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

bluegr bluegr at gmail.com
Sat Aug 17 20:57:50 CEST 2019


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

Summary:
1641bd3a61 STARTREK: Allow lowercase for mission names in console commands
d74060e17a STARTREK: Load all kinds of messages, and remove redundant variables
62d1dbac65 STARTREK: More explicit definition of text types
ef71ebda4d STARTREK: Read TUG0 description messages from the respective RDF file


Commit: 1641bd3a61d5869a409d2594399782231b57795a
    https://github.com/scummvm/scummvm/commit/1641bd3a61d5869a409d2594399782231b57795a
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-08-17T21:56:11+03:00

Commit Message:
STARTREK: Allow lowercase for mission names in console commands

Changed paths:
    engines/startrek/console.cpp


diff --git a/engines/startrek/console.cpp b/engines/startrek/console.cpp
index 816b5ce..471294f 100644
--- a/engines/startrek/console.cpp
+++ b/engines/startrek/console.cpp
@@ -44,6 +44,7 @@ bool Console::Cmd_Room(int argc, const char **argv) {
 	}
 
 	_vm->_missionToLoad = argv[1];
+	_vm->_missionToLoad.toUppercase();
 	_vm->_roomIndexToLoad = atoi(argv[2]);
 	_vm->runAwayMission();
 
