[Scummvm-cvs-logs] SF.net SVN: scummvm:[53477] scummvm/trunk/engines/sword25

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Oct 15 14:18:19 CEST 2010


Revision: 53477
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53477&view=rev
Author:   fingolfin
Date:     2010-10-15 12:18:19 +0000 (Fri, 15 Oct 2010)

Log Message:
-----------
SWORD25: Do not use Kernel::GetService directly anymore

Modified Paths:
--------------
    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/dynamicbitmap.cpp
    scummvm/trunk/engines/sword25/gfx/fontresource.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/staticbitmap.cpp
    scummvm/trunk/engines/sword25/gfx/text.cpp
    scummvm/trunk/engines/sword25/input/inputengine_script.cpp
    scummvm/trunk/engines/sword25/kernel/kernel_script.cpp
    scummvm/trunk/engines/sword25/kernel/persistenceservice.cpp
    scummvm/trunk/engines/sword25/kernel/resmanager.cpp
    scummvm/trunk/engines/sword25/kernel/resource.cpp
    scummvm/trunk/engines/sword25/math/geometry_script.cpp
    scummvm/trunk/engines/sword25/package/packagemanager_script.cpp
    scummvm/trunk/engines/sword25/script/luascript.cpp
    scummvm/trunk/engines/sword25/sfx/soundengine_script.cpp
    scummvm/trunk/engines/sword25/sword25.cpp

Modified: scummvm/trunk/engines/sword25/fmv/movieplayer_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/fmv/movieplayer_script.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/fmv/movieplayer_script.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -187,9 +187,7 @@
 
 #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);

Modified: scummvm/trunk/engines/sword25/gfx/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/animation.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/gfx/animation.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -188,7 +188,7 @@
 	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

Modified: scummvm/trunk/engines/sword25/gfx/animationresource.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/animationresource.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/gfx/animationresource.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -54,8 +54,7 @@
 		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

Modified: scummvm/trunk/engines/sword25/gfx/dynamicbitmap.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/dynamicbitmap.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/gfx/dynamicbitmap.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -99,7 +99,7 @@
 
 bool DynamicBitmap::doRender() {
 	// Framebufferobjekt holen
-	GraphicEngine *pGfx = static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx"));
+	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-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/gfx/fontresource.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -65,7 +65,7 @@
 
 	// 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 @@
 	
 	// 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

Modified: scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -251,7 +251,7 @@
 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 @@
 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);

Modified: scummvm/trunk/engines/sword25/gfx/image/renderedimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/renderedimage.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/gfx/image/renderedimage.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -56,10 +56,10 @@
 	_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 @@
 	_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() : _width(0), _height(0), _data(0) {
-	_backSurface = (static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")))->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-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/gfx/image/swimage.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -55,7 +55,7 @@
 	_height(0) {
 	result = false;
 
-	PackageManager *pPackage = static_cast<PackageManager *>(Kernel::GetInstance()->GetService("package"));
+	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-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/gfx/panel.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -95,7 +95,7 @@
 	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);

Modified: scummvm/trunk/engines/sword25/gfx/staticbitmap.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/staticbitmap.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/gfx/staticbitmap.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -114,7 +114,7 @@
 	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

Modified: scummvm/trunk/engines/sword25/gfx/text.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/text.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/gfx/text.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -169,7 +169,7 @@
 	}
 
 	// Framebufferobjekt holen.
-	GraphicEngine *GfxPtr = static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx"));
+	GraphicEngine *GfxPtr = Kernel::GetInstance()->GetGfx();
 	BS_ASSERT(GfxPtr);
 
 	bool Result = true;

Modified: scummvm/trunk/engines/sword25/input/inputengine_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/input/inputengine_script.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/input/inputengine_script.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -109,7 +109,7 @@
 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 @@
 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);

Modified: scummvm/trunk/engines/sword25/kernel/kernel_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/kernel_script.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/kernel/kernel_script.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -171,7 +171,7 @@
 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 @@
 // -----------------------------------------------------------------------------
 
 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);

Modified: scummvm/trunk/engines/sword25/kernel/persistenceservice.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/persistenceservice.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/kernel/persistenceservice.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -358,8 +358,7 @@
 	}
 
 	// 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];

Modified: scummvm/trunk/engines/sword25/kernel/resmanager.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/resmanager.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/kernel/resmanager.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -256,7 +256,7 @@
 */
 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("");

Modified: scummvm/trunk/engines/sword25/kernel/resource.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/resource.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/kernel/resource.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -44,9 +44,10 @@
 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);
 }
 

Modified: scummvm/trunk/engines/sword25/math/geometry_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/math/geometry_script.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/math/geometry_script.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -364,7 +364,7 @@
 }
 
 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 @@
 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);

Modified: scummvm/trunk/engines/sword25/package/packagemanager_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/package/packagemanager_script.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/package/packagemanager_script.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -46,7 +46,7 @@
 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 @@
 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);

Modified: scummvm/trunk/engines/sword25/script/luascript.cpp
===================================================================
--- scummvm/trunk/engines/sword25/script/luascript.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/script/luascript.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -159,7 +159,7 @@
 	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

Modified: scummvm/trunk/engines/sword25/sfx/soundengine_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/sfx/soundengine_script.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/sfx/soundengine_script.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -48,7 +48,7 @@
 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 @@
 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);

Modified: scummvm/trunk/engines/sword25/sword25.cpp
===================================================================
--- scummvm/trunk/engines/sword25/sword25.cpp	2010-10-15 12:17:20 UTC (rev 53476)
+++ scummvm/trunk/engines/sword25/sword25.cpp	2010-10-15 12:18:19 UTC (rev 53477)
@@ -115,7 +115,7 @@
 	}
 
 	// 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 @@
 
 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::loadPackages() {
-	PackageManager *packageManagerPtr = reinterpret_cast<PackageManager *>(Kernel::GetInstance()->GetService("package"));
+	PackageManager *packageManagerPtr = Kernel::GetInstance()->GetPackage();
 	BS_ASSERT(packageManagerPtr);
 
 	// Load the main package


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