diff options
Diffstat (limited to 'engines/glk/frotz')
-rw-r--r-- | engines/glk/frotz/frotz.cpp | 5 | ||||
-rw-r--r-- | engines/glk/frotz/frotz.h | 5 | ||||
-rw-r--r-- | engines/glk/frotz/pics_decoder.cpp | 6 | ||||
-rw-r--r-- | engines/glk/frotz/screen.cpp | 16 | ||||
-rw-r--r-- | engines/glk/frotz/screen.h | 12 |
5 files changed, 41 insertions, 3 deletions
diff --git a/engines/glk/frotz/frotz.cpp b/engines/glk/frotz/frotz.cpp index d3b0749649..421b7785a6 100644 --- a/engines/glk/frotz/frotz.cpp +++ b/engines/glk/frotz/frotz.cpp @@ -22,6 +22,7 @@ #include "glk/frotz/frotz.h" #include "glk/frotz/frotz_types.h" +#include "glk/frotz/screen.h" #include "common/config-manager.h" namespace Glk { @@ -38,6 +39,10 @@ Frotz::~Frotz() { reset_memory(); } +Screen *Frotz::createScreen() { + return new FrotzScreen(); +} + void Frotz::runGame(Common::SeekableReadStream *gameFile) { story_fp = gameFile; initialize(); diff --git a/engines/glk/frotz/frotz.h b/engines/glk/frotz/frotz.h index 0dd8b69e89..22604e59bd 100644 --- a/engines/glk/frotz/frotz.h +++ b/engines/glk/frotz/frotz.h @@ -32,6 +32,11 @@ namespace Frotz { * Frotz interpreter for Z-code games */ class Frotz : public Processor { +protected: + /** + * Create the screen class + */ + virtual Screen *createScreen() override; public: /** * Constructor diff --git a/engines/glk/frotz/pics_decoder.cpp b/engines/glk/frotz/pics_decoder.cpp index d601874ca5..6dde910508 100644 --- a/engines/glk/frotz/pics_decoder.cpp +++ b/engines/glk/frotz/pics_decoder.cpp @@ -42,15 +42,14 @@ Common::SeekableReadStream *PictureDecoder::decode(Common::ReadStream &src, uint Common::MemoryWriteStreamDynamic out(DisposeAfterUse::NO); byte buf[512]; byte transparent; - int colour_shift; - int first_colour; + int colour_shift = 0; + int first_colour = 0; int code, prev_code = 0; int next_entry; int bits_per_code; int bits_shift; int bits; int bufpos = 0; - int i; /* * Write out dimensions of image @@ -83,6 +82,7 @@ Common::SeekableReadStream *PictureDecoder::decode(Common::ReadStream &src, uint first_colour = 65; break; default: + error("Unsupported mode"); break; } diff --git a/engines/glk/frotz/screen.cpp b/engines/glk/frotz/screen.cpp index eef6d6118d..a71217cc26 100644 --- a/engines/glk/frotz/screen.cpp +++ b/engines/glk/frotz/screen.cpp @@ -21,10 +21,26 @@ */ #include "glk/frotz/screen.h" +#include "common/file.h" +#include "image/bmp.h" namespace Glk { namespace Frotz { +void FrotzScreen::loadFonts(Common::Archive *archive) { + Screen::loadFonts(archive); + + Image::BitmapDecoder decoder; + Common::File f; + if (!f.open("infocom_graphics.bmp", *archive)) + error("Could not load font"); + + decoder.loadStream(f); + _fonts.push_back(new Frotz::BitmapFont(*decoder.getSurface())); +} + +/*--------------------------------------------------------------------------*/ + BitmapFont::BitmapFont(const Graphics::Surface &src, uint charWidth, uint charHeight, unsigned char startingChar) : _startingChar(startingChar) { assert(src.format.bytesPerPixel == 1); diff --git a/engines/glk/frotz/screen.h b/engines/glk/frotz/screen.h index dac716c436..d8b2b89a3f 100644 --- a/engines/glk/frotz/screen.h +++ b/engines/glk/frotz/screen.h @@ -28,11 +28,23 @@ #include "common/archive.h" #include "common/array.h" #include "common/rect.h" +#include "glk/screen.h" namespace Glk { namespace Frotz { /** + * Derived screen class that adds in the Infocom character graphics font + */ +class FrotzScreen : public Glk::Screen { +protected: + /** + * Load the fonts + */ + virtual void loadFonts(Common::Archive *archive) override; +}; + +/** * Implements a fixed width font stored as a grid on a passed surface */ class BitmapFont : public Graphics::Font { |