Skip to content

Commit

Permalink
- __int_opos is gone.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Aug 9, 2022
1 parent fbd2a43 commit a8a3493
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
12 changes: 6 additions & 6 deletions source/games/duke/src/gameexec.cpp
Expand Up @@ -378,18 +378,18 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;

case PLAYER_OPOSX:
if (bSet) ps[iPlayer].__int_opos.X = lValue;
else SetGameVarID(lVar2, ps[iPlayer].player_int_opos().X, sActor, sPlayer);
if (bSet) ps[iPlayer].opos.X = lValue * maptoworld;
else SetGameVarID(lVar2, ps[iPlayer].opos.X * (1/maptoworld), sActor, sPlayer);
break;

case PLAYER_OPOSY:
if (bSet) ps[iPlayer].__int_opos.Y = lValue;
else SetGameVarID(lVar2, ps[iPlayer].player_int_opos().Y, sActor, sPlayer);
if (bSet) ps[iPlayer].opos.Y = lValue * maptoworld;
else SetGameVarID(lVar2, ps[iPlayer].opos.Y * (1 / maptoworld), sActor, sPlayer);
break;

case PLAYER_OPOSZ:
if (bSet) ps[iPlayer].__int_opos.Z = lValue;
else SetGameVarID(lVar2, ps[iPlayer].player_int_opos().Z, sActor, sPlayer);
if (bSet) ps[iPlayer].opos.Z = lValue * zmaptoworld;
else SetGameVarID(lVar2, ps[iPlayer].opos.Z * (1 / zmaptoworld), sActor, sPlayer);
break;

case PLAYER_PYOFF:
Expand Down
5 changes: 3 additions & 2 deletions source/games/duke/src/player_d.cpp
Expand Up @@ -2848,7 +2848,7 @@ void processinput_d(int snum)

checklook(snum,actions);
int ii = 40;
auto oldpos = p->__int_opos;
auto oldpos = p->opos;

if (p->on_crane != nullptr)
goto HORIZONLY;
Expand Down Expand Up @@ -3094,7 +3094,8 @@ void processinput_d(int snum)
{
if (!retry++)
{
p->__int_pos = p->__int_opos = oldpos;
p->opos = oldpos;
p->restorexyz();
continue;
}
quickkill(p);
Expand Down
5 changes: 3 additions & 2 deletions source/games/duke/src/player_r.cpp
Expand Up @@ -3573,7 +3573,7 @@ void processinput_r(int snum)
checklook(snum, actions);
p->apply_seasick(1);

auto oldpos = p->__int_opos;
auto oldpos = p->opos;

if (p->on_crane != nullptr)
goto HORIZONLY;
Expand Down Expand Up @@ -3947,7 +3947,8 @@ void processinput_r(int snum)
{
if (!retry++)
{
p->__int_pos = p->__int_opos = oldpos;
p->opos = oldpos;
p->restorexyz();
continue;
}
quickkill(p);
Expand Down
22 changes: 14 additions & 8 deletions source/games/duke/src/types.h
Expand Up @@ -206,7 +206,9 @@ 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 __int_pos, __int_opos, vel;
vec3_t __int_pos, vel;

DVector3 opos;

// player's horizon and angle structs.
PlayerHorizon horizon;
Expand Down Expand Up @@ -360,29 +362,33 @@ struct player_struct

void backupxyz()
{
__int_opos = __int_pos;
opos.X = __int_pos.X * inttoworld;
opos.Y = __int_pos.Y * inttoworld;
opos.Z = __int_pos.Z * zinttoworld;
}

void restorexyz()
{
__int_pos = __int_opos;
__int_pos.X = opos.X * worldtoint;
__int_pos.Y = opos.Y * worldtoint;
__int_pos.Z = opos.Z * zworldtoint;
}

void backupxy()
{
__int_opos.X = __int_pos.X;
__int_opos.Y = __int_pos.Y;
opos.X = __int_pos.X * inttoworld;
opos.Y = __int_pos.Y * inttoworld;
}

void restorexy()
{
__int_pos.X = __int_opos.X;
__int_pos.Y = __int_opos.Y;
__int_pos.X = opos.X * worldtoint;
__int_pos.Y = opos.Y * worldtoint;
}

void backupz()
{
__int_opos.Z = __int_pos.Z;
opos.Z = __int_pos.Z * zinttoworld;
}

void setbobpos()
Expand Down

0 comments on commit a8a3493

Please sign in to comment.