TWINE: after watching the cutscenes at the television, the background is not properly restored

https://bugs.scummvm.org/ticket/13683
This commit is contained in:
Martin Gerhardy 2022-07-12 01:18:03 +02:00
parent 19a7a40c41
commit dd56f35477
8 changed files with 24 additions and 23 deletions

View File

@ -451,7 +451,7 @@ void Debug::debugProcessWindow() {
count++;
}
_engine->_redraw->_reqBgRedraw = true;
_engine->_redraw->_firstTime = true;
}
void Debug::processDebug() {

View File

@ -43,17 +43,17 @@ void DebugGrid::changeGridCamera() {
Input *input = _engine->_input;
if (input->isActionActive(TwinEActionType::DebugGridCameraPressUp)) {
grid->_newCamera.z--;
redraw->_reqBgRedraw = true;
redraw->_firstTime = true;
} else if (input->isActionActive(TwinEActionType::DebugGridCameraPressDown)) {
grid->_newCamera.z++;
redraw->_reqBgRedraw = true;
redraw->_firstTime = true;
}
if (input->isActionActive(TwinEActionType::DebugGridCameraPressLeft)) {
grid->_newCamera.x--;
redraw->_reqBgRedraw = true;
redraw->_firstTime = true;
} else if (input->isActionActive(TwinEActionType::DebugGridCameraPressRight)) {
grid->_newCamera.x++;
redraw->_reqBgRedraw = true;
redraw->_firstTime = true;
}
}
@ -70,7 +70,7 @@ void DebugGrid::changeGrid() {
scene->_currentSceneIdx = LBA1SceneId::Citadel_Island_Prison;
}
scene->_needChangeScene = scene->_currentSceneIdx;
redraw->_reqBgRedraw = true;
redraw->_firstTime = true;
}
if (input->toggleActionIfActive(TwinEActionType::PreviousRoom)) {
@ -79,7 +79,7 @@ void DebugGrid::changeGrid() {
scene->_currentSceneIdx = LBA1SceneId::SceneIdMax - 1;
}
scene->_needChangeScene = scene->_currentSceneIdx;
redraw->_reqBgRedraw = true;
redraw->_firstTime = true;
}
}
@ -111,7 +111,7 @@ void DebugGrid::applyCellingGrid() {
} else if (grid->_useCellingGrid == 1) {
grid->_useCellingGrid = -1;
grid->createGridMap();
_engine->_redraw->_reqBgRedraw = true;
_engine->_redraw->_firstTime = true;
debug("Disable Celling Grid index: %d", grid->_cellingGridIdx);
_engine->_scene->_needChangeScene = SCENE_CEILING_GRID_FADE_2; // tricky to make the fade
}

View File

@ -142,7 +142,7 @@ public:
bool _inSceneryView = false;
/** Request background redraw */
bool _reqBgRedraw = false;
bool _firstTime = false;
/** Current number of redraw regions in the screen */
int32 _currNumOfRedrawBox = 0; // fullRedrawVar8

View File

@ -460,7 +460,7 @@ bool Grid::initCellingGrid(int32 index) {
createCellingGridMap(gridPtr, gridSize);
free(gridPtr);
_engine->_redraw->_reqBgRedraw = true;
_engine->_redraw->_firstTime = true;
return true;
}
@ -834,7 +834,7 @@ void Grid::centerOnActor(const ActorStruct* actor) {
_newCamera.x = (actor->_pos.x + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
_newCamera.y = (actor->_pos.y + SIZE_BRICK_Y) / SIZE_BRICK_Y;
_newCamera.z = (actor->_pos.z + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
_engine->_redraw->_reqBgRedraw = true;
_engine->_redraw->_firstTime = true;
}
void Grid::centerScreenOnActor() {
@ -863,7 +863,7 @@ void Grid::centerScreenOnActor() {
_newCamera.z = SIZE_CUBE_Z - 1;
}
_engine->_redraw->_reqBgRedraw = true;
_engine->_redraw->_firstTime = true;
}
}

View File

@ -732,7 +732,7 @@ void Scene::checkZoneSce(int32 actorIdx) {
_engine->_grid->_newCamera.x = zone->infoData.CameraView.x;
_engine->_grid->_newCamera.y = zone->infoData.CameraView.y;
_engine->_grid->_newCamera.z = zone->infoData.CameraView.z;
_engine->_redraw->_reqBgRedraw = true;
_engine->_redraw->_firstTime = true;
}
}
break;
@ -796,7 +796,7 @@ void Scene::checkZoneSce(int32 actorIdx) {
_engine->_grid->_useCellingGrid = -1;
_engine->_grid->_cellingGridIdx = -1;
_engine->_grid->createGridMap();
_engine->_redraw->_reqBgRedraw = true;
_engine->_redraw->_firstTime = true;
}
}

