aboutsummaryrefslogtreecommitdiff
path: root/engines/startrek
diff options
context:
space:
mode:
authorFilippos Karapetis2019-08-18 15:29:14 +0300
committerFilippos Karapetis2019-08-19 00:18:00 +0300
commit6a9969ed25e485e393cd76fe486d3778b541d0c4 (patch)
treeee34ce9a3f4a199eeca8b7534fe98a34d33c1f01 /engines/startrek
parent073d8332834b18023207c4aad194986df92bb414 (diff)
downloadscummvm-rg350-6a9969ed25e485e393cd76fe486d3778b541d0c4.tar.gz
scummvm-rg350-6a9969ed25e485e393cd76fe486d3778b541d0c4.tar.bz2
scummvm-rg350-6a9969ed25e485e393cd76fe486d3778b541d0c4.zip
STARTREK: Fix loading of some texts, and add the "text" console command
Diffstat (limited to 'engines/startrek')
-rw-r--r--engines/startrek/console.cpp25
-rw-r--r--engines/startrek/console.h1
-rw-r--r--engines/startrek/room.cpp6
-rw-r--r--engines/startrek/room.h2
-rw-r--r--engines/startrek/startrek.h2
5 files changed, 34 insertions, 2 deletions
diff --git a/engines/startrek/console.cpp b/engines/startrek/console.cpp
index 471294fe9c..d3f012d4d1 100644
--- a/engines/startrek/console.cpp
+++ b/engines/startrek/console.cpp
@@ -30,6 +30,7 @@ namespace StarTrek {
Console::Console(StarTrekEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("room", WRAP_METHOD(Console, Cmd_Room));
registerCmd("actions", WRAP_METHOD(Console, Cmd_Actions));
+ registerCmd("text", WRAP_METHOD(Console, Cmd_Text));
}
Console::~Console() {
@@ -84,6 +85,30 @@ bool Console::Cmd_Actions(int argc, const char **argv) {
return true;
}
+bool Console::Cmd_Text(int argc, const char **argv) {
+ typedef Common::HashMap<int, Common::String>::iterator MessageIterator;
+
+ debugPrintf("\nLook messages\n");
+ debugPrintf("-------------\n");
+ for (MessageIterator i = _vm->_room->_lookMessages.begin(); i != _vm->_room->_lookMessages.end(); ++i) {
+ debugPrintf("%i: %s\n", i->_key, i->_value.c_str());
+ }
+
+ debugPrintf("\nLook with talker messages\n");
+ debugPrintf("-------------------------\n");
+ for (MessageIterator i = _vm->_room->_lookWithTalkerMessages.begin(); i != _vm->_room->_lookWithTalkerMessages.end(); ++i) {
+ debugPrintf("%i: %s\n", i->_key, i->_value.c_str());
+ }
+
+ debugPrintf("\nTalk messages\n");
+ debugPrintf("-------------\n");
+ for (MessageIterator i = _vm->_room->_talkMessages.begin(); i != _vm->_room->_talkMessages.end(); ++i) {
+ debugPrintf("%i: %s\n", i->_key, i->_value.c_str());
+ }
+
+ return true;
+}
+
Common::String Console::EventToString(uint32 action) {
const char *actions[] = {
"Tick",
diff --git a/engines/startrek/console.h b/engines/startrek/console.h
index 8a920ef4db..5293557ada 100644
--- a/engines/startrek/console.h
+++ b/engines/startrek/console.h
@@ -39,6 +39,7 @@ private:
bool Cmd_Room(int argc, const char **argv);
bool Cmd_Actions(int argc, const char **argv);
+ bool Cmd_Text(int argc, const char **argv);
Common::String EventToString(uint32 action);
Common::String ItemToString(byte index);
diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp
index c0ce89e2ba..0cffed9e57 100644
--- a/engines/startrek/room.cpp
+++ b/engines/startrek/room.cpp
@@ -183,8 +183,10 @@ void Room::loadOtherRoomMessages() {
break;
while (offset < nextOffset) {
- if (*(_rdfData + offset) == 0xeb && *(_rdfData + offset + 2) == '#')
- loadRoomMessage((const char *)_rdfData + offset + 2);
+ const char *text = (const char *)_rdfData + offset;
+
+ if (text[0] == '#' && text[1] == _vm->_missionName[0] && text[5] == '\\')
+ loadRoomMessage(text);
offset++;
}
diff --git a/engines/startrek/room.h b/engines/startrek/room.h
index 47a778f2bf..458f3df503 100644
--- a/engines/startrek/room.h
+++ b/engines/startrek/room.h
@@ -66,6 +66,8 @@ public:
Room(StarTrekEngine *vm, const Common::String &name);
~Room();
+ friend class Console;
+
uint16 readRdfWord(int offset);
/**
diff --git a/engines/startrek/startrek.h b/engines/startrek/startrek.h
index 3e27e002af..f07da10b20 100644
--- a/engines/startrek/startrek.h
+++ b/engines/startrek/startrek.h
@@ -231,6 +231,8 @@ public:
StarTrekEngine(OSystem *syst, const StarTrekGameDescription *gamedesc);
virtual ~StarTrekEngine();
+ friend class Console;
+
Common::Error run();
Common::Error runGameMode(int mode, bool resume);