[Scummvm-cvs-logs] SF.net SVN: scummvm: [24614] scummvm/trunk/engines/touche

cyx at users.sourceforge.net cyx at users.sourceforge.net
Sun Nov 5 01:20:47 CET 2006


Revision: 24614
          http://svn.sourceforge.net/scummvm/?rev=24614&view=rev
Author:   cyx
Date:     2006-11-04 16:20:36 -0800 (Sat, 04 Nov 2006)

Log Message:
-----------
cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/touche/graphics.cpp
    scummvm/trunk/engines/touche/graphics.h
    scummvm/trunk/engines/touche/opcodes.cpp
    scummvm/trunk/engines/touche/plugin.cpp
    scummvm/trunk/engines/touche/resource.cpp
    scummvm/trunk/engines/touche/staticres.cpp
    scummvm/trunk/engines/touche/touche.cpp
    scummvm/trunk/engines/touche/touche.h
    scummvm/trunk/engines/touche/ui.cpp

Modified: scummvm/trunk/engines/touche/graphics.cpp
===================================================================
--- scummvm/trunk/engines/touche/graphics.cpp	2006-11-04 23:22:49 UTC (rev 24613)
+++ scummvm/trunk/engines/touche/graphics.cpp	2006-11-05 00:20:36 UTC (rev 24614)
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * $URL$
- * $Id: $
+ * $Id$
  *
  */
 
@@ -94,34 +94,16 @@
 }
 
 void Graphics::drawRect(uint8 *dst, int dstPitch, int x, int y, int w, int h, uint8 color1, uint8 color2) {
-	int x1 = x;
-	int y1 = y;
-	int x2 = x + w - 1;
-	int y2 = y + h - 1;
-	drawLineHV(dst, dstPitch, x1, y1, x2, y1, color1);
-	drawLineHV(dst, dstPitch, x1, y1, x1, y2, color1);
-	drawLineHV(dst, dstPitch, x2, y1 + 1, x2, y2, color2);
-	drawLineHV(dst, dstPitch, x1 + 1, y2, x2, y2, color2);
+	const int x1 = x;
+	const int y1 = y;
+	const int x2 = x + w - 1;
+	const int y2 = y + h - 1;
+	drawLine(dst, dstPitch, x1, y1, x2, y1, color1);
+	drawLine(dst, dstPitch, x1, y1, x1, y2, color1);
+	drawLine(dst, dstPitch, x2, y1 + 1, x2, y2, color2);
+	drawLine(dst, dstPitch, x1 + 1, y2, x2, y2, color2);
 }
 