@@ -55,6 +56,7 @@ bool Console::Cmd_Actions(int argc, const char **argv) {
 
 	if (argc == 3) {
 		Common::String missionName = argv[1];
+		missionName.toUppercase();
 		int roomIndex = atoi(argv[2]);
 
 		screenName = missionName + (char)(roomIndex + '0');


Commit: d74060e17a19f01ea78e71f794b2ddc8f3b7b277
    https://github.com/scummvm/scummvm/commit/d74060e17a19f01ea78e71f794b2ddc8f3b7b277
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-08-17T21:56:12+03:00

Commit Message:
STARTREK: Load all kinds of messages, and remove redundant variables

Changed paths:
    engines/startrek/room.cpp
    engines/startrek/room.h
    engines/startrek/rooms/mudda.cpp


diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp
index 567cbe5..08609c5 100644
--- a/engines/startrek/room.cpp
+++ b/engines/startrek/room.cpp
@@ -52,9 +52,6 @@ Room::Room(StarTrekEngine *vm, const Common::String &name) : _vm(vm), _awayMissi
 	rdfFile->read(_rdfData, size);
 	delete rdfFile;
 
-	_rdfName = name;
-	_roomIndex = name.lastChar() - '0';
-
 	_roomActionList = nullptr;
 
 	ADD_ROOM_OLD(demon0);
@@ -133,7 +130,7 @@ void Room::loadRoomMessages() {
 	const char *text = (const char *)_rdfData + messagesOffset;
 
 	do {
-		while (*text != '#')
+		while (text[0] != '#' || text[1] != _vm->_missionName[0])
 			text++;
 
 		if (text[5] == '\\')
@@ -174,62 +171,22 @@ void Room::loadRoomMessage(const char *text) {
 
 }
 
-// HACK: We hardcode the other room messages here. Remove once we figure
-// how these are indexed
 void Room::loadOtherRoomMessages() {
-	int *offsets = nullptr;
-
-	if (_rdfName == "DEMON0") {
-		int o[] = { 0x1d9, 0x422, 0x48f, 0x4d1, 0x536, 0x578, -1 };
-		offsets = o;
-	} else if (_rdfName == "DEMON1") {
-		int o[] = {
-			0x5d4, 0x716, 0x791, 0x7ec, 0x99e, 0xa06, 0xa51, 0xa96, 0xacc, 0xb5a,
-			0xb87, 0xc46, 0xcd5, 0xd82, 0xe55, 0x107e, 0x1186, 0x11d1, 0x1216, 0x1271,
-			0x12a4, 0x12f3, 0x1335, 0x1371, 0x13b4, 0x1419, 0x1467, 0x14b2, 0x14fd, -1
-		};
-		offsets = o;
-	} else if (_rdfName == "DEMON2") {
-		int o[] = {
-			0x165, 0x195, 0x1c6, 0x1f7, 0x24a, 0x27d, 0x2c6, 0x311, 0x41a, 0x489,
-			0x538, 0x5ba, 0x64d, 0x74d, 0x7ab, 0x817, 0x8a4, 0x950, 0x9e1, -1
-		};
-		offsets = o;
-	} else if (_rdfName == "DEMON3") {
-		int o[] = {
-			0x662, 0x6d3, 0x7a5, 0xa19, 0xa9a, 0xbd7, 0xc30, 0xcfe, 0xe13, 0xed2,
-			0x104e, 0x118e, 0x1248, 0x12a4, 0x12f4, 0x1383, 0x13d5, 0x1443, 0x14b1,
-			0x1522, 0x15ab, 0x15f5, 0x1648, 0x16ad, -1
-		};
-		offsets = o;
-	} else if (_rdfName == "DEMON4") {
-		int o[] = {
-			0x254, 0x2f3, 0x392, 0x41f, 0x642, 0x7b3, 0xa6a, 0xb34, 0xba4, 0xc7b,
-			-1
-		};
-		offsets = o;
-	} else if (_rdfName == "DEMON5") {
-		int o[] = {
-			0x27c, 0x2e7, 0x387, 0x438, 0x483, 0x4de, 0x58f, 0x5e2, 0x61f, 0x713,
-			0x783, 0x812, 0x8af, 0x904, 0x95e, 0x9b8, 0xb7e, 0xccc, -1
-		};
-		offsets = o;
-	} else if (_rdfName == "DEMON6") {
-		int o[] = {
-			0x265, 0x2cb, 0x40c, 0x473, 0x52a, 0x5cd, 0x697, 0x6e5, 0x787, 0x97b,
-			0x9f5, 0xa5f, 0xb7e, 0xbf1, 0xca7, 0xe54, 0xee4,
-			-1
-		};
-		offsets = o;
-	}
+	uint16 startOffset = readRdfWord(14);
+	uint16 endOffset = readRdfWord(16);
+	uint16 offset = startOffset;
 
-	if (offsets == nullptr)
-		return;
+	while (offset < endOffset) {
+		uint16 nextOffset = readRdfWord(offset + 4);
+		if (nextOffset >= endOffset)
+			break;
+
+		while (offset < nextOffset) {
+			if (*(_rdfData + offset) == 0xeb && *(_rdfData + offset + 2) == '#')
+				loadRoomMessage((const char *)_rdfData + offset + 2);
 
-	int i = 0;
-	while (offsets[i] != -1) {
-		loadRoomMessage((const char *)_rdfData + offsets[i]);
-		i++;
+			offset++;
+		}
 	}
 }
 
diff --git a/engines/startrek/room.h b/engines/startrek/room.h
index 54db694..47a778f 100644
--- a/engines/startrek/room.h
+++ b/engines/startrek/room.h
@@ -153,8 +153,6 @@ private:
 	const RoomAction *_roomActionList;
 	int _numRoomActions;
 
-	Common::String _rdfName;
-	int _roomIndex; // ie. for DEMON2, this is 2
 	Common::HashMap<int, Common::String> _lookMessages;
 	Common::HashMap<int, Common::String> _lookWithTalkerMessages;
 	Common::HashMap<int, Common::String> _talkMessages;
diff --git a/engines/startrek/rooms/mudda.cpp b/engines/startrek/rooms/mudda.cpp
index 9c0f11e..20389ea 100644
--- a/engines/startrek/rooms/mudda.cpp
+++ b/engines/startrek/rooms/mudda.cpp
@@ -20,6 +20,7 @@
  *
  */
 
+#include "startrek/startrek.h"
 #include "startrek/room.h"
 
 namespace StarTrek {
@@ -28,7 +29,7 @@ namespace StarTrek {
 // mission, despite being mostly the same.
 
 void Room::muddaUseLenseOnDegrimer() {
-	assert(_roomIndex >= 0 && _roomIndex <= 5);
+	assert(_vm->_roomIndex >= 0 && _vm->_roomIndex <= 5);
 
 	const TextRef text[] = {
 		TX_MUD0N011, // All of these audio files are identical, but there's one for each room.
@@ -44,12 +45,12 @@ void Room::muddaUseLenseOnDegrimer() {
 	loseItem(OBJECT_ILENSES);
 
 	_awayMission->mudd.missionScore++;
-	showDescription(text[_roomIndex]);
+	showDescription(text[_vm->_roomIndex]);
 }
 
 
 void Room::muddaUseAlienDevice() {
-	assert(_roomIndex >= 0 && _roomIndex <= 5);
+	assert(_vm->_roomIndex >= 0 && _vm->_roomIndex <= 5);
 
 	const int deviceObjectIndices[] = { // Each room's object index for the explosion is different
 		9,  // MUDD0
@@ -65,12 +66,12 @@ void Room::muddaUseAlienDevice() {
 	_awayMission->crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_S;
 	loadActorStandAnim(OBJECT_KIRK);
 	Common::Point pos = getActorPos(OBJECT_KIRK);
-	loadActorAnimC(deviceObjectIndices[_roomIndex], "s4cbxp", pos.x, 10, &Room::muddaFiredAlienDevice);
+	loadActorAnimC(deviceObjectIndices[_vm->_roomIndex], "s4cbxp", pos.x, 10, &Room::muddaFiredAlienDevice);
 	playVoc("EXPLO3");
 }
 
 void Room::muddaFiredAlienDevice() {
-	assert(_roomIndex >= 0 && _roomIndex <= 5);
+	assert(_vm->_roomIndex >= 0 && _vm->_roomIndex <= 5);
 
 	const TextRef text[] = {
 		TX_MUD0_002, // These audio files aren't identical, but the text is mostly the same.
@@ -85,13 +86,13 @@ void Room::muddaFiredAlienDevice() {
 	if (!_awayMission->mudd.discoveredLenseAndDegrimerFunction) {
 		_awayMission->mudd.discoveredLenseAndDegrimerFunction = true;
 		_awayMission->mudd.missionScore += 5; // BUGFIX: didn't happen if done in MUDD5
-		showText(TX_SPEAKER_KIRK, text[_roomIndex]);
+		showText(TX_SPEAKER_KIRK, text[_vm->_roomIndex]);
 	}
 }
 
 
 void Room::muddaUseDegrimer() {
-	assert(_roomIndex >= 0 && _roomIndex <= 5);
+	assert(_vm->_roomIndex >= 0 && _vm->_roomIndex <= 5);
 
 	const TextRef text[] = {
 		TX_MUD0N002, // All of these audio files are identical, but there's one for each room.
@@ -102,7 +103,7 @@ void Room::muddaUseDegrimer() {
 		TX_MUD5N001,
 	};
 
-	showDescription(text[_roomIndex]);
+	showDescription(text[_vm->_roomIndex]);
 }
 
 void Room::muddaTick() {
@@ -114,7 +115,7 @@ void Room::muddaTick() {
 	// To simplify things, and since it makes more sense, now they'll just collapse on the
 	// spot instead.
 
-	assert(_roomIndex >= 0 && _roomIndex <= 5);
+	assert(_vm->_roomIndex >= 0 && _vm->_roomIndex <= 5);
 
 	/*
 	// Unused: The positions to they originally walked to before collapsing.
@@ -172,10 +173,10 @@ void Room::muddaTick() {
 
 			for (int i = OBJECT_KIRK; i <= OBJECT_REDSHIRT; i++) {
 				Common::String anim = getCrewmanAnimFilename(i, "getd");
-				anim += directions[i][_roomIndex];
+				anim += directions[i][_vm->_roomIndex];
 				loadActorAnim2(i, anim);
 			}
-			showDescription(deathText[_roomIndex]);
+			showDescription(deathText[_vm->_roomIndex]);
 			showGameOverMenu();
 		}
 	}


Commit: 62d1dbac659213b17d16764f31bf3a1124027284
    https://github.com/scummvm/scummvm/commit/62d1dbac659213b17d16764f31bf3a1124027284
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-08-17T21:56:13+03:00

Commit Message:
STARTREK: More explicit definition of text types

Changed paths:
    engines/startrek/room.cpp


diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp
index 08609c5..5cc913a 100644
--- a/engines/startrek/room.cpp
+++ b/engines/startrek/room.cpp
@@ -151,12 +151,13 @@ void Room::loadRoomMessage(const char *text) {
 	int messageNum;
 	bool isTalkMessage;
 	bool isLookWithTalkerMessage;
+	char textType = text[10];	// _ and U: talk message, N: look message, L: look with talker message
 
 	if (text[5] != '\\')
 		error("loadRoomMessage: Invalid message");
 
-	isTalkMessage = (text[10] == '_' || text[10] == 'U');	// U = Uhura
-	isLookWithTalkerMessage = (text[10] == 'L');
+	isTalkMessage = (textType == '_' || textType == 'U');	// U = Uhura
+	isLookWithTalkerMessage = (textType == 'L');
 
 	sscanf((const char *)(text + 11), "%3d", &messageNum);
 	if (text[14] != '#')


Commit: ef71ebda4d06fb872d1eef4ed17e3ecd74526b21
    https://github.com/scummvm/scummvm/commit/ef71ebda4d06fb872d1eef4ed17e3ecd74526b21
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-08-17T21:56:14+03:00

Commit Message:
STARTREK: Read TUG0 description messages from the respective RDF file

Changed paths:
    engines/startrek/rooms/tug0.cpp
    engines/startrek/text.cpp
    engines/startrek/text.h


diff --git a/engines/startrek/rooms/tug0.cpp b/engines/startrek/rooms/tug0.cpp
index 7c31e8d..0ae7f52 100644
--- a/engines/startrek/rooms/tug0.cpp
+++ b/engines/startrek/rooms/tug0.cpp
@@ -48,9 +48,9 @@ void Room::tug0Tick1() {
 
 void Room::tug0LookAtEngineer() {
 	if (_awayMission->tug.engineerConscious)
-		showDescription(TX_TUG0N002);
+		showDescription(2, true);
 	else
-		showDescription(TX_TUG0N014);
+		showDescription(14, true);
 }
 
 void Room::tug0GetEngineer() {
@@ -59,9 +59,9 @@ void Room::tug0GetEngineer() {
 
 void Room::tug0LookAtControls() {
 	if (_awayMission->tug.transporterRepaired)
-		showDescription(TX_TUG0N012);
+		showDescription(12, true);
 	else
-		showDescription(TX_TUG0N001);
+		showDescription(1, true);
 }
 
 void Room::tug0UseSpockOnControls() {
@@ -208,15 +208,15 @@ void Room::tug0KirkGotTransmogrifier() {
 
 void Room::tug0LookAtToolbox() {
 	if (_awayMission->tug.gotTransmogrifier)
-		showDescription(TX_TUG0N008);
+		showDescription(8, true);
 	else
-		showDescription(TX_TUG0N000);
+		showDescription(0, true);
 }
 
 void Room::tug0UsePhaserOnWelder() {
 	loseItem(OBJECT_IPWE);
 	giveItem(OBJECT_IPWF);
-	showDescription(TX_TUG0N006);
+	showDescription(6, true);
 
 	// BUGFIX: this following line didn't exist, despite it existing in TUG1; meaning this
 	// was supposed to give points, but it only did in a specific room.
@@ -224,7 +224,7 @@ void Room::tug0UsePhaserOnWelder() {
 }
 
 void Room::tug0UseWelderOnWireScraps() {
-	showDescription(TX_TUG0N010);
+	showDescription(10, true);
 	loseItem(OBJECT_IWIRSCRP);
 }
 
@@ -387,27 +387,27 @@ void Room::tug0WalkToDoor() {
 }
 
 void Room::tug0LookAtKirk() {
-	showDescription(TX_TUG0N003);
+	showDescription(3, true);
 }
 
 void Room::tug0LookAtSpock() {
-	showDescription(TX_TUG0N007);
+	showDescription(7, true);
 }
 
 void Room::tug0LookAtMccoy() {
-	showDescription(TX_TUG0N005);
+	showDescription(5, true);
 }
 
 void Room::tug0LookAtRedshirt() {
-	showDescription(TX_TUG0N004);
+	showDescription(4, true);
 }
 
 void Room::tug0LookAtTransporter() {
-	showDescription(TX_TUG0N013);
+	showDescription(13, true);
 }
 
 void Room::tug0LookAtDoor() {
-	showDescription(TX_TUG0N011);
+	showDescription(11, true);
 }
 
 void Room::tug0TalkToKirk() {
@@ -444,7 +444,7 @@ void Room::tug0UseCommunicator() {
 }
 
 void Room::tug0LookAnywhere() {
-	showDescription(TX_TUG0N009);
+	showDescription(9, true);
 }
 
 void Room::tug0UseSTricorderAnywhere() {
diff --git a/engines/startrek/text.cpp b/engines/startrek/text.cpp
index 92dfe24..f1bb2d9 100644
--- a/engines/startrek/text.cpp
+++ b/engines/startrek/text.cpp
@@ -159,22 +159,6 @@ extern const char *const g_gameStrings[] = {
 	"#TUG0\\TUG0L008#If we could get past the forcefield on the door of the bridge, we should be able to surprise them for sure.",
 	"#TUG0\\TUG0L009#Security analysis, sir: if we transport onto the bridge, we'll have the drop on them -- assuming Mr. Spock has the transporter working porperly.",
 	"#TUG0\\TUG0L010#Since we have a bomb, Captain, we could rearm it, transport it onto the bridge, and perhaps the Elasi will flee into the hallway. Then we could capture them.",
-	"#TUG0\\TUG0N000#A Runcinate Transmogrifier: An engineering tool used in the maintainance of transporters, which can be fitted with bits having a variety of irregularly serrated surfaces.",
-	"#TUG0\\TUG0N001#A small bomb appears to have damaged the transporter controls.",
-	"#TUG0\\TUG0N002#Crewman Simpson.",
-	"#TUG0\\TUG0N003#James T. Kirk cautiously watches the area.",
-	"#TUG0\\TUG0N004#Lieutenant Christensen stands ready.",
-	"#TUG0\\TUG0N005#McCoy wonders how many patients he'll have on this mission.",
-	"#TUG0\\TUG0N006#Phaser Welder is now charged.",
-	"#TUG0\\TUG0N007#Spock quietly analyzes the damaged areas of this transporter room.",
-	"#TUG0\\TUG0N008#The cabinet is empty.",
-	"#TUG0\\TUG0N009#The transporter bay has been damaged in a recent fire fight.",
-	"#TUG0\\TUG0N010#The wire scraps are too small, they melt instead of fusing together, and you're left with nothing. ",
-	"#TUG0\\TUG0N011#These doors have been scarred by phaser fire. There was a battle here.",
-	"#TUG0\\TUG0N012#These transporter controls are now operational. They are set for just inside the bridge door.",
-	"#TUG0\\TUG0N013#This is the main transporter pad of the Masada.",
-	"#TUG0\\TUG0N014#This man was obviously the transporter engineer. He is unconscious, but alive.",
-
 
 	"#TUG1\\TUG1_001#This is a mess now, isn't it?",
 	"#TUG1\\TUG1_002#A forcefield of unusual configurations has been erected in front of the doorway which leads into the bridge. I don't think it would be healthy to approach too closely, Captain.",
diff --git a/engines/startrek/text.h b/engines/startrek/text.h
index 0270934..150ae51 100644
--- a/engines/startrek/text.h
+++ b/engines/startrek/text.h
@@ -218,22 +218,6 @@ enum GameStringIDs {
 	TX_TUG0L008,
 	TX_TUG0L009,
 	TX_TUG0L010,
-	TX_TUG0N000,
-	TX_TUG0N001,
-	TX_TUG0N002,
-	TX_TUG0N003,
-	TX_TUG0N004,
-	TX_TUG0N005,
-	TX_TUG0N006,
-	TX_TUG0N007,
-	TX_TUG0N008,
-	TX_TUG0N009,
-	TX_TUG0N010,
-	TX_TUG0N011,
-	TX_TUG0N012,
-	TX_TUG0N013,
-	TX_TUG0N014,
-
 
 	TX_TUG1_001,
 	TX_TUG1_002,





More information about the Scummvm-git-logs mailing list