[Scummvm-git-logs] scummvm master -> 950ad44748dcc84e3cb25b09d4593c95d5054783

neuromancer noreply at scummvm.org
Sun Jun 19 09:27:02 UTC 2022


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

Summary:
01db683a76 HYPNO: count used lives in boyz
a09603a466 HYPNO: refactor arcade stats code and added final score in boyz
1ffae9b411 HYPNO: improved friendlies encounters counting in boyz
b4bd99aac4 HYPNO: fix crash when shooting a botle in boyz
950ad44748 HYPNO: added missing sounds when shooting non-hostiles in boyz


Commit: 01db683a76d845137c7bed3148c53070779fa982
    https://github.com/scummvm/scummvm/commit/01db683a76d845137c7bed3148c53070779fa982
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-06-19T11:24:44+02:00

Commit Message:
HYPNO: count used lives in boyz

Changed paths:
    engines/hypno/arcade.cpp
    engines/hypno/boyz/arcade.cpp
    engines/hypno/boyz/boyz.cpp
    engines/hypno/boyz/hard.cpp
    engines/hypno/grammar.h
    engines/hypno/hypno.h


diff --git a/engines/hypno/arcade.cpp b/engines/hypno/arcade.cpp
index 3fbb77f89fe..3de747cf0ed 100644
--- a/engines/hypno/arcade.cpp
+++ b/engines/hypno/arcade.cpp
@@ -733,6 +733,10 @@ void HypnoEngine::incScore(int inc) {
 	_score = _score + inc;
 }
 
+void HypnoEngine::incLivesUsed() {
+	_stats.livesUsed++;
+}
+
 void HypnoEngine::incShotsFired() {
 	_stats.shootsFired++;
 }
