diff options
author | Johannes Schickel | 2005-12-10 15:52:38 +0000 |
---|---|---|
committer | Johannes Schickel | 2005-12-10 15:52:38 +0000 |
commit | 7b556aaafe00f294d5c3c042e97ab47d4c6ef661 (patch) | |
tree | aa156c6eaf174da350fb35163bea91d841d22458 /kyra | |
parent | fe80cf4f99319322394706d19149e6ce512e13f2 (diff) | |
download | scummvm-rg350-7b556aaafe00f294d5c3c042e97ab47d4c6ef661.tar.gz scummvm-rg350-7b556aaafe00f294d5c3c042e97ab47d4c6ef661.tar.bz2 scummvm-rg350-7b556aaafe00f294d5c3c042e97ab47d4c6ef661.zip |
Implemented cmd_bkgdScrollSceneAndMasksRight.
svn-id: r19772
Diffstat (limited to 'kyra')
-rw-r--r-- | kyra/kyra.cpp | 58 | ||||
-rw-r--r-- | kyra/kyra.h | 4 | ||||
-rw-r--r-- | kyra/script_v1.cpp | 12 |
3 files changed, 67 insertions, 7 deletions
diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp index daa7e28a3d..172c9bd641 100644 --- a/kyra/kyra.cpp +++ b/kyra/kyra.cpp @@ -273,6 +273,7 @@ int KyraEngine::init(GameDetector &detector) { _seq = new SeqPlayer(this, _system); assert(_seq); + _paletteChanged = 1; _currentCharacter = 0; _characterList = new Character[11]; assert(_characterList); @@ -453,13 +454,17 @@ void KyraEngine::startup() { int size = _screen->getRectSize(3, 24); _shapes[365+i] = (byte*)malloc(size); } - _shapes[0] = (byte*)malloc(_screen->getRectSize(3, 24)); + _unkPtr1 = (uint8*)malloc(_screen->getRectSize(1, 144)); + memset(_unkPtr1, 0, _screen->getRectSize(1, 144)); + _unkPtr2 = (uint8*)malloc(_screen->getRectSize(1, 144)); + memset(_unkPtr2, 0, _screen->getRectSize(1, 144)); + _shapes[0] = (uint8*)malloc(_screen->getRectSize(3, 24)); memset(_shapes[0], 0, _screen->getRectSize(3, 24)); - _shapes[1] = (byte*)malloc(_screen->getRectSize(4, 32)); + _shapes[1] = (uint8*)malloc(_screen->getRectSize(4, 32)); memset(_shapes[1], 0, _screen->getRectSize(4, 32)); - _shapes[2] = (byte*)malloc(_screen->getRectSize(8, 69)); + _shapes[2] = (uint8*)malloc(_screen->getRectSize(8, 69)); memset(_shapes[2], 0, _screen->getRectSize(8, 69)); - _shapes[3] = (byte*)malloc(_screen->getRectSize(8, 69)); + _shapes[3] = (uint8*)malloc(_screen->getRectSize(8, 69)); memset(_shapes[3], 0, _screen->getRectSize(8, 69)); for (int i = 0; i < _roomTableSize; ++i) { for (int item = 0; item < 12; ++item) { @@ -3698,6 +3703,51 @@ int KyraEngine::getDrawLayer2(int x, int y, int height) { return layer; } +void KyraEngine::copyBackgroundBlock(int x, int page, int flag) { + debug(9, "copyBackgroundBlock(%d, %d, %d)", x, page, flag); + + if (x < 1) + return; + + int height = 128; + if (flag) + height += 8; + if (!(x & 1)) + ++x; + if (x == 19) + x = 17; + uint8 *ptr1 = _unkPtr1; + uint8 *ptr2 = _unkPtr2; + int oldVideoPage = _screen->_curPage; + _screen->_curPage = page; + + int curX = x; + _screen->hideMouse(); + _screen->copyRegionToBuffer(_screen->_curPage, 8, 8, 8, height, ptr2); + for (int i = 0; i < 19; ++i) { + int tempX = curX + 1; + _screen->copyRegionToBuffer(_screen->_curPage, tempX<<3, 8, 8, height, ptr1); + _screen->copyBlockToPage(_screen->_curPage, tempX<<3, 8, 8, height, ptr2); + int newXPos = curX + x; + if (newXPos > 37) { + newXPos = newXPos % 38; + } + tempX = newXPos + 1; + _screen->copyRegionToBuffer(_screen->_curPage, tempX<<3, 8, 8, height, ptr2); + _screen->copyBlockToPage(_screen->_curPage, tempX<<3, 8, 8, height, ptr1); + curX += x*2; + if (curX > 37) { + curX = curX % 38; + } + } + _screen->showMouse(); + _screen->_curPage = oldVideoPage; +} + +void KyraEngine::copyBackgroundBlock2(int x) { + copyBackgroundBlock(x, 4, 1); +} + #pragma mark - #pragma mark - Pathfinder #pragma mark - diff --git a/kyra/kyra.h b/kyra/kyra.h index c202a05e83..fa352f9c9c 100644 --- a/kyra/kyra.h +++ b/kyra/kyra.h @@ -182,6 +182,7 @@ public: int16 _northExitHeight; Character *_currentCharacter; + int _paletteChanged; typedef void (KyraEngine::*IntroProc)(); typedef int (KyraEngine::*OpcodeProc)(ScriptState *script); @@ -465,6 +466,8 @@ protected: void restoreRect0(int xpos, int ypos); void backUpRect1(int xpos, int ypos); void restoreRect1(int xpos, int ypos); + void copyBackgroundBlock(int x, int page, int flag); + void copyBackgroundBlock2(int x); void processInput(int xpos, int ypos); int processInputHelper(int xpos, int ypos); @@ -561,6 +564,7 @@ protected: uint16 _talkMessageH; bool _talkMessagePrinted; uint8 _flagsTable[53]; + uint8 *_unkPtr1, *_unkPtr2; uint8 *_shapes[377]; uint16 _gameSpeed; uint16 _tickLength; diff --git a/kyra/script_v1.cpp b/kyra/script_v1.cpp index 14c1fc3f28..0f964e7752 100644 --- a/kyra/script_v1.cpp +++ b/kyra/script_v1.cpp @@ -1200,7 +1200,12 @@ int KyraEngine::cmd_getCharactersFacing(ScriptState *script) { } int KyraEngine::cmd_bkgdScrollSceneAndMasksRight(ScriptState *script) { - warning("STUB: cmd_bkgdScrollSceneAndMasksRight"); + debug(3, "cmd_bkgdScrollSceneAndMasksRight(0x%X) (%d)", script, stackPos(0)); + copyBackgroundBlock(stackPos(0), 2, 0); + copyBackgroundBlock2(stackPos(0)); + // update the whole screen + _screen->copyRegion(7, 7, 7, 7, 305, 129, 3, 0); + _screen->updateScreen(); return 0; } @@ -1529,8 +1534,9 @@ int KyraEngine::cmd_resetMaskRegion(ScriptState *script) { } int KyraEngine::cmd_setPaletteChangeFlag(ScriptState *script) { - warning("STUB: cmd_setPaletteChangeFlag"); - return 0; + debug(3, "cmd_setPaletteChangeFlag(0x%X) (%d)", script, stackPos(0)); + _paletteChanged = stackPos(0); + return _paletteChanged; } int KyraEngine::cmd_fillRect(ScriptState *script) { |