mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
Merge branch 'sloped-camera' into 22-merge-again
This commit is contained in:
commit
04b6911e21
10 changed files with 145 additions and 1 deletions
|
|
@ -102,6 +102,8 @@ int SUBVERSION;
|
||||||
|
|
||||||
// platform independant focus loss
|
// platform independant focus loss
|
||||||
UINT8 window_notinfocus = false;
|
UINT8 window_notinfocus = false;
|
||||||
|
INT32 window_x;
|
||||||
|
INT32 window_y;
|
||||||
|
|
||||||
//
|
//
|
||||||
// DEMO LOOP
|
// DEMO LOOP
|
||||||
|
|
|
||||||
|
|
@ -499,6 +499,7 @@ typedef struct player_s
|
||||||
fixed_t bob;
|
fixed_t bob;
|
||||||
|
|
||||||
angle_t viewrollangle;
|
angle_t viewrollangle;
|
||||||
|
angle_t tilt;
|
||||||
|
|
||||||
angle_t angleturn;
|
angle_t angleturn;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,8 @@ extern boolean digital_disabled;
|
||||||
extern boolean menuactive; // Menu overlaid?
|
extern boolean menuactive; // Menu overlaid?
|
||||||
extern UINT8 paused; // Game paused?
|
extern UINT8 paused; // Game paused?
|
||||||
extern UINT8 window_notinfocus; // are we in focus? (backend independant -- handles auto pausing and display of "focus lost" message)
|
extern UINT8 window_notinfocus; // are we in focus? (backend independant -- handles auto pausing and display of "focus lost" message)
|
||||||
|
extern INT32 window_x;
|
||||||
|
extern INT32 window_y;
|
||||||
|
|
||||||
extern boolean nodrawers;
|
extern boolean nodrawers;
|
||||||
extern boolean noblit;
|
extern boolean noblit;
|
||||||
|
|
@ -299,6 +301,7 @@ extern struct quake
|
||||||
{
|
{
|
||||||
// camera offsets and duration
|
// camera offsets and duration
|
||||||
fixed_t x,y,z;
|
fixed_t x,y,z;
|
||||||
|
angle_t roll;
|
||||||
UINT16 time;
|
UINT16 time;
|
||||||
|
|
||||||
// location, radius, and intensity...
|
// location, radius, and intensity...
|
||||||
|
|
|
||||||
|
|
@ -348,4 +348,6 @@ const char *I_ClipboardPaste(void);
|
||||||
|
|
||||||
void I_RegisterSysCommands(void);
|
void I_RegisterSysCommands(void);
|
||||||
|
|
||||||
|
void I_CursedWindowMovement(int xd, int yd);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,10 @@ 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_dist[MAXSPLITSCREENPLAYERS], cv_cam_still[MAXSPLITSCREENPLAYERS], cv_cam_height[MAXSPLITSCREENPLAYERS];
|
||||||
extern consvar_t cv_cam_speed[MAXSPLITSCREENPLAYERS], cv_cam_rotate[MAXSPLITSCREENPLAYERS];
|
extern consvar_t cv_cam_speed[MAXSPLITSCREENPLAYERS], cv_cam_rotate[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
|
extern consvar_t cv_tilting;
|
||||||
|
extern consvar_t cv_actionmovie;
|
||||||
|
extern consvar_t cv_windowquake;
|
||||||
|
|
||||||
extern fixed_t t_cam_dist[MAXSPLITSCREENPLAYERS], t_cam_height[MAXSPLITSCREENPLAYERS], t_cam_rotate[MAXSPLITSCREENPLAYERS];
|
extern fixed_t t_cam_dist[MAXSPLITSCREENPLAYERS], t_cam_height[MAXSPLITSCREENPLAYERS], t_cam_rotate[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
void P_AddPlayerScore(player_t *player, UINT32 amount);
|
void P_AddPlayerScore(player_t *player, UINT32 amount);
|
||||||
|
|
|
||||||
11
src/p_tick.c
11
src/p_tick.c
|
|
@ -655,10 +655,19 @@ void P_Ticker(boolean run)
|
||||||
quake.x = M_RandomRange(-ir,ir);
|
quake.x = M_RandomRange(-ir,ir);
|
||||||
quake.y = M_RandomRange(-ir,ir);
|
quake.y = M_RandomRange(-ir,ir);
|
||||||
quake.z = M_RandomRange(-ir,ir);
|
quake.z = M_RandomRange(-ir,ir);
|
||||||
|
if (cv_windowquake.value)
|
||||||
|
I_CursedWindowMovement(FixedInt(quake.x), FixedInt(quake.y));
|
||||||
|
ir >>= 2;
|
||||||
|
ir = M_RandomRange(-ir,ir);
|
||||||
|
if (ir < 0)
|
||||||
|
ir = ANGLE_MAX - FixedAngle(-ir);
|
||||||
|
else
|
||||||
|
ir = FixedAngle(ir);
|
||||||
|
quake.roll = ir;
|
||||||
--quake.time;
|
--quake.time;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
quake.x = quake.y = quake.z = 0;
|
quake.x = quake.y = quake.z = quake.roll = 0;
|
||||||
|
|
||||||
if (metalplayback)
|
if (metalplayback)
|
||||||
G_ReadMetalTic(metalplayback);
|
G_ReadMetalTic(metalplayback);
|
||||||
|
|
|
||||||
110
src/p_user.c
110
src/p_user.c
|
|
@ -2765,6 +2765,11 @@ consvar_t cv_cam_rotate[MAXSPLITSCREENPLAYERS] = {
|
||||||
CVAR_INIT ("cam4_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate4_OnChange)
|
CVAR_INIT ("cam4_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate4_OnChange)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
consvar_t cv_tilting = CVAR_INIT ("tilting", "On", CV_SAVE, CV_OnOff, NULL);
|
||||||
|
|
||||||
|
consvar_t cv_actionmovie = CVAR_INIT ("actionmovie", "On", CV_SAVE, CV_OnOff, NULL);
|
||||||
|
consvar_t cv_windowquake = CVAR_INIT ("windowquake", "Off", CV_SAVE, CV_OnOff, NULL);
|
||||||
|
|
||||||
fixed_t t_cam_dist[MAXSPLITSCREENPLAYERS] = {-42,-42,-42,-42};
|
fixed_t t_cam_dist[MAXSPLITSCREENPLAYERS] = {-42,-42,-42,-42};
|
||||||
fixed_t t_cam_height[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};
|
fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS] = {-42,-42,-42,-42};
|
||||||
|
|
@ -4245,6 +4250,109 @@ static void P_HandleFollower(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* gaysed script from me, based on Golden's sprite slope roll */
|
||||||
|
|
||||||
|
// holy SHIT
|
||||||
|
static INT32
|
||||||
|
Quaketilt (player_t *player)
|
||||||
|
{
|
||||||
|
angle_t tilt;
|
||||||
|
fixed_t lowb; // this threshold for speed
|
||||||
|
angle_t moma = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
|
||||||
|
INT32 delta = (INT32)( player->mo->angle - moma );
|
||||||
|
fixed_t speed;
|
||||||
|
|
||||||
|
boolean sliptiding =
|
||||||
|
(
|
||||||
|
player->kartstuff[k_aizdriftstrat] != 0 &&
|
||||||
|
player->kartstuff[k_drift] == 0
|
||||||
|
);
|
||||||
|
|
||||||
|
if (delta == (INT32)ANGLE_180)/* FUCK YOU HAVE A HACK */
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hi! I'm "not a math guy"!
|
||||||
|
if (abs(delta) > ANGLE_90)
|
||||||
|
delta = (INT32)(( moma + ANGLE_180 ) - player->mo->angle );
|
||||||
|
if (P_IsObjectOnGround(player->mo))
|
||||||
|
{
|
||||||
|
if (sliptiding)
|
||||||
|
{
|
||||||
|
tilt = ANGLE_45;
|
||||||
|
lowb = 5*FRACUNIT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tilt = ANGLE_11hh/2;
|
||||||
|
lowb = 15*FRACUNIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tilt = ANGLE_22h;
|
||||||
|
lowb = 10*FRACUNIT;
|
||||||
|
}
|
||||||
|
moma = FixedMul(FixedDiv(delta, ANGLE_90), tilt);
|
||||||
|
speed = abs( player->mo->momx + player->mo->momy );
|
||||||
|
if (speed < lowb)
|
||||||
|
{
|
||||||
|
// ease out tilt as we slow...
|
||||||
|
moma = FixedMul(moma, FixedDiv(speed, lowb));
|
||||||
|
}
|
||||||
|
return moma;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
DoABarrelRoll (player_t *player)
|
||||||
|
{
|
||||||
|
angle_t slope;
|
||||||
|
angle_t delta;
|
||||||
|
|
||||||
|
if (player->mo->standingslope)
|
||||||
|
{
|
||||||
|
slope = player->mo->standingslope->zangle;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
slope = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (abs((INT32)slope) > ANGLE_11hh)
|
||||||
|
{
|
||||||
|
delta = ( player->mo->angle - player->mo->standingslope->xydirection );
|
||||||
|
slope = -(FixedMul(FINESINE (delta>>ANGLETOFINESHIFT), slope));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
slope = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
slope -= Quaketilt(player);
|
||||||
|
|
||||||
|
delta = (INT32)( slope - player->tilt )/ 32;
|
||||||
|
|
||||||
|
if (delta)
|
||||||
|
player->tilt += delta;
|
||||||
|
else
|
||||||
|
player->tilt = slope;
|
||||||
|
|
||||||
|
if (cv_tilting.value)
|
||||||
|
{
|
||||||
|
player->viewrollangle = player->tilt;
|
||||||
|
|
||||||
|
if (cv_actionmovie.value)
|
||||||
|
{
|
||||||
|
player->viewrollangle += quake.roll;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player->viewrollangle = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_PlayerThink
|
// P_PlayerThink
|
||||||
//
|
//
|
||||||
|
|
@ -4663,6 +4771,8 @@ void P_PlayerThink(player_t *player)
|
||||||
|
|
||||||
K_KartPlayerThink(player, cmd); // SRB2kart
|
K_KartPlayerThink(player, cmd); // SRB2kart
|
||||||
|
|
||||||
|
DoABarrelRoll(player);
|
||||||
|
|
||||||
LUAh_PlayerThink(player);
|
LUAh_PlayerThink(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1697,6 +1697,10 @@ void R_RegisterEngineStuff(void)
|
||||||
CV_RegisterVar(&cv_cam_rotate[i]);
|
CV_RegisterVar(&cv_cam_rotate[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CV_RegisterVar(&cv_tilting);
|
||||||
|
CV_RegisterVar(&cv_actionmovie);
|
||||||
|
CV_RegisterVar(&cv_windowquake);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_showhud);
|
CV_RegisterVar(&cv_showhud);
|
||||||
CV_RegisterVar(&cv_translucenthud);
|
CV_RegisterVar(&cv_translucenthud);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -811,6 +811,12 @@ INT32 I_GetKey (void)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
I_CursedWindowMovement (int xd, int yd)
|
||||||
|
{
|
||||||
|
SDL_SetWindowPosition(window, window_x + xd, window_y + yd);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// I_JoyScale
|
// I_JoyScale
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -642,6 +642,9 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MAXIMIZED:
|
case SDL_WINDOWEVENT_MAXIMIZED:
|
||||||
break;
|
break;
|
||||||
|
case SDL_WINDOWEVENT_MOVED:
|
||||||
|
window_x = evt.data1;
|
||||||
|
window_y = evt.data2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mousefocus && kbfocus)
|
if (mousefocus && kbfocus)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue