[Scummvm-git-logs] scummvm master -> 505ff5388a9b6f5b2faa5c1857be04b7ab05711b
kelmer44
noreply at scummvm.org
Fri Jul 10 08:43:10 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
505ff5388a PELROCK: Prevent sprites from popping up when entering new room
Commit: 505ff5388a9b6f5b2faa5c1857be04b7ab05711b
https://github.com/scummvm/scummvm/commit/505ff5388a9b6f5b2faa5c1857be04b7ab05711b
Author: kelmer (kelmer at gmail.com)
Date: 2026-07-10T10:43:01+02:00
Commit Message:
PELROCK: Prevent sprites from popping up when entering new room
Changed paths:
engines/pelrock/pelrock.cpp
engines/pelrock/pelrock.h
diff --git a/engines/pelrock/pelrock.cpp b/engines/pelrock/pelrock.cpp
index dfb92fd487e..6ccdcb94c44 100644
--- a/engines/pelrock/pelrock.cpp
+++ b/engines/pelrock/pelrock.cpp
@@ -659,10 +659,29 @@ void PelrockEngine::updateAnimations() {
// Draw Alfred
chooseAlfredStateAndDraw();
- // Second pass: sprites in front of Alfred (sprite zOrder <= alfredZOrder)
- for (uint i = 0; i < _room->_currentRoomAnims.size(); i++) {
- if (_room->_currentRoomAnims[i].zOrder <= alfredZOrder && _room->_currentRoomAnims[i].zOrder != 255) {
- drawNextFrame(&_room->_currentRoomAnims[i]);
+ if (_roomChangedDuringAnimation) {
+ // Room changed mid-frame: re-render both passes for the new room using the
+ // correct z-order. The old alfredZOrder above is stale (old room/position),
+ // and the first-pass sprites were wiped when setScreen() copied the new
+ // background over _compositeBuffer.
+ _roomChangedDuringAnimation = false;
+ sortAnimsByZOrder(_room->_currentRoomAnims);
+ alfredZOrder = calculateAlfredZOrder(_alfredState.y);
+ for (uint i = 0; i < _room->_currentRoomAnims.size(); i++) {
+ if (_room->_currentRoomAnims[i].zOrder > alfredZOrder || _room->_currentRoomAnims[i].zOrder == 255)
+ drawNextFrame(&_room->_currentRoomAnims[i]);
+ }
+ drawIdleFrame();
+ for (uint i = 0; i < _room->_currentRoomAnims.size(); i++) {
+ if (_room->_currentRoomAnims[i].zOrder <= alfredZOrder && _room->_currentRoomAnims[i].zOrder != 255)
+ drawNextFrame(&_room->_currentRoomAnims[i]);
+ }
+ } else {
+ // Second pass: sprites in front of Alfred (sprite zOrder <= alfredZOrder)
+ for (uint i = 0; i < _room->_currentRoomAnims.size(); i++) {
+ if (_room->_currentRoomAnims[i].zOrder <= alfredZOrder && _room->_currentRoomAnims[i].zOrder != 255) {
+ drawNextFrame(&_room->_currentRoomAnims[i]);
+ }
}
}
@@ -835,6 +854,13 @@ void PelrockEngine::chooseAlfredStateAndDraw() {
_alfredState.y = exit->targetY;
setScreenAndPrepare(exit->targetRoom, exit->dir);
_graphics->placeStickersFirstPass();
+ // Signal updateAnimations() to re-render both sprite passes for the
+ // new room. setScreen() wiped _compositeBuffer with the new background,
+ // so the first-pass sprites (already drawn for the old room) are gone.
+ // The second-pass loop below also uses the stale old alfredZOrder,
+ // which would misclassify new-room sprites. The flag triggers a full
+ // re-render with the correct z-order after this function returns.
+ _roomChangedDuringAnimation = true;
}
}
} else {
diff --git a/engines/pelrock/pelrock.h b/engines/pelrock/pelrock.h
index 3583cd02364..ae76116d6da 100644
--- a/engines/pelrock/pelrock.h
+++ b/engines/pelrock/pelrock.h
@@ -154,6 +154,7 @@ private:
bool _disableAmbientSounds = false;
bool _isDogPeeing = false;
bool _disableAction = false;
+ bool _roomChangedDuringAnimation = false;
protected:
// Engine APIs
More information about the Scummvm-git-logs
mailing list