View File

@ -1227,7 +1227,7 @@ static int32 lZOOM(TwinEEngine *engine, LifeScriptContext &ctx) {
engine->exitSceneryView();
engine->_screens->setBackPal();
engine->_screens->_fadePalette = true;
engine->_redraw->_reqBgRedraw = true;
engine->_redraw->_firstTime = true;
}
return 0;
@ -1324,6 +1324,7 @@ static int32 lHIT_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x40
*/
static int32 lPLAY_FLA(TwinEEngine *engine, LifeScriptContext &ctx) {
ScopedEngineFreeze timer(engine);
int strIdx = 0;
char movie[64];
do {
@ -1340,7 +1341,7 @@ static int32 lPLAY_FLA(TwinEEngine *engine, LifeScriptContext &ctx) {
engine->_movie->playMovie(movie);
engine->setPalette(engine->_screens->_paletteRGBA);
engine->_screens->clearScreen();
engine->_redraw->_firstTime = true;
return 0;
}

View File

@ -360,14 +360,14 @@ static int32 mBACKGROUND(TwinEEngine *engine, MoveScriptContext &ctx) {
if (!ctx.actor->_staticFlags.bIsBackgrounded) {
ctx.actor->_staticFlags.bIsBackgrounded = 1;
if (ctx.actor->_dynamicFlags.bIsDrawn) {
engine->_redraw->_reqBgRedraw = true;
engine->_redraw->_firstTime = true;
}
}
} else {
if (ctx.actor->_staticFlags.bIsBackgrounded) {
ctx.actor->_staticFlags.bIsBackgrounded = 0;
if (ctx.actor->_dynamicFlags.bIsDrawn) {
engine->_redraw->_reqBgRedraw = true;
engine->_redraw->_firstTime = true;
}
}
}

View File

@ -1009,7 +1009,7 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
_scene->_heroPositionType = ScenePositionType::kReborn;
_scene->_sceneHero->setLife(kActorMaxLife);
_redraw->_reqBgRedraw = true;
_redraw->_firstTime = true;
_screens->_fadePalette = true;
_gameState->addLeafs(-1);
_actor->_cropBottomScreen = 0;
@ -1050,23 +1050,23 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
_grid->centerScreenOnActor();
_redraw->redrawEngineActions(_redraw->_reqBgRedraw);
_redraw->redrawEngineActions(_redraw->_firstTime);
// workaround to fix hero redraw after drowning
if (_actor->_cropBottomScreen && _redraw->_reqBgRedraw) {
if (_actor->_cropBottomScreen && _redraw->_firstTime) {
_scene->_sceneHero->_staticFlags.bIsHidden = 1;
_redraw->redrawEngineActions(true);
_scene->_sceneHero->_staticFlags.bIsHidden = 0;
}
_scene->_needChangeScene = SCENE_CEILING_GRID_FADE_1;
_redraw->_reqBgRedraw = false;
_redraw->_firstTime = false;
return false;
}
bool TwinEEngine::gameEngineLoop() {
_redraw->_reqBgRedraw = true;
_redraw->_firstTime = true;
_screens->_fadePalette = true;
_movements->setActorAngle(ANGLE_0, -ANGLE_90, ANGLE_1, &_loopMovePtr);