diff options
57 files changed, 593 insertions, 593 deletions
diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp index fffefde5db..076226bf89 100644 --- a/engines/sword25/fmv/movieplayer.cpp +++ b/engines/sword25/fmv/movieplayer.cpp @@ -38,7 +38,7 @@ namespace Sword25 { #define BS_LOG_PREFIX "MOVIEPLAYER" -BS_Service *BS_OggTheora_CreateObject(BS_Kernel *pKernel) { +BS_Service *OggTheora_CreateObject(BS_Kernel *pKernel) { return new MoviePlayer(pKernel); } diff --git a/engines/sword25/fmv/movieplayer_script.cpp b/engines/sword25/fmv/movieplayer_script.cpp index dcf5cd334b..a89338f224 100644 --- a/engines/sword25/fmv/movieplayer_script.cpp +++ b/engines/sword25/fmv/movieplayer_script.cpp @@ -174,12 +174,12 @@ const luaL_reg LIBRARY_FUNCTIONS[] = { bool MoviePlayer::_RegisterScriptBindings() { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_ScriptEngine *pScript = static_cast<BS_ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->GetScriptObject()); BS_ASSERT(L); - if (!BS_LuaBindhelper::AddFunctionsToLib(L, LIBRARY_NAME, LIBRARY_FUNCTIONS)) return false; + if (!LuaBindhelper::AddFunctionsToLib(L, LIBRARY_NAME, LIBRARY_FUNCTIONS)) return false; return true; } diff --git a/engines/sword25/gfx/animationresource.cpp b/engines/sword25/gfx/animationresource.cpp index c229463dfb..770c60f7ce 100644 --- a/engines/sword25/gfx/animationresource.cpp +++ b/engines/sword25/gfx/animationresource.cpp @@ -68,7 +68,7 @@ AnimationResource::AnimationResource(const Common::String &FileName) : BS_Resource(FileName, BS_Resource::TYPE_ANIMATION), m_Valid(false) { // Pointer auf den Package-Manager bekommen - BS_PackageManager *PackagePtr = BS_Kernel::GetInstance()->GetPackage(); + PackageManager *PackagePtr = BS_Kernel::GetInstance()->GetPackage(); BS_ASSERT(PackagePtr); // Animations-XML laden @@ -198,13 +198,13 @@ bool AnimationResource::ParseAnimationTag(TiXmlElement &AnimationTag, int &FPS, // ----------------------------------------------------------------------------- -bool AnimationResource::ParseFrameTag(TiXmlElement &FrameTag, Frame &Frame_, BS_PackageManager &PackageManager) { +bool AnimationResource::ParseFrameTag(TiXmlElement &FrameTag, Frame &Frame_, PackageManager &packageManager) { const char *FileString = FrameTag.Attribute("file"); if (!FileString) { BS_LOG_ERRORLN("<frame> tag without file attribute occurred in \"%s\".", GetFileName().c_str()); return false; } - Frame_.FileName = PackageManager.GetAbsolutePath(FileString); + Frame_.FileName = packageManager.GetAbsolutePath(FileString); if (Frame_.FileName == "") { BS_LOG_ERRORLN("Could not create absolute path for file specified in <frame> tag in \"%s\": \"%s\".", GetFileName().c_str(), FileString); return false; diff --git a/engines/sword25/gfx/animationresource.h b/engines/sword25/gfx/animationresource.h index 532aaa51ae..806861f07e 100644 --- a/engines/sword25/gfx/animationresource.h +++ b/engines/sword25/gfx/animationresource.h @@ -57,7 +57,7 @@ namespace Sword25 { // ----------------------------------------------------------------------------- class BS_Kernel; -class BS_PackageManager; +class PackageManager; // ----------------------------------------------------------------------------- // Class Definition @@ -110,7 +110,7 @@ private: /** @name Dokument-Parser Methoden */ bool ParseAnimationTag(TiXmlElement &AnimationTag, int &FPS, Animation::ANIMATION_TYPES &AnimationType); - bool ParseFrameTag(TiXmlElement &FrameTag, Frame &Frame, BS_PackageManager &PackageManager); + bool ParseFrameTag(TiXmlElement &FrameTag, Frame &Frame, PackageManager &PackageManager); //@} diff --git a/engines/sword25/gfx/fontresource.cpp b/engines/sword25/gfx/fontresource.cpp index 000b1619dc..6d2a7a99a5 100644 --- a/engines/sword25/gfx/fontresource.cpp +++ b/engines/sword25/gfx/fontresource.cpp @@ -89,7 +89,7 @@ FontResource::FontResource(BS_Kernel *pKernel, const Common::String &FileName) : { // Pointer auf den Package-Manager bekommen BS_ASSERT(_pKernel); - BS_PackageManager *pPackage = static_cast<BS_PackageManager *>(_pKernel->GetService("package")); + PackageManager *pPackage = static_cast<PackageManager *>(_pKernel->GetService("package")); BS_ASSERT(pPackage); // Absoluten, eindeutigen Pfad bestimmen @@ -142,7 +142,7 @@ FontResource::FontResource(BS_Kernel *pKernel, const Common::String &FileName) : bool FontResource::_ParseXMLDocument(const Common::String &FileName, TiXmlDocument &Doc) const { // Pointer auf den Package-Manager bekommen BS_ASSERT(_pKernel); - BS_PackageManager *pPackage = static_cast<BS_PackageManager *>(_pKernel->GetService("package")); + PackageManager *pPackage = static_cast<PackageManager *>(_pKernel->GetService("package")); BS_ASSERT(pPackage); // Die Daten werden zunächst über den Package-Manager gelesen und dann in einen um ein Byte größeren Buffer kopiert diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h index 3b00db115b..e68969e128 100644 --- a/engines/sword25/gfx/graphicengine.h +++ b/engines/sword25/gfx/graphicengine.h @@ -173,7 +173,7 @@ public: * @param End The ending point of the line * @param Color The colour of the line. The default is BS_RGB (255,255,255) (White) */ - virtual void DrawDebugLine(const BS_Vertex &Start, const BS_Vertex &End, unsigned int Color = BS_RGB(255, 255, 255)) = 0; + virtual void DrawDebugLine(const Vertex &Start, const Vertex &End, unsigned int Color = BS_RGB(255, 255, 255)) = 0; /** * Creates a screenshot of the current frame buffer and writes it to a graphic file in PNG format. diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 7447e0237b..92f5750d25 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -71,9 +71,9 @@ static bool AnimationLoopPointCallback(unsigned int Data); namespace { // ------------------------------------------------------------------------- -class ActionCallback : public BS_LuaCallback { +class ActionCallback : public LuaCallback { public: - ActionCallback(lua_State *L) : BS_LuaCallback(L) {}; + ActionCallback(lua_State *L) : LuaCallback(L) {}; Common::String Action; @@ -84,7 +84,7 @@ protected: } }; -std::auto_ptr<BS_LuaCallback> LoopPointCallbackPtr; +std::auto_ptr<LuaCallback> LoopPointCallbackPtr; std::auto_ptr<ActionCallback> ActionCallbackPtr; // ------------------------------------------------------------------------- @@ -122,7 +122,7 @@ static void *my_checkudata(lua_State *L, int ud, const char *tname) { if (p != NULL) { /* value is a userdata? */ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ // lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ - BS_LuaBindhelper::GetMetatable(L, tname); + LuaBindhelper::GetMetatable(L, tname); if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ lua_settop(L, top); return p; @@ -166,7 +166,7 @@ static int NewAnimationTemplate(lua_State *L) { if (AnimationTemplatePtr && AnimationTemplatePtr->IsValid()) { NewUintUserData(L, AnimationTemplateHandle); //luaL_getmetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); + LuaBindhelper::GetMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else { @@ -304,7 +304,7 @@ static int Init(lua_State *L) { NewUintUserData(L, MainPanelPtr->GetHandle()); BS_ASSERT(!lua_isnil(L, -1)); // luaL_getmetatable(L, PANEL_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); + LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); @@ -349,10 +349,10 @@ static int EndFrame(lua_State *L) { static int DrawDebugLine(lua_State *L) { GraphicEngine *pGE = GetGE(); - BS_Vertex Start; - BS_Vertex End; - BS_Vertex::LuaVertexToVertex(L, 1, Start); - BS_Vertex::LuaVertexToVertex(L, 2, End); + Vertex Start; + Vertex End; + Vertex::LuaVertexToVertex(L, 1, Start); + Vertex::LuaVertexToVertex(L, 2, End); pGE->DrawDebugLine(Start, End, GraphicEngine::LuaColorToARGBColor(L, 3)); return 0; @@ -541,8 +541,8 @@ static RenderObjectPtr<RenderObject> CheckRenderObject(lua_State *L, bool ErrorI static int RO_SetPos(lua_State *L) { RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); - BS_Vertex Pos; - BS_Vertex::LuaVertexToVertex(L, 2, Pos); + Vertex Pos; + Vertex::LuaVertexToVertex(L, 2, Pos); ROPtr->SetPos(Pos.X, Pos.Y); return 0; } @@ -674,7 +674,7 @@ static int RO_AddPanel(lua_State *L) { if (PanelPtr.IsValid()) { NewUintUserData(L, PanelPtr->GetHandle()); // luaL_getmetatable(L, PANEL_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); + LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else @@ -692,7 +692,7 @@ static int RO_AddBitmap(lua_State *L) { if (BitmaPtr.IsValid()) { NewUintUserData(L, BitmaPtr->GetHandle()); // luaL_getmetatable(L, BITMAP_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, BITMAP_CLASS_NAME); + LuaBindhelper::GetMetatable(L, BITMAP_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else @@ -714,7 +714,7 @@ static int RO_AddText(lua_State *L) { if (TextPtr.IsValid()) { NewUintUserData(L, TextPtr->GetHandle()); // luaL_getmetatable(L, TEXT_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, TEXT_CLASS_NAME); + LuaBindhelper::GetMetatable(L, TEXT_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else @@ -738,7 +738,7 @@ static int RO_AddAnimation(lua_State *L) { if (AnimationPtr.IsValid()) { NewUintUserData(L, AnimationPtr->GetHandle()); // luaL_getmetatable(L, ANIMATION_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, ANIMATION_CLASS_NAME); + LuaBindhelper::GetMetatable(L, ANIMATION_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); @@ -970,8 +970,8 @@ static int B_IsFlipV(lua_State *L) { static int B_GetPixel(lua_State *L) { RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); - BS_Vertex Pos; - BS_Vertex::LuaVertexToVertex(L, 2, Pos); + Vertex Pos; + Vertex::LuaVertexToVertex(L, 2, Pos); GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->GetPixel(Pos.X, Pos.Y)); return 1; } @@ -1528,26 +1528,26 @@ static const luaL_reg TEXT_METHODS[] = { bool GraphicEngine::RegisterScriptBindings() { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_ScriptEngine *pScript = static_cast<BS_ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->GetScriptObject()); BS_ASSERT(L); - if (!BS_LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, PANEL_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, BITMAP_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, TEXT_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, ANIMATION_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, PANEL_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, BITMAP_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, TEXT_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, ANIMATION_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, ANIMATION_TEMPLATE_CLASS_NAME, ANIMATION_TEMPLATE_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, ANIMATION_TEMPLATE_CLASS_NAME, ANIMATION_TEMPLATE_METHODS)) return false; - if (!BS_LuaBindhelper::AddFunctionsToLib(L, GFX_LIBRARY_NAME, GFX_FUNCTIONS)) return false; + if (!LuaBindhelper::AddFunctionsToLib(L, GFX_LIBRARY_NAME, GFX_FUNCTIONS)) return false; - LoopPointCallbackPtr.reset(new BS_LuaCallback(L)); + LoopPointCallbackPtr.reset(new LuaCallback(L)); ActionCallbackPtr.reset(new ActionCallback(L)); return true; diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp index cc8f813fe6..0d17eb1758 100644 --- a/engines/sword25/gfx/opengl/glimage.cpp +++ b/engines/sword25/gfx/opengl/glimage.cpp @@ -57,7 +57,7 @@ GLImage::GLImage(const Common::String &Filename, bool &Result) : m_Height(0) { Result = false; - BS_PackageManager *pPackage = static_cast<BS_PackageManager *>(BS_Kernel::GetInstance()->GetService("package")); + PackageManager *pPackage = static_cast<PackageManager *>(BS_Kernel::GetInstance()->GetService("package")); BS_ASSERT(pPackage); _backSurface = (static_cast<GraphicEngine *>(BS_Kernel::GetInstance()->GetService("gfx")))->getSurface(); diff --git a/engines/sword25/gfx/opengl/openglgfx.cpp b/engines/sword25/gfx/opengl/openglgfx.cpp index f9dda32b40..c30fc8ed0d 100644 --- a/engines/sword25/gfx/opengl/openglgfx.cpp +++ b/engines/sword25/gfx/opengl/openglgfx.cpp @@ -86,7 +86,7 @@ OpenGLGfx::~OpenGLGfx() { // ----------------------------------------------------------------------------- -BS_Service *BS_OpenGLGfx_CreateObject(BS_Kernel *pKernel) { +BS_Service *OpenGLGfx_CreateObject(BS_Kernel *pKernel) { return new OpenGLGfx(pKernel); } @@ -328,7 +328,7 @@ BS_Resource *OpenGLGfx::LoadResource(const Common::String &FileName) { // Vectorgraphik laden if (FileName.hasSuffix(SWF_EXTENSION)) { // Pointer auf Package-Manager holen - BS_PackageManager *pPackage = BS_Kernel::GetInstance()->GetPackage(); + PackageManager *pPackage = BS_Kernel::GetInstance()->GetPackage(); BS_ASSERT(pPackage); // Datei laden @@ -399,7 +399,7 @@ bool OpenGLGfx::CanLoadResource(const Common::String &FileName) { // DEBUGGING // ----------------------------------------------------------------------------- -void OpenGLGfx::DrawDebugLine(const BS_Vertex &Start, const BS_Vertex &End, unsigned int Color) { +void OpenGLGfx::DrawDebugLine(const Vertex &Start, const Vertex &End, unsigned int Color) { m_DebugLines.push_back(DebugLine(Start, End, Color)); } diff --git a/engines/sword25/gfx/opengl/openglgfx.h b/engines/sword25/gfx/opengl/openglgfx.h index 4a7994a92c..c96fa381d6 100644 --- a/engines/sword25/gfx/opengl/openglgfx.h +++ b/engines/sword25/gfx/opengl/openglgfx.h @@ -87,7 +87,7 @@ public: // Debugging Methoden // ------------------ - virtual void DrawDebugLine(const BS_Vertex &Start, const BS_Vertex &End, unsigned int Color); + virtual void DrawDebugLine(const Vertex &Start, const Vertex &End, unsigned int Color); // Persistenz Methoden // ------------------- @@ -103,14 +103,14 @@ private: std::auto_ptr<RenderObjectManager> m_RenderObjectManagerPtr; struct DebugLine { - DebugLine(const BS_Vertex &_Start, const BS_Vertex &_End, unsigned int _Color) : + DebugLine(const Vertex &_Start, const Vertex &_End, unsigned int _Color) : Start(_Start), End(_End), Color(_Color) {} DebugLine() {} - BS_Vertex Start; - BS_Vertex End; + Vertex Start; + Vertex End; unsigned int Color; }; diff --git a/engines/sword25/gfx/opengl/swimage.cpp b/engines/sword25/gfx/opengl/swimage.cpp index 06308bff87..1244cc3879 100644 --- a/engines/sword25/gfx/opengl/swimage.cpp +++ b/engines/sword25/gfx/opengl/swimage.cpp @@ -56,7 +56,7 @@ SWImage::SWImage(const Common::String &Filename, bool &Result) : m_Height(0) { Result = false; - BS_PackageManager *pPackage = static_cast<BS_PackageManager *>(BS_Kernel::GetInstance()->GetService("package")); + PackageManager *pPackage = static_cast<PackageManager *>(BS_Kernel::GetInstance()->GetService("package")); BS_ASSERT(pPackage); // Datei laden diff --git a/engines/sword25/input/inputengine.cpp b/engines/sword25/input/inputengine.cpp index 7552118e54..cd678d2d38 100644 --- a/engines/sword25/input/inputengine.cpp +++ b/engines/sword25/input/inputengine.cpp @@ -44,7 +44,7 @@ namespace Sword25 { -BS_InputEngine::BS_InputEngine(BS_Kernel *pKernel) : BS_Service(pKernel) { +InputEngine::InputEngine(BS_Kernel *pKernel) : BS_Service(pKernel) { if (!_RegisterScriptBindings()) BS_LOG_ERRORLN("Script bindings could not be registered."); else diff --git a/engines/sword25/input/inputengine.h b/engines/sword25/input/inputengine.h index c0f2b47bf5..c3113e0319 100644 --- a/engines/sword25/input/inputengine.h +++ b/engines/sword25/input/inputengine.h @@ -55,10 +55,10 @@ namespace Sword25 { /// Class definitions -class BS_InputEngine : public BS_Service, public BS_Persistable { +class InputEngine : public BS_Service, public BS_Persistable { public: - BS_InputEngine(BS_Kernel *pKernel); - virtual ~BS_InputEngine() {}; + InputEngine(BS_Kernel *pKernel); + virtual ~InputEngine() {}; // NOTE: These codes are registered in inputengine_script.cpp // Any changes to these enums must also adjust the above file. diff --git a/engines/sword25/input/inputengine_script.cpp b/engines/sword25/input/inputengine_script.cpp index 5827e88414..440955b7c0 100644 --- a/engines/sword25/input/inputengine_script.cpp +++ b/engines/sword25/input/inputengine_script.cpp @@ -61,9 +61,9 @@ static void TheCharacterCallback(int Character); static void TheCommandCallback(int Command); namespace { -class CharacterCallbackClass : public BS_LuaCallback { +class CharacterCallbackClass : public LuaCallback { public: - CharacterCallbackClass(lua_State *L) : BS_LuaCallback(L) {}; + CharacterCallbackClass(lua_State *L) : LuaCallback(L) {}; Common::String Character; @@ -77,13 +77,13 @@ Common::SharedPtr<CharacterCallbackClass> CharacterCallbackPtr; // ----------------------------------------------------------------------------- -class CommandCallbackClass : public BS_LuaCallback { +class CommandCallbackClass : public LuaCallback { public: - CommandCallbackClass(lua_State *L) : BS_LuaCallback(L) { - Command = BS_InputEngine::KEY_COMMAND_BACKSPACE; + CommandCallbackClass(lua_State *L) : LuaCallback(L) { + Command = InputEngine::KEY_COMMAND_BACKSPACE; } - BS_InputEngine::KEY_COMMANDS Command; + InputEngine::KEY_COMMANDS Command; protected: int PreFunctionInvokation(lua_State *L) { @@ -106,10 +106,10 @@ static CallbackfunctionRegisterer Instance; // ----------------------------------------------------------------------------- -static BS_InputEngine *GetIE() { +static InputEngine *GetIE() { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_InputEngine *pIE = static_cast<BS_InputEngine *>(pKernel->GetService("input")); + InputEngine *pIE = static_cast<InputEngine *>(pKernel->GetService("input")); BS_ASSERT(pIE); return pIE; } @@ -117,7 +117,7 @@ static BS_InputEngine *GetIE() { // ----------------------------------------------------------------------------- static int Init(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); lua_pushbooleancpp(L, pIE->Init()); return 1; @@ -126,7 +126,7 @@ static int Init(lua_State *L) { // ----------------------------------------------------------------------------- static int Update(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + 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 @@ -145,7 +145,7 @@ static int Update(lua_State *L) { // ----------------------------------------------------------------------------- static int IsLeftMouseDown(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); lua_pushbooleancpp(L, pIE->IsLeftMouseDown()); return 1; @@ -154,7 +154,7 @@ static int IsLeftMouseDown(lua_State *L) { // ----------------------------------------------------------------------------- static int IsRightMouseDown(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); lua_pushbooleancpp(L, pIE->IsRightMouseDown()); return 1; @@ -163,7 +163,7 @@ static int IsRightMouseDown(lua_State *L) { // ----------------------------------------------------------------------------- static int WasLeftMouseDown(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); lua_pushbooleancpp(L, pIE->WasLeftMouseDown()); return 1; @@ -172,7 +172,7 @@ static int WasLeftMouseDown(lua_State *L) { // ----------------------------------------------------------------------------- static int WasRightMouseDown(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); lua_pushbooleancpp(L, pIE->WasRightMouseDown()); return 1; @@ -181,7 +181,7 @@ static int WasRightMouseDown(lua_State *L) { // ----------------------------------------------------------------------------- static int IsLeftDoubleClick(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); lua_pushbooleancpp(L, pIE->IsLeftDoubleClick()); return 1; @@ -190,7 +190,7 @@ static int IsLeftDoubleClick(lua_State *L) { // ----------------------------------------------------------------------------- static int GetMouseX(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); lua_pushnumber(L, pIE->GetMouseX()); return 1; @@ -199,7 +199,7 @@ static int GetMouseX(lua_State *L) { // ----------------------------------------------------------------------------- static int GetMouseY(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); lua_pushnumber(L, pIE->GetMouseY()); return 1; @@ -208,7 +208,7 @@ static int GetMouseY(lua_State *L) { // ----------------------------------------------------------------------------- static int IsKeyDown(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); lua_pushbooleancpp(L, pIE->IsKeyDown((unsigned int) luaL_checknumber(L, 1))); return 1; @@ -217,7 +217,7 @@ static int IsKeyDown(lua_State *L) { // ----------------------------------------------------------------------------- static int WasKeyDown(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); lua_pushbooleancpp(L, pIE->WasKeyDown((unsigned int) luaL_checknumber(L, 1))); return 1; @@ -226,7 +226,7 @@ static int WasKeyDown(lua_State *L) { // ----------------------------------------------------------------------------- static int SetMouseX(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); pIE->SetMouseX((int) luaL_checknumber(L, 1)); return 0; @@ -235,7 +235,7 @@ static int SetMouseX(lua_State *L) { // ----------------------------------------------------------------------------- static int SetMouseY(lua_State *L) { - BS_InputEngine *pIE = GetIE(); + InputEngine *pIE = GetIE(); pIE->SetMouseY((int) luaL_checknumber(L, 1)); return 0; @@ -270,7 +270,7 @@ static int UnregisterCharacterCallback(lua_State *L) { // ----------------------------------------------------------------------------- static void TheCommandCallback(int Command) { - CommandCallbackPtr->Command = static_cast<BS_InputEngine::KEY_COMMANDS>(Command); + CommandCallbackPtr->Command = static_cast<InputEngine::KEY_COMMANDS>(Command); lua_State *L = static_cast<lua_State *>(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); CommandCallbackPtr->InvokeCallbackFunctions(L, 1); } @@ -318,8 +318,8 @@ static const luaL_reg PACKAGE_FUNCTIONS[] = { {0, 0} }; -#define X(k) {"KEY_" #k, BS_InputEngine::KEY_##k} -#define Y(k) {"KEY_COMMAND_" #k, BS_InputEngine::KEY_COMMAND_##k} +#define X(k) {"KEY_" #k, InputEngine::KEY_##k} +#define Y(k) {"KEY_COMMAND_" #k, InputEngine::KEY_COMMAND_##k} static const lua_constant_reg PACKAGE_CONSTANTS[] = { X(BACKSPACE), X(TAB), X(CLEAR), X(RETURN), X(PAUSE), X(CAPSLOCK), X(ESCAPE), X(SPACE), X(PAGEUP), X(PAGEDOWN), X(END), X(HOME), X(LEFT), X(UP), X(RIGHT), X(DOWN), X(PRINTSCREEN), X(INSERT), X(DELETE), X(0), X(1), X(2), X(3), X(4), X(5), X(6), X(7), X(8), X(9), X(A), X(B), @@ -335,16 +335,16 @@ static const lua_constant_reg PACKAGE_CONSTANTS[] = { // ----------------------------------------------------------------------------- -bool BS_InputEngine::_RegisterScriptBindings() { +bool InputEngine::_RegisterScriptBindings() { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_ScriptEngine *pScript = static_cast<BS_ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->GetScriptObject()); BS_ASSERT(L); - if (!BS_LuaBindhelper::AddFunctionsToLib(L, PACKAGE_LIBRARY_NAME, PACKAGE_FUNCTIONS)) return false; - if (!BS_LuaBindhelper::AddConstantsToLib(L, PACKAGE_LIBRARY_NAME, PACKAGE_CONSTANTS)) return false; + 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)); diff --git a/engines/sword25/input/scummvminput.cpp b/engines/sword25/input/scummvminput.cpp index 97273dc8d5..295b1bbf40 100644 --- a/engines/sword25/input/scummvminput.cpp +++ b/engines/sword25/input/scummvminput.cpp @@ -66,7 +66,7 @@ ScummVMInput::ScummVMInput(BS_Kernel *pKernel) : m_LastLeftClickTime(0), m_LastLeftClickMouseX(0), m_LastLeftClickMouseY(0), - BS_InputEngine(pKernel) { + InputEngine(pKernel) { memset(m_KeyboardState[0], 0, sizeof(m_KeyboardState[0])); memset(m_KeyboardState[1], 0, sizeof(m_KeyboardState[1])); m_LeftMouseState[0] = false; diff --git a/engines/sword25/input/scummvminput.h b/engines/sword25/input/scummvminput.h index b7f38df603..d89248f7fb 100644 --- a/engines/sword25/input/scummvminput.h +++ b/engines/sword25/input/scummvminput.h @@ -47,7 +47,7 @@ namespace Sword25 { class BS_Kernel; /// Class definitions -class ScummVMInput : public BS_InputEngine { +class ScummVMInput : public InputEngine { public: ScummVMInput(BS_Kernel *pKernel); virtual ~ScummVMInput(); diff --git a/engines/sword25/kernel/kernel.cpp b/engines/sword25/kernel/kernel.cpp index 4e61965c93..40833fed04 100644 --- a/engines/sword25/kernel/kernel.cpp +++ b/engines/sword25/kernel/kernel.cpp @@ -85,7 +85,7 @@ BS_Kernel::BS_Kernel() : _pResourceManager = new BS_ResourceManager(this); // Initialise the script engine - BS_ScriptEngine *pScript = static_cast<BS_ScriptEngine *>(NewService("script", "lua")); + ScriptEngine *pScript = static_cast<ScriptEngine *>(NewService("script", "lua")); if (!pScript || !pScript->Init()) { _InitSuccess = false; return; @@ -405,8 +405,8 @@ GraphicEngine *BS_Kernel::GetGfx() { /** * Returns a pointer to the active Sfx Service, or NULL if no Sfx service is active */ -BS_SoundEngine *BS_Kernel::GetSfx() { - return static_cast<BS_SoundEngine *>(GetService("sfx")); +SoundEngine *BS_Kernel::GetSfx() { + return static_cast<SoundEngine *>(GetService("sfx")); } // ----------------------------------------------------------------------------- @@ -414,8 +414,8 @@ BS_SoundEngine *BS_Kernel::GetSfx() { /** * Returns a pointer to the active input service, or NULL if no input service is active */ -BS_InputEngine *BS_Kernel::GetInput() { - return static_cast<BS_InputEngine *>(GetService("input")); +InputEngine *BS_Kernel::GetInput() { + return static_cast<InputEngine *>(GetService("input")); } // ----------------------------------------------------------------------------- @@ -423,8 +423,8 @@ BS_InputEngine *BS_Kernel::GetInput() { /** * Returns a pointer to the active package manager, or NULL if no manager is active */ -BS_PackageManager *BS_Kernel::GetPackage() { - return static_cast<BS_PackageManager *>(GetService("package")); +PackageManager *BS_Kernel::GetPackage() { + return static_cast<PackageManager *>(GetService("package")); } // ----------------------------------------------------------------------------- @@ -432,8 +432,8 @@ BS_PackageManager *BS_Kernel::GetPackage() { /** * Returns a pointer to the script engine, or NULL if it is not active */ -BS_ScriptEngine *BS_Kernel::GetScript() { - return static_cast<BS_ScriptEngine *>(GetService("script")); +ScriptEngine *BS_Kernel::GetScript() { + return static_cast<ScriptEngine *>(GetService("script")); } // ----------------------------------------------------------------------------- diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index 1ccf03b879..e7861db32b 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -62,10 +62,10 @@ namespace Sword25 { // Class definitions class BS_Service; class GraphicEngine; -class BS_ScriptEngine; -class BS_SoundEngine; -class BS_InputEngine; -class BS_PackageManager; +class ScriptEngine; +class SoundEngine; +class InputEngine; +class PackageManager; class MoviePlayer; /** @@ -194,19 +194,19 @@ public: /** * Returns a pointer to the active Sfx Service, or NULL if no Sfx service is active */ - BS_SoundEngine *GetSfx(); + SoundEngine *GetSfx(); /** * Returns a pointer to the active input service, or NULL if no input service is active */ - BS_InputEngine *GetInput(); + InputEngine *GetInput(); /** * Returns a pointer to the active package manager, or NULL if no manager is active */ - BS_PackageManager *GetPackage(); + PackageManager *GetPackage(); /** * Returns a pointer to the script engine, or NULL if it is not active */ - BS_ScriptEngine *GetScript(); + ScriptEngine *GetScript(); /** * Returns a pointer to the movie player, or NULL if it is not active */ diff --git a/engines/sword25/kernel/kernel_script.cpp b/engines/sword25/kernel/kernel_script.cpp index 9d62694ad3..9ae78d1e95 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) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_ScriptEngine *pSE = static_cast<BS_ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pSE = static_cast<ScriptEngine *>(pKernel->GetService("script")); BS_ASSERT(pSE); lua_pushbooleancpp(L, pSE->ExecuteFile(luaL_checkstring(L, 1))); @@ -723,15 +723,15 @@ static const luaL_reg PERSISTENCE_FUNCTIONS[] = { // ----------------------------------------------------------------------------- bool BS_Kernel::_RegisterScriptBindings() { - BS_ScriptEngine *pScript = static_cast<BS_ScriptEngine *>(GetService("script")); + ScriptEngine *pScript = static_cast<ScriptEngine *>(GetService("script")); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->GetScriptObject()); BS_ASSERT(L); - if (!BS_LuaBindhelper::AddFunctionsToLib(L, KERNEL_LIBRARY_NAME, KERNEL_FUNCTIONS)) return false; - if (!BS_LuaBindhelper::AddFunctionsToLib(L, WINDOW_LIBRARY_NAME, WINDOW_FUNCTIONS)) return false; - if (!BS_LuaBindhelper::AddFunctionsToLib(L, RESOURCE_LIBRARY_NAME, RESOURCE_FUNCTIONS)) return false; - if (!BS_LuaBindhelper::AddFunctionsToLib(L, PERSISTENCE_LIBRARY_NAME, PERSISTENCE_FUNCTIONS)) return false; + if (!LuaBindhelper::AddFunctionsToLib(L, KERNEL_LIBRARY_NAME, KERNEL_FUNCTIONS)) return false; + if (!LuaBindhelper::AddFunctionsToLib(L, WINDOW_LIBRARY_NAME, WINDOW_FUNCTIONS)) return false; + if (!LuaBindhelper::AddFunctionsToLib(L, RESOURCE_LIBRARY_NAME, RESOURCE_FUNCTIONS)) return false; + if (!LuaBindhelper::AddFunctionsToLib(L, PERSISTENCE_LIBRARY_NAME, PERSISTENCE_FUNCTIONS)) return false; return true; } diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp index aeadc2fe9d..dda570b1d2 100644 --- a/engines/sword25/kernel/persistenceservice.cpp +++ b/engines/sword25/kernel/persistenceservice.cpp @@ -321,7 +321,7 @@ bool BS_PersistenceService::SaveGame(unsigned int SlotID, const Common::String & BS_OutputPersistenceBlock Writer; bool Success = true; Success &= BS_Kernel::GetInstance()->GetScript()->Persist(Writer); - Success &= BS_RegionRegistry::GetInstance().Persist(Writer); + Success &= RegionRegistry::GetInstance().Persist(Writer); Success &= BS_Kernel::GetInstance()->GetGfx()->Persist(Writer); Success &= BS_Kernel::GetInstance()->GetSfx()->Persist(Writer); Success &= BS_Kernel::GetInstance()->GetInput()->Persist(Writer); @@ -437,7 +437,7 @@ bool BS_PersistenceService::LoadGame(unsigned int SlotID) { bool Success = true; Success &= BS_Kernel::GetInstance()->GetScript()->Unpersist(Reader); // Muss unbedingt nach Script passieren. Da sonst die bereits wiederhergestellten Regions per Garbage-Collection gekillt werden. - Success &= BS_RegionRegistry::GetInstance().Unpersist(Reader); + Success &= RegionRegistry::GetInstance().Unpersist(Reader); Success &= BS_Kernel::GetInstance()->GetGfx()->Unpersist(Reader); Success &= BS_Kernel::GetInstance()->GetSfx()->Unpersist(Reader); Success &= BS_Kernel::GetInstance()->GetInput()->Unpersist(Reader); diff --git a/engines/sword25/kernel/resmanager.cpp b/engines/sword25/kernel/resmanager.cpp index dd7a38b753..1f9fb69230 100644 --- a/engines/sword25/kernel/resmanager.cpp +++ b/engines/sword25/kernel/resmanager.cpp @@ -256,7 +256,7 @@ BS_Resource *BS_ResourceManager::LoadResource(const Common::String &FileName) { */ Common::String BS_ResourceManager::GetUniqueFileName(const Common::String &FileName) const { // Get a pointer to the package manager - BS_PackageManager *pPackage = (BS_PackageManager *)m_KernelPtr->GetService("package"); + PackageManager *pPackage = (PackageManager *)m_KernelPtr->GetService("package"); 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 c33bfea268..2223d1b965 100644 --- a/engines/sword25/kernel/resource.cpp +++ b/engines/sword25/kernel/resource.cpp @@ -46,7 +46,7 @@ BS_Resource::BS_Resource(const Common::String &FileName, RESOURCE_TYPES Type) : _RefCount(0) { BS_ASSERT(BS_Kernel::GetInstance()->GetService("package")); - _FileName = static_cast<BS_PackageManager *>(BS_Kernel::GetInstance()->GetService("package"))->GetAbsolutePath(FileName); + _FileName = static_cast<PackageManager *>(BS_Kernel::GetInstance()->GetService("package"))->GetAbsolutePath(FileName); _FileNameHash = BS_String::GetHash(FileName); } diff --git a/engines/sword25/kernel/service_ids.h b/engines/sword25/kernel/service_ids.h index 895579a559..1135317cb2 100644 --- a/engines/sword25/kernel/service_ids.h +++ b/engines/sword25/kernel/service_ids.h @@ -49,13 +49,13 @@ namespace Sword25 { -BS_Service *BS_OpenGLGfx_CreateObject(BS_Kernel *pKernel); -BS_Service *BS_ScummVMPackageManager_CreateObject(BS_Kernel *pKernel); +BS_Service *OpenGLGfx_CreateObject(BS_Kernel *pKernel); +BS_Service *ScummVMPackageManager_CreateObject(BS_Kernel *pKernel); BS_Service *ScummVMInput_CreateObject(BS_Kernel *pKernel); -BS_Service *BS_FMODExSound_CreateObject(BS_Kernel *pKernel); -BS_Service *BS_LuaScriptEngine_CreateObject(BS_Kernel *pKernel); -BS_Service *BS_Geometry_CreateObject(BS_Kernel *pKernel); -BS_Service *BS_OggTheora_CreateObject(BS_Kernel *pKernel); +BS_Service *FMODExSound_CreateObject(BS_Kernel *pKernel); +BS_Service *LuaScriptEngine_CreateObject(BS_Kernel *pKernel); +BS_Service *Geometry_CreateObject(BS_Kernel *pKernel); +BS_Service *OggTheora_CreateObject(BS_Kernel *pKernel); // Services are recorded in this table const BS_ServiceInfo BS_SERVICE_TABLE[] = { @@ -64,13 +64,13 @@ const BS_ServiceInfo BS_SERVICE_TABLE[] = { // of the class and returns it // Example: // BS_ServiceInfo("Superclass", "Service", CreateMethod) - BS_ServiceInfo("gfx", "opengl", BS_OpenGLGfx_CreateObject), - BS_ServiceInfo("package", "archiveFS", BS_ScummVMPackageManager_CreateObject), + BS_ServiceInfo("gfx", "opengl", OpenGLGfx_CreateObject), + BS_ServiceInfo("package", "archiveFS", ScummVMPackageManager_CreateObject), BS_ServiceInfo("input", "winapi", ScummVMInput_CreateObject), - BS_ServiceInfo("sfx", "fmodex", BS_FMODExSound_CreateObject), - BS_ServiceInfo("script", "lua", BS_LuaScriptEngine_CreateObject), - BS_ServiceInfo("geometry", "std", BS_Geometry_CreateObject), - BS_ServiceInfo("fmv", "oggtheora", BS_OggTheora_CreateObject), + BS_ServiceInfo("sfx", "fmodex", FMODExSound_CreateObject), + BS_ServiceInfo("script", "lua", LuaScriptEngine_CreateObject), + BS_ServiceInfo("geometry", "std", Geometry_CreateObject), + BS_ServiceInfo("fmv", "oggtheora", OggTheora_CreateObject), }; const unsigned int BS_SERVICE_COUNT = sizeof(BS_SERVICE_TABLE) / sizeof(BS_ServiceInfo); diff --git a/engines/sword25/math/geometry.cpp b/engines/sword25/math/geometry.cpp index de65017c32..e2816e8a52 100644 --- a/engines/sword25/math/geometry.cpp +++ b/engines/sword25/math/geometry.cpp @@ -38,7 +38,7 @@ namespace Sword25 { #define BS_LOG_PREFIX "GEOMETRY" -BS_Geometry::BS_Geometry(BS_Kernel *pKernel) : BS_Service(pKernel) { +Geometry::Geometry(BS_Kernel *pKernel) : BS_Service(pKernel) { if (!_RegisterScriptBindings()) BS_LOG_ERRORLN("Script bindings could not be registered."); else @@ -46,8 +46,8 @@ BS_Geometry::BS_Geometry(BS_Kernel *pKernel) : BS_Service(pKernel) { } -BS_Service *BS_Geometry_CreateObject(BS_Kernel *pKernel) { - return new BS_Geometry(pKernel); +BS_Service *Geometry_CreateObject(BS_Kernel *pKernel) { + return new Geometry(pKernel); } } // End of namespace Sword25 diff --git a/engines/sword25/math/geometry.h b/engines/sword25/math/geometry.h index 4fee262f2e..bab8183e35 100644 --- a/engines/sword25/math/geometry.h +++ b/engines/sword25/math/geometry.h @@ -42,10 +42,10 @@ namespace Sword25 { class BS_Kernel; -class BS_Geometry : public BS_Service { +class Geometry : public BS_Service { public: - BS_Geometry(BS_Kernel *pKernel); - virtual ~BS_Geometry() {} + Geometry(BS_Kernel *pKernel); + virtual ~Geometry() {} private: bool _RegisterScriptBindings(); diff --git a/engines/sword25/math/geometry_script.cpp b/engines/sword25/math/geometry_script.cpp index 736e3f3d24..2e24c6e446 100644 --- a/engines/sword25/math/geometry_script.cpp +++ b/engines/sword25/math/geometry_script.cpp @@ -71,7 +71,7 @@ static void *my_checkudata(lua_State *L, int ud, const char *tname) { if (p != NULL) { /* value is a userdata? */ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ // lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ - BS_LuaBindhelper::GetMetatable(L, tname); + LuaBindhelper::GetMetatable(L, tname); /* does it have the correct mt? */ if (lua_rawequal(L, -1, -2)) { lua_settop(L, top); @@ -138,7 +138,7 @@ static bool IsValidPolygonDefinition(lua_State *L) { // ----------------------------------------------------------------------------- -static void TablePolygonToPolygon(lua_State *L, BS_Polygon &Polygon) { +static void TablePolygonToPolygon(lua_State *L, Polygon &Polygon) { #ifdef DEBUG int __startStackDepth = lua_gettop(L); #endif @@ -151,7 +151,7 @@ static void TablePolygonToPolygon(lua_State *L, BS_Polygon &Polygon) { int VertexCount = luaL_getn(L, -1) / 2; // Memory is reserved for Vertecies - Common::Array<BS_Vertex> Vertecies; + Common::Array<Vertex> Vertecies; Vertecies.reserve(VertexCount); // Create Vertecies @@ -167,7 +167,7 @@ static void TablePolygonToPolygon(lua_State *L, BS_Polygon &Polygon) { lua_pop(L, 1); // Vertex - Vertecies.push_back(BS_Vertex(X, Y)); + Vertecies.push_back(Vertex(X, Y)); } BS_ASSERT((int)Vertecies.size() == VertexCount); @@ -201,9 +201,9 @@ static unsigned int TableRegionToRegion(lua_State *L, const char *ClassName) { unsigned int RegionHandle = 0; if (!strcmp(ClassName, REGION_CLASS_NAME)) { - RegionHandle = BS_Region::Create(BS_Region::RT_REGION); + RegionHandle = Region::Create(Region::RT_REGION); } else if (!strcmp(ClassName, WALKREGION_CLASS_NAME)) { - RegionHandle = BS_WalkRegion::Create(BS_Region::RT_WALKREGION); + RegionHandle = WalkRegion::Create(Region::RT_WALKREGION); } else { BS_ASSERT(false); } @@ -219,23 +219,23 @@ static unsigned int TableRegionToRegion(lua_State *L, const char *ClassName) { switch (FirstElementType) { case LUA_TNUMBER: { - BS_Polygon Polygon; - TablePolygonToPolygon(L, Polygon); - BS_RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(Polygon); + Polygon polygon; + TablePolygonToPolygon(L, polygon); + RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(polygon); } break; case LUA_TTABLE: { lua_rawgeti(L, -1, 1); - BS_Polygon Polygon; - TablePolygonToPolygon(L, Polygon); + Polygon polygon; + TablePolygonToPolygon(L, polygon); lua_pop(L, 1); int PolygonCount = luaL_getn(L, -1); if (PolygonCount == 1) - BS_RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(Polygon); + RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(polygon); else { - Common::Array<BS_Polygon> Holes; + Common::Array<Polygon> Holes; Holes.reserve(PolygonCount - 1); for (int i = 2; i <= PolygonCount; i++) { @@ -246,7 +246,7 @@ static unsigned int TableRegionToRegion(lua_State *L, const char *ClassName) { } BS_ASSERT((int)Holes.size() == PolygonCount - 1); - BS_RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(Polygon, &Holes); + RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(polygon, &Holes); } } break; @@ -273,7 +273,7 @@ static void NewUserdataRegion(lua_State *L, const char *ClassName) { NewUintUserData(L, RegionHandle); // luaL_getmetatable(L, ClassName); - BS_LuaBindhelper::GetMetatable(L, ClassName); + LuaBindhelper::GetMetatable(L, ClassName); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } @@ -304,12 +304,12 @@ static const luaL_reg GEO_FUNCTIONS[] = { // ----------------------------------------------------------------------------- -static BS_Region *CheckRegion(lua_State *L) { +static Region *CheckRegion(lua_State *L) { // The first parameter must be of type 'userdata', and the Metatable class Geo.Region or Geo.WalkRegion unsigned int *RegionHandlePtr; if ((RegionHandlePtr = reinterpret_cast<unsigned int *>(my_checkudata(L, 1, REGION_CLASS_NAME))) != 0 || (RegionHandlePtr = reinterpret_cast<unsigned int *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) { - return BS_RegionRegistry::GetInstance().ResolveHandle(*RegionHandlePtr); + return RegionRegistry::GetInstance().ResolveHandle(*RegionHandlePtr); } else { luaL_argcheck(L, 0, 1, "'" REGION_CLASS_NAME "' expected"); } @@ -321,7 +321,7 @@ static BS_Region *CheckRegion(lua_State *L) { // ----------------------------------------------------------------------------- static int R_IsValid(lua_State *L) { - BS_Region *pR = CheckRegion(L); + Region *pR = CheckRegion(L); BS_ASSERT(pR); lua_pushbooleancpp(L, pR->IsValid()); @@ -331,7 +331,7 @@ static int R_IsValid(lua_State *L) { // ----------------------------------------------------------------------------- static int R_GetX(lua_State *L) { - BS_Region *pR = CheckRegion(L); + Region *pR = CheckRegion(L); BS_ASSERT(pR); lua_pushnumber(L, pR->GetPosX()); @@ -341,7 +341,7 @@ static int R_GetX(lua_State *L) { // ----------------------------------------------------------------------------- static int R_GetY(lua_State *L) { - BS_Region *pR = CheckRegion(L); + Region *pR = CheckRegion(L); BS_ASSERT(pR); lua_pushnumber(L, pR->GetPosY()); @@ -351,21 +351,21 @@ static int R_GetY(lua_State *L) { // ----------------------------------------------------------------------------- static int R_GetPos(lua_State *L) { - BS_Region *pR = CheckRegion(L); + Region *pR = CheckRegion(L); BS_ASSERT(pR); - BS_Vertex::VertexToLuaVertex(L, pR->GetPosition()); + Vertex::VertexToLuaVertex(L, pR->GetPosition()); return 1; } // ----------------------------------------------------------------------------- static int R_IsPointInRegion(lua_State *L) { - BS_Region *pR = CheckRegion(L); + Region *pR = CheckRegion(L); BS_ASSERT(pR); - BS_Vertex Vertex; - BS_Vertex::LuaVertexToVertex(L, 2, Vertex); + Vertex Vertex; + Vertex::LuaVertexToVertex(L, 2, Vertex); lua_pushbooleancpp(L, pR->IsPointInRegion(Vertex)); return 1; } @@ -373,11 +373,11 @@ static int R_IsPointInRegion(lua_State *L) { // ----------------------------------------------------------------------------- static int R_SetPos(lua_State *L) { - BS_Region *pR = CheckRegion(L); + Region *pR = CheckRegion(L); BS_ASSERT(pR); - BS_Vertex Vertex; - BS_Vertex::LuaVertexToVertex(L, 2, Vertex); + Vertex Vertex; + Vertex::LuaVertexToVertex(L, 2, Vertex); pR->SetPos(Vertex.X, Vertex.Y); return 0; @@ -386,7 +386,7 @@ static int R_SetPos(lua_State *L) { // ----------------------------------------------------------------------------- static int R_SetX(lua_State *L) { - BS_Region *pR = CheckRegion(L); + Region *pR = CheckRegion(L); BS_ASSERT(pR); pR->SetPosX(static_cast<int>(luaL_checknumber(L, 2))); @@ -397,7 +397,7 @@ static int R_SetX(lua_State *L) { // ----------------------------------------------------------------------------- static int R_SetY(lua_State *L) { - BS_Region *pR = CheckRegion(L); + Region *pR = CheckRegion(L); BS_ASSERT(pR); pR->SetPosY(static_cast<int>(luaL_checknumber(L, 2))); @@ -407,7 +407,7 @@ static int R_SetY(lua_State *L) { // ----------------------------------------------------------------------------- -static void DrawPolygon(const BS_Polygon &Polygon, unsigned int Color, const BS_Vertex &Offset) { +static void DrawPolygon(const Polygon &Polygon, unsigned int Color, const Vertex &Offset) { GraphicEngine *pGE = static_cast<GraphicEngine *>(BS_Kernel::GetInstance()->GetService("gfx")); BS_ASSERT(pGE); @@ -419,7 +419,7 @@ static void DrawPolygon(const BS_Polygon &Polygon, unsigned int Color, const BS_ // ----------------------------------------------------------------------------- -static void DrawRegion(const BS_Region &Region, unsigned int Color, const BS_Vertex &Offset) { +static void DrawRegion(const Region &Region, unsigned int Color, const Vertex &Offset) { DrawPolygon(Region.GetContour(), Color, Offset); for (int i = 0; i < Region.GetHoleCount(); i++) DrawPolygon(Region.GetHole(i), Color, Offset); @@ -428,23 +428,23 @@ static void DrawRegion(const BS_Region &Region, unsigned int Color, const BS_Ver // ----------------------------------------------------------------------------- static int R_Draw(lua_State *L) { - BS_Region *pR = CheckRegion(L); + Region *pR = CheckRegion(L); BS_ASSERT(pR); switch (lua_gettop(L)) { case 3: { - BS_Vertex Offset; - BS_Vertex::LuaVertexToVertex(L, 3, Offset); + Vertex Offset; + Vertex::LuaVertexToVertex(L, 3, Offset); DrawRegion(*pR, GraphicEngine::LuaColorToARGBColor(L, 2), Offset); } break; case 2: - DrawRegion(*pR, GraphicEngine::LuaColorToARGBColor(L, 2), BS_Vertex(0, 0)); + DrawRegion(*pR, GraphicEngine::LuaColorToARGBColor(L, 2), Vertex(0, 0)); break; default: - DrawRegion(*pR, BS_RGB(255, 255, 255), BS_Vertex(0, 0)); + DrawRegion(*pR, BS_RGB(255, 255, 255), Vertex(0, 0)); } return 0; @@ -453,10 +453,10 @@ static int R_Draw(lua_State *L) { // ----------------------------------------------------------------------------- static int R_GetCentroid(lua_State *L) { - BS_Region *RPtr = CheckRegion(L); + Region *RPtr = CheckRegion(L); BS_ASSERT(RPtr); - BS_Vertex::VertexToLuaVertex(L, RPtr->GetCentroid()); + Vertex::VertexToLuaVertex(L, RPtr->GetCentroid()); return 1; } @@ -464,7 +464,7 @@ static int R_GetCentroid(lua_State *L) { // ----------------------------------------------------------------------------- static int R_Delete(lua_State *L) { - BS_Region *pR = CheckRegion(L); + Region *pR = CheckRegion(L); BS_ASSERT(pR); delete pR; return 0; @@ -488,11 +488,11 @@ static const luaL_reg REGION_METHODS[] = { // ----------------------------------------------------------------------------- -static BS_WalkRegion *CheckWalkRegion(lua_State *L) { +static WalkRegion *CheckWalkRegion(lua_State *L) { // The first parameter must be of type 'userdate', and the Metatable class Geo.WalkRegion unsigned int RegionHandle; if ((RegionHandle = *reinterpret_cast<unsigned int *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) { - return reinterpret_cast<BS_WalkRegion *>(BS_RegionRegistry::GetInstance().ResolveHandle(RegionHandle)); + return reinterpret_cast<WalkRegion *>(RegionRegistry::GetInstance().ResolveHandle(RegionHandle)); } else { luaL_argcheck(L, 0, 1, "'" WALKREGION_CLASS_NAME "' expected"); } @@ -504,20 +504,20 @@ static BS_WalkRegion *CheckWalkRegion(lua_State *L) { // ----------------------------------------------------------------------------- static int WR_GetPath(lua_State *L) { - BS_WalkRegion *pWR = CheckWalkRegion(L); + WalkRegion *pWR = CheckWalkRegion(L); BS_ASSERT(pWR); - BS_Vertex Start; - BS_Vertex::LuaVertexToVertex(L, 2, Start); - BS_Vertex End; - BS_Vertex::LuaVertexToVertex(L, 3, End); + Vertex Start; + Vertex::LuaVertexToVertex(L, 2, Start); + Vertex End; + Vertex::LuaVertexToVertex(L, 3, End); BS_Path Path; if (pWR->QueryPath(Start, End, Path)) { lua_newtable(L); BS_Path::const_iterator it = Path.begin(); for (; it != Path.end(); it++) { lua_pushnumber(L, (it - Path.begin()) + 1); - BS_Vertex::VertexToLuaVertex(L, *it); + Vertex::VertexToLuaVertex(L, *it); lua_settable(L, -3); } } else @@ -535,22 +535,22 @@ static const luaL_reg WALKREGION_METHODS[] = { // ----------------------------------------------------------------------------- -bool BS_Geometry::_RegisterScriptBindings() { +bool Geometry::_RegisterScriptBindings() { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_ScriptEngine *pScript = static_cast<BS_ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); BS_ASSERT(pScript); lua_State *L = static_cast< lua_State *>(pScript->GetScriptObject()); BS_ASSERT(L); - if (!BS_LuaBindhelper::AddMethodsToClass(L, REGION_CLASS_NAME, REGION_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, WALKREGION_CLASS_NAME, REGION_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, WALKREGION_CLASS_NAME, WALKREGION_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, REGION_CLASS_NAME, REGION_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, WALKREGION_CLASS_NAME, REGION_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, WALKREGION_CLASS_NAME, WALKREGION_METHODS)) return false; - if (!BS_LuaBindhelper::SetClassGCHandler(L, REGION_CLASS_NAME, R_Delete)) return false; - if (!BS_LuaBindhelper::SetClassGCHandler(L, WALKREGION_CLASS_NAME, R_Delete)) return false; + if (!LuaBindhelper::SetClassGCHandler(L, REGION_CLASS_NAME, R_Delete)) return false; + if (!LuaBindhelper::SetClassGCHandler(L, WALKREGION_CLASS_NAME, R_Delete)) return false; - if (!BS_LuaBindhelper::AddFunctionsToLib(L, GEO_LIBRARY_NAME, GEO_FUNCTIONS)) return false; + if (!LuaBindhelper::AddFunctionsToLib(L, GEO_LIBRARY_NAME, GEO_FUNCTIONS)) return false; return true; } diff --git a/engines/sword25/math/line.h b/engines/sword25/math/line.h index 5e442045f1..f2f0607251 100644 --- a/engines/sword25/math/line.h +++ b/engines/sword25/math/line.h @@ -57,7 +57,7 @@ namespace Sword25 { -class BS_Line { +class Line { public: /** * Determines whether a piont is left of a line @@ -67,11 +67,11 @@ public: * @return Returns true if the point is to the left of the line. * If the point is to the right of the line or on the line, false is returned. */ - static bool IsVertexLeft(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) { + static bool IsVertexLeft(const Vertex &a, const Vertex &b, const Vertex &c) { return _TriangleArea2(a, b, c) > 0; } - static bool IsVertexLeftOn(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) { + static bool IsVertexLeftOn(const Vertex &a, const Vertex &b, const Vertex &c) { return _TriangleArea2(a, b, c) >= 0; } @@ -83,11 +83,11 @@ public: * @return Returns true if the point is to the right of the line. * If the point is to the right of the line or on the line, false is returned. */ - static bool IsVertexRight(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) { + static bool IsVertexRight(const Vertex &a, const Vertex &b, const Vertex &c) { return _TriangleArea2(a, b, c) < 0; } - static bool IsVertexRightOn(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) { + static bool IsVertexRightOn(const Vertex &a, const Vertex &b, const Vertex &c) { return _TriangleArea2(a, b, c) <= 0; } @@ -98,7 +98,7 @@ public: * @param c The test point * @return Returns true if the point is on the line, false otherwise. */ - static bool IsVertexOn(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) { + static bool IsVertexOn(const Vertex &a, const Vertex &b, const Vertex &c) { return _TriangleArea2(a, b, c) == 0; } @@ -117,7 +117,7 @@ public: * RIGHT is returned if the point is to the right of the line. * ON is returned if the point is on the line. */ - static VERTEX_CLASSIFICATION ClassifyVertexToLine(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) { + static VERTEX_CLASSIFICATION ClassifyVertexToLine(const Vertex &a, const Vertex &b, const Vertex &c) { int Area = _TriangleArea2(a, b, c); if (Area > 0) return LEFT; if (Area < 0) return RIGHT; @@ -132,7 +132,7 @@ public: * @param d The end point of the second line * @remark In cases where a line only touches the other, false is returned (improper intersection) */ - static bool DoesIntersectProperly(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c, const BS_Vertex &d) { + static bool DoesIntersectProperly(const Vertex &a, const Vertex &b, const Vertex &c, const Vertex &d) { VERTEX_CLASSIFICATION Class1 = ClassifyVertexToLine(a, b, c); VERTEX_CLASSIFICATION Class2 = ClassifyVertexToLine(a, b, d); VERTEX_CLASSIFICATION Class3 = ClassifyVertexToLine(c, d, a); @@ -149,7 +149,7 @@ public: * @param b The end point of a line * @param c The test point */ - static bool IsOnLine(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) { + static bool IsOnLine(const Vertex &a, const Vertex &b, const Vertex &c) { // The items must all be Collinear, otherwise don't bothering testing the point if (_TriangleArea2(a, b, c) != 0) return false; @@ -167,7 +167,7 @@ public: } } - static bool IsOnLineStrict(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) { + static bool IsOnLineStrict(const Vertex &a, const Vertex &b, const Vertex &c) { // The items must all be Collinear, otherwise don't bothering testing the point if (_TriangleArea2(a, b, c) != 0) return false; @@ -192,7 +192,7 @@ private: * The result is positive if the points are arrange counterclockwise, * and negative if they are arranged counter-clockwise. */ - static int _TriangleArea2(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) { + static int _TriangleArea2(const Vertex &a, const Vertex &b, const Vertex &c) { return a.X * b.Y - a.Y * b.X + a.Y * c.X - a.X * c.Y + b.X * c.Y - c.X * b.Y; diff --git a/engines/sword25/math/polygon.cpp b/engines/sword25/math/polygon.cpp index 57a6a37cf4..fb5af91816 100644 --- a/engines/sword25/math/polygon.cpp +++ b/engines/sword25/math/polygon.cpp @@ -47,36 +47,36 @@ namespace Sword25 { // Constructor / Destructor // -------------------------- -BS_Polygon::BS_Polygon() : VertexCount(0), Vertecies(NULL) { +Polygon::Polygon() : VertexCount(0), Vertecies(NULL) { } -BS_Polygon::BS_Polygon(int VertexCount_, const BS_Vertex *Vertecies_) : VertexCount(0), Vertecies(NULL) { +Polygon::Polygon(int VertexCount_, const Vertex *Vertecies_) : VertexCount(0), Vertecies(NULL) { Init(VertexCount_, Vertecies_); } -BS_Polygon::BS_Polygon(const BS_Polygon &Other) : VertexCount(0), Vertecies(NULL) { +Polygon::Polygon(const Polygon &Other) : VertexCount(0), Vertecies(NULL) { Init(Other.VertexCount, Other.Vertecies); } -BS_Polygon::BS_Polygon(BS_InputPersistenceBlock &Reader) : VertexCount(0), Vertecies(NULL) { +Polygon::Polygon(BS_InputPersistenceBlock &Reader) : VertexCount(0), Vertecies(NULL) { Unpersist(Reader); } -BS_Polygon::~BS_Polygon() { +Polygon::~Polygon() { delete[] Vertecies; } // Initialisation // --------------- -bool BS_Polygon::Init(int VertexCount_, const BS_Vertex *Vertecies_) { +bool Polygon::Init(int VertexCount_, const Vertex *Vertecies_) { // Rember the old obstate to restore it if an error occurs whilst initialising it with the new data int OldVertexCount = this->VertexCount; - BS_Vertex *OldVertecies = this->Vertecies; + Vertex *OldVertecies = this->Vertecies; this->VertexCount = VertexCount_; - this->Vertecies = new BS_Vertex[VertexCount_ + 1]; - memcpy(this->Vertecies, Vertecies_, sizeof(BS_Vertex) * VertexCount_); + this->Vertecies = new Vertex[VertexCount_ + 1]; + memcpy(this->Vertecies, Vertecies_, sizeof(Vertex) * VertexCount_); // TODO: // Duplicate and remove redundant vertecies (Superflous = 3 co-linear verts) // _WeedRepeatedVertecies(); @@ -108,15 +108,15 @@ bool BS_Polygon::Init(int VertexCount_, const BS_Vertex *Vertecies_) { // Review the order of the Vertecies // --------------------------------- -bool BS_Polygon::IsCW() const { +bool Polygon::IsCW() const { return m_IsCW; } -bool BS_Polygon::IsCCW() const { +bool Polygon::IsCCW() const { return !IsCW(); } -bool BS_Polygon::ComputeIsCW() const { +bool Polygon::ComputeIsCW() const { if (VertexCount) { // Find the vertex on extreme bottom right int V2Index = FindLRVertexIndex(); @@ -134,7 +134,7 @@ bool BS_Polygon::ComputeIsCW() const { return false; } -int BS_Polygon::FindLRVertexIndex() const { +int Polygon::FindLRVertexIndex() const { if (VertexCount) { int CurIndex = 0; int MaxX = Vertecies[0].X; @@ -158,15 +158,15 @@ int BS_Polygon::FindLRVertexIndex() const { // Testing for Convex / Concave // ------------------------ -bool BS_Polygon::IsConvex() const { +bool Polygon::IsConvex() const { return m_IsConvex; } -bool BS_Polygon::IsConcave() const { +bool Polygon::IsConcave() const { return !IsConvex(); } -bool BS_Polygon::ComputeIsConvex() const { +bool Polygon::ComputeIsConvex() const { // Polygons with three or less Vertecies can only be convex if (VertexCount <= 3) return true; @@ -201,12 +201,12 @@ bool BS_Polygon::ComputeIsConvex() const { // Make a determine vertex order // ----------------------------- -void BS_Polygon::EnsureCWOrder() { +void Polygon::EnsureCWOrder() { if (!IsCW()) ReverseVertexOrder(); } -void BS_Polygon::EnsureCCWOrder() { +void Polygon::EnsureCCWOrder() { if (!IsCCW()) ReverseVertexOrder(); } @@ -214,10 +214,10 @@ void BS_Polygon::EnsureCCWOrder() { // Reverse the order of vertecies // ------------------------------ -void BS_Polygon::ReverseVertexOrder() { +void Polygon::ReverseVertexOrder() { // Vertecies are exchanged in pairs, until the list has been completely reversed for (int i = 0; i < VertexCount / 2; i++) { - BS_Vertex tempVertex = Vertecies[i]; + Vertex tempVertex = Vertecies[i]; Vertecies[i] = Vertecies[VertexCount - i - 1]; Vertecies[VertexCount - i - 1] = tempVertex; } @@ -229,7 +229,7 @@ void BS_Polygon::ReverseVertexOrder() { // Cross Product // ------------- -int BS_Polygon::CrossProduct(const BS_Vertex &V1, const BS_Vertex &V2, const BS_Vertex &V3) const { +int Polygon::CrossProduct(const Vertex &V1, const Vertex &V2, const Vertex &V3) const { return (V2.X - V1.X) * (V3.Y - V2.Y) - (V2.Y - V1.Y) * (V3.X - V2.X); } @@ -237,7 +237,7 @@ int BS_Polygon::CrossProduct(const BS_Vertex &V1, const BS_Vertex &V2, const BS_ // Scalar Product // -------------- -int BS_Polygon::DotProduct(const BS_Vertex &V1, const BS_Vertex &V2, const BS_Vertex &V3) const { +int Polygon::DotProduct(const Vertex &V1, const Vertex &V2, const Vertex &V3) const { return (V1.X - V2.X) * (V3.X - V2.X) + (V1.Y - V2.Y) * (V3.X - V2.Y); } @@ -245,7 +245,7 @@ int BS_Polygon::DotProduct(const BS_Vertex &V1, const BS_Vertex &V2, const BS_Ve // Check for self-intersections // ---------------------------- -bool BS_Polygon::CheckForSelfIntersection() const { +bool Polygon::CheckForSelfIntersection() const { // TODO: Finish this /* float AngleSum = 0.0f; @@ -275,7 +275,7 @@ bool BS_Polygon::CheckForSelfIntersection() const { // Move // ---- -void BS_Polygon::operator+=(const BS_Vertex &Delta) { +void Polygon::operator+=(const Vertex &Delta) { // Move all vertecies for (int i = 0; i < VertexCount; i++) Vertecies[i] += Delta; @@ -287,7 +287,7 @@ void BS_Polygon::operator+=(const BS_Vertex &Delta) { // Line of Sight // ------------- -bool BS_Polygon::IsLineInterior(const BS_Vertex &a, const BS_Vertex &b) const { +bool Polygon::IsLineInterior(const Vertex &a, const Vertex &b) const { // Both points have to be in the polygon if (!IsPointInPolygon(a, true) || !IsPointInPolygon(b, true)) return false; @@ -297,16 +297,16 @@ bool BS_Polygon::IsLineInterior(const BS_Vertex &a, const BS_Vertex &b) const { // Test whether the line intersects a line segment strictly (proper intersection) for (int i = 0; i < VertexCount; i++) { int j = (i + 1) % VertexCount; - const BS_Vertex &VS = Vertecies[i]; - const BS_Vertex &VE = Vertecies[j]; + const Vertex &VS = Vertecies[i]; + const Vertex &VE = Vertecies[j]; // If the line intersects a line segment strictly (proper cross section) the line is not in the polygon - if (BS_Line::DoesIntersectProperly(a, b, VS, VE)) return false; + if (Line::DoesIntersectProperly(a, b, VS, VE)) return false; // If one of the two line items is on the edge and the other is to the right of the edge, // then the line is not completely within the polygon - if (BS_Line::IsOnLineStrict(VS, VE, a) && BS_Line::IsVertexRight(VS, VE, b)) return false; - if (BS_Line::IsOnLineStrict(VS, VE, b) && BS_Line::IsVertexRight(VS, VE, a)) return false; + if (Line::IsOnLineStrict(VS, VE, a) && Line::IsVertexRight(VS, VE, b)) return false; + if (Line::IsOnLineStrict(VS, VE, b) && Line::IsVertexRight(VS, VE, a)) return false; // If one of the two line items is on a vertex, the line traces into the polygon if ((a == VS) && !IsLineInCone(i, b, true)) return false; @@ -316,7 +316,7 @@ bool BS_Polygon::IsLineInterior(const BS_Vertex &a, const BS_Vertex &b) const { return true; } -bool BS_Polygon::IsLineExterior(const BS_Vertex &a, const BS_Vertex &b) const { +bool Polygon::IsLineExterior(const Vertex &a, const Vertex &b) const { // Neither of the two points must be strictly in the polygon (on the edge is allowed) if (IsPointInPolygon(a, false) || IsPointInPolygon(b, false)) return false; @@ -326,24 +326,24 @@ bool BS_Polygon::IsLineExterior(const BS_Vertex &a, const BS_Vertex &b) const { // Test whether the line intersects a line segment strictly (proper intersection) for (int i = 0; i < VertexCount; i++) { int j = (i + 1) % VertexCount; - const BS_Vertex &VS = Vertecies[i]; - const BS_Vertex &VE = Vertecies[j]; + const Vertex &VS = Vertecies[i]; + const Vertex &VE = Vertecies[j]; // If the line intersects a line segment strictly (proper intersection), then // the line is partially inside the polygon - if (BS_Line::DoesIntersectProperly(a, b, VS, VE)) return false; + if (Line::DoesIntersectProperly(a, b, VS, VE)) return false; // If one of the two line items is on the edge and the other is to the right of the edge, // the line is not completely outside the polygon - if (BS_Line::IsOnLineStrict(VS, VE, a) && BS_Line::IsVertexLeft(VS, VE, b)) return false; - if (BS_Line::IsOnLineStrict(VS, VE, b) && BS_Line::IsVertexLeft(VS, VE, a)) return false; + if (Line::IsOnLineStrict(VS, VE, a) && Line::IsVertexLeft(VS, VE, b)) return false; + if (Line::IsOnLineStrict(VS, VE, b) && Line::IsVertexLeft(VS, VE, a)) return false; // If one of the lwo line items is on a vertex, the line must not run into the polygon if ((a == VS) && IsLineInCone(i, b, false)) return false; if ((b == VS) && IsLineInCone(i, a, false)) return false; // If the vertex with start and end point is collinear, (a VS) and (b, VS) is not in the polygon - if (BS_Line::IsOnLine(a, b, VS)) { + if (Line::IsOnLine(a, b, VS)) { if (IsLineInCone(i, a, false)) return false; if (IsLineInCone(i, b, false)) return false; } @@ -352,43 +352,43 @@ bool BS_Polygon::IsLineExterior(const BS_Vertex &a, const BS_Vertex &b) const { return true; } -bool BS_Polygon::IsLineInCone(int StartVertexIndex, const BS_Vertex &EndVertex, bool IncludeEdges) const { - const BS_Vertex &StartVertex = Vertecies[StartVertexIndex]; - const BS_Vertex &NextVertex = Vertecies[(StartVertexIndex + 1) % VertexCount]; - const BS_Vertex &PrevVertex = Vertecies[(StartVertexIndex + VertexCount - 1) % VertexCount]; +bool Polygon::IsLineInCone(int StartVertexIndex, const Vertex &EndVertex, bool IncludeEdges) const { + const Vertex &StartVertex = Vertecies[StartVertexIndex]; + const Vertex &NextVertex = Vertecies[(StartVertexIndex + 1) % VertexCount]; + const Vertex &PrevVertex = Vertecies[(StartVertexIndex + VertexCount - 1) % VertexCount]; - if (BS_Line::IsVertexLeftOn(PrevVertex, StartVertex, NextVertex)) { + if (Line::IsVertexLeftOn(PrevVertex, StartVertex, NextVertex)) { if (IncludeEdges) - return BS_Line::IsVertexLeftOn(EndVertex, StartVertex, NextVertex) && - BS_Line::IsVertexLeftOn(StartVertex, EndVertex, PrevVertex); + return Line::IsVertexLeftOn(EndVertex, StartVertex, NextVertex) && + Line::IsVertexLeftOn(StartVertex, EndVertex, PrevVertex); else - return BS_Line::IsVertexLeft(EndVertex, StartVertex, NextVertex) && - BS_Line::IsVertexLeft(StartVertex, EndVertex, PrevVertex); + return Line::IsVertexLeft(EndVertex, StartVertex, NextVertex) && + Line::IsVertexLeft(StartVertex, EndVertex, PrevVertex); } else { if (IncludeEdges) - return !(BS_Line::IsVertexLeft(EndVertex, StartVertex, PrevVertex) && - BS_Line::IsVertexLeft(StartVertex, EndVertex, NextVertex)); + return !(Line::IsVertexLeft(EndVertex, StartVertex, PrevVertex) && + Line::IsVertexLeft(StartVertex, EndVertex, NextVertex)); else - return !(BS_Line::IsVertexLeftOn(EndVertex, StartVertex, PrevVertex) && - BS_Line::IsVertexLeftOn(StartVertex, EndVertex, NextVertex)); + return !(Line::IsVertexLeftOn(EndVertex, StartVertex, PrevVertex) && + Line::IsVertexLeftOn(StartVertex, EndVertex, NextVertex)); } } // Point-Polygon Tests // ------------------- -bool BS_Polygon::IsPointInPolygon(int X, int Y, bool BorderBelongsToPolygon) const { - return IsPointInPolygon(BS_Vertex(X, Y), BorderBelongsToPolygon); +bool Polygon::IsPointInPolygon(int X, int Y, bool BorderBelongsToPolygon) const { + return IsPointInPolygon(Vertex(X, Y), BorderBelongsToPolygon); } -bool BS_Polygon::IsPointInPolygon(const BS_Vertex &Point, bool EdgesBelongToPolygon) const { +bool Polygon::IsPointInPolygon(const Vertex &Point, bool EdgesBelongToPolygon) const { int Rcross = 0; // Number of right-side overlaps int Lcross = 0; // Number of left-side overlaps // Each edge is checked whether it cuts the outgoing stream from the point for (int i = 0; i < VertexCount; i++) { - const BS_Vertex &EdgeStart = Vertecies[i]; - const BS_Vertex &EdgeEnd = Vertecies[(i + 1) % VertexCount]; + const Vertex &EdgeStart = Vertecies[i]; + const Vertex &EdgeEnd = Vertecies[(i + 1) % VertexCount]; // A vertex is a point? Then it lies on one edge of the polygon if (Point == EdgeStart) return EdgesBelongToPolygon; @@ -414,7 +414,7 @@ bool BS_Polygon::IsPointInPolygon(const BS_Vertex &Point, bool EdgesBelongToPoly else return false; } -bool BS_Polygon::Persist(BS_OutputPersistenceBlock &Writer) { +bool Polygon::Persist(BS_OutputPersistenceBlock &Writer) { Writer.Write(VertexCount); for (int i = 0; i < VertexCount; ++i) { Writer.Write(Vertecies[i].X); @@ -424,16 +424,16 @@ bool BS_Polygon::Persist(BS_OutputPersistenceBlock &Writer) { return true; } -bool BS_Polygon::Unpersist(BS_InputPersistenceBlock &Reader) { +bool Polygon::Unpersist(BS_InputPersistenceBlock &Reader) { int StoredVertexCount; Reader.Read(StoredVertexCount); - Common::Array<BS_Vertex> StoredVertecies; + Common::Array<Vertex> StoredVertecies; for (int i = 0; i < StoredVertexCount; ++i) { int x, y; Reader.Read(x); Reader.Read(y); - StoredVertecies.push_back(BS_Vertex(x, y)); + StoredVertecies.push_back(Vertex(x, y)); } Init(StoredVertexCount, &StoredVertecies[0]); @@ -444,11 +444,11 @@ bool BS_Polygon::Unpersist(BS_InputPersistenceBlock &Reader) { // Main Focus // ---------- -BS_Vertex BS_Polygon::GetCentroid() const { +Vertex Polygon::GetCentroid() const { return m_Centroid; } -BS_Vertex BS_Polygon::ComputeCentroid() const { +Vertex Polygon::ComputeCentroid() const { // Area of the polygon is calculated int DoubleArea = 0; for (int i = 0; i < VertexCount; ++i) { @@ -456,10 +456,10 @@ BS_Vertex BS_Polygon::ComputeCentroid() const { } // Avoid division by zero in the next step - if (DoubleArea == 0) return BS_Vertex(); + if (DoubleArea == 0) return Vertex(); // Calculate centroid - BS_Vertex Centroid; + Vertex Centroid; for (int i = 0; i < VertexCount; ++i) { int Area = Vertecies[i].X * Vertecies[i + 1].Y - Vertecies[i + 1].X * Vertecies[i].Y; Centroid.X += (Vertecies[i].X + Vertecies[i + 1].X) * Area; diff --git a/engines/sword25/math/polygon.h b/engines/sword25/math/polygon.h index 1621efb645..bb0f2d774f 100644 --- a/engines/sword25/math/polygon.h +++ b/engines/sword25/math/polygon.h @@ -46,29 +46,29 @@ namespace Sword25 { // Forward Declarations // ----------------------------------------------------------------------------- -class BS_Vertex; +class Vertex; /** @brief Eine Polygonklasse. */ -class BS_Polygon : public BS_Persistable { +class Polygon : public BS_Persistable { public: /** * Creates an object of type #BS_Polygon, containing 0 Vertecies. * * With the method Init(), Vertices can be added in later */ - BS_Polygon(); + Polygon(); /** * Copy constructor */ - BS_Polygon(const BS_Polygon &Other); + Polygon(const Polygon &Other); /** * Creates a polygon using persisted data */ - BS_Polygon(BS_InputPersistenceBlock &Reader); + Polygon(BS_InputPersistenceBlock &Reader); /** * Creaes an object of type #BS_Polygon, and assigns Vertices to it @@ -77,12 +77,12 @@ public: * @remark The Vertecies that define a polygon must not have any self-intersections. * If the polygon does have self-intersections, then an empty polygon object is created. */ - BS_Polygon(int VertexCount, const BS_Vertex *Vertecies); + Polygon(int VertexCount, const Vertex *Vertecies); /** * Deletes the BS_Polygon object */ - virtual ~BS_Polygon(); + virtual ~Polygon(); /** * Initialises the BS_Polygon with a list of Vertecies. @@ -95,7 +95,7 @@ public: * @return Returns false if the Vertecies have self-intersections. In this case, * the object is not initialised. */ - bool Init(int VertexCount, const BS_Vertex *Vertecies); + bool Init(int VertexCount, const Vertex *Vertecies); // // ** Exploratory methods ** @@ -137,7 +137,7 @@ public: * @param BorderBelongsToPolygon Specifies whether the edge of the polygon should be considered * @return Returns true if the point is inside the polygon, false if it is outside. */ - bool IsPointInPolygon(const BS_Vertex &Vertex, bool BorderBelongsToPolygon = true) const; + bool IsPointInPolygon(const Vertex &Vertex, bool BorderBelongsToPolygon = true) const; /** * Checks whether a point is inside the polygon @@ -151,14 +151,14 @@ public: /** * Returns the focus/centroid of the polygon */ - BS_Vertex GetCentroid() const; + Vertex GetCentroid() const; // Edge belongs to the polygon // Polygon must be CW - bool IsLineInterior(const BS_Vertex &a, const BS_Vertex &b) const; + bool IsLineInterior(const Vertex &a, const Vertex &b) const; // Edge does not belong to the polygon // Polygon must be CW - bool IsLineExterior(const BS_Vertex &a, const BS_Vertex &b) const; + bool IsLineExterior(const Vertex &a, const Vertex &b) const; // // Manipulation methods @@ -183,7 +183,7 @@ public: * Moves the polygon. * @param Delta The vertex around the polygon to be moved. */ - void operator+=(const BS_Vertex &Delta); + void operator+=(const Vertex &Delta); // //------------------ @@ -192,7 +192,7 @@ public: /// Specifies the number of Vertecies in the Vertecies array. int VertexCount; /// COntains the Vertecies of the polygon - BS_Vertex *Vertecies; + Vertex *Vertecies; virtual bool Persist(BS_OutputPersistenceBlock &Writer); virtual bool Unpersist(BS_InputPersistenceBlock &Reader); @@ -200,12 +200,12 @@ public: private: bool m_IsCW; bool m_IsConvex; - BS_Vertex m_Centroid; + Vertex m_Centroid; /** * Computes the centroid of the polygon. */ - BS_Vertex ComputeCentroid() const; + Vertex ComputeCentroid() const; /** * Determines how the Vertecies of the polygon are arranged. @@ -228,7 +228,7 @@ private: * @return Returns the cross-product of the three vertecies * @todo This method would be better as a method of the BS_Vertex class */ - int CrossProduct(const BS_Vertex &V1, const BS_Vertex &V2, const BS_Vertex &V3) const; + int CrossProduct(const Vertex &V1, const Vertex &V2, const Vertex &V3) const; /** * Computes the scalar product of two vectors spanning three vertecies @@ -241,7 +241,7 @@ private: * @return Returns the dot product of the three Vertecies. * @todo This method would be better as a method of the BS_Vertex class */ - int DotProduct(const BS_Vertex &V1, const BS_Vertex &V2, const BS_Vertex &V3) const; + int DotProduct(const Vertex &V1, const Vertex &V2, const Vertex &V3) const; /** * Checks whether the polygon is self-intersecting @@ -258,7 +258,7 @@ private: */ int FindLRVertexIndex() const; - bool IsLineInCone(int StartVertexIndex, const BS_Vertex &EndVertex, bool IncludeEdges) const; + bool IsLineInCone(int StartVertexIndex, const Vertex &EndVertex, bool IncludeEdges) const; }; } // End of namespace Sword25 diff --git a/engines/sword25/math/rect.h b/engines/sword25/math/rect.h index e97feefe41..c08169e86e 100644 --- a/engines/sword25/math/rect.h +++ b/engines/sword25/math/rect.h @@ -98,7 +98,7 @@ public: return isValidRect(); } - bool IsPointInRect(const BS_Vertex &Vertex) const { + bool IsPointInRect(const Vertex &Vertex) const { return contains(Vertex.X, Vertex.Y); } diff --git a/engines/sword25/math/region.cpp b/engines/sword25/math/region.cpp index b967d001c5..0fd9af861d 100644 --- a/engines/sword25/math/region.cpp +++ b/engines/sword25/math/region.cpp @@ -46,69 +46,69 @@ namespace Sword25 { // Constructor / Destructor // ------------------------ -BS_Region::BS_Region() : m_Valid(false), m_Type(RT_REGION) { - BS_RegionRegistry::GetInstance().RegisterObject(this); +Region::Region() : m_Valid(false), m_Type(RT_REGION) { + RegionRegistry::GetInstance().RegisterObject(this); } // ----------------------------------------------------------------------------- -BS_Region::BS_Region(BS_InputPersistenceBlock &Reader, unsigned int Handle) : m_Valid(false), m_Type(RT_REGION) { - BS_RegionRegistry::GetInstance().RegisterObject(this, Handle); +Region::Region(BS_InputPersistenceBlock &Reader, unsigned int Handle) : m_Valid(false), m_Type(RT_REGION) { + RegionRegistry::GetInstance().RegisterObject(this, Handle); Unpersist(Reader); } // ----------------------------------------------------------------------------- -unsigned int BS_Region::Create(REGION_TYPE Type) { - BS_Region *RegionPtr = NULL; +unsigned int Region::Create(REGION_TYPE Type) { + Region *RegionPtr = NULL; switch (Type) { case RT_REGION: - RegionPtr = new BS_Region(); + RegionPtr = new Region(); break; case RT_WALKREGION: - RegionPtr = new BS_WalkRegion(); + RegionPtr = new WalkRegion(); break; default: BS_ASSERT(true); } - return BS_RegionRegistry::GetInstance().ResolvePtr(RegionPtr); + return RegionRegistry::GetInstance().ResolvePtr(RegionPtr); } // ----------------------------------------------------------------------------- -unsigned int BS_Region::Create(BS_InputPersistenceBlock &Reader, unsigned int Handle) { +unsigned int Region::Create(BS_InputPersistenceBlock &Reader, unsigned int Handle) { // Read type unsigned int Type; Reader.Read(Type); // Depending on the type, create a new BS_Region or BS_WalkRegion object - BS_Region *RegionPtr = NULL; + Region *RegionPtr = NULL; if (Type == RT_REGION) { - RegionPtr = new BS_Region(Reader, Handle); + RegionPtr = new Region(Reader, Handle); } else if (Type == RT_WALKREGION) { - RegionPtr = new BS_WalkRegion(Reader, Handle); + RegionPtr = new WalkRegion(Reader, Handle); } else { BS_ASSERT(false); } - return BS_RegionRegistry::GetInstance().ResolvePtr(RegionPtr); + return RegionRegistry::GetInstance().ResolvePtr(RegionPtr); } // ----------------------------------------------------------------------------- -BS_Region::~BS_Region() { - BS_RegionRegistry::GetInstance().DeregisterObject(this); +Region::~Region() { + RegionRegistry::GetInstance().DeregisterObject(this); } // ----------------------------------------------------------------------------- -bool BS_Region::Init(const BS_Polygon &Contour, const Common::Array<BS_Polygon> *pHoles) { +bool Region::Init(const Polygon &Contour, const Common::Array<Polygon> *pHoles) { // Reset object state m_Valid = false; - m_Position = BS_Vertex(0, 0); + m_Position = Vertex(0, 0); m_Polygons.clear(); // Reserve sufficient space for countour and holes in the polygon list @@ -118,7 +118,7 @@ bool BS_Region::Init(const BS_Polygon &Contour, const Common::Array<BS_Polygon> m_Polygons.reserve(1); // The first polygon will be the contour - m_Polygons.push_back(BS_Polygon()); + m_Polygons.push_back(Polygon()); m_Polygons[0].Init(Contour.VertexCount, Contour.Vertecies); // Make sure that the Vertecies in the Contour are arranged in a clockwise direction m_Polygons[0].EnsureCWOrder(); @@ -126,7 +126,7 @@ bool BS_Region::Init(const BS_Polygon &Contour, const Common::Array<BS_Polygon> // Place the hole polygons in the following positions if (pHoles) { for (unsigned int i = 0; i < pHoles->size(); ++i) { - m_Polygons.push_back(BS_Polygon()); + m_Polygons.push_back(Polygon()); m_Polygons[i + 1].Init((*pHoles)[i].VertexCount, (*pHoles)[i].Vertecies); m_Polygons[i + 1].EnsureCWOrder(); } @@ -142,7 +142,7 @@ bool BS_Region::Init(const BS_Polygon &Contour, const Common::Array<BS_Polygon> // ----------------------------------------------------------------------------- -void BS_Region::UpdateBoundingBox() { +void Region::UpdateBoundingBox() { if (m_Polygons[0].VertexCount) { int MinX = m_Polygons[0].Vertecies[0].X; int MaxX = m_Polygons[0].Vertecies[0].X; @@ -163,12 +163,12 @@ void BS_Region::UpdateBoundingBox() { // Position Changes // ---------------- -void BS_Region::SetPos(int X, int Y) { +void Region::SetPos(int X, int Y) { // Calculate the difference between the old and new position - BS_Vertex Delta(X - m_Position.X, Y - m_Position.Y); + Vertex Delta(X - m_Position.X, Y - m_Position.Y); // Save the new position - m_Position = BS_Vertex(X, Y); + m_Position = Vertex(X, Y); // Move all the vertecies for (unsigned int i = 0; i < m_Polygons.size(); ++i) { @@ -181,20 +181,20 @@ void BS_Region::SetPos(int X, int Y) { // ----------------------------------------------------------------------------- -void BS_Region::SetPosX(int X) { +void Region::SetPosX(int X) { SetPos(X, m_Position.Y); } // ----------------------------------------------------------------------------- -void BS_Region::SetPosY(int Y) { +void Region::SetPosY(int Y) { SetPos(m_Position.X, Y); } // Point-Region Tests // ------------------ -bool BS_Region::IsPointInRegion(int X, int Y) const { +bool Region::IsPointInRegion(int X, int Y) const { // Test whether the point is in the bounding box if (m_BoundingBox.IsPointInRect(X, Y)) { // Test whether the point is in the contour @@ -214,13 +214,13 @@ bool BS_Region::IsPointInRegion(int X, int Y) const { // ----------------------------------------------------------------------------- -bool BS_Region::IsPointInRegion(const BS_Vertex &Vertex) const { +bool Region::IsPointInRegion(const Vertex &Vertex) const { return IsPointInRegion(Vertex.X, Vertex.Y); } // ----------------------------------------------------------------------------- -BS_Vertex BS_Region::FindClosestRegionPoint(const BS_Vertex &Point) const { +Vertex Region::FindClosestRegionPoint(const Vertex &Point) const { // Determine whether the point is inside a hole. If that is the case, the closest // point on the edge of the hole is determined int PolygonIdx = 0; @@ -233,18 +233,18 @@ BS_Vertex BS_Region::FindClosestRegionPoint(const BS_Vertex &Point) const { } } - const BS_Polygon &Polygon = m_Polygons[PolygonIdx]; + const Polygon &Polygon = m_Polygons[PolygonIdx]; BS_ASSERT(Polygon.VertexCount > 1); // For each line of the polygon, calculate the point that is cloest to the given point // The point of this set with the smallest distance to the given point is the result. - BS_Vertex ClosestVertex = FindClosestPointOnLine(Polygon.Vertecies[0], Polygon.Vertecies[1], Point); + Vertex ClosestVertex = FindClosestPointOnLine(Polygon.Vertecies[0], Polygon.Vertecies[1], Point); int ClosestVertexDistance2 = ClosestVertex.Distance(Point); for (int i = 1; i < Polygon.VertexCount; ++i) { int j = (i + 1) % Polygon.VertexCount; - BS_Vertex CurVertex = FindClosestPointOnLine(Polygon.Vertecies[i], Polygon.Vertecies[j], Point); + Vertex CurVertex = FindClosestPointOnLine(Polygon.Vertecies[i], Polygon.Vertecies[j], Point); if (CurVertex.Distance(Point) < ClosestVertexDistance2) { ClosestVertex = CurVertex; ClosestVertexDistance2 = CurVertex.Distance(Point); @@ -258,22 +258,22 @@ BS_Vertex BS_Region::FindClosestRegionPoint(const BS_Vertex &Point) const { else { // Try to construct a point within the region - 8 points are tested in the immediate vacinity // of the point - if (IsPointInRegion(ClosestVertex + BS_Vertex(-2, -2))) - return ClosestVertex + BS_Vertex(-2, -2); - else if (IsPointInRegion(ClosestVertex + BS_Vertex(0, -2))) - return ClosestVertex + BS_Vertex(0, -2); - else if (IsPointInRegion(ClosestVertex + BS_Vertex(2, -2))) - return ClosestVertex + BS_Vertex(2, -2); - else if (IsPointInRegion(ClosestVertex + BS_Vertex(-2, 0))) - return ClosestVertex + BS_Vertex(-2, 0); - else if (IsPointInRegion(ClosestVertex + BS_Vertex(0, 2))) - return ClosestVertex + BS_Vertex(0, 2); - else if (IsPointInRegion(ClosestVertex + BS_Vertex(-2, 2))) - return ClosestVertex + BS_Vertex(-2, 2); - else if (IsPointInRegion(ClosestVertex + BS_Vertex(-2, 0))) - return ClosestVertex + BS_Vertex(2, 2); - else if (IsPointInRegion(ClosestVertex + BS_Vertex(2, 2))) - return ClosestVertex + BS_Vertex(2, 2); + if (IsPointInRegion(ClosestVertex + Vertex(-2, -2))) + return ClosestVertex + Vertex(-2, -2); + else if (IsPointInRegion(ClosestVertex + Vertex(0, -2))) + return ClosestVertex + Vertex(0, -2); + else if (IsPointInRegion(ClosestVertex + Vertex(2, -2))) + return ClosestVertex + Vertex(2, -2); + else if (IsPointInRegion(ClosestVertex + Vertex(-2, 0))) + return ClosestVertex + Vertex(-2, 0); + else if (IsPointInRegion(ClosestVertex + Vertex(0, 2))) + return ClosestVertex + Vertex(0, 2); + else if (IsPointInRegion(ClosestVertex + Vertex(-2, 2))) + return ClosestVertex + Vertex(-2, 2); + else if (IsPointInRegion(ClosestVertex + Vertex(-2, 0))) + return ClosestVertex + Vertex(2, 2); + else if (IsPointInRegion(ClosestVertex + Vertex(2, 2))) + return ClosestVertex + Vertex(2, 2); // If no point could be found that way that lies within the region, find the next point ClosestVertex = Polygon.Vertecies[0]; @@ -295,7 +295,7 @@ BS_Vertex BS_Region::FindClosestRegionPoint(const BS_Vertex &Point) const { // ----------------------------------------------------------------------------- -BS_Vertex BS_Region::FindClosestPointOnLine(const BS_Vertex &LineStart, const BS_Vertex &LineEnd, const BS_Vertex Point) const { +Vertex Region::FindClosestPointOnLine(const Vertex &LineStart, const Vertex &LineEnd, const Vertex Point) const { float Vector1X = static_cast<float>(Point.X - LineStart.X); float Vector1Y = static_cast<float>(Point.Y - LineStart.Y); float Vector2X = static_cast<float>(LineEnd.X - LineStart.X); @@ -310,7 +310,7 @@ BS_Vertex BS_Region::FindClosestPointOnLine(const BS_Vertex &LineStart, const BS if (Dot <= 0) return LineStart; if (Dot >= Distance) return LineEnd; - BS_Vertex Vector3(static_cast<int>(Vector2X * Dot + 0.5f), static_cast<int>(Vector2Y * Dot + 0.5f)); + Vertex Vector3(static_cast<int>(Vector2X * Dot + 0.5f), static_cast<int>(Vector2Y * Dot + 0.5f)); return LineStart + Vector3; } @@ -318,11 +318,11 @@ BS_Vertex BS_Region::FindClosestPointOnLine(const BS_Vertex &LineStart, const BS // Line of Sight // ----------------------------------------------------------------------------- -bool BS_Region::IsLineOfSight(const BS_Vertex &a, const BS_Vertex &b) const { +bool Region::IsLineOfSight(const Vertex &a, const Vertex &b) const { BS_ASSERT(m_Polygons.size()); // The line must be within the contour polygon, and outside of any hole polygons - Common::Array<BS_Polygon>::const_iterator iter = m_Polygons.begin(); + Common::Array<Polygon>::const_iterator iter = m_Polygons.begin(); if (!(*iter).IsLineInterior(a, b)) return false; for (iter++; iter != m_Polygons.end(); iter++) if (!(*iter).IsLineExterior(a, b)) return false; @@ -334,7 +334,7 @@ bool BS_Region::IsLineOfSight(const BS_Vertex &a, const BS_Vertex &b) const { // Persistence // ----------------------------------------------------------------------------- -bool BS_Region::Persist(BS_OutputPersistenceBlock &Writer) { +bool Region::Persist(BS_OutputPersistenceBlock &Writer) { bool Result = true; Writer.Write(static_cast<unsigned int>(m_Type)); @@ -343,7 +343,7 @@ bool BS_Region::Persist(BS_OutputPersistenceBlock &Writer) { Writer.Write(m_Position.Y); Writer.Write(m_Polygons.size()); - Common::Array<BS_Polygon>::iterator It = m_Polygons.begin(); + Common::Array<Polygon>::iterator It = m_Polygons.begin(); while (It != m_Polygons.end()) { Result &= It->Persist(Writer); ++It; @@ -359,7 +359,7 @@ bool BS_Region::Persist(BS_OutputPersistenceBlock &Writer) { // ----------------------------------------------------------------------------- -bool BS_Region::Unpersist(BS_InputPersistenceBlock &Reader) { +bool Region::Unpersist(BS_InputPersistenceBlock &Reader) { Reader.Read(m_Valid); Reader.Read(m_Position.X); Reader.Read(m_Position.Y); @@ -368,7 +368,7 @@ bool BS_Region::Unpersist(BS_InputPersistenceBlock &Reader) { unsigned int PolygonCount; Reader.Read(PolygonCount); for (unsigned int i = 0; i < PolygonCount; ++i) { - m_Polygons.push_back(BS_Polygon(Reader)); + m_Polygons.push_back(Polygon(Reader)); } Reader.Read(m_BoundingBox.left); @@ -381,11 +381,11 @@ bool BS_Region::Unpersist(BS_InputPersistenceBlock &Reader) { // ----------------------------------------------------------------------------- -BS_Vertex BS_Region::GetCentroid() const { +Vertex Region::GetCentroid() const { if (m_Polygons.size() > 0) return m_Polygons[0].GetCentroid(); return - BS_Vertex(); + Vertex(); } } // End of namespace Sword25 diff --git a/engines/sword25/math/region.h b/engines/sword25/math/region.h index e3718dd1c9..2afc9e9a45 100644 --- a/engines/sword25/math/region.h +++ b/engines/sword25/math/region.h @@ -52,7 +52,7 @@ namespace Sword25 { * arranged in a clockwise direction, so that the polygon working algorithms will * work properly. */ -class BS_Region : public BS_Persistable { +class Region : public BS_Persistable { protected: /** * Creates a new BS_Region object @@ -60,9 +60,9 @@ protected: * After creation the object is invaild (IsValid() return false), but a call can * be made later on to Init() to set up the region into a valid state. */ - BS_Region(); + Region(); - BS_Region(BS_InputPersistenceBlock &Reader, unsigned int Handle); + Region(BS_InputPersistenceBlock &Reader, unsigned int Handle); public: enum REGION_TYPE { @@ -73,7 +73,7 @@ public: static unsigned int Create(REGION_TYPE Type); static unsigned int Create(BS_InputPersistenceBlock &Reader, unsigned int Handle = 0); - virtual ~BS_Region(); + virtual ~Region(); /** * Initialises a BS_Region object @@ -83,7 +83,7 @@ public: * @return Returns true if the initialisation was successful, otherwise false. * @remark If the region was already initialised, the old state will be deleted. */ - virtual bool Init(const BS_Polygon &Contour, const Common::Array<BS_Polygon> *pHoles = NULL); + virtual bool Init(const Polygon &Contour, const Common::Array<Polygon> *pHoles = NULL); // // Exploratory Methods @@ -101,7 +101,7 @@ public: /** * Returns the position of the region */ - const BS_Vertex &GetPosition() const { + const Vertex &GetPosition() const { return m_Position; } @@ -124,7 +124,7 @@ public: * @param Vertex A verex with the co-ordinates of the test point * @return Returns true if the point is within the region, otherwise false. */ - bool IsPointInRegion(const BS_Vertex &Vertex) const; + bool IsPointInRegion(const Vertex &Vertex) const; /** * Indicates whether a point is inside the region @@ -137,7 +137,7 @@ public: /** * Returns the countour of the region */ - const BS_Polygon &GetContour() const { + const Polygon &GetContour() const { return m_Polygons[0]; } @@ -154,7 +154,7 @@ public: * The index must be between 0 and GetHoleCount() - 1. * @return Returns the desired hole polygon */ - inline const BS_Polygon &GetHole(unsigned int i) const; + inline const Polygon &GetHole(unsigned int i) const; /** * For a point outside the region, finds the closest point inside the region @@ -164,14 +164,14 @@ public: * One should not therefore rely on the fact that there is really no point in * the region which is closer to the given point. */ - BS_Vertex FindClosestRegionPoint(const BS_Vertex &Point) const; + Vertex FindClosestRegionPoint(const Vertex &Point) const; /** * Returns the centroid for the region */ - BS_Vertex GetCentroid() const; + Vertex GetCentroid() const; - bool IsLineOfSight(const BS_Vertex &a, const BS_Vertex &b) const; + bool IsLineOfSight(const Vertex &a, const Vertex &b) const; // // Manipulation Methods @@ -209,10 +209,10 @@ protected: /// This variable indicates whether the current object state is valid bool m_Valid; /// This vertex is the position of the region - BS_Vertex m_Position; + Vertex m_Position; /// This array contains all the polygons that define the region. The first element of // the array is the contour, all others are the holes - Common::Array<BS_Polygon> m_Polygons; + Common::Array<Polygon> m_Polygons; /// The bounding box for the region BS_Rect m_BoundingBox; @@ -228,7 +228,7 @@ protected: * @param Point The point to be compared against * @return Returns the point on the line which is cloest to the passed point. */ - BS_Vertex FindClosestPointOnLine(const BS_Vertex &LineStart, const BS_Vertex &LineEnd, const BS_Vertex Point) const; + Vertex FindClosestPointOnLine(const Vertex &LineStart, const Vertex &LineEnd, const Vertex Point) const; }; @@ -236,7 +236,7 @@ protected: // Inlines // ----------------------------------------------------------------------------- -inline const BS_Polygon &BS_Region::GetHole(unsigned int i) const { +inline const Polygon &Region::GetHole(unsigned int i) const { BS_ASSERT(i < m_Polygons.size() - 1); return m_Polygons[i + 1]; } diff --git a/engines/sword25/math/regionregistry.cpp b/engines/sword25/math/regionregistry.cpp index b03d1c1152..55ace78ab2 100644 --- a/engines/sword25/math/regionregistry.cpp +++ b/engines/sword25/math/regionregistry.cpp @@ -53,23 +53,23 @@ namespace Sword25 { // Implementation // ----------------------------------------------------------------------------- -Common::SharedPtr<BS_RegionRegistry> BS_RegionRegistry::m_InstancePtr; +Common::SharedPtr<RegionRegistry> RegionRegistry::m_InstancePtr; // ----------------------------------------------------------------------------- -void BS_RegionRegistry::LogErrorLn(const char *Message) const { +void RegionRegistry::LogErrorLn(const char *Message) const { BS_LOG_ERRORLN(Message); } // ----------------------------------------------------------------------------- -void BS_RegionRegistry::LogWarningLn(const char *Message) const { +void RegionRegistry::LogWarningLn(const char *Message) const { BS_LOG_WARNINGLN(Message); } // ----------------------------------------------------------------------------- -bool BS_RegionRegistry::Persist(BS_OutputPersistenceBlock &Writer) { +bool RegionRegistry::Persist(BS_OutputPersistenceBlock &Writer) { bool Result = true; // Write out the next handle @@ -95,7 +95,7 @@ bool BS_RegionRegistry::Persist(BS_OutputPersistenceBlock &Writer) { // ----------------------------------------------------------------------------- -bool BS_RegionRegistry::Unpersist(BS_InputPersistenceBlock &Reader) { +bool RegionRegistry::Unpersist(BS_InputPersistenceBlock &Reader) { bool Result = true; // Read in the next handle @@ -116,7 +116,7 @@ bool BS_RegionRegistry::Unpersist(BS_InputPersistenceBlock &Reader) { Reader.Read(Handle); // BS_Region restore - Result &= BS_Region::Create(Reader, Handle) != 0; + Result &= Region::Create(Reader, Handle) != 0; } return Reader.IsGood() && Result; diff --git a/engines/sword25/math/regionregistry.h b/engines/sword25/math/regionregistry.h index 9600dbbdc4..13642c965c 100644 --- a/engines/sword25/math/regionregistry.h +++ b/engines/sword25/math/regionregistry.h @@ -50,16 +50,16 @@ namespace Sword25 { // Forward Declarations // ----------------------------------------------------------------------------- -class BS_Region; +class Region; // ----------------------------------------------------------------------------- // Class definitions // ----------------------------------------------------------------------------- -class BS_RegionRegistry : public BS_ObjectRegistry<BS_Region>, public BS_Persistable { +class RegionRegistry : public BS_ObjectRegistry<Region>, public BS_Persistable { public: - static BS_RegionRegistry &GetInstance() { - if (!m_InstancePtr.get()) m_InstancePtr = Common::SharedPtr<BS_RegionRegistry>(new BS_RegionRegistry()); + static RegionRegistry &GetInstance() { + if (!m_InstancePtr.get()) m_InstancePtr = Common::SharedPtr<RegionRegistry>(new RegionRegistry()); return *m_InstancePtr.get(); } @@ -70,7 +70,7 @@ private: virtual void LogErrorLn(const char *Message) const; virtual void LogWarningLn(const char *Message) const; - static Common::SharedPtr<BS_RegionRegistry> m_InstancePtr; + static Common::SharedPtr<RegionRegistry> m_InstancePtr; }; } // End of namespace Sword25 diff --git a/engines/sword25/math/vertex.cpp b/engines/sword25/math/vertex.cpp index 575618dbb9..058f1c5cd1 100644 --- a/engines/sword25/math/vertex.cpp +++ b/engines/sword25/math/vertex.cpp @@ -48,7 +48,7 @@ extern "C" namespace Sword25 { -BS_Vertex &BS_Vertex::LuaVertexToVertex(lua_State *L, int StackIndex, BS_Vertex &Vertex) { +Vertex &Vertex::LuaVertexToVertex(lua_State *L, int StackIndex, Vertex &vertex) { #ifdef DEBUG int __startStackDepth = lua_gettop(L); #endif @@ -60,37 +60,37 @@ BS_Vertex &BS_Vertex::LuaVertexToVertex(lua_State *L, int StackIndex, BS_Vertex lua_pushstring(L, "X"); lua_gettable(L, StackIndex); if (!lua_isnumber(L, -1)) luaL_argcheck(L, 0, StackIndex, "the X component has to be a number"); - Vertex.X = static_cast<int>(lua_tonumber(L, -1)); + vertex.X = static_cast<int>(lua_tonumber(L, -1)); lua_pop(L, 1); // Read Y Component lua_pushstring(L, "Y"); lua_gettable(L, StackIndex); if (!lua_isnumber(L, -1)) luaL_argcheck(L, 0, StackIndex, "the Y component has to be a number"); - Vertex.Y = static_cast<int>(lua_tonumber(L, -1)); + vertex.Y = static_cast<int>(lua_tonumber(L, -1)); lua_pop(L, 1); #ifdef DEBUG BS_ASSERT(__startStackDepth == lua_gettop(L)); #endif - return Vertex; + return vertex; } // ----------------------------------------------------------------------------- -void BS_Vertex::VertexToLuaVertex(lua_State *L, const BS_Vertex &Vertex) { +void Vertex::VertexToLuaVertex(lua_State *L, const Vertex &vertex) { // Create New Table lua_newtable(L); // X value is written to table lua_pushstring(L, "X"); - lua_pushnumber(L, Vertex.X); + lua_pushnumber(L, vertex.X); lua_settable(L, -3); // Y value is written to table lua_pushstring(L, "Y"); - lua_pushnumber(L, Vertex.Y); + lua_pushnumber(L, vertex.Y); lua_settable(L, -3); } diff --git a/engines/sword25/math/vertex.h b/engines/sword25/math/vertex.h index b39de82fac..22fc1e49e4 100644 --- a/engines/sword25/math/vertex.h +++ b/engines/sword25/math/vertex.h @@ -60,10 +60,10 @@ namespace Sword25 { /** * Defines a 2-D Vertex */ -class BS_Vertex { +class Vertex { public: - BS_Vertex() : X(0), Y(0) {}; - BS_Vertex(int X_, int Y_) { + Vertex() : X(0), Y(0) {}; + Vertex(int X_, int Y_) { this->X = X_; this->Y = Y_; } @@ -74,21 +74,21 @@ public: /** * Compares two Vertecies. */ - inline bool operator==(const BS_Vertex &rhs) const { + inline bool operator==(const Vertex &rhs) const { if (X == rhs.X && Y == rhs.Y) return true; return false; } /** * Compares two Vertecies. */ - inline bool operator!=(const BS_Vertex &rhs) const { + inline bool operator!=(const Vertex &rhs) const { if (X != rhs.X || Y != rhs.Y) return true; return false; } /** * Adds a vertex to vertex */ - inline void operator+=(const BS_Vertex &Delta) { + inline void operator+=(const Vertex &Delta) { X += Delta.X; Y += Delta.Y; } @@ -96,7 +96,7 @@ public: /** * Subtracts a vertex from a vertex */ - inline void operator-=(const BS_Vertex &Delta) { + inline void operator-=(const Vertex &Delta) { X -= Delta.X; Y -= Delta.Y; } @@ -104,15 +104,15 @@ public: /** * Adds two vertecies */ - inline BS_Vertex operator+(const BS_Vertex &Delta) const { - return BS_Vertex(X + Delta.X, Y + Delta.Y); + inline Vertex operator+(const Vertex &Delta) const { + return Vertex(X + Delta.X, Y + Delta.Y); } /** * Subtracts two vertecies */ - inline BS_Vertex operator-(const BS_Vertex &Delta) const { - return BS_Vertex(X - Delta.X, Y - Delta.Y); + inline Vertex operator-(const Vertex &Delta) const { + return Vertex(X - Delta.X, Y - Delta.Y); } /** @@ -122,8 +122,8 @@ public: * @remark If only distances should be compared, this method should be used because * it is faster than Distance() */ - inline int Distance2(const BS_Vertex &Vertex) const { - return (X - Vertex.X) * (X - Vertex.X) + (Y - Vertex.Y) * (Y - Vertex.Y); + inline int Distance2(const Vertex &vertex) const { + return (X - vertex.X) * (X - vertex.X) + (Y - vertex.Y) * (Y - vertex.Y); } /** @@ -132,8 +132,8 @@ public: * @return Returns the square of the distance between itself and the passed vertex * @remark If only distances should be compared, Distance2() should be used, since it is faster. */ - inline int Distance(const BS_Vertex &Vertex) const { - return (int)(sqrtf(static_cast<float>(Distance2(Vertex))) + 0.5); + inline int Distance(const Vertex &vertex) const { + return (int)(sqrtf(static_cast<float>(Distance2(vertex))) + 0.5); } /** @@ -142,8 +142,8 @@ public: * @param Vertex The second vertex * @return Returns the cross product of this vertex and the passed vertex. */ - inline int ComputeCrossProduct(const BS_Vertex &Vertex) const { - return X * Vertex.Y - Vertex.X * Y; + inline int ComputeCrossProduct(const Vertex &vertex) const { + return X * vertex.Y - vertex.X * Y; } /** @@ -151,8 +151,8 @@ public: * @param Vertex The second vertex * @return Returns the dot product of this vertex and the passed vertex. */ - inline int ComputeDotProduct(const BS_Vertex &Vertex) const { - return X * Vertex.X + Y * Vertex.Y; + inline int ComputeDotProduct(const Vertex &vertex) const { + return X * vertex.X + Y * vertex.Y; } /** @@ -160,8 +160,8 @@ public: * @param Vertex The second vertex * @return Returns the angle between this vertex and the passed vertex in radians. */ - inline float ComputeAngle(const BS_Vertex &Vertex) const { - return atan2f(static_cast<float>(ComputeCrossProduct(Vertex)), static_cast<float>(ComputeDotProduct(Vertex))); + inline float ComputeAngle(const Vertex &vertex) const { + return atan2f(static_cast<float>(ComputeCrossProduct(vertex)), static_cast<float>(ComputeDotProduct(vertex))); } /** @@ -171,8 +171,8 @@ public: return sqrtf(static_cast<float>(X * X + Y * Y)); } - static BS_Vertex &LuaVertexToVertex(lua_State *L, int StackIndex, BS_Vertex &Vertex); - static void VertexToLuaVertex(lua_State *L, const BS_Vertex &Vertex); + static Vertex &LuaVertexToVertex(lua_State *L, int StackIndex, Vertex &vertex); + static void VertexToLuaVertex(lua_State *L, const Vertex &vertex); }; } // End of namespace Sword25 diff --git a/engines/sword25/math/walkregion.cpp b/engines/sword25/math/walkregion.cpp index 82ee0bf782..01db9c385b 100644 --- a/engines/sword25/math/walkregion.cpp +++ b/engines/sword25/math/walkregion.cpp @@ -52,28 +52,28 @@ static const int infinity = (~(-1)); // Constructor / Destructor // ----------------------------------------------------------------------------- -BS_WalkRegion::BS_WalkRegion() { +WalkRegion::WalkRegion() { m_Type = RT_WALKREGION; } // ----------------------------------------------------------------------------- -BS_WalkRegion::BS_WalkRegion(BS_InputPersistenceBlock &Reader, unsigned int Handle) : - BS_Region(Reader, Handle) { +WalkRegion::WalkRegion(BS_InputPersistenceBlock &Reader, unsigned int Handle) : + Region(Reader, Handle) { m_Type = RT_WALKREGION; Unpersist(Reader); } // ----------------------------------------------------------------------------- -BS_WalkRegion::~BS_WalkRegion() { +WalkRegion::~WalkRegion() { } // ----------------------------------------------------------------------------- -bool BS_WalkRegion::Init(const BS_Polygon &Contour, const Common::Array<BS_Polygon> *pHoles) { +bool WalkRegion::Init(const Polygon &Contour, const Common::Array<Polygon> *pHoles) { // Default initialisation of the region - if (!BS_Region::Init(Contour, pHoles)) return false; + if (!Region::Init(Contour, pHoles)) return false; // Prepare structures for pathfinding InitNodeVector(); @@ -85,7 +85,7 @@ bool BS_WalkRegion::Init(const BS_Polygon &Contour, const Common::Array<BS_Polyg // ----------------------------------------------------------------------------- -bool BS_WalkRegion::QueryPath(BS_Vertex StartPoint, BS_Vertex EndPoint, BS_Path &Path) { +bool WalkRegion::QueryPath(Vertex StartPoint, Vertex EndPoint, BS_Path &Path) { BS_ASSERT(Path.empty()); // If the start and finish are identical, no path can be found trivially @@ -118,14 +118,14 @@ struct DijkstraNode { bool Chosen; }; -static void InitDijkstraNodes(DijkstraNode::Container &DijkstraNodes, const BS_Region &Region, - const BS_Vertex &Start, const Common::Array<BS_Vertex> &Nodes) { +static void InitDijkstraNodes(DijkstraNode::Container &DijkstraNodes, const Region &Region, + const Vertex &Start, const Common::Array<Vertex> &Nodes) { // Allocate sufficient space in the array DijkstraNodes.resize(Nodes.size()); // Initialise all the nodes which are visible from the starting node DijkstraNode::Iter DijkstraIter = DijkstraNodes.begin(); - for (Common::Array<BS_Vertex>::const_iterator NodesIter = Nodes.begin(); + for (Common::Array<Vertex>::const_iterator NodesIter = Nodes.begin(); NodesIter != Nodes.end(); NodesIter++, DijkstraIter++) { (*DijkstraIter).ParentIter = DijkstraNodes.end(); if (Region.IsLineOfSight(*NodesIter, Start))(*DijkstraIter).Cost = (*NodesIter).Distance(Start); @@ -167,11 +167,11 @@ static void RelaxNodes(DijkstraNode::Container &Nodes, } } -static void RelaxEndPoint(const BS_Vertex &CurNodePos, +static void RelaxEndPoint(const Vertex &CurNodePos, const DijkstraNode::ConstIter &CurNodeIter, - const BS_Vertex &EndPointPos, + const Vertex &EndPointPos, DijkstraNode &EndPoint, - const BS_Region &Region) { + const Region &Region) { if (Region.IsLineOfSight(CurNodePos, EndPointPos)) { int TotalCost = (*CurNodeIter).Cost + CurNodePos.Distance(EndPointPos); if (TotalCost < EndPoint.Cost) { @@ -181,7 +181,7 @@ static void RelaxEndPoint(const BS_Vertex &CurNodePos, } } -bool BS_WalkRegion::FindPath(const BS_Vertex &Start, const BS_Vertex &End, BS_Path &Path) const { +bool WalkRegion::FindPath(const Vertex &Start, const Vertex &End, BS_Path &Path) const { // This is an implementation of Dijkstra's algorithm // Initialise edge node list @@ -221,7 +221,7 @@ bool BS_WalkRegion::FindPath(const BS_Vertex &Start, const BS_Vertex &End, BS_Pa // The nodes of the path must be untwisted, as they were extracted in reverse order. // This step could be saved if the path from end to the beginning was desired - ReverseArray<BS_Vertex>(Path); + ReverseArray<Vertex>(Path); return true; } @@ -238,7 +238,7 @@ bool BS_WalkRegion::FindPath(const BS_Vertex &Start, const BS_Vertex &End, BS_Pa // ----------------------------------------------------------------------------- -void BS_WalkRegion::InitNodeVector() { +void WalkRegion::InitNodeVector() { // Empty the Node list m_Nodes.clear(); @@ -260,7 +260,7 @@ void BS_WalkRegion::InitNodeVector() { // ----------------------------------------------------------------------------- -void BS_WalkRegion::ComputeVisibilityMatrix() { +void WalkRegion::ComputeVisibilityMatrix() { // Initialise visibility matrix m_VisibilityMatrix = Common::Array< Common::Array <int> >(); for (uint idx = 0; idx < m_Nodes.size(); ++idx) { @@ -290,9 +290,9 @@ void BS_WalkRegion::ComputeVisibilityMatrix() { // ----------------------------------------------------------------------------- -bool BS_WalkRegion::CheckAndPrepareStartAndEnd(BS_Vertex &Start, BS_Vertex &End) const { +bool WalkRegion::CheckAndPrepareStartAndEnd(Vertex &Start, Vertex &End) const { if (!IsPointInRegion(Start)) { - BS_Vertex NewStart = FindClosestRegionPoint(Start); + Vertex NewStart = FindClosestRegionPoint(Start); // Check to make sure the point is really in the region. If not, stop with an error if (!IsPointInRegion(NewStart)) { @@ -308,7 +308,7 @@ bool BS_WalkRegion::CheckAndPrepareStartAndEnd(BS_Vertex &Start, BS_Vertex &End) // If the destination is outside the region, a point is determined that is within the region, // and that is used as an endpoint instead if (!IsPointInRegion(End)) { - BS_Vertex NewEnd = FindClosestRegionPoint(End); + Vertex NewEnd = FindClosestRegionPoint(End); // Make sure that the determined point is really within the region if (!IsPointInRegion(NewEnd)) { @@ -327,28 +327,28 @@ bool BS_WalkRegion::CheckAndPrepareStartAndEnd(BS_Vertex &Start, BS_Vertex &End) // ----------------------------------------------------------------------------- -void BS_WalkRegion::SetPos(int X, int Y) { +void WalkRegion::SetPos(int X, int Y) { // Calculate the difference between old and new position - BS_Vertex Delta(X - m_Position.X, Y - m_Position.Y); + Vertex Delta(X - m_Position.X, Y - m_Position.Y); // Move all the nodes for (unsigned int i = 0; i < m_Nodes.size(); i++) m_Nodes[i] += Delta; // Move regions - BS_Region::SetPos(X, Y); + Region::SetPos(X, Y); } // ----------------------------------------------------------------------------- -bool BS_WalkRegion::Persist(BS_OutputPersistenceBlock &Writer) { +bool WalkRegion::Persist(BS_OutputPersistenceBlock &Writer) { bool Result = true; // Persist the parent region - Result &= BS_Region::Persist(Writer); + Result &= Region::Persist(Writer); // Persist the nodes Writer.Write(m_Nodes.size()); - Common::Array<BS_Vertex>::const_iterator It = m_Nodes.begin(); + Common::Array<Vertex>::const_iterator It = m_Nodes.begin(); while (It != m_Nodes.end()) { Writer.Write(It->X); Writer.Write(It->Y); @@ -374,7 +374,7 @@ bool BS_WalkRegion::Persist(BS_OutputPersistenceBlock &Writer) { // ----------------------------------------------------------------------------- -bool BS_WalkRegion::Unpersist(BS_InputPersistenceBlock &Reader) { +bool WalkRegion::Unpersist(BS_InputPersistenceBlock &Reader) { bool Result = true; // The parent object was already loaded in the constructor of BS_Region, so at @@ -385,7 +385,7 @@ bool BS_WalkRegion::Unpersist(BS_InputPersistenceBlock &Reader) { Reader.Read(NodeCount); m_Nodes.clear(); m_Nodes.resize(NodeCount); - Common::Array<BS_Vertex>::iterator It = m_Nodes.begin(); + Common::Array<Vertex>::iterator It = m_Nodes.begin(); while (It != m_Nodes.end()) { Reader.Read(It->X); Reader.Read(It->Y); diff --git a/engines/sword25/math/walkregion.h b/engines/sword25/math/walkregion.h index f23044ecef..fd71ade981 100644 --- a/engines/sword25/math/walkregion.h +++ b/engines/sword25/math/walkregion.h @@ -45,7 +45,7 @@ namespace Sword25 { // Type definitions // ----------------------------------------------------------------------------- -typedef Common::Array<BS_Vertex> BS_Path; +typedef Common::Array<Vertex> BS_Path; // ----------------------------------------------------------------------------- // Class definitions @@ -54,17 +54,17 @@ typedef Common::Array<BS_Vertex> BS_Path; /** * This class represents the region in which the main character can move */ -class BS_WalkRegion : public BS_Region { - friend class BS_Region; +class WalkRegion : public Region { + friend class Region; protected: - BS_WalkRegion(); - BS_WalkRegion(BS_InputPersistenceBlock &Reader, unsigned int Handle); + WalkRegion(); + WalkRegion(BS_InputPersistenceBlock &Reader, unsigned int Handle); public: - virtual ~BS_WalkRegion(); + virtual ~WalkRegion(); - virtual bool Init(const BS_Polygon &Contour, const Common::Array<BS_Polygon> *pHoles = 0); + virtual bool Init(const Polygon &Contour, const Common::Array<Polygon> *pHoles = 0); /** * Get the shortest path between two points in the region @@ -81,7 +81,7 @@ public: * @return Returns false if the result is invalid, otherwise returns true. */ bool QueryPath(int X1, int Y1, int X2, int Y2, BS_Path &Path) { - return QueryPath(BS_Vertex(X1, Y1), BS_Vertex(X2, Y2), Path); + return QueryPath(Vertex(X1, Y1), Vertex(X2, Y2), Path); } /** @@ -92,11 +92,11 @@ public: * @param Path An empty BS_Path that will be set to the resulting path * @return Returns false if the result is invalid, otherwise returns true. */ - bool QueryPath(BS_Vertex StartPoint, BS_Vertex EndPoint, BS_Path &Path); + bool QueryPath(Vertex StartPoint, Vertex EndPoint, BS_Path &Path); virtual void SetPos(int X, int Y); - const Common::Array<BS_Vertex> &GetNodes() const { + const Common::Array<Vertex> &GetNodes() const { return m_Nodes; } const Common::Array< Common::Array<int> > &GetVisibilityMatrix() const { @@ -107,13 +107,13 @@ public: virtual bool Unpersist(BS_InputPersistenceBlock &Reader); private: - Common::Array<BS_Vertex> m_Nodes; + Common::Array<Vertex> m_Nodes; Common::Array< Common::Array<int> > m_VisibilityMatrix; void InitNodeVector(); void ComputeVisibilityMatrix(); - bool CheckAndPrepareStartAndEnd(BS_Vertex &Start, BS_Vertex &End) const; - bool FindPath(const BS_Vertex &Start, const BS_Vertex &End, BS_Path &Path) const; + bool CheckAndPrepareStartAndEnd(Vertex &Start, Vertex &End) const; + bool FindPath(const Vertex &Start, const Vertex &End, BS_Path &Path) const; }; } // End of namespace Sword25 diff --git a/engines/sword25/package/packagemanager.cpp b/engines/sword25/package/packagemanager.cpp index 329061a6b3..4bf25936bb 100644 --- a/engines/sword25/package/packagemanager.cpp +++ b/engines/sword25/package/packagemanager.cpp @@ -44,7 +44,7 @@ namespace Sword25 { -BS_PackageManager::BS_PackageManager(BS_Kernel *pKernel) : BS_Service(pKernel) { +PackageManager::PackageManager(BS_Kernel *pKernel) : BS_Service(pKernel) { if (!_RegisterScriptBindings()) BS_LOG_ERRORLN("Script bindings could not be registered."); else diff --git a/engines/sword25/package/packagemanager.h b/engines/sword25/package/packagemanager.h index 9ef3ab066a..739ed9e644 100644 --- a/engines/sword25/package/packagemanager.h +++ b/engines/sword25/package/packagemanager.h @@ -69,10 +69,10 @@ namespace Sword25 { * 3. LoadDirectoryAsPackage should only be used for testing. The final release will be * have all files in packages. */ -class BS_PackageManager : public BS_Service { +class PackageManager : public BS_Service { public: - BS_PackageManager(BS_Kernel *pKernel); - virtual ~BS_PackageManager() {}; + PackageManager(BS_Kernel *pKernel); + virtual ~PackageManager() {}; enum FILE_TYPES { FT_DIRECTORY = (1 << 0), diff --git a/engines/sword25/package/packagemanager_script.cpp b/engines/sword25/package/packagemanager_script.cpp index 83d0ae7580..943770f074 100644 --- a/engines/sword25/package/packagemanager_script.cpp +++ b/engines/sword25/package/packagemanager_script.cpp @@ -49,10 +49,10 @@ using namespace Lua; // ----------------------------------------------------------------------------- -static BS_PackageManager *GetPM() { +static PackageManager *GetPM() { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_PackageManager *pPM = static_cast<BS_PackageManager *>(pKernel->GetService("package")); + PackageManager *pPM = static_cast<PackageManager *>(pKernel->GetService("package")); BS_ASSERT(pPM); return pPM; } @@ -60,7 +60,7 @@ static BS_PackageManager *GetPM() { // ----------------------------------------------------------------------------- static int LoadPackage(lua_State *L) { - BS_PackageManager *pPM = GetPM(); + PackageManager *pPM = GetPM(); lua_pushbooleancpp(L, pPM->LoadPackage(luaL_checkstring(L, 1), luaL_checkstring(L, 2))); @@ -70,7 +70,7 @@ static int LoadPackage(lua_State *L) { // ----------------------------------------------------------------------------- static int LoadDirectoryAsPackage(lua_State *L) { - BS_PackageManager *pPM = GetPM(); + PackageManager *pPM = GetPM(); lua_pushbooleancpp(L, pPM->LoadDirectoryAsPackage(luaL_checkstring(L, 1), luaL_checkstring(L, 2))); @@ -80,7 +80,7 @@ static int LoadDirectoryAsPackage(lua_State *L) { // ----------------------------------------------------------------------------- static int GetCurrentDirectory(lua_State *L) { - BS_PackageManager *pPM = GetPM(); + PackageManager *pPM = GetPM(); lua_pushstring(L, pPM->GetCurrentDirectory().c_str()); @@ -90,7 +90,7 @@ static int GetCurrentDirectory(lua_State *L) { // ----------------------------------------------------------------------------- static int ChangeDirectory(lua_State *L) { - BS_PackageManager *pPM = GetPM(); + PackageManager *pPM = GetPM(); lua_pushbooleancpp(L, pPM->ChangeDirectory(luaL_checkstring(L, 1))); @@ -100,7 +100,7 @@ static int ChangeDirectory(lua_State *L) { // ----------------------------------------------------------------------------- static int GetAbsolutePath(lua_State *L) { - BS_PackageManager *pPM = GetPM(); + PackageManager *pPM = GetPM(); lua_pushstring(L, pPM->GetAbsolutePath(luaL_checkstring(L, 1)).c_str()); @@ -110,7 +110,7 @@ static int GetAbsolutePath(lua_State *L) { // ----------------------------------------------------------------------------- static int GetFileSize(lua_State *L) { - BS_PackageManager *pPM = GetPM(); + PackageManager *pPM = GetPM(); lua_pushnumber(L, pPM->GetFileSize(luaL_checkstring(L, 1))); @@ -120,7 +120,7 @@ static int GetFileSize(lua_State *L) { // ----------------------------------------------------------------------------- static int GetFileType(lua_State *L) { - BS_PackageManager *pPM = GetPM(); + PackageManager *pPM = GetPM(); lua_pushnumber(L, pPM->GetFileType(luaL_checkstring(L, 1))); @@ -147,7 +147,7 @@ static void SplitSearchPath(const Common::String &Path, Common::String &Director // ----------------------------------------------------------------------------- static void DoSearch(lua_State *L, const Common::String &path, unsigned int type) { - BS_PackageManager *pPM = GetPM(); + PackageManager *pPM = GetPM(); // Der Packagemanager-Service muss den Suchstring und den Pfad getrennt übergeben bekommen. // Um die Benutzbarkeit zu verbessern sollen Skriptprogrammierer dieses als ein Pfad übergeben können. @@ -179,21 +179,21 @@ static void DoSearch(lua_State *L, const Common::String &path, unsigned int type // ----------------------------------------------------------------------------- static int FindFiles(lua_State *L) { - DoSearch(L, luaL_checkstring(L, 1), BS_PackageManager::FT_FILE); + DoSearch(L, luaL_checkstring(L, 1), PackageManager::FT_FILE); return 1; } // ----------------------------------------------------------------------------- static int FindDirectories(lua_State *L) { - DoSearch(L, luaL_checkstring(L, 1), BS_PackageManager::FT_DIRECTORY); + DoSearch(L, luaL_checkstring(L, 1), PackageManager::FT_DIRECTORY); return 1; } // ----------------------------------------------------------------------------- static int GetFileAsString(lua_State *L) { - BS_PackageManager *pPM = GetPM(); + PackageManager *pPM = GetPM(); unsigned int FileSize; char *FileData = (char *)pPM->GetFile(luaL_checkstring(L, 1), &FileSize); @@ -234,15 +234,15 @@ static const luaL_reg PACKAGE_FUNCTIONS[] = { // ----------------------------------------------------------------------------- -bool BS_PackageManager::_RegisterScriptBindings() { +bool PackageManager::_RegisterScriptBindings() { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_ScriptEngine *pScript = static_cast<BS_ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->GetScriptObject()); BS_ASSERT(L); - if (!BS_LuaBindhelper::AddFunctionsToLib(L, PACKAGE_LIBRARY_NAME, PACKAGE_FUNCTIONS)) return false; + if (!LuaBindhelper::AddFunctionsToLib(L, PACKAGE_LIBRARY_NAME, PACKAGE_FUNCTIONS)) return false; return true; } diff --git a/engines/sword25/package/scummvmpackagemanager.cpp b/engines/sword25/package/scummvmpackagemanager.cpp index 0792116a4b..0962bc407a 100644 --- a/engines/sword25/package/scummvmpackagemanager.cpp +++ b/engines/sword25/package/scummvmpackagemanager.cpp @@ -52,23 +52,23 @@ static Common::String normalizePath(const Common::String &path, const Common::St return Common::normalizePath(wholePath, PATH_SEPARATOR); } -BS_ScummVMPackageManager::BS_ScummVMPackageManager(BS_Kernel *kernelPtr) : - BS_PackageManager(kernelPtr), +ScummVMPackageManager::ScummVMPackageManager(BS_Kernel *kernelPtr) : + PackageManager(kernelPtr), _currentDirectory(PATH_SEPARATOR), _rootFolder(ConfMan.get("path")) { } -BS_ScummVMPackageManager::~BS_ScummVMPackageManager() { +ScummVMPackageManager::~ScummVMPackageManager() { } -BS_Service *BS_ScummVMPackageManager_CreateObject(BS_Kernel *kernelPtr) { - return new BS_ScummVMPackageManager(kernelPtr); +BS_Service *ScummVMPackageManager_CreateObject(BS_Kernel *kernelPtr) { + return new ScummVMPackageManager(kernelPtr); } /** * Scans through the archive list for a specified file */ -Common::ArchiveMemberPtr BS_ScummVMPackageManager::GetArchiveMember(const Common::String &fileName) { +Common::ArchiveMemberPtr ScummVMPackageManager::GetArchiveMember(const Common::String &fileName) { // Loop through checking each archive Common::List<ArchiveEntry *>::iterator i; for (i = _archiveList.begin(); i != _archiveList.end(); ++i) { @@ -91,7 +91,7 @@ Common::ArchiveMemberPtr BS_ScummVMPackageManager::GetArchiveMember(const Common return Common::ArchiveMemberPtr(); } -bool BS_ScummVMPackageManager::LoadPackage(const Common::String &fileName, const Common::String &mountPosition) { +bool ScummVMPackageManager::LoadPackage(const Common::String &fileName, const Common::String &mountPosition) { Common::Archive *zipFile = Common::makeZipArchive(fileName); if (zipFile == NULL) { BS_LOG_ERRORLN("Unable to mount file \"%s\" to \"%s\"", fileName.c_str(), mountPosition.c_str()); @@ -111,7 +111,7 @@ bool BS_ScummVMPackageManager::LoadPackage(const Common::String &fileName, const } } -bool BS_ScummVMPackageManager::LoadDirectoryAsPackage(const Common::String &directoryName, const Common::String &mountPosition) { +bool ScummVMPackageManager::LoadDirectoryAsPackage(const Common::String &directoryName, const Common::String &mountPosition) { Common::FSNode directory(directoryName); Common::Archive *folderArchive = new Common::FSDirectory(directory, 6); if (!directory.exists() || (folderArchive == NULL)) { @@ -130,7 +130,7 @@ bool BS_ScummVMPackageManager::LoadDirectoryAsPackage(const Common::String &dire } } -byte *BS_ScummVMPackageManager::GetFile(const Common::String &fileName, unsigned int *fileSizePtr) { +byte *ScummVMPackageManager::GetFile(const Common::String &fileName, unsigned int *fileSizePtr) { Common::SeekableReadStream *in; Common::ArchiveMemberPtr fileNode = GetArchiveMember(normalizePath(fileName, _currentDirectory)); if (!fileNode) @@ -152,21 +152,21 @@ byte *BS_ScummVMPackageManager::GetFile(const Common::String &fileName, unsigned return buffer; } -Common::String BS_ScummVMPackageManager::GetCurrentDirectory() { +Common::String ScummVMPackageManager::GetCurrentDirectory() { return _currentDirectory; } -bool BS_ScummVMPackageManager::ChangeDirectory(const Common::String &directory) { +bool ScummVMPackageManager::ChangeDirectory(const Common::String &directory) { // Get the path elements for the file _currentDirectory = normalizePath(directory, _currentDirectory); return true; } -Common::String BS_ScummVMPackageManager::GetAbsolutePath(const Common::String &fileName) { +Common::String ScummVMPackageManager::GetAbsolutePath(const Common::String &fileName) { return normalizePath(fileName, _currentDirectory); } -unsigned int BS_ScummVMPackageManager::GetFileSize(const Common::String &fileName) { +unsigned int ScummVMPackageManager::GetFileSize(const Common::String &fileName) { Common::SeekableReadStream *in; Common::ArchiveMemberPtr fileNode = GetArchiveMember(normalizePath(fileName, _currentDirectory)); if (!fileNode) @@ -179,19 +179,19 @@ unsigned int BS_ScummVMPackageManager::GetFileSize(const Common::String &fileNam return fileSize; } -unsigned int BS_ScummVMPackageManager::GetFileType(const Common::String &fileName) { +unsigned int ScummVMPackageManager::GetFileType(const Common::String &fileName) { warning("STUB: BS_ScummVMPackageManager::GetFileType(%s)", fileName.c_str()); //return fileNode.isDirectory() ? BS_PackageManager::FT_DIRECTORY : BS_PackageManager::FT_FILE; - return BS_PackageManager::FT_FILE; + return PackageManager::FT_FILE; } -bool BS_ScummVMPackageManager::FileExists(const Common::String &fileName) { +bool ScummVMPackageManager::FileExists(const Common::String &fileName) { Common::ArchiveMemberPtr fileNode = GetArchiveMember(normalizePath(fileName, _currentDirectory)); return fileNode; } -int BS_ScummVMPackageManager::doSearch(Common::ArchiveMemberList &list, const Common::String &filter, const Common::String &path, unsigned int typeFilter) { +int ScummVMPackageManager::doSearch(Common::ArchiveMemberList &list, const Common::String &filter, const Common::String &path, unsigned int typeFilter) { Common::String normalizedFilter = normalizePath(filter, _currentDirectory); int num = 0; @@ -216,8 +216,8 @@ int BS_ScummVMPackageManager::doSearch(Common::ArchiveMemberList &list, const Co // Create a list of the matching names for (Common::ArchiveMemberList::iterator it = memberList.begin(); it != memberList.end(); ++it) { - if (((typeFilter & BS_PackageManager::FT_DIRECTORY) && (*it)->getName().hasSuffix("/")) || - ((typeFilter & BS_PackageManager::FT_FILE) && !(*it)->getName().hasSuffix("/"))) { + if (((typeFilter & PackageManager::FT_DIRECTORY) && (*it)->getName().hasSuffix("/")) || + ((typeFilter & PackageManager::FT_FILE) && !(*it)->getName().hasSuffix("/"))) { list.push_back(*it); num++; } diff --git a/engines/sword25/package/scummvmpackagemanager.h b/engines/sword25/package/scummvmpackagemanager.h index 8ad454d0eb..b70df2528a 100644 --- a/engines/sword25/package/scummvmpackagemanager.h +++ b/engines/sword25/package/scummvmpackagemanager.h @@ -45,7 +45,7 @@ namespace Sword25 { class BS_Kernel; -class BS_ScummVMPackageManager : public BS_PackageManager { +class ScummVMPackageManager : public PackageManager { private: class ArchiveEntry { public: @@ -67,8 +67,8 @@ private: Common::ArchiveMemberPtr GetArchiveMember(const Common::String &fileName); public: - BS_ScummVMPackageManager(BS_Kernel *kernelPtr); - virtual ~BS_ScummVMPackageManager(); + ScummVMPackageManager(BS_Kernel *kernelPtr); + virtual ~ScummVMPackageManager(); virtual bool LoadPackage(const Common::String &fileName, const Common::String &mountPosition); virtual bool LoadDirectoryAsPackage(const Common::String &directoryName, const Common::String &mountPosition); diff --git a/engines/sword25/script/lua_extensions.cpp b/engines/sword25/script/lua_extensions.cpp index 91303ac8e0..6a2110428f 100644 --- a/engines/sword25/script/lua_extensions.cpp +++ b/engines/sword25/script/lua_extensions.cpp @@ -72,11 +72,11 @@ static const luaL_reg GLOBAL_FUNCTIONS[] = { // ----------------------------------------------------------------------------- -bool BS_LuaScriptEngine::RegisterStandardLibExtensions() { +bool LuaScriptEngine::RegisterStandardLibExtensions() { lua_State *L = m_State; BS_ASSERT(m_State); - if (!BS_LuaBindhelper::AddFunctionsToLib(L, "", GLOBAL_FUNCTIONS)) return false; + if (!LuaBindhelper::AddFunctionsToLib(L, "", GLOBAL_FUNCTIONS)) return false; return true; } diff --git a/engines/sword25/script/luabindhelper.cpp b/engines/sword25/script/luabindhelper.cpp index f45a6c24f4..843e8dd4de 100644 --- a/engines/sword25/script/luabindhelper.cpp +++ b/engines/sword25/script/luabindhelper.cpp @@ -93,7 +93,7 @@ namespace Sword25 { * The array must be terminated with the enry (0, 0) * @return Returns true if successful, otherwise false. */ -bool BS_LuaBindhelper::AddFunctionsToLib(lua_State *L, const Common::String &LibName, const luaL_reg *Functions) { +bool LuaBindhelper::AddFunctionsToLib(lua_State *L, const Common::String &LibName, const luaL_reg *Functions) { #ifdef DEBUG int __startStackDepth = lua_gettop(L); #endif @@ -149,7 +149,7 @@ bool BS_LuaBindhelper::AddFunctionsToLib(lua_State *L, const Common::String &Lib * The array must be terminated with the enry (0, 0) * @return Returns true if successful, otherwise false. */ -bool BS_LuaBindhelper::AddConstantsToLib(lua_State *L, const Common::String &LibName, const lua_constant_reg *Constants) { +bool LuaBindhelper::AddConstantsToLib(lua_State *L, const Common::String &LibName, const lua_constant_reg *Constants) { #ifdef DEBUG int __startStackDepth = lua_gettop(L); #endif @@ -196,7 +196,7 @@ bool BS_LuaBindhelper::AddConstantsToLib(lua_State *L, const Common::String &Lib * The array must be terminated with the enry (0, 0) * @return Returns true if successful, otherwise false. */ -bool BS_LuaBindhelper::AddMethodsToClass(lua_State *L, const Common::String &ClassName, const luaL_reg *Methods) { +bool LuaBindhelper::AddMethodsToClass(lua_State *L, const Common::String &ClassName, const luaL_reg *Methods) { #ifdef DEBUG int __startStackDepth = lua_gettop(L); #endif @@ -236,7 +236,7 @@ bool BS_LuaBindhelper::AddMethodsToClass(lua_State *L, const Common::String &Cla * @param GCHandler A function pointer * @return Returns true if successful, otherwise false. */ -bool BS_LuaBindhelper::SetClassGCHandler(lua_State *L, const Common::String &ClassName, lua_CFunction GCHandler) { +bool LuaBindhelper::SetClassGCHandler(lua_State *L, const Common::String &ClassName, lua_CFunction GCHandler) { #ifdef DEBUG int __startStackDepth = lua_gettop(L); #endif @@ -288,7 +288,7 @@ void PushMetatableTable(lua_State *L) { namespace Sword25 { -bool BS_LuaBindhelper::GetMetatable(lua_State *L, const Common::String &TableName) { +bool LuaBindhelper::GetMetatable(lua_State *L, const Common::String &TableName) { // Push the Metatable table onto the stack PushMetatableTable(L); @@ -322,7 +322,7 @@ bool BS_LuaBindhelper::GetMetatable(lua_State *L, const Common::String &TableNam // ----------------------------------------------------------------------------- -bool BS_LuaBindhelper::_CreateTable(lua_State *L, const Common::String &TableName) { +bool LuaBindhelper::_CreateTable(lua_State *L, const Common::String &TableName) { const char *PartBegin = TableName.c_str(); while (PartBegin - TableName.c_str() < (int)TableName.size()) { @@ -406,7 +406,7 @@ Common::String GetLuaValueInfo(lua_State *L, int StackIndex) { namespace Sword25 { -Common::String BS_LuaBindhelper::StackDump(lua_State *L) { +Common::String LuaBindhelper::StackDump(lua_State *L) { Common::String oss; int i = lua_gettop(L); @@ -422,7 +422,7 @@ Common::String BS_LuaBindhelper::StackDump(lua_State *L) { return oss; } -Common::String BS_LuaBindhelper::TableDump(lua_State *L) { +Common::String LuaBindhelper::TableDump(lua_State *L) { Common::String oss; oss += "------------------- Table Dump -------------------\n"; diff --git a/engines/sword25/script/luabindhelper.h b/engines/sword25/script/luabindhelper.h index 9c864c6085..85ff089ee4 100644 --- a/engines/sword25/script/luabindhelper.h +++ b/engines/sword25/script/luabindhelper.h @@ -59,7 +59,7 @@ struct lua_constant_reg { lua_Number Value; }; -class BS_LuaBindhelper { +class LuaBindhelper { public: /** * Registers a set of functions into a Lua library. diff --git a/engines/sword25/script/luacallback.cpp b/engines/sword25/script/luacallback.cpp index dfabc81807..4e9d4dd06c 100644 --- a/engines/sword25/script/luacallback.cpp +++ b/engines/sword25/script/luacallback.cpp @@ -59,7 +59,7 @@ namespace Sword25 { // ----------------------------------------------------------------------------- -BS_LuaCallback::BS_LuaCallback(lua_State *L) { +LuaCallback::LuaCallback(lua_State *L) { // Create callback table lua_newtable(L); lua_setglobal(L, CALLBACKTABLE_NAME); @@ -67,12 +67,12 @@ BS_LuaCallback::BS_LuaCallback(lua_State *L) { // ----------------------------------------------------------------------------- -BS_LuaCallback::~BS_LuaCallback() { +LuaCallback::~LuaCallback() { } // ----------------------------------------------------------------------------- -void BS_LuaCallback::RegisterCallbackFunction(lua_State *L, unsigned int ObjectHandle) { +void LuaCallback::RegisterCallbackFunction(lua_State *L, unsigned int ObjectHandle) { BS_ASSERT(lua_isfunction(L, -1)); EnsureObjectCallbackTableExists(L, ObjectHandle); @@ -86,7 +86,7 @@ void BS_LuaCallback::RegisterCallbackFunction(lua_State *L, unsigned int ObjectH // ----------------------------------------------------------------------------- -void BS_LuaCallback::UnregisterCallbackFunction(lua_State *L, unsigned int ObjectHandle) { +void LuaCallback::UnregisterCallbackFunction(lua_State *L, unsigned int ObjectHandle) { BS_ASSERT(lua_isfunction(L, -1)); EnsureObjectCallbackTableExists(L, ObjectHandle); @@ -116,7 +116,7 @@ void BS_LuaCallback::UnregisterCallbackFunction(lua_State *L, unsigned int Objec // ----------------------------------------------------------------------------- -void BS_LuaCallback::RemoveAllObjectCallbacks(lua_State *L, unsigned int ObjectHandle) { +void LuaCallback::RemoveAllObjectCallbacks(lua_State *L, unsigned int ObjectHandle) { PushCallbackTable(L); // Remove the object callback from the callback table @@ -129,7 +129,7 @@ void BS_LuaCallback::RemoveAllObjectCallbacks(lua_State *L, unsigned int ObjectH // ----------------------------------------------------------------------------- -void BS_LuaCallback::InvokeCallbackFunctions(lua_State *L, unsigned int ObjectHandle) { +void LuaCallback::InvokeCallbackFunctions(lua_State *L, unsigned int ObjectHandle) { EnsureObjectCallbackTableExists(L, ObjectHandle); // Iterate through the table and perform all the callbacks @@ -161,7 +161,7 @@ void BS_LuaCallback::InvokeCallbackFunctions(lua_State *L, unsigned int ObjectHa // ----------------------------------------------------------------------------- -void BS_LuaCallback::EnsureObjectCallbackTableExists(lua_State *L, unsigned int ObjectHandle) { +void LuaCallback::EnsureObjectCallbackTableExists(lua_State *L, unsigned int ObjectHandle) { PushObjectCallbackTable(L, ObjectHandle); // If the table is nil, it must first be created @@ -184,13 +184,13 @@ void BS_LuaCallback::EnsureObjectCallbackTableExists(lua_State *L, unsigned int // ----------------------------------------------------------------------------- -void BS_LuaCallback::PushCallbackTable(lua_State *L) { +void LuaCallback::PushCallbackTable(lua_State *L) { lua_getglobal(L, CALLBACKTABLE_NAME); } // ----------------------------------------------------------------------------- -void BS_LuaCallback::PushObjectCallbackTable(lua_State *L, unsigned int ObjectHandle) { +void LuaCallback::PushObjectCallbackTable(lua_State *L, unsigned int ObjectHandle) { PushCallbackTable(L); // Push Object Callback table onto the stack diff --git a/engines/sword25/script/luacallback.h b/engines/sword25/script/luacallback.h index b8ac97fd95..89ab67a52e 100644 --- a/engines/sword25/script/luacallback.h +++ b/engines/sword25/script/luacallback.h @@ -59,10 +59,10 @@ namespace Sword25 { // Class definitions // ----------------------------------------------------------------------------- -class BS_LuaCallback { +class LuaCallback { public: - BS_LuaCallback(lua_State *L); - virtual ~BS_LuaCallback(); + LuaCallback(lua_State *L); + virtual ~LuaCallback(); // Funktion muss auf dem Lua-Stack liegen. void RegisterCallbackFunction(lua_State *L, unsigned int ObjectHandle); diff --git a/engines/sword25/script/luascript.cpp b/engines/sword25/script/luascript.cpp index 6d2816ae13..2ba528ed18 100644 --- a/engines/sword25/script/luascript.cpp +++ b/engines/sword25/script/luascript.cpp @@ -65,15 +65,15 @@ using namespace Lua; // Constructor / Destructor // ----------------------------------------------------------------------------- -BS_LuaScriptEngine::BS_LuaScriptEngine(BS_Kernel *KernelPtr) : - BS_ScriptEngine(KernelPtr), +LuaScriptEngine::LuaScriptEngine(BS_Kernel *KernelPtr) : + ScriptEngine(KernelPtr), m_State(0), m_PcallErrorhandlerRegistryIndex(0) { } // ----------------------------------------------------------------------------- -BS_LuaScriptEngine::~BS_LuaScriptEngine() { +LuaScriptEngine::~LuaScriptEngine() { // Lua de-initialisation if (m_State) lua_close(m_State); @@ -81,8 +81,8 @@ BS_LuaScriptEngine::~BS_LuaScriptEngine() { // ----------------------------------------------------------------------------- -BS_Service *BS_LuaScriptEngine_CreateObject(BS_Kernel *KernelPtr) { - return new BS_LuaScriptEngine(KernelPtr); +BS_Service *LuaScriptEngine_CreateObject(BS_Kernel *KernelPtr) { + return new LuaScriptEngine(KernelPtr); } // ----------------------------------------------------------------------------- @@ -96,7 +96,7 @@ int PanicCB(lua_State *L) { // ----------------------------------------------------------------------------- -bool BS_LuaScriptEngine::Init() { +bool LuaScriptEngine::Init() { // Lua-State initialisation, as well as standard libaries initialisation m_State = luaL_newstate(); if (!m_State || ! RegisterStandardLibs() || !RegisterStandardLibExtensions()) { @@ -146,14 +146,14 @@ bool BS_LuaScriptEngine::Init() { // ----------------------------------------------------------------------------- -bool BS_LuaScriptEngine::ExecuteFile(const Common::String &FileName) { +bool LuaScriptEngine::ExecuteFile(const Common::String &FileName) { #ifdef DEBUG int __startStackDepth = lua_gettop(m_State); #endif debug(2, "ExecuteFile(%s)", FileName.c_str()); // Get a pointer to the package manager - BS_PackageManager *pPackage = static_cast<BS_PackageManager *>(BS_Kernel::GetInstance()->GetService("package")); + PackageManager *pPackage = static_cast<PackageManager *>(BS_Kernel::GetInstance()->GetService("package")); BS_ASSERT(pPackage); // File read @@ -189,7 +189,7 @@ bool BS_LuaScriptEngine::ExecuteFile(const Common::String &FileName) { // ----------------------------------------------------------------------------- -bool BS_LuaScriptEngine::ExecuteString(const Common::String &Code) { +bool LuaScriptEngine::ExecuteString(const Common::String &Code) { return ExecuteBuffer((byte *)Code.c_str(), Code.size(), "???"); } @@ -212,7 +212,7 @@ void RemoveForbiddenFunctions(lua_State *L) { } } -bool BS_LuaScriptEngine::RegisterStandardLibs() { +bool LuaScriptEngine::RegisterStandardLibs() { luaL_openlibs(m_State); RemoveForbiddenFunctions(m_State); return true; @@ -220,7 +220,7 @@ bool BS_LuaScriptEngine::RegisterStandardLibs() { // ----------------------------------------------------------------------------- -bool BS_LuaScriptEngine::ExecuteBuffer(const byte *Data, unsigned int Size, const Common::String &Name) const { +bool LuaScriptEngine::ExecuteBuffer(const byte *Data, unsigned int Size, const Common::String &Name) const { // Compile buffer if (luaL_loadbuffer(m_State, (const char *)Data, Size, Name.c_str()) != 0) { BS_LOG_ERRORLN("Couldn't compile \"%s\":\n%s", Name.c_str(), lua_tostring(m_State, -1)); @@ -251,7 +251,7 @@ bool BS_LuaScriptEngine::ExecuteBuffer(const byte *Data, unsigned int Size, cons // ----------------------------------------------------------------------------- -void BS_LuaScriptEngine::SetCommandLine(const Common::StringArray &CommandLineParameters) { +void LuaScriptEngine::SetCommandLine(const Common::StringArray &CommandLineParameters) { debug(0, "SetCommandLine()"); lua_newtable(m_State); @@ -424,7 +424,7 @@ int Chunkwriter(lua_State *L, const void *p, size_t sz, void *ud) { } } -bool BS_LuaScriptEngine::Persist(BS_OutputPersistenceBlock &Writer) { +bool LuaScriptEngine::Persist(BS_OutputPersistenceBlock &Writer) { // Empty the Lua stack. pluto_persist() xepects that the stack is empty except for its parameters lua_settop(m_State, 0); @@ -516,7 +516,7 @@ void ClearGlobalTable(lua_State *L, const char **Exceptions) { // ----------------------------------------------------------------------------- -bool BS_LuaScriptEngine::Unpersist(BS_InputPersistenceBlock &Reader) { +bool LuaScriptEngine::Unpersist(BS_InputPersistenceBlock &Reader) { // Empty the Lua stack. pluto_persist() xepects that the stack is empty except for its parameters lua_settop(m_State, 0); diff --git a/engines/sword25/script/luascript.h b/engines/sword25/script/luascript.h index 39fa9ebec4..f7cc152f3f 100644 --- a/engines/sword25/script/luascript.h +++ b/engines/sword25/script/luascript.h @@ -64,14 +64,14 @@ class BS_Kernel; // Class declaration // ----------------------------------------------------------------------------- -class BS_LuaScriptEngine : public BS_ScriptEngine { +class LuaScriptEngine : public ScriptEngine { public: // ----------------------------------------------------------------------------- // Constructor / Destructor // ----------------------------------------------------------------------------- - BS_LuaScriptEngine(BS_Kernel *KernelPtr); - virtual ~BS_LuaScriptEngine(); + LuaScriptEngine(BS_Kernel *KernelPtr); + virtual ~LuaScriptEngine(); /** * Initialises the scripting engine diff --git a/engines/sword25/script/script.h b/engines/sword25/script/script.h index 4804324226..b7d550a163 100644 --- a/engines/sword25/script/script.h +++ b/engines/sword25/script/script.h @@ -59,14 +59,14 @@ class BS_InputPersistenceBlock; // Class declaration // ----------------------------------------------------------------------------- -class BS_ScriptEngine : public BS_Service, public BS_Persistable { +class ScriptEngine : public BS_Service, public BS_Persistable { public: // ----------------------------------------------------------------------------- // Constructor / destructor // ----------------------------------------------------------------------------- - BS_ScriptEngine(BS_Kernel *KernelPtr) : BS_Service(KernelPtr) {}; - virtual ~BS_ScriptEngine() {}; + ScriptEngine(BS_Kernel *KernelPtr) : BS_Service(KernelPtr) {}; + virtual ~ScriptEngine() {}; // ----------------------------------------------------------------------------- // This method must be implemented by the script engine diff --git a/engines/sword25/sfx/fmodexsound.cpp b/engines/sword25/sfx/fmodexsound.cpp index d83e78e62b..da0f0f932e 100644 --- a/engines/sword25/sfx/fmodexsound.cpp +++ b/engines/sword25/sfx/fmodexsound.cpp @@ -120,8 +120,8 @@ inline FMOD_SOUND_FORMAT BitsPerSampleToFMODExSoundFormat(unsigned int BitsPerSa #endif -BS_FMODExSound::BS_FMODExSound(BS_Kernel *pKernel) : - BS_SoundEngine(pKernel) +FMODExSound::FMODExSound(BS_Kernel *pKernel) : + SoundEngine(pKernel) /* m_FMOD(0), m_NextHandle(1) */ { // Lautstärkeneinstellungen auf die Standardwerte setzen @@ -134,7 +134,7 @@ BS_FMODExSound::BS_FMODExSound(BS_Kernel *pKernel) : // ----------------------------------------------------------------------------- -BS_FMODExSound::~BS_FMODExSound() { +FMODExSound::~FMODExSound() { #if 0 // Alle noch spielenden Sounds stoppen und die Ressourcen freigeben for (PSM_ITER it = m_PlayingSoundsMap.begin(); it != m_PlayingSoundsMap.end(); ++it) { @@ -149,13 +149,13 @@ BS_FMODExSound::~BS_FMODExSound() { // ----------------------------------------------------------------------------- -BS_Service *BS_FMODExSound_CreateObject(BS_Kernel *pKernel) { - return new BS_FMODExSound(pKernel); +BS_Service *FMODExSound_CreateObject(BS_Kernel *pKernel) { + return new FMODExSound(pKernel); } // ----------------------------------------------------------------------------- -bool BS_FMODExSound::Init(unsigned int SampleRate, unsigned int Channels) { +bool FMODExSound::Init(unsigned int SampleRate, unsigned int Channels) { #if 0 // Eine Warnung ausgeben, wenn dieser Service schon initialisiert wurde. // Allerdings wird trotzdem true zurückgegeben, weil kein Fehler aufgetreten ist, der Service ist noch benutzbar. @@ -197,7 +197,7 @@ bool BS_FMODExSound::Init(unsigned int SampleRate, unsigned int Channels) { // ----------------------------------------------------------------------------- -void BS_FMODExSound::Update() { +void FMODExSound::Update() { #if 0 BS_ASSERT(m_FMOD); @@ -212,7 +212,7 @@ void BS_FMODExSound::Update() { // Sounds abspielen // ----------------------------------------------------------------------------- -bool BS_FMODExSound::PlaySound(const Common::String &FileName, +bool FMODExSound::PlaySound(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, @@ -228,7 +228,7 @@ bool BS_FMODExSound::PlaySound(const Common::String &FileName, // ----------------------------------------------------------------------------- -unsigned int BS_FMODExSound::PlaySoundEx(const Common::String &FileName, +unsigned int FMODExSound::PlaySoundEx(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, @@ -273,7 +273,7 @@ FMOD_RESULT F_CALLBACK BS_FMODExSound::FMODExDynamicSoundReadCallback(FMOD_SOUND #endif // ----------------------------------------------------------------------------- -unsigned int BS_FMODExSound::PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, +unsigned int FMODExSound::PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, void *UserData, SOUND_TYPES Type, unsigned int SampleRate, @@ -446,7 +446,7 @@ unsigned int BS_FMODExSound::PlaySoundInternal(const Common::String &FileName, // Sonstige Methoden // ----------------------------------------------------------------------------- -void BS_FMODExSound::SetVolume(float Volume, SOUND_TYPES Type) { +void FMODExSound::SetVolume(float Volume, SOUND_TYPES Type) { #if 0 BS_ASSERT(m_FMOD); BS_ASSERT(Type < SOUNDTYPE_COUNT); @@ -465,7 +465,7 @@ void BS_FMODExSound::SetVolume(float Volume, SOUND_TYPES Type) { // ----------------------------------------------------------------------------- -float BS_FMODExSound::GetVolume(SOUND_TYPES Type) { +float FMODExSound::GetVolume(SOUND_TYPES Type) { #if 0 BS_ASSERT(m_FMOD); BS_ASSERT(Type < SOUNDTYPE_COUNT); @@ -477,7 +477,7 @@ float BS_FMODExSound::GetVolume(SOUND_TYPES Type) { // ----------------------------------------------------------------------------- -void BS_FMODExSound::PauseAll() { +void FMODExSound::PauseAll() { #if 0 BS_ASSERT(m_FMOD); @@ -498,7 +498,7 @@ void BS_FMODExSound::PauseAll() { // ----------------------------------------------------------------------------- -void BS_FMODExSound::ResumeAll() { +void FMODExSound::ResumeAll() { #if 0 BS_ASSERT(m_FMOD); @@ -520,7 +520,7 @@ void BS_FMODExSound::ResumeAll() { // ----------------------------------------------------------------------------- -void BS_FMODExSound::PauseLayer(unsigned int Layer) { +void FMODExSound::PauseLayer(unsigned int Layer) { #if 0 BS_ASSERT(m_FMOD); @@ -543,7 +543,7 @@ void BS_FMODExSound::PauseLayer(unsigned int Layer) { // ----------------------------------------------------------------------------- -void BS_FMODExSound::ResumeLayer(unsigned int Layer) { +void FMODExSound::ResumeLayer(unsigned int Layer) { #if 0 BS_ASSERT(m_FMOD); @@ -567,7 +567,7 @@ void BS_FMODExSound::ResumeLayer(unsigned int Layer) { // Sound Setter // ----------------------------------------------------------------------------- -void BS_FMODExSound::SetSoundVolume(unsigned int Handle, float Volume) { +void FMODExSound::SetSoundVolume(unsigned int Handle, float Volume) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -577,7 +577,7 @@ void BS_FMODExSound::SetSoundVolume(unsigned int Handle, float Volume) { // ----------------------------------------------------------------------------- -void BS_FMODExSound::SetSoundPanning(unsigned int Handle, float Pan) { +void FMODExSound::SetSoundPanning(unsigned int Handle, float Pan) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -587,7 +587,7 @@ void BS_FMODExSound::SetSoundPanning(unsigned int Handle, float Pan) { // ----------------------------------------------------------------------------- -void BS_FMODExSound::PauseSound(unsigned int Handle) { +void FMODExSound::PauseSound(unsigned int Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -600,7 +600,7 @@ void BS_FMODExSound::PauseSound(unsigned int Handle) { // ----------------------------------------------------------------------------- -void BS_FMODExSound::ResumeSound(unsigned int Handle) { +void FMODExSound::ResumeSound(unsigned int Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -613,7 +613,7 @@ void BS_FMODExSound::ResumeSound(unsigned int Handle) { // ----------------------------------------------------------------------------- -void BS_FMODExSound::StopSound(unsigned int Handle) { +void FMODExSound::StopSound(unsigned int Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -625,7 +625,7 @@ void BS_FMODExSound::StopSound(unsigned int Handle) { // Sound Getter // ----------------------------------------------------------------------------- -bool BS_FMODExSound::IsSoundPaused(unsigned int Handle) { +bool FMODExSound::IsSoundPaused(unsigned int Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -636,7 +636,7 @@ bool BS_FMODExSound::IsSoundPaused(unsigned int Handle) { // ----------------------------------------------------------------------------- -bool BS_FMODExSound::IsSoundPlaying(unsigned int Handle) { +bool FMODExSound::IsSoundPlaying(unsigned int Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -647,7 +647,7 @@ bool BS_FMODExSound::IsSoundPlaying(unsigned int Handle) { // ----------------------------------------------------------------------------- -float BS_FMODExSound::GetSoundVolume(unsigned int Handle) { +float FMODExSound::GetSoundVolume(unsigned int Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -658,7 +658,7 @@ float BS_FMODExSound::GetSoundVolume(unsigned int Handle) { // ----------------------------------------------------------------------------- -float BS_FMODExSound::GetSoundPanning(unsigned int Handle) { +float FMODExSound::GetSoundPanning(unsigned int Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -669,7 +669,7 @@ float BS_FMODExSound::GetSoundPanning(unsigned int Handle) { // ----------------------------------------------------------------------------- -float BS_FMODExSound::GetSoundTime(unsigned int Handle) { +float FMODExSound::GetSoundTime(unsigned int Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -727,7 +727,7 @@ unsigned int BS_FMODExSound::CountPlayingDynamicSounds() { // Ressourcen-Verwaltung // ----------------------------------------------------------------------------- -BS_Resource *BS_FMODExSound::LoadResource(const Common::String &FileName) { +BS_Resource *FMODExSound::LoadResource(const Common::String &FileName) { #if 0 BS_ASSERT(m_FMOD); BS_ASSERT(CanLoadResource(FileName)); @@ -744,7 +744,7 @@ BS_Resource *BS_FMODExSound::LoadResource(const Common::String &FileName) { return 0; #endif } -bool BS_FMODExSound::CanLoadResource(const Common::String &FileName) { +bool FMODExSound::CanLoadResource(const Common::String &FileName) { #if 0 if (FileName.size() >= 4) { Common::String Extension(FileName.end() - 4, FileName.end()); @@ -764,7 +764,7 @@ bool BS_FMODExSound::CanLoadResource(const Common::String &FileName) { // Persistenz // ----------------------------------------------------------------------------- -bool BS_FMODExSound::Persist(BS_OutputPersistenceBlock &Writer) { +bool FMODExSound::Persist(BS_OutputPersistenceBlock &Writer) { #if 0 BS_ASSERT(m_FMOD); @@ -815,7 +815,7 @@ bool BS_FMODExSound::Persist(BS_OutputPersistenceBlock &Writer) { // ----------------------------------------------------------------------------- -bool BS_FMODExSound::Unpersist(BS_InputPersistenceBlock &Reader) { +bool FMODExSound::Unpersist(BS_InputPersistenceBlock &Reader) { #if 0 BS_ASSERT(m_FMOD); diff --git a/engines/sword25/sfx/fmodexsound.h b/engines/sword25/sfx/fmodexsound.h index 41f82d7b65..988d388a99 100644 --- a/engines/sword25/sfx/fmodexsound.h +++ b/engines/sword25/sfx/fmodexsound.h @@ -39,14 +39,14 @@ namespace Sword25 { -class BS_FMODExSound : public BS_SoundEngine { +class FMODExSound : public SoundEngine { public: // ----------------------------------------------------------------------------- // Konstruktion / Destruktion // ----------------------------------------------------------------------------- - BS_FMODExSound(BS_Kernel *pKernel); - virtual ~BS_FMODExSound(); + FMODExSound(BS_Kernel *pKernel); + virtual ~FMODExSound(); bool Init(unsigned int SampleRate, unsigned int Channels = 32); void Update(); diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp index 039ca55cdd..34a6d70cea 100644 --- a/engines/sword25/sfx/soundengine.cpp +++ b/engines/sword25/sfx/soundengine.cpp @@ -38,7 +38,7 @@ namespace Sword25 { -BS_SoundEngine::BS_SoundEngine(BS_Kernel *pKernel) : BS_ResourceService(pKernel) { +SoundEngine::SoundEngine(BS_Kernel *pKernel) : BS_ResourceService(pKernel) { if (!_RegisterScriptBindings()) BS_LOG_ERRORLN("Script bindings could not be registered."); else diff --git a/engines/sword25/sfx/soundengine.h b/engines/sword25/sfx/soundengine.h index 86efe4d3bd..ac26acbff4 100644 --- a/engines/sword25/sfx/soundengine.h +++ b/engines/sword25/sfx/soundengine.h @@ -62,7 +62,7 @@ namespace Sword25 { // Class definitions // ----------------------------------------------------------------------------- -class BS_SoundEngine : public BS_ResourceService, public BS_Persistable { +class SoundEngine : public BS_ResourceService, public BS_Persistable { public: // ----------------------------------------------------------------------------- // Enums and Types @@ -86,8 +86,8 @@ public: // Constructor / destructor // ----------------------------------------------------------------------------- - BS_SoundEngine(BS_Kernel *pKernel); - virtual ~BS_SoundEngine() {}; + SoundEngine(BS_Kernel *pKernel); + virtual ~SoundEngine() {}; // -------------------------------------------------------------- // THIS METHOD MUST BE IMPLEMENTED BY THE SOUND ENGINE diff --git a/engines/sword25/sfx/soundengine_script.cpp b/engines/sword25/sfx/soundengine_script.cpp index 4df80b07cb..8e9c0f029f 100644 --- a/engines/sword25/sfx/soundengine_script.cpp +++ b/engines/sword25/sfx/soundengine_script.cpp @@ -49,7 +49,7 @@ namespace Sword25 { static int Init(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); if (lua_gettop(L) == 0) @@ -67,7 +67,7 @@ static int Init(lua_State *L) { static int Update(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); pSfx->Update(); @@ -80,11 +80,11 @@ static int Update(lua_State *L) { static int SetVolume(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); pSfx->SetVolume(static_cast<float>(luaL_checknumber(L, 1)), - static_cast<BS_SoundEngine::SOUND_TYPES>(static_cast<unsigned int>(luaL_checknumber(L, 2)))); + static_cast<SoundEngine::SOUND_TYPES>(static_cast<unsigned int>(luaL_checknumber(L, 2)))); return 0; } @@ -94,10 +94,10 @@ static int SetVolume(lua_State *L) { static int GetVolume(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - lua_pushnumber(L, pSfx->GetVolume(static_cast<BS_SoundEngine::SOUND_TYPES>(static_cast<unsigned int>(luaL_checknumber(L, 1))))); + lua_pushnumber(L, pSfx->GetVolume(static_cast<SoundEngine::SOUND_TYPES>(static_cast<unsigned int>(luaL_checknumber(L, 1))))); return 1; } @@ -107,7 +107,7 @@ static int GetVolume(lua_State *L) { static int PauseAll(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); pSfx->PauseAll(); @@ -120,7 +120,7 @@ static int PauseAll(lua_State *L) { static int ResumeAll(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); pSfx->ResumeAll(); @@ -133,7 +133,7 @@ static int ResumeAll(lua_State *L) { static int PauseLayer(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); pSfx->PauseLayer(static_cast<int>(luaL_checknumber(L, 1))); @@ -146,7 +146,7 @@ static int PauseLayer(lua_State *L) { static int ResumeLayer(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); pSfx->ResumeLayer(static_cast<int>(luaL_checknumber(L, 1))); @@ -156,10 +156,10 @@ static int ResumeLayer(lua_State *L) { // ----------------------------------------------------------------------------- -static void ProcessPlayParams(lua_State *L, Common::String &FileName, BS_SoundEngine::SOUND_TYPES &Type, float &Volume, float &Pan, bool &Loop, int &LoopStart, int &LoopEnd, unsigned int &Layer) { +static void ProcessPlayParams(lua_State *L, Common::String &FileName, SoundEngine::SOUND_TYPES &Type, float &Volume, float &Pan, bool &Loop, int &LoopStart, int &LoopEnd, unsigned int &Layer) { FileName = luaL_checkstring(L, 1); - Type = static_cast<BS_SoundEngine::SOUND_TYPES>(static_cast<unsigned int>(luaL_checknumber(L, 2))); + Type = static_cast<SoundEngine::SOUND_TYPES>(static_cast<unsigned int>(luaL_checknumber(L, 2))); if (lua_gettop(L) < 3 || lua_isnil(L, 3)) Volume = 1.0f; else Volume = static_cast<float>(luaL_checknumber(L, 3)); @@ -183,11 +183,11 @@ static void ProcessPlayParams(lua_State *L, Common::String &FileName, BS_SoundEn static int PlaySound(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); Common::String FileName; - BS_SoundEngine::SOUND_TYPES Type; + SoundEngine::SOUND_TYPES Type; float Volume; float Pan; bool Loop; @@ -204,11 +204,11 @@ static int PlaySound(lua_State *L) { static int PlaySoundEx(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); Common::String FileName; - BS_SoundEngine::SOUND_TYPES Type; + SoundEngine::SOUND_TYPES Type; float Volume; float Pan; bool Loop; @@ -227,7 +227,7 @@ static int PlaySoundEx(lua_State *L) { static int SetSoundVolume(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); pSfx->SetSoundVolume(static_cast<unsigned int>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2))); @@ -240,7 +240,7 @@ static int SetSoundVolume(lua_State *L) { static int SetSoundPanning(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); pSfx->SetSoundPanning(static_cast<unsigned int>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2))); @@ -253,7 +253,7 @@ static int SetSoundPanning(lua_State *L) { static int PauseSound(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); pSfx->PauseSound(static_cast<unsigned int>(luaL_checknumber(L, 1))); @@ -266,7 +266,7 @@ static int PauseSound(lua_State *L) { static int ResumeSound(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); pSfx->ResumeSound(static_cast<unsigned int>(luaL_checknumber(L, 1))); @@ -279,7 +279,7 @@ static int ResumeSound(lua_State *L) { static int StopSound(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); pSfx->StopSound(static_cast<unsigned int>(luaL_checknumber(L, 1))); @@ -292,7 +292,7 @@ static int StopSound(lua_State *L) { static int IsSoundPaused(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); lua_pushbooleancpp(L, pSfx->IsSoundPaused(static_cast<unsigned int>(luaL_checknumber(L, 1)))); @@ -305,7 +305,7 @@ static int IsSoundPaused(lua_State *L) { static int IsSoundPlaying(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); lua_pushbooleancpp(L, pSfx->IsSoundPlaying(static_cast<unsigned int>(luaL_checknumber(L, 1)))); @@ -318,7 +318,7 @@ static int IsSoundPlaying(lua_State *L) { static int GetSoundVolume(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); lua_pushnumber(L, pSfx->GetSoundVolume(static_cast<unsigned int>(luaL_checknumber(L, 1)))); @@ -331,7 +331,7 @@ static int GetSoundVolume(lua_State *L) { static int GetSoundPanning(lua_State *L) { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = static_cast<SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); lua_pushnumber(L, pSfx->GetSoundPanning(static_cast<unsigned int>(luaL_checknumber(L, 1)))); @@ -367,24 +367,24 @@ static const luaL_reg SFX_FUNCTIONS[] = { }; static const lua_constant_reg SFX_CONSTANTS[] = { - {"MUSIC", BS_SoundEngine::MUSIC}, - {"SPEECH", BS_SoundEngine::SPEECH}, - {"SFX", BS_SoundEngine::SFX}, + {"MUSIC", SoundEngine::MUSIC}, + {"SPEECH", SoundEngine::SPEECH}, + {"SFX", SoundEngine::SFX}, {0, 0} }; // ----------------------------------------------------------------------------- -bool BS_SoundEngine::_RegisterScriptBindings() { +bool SoundEngine::_RegisterScriptBindings() { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_ScriptEngine *pScript = static_cast<BS_ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->GetScriptObject()); BS_ASSERT(L); - if (!BS_LuaBindhelper::AddFunctionsToLib(L, SFX_LIBRARY_NAME, SFX_FUNCTIONS)) return false; - if (!BS_LuaBindhelper::AddConstantsToLib(L, SFX_LIBRARY_NAME, SFX_CONSTANTS)) return false; + if (!LuaBindhelper::AddFunctionsToLib(L, SFX_LIBRARY_NAME, SFX_FUNCTIONS)) return false; + if (!LuaBindhelper::AddConstantsToLib(L, SFX_LIBRARY_NAME, SFX_CONSTANTS)) return false; return true; } diff --git a/engines/sword25/sword25.cpp b/engines/sword25/sword25.cpp index 74b12d6108..c4a3c3667e 100644 --- a/engines/sword25/sword25.cpp +++ b/engines/sword25/sword25.cpp @@ -95,7 +95,7 @@ Common::Error Sword25Engine::AppStart(const Common::StringArray &CommandParamete } // Package-Manager starten, damit die Packfiles geladen werden können. - BS_PackageManager *PackageManagerPtr = static_cast<BS_PackageManager *>(BS_Kernel::GetInstance()->NewService("package", PACKAGE_MANAGER)); + PackageManager *PackageManagerPtr = static_cast<PackageManager *>(BS_Kernel::GetInstance()->NewService("package", PACKAGE_MANAGER)); if (!PackageManagerPtr) { BS_LOG_ERRORLN("Packagemanager initialization failed."); return Common::kUnknownError; @@ -111,7 +111,7 @@ Common::Error Sword25Engine::AppStart(const Common::StringArray &CommandParamete } // Einen Pointer auf den Skript-Engine holen. - BS_ScriptEngine *ScriptPtr = static_cast<BS_ScriptEngine *>(BS_Kernel::GetInstance()->GetService("script")); + ScriptEngine *ScriptPtr = static_cast<ScriptEngine *>(BS_Kernel::GetInstance()->GetService("script")); if (!ScriptPtr) { BS_LOG_ERRORLN("Script intialization failed."); return Common::kUnknownError; @@ -125,7 +125,7 @@ Common::Error Sword25Engine::AppStart(const Common::StringArray &CommandParamete bool Sword25Engine::AppMain() { // The main script start. This script loads all the other scripts and starts the actual game. - BS_ScriptEngine *ScriptPtr = static_cast<BS_ScriptEngine *>(BS_Kernel::GetInstance()->GetService("script")); + ScriptEngine *ScriptPtr = static_cast<ScriptEngine *>(BS_Kernel::GetInstance()->GetService("script")); BS_ASSERT(ScriptPtr); ScriptPtr->ExecuteFile(DEFAULT_SCRIPT_FILE); @@ -143,7 +143,7 @@ bool Sword25Engine::AppEnd() { } bool Sword25Engine::LoadPackages() { - BS_PackageManager *PackageManagerPtr = reinterpret_cast<BS_PackageManager *>(BS_Kernel::GetInstance()->GetService("package")); + PackageManager *PackageManagerPtr = reinterpret_cast<PackageManager *>(BS_Kernel::GetInstance()->GetService("package")); BS_ASSERT(PackageManagerPtr); // Load the main package |