diff options
author | Filippos Karapetis | 2010-01-23 21:33:24 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-01-23 21:33:24 +0000 |
commit | 5b4fcfdbcb2c6b1e48bb560705ffe6e6f5261d0f (patch) | |
tree | 49abd5f3c4ce5724118f79150745334276313928 /engines/sci | |
parent | dcbcb4185586e30ac8f7d1366f272cf134317feb (diff) | |
download | scummvm-rg350-5b4fcfdbcb2c6b1e48bb560705ffe6e6f5261d0f.tar.gz scummvm-rg350-5b4fcfdbcb2c6b1e48bb560705ffe6e6f5261d0f.tar.bz2 scummvm-rg350-5b4fcfdbcb2c6b1e48bb560705ffe6e6f5261d0f.zip |
Added some skeleton code for kPalVary()
svn-id: r47485
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 8 | ||||
-rw-r--r-- | engines/sci/graphics/gui.cpp | 33 | ||||
-rw-r--r-- | engines/sci/graphics/gui.h | 9 |
3 files changed, 45 insertions, 5 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 266f154c13..3048e30745 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -604,7 +604,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { if (argc == 3) { paletteId = argv[1].toUint16(); time = argv[2].toUint16(); - // forward call to SciGui + s->_gui->startPalVary(paletteId, time); } else { warning("kPalVary(init) called with unsupported argc %d", argc); } @@ -612,7 +612,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { } case 3: { // DeInit if (argc == 1) { - // forward call to SciGui + s->_gui->stopPalVary(); } else { warning("kPalVary(deinit) called with unsupported argc %d", argc); } @@ -622,9 +622,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { bool pauseState; if (argc == 2) { pauseState = argv[1].isNull() ? false : true; - // this call is actually counting states, so calling this 3 times with true will require calling it later - // 3 times with false to actually remove pause - // forward call to SciGui + s->_gui->togglePalVary(pauseState); } else { warning("kPalVary(pause) called with unsupported argc %d", argc); } diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp index 04b8a75fc0..7228ae925a 100644 --- a/engines/sci/graphics/gui.cpp +++ b/engines/sci/graphics/gui.cpp @@ -863,6 +863,39 @@ void SciGui::portraitShow(Common::String resourceName, Common::Point position, u void SciGui::portraitUnload(uint16 portraitId) { } +void SciGui::startPalVary(uint16 paletteId, uint16 ticks) { + if (_palVaryId >= 0) // another palvary is taking place, return + return; + + _palVaryId = paletteId; + _palVaryStart = g_system->getMillis(); + _palVaryEnd = _palVaryStart + ticks * 1000 / 60; + ((SciEngine*)g_engine)->getTimerManager()->installTimerProc(&palVaryCallback, 1000 / 60, this); +} + +void SciGui::togglePalVary(bool pause) { + // this call is actually counting states, so calling this 3 times with true will require calling it later + // 3 times with false to actually remove pause + + // TODO +} + +void SciGui::stopPalVary() { + ((SciEngine*)g_engine)->getTimerManager()->removeTimerProc(&palVaryCallback); + _palVaryId = -1; // invalidate the target palette + + // HACK: just set the target palette + _palette->setFromResource(_palVaryId, 2); +} + +void SciGui::palVaryCallback(void *refCon) { + ((SciGui *)refCon)->doPalVary(); +} + +void SciGui::doPalVary() { + // TODO: do palette transition here... +} + #ifdef ENABLE_SCI32 void SciGui::addScreenItem(reg_t object) { _screenItems.push_back(object); diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h index b61b0d5268..840dedb5a0 100644 --- a/engines/sci/graphics/gui.h +++ b/engines/sci/graphics/gui.h @@ -151,6 +151,10 @@ public: virtual void portraitShow(Common::String resourceName, Common::Point position, uint16 resourceNum, uint16 noun, uint16 verb, uint16 cond, uint16 seq); virtual void portraitUnload(uint16 portraitId); + void startPalVary(uint16 paletteId, uint16 ticks); + void togglePalVary(bool pause); + void stopPalVary(); + #ifdef ENABLE_SCI32 // SCI32 virtual void addScreenItem(reg_t object); @@ -183,6 +187,8 @@ private: virtual void initPriorityBands(); virtual void addToPicSetPicNotValid(); virtual int getControlPicNotValid(); + static void palVaryCallback(void *refCon); + void doPalVary(); WindowMgr *_windowMgr; AudioPlayer *_audio; @@ -191,6 +197,9 @@ private: Menu *_menu; Text *_text; Transitions *_transitions; + int16 _palVaryId; + uint32 _palVaryStart; + uint32 _palVaryEnd; bool _usesOldGfxFunctions; |