SCUMM: HE: SPYFOX3: Fix #4767

Indeed, we were missing some code from the original
which handled overlapping actors in which some moved
and some did not, which caused the latter to be erased.

Thanks eriktorbjorn for the great pointers on this.
This commit is contained in:
AndywinXp 2024-04-28 21:22:01 +02:00
parent 378531d779
commit 2c601ad06a
6 changed files with 39 additions and 16 deletions

View File

@ -132,7 +132,7 @@ void ActorHE::initActor(int mode) {
_heShadow = 0;
_hePaletteNum = 0;
_heFlags = 0;
_generalFlags = 0;
_heTalking = false;
if (_vm->_game.heversion >= 61)
@ -2347,6 +2347,25 @@ void ScummEngine::processActors() {
} else {
a->drawActorCostume();
a->animateCostume();
if (_game.heversion >= 80) {
if (VAR_ALWAYS_REDRAW_ACTORS != 0xFF && VAR(VAR_ALWAYS_REDRAW_ACTORS) != 0)
continue;
}
if (_game.heversion >= 71) {
// Check if this new actor eclipsed another one...
for (int i = 0; i < _gdi->_numStrips; i++) {
int strip = _screenStartStrip + i;
if (testGfxAnyUsageBits(strip)) {
for (int j = 1; j < _numActors; j++) {
if (testGfxUsageBit(strip, j) && testGfxOtherUsageBits(strip, j)) {
_actors[j]->_needRedraw = true;
}
}
}
}
}
}
}
}
@ -2840,7 +2859,7 @@ void ScummEngine::setActorRedrawFlags() {
// Redraw all actors if a full redraw was requested.
// Also redraw all actors in COMI (see bug #1825 for details).
if (_fullRedraw || _game.version == 8 || (VAR_REDRAW_ALL_ACTORS != 0xFF && VAR(VAR_REDRAW_ALL_ACTORS) != 0)) {
if (_fullRedraw || _game.version == 8 || (VAR_ALWAYS_REDRAW_ACTORS != 0xFF && VAR(VAR_ALWAYS_REDRAW_ACTORS) != 0)) {
for (j = 1; j < _numActors; j++) {
_actors[j]->_needRedraw = true;
}
@ -2873,7 +2892,7 @@ void ScummEngine::resetActorBgs() {
clearGfxUsageBit(strip, USAGE_BIT_DIRTY);
clearGfxUsageBit(strip, USAGE_BIT_RESTORED);
for (j = 1; j < _numActors; j++) {
if (_game.heversion != 0 && ((ActorHE *)_actors[j])->_heFlags & 1)
if (_game.heversion != 0 && (((ActorHE *)_actors[j])->_generalFlags & ACTOR_GENERAL_FLAG_IGNORE_ERASE) != 0)
continue;
if (testGfxUsageBit(strip, j) &&
@ -3473,12 +3492,16 @@ bool Actor_v2::isPlayer() {
return (_vm->_game.id == GID_MANIAC && _vm->_game.version == 1) ? (_number == _vm->VAR(_vm->VAR_EGO)) : (_vm->VAR(42) <= _number && _number <= _vm->VAR(43));
}
void ActorHE::setHEFlag(int bit, int set) {
// Note that condition is inverted
if (!set) {
_heFlags |= bit;
void ActorHE::setActorEraseType(int eraseValue) {
if (eraseValue) {
_generalFlags &= ~ACTOR_GENERAL_FLAG_IGNORE_ERASE;
} else {
_heFlags &= ~bit;
_generalFlags |= ACTOR_GENERAL_FLAG_IGNORE_ERASE;
}
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
_needBgReset = true;
_needRedraw = true;
}
}

View File

@ -27,6 +27,8 @@
namespace Scumm {
#define ACTOR_GENERAL_FLAG_IGNORE_ERASE 0x00000001
struct HEEraseAuxEntry {
int actor;
int32 x1, y1, x2, y2;
@ -62,7 +64,7 @@ public:
void drawActorToBackBuf(int x, int y);
void setHEFlag(int bit, int set);
void setActorEraseType(int eraseValue);
void setCondition(int slot, int set);
bool isConditionSet(int slot) const;
@ -79,7 +81,7 @@ public:
bool _heNoTalkAnimation;
bool _heTalking;
byte _heFlags;
byte _generalFlags;
int _auxActor;
int32 _auxEraseX1, _auxEraseY1, _auxEraseX2, _auxEraseY2;

View File

@ -404,8 +404,7 @@ void ScummEngine_v100he::o100_actorOps() {
a->initActor(0);
break;
case SO_ERASE:
k = pop();
a->setHEFlag(1, k);
a->setActorEraseType(pop());
break;
case SO_NAME:
copyScriptString(string, sizeof(string));

View File

@ -861,8 +861,7 @@ void ScummEngine_v72he::o72_actorOps() {
break;
}
case SO_ERASE: // // (HE 90+)
k = pop();
a->setHEFlag(1, k);
a->setActorEraseType(pop());
break;
case SO_COSTUME:
a->setActorCostume(pop());

View File

@ -1823,7 +1823,7 @@ public:
byte VAR_ACTIVE_OBJECT2 = 0xFF;
// HE specific variables
byte VAR_REDRAW_ALL_ACTORS = 0xFF; // Used in setActorRedrawFlags()
byte VAR_ALWAYS_REDRAW_ACTORS = 0xFF; // Used in setActorRedrawFlags()
byte VAR_SKIP_RESET_TALK_ACTOR = 0xFF; // Used in setActorCostume()
byte VAR_SOUND_CHANNEL = 0xFF; // Used in o_startSound()

View File

@ -322,7 +322,7 @@ void ScummEngine_v80he::setupScummVars() {
VAR_NUM_SOUND_CHANNELS = 88;
VAR_COLOR_DEPTH = 89;
VAR_COLOR_BLACK = 93;
VAR_REDRAW_ALL_ACTORS = 95;
VAR_ALWAYS_REDRAW_ACTORS = 95;
}
void ScummEngine_v90he::setupScummVars() {