[Scummvm-git-logs] scummvm master -> b46ba41d7c6291f947a6da34136644d324780048

neuromancer noreply at scummvm.org
Fri Nov 25 19:24:11 UTC 2022


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

Summary:
6031c0d2d7 FREESCAPE: select the specific color for special effect when taking damage from a sensor in driller
1dfe03343e FREESCAPE: refactor flash related code into flashScreen function
b46ba41d7c FREESCAPE: avoid crashing if the color used in the flash effect is invalid


Commit: 6031c0d2d712c8061ccd53f64b4fe1e4d691a59a
    https://github.com/scummvm/scummvm/commit/6031c0d2d712c8061ccd53f64b4fe1e4d691a59a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-25T20:25:11+01:00

Commit Message:
FREESCAPE: select the specific color for special effect when taking damage from a sensor in driller

Changed paths:
    engines/freescape/freescape.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 76a5bbef52c..ce41731b279 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -247,8 +247,11 @@ void FreescapeEngine::drawSensorShoot(Sensor *sensor) {
 
 void FreescapeEngine::takeDamageFromSensor() {
 	_gameStateVars[k8bitVariableShield]--;
-	_currentArea->remapColor(_currentArea->_usualBackgroundColor, _currentArea->_underFireBackgroundColor);
-	_currentArea->remapColor(_currentArea->_skyColor, _currentArea->_underFireBackgroundColor);
+	int underFireColor = isDriller() && (_renderMode == Common::kRenderEGA) ? 1
+						: _currentArea->_underFireBackgroundColor;
+
+	_currentArea->remapColor(_currentArea->_usualBackgroundColor, underFireColor);
+	_currentArea->remapColor(_currentArea->_skyColor, underFireColor);
 	drawFrame();
 	_gfx->flipBuffer();
 	g_system->updateScreen();


Commit: 1dfe03343e703a1da97c98527554f5881e7770d4
    https://github.com/scummvm/scummvm/commit/1dfe03343e703a1da97c98527554f5881e7770d4
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-25T20:25:11+01:00

Commit Message:
FREESCAPE: refactor flash related code into flashScreen function

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/language/instruction.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index ce41731b279..2f19649831c 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -245,13 +245,9 @@ void FreescapeEngine::drawSensorShoot(Sensor *sensor) {
 	_gfx->renderSensorShoot(1, sensor->getOrigin(), _viewArea);
 }
 
-void FreescapeEngine::takeDamageFromSensor() {
-	_gameStateVars[k8bitVariableShield]--;
-	int underFireColor = isDriller() && (_renderMode == Common::kRenderEGA) ? 1
-						: _currentArea->_underFireBackgroundColor;
-
-	_currentArea->remapColor(_currentArea->_usualBackgroundColor, underFireColor);
-	_currentArea->remapColor(_currentArea->_skyColor, underFireColor);
+void FreescapeEngine::flashScreen(int backgroundColor) {
+	_currentArea->remapColor(_currentArea->_usualBackgroundColor, backgroundColor);
+	_currentArea->remapColor(_currentArea->_skyColor, backgroundColor);
 	drawFrame();
 	_gfx->flipBuffer();
 	g_system->updateScreen();
@@ -259,6 +255,13 @@ void FreescapeEngine::takeDamageFromSensor() {
 	_currentArea->unremapColor(_currentArea->_skyColor);
 }
 
+void FreescapeEngine::takeDamageFromSensor() {
+	_gameStateVars[k8bitVariableShield]--;
+	int underFireColor = isDriller() && (_renderMode == Common::kRenderEGA) ? 1
+						: _currentArea->_underFireBackgroundColor;
+	flashScreen(underFireColor);
+}
+
 void FreescapeEngine::drawBackground() {
 	_gfx->setViewport(_fullscreenViewArea);
 	_gfx->clear(_currentArea->_usualBackgroundColor);
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index ea77651b648..5786b62cc82 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -272,6 +272,7 @@ public:
 	Common::RenderMode _renderMode;
 	ColorMap _colorMap;
 	void drawFrame();
+	void flashScreen(int backgroundColor);
 	uint8 _colorNumber;
 	Math::Vector3d _scaleVector;
 	float _nearClipPlane;
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 637e8c068e8..0132c5caf2b 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -212,10 +212,6 @@ void FreescapeEngine::executeSPFX(FCLInstruction &instruction) {
 
 	debugC(1, kFreescapeDebugCode, "Switching palette from position %d to %d", index, color);
 	_currentArea->remapColor(index, color);
-	drawFrame();
-	_gfx->flipBuffer();
-	g_system->updateScreen();
-	g_system->delayMillis(10);
 }
 
 
@@ -267,6 +263,9 @@ void FreescapeEngine::executeIncrementVariable(FCLInstruction &instruction) {
 		else if (_gameStateVars[variable] < 0)
 			_gameStateVars[variable] = 0;
 
+		if (increment < 0)
+			flashScreen(_currentArea->_underFireBackgroundColor);
+
 		debugC(1, kFreescapeDebugCode, "Shield incremented by %d up to %d", increment, _gameStateVars[variable]);
 		break;
 	default:


Commit: b46ba41d7c6291f947a6da34136644d324780048
    https://github.com/scummvm/scummvm/commit/b46ba41d7c6291f947a6da34136644d324780048
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-25T20:25:11+01:00

Commit Message:
FREESCAPE: avoid crashing if the color used in the flash effect is invalid

Changed paths:
    engines/freescape/freescape.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 2f19649831c..f05fca4d716 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -246,6 +246,8 @@ void FreescapeEngine::drawSensorShoot(Sensor *sensor) {
 }
 
 void FreescapeEngine::flashScreen(int backgroundColor) {
+	if (backgroundColor >= 16)
+		return;
 	_currentArea->remapColor(_currentArea->_usualBackgroundColor, backgroundColor);
 	_currentArea->remapColor(_currentArea->_skyColor, backgroundColor);
 	drawFrame();




More information about the Scummvm-git-logs mailing list