Blood: fixed initialization of dmgControl array.

This got lost somewhere in the commit shuffling.
This commit is contained in:
Christoph Oelckers 2023-10-26 20:26:53 +02:00
parent bb6bb85508
commit be9ddb0007
3 changed files with 15 additions and 0 deletions

View file

@ -4331,6 +4331,7 @@ DBloodActor* actSpawnDude(DBloodActor* source, int nType, double dist)
spawned->spr.Angles.Yaw = angle;
SetActor(spawned, pos);
spawned->UpdateDmgControl();
spawned->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_BLOOD_BIT1;
spawned->clipdist = getDudeInfo(nDude + kDudeBase)->fClipdist();
spawned->xspr.health = getDudeInfo(nDude + kDudeBase)->startHealth << 4;

View file

@ -204,6 +204,7 @@ TArray<DBloodActor*> SpawnActors(BloodSpawnSpriteDef& sprites)
{
actor->addX();
actor->xspr = sprites.xspr[i];
actor->UpdateDmgControl();
}
}
leveltimer = sprites.sprites.Size();

View file

@ -150,6 +150,18 @@ public:
}
#endif
void UpdateDmgControl()
{
if (IsDudeActor())
{
memcpy(dmgControl, getDudeInfo(this)->startDamage, sizeof(dmgControl));
}
else
{
memcpy(dmgControl, static_cast<DBloodActor*>(GetDefaultByType(GetClass()))->dmgControl, sizeof(dmgControl));
}
}
void ChangeType(PClass* newtype)
{
if (newtype->IsDescendantOf(RUNTIME_CLASS(DBloodActor)) && newtype->Size == RUNTIME_CLASS(DBloodActor)->Size && GetClass()->Size == RUNTIME_CLASS(DBloodActor)->Size)
@ -157,6 +169,7 @@ public:
// It sucks having to do this but the game heavily depends on being able to swap out the class type and often uses this to manage actor state.
// We'll allow this only for classes that do not add their own data, though.
SetClass(newtype);
UpdateDmgControl();
}
}