Skip to content

Commit

Permalink
XEEN: Mode renamings, fix loading savegame during script dragging party
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Apr 15, 2018
1 parent a7bc089 commit caba188
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 35 deletions.
6 changes: 3 additions & 3 deletions engines/xeen/combat.cpp
Expand Up @@ -638,7 +638,7 @@ void Combat::monstersAttack() {
Condition condition = party._activeParty[charNum].worstCondition();

if (condition == DEPRESSED || condition == CONFUSED || condition == NO_CONDITION) {
_vm->_mode = MODE_1;
_vm->_mode = MODE_INTERACTIVE;
break;
}
}
Expand Down Expand Up @@ -890,7 +890,7 @@ void Combat::doMonsterTurn(int monsterId) {

if (ableChars.size() == 0) {
party._dead = true;
_vm->_mode = MODE_1;
_vm->_mode = MODE_INTERACTIVE;
return;
}

Expand Down Expand Up @@ -2095,7 +2095,7 @@ void Combat::reset() {
clearShooting();
setupCombatParty();

_combatMode = COMBATMODE_1;
_combatMode = COMBATMODE_INTERACTIVE;
_monster2Attack = -1;
}

Expand Down
2 changes: 1 addition & 1 deletion engines/xeen/combat.h
Expand Up @@ -58,7 +58,7 @@ enum ShootType {
};

enum CombatMode {
COMBATMODE_STARTUP = 0, COMBATMODE_1 = 1, COMBATMODE_2 = 2
COMBATMODE_STARTUP = 0, COMBATMODE_INTERACTIVE = 1, COMBATMODE_2 = 2
};

enum PowType {
Expand Down
2 changes: 1 addition & 1 deletion engines/xeen/dialogs/dialogs_input.cpp
Expand Up @@ -84,7 +84,7 @@ Common::KeyState Input::waitForKey(const Common::String &msg) {
intf._tillMove = 0;

bool flag = !_vm->_startupWindowActive && !windows[25]._enabled
&& _vm->_mode != MODE_FF && _vm->_mode != MODE_17;
&& _vm->_mode != MODE_FF && _vm->_mode != MODE_INTERACTIVE7;

PendingEvent pe;
while (!_vm->shouldExit()) {
Expand Down
2 changes: 1 addition & 1 deletion engines/xeen/dialogs/dialogs_message.cpp
Expand Up @@ -51,7 +51,7 @@ void MessageDialog::execute(const Common::String &msg, MessageWaitType waitType)
break;

case WT_ANIMATED_WAIT:
if (windows[11]._enabled || _vm->_mode == MODE_17) {
if (windows[11]._enabled || _vm->_mode == MODE_INTERACTIVE7) {
g_vm->_locations->wait();
break;
}
Expand Down
2 changes: 1 addition & 1 deletion engines/xeen/dialogs/dialogs_party.cpp
Expand Up @@ -58,7 +58,7 @@ void PartyDialog::execute() {
setupBackground();

while (!_vm->shouldExit()) {
_vm->_mode = MODE_1;
_vm->_mode = MODE_INTERACTIVE;

// Build up a list of available characters in the Roster that are on the
// same side of Xeen as the player is currently on
Expand Down
2 changes: 1 addition & 1 deletion engines/xeen/dialogs/dialogs_spells.cpp
Expand Up @@ -137,7 +137,7 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
spells._lastCaster = _buttonValue;
intf.highlightChar(_buttonValue);

if (_vm->_mode == MODE_17) {
if (_vm->_mode == MODE_INTERACTIVE7) {
windows[10].writeString(Common::String::format(Res.GUILD_OPTIONS,
XeenEngine::printMil(party._gold).c_str(), Res.GUILD_TEXT, c->_name.c_str()));
} else {
Expand Down
24 changes: 12 additions & 12 deletions engines/xeen/interface.cpp
Expand Up @@ -559,7 +559,7 @@ void Interface::perform() {

if (combat._attackMonsters[0] != -1 || combat._attackMonsters[1] != -1
|| combat._attackMonsters[2] != -1) {
if ((_vm->_mode == MODE_1 || _vm->_mode == MODE_SLEEPING)
if ((_vm->_mode == MODE_INTERACTIVE || _vm->_mode == MODE_SLEEPING)
&& !combat._monstersAttacking && !_charsShooting) {
doCombat();
}
Expand Down Expand Up @@ -999,7 +999,7 @@ void Interface::rest() {
map.cellFlagLookup(party._mazePosition);

if ((map._currentCantRest || (map.mazeData()._mazeFlags & RESTRICTION_REST))
&& _vm->_mode != MODE_12) {
&& _vm->_mode != MODE_INTERACTIVE2) {
ErrorScroll::show(_vm, Res.TOO_DANGEROUS_TO_REST, WT_NONFREEZED_WAIT);
} else {
// Check whether any character is in danger of dying
Expand All @@ -1025,14 +1025,14 @@ void Interface::rest() {
Mode oldMode = _vm->_mode;
_vm->_mode = MODE_SLEEPING;

if (oldMode == MODE_12) {
if (oldMode == MODE_INTERACTIVE2) {
party.changeTime(8 * 60);
} else {
for (int idx = 0; idx < 10; ++idx) {
chargeStep();
draw3d(true);

if (_vm->_mode == MODE_1) {
if (_vm->_mode == MODE_INTERACTIVE) {
_vm->_mode = oldMode;
return;
}
Expand Down Expand Up @@ -1190,7 +1190,7 @@ void Interface::draw3d(bool updateFlag, bool pauseFlag) {
_flipUIFrame = (_flipUIFrame + 1) % 4;
if (_flipUIFrame == 0)
_flipWater = !_flipWater;
if (_tillMove && (_vm->_mode == MODE_1 || _vm->_mode == MODE_COMBAT) &&
if (_tillMove && (_vm->_mode == MODE_INTERACTIVE || _vm->_mode == MODE_COMBAT) &&
!combat._monstersAttacking && combat._moveMonsters) {
if (--_tillMove == 0)
combat.moveMonsters();
Expand Down Expand Up @@ -1226,7 +1226,7 @@ void Interface::draw3d(bool updateFlag, bool pauseFlag) {

if (combat._attackMonsters[0] != -1 || combat._attackMonsters[1] != -1
|| combat._attackMonsters[2] != -1) {
if ((_vm->_mode == MODE_1 || _vm->_mode == MODE_SLEEPING) &&
if ((_vm->_mode == MODE_INTERACTIVE || _vm->_mode == MODE_SLEEPING) &&
!combat._monstersAttacking && !_charsShooting && combat._moveMonsters) {
doCombat();
if (scripts._eventSkipped)
Expand Down Expand Up @@ -1589,7 +1589,7 @@ void Interface::doCombat() {
combat.run();
nextChar();

if (_vm->_mode == MODE_1) {
if (_vm->_mode == MODE_INTERACTIVE) {
party._treasure._gems = 0;
party._treasure._gold = 0;
party._treasure._hasItems = false;
Expand Down Expand Up @@ -1680,7 +1680,7 @@ void Interface::doCombat() {
break;
}

_vm->_mode = MODE_1;
_vm->_mode = MODE_INTERACTIVE;
if (combat._partyRan && (combat._attackMonsters[0] != -1 ||
combat._attackMonsters[1] != -1 || combat._attackMonsters[2] != -1)) {
party.checkPartyDead();
Expand All @@ -1701,7 +1701,7 @@ void Interface::doCombat() {
_vm->_mode = MODE_COMBAT;
draw3d(true);
party.giveTreasure();
_vm->_mode = MODE_1;
_vm->_mode = MODE_INTERACTIVE;
party._stepped = true;
unhighlightChar();

Expand Down Expand Up @@ -1730,7 +1730,7 @@ void Interface::doCombat() {
}
}

combat._combatMode = COMBATMODE_1;
combat._combatMode = COMBATMODE_INTERACTIVE;
}

void Interface::nextChar() {
Expand All @@ -1741,7 +1741,7 @@ void Interface::nextChar() {
return;
if ((combat._attackMonsters[0] == -1 && combat._attackMonsters[1] == -1 &&
combat._attackMonsters[2] == -1) || combat._combatParty.size() == 0) {
_vm->_mode = MODE_1;
_vm->_mode = MODE_INTERACTIVE;
return;
}

Expand All @@ -1751,7 +1751,7 @@ void Interface::nextChar() {
// Check if party is dead
party.checkPartyDead();
if (party._dead) {
_vm->_mode = MODE_1;
_vm->_mode = MODE_INTERACTIVE;
break;
}

Expand Down
6 changes: 3 additions & 3 deletions engines/xeen/locations.cpp
Expand Up @@ -497,7 +497,7 @@ GuildLocation::GuildLocation() : BaseLocation(GUILD) {
addButton(Common::Rect(234, 64, 308, 72), Common::KEYCODE_b);
addButton(Common::Rect(234, 74, 308, 82), Common::KEYCODE_s);
addButton(Common::Rect(234, 84, 308, 92), 0);
g_vm->_mode = MODE_17;
g_vm->_mode = MODE_INTERACTIVE7;

_vocName = _ccNum ? "parrot1.voc" : "guild10.voc";
}
Expand Down Expand Up @@ -560,7 +560,7 @@ TavernLocation::TavernLocation() : BaseLocation(TAVERN) {
addButton(Common::Rect(234, 64, 308, 72), Common::KEYCODE_f);
addButton(Common::Rect(234, 74, 308, 82), Common::KEYCODE_t);
addButton(Common::Rect(234, 84, 308, 92), Common::KEYCODE_r);
g_vm->_mode = MODE_17;
g_vm->_mode = MODE_INTERACTIVE7;

_vocName = _ccNum ? "hello1.voc" : "hello.voc";
}
Expand Down Expand Up @@ -713,7 +713,7 @@ Character *TavernLocation::doOptions(Character *c) {
party._activeParty[idx]._xeenSide = map._loadCcNum;
}

g_vm->_mode = MODE_17;
g_vm->_mode = MODE_INTERACTIVE7;
party.addTime(1440);
party._mazeId = 0;

Expand Down
6 changes: 3 additions & 3 deletions engines/xeen/party.cpp
Expand Up @@ -524,7 +524,7 @@ void Party::addTime(int numMinutes) {
_newDay = true;

if (_newDay && _minutes >= 300) {
if (_vm->_mode != MODE_RECORD_EVENTS && _vm->_mode != MODE_17) {
if (_vm->_mode != MODE_SCRIPT_IN_PROGRESS && _vm->_mode != MODE_INTERACTIVE7) {
resetTemps();
if (_rested || _vm->_mode == MODE_SLEEPING) {
_rested = false;
Expand Down Expand Up @@ -696,7 +696,7 @@ void Party::giveTreasure() {
return;

bool monstersPresent = combat.areMonstersPresent();
if (_vm->_mode != MODE_RECORD_EVENTS && monstersPresent)
if (_vm->_mode != MODE_SCRIPT_IN_PROGRESS && monstersPresent)
return;

combat.clearShooting();
Expand Down Expand Up @@ -781,7 +781,7 @@ void Party::giveTreasure() {
events.clearEvents();

if (_vm->_mode != MODE_COMBAT)
_vm->_mode = MODE_1;
_vm->_mode = MODE_INTERACTIVE;

w.close();
_gold += _treasure._gold;
Expand Down
4 changes: 2 additions & 2 deletions engines/xeen/scripts.cpp
Expand Up @@ -186,7 +186,7 @@ int Scripts::checkEvents() {
if (event._position == _currentPos && event._line == _lineNum &&
(party._mazeDirection | _currentPos.x | _currentPos.y)) {
if (event._direction == party._mazeDirection || event._direction == DIR_ALL) {
_vm->_mode = MODE_RECORD_EVENTS;
_vm->_mode = MODE_SCRIPT_IN_PROGRESS;
_scriptExecuted = true;
doOpcode(event);
break;
Expand Down Expand Up @@ -1463,7 +1463,7 @@ void Scripts::doCloudsEnding() {
g_vm->_party->_cloudsCompleted = true;
doEnding("ENDGAME");

g_vm->_mode = MODE_1;
g_vm->_mode = MODE_INTERACTIVE;
g_vm->_saves->saveGame();

g_vm->_gameMode = GMODE_MENU;
Expand Down
2 changes: 1 addition & 1 deletion engines/xeen/spells.cpp
Expand Up @@ -1150,7 +1150,7 @@ void Spells::superShelter() {
spellFailed();
} else {
Mode oldMode = _vm->_mode;
_vm->_mode = MODE_12;
_vm->_mode = MODE_INTERACTIVE2;
sound.playFX(30);
intf.rest();
_vm->_mode = oldMode;
Expand Down
7 changes: 5 additions & 2 deletions engines/xeen/xeen.cpp
Expand Up @@ -197,7 +197,8 @@ bool XeenEngine::canLoadGameStateCurrently() {
}

bool XeenEngine::canSaveGameStateCurrently() {
return _mode != MODE_COMBAT && _mode != MODE_STARTUP && (_map->mazeData()._mazeFlags & RESTRICTION_SAVE) == 0;
return _mode != MODE_COMBAT && _mode != MODE_STARTUP && _mode != MODE_SCRIPT_IN_PROGRESS
&& (_map->mazeData()._mazeFlags & RESTRICTION_SAVE) == 0;
}

void XeenEngine::playGame() {
Expand Down Expand Up @@ -243,7 +244,7 @@ void XeenEngine::play() {

_combat->_moveMonsters = true;
if (_mode == MODE_STARTUP) {
_mode = MODE_1;
_mode = MODE_INTERACTIVE;
_screen->fadeIn();
}

Expand Down Expand Up @@ -272,6 +273,8 @@ void XeenEngine::gameLoop() {
_map->cellFlagLookup(_party->_mazePosition);
if (_map->_currentIsEvent) {
_gameMode = (GameMode)_scripts->checkEvents();
if (isLoadPending())
continue;
if (shouldExit())
return;
}
Expand Down
8 changes: 4 additions & 4 deletions engines/xeen/xeen.h
Expand Up @@ -78,19 +78,19 @@ enum XeenDebugChannels {
enum Mode {
MODE_FF = -1,
MODE_STARTUP = 0,
MODE_1 = 1,
MODE_INTERACTIVE = 1,
MODE_COMBAT = 2,
MODE_3 = 3,
MODE_4 = 4,
MODE_SLEEPING = 5,
MODE_6 = 6,
MODE_7 = 7,
MODE_8 = 8,
MODE_RECORD_EVENTS = 9,
MODE_SCRIPT_IN_PROGRESS = 9,
MODE_CHARACTER_INFO = 10,
MODE_12 = 12,
MODE_INTERACTIVE2 = 12,
MODE_DIALOG_123 = 13,
MODE_17 = 17,
MODE_INTERACTIVE7 = 17,
MODE_86 = 86
};

Expand Down

0 comments on commit caba188

Please sign in to comment.