[Scummvm-git-logs] scummvm master -> 097561e242194db1f4d4e1683db3552e1d5d0508
dreammaster
paulfgilbert at gmail.com
Sat Dec 12 06:00:35 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
95e5a62908 GLK: COMPREHEND: Make note of second strings set Talisman has
097561e242 GLK: COMPREHEND: Room description pane when in full-screen text mode
Commit: 95e5a629084e3b9ff2809c86ae92a5ff5c0d24b8
https://github.com/scummvm/scummvm/commit/95e5a629084e3b9ff2809c86ae92a5ff5c0d24b8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-12-11T21:59:32-08:00
Commit Message:
GLK: COMPREHEND: Make note of second strings set Talisman has
Changed paths:
engines/glk/comprehend/game_tm.cpp
diff --git a/engines/glk/comprehend/game_tm.cpp b/engines/glk/comprehend/game_tm.cpp
index caa9b328a2..eb84d2cfe7 100644
--- a/engines/glk/comprehend/game_tm.cpp
+++ b/engines/glk/comprehend/game_tm.cpp
@@ -46,13 +46,14 @@ TalismanGame::TalismanGame() : ComprehendGameV2() {
_titleGraphicFile = "t0";
}
-#define STRINGS_SEGMENT 0x16490
+#define STRINGS_SEGMENT1 0x16490
+#define STRINGS_SEGMENT2 0x22fa0
#define BANKS_COUNT 15
#define STRINGS_PER_BANK 64
void TalismanGame::loadStrings() {
- uint16 bankOffsets[BANKS_COUNT];
- uint16 stringOffsets[STRINGS_PER_BANK + 1];
+ int bankOffsets[BANKS_COUNT];
+ int stringOffsets[STRINGS_PER_BANK + 1];
Common::File f;
if (!f.open("novel.exe"))
@@ -62,19 +63,25 @@ void TalismanGame::loadStrings() {
if (md5 != "0e7f002971acdb055f439020363512ce")
error("Unrecognised novel.exe encountered");
- f.seek(STRINGS_SEGMENT);
+ f.seek(STRINGS_SEGMENT1);
for (int bank = 0; bank < BANKS_COUNT; ++bank)
bankOffsets[bank] = f.readUint16LE();
// Iterate through the banks loading the strings
for (int bank = 0; bank < BANKS_COUNT; ++bank) {
- f.seek(STRINGS_SEGMENT + bankOffsets[bank]);
+ if (!bankOffsets[bank])
+ continue;
+
+ f.seek(STRINGS_SEGMENT1 + bankOffsets[bank]);
for (int strNum = 0; strNum <= STRINGS_PER_BANK; ++strNum)
stringOffsets[strNum] = f.readUint16LE();
for (int strNum = 0; strNum < STRINGS_PER_BANK; ++strNum) {
- f.seek(STRINGS_SEGMENT + bankOffsets[bank] + stringOffsets[strNum]);
- FileBuffer fb(&f, stringOffsets[strNum + 1] - stringOffsets[strNum]);
+ int size = stringOffsets[strNum + 1] - stringOffsets[strNum];
+ assert(size > 0);
+
+ f.seek(STRINGS_SEGMENT1 + bankOffsets[bank] + stringOffsets[strNum]);
+ FileBuffer fb(&f, size);
_strings.push_back(parseString(&fb));
}
}
Commit: 097561e242194db1f4d4e1683db3552e1d5d0508
https://github.com/scummvm/scummvm/commit/097561e242194db1f4d4e1683db3552e1d5d0508
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-12-11T21:59:32-08:00
Commit Message:
GLK: COMPREHEND: Room description pane when in full-screen text mode
Changed paths:
engines/glk/comprehend/comprehend.cpp
engines/glk/comprehend/comprehend.h
engines/glk/comprehend/game.cpp
engines/glk/comprehend/game.h
engines/glk/glk.cpp
diff --git a/engines/glk/comprehend/comprehend.cpp b/engines/glk/comprehend/comprehend.cpp
index 09ad9b2e4f..240a41d346 100644
--- a/engines/glk/comprehend/comprehend.cpp
+++ b/engines/glk/comprehend/comprehend.cpp
@@ -45,7 +45,8 @@ namespace Comprehend {
Comprehend *g_comprehend;
-Comprehend::Comprehend(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc), _topWindow(nullptr), _bottomWindow(nullptr),
+Comprehend::Comprehend(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc),
+ _topWindow(nullptr), _bottomWindow(nullptr), _roomDescWindow(nullptr),
_drawSurface(nullptr), _game(nullptr), _pics(nullptr), _saveSlot(-1),
_graphicsEnabled(true), _drawFlags(0), _disableSaves(false) {
g_comprehend = this;
@@ -101,6 +102,7 @@ void Comprehend::initialize() {
void Comprehend::deinitialize() {
glk_window_close(_topWindow);
glk_window_close(_bottomWindow);
+ glk_window_close(_roomDescWindow);
}
void Comprehend::createDebugger() {
@@ -128,8 +130,7 @@ void Comprehend::print(const char *fmt, ...) {
Common::String msg = Common::String::vformat(fmt, argp);
va_end(argp);
- glk_put_string_stream(glk_window_get_stream(_bottomWindow),
- msg.c_str());
+ glk_put_string_stream(glk_window_get_stream(_bottomWindow), msg.c_str());
}
void Comprehend::print(const Common::U32String fmt, ...) {
@@ -140,8 +141,29 @@ void Comprehend::print(const Common::U32String fmt, ...) {
Common::U32String::vformat(fmt.begin(), fmt.end(), outputMsg, argp);
va_end(argp);
- glk_put_string_stream_uni(glk_window_get_stream(_bottomWindow),
- outputMsg.u32_str());
+ glk_put_string_stream_uni(glk_window_get_stream(_bottomWindow), outputMsg.u32_str());
+}
+
+void Comprehend::printRoomDesc(const Common::String &desc) {
+ if (_roomDescWindow) {
+ glk_window_clear(_roomDescWindow);
+
+ // Get the grid width and do a word wrap
+ uint width;
+ glk_window_get_size(_roomDescWindow, &width, nullptr);
+ Common::String str = desc;
+ str.wordWrap(width - 2);
+ str += '\n';
+
+ // Display the room description
+ while (!str.empty()) {
+ size_t idx = str.findFirstOf('\n');
+ Common::String line = Common::String::format(" %s", Common::String(str.c_str(), str.c_str() + idx + 1).c_str());
+ glk_put_string_stream(glk_window_get_stream(_roomDescWindow), line.c_str());
+
+ str = Common::String(str.c_str() + idx + 1);
+ }
+ }
}
void Comprehend::readLine(char *buffer, size_t maxLen) {
@@ -236,15 +258,25 @@ void Comprehend::clearScreen(bool isBright) {
drawPicture(isBright ? BRIGHT_ROOM : DARK_ROOM);
}
-void Comprehend::toggleGraphics() {
+bool Comprehend::toggleGraphics() {
if (_topWindow) {
// Remove the picture window
glk_window_close(_topWindow);
_topWindow = nullptr;
_graphicsEnabled = false;
+
+ // Add the room description window
+ _roomDescWindow = (TextGridWindow *)glk_window_open(_bottomWindow,
+ winmethod_Above | winmethod_Fixed, 5, wintype_TextGrid, 1);
+ return false;
+
} else {
+ glk_window_close(_roomDescWindow);
+ _roomDescWindow = nullptr;
+
// Create the window again
showGraphics();
+ return true;
}
}
diff --git a/engines/glk/comprehend/comprehend.h b/engines/glk/comprehend/comprehend.h
index 4a0e403d44..4e51906195 100644
--- a/engines/glk/comprehend/comprehend.h
+++ b/engines/glk/comprehend/comprehend.h
@@ -28,6 +28,7 @@
#include "glk/glk_api.h"
#include "glk/window_graphics.h"
#include "glk/window_text_buffer.h"
+#include "glk/window_text_grid.h"
namespace Glk {
namespace Comprehend {
@@ -53,6 +54,7 @@ private:
bool _disableSaves;
public:
GraphicsWindow *_topWindow;
+ TextGridWindow *_roomDescWindow;
TextBufferWindow *_bottomWindow;
DrawSurface *_drawSurface;
ComprehendGame *_game;
@@ -133,9 +135,14 @@ public:
/**
* Print unicode-string to the buffer window
- */
+ */
void print(const Common::U32String fmt, ...);
+ /**
+ * Prints the room description in the room description window
+ */
+ void printRoomDesc(const Common::String &desc);
+
/**
* Read an input line
*/
@@ -169,7 +176,7 @@ public:
/**
* Toggles whether the picture window is visible
*/
- void toggleGraphics();
+ bool toggleGraphics();
/**
* Ensures the picture window is visible
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index 41d3b6498b..13c526bb63 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -448,6 +448,15 @@ void ComprehendGame::describe_objects_in_current_room() {
}
}
+void ComprehendGame::updateRoomDesc() {
+ Room *room = get_room(_currentRoom);
+ uint room_desc_string = room->_stringDesc;
+ roomIsSpecial(_currentRoom, &room_desc_string);
+
+ Common::String desc = stringLookup(room_desc_string);
+ g_comprehend->printRoomDesc(desc);
+}
+
void ComprehendGame::update() {
Room *room = get_room(_currentRoom);
unsigned room_type, room_desc_string;
@@ -459,8 +468,11 @@ void ComprehendGame::update() {
room_type = roomIsSpecial(_currentRoom,
&room_desc_string);
- if (_updateFlags & UPDATE_ROOM_DESC)
- console_println(stringLookup(room_desc_string).c_str());
+ if (_updateFlags & UPDATE_ROOM_DESC) {
+ Common::String desc = stringLookup(room_desc_string);
+ console_println(desc.c_str());
+ g_comprehend->printRoomDesc(desc.c_str());
+ }
if ((_updateFlags & UPDATE_ITEM_LIST) && room_type == ROOM_IS_NORMAL)
describe_objects_in_current_room();
@@ -834,7 +846,8 @@ void ComprehendGame::read_input() {
break;
// Empty line, so toggle picture window visibility
- g_comprehend->toggleGraphics();
+ if (!g_comprehend->toggleGraphics())
+ updateRoomDesc();
g_comprehend->print(_("Picture window toggled\n"));
_updateFlags |= UPDATE_GRAPHICS;
diff --git a/engines/glk/comprehend/game.h b/engines/glk/comprehend/game.h
index a8b96d15d1..d6a60e2f7e 100644
--- a/engines/glk/comprehend/game.h
+++ b/engines/glk/comprehend/game.h
@@ -159,6 +159,7 @@ public:
void move_to(uint8 room);
Room *get_room(uint16 index);
Item *get_item(uint16 index);
+ void updateRoomDesc();
void update();
void update_graphics();
diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp
index 43a077bb25..a3505443f4 100644
--- a/engines/glk/glk.cpp
+++ b/engines/glk/glk.cpp
@@ -297,6 +297,7 @@ void GlkEngine::switchToWhiteOnBlack() {
_conf->_wMarginY = 0;
_conf->_tMarginY = 4;
_conf->_propInfo._caretColor = WHITE;
+ _conf->_monoInfo._caretColor = WHITE;
_conf->_windowColor = _conf->_windowSave = 0;
WindowStyle &ws1 = _conf->_tStyles[style_Normal];
@@ -306,6 +307,10 @@ void GlkEngine::switchToWhiteOnBlack() {
WindowStyle &ws2 = _conf->_tStyles[style_Input];
ws2.bg = BLACK;
ws2.fg = WHITE;
+
+ WindowStyle &ws3 = _conf->_gStyles[style_Normal];
+ ws3.bg = BLACK;
+ ws3.fg = WHITE;
}
} // End of namespace Glk
More information about the Scummvm-git-logs
mailing list