[Scummvm-git-logs] scummvm master -> f16d48c93d1e6f4d3f64b95ea8b86a199c51cb54

dreammaster paulfgilbert at gmail.com
Sun Jul 5 03:15:36 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:
4f8fb4a92e GLK: COMPREHEND: Rename object for better clarity
c492a5e602 GLK: COMPREHEND: Correctly map noun references
f16d48c93d GLK: COMPREHEND: Implement CC throneroom cutscene


Commit: 4f8fb4a92e749bad48c53a14557a5f2ac71e914b
    https://github.com/scummvm/scummvm/commit/4f8fb4a92e749bad48c53a14557a5f2ac71e914b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-07-04T16:57:12-07:00

Commit Message:
GLK: COMPREHEND: Rename object for better clarity

Changed paths:
    engines/glk/comprehend/debugger_dumper.cpp
    engines/glk/comprehend/game.cpp
    engines/glk/comprehend/game_data.h
    engines/glk/comprehend/opcode_map.cpp


diff --git a/engines/glk/comprehend/debugger_dumper.cpp b/engines/glk/comprehend/debugger_dumper.cpp
index 8d1e21f442..957b5b7600 100644
--- a/engines/glk/comprehend/debugger_dumper.cpp
+++ b/engines/glk/comprehend/debugger_dumper.cpp
@@ -53,7 +53,7 @@ DebuggerDumper::DebuggerDumper() : _game(nullptr) {
 	_opcodes[OPCODE_OR] = "or";
 	_opcodes[OPCODE_IN_ROOM] = "in_room";
 	_opcodes[OPCODE_VAR_EQ] = "var_eq";
-	_opcodes[OPCODE_OBJECT_NOT_VALID] = "object_not_valid";
+	_opcodes[OPCODE_CURRENT_OBJECT_NOT_VALID] = "current_object_not_valid";
 	_opcodes[OPCODE_INVENTORY_FULL] = "inventory_full";
 	_opcodes[OPCODE_OBJECT_PRESENT] = "object_present";
 	_opcodes[OPCODE_ELSE] = "else";
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index c7c596ef27..d7d090e06e 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -828,7 +828,7 @@ void ComprehendGame::eval_instruction(FunctionState *func_state,
 		                     item->_room == _currentRoom);
 		break;
 
-	case OPCODE_OBJECT_NOT_VALID:
+	case OPCODE_CURRENT_OBJECT_NOT_VALID:
 		func_set_test_result(func_state, !noun);
 		break;
 
diff --git a/engines/glk/comprehend/game_data.h b/engines/glk/comprehend/game_data.h
index a873f6cd54..de35e3b2a8 100644
--- a/engines/glk/comprehend/game_data.h
+++ b/engines/glk/comprehend/game_data.h
@@ -59,7 +59,7 @@ enum {
 	OPCODE_OBJECT_PRESENT,
 	OPCODE_ELSE,
 	OPCODE_OBJECT_IN_ROOM,
-	OPCODE_OBJECT_NOT_VALID,
+	OPCODE_CURRENT_OBJECT_NOT_VALID,
 	OPCODE_INVENTORY_FULL,
 	OPCODE_TEST_FLAG,
 	OPCODE_CURRENT_OBJECT_IN_ROOM,
diff --git a/engines/glk/comprehend/opcode_map.cpp b/engines/glk/comprehend/opcode_map.cpp
index 646e94853d..add15c50e5 100644
--- a/engines/glk/comprehend/opcode_map.cpp
+++ b/engines/glk/comprehend/opcode_map.cpp
@@ -48,7 +48,7 @@ void OpcodeMap::loadVersion1() {
 	_opcodeMap[0x09] = OPCODE_OBJECT_PRESENT;
 	_opcodeMap[0x0c] = OPCODE_ELSE;
 	_opcodeMap[0x0e] = OPCODE_OBJECT_IN_ROOM;
-	_opcodeMap[0x14] = OPCODE_OBJECT_NOT_VALID;
+	_opcodeMap[0x14] = OPCODE_CURRENT_OBJECT_NOT_VALID;
 	_opcodeMap[0x18] = OPCODE_INVENTORY_FULL;
 	_opcodeMap[0x19] = OPCODE_TEST_FLAG;
 	_opcodeMap[0x1d] = OPCODE_CURRENT_OBJECT_IN_ROOM;
@@ -108,7 +108,7 @@ void OpcodeMap::loadVersion2() {
 	_opcodeMap[0x09] = OPCODE_OBJECT_PRESENT;
 	_opcodeMap[0x0c] = OPCODE_ELSE;
 	_opcodeMap[0x11] = OPCODE_OBJECT_IS_NOWHERE;
-	_opcodeMap[0x14] = OPCODE_OBJECT_NOT_VALID;
+	_opcodeMap[0x14] = OPCODE_CURRENT_OBJECT_NOT_VALID;
 	_opcodeMap[0x19] = OPCODE_TEST_FLAG;
 	_opcodeMap[0x1d] = OPCODE_TEST_ROOM_FLAG;
 	_opcodeMap[0x20] = OPCODE_HAVE_CURRENT_OBJECT;


Commit: c492a5e602668e6817386084eb6acbe4dc201ddc
    https://github.com/scummvm/scummvm/commit/c492a5e602668e6817386084eb6acbe4dc201ddc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-07-04T19:45:17-07:00

Commit Message:
GLK: COMPREHEND: Correctly map noun references

Changed paths:
    engines/glk/comprehend/game.cpp
    engines/glk/comprehend/game.h


diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index d7d090e06e..bb3843063e 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -372,11 +372,11 @@ bool ComprehendGame::handle_restart() {
 	}
 }
 
-Item *ComprehendGame::get_item_by_noun(const Word *noun) {
+Item *ComprehendGame::get_item_by_noun(byte noun) {
 	uint i;
 
-	if (!noun || !(noun->_type & WORD_TYPE_NOUN_MASK))
-		return NULL;
+	if (!noun)
+		return nullptr;
 
 	/*
 	 * FIXME - in oo-topos the word 'box' matches more than one object
@@ -384,7 +384,7 @@ Item *ComprehendGame::get_item_by_noun(const Word *noun) {
 	 *         to drop the latter because this will match the former.
 	 */
 	for (i = 0; i < _items.size(); i++)
-		if (_items[i]._word == noun->_index)
+		if (_items[i]._word == noun)
 			return &_items[i];
 
 	return NULL;
@@ -547,8 +547,10 @@ void ComprehendGame::move_object(Item *item, int new_room) {
 }
 
 void ComprehendGame::eval_instruction(FunctionState *func_state,
-		const Instruction *instr, const Word *verb, const Word *noun) {
+		const Instruction *instr, const Sentence *sentence) {
 	const byte *opcode_map = _opcodeMap;
+	byte verb = sentence ? sentence->_formattedWords[0] : 0;
+	byte noun = sentence ? sentence->_formattedWords[2] : 0;
 	Room *room;
 	Item *item;
 	uint16 index;
@@ -662,13 +664,12 @@ void ComprehendGame::eval_instruction(FunctionState *func_state,
 		break;
 
 	case OPCODE_MOVE_DEFAULT:
-		/* Move in the direction dictated by the current verb */
-		if (verb->_index - 1 >= NR_DIRECTIONS)
-			error("Bad verb %d:%d in move",
-			      verb->_index, verb->_type);
+		// Move in the direction dictated by the current verb
+		if (verb - 1 >= NR_DIRECTIONS)
+			error("Bad verb %d in move", verb);
 
-		if (room->_direction[verb->_index - 1])
-			move_to(room->_direction[verb->_index - 1]);
+		if (room->_direction[verb - 1])
+			move_to(room->_direction[verb - 1]);
 		else
 			console_println(stringLookup(STRING_CANT_GO).c_str());
 		break;
@@ -735,8 +736,7 @@ void ComprehendGame::eval_instruction(FunctionState *func_state,
 			for (i = 0; i < _items.size(); i++) {
 				Item *itemP = &_items[i];
 
-				if (itemP->_word == noun->_index &&
-				        itemP->_room == instr->_operand[0]) {
+				if (itemP->_word == noun && itemP->_room == instr->_operand[0]) {
 					test = true;
 					break;
 				}
@@ -997,7 +997,7 @@ void ComprehendGame::eval_instruction(FunctionState *func_state,
 			      index, _functions.size());
 
 		debugC(kDebugScripts, "Calling subfunction %.4x", index);
-		eval_function(_functions[index], verb, noun);
+		eval_function(_functions[index], sentence);
 		break;
 
 	case OPCODE_TEST_FALSE:
@@ -1024,6 +1024,9 @@ void ComprehendGame::eval_instruction(FunctionState *func_state,
 		break;
 
 	case OPCODE_SET_CURRENT_NOUN_STRING_REPLACEMENT:
+		#if 1
+		error("TODO: OPCODE_SET_CURRENT_NOUN_STRING_REPLACEMENT");
+		#else
 		/*
 		 * FIXME - Not sure what the operand is for,
 		 * maybe capitalisation?
@@ -1036,6 +1039,7 @@ void ComprehendGame::eval_instruction(FunctionState *func_state,
 			_currentReplaceWord = 1;
 		else
 			_currentReplaceWord = 2;
+		#endif
 		break;
 
 	case OPCODE_DRAW_ROOM:
@@ -1071,8 +1075,7 @@ void ComprehendGame::eval_instruction(FunctionState *func_state,
 	}
 }
 
-void ComprehendGame::eval_function(const Function &func,
-		const Word *verb, const Word *noun) {
+void ComprehendGame::eval_function(const Function &func, const Sentence *sentence) {
 	FunctionState func_state;
 	uint i;
 
@@ -1088,8 +1091,7 @@ void ComprehendGame::eval_function(const Function &func,
 			break;
 		}
 
-		eval_instruction(&func_state, &func[i],
-		                 verb, noun);
+		eval_instruction(&func_state, &func[i], sentence);
 	}
 }
 
@@ -1206,7 +1208,7 @@ bool ComprehendGame::handle_sentence(uint tableNum, Sentence *sentence, Common::
 		if (isMatch) {
 			// Match
 			const Function &func = _functions[action._function];
-			eval_function(func, &sentence->_words[0], &sentence->_words[1]);
+			eval_function(func, sentence);
 			return true;
 		}
 	}
@@ -1292,7 +1294,7 @@ void ComprehendGame::doBeforeTurn() {
 	beforeTurn();
 
 	// Run the each turn functions
-	eval_function(_functions[0], nullptr, nullptr);
+	eval_function(_functions[0], nullptr);
 
 	update();
 }
diff --git a/engines/glk/comprehend/game.h b/engines/glk/comprehend/game.h
index 78ab24bd14..06b50fad9f 100644
--- a/engines/glk/comprehend/game.h
+++ b/engines/glk/comprehend/game.h
@@ -45,13 +45,13 @@ public:
 	const GameStrings *_gameStrings;
 
 private:
-	Item *get_item_by_noun(const Word *noun);
+	Item *get_item_by_noun(byte noun);
 	void describe_objects_in_current_room();
 	void update();
 	void func_set_test_result(FunctionState *func_state, bool value);
 	size_t num_objects_in_room(int room);
 	void eval_instruction(FunctionState *func_state, const Instruction *instr,
-		const Word *verb, const Word *noun);
+		const Sentence *sentence);
 	void skip_whitespace(char **p);
 	void skip_non_whitespace(char **p);
 	bool handle_sentence(Sentence *sentence);
@@ -84,7 +84,7 @@ protected:
 	 * is reached. Otherwise the commands instructions are skipped over and the
 	 * next test sequence (if there is one) is tried.
 	 */
-	void eval_function(const Function &func, const Word *verb, const Word *noun);
+	void eval_function(const Function &func, const Sentence *sentence);
 
 	void parse_header(FileBuffer *fb) override {
 		GameData::parse_header(fb);


Commit: f16d48c93d1e6f4d3f64b95ea8b86a199c51cb54
    https://github.com/scummvm/scummvm/commit/f16d48c93d1e6f4d3f64b95ea8b86a199c51cb54
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-07-04T20:15:22-07:00

Commit Message:
GLK: COMPREHEND: Implement CC throneroom cutscene

Changed paths:
    engines/glk/comprehend/game.h
    engines/glk/comprehend/game_cc.cpp
    engines/glk/comprehend/game_cc.h


diff --git a/engines/glk/comprehend/game.h b/engines/glk/comprehend/game.h
index 06b50fad9f..6698b5db90 100644
--- a/engines/glk/comprehend/game.h
+++ b/engines/glk/comprehend/game.h
@@ -47,7 +47,6 @@ public:
 private:
 	Item *get_item_by_noun(byte noun);
 	void describe_objects_in_current_room();
-	void update();
 	void func_set_test_result(FunctionState *func_state, bool value);
 	size_t num_objects_in_room(int room);
 	void eval_instruction(FunctionState *func_state, const Instruction *instr,
@@ -116,6 +115,7 @@ public:
 	void move_to(uint8 room);
 	Room *get_room(uint16 index);
 	Item *get_item(uint16 index);
+	void update();
 	void update_graphics();
 
 	/**
diff --git a/engines/glk/comprehend/game_cc.cpp b/engines/glk/comprehend/game_cc.cpp
index feaf6bf74b..868b15e67e 100644
--- a/engines/glk/comprehend/game_cc.cpp
+++ b/engines/glk/comprehend/game_cc.cpp
@@ -84,13 +84,15 @@ void CrimsonCrownGame::handleSpecialOpcode(uint8 operand) {
 	switch (operand) {
 	case 1:
 		// Crystyal ball cutscene
-		assert(_diskNum == 1);
-		crystalBallCutscene();
+		if (_diskNum == 1) {
+			crystalBallCutscene();
+		} else {
+			throneCutscene();
+		}
 		break;
 
 	case 3:
 		// Game over - failure
-		_newDiskNum = 1;
 		game_restart();
 		break;
 
@@ -135,7 +137,16 @@ void CrimsonCrownGame::crystalBallCutscene() {
 		if (g_comprehend->shouldQuit())
 			return;
 	}
-} 
+}
+
+void CrimsonCrownGame::throneCutscene() {
+	// Show the screen
+	update();
+	console_println(stringLookup(0x20A).c_str());
+
+	// Handle what happens in climatic showdown
+	eval_function(_functions[14], nullptr);
+}
 
 void CrimsonCrownGame::beforePrompt() {
 	// Clear the Sabrina/Erik action flags
diff --git a/engines/glk/comprehend/game_cc.h b/engines/glk/comprehend/game_cc.h
index 1f4a8882c7..c12a602015 100644
--- a/engines/glk/comprehend/game_cc.h
+++ b/engines/glk/comprehend/game_cc.h
@@ -39,6 +39,11 @@ private:
 	 */
 	void crystalBallCutscene();
 
+	/**
+	 * Start of throneroom cutscene
+	 */
+	void throneCutscene();
+
 protected:
 	bool handle_restart() override;
 public:




More information about the Scummvm-git-logs mailing list