aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorFilippos Karapetis2007-11-20 20:25:37 +0000
committerFilippos Karapetis2007-11-20 20:25:37 +0000
commit3cb597a0463ccdaf295a4cf65ba5b0dc50b48732 (patch)
treeb7a94c37b88ea77e7036314889a222f3e77f8a80 /engines/agi
parentc9a7cbf6ee74698a74be94f4522f427fc09a9c12 (diff)
downloadscummvm-rg350-3cb597a0463ccdaf295a4cf65ba5b0dc50b48732.tar.gz
scummvm-rg350-3cb597a0463ccdaf295a4cf65ba5b0dc50b48732.tar.bz2
scummvm-rg350-3cb597a0463ccdaf295a4cf65ba5b0dc50b48732.zip
Cleanup and simplification
svn-id: r29585
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/preagi_mickey.cpp69
-rw-r--r--engines/agi/preagi_mickey.h1
2 files changed, 14 insertions, 56 deletions
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp
index 0a11016cc9..ff135e0014 100644
--- a/engines/agi/preagi_mickey.cpp
+++ b/engines/agi/preagi_mickey.cpp
@@ -104,12 +104,8 @@ void Mickey::readOfsData(int offset, int iItem, uint8 *buffer, long buflen) {
bool Mickey::chooseY_N(int ofsPrompt, bool fErrorMsg) {
printExeStr(ofsPrompt);
- _vm->_gfx->doUpdate();
- _vm->_system->updateScreen(); // TODO: this should go in the game's main loop
-
- int a = _vm->getSelection(kSelYesNo);
for (;;) {
- switch (a) {
+ switch (_vm->getSelection(kSelYesNo)) {
case 0: return false;
case 1: return true;
default: if (fErrorMsg) {
@@ -119,25 +115,21 @@ bool Mickey::chooseY_N(int ofsPrompt, bool fErrorMsg) {
}
break;
}
- a = _vm->getSelection(kSelYesNo);
}
}
int Mickey::choose1to9(int ofsPrompt) {
+ int answer = 0;
printExeStr(ofsPrompt);
- _vm->_gfx->doUpdate();
- _vm->_system->updateScreen(); // TODO: this should go in the game's main loop
-
- int a = _vm->getSelection(kSelNumber);
for (;;) {
- if (a == 10) {
+ answer = _vm->getSelection(kSelNumber);
+ if (answer == 10) {
printExeStr(IDO_MSA_PRESS_1_TO_9);
if (_vm->getSelection(kSelAnyKey) == 0)
return 0;
printExeStr(ofsPrompt);
- } else return a;
- a = _vm->getSelection(kSelNumber);
+ } else return answer;
}
}
@@ -155,6 +147,10 @@ void Mickey::printStr(char *buffer) {
_vm->drawStr(iRow, iCol, IDA_DEFAULT, buffer + pc);
pc += strlen(buffer + pc) + 1;
}
+
+ // Show the string on screen
+ _vm->_gfx->doUpdate();
+ _vm->_system->updateScreen();
}
void Mickey::printExeStr(int ofs) {
@@ -165,8 +161,6 @@ void Mickey::printExeStr(int ofs) {
readExe(ofs, buffer, sizeof(buffer));
printStr((char *)buffer);
- _vm->_gfx->doUpdate();
- _vm->_system->updateScreen(); // TODO: this should go in the game's main loop
}
void Mickey::printExeMsg(int ofs) {
@@ -174,7 +168,7 @@ void Mickey::printExeMsg(int ofs) {
return;
printExeStr(ofs);
- waitAnyKeyAnim();
+ waitAnyKey(true);
}
void Mickey::printDatString(int iStr) {
@@ -221,8 +215,6 @@ void Mickey::printDesc(int iRoom) {
infile.close();
printStr(buffer);
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
free(buffer);
}
@@ -252,9 +244,6 @@ void Mickey::drawMenu(MSA_MENU menu, int sel0, int sel1) {
attr, (char *)menu.row[iRow].entry[iWord].szText);
}
}
-
- _vm->_gfx->doUpdate();
- _vm->_system->updateScreen(); // TODO: this should go in the game's main loop
}
void Mickey::getMouseMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow, int x, int y) {
@@ -414,8 +403,6 @@ bool Mickey::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) {
printExeMsg(IDO_MSA_HIDDEN_MSG[i]);
}
_vm->clearTextArea();
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
waitAnyKey();
}
break;
@@ -572,9 +559,7 @@ void Mickey::patchMenu(MSA_MENU *menu) {
void Mickey::printDatMessage(int iStr) {
printDatString(iStr);
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
- waitAnyKeyAnim();
+ waitAnyKey(true);
}
// Sound
@@ -924,7 +909,7 @@ void Mickey::animate() {
void Mickey::printRoomDesc() {
// print room description
printDesc(_game.iRoom);
- waitAnyKeyAnim();
+ waitAnyKey(true);
// print extended room description
if (_game.oRmTxt[_game.iRoom]) {
@@ -1026,8 +1011,6 @@ void Mickey::printStory() {
_vm->drawStr(iRow, 0, IDA_DEFAULT, szLine);
pBuf += strlen(szLine) + 1;
}
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
waitAnyKey();
_vm->clearScreen(IDA_DEFAULT);
@@ -1036,8 +1019,6 @@ void Mickey::printStory() {
_vm->drawStr(iRow, 0, IDA_DEFAULT, szLine);
pBuf += strlen(szLine) + 1;
}
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
waitAnyKey();
//Set back to black
@@ -1089,16 +1070,12 @@ void Mickey::pressOB(int iButton) {
// print pressed buttons
printExeStr(IDO_MSA_MICKEY_HAS_PRESSED);
_vm->drawStr(IDI_MSA_ROW_BUTTONS, IDI_MSA_COL_BUTTONS, IDA_DEFAULT, szButtons);
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
waitAnyKey();
}
void Mickey::insertDisk(int iDisk) {
_vm->clearTextArea();
_vm->drawStr(IDI_MSA_ROW_INSERT_DISK, IDI_MSA_COL_INSERT_DISK, IDA_DEFAULT, (const char *)IDS_MSA_INSERT_DISK[iDisk]);
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
waitAnyKey();
}
@@ -1154,8 +1131,6 @@ void Mickey::flipSwitch() {
_game.fAnimXL30 = true;
_vm->clearTextArea();
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
playSound(IDI_MSA_SND_XL30);
printExeMsg(IDO_MSA_XL30_SPEAKING);
@@ -1188,7 +1163,7 @@ void Mickey::flipSwitch() {
_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
#endif
- waitAnyKeyAnim();
+ waitAnyKey(true);
}
} else {
printStory();
@@ -1213,8 +1188,6 @@ void Mickey::inventory() {
}
}
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
waitAnyKey();
_vm->clearScreen(IDA_DEFAULT);
@@ -1531,8 +1504,6 @@ bool Mickey::parse(int cmd, int arg) {
if (_game.iRmPic[_game.iRoom] == IDI_MSA_PIC_VENUS_PROBE_1) {
_vm->clearRow(22);
}
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
waitAnyKey();
break;
case IDI_MSA_ACTION_GET_XTAL_VENUS:
@@ -1867,8 +1838,6 @@ bool Mickey::parse(int cmd, int arg) {
(const char *)IDS_MSA_TEMP_C[_game.iPlanet]);
_vm->drawStr(IDI_MSA_ROW_TEMPERATURE, IDI_MSA_COL_TEMPERATURE_F, IDA_DEFAULT,
(const char *)IDS_MSA_TEMP_F[_game.iPlanet]);
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
waitAnyKey();
break;
case IDI_MSA_ACTION_PRESS_ORANGE:
@@ -1901,9 +1870,7 @@ bool Mickey::parse(int cmd, int arg) {
printDatString(22);
_vm->drawStr(IDI_MSA_ROW_PLANET, IDI_MSA_COL_PLANET, IDA_DEFAULT,
(const char *)IDS_MSA_PLANETS[_game.iPlanet]);
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
- waitAnyKeyAnim();
+ waitAnyKey(true);
showPlanetInfo();
} else {
printDatMessage(arg);
@@ -1964,10 +1931,6 @@ bool Mickey::parse(int cmd, int arg) {
// Keyboard
-void Mickey::waitAnyKeyAnim() {
- waitAnyKey(true);
-}
-
void Mickey::waitAnyKey(bool anim) {
Common::Event event;
@@ -2010,8 +1973,6 @@ void Mickey::debug_DrawObjs() {
sprintf(szTitle, "Object %d", iObj);
_vm->drawStrMiddle(22, IDA_DEFAULT, szTitle);
_vm->drawStrMiddle(23, IDA_DEFAULT, (const char *)IDS_MSA_NAME_OBJ[iObj]);
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
waitAnyKey();
}
}
@@ -2025,8 +1986,6 @@ void Mickey::debug_DrawPics(){
_vm->clearTextArea();
sprintf(szTitle, "Picture %d", iPic);
_vm->drawStrMiddle(22, IDA_DEFAULT, szTitle);
- //_vm->_gfx->doUpdate();
- //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
waitAnyKey();
}
}
diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h
index c028f24ff6..85dcc92c16 100644
--- a/engines/agi/preagi_mickey.h
+++ b/engines/agi/preagi_mickey.h
@@ -787,7 +787,6 @@ protected:
void debug_DrawObjs();
void debug_DrawPics();
void flipSwitch();
- void waitAnyKeyAnim();
void waitAnyKey(bool anim = false);
bool planetIsAlreadyAssigned(int planet) {