aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-02-06 21:42:41 -0500
committerPaul Gilbert2018-02-06 21:42:41 -0500
commit255aa972c64c4cd0d7ce03bccd2394138d285563 (patch)
treea04c1622dcc453ebdaae5cd573749d3de9299b1a /engines
parenteb50364c2d7c0e70be0bf9454b0c24a494db8433 (diff)
downloadscummvm-rg350-255aa972c64c4cd0d7ce03bccd2394138d285563.tar.gz
scummvm-rg350-255aa972c64c4cd0d7ce03bccd2394138d285563.tar.bz2
scummvm-rg350-255aa972c64c4cd0d7ce03bccd2394138d285563.zip
XEEN: Implement final score calculation
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/party.cpp15
-rw-r--r--engines/xeen/party.h5
-rw-r--r--engines/xeen/scripts.cpp6
3 files changed, 24 insertions, 2 deletions
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 15e7a21b01..849abfb850 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 b7a41e2a8f..cb7bfd9d7b 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 c7f6c35350..35f28bbf73 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;
}