[Scummvm-git-logs] scummvm master -> 10b0f884c662ef201b5f12bed5bf983f591c7b48
dreammaster
paulfgilbert at gmail.com
Sun Oct 18 04:26:23 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ebc831fb5a GLK: COMPREHEND: Verifying further opcodes
046af3f4c3 GLK: COMPREHEND: First command working in OO-Topis
10b0f884c6 GLK: COMPREHEND: v2 script opcodes for beforeTurn script
Commit: ebc831fb5a4320f3b00462107da8b636602ea7da
https://github.com/scummvm/scummvm/commit/ebc831fb5a4320f3b00462107da8b636602ea7da
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-10-17T20:25:55-07:00
Commit Message:
GLK: COMPREHEND: Verifying further opcodes
Changed paths:
engines/glk/comprehend/game_opcodes.cpp
diff --git a/engines/glk/comprehend/game_opcodes.cpp b/engines/glk/comprehend/game_opcodes.cpp
index 067e688383..8421e808cc 100644
--- a/engines/glk/comprehend/game_opcodes.cpp
+++ b/engines/glk/comprehend/game_opcodes.cpp
@@ -157,6 +157,19 @@ void ComprehendGameOpcodes::execute_opcode(const Instruction *instr, const Sente
_currentReplaceWord = instr->_operand[0] - 1;
break;
+ case OPCODE_TAKE_CURRENT_OBJECT:
+ item = get_item_by_noun(noun);
+ if (!item)
+ error("Attempt to take object failed\n");
+
+ move_object(item, ROOM_INVENTORY);
+ break;
+
+ case OPCODE_TAKE_OBJECT:
+ item = get_item(instr->_operand[0] - 1);
+ move_object(item, ROOM_INVENTORY);
+ break;
+
case OPCODE_TEST_FLAG:
func_set_test_result(func_state, _flags[instr->_operand[0]]);
break;
@@ -576,19 +589,6 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
move_object(item, _currentRoom);
break;
- case OPCODE_TAKE_CURRENT_OBJECT:
- item = get_item_by_noun(noun);
- if (!item)
- error("Attempt to take object failed\n");
-
- move_object(item, ROOM_INVENTORY);
- break;
-
- case OPCODE_TAKE_OBJECT:
- item = get_item(instr->_operand[0] - 1);
- move_object(item, ROOM_INVENTORY);
- break;
-
case OPCODE_TEST_NOT_FLAG:
func_set_test_result(func_state,
!_flags[instr->_operand[0]]);
@@ -701,11 +701,13 @@ ComprehendGameV2::ComprehendGameV2() {
_opcodeMap[0x21] = OPCODE_OBJECT_PRESENT;
_opcodeMap[0x25] = OPCODE_NOT_TAKEABLE;
_opcodeMap[0x29] = OPCODE_INVENTORY_FULL;
+ _opcodeMap[0x81] = OPCODE_TAKE_OBJECT;
_opcodeMap[0x85] = OPCODE_MOVE_TO_ROOM;
_opcodeMap[0x87] = OPCODE_SET_ROOM_DESCRIPTION;
_opcodeMap[0x8e] = OPCODE_PRINT;
_opcodeMap[0x92] = OPCODE_CALL_FUNC;
_opcodeMap[0x99] = OPCODE_SET_FLAG;
+ _opcodeMap[0xa0] = OPCODE_TAKE_CURRENT_OBJECT;
_opcodeMap[0xa1] = OPCODE_CLEAR_FLAG40;
_opcodeMap[0xa5] = OPCODE_SET_FLAG40;
_opcodeMap[0xa9] = OPCODE_CLEAR_INVISIBLE;
@@ -739,7 +741,6 @@ ComprehendGameV2::ComprehendGameV2() {
_opcodeMap[0x61] = OPCODE_OBJECT_NOT_PRESENT;
_opcodeMap[0x70] = OPCODE_CURRENT_OBJECT_NOT_PRESENT;
_opcodeMap[0x80] = OPCODE_INVENTORY;
- _opcodeMap[0x81] = OPCODE_TAKE_OBJECT;
_opcodeMap[0x82] = OPCODE_MOVE_OBJECT_TO_ROOM;
_opcodeMap[0x84] = OPCODE_SAVE_ACTION;
_opcodeMap[0x86] = OPCODE_VAR_ADD;
@@ -753,7 +754,6 @@ ComprehendGameV2::ComprehendGameV2() {
_opcodeMap[0x98] = OPCODE_TURN_TICK;
_opcodeMap[0x9d] = OPCODE_CLEAR_FLAG;
_opcodeMap[0x9e] = OPCODE_INVENTORY_ROOM;
- _opcodeMap[0xa0] = OPCODE_TAKE_CURRENT_OBJECT;
_opcodeMap[0xa2] = OPCODE_SET_OBJECT_GRAPHIC;
_opcodeMap[0xb1] = OPCODE_MOVE_DIR;
_opcodeMap[0xb5] = OPCODE_DESCRIBE_CURRENT_OBJECT;
Commit: 046af3f4c36794dae0bb6373510b1e769f7286c4
https://github.com/scummvm/scummvm/commit/046af3f4c36794dae0bb6373510b1e769f7286c4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-10-17T20:27:15-07:00
Commit Message:
GLK: COMPREHEND: First command working in OO-Topis
Yay \o/
Changed paths:
engines/glk/comprehend/debugger_dumper.cpp
engines/glk/comprehend/game_data.h
engines/glk/comprehend/game_opcodes.cpp
engines/glk/comprehend/game_opcodes.h
diff --git a/engines/glk/comprehend/debugger_dumper.cpp b/engines/glk/comprehend/debugger_dumper.cpp
index 41d60c7f85..cdb60f6c38 100644
--- a/engines/glk/comprehend/debugger_dumper.cpp
+++ b/engines/glk/comprehend/debugger_dumper.cpp
@@ -58,6 +58,7 @@ DebuggerDumper::DebuggerDumper() : _game(nullptr) {
_opcodes[OPCODE_VAR_GTE2] = "var_gte2";
_opcodes[OPCODE_CURRENT_OBJECT_NOT_VALID] = "current_object_not_valid";
_opcodes[OPCODE_INVENTORY_FULL] = "inventory_full";
+ _opcodes[OPCODE_INVENTORY_FULL_X] = "inventory_full_x";
_opcodes[OPCODE_OBJECT_PRESENT] = "object_present";
_opcodes[OPCODE_ELSE] = "else";
_opcodes[OPCODE_OBJECT_IN_ROOM] = "object_in_room";
@@ -102,7 +103,7 @@ DebuggerDumper::DebuggerDumper() : _game(nullptr) {
_opcodes[OPCODE_SET_STRING_REPLACEMENT2] = "set_string_replacement2";
_opcodes[OPCODE_SET_STRING_REPLACEMENT3] = "set_string_replacement3";
_opcodes[OPCODE_SET_CURRENT_NOUN_STRING_REPLACEMENT] = "set_current_noun_string_replacement";
- _opcodes[OPCODE_CURRENT_IS_OBJECT] = "current_is_object";
+ _opcodes[OPCODE_CURRENT_IS_NOT_OBJECT] = "current_is_not_object";
_opcodes[OPCODE_DRAW_ROOM] = "draw_room";
_opcodes[OPCODE_DRAW_OBJECT] = "draw_object";
_opcodes[OPCODE_WAIT_KEY] = "wait_key";
diff --git a/engines/glk/comprehend/game_data.h b/engines/glk/comprehend/game_data.h
index 104e8f201c..2abbaebcbd 100644
--- a/engines/glk/comprehend/game_data.h
+++ b/engines/glk/comprehend/game_data.h
@@ -66,6 +66,7 @@ enum ScriptOpcode {
OPCODE_OBJECT_IN_ROOM,
OPCODE_CURRENT_OBJECT_NOT_VALID,
OPCODE_INVENTORY_FULL,
+ OPCODE_INVENTORY_FULL_X,
OPCODE_TEST_FLAG,
OPCODE_CURRENT_OBJECT_IN_ROOM,
OPCODE_HAVE_CURRENT_OBJECT,
@@ -120,7 +121,7 @@ enum ScriptOpcode {
OPCODE_SET_STRING_REPLACEMENT2,
OPCODE_SET_STRING_REPLACEMENT3,
OPCODE_SET_CURRENT_NOUN_STRING_REPLACEMENT,
- OPCODE_CURRENT_IS_OBJECT,
+ OPCODE_CURRENT_IS_NOT_OBJECT,
OPCODE_DRAW_ROOM,
OPCODE_DRAW_OBJECT,
OPCODE_WAIT_KEY,
diff --git a/engines/glk/comprehend/game_opcodes.cpp b/engines/glk/comprehend/game_opcodes.cpp
index 8421e808cc..00f52ded2f 100644
--- a/engines/glk/comprehend/game_opcodes.cpp
+++ b/engines/glk/comprehend/game_opcodes.cpp
@@ -33,6 +33,8 @@ ComprehendGameOpcodes::ComprehendGameOpcodes() {
Common::fill(&_opcodeMap[0], &_opcodeMap[0x100], OPCODE_UNKNOWN);
}
+#define GET_ITEM item = get_item(instr->_operand[0] - (_comprehendVersion == 2 ? 0 : 1))
+
void ComprehendGameOpcodes::execute_opcode(const Instruction *instr, const Sentence *sentence,
FunctionState *func_state) {
// byte verb = sentence ? sentence->_formattedWords[0] : 0;
@@ -68,10 +70,6 @@ void ComprehendGameOpcodes::execute_opcode(const Instruction *instr, const Sente
item->_flags &= ~ITEMF_INVISIBLE;
break;
- case OPCODE_CURRENT_IS_OBJECT:
- func_set_test_result(func_state, get_item_by_noun(noun) != NULL);
- break;
-
case OPCODE_CURRENT_OBJECT_NOT_VALID:
func_set_test_result(func_state, !noun);
break;
@@ -95,7 +93,7 @@ void ComprehendGameOpcodes::execute_opcode(const Instruction *instr, const Sente
break;
case OPCODE_OBJECT_PRESENT:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
func_set_test_result(func_state, item->_room == _currentRoom);
break;
@@ -166,7 +164,7 @@ void ComprehendGameOpcodes::execute_opcode(const Instruction *instr, const Sente
break;
case OPCODE_TAKE_OBJECT:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
move_object(item, ROOM_INVENTORY);
break;
@@ -398,23 +396,23 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
break;
case OPCODE_MOVE_OBJECT_TO_CURRENT_ROOM:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
move_object(item, _currentRoom);
break;
case OPCODE_OBJECT_IN_ROOM:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
func_set_test_result(func_state,
item->_room == instr->_operand[1]);
break;
case OPCODE_OBJECT_NOT_IN_ROOM:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
func_set_test_result(func_state, !item || item->_room != _currentRoom);
break;
case OPCODE_OBJECT_CAN_TAKE:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
func_set_test_result(func_state, item->_flags & ITEMF_CAN_TAKE);
break;
@@ -424,7 +422,7 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
break;
case OPCODE_MOVE_OBJECT_TO_ROOM:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
move_object(item, instr->_operand[1]);
break;
@@ -466,7 +464,7 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
break;
case OPCODE_HAVE_OBJECT:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
func_set_test_result(func_state,
item->_room == ROOM_INVENTORY);
break;
@@ -478,7 +476,7 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
break;
case OPCODE_NOT_HAVE_OBJECT:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
func_set_test_result(func_state,
item->_room != ROOM_INVENTORY);
break;
@@ -502,7 +500,7 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
break;
case OPCODE_OBJECT_IS_NOWHERE:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
func_set_test_result(func_state, item->_room == ROOM_NOWHERE);
break;
@@ -512,7 +510,7 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
break;
case OPCODE_OBJECT_IS_NOT_NOWHERE:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
func_set_test_result(func_state, item->_room != ROOM_NOWHERE);
break;
@@ -522,12 +520,12 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
break;
case OPCODE_OBJECT_NOT_PRESENT:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
func_set_test_result(func_state, !isItemPresent(item));
break;
case OPCODE_REMOVE_OBJECT:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
move_object(item, ROOM_NOWHERE);
break;
@@ -577,7 +575,7 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
break;
case OPCODE_DROP_OBJECT:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
move_object(item, _currentRoom);
break;
@@ -599,17 +597,17 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
break;
case OPCODE_SET_OBJECT_DESCRIPTION:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
item->_stringDesc = (instr->_operand[2] << 8) | instr->_operand[1];
break;
case OPCODE_SET_OBJECT_LONG_DESCRIPTION:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
item->_longString = (instr->_operand[2] << 8) | instr->_operand[1];
break;
case OPCODE_SET_OBJECT_GRAPHIC:
- item = get_item(instr->_operand[0] - 1);
+ GET_ITEM;
item->_graphic = instr->_operand[1];
if (item->_room == _currentRoom)
_updateFlags |= UPDATE_GRAPHICS;
@@ -693,9 +691,10 @@ ComprehendGameV2::ComprehendGameV2() {
_opcodeMap[0x04] = OPCODE_OR;
_opcodeMap[0x05] = OPCODE_IN_ROOM;
_opcodeMap[0x06] = OPCODE_VAR_EQ2;
- _opcodeMap[0x08] = OPCODE_CURRENT_IS_OBJECT;
+ _opcodeMap[0x08] = OPCODE_CURRENT_IS_NOT_OBJECT;
_opcodeMap[0x0c] = OPCODE_ELSE;
_opcodeMap[0x14] = OPCODE_CURRENT_OBJECT_NOT_VALID;
+ _opcodeMap[0x15] = OPCODE_INVENTORY_FULL_X;
_opcodeMap[0x19] = OPCODE_TEST_FLAG;
_opcodeMap[0x20] = OPCODE_HAVE_CURRENT_OBJECT;
_opcodeMap[0x21] = OPCODE_OBJECT_PRESENT;
@@ -782,14 +781,26 @@ void ComprehendGameV2::execute_opcode(const Instruction *instr, const Sentence *
item->_flags &= ~ITEMF_INVISIBLE;
break;
+ case OPCODE_CURRENT_IS_NOT_OBJECT:
+ func_set_test_result(func_state, get_item_by_noun(noun) == nullptr);
+ break;
+
case OPCODE_INVENTORY_FULL:
item = get_item_by_noun(noun);
weighInventory();
- func_set_test_result(func_state, _totalInventoryWeight + (item->_flags & ITEMF_WEIGHT_MASK) <
+ func_set_test_result(func_state, _totalInventoryWeight + (item->_flags & ITEMF_WEIGHT_MASK) >
_variables[VAR_INVENTORY_LIMIT]);
break;
+ case OPCODE_INVENTORY_FULL_X:
+ item = get_item_by_noun(noun);
+
+ weighInventory();
+ func_set_test_result(func_state, _totalInventoryWeight + (item->_flags & ITEMF_WEIGHT_MASK) >
+ _variables[instr->_operand[1]]);
+ break;
+
case OPCODE_NOT_TAKEABLE:
item = get_item_by_noun(noun);
func_set_test_result(func_state, (item->_flags & ITEMF_WEIGHT_MASK) == ITEMF_WEIGHT_MASK);
diff --git a/engines/glk/comprehend/game_opcodes.h b/engines/glk/comprehend/game_opcodes.h
index fe77980195..bdd859976b 100644
--- a/engines/glk/comprehend/game_opcodes.h
+++ b/engines/glk/comprehend/game_opcodes.h
@@ -46,7 +46,7 @@ public:
virtual byte getOpcode(const Instruction *instr) {
return instr->_opcode;
}
- virtual ScriptOpcode getScriptOpcode(const Instruction *instr) override {
+ ScriptOpcode getScriptOpcode(const Instruction *instr) override {
return _opcodeMap[getOpcode(instr)];
}
};
Commit: 10b0f884c662ef201b5f12bed5bf983f591c7b48
https://github.com/scummvm/scummvm/commit/10b0f884c662ef201b5f12bed5bf983f591c7b48
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-10-17T21:25:56-07:00
Commit Message:
GLK: COMPREHEND: v2 script opcodes for beforeTurn script
Changed paths:
engines/glk/comprehend/game.cpp
engines/glk/comprehend/game_opcodes.cpp
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index 895b2c0ee0..d2dab2b370 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -778,9 +778,8 @@ void ComprehendGame::doBeforeTurn() {
// Run the game specific before turn bits
beforeTurn();
- if (_comprehendVersion == 1)
- // Run the each turn functions
- eval_function(0, nullptr);
+ // Run the each turn functions
+ eval_function(0, nullptr);
update();
}
diff --git a/engines/glk/comprehend/game_opcodes.cpp b/engines/glk/comprehend/game_opcodes.cpp
index 00f52ded2f..9d4702b755 100644
--- a/engines/glk/comprehend/game_opcodes.cpp
+++ b/engines/glk/comprehend/game_opcodes.cpp
@@ -83,15 +83,42 @@ void ComprehendGameOpcodes::execute_opcode(const Instruction *instr, const Sente
func_set_test_result(func_state, item->_room == ROOM_INVENTORY);
break;
+ case OPCODE_HAVE_OBJECT:
+ GET_ITEM;
+ func_set_test_result(func_state, item->_room == ROOM_INVENTORY);
+ break;
+
case OPCODE_IN_ROOM:
func_set_test_result(func_state, _currentRoom == instr->_operand[0]);
break;
+ case OPCODE_INVENTORY: {
+ uint count = num_objects_in_room(ROOM_INVENTORY);
+ if (count == 0) {
+ console_println(stringLookup(STRING_INVENTORY_EMPTY).c_str());
+ break;
+ }
+
+ console_println(stringLookup(STRING_INVENTORY).c_str());
+ for (uint i = 0; i < _items.size(); i++) {
+ item = &_items[i];
+ if (item->_room == ROOM_INVENTORY)
+ g_comprehend->print("%s\n",
+ stringLookup(item->_stringDesc).c_str());
+ }
+ break;
+ }
+
case OPCODE_MOVE_TO_ROOM:
if (instr->_operand[0] != 0xff)
move_to(instr->_operand[0]);
break;
+ case OPCODE_OBJECT_IS_NOWHERE:
+ GET_ITEM;
+ func_set_test_result(func_state, item->_room == ROOM_NOWHERE);
+ break;
+
case OPCODE_OBJECT_PRESENT:
GET_ITEM;
func_set_test_result(func_state, item->_room == _currentRoom);
@@ -172,11 +199,36 @@ void ComprehendGameOpcodes::execute_opcode(const Instruction *instr, const Sente
func_set_test_result(func_state, _flags[instr->_operand[0]]);
break;
+ case OPCODE_TEST_ROOM_FLAG:
+ func_set_test_result(func_state, room->_flags & instr->_operand[0]);
+ break;
+
+ case OPCODE_VAR_ADD:
+ _variables[instr->_operand[0]] += _variables[instr->_operand[1]];
+ break;
+
+ case OPCODE_VAR_DEC:
+ _variables[instr->_operand[0]]--;
+ break;
+
case OPCODE_VAR_EQ2:
func_set_test_result(func_state,
_variables[instr->_operand[0]] == _variables[instr->_operand[1]]);
break;
+ case OPCODE_VAR_GT2:
+ func_set_test_result(func_state, _variables[instr->_operand[0]] >
+ _variables[instr->_operand[1]]);
+ break;
+
+ case OPCODE_VAR_INC:
+ _variables[instr->_operand[0]]++;
+ break;
+
+ case OPCODE_VAR_SUB:
+ _variables[instr->_operand[0]] -= _variables[instr->_operand[1]];
+ break;
+
default:
if (instr->_opcode & 0x80) {
warning("Unhandled command opcode %.2x", opcode);
@@ -310,24 +362,6 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
/*--------------------------------------*/
- case OPCODE_VAR_ADD:
- _variables[instr->_operand[0]] +=
- _variables[instr->_operand[1]];
- break;
-
- case OPCODE_VAR_SUB:
- _variables[instr->_operand[0]] -=
- _variables[instr->_operand[1]];
- break;
-
- case OPCODE_VAR_INC:
- _variables[instr->_operand[0]]++;
- break;
-
- case OPCODE_VAR_DEC:
- _variables[instr->_operand[0]]--;
- break;
-
case OPCODE_VAR_EQ1:
func_set_test_result(func_state,
_variables[0] ==
@@ -340,12 +374,6 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
_variables[instr->_operand[0]]);
break;
- case OPCODE_VAR_GT2:
- func_set_test_result(func_state,
- _variables[instr->_operand[0]] >
- _variables[instr->_operand[1]]);
- break;
-
case OPCODE_VAR_GTE1:
func_set_test_result(func_state,
_variables[0] >=
@@ -367,11 +395,6 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
!(room->_flags & instr->_operand[0]));
break;
- case OPCODE_TEST_ROOM_FLAG:
- func_set_test_result(func_state,
- room->_flags & instr->_operand[0]);
- break;
-
case OPCODE_NOT_IN_ROOM:
func_set_test_result(func_state,
_currentRoom != instr->_operand[0]);
@@ -411,11 +434,6 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
func_set_test_result(func_state, !item || item->_room != _currentRoom);
break;
- case OPCODE_OBJECT_CAN_TAKE:
- GET_ITEM;
- func_set_test_result(func_state, item->_flags & ITEMF_CAN_TAKE);
- break;
-
case OPCODE_CURRENT_OBJECT_NOT_IN_ROOM:
item = get_item_by_noun(noun);
func_set_test_result(func_state, !item || item->_room != _currentRoom);
@@ -463,12 +481,6 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
func_set_test_result(func_state, false);
break;
- case OPCODE_HAVE_OBJECT:
- GET_ITEM;
- func_set_test_result(func_state,
- item->_room == ROOM_INVENTORY);
- break;
-
case OPCODE_NOT_HAVE_CURRENT_OBJECT:
item = get_item_by_noun(noun);
func_set_test_result(func_state,
@@ -499,11 +511,6 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
!(item->_flags & ITEMF_CAN_TAKE));
break;
- case OPCODE_OBJECT_IS_NOWHERE:
- GET_ITEM;
- func_set_test_result(func_state, item->_room == ROOM_NOWHERE);
- break;
-
case OPCODE_CURRENT_OBJECT_IS_NOWHERE:
item = get_item_by_noun(noun);
func_set_test_result(func_state, item && item->_room == ROOM_NOWHERE);
@@ -534,22 +541,6 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
move_object(item, ROOM_NOWHERE);
break;
- case OPCODE_INVENTORY:
- count = num_objects_in_room(ROOM_INVENTORY);
- if (count == 0) {
- console_println(stringLookup(STRING_INVENTORY_EMPTY).c_str());
- break;
- }
-
- console_println(stringLookup(STRING_INVENTORY).c_str());
- for (uint i = 0; i < _items.size(); i++) {
- item = &_items[i];
- if (item->_room == ROOM_INVENTORY)
- g_comprehend->print("%s\n",
- stringLookup(item->_stringDesc).c_str());
- }
- break;
-
case OPCODE_INVENTORY_ROOM:
count = num_objects_in_room(instr->_operand[0]);
if (count == 0) {
@@ -688,21 +679,29 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
/*-------------------------------------------------------*/
ComprehendGameV2::ComprehendGameV2() {
+ _opcodeMap[0x01] = OPCODE_HAVE_OBJECT;
+ _opcodeMap[0x02] = OPCODE_VAR_GT2;
_opcodeMap[0x04] = OPCODE_OR;
_opcodeMap[0x05] = OPCODE_IN_ROOM;
_opcodeMap[0x06] = OPCODE_VAR_EQ2;
_opcodeMap[0x08] = OPCODE_CURRENT_IS_NOT_OBJECT;
_opcodeMap[0x0c] = OPCODE_ELSE;
+ _opcodeMap[0x11] = OPCODE_OBJECT_IS_NOWHERE;
_opcodeMap[0x14] = OPCODE_CURRENT_OBJECT_NOT_VALID;
_opcodeMap[0x15] = OPCODE_INVENTORY_FULL_X;
_opcodeMap[0x19] = OPCODE_TEST_FLAG;
+ _opcodeMap[0x1d] = OPCODE_TEST_ROOM_FLAG;
_opcodeMap[0x20] = OPCODE_HAVE_CURRENT_OBJECT;
_opcodeMap[0x21] = OPCODE_OBJECT_PRESENT;
_opcodeMap[0x25] = OPCODE_NOT_TAKEABLE;
_opcodeMap[0x29] = OPCODE_INVENTORY_FULL;
+ _opcodeMap[0x2d] = OPCODE_OBJECT_CAN_TAKE;
+ _opcodeMap[0x80] = OPCODE_INVENTORY;
_opcodeMap[0x81] = OPCODE_TAKE_OBJECT;
_opcodeMap[0x85] = OPCODE_MOVE_TO_ROOM;
+ _opcodeMap[0x86] = OPCODE_VAR_ADD;
_opcodeMap[0x87] = OPCODE_SET_ROOM_DESCRIPTION;
+ _opcodeMap[0x8a] = OPCODE_VAR_SUB;
_opcodeMap[0x8e] = OPCODE_PRINT;
_opcodeMap[0x92] = OPCODE_CALL_FUNC;
_opcodeMap[0x99] = OPCODE_SET_FLAG;
@@ -711,40 +710,32 @@ ComprehendGameV2::ComprehendGameV2() {
_opcodeMap[0xa5] = OPCODE_SET_FLAG40;
_opcodeMap[0xa9] = OPCODE_CLEAR_INVISIBLE;
_opcodeMap[0xad] = OPCODE_SET_INVISIBLE;
+ _opcodeMap[0xc1] = OPCODE_VAR_DEC;
_opcodeMap[0xc5] = OPCODE_SET_STRING_REPLACEMENT3;
_opcodeMap[0xc9] = OPCODE_SET_STRING_REPLACEMENT1;
_opcodeMap[0xcd] = OPCODE_SET_STRING_REPLACEMENT2;
+ _opcodeMap[0xdd] = OPCODE_VAR_INC;
_opcodeMap[0xe5] = OPCODE_SET_CAN_TAKE;
_opcodeMap[0xe9] = OPCODE_CLEAR_CAN_TAKE;
#if 0
- _opcodeMap[0x01] = OPCODE_HAVE_OBJECT;
- _opcodeMap[0x02] = OPCODE_VAR_GT2;
_opcodeMap[0x09] = OPCODE_VAR_GT1;
_opcodeMap[0x0a] = OPCODE_VAR_GTE2;
_opcodeMap[0x0d] = OPCODE_VAR_EQ1;
- _opcodeMap[0x11] = OPCODE_OBJECT_IS_NOWHERE;
- _opcodeMap[0x1d] = OPCODE_TEST_ROOM_FLAG;
_opcodeMap[0x22] = OPCODE_OBJECT_IN_ROOM;
- _opcodeMap[0x2d] = OPCODE_OBJECT_CAN_TAKE;
_opcodeMap[0x30] = OPCODE_CURRENT_OBJECT_PRESENT;
- _opcodeMap[0x31] = OPCODE_TEST_ROOM_FLAG;
_opcodeMap[0x41] = OPCODE_NOT_HAVE_OBJECT;
_opcodeMap[0x45] = OPCODE_NOT_IN_ROOM;
_opcodeMap[0x48] = OPCODE_CURRENT_OBJECT_NOT_PRESENT;
_opcodeMap[0x43] = OPCODE_OBJECT_NOT_IN_ROOM;
- _opcodeMap[0x51] = OPCODE_OBJECT_IS_NOWHERE;
_opcodeMap[0x59] = OPCODE_TEST_NOT_FLAG;
_opcodeMap[0x5d] = OPCODE_TEST_NOT_ROOM_FLAG;
_opcodeMap[0x60] = OPCODE_NOT_HAVE_CURRENT_OBJECT;
_opcodeMap[0x61] = OPCODE_OBJECT_NOT_PRESENT;
_opcodeMap[0x70] = OPCODE_CURRENT_OBJECT_NOT_PRESENT;
- _opcodeMap[0x80] = OPCODE_INVENTORY;
_opcodeMap[0x82] = OPCODE_MOVE_OBJECT_TO_ROOM;
_opcodeMap[0x84] = OPCODE_SAVE_ACTION;
- _opcodeMap[0x86] = OPCODE_VAR_ADD;
_opcodeMap[0x89] = OPCODE_SPECIAL;
- _opcodeMap[0x8a] = OPCODE_VAR_SUB;
_opcodeMap[0x8b] = OPCODE_SET_OBJECT_DESCRIPTION;
_opcodeMap[0x8c] = OPCODE_MOVE_DEFAULT;
_opcodeMap[0x8f] = OPCODE_SET_OBJECT_LONG_DESCRIPTION;
@@ -756,13 +747,11 @@ ComprehendGameV2::ComprehendGameV2() {
_opcodeMap[0xa2] = OPCODE_SET_OBJECT_GRAPHIC;
_opcodeMap[0xb1] = OPCODE_MOVE_DIR;
_opcodeMap[0xb5] = OPCODE_DESCRIBE_CURRENT_OBJECT;
- _opcodeMap[0xc1] = OPCODE_VAR_DEC;
_opcodeMap[0xc2] = OPCODE_SET_ROOM_GRAPHIC;
_opcodeMap[0xc6] = OPCODE_SET_OBJECT_GRAPHIC;
_opcodeMap[0xd1] = OPCODE_MOVE_DIRECTION;
_opcodeMap[0xd5] = OPCODE_DRAW_ROOM;
_opcodeMap[0xd9] = OPCODE_DRAW_OBJECT;
- _opcodeMap[0xdd] = OPCODE_VAR_INC;
_opcodeMap[0xe1] = OPCODE_MOVE_OBJECT_TO_CURRENT_ROOM;
_opcodeMap[0xed] = OPCODE_REMOVE_OBJECT;
_opcodeMap[0xf0] = OPCODE_DROP_CURRENT_OBJECT;
@@ -806,6 +795,11 @@ void ComprehendGameV2::execute_opcode(const Instruction *instr, const Sentence *
func_set_test_result(func_state, (item->_flags & ITEMF_WEIGHT_MASK) == ITEMF_WEIGHT_MASK);
break;
+ case OPCODE_OBJECT_CAN_TAKE:
+ GET_ITEM;
+ func_set_test_result(func_state, item->_flags & ITEMF_CAN_TAKE);
+ break;
+
case OPCODE_SET_STRING_REPLACEMENT3:
warning("TODO: Figure out OPCODE_SET_STRING_REPLACEMENT3 offset");
_currentReplaceWord = instr->_operand[0] - 1;
More information about the Scummvm-git-logs
mailing list