aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorGregory Montoir2006-11-05 00:20:36 +0000
committerGregory Montoir2006-11-05 00:20:36 +0000
commit6fb623284cf7453f80b1688b1fe38d97d74daff4 (patch)
treefc3e231c159eb0b7cebed4b49b5c9d8c9aed61e3 /engines
parentdb1fc75012ae1d6b2864ceae9c7900bd80d06508 (diff)
downloadscummvm-rg350-6fb623284cf7453f80b1688b1fe38d97d74daff4.tar.gz
scummvm-rg350-6fb623284cf7453f80b1688b1fe38d97d74daff4.tar.bz2
scummvm-rg350-6fb623284cf7453f80b1688b1fe38d97d74daff4.zip
cleanup
svn-id: r24614
Diffstat (limited to 'engines')
-rw-r--r--engines/touche/graphics.cpp36
-rw-r--r--engines/touche/graphics.h3
-rw-r--r--engines/touche/opcodes.cpp179
-rw-r--r--engines/touche/plugin.cpp4
-rw-r--r--engines/touche/resource.cpp2
-rw-r--r--engines/touche/staticres.cpp176
-rw-r--r--engines/touche/touche.cpp3
-rw-r--r--engines/touche/touche.h15
-rw-r--r--engines/touche/ui.cpp57
9 files changed, 232 insertions, 243 deletions
diff --git a/engines/touche/graphics.cpp b/engines/touche/graphics.cpp
index ec0c63ff79..859202103f 100644
--- a/engines/touche/graphics.cpp
+++ b/engines/touche/graphics.cpp
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
- * $Id: $
+ * $Id$
*
*/
@@ -94,32 +94,14 @@ void Graphics::fillRect(uint8 *dst, int dstPitch, int x, int y, int w, int h, ui
}
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);
-}
-
-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;
- }
- }
+ 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::drawLine(uint8 *dst, int dstPitch, int x1, int y1, int x2, int y2, uint8 color) {
diff --git a/engines/touche/graphics.h b/engines/touche/graphics.h
index a55e60c4f3..9c5bbf98fa 100644
--- a/engines/touche/graphics.h
+++ b/engines/touche/graphics.h
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
- * $Id: $
+ * $Id$
*
*/
@@ -40,7 +40,6 @@ struct Graphics {
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);
diff --git a/engines/touche/opcodes.cpp b/engines/touche/opcodes.cpp
index fc71d2835c..d5e9e76138 100644
--- a/engines/touche/opcodes.cpp
+++ b/engines/touche/opcodes.cpp
@@ -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()");
}
diff --git a/engines/touche/plugin.cpp b/engines/touche/plugin.cpp
index 47ec8d1afe..9071445455 100644
--- a/engines/touche/plugin.cpp
+++ b/engines/touche/plugin.cpp
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
- * $Id: $
+ * $Id$
*
*/
@@ -102,7 +102,7 @@ DetectedGameList Engine_TOUCHE_detectGames(const FSList &fslist) {
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;
}
diff --git a/engines/touche/resource.cpp b/engines/touche/resource.cpp
index fd6441d8ca..ef7b1612c4 100644
--- a/engines/touche/resource.cpp
+++ b/engines/touche/resource.cpp
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
- * $Id: $
+ * $Id$
*
*/
diff --git a/engines/touche/staticres.cpp b/engines/touche/staticres.cpp
index 4015ba68c3..72098efcd5 100644
--- a/engines/touche/staticres.cpp
+++ b/engines/touche/staticres.cpp
@@ -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 },
diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp
index 721a2febc2..9d564bca6d 100644
--- a/engines/touche/touche.cpp
+++ b/engines/touche/touche.cpp
@@ -103,7 +103,6 @@ int ToucheEngine::go() {
res_deallocateTables();
res_closeDataFile();
-
return 0;
}
@@ -540,7 +539,7 @@ void ToucheEngine::executeScriptOpcode(int16 param) {
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)();
diff --git a/engines/touche/touche.h b/engines/touche/touche.h
index c2076f68a2..61f38b52ab 100644
--- a/engines/touche/touche.h
+++ b/engines/touche/touche.h
@@ -294,11 +294,15 @@ enum ScriptFlag {
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 @@ protected:
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 @@ protected:
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 @@ protected:
AnimationEntry _animationTable[NUM_ANIMATION_ENTRIES];
Script _script;
+ const OpcodeProc *_opcodesTable;
+ int _numOpcodes;
Common::File _fData;
Common::File _fSpeech[2];
@@ -733,9 +740,7 @@ protected:
static const uint8 _directionsTable[];
static char _saveLoadDescriptionsTable[10][33];
- const OpcodeProc *_opcodesTable;
const Common::Rect *_inventoryAreasTable;
- void setupOpcodes();
void setupRect();
void setupUIRect();
};
diff --git a/engines/touche/ui.cpp b/engines/touche/ui.cpp
index c95fb87631..d41663b864 100644
--- a/engines/touche/ui.cpp
+++ b/engines/touche/ui.cpp
@@ -72,9 +72,9 @@ static int16 settingsMenuTextsTable[] = { 0, 0, 0, -92, -93, -94, -87, -88, 0, -
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 @@ void ToucheEngine::ui_drawCurrentGameStateDescription() {
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 @@ void ToucheEngine::ui_drawSaveLoadMenu(int page, int saveOrLoad) {
}
}
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 @@ void ToucheEngine::ui_drawOptionsMenu() {
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 @@ int ToucheEngine::ui_handleSaveLoad(int saveOrLoad) {
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 @@ int ToucheEngine::ui_handleSaveLoad(int saveOrLoad) {
if (!_inp_mouseButtonClicked) {
button = -1;
}
- if (saveOrLoad == 0) {
+ if (mode == kSaveGameState) {
_saveLoadCurrentPage = (_saveLoadCurrentSlot / 10) * 10;
if (_saveLoadCurrentDescriptionLen != descriptionLen) {
descriptionLen = _saveLoadCurrentDescriptionLen;
@@ -312,7 +315,7 @@ int ToucheEngine::ui_handleSaveLoad(int saveOrLoad) {
case 12:
quitMenu = true;
ret = 1;
- if (saveOrLoad == 0) {
+ if (mode == kSaveGameState) {
if (saveGameState(_saveLoadCurrentSlot, _saveLoadDescriptionsTable[_saveLoadCurrentSlot % 10])) {
ret = 2;
}
@@ -361,12 +364,12 @@ void ToucheEngine::ui_handleOptions(int forceDisplay) {
_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 @@ void ToucheEngine::ui_drawActionsPanel(int dstX, int dstY, int deltaX, int delta
_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 @@ void ToucheEngine::ui_drawActionsPanel(int dstX, int dstY, int deltaX, int delta
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_printStatusString(const char *str) {
}
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);