[Scummvm-git-logs] scummvm master -> 94966010dbe392a4e8c9390db325a6f30d8455ab

dreammaster dreammaster at scummvm.org
Wed Feb 7 03:44:05 CET 2018


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
255aa972c6 XEEN: Implement final score calculation
94966010db XEEN: More of Clouds ending


Commit: 255aa972c64c4cd0d7ce03bccd2394138d285563
    https://github.com/scummvm/scummvm/commit/255aa972c64c4cd0d7ce03bccd2394138d285563
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-02-06T21:42:41-05:00

Commit Message:
XEEN: Implement final score calculation

Changed paths:
    engines/xeen/party.cpp
    engines/xeen/party.h
    engines/xeen/scripts.cpp


diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 15e7a21..849abfb 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -1637,4 +1637,19 @@ void Party::giveBankInterest() {
 	_bankGems += _bankGems / 100;
 }
 
+uint Party::getScore() {
+	uint score = 0;
+	for (uint idx = 0; idx < _activeParty.size(); ++idx)
+		score += _activeParty[idx].getCurrentExperience();
+	score = score / _activeParty.size() / 10000;
+	score *= 100000;
+
+	uint time = _vm->_events->playTime() / GAME_FRAME_RATE;
+	int minutes = (time % 3600) / 60;
+	int hours = time / 3600;
+	
+	score += minutes + (hours * 100);
+	return score;
+}
+
 } // End of namespace Xeen
diff --git a/engines/xeen/party.h b/engines/xeen/party.h
index b7a41e2..cb7bfd9 100644
--- a/engines/xeen/party.h
+++ b/engines/xeen/party.h
@@ -235,6 +235,11 @@ public:
 	 * Resets the inventory that Blacksmiths sell
 	 */
 	void resetBlacksmithWares();
+
+	/**
+	 * Returns the current total score
+	 */
+	uint getScore();
 };
 
 } // End of namespace Xeen
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index c7f6c35..35f28bb 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -1464,8 +1464,10 @@ void Scripts::doEnding(const Common::String &endStr) {
 		}
 	}
 
-	// TODO: Pass proper score
-	g_vm->showCutscene(endStr, state, 42);
+	// Get the current total score
+	uint finalScore = party.getScore();
+
+	g_vm->showCutscene(endStr, state, finalScore);
 	g_vm->_quitMode = QMODE_MENU;
 }
 


Commit: 94966010dbe392a4e8c9390db325a6f30d8455ab
    https://github.com/scummvm/scummvm/commit/94966010dbe392a4e8c9390db325a6f30d8455ab
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-02-06T21:43:50-05:00

Commit Message:
XEEN: More of Clouds ending

Changed paths:
    engines/xeen/events.cpp
    engines/xeen/events.h
    engines/xeen/worldofxeen/clouds_cutscenes.cpp
    engines/xeen/worldofxeen/clouds_cutscenes.h
    engines/xeen/worldofxeen/worldofxeen.cpp


diff --git a/engines/xeen/events.cpp b/engines/xeen/events.cpp
index babfdcb..bec5b6b 100644
--- a/engines/xeen/events.cpp
+++ b/engines/xeen/events.cpp
@@ -179,6 +179,16 @@ void EventsManager::waitForPressAnimated() {
 	clearEvents();
 }
 
