aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2019-01-04 17:12:30 -0800
committerPaul Gilbert2019-01-04 17:12:30 -0800
commit18768f164a35d1d0d25da20f55c70f2c0d306b47 (patch)
tree8563801e8f533c76b1cd44f3607053b42de0dcb5 /engines
parentc41c6f33d53c896c35cda6ac761cdedf896d646c (diff)
downloadscummvm-rg350-18768f164a35d1d0d25da20f55c70f2c0d306b47.tar.gz
scummvm-rg350-18768f164a35d1d0d25da20f55c70f2c0d306b47.tar.bz2
scummvm-rg350-18768f164a35d1d0d25da20f55c70f2c0d306b47.zip
GLK: FROTZ: Cleanup of image drawing code
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/frotz/glk_interface.cpp17
-rw-r--r--engines/glk/frotz/glk_interface.h4
-rw-r--r--engines/glk/frotz/processor_windows.cpp22
-rw-r--r--engines/glk/picture.cpp6
4 files changed, 22 insertions, 27 deletions
diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp
index d6059ff943..ef1917b7eb 100644
--- a/engines/glk/frotz/glk_interface.cpp
+++ b/engines/glk/frotz/glk_interface.cpp
@@ -489,25 +489,20 @@ void GlkInterface::showBeyondZorkTitle() {
int saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
if (saveSlot == -1) {
- uint winW, winH, imgW, imgH;
winid_t win = glk_window_open(0, 0, 0, wintype_Graphics, 0);
- glk_window_get_size(win, &winW, &winH);
-
- if (os_picture_data(1, &imgW, &imgH)) {
- os_draw_picture(1, win, Common::Rect(0, 0, winW, winH));
- _events->waitForPress();
- }
+ glk_image_draw_scaled(win, 1, 0, 0, g_vm->_screen->w, g_vm->_screen->h);
+ _events->waitForPress();
glk_window_close(win, nullptr);
}
}
-void GlkInterface::os_draw_picture(int picture, winid_t win, const Common::Point &pos) {
- glk_image_draw(win, picture, pos.x - 1, pos.y - 1);
+void GlkInterface::os_draw_picture(int picture, const Common::Point &pos) {
+ glk_image_draw(_wp._background, picture, pos.x - 1, pos.y - 1);
}
-void GlkInterface::os_draw_picture(int picture, winid_t win, const Common::Rect &r) {
- glk_image_draw_scaled(win, picture, r.left, r.top, r.width(), r.height());
+void GlkInterface::os_draw_picture(int picture, const Common::Rect &r) {
+ glk_image_draw_scaled(_wp._background, picture, r.left, r.top, r.width(), r.height());
}
zchar GlkInterface::os_read_key(int timeout, bool show_cursor) {
diff --git a/engines/glk/frotz/glk_interface.h b/engines/glk/frotz/glk_interface.h
index 5027edb4d5..d3808013a4 100644
--- a/engines/glk/frotz/glk_interface.h
+++ b/engines/glk/frotz/glk_interface.h
@@ -171,12 +171,12 @@ protected:
/**
* Display a picture at the given coordinates. Top left is (1,1).
*/
- void os_draw_picture(int picture, winid_t win, const Common::Point &pos);
+ void os_draw_picture(int picture, const Common::Point &pos);
/**
* Display a picture using the specified bounds
*/
- void os_draw_picture(int picture, winid_t win, const Common::Rect &r);
+ void os_draw_picture(int picture, const Common::Rect &r);
/**
* Call the IO interface to play a sample.
diff --git a/engines/glk/frotz/processor_windows.cpp b/engines/glk/frotz/processor_windows.cpp
index 74ffdcceff..9842368a9f 100644
--- a/engines/glk/frotz/processor_windows.cpp
+++ b/engines/glk/frotz/processor_windows.cpp
@@ -48,21 +48,19 @@ void Processor::z_draw_picture() {
flush_buffer();
+ Window &win = _wp[cwin];
if (!x || !y) {
- // Currently I only support getting the cursor for the text grid area
- assert(cwin == 1);
- winid_t win = _wp._upper;
- Point cursPos = win->getCursor();
+
// use cursor column if x-coordinate is 0
if (!x)
- x = cursPos.x;
+ x = win[X_CURSOR];
// use cursor line if y-coordinate is 0
if (!y)
- y = cursPos.y;
+ y = win[Y_CURSOR];
}
-// y += cwp->y_pos - 1;
-// x += cwp->x_pos - 1;
+ y += win[Y_POS] - 1;
+ x += win[X_POS] - 1;
/* The following is necessary to make Amiga and Macintosh story
* files work with MCGA graphics files. Some screen-filling
@@ -83,18 +81,18 @@ void Processor::z_draw_picture() {
if (_storyId == ARTHUR && pic == 54)
delta = h_screen_width / 160;
- os_draw_picture(mapper[i].pic1, _wp._lower, Point(x + delta, y + height1));
- os_draw_picture(mapper[i].pic2, _wp._lower, Point(x + width1 - width2 - delta, y + height1));
+ os_draw_picture(mapper[i].pic1, Point(x + delta, y + height1));
+ os_draw_picture(mapper[i].pic2, Point(x + width1 - width2 - delta, y + height1));
}
}
- os_draw_picture(pic, _wp._lower, Point(x, y));
+ os_draw_picture(pic, Point(x, y));
if (_storyId == SHOGUN && pic == 3) {
uint height, width;
os_picture_data(59, &height, &width);
- os_draw_picture(59, _wp._lower, Point(h_screen_width - width + 1, y));
+ os_draw_picture(59, Point(h_screen_width - width + 1, y));
}
}
diff --git a/engines/glk/picture.cpp b/engines/glk/picture.cpp
index c7c8f70b6d..2cebcb2780 100644
--- a/engines/glk/picture.cpp
+++ b/engines/glk/picture.cpp
@@ -32,8 +32,10 @@ namespace Glk {
void Pictures::clear() {
for (uint idx = 0; idx < _store.size(); ++idx) {
- _store[idx]._picture->decrement();
- _store[idx]._scaled->decrement();
+ if (_store[idx]._picture)
+ _store[idx]._picture->decrement();
+ if (_store[idx]._scaled)
+ _store[idx]._scaled->decrement();
}
_store.clear();