diff options
Diffstat (limited to 'engines/agi/graphics.h')
-rw-r--r-- | engines/agi/graphics.h | 136 |
1 files changed, 95 insertions, 41 deletions
diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h index 506a9d93d6..a89a7fdabc 100644 --- a/engines/agi/graphics.h +++ b/engines/agi/graphics.h @@ -27,6 +27,11 @@ namespace Agi { +#define SCRIPT_WIDTH 160 +#define SCRIPT_HEIGHT 168 +#define DISPLAY_WIDTH 320 +#define DISPLAY_HEIGHT 200 + #define GFX_WIDTH 320 #define GFX_HEIGHT 200 #define CHAR_COLS 8 @@ -34,66 +39,115 @@ namespace Agi { class AgiEngine; +enum GfxScreenMasks { + GFX_SCREEN_MASK_VISUAL = 1, + GFX_SCREEN_MASK_PRIORITY = 2, + GFX_SCREEN_MASK_ALL = GFX_SCREEN_MASK_VISUAL|GFX_SCREEN_MASK_PRIORITY +}; + +struct MouseCursorData { + const byte *bitmapData; + uint16 width; + uint16 height; + int hotspotX; + int hotspotY; +}; + class GfxMgr { private: AgiBase *_vm; - uint8 _palette[256 * 3]; - uint8 *_agiScreen; - unsigned char *_screen; - - uint8 *_shakeH, *_shakeV; + uint8 _paletteGfxMode[256 * 3]; + uint8 _paletteTextMode[256 * 3]; uint8 _agipalPalette[16 * 3]; int _agipalFileNum; - int _currentCursorPalette; // 0 - palette not set, 1 - PC, 2 - Amiga - -private: - void rawDrawButton(int x, int y, const char *s, int fgcolor, int bgcolor, bool border, int textOffset); public: GfxMgr(AgiBase *vm); - void gfxPutBlock(int x1, int y1, int x2, int y2); - - void putTextCharacter(int, int, int, unsigned char, int, int, bool checkerboard = false, const uint8 *font = fontData_Sierra); - void shakeScreen(int); - void shakeStart(); - void shakeEnd(); - void saveScreen(); - void restoreScreen(); - int initVideo(); int deinitVideo(); - void scheduleUpdate(int, int, int, int); - void doUpdate(); - void putScreen(); - void flushBlock(int, int, int, int); - void flushBlockA(int, int, int, int); - void putPixelsA(int, int, int, uint8 *); - void flushScreen(); - void clearScreen(int); - void clearConsoleScreen(int); - void drawBox(int, int, int, int, int, int, int); - void drawDefaultStyleButton(int, int, const char *, int, int, int fgcolor = 0, int bgcolor = 0); - void drawCurrentStyleButton(int x, int y, const char *label, bool hasFocus, bool pressed = false, bool positive = true); - int testButton(int, int, const char *); - void drawRectangle(int, int, int, int, int); - void saveBlock(int, int, int, int, uint8 *); - void restoreBlock(int, int, int, int, uint8 *); - void initPalette(const uint8 *p, uint colorCount = 16, uint fromBits = 6, uint toBits = 8); + void initPalette(uint8 *destPalette, const uint8 *paletteData, uint colorCount = 16, uint fromBits = 6, uint toBits = 8); void setAGIPal(int); int getAGIPalFileNum(); - void drawFrame(int x1, int y1, int x2, int y2, int c1, int c2); + void setPalette(bool GfxModePalette); - void putBlock(int x1, int y1, int x2, int y2); - void gfxSetPalette(); - void setCursor(bool amigaStyleCursor = false, bool busy = false); - void setCursorPalette(bool amigaStylePalette = false); + void initMouseCursor(MouseCursorData *mouseCursor, const byte *bitmapData, uint16 width, uint16 height, int hotspotX, int hotspotY); + void setMouseCursor(bool busy = false); - void printCharacter(int, int, char, int, int); int initMachine(); int deinitMachine(); + + void setRenderStartOffset(uint16 offsetY); + +private: + uint _pixels; + //uint16 _displayWidth; + //uint16 _displayHeight; + uint _displayPixels; + + byte *_activeScreen; + byte *_visualScreen; // 160x168 + byte *_priorityScreen; // 160x168 + byte *_displayScreen; // 320x200 + + bool _priorityTableSet; + uint8 _priorityTable[SCRIPT_HEIGHT]; /**< priority table */ + + MouseCursorData _mouseCursor; + MouseCursorData _mouseCursorBusy; + + uint16 _renderStartOffsetY; + +public: + void debugShowMap(int mapNr); + + void clear(byte color, byte priority); + void clearDisplay(byte color, bool copyToScreen = true); + void putPixel(int16 x, int16 y, byte drawMask, byte color, byte priority); + void putPixelOnDisplay(int16 x, int16 y, byte color); + + byte getColor(int16 x, int16 y); + byte getPriority(int16 x, int16 y); + bool checkControlPixel(int16 x, int16 y, byte newPriority); + + byte getCGAMixtureColor(byte color); + + void render_Block(int16 x, int16 y, int16 width, int16 height, bool copyToScreen = true); + bool render_Clip(int16 &x, int16 &y, int16 &width, int16 &height, int16 clipAgainstWidth = SCRIPT_WIDTH, int16 clipAgainstHeight = SCRIPT_HEIGHT); + +private: + void render_BlockEGA(int16 x, int16 y, int16 width, int16 height, bool copyToScreen); + void render_BlockCGA(int16 x, int16 y, int16 width, int16 height, bool copyToScreen); + +public: + void transition_Amiga(); + void transition_AtariSt(); + + void block_save(int16 x, int16 y, int16 width, int16 height, byte *bufferPtr); + void block_restore(int16 x, int16 y, int16 width, int16 height, byte *bufferPtr); + + void copyDisplayRectToScreen(int16 x, int16 y, int16 width, int16 height); + + void drawBox(int16 x, int16 y, int16 width, int16 height, byte backgroundColor, byte lineColor); + void drawRect(int16 x, int16 y, int16 width, int16 height, byte color); + void drawDisplayRect(int16 x, int16 y, int16 width, int16 height, byte color); +private: + void drawDisplayRectEGA(int16 x, int16 y, int16 width, int16 height, byte color); + void drawDisplayRectCGA(int16 x, int16 y, int16 width, int16 height, byte color); + +public: + void drawCharacter(int16 row, int16 column, byte character, byte foreground, byte background, bool disabledLook); + + void shakeScreen(int16 repeatCount); + void updateScreen(); + + void initPriorityTable(); + void setPriorityTable(int16 priorityBase); + void setPriority(int16 yPos, int16 priority); + int16 priorityToY(int16 priority); + int16 priorityFromY(int16 yPos); }; } // End of namespace Agi |