diff options
author | Johannes Schickel | 2005-12-20 10:58:07 +0000 |
---|---|---|
committer | Johannes Schickel | 2005-12-20 10:58:07 +0000 |
commit | f241049961e4758894a0d1abefce6a225956f7d8 (patch) | |
tree | 6b1b9ff10043fc125543e5aa03acedf8c21fba65 /kyra | |
parent | 53f13b76e41298536145b9e511c2938cc1bc1eb0 (diff) | |
download | scummvm-rg350-f241049961e4758894a0d1abefce6a225956f7d8.tar.gz scummvm-rg350-f241049961e4758894a0d1abefce6a225956f7d8.tar.bz2 scummvm-rg350-f241049961e4758894a0d1abefce6a225956f7d8.zip |
Fixes gfx bug in the temple and the cave, also corrected
the encodeShape and drawShape function for CD version.
svn-id: r19814
Diffstat (limited to 'kyra')
-rw-r--r-- | kyra/kyra.cpp | 24 | ||||
-rw-r--r-- | kyra/kyra.h | 2 | ||||
-rw-r--r-- | kyra/screen.cpp | 15 | ||||
-rw-r--r-- | kyra/script_v1.cpp | 47 |
4 files changed, 62 insertions, 26 deletions
diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp index 38c717a43f..828e31cbab 100644 --- a/kyra/kyra.cpp +++ b/kyra/kyra.cpp @@ -522,7 +522,7 @@ void KyraEngine::startup() { enterNewScene(_currentCharacter->sceneId, _currentCharacter->facing, 0, 0, 1); } -void KyraEngine::delay(uint32 amount) { +void KyraEngine::delay(uint32 amount, bool update) { OSystem::Event event; char saveLoadSlot[20]; @@ -576,7 +576,8 @@ void KyraEngine::delay(uint32 amount) { _debugger->onFrame(); _sprites->updateSceneAnims(); - updateAllObjectShapes(); + if (update) + updateAllObjectShapes(); if (_currentCharacter->sceneId == 210) { //XXX @@ -631,7 +632,7 @@ void KyraEngine::mainLoop() { updateTextFade(); _handleInput = true; - delay((frameTime + _gameSpeed) - _system->getMillis()); + delay((frameTime + _gameSpeed) - _system->getMillis(), true); _handleInput = false; } } @@ -1916,12 +1917,15 @@ void KyraEngine::initSceneObjectList(int brandonAlive) { for (int i = 1; i < 5; ++i) { Character *ch = &_characterList[i]; + curAnimState = &_charactersAnimState[addedObjects]; if (ch->sceneId != _currentCharacter->sceneId) { + curAnimState->active = 0; + curAnimState->refreshFlag = 0; + curAnimState->bkgdChangeFlag = 0; ++addedObjects; continue; } - curAnimState = &_charactersAnimState[addedObjects]; curAnimState->drawY = ch->y1; curAnimState->sceneAnimPtr = _shapes[4+ch->currentAnimFrame]; curAnimState->animFrameNumber = ch->currentAnimFrame; @@ -2029,8 +2033,8 @@ void KyraEngine::initSceneObjectList(int brandonAlive) { curAnimState = _charactersAnimState; curAnimState->bkgdChangeFlag = 1; curAnimState->refreshFlag = 1; - for (int i = 0; i < 28; ++i) { - curAnimState = &_charactersAnimState[i]; + for (int i = 1; i < 28; ++i) { + curAnimState = &_animStates[i]; if (curAnimState->active) { curAnimState->bkgdChangeFlag = 1; curAnimState->refreshFlag = 1; @@ -3222,8 +3226,7 @@ void KyraEngine::restoreAllObjectBackgrounds() { _screen->_curPage = 2; while (curObject) { - // XXX - if (curObject->active) { + if (curObject->active && !curObject->unk1) { preserveOrRestoreBackground(curObject, true); curObject->x2 = curObject->x1; curObject->y2 = curObject->y1; @@ -3240,8 +3243,7 @@ void KyraEngine::preserveAnyChangedBackgrounds() { _screen->_curPage = 2; while (curObject) { - // XXX - if (curObject->active && curObject->bkgdChangeFlag) { + if (curObject->active && !curObject->unk1 && curObject->bkgdChangeFlag) { preserveOrRestoreBackground(curObject, false); curObject->bkgdChangeFlag = 0; } @@ -3464,7 +3466,7 @@ void KyraEngine::copyChangedObjectsForward(int refreshFlag) { int xpos = 0, ypos = 0, width = 0, height = 0; xpos = curObject->x1 - (curObject->width2+1); ypos = curObject->y1 - curObject->height2; - width = (curObject->width + curObject->width2*2)<<3; + width = (curObject->width + ((curObject->width2)>>3)+2)<<3; height = curObject->height + curObject->height2*2; if (xpos < 8) { diff --git a/kyra/kyra.h b/kyra/kyra.h index f2a9b72170..fa82b1f4c3 100644 --- a/kyra/kyra.h +++ b/kyra/kyra.h @@ -532,7 +532,7 @@ protected: void res_loadShapeTable(const byte *src, Shape **loadTo, int *size); void waitForEvent(); - void delay(uint32 millis); + void delay(uint32 millis, bool update = false); void loadPalette(const char *filename, uint8 *palData); void loadMouseShapes(); void loadCharacterShapes(); diff --git a/kyra/screen.cpp b/kyra/screen.cpp index 6a32bc8c29..3c42de0461 100644 --- a/kyra/screen.cpp +++ b/kyra/screen.cpp @@ -673,6 +673,13 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int } memset(_decodeShapeBuffer, 0, _decodeShapeBufferSize); uint8 *decodedShapeFrame = _decodeShapeBuffer; + + // only used if shapeFlag & 1 is NOT zero + const uint8 *colorTable = shapeData + 10; + if (_vm->features() & GF_TALKIE) { + colorTable += 2; + } + for (int j = 0; j < shapeHeight; ++j) { uint8 *dsbNextLine = decodedShapeFrame + shapeWidth; int count = shapeWidth; @@ -681,8 +688,9 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int if (code != 0) { // this is guessed if (shapeFlags & 1) { - const uint8 *colorTable = shapeData + 10; - *decodedShapeFrame++ = colorTable[code]; + if (code < 16) { + *decodedShapeFrame++ = colorTable[code]; + } } else { *decodedShapeFrame++ = code; } @@ -1427,6 +1435,9 @@ uint8 *Screen::encodeShape(int x, int y, int w, int h, int flags) { if (flags & 1) { dst = newShape + 10; + if (_vm->features() & GF_TALKIE) { + dst += 2; + } src = &table[0x100]; memcpy(dst, src, sizeof(uint8)*16); } diff --git a/kyra/script_v1.cpp b/kyra/script_v1.cpp index fb6271c261..bae0bcd2c5 100644 --- a/kyra/script_v1.cpp +++ b/kyra/script_v1.cpp @@ -576,7 +576,7 @@ int KyraEngine::cmd_setBrandonStatusBit(ScriptState *script) { int KyraEngine::cmd_pauseSeconds(ScriptState *script) { debug(3, "cmd_pauseSeconds(0x%X) (%d)", script, stackPos(0)); if (stackPos(0) > 0) - delay(stackPos(0)*1000); + delay(stackPos(0)*1000, false); return 0; } @@ -673,15 +673,20 @@ int KyraEngine::cmd_runWSAFromBeginningToEnd(ScriptState *script) { while (running) { wsa_play(_wsaObjects[wsaIndex], wsaFrame++, xpos, ypos, 0); + _updateScreen = true; if (wsaFrame >= wsa_getNumFrames(_wsaObjects[wsaIndex])) running = false; - delay(waitTime * _tickLength); - if (worldUpdate) { - _sprites->updateSceneAnims(); - updateAllObjectShapes(); + uint32 continueTime = waitTime * _tickLength + _system->getMillis(); + while (_system->getMillis() < continueTime) { + if (worldUpdate) { + _sprites->updateSceneAnims(); + updateAllObjectShapes(); + } else { + _screen->updateScreen(); + } + delay(10); } - _updateScreen = true; } _screen->showMouse(); @@ -698,7 +703,12 @@ int KyraEngine::cmd_displayWSAFrame(ScriptState *script) { int wsaIndex = stackPos(4); _screen->hideMouse(); wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 0); - delay(waitTime * _tickLength); + uint32 continueTime = waitTime * _tickLength + _system->getMillis(); + while (_system->getMillis() < continueTime) { + _sprites->updateSceneAnims(); + updateAllObjectShapes(); + delay(10); + } _updateScreen = true; _screen->showMouse(); return 0; @@ -893,9 +903,12 @@ int KyraEngine::cmd_displayWSAFrameOnHidPage(ScriptState *script) { _screen->hideMouse(); wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 2); - delay(waitTime*_tickLength); - _sprites->updateSceneAnims(); - updateAllObjectShapes(); + uint32 continueTime = waitTime * _tickLength + _system->getMillis(); + while (_system->getMillis() < continueTime) { + _sprites->updateSceneAnims(); + updateAllObjectShapes(); + delay(10); + } _screen->showMouse(); return 0; @@ -920,16 +933,26 @@ int KyraEngine::cmd_displayWSASequentialFrames(ScriptState *script) { int frame = startFrame; while (endFrame >= frame) { wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 0); - delay(waitTime * _tickLength); _updateScreen = true; + uint32 continueTime = waitTime * _tickLength + _system->getMillis(); + while (_system->getMillis() < continueTime) { + _sprites->updateSceneAnims(); + updateAllObjectShapes(); + delay(10); + } ++frame; } } else { int frame = endFrame; while (startFrame <= frame) { wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 0); - delay(waitTime * _tickLength); _updateScreen = true; + uint32 continueTime = waitTime * _tickLength + _system->getMillis(); + while (_system->getMillis() < continueTime) { + _sprites->updateSceneAnims(); + updateAllObjectShapes(); + delay(10); + } --frame; } } |