mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 21:21:05 +00:00
SHERLOCK: Revised door close fix due to new bug when entering morgue
This commit is contained in:
parent
f97e550d86
commit
0a2c50deb5
@ -83,6 +83,17 @@ void SceneSound::synchronize(Common::SeekableReadStream &s) {
|
|||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
|
|
||||||
|
int ObjectArray::indexOf(const Object &obj) const {
|
||||||
|
for (uint idx = 0; idx < size(); ++idx) {
|
||||||
|
if (&(*this)[idx] == &obj)
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------*/
|
||||||
|
|
||||||
Scene::Scene(SherlockEngine *vm): _vm(vm) {
|
Scene::Scene(SherlockEngine *vm): _vm(vm) {
|
||||||
for (int idx = 0; idx < SCENES_COUNT; ++idx)
|
for (int idx = 0; idx < SCENES_COUNT; ++idx)
|
||||||
Common::fill(&_sceneStats[idx][0], &_sceneStats[idx][65], false);
|
Common::fill(&_sceneStats[idx][0], &_sceneStats[idx][65], false);
|
||||||
@ -1047,18 +1058,9 @@ int Scene::startCAnim(int cAnimNum, int playRate) {
|
|||||||
if (cObj._frameNumber <= 26)
|
if (cObj._frameNumber <= 26)
|
||||||
gotoCode = cObj._sequences[cObj._frameNumber + 3];
|
gotoCode = cObj._sequences[cObj._frameNumber + 3];
|
||||||
|
|
||||||
// Set canim to REMOVE type and free memory
|
// Unless anim shape has already been freed, set it to REMOVE so doBgAnim can free it
|
||||||
|
if (_canimShapes.indexOf(cObj) != -1)
|
||||||
cObj.checkObject();
|
cObj.checkObject();
|
||||||
for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
|
|
||||||
if (&_canimShapes[idx] == &cObj) {
|
|
||||||
// Do a final call to doBgAnim to erase the anim shape before it's erased
|
|
||||||
doBgAnim();
|
|
||||||
|
|
||||||
// Remove the completed sprite from the animation shapes array
|
|
||||||
_canimShapes.remove_at(idx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gotoCode > 0 && !talk._talkToAbort) {
|
if (gotoCode > 0 && !talk._talkToAbort) {
|
||||||
_goToScene = gotoCode;
|
_goToScene = gotoCode;
|
||||||
@ -1377,13 +1379,14 @@ void Scene::doBgAnim() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
|
for (int idx = _canimShapes.size() - 1; idx >= 0; --idx) {
|
||||||
Object &o = _canimShapes[idx];
|
Object &o = _canimShapes[idx];
|
||||||
if (o._type == REMOVE) {
|
if (o._type == REMOVE) {
|
||||||
if (_goToScene == -1)
|
if (_goToScene == -1)
|
||||||
screen.slamArea(o._position.x, o._position.y, o._delta.x, o._delta.y);
|
screen.slamArea(o._position.x, o._position.y, o._delta.x, o._delta.y);
|
||||||
|
|
||||||
_canimShapes[idx]._type = INVALID;
|
// Shape for an animation is no longer needed, so remove it completely
|
||||||
|
_canimShapes.remove_at(idx);
|
||||||
} else if (o._type == ACTIVE_BG_SHAPE) {
|
} else if (o._type == ACTIVE_BG_SHAPE) {
|
||||||
screen.flushImage(o._imageFrame, o._position,
|
screen.flushImage(o._imageFrame, o._position,
|
||||||
&o._oldPosition.x, &o._oldPosition.y, &o._oldSize.x, &o._oldSize.y);
|
&o._oldPosition.x, &o._oldPosition.y, &o._oldSize.x, &o._oldSize.y);
|
||||||
|
@ -83,6 +83,11 @@ struct SceneSound {
|
|||||||
void synchronize(Common::SeekableReadStream &s);
|
void synchronize(Common::SeekableReadStream &s);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ObjectArray: public Common::Array<Object> {
|
||||||
|
public:
|
||||||
|
int indexOf(const Object &obj) const;
|
||||||
|
};
|
||||||
|
|
||||||
class Scene {
|
class Scene {
|
||||||
private:
|
private:
|
||||||
SherlockEngine *_vm;
|
SherlockEngine *_vm;
|
||||||
@ -127,7 +132,7 @@ public:
|
|||||||
Common::Array<Exit> _exits;
|
Common::Array<Exit> _exits;
|
||||||
SceneEntry _entrance;
|
SceneEntry _entrance;
|
||||||
Common::Array<SceneSound> _sounds;
|
Common::Array<SceneSound> _sounds;
|
||||||
Common::Array<Object> _canimShapes;
|
ObjectArray _canimShapes;
|
||||||
bool _restoreFlag;
|
bool _restoreFlag;
|
||||||
int _animating;
|
int _animating;
|
||||||
bool _doBgAnimDone;
|
bool _doBgAnimDone;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user