+void EventsManager::waitForPress() {
+	clearEvents();
+
+	do {
+		pollEventsAndWait();
+	} while (!_vm->shouldQuit() && !isKeyMousePressed());
+
+	clearEvents();
+}
+
 void EventsManager::nextFrame() {
 	++_frameCounter;
 	++_playTime;
diff --git a/engines/xeen/events.h b/engines/xeen/events.h
index 3ec548d..4963259 100644
--- a/engines/xeen/events.h
+++ b/engines/xeen/events.h
@@ -128,6 +128,11 @@ public:
 	 * Waits for a key or mouse press, animating the 3d view in the background
 	 */
 	void waitForPressAnimated();
+
+	/**
+	 * Waits for a key or mouse press
+	 */
+	void waitForPress();
 };
 
 class GameEvent {
diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.cpp b/engines/xeen/worldofxeen/clouds_cutscenes.cpp
index 8b2d532..e61e477 100644
--- a/engines/xeen/worldofxeen/clouds_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/clouds_cutscenes.cpp
@@ -340,7 +340,8 @@ void CloudsCutscenes::showCloudsEnding(uint finalScore) {
 	if (showCloudsEnding1())
 		if (showCloudsEnding2())
 			if (!showCloudsEnding3())
-				showCloudsEnding4(finalScore);
+				if (!showCloudsEnding4(finalScore))
+					showCloudsEnding5();
 }
 
 bool CloudsCutscenes::showCloudsEnding1() {
@@ -721,7 +722,9 @@ bool CloudsCutscenes::showCloudsEnding2() {
 }
 
 bool CloudsCutscenes::showCloudsEnding3() {
-	SpriteResource mon088("088.mon"), att034("034.att");
+	SpriteResource mon, att;
+
+
 
 	// TODO
 	doScroll(true, false);
@@ -808,21 +811,58 @@ bool CloudsCutscenes::showCloudsEnding4(uint finalScore) {
 
 	windows[28].setBounds(Common::Rect(63, 60, 254, 160));
 
-	for (int idx1 = 0; idx1 < 38; ++idx1) {
-		screen.horizMerge(mergeX);
-		mergeX = (mergeX + 1) % SCREEN_WIDTH;
+	for (int idx = 1; idx <= 2; ++idx) {
+		events.clearEvents();
+		do {
+			screen.horizMerge(mergeX);
+			mergeX = (mergeX + 1) % SCREEN_WIDTH;
 
-		mirrBack.draw(0, 0);
-		mirror.draw(0, 0);
-		endText.draw(0, 19);
+			mirrBack.draw(0, 0);
+			mirror.draw(0, 0);
+			endText.draw(0, 19);
 
-		for (int idx2 = 0; idx2 < 10; ++idx2)
-			endText.draw(0, frames[idx2], Common::Point(FRAMEX[idx2], 110));
-		windows[28].writeString(Res.CLOUDS_CONGRATULATIONS1);
+			for (int idx2 = 0; idx2 < 10; ++idx2)
+				endText.draw(0, frames[idx2], Common::Point(FRAMEX[idx2], 110));
+			windows[28].writeString(idx == 1 ? Res.CLOUDS_CONGRATULATIONS1 :
+				Res.CLOUDS_CONGRATULATIONS2);
 
-		WAIT(1);
+			WAIT(1);
+		} while (!events.isKeyMousePressed());
 	}
-	// TODO
+
+	doScroll(true, false);
+	screen.fadeOut();
+
+	return true;
+}
+
+bool CloudsCutscenes::showCloudsEnding5() {
+	EventsManager &events = *_vm->_events;
+	Screen &screen = *_vm->_screen;
+	Sound &sound = *_vm->_sound;
+	SpriteResource king("king.end");
+
+	king.draw(0, 0, Common::Point(0, 0));
+	king.draw(0, 1, Common::Point(160, 0));
+	screen.fadeIn();
+	
+	sound.playSound("king4.voc");
+	do {
+		king.draw(0, 0, Common::Point(0, 0));
+		king.draw(0, 1, Common::Point(160, 0));
+		int frame = getSpeakingFrame(1, 6);
+		if (frame > 1)
+			king.draw(0, frame);
+
+		showSubtitles();
+		WAIT(3);
+	} while (sound.isPlaying() || _subtitleSize);
+
+	king.draw(0, 0, Common::Point(0, 0));
+	king.draw(0, 1, Common::Point(160, 0));
+	WAIT(1);
+	doScroll(true, false);
+
 	return true;
 }
 
diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.h b/engines/xeen/worldofxeen/clouds_cutscenes.h
index a1579ca..de56039 100644
--- a/engines/xeen/worldofxeen/clouds_cutscenes.h
+++ b/engines/xeen/worldofxeen/clouds_cutscenes.h
@@ -60,6 +60,11 @@ private:
 	 * Shows part 4 of the Clouds of Xeen ending, the final score
 	 */
 	bool showCloudsEnding4(uint finalScore);
+
+	/**
+	 * Shows part 5 of the Clouds of Xeen ending, final king display
+	 */
+	bool showCloudsEnding5();
 public:
 	CloudsCutscenes(XeenEngine *vm) : Cutscenes(vm) {}
 
diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp
index c02e6f7..b2ff215 100644
--- a/engines/xeen/worldofxeen/worldofxeen.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen.cpp
@@ -167,6 +167,7 @@ void WorldOfXeenEngine::death() {
 
 void WorldOfXeenEngine::showCutscene(const Common::String &name, int status, uint score) {
 	_sound->stopAllAudio();
+	_events->clearEvents();
 
 	if (name == "ENDGAME")
 		showCloudsEnding(score);
@@ -174,6 +175,9 @@ void WorldOfXeenEngine::showCutscene(const Common::String &name, int status, uin
 		showDarkSideEnding();
 	else if (name == "WORLDEND")
 		showWorldOfXeenEnding((GooberState)status, score);
+
+	_events->clearEvents();
+	_quitMode = QMODE_MENU;
 }
 
 } // End of namespace WorldOfXeen





More information about the Scummvm-git-logs mailing list