[Scummvm-git-logs] scummvm master -> 768af02f57c588051eaa687ee14f706f9c7cdb14

neuromancer noreply at scummvm.org
Sat Mar 30 18:20:22 UTC 2024


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

Summary:
768af02f57 FREESCAPE: small delay triggering of script execution when shooting


Commit: 768af02f57c588051eaa687ee14f706f9c7cdb14
    https://github.com/scummvm/scummvm/commit/768af02f57c588051eaa687ee14f706f9c7cdb14
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-30T19:19:00+01:00

Commit Message:
FREESCAPE: small delay triggering of script execution when shooting

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/movement.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 28b93fb3068..123a4cf44e7 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -164,6 +164,7 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
 
 	_underFireFrames = 0;
 	_shootingFrames = 0;
+	_delayedShootObject = nullptr;
 	_avoidRenderingFrames = 0;
 	_endGamePlayerEndArea = false;
 	_endGameKeyPressed = false;
@@ -678,6 +679,14 @@ Common::Error FreescapeEngine::run() {
 		checkSensors();
 		drawFrame();
 
+		if (_shootingFrames == 0) {
+			if (_delayedShootObject) {
+				executeObjectConditions(_delayedShootObject, true, false, false);
+				executeLocalGlobalConditions(true, false, false); // Only execute "on shot" room/global conditions
+				_delayedShootObject = nullptr;
+			}
+		}
+
 		_gfx->flipBuffer();
 		_frameLimiter->delayBeforeSwap();
 		g_system->updateScreen();
@@ -693,6 +702,8 @@ Common::Error FreescapeEngine::run() {
 }
 
 void FreescapeEngine::endGame() {
+	_shootingFrames = 0;
+	_delayedShootObject = nullptr;
 	if (_gameStateControl == kFreescapeGameStateEnd && !isPlayingSound() && !_endGamePlayerEndArea) {
 		_endGamePlayerEndArea = true;
 		gotoArea(_endArea, _endEntrance);
@@ -820,6 +831,7 @@ void FreescapeEngine::initGameState() {
 	_noClipMode = false;
 	_playerWasCrushed = false;
 	_shootingFrames = 0;
+	_delayedShootObject = nullptr;
 	_underFireFrames = 0;
 	_avoidRenderingFrames = 0;
 	_yaw = 0;
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index b5780255a12..5fdc1442973 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -402,6 +402,7 @@ public:
 	int _underFireFrames;
 	int _avoidRenderingFrames;
 	int _shootingFrames;
+	GeometricObject *_delayedShootObject;
 	void drawFrame();
 	void flashScreen(int backgroundColor);
 	uint8 _colorNumber;
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 641accc7812..fdde8ecd6c7 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -184,6 +184,9 @@ void FreescapeEngine::activate() {
 
 
 void FreescapeEngine::shoot() {
+	if (_shootingFrames > 0) // No more than one shot at a time
+		return;
+
 	if (isDriller())
 		playSound(1, false);
 	else if (isSpectrum()) {
@@ -215,7 +218,7 @@ void FreescapeEngine::shoot() {
 		if (!gobj->_conditionSource.empty())
 			debugC(1, kFreescapeDebugMove, "Must use shot = true when executing: %s", gobj->_conditionSource.c_str());
 
-		executeObjectConditions(gobj, true, false, false);
+		_delayedShootObject = gobj;
 	}
 	executeLocalGlobalConditions(true, false, false); // Only execute "on shot" room/global conditions
 }




More information about the Scummvm-git-logs mailing list