- two missed iterators.

This commit is contained in:
Christoph Oelckers 2021-09-01 21:52:36 +02:00
parent 13348ca428
commit dc5d32f510
2 changed files with 13 additions and 15 deletions

View file

@ -4440,7 +4440,7 @@ static void checkFloorHit(DBloodActor* actor)
break; break;
} }
if (mass1 > mass2 && IsDudeSprite(pSprite2)) if (mass1 > mass2 && actor2->IsDudeActor())
{ {
if ((IsPlayerSprite(pSprite2) && Chance(0x500)) || !IsPlayerSprite(pSprite2)) if ((IsPlayerSprite(pSprite2) && Chance(0x500)) || !IsPlayerSprite(pSprite2))
actKickObject(actor, actor2); actKickObject(actor, actor2);

View file

@ -836,7 +836,7 @@ static void unicultThinkChase(DBloodActor* actor)
case 3: case 3:
if (pHSprite->statnum == kStatFX || pHSprite->statnum == kStatProjectile || pHSprite->statnum == kStatDebris) if (pHSprite->statnum == kStatFX || pHSprite->statnum == kStatProjectile || pHSprite->statnum == kStatDebris)
break; break;
if (IsDudeSprite(pHSprite) && (weaponType != kGenDudeWeaponHitscan || hscn)) if (hitactor->IsDudeActor() && (weaponType != kGenDudeWeaponHitscan || hscn))
{ {
// dodge a bit in sides // dodge a bit in sides
if (hitactor->GetTarget() != actor) if (hitactor->GetTarget() != actor)
@ -2539,12 +2539,11 @@ bool genDudePrepare(DBloodActor* actor, int propId)
case kGenDudePropertyLeech: case kGenDudePropertyLeech:
pExtra->pLifeLeech = nullptr; pExtra->pLifeLeech = nullptr;
if (pSprite->owner != kMaxSprites - 1) { if (pSprite->owner != kMaxSprites - 1) {
int nSprite; BloodStatIterator it(kStatThing);
StatIterator it(kStatThing); while (auto actor2 = it.Next())
while ((nSprite = it.NextIndex()) >= 0)
{ {
if (sprite[nSprite].owner == pSprite->index && sprite[nSprite].type == kModernThingEnemyLifeLeech) { if (actor2->GetOwner() == actor && actor2->s().type == kModernThingEnemyLifeLeech) {
pExtra->pLifeLeech = &bloodActors[nSprite]; pExtra->pLifeLeech = actor2;
break; break;
} }
} }
@ -2555,17 +2554,16 @@ bool genDudePrepare(DBloodActor* actor, int propId)
case kGenDudePropertySlaves: case kGenDudePropertySlaves:
{ {
pExtra->slaveCount = 0; memset(pExtra->slave, -1, sizeof(pExtra->slave)); pExtra->slaveCount = 0; memset(pExtra->slave, -1, sizeof(pExtra->slave));
int nSprite; BloodStatIterator it(kStatDude);
StatIterator it(kStatDude); while (auto actor2 = it.Next())
while ((nSprite = it.NextIndex()) >= 0)
{ {
if (sprite[nSprite].owner != pSprite->index) continue; if (actor2->GetOwner() != actor) continue;
else if (!IsDudeSprite(&sprite[nSprite]) || !xspriRangeIsFine(sprite[nSprite].extra) || xsprite[sprite[nSprite].extra].health <= 0) { else if (!actor2->IsDudeActor() || !actor2->hasX() || actor2->x().health <= 0) {
sprite[nSprite].owner = -1; actor2->SetOwner(nullptr);
continue; continue;
} }
pExtra->slave[pExtra->slaveCount++] = &bloodActors[nSprite]; pExtra->slave[pExtra->slaveCount++] = actor2;
if (pExtra->slaveCount > gGameOptions.nDifficulty) if (pExtra->slaveCount > gGameOptions.nDifficulty)
break; break;
} }
@ -2573,7 +2571,7 @@ bool genDudePrepare(DBloodActor* actor, int propId)
[[fallthrough]]; [[fallthrough]];
} }
case kGenDudePropertySpriteSize: { case kGenDudePropertySpriteSize: {
if (seqGetStatus(3, pSprite->extra) == -1) if (seqGetStatus(actor) == -1)
seqSpawn(pXSprite->data2 + pXSprite->aiState->seqId, 3, pSprite->extra, -1); seqSpawn(pXSprite->data2 + pXSprite->aiState->seqId, 3, pSprite->extra, -1);
// make sure dudes aren't in the floor or ceiling // make sure dudes aren't in the floor or ceiling