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

dreammaster paulfgilbert at gmail.com
Wed Sep 9 01:56:05 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:
46702ce2bc GLK: COMPREHEND: Add extra info to script debugs
4c806b63a1 GLK: COMPREHEND: Fix loading of OOTopis strings
b0f778130e NUVIE: Rename clashing ScrollEventType enum


Commit: 46702ce2bc246623f30755e975536ae81d00d21e
    https://github.com/scummvm/scummvm/commit/46702ce2bc246623f30755e975536ae81d00d21e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-09-08T18:45:40-07:00

Commit Message:
GLK: COMPREHEND: Add extra info to script debugs

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


diff --git a/engines/glk/comprehend/comprehend.cpp b/engines/glk/comprehend/comprehend.cpp
index 0b4046fa76..6fb3f15305 100644
--- a/engines/glk/comprehend/comprehend.cpp
+++ b/engines/glk/comprehend/comprehend.cpp
@@ -157,6 +157,7 @@ void Comprehend::readLine(char *buffer, size_t maxLen) {
 	}
 
 	buffer[ev.val1] = 0;
+	debug(1, "\n> %s", buffer);
 }
 
 int Comprehend::readChar() {
diff --git a/engines/glk/comprehend/debugger_dumper.cpp b/engines/glk/comprehend/debugger_dumper.cpp
index 957b5b7600..c27b774394 100644
--- a/engines/glk/comprehend/debugger_dumper.cpp
+++ b/engines/glk/comprehend/debugger_dumper.cpp
@@ -156,7 +156,6 @@ Common::String DebuggerDumper::dumpInstruction(ComprehendGame *game,
 		break;
 	}
 
-	line += "\n";
 	return line;
 }
 
