STARTREK: Fix loading of some texts, and add the "text" console command

This commit is contained in:
Filippos Karapetis 2019-08-18 15:29:14 +03:00
parent 073d833283
commit 6a9969ed25
5 changed files with 34 additions and 2 deletions

View File

@ -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",

View File

@ -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);

View File

@ -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++;
}

View File

@ -66,6 +66,8 @@ public:
Room(StarTrekEngine *vm, const Common::String &name);
~Room();
friend class Console;
uint16 readRdfWord(int offset);
/**

View File

@ -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);