aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2016-01-31 17:56:53 +0100
committerMartin Kiewitz2016-01-31 17:56:53 +0100
commit4bc01ab7d585f6be9d25a96ce9544b95f459d7e6 (patch)
tree61ec416cb1bb767838a3516825a209018ec12619
parent82b958f274affa9d67de0ac2f8cfaa1756405dfb (diff)
downloadscummvm-rg350-4bc01ab7d585f6be9d25a96ce9544b95f459d7e6.tar.gz
scummvm-rg350-4bc01ab7d585f6be9d25a96ce9544b95f459d7e6.tar.bz2
scummvm-rg350-4bc01ab7d585f6be9d25a96ce9544b95f459d7e6.zip
AGI: getflag/setflag/etc. cleanup
renamed getflag() to getFlag() renamed setflag() to setFlag() renamed flipflag() to flipFlag() preagi: renamed setFlag for this engine to setWinnieFlag
-rw-r--r--engines/agi/agi.h6
-rw-r--r--engines/agi/checks.cpp4
-rw-r--r--engines/agi/console.cpp10
-rw-r--r--engines/agi/cycle.cpp32
-rw-r--r--engines/agi/detection.cpp4
-rw-r--r--engines/agi/global.cpp28
-rw-r--r--engines/agi/inv.cpp2
-rw-r--r--engines/agi/keyboard.cpp2
-rw-r--r--engines/agi/motion.cpp6
-rw-r--r--engines/agi/op_cmd.cpp62
-rw-r--r--engines/agi/op_test.cpp14
-rw-r--r--engines/agi/preagi_mickey.cpp6
-rw-r--r--engines/agi/preagi_winnie.cpp12
-rw-r--r--engines/agi/preagi_winnie.h4
-rw-r--r--engines/agi/saveload.cpp5
-rw-r--r--engines/agi/sound.cpp6
-rw-r--r--engines/agi/sound_pcjr.cpp2
-rw-r--r--engines/agi/sound_sarien.cpp2
-rw-r--r--engines/agi/sprite.cpp2
-rw-r--r--engines/agi/text.cpp8
-rw-r--r--engines/agi/view.cpp4
-rw-r--r--engines/agi/words.cpp6
22 files changed, 116 insertions, 111 deletions
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 697cf66717..5119ccd046 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -685,9 +685,9 @@ public:
int _soundemu;
- int getflag(int);
- void setflag(int, int);
- void flipflag(int);
+ int getFlag(int16 flagNr);
+ void setFlag(int16 flagNr, bool newState);
+ void flipFlag(int16 flagNr);
const AGIGameDescription *_gameDescription;
diff --git a/engines/agi/checks.cpp b/engines/agi/checks.cpp
index 2ad0dbdd2d..a3698c34ea 100644
--- a/engines/agi/checks.cpp
+++ b/engines/agi/checks.cpp
@@ -163,8 +163,8 @@ bool AgiEngine::checkPriority(ScreenObjEntry *screenObj) {
// Check ego
if (screenObj->objectNr == 0) {
- setflag(VM_FLAG_EGO_TOUCHED_P2, touchedTrigger ? true : false);
- setflag(VM_FLAG_EGO_WATER, touchedWater ? true : false);
+ setFlag(VM_FLAG_EGO_TOUCHED_P2, touchedTrigger ? true : false);
+ setFlag(VM_FLAG_EGO_WATER, touchedWater ? true : false);
}
return touchedControl;
diff --git a/engines/agi/console.cpp b/engines/agi/console.cpp
index 39719a4fde..0e2101ce43 100644
--- a/engines/agi/console.cpp
+++ b/engines/agi/console.cpp
@@ -75,7 +75,7 @@ bool Console::Cmd_SetFlag(int argc, const char **argv) {
}
int p1 = (int)atoi(argv[1]);
int p2 = (int)atoi(argv[2]);
- _vm->setflag(p1, !!p2);
+ _vm->setFlag(p1, !!p2);
return true;
}
@@ -290,7 +290,7 @@ bool Console::Cmd_Flags(int argc, const char **argv) {
for (i = 0; i < 255;) {
debugPrintf("%3d ", i);
for (j = 0; j < 10; j++, i++) {
- debugPrintf("%c ", _vm->getflag(i) ? 'T' : 'F');
+ debugPrintf("%c ", _vm->getFlag(i) ? 'T' : 'F');
}
debugPrintf("\n");
}
@@ -542,7 +542,7 @@ bool Console::Cmd_VmFlags(int argc, const char **argv) {
if (argc < 3) {
// show contents
- if (_vm->getflag(flagNr)) {
+ if (_vm->getFlag(flagNr)) {
debugPrintf("flag %d == set\n", flagNr);
} else {
debugPrintf("flag %d == not set\n", flagNr);
@@ -557,10 +557,10 @@ bool Console::Cmd_VmFlags(int argc, const char **argv) {
}
if (!newFlagState) {
- _vm->setflag(flagNr, 0);
+ _vm->setFlag(flagNr, false);
debugPrintf("flag %d reset.\n", flagNr);
} else {
- _vm->setflag(flagNr, 1);
+ _vm->setFlag(flagNr, true);
debugPrintf("flag %d set.\n", flagNr);
}
}
diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index a2b9d00a68..e58d018b1b 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -109,7 +109,7 @@ void AgiEngine::newRoom(int16 newRoomNr) {
}
setVar(VM_VAR_BORDER_TOUCH_EGO, 0);
- setflag(VM_FLAG_NEW_ROOM_EXEC, true);
+ setFlag(VM_FLAG_NEW_ROOM_EXEC, true);
_game.exitAllLogics = true;
@@ -138,7 +138,7 @@ void AgiEngine::interpretCycle() {
checkAllMotions();
oldScore = getVar(VM_VAR_SCORE);
- oldSound = getflag(VM_FLAG_SOUND_ON);
+ oldSound = getFlag(VM_FLAG_SOUND_ON);
_game.exitAllLogics = false;
while (runLogic(0) == 0 && !(shouldQuit() || _restartGame)) {
@@ -146,7 +146,7 @@ void AgiEngine::interpretCycle() {
setVar(VM_VAR_BORDER_TOUCH_OBJECT, 0);
setVar(VM_VAR_BORDER_CODE, 0);
oldScore = getVar(VM_VAR_SCORE);
- setflag(VM_FLAG_ENTERED_CLI, false);
+ setFlag(VM_FLAG_ENTERED_CLI, false);
_game.exitAllLogics = false;
nonBlockingText_CycleDone();
resetControllers();
@@ -156,14 +156,14 @@ void AgiEngine::interpretCycle() {
screenObjEgo->direction = getVar(VM_VAR_EGO_DIRECTION);
- if (getVar(VM_VAR_SCORE) != oldScore || getflag(VM_FLAG_SOUND_ON) != oldSound)
+ if (getVar(VM_VAR_SCORE) != oldScore || getFlag(VM_FLAG_SOUND_ON) != oldSound)
_game._vm->_text->statusDraw();
setVar(VM_VAR_BORDER_TOUCH_OBJECT, 0);
setVar(VM_VAR_BORDER_CODE, 0);
- setflag(VM_FLAG_NEW_ROOM_EXEC, false);
- setflag(VM_FLAG_RESTART_GAME, false);
- setflag(VM_FLAG_RESTORE_JUST_RAN, false);
+ setFlag(VM_FLAG_NEW_ROOM_EXEC, false);
+ setFlag(VM_FLAG_RESTART_GAME, false);
+ setFlag(VM_FLAG_RESTORE_JUST_RAN, false);
if (_game.gfxMode) {
updateScreenObjTable();
@@ -361,9 +361,9 @@ int AgiEngine::playGame() {
_game.horizon = 36;
_game.playerControl = false;
- setflag(VM_FLAG_LOGIC_ZERO_FIRST_TIME, true); // not in 2.917
- setflag(VM_FLAG_NEW_ROOM_EXEC, true); // needed for MUMG and SQ2!
- setflag(VM_FLAG_SOUND_ON, true); // enable sound
+ setFlag(VM_FLAG_LOGIC_ZERO_FIRST_TIME, true); // not in 2.917
+ setFlag(VM_FLAG_NEW_ROOM_EXEC, true); // needed for MUMG and SQ2!
+ setFlag(VM_FLAG_SOUND_ON, true); // enable sound
setVar(VM_VAR_TIME_DELAY, 2); // "normal" speed
_game.gfxMode = true;
@@ -379,13 +379,13 @@ int AgiEngine::playGame() {
debug(0, "Running AGI script.\n");
- setflag(VM_FLAG_ENTERED_CLI, false);
- setflag(VM_FLAG_SAID_ACCEPTED_INPUT, false);
+ setFlag(VM_FLAG_ENTERED_CLI, false);
+ setFlag(VM_FLAG_SAID_ACCEPTED_INPUT, false);
setVar(VM_VAR_WORD_NOT_FOUND, 0);
setVar(VM_VAR_KEY, 0);
debugC(2, kDebugLevelMain, "Entering main loop");
- bool firstLoop = !getflag(VM_FLAG_RESTART_GAME); // Do not restore on game restart
+ bool firstLoop = !getFlag(VM_FLAG_RESTART_GAME); // Do not restore on game restart
if (firstLoop) {
if (ConfMan.hasKey("save_slot")) {
@@ -419,8 +419,8 @@ int AgiEngine::playGame() {
checkQuickLoad();
}
- setflag(VM_FLAG_ENTERED_CLI, false);
- setflag(VM_FLAG_SAID_ACCEPTED_INPUT, false);
+ setFlag(VM_FLAG_ENTERED_CLI, false);
+ setFlag(VM_FLAG_SAID_ACCEPTED_INPUT, false);
setVar(VM_VAR_WORD_NOT_FOUND, 0);
setVar(VM_VAR_KEY, 0);
}
@@ -465,7 +465,7 @@ int AgiEngine::runGame() {
break;
if (_restartGame) {
- setflag(VM_FLAG_RESTART_GAME, true);
+ setFlag(VM_FLAG_RESTART_GAME, true);
setVar(VM_VAR_TIME_DELAY, 2); // "normal" speed
_restartGame = false;
}
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 641fe55a47..17e1eefcf3 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -571,7 +571,7 @@ namespace Agi {
bool AgiBase::canLoadGameStateCurrently() {
if (!(getGameType() == GType_PreAGI)) {
- if (getflag(VM_FLAG_MENUS_WORK)) {
+ if (getFlag(VM_FLAG_MENUS_WORK)) {
if (!_noSaveLoadAllowed) {
if (!cycleInnerLoopIsActive()) {
// We can't allow to restore a game, while inner loop is active
@@ -592,7 +592,7 @@ bool AgiBase::canSaveGameStateCurrently() {
return true;
if (!(getGameType() == GType_PreAGI)) {
- if (getflag(VM_FLAG_MENUS_WORK)) {
+ if (getFlag(VM_FLAG_MENUS_WORK)) {
if (!_noSaveLoadAllowed) {
if (!cycleInnerLoopIsActive()) {
if (promptIsEnabled()) {
diff --git a/engines/agi/global.cpp b/engines/agi/global.cpp
index bf6356dbcd..4cf6c3d12b 100644
--- a/engines/agi/global.cpp
+++ b/engines/agi/global.cpp
@@ -24,28 +24,28 @@
namespace Agi {
-int AgiBase::getflag(int n) {
- uint8 *set = (uint8 *)&_game.flags;
+int AgiBase::getFlag(int16 flagNr) {
+ uint8 *flagPtr = _game.flags;
- set += n >> 3;
- return (*set & (1 << (n & 0x07))) != 0;
+ flagPtr += flagNr >> 3;
+ return (*flagPtr & (1 << (flagNr & 0x07))) != 0;
}
-void AgiBase::setflag(int n, int v) {
- uint8 *set = (uint8 *)&_game.flags;
+void AgiBase::setFlag(int16 flagNr, bool newState) {
+ uint8 *flagPtr = _game.flags;
- set += n >> 3;
- if (v)
- *set |= 1 << (n & 0x07); // set bit
+ flagPtr += flagNr >> 3;
+ if (newState)
+ *flagPtr |= 1 << (flagNr & 0x07); // set bit
else
- *set &= ~(1 << (n & 0x07)); // clear bit
+ *flagPtr &= ~(1 << (flagNr & 0x07)); // clear bit
}
-void AgiBase::flipflag(int n) {
- uint8 *set = (uint8 *)&_game.flags;
+void AgiBase::flipFlag(int16 flagNr) {
+ uint8 *flagPtr = _game.flags;
- set += n >> 3;
- *set ^= 1 << (n & 0x07); // flip bit
+ flagPtr += flagNr >> 3;
+ *flagPtr ^= 1 << (flagNr & 0x07); // flip bit
}
void AgiEngine::setVar(int16 varNr, int val) {
diff --git a/engines/agi/inv.cpp b/engines/agi/inv.cpp
index 614b016463..38e5e11e0c 100644
--- a/engines/agi/inv.cpp
+++ b/engines/agi/inv.cpp
@@ -127,7 +127,7 @@ void InventoryMgr::show() {
// figure out current inventory of the player
getPlayerInventory();
- if (_vm->getflag(VM_FLAG_STATUS_SELECTS_ITEMS)) {
+ if (_vm->getFlag(VM_FLAG_STATUS_SELECTS_ITEMS)) {
selectItems = true;
} else{
_activeItemNr = -1; // so that none is shown as active
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp
index 0d5efb667b..81de225e71 100644
--- a/engines/agi/keyboard.cpp
+++ b/engines/agi/keyboard.cpp
@@ -540,7 +540,7 @@ int AgiEngine::waitKey() {
clearKeyQueue();
debugC(3, kDebugLevelInput, "waiting...");
- while (!(shouldQuit() || _restartGame || getflag(VM_FLAG_RESTORE_JUST_RAN))) {
+ while (!(shouldQuit() || _restartGame || getFlag(VM_FLAG_RESTORE_JUST_RAN))) {
pollTimer();
key = doPollKeyboard();
if (key == AGI_KEY_ENTER || key == AGI_KEY_ESCAPE || key == AGI_MOUSE_BUTTON_LEFT)
diff --git a/engines/agi/motion.cpp b/engines/agi/motion.cpp
index 76f0f91f51..ad6f6cb6b7 100644
--- a/engines/agi/motion.cpp
+++ b/engines/agi/motion.cpp
@@ -98,7 +98,7 @@ void AgiEngine::motionFollowEgo(ScreenObjEntry *screenObj) {
if (dir == 0) {
screenObj->direction = 0;
screenObj->motionType = kMotionNormal;
- setflag(screenObj->follow_flag, true);
+ setFlag(screenObj->follow_flag, true);
return;
}
@@ -200,7 +200,7 @@ void AgiEngine::checkAllMotions() {
void AgiEngine::inDestination(ScreenObjEntry *screenObj) {
if (screenObj->motionType == kMotionMoveObj) {
screenObj->stepSize = screenObj->move_stepSize;
- setflag(screenObj->move_flag, true);
+ setFlag(screenObj->move_flag, true);
}
screenObj->motionType = kMotionNormal;
if (isEgoView(screenObj))
@@ -213,7 +213,7 @@ void AgiEngine::motionMoveObjStop(ScreenObjEntry *screenObj) {
// This check for motionType was only done in AGI3.
// But we use this motion type for mouse movement, so we need to check in any case, otherwise it will cause glitches.
if (screenObj->motionType != kMotionEgo) {
- setflag(screenObj->move_flag, true);
+ setFlag(screenObj->move_flag, true);
}
screenObj->motionType = kMotionNormal;
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index ec2408229b..57a6d6833d 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -223,22 +223,22 @@ void cmdSet(AgiGame *state, uint8 *parameter) {
AgiEngine *vm = state->_vm;
uint16 flagNr = parameter[0];
- vm->setflag(flagNr, true);
+ vm->setFlag(flagNr, true);
}
void cmdReset(AgiGame *state, uint8 *parameter) {
AgiEngine *vm = state->_vm;
uint16 flagNr = parameter[0];
- vm->setflag(flagNr, false);
+ vm->setFlag(flagNr, false);
}
void cmdToggle(AgiGame *state, uint8 *parameter) {
AgiEngine *vm = state->_vm;
uint16 flagNr = parameter[0];
- bool curFlagState = vm->getflag(flagNr);
+ bool curFlagState = vm->getFlag(flagNr);
- vm->setflag(flagNr, !curFlagState);
+ vm->setFlag(flagNr, !curFlagState);
}
void cmdSetV(AgiGame *state, uint8 *parameter) {
@@ -250,7 +250,7 @@ void cmdSetV(AgiGame *state, uint8 *parameter) {
} else {
flagNr = vm->getVar(flagNr);
- vm->setflag(flagNr, true);
+ vm->setFlag(flagNr, true);
}
}
@@ -263,7 +263,7 @@ void cmdResetV(AgiGame *state, uint8 *parameter) {
} else {
flagNr = vm->getVar(flagNr);
- vm->setflag(flagNr, false);
+ vm->setFlag(flagNr, false);
}
}
@@ -276,9 +276,9 @@ void cmdToggleV(AgiGame *state, uint8 *parameter) {
vm->setVar(flagNr, value ^ 1);
} else {
flagNr = vm->getVar(flagNr);
- bool curFlagState = vm->getflag(flagNr);
+ bool curFlagState = vm->getFlag(flagNr);
- vm->setflag(flagNr, !curFlagState);
+ vm->setFlag(flagNr, !curFlagState);
}
}
@@ -781,7 +781,7 @@ void cmdStopSound(AgiGame *state, uint8 *parameter) {
void cmdMenuInput(AgiGame *state, uint8 *parameter) {
AgiEngine *vm = state->_vm;
- if (vm->getflag(VM_FLAG_MENUS_WORK)) {
+ if (vm->getFlag(VM_FLAG_MENUS_WORK)) {
vm->_menu->delayedExecute();
}
}
@@ -964,21 +964,21 @@ void cmdSetSimple(AgiGame *state, uint8 *parameter) {
uint16 resourceNr = vm->getVar(varNr);
spritesMgr->eraseSprites();
- state->_vm->agiLoadResource(RESOURCETYPE_PICTURE, resourceNr);
+ vm->agiLoadResource(RESOURCETYPE_PICTURE, resourceNr);
// Draw the picture. Similar to void cmdDraw_pic(AgiGame *state, uint8 *p).
- state->_vm->_picture->decodePicture(resourceNr, false, true);
+ vm->_picture->decodePicture(resourceNr, false, true);
spritesMgr->drawAllSpriteLists();
state->pictureShown = false;
// Show the picture. Similar to void cmdShow_pic(AgiGame *state, uint8 *p).
- state->_vm->setflag(VM_FLAG_OUTPUT_MODE, false);
- state->_vm->_text->closeWindow();
- state->_vm->_picture->showPic();
+ vm->setFlag(VM_FLAG_OUTPUT_MODE, false);
+ vm->_text->closeWindow();
+ vm->_picture->showPic();
state->pictureShown = true;
// Loading trigger
- state->_vm->loadingTrigger_DrawPicture();
+ vm->loadingTrigger_DrawPicture();
}
}
@@ -1093,8 +1093,8 @@ void cmdParse(AgiGame *state, uint8 *parameter) {
uint16 stringNr = parameter[0];
vm->setVar(VM_VAR_WORD_NOT_FOUND, 0);
- vm->setflag(VM_FLAG_ENTERED_CLI, false);
- vm->setflag(VM_FLAG_SAID_ACCEPTED_INPUT, false);
+ vm->setFlag(VM_FLAG_ENTERED_CLI, false);
+ vm->setFlag(VM_FLAG_SAID_ACCEPTED_INPUT, false);
vm->_words->parseUsingDictionary(text->stringPrintf(state->strings[stringNr]));
}
@@ -1167,7 +1167,7 @@ void cmdDrawPic(AgiGame *state, uint8 *parameter) {
// that this is a script bug and occurs in the original interpreter as well.
// Fixes bug #3056: AGI: SQ1 (2.2 DOS ENG) bizzare exploding roger
if (getGameID() == GID_SQ1 && resourceNr == 20)
- vm->setflag(103, false);
+ vm->setFlag(103, false);
// Loading trigger
vm->loadingTrigger_DrawPicture();
@@ -1177,7 +1177,7 @@ void cmdShowPic(AgiGame *state, uint8 *parameter) {
AgiEngine *vm = state->_vm;
debugC(6, kDebugLevelScripts, "=== show pic ===");
- vm->setflag(VM_FLAG_OUTPUT_MODE, false);
+ vm->setFlag(VM_FLAG_OUTPUT_MODE, false);
vm->_text->closeWindow();
vm->_picture->showPicWithTransition();
state->pictureShown = true;
@@ -1506,7 +1506,7 @@ void cmdReverseLoop(AgiGame *state, uint8 *parameter) {
screenObj->cycle = kCycleRevLoop;
screenObj->flags |= (fDontupdate | fUpdate | fCycling);
screenObj->loop_flag = loopFlag;
- state->_vm->setflag(screenObj->loop_flag, false);
+ state->_vm->setFlag(screenObj->loop_flag, false);
}
void cmdReverseLoopV1(AgiGame *state, uint8 *parameter) {
@@ -1523,6 +1523,7 @@ void cmdReverseLoopV1(AgiGame *state, uint8 *parameter) {
}
void cmdEndOfLoop(AgiGame *state, uint8 *parameter) {
+ AgiEngine *vm = state->_vm;
uint16 objectNr = parameter[0];
uint16 loopFlag = parameter[1];
ScreenObjEntry *screenObj = &state->screenObjTable[objectNr];
@@ -1531,7 +1532,7 @@ void cmdEndOfLoop(AgiGame *state, uint8 *parameter) {
screenObj->cycle = kCycleEndOfLoop;
screenObj->flags |= (fDontupdate | fUpdate | fCycling);
screenObj->loop_flag = loopFlag;
- state->_vm->setflag(screenObj->loop_flag, false);
+ vm->setFlag(screenObj->loop_flag, false);
}
void cmdEndOfLoopV1(AgiGame *state, uint8 *parameter) {
@@ -1642,7 +1643,7 @@ void cmdFollowEgo(AgiGame *state, uint8 *parameter) {
vm->setVar(screenObj->follow_flag, 0);
screenObj->flags |= fUpdate | fAnimated;
} else {
- state->_vm->setflag(screenObj->follow_flag, false);
+ vm->setFlag(screenObj->follow_flag, false);
screenObj->flags |= fUpdate;
}
}
@@ -1670,7 +1671,7 @@ void cmdMoveObj(AgiGame *state, uint8 *parameter) {
vm->setVar(moveFlag, 0);
screenObj->flags |= fUpdate | fAnimated;
} else {
- vm->setflag(screenObj->move_flag, false);
+ vm->setFlag(screenObj->move_flag, false);
screenObj->flags |= fUpdate;
}
@@ -1700,7 +1701,7 @@ void cmdMoveObjF(AgiGame *state, uint8 *parameter) {
if (stepSize != 0)
screenObj->stepSize = stepSize;
- state->_vm->setflag(screenObj->move_flag, false);
+ vm->setFlag(screenObj->move_flag, false);
screenObj->flags |= fUpdate;
if (objectNr == 0)
@@ -1708,7 +1709,7 @@ void cmdMoveObjF(AgiGame *state, uint8 *parameter) {
// AGI 2.272 (ddp, xmas) doesn't call move_obj!
if (getVersion() > 0x2272)
- state->_vm->moveObj(screenObj);
+ vm->moveObj(screenObj);
}
void cmdWander(AgiGame *state, uint8 *parameter) {
@@ -1899,20 +1900,21 @@ void cmdQuitV1(AgiGame *state, uint8 *parameter) {
}
void cmdRestartGame(AgiGame *state, uint8 *parameter) {
+ AgiEngine *vm = state->_vm;
bool doRestart = false;
state->_vm->_sound->stopSound();
- if (state->_vm->getflag(VM_FLAG_AUTO_RESTART)) {
+ if (vm->getFlag(VM_FLAG_AUTO_RESTART)) {
doRestart = true;
} else {
- doRestart = state->_vm->_systemUI->restartDialog();
+ doRestart = vm->_systemUI->restartDialog();
}
if (doRestart) {
- state->_vm->_restartGame = true;
- state->_vm->setflag(VM_FLAG_RESTART_GAME, true);
- state->_vm->_menu->itemEnableAll();
+ vm->_restartGame = true;
+ vm->setFlag(VM_FLAG_RESTART_GAME, true);
+ vm->_menu->itemEnableAll();
}
}
diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp
index 701bbcd59c..c461dfc4c4 100644
--- a/engines/agi/op_test.cpp
+++ b/engines/agi/op_test.cpp
@@ -78,11 +78,11 @@ void condGreaterV(AgiGame *state, uint8 *p) {
}
void condIsSet(AgiGame *state, uint8 *p) {
- state->testResult = state->_vm->getflag(p[0]);
+ state->testResult = state->_vm->getFlag(p[0]);
}
void condIsSetV(AgiGame *state, uint8 *p) {
- state->testResult = state->_vm->getflag(getVar(p[0]));
+ state->testResult = state->_vm->getFlag(getVar(p[0]));
}
void condIsSetV1(AgiGame *state, uint8 *p) {
@@ -121,7 +121,7 @@ void condSaid(AgiGame *state, uint8 *p) {
void condSaid1(AgiGame *state, uint8 *p) {
state->testResult = false;
- if (!state->_vm->getflag(VM_FLAG_ENTERED_CLI))
+ if (!state->_vm->getFlag(VM_FLAG_ENTERED_CLI))
return;
int id0 = READ_LE_UINT16(p);
@@ -133,7 +133,7 @@ void condSaid1(AgiGame *state, uint8 *p) {
void condSaid2(AgiGame *state, uint8 *p) {
state->testResult = false;
- if (!state->_vm->getflag(VM_FLAG_ENTERED_CLI))
+ if (!state->_vm->getFlag(VM_FLAG_ENTERED_CLI))
return;
int id0 = READ_LE_UINT16(p);
@@ -147,7 +147,7 @@ void condSaid2(AgiGame *state, uint8 *p) {
void condSaid3(AgiGame *state, uint8 *p) {
state->testResult = false;
- if (!state->_vm->getflag(VM_FLAG_ENTERED_CLI))
+ if (!state->_vm->getFlag(VM_FLAG_ENTERED_CLI))
return;
int id0 = READ_LE_UINT16(p);
@@ -320,7 +320,7 @@ uint8 AgiEngine::testSaid(uint8 nwords, uint8 *cc) {
int c, n = words->getEgoWordCount();
int z = 0;
- if (vm->getflag(VM_FLAG_SAID_ACCEPTED_INPUT) || !vm->getflag(VM_FLAG_ENTERED_CLI))
+ if (vm->getFlag(VM_FLAG_SAID_ACCEPTED_INPUT) || !vm->getFlag(VM_FLAG_ENTERED_CLI))
return false;
// FR:
@@ -366,7 +366,7 @@ uint8 AgiEngine::testSaid(uint8 nwords, uint8 *cc) {
if (nwords != 0 && READ_LE_UINT16(cc) != 9999)
return false;
- setflag(VM_FLAG_SAID_ACCEPTED_INPUT, true);
+ setFlag(VM_FLAG_SAID_ACCEPTED_INPUT, true);
return true;
}
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp
index ad1bddff02..cc5c1f807e 100644
--- a/engines/agi/preagi_mickey.cpp
+++ b/engines/agi/preagi_mickey.cpp
@@ -492,7 +492,7 @@ bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow)
return false;
case Common::KEYCODE_s:
- flipflag(VM_FLAG_SOUND_ON);
+ flipFlag(VM_FLAG_SOUND_ON);
break;
case Common::KEYCODE_c:
inventory();
@@ -672,7 +672,7 @@ void MickeyEngine::playNote(MSA_SND_NOTE note) {
}
void MickeyEngine::playSound(ENUM_MSA_SOUND iSound) {
- if (!getflag(VM_FLAG_SOUND_ON))
+ if (!getFlag(VM_FLAG_SOUND_ON))
return;
Common::Event event;
@@ -2297,7 +2297,7 @@ void MickeyEngine::init() {
#endif
- setflag(VM_FLAG_SOUND_ON, true); // enable sound
+ setFlag(VM_FLAG_SOUND_ON, true); // enable sound
}
Common::Error MickeyEngine::go() {
diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp
index 596f417140..5285976884 100644
--- a/engines/agi/preagi_winnie.cpp
+++ b/engines/agi/preagi_winnie.cpp
@@ -226,11 +226,11 @@ void WinnieEngine::setTakeDrop(int fCanSel[]) {
fCanSel[IDI_WTP_SEL_DROP] = _gameStateWinnie.iObjHave;
}
-void WinnieEngine::setFlag(int iFlag) {
+void WinnieEngine::setWinnieFlag(int iFlag) {
_gameStateWinnie.fGame[iFlag] = 1;
}
-void WinnieEngine::clearFlag(int iFlag) {
+void WinnieEngine::clearWinnieFlag(int iFlag) {
_gameStateWinnie.fGame[iFlag] = 0;
}
@@ -404,11 +404,11 @@ int WinnieEngine::parser(int pc, int index, uint8 *buffer) {
break;
case IDO_WTP_FLAG_CLEAR:
opcode = *(buffer + pc++);
- clearFlag(opcode);
+ clearWinnieFlag(opcode);
break;
case IDO_WTP_FLAG_SET:
opcode = *(buffer + pc++);
- setFlag(opcode);
+ setWinnieFlag(opcode);
break;
case IDO_WTP_GAME_OVER:
gameOver();
@@ -947,7 +947,7 @@ void WinnieEngine::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
break;
case Common::KEYCODE_s:
if (event.kbd.flags & Common::KBD_CTRL) {
- flipflag(VM_FLAG_SOUND_ON);
+ flipFlag(VM_FLAG_SOUND_ON);
} else {
*iSel = IDI_WTP_SEL_SOUTH;
makeSel(iSel, fCanSel);
@@ -1342,7 +1342,7 @@ void WinnieEngine::init() {
}
_sound = new SoundMgr(this, _mixer);
- setflag(VM_FLAG_SOUND_ON, true); // enable sound
+ setFlag(VM_FLAG_SOUND_ON, true); // enable sound
memset(&_gameStateWinnie, 0, sizeof(_gameStateWinnie));
_gameStateWinnie.fSound = 1;
diff --git a/engines/agi/preagi_winnie.h b/engines/agi/preagi_winnie.h
index b5e8b8d10b..f05cabaf2d 100644
--- a/engines/agi/preagi_winnie.h
+++ b/engines/agi/preagi_winnie.h
@@ -336,8 +336,8 @@ private:
bool isRightObj(int, int, int*);
void drawObjPic(int, int, int);
void getMenuMouseSel(int*, int[], int, int);
- void setFlag(int);
- void clearFlag(int);
+ void setWinnieFlag(int);
+ void clearWinnieFlag(int);
void gameOver();
void saveGame();
void loadGame();
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index b11927c542..b6974ee651 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -134,6 +134,9 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
out->writeByte(_game.automaticSave);
out->write(_game.automaticSaveDescription, 31);
+ // touch VM_VAR_SECONDS, so that it gets updated
+ getVar(VM_VAR_SECONDS);
+
for (i = 0; i < MAX_FLAGS; i++)
out->writeByte(_game.flags[i]);
for (i = 0; i < MAX_VARS; i++)
@@ -666,7 +669,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
delete in;
debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName.c_str());
- setflag(VM_FLAG_RESTORE_JUST_RAN, true);
+ setFlag(VM_FLAG_RESTORE_JUST_RAN, true);
_game.hasPrompt = 0; // force input line repaint if necessary
_words->clearEgoWords();
diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp
index 8f678cbac9..edf17960ad 100644
--- a/engines/agi/sound.cpp
+++ b/engines/agi/sound.cpp
@@ -140,7 +140,7 @@ void SoundMgr::startSound(int resnum, int flag) {
if (_vm->getVersion() < 0x2000) {
_vm->_game.vars[_endflag] = 0;
} else {
- _vm->setflag(_endflag, false);
+ _vm->setFlag(_endflag, false);
}
}
@@ -160,7 +160,7 @@ void SoundMgr::stopSound() {
if (_vm->getVersion() < 0x2000) {
_vm->_game.vars[_endflag] = 1;
} else {
- _vm->setflag(_endflag, true);
+ _vm->setFlag(_endflag, true);
}
}
@@ -169,7 +169,7 @@ void SoundMgr::stopSound() {
void SoundMgr::soundIsFinished() {
if (_endflag != -1)
- _vm->setflag(_endflag, true);
+ _vm->setFlag(_endflag, true);
if (_playingSound != -1)
_vm->_game.sounds[_playingSound]->stop();
diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp
index d875fa0b97..2042c10a7a 100644
--- a/engines/agi/sound_pcjr.cpp
+++ b/engines/agi/sound_pcjr.cpp
@@ -236,7 +236,7 @@ int SoundGenPCJr::getNextNote_v2(int ch) {
assert(ch < CHAN_MAX);
- if (!_vm->getflag(VM_FLAG_SOUND_ON))
+ if (!_vm->getFlag(VM_FLAG_SOUND_ON))
return -1;
tpcm = &_tchannel[ch];
diff --git a/engines/agi/sound_sarien.cpp b/engines/agi/sound_sarien.cpp
index d197f85832..8cd6af32d5 100644
--- a/engines/agi/sound_sarien.cpp
+++ b/engines/agi/sound_sarien.cpp
@@ -161,7 +161,7 @@ void SoundGenSarien::stopNote(int i) {
}
void SoundGenSarien::playNote(int i, int freq, int vol) {
- if (!_vm->getflag(VM_FLAG_SOUND_ON))
+ if (!_vm->getFlag(VM_FLAG_SOUND_ON))
vol = 0;
else if (vol && _vm->_soundemu == SOUND_EMU_PC)
vol = 160;
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp
index 1124aef742..a3920c39b1 100644
--- a/engines/agi/sprite.cpp
+++ b/engines/agi/sprite.cpp
@@ -254,7 +254,7 @@ void SpritesMgr::drawCel(ScreenObjEntry *screenObj) {
}
if (screenObj->objectNr == 0) { // if ego, update if ego is visible at the moment
- _vm->setflag(VM_FLAG_EGO_INVISIBLE, isViewHidden);
+ _vm->setFlag(VM_FLAG_EGO_INVISIBLE, isViewHidden);
}
}
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 8817756046..8806aeee28 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -328,9 +328,9 @@ void TextMgr::printAt(int16 textNr, int16 textPos_Row, int16 textPos_Column, int
bool TextMgr::messageBox(const char *textPtr) {
drawMessageBox(textPtr);
- if (_vm->getflag(VM_FLAG_OUTPUT_MODE)) {
+ if (_vm->getFlag(VM_FLAG_OUTPUT_MODE)) {
// non-blocking window
- _vm->setflag(VM_FLAG_OUTPUT_MODE, false);
+ _vm->setFlag(VM_FLAG_OUTPUT_MODE, false);
// Signal, that non-blocking text is shown at the moment
_vm->nonBlockingText_IsShown();
@@ -359,7 +359,7 @@ bool TextMgr::messageBox(const char *textPtr) {
_vm->setVar(VM_VAR_KEY, 0);
do {
- if (_vm->getflag(VM_FLAG_RESTORE_JUST_RAN))
+ if (_vm->getFlag(VM_FLAG_RESTORE_JUST_RAN))
break;
_vm->mainCycle();
@@ -491,7 +491,7 @@ void TextMgr::statusDraw() {
displayText(statusTextPtr);
charPos_Set(_statusRow, 30);
- if (_vm->getflag(VM_FLAG_SOUND_ON)) {
+ if (_vm->getFlag(VM_FLAG_SOUND_ON)) {
statusTextPtr = stringPrintf(_systemUI->getStatusTextSoundOn());
} else {
statusTextPtr = stringPrintf(_systemUI->getStatusTextSoundOff());
diff --git a/engines/agi/view.cpp b/engines/agi/view.cpp
index 3793272eb6..5c52732033 100644
--- a/engines/agi/view.cpp
+++ b/engines/agi/view.cpp
@@ -49,7 +49,7 @@ void AgiEngine::updateView(ScreenObjEntry *screenObj) {
if (++celNr != lastCelNr)
break;
}
- setflag(screenObj->loop_flag, true);
+ setFlag(screenObj->loop_flag, true);
screenObj->flags &= ~fCycling;
screenObj->direction = 0;
screenObj->cycle = kCycleNormal;
@@ -60,7 +60,7 @@ void AgiEngine::updateView(ScreenObjEntry *screenObj) {
if (celNr)
break;
}
- setflag(screenObj->loop_flag, true);
+ setFlag(screenObj->loop_flag, true);
screenObj->flags &= ~fCycling;
screenObj->direction = 0;
screenObj->cycle = kCycleNormal;
diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp
index 3c248e9874..0b8a4f3809 100644
--- a/engines/agi/words.cpp
+++ b/engines/agi/words.cpp
@@ -354,11 +354,11 @@ void Words::parseUsingDictionary(char *rawUserInput) {
debugC(4, kDebugLevelScripts, "ego word count = %d", _egoWordCount);
if (_egoWordCount > 0) {
- _vm->setflag(VM_FLAG_ENTERED_CLI, true);
+ _vm->setFlag(VM_FLAG_ENTERED_CLI, true);
} else {
- _vm->setflag(VM_FLAG_ENTERED_CLI, false);
+ _vm->setFlag(VM_FLAG_ENTERED_CLI, false);
}
- _vm->setflag(VM_FLAG_SAID_ACCEPTED_INPUT, false);
+ _vm->setFlag(VM_FLAG_SAID_ACCEPTED_INPUT, false);
}
uint16 Words::getEgoWordCount() {