diff options
author | Walter van Niftrik | 2016-02-28 15:56:17 +0100 |
---|---|---|
committer | Walter van Niftrik | 2016-03-09 10:03:13 +0100 |
commit | 00d87cca9007ef69314b00eec5bffd6b9a9f2e72 (patch) | |
tree | 603b180a9f944fc6d43e9a8a6e7cf02f51f90fcc /engines | |
parent | 2104a5095d9d338a05cdf1e3a8e8b7f680b15f46 (diff) | |
download | scummvm-rg350-00d87cca9007ef69314b00eec5bffd6b9a9f2e72.tar.gz scummvm-rg350-00d87cca9007ef69314b00eec5bffd6b9a9f2e72.tar.bz2 scummvm-rg350-00d87cca9007ef69314b00eec5bffd6b9a9f2e72.zip |
ADL: Add more #defines for literals
Diffstat (limited to 'engines')
-rw-r--r-- | engines/adl/adl.cpp | 64 | ||||
-rw-r--r-- | engines/adl/adl.h | 36 |
2 files changed, 68 insertions, 32 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index 6109004f8a..af71bba5c9 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -210,19 +210,19 @@ void AdlEngine::dropItem(byte noun) { void AdlEngine::doActions(const Command &command, byte noun, byte offset) { for (uint i = 0; i < command.numAct; ++i) { switch (command.script[offset]) { - case 1: + case IDO_ACT_VAR_ADD: _variables[command.script[offset + 2]] += command.script[offset + 1]; offset += 3; break; - case 2: + case IDO_ACT_VAR_SUB: _variables[command.script[offset + 2]] -= command.script[offset + 1]; offset += 3; break; - case 3: + case IDO_ACT_VAR_SET: _variables[command.script[offset + 1]] = command.script[offset + 2]; offset += 3; break; - case 4: { + case IDO_ACT_LIST_ITEMS: { Common::Array<Item>::const_iterator it; for (it = _inventory.begin(); it != _inventory.end(); ++it) @@ -232,44 +232,44 @@ void AdlEngine::doActions(const Command &command, byte noun, byte offset) { ++offset; break; } - case 5: + case IDO_ACT_MOVE_ITEM: _inventory[command.script[offset + 1] - 1].room = command.script[offset + 2]; offset += 3; break; - case 6: + case IDO_ACT_SET_ROOM: _rooms[_room].curPicture = _rooms[_room].picture; _room = command.script[offset + 1]; offset += 2; break; - case 7: + case IDO_ACT_SET_CUR_PIC: _rooms[_room].curPicture = command.script[offset + 1]; offset += 2; break; - case 8: + case IDO_ACT_SET_PIC: _rooms[_room].picture = _rooms[_room].curPicture = command.script[offset + 1]; offset += 2; break; - case 9: + case IDO_ACT_PRINT_MSG: printMessage(command.script[offset + 1]); offset += 2; break; - case 0xa: + case IDO_ACT_SET_LIGHT: _isDark = false; ++offset; break; - case 0xb: + case IDO_ACT_SET_DARK: _isDark = true; ++offset; break; - case 0xf: + case IDO_ACT_SAVE: warning("Save game not implemented"); ++offset; break; - case 0x10: + case IDO_ACT_LOAD: warning("Load game not implemented"); ++offset; break; - case 0x11: { + case IDO_ACT_RESTART: { _display->printString(_strings[IDI_STR_PLAY_AGAIN]); Common::String input = _display->inputString(); if (input.size() == 0 || input[0] != APPLECHAR('N')) { @@ -278,11 +278,11 @@ void AdlEngine::doActions(const Command &command, byte noun, byte offset) { } // Fall-through } - case 0xd: + case IDO_ACT_QUIT: printEngineMessage(IDI_MSG_THANKS_FOR_PLAYING); quitGame(); return; - case 0x12: { + case IDO_ACT_SET_ITEM_POS: { byte item = command.script[offset + 1] - 1; _inventory[item].room = command.script[offset + 2]; _inventory[item].position.x = command.script[offset + 3]; @@ -290,22 +290,22 @@ void AdlEngine::doActions(const Command &command, byte noun, byte offset) { offset += 5; break; } - case 0x13: { + case IDO_ACT_SET_ITEM_PIC: { byte item = command.script[offset + 2] - 1; _inventory[item].picture = command.script[offset + 1]; offset += 3; break; } - case 0x14: + case IDO_ACT_RESET_PIC: _rooms[_room].curPicture = _rooms[_room].picture; ++offset; break; - case 0x15: - case 0x16: - case 0x17: - case 0x18: - case 0x19: - case 0x1a: { + case IDO_ACT_GO_NORTH: + case IDO_ACT_GO_SOUTH: + case IDO_ACT_GO_EAST: + case IDO_ACT_GO_WEST: + case IDO_ACT_GO_UP: + case IDO_ACT_GO_DOWN: { byte room = _rooms[_room].connections[command.script[offset] - 0x15]; if (room == 0) { @@ -317,15 +317,15 @@ void AdlEngine::doActions(const Command &command, byte noun, byte offset) { _room = room; return; } - case 0x1b: + case IDO_ACT_TAKE_ITEM: takeItem(noun); ++offset; break; - case 0x1c: + case IDO_ACT_DROP_ITEM: dropItem(noun); ++offset; break; - case 0x1d: + case IDO_ACT_SET_ROOM_PIC: _rooms[command.script[offset + 1]].picture = _rooms[command.script[offset + 1]].curPicture = command.script[offset + 2]; offset += 3; break; @@ -348,27 +348,27 @@ bool AdlEngine::checkCommand(const Command &command, byte verb, byte noun) { uint offset = 0; for (uint i = 0; i < command.numCond; ++i) { switch (command.script[offset]) { - case 3: + case IDO_CND_ITEM_IN_ROOM: if (_inventory[command.script[offset + 1] - 1].room != command.script[offset + 2]) return false; offset += 3; break; - case 5: + case IDO_CND_STEPS_GE: if (command.script[offset + 1] > _steps) return false; offset += 2; break; - case 6: + case IDO_CND_VAR_EQ: if (_variables[command.script[offset + 1]] != command.script[offset + 2]) return false; offset += 3; break; - case 9: + case IDO_CND_CUR_PIC_EQ: if (_rooms[_room].curPicture != command.script[offset + 1]) return false; offset += 2; break; - case 10: + case IDO_CND_ITEM_PIC_EQ: if (_inventory[command.script[offset + 1] - 1].picture != command.script[offset + 2]) return false; offset += 3; diff --git a/engines/adl/adl.h b/engines/adl/adl.h index fffe61eadf..e78d9ae6fd 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -71,6 +71,42 @@ enum EngineString { IDI_STR_TOTAL }; +// Conditional opcodes +#define IDO_CND_ITEM_IN_ROOM 0x03 +#define IDO_CND_STEPS_GE 0x05 +#define IDO_CND_VAR_EQ 0x06 +#define IDO_CND_CUR_PIC_EQ 0x09 +#define IDO_CND_ITEM_PIC_EQ 0x0a + +// Action opcodes +#define IDO_ACT_VAR_ADD 0x01 +#define IDO_ACT_VAR_SUB 0x02 +#define IDO_ACT_VAR_SET 0x03 +#define IDO_ACT_LIST_ITEMS 0x04 +#define IDO_ACT_MOVE_ITEM 0x05 +#define IDO_ACT_SET_ROOM 0x06 +#define IDO_ACT_SET_CUR_PIC 0x07 +#define IDO_ACT_SET_PIC 0x08 +#define IDO_ACT_PRINT_MSG 0x09 +#define IDO_ACT_SET_LIGHT 0x0a +#define IDO_ACT_SET_DARK 0x0b +#define IDO_ACT_QUIT 0x0d +#define IDO_ACT_SAVE 0x0f +#define IDO_ACT_LOAD 0x10 +#define IDO_ACT_RESTART 0x11 +#define IDO_ACT_SET_ITEM_POS 0x12 +#define IDO_ACT_SET_ITEM_PIC 0x13 +#define IDO_ACT_RESET_PIC 0x14 +#define IDO_ACT_GO_NORTH 0x15 +#define IDO_ACT_GO_SOUTH 0x16 +#define IDO_ACT_GO_EAST 0x17 +#define IDO_ACT_GO_WEST 0x18 +#define IDO_ACT_GO_UP 0x19 +#define IDO_ACT_GO_DOWN 0x1a +#define IDO_ACT_TAKE_ITEM 0x1b +#define IDO_ACT_DROP_ITEM 0x1c +#define IDO_ACT_SET_ROOM_PIC 0x1d + struct Room { byte description; byte connections[6]; |