Make Natural camera a toggle

This commit is contained in:
NepDisk 2025-08-12 23:58:21 -04:00
parent 88c201da47
commit de17315839
3 changed files with 30 additions and 11 deletions

View file

@ -379,6 +379,8 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_test1);
CV_RegisterVar(&cv_test2);
CV_RegisterVar(&cv_test3);
CV_RegisterVar(&cv_naturalcamera);
}
//}

View file

@ -28,6 +28,8 @@
extern "C" {
#endif
extern consvar_t cv_naturalcamera;
#define FLOATSPEED (FRACUNIT*4)
//#define VIEWHEIGHTS "41"

View file

@ -78,6 +78,9 @@
static void P_NukeAllPlayers(player_t *player);
#endif
// Some people like the more limited camerea from V1 so why not.
consvar_t cv_naturalcamera = CVAR_INIT ("naturalcamera", "Off", CV_SAVE, CV_OnOff, NULL);
//
// Jingle stuff.
//
@ -3091,28 +3094,29 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
// sets ideal cam pos
dist = camdist;
if (player->loop.radius)
{
speed = player->speed;
}
else
{
speed = P_AproxDistance(P_AproxDistance(mo->momx, mo->momy), mo->momz / 16);
}
if (cv_naturalcamera.value)
{
const fixed_t speedthreshold = 48*mapobjectscale;
const fixed_t olddist = P_AproxDistance(mo->x - thiscam->x, mo->y - thiscam->y);
fixed_t lag, distoffset;
dist = camdist;
if (player->karthud[khud_boostcam])
{
dist -= FixedMul(11*dist/16, player->karthud[khud_boostcam]);
}
if (player->loop.radius)
{
speed = player->speed;
}
else
{
speed = P_AproxDistance(P_AproxDistance(mo->momx, mo->momy), mo->momz / 16);
}
lag = FRACUNIT - ((FixedDiv(speed, speedthreshold) - FRACUNIT) * 2);
if (lag > FRACUNIT)
@ -3133,6 +3137,17 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
dist = 0;
}
}
else
{
if (speed > K_GetKartSpeed(player, false, true))
dist += 4*(speed - K_GetKartSpeed(player, false, true));
dist += abs(thiscam->momz)/4;
if (player->karthud[khud_boostcam])
{
dist -= FixedMul(11*dist/16, player->karthud[khud_boostcam]);
}
}
if (mo->standingslope)
{