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)
postimg = postimg_flip;
else if (player->awayviewtics)
else if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist
{
camera_t dummycam;
dummycam.subsector = player->awayviewmobj->subsector;
dummycam.x = player->awayviewmobj->x;
dummycam.y = player->awayviewmobj->y;
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?
if (P_CameraCheckWater(&dummycam))
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).
if (!(multiplayer || netgame) && !splitscreen)
{
fixed_t vx = 0, vy = 0;
if (player->awayviewtics) {
fixed_t vx = thiscam->x, vy = thiscam->y;
if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist
{
vx = player->awayviewmobj->x;
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))
player->mo->flags2 |= MF2_SHADOW;
@ -8710,8 +8706,9 @@ void P_PlayerThink(player_t *player)
if (player->flashcount)
player->flashcount--;
if (player->awayviewtics)
player->awayviewtics--;
// By the time P_MoveChaseCamera is called, this might be zero. Do not do it here.
//if (player->awayviewtics)
// player->awayviewtics--;
/// \note do this in the cheat code
if (player->pflags & PF_NOCLIP)
@ -9489,6 +9486,9 @@ void P_PlayerAfterThink(player_t *player)
}
}
if (player->awayviewtics)
player->awayviewtics--;
// spectator invisibility and nogravity.
if ((netgame || multiplayer) && player->spectator)
{