mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 14:50:17 +00:00
ACCESS: Implement palette cycling script commands
This commit is contained in:
parent
7e4d76b1fb
commit
f3063a13f0
@ -413,7 +413,7 @@ typedef void(AmazonScripts::*AmazonScriptMethodPtr)();
|
||||
|
||||
void AmazonScripts::executeCommand(int commandIndex) {
|
||||
static const AmazonScriptMethodPtr COMMAND_LIST[] = {
|
||||
&AmazonScripts::cmdHelp, &AmazonScripts::CMDCYCLEBACK,
|
||||
&AmazonScripts::cmdHelp, &AmazonScripts::cmdCycleBack,
|
||||
&AmazonScripts::cmdChapter, &AmazonScripts::cmdSetHelp,
|
||||
&AmazonScripts::cmdCenterPanel, &AmazonScripts::cmdMainPanel,
|
||||
&AmazonScripts::CMDRETFLASH
|
||||
@ -449,8 +449,8 @@ void AmazonScripts::cmdHelp() {
|
||||
error("TODO: more cmdHelp");
|
||||
}
|
||||
|
||||
void AmazonScripts::CMDCYCLEBACK() {
|
||||
error("TODO CMDCYCLEBACK");
|
||||
void AmazonScripts::cmdCycleBack() {
|
||||
_vm->_screen->cyclePaletteBackwards();
|
||||
}
|
||||
void AmazonScripts::cmdChapter() {
|
||||
int chapter = _data->readByte();
|
||||
|
@ -52,7 +52,7 @@ protected:
|
||||
void boatWalls(int param1, int param2);
|
||||
|
||||
void cmdHelp();
|
||||
void CMDCYCLEBACK();
|
||||
void cmdCycleBack();
|
||||
void cmdChapter();
|
||||
void cmdSetHelp();
|
||||
void cmdCenterPanel();
|
||||
|
@ -59,6 +59,9 @@ Screen::Screen(AccessEngine *vm) : _vm(vm) {
|
||||
_vWindowLinesTall = this->h;
|
||||
_clipWidth = _vWindowBytesWide - 1;
|
||||
_clipHeight = _vWindowLinesTall - 1;
|
||||
_startCycle = 0;
|
||||
_cycleStart = 0;
|
||||
_endCycle = 0;
|
||||
}
|
||||
|
||||
void Screen::clearScreen() {
|
||||
@ -244,4 +247,39 @@ void Screen::copyBlock(ASurface *src, const Common::Rect &bounds) {
|
||||
copyRectToSurface(*src, destBounds.left, destBounds.top, bounds);
|
||||
}
|
||||
|
||||
void Screen::setPaletteCycle(int startCycle, int endCycle, int timer) {
|
||||
_startCycle = _cycleStart = startCycle;
|
||||
_endCycle = endCycle;
|
||||
|
||||
TimerEntry &te = _vm->_timers[6];
|
||||
te._timer = te._initTm = timer;
|
||||
te._flag++;
|
||||
}
|
||||
|
||||
void Screen::cyclePaletteForward() {
|
||||
cyclePaletteBackwards();
|
||||
}
|
||||
|
||||
void Screen::cyclePaletteBackwards() {
|
||||
if (!_vm->_timers[6]._flag) {
|
||||
_vm->_timers[6]._flag++;
|
||||
byte *pStart = &_rawPalette[_cycleStart * 3];
|
||||
byte *pEnd = &_rawPalette[_endCycle * 3];
|
||||
|
||||
for (int idx = _startCycle; idx < _endCycle; ++idx) {
|
||||
g_system->getPaletteManager()->setPalette(pStart, idx, 1);
|
||||
|
||||
pStart += 3;
|
||||
if (pStart == pEnd)
|
||||
pStart = &_rawPalette[_cycleStart * 3];
|
||||
}
|
||||
|
||||
if (--_cycleStart <= _startCycle)
|
||||
_cycleStart = _endCycle - 1;
|
||||
|
||||
g_system->updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Access
|
||||
|
@ -60,6 +60,9 @@ private:
|
||||
Common::Point _virtualOffsetsTable[4];
|
||||
bool _hideFlag;
|
||||
ScreenSave _screenSave;
|
||||
int _startCycle;
|
||||
int _cycleStart;
|
||||
int _endCycle;
|
||||
|
||||
void updatePalette();
|
||||
public:
|
||||
@ -150,6 +153,12 @@ public:
|
||||
* Restores previously saved screen display state variables
|
||||
*/
|
||||
void restoreScreen();
|
||||
|
||||
void setPaletteCycle(int startCycle, int endCycle, int timer);
|
||||
|
||||
void cyclePaletteForward();
|
||||
|
||||
void cyclePaletteBackwards();
|
||||
};
|
||||
|
||||
} // End of namespace Access
|
||||
|
@ -126,7 +126,7 @@ void Scripts::executeCommand(int commandIndex) {
|
||||
&Scripts::cmdSetScroll, &Scripts::cmdVideoEnded, &Scripts::cmdVideoEnded,
|
||||
&Scripts::CMDSETBUFVID, &Scripts::CMDPLAYBUFVID, &Scripts::cmdRemoveLast,
|
||||
&Scripts::cmdSpecial, &Scripts::cmdSpecial, &Scripts::cmdSpecial,
|
||||
&Scripts::CMDSETCYCLE, &Scripts::CMDCYCLE, &Scripts::cmdCharSpeak,
|
||||
&Scripts::cmdSetCycle, &Scripts::cmdCycle, &Scripts::cmdCharSpeak,
|
||||
&Scripts::cmdTexSpeak, &Scripts::cmdTexChoice, &Scripts::cmdWait,
|
||||
&Scripts::cmdSetConPos, &Scripts::CMDCHECKVFRAME, &Scripts::cmdJumpChoice,
|
||||
&Scripts::cmdReturnChoice, &Scripts::cmdClearBlock, &Scripts::cmdLoadSound,
|
||||
@ -514,8 +514,16 @@ void Scripts::cmdSpecial() {
|
||||
}
|
||||
}
|
||||
|
||||
void Scripts::CMDSETCYCLE() { error("TODO CMDSETCYCLE"); }
|
||||
void Scripts::CMDCYCLE() { error("TODO CMDCYCLE"); }
|
||||
void Scripts::cmdSetCycle() {
|
||||
int startCycle = _data->readUint16LE();
|
||||
int endCycle = _data->readUint16LE();
|
||||
int timer = _data->readUint16LE();
|
||||
_vm->_screen->setPaletteCycle(startCycle, endCycle, timer);
|
||||
}
|
||||
|
||||
void Scripts::cmdCycle() {
|
||||
_vm->_screen->cyclePaletteForward();
|
||||
}
|
||||
|
||||
void Scripts::cmdCharSpeak() {
|
||||
_vm->_screen->_printOrg = _charsOrg;
|
||||
|
@ -101,8 +101,8 @@ protected:
|
||||
void CMDPLAYBUFVID();
|
||||
void cmdRemoveLast();
|
||||
void cmdSpecial();
|
||||
void CMDSETCYCLE();
|
||||
void CMDCYCLE();
|
||||
void cmdSetCycle();
|
||||
void cmdCycle();
|
||||
void cmdCharSpeak();
|
||||
void cmdTexSpeak();
|
||||
void cmdTexChoice();
|
||||
|
Loading…
Reference in New Issue
Block a user