diff options
Diffstat (limited to 'engines/adl/display_a2.h')
-rw-r--r-- | engines/adl/display_a2.h | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/engines/adl/display_a2.h b/engines/adl/display_a2.h index 4e84facd58..8de3a775c7 100644 --- a/engines/adl/display_a2.h +++ b/engines/adl/display_a2.h @@ -36,9 +36,10 @@ public: kGfxWidth = 280, kGfxHeight = 192, kGfxPitch = kGfxWidth / 7, - kGfxSize = kGfxWidth * kGfxHeight, + kGfxSize = kGfxPitch * kGfxHeight, kTextWidth = 40, - kTextHeight = 24 + kTextHeight = 24, + kSplitHeight = 32 }; void init() override; @@ -47,7 +48,7 @@ public: uint getGfxWidth() const { return kGfxWidth; } uint getGfxHeight() const { return kGfxHeight; } uint getGfxPitch() const { return kGfxPitch; } - void loadFrameBuffer(Common::ReadStream &stream, byte *dst); + void loadFrameBuffer(Common::ReadStream &stream, byte *dst) const ; void loadFrameBuffer(Common::ReadStream &stream); void putPixel(const Common::Point &p, byte color); void setPixelByte(const Common::Point &p, byte color); @@ -63,13 +64,60 @@ public: void showCursor(bool enable) override; protected: + class TextReader { + public: + static uint16 getBits(const Display_A2 *display, uint y, uint x) { + const uint charPos = (y >> 3) * kTextWidth + x; + byte m = display->_textBuf[charPos]; + + if (display->_showCursor && charPos == display->_cursorPos) + m = (m & 0x3f) | 0x40; + + byte b = _font[m & 0x3f][y % 8]; + + if (!(m & 0x80) && (!(m & 0x40) || display->_blink)) + b = ~b; + + return b & 0x7f; + } + + static uint8 getStartY(const Display_A2 *display) { + if (display->_mode == kModeText) + return 0; + else + return kGfxHeight - kSplitHeight; + } + + static uint8 getEndY(const Display_A2 *display) { return kGfxHeight; } + }; + + class GfxReader { + public: + static uint16 getBits(const Display_A2 *display, uint y, uint x) { + return display->_frameBuf[y * kGfxPitch + x]; + } + + static uint8 getStartY(const Display_A2 *display) { return 0; } + + static uint8 getEndY(const Display_A2 *display) { + if (display->_mode == kModeGraphics) + return kGfxHeight; + else + return kGfxHeight - kSplitHeight; + } + }; + byte *_frameBuf; bool _showCursor; + bool _enableColor; + bool _enableScanlines; + bool _enableMonoText; + bool _blink; private: void writeFrameBuffer(const Common::Point &p, byte color, byte mask); - virtual void showScanlines(bool enable) { }; + static const byte _font[64][8]; }; Display_A2 *Display_A2_create(); |