aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner
diff options
context:
space:
mode:
Diffstat (limited to 'engines/bladerunner')
-rw-r--r--engines/bladerunner/ui/scores.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/engines/bladerunner/ui/scores.cpp b/engines/bladerunner/ui/scores.cpp
index c97a68d581..c4a7df778c 100644
--- a/engines/bladerunner/ui/scores.cpp
+++ b/engines/bladerunner/ui/scores.cpp
@@ -147,7 +147,7 @@ void Scores::tick() {
for (int i = 0; i < 7; i++) {
_font->draw(_txtScorers->getText(_scorers[i]), _vm->_surfaceFront, 220, y);
- _font->drawNumber(_scores[i], _vm->_surfaceFront, 360, y);
+ _font->drawNumber(_scores[_scorers[i]], _vm->_surfaceFront, 360, y);
y += 26;
}
@@ -160,6 +160,27 @@ void Scores::tick() {
}
void Scores::fill() {
+ for (int i = 0; i < 7; i++) {
+ _scorers[i] = i;
+ }
+
+ // Network sorting using Bose-Nelson Algorithm
+ const byte network[32] = { // Bose-Nelson
+ 1,2, 3,4, 5,6,
+ 0,2, 3,5, 4,6,
+ 0,1, 4,5, 2,6,
+ 0,4, 1,5,
+ 0,3, 2,5,
+ 1,3, 2,4,
+ 2,3
+ };
+
+ for (int i = 0; i < 32; i += 2) {
+ int i1 = network[i], i2 = network[i + 1];
+ if (_scores[_scorers[i1]] < _scores[_scorers[i2]]) {
+ SWAP(_scorers[i1], _scorers[i2]);
+ }
+ }
}
void Scores::reset() {