@@ -174,7 +173,7 @@ void DebuggerDumper::dumpFunction(uint functionNum) {
 	print("[%.4x] (%u instructions)\n", functionNum, func.size());
 	for (uint i = 0; i < func.size(); i++) {
 		Common::String line = dumpInstruction(_game, NULL, &func[i]);
-		print("%s", line.c_str());
+		print("%s\n", line.c_str());
 	}
 
 	print("\n");
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index bb3843063e..1abaebc7ed 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -547,7 +547,7 @@ void ComprehendGame::move_object(Item *item, int new_room) {
 }
 
 void ComprehendGame::eval_instruction(FunctionState *func_state,
-		const Instruction *instr, const Sentence *sentence) {
+		const Function &func, uint functionOffset, const Sentence *sentence) {
 	const byte *opcode_map = _opcodeMap;
 	byte verb = sentence ? sentence->_formattedWords[0] : 0;
 	byte noun = sentence ? sentence->_formattedWords[2] : 0;
@@ -557,6 +557,7 @@ void ComprehendGame::eval_instruction(FunctionState *func_state,
 	bool test;
 	uint i, count;
 
+	const Instruction *instr = &func[functionOffset];
 	room = get_room(_currentRoom);
 
 	if (DebugMan.isDebugChannelEnabled(kDebugScripts)) {
@@ -570,6 +571,7 @@ void ComprehendGame::eval_instruction(FunctionState *func_state,
 				line += "- ";
 		}
 
+		line += Common::String::format("%.2x  ", functionOffset);
 		line += g_debugger->dumpInstruction(this, func_state, instr);
 		debugC(kDebugScripts, "%s", line.c_str());
 	}
@@ -996,8 +998,7 @@ void ComprehendGame::eval_instruction(FunctionState *func_state,
 			error("Bad function %.4x >= %.4x\n",
 			      index, _functions.size());
 
-		debugC(kDebugScripts, "Calling subfunction %.4x", index);
-		eval_function(_functions[index], sentence);
+		eval_function(index, sentence);
 		break;
 
 	case OPCODE_TEST_FALSE:
@@ -1075,13 +1076,16 @@ void ComprehendGame::eval_instruction(FunctionState *func_state,
 	}
 }
 
-void ComprehendGame::eval_function(const Function &func, const Sentence *sentence) {
+void ComprehendGame::eval_function(uint functionNum, const Sentence *sentence) {
 	FunctionState func_state;
 	uint i;
 
+	const Function &func = _functions[functionNum];
 	func_state._elseResult = true;
 	func_state._executed = false;
 
+	debugC(kDebugScripts, "Start of function %.4x", functionNum);
+
 	for (i = 0; i < func.size(); i++) {
 		if (func_state._executed && !func[i]._isCommand) {
 			/*
@@ -1091,8 +1095,10 @@ void ComprehendGame::eval_function(const Function &func, const Sentence *sentenc
 			break;
 		}
 
-		eval_instruction(&func_state, &func[i], sentence);
+		eval_instruction(&func_state, func, i, sentence);
 	}
+
+	debugC(kDebugScripts, "End of function %.4x\n", functionNum);
 }
 
 void ComprehendGame::skip_whitespace(char **p) {
@@ -1207,8 +1213,7 @@ bool ComprehendGame::handle_sentence(uint tableNum, Sentence *sentence, Common::
 
 		if (isMatch) {
 			// Match
-			const Function &func = _functions[action._function];
-			eval_function(func, sentence);
+			eval_function(action._function, sentence);
 			return true;
 		}
 	}
@@ -1294,7 +1299,7 @@ void ComprehendGame::doBeforeTurn() {
 	beforeTurn();
 
 	// Run the each turn functions
-	eval_function(_functions[0], nullptr);
+	eval_function(0, nullptr);
 
 	update();
 }
diff --git a/engines/glk/comprehend/game.h b/engines/glk/comprehend/game.h
index 6698b5db90..d31070c737 100644
--- a/engines/glk/comprehend/game.h
+++ b/engines/glk/comprehend/game.h
@@ -49,7 +49,8 @@ private:
 	void describe_objects_in_current_room();
 	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,
+	void eval_instruction(FunctionState *func_state,
+		const Function &func, uint functionOffset,
 		const Sentence *sentence);
 	void skip_whitespace(char **p);
 	void skip_non_whitespace(char **p);
@@ -83,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 Sentence *sentence);
+	void eval_function(uint functionNum, const Sentence *sentence);
 
 	void parse_header(FileBuffer *fb) override {
 		GameData::parse_header(fb);
diff --git a/engines/glk/comprehend/game_cc.cpp b/engines/glk/comprehend/game_cc.cpp
index be0ceb7949..14fdfc9de7 100644
--- a/engines/glk/comprehend/game_cc.cpp
+++ b/engines/glk/comprehend/game_cc.cpp
@@ -150,7 +150,7 @@ void CrimsonCrownGame::throneCutscene() {
 	console_println(stringLookup(0x20A).c_str());
 
 	// Handle what happens in climatic showdown
-	eval_function(_functions[14], nullptr);
+	eval_function(14, nullptr);
 }
 
 void CrimsonCrownGame::beforePrompt() {


Commit: 4c806b63a1db1b90aad1f7817d0b5cee61bd7ccb
    https://github.com/scummvm/scummvm/commit/4c806b63a1db1b90aad1f7817d0b5cee61bd7ccb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-09-08T18:45:40-07:00

Commit Message:
GLK: COMPREHEND: Fix loading of OOTopis strings

Changed paths:
    engines/glk/comprehend/game_data.cpp


diff --git a/engines/glk/comprehend/game_data.cpp b/engines/glk/comprehend/game_data.cpp
index ee09087e7a..9fc1f1ca89 100644
--- a/engines/glk/comprehend/game_data.cpp
+++ b/engines/glk/comprehend/game_data.cpp
@@ -631,7 +631,7 @@ void GameData::load_extra_string_file(const StringFile &stringFile) {
 
 	if (stringFile._baseOffset > 0) {
 		// Explicit offset specified, so read the strings in sequentially
-		uint endOffset = stringFile._baseOffset;
+		uint endOffset = stringFile._endOffset;
 		if (!endOffset)
 			endOffset = fb.size();
 


Commit: b0f778130e55372c7d67e98939d569022819123a
    https://github.com/scummvm/scummvm/commit/b0f778130e55372c7d67e98939d569022819123a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-09-08T18:55:42-07:00

Commit Message:
NUVIE: Rename clashing ScrollEventType enum

Changed paths:
    engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h


diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
index 6ca22ba2ad..a7fdb76de0 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
@@ -240,7 +240,7 @@ void MsgScrollNewUI::Display(bool full_redraw) {
 }
 
 GUI_status MsgScrollNewUI::KeyDown(const Common::KeyState &key) {
-	ScrollEventType event = SCROLL_ESCAPE;
+	MsgScrollEventType event = SCROLL_ESCAPE;
 	/*
 	    switch(key.keycode)
 	    {
@@ -256,12 +256,12 @@ GUI_status MsgScrollNewUI::KeyDown(const Common::KeyState &key) {
 }
 
 GUI_status MsgScrollNewUI::MouseDown(int x, int y, Shared::MouseButton button) {
-	ScrollEventType event = SCROLL_ESCAPE;
+	MsgScrollEventType event = SCROLL_ESCAPE;
 
 	return scroll_movement_event(event);
 }
 
-GUI_status MsgScrollNewUI::scroll_movement_event(ScrollEventType event) {
+GUI_status MsgScrollNewUI::scroll_movement_event(MsgScrollEventType event) {
 	switch (event) {
 	case SCROLL_UP :
 		if (position > 0) {
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
index 8df0b88ef8..f949f70261 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
@@ -43,7 +43,7 @@ typedef enum {
 	SCROLL_UP,
 	SCROLL_DOWN,
 	SCROLL_ESCAPE
-} ScrollEventType;
+} MsgScrollEventType;
 
 class MsgScrollNewUI: public MsgScroll {
 
@@ -99,7 +99,7 @@ protected:
 	MsgLine *add_new_line() override;
 
 private:
-	GUI_status scroll_movement_event(ScrollEventType event);
+	GUI_status scroll_movement_event(MsgScrollEventType event);
 	uint16 count_empty_lines(Std::string s);
 
 };




More information about the Scummvm-git-logs mailing list