aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2006-06-02 08:06:50 +0000
committerTravis Howell2006-06-02 08:06:50 +0000
commit3d1cc0f7200f83fc654d8c623c684d8dff4079f4 (patch)
tree05faced20fd51d7c1ba9f6a1ff0ba1a0c23fd86f /engines
parent9686e5a3beca94ab29f19fb76e3f25d22cad0f61 (diff)
downloadscummvm-rg350-3d1cc0f7200f83fc654d8c623c684d8dff4079f4.tar.gz
scummvm-rg350-3d1cc0f7200f83fc654d8c623c684d8dff4079f4.tar.bz2
scummvm-rg350-3d1cc0f7200f83fc654d8c623c684d8dff4079f4.zip
Cleanup
svn-id: r22829
Diffstat (limited to 'engines')
-rw-r--r--engines/simon/items.cpp4
-rw-r--r--engines/simon/saveload.cpp133
-rw-r--r--engines/simon/simon.cpp2
-rw-r--r--engines/simon/simon.h12
4 files changed, 70 insertions, 81 deletions
diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp
index a6dde7dedd..4bf8b436b8 100644
--- a/engines/simon/items.cpp
+++ b/engines/simon/items.cpp
@@ -1071,14 +1071,14 @@ void SimonEngine::o_setAdjNoun() {
void SimonEngine::o_saveUserGame() {
// 132: save game
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
- saveOrLoadDialog(false);
+ userGame(false);
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
}
void SimonEngine::o_loadUserGame() {
// 133: load game
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
- saveOrLoadDialog(true);
+ userGame(true);
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
}
diff --git a/engines/simon/saveload.cpp b/engines/simon/saveload.cpp
index f947ce3dbe..fd0a85a6d5 100644
--- a/engines/simon/saveload.cpp
+++ b/engines/simon/saveload.cpp
@@ -173,10 +173,10 @@ void SimonEngine::quickLoadOrSave() {
_saveLoadType = 0;
}
-void SimonEngine::saveGameDialog(char *buf) {
+void SimonEngine::listSaveGames(char *buf) {
int i;
- unk_132_helper_3();
+ disableFileBoxes();
i = displaySaveGameList(_saveLoadRowCurPos, _saveOrLoad, buf);
@@ -193,7 +193,7 @@ void SimonEngine::saveGameDialog(char *buf) {
return;
do {
- enableBox(0xd0 + i - 1);
+ enableBox(208 + i - 1);
} while (--i);
}
@@ -207,10 +207,10 @@ const byte hebrewKeyTable[96] = {
123, 124, 125, 126, 127,
};
-void SimonEngine::saveOrLoadDialog(bool load) {
+void SimonEngine::userGame(bool load) {
time_t save_time;
int number_of_savegames;
- int i, name_len, unk132_result;
+ int i, name_len, result;
WindowBlock *window;
char *name;
bool b;
@@ -236,11 +236,11 @@ void SimonEngine::saveOrLoadDialog(bool load) {
if (!load)
_saveLoadRowCurPos = number_of_savegames;
- _saveLoadFlag = false;
+ _saveLoadEdit = false;
restart:;
do {
- i = unk_132_helper(&b, buf);
+ i = userGameGetKey(&b, buf);
} while (!b);
if (i == 205)
@@ -248,22 +248,21 @@ restart:;
if (!load) {
// if_1
if_1:;
- unk132_result = i;
+ result = i;
disableBox(208 + i);
leaveHitAreaById(208 + i);
window = _windowArray[5];
- window->textRow = unk132_result;
+ window->textRow = result;
+ // init x offset with a 2 character savegame number + a period (18 pix)
if (_language == Common::HB_ISR) {
- // init x offset with a 2 character savegame number + a period (18 pix)
window->textColumn = 3;
window->textColumnOffset = 6;
window->textLength = 3;
} else {
- // init x offset with a 2 character savegame number + a period (18 pix)
window->textColumn = 2;
window->textColumnOffset = 2;
window->textLength = 3;
@@ -302,26 +301,25 @@ restart:;
for (;;) {
windowPutChar(window, 0x7f);
- _saveLoadFlag = true;
+ _saveLoadEdit = true;
// do_2
do {
- i = unk_132_helper(&b, buf);
+ i = userGameGetKey(&b, buf);
if (b) {
if (i == 205)
goto get_out;
- enableBox(208 + unk132_result);
- if (_saveLoadFlag) {
- clearCharacter(_windowArray[5], 8);
- // move code
+ enableBox(208 + result);
+ if (_saveLoadEdit) {
+ userGameBackSpace(_windowArray[5], 8);
}
goto if_1;
}
// is_not_b
- if (!_saveLoadFlag) {
- enableBox(208 + unk132_result);
+ if (!_saveLoadEdit) {
+ enableBox(208 + result);
goto restart;
}
} while (i >= maxChar || i == 0);
@@ -334,7 +332,7 @@ restart:;
}
// after_do_2
- clearCharacter(_windowArray[5], 8);
+ userGameBackSpace(_windowArray[5], 8);
if (i == 10 || i == 13)
break;
if (i == 8) {
@@ -353,7 +351,7 @@ restart:;
name[name_len] = 0;
- clearCharacter(_windowArray[5], x, m);
+ userGameBackSpace(_windowArray[5], x, m);
}
} else if (i >= 32 && name_len != 17) {
name[name_len++] = i;
@@ -363,7 +361,7 @@ restart:;
}
// do_save
- if (!saveGame(_saveLoadRowCurPos + unk132_result, buf + unk132_result * 18))
+ if (!saveGame(_saveLoadRowCurPos + result, buf + result * 18))
fileError(_windowArray[5], true);
} else {
if (!loadGame(_saveLoadRowCurPos + i))
@@ -371,7 +369,7 @@ restart:;
}
get_out:;
- unk_132_helper_3();
+ disableFileBoxes();
_gameStoppedClock = time(NULL) - save_time + _gameStoppedClock;
_copyPartialMode = 0;
@@ -384,72 +382,64 @@ get_out:;
} while (i == _timer4);
}
-int SimonEngine::unk_132_helper(bool *b, char *buf) {
+int SimonEngine::userGameGetKey(bool *b, char *buf) {
HitArea *ha;
*b = true;
- if (!_saveLoadFlag) {
- strange_jump:;
- _saveLoadFlag = false;
- saveGameDialog(buf);
+ if (!_saveLoadEdit) {
+ listSaveGames(buf);
}
-start_over:;
_keyPressed = 0;
-start_over_2:;
- _lastHitArea = _lastHitArea3 = 0;
+ for (;;) {
+ _lastHitArea = NULL;
+ _lastHitArea3 = NULL;
- do {
- if (_keyPressed != 0) {
- if (_saveLoadFlag) {
+ do {
+ if (_saveLoadEdit && _keyPressed != 0) {
*b = false;
return _keyPressed;
}
- goto start_over;
+ delay(10);
+ } while (_lastHitArea3 == 0);
+
+ ha = _lastHitArea;
+
+ if (ha == NULL || ha->id < 205) {
+ } else if (ha->id == 205) {
+ return ha->id;
+ } else if (ha->id == 206) {
+ if (_saveLoadRowCurPos != 1) {
+ if (_saveLoadRowCurPos < 7)
+ _saveLoadRowCurPos = 1;
+ else
+ _saveLoadRowCurPos -= 6;
+
+ _saveLoadEdit = false;
+ listSaveGames(buf);
+ }
+ } else if (ha->id == 207) {
+ if (_saveDialogFlag) {
+ _saveLoadRowCurPos += 6;
+ if (_saveLoadRowCurPos >= _numSaveGameRows)
+ _saveLoadRowCurPos = _numSaveGameRows;
+
+ _saveLoadEdit = false;
+ listSaveGames(buf);
+ }
+ } else if (ha->id < 214) {
+ return ha->id - 208;
}
- delay(10);
- } while (_lastHitArea3 == 0);
-
- ha = _lastHitArea;
-
- if (ha == NULL || ha->id < 205)
- goto start_over_2;
-
- if (ha->id == 205)
- return ha->id;
-
- if (ha->id == 206) {
- if (_saveLoadRowCurPos == 1)
- goto start_over_2;
- if (_saveLoadRowCurPos < 7)
- _saveLoadRowCurPos = 1;
- else
- _saveLoadRowCurPos -= 6;
-
- goto strange_jump;
}
-
- if (ha->id == 207) {
- if (!_saveDialogFlag)
- goto start_over_2;
- _saveLoadRowCurPos += 6;
- if (_saveLoadRowCurPos >= _numSaveGameRows)
- _saveLoadRowCurPos = _numSaveGameRows;
- goto strange_jump;
- }
-
- if (ha->id >= 214)
- goto start_over_2;
- return ha->id - 208;
}
-void SimonEngine::unk_132_helper_3() {
- for (int i = 208; i != 208 + 6; i++)
+void SimonEngine::disableFileBoxes() {
+ for (int i = 208; i != 214; i++)
disableBox(i);
}
-void SimonEngine::clearCharacter(WindowBlock *window, int x, byte b) {
+void SimonEngine::userGameBackSpace(WindowBlock *window, int x, byte b) {
byte old_text;
windowPutChar(window, x, b);
@@ -462,7 +452,6 @@ void SimonEngine::clearCharacter(WindowBlock *window, int x, byte b) {
x += 120;
if (x != 128)
x = 129;
-
}
windowPutChar(window, x);
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp
index ea8fedfc68..7f85bca332 100644
--- a/engines/simon/simon.cpp
+++ b/engines/simon/simon.cpp
@@ -364,7 +364,7 @@ SimonEngine::SimonEngine(OSystem *syst)
_numSaveGameRows = 0;
_saveDialogFlag = false;
_saveOrLoad = false;
- _saveLoadFlag = false;
+ _saveLoadEdit = false;
_hyperLink = 0;
_interactY = 0;
diff --git a/engines/simon/simon.h b/engines/simon/simon.h
index 1d1b8ba85c..ee21e77ac4 100644
--- a/engines/simon/simon.h
+++ b/engines/simon/simon.h
@@ -459,7 +459,7 @@ protected:
int _numSaveGameRows;
bool _saveDialogFlag;
bool _saveOrLoad;
- bool _saveLoadFlag;
+ bool _saveLoadEdit;
byte _saveLoadType, _saveLoadSlot;
char _saveLoadName[108];
@@ -1131,11 +1131,11 @@ protected:
void set_volume(int volume);
- void saveOrLoadDialog(bool load);
- void unk_132_helper_3();
- int unk_132_helper(bool *b, char *buf);
- void clearCharacter(WindowBlock *window, int x, byte b = 0);
- void saveGameDialog(char *buf);
+ void userGame(bool load);
+ void disableFileBoxes();
+ int userGameGetKey(bool *b, char *buf);
+ void userGameBackSpace(WindowBlock *window, int x, byte b = 0);
+ void listSaveGames(char *buf);
void fileError(WindowBlock *window, bool save_error);
int countSaveGames();