From 8a595e7771aa89d06876e13d7ab6751e26da8982 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Fri, 29 Jan 2016 13:13:40 +0100 Subject: AGI: graphics rewrite + cleanup - graphics code fully rewritten - Apple IIgs font support - Amiga Topaz support - Word parser rewritten - menu code rewritten - removed forced 2 second delay on all room changes replaced with heuristic to detect situations, where it's required - lots of naming cleanup - new console commands show_map, screenobj, vmvars and vmflags - all sorts of hacks/workarounds removed - added SCI wait mouse cursor - added Apple IIgs mouse cursor - added Atari ST mouse cursor - added Amiga/Apple IIgs transition - added Atari ST transition - user can select another render mode and use Apple IIgs palette + transition for PC versions - inventory screen rewritten - SetSimple command now properly implemented - PreAGI Mickey: Sierra logo now shown - saved games: now saving controller key mapping also saving automatic save data (SetSimple command) - fixed invalid memory access when saving games (31 bytes were saved using Common::String c_ptr() Special Thanks to: - fuzzie for helping out with the Apple IIgs font + valgrind - eriktorbjorn for helping out with valgrind - LordHoto for figuring out the code, that caused invalid memory access in the original code, when saving a game - sev for help out with reversing the Amiga transition currently missing: - mouse support for menu - mouse support for system dialogs - predictive dialog support --- engines/agi/picture.h | 66 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 27 deletions(-) (limited to 'engines/agi/picture.h') diff --git a/engines/agi/picture.h b/engines/agi/picture.h index 9ff1e742f4..b1a272bedb 100644 --- a/engines/agi/picture.h +++ b/engines/agi/picture.h @@ -41,7 +41,8 @@ enum AgiPictureVersion { AGIPIC_C64, AGIPIC_V1, AGIPIC_V15, - AGIPIC_V2 + AGIPIC_V2, + AGIPIC_256 }; enum AgiPictureFlags { @@ -60,31 +61,49 @@ class PictureMgr { AgiBase *_vm; GfxMgr *_gfx; -private: +public: + PictureMgr(AgiBase *agi, GfxMgr *gfx); - void drawLine(int x1, int y1, int x2, int y2); - void dynamicDrawLine(); - void absoluteDrawLine(); - int isOkFillHere(int x, int y); - void agiFill(unsigned int x, unsigned int y); - void xCorner(bool skipOtherCoords = false); +private: + void draw_xCorner(bool skipOtherCoords = false); void yCorner(bool skipOtherCoords = false); - void fill(); int plotPatternPoint(int x, int y, int bitpos); void plotBrush(); - uint8 nextByte() { return _data[_foffs++]; } + byte getNextByte(); + byte getNextNibble(); public: - PictureMgr(AgiBase *agi, GfxMgr *gfx); - void putVirtPixel(int x, int y); - int decodePicture(int n, int clear, bool agi256 = false, int pic_width = _DEFAULT_WIDTH, int pic_height = _DEFAULT_HEIGHT); + int decodePicture(int16 resourceNr, bool clear, bool agi256 = false, int16 pic_width = _DEFAULT_WIDTH, int16 pic_height = _DEFAULT_HEIGHT); int decodePicture(byte* data, uint32 length, int clear, int pic_width = _DEFAULT_WIDTH, int pic_height = _DEFAULT_HEIGHT); int unloadPicture(int); void drawPicture(); - void showPic(int x = 0, int y = 0, int pic_width = _DEFAULT_WIDTH, int pic_height = _DEFAULT_HEIGHT); +private: + void drawPictureC64(); + void drawPictureV1(); + void drawPictureV15(); + void drawPictureV2(); + void drawPictureAGI256(); + + void draw_SetColor(); + void draw_SetPriority(); + void draw_SetNibbleColor(); + void draw_SetNibblePriority(); + + void draw_Line(int16 x1, int16 y1, int16 x2, int16 y2); + void draw_LineShort(); + void draw_LineAbsolute(); + + int draw_FillCheck(int16 x, int16 y); + void draw_Fill(int16 x, int16 y); + void draw_Fill(); + +public: + void showPic(); // <-- for regular AGI games + void showPic(int16 x, int16 y, int16 pic_width, int16 pic_height); // <-- for preAGI games + void showPicWithTransition(); uint8 *convertV3Pic(uint8 *src, uint32 len); void plotPattern(int x, int y); // public because it's used directly by preagi @@ -108,19 +127,12 @@ public: _height = h; } - void putPixel(int x, int y, uint8 color) { - _scrColor = color; - _priOn = false; - _scrOn = true; - putVirtPixel(x, y); - } - - bool isPictureLoaded() { return _data != NULL; } - private: + int16 _resourceNr; uint8 *_data; - uint32 _flen; - uint32 _foffs; + uint32 _dataSize; + uint32 _dataOffset; + bool _dataOffsetNibble; uint8 _patCode; uint8 _patNum; @@ -132,8 +144,8 @@ private: uint8 _minCommand; AgiPictureVersion _pictureVersion; - int _width, _height; - int _xOffset, _yOffset; + int16 _width, _height; + int16 _xOffset, _yOffset; int _flags; int _currentStep; -- cgit v1.2.3