diff options
author | Paul Gilbert | 2018-11-23 11:38:30 -0800 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 |
commit | 0b1e695f249d695333279eaf711b779c43b7b13d (patch) | |
tree | 570cb74bd70a7a128815172a458ac0ab25cc45a9 /engines/glk/frotz/glk_interface.cpp | |
parent | 720ef67a7d124f1d83fdea68879461bca9429a9b (diff) | |
download | scummvm-rg350-0b1e695f249d695333279eaf711b779c43b7b13d.tar.gz scummvm-rg350-0b1e695f249d695333279eaf711b779c43b7b13d.tar.bz2 scummvm-rg350-0b1e695f249d695333279eaf711b779c43b7b13d.zip |
GLK: FROTZ: Beginnings of support for Infocom picture files
Diffstat (limited to 'engines/glk/frotz/glk_interface.cpp')
-rw-r--r-- | engines/glk/frotz/glk_interface.cpp | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp index a8b25a2d76..2790e3009d 100644 --- a/engines/glk/frotz/glk_interface.cpp +++ b/engines/glk/frotz/glk_interface.cpp @@ -21,13 +21,16 @@ */ #include "glk/frotz/glk_interface.h" +#include "glk/frotz/pics.h" +#include "glk/conf.h" +#include "glk/screen.h" namespace Glk { namespace Frotz { GlkInterface::GlkInterface(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc), - oldstyle(0), curstyle(0), cury(1), curx(1), fixforced(0), + _pics(nullptr), oldstyle(0), curstyle(0), cury(1), curx(1), fixforced(0), curr_fg(-2), curr_bg(-2), curr_font(1), prev_font(1), temp_font(0), curr_status_ht(0), mach_status_ht(0), gos_status(nullptr), gos_upper(nullptr), gos_lower(nullptr), gos_curwin(nullptr), gos_linepending(0), gos_linebuf(nullptr), @@ -38,6 +41,10 @@ GlkInterface::GlkInterface(OSystem *syst, const GlkGameDescription &gameDesc) : Common::fill(&statusline[0], &statusline[256], '\0'); } +GlkInterface::~GlkInterface() { + delete _pics; +} + void GlkInterface::initialize() { uint width, height; @@ -152,8 +159,13 @@ void GlkInterface::initialize() { h_font_height = 1; // Must be after screen dimensions are computed - if (h_version == V6) { - h_flags &= ~GRAPHICS_FLAG; + if (g_conf->_graphics) { + if (_blorb) + // Blorb file containers allow graphics + h_flags |= GRAPHICS_FLAG; + else if ((h_version == V6 || _storyId == BEYOND_ZORK) && initPictures()) + // Earlier Infocom game with picture files + h_flags |= GRAPHICS_FLAG; } // Use the ms-dos interpreter number for v6, because that's the @@ -170,6 +182,18 @@ void GlkInterface::initialize() { } } +bool GlkInterface::initPictures() { + if (Pics::exists()) { + _pics = new Pics(); + SearchMan.add("Pics", _pics, 99, false); + return true; + } + + if (h_version == V6) + warning("Could not locate MG1 file"); + return false; +} + int GlkInterface::os_char_width(zchar z) { return 1; } @@ -234,6 +258,18 @@ void GlkInterface::os_stop_sample(int a) { void GlkInterface::os_beep(int volume) { } +bool GlkInterface::os_picture_data(int picture, glui32 *height, glui32 *width) { + if (_pics && picture == 0) { + *width = _pics->version(); + *height = _pics->size(); + return true; + } else { + return glk_image_get_info(picture, width, height); + } +} + + + void GlkInterface::start_sample(int number, int volume, int repeats, zword eos) { // TODO } @@ -405,6 +441,24 @@ void GlkInterface::gos_cancel_pending_line() { gos_linepending = 0; } +void GlkInterface::os_restart_game(RestartAction stage) { + // Show Beyond Zork's title screen + if ((stage == RESTART_END) && (_storyId == BEYOND_ZORK)) { +/* + uint w, h; + if (os_picture_data(1, &h, &w)) { + _screen->clear(); + os_draw_picture(1, Common::Point(1, 1)); + _events->waitForPress(); + } + */ + } +} + +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); +} + zchar GlkInterface::os_read_key(int timeout, bool show_cursor) { event_t ev; winid_t win = gos_curwin ? gos_curwin : gos_lower; |