mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +00:00
- replaced all uses of P_ThrustMobj with the already implemented AActor::Thrust method and deleted this function.
- for quakes, making a distinction between circular and elliptic thrust is pointless, so the checks were removed and both paths consolidated. The elliptic code will do exactly the same for circles and there isn't even a performance difference.
This commit is contained in:
parent
a43dccaa86
commit
a4f5846c7c
14 changed files with 35 additions and 68 deletions
|
@ -1254,10 +1254,9 @@ void FParser::SF_PushThing(void)
|
||||||
AActor * mo = actorvalue(t_argv[0]);
|
AActor * mo = actorvalue(t_argv[0]);
|
||||||
if(!mo) return;
|
if(!mo) return;
|
||||||
|
|
||||||
angle_t angle = (angle_t)FixedToAngle(fixedvalue(t_argv[1]));
|
DAngle angle = floatvalue(t_argv[1]);
|
||||||
fixed_t force = fixedvalue(t_argv[2]);
|
double force = floatvalue(t_argv[2]);
|
||||||
|
mo->Thrust(angle, force);
|
||||||
P_ThrustMobj(mo, angle, force);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MakePod)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
mo->SetState (mo->FindState("Grow"));
|
mo->SetState (mo->FindState("Grow"));
|
||||||
P_ThrustMobj (mo, pr_makepod()<<24, (fixed_t)(4.5*FRACUNIT));
|
mo->Thrust(pr_makepod() * (360. / 256), 4.5);
|
||||||
S_Sound (mo, CHAN_BODY, self->AttackSound, 1, ATTN_IDLE);
|
S_Sound (mo, CHAN_BODY, self->AttackSound, 1, ATTN_IDLE);
|
||||||
self->special1++; // Increment generated pod count
|
self->special1++; // Increment generated pod count
|
||||||
mo->master = self; // Link the generator to the pod
|
mo->master = self; // Link the generator to the pod
|
||||||
|
|
|
@ -118,15 +118,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopDoBlur)
|
||||||
self->special1 = (pr_doblur() & 3) + 3; // Random number of blurs
|
self->special1 = (pr_doblur() & 3) + 3; // Random number of blurs
|
||||||
if (pr_doblur() < 120)
|
if (pr_doblur() < 120)
|
||||||
{
|
{
|
||||||
P_ThrustMobj (self, self->_f_angle() + ANG90, 11*FRACUNIT);
|
self->Thrust(self->Angles.Yaw + 90, 11);
|
||||||
}
|
}
|
||||||
else if (pr_doblur() > 125)
|
else if (pr_doblur() > 125)
|
||||||
{
|
{
|
||||||
P_ThrustMobj (self, self->_f_angle() - ANG90, 11*FRACUNIT);
|
self->Thrust(self->Angles.Yaw - 90, 11);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Thrust forward
|
{ // Thrust forward
|
||||||
P_ThrustMobj (self, self->_f_angle(), 11*FRACUNIT);
|
self->Thrust(11);
|
||||||
}
|
}
|
||||||
S_Sound (self, CHAN_BODY, "BishopBlur", 1, ATTN_NORM);
|
S_Sound (self, CHAN_BODY, "BishopBlur", 1, ATTN_NORM);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -161,7 +161,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack2)
|
||||||
}
|
}
|
||||||
mo->_f_SetZ(self->_f_Z());
|
mo->_f_SetZ(self->_f_Z());
|
||||||
mo->Angles.Yaw = self->Angles.Yaw + 67.5 - 45.*j;
|
mo->Angles.Yaw = self->Angles.Yaw + 67.5 - 45.*j;
|
||||||
P_ThrustMobj(mo, mo->_f_angle(), mo->_f_speed());
|
mo->Thrust();
|
||||||
mo->target = self->target;
|
mo->target = self->target;
|
||||||
mo->args[0] = 10; // initial turn value
|
mo->args[0] = 10; // initial turn value
|
||||||
mo->args[1] = 0; // initial look angle
|
mo->args[1] = 0; // initial look angle
|
||||||
|
|
|
@ -200,7 +200,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
|
||||||
PARAM_ACTION_PROLOGUE;
|
PARAM_ACTION_PROLOGUE;
|
||||||
|
|
||||||
DAngle angle;
|
DAngle angle;
|
||||||
fixed_t power;
|
int power;
|
||||||
int damage;
|
int damage;
|
||||||
DAngle slope;
|
DAngle slope;
|
||||||
int i;
|
int i;
|
||||||
|
@ -223,7 +223,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
|
||||||
if (player->ReadyWeapon->Ammo1->Amount > 0)
|
if (player->ReadyWeapon->Ammo1->Amount > 0)
|
||||||
{
|
{
|
||||||
damage <<= 1;
|
damage <<= 1;
|
||||||
power = 6*FRACUNIT;
|
power = 6;
|
||||||
pufftype = PClass::FindActor ("AxePuffGlow");
|
pufftype = PClass::FindActor ("AxePuffGlow");
|
||||||
useMana = 1;
|
useMana = 1;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
|
||||||
{
|
{
|
||||||
if (t.linetarget->flags3&MF3_ISMONSTER || t.linetarget->player)
|
if (t.linetarget->flags3&MF3_ISMONSTER || t.linetarget->player)
|
||||||
{
|
{
|
||||||
P_ThrustMobj(t.linetarget, t.angleFromSource, power);
|
t.linetarget->Thrust(t.angleFromSource, power);
|
||||||
}
|
}
|
||||||
AdjustPlayerAngle(pmo, &t);
|
AdjustPlayerAngle(pmo, &t);
|
||||||
useMana++;
|
useMana++;
|
||||||
|
|
|
@ -29,7 +29,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
|
||||||
|
|
||||||
DAngle angle;
|
DAngle angle;
|
||||||
int damage;
|
int damage;
|
||||||
fixed_t power;
|
|
||||||
DAngle slope;
|
DAngle slope;
|
||||||
int i;
|
int i;
|
||||||
player_t *player;
|
player_t *player;
|
||||||
|
@ -43,7 +42,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
|
||||||
AActor *pmo=player->mo;
|
AActor *pmo=player->mo;
|
||||||
|
|
||||||
damage = 60+(pr_hammeratk()&63);
|
damage = 60+(pr_hammeratk()&63);
|
||||||
power = 10*FRACUNIT;
|
|
||||||
hammertime = PClass::FindActor("HammerPuff");
|
hammertime = PClass::FindActor("HammerPuff");
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +57,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
|
||||||
AdjustPlayerAngle(pmo, &t);
|
AdjustPlayerAngle(pmo, &t);
|
||||||
if (t.linetarget->flags3 & MF3_ISMONSTER || t.linetarget->player)
|
if (t.linetarget->flags3 & MF3_ISMONSTER || t.linetarget->player)
|
||||||
{
|
{
|
||||||
P_ThrustMobj(t.linetarget, t.angleFromSource, power);
|
t.linetarget->Thrust(t.angleFromSource, 10);
|
||||||
}
|
}
|
||||||
pmo->weaponspecial = false; // Don't throw a hammer
|
pmo->weaponspecial = false; // Don't throw a hammer
|
||||||
goto hammerdone;
|
goto hammerdone;
|
||||||
|
|
|
@ -53,7 +53,7 @@ void AdjustPlayerAngle (AActor *pmo, FTranslatedLineTarget *t)
|
||||||
//
|
//
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
static bool TryPunch(APlayerPawn *pmo, DAngle angle, int damage, fixed_t power)
|
static bool TryPunch(APlayerPawn *pmo, DAngle angle, int damage, int power)
|
||||||
{
|
{
|
||||||
PClassActor *pufftype;
|
PClassActor *pufftype;
|
||||||
FTranslatedLineTarget t;
|
FTranslatedLineTarget t;
|
||||||
|
@ -78,7 +78,7 @@ static bool TryPunch(APlayerPawn *pmo, DAngle angle, int damage, fixed_t power)
|
||||||
if (t.linetarget->player != NULL ||
|
if (t.linetarget->player != NULL ||
|
||||||
(t.linetarget->Mass != INT_MAX && (t.linetarget->flags3 & MF3_ISMONSTER)))
|
(t.linetarget->Mass != INT_MAX && (t.linetarget->flags3 & MF3_ISMONSTER)))
|
||||||
{
|
{
|
||||||
P_ThrustMobj (t.linetarget, t.angleFromSource, power);
|
t.linetarget->Thrust(t.angleFromSource, power);
|
||||||
}
|
}
|
||||||
AdjustPlayerAngle (pmo, &t);
|
AdjustPlayerAngle (pmo, &t);
|
||||||
return true;
|
return true;
|
||||||
|
@ -98,7 +98,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
|
||||||
PARAM_ACTION_PROLOGUE;
|
PARAM_ACTION_PROLOGUE;
|
||||||
|
|
||||||
int damage;
|
int damage;
|
||||||
fixed_t power;
|
|
||||||
int i;
|
int i;
|
||||||
player_t *player;
|
player_t *player;
|
||||||
|
|
||||||
|
@ -109,11 +108,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
|
||||||
APlayerPawn *pmo = player->mo;
|
APlayerPawn *pmo = player->mo;
|
||||||
|
|
||||||
damage = 40+(pr_fpatk()&15);
|
damage = 40+(pr_fpatk()&15);
|
||||||
power = 2*FRACUNIT;
|
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
if (TryPunch(pmo, pmo->Angles.Yaw + i*(45./16), damage, power) ||
|
if (TryPunch(pmo, pmo->Angles.Yaw + i*(45./16), damage, 2) ||
|
||||||
TryPunch(pmo, pmo->Angles.Yaw - i*(45./16), damage, power))
|
TryPunch(pmo, pmo->Angles.Yaw - i*(45./16), damage, 2))
|
||||||
{ // hit something
|
{ // hit something
|
||||||
if (pmo->weaponspecial >= 3)
|
if (pmo->weaponspecial >= 3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -222,7 +222,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafSpawn)
|
||||||
|
|
||||||
if (mo)
|
if (mo)
|
||||||
{
|
{
|
||||||
P_ThrustMobj (mo, self->_f_angle(), (pr_leaf()<<9)+3*FRACUNIT);
|
mo->Thrust(pr_leaf() / 128. + 3);
|
||||||
mo->target = self;
|
mo->target = self;
|
||||||
mo->special1 = 0;
|
mo->special1 = 0;
|
||||||
}
|
}
|
||||||
|
@ -263,18 +263,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafCheck)
|
||||||
self->SetState (NULL);
|
self->SetState (NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
angle_t ang = self->target ? self->target->_f_angle() : self->_f_angle();
|
DAngle ang = self->target ? self->target->Angles.Yaw : self->Angles.Yaw;
|
||||||
if (pr_leafcheck() > 64)
|
if (pr_leafcheck() > 64)
|
||||||
{
|
{
|
||||||
if (self->Vel.X == 0 && self->Vel.Y == 0)
|
if (self->Vel.X == 0 && self->Vel.Y == 0)
|
||||||
{
|
{
|
||||||
P_ThrustMobj (self, ang, (pr_leafcheck()<<9)+FRACUNIT);
|
self->Thrust(ang, pr_leafcheck() / 128. + 1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
self->SetState (self->SpawnState + 7);
|
self->SetState (self->SpawnState + 7);
|
||||||
self->Vel.Z = pr_leafcheck() / 128. + 1;
|
self->Vel.Z = pr_leafcheck() / 128. + 1;
|
||||||
P_ThrustMobj (self, ang, (pr_leafcheck()<<9)+2*FRACUNIT);
|
self->Thrust(ang, pr_leafcheck() / 128. + 2);
|
||||||
self->flags |= MF_MISSILE;
|
self->flags |= MF_MISSILE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "g_level.h"
|
#include "g_level.h"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define ZAGSPEED FRACUNIT
|
#define ZAGSPEED 1.
|
||||||
|
|
||||||
static FRandom pr_lightningready ("LightningReady");
|
static FRandom pr_lightningready ("LightningReady");
|
||||||
static FRandom pr_lightningclip ("LightningClip");
|
static FRandom pr_lightningclip ("LightningClip");
|
||||||
|
@ -170,19 +170,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
|
||||||
zigZag = pr_lightningclip();
|
zigZag = pr_lightningclip();
|
||||||
if((zigZag > 128 && self->special1 < 2) || self->special1 < -2)
|
if((zigZag > 128 && self->special1 < 2) || self->special1 < -2)
|
||||||
{
|
{
|
||||||
P_ThrustMobj(self, self->_f_angle()+ANG90, ZAGSPEED);
|
self->Thrust(self->Angles.Yaw + 90, ZAGSPEED);
|
||||||
if(cMo)
|
if(cMo)
|
||||||
{
|
{
|
||||||
P_ThrustMobj(cMo, self->_f_angle()+ANG90, ZAGSPEED);
|
cMo->Thrust(self->Angles.Yaw + 90, ZAGSPEED);
|
||||||
}
|
}
|
||||||
self->special1++;
|
self->special1++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
P_ThrustMobj(self, self->_f_angle()-ANG90, ZAGSPEED);
|
self->Thrust(self->Angles.Yaw - 90, ZAGSPEED);
|
||||||
if(cMo)
|
if(cMo)
|
||||||
{
|
{
|
||||||
P_ThrustMobj(cMo, cMo->_f_angle()-ANG90, ZAGSPEED);
|
cMo->Thrust(self->Angles.Yaw - 90, ZAGSPEED);
|
||||||
}
|
}
|
||||||
self->special1--;
|
self->special1--;
|
||||||
}
|
}
|
||||||
|
@ -196,8 +196,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self->Angles.Yaw = self->AngleTo(target);
|
self->Angles.Yaw = self->AngleTo(target);
|
||||||
self->Vel.X = self->Vel.Y = 0;
|
self->VelFromAngle(self->Speed / 2);
|
||||||
P_ThrustMobj (self, self->Angles.Yaw, self->_f_speed()>>1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -141,15 +141,8 @@ void DEarthquake::Tick ()
|
||||||
}
|
}
|
||||||
// Thrust player around
|
// Thrust player around
|
||||||
DAngle an = victim->Angles.Yaw + pr_quake();
|
DAngle an = victim->Angles.Yaw + pr_quake();
|
||||||
if (m_IntensityX == m_IntensityY)
|
victim->Vel.X += FIXED2DBL(m_IntensityX) * an.Cos() * 0.5;
|
||||||
{ // Thrust in a circle
|
victim->Vel.Y += FIXED2DBL(m_IntensityY) * an.Sin() * 0.5;
|
||||||
P_ThrustMobj (victim, an, m_IntensityX/2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Thrust in an ellipse
|
|
||||||
victim->Vel.X += FIXED2DBL(m_IntensityX) * an.Cos() * 0.5;
|
|
||||||
victim->Vel.Y += FIXED2DBL(m_IntensityY) * an.Sin() * 0.5;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -530,7 +530,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2)
|
||||||
}
|
}
|
||||||
P_SpawnPlayerMissile (self, PClass::FindActor("MaulerTorpedo"));
|
P_SpawnPlayerMissile (self, PClass::FindActor("MaulerTorpedo"));
|
||||||
P_DamageMobj (self, self, NULL, 20, self->DamageType);
|
P_DamageMobj (self, self, NULL, 20, self->DamageType);
|
||||||
P_ThrustMobj (self, self->_f_angle() + ANGLE_180, 0x7D000);
|
self->Thrust(self->Angles.Yaw+180., 7.8125);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3215,7 +3215,7 @@ FUNC(LS_ForceField)
|
||||||
if (it != NULL)
|
if (it != NULL)
|
||||||
{
|
{
|
||||||
P_DamageMobj (it, NULL, NULL, 16, NAME_None);
|
P_DamageMobj (it, NULL, NULL, 16, NAME_None);
|
||||||
P_ThrustMobj (it, it->_f_angle() + ANGLE_180, 0x7D000);
|
it->Thrust(it->Angles.Yaw + 180, 7.8125);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,12 +127,6 @@ void P_PredictionLerpReset();
|
||||||
|
|
||||||
APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags=0);
|
APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags=0);
|
||||||
|
|
||||||
void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move);
|
|
||||||
inline void P_ThrustMobj(AActor *mo, DAngle angle, fixed_t move)
|
|
||||||
{
|
|
||||||
P_ThrustMobj(mo, FLOAT2ANGLE(angle.Degrees), move);
|
|
||||||
}
|
|
||||||
|
|
||||||
int P_FaceMobj (AActor *source, AActor *target, DAngle *delta);
|
int P_FaceMobj (AActor *source, AActor *target, DAngle *delta);
|
||||||
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise = false, bool usecurspeed=false);
|
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise = false, bool usecurspeed=false);
|
||||||
|
|
||||||
|
|
|
@ -1621,20 +1621,6 @@ bool AActor::FloorBounceMissile (secplane_t &plane)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// PROC P_ThrustMobj
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void P_ThrustMobj (AActor *mo, angle_t _angle, fixed_t _move)
|
|
||||||
{
|
|
||||||
DAngle angle = ANGLE2DBL(_angle);
|
|
||||||
double move = FIXED2DBL(_move);
|
|
||||||
|
|
||||||
mo->Vel += angle.ToVector(move);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// FUNC P_FaceMobj
|
// FUNC P_FaceMobj
|
||||||
|
@ -1785,7 +1771,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
player_t *player;
|
player_t *player;
|
||||||
fixed_t xmove, ymove;
|
fixed_t xmove, ymove;
|
||||||
const secplane_t * walkplane;
|
const secplane_t * walkplane;
|
||||||
static const int windTab[3] = {2048*5, 2048*10, 2048*25};
|
static const double windTab[3] = { 5 / 32., 10 / 32., 25 / 32. };
|
||||||
int steps, step, totalsteps;
|
int steps, step, totalsteps;
|
||||||
fixed_t startx, starty;
|
fixed_t startx, starty;
|
||||||
fixed_t oldfloorz = mo->floorz;
|
fixed_t oldfloorz = mo->floorz;
|
||||||
|
@ -1800,16 +1786,16 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
switch (special)
|
switch (special)
|
||||||
{
|
{
|
||||||
case 40: case 41: case 42: // Wind_East
|
case 40: case 41: case 42: // Wind_East
|
||||||
P_ThrustMobj (mo, 0, windTab[special-40]);
|
mo->Thrust(0., windTab[special-40]);
|
||||||
break;
|
break;
|
||||||
case 43: case 44: case 45: // Wind_North
|
case 43: case 44: case 45: // Wind_North
|
||||||
P_ThrustMobj (mo, ANG90, windTab[special-43]);
|
mo->Thrust(90., windTab[special-43]);
|
||||||
break;
|
break;
|
||||||
case 46: case 47: case 48: // Wind_South
|
case 46: case 47: case 48: // Wind_South
|
||||||
P_ThrustMobj (mo, ANG270, windTab[special-46]);
|
mo->Thrust(270., windTab[special-46]);
|
||||||
break;
|
break;
|
||||||
case 49: case 50: case 51: // Wind_West
|
case 49: case 50: case 51: // Wind_West
|
||||||
P_ThrustMobj (mo, ANG180, windTab[special-49]);
|
mo->Thrust(180., windTab[special-49]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue