- Strife game code refactored for coordinates.

This commit is contained in:
Christoph Oelckers 2016-01-19 11:50:07 +01:00
commit 9f78bcd1e6
21 changed files with 124 additions and 115 deletions

View file

@ -21,16 +21,14 @@ IMPLEMENT_CLASS (ALoreShot)
int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
{
FVector3 thrust;
if (victim != NULL && target != NULL && !(victim->flags7 & MF7_DONTTHRUST))
{
thrust.X = float(target->x - victim->x);
thrust.Y = float(target->y - victim->y);
thrust.Z = float(target->z - victim->z);
fixedvec3 fixthrust = victim->Vec3To(target);
TVector3<double> thrust(fixthrust.x, fixthrust.y, fixthrust.z);
thrust.MakeUnit();
thrust *= float((255*50*FRACUNIT) / (victim->Mass ? victim->Mass : 1));
thrust *= double((255*50*FRACUNIT) / (victim->Mass ? victim->Mass : 1));
victim->velx += fixed_t(thrust.X);
victim->vely += fixed_t(thrust.Y);
@ -42,7 +40,7 @@ int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
DEFINE_ACTION_FUNCTION(AActor, A_LoremasterChain)
{
S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM);
Spawn("LoreShot2", self->x, self->y, self->z, ALLOW_REPLACE);
Spawn("LoreShot2", self->x - (self->velx >> 1), self->y - (self->vely >> 1), self->z - (self->velz >> 1), ALLOW_REPLACE);
Spawn("LoreShot2", self->x - self->velx, self->y - self->vely, self->z - self->velz, ALLOW_REPLACE);
Spawn("LoreShot2", self->Pos(), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-(self->velx >> 1), -(self->vely >> 1), -(self->velz >> 1)), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-self->velx, -self->vely, -self->velz), ALLOW_REPLACE);
}