diff options
author | Filippos Karapetis | 2011-01-28 20:52:52 +0000 |
---|---|---|
committer | Filippos Karapetis | 2011-01-28 20:52:52 +0000 |
commit | 42670975acf72ca52bbf73c0f0c0295b07c0a50a (patch) | |
tree | 2239c83e7e97900c0b211fef8550bf1fbfa7ee49 /engines | |
parent | cfca829e46d40381142c5f024d7f3c555a34564f (diff) | |
download | scummvm-rg350-42670975acf72ca52bbf73c0f0c0295b07c0a50a.tar.gz scummvm-rg350-42670975acf72ca52bbf73c0f0c0295b07c0a50a.tar.bz2 scummvm-rg350-42670975acf72ca52bbf73c0f0c0295b07c0a50a.zip |
SWORD25: Removed a lot of debug/unimplemented/unused functions
svn-id: r55600
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sword25/gfx/graphicengine.cpp | 39 | ||||
-rw-r--r-- | engines/sword25/gfx/graphicengine.h | 27 | ||||
-rw-r--r-- | engines/sword25/gfx/graphicengine_script.cpp | 103 | ||||
-rw-r--r-- | engines/sword25/input/inputengine.cpp | 10 | ||||
-rw-r--r-- | engines/sword25/input/inputengine.h | 10 | ||||
-rw-r--r-- | engines/sword25/input/inputengine_script.cpp | 56 | ||||
-rw-r--r-- | engines/sword25/math/geometry_script.cpp | 47 |
7 files changed, 33 insertions, 259 deletions
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index 1a5a92a291..cf97534d6c 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -67,7 +67,6 @@ GraphicEngine::GraphicEngine(Kernel *pKernel) : _width(0), _height(0), _bitDepth(0), - _windowed(0), _lastTimeStamp((uint) -1), // max. BS_INT64 um beim ersten Aufruf von _UpdateLastFrameDuration() einen Reset zu erzwingen _lastFrameDuration(0), _timerActive(true), @@ -89,7 +88,7 @@ GraphicEngine::~GraphicEngine() { delete _thumbnail; } -bool GraphicEngine::init(int width, int height, int bitDepth, int backbufferCount, bool isWindowed_) { +bool GraphicEngine::init(int width, int height, int bitDepth, int backbufferCount) { // Warnung ausgeben, wenn eine nicht unterstützte Bittiefe gewählt wurde. if (bitDepth != BIT_DEPTH) { warning("Can't use a bit depth of %d (not supported). Falling back to %d.", bitDepth, BIT_DEPTH); @@ -106,7 +105,6 @@ bool GraphicEngine::init(int width, int height, int bitDepth, int backbufferCoun _width = width; _height = height; _bitDepth = bitDepth; - _windowed = isWindowed_; _screenRect.left = 0; _screenRect.top = 0; _screenRect.right = _width; @@ -156,32 +154,6 @@ bool GraphicEngine::endFrame() { g_system->updateScreen(); - // Debug-Lines zeichnen - if (!_debugLines.empty()) { -#if 0 - glEnable(GL_LINE_SMOOTH); - glBegin(GL_LINES); - - Common::Array<DebugLine>::const_iterator iter = m_DebugLines.begin(); - for (; iter != m_DebugLines.end(); ++iter) { - const uint &Color = (*iter).Color; - const BS_Vertex &Start = (*iter).Start; - const BS_Vertex &End = (*iter).End; - - glColor4ub((Color >> 16) & 0xff, (Color >> 8) & 0xff, Color & 0xff, Color >> 24); - glVertex2d(Start.X, Start.Y); - glVertex2d(End.X, End.Y); - } - - glEnd(); - glDisable(GL_LINE_SMOOTH); -#endif - - warning("STUB: Drawing debug lines"); - - _debugLines.clear(); - } - return true; } @@ -367,15 +339,6 @@ bool GraphicEngine::canLoadResource(const Common::String &filename) { filename.hasSuffix(".b25s"); } - -// ----------------------------------------------------------------------------- -// DEBUGGING -// ----------------------------------------------------------------------------- - -void GraphicEngine::drawDebugLine(const Vertex &start, const Vertex &end, uint color) { - _debugLines.push_back(DebugLine(start, end, color)); -} - void GraphicEngine::updateLastFrameDuration() { // Record current time const uint currentTime = Kernel::getInstance()->getMilliTicks(); diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h index 6ddf8cbe05..38eecaa60f 100644 --- a/engines/sword25/gfx/graphicengine.h +++ b/engines/sword25/gfx/graphicengine.h @@ -117,9 +117,8 @@ public: * @param Height The height of the output buffer in pixels. The default value is 600 * @param BitDepth The bit depth of the desired output buffer in bits. The default value is 16 * @param BackbufferCount The number of back buffers to be created. The default value is 2 - * @param Windowed Indicates whether the engine is to run in windowed mode. */ - bool init(int width = 800, int height = 600, int bitDepth = 16, int backbufferCount = 2, bool windowed = false); + bool init(int width = 800, int height = 600, int bitDepth = 16, int backbufferCount = 2); /** * Begins rendering a new frame. @@ -138,20 +137,6 @@ public: */ bool endFrame(); - // Debug methods - - /** - * Draws a line in the frame buffer - * - * This method must be called between calls to StartFrame() and EndFrame(), and is intended only for debugging - * purposes. The line will only appear for a single frame. If the line is to be shown permanently, it must be - * called for every frame. - * @param Start The starting point of the line - * @param End The ending point of the line - * @param Color The color of the line. The default is BS_RGB (255,255,255) (White) - */ - void drawDebugLine(const Vertex &start, const Vertex &end, uint color = BS_RGB(255, 255, 255)); - /** * Creates a thumbnail with the dimensions of 200x125. This will not include the top and bottom of the screen.. * the interface boards the the image as a 16th of it's original size. @@ -248,13 +233,6 @@ public: bool getVsync() const; /** - * Returns true if the engine is running in Windowed mode. - */ - bool isWindowed() { - return _windowed; - } - - /** * Fills a rectangular area of the frame buffer with a color. * Notes: It is possible to create transparent rectangles by passing a color with an Alpha value of 255. * @param FillRectPtr Pointer to a Common::Rect, which specifies the section of the frame buffer to be filled. @@ -330,7 +308,6 @@ protected: int _height; Common::Rect _screenRect; int _bitDepth; - bool _windowed; /** * Calculates the time since the last frame beginning has passed. @@ -367,8 +344,6 @@ private: Vertex _end; uint _color; }; - - Common::Array<DebugLine> _debugLines; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index e9a2617d71..d67d0038c3 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -222,13 +222,10 @@ static int init(lua_State *L) { static_cast<int>(luaL_checknumber(L, 3)))); break; case 4: + default: lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)), static_cast<int>(luaL_checknumber(L, 3)), static_cast<int>(luaL_checknumber(L, 4)))); break; - default: - lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)), - static_cast<int>(luaL_checknumber(L, 3)), static_cast<int>(luaL_checknumber(L, 4)), - lua_tobooleancpp(L, 5))); } @@ -283,34 +280,6 @@ static int endFrame(lua_State *L) { return 1; } -static int drawDebugLine(lua_State *L) { - GraphicEngine *pGE = getGE(); - - Vertex start; - Vertex end; - Vertex::luaVertexToVertex(L, 1, start); - Vertex::luaVertexToVertex(L, 2, end); - pGE->drawDebugLine(start, end, GraphicEngine::luaColorToARGBColor(L, 3)); - - return 0; -} - -static int getDisplayWidth(lua_State *L) { - GraphicEngine *pGE = getGE(); - - lua_pushnumber(L, pGE->getDisplayWidth()); - - return 1; -} - -static int getDisplayHeight(lua_State *L) { - GraphicEngine *pGE = getGE(); - - lua_pushnumber(L, pGE->getDisplayHeight()); - - return 1; -} - static int getBitDepth(lua_State *L) { GraphicEngine *pGE = getGE(); @@ -335,21 +304,6 @@ static int isVsync(lua_State *L) { return 1; } -static int isWindowed(lua_State *L) { - GraphicEngine *pGE = getGE(); - - lua_pushbooleancpp(L, pGE->isWindowed()); - - return 1; -} - -static int getFPSCount(lua_State *L) { - // Used in a debug function - lua_pushnumber(L, 0); - - return 1; -} - static int getLastFrameDuration(lua_State *L) { GraphicEngine *pGE = getGE(); @@ -378,23 +332,15 @@ static int getSecondaryFrameDuration(lua_State *L) { return 1; } -static int saveScreenshot(lua_State *L) { - // This is used by system/debug.lua only. We do not implement this; support - // for taking screenshots is a backend feature. - lua_pushbooleancpp(L, false); - - return 1; -} - static int saveThumbnailScreenshot(lua_State *L) { GraphicEngine *pGE = getGE(); lua_pushbooleancpp(L, pGE->saveThumbnailScreenshot(luaL_checkstring(L, 1))); return 1; } -static int getRepaintedPixels(lua_State *L) { - // Used in a debug function. - lua_pushnumber(L, 0); +// Marks a function that should never be used +static int dummyFuncError(lua_State *L) { + error("Dummy function invoked by LUA"); return 1; } @@ -402,21 +348,21 @@ static const luaL_reg GFX_FUNCTIONS[] = { {"Init", init}, {"StartFrame", startFrame}, {"EndFrame", endFrame}, - {"DrawDebugLine", drawDebugLine}, + {"DrawDebugLine", dummyFuncError}, {"SetVsync", setVsync}, - {"GetDisplayWidth", getDisplayWidth}, - {"GetDisplayHeight", getDisplayHeight}, + {"GetDisplayWidth", dummyFuncError}, + {"GetDisplayHeight", dummyFuncError}, {"GetBitDepth", getBitDepth}, {"IsVsync", isVsync}, - {"IsWindowed", isWindowed}, - {"GetFPSCount", getFPSCount}, + {"IsWindowed", dummyFuncError}, + {"GetFPSCount", dummyFuncError}, {"GetLastFrameDuration", getLastFrameDuration}, {"StopMainTimer", stopMainTimer}, {"ResumeMainTimer", resumeMainTimer}, {"GetSecondaryFrameDuration", getSecondaryFrameDuration}, - {"SaveScreenshot", saveScreenshot}, + {"SaveScreenshot", dummyFuncError}, {"NewAnimationTemplate", newAnimationTemplate}, - {"GetRepaintedPixels", getRepaintedPixels}, + {"GetRepaintedPixels", dummyFuncError}, {"SaveThumbnailScreenshot", saveThumbnailScreenshot}, {0, 0} }; @@ -812,27 +758,6 @@ static int b_getPixel(lua_State *L) { return 1; } -static int b_isScalingAllowed(lua_State *L) { - RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L); - assert(bitmapPtr.isValid()); - lua_pushbooleancpp(L, bitmapPtr->isScalingAllowed()); - return 1; -} - -static int b_isAlphaAllowed(lua_State *L) { - RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L); - assert(bitmapPtr.isValid()); - lua_pushbooleancpp(L, bitmapPtr->isAlphaAllowed()); - return 1; -} - -static int b_isTintingAllowed(lua_State *L) { - RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L); - assert(bitmapPtr.isValid()); - lua_pushbooleancpp(L, bitmapPtr->isColorModulationAllowed()); - return 1; -} - static int b_remove(lua_State *L) { RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L); assert(roPtr.isValid()); @@ -855,9 +780,9 @@ static const luaL_reg BITMAP_METHODS[] = { {"IsFlipH", b_isFlipH}, {"IsFlipV", b_isFlipV}, {"GetPixel", b_getPixel}, - {"IsScalingAllowed", b_isScalingAllowed}, - {"IsAlphaAllowed", b_isAlphaAllowed}, - {"IsTintingAllowed", b_isTintingAllowed}, + {"IsScalingAllowed", dummyFuncError}, + {"IsAlphaAllowed", dummyFuncError}, + {"IsTintingAllowed", dummyFuncError}, {"Remove", b_remove}, {0, 0} }; diff --git a/engines/sword25/input/inputengine.cpp b/engines/sword25/input/inputengine.cpp index 58b40a940d..769baafeed 100644 --- a/engines/sword25/input/inputengine.cpp +++ b/engines/sword25/input/inputengine.cpp @@ -216,16 +216,6 @@ bool InputEngine::wasKeyDown(uint keyCode) { ((_keyboardState[_currentState ^ 1][keyCode] & 0x80) != 0); } -void InputEngine::setMouseX(int posX) { - _mouseX = posX; - g_system->warpMouse(_mouseX, _mouseY); -} - -void InputEngine::setMouseY(int posY) { - _mouseY = posY; - g_system->warpMouse(_mouseX, _mouseY); -} - void InputEngine::setCharacterCallback(CharacterCallback callback) { _characterCallback = callback; } diff --git a/engines/sword25/input/inputengine.h b/engines/sword25/input/inputengine.h index 946d6a8e5e..40f801dde2 100644 --- a/engines/sword25/input/inputengine.h +++ b/engines/sword25/input/inputengine.h @@ -231,16 +231,6 @@ public: int getMouseY(); /** - * Sets the X position of the cursor in pixels - */ - void setMouseX(int posX); - - /** - * Sets the Y position of the cursor in pixels - */ - void setMouseY(int posY); - - /** * Returns true if a given key was pressed * @param KeyCode The key code to be checked * @return Returns true if the given key is done, otherwise false. diff --git a/engines/sword25/input/inputengine_script.cpp b/engines/sword25/input/inputengine_script.cpp index f742f56a5a..d4f2719b62 100644 --- a/engines/sword25/input/inputengine_script.cpp +++ b/engines/sword25/input/inputengine_script.cpp @@ -167,58 +167,22 @@ static int wasKeyDown(lua_State *L) { return 1; } -static int setMouseX(lua_State *L) { - InputEngine *pIE = getIE(); - - pIE->setMouseX((int)luaL_checknumber(L, 1)); - return 0; -} - -static int setMouseY(lua_State *L) { - InputEngine *pIE = getIE(); - - pIE->setMouseY((int)luaL_checknumber(L, 1)); - return 0; -} - static void theCharacterCallback(int character) { characterCallbackPtr->_character = static_cast<byte>(character); lua_State *L = static_cast<lua_State *>(Kernel::getInstance()->getScript()->getScriptObject()); characterCallbackPtr->invokeCallbackFunctions(L, 1); } -static int registerCharacterCallback(lua_State *L) { - luaL_checktype(L, 1, LUA_TFUNCTION); - characterCallbackPtr->registerCallbackFunction(L, 1); - - return 0; -} - -static int unregisterCharacterCallback(lua_State *L) { - luaL_checktype(L, 1, LUA_TFUNCTION); - characterCallbackPtr->unregisterCallbackFunction(L, 1); - - return 0; -} - static void theCommandCallback(int command) { commandCallbackPtr->_command = static_cast<InputEngine::KEY_COMMANDS>(command); lua_State *L = static_cast<lua_State *>(Kernel::getInstance()->getScript()->getScriptObject()); commandCallbackPtr->invokeCallbackFunctions(L, 1); } -static int registerCommandCallback(lua_State *L) { - luaL_checktype(L, 1, LUA_TFUNCTION); - commandCallbackPtr->registerCallbackFunction(L, 1); - - return 0; -} - -static int unregisterCommandCallback(lua_State *L) { - luaL_checktype(L, 1, LUA_TFUNCTION); - commandCallbackPtr->unregisterCallbackFunction(L, 1); - - return 0; +// Marks a function that should never be used +static int dummyFuncError(lua_State *L) { + error("Dummy function invoked by LUA"); + return 1; } static const char *PACKAGE_LIBRARY_NAME = "Input"; @@ -233,14 +197,14 @@ static const luaL_reg PACKAGE_FUNCTIONS[] = { {"IsLeftDoubleClick", isLeftDoubleClick}, {"GetMouseX", getMouseX}, {"GetMouseY", getMouseY}, - {"SetMouseX", setMouseX}, - {"SetMouseY", setMouseY}, + {"SetMouseX", dummyFuncError}, + {"SetMouseY", dummyFuncError}, {"IsKeyDown", isKeyDown}, {"WasKeyDown", wasKeyDown}, - {"RegisterCharacterCallback", registerCharacterCallback}, - {"UnregisterCharacterCallback", unregisterCharacterCallback}, - {"RegisterCommandCallback", registerCommandCallback}, - {"UnregisterCommandCallback", unregisterCommandCallback}, + {"RegisterCharacterCallback", dummyFuncError}, // debug + {"UnregisterCharacterCallback", dummyFuncError}, + {"RegisterCommandCallback", dummyFuncError}, + {"UnregisterCommandCallback", dummyFuncError}, {0, 0} }; diff --git a/engines/sword25/math/geometry_script.cpp b/engines/sword25/math/geometry_script.cpp index 15b1aadac1..6562a0f0a5 100644 --- a/engines/sword25/math/geometry_script.cpp +++ b/engines/sword25/math/geometry_script.cpp @@ -359,45 +359,6 @@ static int r_setY(lua_State *L) { return 0; } -static void drawPolygon(const Polygon &polygon, uint color, const Vertex &offset) { - GraphicEngine *pGE = Kernel::getInstance()->getGfx(); - assert(pGE); - - for (int i = 0; i < polygon.vertexCount - 1; i++) - pGE->drawDebugLine(polygon.vertices[i] + offset, polygon.vertices[i + 1] + offset, color); - - pGE->drawDebugLine(polygon.vertices[polygon.vertexCount - 1] + offset, polygon.vertices[0] + offset, color); -} - -static void drawRegion(const Region ®ion, uint color, const Vertex &offset) { - drawPolygon(region.getContour(), color, offset); - for (int i = 0; i < region.getHoleCount(); i++) - drawPolygon(region.getHole(i), color, offset); -} - -static int r_draw(lua_State *L) { - Region *pR = checkRegion(L); - assert(pR); - - switch (lua_gettop(L)) { - case 3: { - Vertex offset; - Vertex::luaVertexToVertex(L, 3, offset); - drawRegion(*pR, GraphicEngine::luaColorToARGBColor(L, 2), offset); - } - break; - - case 2: - drawRegion(*pR, GraphicEngine::luaColorToARGBColor(L, 2), Vertex(0, 0)); - break; - - default: - drawRegion(*pR, BS_RGB(255, 255, 255), Vertex(0, 0)); - } - - return 0; -} - static int r_getCentroid(lua_State *L) { Region *RPtr = checkRegion(L); assert(RPtr); @@ -414,6 +375,12 @@ static int r_delete(lua_State *L) { return 0; } +// Marks a function that should never be used +static int dummyFuncError(lua_State *L) { + error("Dummy function invoked by LUA"); + return 1; +} + static const luaL_reg REGION_METHODS[] = { {"SetPos", r_setPos}, {"SetX", r_setX}, @@ -423,7 +390,7 @@ static const luaL_reg REGION_METHODS[] = { {"GetX", r_getX}, {"GetY", r_getY}, {"IsValid", r_isValid}, - {"Draw", r_draw}, + {"Draw", dummyFuncError}, {"GetCentroid", r_getCentroid}, {0, 0} }; |