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

dreammaster paulfgilbert at gmail.com
Fri Jun 12 20:17:55 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:
e1a33d0041 GLK: COMPREHEND: Move header magicWord to a class field
d24d720aba GLK: COMPREHEND: Don't show 'You seee' items for Transylvania
f8870c5843 GLK: COMPREHEND: Toggle picture window when blank line entered


Commit: e1a33d0041e282f170bba9225e6ed875b65fab91
    https://github.com/scummvm/scummvm/commit/e1a33d0041e282f170bba9225e6ed875b65fab91
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-06-12T13:15:06-07:00

Commit Message:
GLK: COMPREHEND: Move header magicWord to a class field

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


diff --git a/engines/glk/comprehend/game_data.cpp b/engines/glk/comprehend/game_data.cpp
index 8ca5ccc007..d8cc643fb0 100644
--- a/engines/glk/comprehend/game_data.cpp
+++ b/engines/glk/comprehend/game_data.cpp
@@ -34,8 +34,6 @@ namespace Comprehend {
 static const char CHARSET[] = "..abcdefghijklmnopqrstuvwxyz .";
 static const char SPECIAL_CHARSET[] = "[]\n!\"#$%&'(),-/0123456789:;?<>";
 
-static uint16 magic_offset;
-
 void FunctionState::clear() {
 	test_result = true;
 	else_result = false;
@@ -154,7 +152,7 @@ void GameHeader::clear() {
 	addr_actions_vnn = 0;
 	addr_actions_vn = 0;
 	addr_actions_v = 0;
-	addr_vm = 0; // FIXME - functions
+	addr_vm = 0;
 	Common::fill(&room_direction_table[0], &room_direction_table[NR_DIRECTIONS], 0);
 }
 
@@ -162,6 +160,7 @@ void GameHeader::clear() {
 
 void GameData::clearGame() {
 	_header.clear();
+	_magicWord = 0;
 	_comprehendVersion = 0;
 	_startRoom = 0;
 	_currentRoom = 0;
@@ -186,7 +185,7 @@ void GameData::clearGame() {
 
 void GameData::parse_header_le16(FileBuffer *fb, uint16 *val) {
 	*val = fb->readUint16LE();
-	*val += (uint16)magic_offset;
+	*val += _magicWord;
 }
 
 uint8 GameData::parse_vm_instruction(FileBuffer *fb,
@@ -805,17 +804,17 @@ void GameData::parse_header(FileBuffer *fb) {
 	case 0x2000: /* Transylvania, Crimson Crown disk one */
 	case 0x4800: /* Crimson Crown disk two */
 		_comprehendVersion = 1;
-		magic_offset = (uint16)(-0x5a00 + 0x4);
+		_magicWord = (uint16)(-0x5a00 + 0x4);
 		break;
 
 	case 0x93f0: /* OO-Topos */
 		_comprehendVersion = 2;
-		magic_offset = (uint16) - 0x5a00;
+		_magicWord = (uint16)-0x5a00;
 		break;
 
 	case 0xa429: /* Talisman */
 		_comprehendVersion = 2;
-		magic_offset = (uint16) - 0x5a00;
+		_magicWord = (uint16)-0x5a00;
 		break;
 
 	default:
diff --git a/engines/glk/comprehend/game_data.h b/engines/glk/comprehend/game_data.h
index 206fcaed14..0edb5775eb 100644
--- a/engines/glk/comprehend/game_data.h
+++ b/engines/glk/comprehend/game_data.h
@@ -347,6 +347,8 @@ struct GameHeader {
 };
 
 class GameData {
+private:
+	uint16 _magicWord;
 protected:
 	Common::String _gameDataFile;
 	Common::Array<StringFile> _stringFiles;


Commit: d24d720abadb22b850a50d78b891a9991295b860
    https://github.com/scummvm/scummvm/commit/d24d720abadb22b850a50d78b891a9991295b860
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-06-12T13:15:06-07:00

Commit Message:
GLK: COMPREHEND: Don't show 'You seee' items for Transylvania

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


diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index c67ef5883d..696b2f4f8d 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -406,7 +406,9 @@ void ComprehendGame::update() {
 	if (_updateFlags & UPDATE_ROOM_DESC)
 		console_println(stringLookup(room_desc_string).c_str());
 
-	if ((_updateFlags & UPDATE_ITEM_LIST) &&
+	// TODO: Transylvania at least doesn't describe items in the room explicitly.
+	// Determine which games actually do so
+	if ((_updateFlags & UPDATE_ITEM_LIST) && _comprehendVersion == 2 &&
 	        room_type == ROOM_IS_NORMAL)
 		describe_objects_in_current_room();
 


Commit: f8870c58435ea07f795793169b4f3499a9a761a0
    https://github.com/scummvm/scummvm/commit/f8870c58435ea07f795793169b4f3499a9a761a0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-06-12T13:15:06-07:00

Commit Message:
GLK: COMPREHEND: Toggle picture window when blank line entered

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


diff --git a/engines/glk/comprehend/comprehend.cpp b/engines/glk/comprehend/comprehend.cpp
index 48f5c39a45..70f7306c08 100644
--- a/engines/glk/comprehend/comprehend.cpp
+++ b/engines/glk/comprehend/comprehend.cpp
@@ -82,14 +82,12 @@ void Comprehend::initialize() {
 	g_conf->_tMarginY = 4;
 
 	_bottomWindow = (TextBufferWindow *)glk_window_open(0, 0, 0, wintype_TextBuffer, 1);
-	_topWindow = (GraphicsWindow *)glk_window_open(_bottomWindow,
-	             winmethod_Above | winmethod_Fixed,
-	             160 * SCALE_FACTOR, wintype_Graphics, 2);
-
 	glk_set_window(_bottomWindow);
+
+	togglePictureVisibility();
 	_topWindow->fillRect(0, Rect(0, 0, _topWindow->_w, _topWindow->_h));
 
-	Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
+	const Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
 	_bottomWindow->_stream->setZColors(
 		pixelFormat.RGBToColor(0xff, 0xff, 0xff),
 		pixelFormat.RGBToColor(0, 0, 0)
@@ -183,8 +181,9 @@ Common::Error Comprehend::writeGameData(Common::WriteStream *ws) {
 }
 
 void Comprehend::drawPicture(uint pictureNum) {
-	glk_image_draw_scaled(_topWindow, pictureNum,
-	                      20 * SCALE_FACTOR, 0, G_RENDER_WIDTH * SCALE_FACTOR, G_RENDER_HEIGHT * SCALE_FACTOR);
+	if (_topWindow)
+		glk_image_draw_scaled(_topWindow, pictureNum,
+			20 * SCALE_FACTOR, 0, G_RENDER_WIDTH * SCALE_FACTOR, G_RENDER_HEIGHT * SCALE_FACTOR);
 }
 
 void Comprehend::drawLocationPicture(int pictureNum, bool clearBg) {
@@ -199,5 +198,22 @@ void Comprehend::clearScreen(bool isBright) {
 	drawPicture(isBright ? BRIGHT_ROOM : DARK_ROOM);
 }
 
+void Comprehend::togglePictureVisibility() {
+	if (_topWindow) {
+		// Remove the picture window
+		glk_window_close(_topWindow);
+		_topWindow = nullptr;
+	} else {
+		// Create the window again
+		_topWindow = (GraphicsWindow *)glk_window_open(_bottomWindow,
+			winmethod_Above | winmethod_Fixed,
+			160 * SCALE_FACTOR, wintype_Graphics, 2);
+	}
+
+	_graphicsEnabled = _topWindow != nullptr;
+	print(_("Picture window toggled\n"));
+}
+
+
 } // namespace Comprehend
 } // namespace Glk
diff --git a/engines/glk/comprehend/comprehend.h b/engines/glk/comprehend/comprehend.h
index 609d18e899..adb4210c1a 100644
--- a/engines/glk/comprehend/comprehend.h
+++ b/engines/glk/comprehend/comprehend.h
@@ -149,6 +149,18 @@ public:
 	 * Clear the picture area
 	 */
 	void clearScreen(bool isBright);
+
+	/**
+	 * Toggles whether the picture window is visible
+	 */
+	void togglePictureVisibility();
+
+	/**
+	 * Returns true if the picture area is visible
+	 */
+	bool isPictureVisible() const {
+		return _graphicsEnabled;
+	}
 };
 
 extern Comprehend *g_comprehend;
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index 696b2f4f8d..f226fb6710 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -1188,12 +1188,21 @@ void ComprehendGame::read_input() {
 	beforePrompt();
 	doBeforeTurn();
 
-	do {
+	for (;;) {
 		g_comprehend->print("> ");
 		g_comprehend->readLine(buffer, sizeof(buffer));
 		if (g_comprehend->shouldQuit())
 			return;
-	} while (strlen(buffer) == 0);
+
+		if (strlen(buffer) != 0)
+			break;
+
+		// Empty line, so toggle picture window visibility
+		g_comprehend->togglePictureVisibility();
+		_updateFlags |= UPDATE_GRAPHICS;
+		update_graphics();
+		continue;
+	}
 
 	// Re-comprehend special commands start with '!'
 	line = &buffer[0];




More information about the Scummvm-git-logs mailing list