SCI: putting SciGui::init into SciEngine, removing it from SciGui(32)

svn-id: r49854
This commit is contained in:
Martin Kiewitz 2010-06-15 13:34:40 +00:00
parent af5346e7ab
commit ba2de6dfa4
9 changed files with 17 additions and 35 deletions

View File

@ -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();

View File

@ -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

View File

@ -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;

View File

@ -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();

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -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;