diff options
-rw-r--r-- | engines/sci/engine/savegame.cpp | 10 | ||||
-rw-r--r-- | engines/sci/graphics/gui.cpp | 5 | ||||
-rw-r--r-- | engines/sci/graphics/gui.h | 2 | ||||
-rw-r--r-- | engines/sci/graphics/gui32.cpp | 3 | ||||
-rw-r--r-- | engines/sci/graphics/gui32.h | 4 | ||||
-rw-r--r-- | engines/sci/graphics/ports.cpp | 3 | ||||
-rw-r--r-- | engines/sci/graphics/ports.h | 3 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 19 | ||||
-rw-r--r-- | engines/sci/sci.h | 3 |
9 files changed, 17 insertions, 35 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 02fdde5622..97872253cb 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -983,15 +983,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { // Message state: s->_msgState = new MessageState(s->_segMan); -#ifdef ENABLE_SCI32 - if (g_sci->_gui32) { - g_sci->_gui32->init(); - } else { -#endif - g_sci->_gui->init(g_sci->_features->usesOldGfxFunctions()); -#ifdef ENABLE_SCI32 - } -#endif + g_sci->initGraphics(); s->abortScriptProcessing = kAbortLoadGame; s->shrinkStackToBase(); diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp index 7febbeba69..a450870079 100644 --- a/engines/sci/graphics/gui.cpp +++ b/engines/sci/graphics/gui.cpp @@ -86,9 +86,4 @@ SciGui::~SciGui() { delete _coordAdjuster; } -void SciGui::init(bool usesOldGfxFunctions) { - _ports->init(usesOldGfxFunctions, this, _paint16, _text16); - _paint16->init(_animate, _text16); -} - } // End of namespace Sci diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h index c3954286b3..26028e0cc5 100644 --- a/engines/sci/graphics/gui.h +++ b/engines/sci/graphics/gui.h @@ -49,8 +49,6 @@ public: SciGui(EngineState *s, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor, GfxPorts *ports, AudioPlayer *audio); virtual ~SciGui(); - virtual void init(bool usesOldGfxFunctions); - protected: GfxCursor *_cursor; EngineState *_s; diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp index fb2da08ae5..c953ed7f70 100644 --- a/engines/sci/graphics/gui32.cpp +++ b/engines/sci/graphics/gui32.cpp @@ -66,9 +66,6 @@ SciGui32::~SciGui32() { delete _coordAdjuster; } -void SciGui32::init() { -} - void SciGui32::drawRobot(GuiResourceId robotId) { Robot *test = new Robot(g_sci->getResMan(), _screen, robotId); test->draw(); diff --git a/engines/sci/graphics/gui32.h b/engines/sci/graphics/gui32.h index 2c73272566..2be37d0aaf 100644 --- a/engines/sci/graphics/gui32.h +++ b/engines/sci/graphics/gui32.h @@ -44,10 +44,6 @@ public: SciGui32(SegManager *segMan, EventManager *event, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor); ~SciGui32(); - void init(); - - void textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight); - void drawRobot(GuiResourceId robotId); protected: diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp index d230c1eb9f..b8d38910d1 100644 --- a/engines/sci/graphics/ports.cpp +++ b/engines/sci/graphics/ports.cpp @@ -54,11 +54,10 @@ GfxPorts::~GfxPorts() { delete _menuPort; } -void GfxPorts::init(bool usesOldGfxFunctions, SciGui *gui, GfxPaint16 *paint16, GfxText16 *text16) { +void GfxPorts::init(bool usesOldGfxFunctions, GfxPaint16 *paint16, GfxText16 *text16) { int16 offTop = 10; _usesOldGfxFunctions = usesOldGfxFunctions; - _gui = gui; _paint16 = paint16; _text16 = text16; diff --git a/engines/sci/graphics/ports.h b/engines/sci/graphics/ports.h index c8ce6b3470..818f92f44f 100644 --- a/engines/sci/graphics/ports.h +++ b/engines/sci/graphics/ports.h @@ -45,7 +45,7 @@ public: GfxPorts(SegManager *segMan, GfxScreen *screen); ~GfxPorts(); - void init(bool usesOldGfxFunctions, SciGui *gui, GfxPaint16 *paint16, GfxText16 *text16); + void init(bool usesOldGfxFunctions, GfxPaint16 *paint16, GfxText16 *text16); void kernelSetActive(uint16 portId); Common::Rect kernelGetPicWindow(int16 &picTop, int16 &picLeft); @@ -102,7 +102,6 @@ private: typedef Common::List<Port *> PortList; SegManager *_segMan; - SciGui *_gui; GfxPaint16 *_paint16; GfxScreen *_screen; GfxText16 *_text16; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 2680da9d39..7dba21b800 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -47,6 +47,7 @@ #include "sci/graphics/gui.h" #include "sci/graphics/maciconbar.h" #include "sci/graphics/menu.h" +#include "sci/graphics/paint16.h" #include "sci/graphics/ports.h" #include "sci/graphics/palette.h" #include "sci/graphics/cursor.h" @@ -254,14 +255,7 @@ Common::Error SciEngine::run() { syncSoundSettings(); -#ifdef ENABLE_SCI32 - if (_gui32) - _gui32->init(); - else -#endif - _gui->init(_features->usesOldGfxFunctions()); - // Set default (EGA, amiga or resource 999) palette - _gfxPalette->setDefault(); + initGraphics(); debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion())); @@ -353,6 +347,15 @@ bool SciEngine::initGame() { return true; } +void SciEngine::initGraphics() { + if (_gfxPorts) { + _gfxPorts->init(_features->usesOldGfxFunctions(), _gfxPaint16, _gfxText16); + _gfxPaint16->init(_gfxAnimate, _gfxText16); + } + // Set default (EGA, amiga or resource 999) palette + _gfxPalette->setDefault(); +} + #ifdef USE_OLD_MUSIC_FUNCTIONS void SciEngine::initGameSound(int sound_flags, SciVersion soundVersion) { diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 7cfeec0e09..6f6a6b5dd1 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -193,6 +193,9 @@ public: Common::String getSciLanguageString(const char *str, kLanguage lang, kLanguage *lang2 = NULL) const; + // Initializes ports and paint16 for non-sci32 games, also sets default palette + void initGraphics(); + public: GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx GfxCache *_gfxCache; |