- cleanup and fixing of ALoreShot::DoSpecialDamage.

This commit is contained in:
Christoph Oelckers 2015-01-24 13:30:45 +01:00
parent a578ff5d06
commit 1c375c9100
1 changed files with 10 additions and 10 deletions

View File

@ -14,27 +14,27 @@ class ALoreShot : public AActor
{ {
DECLARE_CLASS (ALoreShot, AActor) DECLARE_CLASS (ALoreShot, AActor)
public: public:
int DoSpecialDamage (AActor *target, int damage, FName damagetype); int DoSpecialDamage (AActor *victim, int damage, FName damagetype);
}; };
IMPLEMENT_CLASS (ALoreShot) IMPLEMENT_CLASS (ALoreShot)
int ALoreShot::DoSpecialDamage (AActor *target, int damage, FName damagetype) int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
{ {
FVector3 thrust; FVector3 thrust;
if (this->target != NULL && !(this->target->flags7 & MF7_DONTTHRUST)) if (victim != NULL && target != NULL && !(victim->flags7 & MF7_DONTTHRUST))
{ {
thrust.X = float(this->target->x - target->x); thrust.X = float(target->x - victim->x);
thrust.Y = float(this->target->y - target->y); thrust.Y = float(target->y - victim->y);
thrust.Z = float(this->target->z - target->z); thrust.Z = float(target->z - victim->z);
thrust.MakeUnit(); thrust.MakeUnit();
thrust *= float((255*50*FRACUNIT) / (target->Mass ? target->Mass : 1)); thrust *= float((255*50*FRACUNIT) / (victim->Mass ? target->Mass : 1));
target->velx += fixed_t(thrust.X); victim->velx += fixed_t(thrust.X);
target->vely += fixed_t(thrust.Y); victim->vely += fixed_t(thrust.Y);
target->velz += fixed_t(thrust.Z); victim->velz += fixed_t(thrust.Z);
} }
return damage; return damage;
} }