- split up actKillSprite into several smaller functions.

The biggest problem in here was tracking the lifetime of local variables.
This commit is contained in:
Christoph Oelckers 2020-12-03 00:20:14 +01:00
parent 36b910a253
commit 965939957e
4 changed files with 648 additions and 499 deletions

File diff suppressed because it is too large Load diff

View file

@ -217,6 +217,7 @@ void actRadiusDamage(DBloodActor* source, int x, int y, int z, int nSector, int
spritetype *actDropObject(spritetype *pSprite, int nType);
bool actHealDude(DBloodActor* pXDude, int a2, int a3);
bool actHealDude(XSPRITE *pXDude, int a2, int a3);
void actKillDude(DBloodActor* a1, DBloodActor* pSprite, DAMAGE_TYPE a3, int a4);
void actKillDude(int a1, spritetype *pSprite, DAMAGE_TYPE a3, int a4);
int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE a3, int a4);
int actDamageSprite(DBloodActor* pSource, DBloodActor* pTarget, DAMAGE_TYPE damageType, int damage);

View file

@ -140,4 +140,14 @@ inline void GetActorExtents(DBloodActor* actor, int* top, int* bottom)
GetSpriteExtents(&actor->s(), top, bottom);
}
inline DBloodActor *PLAYER::fragger()
{
return fraggerId == -1? nullptr : &bloodActors[fraggerId];
}
inline void PLAYER::setFragger(DBloodActor* actor)
{
fraggerId = actor == nullptr ? -1 : actor->s().index;
}
END_BLD_NS

View file

@ -145,6 +145,8 @@ struct PLAYER
int fragInfo[8];
int teamId;
int fraggerId;
DBloodActor* fragger();
void setFragger(DBloodActor*);
int underwaterTime;
int bubbleTime;
int restTime;