diff options
21 files changed, 53 insertions, 56 deletions
diff --git a/engines/sword25/fmv/movieplayer_script.cpp b/engines/sword25/fmv/movieplayer_script.cpp index e4c24bf922..5305fa82fd 100644 --- a/engines/sword25/fmv/movieplayer_script.cpp +++ b/engines/sword25/fmv/movieplayer_script.cpp @@ -187,9 +187,7 @@ const luaL_reg LIBRARY_FUNCTIONS[] = { #ifdef USE_THEORADEC bool MoviePlayer::registerScriptBindings() { - Kernel *pKernel = Kernel::GetInstance(); - BS_ASSERT(pKernel); - ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = Kernel::GetInstance()->GetScript(); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->getScriptObject()); BS_ASSERT(L); diff --git a/engines/sword25/gfx/animation.cpp b/engines/sword25/gfx/animation.cpp index ffa682e569..3f51c8be4c 100644 --- a/engines/sword25/gfx/animation.cpp +++ b/engines/sword25/gfx/animation.cpp @@ -188,7 +188,7 @@ bool Animation::doRender() { BitmapResource *pBitmapResource = static_cast<BitmapResource *>(pResource); // Framebufferobjekt holen - GraphicEngine *pGfx = static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")); + GraphicEngine *pGfx = Kernel::GetInstance()->GetGfx(); BS_ASSERT(pGfx); // Bitmap zeichnen diff --git a/engines/sword25/gfx/animationresource.cpp b/engines/sword25/gfx/animationresource.cpp index 93b5934041..96a93f1890 100644 --- a/engines/sword25/gfx/animationresource.cpp +++ b/engines/sword25/gfx/animationresource.cpp @@ -54,8 +54,7 @@ AnimationResource::AnimationResource(const Common::String &filename) : Common::XMLParser(), _valid(false) { // Get a pointer to the package manager - Kernel *pKernel = Kernel::GetInstance(); - _pPackage = static_cast<PackageManager *>(pKernel->GetService("package")); + _pPackage = Kernel::GetInstance()->GetPackage(); BS_ASSERT(_pPackage); // Switch to the folder the specified Xml fiile is in diff --git a/engines/sword25/gfx/dynamicbitmap.cpp b/engines/sword25/gfx/dynamicbitmap.cpp index 91d46e99f4..47ff68b932 100644 --- a/engines/sword25/gfx/dynamicbitmap.cpp +++ b/engines/sword25/gfx/dynamicbitmap.cpp @@ -99,7 +99,7 @@ uint DynamicBitmap::getPixel(int x, int y) const { bool DynamicBitmap::doRender() { // Framebufferobjekt holen - GraphicEngine *pGfx = static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")); + GraphicEngine *pGfx = Kernel::GetInstance()->GetGfx(); BS_ASSERT(pGfx); // Bitmap zeichnen diff --git a/engines/sword25/gfx/fontresource.cpp b/engines/sword25/gfx/fontresource.cpp index 9f23133a71..2e64a20daa 100644 --- a/engines/sword25/gfx/fontresource.cpp +++ b/engines/sword25/gfx/fontresource.cpp @@ -65,7 +65,7 @@ FontResource::FontResource(Kernel *pKernel, const Common::String &FileName) : // Get a pointer to the package manager BS_ASSERT(_pKernel); - PackageManager *pPackage = static_cast<PackageManager *>(_pKernel->GetService("package")); + PackageManager *pPackage = _pKernel->GetPackage(); BS_ASSERT(pPackage); // Load the contents of the file @@ -105,7 +105,7 @@ bool FontResource::parserCallback_font(ParserNode *node) { // Get a reference to the package manager BS_ASSERT(_pKernel); - PackageManager *pPackage = static_cast<PackageManager *>(_pKernel->GetService("package")); + PackageManager *pPackage = _pKernel->GetPackage(); BS_ASSERT(pPackage); // Get the full path and filename for the bitmap resource diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index ee50f03636..405bebdf89 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -251,7 +251,7 @@ static const luaL_reg ANIMATION_TEMPLATE_METHODS[] = { static GraphicEngine *GetGE() { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - GraphicEngine *pGE = static_cast<GraphicEngine *>(pKernel->GetService("gfx")); + GraphicEngine *pGE = pKernel->GetGfx(); BS_ASSERT(pGE); return pGE; } @@ -1525,7 +1525,7 @@ static const luaL_reg TEXT_METHODS[] = { bool GraphicEngine::RegisterScriptBindings() { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = pKernel->GetScript(); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->getScriptObject()); BS_ASSERT(L); diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index 96b6139a59..d758e66841 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -56,10 +56,10 @@ RenderedImage::RenderedImage(const Common::String &filename, bool &result) : _height(0) { result = false; - PackageManager *pPackage = static_cast<PackageManager *>(Kernel::GetInstance()->GetService("package")); + PackageManager *pPackage = Kernel::GetInstance()->GetPackage(); BS_ASSERT(pPackage); - _backSurface = (static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")))->getSurface(); + _backSurface = Kernel::GetInstance()->GetGfx()->getSurface(); // Datei laden byte *pFileData; @@ -103,7 +103,7 @@ RenderedImage::RenderedImage(uint width, uint height, bool &result) : _data = new byte[width * height * 4]; Common::set_to(_data, &_data[width * height * 4], 0); - _backSurface = (static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")))->getSurface(); + _backSurface = Kernel::GetInstance()->GetGfx()->getSurface(); _doCleanup = true; @@ -112,7 +112,7 @@ RenderedImage::RenderedImage(uint width, uint height, bool &result) : } RenderedImage::RenderedImage() : _width(0), _height(0), _data(0) { - _backSurface = (static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")))->getSurface(); + _backSurface = Kernel::GetInstance()->GetGfx()->getSurface(); _doCleanup = false; diff --git a/engines/sword25/gfx/image/swimage.cpp b/engines/sword25/gfx/image/swimage.cpp index ac4463ea16..77ac109e48 100644 --- a/engines/sword25/gfx/image/swimage.cpp +++ b/engines/sword25/gfx/image/swimage.cpp @@ -55,7 +55,7 @@ SWImage::SWImage(const Common::String &filename, bool &result) : _height(0) { result = false; - PackageManager *pPackage = static_cast<PackageManager *>(Kernel::GetInstance()->GetService("package")); + PackageManager *pPackage = Kernel::GetInstance()->GetPackage(); BS_ASSERT(pPackage); // Datei laden diff --git a/engines/sword25/gfx/panel.cpp b/engines/sword25/gfx/panel.cpp index 3aa0516835..888f6f7468 100644 --- a/engines/sword25/gfx/panel.cpp +++ b/engines/sword25/gfx/panel.cpp @@ -95,7 +95,7 @@ bool Panel::doRender() { if (_color >> 24 == 0) return true; - GraphicEngine *gfxPtr = static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")); + GraphicEngine *gfxPtr = Kernel::GetInstance()->GetGfx(); BS_ASSERT(gfxPtr); return gfxPtr->fill(&_bbox, _color); diff --git a/engines/sword25/gfx/staticbitmap.cpp b/engines/sword25/gfx/staticbitmap.cpp index 7771eb8100..3184e4f971 100644 --- a/engines/sword25/gfx/staticbitmap.cpp +++ b/engines/sword25/gfx/staticbitmap.cpp @@ -114,7 +114,7 @@ bool StaticBitmap::doRender() { BitmapResource *bitmapResourcePtr = static_cast<BitmapResource *>(resourcePtr); // Framebufferobjekt holen - GraphicEngine *gfxPtr = static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")); + GraphicEngine *gfxPtr = Kernel::GetInstance()->GetGfx(); BS_ASSERT(gfxPtr); // Bitmap zeichnen diff --git a/engines/sword25/gfx/text.cpp b/engines/sword25/gfx/text.cpp index d3d77cb0d2..2089886493 100644 --- a/engines/sword25/gfx/text.cpp +++ b/engines/sword25/gfx/text.cpp @@ -169,7 +169,7 @@ bool Text::doRender() { } // Framebufferobjekt holen. - GraphicEngine *GfxPtr = static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")); + GraphicEngine *GfxPtr = Kernel::GetInstance()->GetGfx(); BS_ASSERT(GfxPtr); bool Result = true; diff --git a/engines/sword25/input/inputengine_script.cpp b/engines/sword25/input/inputengine_script.cpp index 25c1c8716b..f9771a2aa2 100644 --- a/engines/sword25/input/inputengine_script.cpp +++ b/engines/sword25/input/inputengine_script.cpp @@ -109,7 +109,7 @@ static CallbackfunctionRegisterer Instance; static InputEngine *GetIE() { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - InputEngine *pIE = static_cast<InputEngine *>(pKernel->GetService("input")); + InputEngine *pIE = pKernel->GetInput(); BS_ASSERT(pIE); return pIE; } @@ -338,7 +338,7 @@ static const lua_constant_reg PACKAGE_CONSTANTS[] = { bool InputEngine::registerScriptBindings() { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = pKernel->GetScript(); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->getScriptObject()); BS_ASSERT(L); diff --git a/engines/sword25/kernel/kernel_script.cpp b/engines/sword25/kernel/kernel_script.cpp index 2f41660fb8..395b0e2637 100644 --- a/engines/sword25/kernel/kernel_script.cpp +++ b/engines/sword25/kernel/kernel_script.cpp @@ -171,7 +171,7 @@ static int Crash(lua_State *L) { static int ExecuteFile(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - ScriptEngine *pSE = static_cast<ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pSE = pKernel->GetScript(); BS_ASSERT(pSE); lua_pushbooleancpp(L, pSE->executeFile(luaL_checkstring(L, 1))); @@ -723,7 +723,7 @@ static const luaL_reg PERSISTENCE_FUNCTIONS[] = { // ----------------------------------------------------------------------------- bool Kernel::_RegisterScriptBindings() { - ScriptEngine *pScript = static_cast<ScriptEngine *>(GetService("script")); + ScriptEngine *pScript = Kernel::GetInstance()->GetScript(); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->getScriptObject()); BS_ASSERT(L); diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp index 7d03497128..79dbcb62e9 100644 --- a/engines/sword25/kernel/persistenceservice.cpp +++ b/engines/sword25/kernel/persistenceservice.cpp @@ -358,8 +358,7 @@ bool PersistenceService::SaveGame(uint SlotID, const Common::String &ScreenshotF } // Get the screenshot - Common::MemoryReadStream *thumbnail = (static_cast<GraphicEngine *>( - Kernel::GetInstance()->GetService("gfx")))->getThumbnail(); + Common::MemoryReadStream *thumbnail = Kernel::GetInstance()->GetGfx()->getThumbnail(); if (thumbnail) { byte *Buffer = new Byte[FILE_COPY_BUFFER_SIZE]; diff --git a/engines/sword25/kernel/resmanager.cpp b/engines/sword25/kernel/resmanager.cpp index 9e80f32f8d..0374acf307 100644 --- a/engines/sword25/kernel/resmanager.cpp +++ b/engines/sword25/kernel/resmanager.cpp @@ -256,7 +256,7 @@ Resource *ResourceManager::loadResource(const Common::String &fileName) { */ Common::String ResourceManager::GetUniqueFileName(const Common::String &FileName) const { // Get a pointer to the package manager - PackageManager *pPackage = (PackageManager *)m_KernelPtr->GetService("package"); + PackageManager *pPackage = (PackageManager *)m_KernelPtr->GetPackage(); if (!pPackage) { BS_LOG_ERRORLN("Could not get package manager."); return Common::String(""); diff --git a/engines/sword25/kernel/resource.cpp b/engines/sword25/kernel/resource.cpp index f6f4f13f68..3ae4bee98a 100644 --- a/engines/sword25/kernel/resource.cpp +++ b/engines/sword25/kernel/resource.cpp @@ -44,9 +44,10 @@ namespace Sword25 { Resource::Resource(const Common::String &fileName, RESOURCE_TYPES type) : _type(type), _refCount(0) { - BS_ASSERT(Kernel::GetInstance()->GetService("package")); + PackageManager *pPM = Kernel::GetInstance()->GetPackage(); + BS_ASSERT(pPM); - _fileName = static_cast<PackageManager *>(Kernel::GetInstance()->GetService("package"))->getAbsolutePath(fileName); + _fileName = pPM->getAbsolutePath(fileName); _fileNameHash = BS_String::GetHash(fileName); } diff --git a/engines/sword25/math/geometry_script.cpp b/engines/sword25/math/geometry_script.cpp index b96fe90e66..dc89428d95 100644 --- a/engines/sword25/math/geometry_script.cpp +++ b/engines/sword25/math/geometry_script.cpp @@ -364,7 +364,7 @@ static int r_setY(lua_State *L) { } static void drawPolygon(const Polygon &polygon, uint color, const Vertex &offset) { - GraphicEngine *pGE = static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")); + GraphicEngine *pGE = Kernel::GetInstance()->GetGfx(); BS_ASSERT(pGE); for (int i = 0; i < polygon.vertexCount - 1; i++) @@ -476,7 +476,7 @@ static const luaL_reg WALKREGION_METHODS[] = { bool Geometry::registerScriptBindings() { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = pKernel->GetScript(); BS_ASSERT(pScript); lua_State *L = static_cast< lua_State *>(pScript->getScriptObject()); BS_ASSERT(L); diff --git a/engines/sword25/package/packagemanager_script.cpp b/engines/sword25/package/packagemanager_script.cpp index cfcea55944..84cfc45cae 100644 --- a/engines/sword25/package/packagemanager_script.cpp +++ b/engines/sword25/package/packagemanager_script.cpp @@ -46,7 +46,7 @@ using namespace Lua; static PackageManager *getPM() { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - PackageManager *pPM = static_cast<PackageManager *>(pKernel->GetService("package")); + PackageManager *pPM = pKernel->GetPackage(); BS_ASSERT(pPM); return pPM; } @@ -201,7 +201,7 @@ static const luaL_reg PACKAGE_FUNCTIONS[] = { bool PackageManager::registerScriptBindings() { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = pKernel->GetScript(); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->getScriptObject()); BS_ASSERT(L); diff --git a/engines/sword25/script/luascript.cpp b/engines/sword25/script/luascript.cpp index 82166f7c25..6c01ca1de5 100644 --- a/engines/sword25/script/luascript.cpp +++ b/engines/sword25/script/luascript.cpp @@ -159,7 +159,7 @@ bool LuaScriptEngine::executeFile(const Common::String &fileName) { debug(2, "LuaScriptEngine::executeFile(%s)", fileName.c_str()); // Get a pointer to the package manager - PackageManager *pPackage = static_cast<PackageManager *>(Kernel::GetInstance()->GetService("package")); + PackageManager *pPackage = Kernel::GetInstance()->GetPackage(); BS_ASSERT(pPackage); // File read diff --git a/engines/sword25/sfx/soundengine_script.cpp b/engines/sword25/sfx/soundengine_script.cpp index 2808296799..56e8f19b74 100644 --- a/engines/sword25/sfx/soundengine_script.cpp +++ b/engines/sword25/sfx/soundengine_script.cpp @@ -48,7 +48,7 @@ namespace Sword25 { static int init(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); if (lua_gettop(L) == 0) @@ -64,7 +64,7 @@ static int init(lua_State *L) { static int update(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); pSfx->update(); @@ -75,7 +75,7 @@ static int update(lua_State *L) { static int setVolume(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); pSfx->setVolume(static_cast<float>(luaL_checknumber(L, 1)), @@ -87,7 +87,7 @@ static int setVolume(lua_State *L) { static int getVolume(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); lua_pushnumber(L, pSfx->getVolume(static_cast<SoundEngine::SOUND_TYPES>(static_cast<uint>(luaL_checknumber(L, 1))))); @@ -98,7 +98,7 @@ static int getVolume(lua_State *L) { static int pauseAll(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); pSfx->pauseAll(); @@ -109,7 +109,7 @@ static int pauseAll(lua_State *L) { static int resumeAll(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); pSfx->resumeAll(); @@ -120,7 +120,7 @@ static int resumeAll(lua_State *L) { static int pauseLayer(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); pSfx->pauseLayer(static_cast<int>(luaL_checknumber(L, 1))); @@ -131,7 +131,7 @@ static int pauseLayer(lua_State *L) { static int resumeLayer(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); pSfx->resumeLayer(static_cast<int>(luaL_checknumber(L, 1))); @@ -178,7 +178,7 @@ static void processPlayParams(lua_State *L, Common::String &fileName, SoundEngin static int playSound(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); Common::String fileName; @@ -199,7 +199,7 @@ static int playSound(lua_State *L) { static int playSoundEx(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); Common::String fileName; @@ -220,7 +220,7 @@ static int playSoundEx(lua_State *L) { static int setSoundVolume(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); pSfx->setSoundVolume(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2))); @@ -231,7 +231,7 @@ static int setSoundVolume(lua_State *L) { static int setSoundPanning(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); pSfx->setSoundPanning(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2))); @@ -242,7 +242,7 @@ static int setSoundPanning(lua_State *L) { static int pauseSound(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); pSfx->pauseSound(static_cast<uint>(luaL_checknumber(L, 1))); @@ -253,7 +253,7 @@ static int pauseSound(lua_State *L) { static int resumeSound(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); pSfx->resumeSound(static_cast<uint>(luaL_checknumber(L, 1))); @@ -264,7 +264,7 @@ static int resumeSound(lua_State *L) { static int stopSound(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); pSfx->stopSound(static_cast<uint>(luaL_checknumber(L, 1))); @@ -275,7 +275,7 @@ static int stopSound(lua_State *L) { static int isSoundPaused(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); lua_pushbooleancpp(L, pSfx->isSoundPaused(static_cast<uint>(luaL_checknumber(L, 1)))); @@ -286,7 +286,7 @@ static int isSoundPaused(lua_State *L) { static int isSoundPlaying(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); lua_pushbooleancpp(L, pSfx->isSoundPlaying(static_cast<uint>(luaL_checknumber(L, 1)))); @@ -297,7 +297,7 @@ static int isSoundPlaying(lua_State *L) { static int getSoundVolume(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); lua_pushnumber(L, pSfx->getSoundVolume(static_cast<uint>(luaL_checknumber(L, 1)))); @@ -308,7 +308,7 @@ static int getSoundVolume(lua_State *L) { static int getSoundPanning(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->GetSfx(); BS_ASSERT(pSfx); lua_pushnumber(L, pSfx->getSoundPanning(static_cast<uint>(luaL_checknumber(L, 1)))); @@ -351,7 +351,7 @@ static const lua_constant_reg SFX_CONSTANTS[] = { bool SoundEngine::registerScriptBindings() { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = pKernel->GetScript(); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->getScriptObject()); BS_ASSERT(L); diff --git a/engines/sword25/sword25.cpp b/engines/sword25/sword25.cpp index 4e99ade25d..0d49d32f2d 100644 --- a/engines/sword25/sword25.cpp +++ b/engines/sword25/sword25.cpp @@ -115,7 +115,7 @@ Common::Error Sword25Engine::appStart() { } // Einen Pointer auf den Skript-Engine holen. - ScriptEngine *scriptPtr = static_cast<ScriptEngine *>(Kernel::GetInstance()->GetService("script")); + ScriptEngine *scriptPtr = Kernel::GetInstance()->GetScript(); if (!scriptPtr) { BS_LOG_ERRORLN("Script intialization failed."); return Common::kUnknownError; @@ -129,7 +129,7 @@ Common::Error Sword25Engine::appStart() { bool Sword25Engine::appMain() { // The main script start. This script loads all the other scripts and starts the actual game. - ScriptEngine *scriptPtr = static_cast<ScriptEngine *>(Kernel::GetInstance()->GetService("script")); + ScriptEngine *scriptPtr = Kernel::GetInstance()->GetScript(); BS_ASSERT(scriptPtr); scriptPtr->executeFile(DEFAULT_SCRIPT_FILE); @@ -147,7 +147,7 @@ bool Sword25Engine::appEnd() { } bool Sword25Engine::loadPackages() { - PackageManager *packageManagerPtr = reinterpret_cast<PackageManager *>(Kernel::GetInstance()->GetService("package")); + PackageManager *packageManagerPtr = Kernel::GetInstance()->GetPackage(); BS_ASSERT(packageManagerPtr); // Load the main package |