- eliminated int_xvel

This commit is contained in:
Christoph Oelckers 2022-09-15 18:41:01 +02:00
parent ad2e984367
commit c511e5dca9
10 changed files with 16 additions and 33 deletions

View file

@ -97,22 +97,11 @@ public:
spr.angle = DAngle::fromBuild(a);
}
void add_int_ang(int a)
{
spr.angle += DAngle::fromBuild(a);
}
void norm_ang()
{
spr.angle = spr.angle.Normalized360();
}
// Note: Both Duke and SW use Q12.4 for this, Exhumed doesn't seem to treat horizontal velocity with a fixed factor.
int int_xvel() const
{
return vel.X * worldtoint;
}
vec3_t int_vel() const
{
return vec3_t(FloatToFixed(vel.X), FloatToFixed(vel.Y), FloatToFixed(vel.Z));

View file

@ -497,11 +497,6 @@ struct spritetypebase
{
angle = DAngle::fromBuild(a);
}
void add_int_ang(int a)
{
angle += DAngle::fromBuild(a);
}
};

View file

@ -2457,7 +2457,6 @@ static void flamethrowerflame(DDukeActor *actor)
}
auto dapos = actor->spr.pos;
int xvel = actor->int_xvel();
getglobalz(actor);

View file

@ -2389,7 +2389,7 @@ int ParseState::parse(void)
l = *insptr;
j = 0;
s = g_ac->int_xvel();
double vel = g_ac->vel.X;
// sigh.. this was yet another place where number literals were used as bit masks for every single value, making the code totally unreadable.
if( (l& pducking) && ps[g_p].on_ground && PlayerInput(g_p, SB_CROUCH))
@ -2398,17 +2398,17 @@ int ParseState::parse(void)
j = 1;
else if( (l& pjumping) && ps[g_p].jumping_counter > 348 )
j = 1;
else if( (l& pstanding) && s >= 0 && s < 8)
else if( (l& pstanding) && vel >= 0 && vel < 0.5)
j = 1;
else if( (l& pwalking) && s >= 8 && !(PlayerInput(g_p, SB_RUN)) )
else if( (l& pwalking) && vel >= 0.5 && !(PlayerInput(g_p, SB_RUN)) )
j = 1;
else if( (l& prunning) && s >= 8 && PlayerInput(g_p, SB_RUN) )
else if( (l& prunning) && vel >= 0.5 && PlayerInput(g_p, SB_RUN) )
j = 1;
else if( (l& phigher) && ps[g_p].pos.Z < g_ac->spr.pos.Z - 48)
j = 1;
else if( (l& pwalkingback) && s <= -8 && !(PlayerInput(g_p, SB_RUN)) )
else if( (l& pwalkingback) && vel <= -0.5 && !(PlayerInput(g_p, SB_RUN)) )
j = 1;
else if( (l& prunningback) && s <= -8 && (PlayerInput(g_p, SB_RUN)) )
else if( (l& prunningback) && vel <= -0.5 && (PlayerInput(g_p, SB_RUN)) )
j = 1;
else if( (l& pkicking) && ( ps[g_p].quick_kick > 0 || ( ps[g_p].curr_weapon == KNEE_WEAPON && ps[g_p].kickback_pic > 0 ) ) )
j = 1;

View file

@ -200,8 +200,8 @@ inline void hud_draw(double x, double y, int tilenum, int shade, int orientation
inline void animateshrunken(player_struct* p, double weapon_xoffset, double looking_arc, double look_anghalf, int tilenum, int8_t shade, int o, double interpfrac)
{
const double fistsign = bsinf(interpolatedvalue<double>(p->ofistsign, p->fistsign, interpfrac), -10);
if (p->jetpack_on == 0) looking_arc += 32 - (p->GetActor()->int_xvel() >> 1);
const double fistsign = BobVal(interpolatedvalue<double>(p->ofistsign, p->fistsign, interpfrac)) * 16;
if (p->jetpack_on == 0) looking_arc += 32 - (p->GetActor()->vel.X * 8);
hud_draw(weapon_xoffset + fistsign + 250 - look_anghalf, looking_arc + 258 - fabs(fistsign * 4), tilenum, shade, o);
hud_draw(weapon_xoffset - fistsign + 40 - look_anghalf, looking_arc + 200 + fabs(fistsign * 4), tilenum, shade, o | 4);
}

View file

@ -811,11 +811,11 @@ void player_struct::checkhardlanding()
}
}
void player_struct::playerweaponsway(int xvel)
void player_struct::playerweaponsway(double xvel)
{
if (cl_weaponsway)
{
if (xvel < 32 || on_ground == 0 || bobcounter == 1024)
if (xvel < 2 || on_ground == 0 || bobcounter == 1024)
{
if ((weapon_sway & 2047) > (1024 + 96))
weapon_sway -= 96;

View file

@ -2859,7 +2859,7 @@ void processinput_d(int snum)
if (p->GetActor()->spr.xrepeat < 40 && p->jetpack_on == 0)
{
p->ofistsign = p->fistsign;
p->fistsign += p->GetActor()->int_xvel();
p->fistsign += p->GetActor()->vel.X * 16;
}
if (p->transporter_hold > 0)
@ -2892,7 +2892,7 @@ void processinput_d(int snum)
if (p->on_crane != nullptr)
goto HORIZONLY;
p->playerweaponsway(pact->int_xvel());
p->playerweaponsway(pact->vel.X);
pact->vel.X = clamp((p->pos.XY() - p->bobpos).Length(), 0., 32.);
if (p->on_ground) p->bobcounter += int(p->GetActor()->vel.X * 8);

View file

@ -3537,7 +3537,7 @@ void processinput_r(int snum)
if (p->GetActor()->spr.xrepeat < 8 && p->jetpack_on == 0)
{
p->ofistsign = p->fistsign;
p->fistsign += p->GetActor()->int_xvel();
p->fistsign += p->GetActor()->vel.X * 16;
}
if (p->transporter_hold > 0)
@ -3570,7 +3570,7 @@ void processinput_r(int snum)
if (p->on_crane != nullptr)
goto HORIZONLY;
p->playerweaponsway(pact->int_xvel());
p->playerweaponsway(pact->vel.X);
pact->vel.X = clamp((p->pos.XY() - p->bobpos).Length(), 0., 32.);
if (p->on_ground) p->bobcounter += int(p->GetActor()->vel.X * 8);

View file

@ -333,7 +333,7 @@ struct player_struct
void backuppos(bool noclipping = false);
void backupweapon();
void checkhardlanding();
void playerweaponsway(int xvel);
void playerweaponsway(double xvel);
float adjustavel(float avel)
{

View file

@ -258,7 +258,7 @@ struct DukePlayer
void backuppos(bool noclipping = false);
void backupweapon();
void checkhardlanding();
void playerweaponsway(int xvel);
void playerweaponsway(double xvel);
float adjustavel(float avel)
{