diff --git a/src/d_main.c b/src/d_main.c index 0b0172f96..8b437a8a3 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -102,6 +102,8 @@ int SUBVERSION; // platform independant focus loss UINT8 window_notinfocus = false; +INT32 window_x; +INT32 window_y; // // DEMO LOOP diff --git a/src/d_player.h b/src/d_player.h index b055f6d9f..19a998f74 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -499,6 +499,7 @@ typedef struct player_s fixed_t bob; angle_t viewrollangle; + angle_t tilt; angle_t angleturn; diff --git a/src/doomstat.h b/src/doomstat.h index 636b36a9f..522108913 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -141,6 +141,8 @@ extern boolean digital_disabled; extern boolean menuactive; // Menu overlaid? 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 INT32 window_x; +extern INT32 window_y; extern boolean nodrawers; extern boolean noblit; @@ -299,6 +301,7 @@ extern struct quake { // camera offsets and duration fixed_t x,y,z; + angle_t roll; UINT16 time; // location, radius, and intensity... diff --git a/src/i_system.h b/src/i_system.h index 6cbea3a46..0d5898a72 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -348,4 +348,6 @@ const char *I_ClipboardPaste(void); void I_RegisterSysCommands(void); +void I_CursedWindowMovement(int xd, int yd); + #endif diff --git a/src/p_local.h b/src/p_local.h index ebb58c6f4..a04f1f197 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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_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]; void P_AddPlayerScore(player_t *player, UINT32 amount); diff --git a/src/p_tick.c b/src/p_tick.c index 9b1cbe6b9..ca02b1513 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -655,10 +655,19 @@ void P_Ticker(boolean run) quake.x = M_RandomRange(-ir,ir); quake.y = 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; } else - quake.x = quake.y = quake.z = 0; + quake.x = quake.y = quake.z = quake.roll = 0; if (metalplayback) G_ReadMetalTic(metalplayback); diff --git a/src/p_user.c b/src/p_user.c index 91c7b9df3..c403aaaf5 100644 --- a/src/p_user.c +++ b/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) }; +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_height[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 // @@ -4663,6 +4771,8 @@ void P_PlayerThink(player_t *player) K_KartPlayerThink(player, cmd); // SRB2kart + DoABarrelRoll(player); + LUAh_PlayerThink(player); } diff --git a/src/r_main.c b/src/r_main.c index aa9cd50ed..f09826623 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1697,6 +1697,10 @@ void R_RegisterEngineStuff(void) 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_translucenthud); diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index df39a50ee..26acad22c 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -811,6 +811,12 @@ INT32 I_GetKey (void) return rc; } +void +I_CursedWindowMovement (int xd, int yd) +{ + SDL_SetWindowPosition(window, window_x + xd, window_y + yd); +} + // // I_JoyScale // diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 83d8320ed..426081873 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -642,6 +642,9 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) break; case SDL_WINDOWEVENT_MAXIMIZED: break; + case SDL_WINDOWEVENT_MOVED: + window_x = evt.data1; + window_y = evt.data2; } if (mousefocus && kbfocus)