diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 8d90c92b7..fabe74ca4 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -375,7 +375,7 @@ void movedummyplayers(void) } act->spr.pos.X += (ps[p].posX() - ps[p].PlayerOldPosition.X); - act->spr.pos.Y += (ps[p].PlayerNowPosition.Y - ps[p].PlayerOldPosition.Y); + act->spr.pos.Y += (ps[p].posY() - ps[p].PlayerOldPosition.Y); SetActor(act, act->spr.pos); } } @@ -1869,7 +1869,7 @@ void handle_se00(DDukeActor* actor) ps[p].bobpos += (result - ps[p].posXY()); ps[p].posX() = result.X; - ps[p].PlayerNowPosition.Y = result.Y; + ps[p].posY() = result.Y; auto psp = ps[p].GetActor(); if (psp->spr.extra <= 0) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 670dd1ec7..41bd670b3 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1368,7 +1368,7 @@ void movetransports_d(void) (ps[p].jetpack_on && PlayerInput(p, SB_CROUCH))) { ps[p].posX() += Owner->spr.pos.X - act->spr.pos.X; - ps[p].PlayerNowPosition.Y += Owner->spr.pos.Y - act->spr.pos.Y; + ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y; ps[p].backupxy(); if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11)) @@ -1426,7 +1426,7 @@ void movetransports_d(void) if (k == 1) { ps[p].posX() += Owner->spr.pos.X - act->spr.pos.X; - ps[p].PlayerNowPosition.Y += Owner->spr.pos.Y - act->spr.pos.Y; + ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y; ps[p].backupxy(); if (!Owner || Owner->GetOwner() != Owner) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 174f57aa8..8fab05bad 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1253,7 +1253,7 @@ void movetransports_r(void) (ps[p].jetpack_on && PlayerInput(p, SB_CROUCH))) { ps[p].posX() += Owner->spr.pos.X - act->spr.pos.X; - ps[p].PlayerNowPosition.Y += Owner->spr.pos.Y - act->spr.pos.Y; + ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y; ps[p].backupxy(); if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11)) @@ -1320,7 +1320,7 @@ void movetransports_r(void) if (k == 1) { ps[p].posX() += Owner->spr.pos.X - act->spr.pos.X; - ps[p].PlayerNowPosition.Y += Owner->spr.pos.Y - act->spr.pos.Y; + ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y; ps[p].backupxy(); if (Owner->GetOwner() != Owner) @@ -1335,7 +1335,7 @@ void movetransports_r(void) else if (isRRRA() && k == 2) { ps[p].PlayerOldPosition.X = ps[p].posX() += Owner->spr.pos.X - act->spr.pos.X; - ps[p].PlayerOldPosition.Y = ps[p].PlayerNowPosition.Y += Owner->spr.pos.Y - act->spr.pos.Y; + ps[p].PlayerOldPosition.Y = ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y; ps[p].backupxy(); if (Owner->GetOwner() != Owner) diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 86a4bef92..a78331a5c 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -330,7 +330,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case PLAYER_POSY: - if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].PlayerNowPosition.Y * (1 / maptoworld)), sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].posY() * (1 / maptoworld)), sActor, sPlayer); break; case PLAYER_POSZ: diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 21117f71e..90a554429 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -508,7 +508,7 @@ void footprints(int snum) { if (act->spr.picnum == TILE_FOOTPRINTS || act->spr.picnum == TILE_FOOTPRINTS2 || act->spr.picnum == TILE_FOOTPRINTS3 || act->spr.picnum == TILE_FOOTPRINTS4) if (abs(act->spr.pos.X - p->posX()) < 24) - if (abs(act->spr.pos.Y - p->PlayerNowPosition.Y) < 24) + if (abs(act->spr.pos.Y - p->posY()) < 24) { j = 1; break; @@ -766,12 +766,12 @@ void player_struct::backuppos(bool noclipping) if (!noclipping) { PlayerOldPosition.X = posX(); - PlayerOldPosition.Y = PlayerNowPosition.Y; + PlayerOldPosition.Y = posY(); } else { posX() = PlayerOldPosition.X; - PlayerNowPosition.Y = PlayerOldPosition.Y; + posY() = PlayerOldPosition.Y; } PlayerOldPosition.Z = PlayerNowPosition.Z; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index ce273a6c0..7167365ee 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3991,7 +3991,7 @@ void OnMotorcycle(player_struct *p, DDukeActor* motosprite) if (motosprite) { p->posX() = motosprite->spr.pos.X; - p->PlayerNowPosition.Y = motosprite->spr.pos.Y; + p->posY() = motosprite->spr.pos.Y; p->angle.ang = motosprite->spr.angle; p->ammo_amount[MOTORCYCLE_WEAPON] = motosprite->saved_ammo; motosprite->Destroy(); @@ -4066,7 +4066,7 @@ void OnBoat(player_struct *p, DDukeActor* boat) if (boat) { p->posX() = boat->spr.pos.X; - p->PlayerNowPosition.Y = boat->spr.pos.Y; + p->posY() = boat->spr.pos.Y; p->angle.ang = boat->spr.angle; p->ammo_amount[BOAT_WEAPON] = boat->saved_ammo; boat->Destroy(); diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index b11a558cb..afdd82a67 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -77,7 +77,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w, if (arc.BeginObject(keyname)) { arc("posx", w.posX()) - ("posy", w.PlayerNowPosition.Y) + ("posy", w.posY()) ("posz", w.PlayerNowPosition.Z) ("angle", w.angle) ("horizon", w.horizon) diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 6897d6221..4716922f3 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -362,6 +362,10 @@ struct player_struct { return PlayerNowPosition.X; } + double& posY() + { + return PlayerNowPosition.Y; + } DVector2& posXY() { return PlayerNowPosition.XY();