aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-04-30 21:07:33 -1000
committerPaul Gilbert2015-04-30 21:07:33 -1000
commit56f8d54e5133ecdc6e6cceda27202bf6ba7e26fd (patch)
treedb6a12b3c6c4c5a52f29ce52fc1f72f6d0c23d98 /engines/sherlock
parent821040deaaa4dabf160795e96cb223ba192a87d3 (diff)
downloadscummvm-rg350-56f8d54e5133ecdc6e6cceda27202bf6ba7e26fd.tar.gz
scummvm-rg350-56f8d54e5133ecdc6e6cceda27202bf6ba7e26fd.tar.bz2
scummvm-rg350-56f8d54e5133ecdc6e6cceda27202bf6ba7e26fd.zip
SHERLOCK: Use script opcode constants in journal loading
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/journal.cpp40
-rw-r--r--engines/sherlock/talk.cpp41
-rw-r--r--engines/sherlock/talk.h37
3 files changed, 58 insertions, 60 deletions
diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp
index c30b4683d9..be76756bdd 100644
--- a/engines/sherlock/journal.cpp
+++ b/engines/sherlock/journal.cpp
@@ -346,48 +346,48 @@ int Journal::loadJournalFile(bool alreadyLoaded) {
} else {
// Control code, so move past it and any parameters
switch (c) {
- case 129: // Run canim
- case 130: // Assign side
- case 131: // Pause with control
- case 136: // Pause without control
- case 157: // Walk to canimation
+ case RUN_CANIMATION:
+ case ASSIGN_PORTRAIT_LOCATION:
+ case PAUSE:
+ case PAUSE_WITHOUT_CONTROL:
+ case WALK_TO_CANIMATION:
// These commands have a single parameter
++replyP;
break;
- case 134: // Change sequence
+ case ADJUST_OBJ_SEQUENCE:
replyP += ((byte)replyP[0] & 127) + (byte)replyP[1] + 2;
break;
- case 135: // Walk to co-ords
- case 154: // Move mouse
+ case WALK_TO_COORDS:
+ case MOVE_MOUSE:
replyP += 4;
break;
- case 139: // Set flag
- case 143: // If statement
+ case SET_FLAG:
+ case IF_STATEMENT:
replyP += 2;
break;
- case 140: // Play voice file
- case 150: // Play prologue
- case 153: // Call talk file
+ case SFX_COMMAND:
+ case PLAY_PROLOGUE:
+ case CALL_TALK_FILE:
replyP += 8;
break;
- case 141: // Toggle object
- case 151: // Put item in inventory
- case 152: // Set object
- case 155: // Info line
- case 158: // Delete item from inventory
+ case TOGGLE_OBJECT:
+ case ADD_ITEM_TO_INVENTORY:
+ case SET_OBJECT:
+ case DISPLAY_INFO_LINE:
+ case REMOVE_ITEM_FROM_INVENTORY:
replyP += ((byte)*replyP & 127) + 1;
break;
- case 149: // Goto scene
+ case GOTO_SCENE:
replyP += 5;
break;
- case 161: // End of line
+ case CARRIAGE_RETURN:
journalString += "\n";
break;
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index ed8092c03e..fb16995d2b 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -26,45 +26,6 @@
namespace Sherlock {
-enum {
- SWITCH_SPEAKER = 128,
- RUN_CANIMATION = 129,
- ASSIGN_PORTRAIT_LOCATION = 130,
- PAUSE = 131,
- REMOVE_PORTRAIT = 132,
- CLEAR_WINDOW = 133,
- ADJUST_OBJ_SEQUENCE = 134,
- WALK_TO_COORDS = 135,
- PAUSE_WITHOUT_CONTROL = 136,
- BANISH_WINDOW = 137,
- SUMMON_WINDOW = 138,
- SET_FLAG = 139,
- SFX_COMMAND = 140,
- TOGGLE_OBJECT = 141,
- STEALTH_MODE_ACTIVE = 142,
- IF_STATEMENT = 143,
- ELSE_STATEMENT = 144,
- END_IF_STATEMENT = 145,
- STEALTH_MODE_DEACTIVATE = 146,
- TURN_HOLMES_OFF = 147,
- TURN_HOLMES_ON = 148,
- GOTO_SCENE = 149,
- PLAY_PROLOGUE = 150,
- ADD_ITEM_TO_INVENTORY = 151,
- SET_OBJECT = 152,
- CALL_TALK_FILE = 153,
- MOVE_MOUSE = 154,
- DISPLAY_INFO_LINE = 155,
- CLEAR_INFO_LINE = 156,
- WALK_TO_CANIMATION = 157,
- REMOVE_ITEM_FROM_INVENTORY = 158,
- ENABLE_END_KEY = 159,
- DISABLE_END_KEY = 160,
- COMMAND_161 = 161
-};
-
-/*----------------------------------------------------------------*/
-
/**
* Load the data for a single statement within a talk file
*/
@@ -1621,7 +1582,7 @@ void Talk::doScript(const Common::String &script) {
}
// Open window if it wasn't already open, and text has already been printed
- if ((openTalkWindow && wait) || (openTalkWindow && (byte)str[0] >= 128 && (byte)str[0] != COMMAND_161)) {
+ if ((openTalkWindow && wait) || (openTalkWindow && (byte)str[0] >= 128 && (byte)str[0] != CARRIAGE_RETURN)) {
if (!ui._windowStyle) {
screen.slamRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
} else {
diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h
index 620a986454..d545d31351 100644
--- a/engines/sherlock/talk.h
+++ b/engines/sherlock/talk.h
@@ -35,6 +35,43 @@ namespace Sherlock {
#define MAX_TALK_SEQUENCES 11
#define MAX_TALK_FILES 500
+enum {
+ SWITCH_SPEAKER = 128,
+ RUN_CANIMATION = 129,
+ ASSIGN_PORTRAIT_LOCATION = 130,
+ PAUSE = 131,
+ REMOVE_PORTRAIT = 132,
+ CLEAR_WINDOW = 133,
+ ADJUST_OBJ_SEQUENCE = 134,
+ WALK_TO_COORDS = 135,
+ PAUSE_WITHOUT_CONTROL = 136,
+ BANISH_WINDOW = 137,
+ SUMMON_WINDOW = 138,
+ SET_FLAG = 139,
+ SFX_COMMAND = 140,
+ TOGGLE_OBJECT = 141,
+ STEALTH_MODE_ACTIVE = 142,
+ IF_STATEMENT = 143,
+ ELSE_STATEMENT = 144,
+ END_IF_STATEMENT = 145,
+ STEALTH_MODE_DEACTIVATE = 146,
+ TURN_HOLMES_OFF = 147,
+ TURN_HOLMES_ON = 148,
+ GOTO_SCENE = 149,
+ PLAY_PROLOGUE = 150,
+ ADD_ITEM_TO_INVENTORY = 151,
+ SET_OBJECT = 152,
+ CALL_TALK_FILE = 153,
+ MOVE_MOUSE = 154,
+ DISPLAY_INFO_LINE = 155,
+ CLEAR_INFO_LINE = 156,
+ WALK_TO_CANIMATION = 157,
+ REMOVE_ITEM_FROM_INVENTORY = 158,
+ ENABLE_END_KEY = 159,
+ DISABLE_END_KEY = 160,
+ CARRIAGE_RETURN = 161
+};
+
struct SequenceEntry {
int _objNum;
Common::Array<byte> _sequences;