diff --git a/source/core/coreactor.h b/source/core/coreactor.h index 2e161f13c..d2e3d9155 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -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)); diff --git a/source/core/maptypes.h b/source/core/maptypes.h index c7c51b5db..d2159829e 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -497,11 +497,6 @@ struct spritetypebase { angle = DAngle::fromBuild(a); } - - void add_int_ang(int a) - { - angle += DAngle::fromBuild(a); - } }; diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index ac2c5e66d..fdbb6e297 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -2457,7 +2457,6 @@ static void flamethrowerflame(DDukeActor *actor) } auto dapos = actor->spr.pos; - int xvel = actor->int_xvel(); getglobalz(actor); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 81d77b329..296f6d5a8 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -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; diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 7465f85cb..5645344d2 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -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(p->ofistsign, p->fistsign, interpfrac), -10); - if (p->jetpack_on == 0) looking_arc += 32 - (p->GetActor()->int_xvel() >> 1); + const double fistsign = BobVal(interpolatedvalue(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); } diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index cbedb97cf..65c581e92 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -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; diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 136d44f85..376a54f02 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -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); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 041c4635c..3d122c0b6 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -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); diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 25b401af4..71941516a 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -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) { diff --git a/wadsrc/static/zscript/games/duke/dukegame.zs b/wadsrc/static/zscript/games/duke/dukegame.zs index 7879b5d6e..07ba8c322 100644 --- a/wadsrc/static/zscript/games/duke/dukegame.zs +++ b/wadsrc/static/zscript/games/duke/dukegame.zs @@ -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) {