diff --git a/src/d_player.h b/src/d_player.h index 35795e9fa..6d6e887d1 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -504,6 +504,7 @@ struct player_t fixed_t deltaviewheight; // bounded/scaled total momentum. fixed_t bob; + fixed_t cameraOffset; skybox_t skybox; diff --git a/src/k_kart.c b/src/k_kart.c index 7e49c0847..815004164 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7794,6 +7794,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->mo->spritexoffset = 0; player->mo->spriteyoffset = 0; + player->cameraOffset = 0; + if (player->curshield == KSHIELD_TOP) { mobj_t *top = K_GetGardenTop(player); diff --git a/src/p_user.c b/src/p_user.c index d2f148283..63b6ca6a9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3542,6 +3542,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall z = mo->z + pviewheight + distz; } + z += player->cameraOffset; + // point viewed by the camera // this point is just 64 unit forward the player dist = 64*cameraScale; @@ -3586,13 +3588,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (mo->eflags & MFE_VERTICALFLIP) { - angle = R_PointToAngle2(0, thiscam->z + thiscam->height, dist, mo->z + mo->height - player->mo->height); + angle = R_PointToAngle2(0, thiscam->z + thiscam->height, dist, mo->z + mo->height - player->mo->height + player->cameraOffset); if (thiscam->pitch < ANGLE_180 && thiscam->pitch > angle) angle += (thiscam->pitch - angle)/2; } else { - angle = R_PointToAngle2(0, thiscam->z, dist, mo->z + player->mo->height); + angle = R_PointToAngle2(0, thiscam->z, dist, mo->z + player->mo->height + player->cameraOffset); if (thiscam->pitch >= ANGLE_180 && thiscam->pitch < angle) angle -= (angle - thiscam->pitch)/2; }