Merge branch 'drawanglefixes' into 'master'

Drawangle fixes

Closes #153

See merge request STJr/SRB2Internal!236
This commit is contained in:
Monster Iestyn 2019-06-23 17:33:40 -04:00
commit f8087565b7
3 changed files with 34 additions and 24 deletions

View file

@ -6268,7 +6268,7 @@ void A_MixUp(mobj_t *actor)
else if (numplayers == 2) // Special case -- simple swap
{
fixed_t x, y, z;
angle_t angle;
angle_t angle, drawangle;
INT32 one = -1, two = 0; // default value 0 to make the compiler shut up
// Zoom tube stuff
@ -6322,6 +6322,7 @@ void A_MixUp(mobj_t *actor)
y = players[one].mo->y;
z = players[one].mo->z;
angle = players[one].mo->angle;
drawangle = players[one].drawangle;
starpostx = players[one].starpostx;
starposty = players[one].starposty;
@ -6337,10 +6338,14 @@ void A_MixUp(mobj_t *actor)
players[two].starpostnum, players[two].starposttime, players[two].starpostangle,
players[two].mo->flags2);
players[one].drawangle = players[two].drawangle;
P_MixUp(players[two].mo, x, y, z, angle, starpostx, starposty, starpostz,
starpostnum, starposttime, starpostangle,
mflags2);
players[two].drawangle = drawangle;
//carry set after mixup. Stupid P_ResetPlayer() takes away some of the stuff we look for...
//but not all of it! So we need to make sure they aren't set wrong or anything.
players[one].powers[pw_carry] = carry2;
@ -6352,7 +6357,7 @@ void A_MixUp(mobj_t *actor)
else
{
fixed_t position[MAXPLAYERS][3];
angle_t anglepos[MAXPLAYERS];
angle_t anglepos[MAXPLAYERS][2];
INT32 pindex[MAXPLAYERS], counter = 0, teleportfrom = 0;
// Zoom tube stuff
@ -6371,7 +6376,7 @@ void A_MixUp(mobj_t *actor)
for (i = 0; i < MAXPLAYERS; i++)
{
position[i][0] = position[i][1] = position[i][2] = anglepos[i] = pindex[i] = -1;
position[i][0] = position[i][1] = position[i][2] = anglepos[i][0] = anglepos[i][1] = pindex[i] = -1;
teleported[i] = false;
}
@ -6387,7 +6392,8 @@ void A_MixUp(mobj_t *actor)
position[counter][1] = players[i].mo->y;
position[counter][2] = players[i].mo->z;
pindex[counter] = i;
anglepos[counter] = players[i].mo->angle;
anglepos[counter][0] = players[i].mo->angle;
anglepos[counter][1] = players[i].drawangle;
players[i].mo->momx = players[i].mo->momy = players[i].mo->momz =
players[i].rmomx = players[i].rmomy = 1;
players[i].cmomx = players[i].cmomy = 0;
@ -6439,11 +6445,13 @@ void A_MixUp(mobj_t *actor)
players[i].speed = transspeed[teleportfrom];
P_SetTarget(&players[i].mo->tracer, transtracer[teleportfrom]);
P_MixUp(players[i].mo, position[teleportfrom][0], position[teleportfrom][1], position[teleportfrom][2], anglepos[teleportfrom],
P_MixUp(players[i].mo, position[teleportfrom][0], position[teleportfrom][1], position[teleportfrom][2], anglepos[teleportfrom][0],
spposition[teleportfrom][0], spposition[teleportfrom][1], spposition[teleportfrom][2],
starpostnum[teleportfrom], starposttime[teleportfrom], starpostangle[teleportfrom],
flags2[teleportfrom]);
players[i].drawangle = anglepos[teleportfrom][1];
//...carry after. same reasoning.
players[i].powers[pw_carry] = transcarry[teleportfrom];
if (transcarry[teleportfrom] == CR_MINECART && transtracer[teleportfrom] && !(P_MobjWasRemoved(transtracer[teleportfrom])))

View file

@ -4514,7 +4514,7 @@ DoneSection2:
break;
}
player->mo->angle = lineangle;
player->mo->angle = player->drawangle = lineangle;
if (!demoplayback || P_AnalogMove(player))
{

View file

@ -125,12 +125,10 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle
if (!P_TeleportMove(thing, x, y, z))
return false;
thing->angle = angle;
if (!dontstopmove)
thing->momx = thing->momy = thing->momz = 0;
else // Change speed to match direction
P_InstaThrust(thing, thing->angle, P_AproxDistance(thing->momx, thing->momy));
P_InstaThrust(thing, angle, FixedHypot(thing->momx, thing->momy));
if (thing->player)
{
@ -139,21 +137,6 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle
else
thing->player->viewz = thing->z + thing->player->viewheight;
if (!dontstopmove)
thing->reactiontime = TICRATE/2; // don't move for about half a second
// absolute angle position
if (thing->player == &players[consoleplayer])
localangle = angle;
if (thing->player == &players[secondarydisplayplayer])
localangle2 = angle;
// move chasecam at new player location
if (splitscreen && camera2.chase && thing->player == &players[secondarydisplayplayer])
P_ResetCamera(thing->player, &camera2);
else if (camera.chase && thing->player == &players[displayplayer])
P_ResetCamera(thing->player, &camera);
// don't run in place after a teleport
if (!dontstopmove)
{
@ -171,11 +154,30 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle
thing->player->speed = 0;
P_ResetPlayer(thing->player);
P_SetPlayerMobjState(thing, S_PLAY_STND);
thing->reactiontime = TICRATE/2; // don't move for about half a second
thing->player->drawangle = angle;
}
else
thing->player->drawangle += (angle - thing->angle);
// absolute angle position
if (thing->player == &players[consoleplayer])
localangle = angle;
if (thing->player == &players[secondarydisplayplayer])
localangle2 = angle;
// move chasecam at new player location
if (splitscreen && camera2.chase && thing->player == &players[secondarydisplayplayer])
P_ResetCamera(thing->player, &camera2);
else if (camera.chase && thing->player == &players[displayplayer])
P_ResetCamera(thing->player, &camera);
if (flash)
P_FlashPal(thing->player, PAL_MIXUP, 10);
}
thing->angle = angle;
return true;
}