diff --git a/src/p_local.h b/src/p_local.h index a4062ff6..cef7e736 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -86,6 +86,7 @@ typedef struct camera_s // Camera demobjerization // Info for drawing: position. fixed_t x, y, z; + boolean reset; //More drawing info: to determine current sprite. angle_t angle; // orientation diff --git a/src/p_user.c b/src/p_user.c index 5cbc6926..82e5fa3f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7392,6 +7392,7 @@ void P_ResetCamera(player_t *player, camera_t *thiscam) thiscam->x = x; thiscam->y = y; thiscam->z = z; + thiscam->reset = true; if (!(thiscam == &camera[0] && (cv_cam_still.value || cv_analog.value)) && !(thiscam == &camera[1] && (cv_cam2_still.value || cv_analog2.value)) diff --git a/src/r_main.c b/src/r_main.c index 152ed20d..e5548151 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1045,24 +1045,44 @@ void R_SetupFrame(player_t *player, boolean skybox) thiscam = &camera[3]; chasecam = (cv_chasecam4.value != 0); R_SetViewContext(VIEWCONTEXT_PLAYER4); + if (thiscam->reset) + { + R_ResetViewInterpolation(4); + thiscam->reset = false; + } } else if (splitscreen > 1 && player == &players[displayplayers[2]]) { thiscam = &camera[2]; chasecam = (cv_chasecam3.value != 0); R_SetViewContext(VIEWCONTEXT_PLAYER3); + if (thiscam->reset) + { + R_ResetViewInterpolation(3); + thiscam->reset = false; + } } else if (splitscreen && player == &players[displayplayers[1]]) { thiscam = &camera[1]; chasecam = (cv_chasecam2.value != 0); R_SetViewContext(VIEWCONTEXT_PLAYER2); + if (thiscam->reset) + { + R_ResetViewInterpolation(2); + thiscam->reset = false; + } } else { thiscam = &camera[0]; chasecam = (cv_chasecam.value != 0); R_SetViewContext(VIEWCONTEXT_PLAYER1); + if (thiscam->reset) + { + R_ResetViewInterpolation(1); + thiscam->reset = false; + } } if (player->spectator) // no spectator chasecam @@ -1175,11 +1195,11 @@ static void R_PortalFrame(line_t *start, line_t *dest, portal_pair *portal) #endif //R_SetupFrame(player, false); - newview->x = portal->viewx; - newview->y = portal->viewy; - newview->z = portal->viewz; + viewx = portal->viewx; + viewy = portal->viewy; + viewz = portal->viewz; - newview->angle = portal->viewangle; + viewangle = portal->viewangle; // newview->sin = FINESINE(newview->angle>>ANGLETOFINESHIFT); // newview->cos = FINECOSINE(newview->angle>>ANGLETOFINESHIFT); @@ -1207,13 +1227,13 @@ static void R_PortalFrame(line_t *start, line_t *dest, portal_pair *portal) if (dangle == 0) #endif { // the entrance goes straight opposite the exit, so we just need to mess with the offset. - newview->x += dest_c.x - start_c.x; - newview->y += dest_c.y - start_c.y; + viewx += dest_c.x - start_c.x; + viewy += dest_c.y - start_c.y; return; } #ifdef ANGLED_PORTALS - newview->angle += dangle; + viewangle += dangle; // newview->sin = FINESINE(newview->angle>>ANGLETOFINESHIFT); // newview->cos = FINECOSINE(newview->angle>>ANGLETOFINESHIFT); //CONS_Printf("dangle == %u\n", AngleFixed(dangle)>>FRACBITS); @@ -1227,8 +1247,8 @@ static void R_PortalFrame(line_t *start, line_t *dest, portal_pair *portal) angtopoint = R_PointToAngle2(start_c.x, start_c.y, newview->x, newview->y); angtopoint += dangle; - newview->x = dest_c.x+FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint); - newview->y = dest_c.y+FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint); + viewx = dest_c.x+FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint); + viewy = dest_c.y+FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint); } #endif }