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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Jan 28 21:52:54 CET 2011


Revision: 55600
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55600&view=rev
Author:   thebluegr
Date:     2011-01-28 20:52:52 +0000 (Fri, 28 Jan 2011)

Log Message:
-----------
SWORD25: Removed a lot of debug/unimplemented/unused functions

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/gfx/graphicengine.cpp
    scummvm/trunk/engines/sword25/gfx/graphicengine.h
    scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp
    scummvm/trunk/engines/sword25/input/inputengine.cpp
    scummvm/trunk/engines/sword25/input/inputengine.h
    scummvm/trunk/engines/sword25/input/inputengine_script.cpp
    scummvm/trunk/engines/sword25/math/geometry_script.cpp

Modified: scummvm/trunk/engines/sword25/gfx/graphicengine.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/graphicengine.cpp	2011-01-28 19:54:48 UTC (rev 55599)
+++ scummvm/trunk/engines/sword25/gfx/graphicengine.cpp	2011-01-28 20:52:52 UTC (rev 55600)
@@ -67,7 +67,6 @@
 	_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 @@
 	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\xFCtzte Bittiefe gew\xE4hlt 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 @@
 	_width = width;
 	_height = height;
 	_bitDepth = bitDepth;
-	_windowed = isWindowed_;
 	_screenRect.left = 0;
 	_screenRect.top = 0;
 	_screenRect.right = _width;
@@ -156,32 +154,6 @@
 
 	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 @@
 		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();

Modified: scummvm/trunk/engines/sword25/gfx/graphicengine.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/graphicengine.h	2011-01-28 19:54:48 UTC (rev 55599)
+++ scummvm/trunk/engines/sword25/gfx/graphicengine.h	2011-01-28 20:52:52 UTC (rev 55600)
@@ -117,9 +117,8 @@
 	 * @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,21 +137,7 @@
 	*/
 	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.
 	 * Notes: This method should only be called after a call to EndFrame(), and before the next call to StartFrame().
@@ -248,13 +233,6 @@
 	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 @@
 	int _height;
 	Common::Rect _screenRect;
 	int _bitDepth;
-	bool _windowed;
 
 	/**
 	 * Calculates the time since the last frame beginning has passed.
@@ -367,8 +344,6 @@
 		Vertex _end;
 		uint _color;
 	};
-
-	Common::Array<DebugLine> _debugLines;
 };
 
 } // End of namespace Sword25

Modified: scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp	2011-01-28 19:54:48 UTC (rev 55599)
+++ scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp	2011-01-28 20:52:52 UTC (rev 55600)
@@ -222,13 +222,10 @@
 		                                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 @@
 	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 @@
 	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 @@
 	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 @@
 	{"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 @@
 	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 @@
 	{"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}
 };

Modified: scummvm/trunk/engines/sword25/input/inputengine.cpp
===================================================================
--- scummvm/trunk/engines/sword25/input/inputengine.cpp	2011-01-28 19:54:48 UTC (rev 55599)
+++ scummvm/trunk/engines/sword25/input/inputengine.cpp	2011-01-28 20:52:52 UTC (rev 55600)
@@ -216,16 +216,6 @@
 	       ((_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;
 }

Modified: scummvm/trunk/engines/sword25/input/inputengine.h
===================================================================
--- scummvm/trunk/engines/sword25/input/inputengine.h	2011-01-28 19:54:48 UTC (rev 55599)
+++ scummvm/trunk/engines/sword25/input/inputengine.h	2011-01-28 20:52:52 UTC (rev 55600)
@@ -231,16 +231,6 @@
 	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.

Modified: scummvm/trunk/engines/sword25/input/inputengine_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/input/inputengine_script.cpp	2011-01-28 19:54:48 UTC (rev 55599)
+++ scummvm/trunk/engines/sword25/input/inputengine_script.cpp	2011-01-28 20:52:52 UTC (rev 55600)
@@ -167,60 +167,24 @@
 	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;
+// Marks a function that should never be used
+static int dummyFuncError(lua_State *L) {
+	error("Dummy function invoked by LUA");
+	return 1;
 }
 
-static int unregisterCommandCallback(lua_State *L) {
-	luaL_checktype(L, 1, LUA_TFUNCTION);
-	commandCallbackPtr->unregisterCallbackFunction(L, 1);
-
-	return 0;
-}
-
 static const char *PACKAGE_LIBRARY_NAME = "Input";
 
 static const luaL_reg PACKAGE_FUNCTIONS[] = {
@@ -233,14 +197,14 @@
 	{"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}
 };
 

Modified: scummvm/trunk/engines/sword25/math/geometry_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/math/geometry_script.cpp	2011-01-28 19:54:48 UTC (rev 55599)
+++ scummvm/trunk/engines/sword25/math/geometry_script.cpp	2011-01-28 20:52:52 UTC (rev 55600)
@@ -359,45 +359,6 @@
 	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 &region, 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 @@
 	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 @@
 	{"GetX", r_getX},
 	{"GetY", r_getY},
 	{"IsValid", r_isValid},
-	{"Draw", r_draw},
+	{"Draw", dummyFuncError},
 	{"GetCentroid", r_getCentroid},
 	{0, 0}
 };


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list