Skip to content

Commit

Permalink
XEEN: Renamings of endgame methods for better clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Dec 19, 2017
1 parent 46b0101 commit a2eb11f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 30 deletions.
51 changes: 25 additions & 26 deletions engines/xeen/scripts.cpp
Expand Up @@ -937,18 +937,18 @@ bool Scripts::cmdConfirmWord(ParamsIterator &params) {
_mirrorId = StringInput::show(_vm, inputType, msg1, msg2, _event->_opcode);
if (_mirrorId) {
if (_mirrorId == 33 && files._isDarkCc) {
doEndGame2();
doDarkSideEnding();
} else if (_mirrorId == 34 && files._isDarkCc) {
doWorldEnd();
doWorldEnding();
} else if (_mirrorId == 35 && files._isDarkCc &&
_vm->getGameID() == GType_WorldOfXeen) {
doEndGame();
doCloudsEnding();
} else if (_mirrorId == 40 && !files._isDarkCc) {
doEndGame();
doCloudsEnding();
} else if (_mirrorId == 60 && !files._isDarkCc) {
doEndGame2();
doDarkSideEnding();
} else if (_mirrorId == 61 && !files._isDarkCc) {
doWorldEnd();
doWorldEnding();
} else {
if (_mirrorId == 59 && !files._isDarkCc) {
for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
Expand Down Expand Up @@ -1386,15 +1386,15 @@ bool Scripts::cmdCutsceneEndDarkside(ParamsIterator &params) {
party._mazeDirection = DIR_NORTH;
party._mazePosition = Common::Point(25, 21);

doEndGame2();
doDarkSideEnding();
return false;
}

bool Scripts::cmdCutsceneEndWorld(ParamsIterator &params) {
_vm->_saves->_wonWorld = true;
_vm->_party->_worldEnd = true;

doWorldEnd();
doWorldEnding();
return false;
}

Expand All @@ -1405,36 +1405,35 @@ bool Scripts::cmdFlipWorld(ParamsIterator &params) {

bool Scripts::cmdPlayCD(ParamsIterator &params) { error("TODO"); }

void Scripts::doEndGame() {
doEnding("ENDGAME", 0);
void Scripts::doCloudsEnding() {
doEnding("ENDGAME");
}

void Scripts::doEndGame2() {
void Scripts::doDarkSideEnding() {
doEnding("ENDGAME2");
}

void Scripts::doWorldEnding() {
doEnding("WORLDEND");
}

void Scripts::doEnding(const Common::String &endStr) {
_vm->_saves->saveChars();

Party &party = *_vm->_party;
int v2 = 0;

int state = 0;
for (uint idx = 0; idx < party._activeParty.size(); ++idx) {
Character &player = party._activeParty[idx];
if (player.hasAward(77)) {
v2 = 2;
state = 2;
break;
}
else if (player.hasAward(76)) {
v2 = 1;
} else if (player.hasAward(76)) {
state = 1;
break;
}
}

doEnding("ENDGAME2", v2);
}

void Scripts::doWorldEnd() {
error("TODO: doWorldEnd");
}

void Scripts::doEnding(const Common::String &endStr, int v2) {
_vm->_saves->saveChars();

error("TODO: doEnding");
}

Expand Down
21 changes: 17 additions & 4 deletions engines/xeen/scripts.h
Expand Up @@ -505,13 +505,26 @@ class Scripts {

int whoWill(int v1, int v2, int v3);

void doEndGame();
/**
* Do the Clouds of Xeen ending
*/
void doCloudsEnding();

void doEndGame2();
/**
* Do the Dark Side of Xeen ending
*/
void doDarkSideEnding();

void doWorldEnd();
/**
* Do the World of Xeen combined ending
void doEnding(const Common::String &endStr, int v2);
*/
void doWorldEnding();

/**
* Triggers an ending sequence
*/
void doEnding(const Common::String &endStr);

/**
* This monstrosity handles doing the various types of If checks on various data
Expand Down

0 comments on commit a2eb11f

Please sign in to comment.