mirror of
https://github.com/ZDoom/Raze.git
synced 2025-04-21 23:40:48 +00:00
eliminate the redundant pExtra pointer in DCustomDude
This commit is contained in:
parent
2bae1077cf
commit
73050e3f74
3 changed files with 14 additions and 14 deletions
|
@ -815,7 +815,7 @@ void thinkTarget(DBloodActor* pSpr)
|
|||
qsort(targets, numTargets, sizeof(targets[0]), (int(*)(const void*, const void*))qsSortTargets);
|
||||
|
||||
pTarget = pInfo->pSpr;
|
||||
if (pDude->pExtra->active)
|
||||
if (pDude->pSpr->dudeExtra.active)
|
||||
{
|
||||
if (pSpr->xspr.target != pTarget || Chance(0x0400))
|
||||
pDude->PlaySound(kCdudeSndTargetSpot);
|
||||
|
|
|
@ -788,8 +788,8 @@ void DCustomDude::InitSprite(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
pExtra->active = 0;
|
||||
pExtra->thinkTime = 0;
|
||||
pSpr->dudeExtra.active = 0;
|
||||
pSpr->dudeExtra.thinkTime = 0;
|
||||
if (spriteIsUnderwater(pSpr))
|
||||
{
|
||||
pSpr->xspr.medium = kMediumWater;
|
||||
|
@ -840,10 +840,10 @@ void DCustomDude::Activate(void)
|
|||
{
|
||||
if (!IsSleeping())
|
||||
{
|
||||
if (!pExtra->active && StatusTest(kCdudeStatusForceCrouch) && IsCrouching())
|
||||
if (!pSpr->dudeExtra.active && StatusTest(kCdudeStatusForceCrouch) && IsCrouching())
|
||||
posture = kCdudePostureL;
|
||||
|
||||
pExtra->active = 1;
|
||||
pSpr->dudeExtra.active = 1;
|
||||
NewState(kCdudeStateChase);
|
||||
}
|
||||
else
|
||||
|
@ -893,19 +893,19 @@ int DCustomDude::Damage(DBloodActor* nFrom, int nDmgType, int nDmg)
|
|||
{
|
||||
if (IsKnockout())
|
||||
{
|
||||
pExtra->teslaHit = 0;
|
||||
pSpr->dudeExtra.teslaHit = 0;
|
||||
return nDmg;
|
||||
}
|
||||
else if (CanKnockout() && knockout.Allow(t))
|
||||
{
|
||||
NewState(kCdudeStateKnockEnter);
|
||||
PlaySound(kCdudeSndGotHit);
|
||||
pExtra->teslaHit = 0;
|
||||
pSpr->dudeExtra.teslaHit = 0;
|
||||
return nDmg;
|
||||
}
|
||||
|
||||
if (nDmgType == kDmgElectric)
|
||||
pExtra->teslaHit = 1;
|
||||
pSpr->dudeExtra.teslaHit = 1;
|
||||
|
||||
if (CanRecoil() && recoil.Allow(t))
|
||||
Recoil();
|
||||
|
@ -934,7 +934,7 @@ int DCustomDude::Damage(DBloodActor* nFrom, int nDmgType, int nDmg)
|
|||
}
|
||||
}
|
||||
|
||||
pExtra->teslaHit = 0;
|
||||
pSpr->dudeExtra.teslaHit = 0;
|
||||
return nDmg;
|
||||
}
|
||||
|
||||
|
@ -946,7 +946,7 @@ void DCustomDude::Recoil(void)
|
|||
if (CanRecoil())
|
||||
nState = kCdudeStateRecoil;
|
||||
|
||||
if (pExtra->teslaHit)
|
||||
if (pSpr->dudeExtra.teslaHit)
|
||||
{
|
||||
if (CanElectrocute() && !IsUnderwater())
|
||||
{
|
||||
|
@ -958,7 +958,7 @@ void DCustomDude::Recoil(void)
|
|||
NewState(nState);
|
||||
}
|
||||
|
||||
pExtra->teslaHit = 0;
|
||||
pSpr->dudeExtra.teslaHit = 0;
|
||||
}
|
||||
|
||||
AISTATE* DCustomDude::PickDeath(int nDmgType)
|
||||
|
@ -1559,7 +1559,6 @@ void CUSTOMDUDE_SETUP::DoSetup(DBloodActor* pSpr)
|
|||
|
||||
pDude->pInfo = getDudeInfo(pSpr);
|
||||
pDude->pSpr = pSpr;
|
||||
pDude->pExtra = &pSpr->dudeExtra;
|
||||
pDude->pLeech = nullptr;
|
||||
|
||||
pDude->pWeapon = &pDude->weapons[0];
|
||||
|
|
|
@ -1186,6 +1186,8 @@ class CUSTOMDUDE_DROPITEM
|
|||
}
|
||||
};
|
||||
|
||||
using NextDudeInfo = std::variant<bool, int, PClass*, DBloodActor*>;
|
||||
|
||||
class DCustomDude : public DObject
|
||||
{
|
||||
DECLARE_CLASS(DCustomDude, DObject)
|
||||
|
@ -1200,7 +1202,6 @@ class DCustomDude : public DObject
|
|||
uint8_t initialized;
|
||||
uint8_t numEffects;
|
||||
uint8_t numWeapons;
|
||||
DUDEEXTRA* pExtra;
|
||||
DUDEINFO* pInfo;
|
||||
DBloodActor* pSpr; // this is our owner so no TObjPtr is needed
|
||||
TObjPtr<DBloodActor *> pLeech;
|
||||
|
@ -1226,7 +1227,7 @@ class DCustomDude : public DObject
|
|||
double _hearDist ; // dudeInfo duplicate for sleeping
|
||||
DAngle periphery ; // dudeInfo duplicate for sleeping
|
||||
unsigned int fallHeight ; // in pixels
|
||||
std::variant<bool, int, PClass*, DBloodActor*> nextDude;
|
||||
NextDudeInfo nextDude;
|
||||
|
||||
//signed int nextDude ;
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue