mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-27 13:42:02 +00:00
SCI: kPalVary - cleanup and some more code
svn-id: r50081
This commit is contained in:
parent
f58c69e65d
commit
7ce739f51b
@ -652,7 +652,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) {
|
||||
ticks = argv[2].toUint16();
|
||||
paletteStop = argc >= 4 ? argv[3].toUint16() : 64;
|
||||
paletteDirection = argc >= 5 ? argv[4].toUint16() : 1;
|
||||
g_sci->_gfxPalette->startPalVary(paletteId, ticks);
|
||||
g_sci->_gfxPalette->kernelPalVaryInit(paletteId, ticks);
|
||||
warning("kPalVary(init) called with paletteId = %d, ticks = %d, stop = %d, direction = %d", paletteId, ticks, paletteStop, paletteDirection);
|
||||
} else {
|
||||
warning("kPalVary(init) called with unsupported argc %d", argc);
|
||||
@ -670,7 +670,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) {
|
||||
}
|
||||
case 3: { // DeInit
|
||||
if (argc == 1) {
|
||||
g_sci->_gfxPalette->stopPalVary();
|
||||
g_sci->_gfxPalette->kernelPalVaryDeinit();
|
||||
warning("kPalVary(deinit)");
|
||||
} else {
|
||||
warning("kPalVary(deinit) called with unsupported argc %d", argc);
|
||||
@ -690,7 +690,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) {
|
||||
bool pauseState;
|
||||
if (argc == 2) {
|
||||
pauseState = argv[1].isNull() ? false : true;
|
||||
g_sci->_gfxPalette->togglePalVary(pauseState);
|
||||
g_sci->_gfxPalette->kernelPalVaryToggle(pauseState);
|
||||
warning("kPalVary(pause) called with state = %d", pauseState);
|
||||
} else {
|
||||
warning("kPalVary(pause) called with unsupported argc %d", argc);
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "sci/graphics/cursor.h"
|
||||
#include "sci/graphics/ports.h"
|
||||
#include "sci/graphics/paint16.h"
|
||||
#include "sci/graphics/palette.h"
|
||||
#include "sci/graphics/view.h"
|
||||
#include "sci/graphics/screen.h"
|
||||
#include "sci/graphics/transitions.h"
|
||||
@ -592,6 +593,9 @@ void GfxAnimate::animateShowPic() {
|
||||
void GfxAnimate::kernelAnimate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
|
||||
byte old_picNotValid = _screen->_picNotValid;
|
||||
|
||||
if (getSciVersion() >= SCI_VERSION_1_1)
|
||||
_palette->palVaryUpdate();
|
||||
|
||||
if (listReference.isNull()) {
|
||||
disposeLastCast();
|
||||
if (_screen->_picNotValid)
|
||||
|
@ -72,6 +72,8 @@ GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen)
|
||||
_alwaysForceRealMerge = true;
|
||||
else if (g_sci->getGameId() == "pq1sci")
|
||||
_alwaysForceRealMerge = true;
|
||||
|
||||
palVaryInit();
|
||||
}
|
||||
|
||||
GfxPalette::~GfxPalette() {
|
||||
@ -473,7 +475,7 @@ void GfxPalette::kernelAssertPalette(GuiResourceId resourceId) {
|
||||
// Saving/restoring
|
||||
// need to save start and target-palette, when palVaryOn = true
|
||||
|
||||
void GfxPalette::startPalVary(GuiResourceId resourceId, uint16 ticks) {
|
||||
void GfxPalette::kernelPalVaryInit(GuiResourceId resourceId, uint16 ticks) {
|
||||
kernelSetFromResource(resourceId, true);
|
||||
return;
|
||||
|
||||
@ -481,19 +483,23 @@ void GfxPalette::startPalVary(GuiResourceId resourceId, uint16 ticks) {
|
||||
return;
|
||||
|
||||
_palVaryResourceId = resourceId;
|
||||
_palVaryStart = g_system->getMillis();
|
||||
_palVaryEnd = _palVaryStart + ticks * 1000 / 60;
|
||||
g_sci->getTimerManager()->installTimerProc(&palVaryCallback, 1000000 / 60, this);
|
||||
_palVarySignal = 0;
|
||||
// Call signal increase every [ticks]
|
||||
g_sci->getTimerManager()->installTimerProc(&palVaryCallback, 1000000 / 60 * ticks, this);
|
||||
}
|
||||
|
||||
void GfxPalette::togglePalVary(bool pause) {
|
||||
void GfxPalette::kernelPalVaryToggle(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
|
||||
if (pause) {
|
||||
_palVaryPaused++;
|
||||
} else {
|
||||
if (_palVaryPaused)
|
||||
_palVaryPaused--;
|
||||
}
|
||||
}
|
||||
|
||||
void GfxPalette::stopPalVary() {
|
||||
void GfxPalette::kernelPalVaryDeinit() {
|
||||
g_sci->getTimerManager()->removeTimerProc(&palVaryCallback);
|
||||
|
||||
// HACK: just set the target palette
|
||||
@ -502,12 +508,24 @@ void GfxPalette::stopPalVary() {
|
||||
_palVaryResourceId = -1; // invalidate the target palette
|
||||
}
|
||||
|
||||
void GfxPalette::palVaryCallback(void *refCon) {
|
||||
((GfxPalette *)refCon)->doPalVary();
|
||||
void GfxPalette::palVaryInit() {
|
||||
_palVaryResourceId = -1;
|
||||
_palVaryPaused = 0;
|
||||
_palVarySignal = 0;
|
||||
}
|
||||
|
||||
void GfxPalette::doPalVary() {
|
||||
// TODO: do palette transition here...
|
||||
void GfxPalette::palVaryCallback(void *refCon) {
|
||||
((GfxPalette *)refCon)->palVaryIncreaseSignal();
|
||||
}
|
||||
|
||||
void GfxPalette::palVaryIncreaseSignal() {
|
||||
if (!_palVaryPaused)
|
||||
_palVarySignal++;
|
||||
}
|
||||
|
||||
// Actually do the pal vary processing
|
||||
void GfxPalette::palVaryUpdate() {
|
||||
|
||||
}
|
||||
|
||||
} // End of namespace Sci
|
||||
|
@ -62,21 +62,26 @@ public:
|
||||
void kernelAnimateSet();
|
||||
void kernelAssertPalette(GuiResourceId resourceId);
|
||||
|
||||
void startPalVary(GuiResourceId resourceId, uint16 ticks);
|
||||
void togglePalVary(bool pause);
|
||||
void stopPalVary();
|
||||
void kernelPalVaryInit(GuiResourceId resourceId, uint16 ticks);
|
||||
void kernelPalVaryToggle(bool pause);
|
||||
void kernelPalVaryDeinit();
|
||||
void palVaryUpdate();
|
||||
|
||||
Palette _sysPalette;
|
||||
|
||||
private:
|
||||
void palVaryInit();
|
||||
static void palVaryCallback(void *refCon);
|
||||
void doPalVary();
|
||||
void palVaryIncreaseSignal();
|
||||
|
||||
GfxScreen *_screen;
|
||||
ResourceManager *_resMan;
|
||||
|
||||
GuiResourceId _palVaryResourceId;
|
||||
uint32 _palVaryStart;
|
||||
uint32 _palVaryEnd;
|
||||
int _palVaryPaused;
|
||||
int _palVarySignal;
|
||||
|
||||
bool _sysPaletteChanged;
|
||||
bool _alwaysForceRealMerge;
|
||||
|
Loading…
x
Reference in New Issue
Block a user