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

mgerhardy martin.gerhardy at gmail.com
Mon Jul 19 19:23:26 UTC 2021


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:
e2277af3fb TWINE: replaced magic numbers for holomap flags
f0b35f0393 TWINE: minor cleanup


Commit: e2277af3fbcb6b4da110cacad2fa18b0fed5d8f3
    https://github.com/scummvm/scummvm/commit/e2277af3fbcb6b4da110cacad2fa18b0fed5d8f3
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-07-19T21:15:45+02:00

Commit Message:
TWINE: replaced magic numbers for holomap flags

Changed paths:
    engines/twine/holomap.cpp
    engines/twine/renderer/renderer.cpp


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 9d1f31920c..72babf7572 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -45,6 +45,17 @@
 
 namespace TwinE {
 
+#define HOLOMAP_ARROW		(1 << 0)
+#define HOLOMAP_VISITED		(1 << 1)
+#define HOLOMAP_UNK3		(1 << 2)
+#define HOLOMAP_UNK4		(1 << 3)
+#define HOLOMAP_UNK5		(1 << 4)
+#define HOLOMAP_UNK6		(1 << 5)
+#define HOLOMAP_UNK7		(1 << 6)
+#define HOLOMAP_CAN_FOCUS	(1 << 7)
+#define HOLOMAP_RESET		(HOLOMAP_VISITED | HOLOMAP_UNK3 | HOLOMAP_UNK4 | HOLOMAP_UNK5 | HOLOMAP_UNK6 | HOLOMAP_UNK7)
+#define HOLOMAP_ACTIVE		(HOLOMAP_CAN_FOCUS | HOLOMAP_ARROW)
+
 Holomap::Holomap(TwinEEngine *engine) : _engine(engine) {}
 
 bool Holomap::loadLocations() {
@@ -80,7 +91,7 @@ bool Holomap::loadLocations() {
 
 void Holomap::setHolomapPosition(int32 locationIdx) {
 	assert(locationIdx >= 0 && locationIdx <= ARRAYSIZE(_engine->_gameState->holomapFlags));
-	_engine->_gameState->holomapFlags[locationIdx] = 0x81;
+	_engine->_gameState->holomapFlags[locationIdx] = HOLOMAP_ACTIVE;
 	if (_engine->_gameState->hasItem(InventoryItems::kiHolomap)) {
 		_engine->_redraw->addOverlay(OverlayType::koInventoryItem, InventoryItems::kiHolomap, 0, 0, 0, OverlayPosType::koNormal, 3);
 	}
@@ -88,8 +99,8 @@ void Holomap::setHolomapPosition(int32 locationIdx) {
 
 void Holomap::clearHolomapPosition(int32 locationIdx) {
 	assert(locationIdx >= 0 && locationIdx <= ARRAYSIZE(_engine->_gameState->holomapFlags));
-	_engine->_gameState->holomapFlags[locationIdx] &= 0x7E;
-	_engine->_gameState->holomapFlags[locationIdx] |= 0x40;
+	_engine->_gameState->holomapFlags[locationIdx] &= HOLOMAP_RESET;
+	_engine->_gameState->holomapFlags[locationIdx] |= HOLOMAP_UNK7;
 }
 
 void Holomap::loadHolomapGFX() {
@@ -387,7 +398,7 @@ int32 Holomap::getNextHolomapLocation(int32 currentLocation, int32 dir) const {
 		i %= NUM_LOCATIONS;
 	}
 	for (; i != idx; i = (i + dir) % NUM_LOCATIONS) {
-		if (_engine->_gameState->holomapFlags[i] & 0x81) {
+		if (_engine->_gameState->holomapFlags[i] & HOLOMAP_ACTIVE) {
 			return i;
 		}
 	}
@@ -397,7 +408,7 @@ int32 Holomap::getNextHolomapLocation(int32 currentLocation, int32 dir) const {
 void Holomap::renderLocations(int xRot, int yRot, int zRot, bool lower) {
 	int n = 0;
 	for (int locationIdx = 0; locationIdx < NUM_LOCATIONS; ++locationIdx) {
-		if ((_engine->_gameState->holomapFlags[locationIdx] & 0x80) || locationIdx == _engine->_scene->currentSceneIdx) {
+		if ((_engine->_gameState->holomapFlags[locationIdx] & HOLOMAP_CAN_FOCUS) || locationIdx == _engine->_scene->currentSceneIdx) {
 			const Location &loc = _locations[locationIdx];
 			_engine->_renderer->setBaseRotation(loc.angle.x, loc.angle.y, 0);
 			_engine->_renderer->getBaseRotationPosition(0, 0, loc.angle.z + 1000);
@@ -425,7 +436,7 @@ void Holomap::renderLocations(int xRot, int yRot, int zRot, bool lower) {
 					continue;
 				}
 			}
-			uint8 flags = _engine->_gameState->holomapFlags[locationIdx] & 1;
+			uint8 flags = _engine->_gameState->holomapFlags[locationIdx] & HOLOMAP_ARROW;
 			if (locationIdx == _engine->_scene->currentSceneIdx) {
 				flags |= 2u; // model type
 			}
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index ad37fcdc4e..2fb39be1f4 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -84,7 +84,6 @@ void Renderer::projectXYPositionOnScreen(int32 x, int32 y, int32 z) {
 	}
 	projPos.x = 0;
 	projPos.y = 0;
-	return;
 }
 
 int32 Renderer::projectPositionOnScreen(int32 cX, int32 cY, int32 cZ) {


Commit: f0b35f039305eeb3c4898b0b4d9af409b283475b
    https://github.com/scummvm/scummvm/commit/f0b35f039305eeb3c4898b0b4d9af409b283475b
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-07-19T21:21:40+02:00

Commit Message:
TWINE: minor cleanup

Changed paths:
    engines/twine/scene/actor.h
    engines/twine/scene/gamestate.cpp


diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 448e6f441d..e6a2e80186 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -190,7 +190,7 @@ public:
 	int32 strengthOfHit = 0; // field_66
 	int32 hitBy = 0;
 	BonusParameter bonusParameter; // field_10
-	int32 angle = 0;
+	int32 angle = 0; // facing angle of actor. Minumum is 0 (SW). Going counter clock wise
 	int32 speed = 0;
 	ControlMode controlMode = ControlMode::kNoMove;
 	int32 delayInMillis = 0;
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 08ef0051c5..de6a8a1e25 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -274,7 +274,6 @@ bool GameState::saveGame(Common::WriteStream *file) {
 	file->write(inventoryFlags, NUM_INVENTORY_ITEMS);
 
 	file->writeByte(inventoryNumLeafs);
-	// TODO: writeUInt16LE in disassembly
 	file->writeByte(usingSabre ? 1 : 0);
 	file->writeByte(0);
 
@@ -285,19 +284,16 @@ void GameState::setGameFlag(uint8 index, uint8 value) {
 	debug(2, "Set gameStateFlags[%u]=%u", index, value);
 	_gameStateFlags[index] = value;
 
-	// all 4 slap videos
 	if ((index == GAMEFLAG_VIDEO_BAFFE || index == GAMEFLAG_VIDEO_BAFFE2 || index == GAMEFLAG_VIDEO_BAFFE3 || index == GAMEFLAG_VIDEO_BAFFE5) &&
 		_gameStateFlags[GAMEFLAG_VIDEO_BAFFE] != 0 && _gameStateFlags[GAMEFLAG_VIDEO_BAFFE2] != 0 && _gameStateFlags[GAMEFLAG_VIDEO_BAFFE3] != 0 && _gameStateFlags[GAMEFLAG_VIDEO_BAFFE5] != 0) {
+		// all 4 slap videos
 		_engine->unlockAchievement("LBA_ACH_012");
-	}
-	// second video of ferry trip
-	if (index == GAMEFLAG_VIDEO_BATEAU2) {
+	} else if (index == GAMEFLAG_VIDEO_BATEAU2) {
+		// second video of ferry trip
 		_engine->unlockAchievement("LBA_ACH_010");
-	}
-	if (index == (uint8)InventoryItems::kiUseSabre) {
+	} else if (index == (uint8)InventoryItems::kiUseSabre) {
 		_engine->unlockAchievement("LBA_ACH_002");
-	}
-	if (index == (uint8)InventoryItems::kBottleOfSyrup) {
+	} else if (index == (uint8)InventoryItems::kBottleOfSyrup) {
 		_engine->unlockAchievement("LBA_ACH_007");
 	}
 }




More information about the Scummvm-git-logs mailing list