Duke3D: oang, ohoriz and ohorizoff no longer hold the proper value when accessed from the Player Actor
This is a nasty ordering problem introduced by 3b3cd0e0, and involves the player struct members oang
, ohoriz
and ohorizoff
.
Namely, these values now always hold the same value as ang
, horiz
and horizoff
when accessed from within the player actor (and other actors and events).
The problematic change is the following inside G_MovePlayers()
in actors.cpp
at line 1381 (which is called from G_MoveWorld()
):
if (G_TileHasActor(sprite[spriteNum].picnum))
A_Execute(spriteNum, P_GetP(pSprite), otherPlayerDist);
- thisPlayer.smoothcamera = false;
-
- pPlayer->q16angvel = P_GetQ16AngleDeltaForTic(pPlayer);
- pPlayer->oq16ang = pPlayer->q16ang;
- pPlayer->oq16horiz = pPlayer->q16horiz;
- pPlayer->oq16horizoff = pPlayer->q16horizoff;
-
which was moved to P_ProcessInput()
in player.cpp
at line 4949. The problem is that P_ProcessInput()
is executed before G_MoveWorld()
inside the function G_DoMoveThings()
.
if (ud.pause_on == 0)
{
P_ProcessInput(i);
P_CheckSectors(i);
}
}
if (ud.pause_on == 0)
G_MoveWorld();
Note that in the first code block, A_Execute(spriteNum, P_GetP(pSprite), otherPlayerDist)
is the call that runs the CON code for the player actor. We see that the oang
and other struct members were only updated AFTER this call had been made. This is of course required, otherwise the oang
would be the same as ang
when accessed from the player actor.
As such, this reordering causes the problem. NOTE: The player actor may not be the only entry point for CON code that potentially makes use of the oang
, ohoriz
and ohorizoff
members. For example, the EVENT_ALTFIRE
event was prior to 3b3cd0e0 also able to access the proper oang
value, but now no longer can. Keep this in mind when trying to resolve this issue.
EDIT: Here is a CON file to test the issue. Press Alt-Fire to see if oang is updated properly.