diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 133bc8bc5..5a66c3232 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -202,7 +202,7 @@ void checkavailweapon(struct player_struct* player) void clearcamera(player_struct* ps) { ps->newOwner = nullptr; - ps->pos.X = ps->oposx; + ps->pos.X = ps->opos.X; ps->pos.Y = ps->oposy; ps->pos.Z = ps->oposz; ps->angle.restore(); @@ -375,7 +375,7 @@ void movedummyplayers(void) } } - act->spr.pos.X += (ps[p].pos.X - ps[p].oposx); + act->spr.pos.X += (ps[p].pos.X - ps[p].opos.X); act->spr.pos.Y += (ps[p].pos.Y - ps[p].oposy); SetActor(act, act->spr.pos); } @@ -401,7 +401,7 @@ void moveplayers(void) { if (p->newOwner != nullptr) //Looking thru the camera { - act->spr.pos.X = p->oposx; + act->spr.pos.X = p->opos.X; act->spr.pos.Y = p->oposy; act->spr.pos.Z = p->oposz + gs.playerheight; act->spr.backupz(); @@ -797,7 +797,7 @@ void movecrane(DDukeActor *actor, int crane) else if (actor->IsActiveCrane()) { auto ang = ps[p].angle.ang.asbuild(); - ps[p].oposx = ps[p].pos.X; + ps[p].opos.X = ps[p].pos.X; ps[p].oposy = ps[p].pos.Y; ps[p].oposz = ps[p].pos.Z; ps[p].pos.X = actor->spr.pos.X - bcos(ang, -6); @@ -2900,7 +2900,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) if (numplayers > 1) { - ps[p].oposx = ps[p].pos.X; + ps[p].opos.X = ps[p].pos.X; ps[p].oposy = ps[p].pos.Y; } if (psp->spr.extra <= 0) @@ -2944,7 +2944,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) updatesector(ps[p].pos.X, ps[p].pos.Y, &k); if ((k == nullptr && ud.clipping == 0) || (k == actor->spr.sector() && ps[p].cursector != actor->spr.sector())) { - ps[p].oposx = ps[p].pos.X = actor->spr.pos.X; + ps[p].opos.X = ps[p].pos.X = actor->spr.pos.X; ps[p].oposy = ps[p].pos.Y = actor->spr.pos.Y; ps[p].setCursector(actor->spr.sector()); @@ -3065,7 +3065,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) if (numplayers > 1) { - ps[p].oposx = ps[p].pos.X; + ps[p].opos.X = ps[p].pos.X; ps[p].oposy = ps[p].pos.Y; } @@ -3111,7 +3111,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) ps[p].pos.X = actor->spr.pos.X; ps[p].pos.Y = actor->spr.pos.Y; - ps[p].oposx = ps[p].pos.X; + ps[p].opos.X = ps[p].pos.X; ps[p].oposy = ps[p].pos.Y; ps[p].setCursector(actor->spr.sector()); @@ -3933,7 +3933,7 @@ void handle_se17(DDukeActor* actor) act3->floorz = act2->spr.sector()->floorz; act3->ceilingz = act2->spr.sector()->ceilingz; - ps[p].bobposx = ps[p].oposx = ps[p].pos.X; + ps[p].bobposx = ps[p].opos.X = ps[p].pos.X; ps[p].bobposy = ps[p].oposy = ps[p].pos.Y; ps[p].oposz = ps[p].pos.Z; @@ -4214,7 +4214,7 @@ void handle_se20(DDukeActor* actor) ps[p].pos.X += x; ps[p].pos.Y += l; - ps[p].oposx = ps[p].pos.X; + ps[p].opos.X = ps[p].pos.X; ps[p].oposy = ps[p].pos.Y; SetActor(ps[p].GetActor(), { ps[p].pos.X, ps[p].pos.Y, ps[p].pos.Z + gs.playerheight }); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index d56dd26fe..6f80aa9c8 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -624,7 +624,7 @@ void movefta_d(void) { if (badguy(act)) { - px = ps[p].oposx + 64 - (krand() & 127); + px = ps[p].opos.X + 64 - (krand() & 127); py = ps[p].oposy + 64 - (krand() & 127); updatesector(px, py, &psect); if (psect == nullptr) @@ -647,7 +647,7 @@ void movefta_d(void) { int r1 = krand(); int r2 = krand(); - j = cansee(act->spr.pos.X, act->spr.pos.Y, act->spr.pos.Z - ((r2 & 31) << 8), act->spr.sector(), ps[p].oposx, ps[p].oposy, ps[p].oposz - ((r1 & 31) << 8), ps[p].cursector); + j = cansee(act->spr.pos.X, act->spr.pos.Y, act->spr.pos.Z - ((r2 & 31) << 8), act->spr.sector(), ps[p].opos.X, ps[p].oposy, ps[p].oposz - ((r1 & 31) << 8), ps[p].cursector); } @@ -1940,7 +1940,7 @@ void movetransports_d(void) ps[p].transporter_hold = 13; } - ps[p].bobposx = ps[p].oposx = ps[p].pos.X = Owner->spr.pos.X; + ps[p].bobposx = ps[p].opos.X = ps[p].pos.X = Owner->spr.pos.X; ps[p].bobposy = ps[p].oposy = ps[p].pos.Y = Owner->spr.pos.Y; ps[p].oposz = ps[p].pos.Z = Owner->spr.pos.Z - gs.playerheight; @@ -1962,7 +1962,7 @@ void movetransports_d(void) if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP))) || (ps[p].jetpack_on && PlayerInput(p, SB_CROUCH))) { - ps[p].oposx = ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X; + ps[p].opos.X = ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X; ps[p].oposy = ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y; if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11)) @@ -2018,7 +2018,7 @@ void movetransports_d(void) if (k == 1) { - ps[p].oposx = ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X; + ps[p].opos.X = ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X; ps[p].oposy = ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y; if (!Owner || Owner->GetOwner() != Owner) @@ -2338,7 +2338,7 @@ static void greenslime(DDukeActor *actor) if (ps[p].newOwner != nullptr) { ps[p].newOwner = nullptr; - ps[p].pos.X = ps[p].oposx; + ps[p].pos.X = ps[p].opos.X; ps[p].pos.Y = ps[p].oposy; ps[p].pos.Z = ps[p].oposz; ps[p].angle.restore(); @@ -3682,7 +3682,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel) if (a & face_player) { if (ps[playernum].newOwner != nullptr) - goalang = getangle(ps[playernum].oposx - actor->spr.pos.X, ps[playernum].oposy - actor->spr.pos.Y); + goalang = getangle(ps[playernum].opos.X - actor->spr.pos.X, ps[playernum].oposy - actor->spr.pos.Y); else goalang = getangle(ps[playernum].pos.X - actor->spr.pos.X, ps[playernum].pos.Y - actor->spr.pos.Y); angdif = getincangle(actor->spr.ang, goalang) >> 2; if (angdif > -8 && angdif < 0) angdif = 0; @@ -3695,7 +3695,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel) if (a & face_player_slow) { if (ps[playernum].newOwner != nullptr) - goalang = getangle(ps[playernum].oposx - actor->spr.pos.X, ps[playernum].oposy - actor->spr.pos.Y); + goalang = getangle(ps[playernum].opos.X - actor->spr.pos.X, ps[playernum].oposy - actor->spr.pos.Y); else goalang = getangle(ps[playernum].pos.X - actor->spr.pos.X, ps[playernum].pos.Y - actor->spr.pos.Y); angdif = Sgn(getincangle(actor->spr.ang, goalang)) << 5; if (angdif > -32 && angdif < 0) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 0911c78fb..692f27cfa 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -522,7 +522,7 @@ void movefta_r(void) { if (badguy(act)) { - px = ps[p].oposx + 64 - (krand() & 127); + px = ps[p].opos.X + 64 - (krand() & 127); py = ps[p].oposy + 64 - (krand() & 127); updatesector(px, py, &psect); if (psect == nullptr) @@ -552,7 +552,7 @@ void movefta_r(void) { int r1 = krand(); int r2 = krand(); - j = cansee(act->spr.pos.X, act->spr.pos.Y, act->spr.pos.Z - ((r2 & 31) << 8), act->spr.sector(), ps[p].oposx, ps[p].oposy, ps[p].oposz - ((r1 & 31) << 8), ps[p].cursector); + j = cansee(act->spr.pos.X, act->spr.pos.Y, act->spr.pos.Z - ((r2 & 31) << 8), act->spr.sector(), ps[p].opos.X, ps[p].oposy, ps[p].oposz - ((r1 & 31) << 8), ps[p].cursector); } @@ -1604,7 +1604,7 @@ void movetransports_r(void) ps[p].transporter_hold = 13; } - ps[p].bobposx = ps[p].oposx = ps[p].pos.X = Owner->spr.pos.X; + ps[p].bobposx = ps[p].opos.X = ps[p].pos.X = Owner->spr.pos.X; ps[p].bobposy = ps[p].oposy = ps[p].pos.Y = Owner->spr.pos.Y; ps[p].oposz = ps[p].pos.Z = Owner->spr.pos.Z - (gs.playerheight - (4 << 8)); @@ -1623,7 +1623,7 @@ void movetransports_r(void) if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && PlayerInput(p, SB_JUMP)) || (ps[p].jetpack_on && PlayerInput(p, SB_CROUCH))) { - ps[p].oposx = ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X; + ps[p].opos.X = ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X; ps[p].oposy = ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y; if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11)) @@ -1689,7 +1689,7 @@ void movetransports_r(void) if (k == 1) { - ps[p].oposx = ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X; + ps[p].opos.X = ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X; ps[p].oposy = ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y; if (Owner->GetOwner() != Owner) @@ -1703,7 +1703,7 @@ void movetransports_r(void) } else if (isRRRA() && k == 2) { - ps[p].oposx = ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X; + ps[p].opos.X = ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X; ps[p].oposy = ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y; if (Owner->GetOwner() != Owner) @@ -2449,7 +2449,7 @@ void rr_specialstats() if (act2->spr.picnum == RRTILE297) { ps[p].angle.ang = buildang(act2->spr.ang); - ps[p].bobposx = ps[p].oposx = ps[p].pos.X = act2->spr.pos.X; + ps[p].bobposx = ps[p].opos.X = ps[p].pos.X = act2->spr.pos.X; ps[p].bobposy = ps[p].oposy = ps[p].pos.Y = act2->spr.pos.Y; ps[p].oposz = ps[p].pos.Z = act2->spr.pos.Z - (36 << 8); auto pact = ps[p].GetActor(); @@ -3657,7 +3657,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel) if (a & face_player) { if (ps[pnum].newOwner != nullptr) - goalang = getangle(ps[pnum].oposx - actor->spr.pos.X, ps[pnum].oposy - actor->spr.pos.Y); + goalang = getangle(ps[pnum].opos.X - actor->spr.pos.X, ps[pnum].oposy - actor->spr.pos.Y); else goalang = getangle(ps[pnum].pos.X - actor->spr.pos.X, ps[pnum].pos.Y - actor->spr.pos.Y); angdif = getincangle(actor->spr.ang, goalang) >> 2; if (angdif > -8 && angdif < 0) angdif = 0; @@ -3670,7 +3670,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel) if (a & face_player_slow) { if (ps[pnum].newOwner != nullptr) - goalang = getangle(ps[pnum].oposx - actor->spr.pos.X, ps[pnum].oposy - actor->spr.pos.Y); + goalang = getangle(ps[pnum].opos.X - actor->spr.pos.X, ps[pnum].oposy - actor->spr.pos.Y); else goalang = getangle(ps[pnum].pos.X - actor->spr.pos.X, ps[pnum].pos.Y - actor->spr.pos.Y); angdif = Sgn(getincangle(actor->spr.ang, goalang)) << 5; if (angdif > -32 && angdif < 0) @@ -3686,7 +3686,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel) if (a & antifaceplayerslow) { if (ps[pnum].newOwner != nullptr) - goalang = (getangle(ps[pnum].oposx - actor->spr.pos.X, ps[pnum].oposy - actor->spr.pos.Y) + 1024) & 2047; + goalang = (getangle(ps[pnum].opos.X - actor->spr.pos.X, ps[pnum].oposy - actor->spr.pos.Y) + 1024) & 2047; else goalang = (getangle(ps[pnum].pos.X - actor->spr.pos.X, ps[pnum].pos.Y - actor->spr.pos.Y) + 1024) & 2047; angdif = Sgn(getincangle(actor->spr.ang, goalang)) << 5; if (angdif > -32 && angdif < 0) diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index bb133e660..f757b8cf8 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -165,7 +165,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in if (t->statnum == 99) continue; if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && ps[h->spr.yvel].newOwner == nullptr && h->GetOwner()) { - t->pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].oposx, 16); + t->pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].opos.X, 16); t->pos.Y -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.Y - ps[h->spr.yvel].oposy, 16); t->pos.Z = interpolatedvalue(ps[h->spr.yvel].oposz, ps[h->spr.yvel].pos.Z, smoothratio); t->pos.Z += PHEIGHT_DUKE; diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 9ba57bfc3..8052b70e0 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -146,7 +146,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in if (t->statnum == 99) continue; if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && ps[h->spr.yvel].newOwner == nullptr && h->GetOwner()) { - t->pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].oposx, 16); + t->pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].opos.X, 16); t->pos.Y -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.Y - ps[h->spr.yvel].oposy, 16); t->pos.Z = interpolatedvalue(ps[h->spr.yvel].oposz, ps[h->spr.yvel].pos.Z, smoothratio); t->pos.Z += PHEIGHT_RR; diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index 830fc7224..fff0cbea0 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -115,7 +115,7 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) { player_struct* p = &ps[myconnectindex]; - p->oposx = p->pos.X = x; + p->opos.X = p->pos.X = x; p->oposy = p->pos.Y = y; p->oposz = p->pos.Z = z; diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 0c09d4a56..9fa36ba46 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -270,14 +270,14 @@ void drawoverlays(double smoothratio) } else { - cposx = interpolatedvalue(pp->oposx, pp->pos.X, smoothratio); + cposx = interpolatedvalue(pp->opos.X, pp->pos.X, smoothratio); cposy = interpolatedvalue(pp->oposy, pp->pos.Y, smoothratio); cang = (!SyncInput() ? pp->angle.ang : interpolatedangle(pp->angle.oang, pp->angle.ang, smoothratio)).asbuild(); } } else { - cposx = pp->oposx; + cposx = pp->opos.X; cposy = pp->oposy; cang = pp->angle.oang.asbuild(); } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 8abac307c..0de6adc5e 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -378,8 +378,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case PLAYER_OPOSX: - if (bSet) ps[iPlayer].oposx = lValue; - else SetGameVarID(lVar2, ps[iPlayer].oposx, sActor, sPlayer); + if (bSet) ps[iPlayer].opos.X = lValue; + else SetGameVarID(lVar2, ps[iPlayer].opos.X, sActor, sPlayer); break; case PLAYER_OPOSY: @@ -2066,7 +2066,7 @@ int ParseState::parse(void) if(!isRR() && ps[g_p].newOwner != nullptr) { ps[g_p].newOwner = nullptr; - ps[g_p].pos.X = ps[g_p].oposx; + ps[g_p].pos.X = ps[g_p].opos.X; ps[g_p].pos.Y = ps[g_p].oposy; ps[g_p].pos.Z = ps[g_p].oposz; ps[g_p].angle.restore(); @@ -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].oposx = ps[g_p].pos.X; + g_ac->spr.pos.X = ps[g_p].bobposx = ps[g_p].opos.X = ps[g_p].pos.X; g_ac->spr.pos.Y = ps[g_p].bobposy = ps[g_p].oposy = ps[g_p].pos.Y; g_ac->spr.pos.Z = ps[g_p].oposz = 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 16f87d9ef..39865e17e 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -745,12 +745,12 @@ void player_struct::backuppos(bool noclipping) { if (!noclipping) { - oposx = pos.X; + opos.X = pos.X; oposy = pos.Y; } else { - pos.X = oposx; + pos.X = opos.X; pos.Y = oposy; } @@ -1065,7 +1065,7 @@ 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, bobposy) -DEFINE_FIELD_X(DukePlayer, player_struct, oposx) +//DEFINE_FIELD_X(DukePlayer, player_struct, oposx) DEFINE_FIELD_X(DukePlayer, player_struct, oposy) DEFINE_FIELD_X(DukePlayer, player_struct, oposz) DEFINE_FIELD_X(DukePlayer, player_struct, pyoff) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 4749bcedd..de8896c45 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -159,7 +159,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int { int x; int j = findplayer(actor, &x); - sa = getangle(ps[j].oposx - sx, ps[j].oposy - sy); + sa = getangle(ps[j].opos.X - sx, ps[j].oposy - sy); if (actor->spr.picnum == BOSS5) { @@ -184,7 +184,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int zvel = -MulScale(ps[p].horizon.sum().asq16(), 81, 16); if (ps[p].GetActor()->spr.xvel != 0) vel = (int)((((512 - (1024 - - abs(abs(getangle(sx - ps[p].oposx, sy - ps[p].oposy) - sa) - 1024))) + - abs(abs(getangle(sx - ps[p].opos.X, sy - ps[p].oposy) - sa) - 1024))) * 0.001953125f) * ps[p].GetActor()->spr.xvel) + 400); if (actor->spr.sector()->lotag == 2 && (krand() % 5) == 0) spawned = spawn(actor, WATERBUBBLE); @@ -706,7 +706,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i { int x; int j = findplayer(actor, &x); - sa = getangle(ps[j].oposx - sx, ps[j].oposy - sy); + sa = getangle(ps[j].opos.X - sx, ps[j].oposy - sy); if (actor->spr.picnum == BOSS3) { int zoffs = (32 << 8); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index f318210c3..e4271437c 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -644,7 +644,7 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i { int x; int j = findplayer(actor, &x); - sa = getangle(ps[j].oposx - sx, ps[j].oposy - sy); + sa = getangle(ps[j].opos.X - sx, ps[j].oposy - sy); if (actor->spr.picnum == BOSS3) sz -= (32 << 8); else if (actor->spr.picnum == BOSS2) diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 0e5a8f618..5d299b744 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->oposx = p->pos.X = po[i].ox; + p->bobposx = p->opos.X = p->pos.X = po[i].ox; p->bobposy = p->oposy = p->pos.Y = po[i].oy; p->oposz = p->pos.Z = po[i].oz; 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].oposx = ps[j].pos.X = act->spr.pos.X; + ps[j].bobposx = ps[j].opos.X = ps[j].pos.X = act->spr.pos.X; ps[j].bobposy = ps[j].oposy = ps[j].pos.Y = act->spr.pos.Y; ps[j].oposz = ps[j].pos.Z = act->spr.pos.Z; act->spr.backuppos(); diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 34127ace5..196315609 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -327,7 +327,7 @@ void displayrooms(int snum, double smoothratio) else #endif { - cposx = interpolatedvalue(p->oposx, p->pos.X, smoothratio); + cposx = interpolatedvalue(p->opos.X, p->pos.X, smoothratio); cposy = interpolatedvalue(p->oposy, p->pos.Y, smoothratio); cposz = interpolatedvalue(p->oposz, p->pos.Z, smoothratio);; if (SyncInput()) diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index e7d721f24..f63e7a157 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -277,7 +277,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w, .EndObject(); w.invdisptime = 0; - w.oposx = w.pos.X; + w.opos.X = w.pos.X; w.oposy = w.pos.Y; w.oposz = w.pos.Z; w.opyoff = w.pyoff; diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 52c25b947..c2dbc1b09 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -220,7 +220,7 @@ int findplayer(const DDukeActor* actor, int* d) if (ud.multimode < 2) { - if (d) *d = abs(ps[myconnectindex].oposx - s->X) + abs(ps[myconnectindex].oposy - s->Y) + ((abs(ps[myconnectindex].oposz - s->Z + (28 << 8))) >> 4); + if (d) *d = abs(ps[myconnectindex].opos.X - s->X) + abs(ps[myconnectindex].oposy - s->Y) + ((abs(ps[myconnectindex].oposz - s->Z + (28 << 8))) >> 4); return myconnectindex; } @@ -229,7 +229,7 @@ int findplayer(const DDukeActor* actor, int* d) for (j = connecthead; j >= 0; j = connectpoint2[j]) { - x = abs(ps[j].oposx - s->X) + abs(ps[j].oposy - s->Y) + ((abs(ps[j].oposz - s->Z + (28 << 8))) >> 4); + x = abs(ps[j].opos.X - s->X) + abs(ps[j].oposy - s->Y) + ((abs(ps[j].oposz - s->Z + (28 << 8))) >> 4); if (x < closest && ps[j].GetActor()->spr.extra > 0) { closest_player = j; @@ -258,7 +258,7 @@ int findotherplayer(int p, int* d) for (j = connecthead; j >= 0; j = connectpoint2[j]) if (p != j && ps[j].GetActor()->spr.extra > 0) { - x = abs(ps[j].oposx - ps[p].pos.X) + abs(ps[j].oposy - ps[p].pos.Y) + (abs(ps[j].oposz - ps[p].pos.Z) >> 4); + x = abs(ps[j].opos.X - ps[p].pos.X) + abs(ps[j].oposy - ps[p].pos.Y) + (abs(ps[j].oposz - ps[p].pos.Z) >> 4); if (x < closest) { diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 7ecb1b730..9c41c9de8 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -1464,7 +1464,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) if (ps[p].newOwner != nullptr) { ps[p].newOwner = nullptr; - ps[p].pos.X = ps[p].oposx; + ps[p].pos.X = ps[p].opos.X; ps[p].pos.Y = ps[p].oposy; ps[p].pos.Z = ps[p].oposz; ps[p].angle.restore(); @@ -1502,7 +1502,7 @@ void clearcameras(int i, player_struct* p) { if (i < 0) { - p->pos.X = p->oposx; + p->pos.X = p->opos.X; p->pos.Y = p->oposy; p->pos.Z = p->oposz; p->newOwner = nullptr; @@ -1616,7 +1616,7 @@ void checksectors_d(int snum) return; } if (p->newOwner != nullptr) - neartag({ p->oposx, p->oposy, p->oposz }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280L, 1); + neartag({ p->opos.X, p->oposy, p->oposz }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280L, 1); else { neartag(p->pos, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 1); diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index d6b63ab04..efa38ce47 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -2412,7 +2412,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) if (ps[p].newOwner != nullptr) { ps[p].newOwner = nullptr; - ps[p].pos.X = ps[p].oposx; + ps[p].pos.X = ps[p].opos.X; ps[p].pos.Y = ps[p].oposy; ps[p].pos.Z = ps[p].oposz; @@ -2569,7 +2569,7 @@ void checksectors_r(int snum) } if (p->newOwner != nullptr) - neartag({ p->oposx, p->oposy, p->oposz }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280L, 1); + neartag({ p->opos.X, p->oposy, p->oposz }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280L, 1); else { neartag(p->pos, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 1); diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 80c7a4d41..41783682a 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -186,7 +186,7 @@ struct player_struct // This is basically the version from JFDuke but this first block contains a few changes to make it work with other parts of Raze. // The sound code wants to read a vector out of this so we need to define one for the main coordinate. - vec3_t pos; + vec3_t pos, opos; // player's horizon and angle structs. PlayerHorizon horizon; @@ -216,7 +216,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 exitx, exity, loogiex[64], loogiey[64], numloogs, loogcnt; int invdisptime; - int bobposx, bobposy, oposx, oposy, oposz, pyoff, opyoff; + int bobposx, bobposy, oposy, oposz, pyoff, opyoff; int posxv, posyv, poszv, 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 7be15e23b..046d9ae08 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 exitx, exity, loogiex[64], loogiey[64], numloogs, loogcnt; native int invdisptime; - native int bobposx, bobposy, oposx, oposy, oposz, pyoff, opyoff; + native int bobposx, bobposy, oposy, oposz, pyoff, opyoff; native int posxv, posyv, poszv, last_pissed_time, truefz, truecz; native int player_par, visibility; native int bobcounter;