[Scummvm-cvs-logs] SF.net SVN: scummvm:[44773] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Oct 8 10:00:30 CEST 2009
Revision: 44773
http://scummvm.svn.sourceforge.net/scummvm/?rev=44773&view=rev
Author: thebluegr
Date: 2009-10-08 08:00:30 +0000 (Thu, 08 Oct 2009)
Log Message:
-----------
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)
Modified Paths:
--------------
scummvm/trunk/engines/sci/gui/gui_cursor.cpp
scummvm/trunk/engines/sci/gui/gui_palette.cpp
scummvm/trunk/engines/sci/gui/gui_palette.h
scummvm/trunk/engines/sci/sci.cpp
Modified: scummvm/trunk/engines/sci/gui/gui_cursor.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_cursor.cpp 2009-10-08 07:58:31 UTC (rev 44772)
+++ scummvm/trunk/engines/sci/gui/gui_cursor.cpp 2009-10-08 08:00:30 UTC (rev 44773)
@@ -41,6 +41,7 @@
_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() {
Modified: scummvm/trunk/engines/sci/gui/gui_palette.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_palette.cpp 2009-10-08 07:58:31 UTC (rev 44772)
+++ scummvm/trunk/engines/sci/gui/gui_palette.cpp 2009-10-08 08:00:30 UTC (rev 44773)
@@ -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 @@
_clrPowers[i] = i*i;
}
+SciGuiPalette::~SciGuiPalette() {
+}
+
#define SCI_PAL_FORMAT_CONSTANT 1
#define SCI_PAL_FORMAT_VARIABLE 0
@@ -177,7 +173,7 @@
}
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 @@
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::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++) {
Modified: scummvm/trunk/engines/sci/gui/gui_palette.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_palette.h 2009-10-08 07:58:31 UTC (rev 44772)
+++ scummvm/trunk/engines/sci/gui/gui_palette.h 2009-10-08 08:00:30 UTC (rev 44773)
@@ -33,7 +33,7 @@
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 @@
GuiPalette _sysPalette;
private:
- void init();
-
- EngineState *_s;
SciGuiScreen *_screen;
+ ResourceManager *_resMan;
uint16 _clrPowers[256];
Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp 2009-10-08 07:58:31 UTC (rev 44772)
+++ scummvm/trunk/engines/sci/sci.cpp 2009-10-08 08:00:30 UTC (rev 44773)
@@ -137,10 +137,17 @@
_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 @@
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");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list