From 57c7e9303e77e0aece2516e48493438087d7f69b Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 22 Sep 2018 22:22:44 -0400 Subject: [PATCH 01/33] Obvious first commit: enable the NOCLIPCAM define again --- src/doomdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doomdef.h b/src/doomdef.h index b5519f6fd..31eb1877f 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -546,6 +546,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// SRB2Kart: Camera always has noclip. /// \note Kind of problematic. If we decide to keep this on, we'll need serious map changes. -//#define NOCLIPCAM +#define NOCLIPCAM #endif // __DOOMDEF__ From 6f10f15627a1a82a63028255db8466865d9c8e68 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 22 Sep 2018 22:46:06 -0400 Subject: [PATCH 02/33] Attempt to not let the camera into thok barriers Doesn't really work right now; it'll still go into thok barriers and get caught up at its floor height --- src/p_map.c | 19 ++++++++++++++----- src/p_mobj.c | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 41d61cb05..e9d38272f 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2181,6 +2181,12 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) mapcampointer = thiscam; +#ifdef NOCLIPCAM + if (newsubsec->sector->floorheight >= newsubsec->sector->ceilingheight + || newsubsec->sector->ceilingheight <= newsubsec->sector->floorheight) + return false; +#endif + if (GETSECSPECIAL(newsubsec->sector->special, 4) == 12) { // Camera noclip on entire sector. tmfloorz = tmdropoffz = thiscam->z; @@ -2378,12 +2384,15 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) fixed_t tryx = thiscam->x; fixed_t tryy = thiscam->y; -#ifndef NOCLIPCAM +#ifdef NOCLIPCAM + if (!(s->sector->floorheight >= s->sector->ceilingheight + || s->sector->ceilingheight <= s->sector->floorheight)) +#else if ((thiscam == &camera && (players[displayplayer].pflags & PF_NOCLIP)) - || (thiscam == &camera2 && (players[secondarydisplayplayer].pflags & PF_NOCLIP)) - || (thiscam == &camera3 && (players[thirddisplayplayer].pflags & PF_NOCLIP)) - || (thiscam == &camera4 && (players[fourthdisplayplayer].pflags & PF_NOCLIP)) - || (leveltime < introtime)) + || (thiscam == &camera2 && (players[secondarydisplayplayer].pflags & PF_NOCLIP)) + || (thiscam == &camera3 && (players[thirddisplayplayer].pflags & PF_NOCLIP)) + || (thiscam == &camera4 && (players[fourthdisplayplayer].pflags & PF_NOCLIP)) + || (leveltime < introtime)) #endif { // Noclipping player camera noclips too!! floatok = true; diff --git a/src/p_mobj.c b/src/p_mobj.c index d39e38766..233b307f6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3701,6 +3701,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled { if (!P_TryCameraMove(thiscam->x + thiscam->momx, thiscam->y + thiscam->momy, thiscam)) { // Never fails for 2D mode. +#ifndef NOCLIPCAM mobj_t dummy; dummy.thinker.function.acp1 = (actionf_p1)P_MobjThinker; dummy.subsector = thiscam->subsector; @@ -3711,6 +3712,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead. P_ResetCamera(player, thiscam); else +#endif P_SlideCameraMove(thiscam); if (resetcalled) // Okay this means the camera is fully reset. return true; From 7f0a1e1615bd2dc8121c960d5b2f2c5ddcbaf70a Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 26 Sep 2018 20:40:26 -0400 Subject: [PATCH 03/33] Remove the commented out SALLYALTRAINBOW define The relative luminance tweak fixes what it was meant to fix, but without changing the core functionality --- src/k_kart.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index ed91616b3..c2a678d38 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -256,8 +256,6 @@ UINT8 colortranslations[MAXSKINCOLORS][16] = { */ }; -//#define SALLYALTRAINBOW // Sal's edited version of the below, which keeps a colors' lightness, and looks better with hue-shifted colors like Ruby & Dream. Not strictly *better*, just different... - // Define for getting accurate color brightness readings according to how the human eye sees them. // https://en.wikipedia.org/wiki/Relative_luminance // 0.2126 to red @@ -277,7 +275,6 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) INT32 i; RGBA_t color; UINT8 brightness; -#ifndef SALLYALTRAINBOW INT32 j; UINT8 colorbrightnesses[16]; UINT16 brightdif; @@ -289,7 +286,6 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) color = V_GetColor(colortranslations[skincolor][i]); SETBRIGHTNESS(colorbrightnesses[i], color.s.red, color.s.green, color.s.blue); } -#endif // next, for every colour in the palette, choose the transcolor that has the closest brightness for (i = 0; i < NUM_PALETTE_ENTRIES; i++) @@ -301,10 +297,6 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) } color = V_GetColor(i); SETBRIGHTNESS(brightness, color.s.red, color.s.green, color.s.blue); -#ifdef SALLYALTRAINBOW - brightness = 15-(brightness/16); // Yes, 15. - dest_colormap[i] = colortranslations[skincolor][brightness]; -#else brightdif = 256; for (j = 0; j < 16; j++) { @@ -315,7 +307,6 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) dest_colormap[i] = colortranslations[skincolor][j]; } } -#endif } } From 2d5e6039740b53a59b55b97b80ba53fbc95a0229 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 26 Sep 2018 20:51:25 -0400 Subject: [PATCH 04/33] ESC rebind works on both bound keys --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 5d0448ce0..727735808 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2547,7 +2547,7 @@ boolean M_Responder(event_t *ev) if (ch == -1) return false; - else if (ch == gamecontrol[gc_systemmenu][0]) // allow remappable ESC key + else if (ch == gamecontrol[gc_systemmenu][0] || ch == gamecontrol[gc_systemmenu][1]) // allow remappable ESC key ch = KEY_ESCAPE; // F-Keys From 0a2be735bd5bc38c6da4ca818bd6c16d8dc8f4ef Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 26 Sep 2018 21:35:57 -0400 Subject: [PATCH 05/33] Viewpoint key improvements - Don't cycle through exiting players - Don't cycle through karma players in Battle - Disable console print on switch, it's already got a HUD element --- src/g_game.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index e501fa569..7edd7725e 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1831,6 +1831,7 @@ boolean G_Responder(event_t *ev) if (players[displayplayer].spectator) continue; + // SRB2Kart: we have no team-based modes, YET... /*if (G_GametypeHasTeams()) { if (players[consoleplayer].ctfteam @@ -1855,12 +1856,16 @@ boolean G_Responder(event_t *ev) continue; }*/ - // SRB2Kart: Ehhh, who cares, Mario Kart's designed around screen-cheating anyway - /*if (gametype != GT_RACE) + // SRB2Kart: Only go through players who are actually playing + if (players[displayplayer].exiting) + continue; + + // I don't know if we want this actually, but I'll humor the suggestion anyway + if (G_BattleGametype()) { - if (players[consoleplayer].kartstuff[k_bumper] > 0) + if (players[displayplayer].kartstuff[k_bumper] <= 0) continue; - }*/ + } break; } while (displayplayer != consoleplayer); @@ -1869,10 +1874,6 @@ boolean G_Responder(event_t *ev) if (singledemo) ST_changeDemoView(); - // tell who's the view - CONS_Printf(M_GetText("Viewpoint: %s\n"), player_names[displayplayer]); - P_ResetCamera(&players[displayplayer], &camera); - return true; } } From 771367c5d728c177c4268bd1957720c76df926e1 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 27 Sep 2018 16:55:21 -0400 Subject: [PATCH 06/33] New bindable keys You can now remap Change Viewpoint, Screenshot, and Toggle GIF Recording to other keys, mainly for gamepads They also pushed me to my breaking point and I couldn't tolerate the control menu anymore, thanks to toaster for the scrolling backport --- src/g_game.c | 11 +- src/g_input.c | 10 +- src/g_input.h | 3 + src/hu_stuff.c | 8 +- src/m_menu.c | 413 ++++++++++++++++++++++++++----------------------- src/m_misc.c | 5 +- src/st_stuff.c | 9 +- 7 files changed, 251 insertions(+), 208 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 7edd7725e..42baee934 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -428,10 +428,10 @@ consvar_t cv_chatbacktint = {"chatbacktint", "Off", CV_SAVE, CV_OnOff, NULL, 0, static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {0, NULL}}; consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair = {"crosshair", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair2 = {"crosshair2", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair3 = {"crosshair3", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair4 = {"crosshair4", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair = {"crosshair", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair2 = {"crosshair2", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair3 = {"crosshair3", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair4 = {"crosshair4", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_invertmouse = {"invertmouse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_alwaysfreelook = {"alwaysmlook", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_invertmouse2 = {"invertmouse2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -1812,7 +1812,8 @@ static INT32 spectatedelay, spectatedelay2, spectatedelay3, spectatedelay4 = 0; boolean G_Responder(event_t *ev) { // allow spy mode changes even during the demo - if (gamestate == GS_LEVEL && ev->type == ev_keydown && ev->data1 == KEY_F12) + if (gamestate == GS_LEVEL && ev->type == ev_keydown + && (ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) { if (splitscreen || !netgame) displayplayer = consoleplayer; diff --git a/src/g_input.c b/src/g_input.c index 279ee56b2..101fa8e4e 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1209,6 +1209,9 @@ static const char *gamecontrolname[num_gamecontrols] = "console", "pause", "systemmenu", + "screenshot", + "recordgif", + "viewpoint", "custom1", "custom2", "custom3", @@ -1293,6 +1296,9 @@ void G_Controldefault(void) // Extra controls gamecontrol[gc_pause ][0] = KEY_PAUSE; gamecontrol[gc_console ][0] = KEY_CONSOLE; + gamecontrol[gc_screenshot ][0] = KEY_F8; + gamecontrol[gc_recordgif ][0] = KEY_F9; + gamecontrol[gc_viewpoint ][0] = KEY_F12; gamecontrol[gc_talkkey ][0] = 't'; //gamecontrol[gc_teamkey ][0] = 'y'; gamecontrol[gc_scores ][0] = KEY_TAB; @@ -1303,11 +1309,11 @@ void G_Controldefault(void) gamecontrol[gc_camreset ][0] = KEY_HOME; gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE; - //gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y + gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y gamecontrol[gc_pause ][1] = KEY_JOY1+6; // Back gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start gamecontrol[gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up - //gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down + gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down gamecontrol[gc_talkkey ][1] = KEY_HAT1+2; // D-Pad Left gamecontrol[gc_scores ][1] = KEY_HAT1+3; // D-Pad Right diff --git a/src/g_input.h b/src/g_input.h index 6bbadf3eb..3bdd97995 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -115,6 +115,9 @@ typedef enum gc_console, gc_pause, gc_systemmenu, + gc_screenshot, + gc_recordgif, + gc_viewpoint, gc_custom1, // Lua scriptable gc_custom2, // Lua scriptable gc_custom3, // Lua scriptable diff --git a/src/hu_stuff.c b/src/hu_stuff.c index ab427b486..60b4e07f4 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1695,7 +1695,7 @@ static void HU_DrawChat_Old(void) // // Crosshairs are pre-cached at HU_Init -static inline void HU_DrawCrosshair(void) +/*static inline void HU_DrawCrosshair(void) { INT32 i, x, y; @@ -1847,7 +1847,7 @@ static inline void HU_DrawCrosshair4(void) V_DrawScaledPatch(x, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]); } -} +}*/ static void HU_DrawCEcho(void) { @@ -2018,7 +2018,7 @@ void HU_Drawer(void) return; // draw the crosshair, not when viewing demos nor with chasecam - if (!automapactive && !demoplayback) + /*if (!automapactive && !demoplayback) { if (cv_crosshair.value && !camera.chase && !players[displayplayer].spectator) HU_DrawCrosshair(); @@ -2031,7 +2031,7 @@ void HU_Drawer(void) if (cv_crosshair4.value && !camera4.chase && !players[fourthdisplayplayer].spectator) HU_DrawCrosshair4(); - } + }*/ // draw desynch text if (hu_resynching) diff --git a/src/m_menu.c b/src/m_menu.c index 727735808..61d1fba9a 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -288,8 +288,7 @@ static void M_SetupMultiPlayer4(INT32 choice); // Options // Split into multiple parts due to size // Controls -menu_t OP_ControlsDef, /*OP_ControlListDef,*/ OP_MoveControlsDef; -menu_t /*OP_MPControlsDef, OP_CameraControlsDef, OP_MiscControlsDef,*/ OP_CustomControlsDef, OP_SpectateControlsDef; +menu_t OP_ControlsDef, OP_AllControlsDef; menu_t OP_MouseOptionsDef, OP_Mouse2OptionsDef; menu_t OP_Joystick1Def, OP_Joystick2Def; #ifndef NOFOURPLAYER @@ -1112,88 +1111,47 @@ static menuitem_t OP_ControlsMenu[] = #endif }; -static menuitem_t OP_MoveControlsMenu[] = +static menuitem_t OP_AllControlsMenu[] = { - {IT_CONTROL, NULL, "Accelerate", M_ChangeControl, gc_accelerate }, - {IT_CONTROL, NULL, "Turn Left", M_ChangeControl, gc_turnleft }, - {IT_CONTROL, NULL, "Turn Right", M_ChangeControl, gc_turnright }, - {IT_CONTROL, NULL, "Drift", M_ChangeControl, gc_drift }, - {IT_CONTROL, NULL, "Brake", M_ChangeControl, gc_brake }, - {IT_CONTROL, NULL, "Use/Throw Item", M_ChangeControl, gc_fire }, - {IT_CONTROL, NULL, "Aim Forward", M_ChangeControl, gc_aimforward }, - {IT_CONTROL, NULL, "Aim Backward", M_ChangeControl, gc_aimbackward}, - {IT_CONTROL, NULL, "Look Backward", M_ChangeControl, gc_lookback }, - - {IT_SPACE, NULL, "", NULL, 76}, - {IT_CONTROL, NULL, "Talk key", M_ChangeControl, gc_talkkey }, - //{IT_CONTROL, NULL, "Team-Talk key", M_ChangeControl, gc_teamkey }, - {IT_CONTROL, NULL, "Rankings/Scores", M_ChangeControl, gc_scores }, - {IT_CONTROL, NULL, "Open/Close Menu (ESC)", M_ChangeControl, gc_systemmenu}, - {IT_CONTROL, NULL, "Pause", M_ChangeControl, gc_pause }, - {IT_CONTROL, NULL, "Console", M_ChangeControl, gc_console }, - - {IT_SUBMENU | IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 120}, - {IT_SUBMENU | IT_STRING, NULL, "Spectator Controls...", &OP_SpectateControlsDef, 128}, - {IT_SUBMENU | IT_STRING, NULL, "Custom Lua Actions...", &OP_CustomControlsDef, 136}, + {IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0}, + //{IT_SPACE, NULL, NULL, NULL, 0}, + {IT_HEADER, NULL, "Gameplay Controls", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Accelerate", M_ChangeControl, gc_accelerate }, + {IT_CONTROL, NULL, "Turn Left", M_ChangeControl, gc_turnleft }, + {IT_CONTROL, NULL, "Turn Right", M_ChangeControl, gc_turnright }, + {IT_CONTROL, NULL, "Drift", M_ChangeControl, gc_drift }, + {IT_CONTROL, NULL, "Brake", M_ChangeControl, gc_brake }, + {IT_CONTROL, NULL, "Use/Throw Item", M_ChangeControl, gc_fire }, + {IT_CONTROL, NULL, "Aim Forward", M_ChangeControl, gc_aimforward }, + {IT_CONTROL, NULL, "Aim Backward", M_ChangeControl, gc_aimbackward}, + {IT_CONTROL, NULL, "Look Backward", M_ChangeControl, gc_lookback }, + {IT_HEADER, NULL, "Miscelleanous Controls", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Chat", M_ChangeControl, gc_talkkey }, + //{IT_CONTROL, NULL, "Team Chat", M_ChangeControl, gc_teamkey }, + {IT_CONTROL, NULL, "Show Rankings", M_ChangeControl, gc_scores }, + {IT_CONTROL, NULL, "Change Viewpoint", M_ChangeControl, gc_viewpoint }, + {IT_CONTROL, NULL, "Reset Camera", M_ChangeControl, gc_camreset }, + {IT_CONTROL, NULL, "Toggle First-Person", M_ChangeControl, gc_camtoggle }, + {IT_CONTROL, NULL, "Pause", M_ChangeControl, gc_pause }, + {IT_CONTROL, NULL, "Screenshot", M_ChangeControl, gc_screenshot }, + {IT_CONTROL, NULL, "Toggle GIF Recording", M_ChangeControl, gc_recordgif }, + {IT_CONTROL, NULL, "Open/Close Menu (ESC)", M_ChangeControl, gc_systemmenu }, + {IT_CONTROL, NULL, "Developer Console", M_ChangeControl, gc_console }, + {IT_HEADER, NULL, "Spectator Controls", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Become Spectator", M_ChangeControl, gc_spectate }, + {IT_CONTROL, NULL, "Look Up", M_ChangeControl, gc_lookup }, + {IT_CONTROL, NULL, "Look Down", M_ChangeControl, gc_lookdown }, + {IT_CONTROL, NULL, "Center View", M_ChangeControl, gc_centerview }, + {IT_HEADER, NULL, "Custom Lua Actions", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Custom Action 1", M_ChangeControl, gc_custom1 }, + {IT_CONTROL, NULL, "Custom Action 2", M_ChangeControl, gc_custom2 }, + {IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 }, }; -static menuitem_t OP_SpectateControlsMenu[] = -{ - {IT_CONTROL, NULL, "Become Spectator", M_ChangeControl, gc_spectate }, - {IT_CONTROL, NULL, "Look Up", M_ChangeControl, gc_lookup }, - {IT_CONTROL, NULL, "Look Down", M_ChangeControl, gc_lookdown }, - {IT_CONTROL, NULL, "Center View", M_ChangeControl, gc_centerview}, - {IT_CONTROL, NULL, "Reset Camera", M_ChangeControl, gc_camreset }, - {IT_CONTROL, NULL, "Toggle Chasecam", M_ChangeControl, gc_camtoggle }, - - {IT_STRING | IT_CVAR, NULL, "Chasecam" , &cv_chasecam , 52}, - {IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair, 60}, -}; - -static menuitem_t OP_CustomControlsMenu[] = -{ - {IT_CONTROL, NULL, "Custom Action 1", M_ChangeControl, gc_custom1}, - {IT_CONTROL, NULL, "Custom Action 2", M_ChangeControl, gc_custom2}, - {IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3}, -}; - -// Obsolete thanks to Kart -/*static menuitem_t OP_MPControlsMenu[] = -{ -// {IT_CALL | IT_STRING2, NULL, "Next Weapon", M_ChangeControl, gc_driftleft }, -// {IT_CALL | IT_STRING2, NULL, "Prev Weapon", M_ChangeControl, gc_driftright }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 1", M_ChangeControl, gc_wepslot1 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 2", M_ChangeControl, gc_wepslot2 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 3", M_ChangeControl, gc_wepslot3 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 4", M_ChangeControl, gc_wepslot4 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 5", M_ChangeControl, gc_wepslot5 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 6", M_ChangeControl, gc_wepslot6 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 7", M_ChangeControl, gc_wepslot7 }, -}; - -static menuitem_t OP_CameraControlsMenu[] = -{ -// {IT_CALL | IT_STRING2, NULL, "Look Up", M_ChangeControl, gc_lookup }, -// {IT_CALL | IT_STRING2, NULL, "Look Down", M_ChangeControl, gc_lookdown }, -// {IT_CALL | IT_STRING2, NULL, "Center View", M_ChangeControl, gc_centerview }, -// {IT_CALL | IT_STRING2, NULL, "Mouselook", M_ChangeControl, gc_mouseaiming }, -}; - -static menuitem_t OP_MiscControlsMenu[] = -{ - {IT_CALL | IT_STRING2, NULL, "Custom Action 1", M_ChangeControl, gc_custom1 }, - {IT_CALL | IT_STRING2, NULL, "Custom Action 2", M_ChangeControl, gc_custom2 }, - {IT_CALL | IT_STRING2, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 }, - - {IT_CALL | IT_STRING2, NULL, "Pause", M_ChangeControl, gc_pause }, - {IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console }, - - {IT_CALL | IT_STRING2, NULL, "Talk key", M_ChangeControl, gc_talkkey }, - {IT_CALL | IT_STRING2, NULL, "Team-Talk key", M_ChangeControl, gc_teamkey }, - {IT_CALL | IT_STRING2, NULL, "Rankings/Scores", M_ChangeControl, gc_scores }, - {IT_CALL | IT_STRING2, NULL, "Spectate", M_ChangeControl, gc_spectate }, -};*/ - static menuitem_t OP_Joystick1Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup1PJoystickMenu, 10}, @@ -1950,28 +1908,12 @@ menu_t OP_MainDef = }; menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 60, 30); -//menu_t OP_ControlListDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlListMenu, &OP_ControlsDef, 60, 30); -menu_t OP_MoveControlsDef = CONTROLMENUSTYLE(OP_MoveControlsMenu, &OP_ControlsDef); -//menu_t OP_MPControlsDef = CONTROLMENUSTYLE(OP_MPControlsMenu, &OP_ControlListDef); -//menu_t OP_CameraControlsDef = CONTROLMENUSTYLE(OP_CameraControlsMenu, &OP_ControlListDef); -//menu_t OP_MiscControlsDef = CONTROLMENUSTYLE(OP_MiscControlsMenu, &OP_ControlListDef); -menu_t OP_CustomControlsDef = CONTROLMENUSTYLE(OP_CustomControlsMenu, &OP_MoveControlsDef); -menu_t OP_SpectateControlsDef = CONTROLMENUSTYLE(OP_SpectateControlsMenu, &OP_MoveControlsDef); -/* -menu_t OP_P1ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P1ControlsMenu, &OP_ControlsDef, 60, 30); -menu_t OP_P2ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P2ControlsMenu, &OP_ControlsDef, 60, 30); +menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef); +menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 60, 30); +menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 60, 30); #ifndef NOFOURPLAYER -menu_t OP_P3ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P3ControlsMenu, &OP_ControlsDef, 60, 30); -menu_t OP_P4ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P4ControlsMenu, &OP_ControlsDef, 60, 30); -#endif -menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_P1ControlsDef, 60, 30); -menu_t OP_Mouse2OptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_Mouse2OptionsMenu, &OP_P2ControlsDef, 60, 30); -*/ -menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_MoveControlsDef, 60, 30); -menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_MoveControlsDef, 60, 30); -#ifndef NOFOURPLAYER -menu_t OP_Joystick3Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_MoveControlsDef, 60, 30); -menu_t OP_Joystick4Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_MoveControlsDef, 60, 30); +menu_t OP_Joystick3Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 60, 30); +menu_t OP_Joystick4Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_AllControlsDef, 60, 30); #endif menu_t OP_JoystickSetDef = { @@ -8468,19 +8410,28 @@ static void M_Setup1PControlsMenu(INT32 choice) setupcontrols = gamecontrol; // was called from main Options (for console player, then) currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick1Def; + // Unhide P1-only controls - OP_MoveControlsMenu[10].status = IT_CONTROL; // Talk - //OP_MoveControlsMenu[11].status = IT_CONTROL; // Team-talk - OP_MoveControlsMenu[11].status = IT_CONTROL; // Rankings - OP_MoveControlsMenu[12].status = IT_CONTROL; // Pause - OP_MoveControlsMenu[13].status = IT_CONTROL; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick1Def; // Gamepad + OP_AllControlsMenu[14].status = IT_CONTROL; // Chat + //OP_AllControlsMenu[15].status = IT_CONTROL; // Team-chat + OP_AllControlsMenu[15].status = IT_CONTROL; // Rankings + OP_AllControlsMenu[16].status = IT_CONTROL; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_CONTROL; // Pause + OP_AllControlsMenu[20].status = IT_CONTROL; // Screenshot + OP_AllControlsMenu[21].status = IT_CONTROL; // GIF + OP_AllControlsMenu[22].status = IT_CONTROL; // System Menu + OP_AllControlsMenu[23].status = IT_CONTROL; // Console + OP_AllControlsMenu[24].status = IT_HEADER; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_SPACE; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_CONTROL; // Spectate + OP_AllControlsMenu[27].status = IT_CONTROL; // Look Up + OP_AllControlsMenu[28].status = IT_CONTROL; // Look Down + OP_AllControlsMenu[29].status = IT_CONTROL; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } static void M_Setup2PControlsMenu(INT32 choice) @@ -8491,19 +8442,28 @@ static void M_Setup2PControlsMenu(INT32 choice) setupcontrols = gamecontrolbis; currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick2Def; + // Hide P1-only controls - OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Talk - //OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Team-talk - OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings - OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause - OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick2Def; // Gamepad + OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat + //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat + OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings + OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause + OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot + OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF + OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu + OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console + OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate + OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up + OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down + OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam2; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair2; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } #ifndef NOFOURPLAYER @@ -8515,19 +8475,28 @@ static void M_Setup3PControlsMenu(INT32 choice) setupcontrols = gamecontrol3; currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick3Def; + // Hide P1-only controls - OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Talk - //OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Team-talk - OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings - OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause - OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick3Def; // Gamepad + OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat + //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat + OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings + OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause + OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot + OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF + OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu + OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console + OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate + OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up + OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down + OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam3; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair3; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } static void M_Setup4PControlsMenu(INT32 choice) @@ -8538,80 +8507,144 @@ static void M_Setup4PControlsMenu(INT32 choice) setupcontrols = gamecontrol4; currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick4Def; + // Hide P1-only controls - OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Talk - //OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Team-talk - OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings - OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause - OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick4Def; // Gamepad + OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat + //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat + OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings + OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause + OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot + OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF + OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu + OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console + OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate + OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up + OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down + OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam4; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair4; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } #endif +#define controlheight 18 + // Draws the Customise Controls menu static void M_DrawControl(void) { - char tmp[50]; - INT32 i, y; - INT32 keys[2]; - const char *ctrl; + char tmp[50]; + INT32 x, y, i, max, cursory = 0, iter; + INT32 keys[2]; - // draw title, strings and submenu - M_DrawGenericMenu(); + x = currentMenu->x; + y = currentMenu->y; - if (setupcontrols_secondaryplayer) - ctrl = "\x86""SET ""\x82""CONTROLS""\x86"" FOR ""\x82""SECONDARY PLAYER"; - else if (setupcontrols_thirdplayer) - ctrl = "\x86""SET ""\x82""CONTROLS""\x86"" FOR ""\x82""THIRD PLAYER"; - else if (setupcontrols_fourthplayer) - ctrl = "\x86""SET ""\x82""CONTROLS""\x86"" FOR ""\x82""FOURTH PLAYER"; - else - ctrl = "\x86""PRESS ""\x82""ENTER""\x86"" TO CHANGE, ""\x82""BACKSPACE""\x86"" TO CLEAR"; + /*i = itemOn - (controlheight/2); + if (i < 0) + i = 0; + */ - M_CentreText(28, ctrl); + iter = (controlheight/2); + for (i = itemOn; ((iter || currentMenu->menuitems[i].status == IT_GRAYEDOUT2) && i > 0); i--) + { + if (currentMenu->menuitems[i].status != IT_GRAYEDOUT2) + iter--; + } + if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + i--; - y = currentMenu->y; + iter += (controlheight/2); + for (max = itemOn; (iter && max < currentMenu->numitems); max++) + { + if (currentMenu->menuitems[max].status != IT_GRAYEDOUT2) + iter--; + } - for (i = 0; i < currentMenu->numitems;i++) - { - if (currentMenu->menuitems[i].status != IT_CONTROL) - { - y = currentMenu->y+currentMenu->menuitems[i].alphaKey; - continue; - } - if (currentMenu->menuitems[i].status != IT_CONTROL) - continue; + if (iter) + { + iter += (controlheight/2); + for (i = itemOn; ((iter || currentMenu->menuitems[i].status == IT_GRAYEDOUT2) && i > 0); i--) + { + if (currentMenu->menuitems[i].status != IT_GRAYEDOUT2) + iter--; + } + } - keys[0] = setupcontrols[currentMenu->menuitems[i].alphaKey][0]; - keys[1] = setupcontrols[currentMenu->menuitems[i].alphaKey][1]; + /*max = i + controlheight; + if (max > currentMenu->numitems) + { + max = currentMenu->numitems; + if (max < controlheight) + i = 0; + else + i = max - controlheight; + }*/ - tmp[0] ='\0'; - if (keys[0] == KEY_NULL && keys[1] == KEY_NULL) - { - strcpy(tmp, "---"); - } - else - { - if (keys[0] != KEY_NULL) - strcat (tmp, G_KeynumToString (keys[0])); + // draw title (or big pic) + M_DrawMenuTitle(); - if (keys[0] != KEY_NULL && keys[1] != KEY_NULL) - strcat(tmp," or "); + M_CentreText(30, + (setupcontrols_fourthplayer ? "Set controls for Player 4" : + (setupcontrols_thirdplayer ? "Set controls for Player 3" : + (setupcontrols_secondaryplayer ? "Set controls for Player 2" : + "Press ENTER to change, BACKSPACE to clear")))); - if (keys[1] != KEY_NULL) - strcat (tmp, G_KeynumToString (keys[1])); + if (i) + V_DrawString(currentMenu->x - 16, y-(skullAnimCounter/5), highlightflags, "\x1A"); // up arrow + if (max != currentMenu->numitems) + V_DrawString(currentMenu->x - 16, y+(SMALLLINEHEIGHT*(controlheight-1))+(skullAnimCounter/5), highlightflags, "\x1B"); // down arrow + + for (; i < max; i++) + { + if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + continue; + + if (i == itemOn) + cursory = y; + + if (currentMenu->menuitems[i].status == IT_CONTROL) + { + V_DrawString(x, y, ((i == itemOn) ? highlightflags : 0), currentMenu->menuitems[i].text); + keys[0] = setupcontrols[currentMenu->menuitems[i].alphaKey][0]; + keys[1] = setupcontrols[currentMenu->menuitems[i].alphaKey][1]; + + tmp[0] ='\0'; + if (keys[0] == KEY_NULL && keys[1] == KEY_NULL) + { + strcpy(tmp, "---"); + } + else + { + if (keys[0] != KEY_NULL) + strcat (tmp, G_KeynumToString (keys[0])); + + if (keys[0] != KEY_NULL && keys[1] != KEY_NULL) + strcat(tmp,", "); + + if (keys[1] != KEY_NULL) + strcat (tmp, G_KeynumToString (keys[1])); - } - V_DrawRightAlignedString(BASEVIDWIDTH-currentMenu->x, y, highlightflags, tmp); - y += SMALLLINEHEIGHT; - } + } + V_DrawRightAlignedString(BASEVIDWIDTH-currentMenu->x, y, highlightflags, tmp); + } + /*else if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);*/ + else if ((currentMenu->menuitems[i].status == IT_HEADER) && (i != max-1)) + V_DrawString(19, y+6, highlightflags, currentMenu->menuitems[i].text); + else if (currentMenu->menuitems[i].status & IT_STRING) + V_DrawString(x, y, ((i == itemOn) ? highlightflags : 0), currentMenu->menuitems[i].text); + + y += SMALLLINEHEIGHT; + } + + V_DrawScaledPatch(currentMenu->x - 20, cursory, 0, + W_CachePatchName("M_CURSOR", PU_CACHE)); } static INT32 controltochange; diff --git a/src/m_misc.c b/src/m_misc.c index 766db72df..7b176fd90 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1480,9 +1480,10 @@ boolean M_ScreenshotResponder(event_t *ev) return false; ch = ev->data1; - if (ch == KEY_F8) + + if (ch == gamecontrol[gc_screenshot][0] || ch == gamecontrol[gc_screenshot][1]) // remappable F8 M_ScreenShot(); - else if (ch == KEY_F9) + else if (ch == gamecontrol[gc_recordgif][0] || ch == gamecontrol[gc_recordgif][1]) // remappable F9 ((moviemode) ? M_StopMovie : M_StartMovie)(); else return false; diff --git a/src/st_stuff.c b/src/st_stuff.c index 72266ba2f..45e0deb58 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1952,14 +1952,13 @@ static void ST_overlayDrawer(void) ) { // SRB2kart: changed positions & text - V_DrawString(2, BASEVIDHEIGHT-50, V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -")); + V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -")); if (stplyr->pflags & PF_WANTSTOJOIN) - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Cancel Join")); + V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - Cancel Join")); /*else if (G_GametypeHasTeams()) - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Join Team"));*/ + V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - Join Team"));*/ else - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Join Game")); - V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("F12 - Change View")); + V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - Join Game")); V_DrawString(2, BASEVIDHEIGHT-20, V_HUDTRANSHALF, M_GetText("Accelerate - Float")); V_DrawString(2, BASEVIDHEIGHT-10, V_HUDTRANSHALF, M_GetText("Brake - Sink")); } From 40f887fc7ec8f4900b673d5bcdea0b91549d7b4e Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 27 Sep 2018 17:17:04 -0400 Subject: [PATCH 07/33] Scale fixes --- src/k_kart.c | 44 +++++++++----------------------------------- src/m_menu.c | 2 ++ src/p_mobj.c | 1 + 3 files changed, 12 insertions(+), 35 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index c2a678d38..f8d022929 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2522,7 +2522,7 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent) I_Assert(mo != NULL); I_Assert(!P_MobjWasRemoved(mo)); - dust = P_SpawnMobj(mo->x + (P_RandomRange(-25,25)<y + (P_RandomRange(-25,25)<z, MT_WIPEOUTTRAIL); + dust = P_SpawnMobj(mo->x + (P_RandomRange(-25,25) * mo->scale), mo->y + (P_RandomRange(-25,25) * mo->scale), mo->z, MT_WIPEOUTTRAIL); P_SetTarget(&dust->target, mo); dust->angle = R_PointToAngle2(0,0,mo->momx,mo->momy); @@ -2591,45 +2591,17 @@ void K_DriftDustHandling(mobj_t *spawner) { dust->z += spawner->height - dust->height; } - dust->momx = FixedMul(spawner->momx + (P_RandomRange(-speedrange, speedrange)<momy = FixedMul(spawner->momy + (P_RandomRange(-speedrange, speedrange)<momz = P_MobjFlip(spawner) * P_RandomRange(1, 4)<momx = FixedMul(spawner->momx + (P_RandomRange(-speedrange, speedrange)<scale)/4); + dust->momy = FixedMul(spawner->momy + (P_RandomRange(-speedrange, speedrange)<scale)/4); + dust->momz = P_MobjFlip(spawner) * (P_RandomRange(1, 4) * (spawner->scale)); P_SetScale(dust, spawner->scale/2); dust->destscale = spawner->scale * 3; + dust->scalespeed = FixedMul(dust->scalespeed, spawner->scale); if (leveltime % 6 == 0) S_StartSound(spawner, sfx_screec); - // Now time for a bunch of flag shit, groooooaann... - if (spawner->flags2 & MF2_DONTDRAW) - dust->flags2 |= MF2_DONTDRAW; - else - dust->flags2 &= ~MF2_DONTDRAW; - - if (spawner->eflags & MFE_VERTICALFLIP) - dust->eflags |= MFE_VERTICALFLIP; - else - dust->eflags &= ~MFE_VERTICALFLIP; - - if (spawner->eflags & MFE_DRAWONLYFORP1) - dust->eflags |= MFE_DRAWONLYFORP1; - else - dust->eflags &= ~MFE_DRAWONLYFORP1; - - if (spawner->eflags & MFE_DRAWONLYFORP2) - dust->eflags |= MFE_DRAWONLYFORP2; - else - dust->eflags &= ~MFE_DRAWONLYFORP2; - - if (spawner->eflags & MFE_DRAWONLYFORP3) - dust->eflags |= MFE_DRAWONLYFORP3; - else - dust->eflags &= ~MFE_DRAWONLYFORP3; - - if (spawner->eflags & MFE_DRAWONLYFORP4) - dust->eflags |= MFE_DRAWONLYFORP4; - else - dust->eflags &= ~MFE_DRAWONLYFORP4; + K_MatchGenericExtraFlags(dust, spawner); } } @@ -2965,7 +2937,10 @@ void K_DoSneaker(player_t *player, boolean doPFlag) const fixed_t prevboost = player->kartstuff[k_speedboost]; if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) + { S_StartSound(player->mo, sfx_cdfm01); + K_SpawnDashDustRelease(player); + } if (!player->kartstuff[k_sneakertimer]) { @@ -2976,7 +2951,6 @@ void K_DoSneaker(player_t *player, boolean doPFlag) } player->kartstuff[k_sneakertimer] = sneakertime; - K_SpawnDashDustRelease(player); if (doPFlag) { diff --git a/src/m_menu.c b/src/m_menu.c index 61d1fba9a..9957f1ebb 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8647,6 +8647,8 @@ static void M_DrawControl(void) W_CachePatchName("M_CURSOR", PU_CACHE)); } +#undef controlheight + static INT32 controltochange; static void M_ChangecontrolResponse(event_t *ev) diff --git a/src/p_mobj.c b/src/p_mobj.c index 0f0657336..205a5501b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8266,6 +8266,7 @@ void P_MobjThinker(mobj_t *mobj) P_SetScale(smoke, mobj->target->scale/2); smoke->destscale = 3*mobj->target->scale/2; + smoke->scalespeed = FixedMul(smoke->scalespeed, mobj->target->scale); smoke->momx = mobj->target->momx/2; smoke->momy = mobj->target->momy/2; From a967a8990a7b43e199fbe991ad2f6a3a39d6fce1 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 27 Sep 2018 17:21:06 -0400 Subject: [PATCH 08/33] 1 more fix --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 205a5501b..baa21d45c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8272,7 +8272,7 @@ void P_MobjThinker(mobj_t *mobj) smoke->momy = mobj->target->momy/2; smoke->momz = mobj->target->momz/2; - P_Thrust(smoke, mobj->target->angle+FixedAngle(P_RandomRange(135, 225)<mobj_scale); + P_Thrust(smoke, mobj->target->angle+FixedAngle(P_RandomRange(135, 225)<target->scale); } break; case MT_SPARKLETRAIL: From c0f1dbd850839102d03acc1c1184cfc0eedc6fd1 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 27 Sep 2018 18:26:37 -0400 Subject: [PATCH 09/33] Yet another scale fix --- src/k_kart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index f8d022929..e6467deae 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3607,9 +3607,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) // Speed lines if ((player->kartstuff[k_sneakertimer] || player->kartstuff[k_driftboost] || player->kartstuff[k_startboost]) && player->speed > 0) { - mobj_t *fast = P_SpawnMobj(player->mo->x + (P_RandomRange(-36,36)<mo->y + (P_RandomRange(-36,36)<mo->z + (player->mo->height/2) + (P_RandomRange(-20,20)<mo->x + (P_RandomRange(-36,36) * player->mo->scale), + player->mo->y + (P_RandomRange(-36,36) * player->mo->scale), + player->mo->z + (player->mo->height/2) + (P_RandomRange(-20,20) * player->mo->scale), MT_FASTLINE); fast->angle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); fast->momx = 3*player->mo->momx/4; From ddf310d135f141975e8d01b7526889ac6ed8079f Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 27 Sep 2018 18:32:48 -0400 Subject: [PATCH 10/33] Talk key is a two-way toggle for non-keyboard binds --- src/hu_stuff.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 60b4e07f4..a5d598d08 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1155,7 +1155,10 @@ boolean HU_Responder(event_t *ev) c_input = 0; // reset input cursor chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :) } - else if (c == KEY_ESCAPE) + else if (c == KEY_ESCAPE + || ((c == gamecontrol[gc_talkkey][0] || c == gamecontrol[gc_talkkey][1] + || c == gamecontrol[gc_teamkey][0] || c == gamecontrol[gc_teamkey][1]) + && c >= KEY_MOUSE1)) // If it's not a keyboard key, then the chat button is used as a toggle. { chat_on = false; c_input = 0; // reset input cursor From a641bba6419a6a20c12a3daaf10640712477ce25 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 27 Sep 2018 18:42:42 -0400 Subject: [PATCH 11/33] No mashing in Record Attack --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index e6467deae..96e8f64fa 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -901,7 +901,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) // If the roulette finishes or the player presses BT_ATTACK, stop the roulette and calculate the item. // I'm returning via the exact opposite, however, to forgo having another bracket embed. Same result either way, I think. // Finally, if you get past this check, now you can actually start calculating what item you get. - if ((cmd->buttons & BT_ATTACK) && !(player->kartstuff[k_eggmanheld] || player->kartstuff[k_itemheld]) && player->kartstuff[k_itemroulette] >= roulettestop) + if ((cmd->buttons & BT_ATTACK) && !(player->kartstuff[k_eggmanheld] || player->kartstuff[k_itemheld]) && player->kartstuff[k_itemroulette] >= roulettestop && !modeattacking) { // Mashing reduces your chances for the good items mashed = FixedDiv((player->kartstuff[k_itemroulette])*FRACUNIT, ((TICRATE*3)+roulettestop)*FRACUNIT) - FRACUNIT; From aaee15b5eb069a5810d3373c1fb38e5b31e1d08d Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 27 Sep 2018 18:44:14 -0400 Subject: [PATCH 12/33] "TICRATE*1"?! --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 96e8f64fa..aadfd2d2a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -896,7 +896,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsLocalPlayer(player)) S_StartSound(NULL, sfx_mkitm1 + ((player->kartstuff[k_itemroulette] / 3) % 8)); - roulettestop = (TICRATE*1) + (3*(pingame - player->kartstuff[k_position])); + roulettestop = TICRATE + (3*(pingame - player->kartstuff[k_position])); // If the roulette finishes or the player presses BT_ATTACK, stop the roulette and calculate the item. // I'm returning via the exact opposite, however, to forgo having another bracket embed. Same result either way, I think. From 8768e96afad64318aefdfc1fdfd15bf1751a0349 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 21:46:12 -0400 Subject: [PATCH 13/33] Please don't punish offline practice --- src/g_game.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 42baee934..c14f1b1f3 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2282,28 +2282,11 @@ static inline void G_PlayerFinishLevel(INT32 player) { if (legitimateexit && !demoplayback && !mapreset) // (yes you're allowed to unlock stuff this way when the game is modified) { - UINT8 i = 0; - - if (netgame) + matchesplayed++; + if (M_UpdateUnlockablesAndExtraEmblems(true)) { - // check to see if there's anyone else at all - for (; i < MAXPLAYERS; i++) - { - if (i == consoleplayer) - continue; - if (playeringame[i] && !stplyr->spectator) - break; - } - } - - if (i != MAXPLAYERS) // Not FREE PLAY - { - matchesplayed++; - if (M_UpdateUnlockablesAndExtraEmblems(true)) - { - S_StartSound(NULL, sfx_ncitem); - G_SaveGameData(true); // only save if unlocked something - } + S_StartSound(NULL, sfx_ncitem); + G_SaveGameData(true); // only save if unlocked something } } From abb21fc79c355f5a06705fc9e8d915aa2f7f5143 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 1 Oct 2018 07:21:02 -0400 Subject: [PATCH 14/33] Goodbye cvar --- src/d_netcmd.c | 8 ++++---- src/g_game.c | 4 ++-- src/g_game.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 144e4bf94..6d1ccb8d9 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -796,10 +796,10 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_consolechat); CV_RegisterVar(&cv_chatnotifications); CV_RegisterVar(&cv_chatbacktint); - CV_RegisterVar(&cv_crosshair); - CV_RegisterVar(&cv_crosshair2); - CV_RegisterVar(&cv_crosshair3); - CV_RegisterVar(&cv_crosshair4); + //CV_RegisterVar(&cv_crosshair); + //CV_RegisterVar(&cv_crosshair2); + //CV_RegisterVar(&cv_crosshair3); + //CV_RegisterVar(&cv_crosshair4); //CV_RegisterVar(&cv_alwaysfreelook); //CV_RegisterVar(&cv_alwaysfreelook2); diff --git a/src/g_game.c b/src/g_game.c index c14f1b1f3..f20ccdc52 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -428,10 +428,10 @@ consvar_t cv_chatbacktint = {"chatbacktint", "Off", CV_SAVE, CV_OnOff, NULL, 0, static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {0, NULL}}; consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair = {"crosshair", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +/*consvar_t cv_crosshair = {"crosshair", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_crosshair2 = {"crosshair2", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_crosshair3 = {"crosshair3", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair4 = {"crosshair4", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair4 = {"crosshair4", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};*/ consvar_t cv_invertmouse = {"invertmouse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_alwaysfreelook = {"alwaysmlook", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_invertmouse2 = {"invertmouse2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/g_game.h b/src/g_game.h index 10eb4c681..e34a69860 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -55,7 +55,7 @@ extern INT16 rw_maximums[NUM_WEAPONS]; // used in game menu extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatspamprotection, cv_chatbacktint; -extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4; +//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4; extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_mousemove; extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis; extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2; From 32bb288b84bc505488c2b029e931a76e2e11a824 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 1 Oct 2018 08:41:44 -0400 Subject: [PATCH 15/33] DrawFill supports splitscreen offset flags --- src/g_game.c | 2 +- src/hardware/hw_draw.c | 8 ++++++++ src/v_video.c | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index f20ccdc52..bd55ea9f6 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -340,7 +340,7 @@ void SendWeaponPref2(void); void SendWeaponPref3(void); void SendWeaponPref4(void); -static CV_PossibleValue_t crosshair_cons_t[] = {{0, "Off"}, {1, "Cross"}, {2, "Angle"}, {3, "Point"}, {0, NULL}}; +//static CV_PossibleValue_t crosshair_cons_t[] = {{0, "Off"}, {1, "Cross"}, {2, "Angle"}, {3, "Point"}, {0, NULL}}; static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, #ifdef _WII {1, "LStick.X"}, {2, "LStick.Y"}, {-1, "LStick.X-"}, {-2, "LStick.Y-"}, diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index f19493257..98bb434ae 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -857,6 +857,10 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) else if (!(color & V_SNAPTOTOP)) fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2; } + if (color & V_SPLITSCREEN) + fy += ((float)BASEVIDHEIGHT * dupy)/2; + if (color & V_HORZSCREEN) + fx += ((float)BASEVIDWIDTH * dupx)/2; } if (fx >= vid.width || fy >= vid.height) @@ -963,6 +967,10 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 else if (!(options & V_SNAPTOTOP)) fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2; } + if (options & V_SPLITSCREEN) + fy += ((float)BASEVIDHEIGHT * dupy)/2; + if (options & V_HORZSCREEN) + fx += ((float)BASEVIDWIDTH * dupx)/2; } if (fx >= vid.width || fy >= vid.height) diff --git a/src/v_video.c b/src/v_video.c index 46d34acce..9d4fca453 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -820,6 +820,10 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) else if (!(c & V_SNAPTOTOP)) y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2; } + if (c & V_SPLITSCREEN) + y += (BASEVIDHEIGHT * dupy)/2; + if (c & V_HORZSCREEN) + x += (BASEVIDWIDTH * dupx)/2; } if (x >= vid.width || y >= vid.height) @@ -901,6 +905,10 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c) else if (!(c & V_SNAPTOTOP)) y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2; } + if (c & V_SPLITSCREEN) + y += (BASEVIDHEIGHT * dupy)/2; + if (c & V_HORZSCREEN) + x += (BASEVIDWIDTH * dupx)/2; } if (x >= vid.width || y >= vid.height) From 9e068f8c031c7083075001b6daf0371af0c56c51 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 1 Oct 2018 19:23:38 -0400 Subject: [PATCH 16/33] Address toast review - Re-add highlighting to the header text, and shift it back up slightly - Move the viewpoint loop break out of a while and into the main loop --- src/g_game.c | 27 +++++++++++++++------------ src/m_menu.c | 10 +++++----- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index bd55ea9f6..d77d04f86 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1826,12 +1826,26 @@ boolean G_Responder(event_t *ev) if (displayplayer == MAXPLAYERS) displayplayer = 0; + if (displayplayer == consoleplayer) + break; // End loop + if (!playeringame[displayplayer]) continue; if (players[displayplayer].spectator) continue; + // SRB2Kart: Only go through players who are actually playing + if (players[displayplayer].exiting) + continue; + + // I don't know if we want this actually, but I'll humor the suggestion anyway + if (G_BattleGametype()) + { + if (players[displayplayer].kartstuff[k_bumper] <= 0) + continue; + } + // SRB2Kart: we have no team-based modes, YET... /*if (G_GametypeHasTeams()) { @@ -1857,19 +1871,8 @@ boolean G_Responder(event_t *ev) continue; }*/ - // SRB2Kart: Only go through players who are actually playing - if (players[displayplayer].exiting) - continue; - - // I don't know if we want this actually, but I'll humor the suggestion anyway - if (G_BattleGametype()) - { - if (players[displayplayer].kartstuff[k_bumper] <= 0) - continue; - } - break; - } while (displayplayer != consoleplayer); + } // change statusbar also if playing back demo if (singledemo) diff --git a/src/m_menu.c b/src/m_menu.c index 9957f1ebb..1e952d1aa 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8588,11 +8588,11 @@ static void M_DrawControl(void) // draw title (or big pic) M_DrawMenuTitle(); - M_CentreText(30, - (setupcontrols_fourthplayer ? "Set controls for Player 4" : - (setupcontrols_thirdplayer ? "Set controls for Player 3" : - (setupcontrols_secondaryplayer ? "Set controls for Player 2" : - "Press ENTER to change, BACKSPACE to clear")))); + M_CentreText(28, + (setupcontrols_fourthplayer ? "\x86""Set controls for ""\x82""Player 4" : + (setupcontrols_thirdplayer ? "\x86""Set controls for ""\x82""Player 3" : + (setupcontrols_secondaryplayer ? "\x86""Set controls for ""\x82""Player 2" : + "\x86""Press ""\x82""ENTER""\x86"" to change, ""\x82""BACKSPACE""\x86"" to clear")))); if (i) V_DrawString(currentMenu->x - 16, y-(skullAnimCounter/5), highlightflags, "\x1A"); // up arrow From 5e8799a965f2da4a08f2c7ee0709775509726de5 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 3 Oct 2018 17:04:41 +0100 Subject: [PATCH 17/33] Nuke a bunch of iteration things that have no purpose in SRB2Kart. A full explanation of my reasoning and what it affects is as follows. p_inter.c - Everything to do with setting states for starposts In SRB2Kart, starposts are invisble. We don't need to loop through all thinkers just to set their states when there's no visible effect of the state-setting. In addition, it has no consequences for gameplay - starposts have long been silent here, and all checking is done regarding their health, not their state. Remove extremely low-traffic conditionals (MT_FLINGEMERALD collision height extension, for example) These objects serve no functional purpose during regular SRB2Kart gameplay. Why should every other object have to pay an admittedly minor performance hit just for them? Disable all mechanisms of damaging bosses or enemies with the player's physical contact With the exception of Sapphire Coast, no MF_ENEMY objects exist in the entirety of the standard roster. In addition, the conditions for damaging the enemies were impossible to achieve, because they required vanilla SRB2 mechanics such as "jumping", "spindashing", or "super". Therefore, they can be safely commented out. Disable NiGHTS-related material (excepting bumper, hoop, and wing-emblem objects) NiGHTS is fundamentally incompatible with regular kart gameplay and I believe was already broken. Therefore, any mechanism which enters, aids, or abets it can be safely disabled. Comment out Tag mechanisms Tag is the only vanilla multiplayer gametype which has sufficient gameplay depth and complexity (HEYOOOOOOOOO) to require dedicated thinking in and of itself in order to manage. This thinking is irrelevant to Kart's functioning, and can be neutered easily. d_clisrv.c Comment out Tag mechanisms See p_inter.c d_netcmd.c Disable several devmode commands which are irrelevant to SRB2Kart gameplay When investigating for references to NiGHTS material, I discovered that these remained untouched. In order to present a more coherent game, I have hidden the ones that serve no purpose for us. Comment out Tag mechanisms See p_inter.c g_game.c Disable NiGHTS-related material See p_inter.c Disable some team-related material Teams are not present in SRB2Kart at present. Obviously we'd want to reconsider for future, but it doesn't need to be run right now. Everything to do with setting states for starposts See p_inter.c m_cheat.c Disable several devmode commands which are irrelevant to SRB2Kart gameplay See d_netcmd.c p_map.c Remove extremely low-traffic conditionals (MT_EGGSHIELD collision, for example) See p_inter.c Disable NiGHTS-related material See p_inter.c p_mobj.c Disable P_EmeraldManager Power stones, despite their relevance in vanilla Match, are not in SRB2Kart's Battle. No management of nonexistent emeralds is required. p_setup.c Everything to do with setting states for starposts See p_inter.c p_spec.c Disable NiGHTS-related material See p_inter.c Everything to do with setting states for starposts See p_inter.c p_telept.c Everything to do with setting states for starposts See p_inter.c p_tick.c Disable some team-related material See g_game.c Disable P_EmeraldManager See p_mobj.c Do not run shields Shield objects are not run under the vanilla system; the Thunder Shield is a domain-specific recreation using a standard mobjthinker. Do not run special stages SRB2Kart does not have special stages. Comment out Tag mechanisms See p_inter.c y_inter.c Disable some team-related material See g_game.c p_user.c Disable NiGHTS-related material See p_inter.c Disable 2d movement for players 2D mode? In a kart racer? :nick: --- src/d_clisrv.c | 4 +- src/d_netcmd.c | 12 ++--- src/g_game.c | 10 ++--- src/m_cheat.c | 12 ++--- src/m_cheat.h | 8 ++-- src/p_inter.c | 120 +++++++++---------------------------------------- src/p_local.h | 13 +++--- src/p_map.c | 41 ++++++++--------- src/p_mobj.c | 4 +- src/p_setup.c | 1 - src/p_spec.c | 9 ++-- src/p_telept.c | 4 -- src/p_tick.c | 16 +++---- src/p_user.c | 56 ++++++++--------------- src/y_inter.c | 4 +- 15 files changed, 102 insertions(+), 212 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 63393690a..4dc5ed7ef 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2491,9 +2491,9 @@ static void CL_RemovePlayer(INT32 playernum) LUA_InvalidatePlayer(&players[playernum]); #endif - if (G_TagGametype()) //Check if you still have a game. Location flexible. =P + /*if (G_TagGametype()) //Check if you still have a game. Location flexible. =P P_CheckSurvivors(); - else if (G_BattleGametype()) // SRB2Kart + else*/ if (G_BattleGametype()) // SRB2Kart K_CheckBumpers(); else if (G_RaceGametype()) P_CheckRacers(); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 144e4bf94..76ea3d6fc 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -915,19 +915,19 @@ void D_RegisterClientCommands(void) COM_AddCommand("noclip", Command_CheatNoClip_f); COM_AddCommand("god", Command_CheatGod_f); COM_AddCommand("notarget", Command_CheatNoTarget_f); - COM_AddCommand("getallemeralds", Command_Getallemeralds_f); + /*COM_AddCommand("getallemeralds", Command_Getallemeralds_f); COM_AddCommand("resetemeralds", Command_Resetemeralds_f); COM_AddCommand("setrings", Command_Setrings_f); COM_AddCommand("setlives", Command_Setlives_f); - COM_AddCommand("setcontinues", Command_Setcontinues_f); + COM_AddCommand("setcontinues", Command_Setcontinues_f);*/ COM_AddCommand("devmode", Command_Devmode_f); COM_AddCommand("savecheckpoint", Command_Savecheckpoint_f); COM_AddCommand("scale", Command_Scale_f); COM_AddCommand("gravflip", Command_Gravflip_f); COM_AddCommand("hurtme", Command_Hurtme_f); - COM_AddCommand("jumptoaxis", Command_JumpToAxis_f); + /*COM_AddCommand("jumptoaxis", Command_JumpToAxis_f); COM_AddCommand("charability", Command_Charability_f); - COM_AddCommand("charspeed", Command_Charspeed_f); + COM_AddCommand("charspeed", Command_Charspeed_f);*/ COM_AddCommand("teleport", Command_Teleport_f); COM_AddCommand("rteleport", Command_RTeleport_f); COM_AddCommand("skynum", Command_Skynum_f); @@ -3260,9 +3260,9 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) } // In tag, check to see if you still have a game. - if (G_TagGametype()) + /*if (G_TagGametype()) P_CheckSurvivors(); - else if (G_BattleGametype()) + else*/ if (G_BattleGametype()) K_CheckBumpers(); // SRB2Kart else if (G_RaceGametype()) P_CheckRacers(); // also SRB2Kart diff --git a/src/g_game.c b/src/g_game.c index e501fa569..5c9af3ed7 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2554,15 +2554,15 @@ void G_PlayerReborn(INT32 player) p->maxlink = 0; // If NiGHTS, find lowest mare to start with. - p->mare = P_FindLowestMare(); + p->mare = 0; /*P_FindLowestMare(); CONS_Debug(DBG_NIGHTS, M_GetText("Current mare is %d\n"), p->mare); if (p->mare == 255) - p->mare = 0; + p->mare = 0;*/ // Check to make sure their color didn't change somehow... - if (G_GametypeHasTeams()) + /*if (G_GametypeHasTeams()) { if (p->ctfteam == 1 && p->skincolor != skincolor_redteam) { @@ -2586,7 +2586,7 @@ void G_PlayerReborn(INT32 player) else if (p == &players[fourthdisplayplayer]) CV_SetValue(&cv_playercolor4, skincolor_blueteam); } - } + }*/ } // @@ -2967,8 +2967,6 @@ void G_DoReborn(INT32 playernum) P_LoadThingsOnly(); - P_ClearStarPost(player->starpostnum); - // Do a wipe wipegamestate = -1; diff --git a/src/m_cheat.c b/src/m_cheat.c index 99b96d991..e57a85ae2 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -377,7 +377,7 @@ void Command_Hurtme_f(void) } // Moves the NiGHTS player to another axis within the current mare -void Command_JumpToAxis_f(void) +/*void Command_JumpToAxis_f(void) { REQUIRE_DEVMODE; REQUIRE_INLEVEL; @@ -438,7 +438,7 @@ void Command_Charspeed_f(void) players[consoleplayer].actionspd = atoi(COM_Argv(2))< : set character speed\n")); -} +}*/ void Command_RTeleport_f(void) { @@ -683,7 +683,7 @@ void Command_Savecheckpoint_f(void) } // Like M_GetAllEmeralds() but for console devmode junkies. -void Command_Getallemeralds_f(void) +/*void Command_Getallemeralds_f(void) { REQUIRE_SINGLEPLAYER; REQUIRE_NOULTIMATE; @@ -702,7 +702,7 @@ void Command_Resetemeralds_f(void) emeralds = 0; CONS_Printf(M_GetText("Emeralds reset to zero.\n")); -} +}*/ void Command_Devmode_f(void) { @@ -730,7 +730,7 @@ void Command_Devmode_f(void) G_SetGameModified(multiplayer); } -void Command_Setrings_f(void) +/*void Command_Setrings_f(void) { REQUIRE_INLEVEL; REQUIRE_SINGLEPLAYER; @@ -785,7 +785,7 @@ void Command_Setcontinues_f(void) G_SetGameModified(multiplayer); } -} +}*/ // // OBJECTPLACE (and related variables) diff --git a/src/m_cheat.h b/src/m_cheat.h index 951c7a16a..3b5a1d0fb 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -48,18 +48,18 @@ void Command_CheatNoClip_f(void); void Command_CheatGod_f(void); void Command_CheatNoTarget_f(void); void Command_Savecheckpoint_f(void); -void Command_Getallemeralds_f(void); +/*void Command_Getallemeralds_f(void); void Command_Resetemeralds_f(void); void Command_Setrings_f(void); void Command_Setlives_f(void); -void Command_Setcontinues_f(void); +void Command_Setcontinues_f(void);*/ void Command_Devmode_f(void); void Command_Scale_f(void); void Command_Gravflip_f(void); void Command_Hurtme_f(void); -void Command_JumpToAxis_f(void); +/*void Command_JumpToAxis_f(void); void Command_Charability_f(void); -void Command_Charspeed_f(void); +void Command_Charspeed_f(void);*/ void Command_Teleport_f(void); void Command_RTeleport_f(void); void Command_Skynum_f(void); diff --git a/src/p_inter.c b/src/p_inter.c index 4a120a42a..23c6ffbd3 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -96,55 +96,6 @@ void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End) // GET STUFF // -/** Makes sure all previous starposts are cleared. - * For instance, hitting starpost 5 will clear starposts 1 through 4, even if - * you didn't touch them. This is how the classic games work, although it can - * lead to bizarre situations on levels that allow you to make a circuit. - * - * \param postnum The number of the starpost just touched. - */ -void P_ClearStarPost(INT32 postnum) -{ - thinker_t *th; - mobj_t *mo2; - - // scan the thinkers - for (th = thinkercap.next; th != &thinkercap; th = th->next) - { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - mo2 = (mobj_t *)th; - - if (mo2->type == MT_STARPOST && mo2->health <= postnum) - P_SetMobjState(mo2, mo2->info->seestate); - } - return; -} - -// -// P_ResetStarposts -// -// Resets all starposts back to their spawn state, used on A_Mixup and some other things. -// -void P_ResetStarposts(void) -{ - // Search through all the thinkers. - thinker_t *th; - mobj_t *post; - - for (th = thinkercap.next; th != &thinkercap; th = th->next) - { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - post = (mobj_t *)th; - - if (post->type == MT_STARPOST) - P_SetMobjState(post, post->info->spawnstate); - } -} - // // P_CanPickupItem // @@ -299,14 +250,14 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (heightcheck) { - if (special->type == MT_FLINGEMERALD) // little hack here... + /*if (special->type == MT_FLINGEMERALD) // little hack here... { // flingemerald sprites are low to the ground, so extend collision radius down some. if (toucher->z > (special->z + special->height)) return; if (special->z - special->height > (toucher->z + toucher->height)) return; } - else + else*/ { if (toucher->momz < 0) { if (toucher->z + toucher->momz > special->z + special->height) @@ -341,7 +292,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (special->flags & MF_BOSS) { - if (special->type == MT_BLACKEGGMAN) + /*if (special->type == MT_BLACKEGGMAN) { P_DamageMobj(toucher, special, special, 1); // ouch return; @@ -357,7 +308,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) toucher->momy = -toucher->momy; P_DamageMobj(special, toucher, toucher, 1); } - /* else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP)) || (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) && player->charability == CA_FLY @@ -368,8 +318,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_DamageMobj(special, toucher, toucher, 1); } - */ // SRB2kart - Removed: No more fly states - else + // SRB2kart - Removed: No more fly states + else*/ P_DamageMobj(toucher, special, special, 1); return; @@ -379,7 +329,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) //////////////////////////////////////////////////////// /////ENEMIES!!////////////////////////////////////////// //////////////////////////////////////////////////////// - if (special->type == MT_GSNAPPER && !(((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) + /*if (special->type == MT_GSNAPPER && !(((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) || player->powers[pw_invulnerability] || player->powers[pw_super]) && toucher->z < special->z + special->height && toucher->z + toucher->height > special->z) { @@ -401,7 +351,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_DamageMobj(special, toucher, toucher, 1); } - /* else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP)) || (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) // Flame is bad at logic - JTE && player->charability == CA_FLY @@ -413,8 +362,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_DamageMobj(special, toucher, toucher, 1); } - */ // SRB2kart - Removed: No more fly states - else + // SRB2kart - Removed: No more fly states + else*/ P_DamageMobj(toucher, special, special, 1); return; @@ -843,7 +792,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // ********************************** // // NiGHTS gameplay items and powerups // // ********************************** // - case MT_NIGHTSDRONE: + /*case MT_NIGHTSDRONE: if (player->bot) return; if (player->exiting) @@ -1034,7 +983,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Clear text player->texttimer = 0; - return; + return;*/ case MT_NIGHTSBUMPER: // Don't trigger if the stage is ended/failed if (player->exiting) @@ -1102,7 +1051,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } } return; - case MT_NIGHTSSUPERLOOP: + /*case MT_NIGHTSSUPERLOOP: if (player->bot || !(player->pflags & PF_NIGHTSMODE)) return; if (!G_IsSpecialStage(gamemap)) @@ -1235,7 +1184,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) HU_SetCEchoDuration(4); HU_DoCEcho(M_GetText("\\\\\\\\\\\\\\\\Link Freeze")); } - break; + break;*/ case MT_NIGHTSWING: if (G_IsSpecialStage(gamemap) && useNightsSS) { // Pseudo-ring. @@ -1387,35 +1336,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->starpostangle = special->angle; player->starpostnum = special->health; player->starpostcount++; - P_ClearStarPost(special->health); - // Find all starposts in the level with this value. - { - thinker_t *th; - mobj_t *mo2; - - for (th = thinkercap.next; th != &thinkercap; th = th->next) - { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - mo2 = (mobj_t *)th; - - if (mo2 == special) - continue; - - if (mo2->type == MT_STARPOST && mo2->health == special->health) - { - if (!(netgame && circuitmap && player != &players[consoleplayer])) - P_SetMobjState(mo2, mo2->info->painstate); - } - } - } - - S_StartSound(toucher, special->info->painsound); - - if (!(netgame && circuitmap && player != &players[consoleplayer])) - P_SetMobjState(special, special->info->painstate); + //S_StartSound(toucher, special->info->painsound); return; case MT_FAKEMOBILE: @@ -1914,7 +1836,7 @@ void P_CheckTimeLimit(void) //Tagmode round end but only on the tic before the //XD_EXITLEVEL packet is received by all players. - if (G_TagGametype()) + /*if (G_TagGametype()) { if (leveltime == (timelimitintics + 1)) { @@ -1931,7 +1853,7 @@ void P_CheckTimeLimit(void) } //Optional tie-breaker for Match/CTF - else if (cv_overtime.value) + else*/ if (cv_overtime.value) { INT32 playerarray[MAXPLAYERS]; INT32 tempplayer = 0; @@ -2064,7 +1986,7 @@ void P_CheckPointLimit(void) /*Checks for untagged remaining players in both tag derivitave modes. *If no untagged players remain, end the round. *Also serves as error checking if the only IT player leaves.*/ -void P_CheckSurvivors(void) +/*void P_CheckSurvivors(void) { INT32 i; INT32 survivors = 0; @@ -2144,7 +2066,7 @@ void P_CheckSurvivors(void) if (server) SendNetXCmd(XD_EXITLEVEL, NULL, 0); } -} +}*/ // Checks whether or not to end a race netgame. boolean P_CheckRacers(void) @@ -2444,7 +2366,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) localaiming4 = 0; //tag deaths handled differently in suicide cases. Don't count spectators! - if (G_TagGametype() + /*if (G_TagGametype() && !(target->player->pflags & PF_TAGIT) && (!source || !source->player) && !(target->player->spectator)) { // if you accidentally die before you run out of time to hide, ignore it. @@ -2478,7 +2400,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) } } } - else if (G_BattleGametype()) + else*/ if (G_BattleGametype()) K_CheckBumpers(); target->player->kartstuff[k_pogospring] = 0; @@ -2841,7 +2763,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou } // The tag occurs so long as you aren't shooting another tagger with friendlyfire on. - if (source->player->pflags & PF_TAGIT && !(player->pflags & PF_TAGIT)) + /*if (source->player->pflags & PF_TAGIT && !(player->pflags & PF_TAGIT)) { P_AddPlayerScore(source->player, 1); //award points to tagger. P_HitDeathMessages(player, inflictor, source); @@ -2859,7 +2781,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou //checks if tagger has tagged all players, if so, end round early. P_CheckSurvivors(); - } + }*/ P_DoPlayerPain(player, source, inflictor); diff --git a/src/p_local.h b/src/p_local.h index 51676a2c3..30bf38511 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -172,7 +172,7 @@ void P_PlayerThink(player_t *player); void P_PlayerAfterThink(player_t *player); void P_DoPlayerExit(player_t *player); void P_DoTimeOver(player_t *player); -void P_NightserizePlayer(player_t *player, INT32 ptime); +//void P_NightserizePlayer(player_t *player, INT32 ptime); void P_InstaThrust(mobj_t *mo, angle_t angle, fixed_t move); fixed_t P_ReturnThrustX(mobj_t *mo, angle_t angle, fixed_t move); @@ -185,12 +185,12 @@ void P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in //boolean P_SuperReady(player_t *player); void P_DoJump(player_t *player, boolean soundandstate); boolean P_AnalogMove(player_t *player); -boolean P_TransferToNextMare(player_t *player); -UINT8 P_FindLowestMare(void); +/*boolean P_TransferToNextMare(player_t *player); +UINT8 P_FindLowestMare(void);*/ UINT8 P_FindLowestLap(void); UINT8 P_FindHighestLap(void); void P_FindEmerald(void); -void P_TransferToAxis(player_t *player, INT32 axisnum); +//void P_TransferToAxis(player_t *player, INT32 axisnum); boolean P_PlayerMoving(INT32 pnum); void P_SpawnThokMobj(player_t *player); void P_SpawnSpinMobj(player_t *player, mobjtype_t type); @@ -406,12 +406,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck); void P_PlayerFlagBurst(player_t *player, boolean toss); void P_CheckTimeLimit(void); void P_CheckPointLimit(void); -void P_CheckSurvivors(void); +//void P_CheckSurvivors(void); boolean P_CheckRacers(void); -void P_ClearStarPost(INT32 postnum); -void P_ResetStarposts(void); - boolean P_CanPickupItem(player_t *player, UINT8 weapon); void P_DoNightsScore(player_t *player); diff --git a/src/p_map.c b/src/p_map.c index b249f3628..0b4d8225e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -469,7 +469,7 @@ static boolean PIT_CheckThing(mobj_t *thing) #endif // Metal Sonic destroys tiny baby objects. - if (tmthing->type == MT_METALSONIC_RACE + /*if (tmthing->type == MT_METALSONIC_RACE && (thing->flags & (MF_MISSILE|MF_ENEMY|MF_BOSS) || thing->type == MT_SPIKE)) { if ((thing->flags & (MF_ENEMY|MF_BOSS)) && (thing->health <= 0 || !(thing->flags & MF_SHOOTABLE))) @@ -495,7 +495,7 @@ static boolean PIT_CheckThing(mobj_t *thing) P_KillMobj(thing, tmthing, tmthing); } return true; - } + }*/ if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE)) || (thing->flags & MF_NOCLIPTHING)) return true; @@ -647,9 +647,9 @@ static boolean PIT_CheckThing(mobj_t *thing) // check for skulls slamming into things if (tmthing->flags2 & MF2_SKULLFLY) { - if (tmthing->type == MT_EGGMOBILE) // Don't make Eggman stop! + /*if (tmthing->type == MT_EGGMOBILE) // Don't make Eggman stop! return true; // Let him RUN YOU RIGHT OVER. >:3 - else + else*/ { // see if it went over / under if (tmthing->z > thing->z + thing->height) @@ -1133,7 +1133,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; // Missiles ignore Brak's helper. - if (thing->type == MT_BLACKEGGMAN_HELPER) + /*if (thing->type == MT_BLACKEGGMAN_HELPER) return true; // Hurting Brak @@ -1144,9 +1144,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (!(thing->state >= &states[S_BLACKEGG_PAIN1] && thing->state <= &states[S_BLACKEGG_PAIN35])) P_SetMobjState(thing, thing->info->painstate); return false; - } + }*/ - if (!(thing->flags & MF_SHOOTABLE) && !(thing->type == MT_EGGSHIELD)) + if (!(thing->flags & MF_SHOOTABLE)/* && !(thing->type == MT_EGGSHIELD)*/) { // didn't do any damage return !(thing->flags & MF_SOLID); @@ -1157,7 +1157,7 @@ static boolean PIT_CheckThing(mobj_t *thing) && thing->player->pflags & PF_CARRIED && thing->tracer == tmthing->target) return true; // Don't give rings to your carry player by accident. - if (thing->type == MT_EGGSHIELD) + /*if (thing->type == MT_EGGSHIELD) { fixed_t touchx, touchy; angle_t angle; @@ -1183,14 +1183,14 @@ static boolean PIT_CheckThing(mobj_t *thing) P_KillMobj(thing, tmthing, tmthing); return false; } - } + }*/ if (tmthing->type == MT_SHELL && tmthing->threshold > TICRATE) return true; // damage / explode if (tmthing->flags & MF_ENEMY) // An actual ENEMY! (Like the deton, for example) P_DamageMobj(thing, tmthing, tmthing, 1); - else if (tmthing->type == MT_BLACKEGGMAN_MISSILE && thing->player + /*else if (tmthing->type == MT_BLACKEGGMAN_MISSILE && thing->player && (thing->player->pflags & PF_JUMPED) && !thing->player->powers[pw_flashing] && thing->tracer != tmthing @@ -1230,16 +1230,13 @@ static boolean PIT_CheckThing(mobj_t *thing) tmthing->x = thing->x; tmthing->y = thing->y; P_SetThingPosition(tmthing); - } + }*/ else P_DamageMobj(thing, tmthing, tmthing->target, 1); // don't traverse any more - if (tmthing->type == MT_SHELL) - return true; - else - return false; + return (tmthing->type == MT_SHELL); } if (thing->flags & MF_PUSHABLE && (tmthing->player || tmthing->flags & MF_PUSHABLE) @@ -1303,7 +1300,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } // Respawn rings and items - if ((tmthing->type == MT_NIGHTSDRONE || thing->type == MT_NIGHTSDRONE) + /*if ((tmthing->type == MT_NIGHTSDRONE || thing->type == MT_NIGHTSDRONE) && (tmthing->player || thing->player)) { mobj_t *droneobj = (tmthing->type == MT_NIGHTSDRONE) ? tmthing : thing; @@ -1323,7 +1320,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } droneobj->extravalue1 = pl->anotherflyangle; droneobj->extravalue2 = (INT32)leveltime + TICRATE; - } + }*/ // check for special pickup if (thing->flags & MF_SPECIAL && tmthing->player && thing->type != MT_POKEY) @@ -1394,7 +1391,7 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (thing->scale > tmthing->scale + (FRACUNIT/8)) K_SquishPlayer(tmthing->player, thing); - // SRB2kart - Starpower! + // SRB2kart - Invincibility! if (tmthing->player->kartstuff[k_invincibilitytimer] && !thing->player->kartstuff[k_invincibilitytimer]) P_DamageMobj(thing, tmthing, tmthing, 1); else if (thing->player->kartstuff[k_invincibilitytimer] && !tmthing->player->kartstuff[k_invincibilitytimer]) @@ -1440,7 +1437,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player) { // Doesn't matter what gravity player's following! Just do your stuff in YOUR direction only - if (tmthing->eflags & MFE_VERTICALFLIP + /*if (tmthing->eflags & MFE_VERTICALFLIP && (tmthing->z + tmthing->height + tmthing->momz < thing->z || tmthing->z + tmthing->height + tmthing->momz >= thing->z + thing->height)) ; @@ -1462,7 +1459,7 @@ static boolean PIT_CheckThing(mobj_t *thing) // The tmthing->target allows the pusher of the object // to get the point if he topples it on an opponent. } - } + }*/ if (tmthing->type == MT_FAN || tmthing->type == MT_STEAM) P_DoFanAndGasJet(tmthing, thing); @@ -1585,9 +1582,9 @@ static boolean PIT_CheckThing(mobj_t *thing) ; // Fix a few nasty spring-jumping bugs that happen sometimes. // Monitors are not treated as solid to players who are jumping, spinning or gliding, // unless it's a CTF team monitor and you're on the wrong team - else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) + /*else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) && !((thing->type == MT_REDRINGBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_BLUERINGBOX && tmthing->player->ctfteam != 2))) - ; + ;*/ // z checking at last // Treat noclip things as non-solid! else if ((thing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID diff --git a/src/p_mobj.c b/src/p_mobj.c index d22d5cb61..deeb737d8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -495,7 +495,7 @@ boolean P_WeaponOrPanel(mobjtype_t type) // // Power Stone emerald management // -void P_EmeraldManager(void) +/*void P_EmeraldManager(void) { thinker_t *think; mobj_t *mo; @@ -664,7 +664,7 @@ void P_EmeraldManager(void) break; } } -} +}*/ // // P_ExplodeMissile diff --git a/src/p_setup.c b/src/p_setup.c index 6c7b6e927..98be24805 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2865,7 +2865,6 @@ boolean P_SetupLevel(boolean skipprecip) if (players[i].starposttime) { G_SpawnPlayer(i, true); - P_ClearStarPost(players[i].starpostnum); } else G_SpawnPlayer(i, false); diff --git a/src/p_spec.c b/src/p_spec.c index 17cd1f886..bce18999b 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1707,16 +1707,16 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (actor && actor->player && triggerline->flags & ML_EFFECT4) { - if (maptol & TOL_NIGHTS) + /*if (maptol & TOL_NIGHTS) lap = actor->player->mare; - else + else*/ lap = actor->player->laps; } else { - if (maptol & TOL_NIGHTS) + /*if (maptol & TOL_NIGHTS) lap = P_FindLowestMare(); - else + else*/ lap = P_FindLowestLap(); } @@ -4252,7 +4252,6 @@ DoneSection2: // //player->starpostangle = player->starposttime = player->starpostnum = 0; //player->starpostx = player->starposty = player->starpostz = 0; - P_ResetStarposts(); // Play the starpost sound for 'consistency' // S_StartSound(player->mo, sfx_strpst); diff --git a/src/p_telept.c b/src/p_telept.c index 695736403..89a28ddce 100644 --- a/src/p_telept.c +++ b/src/p_telept.c @@ -96,10 +96,6 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, thing->player->starpostangle = starpostangle; thing->player->starpostnum = starpostnum; - // Reset map starposts for the player's new info. - P_ResetStarposts(); - P_ClearStarPost(starpostnum); - P_ResetPlayer(thing->player); P_SetPlayerMobjState(thing, S_KART_STND1); // SRB2kart - was S_PLAY_STND diff --git a/src/p_tick.c b/src/p_tick.c index 3c5ed0b9e..bbb90f639 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -310,7 +310,7 @@ static inline void P_RunThinkers(void) // // Determine if the teams are unbalanced, and if so, move a player to the other team. // -static void P_DoAutobalanceTeams(void) +/*static void P_DoAutobalanceTeams(void) { changeteam_union NetPacket; UINT16 usvalue; @@ -562,7 +562,7 @@ static inline void P_DoCTFStuff(void) if (cv_teamscramble.value && server) P_DoTeamscrambling(); } -} +}*/ // // P_Ticker @@ -612,11 +612,11 @@ void P_Ticker(boolean run) if (!demoplayback) // Don't increment if a demo is playing. totalplaytime++; - if (!useNightsSS && G_IsSpecialStage(gamemap)) + /*if (!useNightsSS && G_IsSpecialStage(gamemap)) P_DoSpecialStageStuff(); if (runemeraldmanager) - P_EmeraldManager(); // Power stone mode + P_EmeraldManager(); // Power stone mode*/ if (run) { @@ -633,7 +633,7 @@ void P_Ticker(boolean run) } // Run shield positioning - P_RunShields(); + //P_RunShields(); P_RunOverlays(); P_RunShadows(); @@ -648,11 +648,11 @@ void P_Ticker(boolean run) leveltime++; timeinmap++; - if (G_TagGametype()) + /*if (G_TagGametype()) P_DoTagStuff(); if (G_GametypeHasTeams()) - P_DoCTFStuff(); + P_DoCTFStuff();*/ if (run) { @@ -793,7 +793,7 @@ void P_PreTicker(INT32 frames) #endif // Run shield positioning - P_RunShields(); + //P_RunShields(); P_RunOverlays(); P_UpdateSpecials(); diff --git a/src/p_user.c b/src/p_user.c index d3407bd65..502670549 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -344,7 +344,7 @@ void P_ResetScore(player_t *player) // // Returns the lowest open mare available // -UINT8 P_FindLowestMare(void) +/*UINT8 P_FindLowestMare(void) { thinker_t *th; mobj_t *mo2; @@ -375,7 +375,7 @@ UINT8 P_FindLowestMare(void) CONS_Debug(DBG_NIGHTS, "Lowest mare found: %d\n", mare); return mare; -} +}*/ // // P_FindLowestLap @@ -438,7 +438,7 @@ UINT8 P_FindHighestLap(void) // (Finds the lowest mare # for capsules that have not been destroyed). // Returns true if successful, false if there is no other mare. // -boolean P_TransferToNextMare(player_t *player) +/*boolean P_TransferToNextMare(player_t *player) { thinker_t *th; mobj_t *mo2; @@ -759,7 +759,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) if (G_IsSpecialStage(gamemap)) { for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i]/* && players[i].pflags & PF_NIGHTSMODE*/) + if (playeringame[i]) total_rings += players[i].health-1; } @@ -782,10 +782,6 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) P_AddPlayerScore(&players[i], (players[i].health - 1) * 50); } - // Add score to leaderboards now - /*if (!(netgame||multiplayer) && P_IsLocalPlayer(&players[i])) - G_AddTempNightsRecords(players[i].marescore, leveltime - player->marebegunat, players[i].mare + 1);*/ - // transfer scores anyway players[i].mo->health = players[i].health = 1; @@ -803,10 +799,6 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->textvar = 4; // Score and grades player->finishedrings = (INT16)(player->health - 1); - // Add score to temp leaderboards - /*if (!(netgame||multiplayer) && P_IsLocalPlayer(player)) - G_AddTempNightsRecords(player->marescore, leveltime - player->marebegunat, (UINT8)(oldmare + 1));*/ - // Starting a new mare, transfer scores player->marebegunat = leveltime; @@ -824,7 +816,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) } player->pflags |= PF_NIGHTSMODE; -} +}*/ // // P_PlayerInPain @@ -4536,7 +4528,7 @@ INT32 P_GetPlayerControlDirection(player_t *player) } // Control scheme for 2d levels. -static void P_2dMovement(player_t *player) +/*static void P_2dMovement(player_t *player) { ticcmd_t *cmd; INT32 topspeed, acceleration, thrustfactor; @@ -4713,7 +4705,7 @@ static void P_2dMovement(player_t *player) else if (player->rmomx > -topspeed && cmd->sidemove < 0) P_Thrust(player->mo, movepushangle, movepushforward); } -} +}*/ //#define OLD_MOVEMENT_CODE 1 static void P_3dMovement(player_t *player) @@ -5004,7 +4996,7 @@ static void P_SpectatorMovement(player_t *player) // graphical indicator // for building/debugging // NiGHTS levels! -static void P_ShootLine(mobj_t *source, mobj_t *dest, fixed_t height) +/*static void P_ShootLine(mobj_t *source, mobj_t *dest, fixed_t height) { mobj_t *mo; INT32 i; @@ -5578,16 +5570,6 @@ static void P_DoNiGHTSCapsule(player_t *player) UINT8 em = P_GetNextEmerald(); tic_t lowest_time; - /*for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || players[i].spectator || !players[i].mo || !players[i].mo->tracer) - continue; - - emmo = P_SpawnMobj(players[i].mo->x, players[i].mo->y, players[i].mo->z + players[i].mo->info->height, MT_GOTEMERALD); - P_SetTarget(&emmo->target, players[i].mo); - P_SetMobjState(emmo, mobjinfo[MT_GOTEMERALD].meleestate + em); - }*/ - if (player->mo->tracer) { // Only give it to ONE person, and THAT player has to get to the goal! @@ -5683,7 +5665,7 @@ static void P_NiGHTSMovement(player_t *player) boolean capsule = false; // NiGHTS special stages have a pseudo-shared timer, so check if ANYONE is feeding the capsule. for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] /*&& players[i].pflags & PF_NIGHTSMODE*/ + if (playeringame[i] && (players[i].capsule && players[i].capsule->reactiontime)) capsule = true; if (!capsule @@ -6238,7 +6220,7 @@ static void P_NiGHTSMovement(player_t *player) if (objectplacing) OP_NightsObjectplace(player); -} +}*/ // May be used in future for CTF #if 0 @@ -6457,7 +6439,7 @@ void P_ElementalFireTrail(player_t *player) static void P_MovePlayer(player_t *player) { ticcmd_t *cmd; - INT32 i; + //INT32 i; fixed_t runspd; @@ -6532,7 +6514,7 @@ static void P_MovePlayer(player_t *player) } // Locate the capsule for this mare. - else if (maptol & TOL_NIGHTS) + /*else if (maptol & TOL_NIGHTS) { if (!player->capsule && !player->bonustime) { @@ -6585,15 +6567,15 @@ static void P_MovePlayer(player_t *player) P_DamageMobj(player->mo, NULL, NULL, 1); player->pflags &= ~PF_NIGHTSFALL; } - } + }*/ ////////////////////// // MOVEMENT CODE // ////////////////////// - if (twodlevel || player->mo->flags2 & MF2_TWOD) // 2d-level, so special control applies. + /*if (twodlevel || player->mo->flags2 & MF2_TWOD) // 2d-level, so special control applies. P_2dMovement(player); - else + else*/ { if (!player->climbing && (!P_AnalogMove(player))) player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */); @@ -9441,8 +9423,8 @@ void P_PlayerThink(player_t *player) player->losstime--; // Flash player after being hit. - if (!(player->pflags & PF_NIGHTSMODE - || player->kartstuff[k_hyudorotimer] // SRB2kart - fixes Hyudoro not flashing when it should. + if (!(//player->pflags & PF_NIGHTSMODE || + player->kartstuff[k_hyudorotimer] // SRB2kart - fixes Hyudoro not flashing when it should. || player->kartstuff[k_growshrinktimer] > 0 // Grow doesn't flash either. || player->kartstuff[k_respawn] // Respawn timer (for drop dash effect) || (G_BattleGametype() && player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) @@ -9454,13 +9436,13 @@ void P_PlayerThink(player_t *player) else player->mo->flags2 &= ~MF2_DONTDRAW; } - else if (player->mo->tracer) + /*else if (player->mo->tracer) { if (player->powers[pw_flashing] & 1) player->mo->tracer->flags2 |= MF2_DONTDRAW; else player->mo->tracer->flags2 &= ~MF2_DONTDRAW; - } + }*/ player->pflags &= ~PF_SLIDING; diff --git a/src/y_inter.c b/src/y_inter.c index e26d49737..3228f8a3d 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -560,13 +560,13 @@ void Y_Ticker(void) // Team scramble code for team match and CTF. // Don't do this if we're going to automatically scramble teams next round. - if (G_GametypeHasTeams() && cv_teamscramble.value && !cv_scrambleonchange.value && server) + /*if (G_GametypeHasTeams() && cv_teamscramble.value && !cv_scrambleonchange.value && server) { // If we run out of time in intermission, the beauty is that // the P_Ticker() team scramble code will pick it up. if ((intertic % (TICRATE/7)) == 0) P_DoTeamscrambling(); - } + }*/ // multiplayer uses timer (based on cv_inttime) if (timer) From 7032b2773ad87e7d22baea32f46ef26b44eb52c1 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 3 Oct 2018 17:14:25 +0100 Subject: [PATCH 18/33] Complete the disabling of the traditional shield mechanism (oversight from initial commit). --- src/p_local.h | 2 +- src/p_mobj.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 30bf38511..5fd37248c 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -231,7 +231,7 @@ boolean P_MobjWasRemoved(mobj_t *th); void P_RemoveSavegameMobj(mobj_t *th); boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state); boolean P_SetMobjState(mobj_t *mobj, statenum_t state); -void P_RunShields(void); +//void P_RunShields(void); void P_RunOverlays(void); void P_RunShadows(void); void P_MobjThinker(mobj_t *mobj); diff --git a/src/p_mobj.c b/src/p_mobj.c index deeb737d8..ed794b0f4 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6127,7 +6127,7 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) return true; } -mobj_t *shields[MAXPLAYERS*2]; +/*mobj_t *shields[MAXPLAYERS*2]; INT32 numshields = 0; void P_RunShields(void) @@ -6175,7 +6175,7 @@ static boolean P_AddShield(mobj_t *thing) P_SetTarget(&shields[numshields++], thing); return true; -} +}*/ void P_RunOverlays(void) { @@ -6609,8 +6609,8 @@ void P_MobjThinker(mobj_t *mobj) P_RemoveMobj(mobj); return; } - else - P_AddOverlay(mobj); + + P_AddOverlay(mobj); break; case MT_SHADOW: if (!mobj->target) @@ -6618,10 +6618,10 @@ void P_MobjThinker(mobj_t *mobj) P_RemoveMobj(mobj); return; } - else - P_AddShadow(mobj); + + P_AddShadow(mobj); break; - case MT_BLACKORB: + /*case MT_BLACKORB: case MT_WHITEORB: case MT_GREENORB: case MT_YELLOWORB: @@ -6629,7 +6629,7 @@ void P_MobjThinker(mobj_t *mobj) case MT_PITYORB: if (!P_AddShield(mobj)) return; - break; + break;*/ //{ SRB2kart mobs case MT_ORBINAUT_SHIELD: // Kart orbit/trail items case MT_JAWZ_SHIELD: From 6691f3911756f4a22002e2ccec3ec5b7c26a8bb6 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 3 Oct 2018 17:16:23 +0100 Subject: [PATCH 19/33] Incorrect comment starting location. --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index ed794b0f4..b0aba1ec9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6059,7 +6059,7 @@ static void P_NightsItemChase(mobj_t *thing) P_Attract(thing, thing->tracer, true); } -static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) +/*static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) { if (!thing->target || thing->target->health <= 0 || !thing->target->player || (thing->target->player->powers[pw_shield] & SH_NOSTACK) == SH_NONE || thing->target->player->powers[pw_super] @@ -6127,7 +6127,7 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) return true; } -/*mobj_t *shields[MAXPLAYERS*2]; +mobj_t *shields[MAXPLAYERS*2]; INT32 numshields = 0; void P_RunShields(void) From cdc6a87ada3bdb2f2ed22b62bae32eac9b6a2862 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 3 Oct 2018 17:26:56 +0100 Subject: [PATCH 20/33] Improve A_MineExplode. * Re-order the conditions within it such that it quickly checks for shootability and absence of scenery BEFORE it performs the more costly range or parentage checks. * Make its explosion radius take mapscale into account. (This is the only off-topic change made in this branch. I have made it here because half of this commit, which doing the other half in a seperate branch would conflict with, is on-topic.) --- src/p_enemy.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 7cdc354de..8073a2c24 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8247,12 +8247,14 @@ void A_MineExplode(mobj_t *actor) INT32 d; INT32 locvar1 = var1; mobjtype_t type; + fixed_t range; #ifdef HAVE_BLUA if (LUA_CallAction("A_MineExplode", actor)) return; #endif type = (mobjtype_t)locvar1; + range = FixedMul(actor->info->painchance, mapheaderinfo[gamemap-1]->mobj_scale); for (th = thinkercap.next; th != &thinkercap; th = th->next) { @@ -8267,27 +8269,25 @@ void A_MineExplode(mobj_t *actor) if (mo2 == actor || mo2->type == MT_MINEEXPLOSIONSOUND) // Don't explode yourself! Endless loop! continue; + if (!(mo2->flags & MF_SHOOTABLE) || (mo2->flags & MF_SCENERY)) + continue; + if (G_BattleGametype() && actor->target && actor->target->player && actor->target->player->kartstuff[k_bumper] <= 0 && mo2 == actor->target) continue; - if (P_AproxDistance(P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > actor->info->painchance) + if (P_AproxDistance(P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > range) continue; - if ((mo2->flags & MF_SHOOTABLE) && !(mo2->flags & MF_SCENERY)) - { - actor->flags2 |= MF2_DEBRIS; + actor->flags2 |= MF2_DEBRIS; - if (mo2->player) // Looks like we're going to have to need a seperate function for this too - K_ExplodePlayer(mo2->player, actor->target); - else - P_DamageMobj(mo2, actor, actor->target, 1); - - continue; - } + if (mo2->player) // Looks like we're going to have to need a seperate function for this too + K_ExplodePlayer(mo2->player, actor->target); + else + P_DamageMobj(mo2, actor, actor->target, 1); } for (d = 0; d < 16; d++) - K_SpawnKartExplosion(actor->x, actor->y, actor->z, actor->info->painchance + 32*FRACUNIT, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64 + K_SpawnKartExplosion(actor->x, actor->y, actor->z, range + 32*mapheaderinfo[gamemap-1]->mobj_scale, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64 if (actor->target && actor->target->player) K_SpawnMineExplosion(actor, actor->target->player->skincolor); From 9e2e7e553d81fad629edabd0b586bd1a49bc1b82 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 3 Oct 2018 20:23:59 +0100 Subject: [PATCH 21/33] Update A_GrenadeRing to also take the mapheader scale into account. --- src/p_enemy.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 8073a2c24..28dcf7b95 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3913,6 +3913,7 @@ void A_ThrownRing(mobj_t *actor) //{ SRB2kart - A_GRENADERING static mobj_t *grenade; +static fixed_t explodedist; static inline boolean PIT_GrenadeRing(mobj_t *thing) { @@ -3935,9 +3936,9 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing) return true; // see if it went over / under - if (grenade->z - grenade->info->painchance > thing->z + thing->height) + if (grenade->z - explodedist > thing->z + thing->height) return true; // overhead - if (grenade->z + grenade->height + grenade->info->painchance < thing->z) + if (grenade->z + grenade->height + explodedist < thing->z) return true; // underneath if (netgame && thing->player && thing->player->spectator) @@ -3950,7 +3951,7 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing) } if (P_AproxDistance(P_AproxDistance(thing->x - grenade->x, thing->y - grenade->y), - thing->z - grenade->z) > grenade->info->painchance) + thing->z - grenade->z) > explodedist) return true; // Too far away // Explode! @@ -3961,7 +3962,7 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing) void A_GrenadeRing(mobj_t *actor) { INT32 bx, by, xl, xh, yl, yh; - const fixed_t explodedist = actor->info->painchance; + explodedist = FixedMul(actor->info->painchance, mapheaderinfo[gamemap-1]->mobj_scale); if (leveltime % 35 == 0) S_StartSound(actor, actor->info->activesound); From e94465689edf3cfa5d7be80444a1c28a499853b0 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 3 Oct 2018 20:51:15 +0100 Subject: [PATCH 22/33] * Modify PIT_GrenadeRing to place less-complicated checks near the start of the function. * Add the customary LUA_CallAction call to A_GrenadeRing. * Revamp A_MineExplode into using a blockmap iterator. Having tested it it might be less laggy in some situations, but I think the drawing is causing the bulk of the problems here. --- src/p_enemy.c | 101 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 90 insertions(+), 11 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 28dcf7b95..001b9e547 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3918,11 +3918,20 @@ static fixed_t explodedist; static inline boolean PIT_GrenadeRing(mobj_t *thing) { if (!grenade) - return true; + return false; if (thing->type != MT_PLAYER) // Don't explode for anything but an actual player. return true; + if (!(thing->flags & MF_SHOOTABLE)) + { + // didn't do any damage + return true; + } + + if (netgame && thing->player && thing->player->spectator) + return true; + if (thing == grenade->target && grenade->threshold != 0) // Don't blow up at your owner. return true; @@ -3941,15 +3950,6 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing) if (grenade->z + grenade->height + explodedist < thing->z) return true; // underneath - if (netgame && thing->player && thing->player->spectator) - return true; - - if (!(thing->flags & MF_SHOOTABLE)) - { - // didn't do any damage - return true; - } - if (P_AproxDistance(P_AproxDistance(thing->x - grenade->x, thing->y - grenade->y), thing->z - grenade->z) > explodedist) return true; // Too far away @@ -3963,6 +3963,10 @@ void A_GrenadeRing(mobj_t *actor) { INT32 bx, by, xl, xh, yl, yh; explodedist = FixedMul(actor->info->painchance, mapheaderinfo[gamemap-1]->mobj_scale); +#ifdef HAVE_BLUA + if (LUA_CallAction("A_GrenadeRing", actor)) + return; +#endif if (leveltime % 35 == 0) S_StartSound(actor, actor->info->activesound); @@ -3979,6 +3983,80 @@ void A_GrenadeRing(mobj_t *actor) for (bx = xl; bx <= xh; bx++) P_BlockThingsIterator(bx, by, PIT_GrenadeRing); } + +static inline boolean PIT_MineExplode(mobj_t *thing) +{ + if (!grenade || P_MobjWasRemoved(grenade)) + return false; // There's the possibility these can chain react onto themselves after they've already died if there are enough all in one spot + + if (thing == grenade || thing->type == MT_MINEEXPLOSIONSOUND) // Don't explode yourself! Endless loop! + return true; + + if (!(thing->flags & MF_SHOOTABLE) || (thing->flags & MF_SCENERY)) + return true; + + if (netgame && thing->player && thing->player->spectator) + return true; + + if (G_BattleGametype() && grenade->target && grenade->target->player && grenade->target->player->kartstuff[k_bumper] <= 0 && thing == grenade->target) + return true; + + // see if it went over / under + if (grenade->z - explodedist > thing->z + thing->height) + return true; // overhead + if (grenade->z + grenade->height + explodedist < thing->z) + return true; // underneath + + if (P_AproxDistance(P_AproxDistance(thing->x - grenade->x, thing->y - grenade->y), + thing->z - grenade->z) > explodedist) + return true; // Too far away + + grenade->flags2 |= MF2_DEBRIS; + + if (thing->player) // Looks like we're going to have to need a seperate function for this too + K_ExplodePlayer(thing->player, grenade->target); + else + P_DamageMobj(thing, grenade, grenade->target, 1); + + return true; +} + +void A_MineExplode(mobj_t *actor) +{ + INT32 bx, by, xl, xh, yl, yh; + explodedist = FixedMul(actor->info->painchance, mapheaderinfo[gamemap-1]->mobj_scale); + INT32 d; + INT32 locvar1 = var1; + mobjtype_t type; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_MineExplode", actor)) + return; +#endif + + type = (mobjtype_t)locvar1; + + // Use blockmap to check for nearby shootables + yh = (unsigned)(actor->y + explodedist - bmaporgy)>>MAPBLOCKSHIFT; + yl = (unsigned)(actor->y - explodedist - bmaporgy)>>MAPBLOCKSHIFT; + xh = (unsigned)(actor->x + explodedist - bmaporgx)>>MAPBLOCKSHIFT; + xl = (unsigned)(actor->x - explodedist - bmaporgx)>>MAPBLOCKSHIFT; + + grenade = actor; + + for (by = yl; by <= yh; by++) + for (bx = xl; bx <= xh; bx++) + P_BlockThingsIterator(bx, by, PIT_MineExplode); + + for (d = 0; d < 16; d++) + K_SpawnKartExplosion(actor->x, actor->y, actor->z, explodedist + 32*mapheaderinfo[gamemap-1]->mobj_scale, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64 + + if (actor->target && actor->target->player) + K_SpawnMineExplosion(actor, actor->target->player->skincolor); + else + K_SpawnMineExplosion(actor, SKINCOLOR_RED); + + P_SpawnMobj(actor->x, actor->y, actor->z, MT_MINEEXPLOSIONSOUND); +} //} // Function: A_SetSolidSteam @@ -8241,6 +8319,7 @@ void A_JawzExplode(mobj_t *actor) return; } +/* old A_MineExplode - see elsewhere in the file void A_MineExplode(mobj_t *actor) { mobj_t *mo2; @@ -8298,7 +8377,7 @@ void A_MineExplode(mobj_t *actor) P_SpawnMobj(actor->x, actor->y, actor->z, MT_MINEEXPLOSIONSOUND); return; -} +}*/ void A_BallhogExplode(mobj_t *actor) { From 697d625a41ab06a36be5c13eaad2bbb269cfadf5 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 4 Oct 2018 20:06:55 -0400 Subject: [PATCH 23/33] Foolish --- src/g_game.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index d77d04f86..9b413ee89 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1819,8 +1819,8 @@ boolean G_Responder(event_t *ev) displayplayer = consoleplayer; else { - // spy mode - do + UINT8 i = 0; // spy mode + for (i = 0; i < MAXPLAYERS; i++) { displayplayer++; if (displayplayer == MAXPLAYERS) From 99ce5f5700c35adadb7aa28de3f5981ab53d417f Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 4 Oct 2018 20:08:29 -0400 Subject: [PATCH 24/33] Revert "Attempt to not let the camera into thok barriers" This reverts commit 6f10f15627a1a82a63028255db8466865d9c8e68. --- src/p_map.c | 19 +++++-------------- src/p_mobj.c | 2 -- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 11dda089e..b249f3628 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2181,12 +2181,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) mapcampointer = thiscam; -#ifdef NOCLIPCAM - if (newsubsec->sector->floorheight >= newsubsec->sector->ceilingheight - || newsubsec->sector->ceilingheight <= newsubsec->sector->floorheight) - return false; -#endif - if (GETSECSPECIAL(newsubsec->sector->special, 4) == 12) { // Camera noclip on entire sector. tmfloorz = tmdropoffz = thiscam->z; @@ -2384,15 +2378,12 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) fixed_t tryx = thiscam->x; fixed_t tryy = thiscam->y; -#ifdef NOCLIPCAM - if (!(s->sector->floorheight >= s->sector->ceilingheight - || s->sector->ceilingheight <= s->sector->floorheight)) -#else +#ifndef NOCLIPCAM if ((thiscam == &camera && (players[displayplayer].pflags & PF_NOCLIP)) - || (thiscam == &camera2 && (players[secondarydisplayplayer].pflags & PF_NOCLIP)) - || (thiscam == &camera3 && (players[thirddisplayplayer].pflags & PF_NOCLIP)) - || (thiscam == &camera4 && (players[fourthdisplayplayer].pflags & PF_NOCLIP)) - || (leveltime < introtime)) + || (thiscam == &camera2 && (players[secondarydisplayplayer].pflags & PF_NOCLIP)) + || (thiscam == &camera3 && (players[thirddisplayplayer].pflags & PF_NOCLIP)) + || (thiscam == &camera4 && (players[fourthdisplayplayer].pflags & PF_NOCLIP)) + || (leveltime < introtime)) #endif { // Noclipping player camera noclips too!! floatok = true; diff --git a/src/p_mobj.c b/src/p_mobj.c index 456c0acfa..d22d5cb61 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3702,7 +3702,6 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled { if (!P_TryCameraMove(thiscam->x + thiscam->momx, thiscam->y + thiscam->momy, thiscam)) { // Never fails for 2D mode. -#ifndef NOCLIPCAM mobj_t dummy; dummy.thinker.function.acp1 = (actionf_p1)P_MobjThinker; dummy.subsector = thiscam->subsector; @@ -3713,7 +3712,6 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead. P_ResetCamera(player, thiscam); else -#endif P_SlideCameraMove(thiscam); if (resetcalled) // Okay this means the camera is fully reset. return true; From f1c7eb4907bb517e33768ff7b1f4667e10e174a8 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 4 Oct 2018 22:06:56 -0400 Subject: [PATCH 25/33] Don't allow non-keyboard keys to screenshot/gif in menus --- src/m_misc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/m_misc.c b/src/m_misc.c index 7b176fd90..f1a81bb36 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1481,6 +1481,9 @@ boolean M_ScreenshotResponder(event_t *ev) ch = ev->data1; + if (ch >= KEY_MOUSE1 && menuactive) // If it's not a keyboard key, then don't allow it in the menus! + return false; + if (ch == gamecontrol[gc_screenshot][0] || ch == gamecontrol[gc_screenshot][1]) // remappable F8 M_ScreenShot(); else if (ch == gamecontrol[gc_recordgif][0] || ch == gamecontrol[gc_recordgif][1]) // remappable F9 From 083862b38be25cb60ec4557112ee0d6da0aa9789 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 4 Oct 2018 22:09:12 -0400 Subject: [PATCH 26/33] Scale explosions properly --- src/k_kart.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index 16d1cbce7..0756b307b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2168,6 +2168,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) dust->angle = (ANGLE_180/16) * i; P_SetScale(dust, source->scale); dust->destscale = source->scale*10; + dust->scalespeed = FixedMul(dust->scalespeed, source->scale); P_InstaThrust(dust, dust->angle, FixedMul(20*FRACUNIT, source->scale)); truc = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT, @@ -2175,6 +2176,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMEXPLODE); P_SetScale(truc, source->scale); truc->destscale = source->scale*6; + truc->scalespeed = FixedMul(truc->scalespeed, source->scale); speed = FixedMul(10*FRACUNIT, source->scale)>>FRACBITS; truc->momx = P_RandomRange(-speed, speed)*FRACUNIT; truc->momy = P_RandomRange(-speed, speed)*FRACUNIT; @@ -2190,6 +2192,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) source->z + P_RandomRange(0, height)*FRACUNIT, MT_SMOKE); P_SetScale(dust, source->scale); dust->destscale = source->scale*10; + dust->scalespeed = FixedMul(dust->scalespeed, source->scale); dust->tics = 30; dust->momz = P_RandomRange(FixedMul(3*FRACUNIT, source->scale)>>FRACBITS, FixedMul(7*FRACUNIT, source->scale)>>FRACBITS)*FRACUNIT; @@ -2198,6 +2201,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMPARTICLE); P_SetScale(truc, source->scale); truc->destscale = source->scale*5; + truc->scalespeed = FixedMul(truc->scalespeed, source->scale); speed = FixedMul(20*FRACUNIT, source->scale)>>FRACBITS; truc->momx = P_RandomRange(-speed, speed)*FRACUNIT; truc->momy = P_RandomRange(-speed, speed)*FRACUNIT; From bd812b6ece0ee608bcc35468946ebe906ed5dc40 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 4 Oct 2018 23:58:44 -0400 Subject: [PATCH 27/33] -skill launcher option Requested by Sev(?), for map editing; sets kartspeed using the same name as Doom's difficulty launcher option --- src/d_main.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/d_main.c b/src/d_main.c index e56a631a2..214bfac67 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1484,6 +1484,29 @@ void D_SRB2Main(void) } } + if (M_CheckParm("-skill") && M_IsNextParm()) + { + INT32 j; + INT16 newskill = -1; + const char *sskill = M_GetNextParm(); + + for (j = 0; kartspeed_cons_t[j].strvalue; j++) + if (!strcasecmp(kartspeed_cons_t[j].strvalue, sskill)) + { + newskill = (INT16)kartspeed_cons_t[j].value; + break; + } + if (!kartspeed_cons_t[j].strvalue) // reached end of the list with no match + { + j = atoi(sskill); // assume they gave us a skill number, which is okay too + if (j >= 0 && j <= 2) + newskill = (INT16)j; + } + + if (newskill != -1) + CV_SetValue(&cv_kartspeed, newskill); + } + if (server && !M_CheckParm("+map")) { // Prevent warping to nonexistent levels From 3ed027a4f75c5d41bfd8738ba26a6987307b3603 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 6 Oct 2018 15:13:57 -0400 Subject: [PATCH 28/33] Remove R_DoorClosed This function has caused me, so much unexpected pain because of just how out of the way it is, and NOTHING else uses it --- src/r_bsp.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index 34b082caf..d47c1140c 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -222,30 +222,6 @@ void R_PortalClearClipSegs(INT32 start, INT32 end) newend = solidsegs + 2; } - -// R_DoorClosed -// -// This function is used to fix the automap bug which -// showed lines behind closed doors simply because the door had a dropoff. -// -// It assumes that Doom has already ruled out a door being closed because -// of front-back closure (e.g. front floor is taller than back ceiling). -static INT32 R_DoorClosed(void) -{ - return - - // if door is closed because back is shut: - backsector->ceilingheight <= backsector->floorheight - - // preserve a kind of transparent door/lift special effect: - && (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture) - - && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture) - - // properly render skies (consider door "open" if both ceilings are sky): - && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum); -} - // // If player's view height is underneath fake floor, lower the // drawn ceiling to be just under the floor height, and replace @@ -534,7 +510,11 @@ static void R_AddLine(seg_t *line) } // Check for automap fix. Store in doorclosed for r_segs.c - doorclosed = R_DoorClosed(); + doorclosed = (backsector->ceilingheight <= backsector->floorheight + && (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture) + && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture) + && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); + if (doorclosed) goto clipsolid; From 8d39d4be31c69dfade58f51c24d64f2e58f8a9aa Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 6 Oct 2018 16:22:36 -0400 Subject: [PATCH 29/33] Do clipsolid for doorclosed only while your camera is outside of the sector --- src/r_bsp.c | 55 +++++++++++++++++++++++++------------------- src/r_segs.c | 65 ++++++++++++++++++++++++++++------------------------ 2 files changed, 66 insertions(+), 54 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index d47c1140c..da9ad6656 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -374,6 +374,7 @@ static void R_AddLine(seg_t *line) INT32 x1, x2; angle_t angle1, angle2, span, tspan; static sector_t tempsec; // ceiling/water hack + sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) return; @@ -478,21 +479,24 @@ static void R_AddLine(seg_t *line) SLOPEPARAMS( backsector->f_slope, backf1, backf2, backsector->floorheight) SLOPEPARAMS( backsector->c_slope, backc1, backc2, backsector->ceilingheight) #undef SLOPEPARAMS - if ((backc1 <= frontf1 && backc2 <= frontf2) - || (backf1 >= frontc1 && backf2 >= frontc2)) + if (thissec != backsector && thissec != frontsector) { - goto clipsolid; + if ((backc1 <= frontf1 && backc2 <= frontf2) + || (backf1 >= frontc1 && backf2 >= frontc2)) + { + goto clipsolid; + } + + // Check for automap fix. Store in doorclosed for r_segs.c + doorclosed = (backc1 <= backf1 && backc2 <= backf2 + && ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture) + && ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture) + && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); + + if (doorclosed) + goto clipsolid; } - // Check for automap fix. Store in doorclosed for r_segs.c - doorclosed = (backc1 <= backf1 && backc2 <= backf2 - && ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture) - && ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture) - && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); - - if (doorclosed) - goto clipsolid; - // Window. if (backc1 != frontc1 || backc2 != frontc2 || backf1 != frontf1 || backf2 != frontf2) @@ -503,21 +507,24 @@ static void R_AddLine(seg_t *line) else #endif { - if (backsector->ceilingheight <= frontsector->floorheight - || backsector->floorheight >= frontsector->ceilingheight) + if (thissec != backsector && thissec != frontsector) { - goto clipsolid; + if (backsector->ceilingheight <= frontsector->floorheight + || backsector->floorheight >= frontsector->ceilingheight) + { + goto clipsolid; + } + + // Check for automap fix. Store in doorclosed for r_segs.c + doorclosed = (backsector->ceilingheight <= backsector->floorheight + && (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture) + && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture) + && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); + + if (doorclosed) + goto clipsolid; } - // Check for automap fix. Store in doorclosed for r_segs.c - doorclosed = (backsector->ceilingheight <= backsector->floorheight - && (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture) - && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture) - && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); - - if (doorclosed) - goto clipsolid; - // Window. if (backsector->ceilingheight != frontsector->ceilingheight || backsector->floorheight != frontsector->floorheight) diff --git a/src/r_segs.c b/src/r_segs.c index 11287f16d..84bb119fd 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2020,6 +2020,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) { // two sided line + sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; + #ifdef ESLOPE if (backsector->c_slope) { worldhigh = P_GetZAt(backsector->c_slope, segleft.x, segleft.y) - viewz; @@ -2113,52 +2115,55 @@ void R_StoreWallRange(INT32 start, INT32 stop) // ds_p->sprtopclip = screenheightarray; } -#ifdef ESLOPE - if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope) -#else - if (worldhigh <= worldbottom) -#endif - { - ds_p->sprbottomclip = negonearray; - ds_p->bsilheight = INT32_MAX; - ds_p->silhouette |= SIL_BOTTOM; - } - -#ifdef ESLOPE - if (worldlow >= worldtop && worldlowslope >= worldtopslope) -#else - if (worldlow >= worldtop) -#endif - { - ds_p->sprtopclip = screenheightarray; - ds_p->tsilheight = INT32_MIN; - ds_p->silhouette |= SIL_TOP; - } - - //SoM: 3/25/2000: This code fixes an automap bug that didn't check - // frontsector->ceiling and backsector->floor to see if a door was closed. - // Without the following code, sprites get displayed behind closed doors. + if (thissec != frontsector && thissec != backsector) { #ifdef ESLOPE - if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)) + if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope) #else - if (doorclosed || backsector->ceilingheight <= frontsector->floorheight) + if (worldhigh <= worldbottom) #endif { ds_p->sprbottomclip = negonearray; ds_p->bsilheight = INT32_MAX; ds_p->silhouette |= SIL_BOTTOM; } + #ifdef ESLOPE - if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope)) + if (worldlow >= worldtop && worldlowslope >= worldtopslope) #else - if (doorclosed || backsector->floorheight >= frontsector->ceilingheight) + if (worldlow >= worldtop) #endif - { // killough 1/17/98, 2/8/98 + { ds_p->sprtopclip = screenheightarray; ds_p->tsilheight = INT32_MIN; ds_p->silhouette |= SIL_TOP; } + + //SoM: 3/25/2000: This code fixes an automap bug that didn't check + // frontsector->ceiling and backsector->floor to see if a door was closed. + // Without the following code, sprites get displayed behind closed doors. + { +#ifdef ESLOPE + if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)) +#else + if (doorclosed || backsector->ceilingheight <= frontsector->floorheight) +#endif + { + ds_p->sprbottomclip = negonearray; + ds_p->bsilheight = INT32_MAX; + ds_p->silhouette |= SIL_BOTTOM; + } +#ifdef ESLOPE + if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope)) +#else + if (doorclosed || backsector->floorheight >= frontsector->ceilingheight) +#endif + { // killough 1/17/98, 2/8/98 + ds_p->sprtopclip = screenheightarray; + ds_p->tsilheight = INT32_MIN; + ds_p->silhouette |= SIL_TOP; + } + } } if (worldlow != worldbottom From d8cf9327a6f13c12032a8b17d4b0465de6e32e5a Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 6 Oct 2018 19:25:59 -0400 Subject: [PATCH 30/33] OGL support --- src/hardware/hw_main.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 6a664d39b..774ff8c1c 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2690,6 +2690,8 @@ static void HWR_AddLine(seg_t * line) // SoM: Backsector needs to be run through R_FakeFlat static sector_t tempsec; + sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; + if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) return; @@ -2811,11 +2813,14 @@ static void HWR_AddLine(seg_t * line) SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight) #undef SLOPEPARAMS - // Closed door. - if ((backc1 <= frontf1 && backc2 <= frontf2) - || (backf1 >= frontc1 && backf2 >= frontc2)) + if (thissec != gr_backsector && thissec != gr_frontsector) { - goto clipsolid; + // Closed door. + if ((backc1 <= frontf1 && backc2 <= frontf2) + || (backf1 >= frontc1 && backf2 >= frontc2)) + { + goto clipsolid; + } } // Window. @@ -2828,10 +2833,13 @@ static void HWR_AddLine(seg_t * line) else #endif { - // Closed door. - if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || - gr_backsector->floorheight >= gr_frontsector->ceilingheight) - goto clipsolid; + if (thissec != gr_backsector && thissec != gr_frontsector) + { + // Closed door. + if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || + gr_backsector->floorheight >= gr_frontsector->ceilingheight) + goto clipsolid; + } // Window. if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight || From f026615dfe941bffc2715eda714a58c37d0dc9bf Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 6 Oct 2018 23:37:27 -0400 Subject: [PATCH 31/33] Don't need thissec --- src/hardware/hw_main.c | 6 ++---- src/r_bsp.c | 5 ++--- src/r_segs.c | 6 ++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 774ff8c1c..2e4c733b0 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2690,8 +2690,6 @@ static void HWR_AddLine(seg_t * line) // SoM: Backsector needs to be run through R_FakeFlat static sector_t tempsec; - sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; - if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) return; @@ -2813,7 +2811,7 @@ static void HWR_AddLine(seg_t * line) SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight) #undef SLOPEPARAMS - if (thissec != gr_backsector && thissec != gr_frontsector) + if (viewsector != gr_backsector && viewsector != gr_frontsector) { // Closed door. if ((backc1 <= frontf1 && backc2 <= frontf2) @@ -2833,7 +2831,7 @@ static void HWR_AddLine(seg_t * line) else #endif { - if (thissec != gr_backsector && thissec != gr_frontsector) + if (viewsector != gr_backsector && viewsector != gr_frontsector) { // Closed door. if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || diff --git a/src/r_bsp.c b/src/r_bsp.c index da9ad6656..0c48ae8b4 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -374,7 +374,6 @@ static void R_AddLine(seg_t *line) INT32 x1, x2; angle_t angle1, angle2, span, tspan; static sector_t tempsec; // ceiling/water hack - sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) return; @@ -479,7 +478,7 @@ static void R_AddLine(seg_t *line) SLOPEPARAMS( backsector->f_slope, backf1, backf2, backsector->floorheight) SLOPEPARAMS( backsector->c_slope, backc1, backc2, backsector->ceilingheight) #undef SLOPEPARAMS - if (thissec != backsector && thissec != frontsector) + if (viewsector != backsector && viewsector != frontsector) { if ((backc1 <= frontf1 && backc2 <= frontf2) || (backf1 >= frontc1 && backf2 >= frontc2)) @@ -507,7 +506,7 @@ static void R_AddLine(seg_t *line) else #endif { - if (thissec != backsector && thissec != frontsector) + if (viewsector != backsector && viewsector != frontsector) { if (backsector->ceilingheight <= frontsector->floorheight || backsector->floorheight >= frontsector->ceilingheight) diff --git a/src/r_segs.c b/src/r_segs.c index 84bb119fd..231a84f79 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1365,7 +1365,7 @@ static void R_RenderSegLoop (void) if (bottom >= floorclip[rw_x]) bottom = floorclip[rw_x]-1; - if (top <= bottom) + if (top <= bottom && ceilingplane) { ceilingplane->top[rw_x] = (INT16)top; ceilingplane->bottom[rw_x] = (INT16)bottom; @@ -2020,8 +2020,6 @@ void R_StoreWallRange(INT32 start, INT32 stop) { // two sided line - sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; - #ifdef ESLOPE if (backsector->c_slope) { worldhigh = P_GetZAt(backsector->c_slope, segleft.x, segleft.y) - viewz; @@ -2115,7 +2113,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) // ds_p->sprtopclip = screenheightarray; } - if (thissec != frontsector && thissec != backsector) + if (viewsector != frontsector && viewsector != backsector) { #ifdef ESLOPE if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope) From 9e1584fbb017fe599e4b227e1bf6e4f32fd6afdb Mon Sep 17 00:00:00 2001 From: Sryder Date: Sun, 7 Oct 2018 15:35:54 +0100 Subject: [PATCH 32/33] Fix the mixed declaration and code warnings that only don't appear currently because of a tiny Makefile issue. --- src/hu_stuff.c | 99 ++++++++++++++++++++++++++--------------------- src/k_kart.c | 17 ++++---- src/lua_baselib.c | 13 ++++--- src/p_enemy.c | 6 +-- 4 files changed, 74 insertions(+), 61 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index e503e2a6c..7080ab6ac 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -465,6 +465,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) { // what we're gonna do now is check if the node exists // with that logic, characters 4 and 5 are our numbers: + const char *newmsg; int spc = 1; // used if nodenum[1] is a space. char *nodenum = (char*) malloc(3); strncpy(nodenum, msg+3, 5); @@ -503,7 +504,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) return; } buf[0] = target; - const char *newmsg = msg+5+spc; + newmsg = msg+5+spc; memcpy(msg, newmsg, 252); } @@ -567,10 +568,10 @@ static void Command_Sayteam_f(void) CONS_Alert(CONS_NOTICE, M_GetText("Dedicated servers can't send team messages. Use \"say\".\n")); return; } - + if (G_GametypeHasTeams()) // revert to normal say if we don't have teams in this gametype. DoSayCommand(-1, 1, 0); - else + else DoSayCommand(0, 1, 0); } @@ -607,6 +608,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) char *msg; boolean action = false; char *ptr; + int spam_eatmsg = 0; CONS_Debug(DBG_NETPLAY,"Received SAY cmd from Player %d (%s)\n", playernum+1, player_names[playernum]); @@ -653,8 +655,6 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) } } - int spam_eatmsg = 0; - // before we do anything, let's verify the guy isn't spamming, get this easier on us. //if (stop_spamming_you_cunt[playernum] != 0 && cv_chatspamprotection.value && !(flags & HU_CSAY)) @@ -721,7 +721,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) // player is a spectator? if (players[playernum].spectator) - { + { cstart = "\x86"; // grey name textcolor = "\x86"; } @@ -731,12 +731,12 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) { cstart = "\x85"; textcolor = "\x85"; - } + } else // blue { cstart = "\x84"; textcolor = "\x84"; - } + } } else { @@ -775,7 +775,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) cstart = "\x89"; // V_LAVENDERMAP } prefix = cstart; - + // Give admins and remote admins their symbols. if (playernum == serverplayer) tempchar = (char *)Z_Calloc(strlen(cstart) + strlen(adminchar) + 1, PU_STATIC, NULL); @@ -883,7 +883,7 @@ static inline boolean HU_keyInChatString(char *s, char ch) { if (s[m]) s[m+1] = (s[m]); - + if (m < 1) break; // fix the chat going ham if your replace the first character. (For whatever reason this didn't happen in vanilla????) } @@ -896,9 +896,10 @@ static inline boolean HU_keyInChatString(char *s, char ch) } else if (ch == KEY_BACKSPACE) { + size_t i; if (c_input <= 0) return false; - size_t i = c_input; + i = c_input; if (!s[i-1]) return false; @@ -951,12 +952,14 @@ static void HU_queueChatChar(INT32 c) char buf[2+256]; size_t ci = 2; char *msg = &buf[2]; + size_t i; + INT32 target = 0; do { c = w_chat[-2+ci++]; if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only. buf[ci-1]=c; } while (c); - size_t i = 0; + i = 0; for (;(i 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm { + int spc; + char *nodenum; + const char *newmsg; // what we're gonna do now is check if the node exists // with that logic, characters 4 and 5 are our numbers: @@ -983,8 +987,8 @@ static void HU_queueChatChar(INT32 c) return; } - int spc = 1; // used if nodenum[1] is a space. - char *nodenum = (char*) malloc(3); + spc = 1; // used if nodenum[1] is a space. + nodenum = (char*) malloc(3); strncpy(nodenum, msg+3, 5); // check for undesirable characters in our "number" if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9'))) @@ -1021,7 +1025,7 @@ static void HU_queueChatChar(INT32 c) return; } // we need to get rid of the /pm - const char *newmsg = msg+5+spc; + newmsg = msg+5+spc; memcpy(msg, newmsg, 255); } if (ci > 3) // don't send target+flags+empty message. @@ -1056,12 +1060,12 @@ static boolean justscrolledup; boolean HU_Responder(event_t *ev) { INT32 c=0; - + if (ev->type != ev_keydown) return false; // only KeyDown events now... - + if (!chat_on) { // enter chat mode @@ -1086,7 +1090,7 @@ boolean HU_Responder(event_t *ev) } else // if chat_on { - + // Ignore modifier keys // Note that we do this here so users can still set // their chat keys to one of these, if they so desire. @@ -1117,14 +1121,16 @@ boolean HU_Responder(event_t *ev) if (((c == 'v' || c == 'V') && ctrldown) && !CHAT_MUTE) { const char *paste = I_ClipboardPaste(); + size_t chatlen; + size_t pastelen; // create a dummy string real quickly if (paste == NULL) return true; - size_t chatlen = strlen(w_chat); - size_t pastelen = strlen(paste); + chatlen = strlen(w_chat); + pastelen = strlen(paste); if (chatlen+pastelen > HU_MAXMSGLEN) return true; // we can't paste this!! @@ -1258,9 +1264,6 @@ INT16 chatx = 13, chaty = 169; // let's use this as our coordinates, shh static void HU_drawMiniChat(void) { - if (!chat_nummsg_min) - return; // needless to say it's useless to do anything if we don't have anything to draw. - INT32 x = chatx+2; INT32 charwidth = 4, charheight = 6; INT32 dx = 0, dy = 0; @@ -1269,6 +1272,10 @@ static void HU_drawMiniChat(void) INT32 msglines = 0; // process all messages once without rendering anything or doing anything fancy so that we know how many lines each message has... + INT32 y; + + if (!chat_nummsg_min) + return; // needless to say it's useless to do anything if we don't have anything to draw. for (; i>0; i--) { @@ -1284,10 +1291,10 @@ static void HU_drawMiniChat(void) { ++j; if (!prev_linereturn) - { + { linescount += 1; dx = 0; - } + } prev_linereturn = true; continue; } @@ -1316,7 +1323,7 @@ static void HU_drawMiniChat(void) msglines += linescount+1; } - INT32 y = chaty - charheight*(msglines+1) - (cv_kartspeedometer.value ? 16 : 0); + y = chaty - charheight*(msglines+1) - (cv_kartspeedometer.value ? 16 : 0); dx = 0; dy = 0; i = 0; @@ -1339,10 +1346,10 @@ static void HU_drawMiniChat(void) { ++j; if (!prev_linereturn) - { + { dy += charheight; dx = 0; - } + } prev_linereturn = true; continue; } @@ -1509,36 +1516,36 @@ static void HU_DrawChat(void) t = 0x400; // Blue #endif } - + if (CHAT_MUTE) { talk = mute; typelines = 1; cflag = V_GRAYMAP; // set text in gray if chat is muted. - } - + } + V_DrawFillConsoleMap(chatx, y-1, cv_chatwidth.value, (typelines*charheight), 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); - + while (talk[i]) { if (talk[i] < HU_FONTSTART) ++i; else - { + { V_DrawChatCharacter(chatx + c + 2, y, talk[i] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|cflag, !cv_allcaps.value, V_GetStringColormap(talk[i]|cflag)); i++; - } + } c += charwidth; } - + // if chat is muted, just draw the log and get it over with: if (CHAT_MUTE) - { + { HU_drawChatLog(0); return; - } - + } + i = 0; typelines = 1; @@ -1581,24 +1588,25 @@ static void HU_DrawChat(void) // handle /pm list. if (strnicmp(w_chat, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai { - i = 0; INT32 count = 0; INT32 p_dispy = chaty - charheight -1; + i = 0; for(i=0; (i '9'))) || ((w_chat[4] != 0) && (((w_chat[4] < '0') || (w_chat[4] > '9'))))) && (w_chat[4] != ' ')) break; - char *nodenum = (char*) malloc(3); + nodenum = (char*) malloc(3); strncpy(nodenum, w_chat+3, 4); - UINT32 n = atoi((const char*) nodenum); // turn that into a number + n = atoi((const char*) nodenum); // turn that into a number // special cases: if ((n == 0) && !(w_chat[4] == '0')) @@ -2164,6 +2172,7 @@ void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext) UINT8 barcolor = 128; // color we use for the bars (green, yellow or red) SINT8 i = 0; SINT8 yoffset = 6; + INT32 dx; if (ping < 128) { numbars = 3; @@ -2175,7 +2184,7 @@ void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext) barcolor = 103; } - INT32 dx = x+1 - (V_SmallStringWidth(va("%dms", ping), V_ALLOWLOWERCASE)/2); + dx = x+1 - (V_SmallStringWidth(va("%dms", ping), V_ALLOWLOWERCASE)/2); if (!notext || vid.width >= 640) // how sad, we're using a shit resolution. V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE, va("%dms", ping)); diff --git a/src/k_kart.c b/src/k_kart.c index b37c8f494..d369c1d07 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2850,24 +2850,25 @@ static void K_DoThunderShield(player_t *player) int i = 0; fixed_t sx; fixed_t sy; - + angle_t an; + S_StartSound(player->mo, sfx_zio3); //player->kartstuff[k_thunderanim] = 35; P_NukeEnemies(player->mo, player->mo, RING_DIST/4); - + // spawn vertical bolt mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_THOK); P_SetTarget(&mo->target, player->mo); P_SetMobjState(mo, S_LZIO11); mo->color = SKINCOLOR_TEAL; mo->scale = player->mo->scale*3 + (player->mo->scale/2); - + mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_THOK); P_SetTarget(&mo->target, player->mo); P_SetMobjState(mo, S_LZIO21); mo->color = SKINCOLOR_CYAN; mo->scale = player->mo->scale*3 + (player->mo->scale/2); - + // spawn horizontal bolts; for (i=0; i<7; i++) { @@ -2877,9 +2878,9 @@ static void K_DoThunderShield(player_t *player) P_SetTarget(&mo->target, player->mo); P_SetMobjState(mo, S_KLIT1); } - - // spawn the radius thing: - angle_t an = ANGLE_22h; + + // spawn the radius thing: + an = ANGLE_22h; for (i=0; i<15; i++) { sx = player->mo->x + FixedMul((player->mo->scale*THUNDERRADIUS), FINECOSINE((an*i)>>ANGLETOFINESHIFT)); @@ -7235,7 +7236,7 @@ static void K_drawDistributionDebugger(void) if (stplyr != &players[displayplayer]) // only for p1 return; - // The only code duplication from the Kart, just to avoid the actual item function from calculating pingame twice + // The only code duplication from the Kart, just to avoid the actual item function from calculating pingame twice for (i = 0; i < MAXPLAYERS; i++) { if (!playeringame[i] || players[i].spectator) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 2d287d0f5..240db71c5 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -92,9 +92,10 @@ static int lib_print(lua_State *L) static int lib_chatprint(lua_State *L) { const char *str = luaL_checkstring(L, 1); // retrieve string + int len; if (str == NULL) // error if we don't have a string! return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprint")); - int len = strlen(str); + len = strlen(str); if (len > 255) // string is too long!!! return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer."); @@ -113,19 +114,21 @@ static int lib_chatprintf(lua_State *L) { int n = lua_gettop(L); /* number of arguments */ player_t *plr; + const char *str; + int len; if (n < 2) return luaL_error(L, "chatprintf requires at least two arguments: player and text."); - + plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player if (!plr) return LUA_ErrInvalid(L, "player_t"); if (plr != &players[consoleplayer]) return 0; - - const char *str = luaL_checkstring(L, 2); // retrieve string + + str = luaL_checkstring(L, 2); // retrieve string if (str == NULL) // error if we don't have a string! return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprintf")); - int len = strlen(str); + len = strlen(str); if (len > 255) // string is too long!!! return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer."); diff --git a/src/p_enemy.c b/src/p_enemy.c index 7cdc354de..a9871ab74 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8318,13 +8318,13 @@ void A_BallhogExplode(mobj_t *actor) // Dumb simple function that gives a mobj its target's momentums without updating its angle. void A_LightningFollowPlayer(mobj_t *actor) { + fixed_t sx, sy; #ifdef HAVE_BLUA if (LUA_CallAction("A_LightningFollowPlayer", actor)) return; #endif - fixed_t sx, sy; if (actor->target) - { + { if (actor->extravalue1) // Make the radius also follow the player somewhat accuratly { sx = actor->target->x + FixedMul((actor->target->scale*actor->extravalue1), FINECOSINE((actor->angle)>>ANGLETOFINESHIFT)); @@ -8333,7 +8333,7 @@ void A_LightningFollowPlayer(mobj_t *actor) } else // else just teleport to player directly P_TeleportMove(actor, actor->target->x, actor->target->y, actor->target->z); - + actor->momx = actor->target->momx; actor->momy = actor->target->momy; actor->momz = actor->target->momz; // Give momentum since we don't teleport to our player literally every frame. From 7a8dc91b6a2b7fa9f7ee24c84adabddb3bf7cbd3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 9 Oct 2018 15:28:52 -0400 Subject: [PATCH 33/33] Fix tabbing --- src/m_menu.c | 169 +++++++++++++++++++++++++-------------------------- 1 file changed, 84 insertions(+), 85 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 2e1704dcb..0bc0f2138 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8541,114 +8541,113 @@ static void M_Setup4PControlsMenu(INT32 choice) // Draws the Customise Controls menu static void M_DrawControl(void) { - char tmp[50]; - INT32 x, y, i, max, cursory = 0, iter; - INT32 keys[2]; + char tmp[50]; + INT32 x, y, i, max, cursory = 0, iter; + INT32 keys[2]; - x = currentMenu->x; - y = currentMenu->y; + x = currentMenu->x; + y = currentMenu->y; - /*i = itemOn - (controlheight/2); - if (i < 0) - i = 0; - */ + /*i = itemOn - (controlheight/2); + if (i < 0) + i = 0; + */ - iter = (controlheight/2); - for (i = itemOn; ((iter || currentMenu->menuitems[i].status == IT_GRAYEDOUT2) && i > 0); i--) - { - if (currentMenu->menuitems[i].status != IT_GRAYEDOUT2) - iter--; - } - if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) - i--; + iter = (controlheight/2); + for (i = itemOn; ((iter || currentMenu->menuitems[i].status == IT_GRAYEDOUT2) && i > 0); i--) + { + if (currentMenu->menuitems[i].status != IT_GRAYEDOUT2) + iter--; + } + if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + i--; - iter += (controlheight/2); - for (max = itemOn; (iter && max < currentMenu->numitems); max++) - { - if (currentMenu->menuitems[max].status != IT_GRAYEDOUT2) - iter--; - } + iter += (controlheight/2); + for (max = itemOn; (iter && max < currentMenu->numitems); max++) + { + if (currentMenu->menuitems[max].status != IT_GRAYEDOUT2) + iter--; + } - if (iter) - { - iter += (controlheight/2); - for (i = itemOn; ((iter || currentMenu->menuitems[i].status == IT_GRAYEDOUT2) && i > 0); i--) - { - if (currentMenu->menuitems[i].status != IT_GRAYEDOUT2) - iter--; - } - } + if (iter) + { + iter += (controlheight/2); + for (i = itemOn; ((iter || currentMenu->menuitems[i].status == IT_GRAYEDOUT2) && i > 0); i--) + { + if (currentMenu->menuitems[i].status != IT_GRAYEDOUT2) + iter--; + } + } - /*max = i + controlheight; - if (max > currentMenu->numitems) - { - max = currentMenu->numitems; - if (max < controlheight) - i = 0; - else - i = max - controlheight; - }*/ + /*max = i + controlheight; + if (max > currentMenu->numitems) + { + max = currentMenu->numitems; + if (max < controlheight) + i = 0; + else + i = max - controlheight; + }*/ - // draw title (or big pic) - M_DrawMenuTitle(); + // draw title (or big pic) + M_DrawMenuTitle(); - M_CentreText(28, + M_CentreText(28, (setupcontrols_fourthplayer ? "\x86""Set controls for ""\x82""Player 4" : (setupcontrols_thirdplayer ? "\x86""Set controls for ""\x82""Player 3" : - (setupcontrols_secondaryplayer ? "\x86""Set controls for ""\x82""Player 2" : - "\x86""Press ""\x82""ENTER""\x86"" to change, ""\x82""BACKSPACE""\x86"" to clear")))); + (setupcontrols_secondaryplayer ? "\x86""Set controls for ""\x82""Player 2" : + "\x86""Press ""\x82""ENTER""\x86"" to change, ""\x82""BACKSPACE""\x86"" to clear")))); - if (i) - V_DrawString(currentMenu->x - 16, y-(skullAnimCounter/5), highlightflags, "\x1A"); // up arrow - if (max != currentMenu->numitems) - V_DrawString(currentMenu->x - 16, y+(SMALLLINEHEIGHT*(controlheight-1))+(skullAnimCounter/5), highlightflags, "\x1B"); // down arrow + if (i) + V_DrawString(currentMenu->x - 16, y-(skullAnimCounter/5), highlightflags, "\x1A"); // up arrow + if (max != currentMenu->numitems) + V_DrawString(currentMenu->x - 16, y+(SMALLLINEHEIGHT*(controlheight-1))+(skullAnimCounter/5), highlightflags, "\x1B"); // down arrow - for (; i < max; i++) - { - if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) - continue; + for (; i < max; i++) + { + if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + continue; - if (i == itemOn) - cursory = y; + if (i == itemOn) + cursory = y; - if (currentMenu->menuitems[i].status == IT_CONTROL) - { - V_DrawString(x, y, ((i == itemOn) ? highlightflags : 0), currentMenu->menuitems[i].text); - keys[0] = setupcontrols[currentMenu->menuitems[i].alphaKey][0]; - keys[1] = setupcontrols[currentMenu->menuitems[i].alphaKey][1]; + if (currentMenu->menuitems[i].status == IT_CONTROL) + { + V_DrawString(x, y, ((i == itemOn) ? highlightflags : 0), currentMenu->menuitems[i].text); + keys[0] = setupcontrols[currentMenu->menuitems[i].alphaKey][0]; + keys[1] = setupcontrols[currentMenu->menuitems[i].alphaKey][1]; - tmp[0] ='\0'; - if (keys[0] == KEY_NULL && keys[1] == KEY_NULL) - { - strcpy(tmp, "---"); - } - else - { - if (keys[0] != KEY_NULL) - strcat (tmp, G_KeynumToString (keys[0])); + tmp[0] ='\0'; + if (keys[0] == KEY_NULL && keys[1] == KEY_NULL) + { + strcpy(tmp, "---"); + } + else + { + if (keys[0] != KEY_NULL) + strcat (tmp, G_KeynumToString (keys[0])); - if (keys[0] != KEY_NULL && keys[1] != KEY_NULL) - strcat(tmp,", "); + if (keys[0] != KEY_NULL && keys[1] != KEY_NULL) + strcat(tmp,", "); - if (keys[1] != KEY_NULL) - strcat (tmp, G_KeynumToString (keys[1])); + if (keys[1] != KEY_NULL) + strcat (tmp, G_KeynumToString (keys[1])); - - } - V_DrawRightAlignedString(BASEVIDWIDTH-currentMenu->x, y, highlightflags, tmp); - } - /*else if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) - V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);*/ - else if ((currentMenu->menuitems[i].status == IT_HEADER) && (i != max-1)) + } + V_DrawRightAlignedString(BASEVIDWIDTH-currentMenu->x, y, highlightflags, tmp); + } + /*else if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);*/ + else if ((currentMenu->menuitems[i].status == IT_HEADER) && (i != max-1)) V_DrawString(19, y+6, highlightflags, currentMenu->menuitems[i].text); else if (currentMenu->menuitems[i].status & IT_STRING) V_DrawString(x, y, ((i == itemOn) ? highlightflags : 0), currentMenu->menuitems[i].text); - y += SMALLLINEHEIGHT; - } + y += SMALLLINEHEIGHT; + } - V_DrawScaledPatch(currentMenu->x - 20, cursory, 0, - W_CachePatchName("M_CURSOR", PU_CACHE)); + V_DrawScaledPatch(currentMenu->x - 20, cursory, 0, + W_CachePatchName("M_CURSOR", PU_CACHE)); } #undef controlheight