Hold up/down for 2 seconds while not moving to pan the camera vertically

This commit is contained in:
James R 2024-04-02 19:23:53 -07:00
parent 7c69767a6a
commit 192c770c16
3 changed files with 20 additions and 1 deletions

View file

@ -138,6 +138,9 @@ struct camera_t
// Freecam: aiming needs to be reset after switching from chasecam
boolean reset_aiming;
// Hold up/down to pan the camera vertically
SINT8 dpad_y_held;
// Interpolation data
fixed_t old_x, old_y, old_z;
angle_t old_angle, old_aiming;

View file

@ -763,7 +763,18 @@ void P_RunChaseCameras(void)
{
if (camera[i].chase)
{
P_MoveChaseCamera(&players[displayplayers[i]], &camera[i], false);
player_t *p = &players[displayplayers[i]];
camera_t *cam = &camera[i];
if (p->mo && p->cmd.throwdir != 0)
{
if (p->speed < 6 * p->mo->scale && abs(cam->dpad_y_held) < 2*TICRATE)
cam->dpad_y_held += intsign(p->cmd.throwdir);
}
else
cam->dpad_y_held = 0;
P_MoveChaseCamera(p, cam, false);
}
}

View file

@ -3275,6 +3275,11 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
focusaiming = localaiming[num];
}
if (abs(thiscam->dpad_y_held) >= 2*TICRATE)
{
focusaiming += ANGLE_45 * intsign(thiscam->dpad_y_held) * P_MobjFlip(mo);
}
if (P_CameraThinker(player, thiscam, resetcalled))
return true;