- made AActor::velx/y/z and player_t::velx/y fixedvec's.
(This commit is 95% search & replace with only a few places where velz was used as a local variable changed.)
This commit is contained in:
parent
4116719a5a
commit
651817fad7
81 changed files with 869 additions and 870 deletions
|
|
@ -1260,16 +1260,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
|||
{
|
||||
if (CMF_OFFSETPITCH & flags)
|
||||
{
|
||||
DVector2 velocity (missile->velx, missile->vely);
|
||||
pitch += R_PointToAngle2(0,0, xs_CRoundToInt(velocity.Length()), missile->velz);
|
||||
DVector2 velocity (missile->vel.x, missile->vel.y);
|
||||
pitch += R_PointToAngle2(0,0, xs_CRoundToInt(velocity.Length()), missile->vel.z);
|
||||
}
|
||||
ang = pitch >> ANGLETOFINESHIFT;
|
||||
missilespeed = abs(FixedMul(finecosine[ang], missile->Speed));
|
||||
missile->velz = FixedMul(finesine[ang], missile->Speed);
|
||||
missile->vel.z = FixedMul(finesine[ang], missile->Speed);
|
||||
}
|
||||
else
|
||||
{
|
||||
DVector2 velocity (missile->velx, missile->vely);
|
||||
DVector2 velocity (missile->vel.x, missile->vel.y);
|
||||
missilespeed = xs_CRoundToInt(velocity.Length());
|
||||
}
|
||||
|
||||
|
|
@ -1284,8 +1284,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
|||
missile->angle = (CMF_ABSOLUTEANGLE & flags) ? angle : missile->angle + angle ;
|
||||
|
||||
ang = missile->angle >> ANGLETOFINESHIFT;
|
||||
missile->velx = FixedMul(missilespeed, finecosine[ang]);
|
||||
missile->vely = FixedMul(missilespeed, finesine[ang]);
|
||||
missile->vel.x = FixedMul(missilespeed, finecosine[ang]);
|
||||
missile->vel.y = FixedMul(missilespeed, finesine[ang]);
|
||||
|
||||
// handle projectile shooting projectiles - track the
|
||||
// links back to a real owner
|
||||
|
|
@ -1677,12 +1677,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
|
|||
{
|
||||
// This original implementation is to aim straight ahead and then offset
|
||||
// the angle from the resulting direction.
|
||||
DVector3 velocity(misl->velx, misl->vely, 0);
|
||||
DVector3 velocity(misl->vel.x, misl->vel.y, 0);
|
||||
fixed_t missilespeed = xs_CRoundToInt(velocity.Length());
|
||||
misl->angle += angle;
|
||||
angle_t an = misl->angle >> ANGLETOFINESHIFT;
|
||||
misl->velx = FixedMul (missilespeed, finecosine[an]);
|
||||
misl->vely = FixedMul (missilespeed, finesine[an]);
|
||||
misl->vel.x = FixedMul (missilespeed, finecosine[an]);
|
||||
misl->vel.y = FixedMul (missilespeed, finesine[an]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1940,7 +1940,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
// Let the aim trail behind the player
|
||||
if (aim)
|
||||
{
|
||||
saved_angle = self->angle = self->AngleTo(self->target, -self->target->velx * 3, -self->target->vely * 3);
|
||||
saved_angle = self->angle = self->AngleTo(self->target, -self->target->vel.x * 3, -self->target->vel.y * 3);
|
||||
|
||||
if (aim == CRF_AIMDIRECT)
|
||||
{
|
||||
|
|
@ -1950,7 +1950,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
spawnofs_xy * finecosine[self->angle],
|
||||
spawnofs_xy * finesine[self->angle]));
|
||||
spawnofs_xy = 0;
|
||||
self->angle = self->AngleTo(self->target,- self->target->velx * 3, -self->target->vely * 3);
|
||||
self->angle = self->AngleTo(self->target,- self->target->vel.x * 3, -self->target->vel.y * 3);
|
||||
}
|
||||
|
||||
if (self->target->flags & MF_SHADOW)
|
||||
|
|
@ -2518,15 +2518,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
|
|||
}
|
||||
if (flags & SIXF_MULTIPLYSPEED)
|
||||
{
|
||||
mo->velx = FixedMul(xvel, mo->Speed);
|
||||
mo->vely = FixedMul(yvel, mo->Speed);
|
||||
mo->velz = FixedMul(zvel, mo->Speed);
|
||||
mo->vel.x = FixedMul(xvel, mo->Speed);
|
||||
mo->vel.y = FixedMul(yvel, mo->Speed);
|
||||
mo->vel.z = FixedMul(zvel, mo->Speed);
|
||||
}
|
||||
else
|
||||
{
|
||||
mo->velx = xvel;
|
||||
mo->vely = yvel;
|
||||
mo->velz = zvel;
|
||||
mo->vel.x = xvel;
|
||||
mo->vel.y = yvel;
|
||||
mo->vel.z = zvel;
|
||||
}
|
||||
mo->angle = angle;
|
||||
}
|
||||
|
|
@ -2598,9 +2598,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ThrowGrenade)
|
|||
fixed_t z_velx = FixedMul(z_xyscale, finecosine[angle]);
|
||||
fixed_t z_vely = FixedMul(z_xyscale, finesine[angle]);
|
||||
|
||||
bo->velx = xy_velx + z_velx + (self->velx >> 1);
|
||||
bo->vely = xy_vely + z_vely + (self->vely >> 1);
|
||||
bo->velz = xy_velz + z_velz;
|
||||
bo->vel.x = xy_velx + z_velx + (self->vel.x >> 1);
|
||||
bo->vel.y = xy_vely + z_vely + (self->vel.y >> 1);
|
||||
bo->vel.z = xy_velz + z_velz;
|
||||
|
||||
bo->target = self;
|
||||
P_CheckMissileSpawn (bo, self->radius);
|
||||
|
|
@ -2625,8 +2625,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Recoil)
|
|||
|
||||
angle_t angle = self->angle + ANG180;
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
self->velx += FixedMul(xyvel, finecosine[angle]);
|
||||
self->vely += FixedMul(xyvel, finesine[angle]);
|
||||
self->vel.x += FixedMul(xyvel, finecosine[angle]);
|
||||
self->vel.y += FixedMul(xyvel, finesine[angle]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2985,9 +2985,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris)
|
|||
{
|
||||
mo->SetState (mo->GetClass()->OwnedStates + i);
|
||||
}
|
||||
mo->velz = FixedMul(mult_v, ((pr_spawndebris()&7)+5)*FRACUNIT);
|
||||
mo->velx = FixedMul(mult_h, pr_spawndebris.Random2()<<(FRACBITS-6));
|
||||
mo->vely = FixedMul(mult_h, pr_spawndebris.Random2()<<(FRACBITS-6));
|
||||
mo->vel.z = FixedMul(mult_v, ((pr_spawndebris()&7)+5)*FRACUNIT);
|
||||
mo->vel.x = FixedMul(mult_h, pr_spawndebris.Random2()<<(FRACBITS-6));
|
||||
mo->vel.y = FixedMul(mult_h, pr_spawndebris.Random2()<<(FRACBITS-6));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -3344,7 +3344,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst)
|
|||
return 0;
|
||||
}
|
||||
|
||||
self->velx = self->vely = self->velz = 0;
|
||||
self->vel.x = self->vel.y = self->vel.z = 0;
|
||||
self->height = self->GetDefault()->height;
|
||||
|
||||
// [RH] In Hexen, this creates a random number of shards (range [24,56])
|
||||
|
|
@ -3363,9 +3363,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst)
|
|||
|
||||
if (mo)
|
||||
{
|
||||
mo->velz = FixedDiv(mo->Z() - self->Z(), self->height)<<2;
|
||||
mo->velx = pr_burst.Random2 () << (FRACBITS-7);
|
||||
mo->vely = pr_burst.Random2 () << (FRACBITS-7);
|
||||
mo->vel.z = FixedDiv(mo->Z() - self->Z(), self->height)<<2;
|
||||
mo->vel.x = pr_burst.Random2 () << (FRACBITS-7);
|
||||
mo->vel.y = pr_burst.Random2 () << (FRACBITS-7);
|
||||
mo->RenderStyle = self->RenderStyle;
|
||||
mo->alpha = self->alpha;
|
||||
mo->CopyFriendliness(self, true);
|
||||
|
|
@ -3429,11 +3429,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckCeiling)
|
|||
DEFINE_ACTION_FUNCTION(AActor, A_Stop)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
self->velx = self->vely = self->velz = 0;
|
||||
self->vel.x = self->vel.y = self->vel.z = 0;
|
||||
if (self->player && self->player->mo == self && !(self->player->cheats & CF_PREDICTING))
|
||||
{
|
||||
self->player->mo->PlayIdle();
|
||||
self->player->velx = self->player->vely = 0;
|
||||
self->player->vel.x = self->player->vel.y = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -3443,10 +3443,10 @@ static void CheckStopped(AActor *self)
|
|||
if (self->player != NULL &&
|
||||
self->player->mo == self &&
|
||||
!(self->player->cheats & CF_PREDICTING) &&
|
||||
!(self->velx | self->vely | self->velz))
|
||||
!(self->vel.x | self->vel.y | self->vel.z))
|
||||
{
|
||||
self->player->mo->PlayIdle();
|
||||
self->player->velx = self->player->vely = 0;
|
||||
self->player->vel.x = self->player->vel.y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4562,11 +4562,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ScaleVelocity)
|
|||
return 0;
|
||||
}
|
||||
|
||||
INTBOOL was_moving = ref->velx | ref->vely | ref->velz;
|
||||
INTBOOL was_moving = ref->vel.x | ref->vel.y | ref->vel.z;
|
||||
|
||||
ref->velx = FixedMul(ref->velx, scale);
|
||||
ref->vely = FixedMul(ref->vely, scale);
|
||||
ref->velz = FixedMul(ref->velz, scale);
|
||||
ref->vel.x = FixedMul(ref->vel.x, scale);
|
||||
ref->vel.y = FixedMul(ref->vel.y, scale);
|
||||
ref->vel.z = FixedMul(ref->vel.z, scale);
|
||||
|
||||
// If the actor was previously moving but now is not, and is a player,
|
||||
// update its player variables. (See A_Stop.)
|
||||
|
|
@ -4599,7 +4599,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity)
|
|||
return 0;
|
||||
}
|
||||
|
||||
INTBOOL was_moving = ref->velx | ref->vely | ref->velz;
|
||||
INTBOOL was_moving = ref->vel.x | ref->vel.y | ref->vel.z;
|
||||
|
||||
fixed_t vx = x, vy = y, vz = z;
|
||||
fixed_t sina = finesine[ref->angle >> ANGLETOFINESHIFT];
|
||||
|
|
@ -4612,15 +4612,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity)
|
|||
}
|
||||
if (flags & 2) // discard old velocity - replace old velocity with new velocity
|
||||
{
|
||||
ref->velx = vx;
|
||||
ref->vely = vy;
|
||||
ref->velz = vz;
|
||||
ref->vel.x = vx;
|
||||
ref->vel.y = vy;
|
||||
ref->vel.z = vz;
|
||||
}
|
||||
else // add new velocity to old velocity
|
||||
{
|
||||
ref->velx += vx;
|
||||
ref->vely += vy;
|
||||
ref->velz += vz;
|
||||
ref->vel.x += vx;
|
||||
ref->vel.y += vy;
|
||||
ref->vel.z += vz;
|
||||
}
|
||||
|
||||
if (was_moving)
|
||||
|
|
@ -4903,7 +4903,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport)
|
|||
ref->angle = spot->angle;
|
||||
|
||||
if (!(flags & TF_KEEPVELOCITY))
|
||||
ref->velx = ref->vely = ref->velz = 0;
|
||||
ref->vel.x = ref->vel.y = ref->vel.z = 0;
|
||||
|
||||
if (!(flags & TF_NOJUMP)) //The state jump should only happen with the calling actor.
|
||||
{
|
||||
|
|
@ -5139,9 +5139,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack)
|
|||
dist /= blocksize;
|
||||
|
||||
// Now for the speed accuracy thingie
|
||||
fixed_t speed = FixedMul(self->target->velx, self->target->velx)
|
||||
+ FixedMul(self->target->vely, self->target->vely)
|
||||
+ FixedMul(self->target->velz, self->target->velz);
|
||||
fixed_t speed = FixedMul(self->target->vel.x, self->target->vel.x)
|
||||
+ FixedMul(self->target->vel.y, self->target->vel.y)
|
||||
+ FixedMul(self->target->vel.z, self->target->vel.z);
|
||||
int hitchance = speed < runspeed ? 256 : 160;
|
||||
|
||||
// Distance accuracy (factoring dodge)
|
||||
|
|
@ -6776,10 +6776,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMovementDirection)
|
|||
}
|
||||
|
||||
//Don't bother calculating this if we don't have any horizontal movement.
|
||||
if (!(flags & FMDF_NOANGLE) && (mobj->velx != 0 || mobj->vely != 0))
|
||||
if (!(flags & FMDF_NOANGLE) && (mobj->vel.x != 0 || mobj->vel.y != 0))
|
||||
{
|
||||
angle_t current = mobj->angle;
|
||||
const angle_t angle = R_PointToAngle2(0, 0, mobj->velx, mobj->vely);
|
||||
const angle_t angle = R_PointToAngle2(0, 0, mobj->vel.x, mobj->vel.y);
|
||||
//Done because using anglelimit directly causes a signed/unsigned mismatch.
|
||||
const angle_t limit = anglelimit;
|
||||
|
||||
|
|
@ -6814,8 +6814,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMovementDirection)
|
|||
if (!(flags & FMDF_NOPITCH))
|
||||
{
|
||||
fixed_t current = mobj->pitch;
|
||||
const DVector2 velocity(mobj->velx, mobj->vely);
|
||||
const fixed_t pitch = R_PointToAngle2(0, 0, xs_CRoundToInt(velocity.Length()), -mobj->velz);
|
||||
const DVector2 velocity(mobj->vel.x, mobj->vel.y);
|
||||
const fixed_t pitch = R_PointToAngle2(0, 0, xs_CRoundToInt(velocity.Length()), -mobj->vel.z);
|
||||
if (pitchlimit > 0)
|
||||
{
|
||||
// [MC] angle_t for pitchlimit was required because otherwise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue