mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-07 02:39:56 +00:00
GLK: FROTZ: Cleanup of image drawing code
This commit is contained in:
parent
c41c6f33d5
commit
18768f164a
@ -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) {
|
||||
|
@ -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.
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user