- replaced AActor::vel and player_t::Vel with a floating point version.

- Converted P_MovePlayer and all associated variables to floating point because this wasn't working well with a mixture between float and fixed.

Like the angle commit this has just been patched up to compile, the bulk of work is yet to be done.
This commit is contained in:
Christoph Oelckers 2016-03-20 00:54:18 +01:00
commit 51b05d331d
140 changed files with 2406 additions and 2403 deletions

View file

@ -85,7 +85,7 @@ FName MeansOfDeath;
//
void P_TouchSpecialThing (AActor *special, AActor *toucher)
{
fixed_t delta = special->Z() - toucher->Z();
fixed_t delta = special->_f_Z() - toucher->_f_Z();
// The pickup is at or above the toucher's feet OR
// The pickup is below the toucher.
@ -927,9 +927,9 @@ static inline bool isFakePain(AActor *target, AActor *inflictor, int damage)
// Returns the amount of damage actually inflicted upon the target, or -1 if
// the damage was cancelled.
int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags, angle_t angle)
int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags, DAngle angle)
{
unsigned ang;
DAngle ang;
player_t *player = NULL;
fixed_t thrust;
int temp;
@ -974,7 +974,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
{
target->tics = 1;
target->flags6 |= MF6_SHATTERING;
target->vel.x = target->vel.y = target->vel.z = 0;
target->Vel.Zero();
}
return -1;
}
@ -1029,7 +1029,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
}
if (target->flags & MF_SKULLFLY)
{
target->vel.x = target->vel.y = target->vel.z = 0;
target->Vel.Zero();
}
player = target->player;
@ -1160,11 +1160,11 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
// If the origin and target are in exactly the same spot, choose a random direction.
// (Most likely cause is from telefragging somebody during spawning because they
// haven't moved from their spawn spot at all.)
ang = pr_kickbackdir.GenRand32();
ang = pr_kickbackdir.GenRand_Real2() * 360.;
}
else
{
ang = origin->__f_AngleTo(target);
ang = origin->AngleTo(target);
}
// Calculate this as float to avoid overflows so that the
@ -1184,7 +1184,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
// make fall forwards sometimes
if ((damage < 40) && (damage > target->health)
&& (target->Z() - origin->Z() > 64*FRACUNIT)
&& (target->Z() - origin->Z() > 64)
&& (pr_damagemobj()&1)
// [RH] But only if not too fast and not flying
&& thrust < 10*FRACUNIT
@ -1192,26 +1192,23 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
&& (inflictor == NULL || !(inflictor->flags5 & MF5_NOFORWARDFALL))
)
{
ang += ANG180;
ang += 180.;
thrust *= 4;
}
ang >>= ANGLETOFINESHIFT;
if (source && source->player && (flags & DMG_INFLICTOR_IS_PUFF)
&& source->player->ReadyWeapon != NULL &&
(source->player->ReadyWeapon->WeaponFlags & WIF_STAFF2_KICKBACK))
{
// Staff power level 2
target->vel.x += FixedMul (10*FRACUNIT, finecosine[ang]);
target->vel.y += FixedMul (10*FRACUNIT, finesine[ang]);
target->Thrust(ang, 10);
if (!(target->flags & MF_NOGRAVITY))
{
target->vel.z += 5*FRACUNIT;
target->Vel.Z += 5.;
}
}
else
{
target->vel.x += FixedMul (thrust, finecosine[ang]);
target->vel.y += FixedMul (thrust, finesine[ang]);
target->Thrust(ang, FIXED2DBL(thrust));
}
}
}