[Scummvm-cvs-logs] SF.net SVN: scummvm:[53626] scummvm/trunk/engines/sword25
sev at users.sourceforge.net
sev at users.sourceforge.net
Tue Oct 19 23:03:34 CEST 2010
Revision: 53626
http://scummvm.svn.sourceforge.net/scummvm/?rev=53626&view=rev
Author: sev
Date: 2010-10-19 21:03:33 +0000 (Tue, 19 Oct 2010)
Log Message:
-----------
SWORD25: Enforced code formatting rules in rest of the engine
Modified Paths:
--------------
scummvm/trunk/engines/sword25/fmv/movieplayer.cpp
scummvm/trunk/engines/sword25/fmv/movieplayer_script.cpp
scummvm/trunk/engines/sword25/gfx/animation.cpp
scummvm/trunk/engines/sword25/gfx/animationresource.cpp
scummvm/trunk/engines/sword25/gfx/animationtemplate.cpp
scummvm/trunk/engines/sword25/gfx/dynamicbitmap.cpp
scummvm/trunk/engines/sword25/gfx/fontresource.cpp
scummvm/trunk/engines/sword25/gfx/graphicengine.cpp
scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp
scummvm/trunk/engines/sword25/gfx/image/renderedimage.cpp
scummvm/trunk/engines/sword25/gfx/image/swimage.cpp
scummvm/trunk/engines/sword25/gfx/panel.cpp
scummvm/trunk/engines/sword25/gfx/renderobjectmanager.cpp
scummvm/trunk/engines/sword25/gfx/staticbitmap.cpp
scummvm/trunk/engines/sword25/gfx/text.cpp
scummvm/trunk/engines/sword25/input/inputengine.cpp
scummvm/trunk/engines/sword25/input/inputengine.h
scummvm/trunk/engines/sword25/input/inputengine_script.cpp
scummvm/trunk/engines/sword25/kernel/callbackregistry.cpp
scummvm/trunk/engines/sword25/kernel/callbackregistry.h
scummvm/trunk/engines/sword25/kernel/filesystemutil.cpp
scummvm/trunk/engines/sword25/kernel/filesystemutil.h
scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp
scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h
scummvm/trunk/engines/sword25/kernel/kernel.cpp
scummvm/trunk/engines/sword25/kernel/kernel.h
scummvm/trunk/engines/sword25/kernel/kernel_script.cpp
scummvm/trunk/engines/sword25/kernel/log.cpp
scummvm/trunk/engines/sword25/kernel/log.h
scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.cpp
scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.h
scummvm/trunk/engines/sword25/kernel/persistenceblock.h
scummvm/trunk/engines/sword25/kernel/persistenceservice.cpp
scummvm/trunk/engines/sword25/kernel/persistenceservice.h
scummvm/trunk/engines/sword25/kernel/resmanager.cpp
scummvm/trunk/engines/sword25/kernel/resmanager.h
scummvm/trunk/engines/sword25/kernel/resource.cpp
scummvm/trunk/engines/sword25/kernel/resource.h
scummvm/trunk/engines/sword25/kernel/resservice.h
scummvm/trunk/engines/sword25/kernel/scummvmwindow.cpp
scummvm/trunk/engines/sword25/kernel/scummvmwindow.h
scummvm/trunk/engines/sword25/kernel/service_ids.h
scummvm/trunk/engines/sword25/kernel/string.h
scummvm/trunk/engines/sword25/kernel/window.cpp
scummvm/trunk/engines/sword25/kernel/window.h
scummvm/trunk/engines/sword25/math/geometry_script.cpp
scummvm/trunk/engines/sword25/math/walkregion.cpp
scummvm/trunk/engines/sword25/package/packagemanager.cpp
scummvm/trunk/engines/sword25/package/packagemanager_script.cpp
scummvm/trunk/engines/sword25/script/lua_extensions.cpp
scummvm/trunk/engines/sword25/script/luascript.cpp
scummvm/trunk/engines/sword25/sfx/soundengine.cpp
scummvm/trunk/engines/sword25/sfx/soundengine_script.cpp
scummvm/trunk/engines/sword25/sword25.cpp
Modified: scummvm/trunk/engines/sword25/fmv/movieplayer.cpp
===================================================================
--- scummvm/trunk/engines/sword25/fmv/movieplayer.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/fmv/movieplayer.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -65,11 +65,11 @@
bool MoviePlayer::loadMovie(const Common::String &filename, uint z) {
// Get the file and load it into the decoder
- Common::SeekableReadStream *in = Kernel::GetInstance()->GetPackage()->getStream(filename);
+ Common::SeekableReadStream *in = Kernel::getInstance()->getPackage()->getStream(filename);
_decoder.load(in);
// Ausgabebitmap erstellen
- GraphicEngine *pGfx = Kernel::GetInstance()->GetGfx();
+ GraphicEngine *pGfx = Kernel::getInstance()->getGfx();
#if INDIRECTRENDERING
_outputBitmap = pGfx->getMainPanel()->addDynamicBitmap(_decoder.getWidth(), _decoder.getHeight());
@@ -167,7 +167,7 @@
_outputBitmap->setScaleFactor(scaleFactor);
// Ausgabebitmap auf dem Bildschirm zentrieren
- GraphicEngine *gfxPtr = Kernel::GetInstance()->GetGfx();
+ GraphicEngine *gfxPtr = Kernel::getInstance()->getGfx();
_outputBitmap->setX((gfxPtr->getDisplayWidth() - _outputBitmap->getWidth()) / 2);
_outputBitmap->setY((gfxPtr->getDisplayHeight() - _outputBitmap->getHeight()) / 2);
}
Modified: scummvm/trunk/engines/sword25/fmv/movieplayer_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/fmv/movieplayer_script.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/fmv/movieplayer_script.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -44,7 +44,7 @@
namespace Sword25 {
int loadMovie(lua_State *L) {
- MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
+ MoviePlayer *FMVPtr = Kernel::getInstance()->getFMV();
BS_ASSERT(FMVPtr);
lua_pushbooleancpp(L, FMVPtr->loadMovie(luaL_checkstring(L, 1), lua_gettop(L) == 2 ? static_cast<uint>(luaL_checknumber(L, 2)) : 10));
@@ -53,7 +53,7 @@
}
int unloadMovie(lua_State *L) {
- MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
+ MoviePlayer *FMVPtr = Kernel::getInstance()->getFMV();
BS_ASSERT(FMVPtr);
lua_pushbooleancpp(L, FMVPtr->unloadMovie());
@@ -62,7 +62,7 @@
}
int play(lua_State *L) {
- MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
+ MoviePlayer *FMVPtr = Kernel::getInstance()->getFMV();
BS_ASSERT(FMVPtr);
lua_pushbooleancpp(L, FMVPtr->play());
@@ -71,7 +71,7 @@
}
int pause(lua_State *L) {
- MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
+ MoviePlayer *FMVPtr = Kernel::getInstance()->getFMV();
BS_ASSERT(FMVPtr);
lua_pushbooleancpp(L, FMVPtr->pause());
@@ -80,7 +80,7 @@
}
int update(lua_State *L) {
- MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
+ MoviePlayer *FMVPtr = Kernel::getInstance()->getFMV();
BS_ASSERT(FMVPtr);
FMVPtr->update();
@@ -89,7 +89,7 @@
}
int isMovieLoaded(lua_State *L) {
- MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
+ MoviePlayer *FMVPtr = Kernel::getInstance()->getFMV();
BS_ASSERT(FMVPtr);
lua_pushbooleancpp(L, FMVPtr->isMovieLoaded());
@@ -98,7 +98,7 @@
}
int isPaused(lua_State *L) {
- MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
+ MoviePlayer *FMVPtr = Kernel::getInstance()->getFMV();
BS_ASSERT(FMVPtr);
lua_pushbooleancpp(L, FMVPtr->isPaused());
@@ -107,7 +107,7 @@
}
int getScaleFactor(lua_State *L) {
- MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
+ MoviePlayer *FMVPtr = Kernel::getInstance()->getFMV();
BS_ASSERT(FMVPtr);
lua_pushnumber(L, FMVPtr->getScaleFactor());
@@ -116,7 +116,7 @@
}
int setScaleFactor(lua_State *L) {
- MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
+ MoviePlayer *FMVPtr = Kernel::getInstance()->getFMV();
BS_ASSERT(FMVPtr);
FMVPtr->setScaleFactor(static_cast<float>(luaL_checknumber(L, 1)));
@@ -125,7 +125,7 @@
}
int getTime(lua_State *L) {
- MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
+ MoviePlayer *FMVPtr = Kernel::getInstance()->getFMV();
BS_ASSERT(FMVPtr);
lua_pushnumber(L, FMVPtr->getTime());
@@ -150,7 +150,7 @@
};
bool MoviePlayer::registerScriptBindings() {
- ScriptEngine *pScript = Kernel::GetInstance()->GetScript();
+ ScriptEngine *pScript = Kernel::getInstance()->getScript();
BS_ASSERT(pScript);
lua_State *L = static_cast<lua_State *>(pScript->getScriptObject());
BS_ASSERT(L);
Modified: scummvm/trunk/engines/sword25/gfx/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/animation.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/animation.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -99,8 +99,8 @@
void Animation::initializeAnimationResource(const Common::String &fileName) {
// Die Resource wird f\xFCr die gesamte Lebensdauer des Animations-Objektes gelockt.
- Resource *resourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(fileName);
- if (resourcePtr && resourcePtr->GetType() == Resource::TYPE_ANIMATION)
+ Resource *resourcePtr = Kernel::getInstance()->getResourceManager()->requestResource(fileName);
+ if (resourcePtr && resourcePtr->getType() == Resource::TYPE_ANIMATION)
_animationResourcePtr = static_cast<AnimationResource *>(resourcePtr);
else {
BS_LOG_ERRORLN("The resource \"%s\" could not be requested. The Animation can't be created.", fileName.c_str());
@@ -182,13 +182,13 @@
BS_ASSERT(_currentFrame < animationDescriptionPtr->getFrameCount());
// Bitmap des aktuellen Frames holen
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->getFrame(_currentFrame).fileName);
+ Resource *pResource = Kernel::getInstance()->getResourceManager()->requestResource(animationDescriptionPtr->getFrame(_currentFrame).fileName);
BS_ASSERT(pResource);
- BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
+ BS_ASSERT(pResource->getType() == Resource::TYPE_BITMAP);
BitmapResource *pBitmapResource = static_cast<BitmapResource *>(pResource);
// Framebufferobjekt holen
- GraphicEngine *pGfx = Kernel::GetInstance()->GetGfx();
+ GraphicEngine *pGfx = Kernel::getInstance()->getGfx();
BS_ASSERT(pGfx);
// Bitmap zeichnen
@@ -315,9 +315,9 @@
BS_ASSERT(animationDescriptionPtr);
const AnimationResource::Frame &curFrame = animationDescriptionPtr->getFrame(_currentFrame);
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(curFrame.fileName);
+ Resource *pResource = Kernel::getInstance()->getResourceManager()->requestResource(curFrame.fileName);
BS_ASSERT(pResource);
- BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
+ BS_ASSERT(pResource->getType() == Resource::TYPE_BITMAP);
BitmapResource *pBitmap = static_cast<BitmapResource *>(pResource);
// Gr\xF6\xDFe des Bitmaps auf die Animation \xFCbertragen
@@ -338,7 +338,7 @@
AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
for (uint i = 0; i < animationDescriptionPtr->getFrameCount(); ++i) {
- if (!Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->getFrame(i).fileName)) {
+ if (!Kernel::getInstance()->getResourceManager()->requestResource(animationDescriptionPtr->getFrame(i).fileName)) {
BS_LOG_ERRORLN("Could not lock all animation frames.");
return false;
}
@@ -356,14 +356,14 @@
BS_ASSERT(animationDescriptionPtr);
for (uint i = 0; i < animationDescriptionPtr->getFrameCount(); ++i) {
Resource *pResource;
- if (!(pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->getFrame(i).fileName))) {
+ if (!(pResource = Kernel::getInstance()->getResourceManager()->requestResource(animationDescriptionPtr->getFrame(i).fileName))) {
BS_LOG_ERRORLN("Could not unlock all animation frames.");
return false;
}
// Zwei mal freigeben um den Request von LockAllFrames() und den jetzigen Request aufzuheben
pResource->release();
- if (pResource->GetLockCount())
+ if (pResource->getLockCount())
pResource->release();
}
@@ -524,9 +524,9 @@
BS_ASSERT(animationDescriptionPtr);
const AnimationResource::Frame &curFrame = animationDescriptionPtr->getFrame(_currentFrame);
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(curFrame.fileName);
+ Resource *pResource = Kernel::getInstance()->getResourceManager()->requestResource(curFrame.fileName);
BS_ASSERT(pResource);
- BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
+ BS_ASSERT(pResource->getType() == Resource::TYPE_BITMAP);
BitmapResource *pBitmap = static_cast<BitmapResource *>(pResource);
int result = curFrame.flipV ? - static_cast<int>((pBitmap->getWidth() - 1 - curFrame.hotspotX) * _scaleFactorX) :
@@ -542,9 +542,9 @@
BS_ASSERT(animationDescriptionPtr);
const AnimationResource::Frame &curFrame = animationDescriptionPtr->getFrame(_currentFrame);
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(curFrame.fileName);
+ Resource *pResource = Kernel::getInstance()->getResourceManager()->requestResource(curFrame.fileName);
BS_ASSERT(pResource);
- BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
+ BS_ASSERT(pResource->getType() == Resource::TYPE_BITMAP);
BitmapResource *pBitmap = static_cast<BitmapResource *>(pResource);
int result = curFrame.flipH ? - static_cast<int>((pBitmap->getHeight() - 1 - curFrame.hotspotY) * _scaleFactorY) :
Modified: scummvm/trunk/engines/sword25/gfx/animationresource.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/animationresource.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/animationresource.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -54,7 +54,7 @@
Common::XMLParser(),
_valid(false) {
// Get a pointer to the package manager
- _pPackage = Kernel::GetInstance()->GetPackage();
+ _pPackage = Kernel::getInstance()->getPackage();
BS_ASSERT(_pPackage);
// Switch to the folder the specified Xml fiile is in
@@ -211,7 +211,7 @@
bool AnimationResource::precacheAllFrames() const {
Common::Array<Frame>::const_iterator iter = _frames.begin();
for (; iter != _frames.end(); ++iter) {
- if (!Kernel::GetInstance()->GetResourceManager()->PrecacheResource((*iter).fileName)) {
+ if (!Kernel::getInstance()->getResourceManager()->precacheResource((*iter).fileName)) {
BS_LOG_ERRORLN("Could not precache \"%s\".", (*iter).fileName.c_str());
return false;
}
@@ -232,7 +232,7 @@
Common::Array<Frame>::const_iterator iter = _frames.begin();
for (; iter != _frames.end(); ++iter) {
BitmapResource *pBitmap;
- if (!(pBitmap = static_cast<BitmapResource *>(Kernel::GetInstance()->GetResourceManager()->RequestResource((*iter).fileName)))) {
+ if (!(pBitmap = static_cast<BitmapResource *>(Kernel::getInstance()->getResourceManager()->requestResource((*iter).fileName)))) {
BS_LOG_ERRORLN("Could not request \"%s\".", (*iter).fileName.c_str());
return false;
}
Modified: scummvm/trunk/engines/sword25/gfx/animationtemplate.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/animationtemplate.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/animationtemplate.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -125,9 +125,9 @@
}
AnimationResource *AnimationTemplate::requestSourceAnimation(const Common::String &sourceAnimation) const {
- ResourceManager *RMPtr = Kernel::GetInstance()->GetResourceManager();
+ ResourceManager *RMPtr = Kernel::getInstance()->getResourceManager();
Resource *resourcePtr;
- if (NULL == (resourcePtr = RMPtr->RequestResource(sourceAnimation)) || resourcePtr->GetType() != Resource::TYPE_ANIMATION) {
+ if (NULL == (resourcePtr = RMPtr->requestResource(sourceAnimation)) || resourcePtr->getType() != Resource::TYPE_ANIMATION) {
BS_LOG_ERRORLN("The resource \"%s\" could not be requested or is has an invalid type. The animation template can't be created.", sourceAnimation.c_str());
return 0;
}
Modified: scummvm/trunk/engines/sword25/gfx/dynamicbitmap.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/dynamicbitmap.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/dynamicbitmap.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -77,7 +77,7 @@
bool DynamicBitmap::doRender() {
// Framebufferobjekt holen
- GraphicEngine *pGfx = Kernel::GetInstance()->GetGfx();
+ GraphicEngine *pGfx = Kernel::getInstance()->getGfx();
BS_ASSERT(pGfx);
// Bitmap zeichnen
Modified: scummvm/trunk/engines/sword25/gfx/fontresource.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/fontresource.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/fontresource.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -55,7 +55,7 @@
// Get a pointer to the package manager
BS_ASSERT(_pKernel);
- PackageManager *pPackage = _pKernel->GetPackage();
+ PackageManager *pPackage = _pKernel->getPackage();
BS_ASSERT(pPackage);
// Load the contents of the file
@@ -93,7 +93,7 @@
// Get a reference to the package manager
BS_ASSERT(_pKernel);
- PackageManager *pPackage = _pKernel->GetPackage();
+ PackageManager *pPackage = _pKernel->getPackage();
BS_ASSERT(pPackage);
// Get the full path and filename for the bitmap resource
@@ -104,7 +104,7 @@
}
// Pre-cache the resource
- if (!_pKernel->GetResourceManager()->PrecacheResource(_bitmapFileName)) {
+ if (!_pKernel->getResourceManager()->precacheResource(_bitmapFileName)) {
BS_LOG_ERRORLN("Could not precache \"%s\".", _bitmapFileName.c_str());
}
Modified: scummvm/trunk/engines/sword25/gfx/graphicengine.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/graphicengine.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/graphicengine.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -306,7 +306,7 @@
debug(2, "VectorImage: %s", filename.c_str());
// Pointer auf Package-Manager holen
- PackageManager *pPackage = Kernel::GetInstance()->GetPackage();
+ PackageManager *pPackage = Kernel::getInstance()->getPackage();
BS_ASSERT(pPackage);
// Datei laden
@@ -349,7 +349,7 @@
// Load font
if (filename.hasSuffix("_fnt.xml")) {
- FontResource *pResource = new FontResource(Kernel::GetInstance(), filename);
+ FontResource *pResource = new FontResource(Kernel::getInstance(), filename);
if (pResource->isValid())
return pResource;
else {
@@ -383,7 +383,7 @@
void GraphicEngine::updateLastFrameDuration() {
// Record current time
- const uint currentTime = Kernel::GetInstance()->GetMilliTicks();
+ const uint currentTime = Kernel::getInstance()->getMilliTicks();
// Compute the elapsed time since the last frame and prevent too big ( > 250 msecs) time jumps.
// These can occur when loading save states, during debugging or due to hardware inaccuracies.
Modified: scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -209,9 +209,9 @@
};
static GraphicEngine *getGE() {
- Kernel *pKernel = Kernel::GetInstance();
+ Kernel *pKernel = Kernel::getInstance();
BS_ASSERT(pKernel);
- GraphicEngine *pGE = pKernel->GetGfx();
+ GraphicEngine *pGE = pKernel->getGfx();
BS_ASSERT(pGE);
return pGE;
}
@@ -1039,7 +1039,7 @@
}
static bool animationLoopPointCallback(uint handle) {
- lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
+ lua_State *L = static_cast<lua_State *>(Kernel::getInstance()->getScript()->getScriptObject());
loopPointCallbackPtr->invokeCallbackFunctions(L, handle);
return true;
@@ -1071,7 +1071,7 @@
RenderObjectPtr<Animation> animationPtr(Handle);
if (animationPtr.isValid()) {
actionCallbackPtr->Action = animationPtr->getCurrentAction();
- lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
+ lua_State *L = static_cast<lua_State *>(Kernel::getInstance()->getScript()->getScriptObject());
actionCallbackPtr->invokeCallbackFunctions(L, animationPtr->getHandle());
}
@@ -1101,7 +1101,7 @@
}
static bool animationDeleteCallback(uint Handle) {
- lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
+ lua_State *L = static_cast<lua_State *>(Kernel::getInstance()->getScript()->getScriptObject());
loopPointCallbackPtr->removeAllObjectCallbacks(L, Handle);
return true;
@@ -1268,9 +1268,9 @@
};
bool GraphicEngine::registerScriptBindings() {
- Kernel *pKernel = Kernel::GetInstance();
+ Kernel *pKernel = Kernel::getInstance();
BS_ASSERT(pKernel);
- ScriptEngine *pScript = pKernel->GetScript();
+ ScriptEngine *pScript = pKernel->getScript();
BS_ASSERT(pScript);
lua_State *L = static_cast<lua_State *>(pScript->getScriptObject());
BS_ASSERT(L);
Modified: scummvm/trunk/engines/sword25/gfx/image/renderedimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/renderedimage.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/image/renderedimage.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -56,10 +56,10 @@
_height(0) {
result = false;
- PackageManager *pPackage = Kernel::GetInstance()->GetPackage();
+ PackageManager *pPackage = Kernel::getInstance()->getPackage();
BS_ASSERT(pPackage);
- _backSurface = Kernel::GetInstance()->GetGfx()->getSurface();
+ _backSurface = Kernel::getInstance()->getGfx()->getSurface();
// Datei laden
byte *pFileData;
@@ -103,7 +103,7 @@
_data = new byte[width * height * 4];
Common::set_to(_data, &_data[width * height * 4], 0);
- _backSurface = Kernel::GetInstance()->GetGfx()->getSurface();
+ _backSurface = Kernel::getInstance()->getGfx()->getSurface();
_doCleanup = true;
@@ -112,7 +112,7 @@
}
RenderedImage::RenderedImage() : _width(0), _height(0), _data(0) {
- _backSurface = Kernel::GetInstance()->GetGfx()->getSurface();
+ _backSurface = Kernel::getInstance()->getGfx()->getSurface();
_doCleanup = false;
Modified: scummvm/trunk/engines/sword25/gfx/image/swimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/swimage.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/image/swimage.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -47,7 +47,7 @@
_height(0) {
result = false;
- PackageManager *pPackage = Kernel::GetInstance()->GetPackage();
+ PackageManager *pPackage = Kernel::getInstance()->getPackage();
BS_ASSERT(pPackage);
// Datei laden
Modified: scummvm/trunk/engines/sword25/gfx/panel.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/panel.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/panel.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -77,7 +77,7 @@
if (_color >> 24 == 0)
return true;
- GraphicEngine *gfxPtr = Kernel::GetInstance()->GetGfx();
+ GraphicEngine *gfxPtr = Kernel::getInstance()->getGfx();
BS_ASSERT(gfxPtr);
return gfxPtr->fill(&_bbox, _color);
Modified: scummvm/trunk/engines/sword25/gfx/renderobjectmanager.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/renderobjectmanager.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/renderobjectmanager.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -63,7 +63,7 @@
_frameStarted = true;
// Verstrichene Zeit bestimmen
- int timeElapsed = Kernel::GetInstance()->GetGfx()->getLastFrameDurationMicro();
+ int timeElapsed = Kernel::getInstance()->getGfx()->getLastFrameDurationMicro();
// Alle BS_TimedRenderObject Objekte \xFCber den Framestart und die verstrichene Zeit in Kenntnis setzen
RenderObjectList::iterator iter = _timedRenderObjects.begin();
Modified: scummvm/trunk/engines/sword25/gfx/staticbitmap.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/staticbitmap.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/staticbitmap.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -58,12 +58,12 @@
bool StaticBitmap::initBitmapResource(const Common::String &filename) {
// Bild-Resource laden
- Resource *resourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(filename);
+ Resource *resourcePtr = Kernel::getInstance()->getResourceManager()->requestResource(filename);
if (!resourcePtr) {
BS_LOG_ERRORLN("Could not request resource \"%s\".", filename.c_str());
return false;
}
- if (resourcePtr->GetType() != Resource::TYPE_BITMAP) {
+ if (resourcePtr->getType() != Resource::TYPE_BITMAP) {
BS_LOG_ERRORLN("Requested resource \"%s\" is not a bitmap.", filename.c_str());
return false;
}
@@ -88,13 +88,13 @@
bool StaticBitmap::doRender() {
// Bitmap holen
- Resource *resourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename);
+ Resource *resourcePtr = Kernel::getInstance()->getResourceManager()->requestResource(_resourceFilename);
BS_ASSERT(resourcePtr);
- BS_ASSERT(resourcePtr->GetType() == Resource::TYPE_BITMAP);
+ BS_ASSERT(resourcePtr->getType() == Resource::TYPE_BITMAP);
BitmapResource *bitmapResourcePtr = static_cast<BitmapResource *>(resourcePtr);
// Framebufferobjekt holen
- GraphicEngine *gfxPtr = Kernel::GetInstance()->GetGfx();
+ GraphicEngine *gfxPtr = Kernel::getInstance()->getGfx();
BS_ASSERT(gfxPtr);
// Bitmap zeichnen
@@ -121,8 +121,8 @@
BS_ASSERT(x >= 0 && x < _width);
BS_ASSERT(y >= 0 && y < _height);
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename);
- BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
+ Resource *pResource = Kernel::getInstance()->getResourceManager()->requestResource(_resourceFilename);
+ BS_ASSERT(pResource->getType() == Resource::TYPE_BITMAP);
BitmapResource *pBitmapResource = static_cast<BitmapResource *>(pResource);
uint result = pBitmapResource->getPixel(x, y);
pResource->release();
@@ -135,24 +135,24 @@
}
bool StaticBitmap::isAlphaAllowed() const {
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename);
- BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
+ Resource *pResource = Kernel::getInstance()->getResourceManager()->requestResource(_resourceFilename);
+ BS_ASSERT(pResource->getType() == Resource::TYPE_BITMAP);
bool result = static_cast<BitmapResource *>(pResource)->isAlphaAllowed();
pResource->release();
return result;
}
bool StaticBitmap::isColorModulationAllowed() const {
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename);
- BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
+ Resource *pResource = Kernel::getInstance()->getResourceManager()->requestResource(_resourceFilename);
+ BS_ASSERT(pResource->getType() == Resource::TYPE_BITMAP);
bool result = static_cast<BitmapResource *>(pResource)->isColorModulationAllowed();
pResource->release();
return result;
}
bool StaticBitmap::isScalingAllowed() const {
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename);
- BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
+ Resource *pResource = Kernel::getInstance()->getResourceManager()->requestResource(_resourceFilename);
+ BS_ASSERT(pResource->getType() == Resource::TYPE_BITMAP);
bool result = static_cast<BitmapResource *>(pResource)->isScalingAllowed();
pResource->release();
return result;
Modified: scummvm/trunk/engines/sword25/gfx/text.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/text.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/gfx/text.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -73,7 +73,7 @@
bool Text::setFont(const Common::String &font) {
// Font precachen.
- if (getResourceManager()->PrecacheResource(font)) {
+ if (getResourceManager()->precacheResource(font)) {
_font = font;
updateFormat();
forceRefresh();
@@ -134,12 +134,12 @@
ResourceManager *rmPtr = getResourceManager();
BitmapResource *charMapPtr;
{
- Resource *pResource = rmPtr->RequestResource(fontPtr->getCharactermapFileName());
+ Resource *pResource = rmPtr->requestResource(fontPtr->getCharactermapFileName());
if (!pResource) {
BS_LOG_ERRORLN("Could not request resource \"%s\".", fontPtr->getCharactermapFileName().c_str());
return false;
}
- if (pResource->GetType() != Resource::TYPE_BITMAP) {
+ if (pResource->getType() != Resource::TYPE_BITMAP) {
BS_LOG_ERRORLN("Requested resource \"%s\" is not a bitmap.", fontPtr->getCharactermapFileName().c_str());
return false;
}
@@ -148,7 +148,7 @@
}
// Framebufferobjekt holen.
- GraphicEngine *gfxPtr = Kernel::GetInstance()->GetGfx();
+ GraphicEngine *gfxPtr = Kernel::getInstance()->getGfx();
BS_ASSERT(gfxPtr);
bool result = true;
@@ -187,7 +187,7 @@
ResourceManager *Text::getResourceManager() {
// Pointer auf den Resource-Manager holen.
- return Kernel::GetInstance()->GetResourceManager();
+ return Kernel::getInstance()->getResourceManager();
}
FontResource *Text::lockFontResource() {
@@ -196,12 +196,12 @@
// Font-Resource locken.
FontResource *fontPtr;
{
- Resource *resourcePtr = rmPtr->RequestResource(_font);
+ Resource *resourcePtr = rmPtr->requestResource(_font);
if (!resourcePtr) {
BS_LOG_ERRORLN("Could not request resource \"%s\".", _font.c_str());
return NULL;
}
- if (resourcePtr->GetType() != Resource::TYPE_FONT) {
+ if (resourcePtr->getType() != Resource::TYPE_FONT) {
BS_LOG_ERRORLN("Requested resource \"%s\" is not a font.", _font.c_str());
return NULL;
}
Modified: scummvm/trunk/engines/sword25/input/inputengine.cpp
===================================================================
--- scummvm/trunk/engines/sword25/input/inputengine.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/input/inputengine.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -51,24 +51,24 @@
InputEngine::InputEngine(Kernel *pKernel) :
Service(pKernel),
- m_CurrentState(0),
- m_LeftMouseDown(false),
- m_RightMouseDown(false),
- m_MouseX(0),
- m_MouseY(0),
- m_LeftDoubleClick(false),
- m_DoubleClickTime(DOUBLE_CLICK_TIME),
- m_DoubleClickRectWidth(DOUBLE_CLICK_RECT_SIZE),
- m_DoubleClickRectHeight(DOUBLE_CLICK_RECT_SIZE),
- m_LastLeftClickTime(0),
- m_LastLeftClickMouseX(0),
- m_LastLeftClickMouseY(0) {
- memset(m_KeyboardState[0], 0, sizeof(m_KeyboardState[0]));
- memset(m_KeyboardState[1], 0, sizeof(m_KeyboardState[1]));
- m_LeftMouseState[0] = false;
- m_LeftMouseState[1] = false;
- m_RightMouseState[0] = false;
- m_RightMouseState[1] = false;
+ _currentState(0),
+ _leftMouseDown(false),
+ _rightMouseDown(false),
+ _mouseX(0),
+ _mouseY(0),
+ _leftDoubleClick(false),
+ _doubleClickTime(DOUBLE_CLICK_TIME),
+ _doubleClickRectWidth(DOUBLE_CLICK_RECT_SIZE),
+ _doubleClickRectHeight(DOUBLE_CLICK_RECT_SIZE),
+ _lastLeftClickTime(0),
+ _lastLeftClickMouseX(0),
+ _lastLeftClickMouseY(0) {
+ memset(_keyboardState[0], 0, sizeof(_keyboardState[0]));
+ memset(_keyboardState[1], 0, sizeof(_keyboardState[1]));
+ _leftMouseState[0] = false;
+ _leftMouseState[1] = false;
+ _rightMouseState[0] = false;
+ _rightMouseState[1] = false;
if (!registerScriptBindings())
BS_LOG_ERRORLN("Script bindings could not be registered.");
@@ -80,18 +80,14 @@
return new InputEngine(pKernel);
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::Init() {
+bool InputEngine::init() {
// No initialisation needed
return true;
}
-// -----------------------------------------------------------------------------
-
-void InputEngine::Update() {
+void InputEngine::update() {
Common::Event event;
- m_CurrentState ^= 1;
+ _currentState ^= 1;
// Loop through processing any pending events
bool handleEvents = true;
@@ -99,31 +95,31 @@
switch (event.type) {
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_LBUTTONUP:
- m_LeftMouseDown = event.type == Common::EVENT_LBUTTONDOWN;
- m_MouseX = event.mouse.x;
- m_MouseY = event.mouse.y;
+ _leftMouseDown = event.type == Common::EVENT_LBUTTONDOWN;
+ _mouseX = event.mouse.x;
+ _mouseY = event.mouse.y;
handleEvents = false;
break;
case Common::EVENT_RBUTTONDOWN:
case Common::EVENT_RBUTTONUP:
- m_RightMouseDown = event.type == Common::EVENT_RBUTTONDOWN;
- m_MouseX = event.mouse.x;
- m_MouseY = event.mouse.y;
+ _rightMouseDown = event.type == Common::EVENT_RBUTTONDOWN;
+ _mouseX = event.mouse.x;
+ _mouseY = event.mouse.y;
handleEvents = false;
break;
case Common::EVENT_MOUSEMOVE:
- m_MouseX = event.mouse.x;
- m_MouseY = event.mouse.y;
+ _mouseX = event.mouse.x;
+ _mouseY = event.mouse.y;
break;
case Common::EVENT_KEYDOWN:
case Common::EVENT_KEYUP:
- AlterKeyboardState(event.kbd.keycode, (event.type == Common::EVENT_KEYDOWN) ? 0x80 : 0);
+ alterKeyboardState(event.kbd.keycode, (event.type == Common::EVENT_KEYDOWN) ? 0x80 : 0);
break;
case Common::EVENT_QUIT:
- Kernel::GetInstance()->GetWindow()->SetWindowAlive(false);
+ Kernel::getInstance()->getWindow()->setWindowAlive(false);
break;
default:
@@ -131,125 +127,97 @@
}
}
- m_LeftMouseState[m_CurrentState] = m_LeftMouseDown;
- m_RightMouseState[m_CurrentState] = m_RightMouseDown;
+ _leftMouseState[_currentState] = _leftMouseDown;
+ _rightMouseState[_currentState] = _rightMouseDown;
- TestForLeftDoubleClick();
+ testForLeftDoubleClick();
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::IsLeftMouseDown() {
- return m_LeftMouseDown;
+bool InputEngine::isLeftMouseDown() {
+ return _leftMouseDown;
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::IsRightMouseDown() {
- return m_RightMouseDown;
+bool InputEngine::isRightMouseDown() {
+ return _rightMouseDown;
}
-// -----------------------------------------------------------------------------
+void InputEngine::testForLeftDoubleClick() {
+ _leftDoubleClick = false;
-void InputEngine::TestForLeftDoubleClick() {
- m_LeftDoubleClick = false;
-
// Only bother checking for a double click if the left mouse button was clicked
- if (WasLeftMouseDown()) {
+ if (wasLeftMouseDown()) {
// Get the time now
- uint Now = Kernel::GetInstance()->GetMilliTicks();
+ uint now = Kernel::getInstance()->getMilliTicks();
// A double click is signalled if
// 1. The two clicks are close enough together
// 2. The mouse cursor hasn't moved much
- if (Now - m_LastLeftClickTime <= m_DoubleClickTime &&
- ABS(m_MouseX - m_LastLeftClickMouseX) <= m_DoubleClickRectWidth / 2 &&
- ABS(m_MouseY - m_LastLeftClickMouseY) <= m_DoubleClickRectHeight / 2) {
- m_LeftDoubleClick = true;
+ if (now - _lastLeftClickTime <= _doubleClickTime &&
+ ABS(_mouseX - _lastLeftClickMouseX) <= _doubleClickRectWidth / 2 &&
+ ABS(_mouseY - _lastLeftClickMouseY) <= _doubleClickRectHeight / 2) {
+ _leftDoubleClick = true;
// Reset the time and position of the last click, so that clicking is not
// interpreted as the first click of a further double-click
- m_LastLeftClickTime = 0;
- m_LastLeftClickMouseX = 0;
- m_LastLeftClickMouseY = 0;
+ _lastLeftClickTime = 0;
+ _lastLeftClickMouseX = 0;
+ _lastLeftClickMouseY = 0;
} else {
// There is no double click. Remember the position and time of the click,
// in case it's the first click of a double-click sequence
- m_LastLeftClickTime = Now;
- m_LastLeftClickMouseX = m_MouseX;
- m_LastLeftClickMouseY = m_MouseY;
+ _lastLeftClickTime = now;
+ _lastLeftClickMouseX = _mouseX;
+ _lastLeftClickMouseY = _mouseY;
}
}
}
-// -----------------------------------------------------------------------------
-
-void InputEngine::AlterKeyboardState(int keycode, byte newState) {
- m_KeyboardState[m_CurrentState][keycode] = newState;
+void InputEngine::alterKeyboardState(int keycode, byte newState) {
+ _keyboardState[_currentState][keycode] = newState;
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::IsLeftDoubleClick() {
- return m_LeftDoubleClick;
+bool InputEngine::isLeftDoubleClick() {
+ return _leftDoubleClick;
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::WasLeftMouseDown() {
- return (m_LeftMouseState[m_CurrentState] == false) && (m_LeftMouseState[m_CurrentState ^ 1] == true);
+bool InputEngine::wasLeftMouseDown() {
+ return (_leftMouseState[_currentState] == false) && (_leftMouseState[_currentState ^ 1] == true);
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::WasRightMouseDown() {
- return (m_RightMouseState[m_CurrentState] == false) && (m_RightMouseState[m_CurrentState ^ 1] == true);
+bool InputEngine::wasRightMouseDown() {
+ return (_rightMouseState[_currentState] == false) && (_rightMouseState[_currentState ^ 1] == true);
}
-// -----------------------------------------------------------------------------
-
-int InputEngine::GetMouseX() {
- return m_MouseX;
+int InputEngine::getMouseX() {
+ return _mouseX;
}
-// -----------------------------------------------------------------------------
-
-int InputEngine::GetMouseY() {
- return m_MouseY;
+int InputEngine::getMouseY() {
+ return _mouseY;
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::IsKeyDown(uint KeyCode) {
- return (m_KeyboardState[m_CurrentState][KeyCode] & 0x80) != 0;
+bool InputEngine::isKeyDown(uint keyCode) {
+ return (_keyboardState[_currentState][keyCode] & 0x80) != 0;
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::WasKeyDown(uint KeyCode) {
- return ((m_KeyboardState[m_CurrentState][KeyCode] & 0x80) == 0) &&
- ((m_KeyboardState[m_CurrentState ^ 1][KeyCode] & 0x80) != 0);
+bool InputEngine::wasKeyDown(uint keyCode) {
+ return ((_keyboardState[_currentState][keyCode] & 0x80) == 0) &&
+ ((_keyboardState[_currentState ^ 1][keyCode] & 0x80) != 0);
}
-// -----------------------------------------------------------------------------
-
-void InputEngine::SetMouseX(int PosX) {
- m_MouseX = PosX;
- g_system->warpMouse(m_MouseX, m_MouseY);
+void InputEngine::setMouseX(int posX) {
+ _mouseX = posX;
+ g_system->warpMouse(_mouseX, _mouseY);
}
-// -----------------------------------------------------------------------------
-
-void InputEngine::SetMouseY(int PosY) {
- m_MouseY = PosY;
- g_system->warpMouse(m_MouseX, m_MouseY);
+void InputEngine::setMouseY(int posY) {
+ _mouseY = posY;
+ g_system->warpMouse(_mouseX, _mouseY);
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::RegisterCharacterCallback(CharacterCallback Callback) {
- if (Common::find(m_CharacterCallbacks.begin(), m_CharacterCallbacks.end(), Callback) == m_CharacterCallbacks.end()) {
- m_CharacterCallbacks.push_back(Callback);
+bool InputEngine::registerCharacterCallback(CharacterCallback callback) {
+ if (Common::find(_characterCallbacks.begin(), _characterCallbacks.end(), callback) == _characterCallbacks.end()) {
+ _characterCallbacks.push_back(callback);
return true;
} else {
BS_LOG_WARNINGLN("Tried to register an CharacterCallback that was already registered.");
@@ -257,13 +225,11 @@
}
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::UnregisterCharacterCallback(CharacterCallback Callback) {
- Common::List<CharacterCallback>::iterator CallbackIter = Common::find(m_CharacterCallbacks.begin(),
- m_CharacterCallbacks.end(), Callback);
- if (CallbackIter != m_CharacterCallbacks.end()) {
- m_CharacterCallbacks.erase(CallbackIter);
+bool InputEngine::unregisterCharacterCallback(CharacterCallback callback) {
+ Common::List<CharacterCallback>::iterator callbackIter = Common::find(_characterCallbacks.begin(),
+ _characterCallbacks.end(), callback);
+ if (callbackIter != _characterCallbacks.end()) {
+ _characterCallbacks.erase(callbackIter);
return true;
} else {
BS_LOG_WARNINGLN("Tried to unregister an CharacterCallback that was not previously registered.");
@@ -271,11 +237,9 @@
}
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::RegisterCommandCallback(CommandCallback Callback) {
- if (Common::find(m_CommandCallbacks.begin(), m_CommandCallbacks.end(), Callback) == m_CommandCallbacks.end()) {
- m_CommandCallbacks.push_back(Callback);
+bool InputEngine::registerCommandCallback(CommandCallback callback) {
+ if (Common::find(_commandCallbacks.begin(), _commandCallbacks.end(), callback) == _commandCallbacks.end()) {
+ _commandCallbacks.push_back(callback);
return true;
} else {
BS_LOG_WARNINGLN("Tried to register an CommandCallback that was already registered.");
@@ -283,13 +247,11 @@
}
}
-// -----------------------------------------------------------------------------
-
-bool InputEngine::UnregisterCommandCallback(CommandCallback Callback) {
- Common::List<CommandCallback>::iterator CallbackIter =
- Common::find(m_CommandCallbacks.begin(), m_CommandCallbacks.end(), Callback);
- if (CallbackIter != m_CommandCallbacks.end()) {
- m_CommandCallbacks.erase(CallbackIter);
+bool InputEngine::unregisterCommandCallback(CommandCallback callback) {
+ Common::List<CommandCallback>::iterator callbackIter =
+ Common::find(_commandCallbacks.begin(), _commandCallbacks.end(), callback);
+ if (callbackIter != _commandCallbacks.end()) {
+ _commandCallbacks.erase(callbackIter);
return true;
} else {
BS_LOG_WARNINGLN("Tried to unregister an CommandCallback that was not previously registered.");
@@ -297,60 +259,52 @@
}
}
-// -----------------------------------------------------------------------------
-
-void InputEngine::ReportCharacter(byte Character) {
- Common::List<CharacterCallback>::const_iterator CallbackIter = m_CharacterCallbacks.begin();
- while (CallbackIter != m_CharacterCallbacks.end()) {
+void InputEngine::reportCharacter(byte character) {
+ Common::List<CharacterCallback>::const_iterator callbackIter = _characterCallbacks.begin();
+ while (callbackIter != _characterCallbacks.end()) {
// Iterator vor dem Aufruf erhöhen und im Folgendem auf einer Kopie arbeiten.
// Dieses Vorgehen ist notwendig da der Iterator möglicherweise von der Callbackfunktion durch das Deregistrieren des Callbacks
// invalidiert wird.
- Common::List<CharacterCallback>::const_iterator CurCallbackIter = CallbackIter;
- ++CallbackIter;
+ Common::List<CharacterCallback>::const_iterator curCallbackIter = callbackIter;
+ ++callbackIter;
- (*CurCallbackIter)(Character);
+ (*curCallbackIter)(character);
}
}
-// -----------------------------------------------------------------------------
-
-void InputEngine::ReportCommand(KEY_COMMANDS Command) {
- Common::List<CommandCallback>::const_iterator CallbackIter = m_CommandCallbacks.begin();
- while (CallbackIter != m_CommandCallbacks.end()) {
+void InputEngine::reportCommand(KEY_COMMANDS command) {
+ Common::List<CommandCallback>::const_iterator callbackIter = _commandCallbacks.begin();
+ while (callbackIter != _commandCallbacks.end()) {
// Iterator vor dem Aufruf erhöhen und im Folgendem auf einer Kopie arbeiten.
// Dieses Vorgehen ist notwendig da der Iterator möglicherweise von der Callbackfunktion durch das Deregistrieren des Callbacks
// invalidiert wird.
- Common::List<CommandCallback>::const_iterator CurCallbackIter = CallbackIter;
- ++CallbackIter;
+ Common::List<CommandCallback>::const_iterator curCallbackIter = callbackIter;
+ ++callbackIter;
- (*CurCallbackIter)(Command);
+ (*curCallbackIter)(command);
}
}
-// -----------------------------------------------------------------------------
-// Persistenz
-// -----------------------------------------------------------------------------
-
bool InputEngine::persist(OutputPersistenceBlock &writer) {
// Anzahl an Command-Callbacks persistieren.
- writer.write(m_CommandCallbacks.size());
+ writer.write(_commandCallbacks.size());
// Alle Command-Callbacks einzeln persistieren.
{
- Common::List<CommandCallback>::const_iterator It = m_CommandCallbacks.begin();
- while (It != m_CommandCallbacks.end()) {
+ Common::List<CommandCallback>::const_iterator It = _commandCallbacks.begin();
+ while (It != _commandCallbacks.end()) {
writer.write(CallbackRegistry::instance().resolveCallbackPointer(*It));
++It;
}
}
// Anzahl an Character-Callbacks persistieren.
- writer.write(m_CharacterCallbacks.size());
+ writer.write(_characterCallbacks.size());
// Alle Character-Callbacks einzeln persistieren.
{
- Common::List<CharacterCallback>::const_iterator It = m_CharacterCallbacks.begin();
- while (It != m_CharacterCallbacks.end()) {
+ Common::List<CharacterCallback>::const_iterator It = _characterCallbacks.begin();
+ while (It != _characterCallbacks.end()) {
writer.write(CallbackRegistry::instance().resolveCallbackPointer(*It));
++It;
}
@@ -359,38 +313,36 @@
return true;
}
-// -----------------------------------------------------------------------------
-
bool InputEngine::unpersist(InputPersistenceBlock &reader) {
// Command-Callbackliste leeren.
- m_CommandCallbacks.clear();
+ _commandCallbacks.clear();
// Anzahl an Command-Callbacks lesen.
- uint CommandCallbackCount;
- reader.read(CommandCallbackCount);
+ uint commandCallbackCount;
+ reader.read(commandCallbackCount);
// Alle Command-Callbacks wieder herstellen.
- for (uint i = 0; i < CommandCallbackCount; ++i) {
- Common::String CallbackFunctionName;
- reader.read(CallbackFunctionName);
+ for (uint i = 0; i < commandCallbackCount; ++i) {
+ Common::String callbackFunctionName;
+ reader.read(callbackFunctionName);
- m_CommandCallbacks.push_back(reinterpret_cast<CommandCallback>(
- CallbackRegistry::instance().resolveCallbackFunction(CallbackFunctionName)));
+ _commandCallbacks.push_back(reinterpret_cast<CommandCallback>(
+ CallbackRegistry::instance().resolveCallbackFunction(callbackFunctionName)));
}
// Character-Callbackliste leeren.
- m_CharacterCallbacks.clear();
+ _characterCallbacks.clear();
// Anzahl an Character-Callbacks lesen.
- uint CharacterCallbackCount;
- reader.read(CharacterCallbackCount);
+ uint characterCallbackCount;
+ reader.read(characterCallbackCount);
// Alle Character-Callbacks wieder herstellen.
- for (uint i = 0; i < CharacterCallbackCount; ++i) {
- Common::String CallbackFunctionName;
- reader.read(CallbackFunctionName);
+ for (uint i = 0; i < characterCallbackCount; ++i) {
+ Common::String callbackFunctionName;
+ reader.read(callbackFunctionName);
- m_CharacterCallbacks.push_back(reinterpret_cast<CharacterCallback>(CallbackRegistry::instance().resolveCallbackFunction(CallbackFunctionName)));
+ _characterCallbacks.push_back(reinterpret_cast<CharacterCallback>(CallbackRegistry::instance().resolveCallbackFunction(callbackFunctionName)));
}
return reader.isGood();
Modified: scummvm/trunk/engines/sword25/input/inputengine.h
===================================================================
--- scummvm/trunk/engines/sword25/input/inputengine.h 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/input/inputengine.h 2010-10-19 21:03:33 UTC (rev 53626)
@@ -45,7 +45,6 @@
#ifndef SWORD25_INPUTENGINE_H
#define SWORD25_INPUTENGINE_H
-/// Includes
#include "sword25/kernel/common.h"
#include "sword25/kernel/service.h"
#include "sword25/kernel/persistable.h"
@@ -176,7 +175,7 @@
* Initialises the input engine
* @return Returns a true on success, otherwise false.
*/
- bool Init();
+ bool init();
/**
* Performs a "tick" of the input engine.
@@ -185,17 +184,17 @@
* of the input engine that are not running in their own thread, or to perform
* additional administrative tasks that are needed.
*/
- void Update();
+ void update();
/**
* Returns true if the left mouse button is pressed
*/
- bool IsLeftMouseDown();
+ bool isLeftMouseDown();
/**
* Returns true if the right mouse button is pressed.
*/
- bool IsRightMouseDown();
+ bool isRightMouseDown();
/**
* Returns true if the left mouse button was pressed and released.
@@ -203,7 +202,7 @@
* The difference between this and IsLeftMouseDown() is that this only returns
* true when the left mouse button is released.
*/
- bool WasLeftMouseDown();
+ bool wasLeftMouseDown();
/**
* Returns true if the right mouse button was pressed and released.
@@ -211,39 +210,39 @@
* The difference between this and IsRightMouseDown() is that this only returns
* true when the right mouse button is released.
*/
- bool WasRightMouseDown();
+ bool wasRightMouseDown();
/**
* Returns true if the left mouse button double click was done
*/
- bool IsLeftDoubleClick();
+ bool isLeftDoubleClick();
/**
* Returns the X position of the cursor in pixels
*/
- int GetMouseX();
+ int getMouseX();
/**
* Returns the Y position of the cursor in pixels
*/
- int GetMouseY();
+ int getMouseY();
/**
* Sets the X position of the cursor in pixels
*/
- void SetMouseX(int PosX);
+ void setMouseX(int posX);
/**
* Sets the Y position of the cursor in pixels
*/
- void SetMouseY(int PosY);
+ void setMouseY(int posY);
/**
* Returns true if a given key was pressed
* @param KeyCode The key code to be checked
* @return Returns true if the given key is done, otherwise false.
*/
- bool IsKeyDown(uint KeyCode);
+ bool isKeyDown(uint keyCode);
/**
* Returns true if a certain key was pushed and released.
@@ -253,7 +252,7 @@
* strings that users type.
* @param KeyCode The key code to be checked
*/
- bool WasKeyDown(uint KeyCode);
+ bool wasKeyDown(uint keyCode);
typedef CallbackPtr CharacterCallback;
@@ -269,13 +268,13 @@
* The input of strings by the user through use of callbacks should be implemented.
* @return Returns true if the function was registered, otherwise false.
*/
- bool RegisterCharacterCallback(CallbackPtr Callback);
+ bool registerCharacterCallback(CallbackPtr callback);
/**
* De-registeres a previously registered callback function.
* @return Returns true if the function could be de-registered, otherwise false.
*/
- bool UnregisterCharacterCallback(CallbackPtr Callback);
+ bool unregisterCharacterCallback(CallbackPtr callback);
typedef CallbackPtr CommandCallback;
@@ -288,16 +287,16 @@
* The input of strings by the user through the use of callbacks should be implemented.
* @return Returns true if the function was registered, otherwise false.
*/
- bool RegisterCommandCallback(CallbackPtr Callback);
+ bool registerCommandCallback(CallbackPtr callback);
/**
* Un-register a callback function for the input of commands that can have an influence on the string input.
* @return Returns true if the function could be de-registered, otherwise false.
*/
- bool UnregisterCommandCallback(CommandCallback Callback);
+ bool unregisterCommandCallback(CommandCallback callback);
- void ReportCharacter(byte Character);
- void ReportCommand(KEY_COMMANDS Command);
+ void reportCharacter(byte character);
+ void reportCommand(KEY_COMMANDS command);
bool persist(OutputPersistenceBlock &writer);
bool unpersist(InputPersistenceBlock &reader);
@@ -306,26 +305,26 @@
bool registerScriptBindings();
private:
- void TestForLeftDoubleClick();
- void AlterKeyboardState(int keycode, byte newState);
+ void testForLeftDoubleClick();
+ void alterKeyboardState(int keycode, byte newState);
- byte m_KeyboardState[2][256];
- bool m_LeftMouseState[2];
- bool m_RightMouseState[2];
- uint m_CurrentState;
- int m_MouseX;
- int m_MouseY;
- bool m_LeftMouseDown;
- bool m_RightMouseDown;
- bool m_LeftDoubleClick;
- uint m_DoubleClickTime;
- int m_DoubleClickRectWidth;
- int m_DoubleClickRectHeight;
- uint m_LastLeftClickTime;
- int m_LastLeftClickMouseX;
- int m_LastLeftClickMouseY;
- Common::List<CommandCallback> m_CommandCallbacks;
- Common::List<CharacterCallback> m_CharacterCallbacks;
+ byte _keyboardState[2][256];
+ bool _leftMouseState[2];
+ bool _rightMouseState[2];
+ uint _currentState;
+ int _mouseX;
+ int _mouseY;
+ bool _leftMouseDown;
+ bool _rightMouseDown;
+ bool _leftDoubleClick;
+ uint _doubleClickTime;
+ int _doubleClickRectWidth;
+ int _doubleClickRectHeight;
+ uint _lastLeftClickTime;
+ int _lastLeftClickMouseX;
+ int _lastLeftClickMouseY;
+ Common::List<CommandCallback> _commandCallbacks;
+ Common::List<CharacterCallback> _characterCallbacks;
};
} // End of namespace Sword25
Modified: scummvm/trunk/engines/sword25/input/inputengine_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/input/inputengine_script.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/input/inputengine_script.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -32,10 +32,6 @@
*
*/
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "common/ptr.h"
#include "common/str.h"
#include "sword25/kernel/common.h"
@@ -51,268 +47,218 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Callback-Objekte
-// -----------------------------------------------------------------------------
+static void theCharacterCallback(int character);
+static void theCommandCallback(int command);
-static void TheCharacterCallback(int Character);
-static void TheCommandCallback(int Command);
-
namespace {
class CharacterCallbackClass : public LuaCallback {
public:
CharacterCallbackClass(lua_State *L) : LuaCallback(L) {}
- Common::String Character;
+ Common::String _character;
protected:
int PreFunctionInvokation(lua_State *L) {
- lua_pushstring(L, Character.c_str());
+ lua_pushstring(L, _character.c_str());
return 1;
}
};
-Common::SharedPtr<CharacterCallbackClass> CharacterCallbackPtr;
+Common::SharedPtr<CharacterCallbackClass> characterCallbackPtr;
-// -----------------------------------------------------------------------------
-
class CommandCallbackClass : public LuaCallback {
public:
CommandCallbackClass(lua_State *L) : LuaCallback(L) {
- Command = InputEngine::KEY_COMMAND_BACKSPACE;
+ _command = InputEngine::KEY_COMMAND_BACKSPACE;
}
- InputEngine::KEY_COMMANDS Command;
+ InputEngine::KEY_COMMANDS _command;
protected:
- int PreFunctionInvokation(lua_State *L) {
- lua_pushnumber(L, Command);
+ int preFunctionInvokation(lua_State *L) {
+ lua_pushnumber(L, _command);
return 1;
}
};
-Common::SharedPtr<CommandCallbackClass> CommandCallbackPtr;
+Common::SharedPtr<CommandCallbackClass> commandCallbackPtr;
-// -------------------------------------------------------------------------
-
struct CallbackfunctionRegisterer {
CallbackfunctionRegisterer() {
- CallbackRegistry::instance().registerCallbackFunction("LuaCommandCB", TheCommandCallback);
- CallbackRegistry::instance().registerCallbackFunction("LuaCharacterCB", TheCharacterCallback);
+ CallbackRegistry::instance().registerCallbackFunction("LuaCommandCB", theCommandCallback);
+ CallbackRegistry::instance().registerCallbackFunction("LuaCharacterCB", theCharacterCallback);
}
};
-static CallbackfunctionRegisterer Instance;
+static CallbackfunctionRegisterer instance;
}
-// -----------------------------------------------------------------------------
-
-static InputEngine *GetIE() {
- Kernel *pKernel = Kernel::GetInstance();
+static InputEngine *getIE() {
+ Kernel *pKernel = Kernel::getInstance();
BS_ASSERT(pKernel);
- InputEngine *pIE = pKernel->GetInput();
+ InputEngine *pIE = pKernel->getInput();
BS_ASSERT(pIE);
return pIE;
}
-// -----------------------------------------------------------------------------
+static int init(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int Init(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- lua_pushbooleancpp(L, pIE->Init());
+ lua_pushbooleancpp(L, pIE->init());
return 1;
}
-// -----------------------------------------------------------------------------
+static int update(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int Update(lua_State *L) {
- InputEngine *pIE = GetIE();
-
// Beim ersten Aufruf der Update()-Methode werden die beiden Callbacks am Input-Objekt registriert.
// Dieses kann nicht in _RegisterScriptBindings() passieren, da diese Funktion vom Konstruktor der abstrakten Basisklasse aufgerufen wird und die
// Register...()-Methoden abstrakt sind, im Konstruktor der Basisklasse also nicht aufgerufen werden k\xF6nnen.
- static bool FirstCall = true;
- if (FirstCall) {
- FirstCall = false;
- pIE->RegisterCharacterCallback(TheCharacterCallback);
- pIE->RegisterCommandCallback(TheCommandCallback);
+ static bool firstCall = true;
+ if (firstCall) {
+ firstCall = false;
+ pIE->registerCharacterCallback(theCharacterCallback);
+ pIE->registerCommandCallback(theCommandCallback);
}
- pIE->Update();
+ pIE->update();
return 0;
}
-// -----------------------------------------------------------------------------
+static int isLeftMouseDown(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int IsLeftMouseDown(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- lua_pushbooleancpp(L, pIE->IsLeftMouseDown());
+ lua_pushbooleancpp(L, pIE->isLeftMouseDown());
return 1;
}
-// -----------------------------------------------------------------------------
+static int isRightMouseDown(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int IsRightMouseDown(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- lua_pushbooleancpp(L, pIE->IsRightMouseDown());
+ lua_pushbooleancpp(L, pIE->isRightMouseDown());
return 1;
}
-// -----------------------------------------------------------------------------
+static int wasLeftMouseDown(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int WasLeftMouseDown(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- lua_pushbooleancpp(L, pIE->WasLeftMouseDown());
+ lua_pushbooleancpp(L, pIE->wasLeftMouseDown());
return 1;
}
-// -----------------------------------------------------------------------------
+static int wasRightMouseDown(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int WasRightMouseDown(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- lua_pushbooleancpp(L, pIE->WasRightMouseDown());
+ lua_pushbooleancpp(L, pIE->wasRightMouseDown());
return 1;
}
-// -----------------------------------------------------------------------------
+static int isLeftDoubleClick(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int IsLeftDoubleClick(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- lua_pushbooleancpp(L, pIE->IsLeftDoubleClick());
+ lua_pushbooleancpp(L, pIE->isLeftDoubleClick());
return 1;
}
-// -----------------------------------------------------------------------------
+static int getMouseX(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int GetMouseX(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- lua_pushnumber(L, pIE->GetMouseX());
+ lua_pushnumber(L, pIE->getMouseX());
return 1;
}
-// -----------------------------------------------------------------------------
+static int getMouseY(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int GetMouseY(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- lua_pushnumber(L, pIE->GetMouseY());
+ lua_pushnumber(L, pIE->getMouseY());
return 1;
}
-// -----------------------------------------------------------------------------
+static int isKeyDown(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int IsKeyDown(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- lua_pushbooleancpp(L, pIE->IsKeyDown((uint) luaL_checknumber(L, 1)));
+ lua_pushbooleancpp(L, pIE->isKeyDown((uint)luaL_checknumber(L, 1)));
return 1;
}
-// -----------------------------------------------------------------------------
+static int wasKeyDown(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int WasKeyDown(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- lua_pushbooleancpp(L, pIE->WasKeyDown((uint) luaL_checknumber(L, 1)));
+ lua_pushbooleancpp(L, pIE->wasKeyDown((uint)luaL_checknumber(L, 1)));
return 1;
}
-// -----------------------------------------------------------------------------
+static int setMouseX(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int SetMouseX(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- pIE->SetMouseX((int) luaL_checknumber(L, 1));
+ pIE->setMouseX((int)luaL_checknumber(L, 1));
return 0;
}
-// -----------------------------------------------------------------------------
+static int setMouseY(lua_State *L) {
+ InputEngine *pIE = getIE();
-static int SetMouseY(lua_State *L) {
- InputEngine *pIE = GetIE();
-
- pIE->SetMouseY((int) luaL_checknumber(L, 1));
+ pIE->setMouseY((int)luaL_checknumber(L, 1));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static void TheCharacterCallback(int Character) {
- CharacterCallbackPtr->Character = static_cast<byte>(Character);
- lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
- CharacterCallbackPtr->invokeCallbackFunctions(L, 1);
+static void theCharacterCallback(int character) {
+ characterCallbackPtr->_character = static_cast<byte>(character);
+ lua_State *L = static_cast<lua_State *>(Kernel::getInstance()->getScript()->getScriptObject());
+ characterCallbackPtr->invokeCallbackFunctions(L, 1);
}
-// -----------------------------------------------------------------------------
-
-static int RegisterCharacterCallback(lua_State *L) {
+static int registerCharacterCallback(lua_State *L) {
luaL_checktype(L, 1, LUA_TFUNCTION);
- CharacterCallbackPtr->registerCallbackFunction(L, 1);
+ characterCallbackPtr->registerCallbackFunction(L, 1);
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int UnregisterCharacterCallback(lua_State *L) {
+static int unregisterCharacterCallback(lua_State *L) {
luaL_checktype(L, 1, LUA_TFUNCTION);
- CharacterCallbackPtr->unregisterCallbackFunction(L, 1);
+ characterCallbackPtr->unregisterCallbackFunction(L, 1);
return 0;
}
-// -----------------------------------------------------------------------------
-
-static void TheCommandCallback(int Command) {
- CommandCallbackPtr->Command = static_cast<InputEngine::KEY_COMMANDS>(Command);
- lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
- CommandCallbackPtr->invokeCallbackFunctions(L, 1);
+static void theCommandCallback(int command) {
+ commandCallbackPtr->_command = static_cast<InputEngine::KEY_COMMANDS>(command);
+ lua_State *L = static_cast<lua_State *>(Kernel::getInstance()->getScript()->getScriptObject());
+ commandCallbackPtr->invokeCallbackFunctions(L, 1);
}
-// -----------------------------------------------------------------------------
-
-static int RegisterCommandCallback(lua_State *L) {
+static int registerCommandCallback(lua_State *L) {
luaL_checktype(L, 1, LUA_TFUNCTION);
- CommandCallbackPtr->registerCallbackFunction(L, 1);
+ commandCallbackPtr->registerCallbackFunction(L, 1);
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int UnregisterCommandCallback(lua_State *L) {
+static int unregisterCommandCallback(lua_State *L) {
luaL_checktype(L, 1, LUA_TFUNCTION);
- CommandCallbackPtr->unregisterCallbackFunction(L, 1);
+ commandCallbackPtr->unregisterCallbackFunction(L, 1);
return 0;
}
-// -----------------------------------------------------------------------------
-
static const char *PACKAGE_LIBRARY_NAME = "Input";
static const luaL_reg PACKAGE_FUNCTIONS[] = {
- {"Init", Init},
- {"Update", Update},
- {"IsLeftMouseDown", IsLeftMouseDown},
- {"IsRightMouseDown", IsRightMouseDown},
- {"WasLeftMouseDown", WasLeftMouseDown},
- {"WasRightMouseDown", WasRightMouseDown},
- {"IsLeftDoubleClick", IsLeftDoubleClick},
- {"GetMouseX", GetMouseX},
- {"GetMouseY", GetMouseY},
- {"SetMouseX", SetMouseX},
- {"SetMouseY", SetMouseY},
- {"IsKeyDown", IsKeyDown},
- {"WasKeyDown", WasKeyDown},
- {"RegisterCharacterCallback", RegisterCharacterCallback},
- {"UnregisterCharacterCallback", UnregisterCharacterCallback},
- {"RegisterCommandCallback", RegisterCommandCallback},
- {"UnregisterCommandCallback", UnregisterCommandCallback},
+ {"Init", init},
+ {"Update", update},
+ {"IsLeftMouseDown", isLeftMouseDown},
+ {"IsRightMouseDown", isRightMouseDown},
+ {"WasLeftMouseDown", wasLeftMouseDown},
+ {"WasRightMouseDown", wasRightMouseDown},
+ {"IsLeftDoubleClick", isLeftDoubleClick},
+ {"GetMouseX", getMouseX},
+ {"GetMouseY", getMouseY},
+ {"SetMouseX", setMouseX},
+ {"SetMouseY", setMouseY},
+ {"IsKeyDown", isKeyDown},
+ {"WasKeyDown", wasKeyDown},
+ {"RegisterCharacterCallback", registerCharacterCallback},
+ {"UnregisterCharacterCallback", unregisterCharacterCallback},
+ {"RegisterCommandCallback", registerCommandCallback},
+ {"UnregisterCommandCallback", unregisterCommandCallback},
{0, 0}
};
@@ -334,9 +280,9 @@
// -----------------------------------------------------------------------------
bool InputEngine::registerScriptBindings() {
- Kernel *pKernel = Kernel::GetInstance();
+ Kernel *pKernel = Kernel::getInstance();
BS_ASSERT(pKernel);
- ScriptEngine *pScript = pKernel->GetScript();
+ ScriptEngine *pScript = pKernel->getScript();
BS_ASSERT(pScript);
lua_State *L = static_cast<lua_State *>(pScript->getScriptObject());
BS_ASSERT(L);
@@ -344,8 +290,8 @@
if (!LuaBindhelper::addFunctionsToLib(L, PACKAGE_LIBRARY_NAME, PACKAGE_FUNCTIONS)) return false;
if (!LuaBindhelper::addConstantsToLib(L, PACKAGE_LIBRARY_NAME, PACKAGE_CONSTANTS)) return false;
- CharacterCallbackPtr = Common::SharedPtr<CharacterCallbackClass>(new CharacterCallbackClass(L));
- CommandCallbackPtr = Common::SharedPtr<CommandCallbackClass>(new CommandCallbackClass(L));
+ characterCallbackPtr = Common::SharedPtr<CharacterCallbackClass>(new CharacterCallbackClass(L));
+ commandCallbackPtr = Common::SharedPtr<CommandCallbackClass>(new CommandCallbackClass(L));
return true;
}
Modified: scummvm/trunk/engines/sword25/kernel/callbackregistry.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/callbackregistry.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/kernel/callbackregistry.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -44,22 +44,12 @@
// Pointer gespeichert war, st\xFCrtzt das Programm beim \xC4ufrufen dieser Callbackfunktion ab. Durch das Aufl\xF6sungverfahren wird beim Laden der
// Callbackbezeichner in den neuen Funktionspointer umgewandelt und der Aufruf kann erfolgen.
-// -----------------------------------------------------------------------------
-// Logging
-// -----------------------------------------------------------------------------
-
#define BS_LOG_PREFIX "CALLBACKREGISTRY"
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/callbackregistry.h"
namespace Sword25 {
-// -----------------------------------------------------------------------------
-
bool CallbackRegistry::registerCallbackFunction(const Common::String &name, CallbackPtr ptr) {
if (name == "") {
BS_LOG_ERRORLN("The empty string is not allowed as a callback function name.");
@@ -80,8 +70,6 @@
return true;
}
-// -----------------------------------------------------------------------------
-
CallbackPtr CallbackRegistry::resolveCallbackFunction(const Common::String &name) const {
CallbackPtr result = findPtrByName(name);
@@ -92,8 +80,6 @@
return result;
}
-// -----------------------------------------------------------------------------
-
Common::String CallbackRegistry::resolveCallbackPointer(CallbackPtr ptr) const {
const Common::String &result = findNameByPtr(ptr);
@@ -104,24 +90,18 @@
return result;
}
-// -----------------------------------------------------------------------------
-
CallbackPtr CallbackRegistry::findPtrByName(const Common::String &name) const {
// Eintrag in der Map finden und den Pointer zur\xFCckgeben.
NameToPtrMap::const_iterator it = _nameToPtrMap.find(name);
return it == _nameToPtrMap.end() ? 0 : it->_value;
}
-// -----------------------------------------------------------------------------
-
Common::String CallbackRegistry::findNameByPtr(CallbackPtr ptr) const {
// Eintrag in der Map finden und den Namen zur\xFCckgeben.
PtrToNameMap::const_iterator it = _ptrToNameMap.find(ptr);
return it == _ptrToNameMap.end() ? "" : it->_value;
}
-// -----------------------------------------------------------------------------
-
void CallbackRegistry::storeCallbackFunction(const Common::String &name, CallbackPtr ptr) {
// Callback-Funktion in beide Maps eintragen.
_nameToPtrMap[name] = ptr;
Modified: scummvm/trunk/engines/sword25/kernel/callbackregistry.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/callbackregistry.h 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/kernel/callbackregistry.h 2010-10-19 21:03:33 UTC (rev 53626)
@@ -35,10 +35,6 @@
#ifndef SWORD25_CALLBACK_REGISTRY_H
#define SWORD25_CALLBACK_REGISTRY_H
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "common/scummsys.h"
#include "common/str.h"
#include "common/hash-str.h"
@@ -47,10 +43,6 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Klassendeklaration
-// -----------------------------------------------------------------------------
-
typedef void (*CallbackPtr)(int command);
class CallbackRegistry {
@@ -60,9 +52,9 @@
return _instance;
}
- bool registerCallbackFunction(const Common::String &name, CallbackPtr ptr);
- CallbackPtr resolveCallbackFunction(const Common::String &name) const;
- Common::String resolveCallbackPointer(CallbackPtr ptr) const;
+ bool registerCallbackFunction(const Common::String &name, CallbackPtr ptr);
+ CallbackPtr resolveCallbackFunction(const Common::String &name) const;
+ Common::String resolveCallbackPointer(CallbackPtr ptr) const;
private:
typedef Common::HashMap<Common::String, CallbackPtr, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> NameToPtrMap;
@@ -82,9 +74,9 @@
typedef Common::HashMap<CallbackPtr, Common::String, CallbackPtr_Hash, CallbackPtr_EqualTo> PtrToNameMap;
PtrToNameMap _ptrToNameMap;
- CallbackPtr findPtrByName(const Common::String &name) const;
- Common::String findNameByPtr(CallbackPtr ptr) const;
- void storeCallbackFunction(const Common::String &name, CallbackPtr ptr);
+ CallbackPtr findPtrByName(const Common::String &name) const;
+ Common::String findNameByPtr(CallbackPtr ptr) const;
+ void storeCallbackFunction(const Common::String &name, CallbackPtr ptr);
};
} // End of namespace Sword25
Modified: scummvm/trunk/engines/sword25/kernel/filesystemutil.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/filesystemutil.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/kernel/filesystemutil.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -32,10 +32,6 @@
*
*/
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "common/config-manager.h"
#include "common/fs.h"
#include "common/savefile.h"
@@ -47,13 +43,9 @@
#define BS_LOG_PREFIX "FILESYSTEMUTIL"
-// -----------------------------------------------------------------------------
-// Constants and utility functions
-// -----------------------------------------------------------------------------
+Common::String getAbsolutePath(const Common::String &path) {
+ Common::FSNode node(path);
-Common::String GetAbsolutePath(const Common::String &Path) {
- Common::FSNode node(Path);
-
if (!node.exists()) {
// An error has occurred finding the node
// We can do nothing at this pointer than return an empty string
@@ -65,13 +57,9 @@
return node.getPath();
}
-// -----------------------------------------------------------------------------
-// Class definitions
-// -----------------------------------------------------------------------------
-
class BS_FileSystemUtilScummVM : public FileSystemUtil {
public:
- virtual Common::String GetUserdataDirectory() {
+ virtual Common::String getUserdataDirectory() {
Common::String path = ConfMan.get("savepath");
if (path.empty()) {
@@ -83,12 +71,12 @@
return path;
}
- virtual Common::String GetPathSeparator() {
+ virtual Common::String getPathSeparator() {
return Common::String("/");
}
- virtual int32 GetFileSize(const Common::String &Filename) {
- Common::FSNode node(Filename);
+ virtual int32 getFileSize(const Common::String &filename) {
+ Common::FSNode node(filename);
// If the file does not exist, return -1 as a result
if (!node.exists())
@@ -103,7 +91,7 @@
return size;
}
- virtual TimeDate GetFileTime(const Common::String &Filename) {
+ virtual TimeDate getFileTime(const Common::String &filename) {
// TODO: There isn't any way in ScummVM to get a file's modified date/time. We will need to check
// what code makes use of it. If it's only the save game code, for example, we may be able to
// encode the date/time inside the savegame files themselves.
@@ -112,41 +100,37 @@
return result;
}
- virtual bool FileExists(const Common::String &Filename) {
+ virtual bool fileExists(const Common::String &filename) {
Common::File f;
- if (f.exists(Filename))
+ if (f.exists(filename))
return true;
// Check if the file exists in the save folder
- Common::FSNode folder(PersistenceService::GetSavegameDirectory());
- Common::FSNode fileNode = folder.getChild(FileSystemUtil::GetInstance().GetPathFilename(Filename));
+ Common::FSNode folder(PersistenceService::getSavegameDirectory());
+ Common::FSNode fileNode = folder.getChild(FileSystemUtil::getInstance().getPathFilename(filename));
return fileNode.exists();
}
- virtual bool CreateDirectory(const Common::String &DirectoryName) {
+ virtual bool createDirectory(const Common::String &sirectoryName) {
// ScummVM doesn't support creating folders, so this is only a stub
BS_LOG_ERRORLN("CreateDirectory method called");
return false;
}
- virtual Common::String GetPathFilename(const Common::String &Path) {
- for (int i = Path.size() - 1; i >= 0; --i) {
- if ((Path[i] == '/') || (Path[i] == '\\')) {
- return Common::String(&Path.c_str()[i + 1]);
+ virtual Common::String getPathFilename(const Common::String &path) {
+ for (int i = path.size() - 1; i >= 0; --i) {
+ if ((path[i] == '/') || (path[i] == '\\')) {
+ return Common::String(&path.c_str()[i + 1]);
}
}
- return Path;
+ return path;
}
};
-// -----------------------------------------------------------------------------
-// Singleton method of parent class
-// -----------------------------------------------------------------------------
-
-FileSystemUtil &FileSystemUtil::GetInstance() {
- static BS_FileSystemUtilScummVM Instance;
- return Instance;
+FileSystemUtil &FileSystemUtil::getInstance() {
+ static BS_FileSystemUtilScummVM instance;
+ return instance;
}
} // End of namespace Sword25
Modified: scummvm/trunk/engines/sword25/kernel/filesystemutil.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/filesystemutil.h 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/kernel/filesystemutil.h 2010-10-19 21:03:33 UTC (rev 53626)
@@ -61,7 +61,7 @@
class FileSystemUtil {
public:
- static FileSystemUtil &GetInstance();
+ static FileSystemUtil &getInstance();
virtual ~FileSystemUtil() {}
/**
@@ -70,27 +70,27 @@
* These are for example Screenshots, game saves, configuration files, log files, ...
* @return Returns the name of the directory for user data.
*/
- virtual Common::String GetUserdataDirectory() = 0;
+ virtual Common::String getUserdataDirectory() = 0;
/**
* @return Returns the path seperator
*/
- virtual Common::String GetPathSeparator() = 0;
+ virtual Common::String getPathSeparator() = 0;
/**
* @param Filename The path to a file.
* @return Returns the size of the specified file. If the size could not be
* determined, or the file does not exist, returns -1
*/
- virtual int32 GetFileSize(const Common::String &Filename) = 0;
+ virtual int32 getFileSize(const Common::String &filename) = 0;
/**
* @param Filename The path to a file.
* @return Returns the timestamp of the specified file.
*/
- virtual TimeDate GetFileTime(const Common::String &Filename) = 0;
+ virtual TimeDate getFileTime(const Common::String &filename) = 0;
/**
* @param Filename The path to a file.
* @return Returns true if the file exists.
*/
- virtual bool FileExists(const Common::String &Filename) = 0;
+ virtual bool fileExists(const Common::String &filename) = 0;
/**
* This function creates a directory
*
@@ -99,13 +99,13 @@
* @param DirectoryName The name of the directory to be created
* @return Returns true if the folder(s) could be created, otherwise false.
*/
- virtual bool CreateDirectory(const Common::String &DirectoryName) = 0;
+ virtual bool createDirectory(const Common::String &directoryName) = 0;
/**
* Gets the filename from a path and filename
* @param Filename The full path and filename
* @return Returns just the filename
*/
- virtual Common::String GetPathFilename(const Common::String &Path) = 0;
+ virtual Common::String getPathFilename(const Common::String &path) = 0;
};
} // End of namespace Sword25
Modified: scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -34,146 +34,116 @@
#define BS_LOG_PREFIX "INPUTPERSISTENCEBLOCK"
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/inputpersistenceblock.h"
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Constructor / Destructor
-// -----------------------------------------------------------------------------
-
-InputPersistenceBlock::InputPersistenceBlock(const void *Data, uint DataLength) :
- m_Data(static_cast<const byte *>(Data), DataLength),
- m_ErrorState(NONE) {
- m_Iter = m_Data.begin();
+InputPersistenceBlock::InputPersistenceBlock(const void *data, uint dataLength) :
+ _data(static_cast<const byte *>(data), dataLength),
+ _errorState(NONE) {
+ _iter = _data.begin();
}
-// -----------------------------------------------------------------------------
-
InputPersistenceBlock::~InputPersistenceBlock() {
- if (m_Iter != m_Data.end()) BS_LOG_WARNINGLN("Persistence block was not read to the end.");
+ if (_iter != _data.end())
+ BS_LOG_WARNINGLN("Persistence block was not read to the end.");
}
-// -----------------------------------------------------------------------------
-// Reading
-// -----------------------------------------------------------------------------
-
-void InputPersistenceBlock::read(int16 &Value) {
+void InputPersistenceBlock::read(int16 &value) {
signed int v;
read(v);
- Value = static_cast<int16>(v);
+ value = static_cast<int16>(v);
}
-// -----------------------------------------------------------------------------
-
-void InputPersistenceBlock::read(signed int &Value) {
- if (CheckMarker(SINT_MARKER)) {
- RawRead(&Value, sizeof(signed int));
- Value = ConvertEndianessFromStorageToSystem(Value);
+void InputPersistenceBlock::read(signed int &value) {
+ if (checkMarker(SINT_MARKER)) {
+ rawRead(&value, sizeof(signed int));
+ value = convertEndianessFromStorageToSystem(value);
} else {
- Value = 0;
+ value = 0;
}
}
-// -----------------------------------------------------------------------------
-
-void InputPersistenceBlock::read(uint &Value) {
- if (CheckMarker(UINT_MARKER)) {
- RawRead(&Value, sizeof(uint));
- Value = ConvertEndianessFromStorageToSystem(Value);
+void InputPersistenceBlock::read(uint &value) {
+ if (checkMarker(UINT_MARKER)) {
+ rawRead(&value, sizeof(uint));
+ value = convertEndianessFromStorageToSystem(value);
} else {
- Value = 0;
+ value = 0;
}
}
-// -----------------------------------------------------------------------------
-
-void InputPersistenceBlock::read(float &Value) {
- if (CheckMarker(FLOAT_MARKER)) {
- RawRead(&Value, sizeof(float));
- Value = ConvertEndianessFromStorageToSystem(Value);
+void InputPersistenceBlock::read(float &value) {
+ if (checkMarker(FLOAT_MARKER)) {
+ rawRead(&value, sizeof(float));
+ value = convertEndianessFromStorageToSystem(value);
} else {
- Value = 0.0f;
+ value = 0.0f;
}
}
-// -----------------------------------------------------------------------------
-
-void InputPersistenceBlock::read(bool &Value) {
- if (CheckMarker(BOOL_MARKER)) {
- uint UIntBool;
- RawRead(&UIntBool, sizeof(float));
- UIntBool = ConvertEndianessFromStorageToSystem(UIntBool);
- Value = UIntBool == 0 ? false : true;
+void InputPersistenceBlock::read(bool &value) {
+ if (checkMarker(BOOL_MARKER)) {
+ uint uintBool;
+ rawRead(&uintBool, sizeof(float));
+ uintBool = convertEndianessFromStorageToSystem(uintBool);
+ value = uintBool == 0 ? false : true;
} else {
- Value = 0.0f;
+ value = 0.0f;
}
}
-// -----------------------------------------------------------------------------
+void InputPersistenceBlock::read(Common::String &value) {
+ value = "";
-void InputPersistenceBlock::read(Common::String &Value) {
- Value = "";
+ if (checkMarker(STRING_MARKER)) {
+ uint size;
+ read(size);
- if (CheckMarker(STRING_MARKER)) {
- uint Size;
- read(Size);
-
- if (CheckBlockSize(Size)) {
- Value = Common::String(reinterpret_cast<const char *>(&*m_Iter), Size);
- m_Iter += Size;
+ if (checkBlockSize(size)) {
+ value = Common::String(reinterpret_cast<const char *>(&*_iter), size);
+ _iter += size;
}
}
}
-// -----------------------------------------------------------------------------
+void InputPersistenceBlock::read(Common::Array<byte> &value) {
+ if (checkMarker(BLOCK_MARKER)) {
+ uint size;
+ read(size);
-void InputPersistenceBlock::read(Common::Array<byte> &Value) {
- if (CheckMarker(BLOCK_MARKER)) {
- uint Size;
- read(Size);
-
- if (CheckBlockSize(Size)) {
- Value = Common::Array<byte>(m_Iter, Size);
- m_Iter += Size;
+ if (checkBlockSize(size)) {
+ value = Common::Array<byte>(_iter, size);
+ _iter += size;
}
}
}
-// -----------------------------------------------------------------------------
-
-void InputPersistenceBlock::RawRead(void *DestPtr, size_t Size) {
- if (CheckBlockSize(Size)) {
- memcpy(DestPtr, &*m_Iter, Size);
- m_Iter += Size;
+void InputPersistenceBlock::rawRead(void *destPtr, size_t size) {
+ if (checkBlockSize(size)) {
+ memcpy(destPtr, &*_iter, size);
+ _iter += size;
}
}
-// -----------------------------------------------------------------------------
-
-bool InputPersistenceBlock::CheckBlockSize(int Size) {
- if (m_Data.end() - m_Iter >= Size) {
+bool InputPersistenceBlock::checkBlockSize(int size) {
+ if (_data.end() - _iter >= size) {
return true;
} else {
- m_ErrorState = END_OF_DATA;
+ _errorState = END_OF_DATA;
BS_LOG_ERRORLN("Unexpected end of persistence block.");
return false;
}
}
-// -----------------------------------------------------------------------------
+bool InputPersistenceBlock::checkMarker(byte marker) {
+ if (!isGood() || !checkBlockSize(1))
+ return false;
-bool InputPersistenceBlock::CheckMarker(byte Marker) {
- if (!isGood() || !CheckBlockSize(1)) return false;
-
- if (*m_Iter++ == Marker) {
+ if (*_iter++ == marker) {
return true;
} else {
- m_ErrorState = OUT_OF_SYNC;
+ _errorState = OUT_OF_SYNC;
BS_LOG_ERRORLN("Wrong type marker found in persistence block.");
return false;
}
Modified: scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h 2010-10-19 21:03:33 UTC (rev 53626)
@@ -35,20 +35,12 @@
#ifndef SWORD25_INPUTPERSISTENCEBLOCK_H
#define SWORD25_INPUTPERSISTENCEBLOCK_H
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "common/array.h"
#include "sword25/kernel/common.h"
#include "sword25/kernel/persistenceblock.h"
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Class declaration
-// -----------------------------------------------------------------------------
-
class InputPersistenceBlock : public PersistenceBlock {
public:
enum ErrorState {
@@ -57,32 +49,32 @@
OUT_OF_SYNC
};
- InputPersistenceBlock(const void *Data, uint DataLength);
+ InputPersistenceBlock(const void *data, uint dataLength);
virtual ~InputPersistenceBlock();
- void read(int16 &Value);
- void read(signed int &Value);
- void read(uint &Value);
- void read(float &Value);
- void read(bool &Value);
- void read(Common::String &Value);
- void read(Common::Array<byte> &Value);
+ void read(int16 &value);
+ void read(signed int &value);
+ void read(uint &value);
+ void read(float &value);
+ void read(bool &value);
+ void read(Common::String &value);
+ void read(Common::Array<byte> &value);
bool isGood() const {
- return m_ErrorState == NONE;
+ return _errorState == NONE;
}
- ErrorState GetErrorState() const {
- return m_ErrorState;
+ ErrorState getErrorState() const {
+ return _errorState;
}
private:
- bool CheckMarker(byte Marker);
- bool CheckBlockSize(int Size);
- void RawRead(void *DestPtr, size_t Size);
+ bool checkMarker(byte marker);
+ bool checkBlockSize(int size);
+ void rawRead(void *destPtr, size_t size);
- Common::Array<byte> m_Data;
- Common::Array<byte>::const_iterator m_Iter;
- ErrorState m_ErrorState;
+ Common::Array<byte> _data;
+ Common::Array<byte>::const_iterator _iter;
+ ErrorState _errorState;
};
} // End of namespace Sword25
Modified: scummvm/trunk/engines/sword25/kernel/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/kernel.cpp 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/kernel/kernel.cpp 2010-10-19 21:03:33 UTC (rev 53626)
@@ -47,14 +47,13 @@
#define BS_LOG_PREFIX "KERNEL"
+Kernel *Kernel::_instance = 0;
-Kernel *Kernel::_Instance = 0;
-
Kernel::Kernel() :
_pWindow(NULL),
- _Running(false),
+ _running(false),
_pResourceManager(NULL),
- _InitSuccess(false) {
+ _initSuccess(false) {
// Log that the kernel is beign created
BS_LOGLN("created.");
@@ -63,10 +62,10 @@
for (uint i = 0; i < ARRAYSIZE(BS_SERVICE_TABLE); i++) {
// Is the superclass already registered?
Superclass *pCurSuperclass = NULL;
- Common::Array<Superclass *>::iterator Iter;
- for (Iter = _superclasses.begin(); Iter != _superclasses.end(); ++Iter)
- if ((*Iter)->GetIdentifier() == BS_SERVICE_TABLE[i].superclassId) {
- pCurSuperclass = *Iter;
+ Common::Array<Superclass *>::iterator iter;
+ for (iter = _superclasses.begin(); iter != _superclasses.end(); ++iter)
+ if ((*iter)->getIdentifier() == BS_SERVICE_TABLE[i].superclassId) {
+ pCurSuperclass = *iter;
break;
}
@@ -76,7 +75,7 @@
}
// Create window object
- _pWindow = Window::CreateBSWindow(0, 0, 0, 0, false);
+ _pWindow = Window::createBSWindow(0, 0, 0, 0, false);
if (!_pWindow) {
BS_LOG_ERRORLN("Failed to create the window.");
} else
@@ -86,29 +85,30 @@
_pResourceManager = new ResourceManager(this);
// Initialise the script engine
- ScriptEngine *pScript = static_cast<ScriptEngine *>(NewService("script", "lua"));
+ ScriptEngine *pScript = static_cast<ScriptEngine *>(newService("script", "lua"));
if (!pScript || !pScript->init()) {
- _InitSuccess = false;
+ _initSuccess = false;
return;
}
// Register kernel script bindings
- if (!_RegisterScriptBindings()) {
+ if (!registerScriptBindings()) {
BS_LOG_ERRORLN("Script bindings could not be registered.");
- _InitSuccess = false;
+ _initSuccess = false;
return;
}
BS_LOGLN("Script bindings registered.");
- _InitSuccess = true;
+ _initSuccess = true;
}
Kernel::~Kernel() {
// Services are de-registered in reverse order of creation
- while (!_ServiceCreationOrder.empty()) {
- Superclass *superclass = GetSuperclassByIdentifier(_ServiceCreationOrder.top());
- if (superclass) superclass->DisconnectService();
- _ServiceCreationOrder.pop();
+ while (!_serviceCreationOrder.empty()) {
+ Superclass *superclass = getSuperclassByIdentifier(_serviceCreationOrder.top());
+ if (superclass)
+ superclass->disconnectService();
+ _serviceCreationOrder.pop();
}
// Empty the Superclass list
@@ -127,21 +127,18 @@
BS_LOGLN("destroyed.");
}
-// Service Methoden
-// ----------------
-
-Kernel::Superclass::Superclass(Kernel *pKernel, const Common::String &Identifier) :
+Kernel::Superclass::Superclass(Kernel *pKernel, const Common::String &identifier) :
_pKernel(pKernel),
- _Identifier(Identifier),
- _ServiceCount(0),
- _ActiveService(NULL) {
+ _identifier(identifier),
+ _serviceCount(0),
+ _activeService(NULL) {
for (uint i = 0; i < ARRAYSIZE(BS_SERVICE_TABLE); i++)
- if (BS_SERVICE_TABLE[i].superclassId == _Identifier)
- _ServiceCount++;
+ if (BS_SERVICE_TABLE[i].superclassId == _identifier)
+ _serviceCount++;
}
Kernel::Superclass::~Superclass() {
- DisconnectService();
+ disconnectService();
}
/**
@@ -153,16 +150,17 @@
* Hierbei ist zu beachten, dass der erste Service die Nummer 0 erh\xE4lt. Number muss also eine Zahl zwischen
* 0 und GetServiceCount() - 1 sein.
*/
-Common::String Kernel::Superclass::GetServiceIdentifier(uint Number) {
- if (Number > _ServiceCount) return NULL;
+Common::String Kernel::Superclass::getServiceIdentifier(uint number) {
+ if (number > _serviceCount)
+ return NULL;
- uint CurServiceOrd = 0;
+ uint curServiceOrd = 0;
for (uint i = 0; i < ARRAYSIZE(BS_SERVICE_TABLE); i++) {
- if (BS_SERVICE_TABLE[i].superclassId == _Identifier) {
- if (Number == CurServiceOrd)
+ if (BS_SERVICE_TABLE[i].superclassId == _identifier) {
+ if (number == curServiceOrd)
return BS_SERVICE_TABLE[i].serviceId;
else
- CurServiceOrd++;
+ curServiceOrd++;
}
}
@@ -178,25 +176,25 @@
* @param serviceId The name of the service
* For the superclass "sfx" an example could be "Fmod" or "directsound"
*/
-Service *Kernel::Superclass::NewService(const Common::String &serviceId) {
+Service *Kernel::Superclass::newService(const Common::String &serviceId) {
for (uint i = 0; i < ARRAYSIZE(BS_SERVICE_TABLE); i++)
- if (BS_SERVICE_TABLE[i].superclassId == _Identifier &&
+ if (BS_SERVICE_TABLE[i].superclassId == _identifier &&
BS_SERVICE_TABLE[i].serviceId == serviceId) {
- Service *newService = BS_SERVICE_TABLE[i].create(_pKernel);
+ Service *newService_ = BS_SERVICE_TABLE[i].create(_pKernel);
- if (newService) {
- DisconnectService();
- BS_LOGLN("Service '%s' created from superclass '%s'.", serviceId.c_str(), _Identifier.c_str());
- _ActiveService = newService;
- _ActiveServiceName = BS_SERVICE_TABLE[i].serviceId;
- return _ActiveService;
+ if (newService_) {
+ disconnectService();
+ BS_LOGLN("Service '%s' created from superclass '%s'.", serviceId.c_str(), _identifier.c_str());
+ _activeService = newService_;
+ _activeServiceName = BS_SERVICE_TABLE[i].serviceId;
+ return _activeService;
} else {
- BS_LOG_ERRORLN("Failed to create service '%s' from superclass '%s'.", serviceId.c_str(), _Identifier.c_str());
+ BS_LOG_ERRORLN("Failed to create service '%s' from superclass '%s'.", serviceId.c_str(), _identifier.c_str());
return NULL;
}
}
- BS_LOG_ERRORLN("Service '%s' is not avaliable from superclass '%s'.", serviceId.c_str(), _Identifier.c_str());
+ BS_LOG_ERRORLN("Service '%s' is not avaliable from superclass '%s'.", serviceId.c_str(), _identifier.c_str());
return NULL;
}
@@ -206,32 +204,32 @@
* @param superclassId The name of the superclass which is to be disconnected
* e.g.: "sfx", "gfx", "package" ...
*/
-bool Kernel::Superclass::DisconnectService() {
- if (_ActiveService) {
- delete _ActiveService;
- _ActiveService = 0;
- BS_LOGLN("Active service '%s' disconnected from superclass '%s'.", _ActiveServiceName.c_str(), _Identifier.c_str());
+bool Kernel::Superclass::disconnectService() {
+ if (_activeService) {
+ delete _activeService;
+ _activeService = 0;
+ BS_LOGLN("Active service '%s' disconnected from superclass '%s'.", _activeServiceName.c_str(), _identifier.c_str());
return true;
}
return false;
}
-Kernel::Superclass *Kernel::GetSuperclassByIdentifier(const Common::String &Identifier) const {
- Common::Array<Superclass *>::const_iterator Iter;
- for (Iter = _superclasses.begin(); Iter != _superclasses.end(); ++Iter) {
- if ((*Iter)->GetIdentifier() == Identifier)
- return *Iter;
+Kernel::Superclass *Kernel::getSuperclassByIdentifier(const Common::String &identifier) const {
+ Common::Array<Superclass *>::const_iterator iter;
+ for (iter = _superclasses.begin(); iter != _superclasses.end(); ++iter) {
+ if ((*iter)->getIdentifier() == identifier)
+ return *iter;
}
- // BS_LOG_ERRORLN("Superclass '%s' does not exist.", Identifier.c_str());
+ // BS_LOG_ERRORLN("Superclass '%s' does not exist.", identifier.c_str());
return NULL;
}
/**
* Returns the number of register superclasses
*/
-uint Kernel::GetSuperclassCount() const {
+uint Kernel::getSuperclassCount() const {
return _superclasses.size();
}
@@ -241,17 +239,17 @@
* @param Number The number of the superclass to return the identifier for.
* It should be noted that the number should be between 0 und GetSuperclassCount() - 1.
*/
-Common::String Kernel::GetSuperclassIdentifier(uint Number) const {
- if (Number > _superclasses.size())
+Common::String Kernel::getSuperclassIdentifier(uint number) const {
+ if (number > _superclasses.size())
return NULL;
- uint CurSuperclassOrd = 0;
- Common::Array<Superclass *>::const_iterator Iter;
- for (Iter = _superclasses.begin(); Iter != _superclasses.end(); ++Iter) {
- if (CurSuperclassOrd == Number)
- return ((*Iter)->GetIdentifier());
+ uint curSuperclassOrd = 0;
+ Common::Array<Superclass *>::const_iterator iter;
+ for (iter = _superclasses.begin(); iter != _superclasses.end(); ++iter) {
+ if (curSuperclassOrd == number)
+ return ((*iter)->getIdentifier());
- CurSuperclassOrd++;
+ curSuperclassOrd++;
}
return Common::String();
@@ -262,12 +260,12 @@
* @param superclassId The name of the superclass
* e.g.: "sfx", "gfx", "package" ...
*/
-uint Kernel::GetServiceCount(const Common::String &superclassId) const {
- Superclass *pSuperclass = GetSuperclassByIdentifier(superclassId);
+uint Kernel::getServiceCount(const Common::String &superclassId) const {
+ Superclass *pSuperclass = getSuperclassByIdentifier(superclassId);
if (!pSuperclass)
return 0;
- return pSuperclass->GetServiceCount();
+ return pSuperclass->getServiceCount();
}
@@ -280,12 +278,12 @@
* Hierbei ist zu beachten, dass der erste Service die Nummer 0 erh\xE4lt. Number muss also eine Zahl zwischen
* 0 und GetServiceCount() - 1 sein.
*/
-Common::String Kernel::GetServiceIdentifier(const Common::String &superclassId, uint Number) const {
- Superclass *pSuperclass = GetSuperclassByIdentifier(superclassId);
+Common::String Kernel::getServiceIdentifier(const Common::String &superclassId, uint number) const {
+ Superclass *pSuperclass = getSuperclassByIdentifier(superclassId);
if (!pSuperclass)
return NULL;
- return (pSuperclass->GetServiceIdentifier(Number));
+ return (pSuperclass->getServiceIdentifier(number));
}
/**
@@ -297,15 +295,15 @@
* @param serviceId The name of the service
* For the superclass "sfx" an example could be "Fmod" or "directsound"
*/
-Service *Kernel::NewService(const Common::String &superclassId, const Common::String &serviceId) {
- Superclass *pSuperclass = GetSuperclassByIdentifier(superclassId);
+Service *Kernel::newService(const Common::String &superclassId, const Common::String &serviceId) {
+ Superclass *pSuperclass = getSuperclassByIdentifier(superclassId);
if (!pSuperclass)
return NULL;
// Die Reihenfolge merken, in der Services erstellt werden, damit sie sp\xE4ter in umgekehrter Reihenfolge entladen werden k\xF6nnen.
- _ServiceCreationOrder.push(superclassId);
+ _serviceCreationOrder.push(superclassId);
- return pSuperclass->NewService(serviceId);
+ return pSuperclass->newService(serviceId);
}
/**
@@ -314,12 +312,12 @@
* e.g.: "sfx", "gfx", "package" ...
* @return true on success, and false if the superclass does not exist or if not service was active.
*/
-bool Kernel::DisconnectService(const Common::String &superclassId) {
- Superclass *pSuperclass = GetSuperclassByIdentifier(superclassId);
+bool Kernel::disconnectService(const Common::String &superclassId) {
+ Superclass *pSuperclass = getSuperclassByIdentifier(superclassId);
if (!pSuperclass)
return false;
- return pSuperclass->DisconnectService();
+ return pSuperclass->disconnectService();
}
/**
@@ -327,12 +325,12 @@
* @param superclassId The name of the superclass
* e.g.: "sfx", "gfx", "package" ...
*/
-Service *Kernel::GetService(const Common::String &superclassId) {
- Superclass *pSuperclass = GetSuperclassByIdentifier(superclassId);
+Service *Kernel::getService(const Common::String &superclassId) {
+ Superclass *pSuperclass = getSuperclassByIdentifier(superclassId);
if (!pSuperclass)
return NULL;
- return (pSuperclass->GetActiveService());
+ return (pSuperclass->getActiveService());
}
/**
@@ -341,113 +339,83 @@
* @param superclassId The name of the superclass
* e.g.: "sfx", "gfx", "package" ...
*/
-Common::String Kernel::GetActiveServiceIdentifier(const Common::String &superclassId) {
- Superclass *pSuperclass = GetSuperclassByIdentifier(superclassId);
+Common::String Kernel::getActiveServiceIdentifier(const Common::String &superclassId) {
+ Superclass *pSuperclass = getSuperclassByIdentifier(superclassId);
if (!pSuperclass)
return Common::String();
- return pSuperclass->GetActiveServiceName();
+ return pSuperclass->getActiveServiceName();
}
-// -----------------------------------------------------------------------------
-
/**
* Returns a random number
* @param Min The minimum allowed value
* @param Max The maximum allowed value
*/
-int Kernel::GetRandomNumber(int Min, int Max) {
- BS_ASSERT(Min <= Max);
+int Kernel::getRandomNumber(int min, int max) {
+ BS_ASSERT(min <= max);
- return Min + _rnd.getRandomNumber(Max - Min + 1);
+ return min + _rnd.getRandomNumber(max - min + 1);
}
/**
* Returns the elapsed time since startup in milliseconds
*/
-uint Kernel::GetMilliTicks() {
+uint Kernel::getMilliTicks() {
return g_system->getMillis();
}
-// Other methods
-// -----------------
-
/**
* Returns how much memory is being used
*/
-size_t Kernel::GetUsedMemory() {
+size_t Kernel::getUsedMemory() {
return 0;
-
-#ifdef SCUMMVM_DISABLED_CODE
- PROCESS_MEMORY_COUNTERS pmc;
- pmc.cb = sizeof(pmc);
- if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
- return pmc.WorkingSetSize;
- } else {
- BS_LOG_ERRORLN("Call to GetProcessMemoryInfo() failed. Error code: %d", GetLastError());
- return 0;
- }
-#endif
}
-// -----------------------------------------------------------------------------
-
/**
* Returns a pointer to the active Gfx Service, or NULL if no Gfx service is active.
*/
-GraphicEngine *Kernel::GetGfx() {
- return static_cast<GraphicEngine *>(GetService("gfx"));
+GraphicEngine *Kernel::getGfx() {
+ return static_cast<GraphicEngine *>(getService("gfx"));
}
-// -----------------------------------------------------------------------------
-
/**
* Returns a pointer to the active Sfx Service, or NULL if no Sfx service is active.
*/
-SoundEngine *Kernel::GetSfx() {
- return static_cast<SoundEngine *>(GetService("sfx"));
+SoundEngine *Kernel::getSfx() {
+ return static_cast<SoundEngine *>(getService("sfx"));
}
-// -----------------------------------------------------------------------------
-
/**
* Returns a pointer to the active input service, or NULL if no input service is active.
*/
-InputEngine *Kernel::GetInput() {
- return static_cast<InputEngine *>(GetService("input"));
+InputEngine *Kernel::getInput() {
+ return static_cast<InputEngine *>(getService("input"));
}
-// -----------------------------------------------------------------------------
-
/**
* Returns a pointer to the active package manager, or NULL if no manager is active.
*/
-PackageManager *Kernel::GetPackage() {
- return static_cast<PackageManager *>(GetService("package"));
+PackageManager *Kernel::getPackage() {
+ return static_cast<PackageManager *>(getService("package"));
}
-// -----------------------------------------------------------------------------
-
/**
* Returns a pointer to the script engine, or NULL if it is not active.
*/
-ScriptEngine *Kernel::GetScript() {
- return static_cast<ScriptEngine *>(GetService("script"));
+ScriptEngine *Kernel::getScript() {
+ return static_cast<ScriptEngine *>(getService("script"));
}
-// -----------------------------------------------------------------------------
-
/**
* Returns a pointer to the movie player, or NULL if it is not active.
*/
-MoviePlayer *Kernel::GetFMV() {
- return static_cast<MoviePlayer *>(GetService("fmv"));
+MoviePlayer *Kernel::getFMV() {
+ return static_cast<MoviePlayer *>(getService("fmv"));
}
-// -----------------------------------------------------------------------------
-
-void Kernel::Sleep(uint Msecs) const {
- g_system->delayMillis(Msecs);
+void Kernel::sleep(uint msecs) const {
+ g_system->delayMillis(msecs);
}
} // End of namespace Sword25
Modified: scummvm/trunk/engines/sword25/kernel/kernel.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/kernel.h 2010-10-19 20:54:30 UTC (rev 53625)
+++ scummvm/trunk/engines/sword25/kernel/kernel.h 2010-10-19 21:03:33 UTC (rev 53626)
@@ -45,7 +45,6 @@
#ifndef SWORD25_KERNEL_H
#define SWORD25_KERNEL_H
-// Includes
#include "common/scummsys.h"
#include "common/random.h"
#include "common/stack.h"
@@ -81,7 +80,7 @@
/**
* Returns a pointer to the window object
*/
- Window *GetWindow() {
+ Window *getWindow() {
return _pWindow;
}
@@ -97,7 +96,7 @@
* @param ServiceIdentifier The name of the service
* For the superclass "sfx" an example could be "Fmod" or "directsound"
*/
- Service *NewService(const Common::String &SuperclassIdentifier, const Common::String &ServiceIdentifier);
+ Service *newService(const Common::String &superclassIdentifier, const Common::String &serviceIdentifier);
/**
* Ends the current service of a superclass. Returns true on success, and false if the superclass
@@ -105,14 +104,14 @@
* @param SuperclassIdentfier The name of the superclass which is to be disconnected
* z.B: "sfx", "gfx", "package" ...
*/
- bool DisconnectService(const Common::String &SuperclassIdentifier);
+ bool disconnectService(const Common::String &superclassIdentifier);
/**
* Returns a pointer to the currently active service object of a superclass
* @param SuperclassIdentfier The name of the superclass
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list