mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add player_t.cameraOffset, offset chasecam Z position
This commit is contained in:
parent
7f89bee3f2
commit
ebb79fa34b
3 changed files with 7 additions and 2 deletions
|
|
@ -504,6 +504,7 @@ struct player_t
|
|||
fixed_t deltaviewheight;
|
||||
// bounded/scaled total momentum.
|
||||
fixed_t bob;
|
||||
fixed_t cameraOffset;
|
||||
|
||||
skybox_t skybox;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue