diff --git a/src/p_user.c b/src/p_user.c index f5df23641..5225bfb02 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -63,6 +63,8 @@ static boolean onground; +static boolean speccam = false; + // // P_Thrust // Moves the given origin along a given angle. @@ -2274,8 +2276,11 @@ static void P_MovePlayer(player_t *player) if (player->spectator) { P_SpectatorMovement(player); + speccam = true; return; } + else + speccam = false; ////////////////////// // MOVEMENT CODE // @@ -3360,10 +3365,15 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num) if (cmd->buttons & BT_ATTACK) { lastp = &players[displayplayers[0]]; // Fun fact, I was trying displayplayers[0]->mo as if it was Lua like an absolute idiot. - cam->angle = R_PointToAngle2(cam->x, cam->y, lastp->mo->x, lastp->mo->y); - cam->aiming = R_PointToAngle2(0, cam->z, R_PointToDist2(cam->x, cam->y, lastp->mo->x, lastp->mo->y), lastp->mo->z + lastp->mo->scale*128*P_MobjFlip(lastp->mo)); // This is still unholy. Aim a bit above their heads. - cam->reset_aiming = false; + // dont chase after your spectator self + if (!lastp->spectator) + { + const fixed_t dist = R_PointToDist2(cam->x, cam->y, lastp->mo->x, lastp->mo->y); + cam->angle = R_PointToAngle2(cam->x, cam->y, lastp->mo->x, lastp->mo->y); + cam->aiming = R_PointToAngle2(0, cam->z, dist, lastp->mo->z + lastp->mo->scale*128*P_MobjFlip(lastp->mo)); // This is still unholy. Aim a bit above their heads. + cam->reset_aiming = false; + } } if (cmd->forwardmove != 0) @@ -3512,7 +3522,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall num = 0; } - if (thiscam->freecam || player->spectator) + if (thiscam->freecam || (player->spectator && speccam == true)) { P_DemoCameraMovement(thiscam, num); return true; diff --git a/src/r_bsp.c b/src/r_bsp.c index 84412ac42..1e5e14547 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -265,7 +265,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, boolean underwater; UINT8 i = R_GetViewNumber(); - if (camera[i].chase) + if (viewplayer == &players[displayplayers[i]] && camera[i].chase) heightsec = R_PointInSubsector(camera[i].x, camera[i].y)->sector->heightsec; else if (i > splitscreen && viewmobj) heightsec = R_PointInSubsector(pviewmobj->x, pviewmobj->y)->sector->heightsec;