mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 06:12:19 +00:00
- fixed and cleaned up ALoreShot::DoSpecialDamage.
This commit is contained in:
parent
d1cca79c31
commit
92fbe47ade
1 changed files with 10 additions and 10 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue