From be9ddb000773f4fc97c053cc389d851b38e31fc2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 Oct 2023 20:26:53 +0200 Subject: [PATCH] Blood: fixed initialization of dmgControl array. This got lost somewhere in the commit shuffling. --- source/games/blood/src/actor.cpp | 1 + source/games/blood/src/blood.cpp | 1 + source/games/blood/src/bloodactor.h | 13 +++++++++++++ 3 files changed, 15 insertions(+) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 6a963a025..ea97e79bb 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -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; diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index a9925c663..848fc2777 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -204,6 +204,7 @@ TArray SpawnActors(BloodSpawnSpriteDef& sprites) { actor->addX(); actor->xspr = sprites.xspr[i]; + actor->UpdateDmgControl(); } } leveltimer = sprites.sprites.Size(); diff --git a/source/games/blood/src/bloodactor.h b/source/games/blood/src/bloodactor.h index 9e9c4195c..6069b91fe 100644 --- a/source/games/blood/src/bloodactor.h +++ b/source/games/blood/src/bloodactor.h @@ -150,6 +150,18 @@ public: } #endif + void UpdateDmgControl() + { + if (IsDudeActor()) + { + memcpy(dmgControl, getDudeInfo(this)->startDamage, sizeof(dmgControl)); + } + else + { + memcpy(dmgControl, static_cast(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(); } }