mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-29 20:50:38 +00:00
Merge branch 'insta-lookback' into 'master'
Lookback camera switches instantly See merge request KartKrew/Kart-Public!51
This commit is contained in:
commit
258a426603
1 changed files with 50 additions and 15 deletions
65
src/p_user.c
65
src/p_user.c
|
@ -8165,6 +8165,8 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
|
||||||
|
|
||||||
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled)
|
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled)
|
||||||
{
|
{
|
||||||
|
static UINT8 lookbackdelay[4] = {0,0,0,0};
|
||||||
|
UINT8 num;
|
||||||
angle_t angle = 0, focusangle = 0, focusaiming = 0;
|
angle_t angle = 0, focusangle = 0, focusaiming = 0;
|
||||||
fixed_t x, y, z, dist, height, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight;
|
fixed_t x, y, z, dist, height, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight;
|
||||||
fixed_t pan, xpan, ypan;
|
fixed_t pan, xpan, ypan;
|
||||||
|
@ -8293,6 +8295,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
|
|
||||||
if (thiscam == &camera)
|
if (thiscam == &camera)
|
||||||
{
|
{
|
||||||
|
num = 0;
|
||||||
camspeed = cv_cam_speed.value;
|
camspeed = cv_cam_speed.value;
|
||||||
camstill = cv_cam_still.value;
|
camstill = cv_cam_still.value;
|
||||||
camrotate = cv_cam_rotate.value;
|
camrotate = cv_cam_rotate.value;
|
||||||
|
@ -8302,6 +8305,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
}
|
}
|
||||||
else if (thiscam == &camera2) // Camera 2
|
else if (thiscam == &camera2) // Camera 2
|
||||||
{
|
{
|
||||||
|
num = 1;
|
||||||
camspeed = cv_cam2_speed.value;
|
camspeed = cv_cam2_speed.value;
|
||||||
camstill = cv_cam2_still.value;
|
camstill = cv_cam2_still.value;
|
||||||
camrotate = cv_cam2_rotate.value;
|
camrotate = cv_cam2_rotate.value;
|
||||||
|
@ -8311,6 +8315,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
}
|
}
|
||||||
else if (thiscam == &camera3) // Camera 3
|
else if (thiscam == &camera3) // Camera 3
|
||||||
{
|
{
|
||||||
|
num = 2;
|
||||||
camspeed = cv_cam3_speed.value;
|
camspeed = cv_cam3_speed.value;
|
||||||
camstill = cv_cam3_still.value;
|
camstill = cv_cam3_still.value;
|
||||||
camrotate = cv_cam3_rotate.value;
|
camrotate = cv_cam3_rotate.value;
|
||||||
|
@ -8320,6 +8325,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
}
|
}
|
||||||
else // Camera 4
|
else // Camera 4
|
||||||
{
|
{
|
||||||
|
num = 3;
|
||||||
camspeed = cv_cam4_speed.value;
|
camspeed = cv_cam4_speed.value;
|
||||||
camstill = cv_cam4_still.value;
|
camstill = cv_cam4_still.value;
|
||||||
camrotate = cv_cam4_rotate.value;
|
camrotate = cv_cam4_rotate.value;
|
||||||
|
@ -8342,12 +8348,16 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
}
|
}
|
||||||
else if (player->exiting) // SRB2Kart: Leave the camera behind while exiting, for dramatic effect!
|
else if (player->exiting) // SRB2Kart: Leave the camera behind while exiting, for dramatic effect!
|
||||||
camstill = true;
|
camstill = true;
|
||||||
else if (lookback) // SRB2kart - Camera flipper
|
else if (lookback || lookbackdelay[num]) // SRB2kart - Camera flipper
|
||||||
{
|
{
|
||||||
camrotate += 180;
|
camspeed = FRACUNIT;
|
||||||
camspeed *= 2;
|
if (lookback)
|
||||||
if (camspeed > FRACUNIT)
|
{
|
||||||
camspeed = FRACUNIT;
|
camrotate += 180;
|
||||||
|
lookbackdelay[num] = 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
lookbackdelay[num]--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mo->eflags & MFE_VERTICALFLIP)
|
if (mo->eflags & MFE_VERTICALFLIP)
|
||||||
|
@ -8356,6 +8366,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
if (splitscreen == 1)
|
if (splitscreen == 1)
|
||||||
camspeed = (3*camspeed)/4;
|
camspeed = (3*camspeed)/4;
|
||||||
|
|
||||||
|
if (camspeed > FRACUNIT)
|
||||||
|
camspeed = FRACUNIT;
|
||||||
|
|
||||||
if (timeover)
|
if (timeover)
|
||||||
angle = mo->angle + FixedAngle(camrotate*FRACUNIT);
|
angle = mo->angle + FixedAngle(camrotate*FRACUNIT);
|
||||||
else if (leveltime < starttime)
|
else if (leveltime < starttime)
|
||||||
|
@ -8364,16 +8377,21 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
angle = thiscam->angle;
|
angle = thiscam->angle;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
angle_t input = focusangle + FixedAngle(camrotate<<FRACBITS) - thiscam->angle;
|
if (camspeed == FRACUNIT)
|
||||||
boolean invert = (input > ANGLE_180);
|
angle = focusangle + FixedAngle(camrotate<<FRACBITS);
|
||||||
if (invert)
|
else
|
||||||
input = InvAngle(input);
|
{
|
||||||
|
angle_t input = focusangle + FixedAngle(camrotate<<FRACBITS) - thiscam->angle;
|
||||||
|
boolean invert = (input > ANGLE_180);
|
||||||
|
if (invert)
|
||||||
|
input = InvAngle(input);
|
||||||
|
|
||||||
input = FixedAngle(FixedMul(AngleFixed(input), camspeed));
|
input = FixedAngle(FixedMul(AngleFixed(input), camspeed));
|
||||||
if (invert)
|
if (invert)
|
||||||
input = InvAngle(input);
|
input = InvAngle(input);
|
||||||
|
|
||||||
angle = thiscam->angle + input;
|
angle = thiscam->angle + input;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resetcalled && (leveltime > starttime && timeover != 2)
|
if (!resetcalled && (leveltime > starttime && timeover != 2)
|
||||||
|
@ -8697,8 +8715,25 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
if (twodlevel || (mo->flags2 & MF2_TWOD) || (!camstill && !timeover)) // Keep the view still...
|
if (twodlevel || (mo->flags2 & MF2_TWOD) || (!camstill && !timeover)) // Keep the view still...
|
||||||
{
|
{
|
||||||
G_ClipAimingPitch((INT32 *)&angle);
|
G_ClipAimingPitch((INT32 *)&angle);
|
||||||
dist = thiscam->aiming - angle;
|
|
||||||
thiscam->aiming -= (dist>>3);
|
if (camspeed == FRACUNIT)
|
||||||
|
thiscam->aiming = angle;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
angle_t input;
|
||||||
|
boolean invert;
|
||||||
|
|
||||||
|
input = thiscam->aiming - angle;
|
||||||
|
invert = (input > ANGLE_180);
|
||||||
|
if (invert)
|
||||||
|
input = InvAngle(input);
|
||||||
|
|
||||||
|
input = FixedAngle(FixedMul(AngleFixed(input), (5*camspeed)/16));
|
||||||
|
if (invert)
|
||||||
|
input = InvAngle(input);
|
||||||
|
|
||||||
|
thiscam->aiming -= input;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resetcalled && (player->playerstate == PST_DEAD || player->playerstate == PST_REBORN))
|
if (!resetcalled && (player->playerstate == PST_DEAD || player->playerstate == PST_REBORN))
|
||||||
|
|
Loading…
Reference in a new issue