[Scummvm-git-logs] scummvm master -> 0ede777f55124480e469ad5fb23e865f61e48edf
dreammaster
paulfgilbert at gmail.com
Sat Aug 3 05:29:56 CEST 2019
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:
2eb7479d91 GLK: Fix VS uninitialized field warnings
0ede777f55 GLK: FROTZ: Title screen for Arthur is partially showing
Commit: 2eb7479d91ae82a5e8fcc4c6e00d282b467e4ae1
https://github.com/scummvm/scummvm/commit/2eb7479d91ae82a5e8fcc4c6e00d282b467e4ae1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-08-02T19:45:14-07:00
Commit Message:
GLK: Fix VS uninitialized field warnings
Changed paths:
engines/glk/frotz/windows.cpp
engines/glk/glk.cpp
diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp
index 8ebc263..848dddb 100644
--- a/engines/glk/frotz/windows.cpp
+++ b/engines/glk/frotz/windows.cpp
@@ -82,7 +82,7 @@ void Windows::setWindow(int win) {
/*--------------------------------------------------------------------------*/
-Window::Window() : _windows(nullptr), _win(nullptr), _quotes(0), _dashes(0), _spaces(0),
+Window::Window() : _windows(nullptr), _win(nullptr), _quotes(0), _dashes(0), _spaces(0), _index(-1),
_currFont(TEXT_FONT), _prevFont(TEXT_FONT), _tempFont(TEXT_FONT), _currStyle(0), _oldStyle(0) {
Common::fill(_properties, _properties + TRUE_BG_COLOR + 1, 0);
_properties[Y_POS] = _properties[X_POS] = 1;
diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp
index 892094a..cffdd8b 100644
--- a/engines/glk/glk.cpp
+++ b/engines/glk/glk.cpp
@@ -48,8 +48,8 @@ GlkEngine *g_vm;
GlkEngine::GlkEngine(OSystem *syst, const GlkGameDescription &gameDesc) :
_gameDescription(gameDesc), Engine(syst), _random("Glk"), _blorb(nullptr),
_clipboard(nullptr), _conf(nullptr), _debugger(nullptr), _events(nullptr), _pictures(nullptr),
- _screen(nullptr), _selection(nullptr), _sounds(nullptr), _windows(nullptr),
- _copySelect(false), _terminated(false), _pcSpeaker(nullptr),
+ _screen(nullptr), _selection(nullptr), _sounds(nullptr), _streams(nullptr), _windows(nullptr),
+ _copySelect(false), _terminated(false), _pcSpeaker(nullptr), _loadSaveSlot(-1),
gli_register_obj(nullptr), gli_unregister_obj(nullptr), gli_register_arr(nullptr),
gli_unregister_arr(nullptr) {
// Set up debug channels
Commit: 0ede777f55124480e469ad5fb23e865f61e48edf
https://github.com/scummvm/scummvm/commit/0ede777f55124480e469ad5fb23e865f61e48edf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-08-02T20:29:51-07:00
Commit Message:
GLK: FROTZ: Title screen for Arthur is partially showing
Changed paths:
engines/glk/events.cpp
engines/glk/events.h
engines/glk/frotz/glk_interface.cpp
engines/glk/frotz/windows.cpp
engines/glk/frotz/windows.h
diff --git a/engines/glk/events.cpp b/engines/glk/events.cpp
index ba132b5..bb8dc96 100644
--- a/engines/glk/events.cpp
+++ b/engines/glk/events.cpp
@@ -384,15 +384,25 @@ bool Events::isModifierKey(const Common::KeyCode &keycode) const {
|| keycode == Common::KEYCODE_SCROLLOCK;
}
-void Events::waitForPress() {
+uint Events::getKeypress() {
Common::Event e;
- do {
+ while (!g_vm->shouldQuit()) {
g_system->getEventManager()->pollEvent(e);
g_system->delayMillis(10);
checkForNextFrameCounter();
- } while (!g_vm->shouldQuit() && (e.type != Common::EVENT_KEYDOWN || isModifierKey(e.kbd.keycode))
- && e.type != Common::EVENT_LBUTTONDOWN && e.type != Common::EVENT_RBUTTONDOWN && e.type != Common::EVENT_MBUTTONDOWN);
+
+ if (e.type == Common::EVENT_KEYDOWN && !isModifierKey(e.kbd.keycode))
+ return e.kbd.keycode;
+ if (e.type == Common::EVENT_LBUTTONDOWN)
+ return Common::KEYCODE_SPACE;
+ }
+
+ return 0;
+}
+
+void Events::waitForPress() {
+ getKeypress();
}
void Events::setCursor(CursorId cursorId) {
diff --git a/engines/glk/events.h b/engines/glk/events.h
index 2a4f10c..99a25f6 100644
--- a/engines/glk/events.h
+++ b/engines/glk/events.h
@@ -249,6 +249,11 @@ public:
void store(EvType type, Window *win, uint val1 = 0, uint val2 = 0);
/**
+ * Wait for a keypress
+ */
+ uint getKeypress();
+
+ /**
* Wait for a keyboard or mouse press
*/
void waitForPress();
diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp
index 1587cf4..6f50654 100644
--- a/engines/glk/frotz/glk_interface.cpp
+++ b/engines/glk/frotz/glk_interface.cpp
@@ -542,9 +542,9 @@ void GlkInterface::showBeyondZorkTitle() {
void GlkInterface::os_draw_picture(int picture, const Common::Point &pos) {
assert(pos.x != 0 && pos.y != 0);
- if (_wp._cwin == 0) {
+ if (_wp._cwin == 0 && _wp._lower) {
// Picture embedded within the lower text area
- glk_image_draw(_wp._lower, picture, imagealign_MarginLeft, 0);
+ _wp._lower.imageDraw(picture, imagealign_MarginLeft, 0);
} else {
glk_image_draw(_wp._background, picture,
(pos.x - 1) * g_conf->_monoInfo._cellW,
@@ -554,6 +554,7 @@ void GlkInterface::os_draw_picture(int picture, const Common::Point &pos) {
void GlkInterface::os_draw_picture(int picture, const Common::Rect &r) {
Point cell(g_conf->_monoInfo._cellW, g_conf->_monoInfo._cellH);
+
glk_image_draw_scaled(_wp._background, picture, (r.left - 1) * cell.x, (r.top - 1) * cell.y,
r.width() * cell.x, r.height() * cell.y);
}
@@ -584,38 +585,46 @@ int GlkInterface::os_peek_color() {
}
zchar GlkInterface::os_read_key(int timeout, bool show_cursor) {
- event_t ev;
- winid_t win = _wp.currWin() ? _wp.currWin() : _wp._lower;
+ Window &win = _wp.currWin() ? _wp.currWin() : _wp._lower;
+ uint key;
- if (gos_linepending)
- gos_cancel_pending_line();
+ if (win) {
+ // Get a keypress from a window
+ if (gos_linepending)
+ gos_cancel_pending_line();
- glk_request_char_event_uni(win);
- if (timeout != 0)
- glk_request_timer_events(timeout * 100);
+ glk_request_char_event_uni(win);
+ if (timeout != 0)
+ glk_request_timer_events(timeout * 100);
- while (!shouldQuit()) {
- glk_select(&ev);
- if (ev.type == evtype_Arrange) {
- gos_update_height();
- gos_update_width();
- } else if (ev.type == evtype_Timer) {
- glk_cancel_char_event(win);
- glk_request_timer_events(0);
- return ZC_TIME_OUT;
- } else if (ev.type == evtype_CharInput)
- break;
- }
- if (shouldQuit())
- return 0;
+ event_t ev;
+ while (!shouldQuit()) {
+ glk_select(&ev);
+ if (ev.type == evtype_Arrange) {
+ gos_update_height();
+ gos_update_width();
+ } else if (ev.type == evtype_Timer) {
+ glk_cancel_char_event(win);
+ glk_request_timer_events(0);
+ return ZC_TIME_OUT;
+ } else if (ev.type == evtype_CharInput)
+ break;
+ }
+ if (shouldQuit())
+ return 0;
- glk_request_timer_events(0);
+ glk_request_timer_events(0);
- if (_wp._upper && mach_status_ht < curr_status_ht)
- reset_status_ht();
- curr_status_ht = 0;
+ if (_wp._upper && mach_status_ht < curr_status_ht)
+ reset_status_ht();
+ curr_status_ht = 0;
+ key = ev.val1;
+ } else {
+ // No active window, so get a raw keypress
+ key = _events->getKeypress();
+ }
- switch (ev.val1) {
+ switch (key) {
case keycode_Escape: return ZC_ESCAPE;
case keycode_PageUp: return ZC_ARROW_MIN;
case keycode_PageDown: return ZC_ARROW_MAX;
@@ -627,7 +636,7 @@ zchar GlkInterface::os_read_key(int timeout, bool show_cursor) {
case keycode_Delete: return ZC_BACKSPACE;
case keycode_Tab: return ZC_INDENT;
default:
- return ev.val1;
+ return key;
}
}
diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp
index 848dddb..d3748b5 100644
--- a/engines/glk/frotz/windows.cpp
+++ b/engines/glk/frotz/windows.cpp
@@ -339,5 +339,21 @@ void Window::checkRepositionLower() {
}
}
+bool Window::imageDraw(uint image, int val1, int val2) {
+ if (!_win)
+ _win = g_vm->glk_window_open(g_vm->glk_window_get_root(),
+ winmethod_Arbitrary | winmethod_Fixed, 0, wintype_Graphics, 0);
+
+ return g_vm->glk_image_draw(_win, image, val1, val2);
+}
+
+bool Window::imageDrawScaled(uint image, int val1, int val2, uint width, uint height) {
+ if (!_win)
+ _win = g_vm->glk_window_open(g_vm->glk_window_get_root(),
+ winmethod_Arbitrary | winmethod_Fixed, 0, wintype_Graphics, 0);
+
+ return g_vm->glk_image_draw_scaled(_win, image, val1, val2, width, height);
+}
+
} // End of namespace Frotz
} // End of namespace Glk
diff --git a/engines/glk/frotz/windows.h b/engines/glk/frotz/windows.h
index fe59cc7..8043a10 100644
--- a/engines/glk/frotz/windows.h
+++ b/engines/glk/frotz/windows.h
@@ -197,6 +197,16 @@ public:
* Set reverse video
*/
void setReverseVideo(bool reverse);
+
+ /**
+ * Draw an image
+ */
+ bool imageDraw(uint image, int val1, int val2);
+
+ /**
+ * Draw a scaled image
+ */
+ bool imageDrawScaled(uint image, int val1, int val2, uint width, uint height);
};
/**
More information about the Scummvm-git-logs
mailing list