diff options
author | Denis Kasak | 2009-08-15 02:42:34 +0000 |
---|---|---|
committer | Denis Kasak | 2009-08-15 02:42:34 +0000 |
commit | abf10049bb50d55020ee0f791646a6ca0c0baea8 (patch) | |
tree | b958a5cc41d20197bc5cab25e1df306b8fb1bcd9 | |
parent | fad77de23486d806f5cc94ae65e0df5953511a73 (diff) | |
download | scummvm-rg350-abf10049bb50d55020ee0f791646a6ca0c0baea8.tar.gz scummvm-rg350-abf10049bb50d55020ee0f791646a6ca0c0baea8.tar.bz2 scummvm-rg350-abf10049bb50d55020ee0f791646a6ca0c0baea8.zip |
* Implemented LoadPalette, SetPalette and BlackPalette GPL commands.
* Used a more natural condition (whether the scheduled room number is different from the current room number) instead of the _roomChange hack.
svn-id: r43391
-rw-r--r-- | engines/draci/game.cpp | 11 | ||||
-rw-r--r-- | engines/draci/game.h | 9 | ||||
-rw-r--r-- | engines/draci/script.cpp | 28 | ||||
-rw-r--r-- | engines/draci/script.h | 3 |
4 files changed, 47 insertions, 4 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 715b233ab2..cfd06201b6 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -217,6 +217,7 @@ void Game::start() { void Game::init() { _shouldQuit = false; _shouldExitLoop = false; + _scheduledPalette = 0; _animUnderCursor = kOverlayImage; @@ -437,7 +438,7 @@ void Game::loop() { _vm->_system->delayMillis(20); // HACK: Won't be needed once the game loop is implemented properly - _shouldExitLoop = _shouldExitLoop || (_roomChange && + _shouldExitLoop = _shouldExitLoop || (_newRoom != _currentRoom._roomNum && (_loopStatus == kStatusOrdinary || _loopStatus == kStatusGate)); } while (!shouldExitLoop()); @@ -1160,6 +1161,14 @@ int Game::getEscRoom() { return _currentRoom._escRoom; } +void Game::schedulePalette(int paletteID) { + _scheduledPalette = paletteID; +} + +int Game::getScheduledPalette() { + return _scheduledPalette; +} + /** * The GPL command Mark sets the animation index (which specifies the order in which * animations were loaded in) which is then used by the Release command to delete diff --git a/engines/draci/game.h b/engines/draci/game.h index 31e27f9708..8445bf7a72 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -73,6 +73,10 @@ enum { kNoDialogue = -1, kDialogueLines = 4 }; +enum { + kBlackPalette = -1 +}; + enum SpeechConstants { kBaseSpeechDuration = 200, kSpeechTimeUnit = 400 @@ -293,6 +297,9 @@ public: void dialogueDone(); void runDialogueProg(GPL2Program, int offset); + void schedulePalette(int paletteID); + int getScheduledPalette(); + bool _roomChange; private: @@ -341,6 +348,8 @@ public: int _animUnderCursor; int _markedAnimationIndex; //!< Used by the Mark GPL command + + int _scheduledPalette; }; } // End of namespace Draci diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 5e0354dffe..e30af8f00c 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -61,9 +61,9 @@ void Script::setupCommandList() { { 10, 1, "WalkOn", 3, { 1, 1, 3 }, &Script::walkOn }, { 10, 2, "StayOn", 3, { 1, 1, 3 }, &Script::walkOn }, // HACK: not a proper implementation { 10, 3, "WalkOnPlay", 3, { 1, 1, 3 }, &Script::walkOnPlay }, - { 11, 1, "LoadPalette", 1, { 2 }, NULL }, - { 12, 1, "SetPalette", 0, { 0 }, NULL }, - { 12, 2, "BlackPalette", 0, { 0 }, NULL }, + { 11, 1, "LoadPalette", 1, { 2 }, &Script::loadPalette }, + { 12, 1, "SetPalette", 0, { 0 }, &Script::setPalette }, + { 12, 2, "BlackPalette", 0, { 0 }, &Script::blackPalette }, { 13, 1, "FadePalette", 3, { 1, 1, 1 }, NULL }, { 13, 2, "FadePalettePlay", 3, { 1, 1, 1 }, NULL }, { 14, 1, "NewRoom", 2, { 3, 1 }, &Script::newRoom }, @@ -716,6 +716,28 @@ void Script::roomMap(Common::Queue<int> ¶ms) { _vm->_game->loadWalkingMap(); } +void Script::loadPalette(Common::Queue<int> ¶ms) { + int palette = params.pop() - 1; + + _vm->_game->schedulePalette(palette); +} + +void Script::blackPalette(Common::Queue<int> ¶ms) { + + _vm->_game->schedulePalette(kBlackPalette); +} + +void Script::setPalette(Common::Queue<int> ¶ms) { + + if (_vm->_game->getScheduledPalette() == -1) { + _vm->_screen->setPaletteEmpty(); + } else { + BAFile *f; + f = _vm->_paletteArchive->getFile(_vm->_game->getScheduledPalette()); + _vm->_screen->setPalette(f->_data, 0, kNumColours); + } +} + void Script::endCurrentProgram() { _endProgram = true; } diff --git a/engines/draci/script.h b/engines/draci/script.h index 5483bf4e6a..7fe917eaf3 100644 --- a/engines/draci/script.h +++ b/engines/draci/script.h @@ -127,6 +127,9 @@ private: void resetDialogue(Common::Queue<int> ¶ms); void resetDialogueFrom(Common::Queue<int> ¶ms); void resetBlock(Common::Queue<int> ¶ms); + void setPalette(Common::Queue<int> ¶ms); + void blackPalette(Common::Queue<int> ¶ms); + void loadPalette(Common::Queue<int> ¶ms); int operAnd(int op1, int op2); int operOr(int op1, int op2); |