diff options
author | Eugene Sandulenko | 2018-03-27 00:57:49 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-03-27 01:07:38 +0200 |
commit | 53371ed2f7e30ce5940676be47cda033b685959b (patch) | |
tree | e35e0ed641ba48fcea4b63878498dd59953b2b92 | |
parent | 20c8b949a9a790f7d2b2110587109f9767822de6 (diff) | |
download | scummvm-rg350-53371ed2f7e30ce5940676be47cda033b685959b.tar.gz scummvm-rg350-53371ed2f7e30ce5940676be47cda033b685959b.tar.bz2 scummvm-rg350-53371ed2f7e30ce5940676be47cda033b685959b.zip |
BLADERUNNER: Complete Scores functionality
-rw-r--r-- | engines/bladerunner/ui/scores.cpp | 23 |
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() { |