diff --git a/engines/hypno/boyz/arcade.cpp b/engines/hypno/boyz/arcade.cpp
index 17b13feb07f..24c33ee0329 100644
--- a/engines/hypno/boyz/arcade.cpp
+++ b/engines/hypno/boyz/arcade.cpp
@@ -133,7 +133,7 @@ void BoyzEngine::runAfterArcade(ArcadeShooting *arc) {
 		drawString("scifi08.fgx", Common::String::format("%d%%", killRatio), 240, 54, 0, kHypnoColorWhiteOrBlue);
 		drawString("scifi08.fgx", Common::String::format("%d", _stats.shootsFired), 240, 77, 0, kHypnoColorWhiteOrBlue);
 		drawString("scifi08.fgx", Common::String::format("%d%%", accuracyRatio()), 240, 92, 0, kHypnoColorWhiteOrBlue);
-		drawString("scifi08.fgx", Common::String::format("%d", -uint32(-1) - _lives), 240, 117, 0, kHypnoColorWhiteOrBlue);
+		drawString("scifi08.fgx", Common::String::format("%d", _stats.livesUsed), 240, 117, 0, kHypnoColorWhiteOrBlue);
 		drawString("scifi08.fgx", Common::String::format("%d", _stats.friendliesEncountered), 240, 142, 0, kHypnoColorWhiteOrBlue);
 		drawString("scifi08.fgx", Common::String::format("%d", _stats.infoReceived), 240, 158, 0, kHypnoColorWhiteOrBlue);
 
@@ -154,6 +154,7 @@ void BoyzEngine::runAfterArcade(ArcadeShooting *arc) {
 		}
 
 		// Merge current stats with the global ones
+		_globalStats.livesUsed = _stats.livesUsed + _globalStats.livesUsed;
 		_globalStats.shootsFired = _stats.shootsFired + _globalStats.shootsFired;
 		_globalStats.enemyHits = _stats.enemyHits + _globalStats.enemyHits;
 		_globalStats.enemyTargets = _stats.enemyTargets + _globalStats.enemyTargets;
diff --git a/engines/hypno/boyz/boyz.cpp b/engines/hypno/boyz/boyz.cpp
index 60c507889d3..0055632accb 100644
--- a/engines/hypno/boyz/boyz.cpp
+++ b/engines/hypno/boyz/boyz.cpp
@@ -1070,6 +1070,7 @@ Common::Error BoyzEngine::saveGameStream(Common::WriteStream *stream, bool isAut
 	stream->writeUint32LE(_lastLevel);
 
 	// Save current stats
+	stream->writeUint32LE(_stats.livesUsed);
 	stream->writeUint32LE(_stats.shootsFired);
 	stream->writeUint32LE(_stats.enemyHits);
 	stream->writeUint32LE(_stats.enemyTargets);
@@ -1078,6 +1079,7 @@ Common::Error BoyzEngine::saveGameStream(Common::WriteStream *stream, bool isAut
 	stream->writeUint32LE(_stats.friendliesEncountered);
 	stream->writeUint32LE(_stats.infoReceived);
 
+	stream->writeUint32LE(_globalStats.livesUsed);
 	stream->writeUint32LE(_globalStats.shootsFired);
 	stream->writeUint32LE(_globalStats.enemyHits);
 	stream->writeUint32LE(_globalStats.enemyTargets);
@@ -1100,6 +1102,7 @@ Common::Error BoyzEngine::loadGameStream(Common::SeekableReadStream *stream) {
 	_lastLevel = stream->readUint32LE();
 
 	// Load stats
+	_stats.livesUsed = stream->readUint32LE();
 	_stats.shootsFired = stream->readUint32LE();
 	_stats.enemyHits = stream->readUint32LE();
 	_stats.enemyTargets = stream->readUint32LE();
@@ -1108,6 +1111,7 @@ Common::Error BoyzEngine::loadGameStream(Common::SeekableReadStream *stream) {
 	_stats.friendliesEncountered = stream->readUint32LE();
 	_stats.infoReceived = stream->readUint32LE();
 
+	_globalStats.livesUsed = stream->readUint32LE();
 	_globalStats.shootsFired = stream->readUint32LE();
 	_globalStats.enemyHits = stream->readUint32LE();
 	_globalStats.enemyTargets = stream->readUint32LE();
diff --git a/engines/hypno/boyz/hard.cpp b/engines/hypno/boyz/hard.cpp
index af12de65a68..ce6473bfd9b 100644
--- a/engines/hypno/boyz/hard.cpp
+++ b/engines/hypno/boyz/hard.cpp
@@ -275,8 +275,7 @@ void BoyzEngine::runDifficultyMenu(Code *code) {
 }
 
 void BoyzEngine::runRetryMenu(Code *code) {
-	_lives--;
-
+	incLivesUsed();
 	uint32 idx = _rnd->getRandomNumber(_deathVideo.size() - 1);
 	Filename filename = _deathVideo[idx];
 	MVideo video(filename, Common::Point(0, 0), false, true, false);
diff --git a/engines/hypno/grammar.h b/engines/hypno/grammar.h
index d01e528ab74..ad38b8fad2f 100644
--- a/engines/hypno/grammar.h
+++ b/engines/hypno/grammar.h
@@ -741,6 +741,7 @@ extern ArcadeShooting *g_parsedArc;
 class ArcadeStats {
 	public:
 	ArcadeStats()  {
+		livesUsed = 0;
 		shootsFired = 0;
 		enemyHits = 0;
 		enemyTargets = 0;
@@ -749,7 +750,7 @@ class ArcadeStats {
 		friendliesEncountered = 0;
 		infoReceived = 0;
 	}
-
+	uint32 livesUsed;
 	uint32 shootsFired;
 	uint32 enemyHits;
 	uint32 enemyTargets;
diff --git a/engines/hypno/hypno.h b/engines/hypno/hypno.h
index 2ab11cac84c..73ab1495425 100644
--- a/engines/hypno/hypno.h
+++ b/engines/hypno/hypno.h
@@ -277,6 +277,7 @@ public:
 
 	ArcadeStats _stats;
 	void resetStatistics();
+	void incLivesUsed();
 	void incShotsFired();
 	void incEnemyHits();
 	void incEnemyTargets();


Commit: a09603a4660d8fdaed627b9ed900287cc04c0383
    https://github.com/scummvm/scummvm/commit/a09603a4660d8fdaed627b9ed900287cc04c0383
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-06-19T11:24:44+02:00

Commit Message:
HYPNO: refactor arcade stats code and added final score in boyz

Changed paths:
    engines/hypno/boyz/arcade.cpp
    engines/hypno/hypno.h


diff --git a/engines/hypno/boyz/arcade.cpp b/engines/hypno/boyz/arcade.cpp
index 24c33ee0329..3476ec05531 100644
--- a/engines/hypno/boyz/arcade.cpp
+++ b/engines/hypno/boyz/arcade.cpp
@@ -120,39 +120,8 @@ void BoyzEngine::runAfterArcade(ArcadeShooting *arc) {
 	}
 
 	if (_currentLevel == lastLevelTerritory(_currentLevel)) {
-		byte *palette;
 		int territory = getTerritory(_currentLevel) - 1;
-		Graphics::Surface *stats = decodeFrame("preload/stats.smk", territory, &palette);
-		loadPalette(palette, 0, 256);
-		drawImage(*stats, 0, 0, true);
-		stats->free();
-		delete stats;
-		uint32 enemiesAvailable = _stats.targetsDestroyed + _stats.targetsMissed;
-		drawString("scifi08.fgx", Common::String::format("%d", enemiesAvailable), 240, 40, 0, kHypnoColorWhiteOrBlue);
-		uint32 killRatio = enemiesAvailable > 0 ? 100 * _stats.targetsDestroyed / enemiesAvailable : 0;
-		drawString("scifi08.fgx", Common::String::format("%d%%", killRatio), 240, 54, 0, kHypnoColorWhiteOrBlue);
-		drawString("scifi08.fgx", Common::String::format("%d", _stats.shootsFired), 240, 77, 0, kHypnoColorWhiteOrBlue);
-		drawString("scifi08.fgx", Common::String::format("%d%%", accuracyRatio()), 240, 92, 0, kHypnoColorWhiteOrBlue);
-		drawString("scifi08.fgx", Common::String::format("%d", _stats.livesUsed), 240, 117, 0, kHypnoColorWhiteOrBlue);
-		drawString("scifi08.fgx", Common::String::format("%d", _stats.friendliesEncountered), 240, 142, 0, kHypnoColorWhiteOrBlue);
-		drawString("scifi08.fgx", Common::String::format("%d", _stats.infoReceived), 240, 158, 0, kHypnoColorWhiteOrBlue);
-
-		bool cont = true;
-		while (!shouldQuit() && cont) {
-			Common::Event event;
-			while (g_system->getEventManager()->pollEvent(event)) {
-				switch (event.type) {
-					case Common::EVENT_KEYDOWN:
-					cont = false;
-					break;
-					default:
-					break;
-				}
-			}
-			drawScreen();
-			g_system->delayMillis(10);
-		}
-
+		showArcadeStats(territory, _stats);
 		// Merge current stats with the global ones
 		_globalStats.livesUsed = _stats.livesUsed + _globalStats.livesUsed;
 		_globalStats.shootsFired = _stats.shootsFired + _globalStats.shootsFired;
@@ -162,6 +131,10 @@ void BoyzEngine::runAfterArcade(ArcadeShooting *arc) {
 		_globalStats.targetsMissed = _stats.targetsMissed + _globalStats.targetsMissed;
 		_globalStats.friendliesEncountered = _stats.friendliesEncountered + _globalStats.friendliesEncountered;
 		_globalStats.infoReceived = _stats.infoReceived + _globalStats.infoReceived;
+		// If we are finishing the last level, show final stats
+		if (_currentLevel == "c59.mi_")
+			showArcadeStats(5, _globalStats);
+
 		// After that, we can reset the current stats
 		resetStatistics();
 	}
@@ -170,6 +143,43 @@ void BoyzEngine::runAfterArcade(ArcadeShooting *arc) {
 	_sceneState[Common::String::format("GS_SEQ_%d", _levelId)] = 1;
 }
 
+void BoyzEngine::showArcadeStats(int territory, const ArcadeStats &data) {
+	byte *palette;
+	Graphics::Surface *stats = decodeFrame("preload/stats.smk", territory, &palette);
+	loadPalette(palette, 0, 256);
+	drawImage(*stats, 0, 0, true);
+	stats->free();
+	delete stats;
+	uint32 enemiesAvailable = data.targetsDestroyed + data.targetsMissed;
+	drawString("scifi08.fgx", Common::String::format("%d", enemiesAvailable), 278, 41, 0, kHypnoColorWhiteOrBlue);
+	uint32 killRatio = enemiesAvailable > 0 ? 100 * data.targetsDestroyed / enemiesAvailable : 0;
+	drawString("scifi08.fgx", Common::String::format("%d%%", killRatio), 278, 56, 0, kHypnoColorWhiteOrBlue);
+	drawString("scifi08.fgx", Common::String::format("%d", data.shootsFired), 278, 79, 0, kHypnoColorWhiteOrBlue);
+	uint32 accuracyRatio = data.shootsFired > 0 ? 100 * data.enemyHits / data.shootsFired : 0;
+	drawString("scifi08.fgx", Common::String::format("%d%%", accuracyRatio), 278, 94, 0, kHypnoColorWhiteOrBlue);
+	drawString("scifi08.fgx", Common::String::format("%d", data.livesUsed), 278, 119, 0, kHypnoColorWhiteOrBlue);
+	drawString("scifi08.fgx", Common::String::format("%d", data.friendliesEncountered), 278, 144, 0, kHypnoColorWhiteOrBlue);
+	drawString("scifi08.fgx", Common::String::format("%d", data.infoReceived), 278, 159, 0, kHypnoColorWhiteOrBlue);
+	uint32 scorePercentage = (killRatio + accuracyRatio) / 2;
+	drawString("scifi08.fgx", Common::String::format("%d%%", scorePercentage), 278, 184, 0, kHypnoColorWhiteOrBlue);
+
+	bool cont = true;
+	while (!shouldQuit() && cont) {
+		Common::Event event;
+		while (g_system->getEventManager()->pollEvent(event)) {
+			switch (event.type) {
+				case Common::EVENT_KEYDOWN:
+				cont = false;
+				break;
+				default:
+				break;
+			}
+		}
+		drawScreen();
+		g_system->delayMillis(10);
+	}
+}
+
 void BoyzEngine::pressedKey(const int keycode) {
 	if (keycode == Common::KEYCODE_c) {
 		if (_cheatsEnabled) {
diff --git a/engines/hypno/hypno.h b/engines/hypno/hypno.h
index 73ab1495425..10a9f32065b 100644
--- a/engines/hypno/hypno.h
+++ b/engines/hypno/hypno.h
@@ -560,6 +560,8 @@ public:
 	bool shoot(const Common::Point &mousePos, ArcadeShooting *arc, bool secondary) override;
 	bool clickedSecondaryShoot(const Common::Point &mousePos) override;
 	void showCredits() override;
+	// Stats
+	void showArcadeStats(int territory, const ArcadeStats &data);
 	ArcadeStats _lastStats;
 	ArcadeStats _globalStats;
 


Commit: 1ffae9b411eb891f5afb0243d3bc2eb1a541ce9d
    https://github.com/scummvm/scummvm/commit/1ffae9b411eb891f5afb0243d3bc2eb1a541ce9d
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-06-19T11:24:44+02:00

Commit Message:
HYPNO: improved friendlies encounters counting in boyz

Changed paths:
    engines/hypno/boyz/arcade.cpp


diff --git a/engines/hypno/boyz/arcade.cpp b/engines/hypno/boyz/arcade.cpp
index 3476ec05531..58032c7916a 100644
--- a/engines/hypno/boyz/arcade.cpp
+++ b/engines/hypno/boyz/arcade.cpp
@@ -580,9 +580,9 @@ bool BoyzEngine::shoot(const Common::Point &mousePos, ArcadeShooting *arc, bool
 				playSound(_soundPath + _shoots[i].animalSound, 1);
 				return false;
 			}
-			incFriendliesEncountered();
 
 			if (!_shoots[i].additionalVideo.empty()) {
+				incFriendliesEncountered();
 				incInfoReceived();
 				_background->decoder->pauseVideo(true);
 				MVideo video(_shoots[i].additionalVideo, Common::Point(0, 0), false, true, false);
@@ -615,6 +615,7 @@ bool BoyzEngine::shoot(const Common::Point &mousePos, ArcadeShooting *arc, bool
 						playSound(_music, 0, _musicRate, _musicStereo); // restore music
 				}
 			} else if (_shoots[i].interactionFrame > 0) {
+				incFriendliesEncountered();
 				incInfoReceived();
 				_background->decoder->forceSeekToFrame(_shoots[i].interactionFrame);
 				_masks->decoder->forceSeekToFrame(_shoots[i].interactionFrame);
@@ -632,7 +633,9 @@ bool BoyzEngine::shoot(const Common::Point &mousePos, ArcadeShooting *arc, bool
 			if (checkCup(_shoots[i].name))
 				return false;
 
-			incFriendliesEncountered();
+			if (!_shoots[i].additionalVideo.empty() || _shoots[i].interactionFrame > 0) // Only count the ones with info
+				incFriendliesEncountered();
+
 			uint32 idx = _shoots[i].warningVideoIdx;
 			if (idx > 0) {
 				Common::String filename = _warningVideosDay[idx];
@@ -726,7 +729,8 @@ void BoyzEngine::missedTarget(Shoot *s, ArcadeShooting *arc) {
 	}
 
 	if (s->nonHostile) {
-		incFriendliesEncountered();
+		if (!s->additionalVideo.empty() || s->interactionFrame > 0) // Only count the ones with info
+			incFriendliesEncountered();
 		_stats.targetsMissed--; // If the target was not hostile, it should *not* count as missed
 	}
 


Commit: b4bd99aac4d07a8dd837ec8e98c453e2ba193ae8
    https://github.com/scummvm/scummvm/commit/b4bd99aac4d07a8dd837ec8e98c453e2ba193ae8
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-06-19T11:24:44+02:00

Commit Message:
HYPNO: fix crash when shooting a botle in boyz

Changed paths:
    engines/hypno/boyz/arcade.cpp


diff --git a/engines/hypno/boyz/arcade.cpp b/engines/hypno/boyz/arcade.cpp
index 58032c7916a..42d48f532df 100644
--- a/engines/hypno/boyz/arcade.cpp
+++ b/engines/hypno/boyz/arcade.cpp
@@ -654,6 +654,9 @@ bool BoyzEngine::shoot(const Common::Point &mousePos, ArcadeShooting *arc, bool
 
 				hitPlayer();
 			}
+			if (_shoots[i].explosionFrames.size() == 0)
+				return false;
+
 			debugC(1, kHypnoDebugArcade, "Jumping to %d", _shoots[i].explosionFrames[0].start - 3);
 			_background->decoder->forceSeekToFrame(_shoots[i].explosionFrames[0].start - 3);
 			_masks->decoder->forceSeekToFrame(_shoots[i].explosionFrames[0].start - 3);


Commit: 950ad44748dcc84e3cb25b09d4593c95d5054783
    https://github.com/scummvm/scummvm/commit/950ad44748dcc84e3cb25b09d4593c95d5054783
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-06-19T11:24:44+02:00

Commit Message:
HYPNO: added missing sounds when shooting non-hostiles in boyz

Changed paths:
    engines/hypno/boyz/arcade.cpp


diff --git a/engines/hypno/boyz/arcade.cpp b/engines/hypno/boyz/arcade.cpp
index 42d48f532df..6328091fe86 100644
--- a/engines/hypno/boyz/arcade.cpp
+++ b/engines/hypno/boyz/arcade.cpp
@@ -633,6 +633,12 @@ bool BoyzEngine::shoot(const Common::Point &mousePos, ArcadeShooting *arc, bool
 			if (checkCup(_shoots[i].name))
 				return false;
 
+			if (!_shoots[i].hitSound.empty())
+				playSound(_soundPath + _shoots[i].hitSound, 1);
+
+			if (!_shoots[i].deathSound.empty())
+				playSound(_soundPath + _shoots[i].deathSound, 1);
+
 			if (!_shoots[i].additionalVideo.empty() || _shoots[i].interactionFrame > 0) // Only count the ones with info
 				incFriendliesEncountered();
 




More information about the Scummvm-git-logs mailing list