Runtime/MP1/World: Replace bitfield unions with constructor initializers

This commit is contained in:
Luke Street 2020-04-10 15:33:05 -04:00
parent 402e45ecb5
commit 153004faee
14 changed files with 154 additions and 147 deletions

View File

@ -69,7 +69,21 @@ CBabygoth::CBabygoth(TUniqueId uid, std::string_view name, const CEntityInfo& in
g_SimplePool->GetObj({SBIG('WPSC'), babyData.x44_fireBreathWeapon})
: g_SimplePool->GetObj("FlameThrower"sv))
, x98c_dVuln(pInfo.GetDamageVulnerability())
, xa00_shellHitPoints(babyData.GetShellHitPoints()) {
, xa00_shellHitPoints(babyData.GetShellHitPoints())
, xa48_24_isAlert(false)
, xa48_25_(false)
, xa48_26_inProjectileAttack(false)
, xa48_27_(false)
, xa48_28_pendingAttackContactDamage(false)
, xa48_29_hasBeenEnraged(false)
, xa48_30_heardPlayerFire(false)
, xa48_31_approachNeedsPathSearch(true)
, xa49_24_gettingUp(false)
, xa49_25_shouldStepBackwards(false)
, xa49_26_readyForTeam(false)
, xa49_27_locomotionValid(false)
, xa49_28_onApproachPath(false)
, xa49_29_objectSpaceCollision(false) {
TLockedToken<CModel> model = g_SimplePool->GetObj({SBIG('CMDL'), babyData.x138_noShellModel});
TLockedToken<CSkinRules> skin = g_SimplePool->GetObj({SBIG('CSKR'), babyData.x13c_noShellSkin});
xa08_noShellModel =
@ -80,7 +94,6 @@ CBabygoth::CBabygoth(TUniqueId uid, std::string_view name, const CEntityInfo& in
xa2c_destroyShellParticle = g_SimplePool->GetObj({SBIG('PART'), babyData.x154_destroyShellParticle});
if (x570_babyData.x148_intermediateCrackParticle.IsValid())
xa38_intermediateCrackParticle = g_SimplePool->GetObj({SBIG('PART'), babyData.x148_intermediateCrackParticle});
xa48_31_approachNeedsPathSearch = true;
x958_iceProjectile.Token().Lock();
UpdateTouchBounds();
x460_knockBackController.SetEnableFreeze(false);

View File

@ -100,25 +100,20 @@ private:
TToken<CGenDescription> xa20_crackTwoParticle;
TToken<CGenDescription> xa2c_destroyShellParticle;
TLockedToken<CGenDescription> xa38_intermediateCrackParticle; // Used to be an optional, not necessary in URDE
union {
struct {
bool xa48_24_isAlert : 1;
bool xa48_25_ : 1;
bool xa48_26_inProjectileAttack : 1;
bool xa48_27_ : 1;
bool xa48_28_pendingAttackContactDamage : 1;
bool xa48_29_hasBeenEnraged : 1;
bool xa48_30_heardPlayerFire : 1;
bool xa48_31_approachNeedsPathSearch : 1;
bool xa49_24_gettingUp : 1;
bool xa49_25_shouldStepBackwards : 1;
bool xa49_26_readyForTeam : 1;
bool xa49_27_locomotionValid : 1;
bool xa49_28_onApproachPath : 1;
bool xa49_29_objectSpaceCollision : 1;
};
u32 _dummy = 0;
};
bool xa48_24_isAlert : 1;
bool xa48_25_ : 1;
bool xa48_26_inProjectileAttack : 1;
bool xa48_27_ : 1;
bool xa48_28_pendingAttackContactDamage : 1;
bool xa48_29_hasBeenEnraged : 1;
bool xa48_30_heardPlayerFire : 1;
bool xa48_31_approachNeedsPathSearch : 1;
bool xa49_24_gettingUp : 1;
bool xa49_25_shouldStepBackwards : 1;
bool xa49_26_readyForTeam : 1;
bool xa49_27_locomotionValid : 1;
bool xa49_28_onApproachPath : 1;
bool xa49_29_objectSpaceCollision : 1;
void AddSphereCollisionList(const SSphereJointInfo*, s32, std::vector<CJointCollisionDescription>&);

View File

@ -18,22 +18,23 @@ CBeetle::CBeetle(TUniqueId uid, std::string_view name, const CEntityInfo& info,
CModelData&& mData, const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor,
CBeetle::EEntranceType entranceType, const CDamageInfo& touchDamage,
const CDamageVulnerability& platingVuln, const zeus::CVector3f& tailAimReference,
float initialAttackDelay, float retreatTime, float f3,
const CDamageVulnerability& tailVuln, const CActorParameters& aParams,
const std::optional<CStaticRes>& tailModel)
float initialAttackDelay, float retreatTime, float f3, const CDamageVulnerability& tailVuln,
const CActorParameters& aParams, const std::optional<CStaticRes>& tailModel)
: CPatterned(ECharacter::Beetle, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Ground,
EColliderType::One, EBodyType::BiPedal, aParams, EKnockBackVariant(flavor))
, x56c_entranceType(entranceType)
, x574_tailAimReference(tailAimReference)
, x580_f3(f3)
, x584_touchDamage(touchDamage)
, x5ac_tailModel(tailModel ? std::optional<CModelData>(CModelData(*tailModel)) :
std::optional<CModelData>())
, x5ac_tailModel(tailModel ? std::optional<CModelData>(CModelData(*tailModel)) : std::nullopt)
, x5fc_pathFindSearch(nullptr, 1, pInfo.GetPathfindingIndex(), 1.f, 1.f)
, x744_platingVuln(platingVuln)
, x7ac_tailVuln(tailVuln)
, x814_attackDelayTimer(initialAttackDelay)
, x834_retreatTime(retreatTime) {
, x834_retreatTime(retreatTime)
, x838_24_hitSomething(false)
, x838_25_burrowing(false)
, x838_26_canSkid(false) {
x5a0_headbuttDist = GetAnimationDistance(CPASAnimParmData(7, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(1)));
x5a4_jumpBackwardDist =
x64_modelData->GetScale().y() *

View File

@ -38,14 +38,9 @@ private:
zeus::CVector3f x824_predictPos;
float x830_intoGroundFactor = 1.f;
float x834_retreatTime;
union {
struct {
bool x838_24_hitSomething : 1;
bool x838_25_burrowing : 1;
bool x838_26_canSkid : 1;
};
u32 _dummy3 = 0;
};
bool x838_24_hitSomething : 1;
bool x838_25_burrowing : 1;
bool x838_26_canSkid : 1;
void SquadAdd(CStateManager& mgr);
void SquadRemove(CStateManager& mgr);

View File

@ -23,6 +23,7 @@ CMetroid::CMetroid(TUniqueId uid, std::string_view name, EFlavorType flavor, con
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
const CActorParameters& aParms, const CMetroidData& metroidData, TUniqueId)
: CPatterned(ECharacter::Metroid, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer,
EColliderType::One, EBodyType::Flyer, aParms, EKnockBackVariant::Medium) {}
EColliderType::One, EBodyType::Flyer, aParms, EKnockBackVariant::Medium)
, x9bf_29_(false) {}
} // namespace urde::MP1

View File

@ -30,12 +30,7 @@ public:
};
class CMetroid : public CPatterned {
union {
struct {
bool x9bf_29_ : 1;
};
u32 _dummy = 0;
};
bool x9bf_29_ : 1;
public:
DEFINE_PATTERNED(Metroid)

View File

@ -56,7 +56,15 @@ CMetroidBeta::CMetroidBeta(TUniqueId uid, std::string_view name, const CEntityIn
, x824_(std::make_unique<CParticleSwoosh>(x7f0_, 0))
, x828_(std::make_unique<CElementGen>(x7fc_))
, x82c_(std::make_unique<CElementGen>(x808_))
, x830_(std::make_unique<CElementGen>(x814_)) {
, x830_(std::make_unique<CElementGen>(x814_))
, x840_24_(false)
, x840_25_(false)
, x840_26_(false)
, x840_27_(false)
, x840_28_(false)
, x840_29_(false)
, x840_30_(false)
, x840_31_(false) {
x820_->SetParticleEmission(false);
x828_->SetParticleEmission(false);
x82c_->SetParticleEmission(false);

View File

@ -75,19 +75,14 @@ class CMetroidBeta : public CPatterned {
float x834_ = 0.f;
CRandom16 x838_ = CRandom16(1469);
float x83c_;
union {
struct {
bool x840_24_ : 1;
bool x840_25_ : 1;
bool x840_26_ : 1;
bool x840_27_ : 1;
bool x840_28_ : 1;
bool x840_29_ : 1;
bool x840_30_ : 1;
bool x840_31_ : 1;
};
u32 _dummy = 0;
};
bool x840_24_ : 1;
bool x840_25_ : 1;
bool x840_26_ : 1;
bool x840_27_ : 1;
bool x840_28_ : 1;
bool x840_29_ : 1;
bool x840_30_ : 1;
bool x840_31_ : 1;
void CreateCollisionActorManager(CStateManager& mgr);
void AddSphereJoints(SSphereJointInfo* sphereJoints, s32 count, std::vector<CJointCollisionDescription>& joints);

View File

@ -58,10 +58,19 @@ CParasite::CParasite(TUniqueId uid, std::string_view name, EFlavorType flavor, c
, x714_iceZoomerJointHP(iceZoomerJointHP)
, x73c_haltSfx(CSfxManager::TranslateSFXID(haltSfx))
, x73e_getUpSfx(CSfxManager::TranslateSFXID(getUpSfx))
, x740_crouchSfx(CSfxManager::TranslateSFXID(crouchSfx)) {
x742_28_onGround = true;
x742_30_attackOver = true;
, x740_crouchSfx(CSfxManager::TranslateSFXID(crouchSfx))
, x742_24_receivedTelegraph(false)
, x742_25_jumpVelDirty(false)
, x742_26_(false)
, x742_27_landed(false)
, x742_28_onGround(true)
, x742_29_(false)
, x742_30_attackOver(true)
, x742_31_(false)
, x743_24_halted(false)
, x743_25_vulnerable(false)
, x743_26_oculusShotAt(false)
, x743_27_inJump(false) {
switch (x5d0_walkerType) {
case EWalkerType::Geemer:
x460_knockBackController.SetEnableFreeze(false);

View File

@ -70,23 +70,19 @@ class CParasite : public CWallWalker {
u16 x73c_haltSfx;
u16 x73e_getUpSfx;
u16 x740_crouchSfx;
union {
struct {
bool x742_24_receivedTelegraph : 1;
bool x742_25_jumpVelDirty : 1;
bool x742_26_ : 1;
bool x742_27_landed : 1;
bool x742_28_onGround : 1;
bool x742_29_ : 1;
bool x742_30_attackOver : 1;
bool x742_31_ : 1;
bool x743_24_halted : 1;
bool x743_25_vulnerable : 1;
bool x743_26_oculusShotAt : 1;
bool x743_27_inJump : 1;
};
u16 _dummy = 0;
};
bool x742_24_receivedTelegraph : 1;
bool x742_25_jumpVelDirty : 1;
bool x742_26_ : 1;
bool x742_27_landed : 1;
bool x742_28_onGround : 1;
bool x742_29_ : 1;
bool x742_30_attackOver : 1;
bool x742_31_ : 1;
bool x743_24_halted : 1;
bool x743_25_vulnerable : 1;
bool x743_26_oculusShotAt : 1;
bool x743_27_inJump : 1;
bool CloseToWall(const CStateManager& mgr) const;
void FaceTarget(const zeus::CVector3f& target);
TUniqueId RecursiveFindClosestWayPoint(CStateManager& mgr, TUniqueId id, float& dist);

View File

@ -418,6 +418,7 @@ CSpacePirate::CSpacePirate(TUniqueId uid, std::string_view name, const CEntityIn
x637_24_enablePatrol = false;
x637_25_enableAim = false;
x637_26_hearPlayerFire = false;
x637_27_inProjectilePath = false;
x637_28_noPlayerLos = false;
x637_29_inWallHang = false;
x637_30_jumpVelSet = false;
@ -438,6 +439,7 @@ CSpacePirate::CSpacePirate(TUniqueId uid, std::string_view name, const CEntityIn
x639_29_enableBreakDodge = false;
x639_30_closeMelee = false;
x639_31_sentAttackMsg = false;
x63a_24_normalDodge = false;
x758_headSeg = x64_modelData->GetAnimationData()->GetLocatorSegId("Head_1"sv);
x7b6_gunSeg = x64_modelData->GetAnimationData()->GetLocatorSegId("R_gun_LCTR"sv);

View File

@ -97,61 +97,56 @@ private:
};
CSpacePirateData x568_pirateData;
union {
struct {
bool x634_24_pendingAmbush : 1;
bool x634_25_ceilingAmbush : 1;
bool x634_26_nonAggressive : 1;
bool x634_27_melee : 1;
bool x634_28_noShuffleCloseCheck : 1;
bool x634_29_onlyAttackInRange : 1;
bool x634_30_ : 1;
bool x634_31_noKnockbackImpulseReset : 1;
bool x635_24_noMeleeAttack : 1;
bool x635_25_breakAttack : 1;
bool x635_26_seated : 1;
bool x635_27_shadowPirate : 1;
bool x635_28_alertBeforeCloak : 1;
bool x635_29_noBreakDodge : 1;
bool x635_30_floatingCorpse : 1;
bool x635_31_ragdollNoAiCollision : 1;
bool x636_24_trooper : 1;
bool x636_25_hearNoise : 1;
bool x636_26_enableMeleeAttack : 1;
bool x636_27_ : 1;
bool x636_28_ : 1;
bool x636_29_enableRetreat : 1;
bool x636_30_shuffleClose : 1;
bool x636_31_inAttackState : 1;
bool x637_24_enablePatrol : 1;
bool x637_25_enableAim : 1;
bool x637_26_hearPlayerFire : 1;
bool x637_27_inProjectilePath : 1;
bool x637_28_noPlayerLos : 1;
bool x637_29_inWallHang : 1;
bool x637_30_jumpVelSet : 1;
bool x637_31_prevInCineCam : 1;
bool x638_24_pendingFrenzyChance : 1;
bool x638_25_appliedBladeDamage : 1;
bool x638_26_alwaysAggressive : 1;
bool x638_27_coverCheck : 1;
bool x638_28_enableDodge : 1;
bool x638_29_noPlayerDodge : 1;
bool x638_30_ragdollOver : 1;
bool x638_31_mayStartAttack : 1;
bool x639_24_ : 1;
bool x639_25_useJumpBackJump : 1;
bool x639_26_started : 1;
bool x639_27_inRange : 1;
bool x639_28_satUp : 1;
bool x639_29_enableBreakDodge : 1;
bool x639_30_closeMelee : 1;
bool x639_31_sentAttackMsg : 1;
bool x63a_24_normalDodge : 1;
};
u64 _dummy = 0;
};
bool x634_24_pendingAmbush : 1;
bool x634_25_ceilingAmbush : 1;
bool x634_26_nonAggressive : 1;
bool x634_27_melee : 1;
bool x634_28_noShuffleCloseCheck : 1;
bool x634_29_onlyAttackInRange : 1;
bool x634_30_ : 1;
bool x634_31_noKnockbackImpulseReset : 1;
bool x635_24_noMeleeAttack : 1;
bool x635_25_breakAttack : 1;
bool x635_26_seated : 1;
bool x635_27_shadowPirate : 1;
bool x635_28_alertBeforeCloak : 1;
bool x635_29_noBreakDodge : 1;
bool x635_30_floatingCorpse : 1;
bool x635_31_ragdollNoAiCollision : 1;
bool x636_24_trooper : 1;
bool x636_25_hearNoise : 1;
bool x636_26_enableMeleeAttack : 1;
bool x636_27_ : 1;
bool x636_28_ : 1;
bool x636_29_enableRetreat : 1;
bool x636_30_shuffleClose : 1;
bool x636_31_inAttackState : 1;
bool x637_24_enablePatrol : 1;
bool x637_25_enableAim : 1;
bool x637_26_hearPlayerFire : 1;
bool x637_27_inProjectilePath : 1;
bool x637_28_noPlayerLos : 1;
bool x637_29_inWallHang : 1;
bool x637_30_jumpVelSet : 1;
bool x637_31_prevInCineCam : 1;
bool x638_24_pendingFrenzyChance : 1;
bool x638_25_appliedBladeDamage : 1;
bool x638_26_alwaysAggressive : 1;
bool x638_27_coverCheck : 1;
bool x638_28_enableDodge : 1;
bool x638_29_noPlayerDodge : 1;
bool x638_30_ragdollOver : 1;
bool x638_31_mayStartAttack : 1;
bool x639_24_ : 1;
bool x639_25_useJumpBackJump : 1;
bool x639_26_started : 1;
bool x639_27_inRange : 1;
bool x639_28_satUp : 1;
bool x639_29_enableBreakDodge : 1;
bool x639_30_closeMelee : 1;
bool x639_31_sentAttackMsg : 1;
bool x63a_24_normalDodge : 1;
s32 x63c_frenzyFrames = 0;
TUniqueId x640_coverPoint = kInvalidUniqueId;

View File

@ -24,9 +24,15 @@ CWarWasp::CWarWasp(TUniqueId uid, std::string_view name, const CEntityInfo& info
, x590_pfSearch(nullptr, 0x3, pInfo.GetPathfindingIndex(), 1.f, 1.f)
, x684_(dInfo1)
, x6d4_projectileInfo(projectileWeapon, projectileDamage)
, x72c_projectileVisorSfx(CSfxManager::TranslateSFXID(projecileVisorSfx)) {
x72e_24_jumpBackRepeat = true;
x72e_26_initiallyInactive = !pInfo.GetActive();
, x72c_projectileVisorSfx(CSfxManager::TranslateSFXID(projecileVisorSfx))
, x72e_24_jumpBackRepeat(true)
, x72e_25_canApplyDamage(false)
, x72e_26_initiallyInactive(!pInfo.GetActive())
, x72e_27_teamMatesMelee(false)
, x72e_28_inProjectileAttack(false)
, x72e_29_pathObstructed(false)
, x72e_30_isRetreating(false)
, x72e_31_heardNoise(false) {
x6d4_projectileInfo.Token().Lock();
UpdateTouchBounds();
SetCoefficientOfRestitutionModifier(0.1f);

View File

@ -33,19 +33,15 @@ class CWarWasp : public CPatterned {
float x718_circleBurstOffTotemAngle = zeus::degToRad(90.f);
TLockedToken<CGenDescription> x71c_projectileVisorParticle; // Used to be optional
u16 x72c_projectileVisorSfx;
union {
struct {
bool x72e_24_jumpBackRepeat : 1;
bool x72e_25_canApplyDamage : 1;
bool x72e_26_initiallyInactive : 1;
bool x72e_27_teamMatesMelee : 1;
bool x72e_28_inProjectileAttack : 1;
bool x72e_29_pathObstructed : 1;
bool x72e_30_isRetreating : 1;
bool x72e_31_heardNoise : 1;
};
u32 _dummy = 0;
};
bool x72e_24_jumpBackRepeat : 1;
bool x72e_25_canApplyDamage : 1;
bool x72e_26_initiallyInactive : 1;
bool x72e_27_teamMatesMelee : 1;
bool x72e_28_inProjectileAttack : 1;
bool x72e_29_pathObstructed : 1;
bool x72e_30_isRetreating : 1;
bool x72e_31_heardNoise : 1;
void SwarmAdd(CStateManager& mgr);
void SwarmRemove(CStateManager& mgr);
void ApplyDamage(CStateManager& mgr);