aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2019-08-02 20:29:51 -0700
committerPaul Gilbert2019-08-02 20:29:51 -0700
commit0ede777f55124480e469ad5fb23e865f61e48edf (patch)
tree8c30ef4cfb82c18d0dbecfdd1fb65d6d3a2dbed9 /engines
parent2eb7479d91ae82a5e8fcc4c6e00d282b467e4ae1 (diff)
downloadscummvm-rg350-0ede777f55124480e469ad5fb23e865f61e48edf.tar.gz
scummvm-rg350-0ede777f55124480e469ad5fb23e865f61e48edf.tar.bz2
scummvm-rg350-0ede777f55124480e469ad5fb23e865f61e48edf.zip
GLK: FROTZ: Title screen for Arthur is partially showing
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/events.cpp18
-rw-r--r--engines/glk/events.h5
-rw-r--r--engines/glk/frotz/glk_interface.cpp67
-rw-r--r--engines/glk/frotz/windows.cpp16
-rw-r--r--engines/glk/frotz/windows.h10
5 files changed, 83 insertions, 33 deletions
diff --git a/engines/glk/events.cpp b/engines/glk/events.cpp
index ba132b5fbe..bb8dc963e3 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 2a4f10cb8f..99a25f6ad1 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 1587cf40ec..6f5065421b 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 848dddb3b3..d3748b5849 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 fe59cc7e00..8043a103ba 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);
};
/**