[Scummvm-git-logs] scummvm master -> 53371ed2f7e30ce5940676be47cda033b685959b

sev- sev at scummvm.org
Tue Mar 27 01:07:47 CEST 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:
20c8b949a9 BLADERUNNER: Implement Scores::tick()
53371ed2f7 BLADERUNNER: Complete Scores functionality


Commit: 20c8b949a9a790f7d2b2110587109f9767822de6
    https://github.com/scummvm/scummvm/commit/20c8b949a9a790f7d2b2110587109f9767822de6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-03-27T01:07:38+02:00

Commit Message:
BLADERUNNER: Implement Scores::tick()

Changed paths:
    engines/bladerunner/font.cpp
    engines/bladerunner/font.h
    engines/bladerunner/ui/scores.cpp


diff --git a/engines/bladerunner/font.cpp b/engines/bladerunner/font.cpp
index 5ae1c8e..d4b0e16 100644
--- a/engines/bladerunner/font.cpp
+++ b/engines/bladerunner/font.cpp
@@ -120,6 +120,14 @@ void Font::drawColor(const Common::String &text, Graphics::Surface &surface, int
 	draw(text, surface, x, y);
 }
 
+void Font::drawNumber(int num, Graphics::Surface &surface, int x, int y) const {
+	char buffer[20];
+
+	snprintf(buffer, 20, "%d", num);
+
+	draw(buffer, surface, x, y);
+}
+
 int Font::getTextWidth(const Common::String &text) const {
 	const uint8 *character = (const uint8 *)text.c_str();
 
diff --git a/engines/bladerunner/font.h b/engines/bladerunner/font.h
index 9302520..4af2546 100644
--- a/engines/bladerunner/font.h
+++ b/engines/bladerunner/font.h
@@ -69,6 +69,7 @@ public:
 
 	void draw(const Common::String &text, Graphics::Surface &surface, int x, int y) const;
 	void drawColor(const Common::String &text, Graphics::Surface &surface, int x, int y, uint16 color);
+	void drawNumber(int num, Graphics::Surface &surface, int x, int y) const;
 
 	int getTextWidth(const Common::String &text) const;
 	int getTextHeight(const Common::String &text) const;
diff --git a/engines/bladerunner/ui/scores.cpp b/engines/bladerunner/ui/scores.cpp
index 55d3111..c97a68d 100644
--- a/engines/bladerunner/ui/scores.cpp
+++ b/engines/bladerunner/ui/scores.cpp
@@ -128,6 +128,35 @@ int Scores::handleMouseDown(int x, int y) {
 }
 
 void Scores::tick() {
+	if (!_vm->_gameIsRunning) {
+		return;
+	}
+
+	int frame = _vqaPlayer->update();
+	assert(frame >= -1);
+
+	// vqaPlayer renders to _surfaceBack
+	blit(_vm->_surfaceBack, _vm->_surfaceFront);
+
+	_vm->_surfaceFront.hLine(200, 139, 400, 0x3e0);
+	_vm->_surfaceFront.hLine(200, 347, 400, 0x1f);
+
+	_font->draw(_txtScorers->getText(7), _vm->_surfaceFront, 200, 114);
+
+	int y = 140;
+
+	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);
+
+		y += 26;
+	}
+
+	_font->draw(_txtScorers->getText(8), _vm->_surfaceFront, 200, 322);
+	_font->draw(_txtScorers->getText(_lastScoreId), _vm->_surfaceFront, 220, 348);
+	_font->drawNumber(_lastScoreValue, _vm->_surfaceFront, 360, 348);
+
+	_vm->blitToScreen(_vm->_surfaceFront);
 }
 
 void Scores::fill() {


Commit: 53371ed2f7e30ce5940676be47cda033b685959b
    https://github.com/scummvm/scummvm/commit/53371ed2f7e30ce5940676be47cda033b685959b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-03-27T01:07:38+02:00

Commit Message:
BLADERUNNER: Complete Scores functionality

Changed paths:
    engines/bladerunner/ui/scores.cpp


diff --git a/engines/bladerunner/ui/scores.cpp b/engines/bladerunner/ui/scores.cpp
index c97a68d..c4a7df7 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() {





More information about the Scummvm-git-logs mailing list