P_DemoCameraMovement: don't let A button press from menu carry over to rise camera

This commit is contained in:
James R 2023-08-14 01:55:00 -07:00
parent 83f02231e3
commit 0f9ceab817
3 changed files with 23 additions and 4 deletions

View file

@ -239,6 +239,7 @@ void M_PlaybackToggleFreecam(INT32 choice)
if (!demo.freecam) // toggle on
{
demo.freecam = true;
democam.button_a_held = 2;
}
else // toggle off
{

View file

@ -131,6 +131,14 @@ struct camera_t
angle_t old_angle, old_aiming;
};
// demo freecam or something before i commit die
struct demofreecam_s {
UINT8 button_a_held; // A button was held since entering from menu, so don't move camera
};
extern struct demofreecam_s democam;
extern camera_t camera[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_dist[MAXSPLITSCREENPLAYERS], cv_cam_still[MAXSPLITSCREENPLAYERS], cv_cam_height[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_speed[MAXSPLITSCREENPLAYERS], cv_cam_rotate[MAXSPLITSCREENPLAYERS];

View file

@ -2939,6 +2939,8 @@ fixed_t t_cam_dist[MAXSPLITSCREENPLAYERS] = {-42,-42,-42,-42};
fixed_t t_cam_height[MAXSPLITSCREENPLAYERS] = {-42,-42,-42,-42};
fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS] = {-42,-42,-42,-42};
struct demofreecam_s democam;
void P_DemoCameraMovement(camera_t *cam)
{
ticcmd_t *cmd;
@ -2954,10 +2956,18 @@ void P_DemoCameraMovement(camera_t *cam)
cam->aiming = G_ClipAimingPitch((INT32 *)&cam->aiming);
// camera movement:
if (cmd->buttons & BT_ACCELERATE)
cam->z += 32*mapobjectscale;
else if (cmd->buttons & BT_BRAKE)
cam->z -= 32*mapobjectscale;
if (!democam.button_a_held)
{
if (cmd->buttons & BT_ACCELERATE)
cam->z += 32*mapobjectscale;
else if (cmd->buttons & BT_BRAKE)
cam->z -= 32*mapobjectscale;
}
if (!(cmd->buttons & BT_ACCELERATE) && democam.button_a_held)
{
democam.button_a_held--;
}
// if you hold item, you will lock on to displayplayer. (The last player you were ""f12-ing"")
if (demo.freecam && cmd->buttons & BT_ATTACK)