[Scummvm-git-logs] scummvm master -> 6e01e7603b219aa52ba77eb2772c55467aed3267

mgerhardy martin.gerhardy at gmail.com
Tue Mar 2 16:54:33 UTC 2021


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

Summary:
b813ad1c07 TWINE: flag the game demo with ADGF_DEMO
7176f94aac TWINE: put scene names into the savegames
a2cdb8fb3a TWINE: put the scene location name into the savegame header
64f70759cc TWINE: perform the entry amount calculation independently of the real Location struct size
9a9e26cc82 TWINE: replaced copyText with Common::strlcpy
89f0b55648 TWINE: use the translated scene names
0de7b47ad2 TWINE: support the demo scenes
9fd3ad17e3 TWINE: some holomap checks
6e01e7603b TWINE: corrected angle in Collision::checkCollisionWithActors


Commit: b813ad1c071e1f2fd3fe0ba23e49f482a44b2dc4
    https://github.com/scummvm/scummvm/commit/b813ad1c071e1f2fd3fe0ba23e49f482a44b2dc4
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-02T08:17:28+01:00

Commit Message:
TWINE: flag the game demo with ADGF_DEMO

Changed paths:
    engines/twine/detection.cpp
    engines/twine/twine.h


diff --git a/engines/twine/detection.cpp b/engines/twine/detection.cpp
index 56a896bf20..872f90e77f 100644
--- a/engines/twine/detection.cpp
+++ b/engines/twine/detection.cpp
@@ -64,7 +64,7 @@ static const ADGameDescription twineGameDescriptions[] = {
 		AD_ENTRY1s("RELENT.EXE", "c1a887e38283d43f271249ad9f2a73ef", 245961),
 		Common::EN_ANY,
 		Common::kPlatformDOS,
-		ADGF_TESTING,
+		ADGF_TESTING | ADGF_DEMO,
 		GUIO1(GUIO_NONE)
 	},
 	{
@@ -73,7 +73,7 @@ static const ADGameDescription twineGameDescriptions[] = {
 		AD_ENTRY1s("RELENT.EXE", "c1a887e38283d43f271249ad9f2a73ef", 245961),
 		Common::FR_FRA,
 		Common::kPlatformDOS,
-		ADGF_TESTING,
+		ADGF_TESTING | ADGF_DEMO,
 		GUIO1(GUIO_NONE)
 	},
 	{
@@ -82,7 +82,7 @@ static const ADGameDescription twineGameDescriptions[] = {
 		AD_ENTRY1s("RELENT.EXE", "c1a887e38283d43f271249ad9f2a73ef", 245961),
 		Common::DE_DEU,
 		Common::kPlatformDOS,
-		ADGF_TESTING,
+		ADGF_TESTING | ADGF_DEMO,
 		GUIO1(GUIO_NONE)
 	},
 	{
@@ -91,7 +91,7 @@ static const ADGameDescription twineGameDescriptions[] = {
 		AD_ENTRY1s("RELENT.EXE", "c1a887e38283d43f271249ad9f2a73ef", 245961),
 		Common::IT_ITA,
 		Common::kPlatformDOS,
-		ADGF_TESTING,
+		ADGF_TESTING | ADGF_DEMO,
 		GUIO1(GUIO_NONE)
 	},
 	{
@@ -100,7 +100,7 @@ static const ADGameDescription twineGameDescriptions[] = {
 		AD_ENTRY1s("RELENT.EXE", "c1a887e38283d43f271249ad9f2a73ef", 245961),
 		Common::ES_ESP,
 		Common::kPlatformDOS,
-		ADGF_TESTING,
+		ADGF_TESTING | ADGF_DEMO,
 		GUIO1(GUIO_NONE)
 	},
 
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index 9d39c1c1e1..690ac686dc 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -26,15 +26,16 @@
 #include "backends/keymapper/keymap.h"
 #include "common/random.h"
 #include "common/rect.h"
+#include "engines/advancedDetector.h"
 #include "engines/engine.h"
 
+#include "engines/metaengine.h"
 #include "graphics/managed_surface.h"
 #include "graphics/pixelformat.h"
 #include "graphics/surface.h"
-#include "engines/metaengine.h"
-#include "twine/scene/actor.h"
-#include "twine/input.h"
 #include "twine/detection.h"
+#include "twine/input.h"
+#include "twine/scene/actor.h"
 
 namespace TwinE {
 
@@ -154,14 +155,14 @@ enum class EngineState {
 };
 
 struct ScopedEngineFreeze {
-	TwinEEngine* _engine;
-	ScopedEngineFreeze(TwinEEngine* engine);
+	TwinEEngine *_engine;
+	ScopedEngineFreeze(TwinEEngine *engine);
 	~ScopedEngineFreeze();
 };
 
 struct ScopedCursor {
-	TwinEEngine* _engine;
-	ScopedCursor(TwinEEngine* engine);
+	TwinEEngine *_engine;
+	ScopedCursor(TwinEEngine *engine);
 	~ScopedCursor();
 };
 
@@ -226,6 +227,7 @@ public:
 
 	bool isLBA1() const { return _gameType == TwineGameType::GType_LBA; }
 	bool isLBA2() const { return _gameType == TwineGameType::GType_LBA2; }
+	bool isDemo() const { return (_gameFlags & ADGF_DEMO) != 0; };
 	const char *getGameId() const;
 
 	bool unlockAchievement(const Common::String &id);


Commit: 7176f94aac083b01799ada5ec8e3651f45feb9e0
    https://github.com/scummvm/scummvm/commit/7176f94aac083b01799ada5ec8e3651f45feb9e0
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T19:03:27+01:00

Commit Message:
TWINE: put scene names into the savegames

Changed paths:
    engines/twine/holomap.cpp
    engines/twine/holomap.h
    engines/twine/resources/resources.cpp


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 519ee8851a..86ff02ae83 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -61,11 +61,19 @@ bool Holomap::loadLocations() {
 		return false;
 	}
 
+	debug(2, "Holomap locations: %i", _numLocations);
+
+	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
 	for (int32 i = 0; i < _numLocations; i++) {
 		_locations[i].x = ClampAngle(stream.readSint16LE());
 		_locations[i].y = ClampAngle(stream.readSint16LE());
 		_locations[i].z = ClampAngle(stream.readSint16LE());
 		_locations[i].textIndex = stream.readUint16LE();
+		if (_engine->_text->getMenuText(_locations[i].textIndex, _locations[i].name, sizeof(_locations[i].name))) {
+			debug(2, "scene %i: %s", i, _locations[i].name);
+			continue;
+		}
+		debug("Could not get location text for index %i", i);
 	}
 	return true;
 }
diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index 067da99ad2..8e28f07bc3 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -50,6 +50,7 @@ private:
 		uint16 y = 0;
 		uint16 z = 0;
 		uint16 textIndex = 0;
+		char name[30] = "";
 	};
 
 	enum HolomapVehicle {
@@ -146,6 +147,8 @@ public:
 
 	bool loadLocations();
 
+	const char *getLocationName(int index) const;
+
 	/**
 	 * Clear Holomap location position
 	 * @param locationIdx Scene where position must be cleared
@@ -161,6 +164,11 @@ public:
 	void processHolomap();
 };
 
+inline const char *Holomap::getLocationName(int index) const {
+	assert(index >= 0 && index <= ARRAYSIZE(_locations));
+	return _locations[index].name;
+}
+
 } // namespace TwinE
 
 #endif
diff --git a/engines/twine/resources/resources.cpp b/engines/twine/resources/resources.cpp
index 10fcba71ec..b4b9ea9090 100644
--- a/engines/twine/resources/resources.cpp
+++ b/engines/twine/resources/resources.cpp
@@ -129,7 +129,7 @@ void Resources::preloadSamples() {
 		}
 		// Fix incorrect sample files first byte
 		if (*samplesTable[i] != 'C') {
-			debug("Sample %i has incorrect magic id", i);
+			debug("Sample %i has incorrect magic id (size: %u)", i, samplesSizeTable[i]);
 			*samplesTable[i] = 'C';
 		}
 	}


Commit: a2cdb8fb3a227dcd370523c2d14cb4d941eceec7
    https://github.com/scummvm/scummvm/commit/a2cdb8fb3a227dcd370523c2d14cb4d941eceec7
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T19:12:53+01:00

Commit Message:
TWINE: put the scene location name into the savegame header

Changed paths:
    engines/twine/holomap.cpp
    engines/twine/resources/resources.h
    engines/twine/scene/gamestate.h
    engines/twine/scene/scene.cpp
    engines/twine/twine.cpp


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 86ff02ae83..519ee8851a 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -61,19 +61,11 @@ bool Holomap::loadLocations() {
 		return false;
 	}
 
-	debug(2, "Holomap locations: %i", _numLocations);
-
-	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
 	for (int32 i = 0; i < _numLocations; i++) {
 		_locations[i].x = ClampAngle(stream.readSint16LE());
 		_locations[i].y = ClampAngle(stream.readSint16LE());
 		_locations[i].z = ClampAngle(stream.readSint16LE());
 		_locations[i].textIndex = stream.readUint16LE();
-		if (_engine->_text->getMenuText(_locations[i].textIndex, _locations[i].name, sizeof(_locations[i].name))) {
-			debug(2, "scene %i: %s", i, _locations[i].name);
-			continue;
-		}
-		debug("Could not get location text for index %i", i);
 	}
 	return true;
 }
diff --git a/engines/twine/resources/resources.h b/engines/twine/resources/resources.h
index 96992cf85d..d152470b0f 100644
--- a/engines/twine/resources/resources.h
+++ b/engines/twine/resources/resources.h
@@ -28,6 +28,7 @@
 #include "twine/parser/sprite.h"
 #include "twine/scene/gamestate.h"
 #include "twine/resources/hqr.h"
+#include "twine/scene/scene.h"
 
 namespace TwinE {
 
diff --git a/engines/twine/scene/gamestate.h b/engines/twine/scene/gamestate.h
index 5887eb1295..5db7b4374c 100644
--- a/engines/twine/scene/gamestate.h
+++ b/engines/twine/scene/gamestate.h
@@ -211,6 +211,7 @@ public:
 	uint8 holomapFlags[NUM_LOCATIONS]; // GV14
 
 	char playerName[30];
+	const char *sceneName = "";
 
 	int32 gameChoices[10];  // inGameMenuData
 	int32 numChoices = 0;   // numOfOptionsInChoice
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index 5465d3d989..408d5981a4 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -457,12 +457,141 @@ void Scene::changeScene() {
 	if (needChangeScene == LBA1SceneId::Citadel_Island_near_twinsens_house && _engine->_gameState->hasOpenedFunfrocksSafe()) {
 		needChangeScene = LBA1SceneId::Citadel_Island_Twinsens_house_destroyed;
 	}
-	debug(2, "Change scene to %i (currently in %i)", needChangeScene, currentSceneIdx);
 
 	// local backup previous scene
 	previousSceneIdx = currentSceneIdx;
 	currentSceneIdx = needChangeScene;
 
+	if (_engine->isLBA1()) {
+		static const char *sceneNames[] = {
+			"Citadel Island Prison",
+			"Citadel Island outside the citadel",
+			"Citadel Island near the tavern",
+			"Citadel Island near the pharmacy",
+			"Citadel Island near twinsens house",
+			"Citadel Island inside Twinsens house",
+			"Citadel Island Harbor",
+			"Citadel Island Pharmacy",
+			"White Leaf Desert Temple of Bu 1st scene",
+			"Hamalayi Mountains landing place",
+			"Principal Island Library",
+			"Principal Island Harbor",
+			"Principal Island outside the fortress",
+			"Principal Island Old Burg",
+			"Citadel Island Tavern",
+			"Hamalayi Mountains Rabbibunny village",
+			"Citadel Island inside a Rabbibunny house",
+			"Principal Island Ruins",
+			"Principal Island outside the library",
+			"Principal Island Militairy camp",
+			"Citadel Island Architects house",
+			"Citadel Island secret chamber in the house",
+			"Principal Island Ticket office",
+			"Principal Island Prison",
+			"Principal Island Port Belooga",
+			"Principal Island Peg Leg Street",
+			"Principal Island Shop",
+			"Principal Island Locksmith",
+			"Principal Island inside a Rabbibunny house",
+			"Principal Island Astronimers House",
+			"Principal Island Tavern",
+			"Principal Island Basement of the Astronomer",
+			"Principal Island Stables",
+			"Citadel Island Cellar of the Tavern",
+			"Citadel Island Sewer of the 1st scene",
+			"Citadel Island Warehouse",
+			"White Leaf Desert outside the Temple of Bu",
+			"Principal Island outside the water tower",
+			"Principal Island inside the water tower",
+			"White Leaf Desert Militairy camp",
+			"White Leaf Desert Temple of Bu 2nd scene",
+			"White Leaf Desert Temple of Bu 3rd scene",
+			"Proxima Island Proxim City",
+			"Proxima Island Museum",
+			"Proxima Island near the Inventors house",
+			"Proxima Island upper rune stone",
+			"Proxima Island lower rune stone",
+			"Proxima Island befor the upper rune stone",
+			"Proxima Island Forgers house",
+			"Proxima Island Prison",
+			"Proxima Island Shop",
+			"Proxima Island Sewer",
+			"Principal Island house at Peg Leg Street",
+			"Proxima Island Grobo house",
+			"Proxima Island Inventors house",
+			"Citadel Island Sewer secret",
+			"Principal Island Sewer secret",
+			"White Leaf Desert Maze",
+			"Principal Island House with the TV",
+			"Rebelion Island Harbor",
+			"Rebelion Island Rebel camp",
+			"Some room cut out",
+			"Hamalayi Mountains 1st fighting scene",
+			"Hamalayi Mountains 2nd fighting scene",
+			"Hamalayi Mountains Prison",
+			"Hamalayi Mountains outside the transporter",
+			"Hamalayi Mountains inside the transporter",
+			"Hamalayi Mountains Mutation centre 1st scene",
+			"Hamalayi Mountains Mutation centre 2nd scene",
+			"Hamalayi Mountains 3rd fighting scene",
+			"Hamalayi Mountains Entrance to the prison",
+			"Hamalayi Mountains outside the prison",
+			"Hamalayi Mountains Catamaran dock",
+			"Hamalayi Mountains Bunker near clear water",
+			"Tippet Island Village",
+			"Tippet Island Secret passage scene 2",
+			"Tippet Island near the bar",
+			"Tippet Island Secret passage scene 1",
+			"Tippet Island near the Dino Fly",
+			"Tippet Island Secret passage scene 3",
+			"Tippet Island Twinsun Cafe",
+			"Hamalayi Mountains Sacret Carrot",
+			"Hamalayi Mountains Backdoor of the prison",
+			"Fortress Island inside the fortress",
+			"Fortress Island outside the forstress",
+			"Fortress Island Secret passage scene 1",
+			"Fortress Island Secret in the fortress",
+			"Fortress Island near Zoes cell",
+			"Fortress Island Swimming pool",
+			"Fortress Island Cloning centre",
+			"Fortress Island Rune stone",
+			"Hamalayi Mountains Behind the sacret carrot",
+			"Hamalayi Mountains Clear water lake",
+			"Fortress Island outside fortress destroyed",
+			"Brundle Island outside the teleportation",
+			"Brundle Island inside the teleportation",
+			"Hamalayi Mountains Ski resort",
+			"Brundle Island Docks",
+			"Brundle Island Secret room",
+			"Brundle Island near the telepods",
+			"Fortress Island Docks",
+			"Tippet Island Shop",
+			"Principal Island house in port Belooga",
+			"Brundle Island Painters house",
+			"Citadel Island Ticket Office",
+			"Principal Island inside the fortress",
+			"Polar Island 2nd scene",
+			"Polar Island 3rd scene",
+			"Polar Island Before the rocky peak",
+			"Polar Island 4th scene",
+			"Polar Island The rocky peak",
+			"Polar Island on the rocky peak",
+			"Polar Island Before the end room",
+			"Polar Island Final Battle",
+			"Polar Island end scene",
+			"Polar Island 1st scene",
+			"Citadel Island end sequence 1",
+			"Citadel Island end sequence 2",
+			"Citadel Island Twinsens house destroyed",
+			"Credits List Sequence"
+		};
+		static_assert(ARRAYSIZE(sceneNames) == LBA1SceneId::SceneIdMax, "Unexpected scene name size");
+		assert(currentSceneIdx >= LBA1SceneId::Citadel_Island_Prison && currentSceneIdx < LBA1SceneId::SceneIdMax);
+		_engine->_gameState->sceneName = sceneNames[currentSceneIdx];
+		debug("Entering scene %s", _engine->_gameState->sceneName);
+	}
+	debug(2, "Change scene to %i (currently in %i)", needChangeScene, currentSceneIdx);
+
 	if (needChangeScene == LBA1SceneId::Polar_Island_end_scene) {
 		_engine->unlockAchievement("LBA_ACH_001");
 		// TODO: if you finish in under 4 hours - unlock the achievement - see version 4 savegames
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 8cf7d2135c..92de108ff8 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -352,8 +352,8 @@ Common::Error TwinEEngine::saveGameStream(Common::WriteStream *stream, bool isAu
 }
 
 void TwinEEngine::autoSave() {
-	// TODO: scene title, not player name
-	saveGameState(getAutosaveSlot(), _gameState->playerName, true);
+	debug("Autosave %s", _gameState->sceneName);
+	saveGameState(getAutosaveSlot(), _gameState->sceneName, true);
 }
 
 void TwinEEngine::allocVideoMemory(int32 w, int32 h) {


Commit: 64f70759cca11138383ceb53ec232b84239a888e
    https://github.com/scummvm/scummvm/commit/64f70759cca11138383ceb53ec232b84239a888e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T19:17:58+01:00

Commit Message:
TWINE: perform the entry amount calculation independently of the real Location struct size

Changed paths:
    engines/twine/holomap.cpp


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 519ee8851a..4ef78a8ac1 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -55,7 +55,7 @@ bool Holomap::loadLocations() {
 	}
 
 	Common::MemoryReadStream stream(locationsPtr, locationsSize, DisposeAfterUse::YES);
-	_numLocations = locationsSize / sizeof(Location);
+	_numLocations = locationsSize / 8;
 	if (_numLocations > NUM_LOCATIONS) {
 		warning("Amount of locations (%i) exceeds the maximum of %i", _numLocations, NUM_LOCATIONS);
 		return false;


Commit: 9a9e26cc826a3adb5ca8549495605054729f7f6d
    https://github.com/scummvm/scummvm/commit/9a9e26cc826a3adb5ca8549495605054729f7f6d
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T19:28:12+01:00

Commit Message:
TWINE: replaced copyText with Common::strlcpy

Changed paths:
    engines/twine/text.cpp
    engines/twine/text.h


diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index a6a347adb5..ac0917d183 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -725,12 +725,6 @@ bool Text::getText(int32 index) {
 	return true;
 }
 
-void Text::copyText(const char *src, char *dst, int32 size) {
-	for (int32 i = 0; i < size; i++) {
-		*(dst++) = *(src++);
-	}
-}
-
 bool Text::getMenuText(int32 index, char *text, uint32 textSize) {
 	if (index == currMenuTextIndex) {
 		if (currMenuTextBank == _engine->_scene->sceneTextBank) {
@@ -748,9 +742,9 @@ bool Text::getMenuText(int32 index, char *text, uint32 textSize) {
 		_currDialTextSize = 0xFF;
 	}
 
-	copyText(_currDialTextPtr, text, _currDialTextSize);
+	Common::strlcpy(text, _currDialTextPtr, MIN<int32>(textSize, _currDialTextSize + 1));
 	_currDialTextSize++;
-	copyText(text, currMenuTextBuffer, _currDialTextSize);
+	Common::strlcpy(currMenuTextBuffer, text, MIN<int32>(sizeof(currMenuTextBuffer), _currDialTextSize));
 
 	currMenuTextIndex = index;
 	currMenuTextBank = _engine->_scene->sceneTextBank;
diff --git a/engines/twine/text.h b/engines/twine/text.h
index 08f79de891..957c69d057 100644
--- a/engines/twine/text.h
+++ b/engines/twine/text.h
@@ -168,13 +168,6 @@ private:
 	 * @param counter The amount of characters to handle - max 32
 	 */
 	void fadeInCharacters(int32 counter, int32 fontColor);
-	/**
-	 * Copy dialogue text
-	 * @param src source text buffer
-	 * @param dst destination text buffer
-	 * @param size text size
-	 */
-	void copyText(const char *src, char *dst, int32 size);
 
 	// RECHECK THIS LATER
 	int32 currentBankIdx = TextBankId::None; // textVar1


Commit: 89f0b556487bea642a2ff7ededaa30a9facfe5d4
    https://github.com/scummvm/scummvm/commit/89f0b556487bea642a2ff7ededaa30a9facfe5d4
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T19:54:30+01:00

Commit Message:
TWINE: use the translated scene names

Some scenes have duplicate names - so we can't distinguish between
all of them. But that's imo fine if we get the names into the
savegames. I've therefore added the scene number into the description
text.

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


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 4ef78a8ac1..4664f1bc12 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -61,11 +61,18 @@ bool Holomap::loadLocations() {
 		return false;
 	}
 
+	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
 	for (int32 i = 0; i < _numLocations; i++) {
 		_locations[i].x = ClampAngle(stream.readSint16LE());
 		_locations[i].y = ClampAngle(stream.readSint16LE());
 		_locations[i].z = ClampAngle(stream.readSint16LE());
 		_locations[i].textIndex = stream.readUint16LE();
+
+		if (_engine->_text->getMenuText(_locations[i].textIndex, _locations[i].name, sizeof(_locations[i].name))) {
+			debug(2, "Scene %i: %s", i, _locations[i].name);
+			continue;
+		}
+		debug(2, "Could not get location text for index %i", i);
 	}
 	return true;
 }
diff --git a/engines/twine/scene/gamestate.h b/engines/twine/scene/gamestate.h
index 5db7b4374c..b7f9fc5641 100644
--- a/engines/twine/scene/gamestate.h
+++ b/engines/twine/scene/gamestate.h
@@ -210,8 +210,8 @@ public:
 
 	uint8 holomapFlags[NUM_LOCATIONS]; // GV14
 
-	char playerName[30];
-	const char *sceneName = "";
+	char playerName[30] {};
+	char sceneName[30] {};
 
 	int32 gameChoices[10];  // inGameMenuData
 	int32 numChoices = 0;   // numOfOptionsInChoice
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index 408d5981a4..d6cfffcdd1 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -462,135 +462,13 @@ void Scene::changeScene() {
 	previousSceneIdx = currentSceneIdx;
 	currentSceneIdx = needChangeScene;
 
-	if (_engine->isLBA1()) {
-		static const char *sceneNames[] = {
-			"Citadel Island Prison",
-			"Citadel Island outside the citadel",
-			"Citadel Island near the tavern",
-			"Citadel Island near the pharmacy",
-			"Citadel Island near twinsens house",
-			"Citadel Island inside Twinsens house",
-			"Citadel Island Harbor",
-			"Citadel Island Pharmacy",
-			"White Leaf Desert Temple of Bu 1st scene",
-			"Hamalayi Mountains landing place",
-			"Principal Island Library",
-			"Principal Island Harbor",
-			"Principal Island outside the fortress",
-			"Principal Island Old Burg",
-			"Citadel Island Tavern",
-			"Hamalayi Mountains Rabbibunny village",
-			"Citadel Island inside a Rabbibunny house",
-			"Principal Island Ruins",
-			"Principal Island outside the library",
-			"Principal Island Militairy camp",
-			"Citadel Island Architects house",
-			"Citadel Island secret chamber in the house",
-			"Principal Island Ticket office",
-			"Principal Island Prison",
-			"Principal Island Port Belooga",
-			"Principal Island Peg Leg Street",
-			"Principal Island Shop",
-			"Principal Island Locksmith",
-			"Principal Island inside a Rabbibunny house",
-			"Principal Island Astronimers House",
-			"Principal Island Tavern",
-			"Principal Island Basement of the Astronomer",
-			"Principal Island Stables",
-			"Citadel Island Cellar of the Tavern",
-			"Citadel Island Sewer of the 1st scene",
-			"Citadel Island Warehouse",
-			"White Leaf Desert outside the Temple of Bu",
-			"Principal Island outside the water tower",
-			"Principal Island inside the water tower",
-			"White Leaf Desert Militairy camp",
-			"White Leaf Desert Temple of Bu 2nd scene",
-			"White Leaf Desert Temple of Bu 3rd scene",
-			"Proxima Island Proxim City",
-			"Proxima Island Museum",
-			"Proxima Island near the Inventors house",
-			"Proxima Island upper rune stone",
-			"Proxima Island lower rune stone",
-			"Proxima Island befor the upper rune stone",
-			"Proxima Island Forgers house",
-			"Proxima Island Prison",
-			"Proxima Island Shop",
-			"Proxima Island Sewer",
-			"Principal Island house at Peg Leg Street",
-			"Proxima Island Grobo house",
-			"Proxima Island Inventors house",
-			"Citadel Island Sewer secret",
-			"Principal Island Sewer secret",
-			"White Leaf Desert Maze",
-			"Principal Island House with the TV",
-			"Rebelion Island Harbor",
-			"Rebelion Island Rebel camp",
-			"Some room cut out",
-			"Hamalayi Mountains 1st fighting scene",
-			"Hamalayi Mountains 2nd fighting scene",
-			"Hamalayi Mountains Prison",
-			"Hamalayi Mountains outside the transporter",
-			"Hamalayi Mountains inside the transporter",
-			"Hamalayi Mountains Mutation centre 1st scene",
-			"Hamalayi Mountains Mutation centre 2nd scene",
-			"Hamalayi Mountains 3rd fighting scene",
-			"Hamalayi Mountains Entrance to the prison",
-			"Hamalayi Mountains outside the prison",
-			"Hamalayi Mountains Catamaran dock",
-			"Hamalayi Mountains Bunker near clear water",
-			"Tippet Island Village",
-			"Tippet Island Secret passage scene 2",
-			"Tippet Island near the bar",
-			"Tippet Island Secret passage scene 1",
-			"Tippet Island near the Dino Fly",
-			"Tippet Island Secret passage scene 3",
-			"Tippet Island Twinsun Cafe",
-			"Hamalayi Mountains Sacret Carrot",
-			"Hamalayi Mountains Backdoor of the prison",
-			"Fortress Island inside the fortress",
-			"Fortress Island outside the forstress",
-			"Fortress Island Secret passage scene 1",
-			"Fortress Island Secret in the fortress",
-			"Fortress Island near Zoes cell",
-			"Fortress Island Swimming pool",
-			"Fortress Island Cloning centre",
-			"Fortress Island Rune stone",
-			"Hamalayi Mountains Behind the sacret carrot",
-			"Hamalayi Mountains Clear water lake",
-			"Fortress Island outside fortress destroyed",
-			"Brundle Island outside the teleportation",
-			"Brundle Island inside the teleportation",
-			"Hamalayi Mountains Ski resort",
-			"Brundle Island Docks",
-			"Brundle Island Secret room",
-			"Brundle Island near the telepods",
-			"Fortress Island Docks",
-			"Tippet Island Shop",
-			"Principal Island house in port Belooga",
-			"Brundle Island Painters house",
-			"Citadel Island Ticket Office",
-			"Principal Island inside the fortress",
-			"Polar Island 2nd scene",
-			"Polar Island 3rd scene",
-			"Polar Island Before the rocky peak",
-			"Polar Island 4th scene",
-			"Polar Island The rocky peak",
-			"Polar Island on the rocky peak",
-			"Polar Island Before the end room",
-			"Polar Island Final Battle",
-			"Polar Island end scene",
-			"Polar Island 1st scene",
-			"Citadel Island end sequence 1",
-			"Citadel Island end sequence 2",
-			"Citadel Island Twinsens house destroyed",
-			"Credits List Sequence"
-		};
-		static_assert(ARRAYSIZE(sceneNames) == LBA1SceneId::SceneIdMax, "Unexpected scene name size");
-		assert(currentSceneIdx >= LBA1SceneId::Citadel_Island_Prison && currentSceneIdx < LBA1SceneId::SceneIdMax);
-		_engine->_gameState->sceneName = sceneNames[currentSceneIdx];
-		debug("Entering scene %s", _engine->_gameState->sceneName);
-	}
-	debug(2, "Change scene to %i (currently in %i)", needChangeScene, currentSceneIdx);
+	if (_engine->isLBA1() && currentSceneIdx >= LBA1SceneId::Citadel_Island_Prison && currentSceneIdx < LBA1SceneId::SceneIdMax) {
+		snprintf(_engine->_gameState->sceneName, sizeof(_engine->_gameState->sceneName), "%i %s", currentSceneIdx, _engine->_holomap->getLocationName(currentSceneIdx));
+	} else {
+		const char *pName = _engine->_gameState->playerName;
+		snprintf(_engine->_gameState->sceneName, sizeof(_engine->_gameState->sceneName), "%i %s", currentSceneIdx, pName);
+	}
+	debug(2, "Entering scene %s (came from %i)", _engine->_gameState->sceneName, previousSceneIdx);
 
 	if (needChangeScene == LBA1SceneId::Polar_Island_end_scene) {
 		_engine->unlockAchievement("LBA_ACH_001");


Commit: 0de7b47ad266171f5322e7d1f9203d9325bdeb6d
    https://github.com/scummvm/scummvm/commit/0de7b47ad266171f5322e7d1f9203d9325bdeb6d
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T19:43:46+01:00

Commit Message:
TWINE: support the demo scenes

without this the player just enters a black scene and is falling all the time

Changed paths:
    engines/twine/twine.cpp


diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 92de108ff8..42b823aa12 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -699,6 +699,12 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
 	}
 
 	if (_scene->needChangeScene > -1) {
+		if (isDemo() && isLBA1()) {
+			// the demo only has these two scenes
+			if (_scene->needChangeScene != LBA1SceneId::Citadel_Island_Prison && _scene->needChangeScene != LBA1SceneId::Citadel_Island_outside_the_citadel) {
+				return 1;
+			}
+		}
 		_scene->changeScene();
 	}
 


Commit: 9fd3ad17e3e08bae0171adf23dfb6b4ab9fb5911
    https://github.com/scummvm/scummvm/commit/9fd3ad17e3e08bae0171adf23dfb6b4ab9fb5911
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T19:54:06+01:00

Commit Message:
TWINE: some holomap checks

Changed paths:
    engines/twine/holomap.cpp


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 4664f1bc12..01a9a5b901 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -121,9 +121,9 @@ void Holomap::prepareHolomapSurface() {
 	Common::MemoryReadStream stream(_engine->_resources->holomapSurfacePtr, _engine->_resources->holomapSurfaceSize);
 	int holomapSurfaceArrayIdx = 0;
 	_engine->_renderer->setBaseRotation(0, 0, 0);
-	for (int32 angle = -ANGLE_90; angle <= ANGLE_90; angle += ANGLE_11_25) {
+	for (int angle = -ANGLE_90; angle <= ANGLE_90; angle += ANGLE_11_25) {
 		int rotation = 0;
-		for (int32 stepWidth = ANGLE_11_25; stepWidth != 0; --stepWidth) {
+		for (int i = 0; i <= ANGLE_11_25; ++i, rotation += ANGLE_11_25) {
 			const int32 rotX = stream.readByte();
 			_engine->_movements->rotateActor(rotX * 2 + 1000, 0, angle);
 			const int32 tmpDestY = _engine->_renderer->destPos.z;
@@ -133,26 +133,16 @@ void Holomap::prepareHolomapSurface() {
 			_holomapSurface[holomapSurfaceArrayIdx].y = _engine->_renderer->destPos.y;
 			_holomapSurface[holomapSurfaceArrayIdx].z = _engine->_renderer->destPos.z;
 			++holomapSurfaceArrayIdx;
-			rotation += ANGLE_11_25;
 		}
-		const int32 rotX = stream.readByte();
-		_engine->_movements->rotateActor(rotX * 2 + 1000, 0, angle);
-		const int32 tmpDestY = _engine->_renderer->destPos.z;
-		_engine->_movements->rotateActor(_engine->_renderer->destPos.x, 0, ANGLE_0);
-		_engine->_renderer->getBaseRotationPosition(_engine->_renderer->destPos.x, tmpDestY, _engine->_renderer->destPos.z);
-		_holomapSurface[holomapSurfaceArrayIdx].x = _engine->_renderer->destPos.x;
-		_holomapSurface[holomapSurfaceArrayIdx].y = _engine->_renderer->destPos.y;
-		_holomapSurface[holomapSurfaceArrayIdx].z = _engine->_renderer->destPos.z;
-		++holomapSurfaceArrayIdx;
 	}
+	assert(stream.eos());
 }
 
 void Holomap::prepareHolomapProjectedPositions() {
-	Common::MemoryReadStream stream(_engine->_resources->holomapSurfacePtr, _engine->_resources->holomapSurfaceSize);
 	int projectedIndex = 0;
 	for (int32 angle = -ANGLE_90; angle <= ANGLE_90; angle += ANGLE_11_25) {
 		int rotation = 0;
-		for (int32 stepWidth = ANGLE_11_25; stepWidth != 0; --stepWidth) {
+		for (int32 i = 0; i < ANGLE_11_25; ++i) {
 			_projectedSurfacePositions[projectedIndex].unk1 = _engine->_screens->crossDot(0, 0xffff, ANGLE_360 - 1, rotation);
 			if (angle == ANGLE_90) {
 				_projectedSurfacePositions[projectedIndex].unk2 = 0xffff;
@@ -173,7 +163,6 @@ void Holomap::prepareHolomapProjectedPositions() {
 }
 
 void Holomap::prepareHolomapPolygons() {
-	Common::MemoryReadStream stream(_engine->_resources->holomapSurfacePtr, _engine->_resources->holomapSurfaceSize);
 	int holomapSortArrayIdx = 0;
 	int holomapSurfaceArrayIdx = 0;
 	_projectedSurfaceIndex = 0;


Commit: 6e01e7603b219aa52ba77eb2772c55467aed3267
    https://github.com/scummvm/scummvm/commit/6e01e7603b219aa52ba77eb2772c55467aed3267
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-02T17:53:56+01:00

Commit Message:
TWINE: corrected angle in Collision::checkCollisionWithActors

according to disassembly

Changed paths:
    engines/twine/scene/collision.cpp


diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index b69165f8e7..baac84b29e 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -370,7 +370,7 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
 				const int32 zRightTest = actorTest->pos.z + actorTest->boudingBox.z.topRight;
 
 				if (xLeft < xRightTest && xRight > xLeftTest && yLeft < yRightTest && yRight > yLeftTest && zLeft < zRightTest && zRight > zLeftTest) {
-					_engine->_actor->hitActor(actorIdx, a, actor->strengthOfHit, actor->angle + ANGLE_90);
+					_engine->_actor->hitActor(actorIdx, a, actor->strengthOfHit, actor->angle + ANGLE_180);
 					actor->dynamicFlags.bIsHitting = 0;
 				}
 			}




More information about the Scummvm-git-logs mailing list