Minor remote viewpoint bugfixes.

This commit is contained in:
MPC 2018-11-05 20:40:51 -02:00
parent 0f37411e2b
commit 1cc8619c9e
2 changed files with 12 additions and 11 deletions

View File

@ -3506,14 +3506,15 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
if (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP) if (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP)
postimg = postimg_flip; postimg = postimg_flip;
else if (player->awayviewtics) else if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist
{ {
camera_t dummycam; camera_t dummycam;
dummycam.subsector = player->awayviewmobj->subsector; dummycam.subsector = player->awayviewmobj->subsector;
dummycam.x = player->awayviewmobj->x; dummycam.x = player->awayviewmobj->x;
dummycam.y = player->awayviewmobj->y; dummycam.y = player->awayviewmobj->y;
dummycam.z = player->awayviewmobj->z; dummycam.z = player->awayviewmobj->z;
dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT //dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT
dummycam.height = 0; // Why? Remote viewpoint cameras have no height.
// Are we in water? // Are we in water?
if (P_CameraCheckWater(&dummycam)) if (P_CameraCheckWater(&dummycam))
postimg = postimg_water; postimg = postimg_water;

View File

@ -8365,16 +8365,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
// Make player translucent if camera is too close (only in single player). // Make player translucent if camera is too close (only in single player).
if (!(multiplayer || netgame) && !splitscreen) if (!(multiplayer || netgame) && !splitscreen)
{ {
fixed_t vx = 0, vy = 0; fixed_t vx = thiscam->x, vy = thiscam->y;
if (player->awayviewtics) { if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist
{
vx = player->awayviewmobj->x; vx = player->awayviewmobj->x;
vy = player->awayviewmobj->y; vy = player->awayviewmobj->y;
} }
else
{
vx = thiscam->x;
vy = thiscam->y;
}
if (P_AproxDistance(vx - player->mo->x, vy - player->mo->y) < FixedMul(48*FRACUNIT, mo->scale)) if (P_AproxDistance(vx - player->mo->x, vy - player->mo->y) < FixedMul(48*FRACUNIT, mo->scale))
player->mo->flags2 |= MF2_SHADOW; player->mo->flags2 |= MF2_SHADOW;
@ -8710,8 +8706,9 @@ void P_PlayerThink(player_t *player)
if (player->flashcount) if (player->flashcount)
player->flashcount--; player->flashcount--;
if (player->awayviewtics) // By the time P_MoveChaseCamera is called, this might be zero. Do not do it here.
player->awayviewtics--; //if (player->awayviewtics)
// player->awayviewtics--;
/// \note do this in the cheat code /// \note do this in the cheat code
if (player->pflags & PF_NOCLIP) if (player->pflags & PF_NOCLIP)
@ -9489,6 +9486,9 @@ void P_PlayerAfterThink(player_t *player)
} }
} }
if (player->awayviewtics)
player->awayviewtics--;
// spectator invisibility and nogravity. // spectator invisibility and nogravity.
if ((netgame || multiplayer) && player->spectator) if ((netgame || multiplayer) && player->spectator)
{ {