From 034e1fd175f7c28fe91f7138ef88de1a6b00b4f4 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 30 Dec 2021 22:57:39 +1100 Subject: [PATCH] - Duke: Replace `player_struct` `bobposx` with `bobpos.X` calls. --- source/games/duke/src/actors.cpp | 10 +++++----- source/games/duke/src/actors_d.cpp | 2 +- source/games/duke/src/actors_r.cpp | 4 ++-- source/games/duke/src/gameexec.cpp | 6 +++--- source/games/duke/src/player.cpp | 4 ++-- source/games/duke/src/player_d.cpp | 2 +- source/games/duke/src/player_r.cpp | 2 +- source/games/duke/src/premap.cpp | 4 ++-- source/games/duke/src/savegame.cpp | 2 +- source/games/duke/src/types.h | 4 ++-- wadsrc/static/zscript/games/duke/dukegame.zs | 2 +- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 2c263dd8f..c13bcb4b0 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -2694,7 +2694,7 @@ void handle_se00(DDukeActor* actor, int LASERLINE) vec2_t res; rotatepoint(Owner->spr.pos.vec2, ps[p].pos.vec2, (q * l), &res); - ps[p].bobposx += res.X - ps[p].pos.X; + ps[p].bobpos.X += res.X - ps[p].pos.X; ps[p].bobposy += res.Y - ps[p].pos.Y; ps[p].pos.vec2 = res; @@ -2871,7 +2871,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) ps[p].pos.X += m; ps[p].pos.Y += x; - ps[p].bobposx += m; + ps[p].bobpos.X += m; ps[p].bobposy += x; ps[p].angle.addadjustment(q); @@ -3046,7 +3046,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) ps[p].opos.Y = ps[p].pos.Y; } - ps[p].bobposx += l; + ps[p].bobpos.X += l; ps[p].bobposy += x; } @@ -3177,7 +3177,7 @@ void handle_se02(DDukeActor* actor) ps[p].pos.X += m; ps[p].pos.Y += x; - ps[p].bobposx += m; + ps[p].bobpos.X += m; ps[p].bobposy += x; } @@ -3898,7 +3898,7 @@ void handle_se17(DDukeActor* actor) act3->floorz = act2->spr.sector()->floorz; act3->ceilingz = act2->spr.sector()->ceilingz; - ps[p].bobposx = ps[p].opos.X = ps[p].pos.X; + ps[p].bobpos.X = ps[p].opos.X = ps[p].pos.X; ps[p].bobposy = ps[p].opos.Y = ps[p].pos.Y; ps[p].opos.Z = ps[p].pos.Z; diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 54189a090..4158ff1fd 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1929,7 +1929,7 @@ void movetransports_d(void) ps[p].transporter_hold = 13; } - ps[p].bobposx = ps[p].opos.X = ps[p].pos.X = Owner->spr.pos.X; + ps[p].bobpos.X = ps[p].opos.X = ps[p].pos.X = Owner->spr.pos.X; ps[p].bobposy = ps[p].opos.Y = ps[p].pos.Y = Owner->spr.pos.Y; ps[p].opos.Z = ps[p].pos.Z = Owner->spr.pos.Z - gs.playerheight; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 4253d4d70..1e71ee8bf 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1601,7 +1601,7 @@ void movetransports_r(void) ps[p].transporter_hold = 13; } - ps[p].bobposx = ps[p].opos.X = ps[p].pos.X = Owner->spr.pos.X; + ps[p].bobpos.X = ps[p].opos.X = ps[p].pos.X = Owner->spr.pos.X; ps[p].bobposy = ps[p].opos.Y = ps[p].pos.Y = Owner->spr.pos.Y; ps[p].opos.Z = ps[p].pos.Z = Owner->spr.pos.Z - (gs.playerheight - (4 << 8)); @@ -2446,7 +2446,7 @@ void rr_specialstats() if (act2->spr.picnum == RRTILE297) { ps[p].angle.ang = buildang(act2->spr.ang); - ps[p].bobposx = ps[p].opos.X = ps[p].pos.X = act2->spr.pos.X; + ps[p].bobpos.X = ps[p].opos.X = ps[p].pos.X = act2->spr.pos.X; ps[p].bobposy = ps[p].opos.Y = ps[p].pos.Y = act2->spr.pos.Y; ps[p].opos.Z = ps[p].pos.Z = act2->spr.pos.Z - (36 << 8); auto pact = ps[p].GetActor(); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 0e27dece3..b2f961dc7 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -368,8 +368,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case PLAYER_BOBPOSX: - if (bSet) ps[iPlayer].bobposx = lValue; - else SetGameVarID(lVar2, ps[iPlayer].bobposx, sActor, sPlayer); + if (bSet) ps[iPlayer].bobpos.X = lValue; + else SetGameVarID(lVar2, ps[iPlayer].bobpos.X, sActor, sPlayer); break; case PLAYER_BOBPOSY: @@ -2245,7 +2245,7 @@ int ParseState::parse(void) { // I am not convinced this is even remotely smart to be executed from here.. pickrandomspot(g_p); - g_ac->spr.pos.X = ps[g_p].bobposx = ps[g_p].opos.X = ps[g_p].pos.X; + g_ac->spr.pos.X = ps[g_p].bobpos.X = ps[g_p].opos.X = ps[g_p].pos.X; g_ac->spr.pos.Y = ps[g_p].bobposy = ps[g_p].opos.Y = ps[g_p].pos.Y; g_ac->spr.pos.Z = ps[g_p].opos.Z = ps[g_p].pos.Z; g_ac->spr.backuppos(); diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 9f200ca9d..c2aba11e6 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -771,7 +771,7 @@ void player_struct::backuppos(bool noclipping) } opos.Z = pos.Z; - bobposx = pos.X; + bobpos.X = pos.X; bobposy = pos.Y; opyoff = pyoff; } @@ -1079,7 +1079,7 @@ DEFINE_FIELD_X(DukePlayer, player_struct, psectlotag) DEFINE_FIELD_X(DukePlayer, player_struct, numloogs) DEFINE_FIELD_X(DukePlayer, player_struct, loogcnt) DEFINE_FIELD_X(DukePlayer, player_struct, invdisptime) -DEFINE_FIELD_X(DukePlayer, player_struct, bobposx) +//DEFINE_FIELD_X(DukePlayer, player_struct, bobposx) DEFINE_FIELD_X(DukePlayer, player_struct, bobposy) //DEFINE_FIELD_X(DukePlayer, player_struct, oposx) //DEFINE_FIELD_X(DukePlayer, player_struct, oposy) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 654988228..0cb5a40be 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2848,7 +2848,7 @@ void processinput_d(int snum) p->playerweaponsway(pact->spr.xvel); - pact->spr.xvel = clamp(ksqrt((p->pos.X - p->bobposx) * (p->pos.X - p->bobposx) + (p->pos.Y - p->bobposy) * (p->pos.Y - p->bobposy)), 0, 512); + pact->spr.xvel = clamp(ksqrt((p->pos.X - p->bobpos.X) * (p->pos.X - p->bobpos.X) + (p->pos.Y - p->bobposy) * (p->pos.Y - p->bobposy)), 0, 512); if (p->on_ground) p->bobcounter += p->GetActor()->spr.xvel >> 1; p->backuppos(ud.clipping == 0 && (p->cursector->floorpicnum == MIRROR || !p->insector())); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 766520c45..d034d8c49 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3563,7 +3563,7 @@ void processinput_r(int snum) p->playerweaponsway(pact->spr.xvel); - pact->spr.xvel = clamp(ksqrt((p->pos.X - p->bobposx) * (p->pos.X - p->bobposx) + (p->pos.Y - p->bobposy) * (p->pos.Y - p->bobposy)), 0, 512); + pact->spr.xvel = clamp(ksqrt((p->pos.X - p->bobpos.X) * (p->pos.X - p->bobpos.X) + (p->pos.Y - p->bobposy) * (p->pos.Y - p->bobposy)), 0, 512); if (p->on_ground) p->bobcounter += p->GetActor()->spr.xvel >> 1; p->backuppos(ud.clipping == 0 && (p->cursector->floorpicnum == MIRROR || !p->insector())); diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 886b4bce3..e2e455ac6 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -60,7 +60,7 @@ void pickrandomspot(int snum) i = krand()%numplayersprites; else i = snum; - p->bobposx = p->opos.X = p->pos.X = po[i].opos.X; + p->bobpos.X = p->opos.X = p->pos.X = po[i].opos.X; p->bobposy = p->opos.Y = p->pos.Y = po[i].opos.Y; p->opos.Z = p->pos.Z = po[i].opos.Z; p->angle.oang = p->angle.ang = buildang(po[i].oa); @@ -625,7 +625,7 @@ void resetpspritevars(int g) ps[j].frag_ps = j; act->SetOwner(act); - ps[j].bobposx = ps[j].opos.X = ps[j].pos.X = act->spr.pos.X; + ps[j].bobpos.X = ps[j].opos.X = ps[j].pos.X = act->spr.pos.X; ps[j].bobposy = ps[j].opos.Y = ps[j].pos.Y = act->spr.pos.Y; ps[j].opos.Z = ps[j].pos.Z = act->spr.pos.Z; act->spr.backuppos(); diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index 5cb6fdf9b..18621be7d 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -121,7 +121,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w, ("numloogs", w.numloogs) ("loogcnt", w.loogcnt) .Array("loogie", w.loogie, w.numloogs) - ("bobposx", w.bobposx) + ("bobposx", w.bobpos.X) ("bobposy", w.bobposy) ("pyoff", w.pyoff) ("posxv", w.vel.X) diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 6e726b6f0..d1559854b 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -188,7 +188,7 @@ struct player_struct PalEntry pals; // this was a global variable originally. - vec2_t fric, exit, loogie[64]; + vec2_t fric, exit, loogie[64], bobpos; // weapon drawer variables and their interpolation counterparts. int weapon_sway; @@ -204,7 +204,7 @@ struct player_struct // From here on it is unaltered from JFDuke with the exception of a few fields that are no longer needed and were removed. int numloogs, loogcnt; int invdisptime; - int bobposx, bobposy, pyoff, opyoff; + int bobposy, pyoff, opyoff; int last_pissed_time, truefz, truecz; int player_par, visibility; int bobcounter; diff --git a/wadsrc/static/zscript/games/duke/dukegame.zs b/wadsrc/static/zscript/games/duke/dukegame.zs index 3a23c21a7..24b49d3c5 100644 --- a/wadsrc/static/zscript/games/duke/dukegame.zs +++ b/wadsrc/static/zscript/games/duke/dukegame.zs @@ -152,7 +152,7 @@ struct DukePlayer // From here on it is unaltered from JFDuke with the exception of a few fields that are no longer needed and were removed. native int numloogs, loogcnt; native int invdisptime; - native int bobposx, bobposy, pyoff, opyoff; + native int bobposy, pyoff, opyoff; native int last_pissed_time, truefz, truecz; native int player_par, visibility; native int bobcounter;