diff options
| -rw-r--r-- | engines/xeen/scripts.cpp | 51 | ||||
| -rw-r--r-- | engines/xeen/scripts.h | 21 | 
2 files changed, 42 insertions, 30 deletions
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 12054082e5..d33c534b6b 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -937,18 +937,18 @@ bool Scripts::cmdConfirmWord(ParamsIterator ¶ms) {  	_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) { @@ -1386,7 +1386,7 @@ bool Scripts::cmdCutsceneEndDarkside(ParamsIterator ¶ms) {  	party._mazeDirection = DIR_NORTH;  	party._mazePosition = Common::Point(25, 21); -	doEndGame2(); +	doDarkSideEnding();  	return false;  } @@ -1394,7 +1394,7 @@ bool Scripts::cmdCutsceneEndWorld(ParamsIterator ¶ms) {  	_vm->_saves->_wonWorld = true;  	_vm->_party->_worldEnd = true; -	doWorldEnd(); +	doWorldEnding();  	return false;  } @@ -1405,36 +1405,35 @@ bool Scripts::cmdFlipWorld(ParamsIterator ¶ms) {  bool Scripts::cmdPlayCD(ParamsIterator ¶ms) { 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");  } diff --git a/engines/xeen/scripts.h b/engines/xeen/scripts.h index 457d4b76c2..4c81185c54 100644 --- a/engines/xeen/scripts.h +++ b/engines/xeen/scripts.h @@ -505,13 +505,26 @@ private:  	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  | 