-void Graphics::drawLineHV(uint8 *dst, int dstPitch, int x1, int y1, int x2, int y2, uint8 color) {
-	if (x2 < x1) {
-		SWAP(x2, x1);
-	}
-	if (y2 < y1) {
-		SWAP(y2, y1);
-	}
-	if (y1 == y2) {
-		for (int x = x1; x < x2; ++x) {
-			dst[y1 * dstPitch + x] = color;
-		}
-	} else {
-		for (int y = y1; y < y2; ++y) {
-			dst[y * dstPitch + x1] = color;
-		}
-	}
-}
-
 void Graphics::drawLine(uint8 *dst, int dstPitch, int x1, int y1, int x2, int y2, uint8 color) {
 	assert(x1 >= 0 && y1 >= 0 && x2 >= 0 && y2 >= 0);
 

Modified: scummvm/trunk/engines/touche/graphics.h
===================================================================
--- scummvm/trunk/engines/touche/graphics.h	2006-11-04 23:22:49 UTC (rev 24613)
+++ scummvm/trunk/engines/touche/graphics.h	2006-11-05 00:20:36 UTC (rev 24614)
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * $URL$
- * $Id: $
+ * $Id$
  *
  */
 
@@ -40,7 +40,6 @@
 	static int drawChar16(uint8 *dst, int dstPitch, uint8 chr, int x, int y, uint16 color);
 	static void fillRect(uint8 *dst, int dstPitch, int x, int y, int w, int h, uint8 color);
 	static void drawRect(uint8 *dst, int dstPitch, int x, int y, int w, int h, uint8 color1, uint8 color2);
-	static void drawLineHV(uint8 *dst, int dstPitch, int x1, int y1, int x2, int y2, uint8 color);
 	static void drawLine(uint8 *dst, int dstPitch, int x1, int y1, int x2, int y2, uint8 color);
 	static void copyRect(uint8 *dst, int dstPitch, int dstX, int dstY, const uint8 *src, int srcPitch, int srcX, int srcY, int w, int h, int flags = 0);
 	static void copyMask(uint8 *dst, int dstPitch, int dstX, int dstY, const uint8 *src, int srcPitch, int srcX, int srcY, int w, int h, uint8 fillColor);

Modified: scummvm/trunk/engines/touche/opcodes.cpp
===================================================================
--- scummvm/trunk/engines/touche/opcodes.cpp	2006-11-04 23:22:49 UTC (rev 24613)
+++ scummvm/trunk/engines/touche/opcodes.cpp	2006-11-05 00:20:36 UTC (rev 24614)
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * $URL$
- * $Id: $
+ * $Id$
  *
  */
 
@@ -26,6 +26,183 @@
 
 namespace Touche {
 
+void ToucheEngine::setupOpcodes() {
+	static const OpcodeProc opcodesTable[] = {
+		/* 0x00 */
+		&ToucheEngine::op_nop,
+		&ToucheEngine::op_jnz,
+		&ToucheEngine::op_jz,
+		&ToucheEngine::op_jmp,
+		/* 0x04 */
+		&ToucheEngine::op_true,
+		&ToucheEngine::op_false,
+		&ToucheEngine::op_push,
+		&ToucheEngine::op_testFalse,
+		/* 0x08 */
+		&ToucheEngine::op_add,
+		&ToucheEngine::op_sub,
+		&ToucheEngine::op_mul,
+		&ToucheEngine::op_div,
+		/* 0x0C */
+		&ToucheEngine::op_mod,
+		&ToucheEngine::op_and,
+		&ToucheEngine::op_or,
+		&ToucheEngine::op_not,
+		/* 0x10 */
+		&ToucheEngine::op_testGreater,
+		&ToucheEngine::op_testEquals,
+		&ToucheEngine::op_testLower,
+		&ToucheEngine::op_fetchScriptWord,
+		/* 0x14 */
+		0,
+		0,
+		0,
+		0,
+		/* 0x18 */
+		&ToucheEngine::op_testGreaterOrEquals,
+		&ToucheEngine::op_testLowerOrEquals,
+		&ToucheEngine::op_testNotEquals,
+		&ToucheEngine::op_endConversation,
+		/* 0x1C */
+		&ToucheEngine::op_stopScript,
+		&ToucheEngine::op_getFlag,
+		&ToucheEngine::op_setFlag,
+		0,
+		/* 0x20 */
+		0,
+		0,
+		0,
+		&ToucheEngine::op_fetchScriptByte,
+		/* 0x24 */
+		0,
+		0,
+		0,
+		0,
+		/* 0x28 */
+		&ToucheEngine::op_getScriptValue,
+		&ToucheEngine::op_setScriptValue,
+		0,
+		0,
+		/* 0x2C */
+		0,
+		0,
+		&ToucheEngine::op_getKeyCharWalkBox,
+		&ToucheEngine::op_startSound,
+		/* 0x30 */
+		&ToucheEngine::op_initKeyCharTalk,
+		0,
+		0,
+		0,
+		/* 0x34 */
+		&ToucheEngine::op_loadRoom,
+		&ToucheEngine::op_updateRoom,
+		&ToucheEngine::op_startTalk,
+		&ToucheEngine::op_setKeyCharBox,
+		/* 0x38 */
+		&ToucheEngine::op_initKeyCharScript,
+		&ToucheEngine::op_loadSprite,
+		&ToucheEngine::op_loadSequence,
+		&ToucheEngine::op_setKeyCharFrame,
+		/* 0x3C */
+		&ToucheEngine::op_setKeyCharDirection,
+		&ToucheEngine::op_clearConversationChoices,
+		&ToucheEngine::op_addConversationChoice,
+		&ToucheEngine::op_removeConversationChoice,
+		/* 0x40 */
+		&ToucheEngine::op_getInventoryItem,
+		&ToucheEngine::op_setInventoryItem,
+		&ToucheEngine::op_startEpisode,
+		&ToucheEngine::op_setConversationNum,
+		/* 0x44 */
+		&ToucheEngine::op_enableInventoryItem,
+		&ToucheEngine::op_enableInput,
+		&ToucheEngine::op_disableInput,
+		&ToucheEngine::op_faceKeyChar,
+		/* 0x48 */
+		&ToucheEngine::op_getKeyCharCurrentAnim,
+		&ToucheEngine::op_getCurrentKeyChar,
+		&ToucheEngine::op_isKeyCharActive,
+		&ToucheEngine::op_setPalette,
+		/* 0x4C */
+		&ToucheEngine::op_changeWalkPath,
+		&ToucheEngine::op_lockWalkPath,
+		&ToucheEngine::op_initializeKeyChar,
+		&ToucheEngine::op_setupWaitingKeyChars,
+		/* 0x50 */
+		&ToucheEngine::op_updateRoomAreas,
+		&ToucheEngine::op_unlockWalkPath,
+		0,
+		&ToucheEngine::op_addItemToInventoryAndRedraw,
+		/* 0x54 */
+		&ToucheEngine::op_giveItemTo,
+		&ToucheEngine::op_resetHitBoxes,
+		&ToucheEngine::op_fadePalette,
+		0,
+		/* 0x58 */
+		&ToucheEngine::op_disableInventoryItem,
+		0,
+		0,
+		0,
+		/* 0x5C */
+		0,
+		0,
+		0,
+		0,
+		/* 0x60 */
+		0,
+		&ToucheEngine::op_getInventoryItemFlags,
+		&ToucheEngine::op_drawInventory,
+		&ToucheEngine::op_stopKeyCharScript,
+		/* 0x64 */
+		&ToucheEngine::op_restartKeyCharScript,
+		&ToucheEngine::op_getKeyCharCurrentWalkBox,
+		&ToucheEngine::op_getKeyCharPointsDataNum,
+		&ToucheEngine::op_setupFollowingKeyChar,
+		/* 0x68 */
+		&ToucheEngine::op_startAnimation,
+		&ToucheEngine::op_setKeyCharTextColor,
+		0,
+		0,
+		/* 0x6C */
+		0,
+		0,
+		0,
+		0,
+		/* 0x70 */
+		&ToucheEngine::op_startMusic,
+		0,
+		0,
+		&ToucheEngine::op_copyPaletteColor,
+		/* 0x74 */
+		&ToucheEngine::op_delay,
+		&ToucheEngine::op_lockHitBox,
+		&ToucheEngine::op_removeItemFromInventory,
+		&ToucheEngine::op_unlockHitBox,
+		/* 0x78 */
+		&ToucheEngine::op_addRoomArea,
+		&ToucheEngine::op_setKeyCharFlags,
+		0,
+		0,
+		/* 0x7C */
+		0,
+		0,
+		0,
+		0,
+		/* 0x80 */
+		&ToucheEngine::op_unsetKeyCharFlags,
+		&ToucheEngine::op_drawSpriteOnBackdrop,
+		&ToucheEngine::op_loadVoice,
+		0,
+		/* 0x84 */
+		&ToucheEngine::op_startPaletteFadeIn,
+		&ToucheEngine::op_startPaletteFadeOut,
+		&ToucheEngine::op_setRoomAreaState
+	};
+
+	_opcodesTable = opcodesTable;
+	_numOpcodes = ARRAYSIZE(opcodesTable);
+}
+
 void ToucheEngine::op_nop() {
 	debugC(9, kDebugOpcodes, "ToucheEngine::op_nop()");
 }

Modified: scummvm/trunk/engines/touche/plugin.cpp
===================================================================
--- scummvm/trunk/engines/touche/plugin.cpp	2006-11-04 23:22:49 UTC (rev 24613)
+++ scummvm/trunk/engines/touche/plugin.cpp	2006-11-05 00:20:36 UTC (rev 24614)
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * $URL$
- * $Id: $
+ * $Id$
  *
  */
 
@@ -102,7 +102,7 @@
 			continue;
 		}
 		for (int i = 0; i < ARRAYSIZE(toucheGameVersionsTable); ++i) {
-			if (scumm_stricmp(file->name().c_str(), toucheDetectFileName) == 0) {
+			if (file->name().equalsIgnoreCase(toucheDetectFileName)) {
 				foundFile = true;
 				break;
 			}

Modified: scummvm/trunk/engines/touche/resource.cpp
===================================================================
--- scummvm/trunk/engines/touche/resource.cpp	2006-11-04 23:22:49 UTC (rev 24613)
+++ scummvm/trunk/engines/touche/resource.cpp	2006-11-05 00:20:36 UTC (rev 24614)
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * $URL$
- * $Id: $
+ * $Id$
  *
  */
 

Modified: scummvm/trunk/engines/touche/staticres.cpp
===================================================================
--- scummvm/trunk/engines/touche/staticres.cpp	2006-11-04 23:22:49 UTC (rev 24613)
+++ scummvm/trunk/engines/touche/staticres.cpp	2006-11-05 00:20:36 UTC (rev 24614)
@@ -27,182 +27,6 @@
 
 namespace Touche {
 
-void ToucheEngine::setupOpcodes() {
-	static const OpcodeProc opcodesTable[NUM_OPCODES] = {
-		/* 0x00 */
-		&ToucheEngine::op_nop,
-		&ToucheEngine::op_jnz,
-		&ToucheEngine::op_jz,
-		&ToucheEngine::op_jmp,
-		/* 0x04 */
-		&ToucheEngine::op_true,
-		&ToucheEngine::op_false,
-		&ToucheEngine::op_push,
-		&ToucheEngine::op_testFalse,
-		/* 0x08 */
-		&ToucheEngine::op_add,
-		&ToucheEngine::op_sub,
-		&ToucheEngine::op_mul,
-		&ToucheEngine::op_div,
-		/* 0x0C */
-		&ToucheEngine::op_mod,
-		&ToucheEngine::op_and,
-		&ToucheEngine::op_or,
-		&ToucheEngine::op_not,
-		/* 0x10 */
-		&ToucheEngine::op_testGreater,
-		&ToucheEngine::op_testEquals,
-		&ToucheEngine::op_testLower,
-		&ToucheEngine::op_fetchScriptWord,
-		/* 0x14 */
-		0,
-		0,
-		0,
-		0,
-		/* 0x18 */
-		&ToucheEngine::op_testGreaterOrEquals,
-		&ToucheEngine::op_testLowerOrEquals,
-		&ToucheEngine::op_testNotEquals,
-		&ToucheEngine::op_endConversation,
-		/* 0x1C */
-		&ToucheEngine::op_stopScript,
-		&ToucheEngine::op_getFlag,
-		&ToucheEngine::op_setFlag,
-		0,
-		/* 0x20 */
-		0,
-		0,
-		0,
-		&ToucheEngine::op_fetchScriptByte,
-		/* 0x24 */
-		0,
-		0,
-		0,
-		0,
-		/* 0x28 */
-		&ToucheEngine::op_getScriptValue,
-		&ToucheEngine::op_setScriptValue,
-		0,
-		0,
-		/* 0x2C */
-		0,
-		0,
-		&ToucheEngine::op_getKeyCharWalkBox,
-		&ToucheEngine::op_startSound,
-		/* 0x30 */
-		&ToucheEngine::op_initKeyCharTalk,
-		0,
-		0,
-		0,
-		/* 0x34 */
-		&ToucheEngine::op_loadRoom,
-		&ToucheEngine::op_updateRoom,
-		&ToucheEngine::op_startTalk,
-		&ToucheEngine::op_setKeyCharBox,
-		/* 0x38 */
-		&ToucheEngine::op_initKeyCharScript,
-		&ToucheEngine::op_loadSprite,
-		&ToucheEngine::op_loadSequence,
-		&ToucheEngine::op_setKeyCharFrame,
-		/* 0x3C */
-		&ToucheEngine::op_setKeyCharDirection,
-		&ToucheEngine::op_clearConversationChoices,
-		&ToucheEngine::op_addConversationChoice,
-		&ToucheEngine::op_removeConversationChoice,
-		/* 0x40 */
-		&ToucheEngine::op_getInventoryItem,
-		&ToucheEngine::op_setInventoryItem,
-		&ToucheEngine::op_startEpisode,
-		&ToucheEngine::op_setConversationNum,
-		/* 0x44 */
-		&ToucheEngine::op_enableInventoryItem,
-		&ToucheEngine::op_enableInput,
-		&ToucheEngine::op_disableInput,
-		&ToucheEngine::op_faceKeyChar,
-		/* 0x48 */
-		&ToucheEngine::op_getKeyCharCurrentAnim,
-		&ToucheEngine::op_getCurrentKeyChar,
-		&ToucheEngine::op_isKeyCharActive,
-		&ToucheEngine::op_setPalette,
-		/* 0x4C */
-		&ToucheEngine::op_changeWalkPath,
-		&ToucheEngine::op_lockWalkPath,
-		&ToucheEngine::op_initializeKeyChar,
-		&ToucheEngine::op_setupWaitingKeyChars,
-		/* 0x50 */
-		&ToucheEngine::op_updateRoomAreas,
-		&ToucheEngine::op_unlockWalkPath,
-		0,
-		&ToucheEngine::op_addItemToInventoryAndRedraw,
-		/* 0x54 */
-		&ToucheEngine::op_giveItemTo,
-		&ToucheEngine::op_resetHitBoxes,
-		&ToucheEngine::op_fadePalette,
-		0,
-		/* 0x58 */
-		&ToucheEngine::op_disableInventoryItem,
-		0,
-		0,
-		0,
-		/* 0x5C */
-		0,
-		0,
-		0,
-		0,
-		/* 0x60 */
-		0,
-		&ToucheEngine::op_getInventoryItemFlags,
-		&ToucheEngine::op_drawInventory,
-		&ToucheEngine::op_stopKeyCharScript,
-		/* 0x64 */
-		&ToucheEngine::op_restartKeyCharScript,
-		&ToucheEngine::op_getKeyCharCurrentWalkBox,
-		&ToucheEngine::op_getKeyCharPointsDataNum,
-		&ToucheEngine::op_setupFollowingKeyChar,
-		/* 0x68 */
-		&ToucheEngine::op_startAnimation,
-		&ToucheEngine::op_setKeyCharTextColor,
-		0,
-		0,
-		/* 0x6C */
-		0,
-		0,
-		0,
-		0,
-		/* 0x70 */
-		&ToucheEngine::op_startMusic,
-		0,
-		0,
-		&ToucheEngine::op_copyPaletteColor,
-		/* 0x74 */
-		&ToucheEngine::op_delay,
-		&ToucheEngine::op_lockHitBox,
-		&ToucheEngine::op_removeItemFromInventory,
-		&ToucheEngine::op_unlockHitBox,
-		/* 0x78 */
-		&ToucheEngine::op_addRoomArea,
-		&ToucheEngine::op_setKeyCharFlags,
-		0,
-		0,
-		/* 0x7C */
-		0,
-		0,
-		0,
-		0,
-		/* 0x80 */
-		&ToucheEngine::op_unsetKeyCharFlags,
-		&ToucheEngine::op_drawSpriteOnBackdrop,
-		&ToucheEngine::op_loadVoice,
-		0,
-		/* 0x84 */
-		&ToucheEngine::op_startPaletteFadeIn,
-		&ToucheEngine::op_startPaletteFadeOut,
-		&ToucheEngine::op_setRoomAreaState
-	};
-	
-	_opcodesTable = opcodesTable;
-}
-
 SpriteData ToucheEngine::_spritesTable[NUM_SPRITES] = {
 	{ 0x34BC0, 0, 0, 0, 0, 0 },
 	{ 0x1E848, 0, 0, 0, 0, 0 },

Modified: scummvm/trunk/engines/touche/touche.cpp
===================================================================
--- scummvm/trunk/engines/touche/touche.cpp	2006-11-04 23:22:49 UTC (rev 24613)
+++ scummvm/trunk/engines/touche/touche.cpp	2006-11-05 00:20:36 UTC (rev 24614)
@@ -103,7 +103,6 @@
 
 	res_deallocateTables();
 	res_closeDataFile();
-
 	return 0;
 }
 
@@ -540,7 +539,7 @@
 	debugC(9, kDebugEngine, "executeScriptOpcode(%d) offset=%04X", param, _script.dataOffset);
 	_script.keyCharNum = param;
 	_script.opcodeNum = _script.readNextByte();
-	if (_script.opcodeNum < NUM_OPCODES) {
+	if (_script.opcodeNum < _numOpcodes) {
 		OpcodeProc op = _opcodesTable[_script.opcodeNum];
 		if (op) {
 			(this->*op)();

Modified: scummvm/trunk/engines/touche/touche.h
===================================================================
--- scummvm/trunk/engines/touche/touche.h	2006-11-04 23:22:49 UTC (rev 24613)
+++ scummvm/trunk/engines/touche/touche.h	2006-11-05 00:20:36 UTC (rev 24614)
@@ -294,11 +294,15 @@
 	kScriptPaused  = 1 << 1
 };
 
+enum SaveLoadMode {
+	kSaveGameState = 0,
+	kLoadGameState
+};
+
 class ToucheEngine: public Engine {
 public:
 
 	enum {
-		NUM_OPCODES = 135,
 		NUM_FLAGS = 2000,
 		NUM_KEYCHARS = 32,
 		NUM_AREAS = 10,
@@ -454,6 +458,7 @@
 	void readGameStateDescription(int num, char *description, int len);
 	void generateGameStateFileName(int num, char *dst, int len, bool prefixOnly = false) const;
 
+	void setupOpcodes();
 	void op_nop();
 	void op_jnz();
 	void op_jz();
@@ -573,13 +578,13 @@
 	void ui_drawTalkMode();
 	void ui_drawAllBorders();
 	void ui_drawSaveGamesList(int page);
-	void ui_drawSaveLoadMenu(int page, int saveOrLoad);
+	void ui_drawSaveLoadMenu(int page, SaveLoadMode mode);
 	int ui_getButtonPressed(const Common::Rect *r, int count) const;
 	void ui_drawButtonText(const int16 *texts, const Common::Rect *r, int count, bool centerTexts);
 	void ui_drawArrow(int x, int y, int dx, uint8 color);
 	void ui_drawOptionsMenu();
 	void ui_drawCurrentGameStateDescription();
-	int ui_handleSaveLoad(int saveOrLoad);
+	int ui_handleSaveLoad(SaveLoadMode mode);
 	void ui_handleOptions(int forceDisplay);
 	void ui_drawActionsPanel(int dstX, int dstY, int deltaX, int deltaY);
 	void ui_drawConversationPanelBorder(int dstY, int srcX, int srcY);
@@ -685,6 +690,8 @@
 	AnimationEntry _animationTable[NUM_ANIMATION_ENTRIES];
 
 	Script _script;
+	const OpcodeProc *_opcodesTable;
+	int _numOpcodes;
 
 	Common::File _fData;
 	Common::File _fSpeech[2];
@@ -733,9 +740,7 @@
 	static const uint8 _directionsTable[];
 	static char _saveLoadDescriptionsTable[10][33];
 
-	const OpcodeProc *_opcodesTable;
 	const Common::Rect *_inventoryAreasTable;
-	void setupOpcodes();
 	void setupRect();
 	void setupUIRect();
 };

Modified: scummvm/trunk/engines/touche/ui.cpp
===================================================================
--- scummvm/trunk/engines/touche/ui.cpp	2006-11-04 23:22:49 UTC (rev 24613)
+++ scummvm/trunk/engines/touche/ui.cpp	2006-11-05 00:20:36 UTC (rev 24614)
@@ -72,9 +72,9 @@
 
 static const int16 optionsMenuTextsTable[] = { -52, -53, -54, -55, -90 };
 
-static const int16 saveMenuTextsTable[] = { 2000, -56, -52, 2001, 0 };
+static const int16 loadMenuTextsTable[] = { 2000, -56, -52, 2001, 0 };
 
-static const int16 loadMenuTextsTable[] = { 2000, -56, -53, 2001, 0 };
+static const int16 saveMenuTextsTable[] = { 2000, -56, -53, 2001, 0 };
 
 bool ToucheEngine::ui_processEvents() {
 	bool quit = false;
@@ -182,7 +182,7 @@
 	updateScreenArea(_offscreenBuffer, 640, r->left, r->top, r->left, r->top, r->width(), r->height());
 }
 
-void ToucheEngine::ui_drawSaveLoadMenu(int page, int saveOrLoad) {
+void ToucheEngine::ui_drawSaveLoadMenu(int page, SaveLoadMode mode) {
 	for (int i = 0; i < 10; ++i) {
 		_saveLoadDescriptionsTable[i][0] = 0;
 		const int gameState = page + i;
@@ -191,10 +191,13 @@
 		}
 	}
 	ui_drawSaveGamesList(page);
-	if (saveOrLoad == 0) {
-		ui_drawButtonText(loadMenuTextsTable, &buttonsRectTable1[10], 5, true);
-	} else {
-		ui_drawButtonText(saveMenuTextsTable, &buttonsRectTable1[10], 5, true);
+	switch (mode) {
+	case kLoadGameState:
+ 		ui_drawButtonText(loadMenuTextsTable, &buttonsRectTable1[10], 5, true);
+		break;
+	case kSaveGameState:
+ 		ui_drawButtonText(saveMenuTextsTable, &buttonsRectTable1[10], 5, true);
+		break;
 	}
 	updateScreenArea(_offscreenBuffer, 640, 90, 102, 90, 102, 460, 196);
 }
@@ -270,7 +273,7 @@
 	updateScreenArea(_offscreenBuffer, 640, 90, 102, 90, 102, 460, 196);
 }
 
-int ToucheEngine::ui_handleSaveLoad(int saveOrLoad) {
+int ToucheEngine::ui_handleSaveLoad(SaveLoadMode mode) {
 	char gameStateFileName[16];
 	generateGameStateFileName(999, gameStateFileName, 15, true);
 	_saveFileMan->listSavefiles(gameStateFileName, _saveLoadMarks, NUM_GAMESTATE_FILES);
@@ -279,7 +282,7 @@
 	while (!quitMenu) {
 		_saveLoadCurrentDescription[0] = 0;
 		_saveLoadCurrentDescriptionLen = 0;
-		ui_drawSaveLoadMenu(_saveLoadCurrentPage, saveOrLoad);
+		ui_drawSaveLoadMenu(_saveLoadCurrentPage, mode);
 		int descriptionLen = 0;
 		int button = -1;
 		while (button == -1 && !quitMenu) {
@@ -287,7 +290,7 @@
 			if (!_inp_mouseButtonClicked) {
 				button = -1;
 			}
-			if (saveOrLoad == 0) {
+			if (mode == kSaveGameState) {
 				_saveLoadCurrentPage = (_saveLoadCurrentSlot / 10) * 10;
 				if (_saveLoadCurrentDescriptionLen != descriptionLen) {
 					descriptionLen = _saveLoadCurrentDescriptionLen;
@@ -312,7 +315,7 @@
 		case 12:
 			quitMenu = true;
 			ret = 1;
-			if (saveOrLoad == 0) {
+			if (mode == kSaveGameState) {
 				if (saveGameState(_saveLoadCurrentSlot, _saveLoadDescriptionsTable[_saveLoadCurrentSlot % 10])) {
 					ret = 2;
 				}
@@ -361,12 +364,12 @@
 			_inp_mouseButtonClicked = false;
 			switch (button) {
 			case 10:
-				if (ui_handleSaveLoad(1) == 2) {
+				if (ui_handleSaveLoad(kLoadGameState) == 2) {
 					quitMenu = true;
 				}
 				break;
 			case 11:
-				if (ui_handleSaveLoad(0) == 2) {
+				if (ui_handleSaveLoad(kSaveGameState) == 2) {
 					quitMenu = true;
 				}
 				break;
@@ -420,24 +423,24 @@
 	  _menuKitData, 42, 0, 40,
 	  14, 24,
 	  Graphics::kTransparent);
-	Graphics::copyRect(_offscreenBuffer, 640, dstX, deltaY - 16 + dstY, 
-	  _menuKitData, 42, 0, 24, 
+	Graphics::copyRect(_offscreenBuffer, 640, dstX, deltaY - 16 + dstY,
+	  _menuKitData, 42, 0, 24,
 	  14, 16,
 	  Graphics::kTransparent);
 	Graphics::copyRect(_offscreenBuffer, 640, deltaX - 14 + dstX, deltaY - 16 + dstY,
-	  _menuKitData, 42, 0, 64, 
+	  _menuKitData, 42, 0, 64,
 	  14, 16,
 	  Graphics::kTransparent);
 	int x1 = deltaX - 28;
 	int x2 = dstX + 14;
 	while (x1 > 0) {
 		int w = (x1 > 14) ? 14 : x1;
-		Graphics::copyRect(_offscreenBuffer, 640, x2, dstY, 
-		  _menuKitData, 42, 0, 80, 
-		  w, 24, 
+		Graphics::copyRect(_offscreenBuffer, 640, x2, dstY,
+		  _menuKitData, 42, 0, 80,
+		  w, 24,
 		  Graphics::kTransparent);
-		Graphics::copyRect(_offscreenBuffer, 640, x2, deltaY - 16 + dstY, 
-		  _menuKitData, 42, 0, 104, 
+		Graphics::copyRect(_offscreenBuffer, 640, x2, deltaY - 16 + dstY,
+		  _menuKitData, 42, 0, 104,
 		  w, 16,
 		  Graphics::kTransparent);
 		x1 -= 14;
@@ -447,12 +450,12 @@
 	x2 = dstY + 24;
 	while (x1 > 0) {
 		int w = (x1 > 120) ? 120 : x1;
-		Graphics::copyRect(_offscreenBuffer, 640, dstX, x2, 
-		  _menuKitData, 42, 14, 0, 
-		  14, w, 
+		Graphics::copyRect(_offscreenBuffer, 640, dstX, x2,
+		  _menuKitData, 42, 14, 0,
+		  14, w,
 		  Graphics::kTransparent);
-		Graphics::copyRect(_offscreenBuffer, 640, deltaX - 14 + dstX, x2, 
-		  _menuKitData, 42, 28, 0, 
+		Graphics::copyRect(_offscreenBuffer, 640, deltaX - 14 + dstX, x2,
+		  _menuKitData, 42, 28, 0,
 		  14, w,
 		  Graphics::kTransparent);
 		x1 -= 120;
@@ -511,7 +514,7 @@
 }
 
 void ToucheEngine::ui_clearStatusString() {
-	Graphics::copyRect(_offscreenBuffer, 640, 0, 0, 
+	Graphics::copyRect(_offscreenBuffer, 640, 0, 0,
 	  _backdropBuffer, _currentBitmapWidth, _flagsTable[614], _flagsTable[615],
 	  640, 16);
 	updateScreenArea(_offscreenBuffer, 640, 0, 0, 0, 0, 640, 16);


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