diff options
author | Paul Gilbert | 2017-11-24 07:01:55 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-11-24 07:01:55 -0500 |
commit | c5caf9825e0d02036795afa87f49b7aa274cc983 (patch) | |
tree | fa80bf8c49ae61d390a392090e2043cd3534b4d9 /engines/xeen | |
parent | 48b5132c2cf6b4bd3705b3f9c8a6df3d6fc55f70 (diff) | |
download | scummvm-rg350-c5caf9825e0d02036795afa87f49b7aa274cc983.tar.gz scummvm-rg350-c5caf9825e0d02036795afa87f49b7aa274cc983.tar.bz2 scummvm-rg350-c5caf9825e0d02036795afa87f49b7aa274cc983.zip |
XEEN: Load opcode messages needed by some opcodes
Diffstat (limited to 'engines/xeen')
-rw-r--r-- | engines/xeen/scripts.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 6d74262b83..cb49586d54 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -340,6 +340,7 @@ void Scripts::openGrate(int wallVal, int action) { } bool Scripts::doOpcode(MazeEvent &event) { + Map &map = *_vm->_map; typedef bool(Scripts::*ScriptMethodPtr)(ParamsIterator &); static const ScriptMethodPtr COMMAND_LIST[] = { &Scripts::cmdDoNothing, &Scripts::cmdDisplay1, &Scripts::cmdDoorTextSml, @@ -367,6 +368,12 @@ bool Scripts::doOpcode(MazeEvent &event) { }; _event = &event; + + // Some opcodes use the first parameter as a message + int msgId = event._parameters.empty() ? 0 : event._parameters[0]; + _message = msgId >= map._events._text.size() ? "" : map._events._text[msgId]; + + // Execute the opcode ParamsIterator params = event._parameters.getIterator(); bool result = (this->*COMMAND_LIST[event._opcode])(params); if (result) |