diff options
author | Filippos Karapetis | 2009-10-08 08:00:30 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-10-08 08:00:30 +0000 |
commit | 498d80a5107c8513a1c7dfa30b458af6408211d6 (patch) | |
tree | 97cf059759162a176ff78a9e7adb52100c748433 | |
parent | 0120111416a8bb8c9447123a43746d1d61e42a55 (diff) | |
download | scummvm-rg350-498d80a5107c8513a1c7dfa30b458af6408211d6.tar.gz scummvm-rg350-498d80a5107c8513a1c7dfa30b458af6408211d6.tar.bz2 scummvm-rg350-498d80a5107c8513a1c7dfa30b458af6408211d6.zip |
Don't store the engine state in the SciGuiPalette class. The palette timestamps are now calculated from Epoch time, instead of game start time (the functionality is exactly the same, though)
svn-id: r44773
-rw-r--r-- | engines/sci/gui/gui_cursor.cpp | 1 | ||||
-rw-r--r-- | engines/sci/gui/gui_palette.cpp | 20 | ||||
-rw-r--r-- | engines/sci/gui/gui_palette.h | 6 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 22 |
4 files changed, 20 insertions, 29 deletions
diff --git a/engines/sci/gui/gui_cursor.cpp b/engines/sci/gui/gui_cursor.cpp index 25ba1b9416..68e376f66d 100644 --- a/engines/sci/gui/gui_cursor.cpp +++ b/engines/sci/gui/gui_cursor.cpp @@ -41,6 +41,7 @@ SciGuiCursor::SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette) _rawBitmap = NULL; setPosition(Common::Point(160, 150)); // TODO: how is that different in 640x400 games? + setMoveZone(Common::Rect(0, 0, 320, 200)); // TODO: hires games } SciGuiCursor::~SciGuiCursor() { diff --git a/engines/sci/gui/gui_palette.cpp b/engines/sci/gui/gui_palette.cpp index 5c2bfa6c01..9872c659f3 100644 --- a/engines/sci/gui/gui_palette.cpp +++ b/engines/sci/gui/gui_palette.cpp @@ -34,15 +34,8 @@ namespace Sci { -SciGuiPalette::SciGuiPalette(EngineState *state, SciGuiScreen *screen) - : _s(state), _screen(screen) { - init(); -} - -SciGuiPalette::~SciGuiPalette() { -} - -void SciGuiPalette::init() { +SciGuiPalette::SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen) + : _resMan(resMan), _screen(screen) { int16 i; for (i = 0; i < 256; i++) { _sysPalette.colors[i].used = 0; @@ -72,6 +65,9 @@ void SciGuiPalette::init() { _clrPowers[i] = i*i; } +SciGuiPalette::~SciGuiPalette() { +} + #define SCI_PAL_FORMAT_CONSTANT 1 #define SCI_PAL_FORMAT_VARIABLE 0 @@ -177,7 +173,7 @@ void SciGuiPalette::setEGA() { } bool SciGuiPalette::setFromResource(int16 resourceNo, int16 flag) { - Resource *palResource = _s->resMan->findResource(ResourceId(kResourceTypePalette, resourceNo), 0); + Resource *palResource = _resMan->findResource(ResourceId(kResourceTypePalette, resourceNo), 0); GuiPalette palette; if (palResource) { @@ -236,7 +232,7 @@ void SciGuiPalette::merge(GuiPalette *pFrom, GuiPalette *pTo, uint16 flag) { pTo->colors[res & 0xFF].used |= 0x10; } } - pTo->timestamp = (g_system->getMillis() - _s->game_start_time) * 60 / 1000;; + pTo->timestamp = g_system->getMillis() * 60 / 1000;; } uint16 SciGuiPalette::matchColor(GuiPalette *pPal, byte r, byte g, byte b) { @@ -282,7 +278,7 @@ void SciGuiPalette::setIntensity(int fromColor, int toColor, int intensity, GuiP void SciGuiPalette::animate(byte fromColor, byte toColor, int speed) { GuiColor col; int len = toColor - fromColor - 1; - uint32 now = (g_system->getMillis() - _s->game_start_time) * 60 / 1000;; + uint32 now = g_system->getMillis() * 60 / 1000;; // search for sheduled animations with the same 'from' value int sz = _palSchedules.size(); for (int i = 0; i < sz; i++) { diff --git a/engines/sci/gui/gui_palette.h b/engines/sci/gui/gui_palette.h index 2b0ea99df3..0cb337996e 100644 --- a/engines/sci/gui/gui_palette.h +++ b/engines/sci/gui/gui_palette.h @@ -33,7 +33,7 @@ namespace Sci { class SciGuiScreen; class SciGuiPalette { public: - SciGuiPalette(EngineState *state, SciGuiScreen *screen); + SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen); ~SciGuiPalette(); void createFromData(byte *data, GuiPalette *paletteOut); @@ -53,10 +53,8 @@ public: GuiPalette _sysPalette; private: - void init(); - - EngineState *_s; SciGuiScreen *_screen; + ResourceManager *_resMan; uint16 _clrPowers[256]; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 8ebc947e23..4ad63d24f7 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -137,9 +137,16 @@ Common::Error SciEngine::run() { _kernel = new Kernel(_resMan); _vocabulary = new Vocabulary(_resMan); + SciGuiScreen *screen = new SciGuiScreen(); + SciGuiPalette *palette = new SciGuiPalette(_resMan, screen); + SciGuiCursor *cursor = new SciGuiCursor(_resMan, palette); - // we'll set the gui and cursor below - _gamestate = new EngineState(_resMan, _kernel, _vocabulary, NULL, NULL, flags); + // We'll set the GUI below + _gamestate = new EngineState(_resMan, _kernel, _vocabulary, NULL, cursor, flags); + + // Gui change + //_gamestate->_gui = new SciGui(_gamestate, screen, palette, cursor); // new + _gamestate->_gui = new SciGui32(_gamestate, screen, palette, cursor); // old if (script_init_engine(_gamestate)) return Common::kUnknownError; @@ -159,17 +166,6 @@ Common::Error SciEngine::run() { GfxState gfx_state; _gamestate->gfx_state = &gfx_state; - SciGuiScreen *screen = new SciGuiScreen(); - SciGuiPalette *palette = new SciGuiPalette(_gamestate, screen); - SciGuiCursor *cursor = new SciGuiCursor(_resMan, palette); - - _gamestate->_cursor = cursor; - _gamestate->_cursor->setMoveZone(Common::Rect(0, 0, 320, 200)); - - // Gui change - //_gamestate->_gui = new SciGui(_gamestate, screen, palette, cursor); // new - _gamestate->_gui = new SciGui32(_gamestate, screen, palette, cursor); // old - // Assign default values to the config manager, in case settings are missing ConfMan.registerDefault("dither_mode", "0"); |