aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kgraphics.cpp6
-rw-r--r--engines/sci/graphics/gui.cpp33
-rw-r--r--engines/sci/graphics/gui.h9
-rw-r--r--engines/sci/graphics/palette.cpp33
-rw-r--r--engines/sci/graphics/palette.h10
5 files changed, 46 insertions, 45 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 25a4839b2f..7f8ee9de31 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -691,7 +691,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) {
if (argc == 3) {
paletteId = argv[1].toUint16();
time = argv[2].toUint16();
- s->_gui->startPalVary(paletteId, time);
+ s->_gfxPalette->startPalVary(paletteId, time);
} else {
warning("kPalVary(init) called with unsupported argc %d", argc);
}
@@ -699,7 +699,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) {
}
case 3: { // DeInit
if (argc == 1) {
- s->_gui->stopPalVary();
+ s->_gfxPalette->stopPalVary();
} else {
warning("kPalVary(deinit) called with unsupported argc %d", argc);
}
@@ -709,7 +709,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) {
bool pauseState;
if (argc == 2) {
pauseState = argv[1].isNull() ? false : true;
- s->_gui->togglePalVary(pauseState);
+ s->_gfxPalette->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 0eb01befa0..7e200d7816 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -463,39 +463,6 @@ 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->kernelSetFromResource(_palVaryId, true);
-}
-
-void SciGui::palVaryCallback(void *refCon) {
- ((SciGui *)refCon)->doPalVary();
-}
-
-void SciGui::doPalVary() {
- // TODO: do palette transition here...
-}
-
bool SciGui::debugUndither(bool flag) {
_screen->unditherSetState(flag);
return false;
diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h
index 07694fcdcd..c5c80342c6 100644
--- a/engines/sci/graphics/gui.h
+++ b/engines/sci/graphics/gui.h
@@ -101,10 +101,6 @@ 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();
-
virtual bool debugUndither(bool flag);
virtual bool debugShowMap(int mapNo);
virtual bool debugEGAdrawingVisualize(bool state);
@@ -124,8 +120,6 @@ protected:
private:
virtual void initPriorityBands();
- static void palVaryCallback(void *refCon);
- void doPalVary();
AudioPlayer *_audio;
GfxAnimate *_animate;
@@ -133,9 +127,6 @@ private:
GfxMenu *_menu;
GfxText16 *_text16;
GfxTransitions *_transitions;
- int16 _palVaryId;
- uint32 _palVaryStart;
- uint32 _palVaryEnd;
bool _usesOldGfxFunctions;
};
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 85eac2157d..e716fd914a 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -417,4 +417,37 @@ void GfxPalette::kernelAnimateSet() {
// Saving/restoring
// need to save start and target-palette, when palVaryOn = true
+void GfxPalette::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 GfxPalette::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 GfxPalette::stopPalVary() {
+ ((SciEngine*)g_engine)->getTimerManager()->removeTimerProc(&palVaryCallback);
+ _palVaryId = -1; // invalidate the target palette
+
+ // HACK: just set the target palette
+ kernelSetFromResource(_palVaryId, true);
+}
+
+void GfxPalette::palVaryCallback(void *refCon) {
+ ((GfxPalette *)refCon)->doPalVary();
+}
+
+void GfxPalette::doPalVary() {
+ // TODO: do palette transition here...
+}
+
} // End of namespace Sci
diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h
index 2806c6e8aa..8bee000d81 100644
--- a/engines/sci/graphics/palette.h
+++ b/engines/sci/graphics/palette.h
@@ -55,11 +55,21 @@ public:
bool kernelAnimate(byte fromColor, byte toColor, int speed);
void kernelAnimateSet();
+ void startPalVary(uint16 paletteId, uint16 ticks);
+ void togglePalVary(bool pause);
+ void stopPalVary();
+
Palette _sysPalette;
private:
+ static void palVaryCallback(void *refCon);
+ void doPalVary();
+
GfxScreen *_screen;
ResourceManager *_resMan;
+ int16 _palVaryId;
+ uint32 _palVaryStart;
+ uint32 _palVaryEnd;
Common::Array<PalSchedule> _schedules;
};