From 42670975acf72ca52bbf73c0f0c0295b07c0a50a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jan 2011 20:52:52 +0000 Subject: SWORD25: Removed a lot of debug/unimplemented/unused functions svn-id: r55600 --- engines/sword25/gfx/graphicengine.cpp | 39 +--------- engines/sword25/gfx/graphicengine.h | 27 +------ engines/sword25/gfx/graphicengine_script.cpp | 103 ++++----------------------- 3 files changed, 16 insertions(+), 153 deletions(-) (limited to 'engines/sword25/gfx') 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::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. @@ -247,13 +232,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. @@ -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 _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(luaL_checknumber(L, 3)))); break; case 4: + default: lua_pushbooleancpp(L, pGE->init(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2)), static_cast(luaL_checknumber(L, 3)), static_cast(luaL_checknumber(L, 4)))); break; - default: - lua_pushbooleancpp(L, pGE->init(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2)), - static_cast(luaL_checknumber(L, 3)), static_cast(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 bitmapPtr = checkBitmap(L); - assert(bitmapPtr.isValid()); - lua_pushbooleancpp(L, bitmapPtr->isScalingAllowed()); - return 1; -} - -static int b_isAlphaAllowed(lua_State *L) { - RenderObjectPtr bitmapPtr = checkBitmap(L); - assert(bitmapPtr.isValid()); - lua_pushbooleancpp(L, bitmapPtr->isAlphaAllowed()); - return 1; -} - -static int b_isTintingAllowed(lua_State *L) { - RenderObjectPtr bitmapPtr = checkBitmap(L); - assert(bitmapPtr.isValid()); - lua_pushbooleancpp(L, bitmapPtr->isColorModulationAllowed()); - return 1; -} - static int b_remove(lua_State *L) { RenderObjectPtr 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} }; -- cgit v1.2.3