From 0acb8e6a63226f7d7a3c14d4589a280ef7f2ca21 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 22 Dec 2024 18:38:09 +0100 Subject: [PATCH 01/28] fix compile --- src/p_mobj.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index e68288f2b..03e7e9f99 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3234,7 +3234,6 @@ void P_DestroyRobots(void) // the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person static void P_CalcChasePostImg(player_t *player, camera_t *thiscam) { - boolean itsatwodlevel = false; const boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP); UINT16 postimgflags = 0; UINT8 i; @@ -3244,21 +3243,6 @@ static void P_CalcChasePostImg(player_t *player, camera_t *thiscam) if (flipcam) postimgflags |= POSTIMG_FLIP; - if (twodlevel) - itsatwodlevel = true; - else - { - for (i = 0; i <= splitscreen; i++) - { - if (thiscam == &camera[i] && players[displayplayers[i]].mo - && (players[displayplayers[i]].mo->flags2 & MF2_TWOD)) - { - itsatwodlevel = true; - break; - } - } - } - if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist { camera_t dummycam; @@ -3300,12 +3284,30 @@ static void P_CalcChasePostImg(player_t *player, camera_t *thiscam) // Process the mobj-ish required functions of the camera boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled) { + boolean itsatwodlevel = false; + UINT8 i; + // This can happen when joining if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL) return true; P_CalcChasePostImg(player, thiscam); + if (twodlevel) + itsatwodlevel = true; + else + { + for (i = 0; i <= splitscreen; i++) + { + if (thiscam == &camera[i] && players[displayplayers[i]].mo + && (players[displayplayers[i]].mo->flags2 & MF2_TWOD)) + { + itsatwodlevel = true; + break; + } + } + } + if (thiscam->momx || thiscam->momy) { if (!P_TryCameraMove(thiscam->x + thiscam->momx, thiscam->y + thiscam->momy, thiscam)) // Never fails for 2D mode. @@ -3333,7 +3335,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled } if (!itsatwodlevel) - P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam); + P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam); thiscam->subsector = R_PointInSubsectorFast(thiscam->x, thiscam->y); thiscam->floorz = tmfloorz; From 0290c738e1d2ee2e72beb5ed6a57c20e7a6e41ee Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 22 Dec 2024 18:38:09 +0100 Subject: [PATCH 02/28] fix compile --- src/p_mobj.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index e68288f2b..03e7e9f99 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3234,7 +3234,6 @@ void P_DestroyRobots(void) // the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person static void P_CalcChasePostImg(player_t *player, camera_t *thiscam) { - boolean itsatwodlevel = false; const boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP); UINT16 postimgflags = 0; UINT8 i; @@ -3244,21 +3243,6 @@ static void P_CalcChasePostImg(player_t *player, camera_t *thiscam) if (flipcam) postimgflags |= POSTIMG_FLIP; - if (twodlevel) - itsatwodlevel = true; - else - { - for (i = 0; i <= splitscreen; i++) - { - if (thiscam == &camera[i] && players[displayplayers[i]].mo - && (players[displayplayers[i]].mo->flags2 & MF2_TWOD)) - { - itsatwodlevel = true; - break; - } - } - } - if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist { camera_t dummycam; @@ -3300,12 +3284,30 @@ static void P_CalcChasePostImg(player_t *player, camera_t *thiscam) // Process the mobj-ish required functions of the camera boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled) { + boolean itsatwodlevel = false; + UINT8 i; + // This can happen when joining if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL) return true; P_CalcChasePostImg(player, thiscam); + if (twodlevel) + itsatwodlevel = true; + else + { + for (i = 0; i <= splitscreen; i++) + { + if (thiscam == &camera[i] && players[displayplayers[i]].mo + && (players[displayplayers[i]].mo->flags2 & MF2_TWOD)) + { + itsatwodlevel = true; + break; + } + } + } + if (thiscam->momx || thiscam->momy) { if (!P_TryCameraMove(thiscam->x + thiscam->momx, thiscam->y + thiscam->momy, thiscam)) // Never fails for 2D mode. @@ -3333,7 +3335,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled } if (!itsatwodlevel) - P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam); + P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam); thiscam->subsector = R_PointInSubsectorFast(thiscam->x, thiscam->y); thiscam->floorz = tmfloorz; From 7ab7193592d0ff25e34c7048b2541cc76492e618 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 25 Jan 2025 15:39:40 +0100 Subject: [PATCH 03/28] remove noshowhelp from bunch of debug cvars doesent make too much sense those are hidden tbh --- src/d_netcmd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 41b9c97e9..b527f9c6f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -404,18 +404,18 @@ static CV_PossibleValue_t kartvoices_cons_t[] = {{0, "Never"}, {1, "Tasteful"}, consvar_t cv_kartvoices = {"kartvoices", "Tasteful", CV_SAVE, kartvoices_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_karthitemdialog = {"karthitemdialog", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_karteliminatelast = {"karteliminatelast", "Yes", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOSHOWHELP, CV_YesNo, KartEliminateLast_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_karteliminatelast = {"karteliminatelast", "Yes", CV_NETVAR|CV_CHEAT|CV_CALL, CV_YesNo, KartEliminateLast_OnChange, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t kartdebugitem_cons_t[] = {{-1, "MIN"}, {NUMKARTITEMS-1, "MAX"}, {0, NULL}}; -consvar_t cv_kartdebugitem = {"kartdebugitem", "0", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, kartdebugitem_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_kartdebugitem = {"kartdebugitem", "0", CV_NETVAR|CV_CHEAT, kartdebugitem_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t kartdebugamount_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}}; -consvar_t cv_kartdebugamount = {"kartdebugamount", "1", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, kartdebugamount_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_kartdebugshrink = {"kartdebugshrink", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_kartdebugdistribution = {"kartdebugdistribution", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_kartdebughuddrop = {"kartdebughuddrop", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_kartdebugamount = {"kartdebugamount", "1", CV_NETVAR|CV_CHEAT, kartdebugamount_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_kartdebugshrink = {"kartdebugshrink", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_kartdebugdistribution = {"kartdebugdistribution", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_kartdebughuddrop = {"kartdebughuddrop", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_kartdebugcheckpoint = {"kartdebugcheckpoint", "Off", CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_kartdebugnodes = {"kartdebugnodes", "Off", CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_kartdebugcheckpoint = {"kartdebugcheckpoint", "Off", NULL, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_kartdebugnodes = {"kartdebugnodes", "Off", NULL, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_kartdebugcolorize = {"kartdebugcolorize", "Off", CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t votetime_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, NULL}}; From 40660f237974d316d31b80d0af343d6f188158e3 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 25 Jan 2025 16:59:31 +0100 Subject: [PATCH 04/28] "makes integer from pointer without a cast" deez nuts --- src/d_netcmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b527f9c6f..184fdd70f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -414,8 +414,8 @@ consvar_t cv_kartdebugshrink = {"kartdebugshrink", "Off", CV_NETVAR|CV_CHEAT, CV consvar_t cv_kartdebugdistribution = {"kartdebugdistribution", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_kartdebughuddrop = {"kartdebughuddrop", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_kartdebugcheckpoint = {"kartdebugcheckpoint", "Off", NULL, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_kartdebugnodes = {"kartdebugnodes", "Off", NULL, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_kartdebugcheckpoint = {"kartdebugcheckpoint", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_kartdebugnodes = {"kartdebugnodes", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_kartdebugcolorize = {"kartdebugcolorize", "Off", CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t votetime_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, NULL}}; From 3b90038b621b3e5fb3746e6a652ee08482738b82 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 24 Jan 2025 21:19:50 +0100 Subject: [PATCH 05/28] inline G_TicsTo stuff theyre smol and get called often --- src/g_game.c | 30 ------------------------------ src/g_game.h | 31 ++++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index d30e07c00..cfc99b9a8 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -7814,7 +7814,6 @@ void G_DoneLevelLoad(void) // Stops metal sonic's demo. Separate from other functions because metal + replays can coexist void G_StopMetalDemo(void) { - // Metal Sonic finishing doesn't end the game, dammit. Z_Free(metalbuffer); metalbuffer = NULL; @@ -8155,32 +8154,3 @@ boolean G_GetRetryFlag(void) { return retrying; } - -// Time utility functions -INT32 G_TicsToHours(tic_t tics) -{ - return tics/(3600*TICRATE); -} - -INT32 G_TicsToMinutes(tic_t tics, boolean full) -{ - if (full) - return tics/(60*TICRATE); - else - return tics/(60*TICRATE)%60; -} - -INT32 G_TicsToSeconds(tic_t tics) -{ - return (tics/TICRATE)%60; -} - -INT32 G_TicsToCentiseconds(tic_t tics) -{ - return (INT32)((tics%TICRATE) * (100.00f/TICRATE)); -} - -INT32 G_TicsToMilliseconds(tic_t tics) -{ - return (INT32)((tics%TICRATE) * (1000.00f/TICRATE)); -} diff --git a/src/g_game.h b/src/g_game.h index d82946684..107741d75 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -435,11 +435,32 @@ void G_ClearRecords(void); tic_t G_GetBestTime(INT16 map); -FUNCMATH INT32 G_TicsToHours(tic_t tics); -FUNCMATH INT32 G_TicsToMinutes(tic_t tics, boolean full); -FUNCMATH INT32 G_TicsToSeconds(tic_t tics); -FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics); -FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics); +// Time utility functions + +FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToHours(tic_t tics) +{ + return tics/(3600*TICRATE); +} + +FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToMinutes(tic_t tics, boolean full) +{ + return full ? (tics/(60*TICRATE)) : (tics/(60*TICRATE)%60); +} + +FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToSeconds(tic_t tics) +{ + return (tics/TICRATE)%60; +} + +FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics) +{ + return (INT32)((tics%TICRATE) * (100.00f/TICRATE)); +} + +FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics) +{ + return (INT32)((tics%TICRATE) * (1000.00f/TICRATE)); +} // Don't split up TOL handling INT16 G_TOLFlag(INT32 pgametype); From 36404fd93d7c05e25b1b6d8fb6fc65e6380aaad5 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 30 Jan 2025 10:27:36 +0100 Subject: [PATCH 06/28] inline bunch of one line HWR things --- src/hardware/hw_main.c | 52 +--------------------------------- src/hardware/hw_main.h | 64 ++++++++++++++++++++++++++++++++++-------- src/sdl/ogl_sdl.c | 2 +- 3 files changed, 54 insertions(+), 64 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 97f6d9795..6a6c5db4f 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -317,26 +317,11 @@ static void CV_glpalettedepth_OnChange(void) // Lighting // ========================================================================== -boolean HWR_UseShader(void) -{ - return (cv_glshaders.value && gl_shadersavailable); -} - static void HWR_SetShaderState(void) { GL_SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0); } -boolean HWR_ShouldUsePaletteRendering(void) -{ - return (cv_glpaletterendering.value && (pLocalPalette != NULL) && HWR_UseShader()); -} - -boolean HWR_PalRenderFlashpal(void) -{ - return (HWR_ShouldUsePaletteRendering() && cv_glflashpal.value); -} - void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap) { RGBA_t poly_color, tint_color, fade_color; @@ -3163,7 +3148,7 @@ static gl_vissprite_t *gl_visspritechunks[MAXVISSPRITES >> VISSPRITECHUNKBITS] = // HWR_ClearSprites // Called at frame start. // -------------------------------------------------------------------------- -static void HWR_ClearSprites(void) +static inline void HWR_ClearSprites(void) { gl_visspritecount = 0; } @@ -5747,11 +5732,6 @@ static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD #endif } -INT32 HWR_GetTextureUsed(void) -{ - return GL_GetTextureUsed(); -} - static void HWR_DoPostProcessor(player_t *player) { GL_UnSetShader(); @@ -5835,21 +5815,6 @@ static void HWR_DoPostProcessor(player_t *player) // Flipping of the screen isn't done here anymore } -void HWR_StartScreenWipe(void) -{ - GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START); -} - -void HWR_EndScreenWipe(void) -{ - GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END); -} - -void HWR_DrawIntermissionBG(void) -{ - GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0); -} - void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum) { static char lumpname[9] = "FADEmmss"; @@ -5884,19 +5849,4 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum) GL_DoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END); } -void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize) -{ - GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize); -} - -void HWR_MakeScreenFinalTexture(void) -{ - GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2); -} - -void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader) -{ - GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader); -} - #endif // HWRENDER diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 93fbd9c1e..9d25ff97f 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -20,6 +20,7 @@ #ifndef __HWR_MAIN_H__ #define __HWR_MAIN_H__ +#include "hw_gl.h" #include "hw_glob.h" #include "hw_data.h" #include "hw_defs.h" @@ -29,6 +30,7 @@ #include "../d_player.h" #include "../r_defs.h" #include "../m_perfstats.h" +#include "../v_video.h" #define GLENCORE @@ -112,10 +114,6 @@ void HWR_SetTransform(float fpov, player_t *player); void HWR_ClearClipper(void); void HWR_SetStencilState(int state, int level); -boolean HWR_UseShader(void); -boolean HWR_ShouldUsePaletteRendering(void); -boolean HWR_PalRenderFlashpal(void); - // My original intention was to split hw_main.c // into files like hw_bsp.c, hw_sprites.c... @@ -124,17 +122,44 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf); -// Get amount of memory used by gpu textures in bytes -INT32 HWR_GetTextureUsed(void); +// Get amount of memory used by gpu textures in bytes; +FUNCINLINE static ATTRINLINE INT32 HWR_GetTextureUsed(void) +{ + return GL_GetTextureUsed(); +} // hw_main.c: Post-rendering -void HWR_StartScreenWipe(void); -void HWR_EndScreenWipe(void); -void HWR_DrawIntermissionBG(void); void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum); -void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize); -void HWR_MakeScreenFinalTexture(void); -void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader); + +FUNCINLINE static ATTRINLINE void HWR_StartScreenWipe(void) +{ + GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START); +} + +FUNCINLINE static ATTRINLINE void HWR_EndScreenWipe(void) +{ + GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END); +} + +FUNCINLINE static ATTRINLINE void HWR_DrawIntermissionBG(void) +{ + GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0); +} + +FUNCINLINE static ATTRINLINE void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize) +{ + GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize); +} + +FUNCINLINE static ATTRINLINE void HWR_MakeScreenFinalTexture(void) +{ + GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2); +} + +FUNCINLINE static ATTRINLINE void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader) +{ + GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader); +} // hw_main.c: Segs void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom @@ -185,4 +210,19 @@ extern consvar_t cv_glpaletterendering; extern consvar_t cv_glpalettedepth; extern consvar_t cv_glflashpal; +FUNCINLINE static ATTRINLINE boolean HWR_UseShader(void) +{ + return (cv_glshaders.value && gl_shadersavailable); +} + +FUNCINLINE static ATTRINLINE boolean HWR_ShouldUsePaletteRendering(void) +{ + return (cv_glpaletterendering.value && (pLocalPalette != NULL) && HWR_UseShader()); +} + +FUNCINLINE static ATTRINLINE boolean HWR_PalRenderFlashpal(void) +{ + return (HWR_ShouldUsePaletteRendering() && cv_glflashpal.value); +} + #endif diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 8a3a0eabb..7f84adcea 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -264,7 +264,7 @@ void OglSdlFinishUpdate(boolean waitvbl) } #endif - GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, sdlw, sdlh, HWR_ShouldUsePaletteRendering()); + HWR_DrawScreenFinalTexture(sdlw, sdlh, HWR_ShouldUsePaletteRendering()); #ifdef USE_FBO_OGL if (usefbo) From bab120235d2d693dedcd5b4a395b7c963c87f681 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 25 Jan 2025 22:13:39 +0100 Subject: [PATCH 07/28] draw non widescreen anim vote bg before falling back to vanilla bg how it was before, the game just fallback to the vanila widescreen patch if there was no animated widescreen bg provided, just fall back to the non widescreen anim patch instead if it exists --- src/y_inter.c | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 61f4a069b..115967509 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -319,7 +319,7 @@ static void Y_AnimatedVoteScreenCheck(void) strncpy(tmpPrefix, luaVoteScreen, 4); else { - if(G_BattleGametype()) + if (G_BattleGametype()) strcpy(tmpPrefix, "BTLS"); } @@ -923,20 +923,12 @@ static void Y_UnloadData(void) static inline void Y_DrawAnimatedVoteScreenPatch(boolean widePatch) { char tempAnimPrefix[7]; - (widePatch) ? strcpy(tempAnimPrefix, animWidePrefix) : strcpy(tempAnimPrefix, animPrefix); - INT32 tempFoundAnimVoteFrames = (widePatch) ? foundAnimVoteWideFrames : foundAnimVoteFrames; + widePatch ? strcpy(tempAnimPrefix, animWidePrefix) : strcpy(tempAnimPrefix, animPrefix); + const INT32 tempFoundAnimVoteFrames = widePatch ? foundAnimVoteWideFrames : foundAnimVoteFrames; // Just in case someone provides LESS widescreen frames than normal frames or vice versa, reset the frame counter to 0 - if (widePatch) - { - if (currentAnimFrame > foundAnimVoteWideFrames-1) - currentAnimFrame = 0; - } - else - { - if (currentAnimFrame > foundAnimVoteFrames-1) - currentAnimFrame = 0; - } + if (currentAnimFrame > tempFoundAnimVoteFrames - 1) + currentAnimFrame = 0; patch_t *background = W_CachePatchName(va("%s%d", tempAnimPrefix, currentAnimFrame + 1), PU_CACHE); V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(background->width)/2), // Keep the width/height adjustments, for screens that are less wide than 320(?) @@ -973,23 +965,27 @@ void Y_VoteDrawer(void) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); - if (widebgpatch && vid.width / vid.dupx > 320) + const boolean widescreen = (vid.width / vid.dupx > 320); + + if (foundAnimVoteWideFrames && widescreen) { - if (foundAnimVoteWideFrames == 0) - V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(widebgpatch->width)/2), - (vid.height / vid.dupy) - SHORT(widebgpatch->height), - V_SNAPTOTOP|V_SNAPTOLEFT, widebgpatch); - else - Y_DrawAnimatedVoteScreenPatch(true); + Y_DrawAnimatedVoteScreenPatch(true); + } + else if (foundAnimVoteFrames) + { + Y_DrawAnimatedVoteScreenPatch(false); + } + else if (widebgpatch && widescreen) + { + V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(widebgpatch->width)/2), + (vid.height / vid.dupy) - SHORT(widebgpatch->height), + V_SNAPTOTOP|V_SNAPTOLEFT, widebgpatch); } else { - if (foundAnimVoteFrames == 0) - V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(bgpatch->width)/2), // Keep the width/height adjustments, for screens that are less wide than 320(?) - (vid.height / vid.dupy) - SHORT(bgpatch->height), - V_SNAPTOTOP|V_SNAPTOLEFT, bgpatch); - else - Y_DrawAnimatedVoteScreenPatch(false); + V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(bgpatch->width)/2), // Keep the width/height adjustments, for screens that are less wide than 320(?) + (vid.height / vid.dupy) - SHORT(bgpatch->height), + V_SNAPTOTOP|V_SNAPTOLEFT, bgpatch); } for (i = 0; i < 4; i++) // First, we need to figure out the height of this thing... From 2ebf66b99c046d00797e409e5ec7f7454dca0bbb Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 23 Jan 2025 19:33:35 +0100 Subject: [PATCH 08/28] kill P_TeleportMove P_MoveOrigin literally just calls that so replace it with that --- src/p_map.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 1f21d8ccb..00a3bb1b2 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -76,9 +76,9 @@ camera_t *mapcampointer; // // -// P_TeleportMove +// P_MoveOrigin - P_TeleportMove which KEEPS interpolation values. // -static boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) +boolean P_MoveOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) { // the move is ok, // so link the thing into its new position @@ -108,28 +108,19 @@ static boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) return true; } +// // P_SetOrigin - P_TeleportMove which RESETS interpolation values. // boolean P_SetOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) { - boolean result = P_TeleportMove(thing, x, y, z); - - if (result == true) + if (P_MoveOrigin(thing, x, y, z)) { thing->old_x = thing->x; thing->old_y = thing->y; thing->old_z = thing->z; } - return result; -} - -// -// P_MoveOrigin - P_TeleportMove which KEEPS interpolation values. -// -boolean P_MoveOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) -{ - return P_TeleportMove(thing, x, y, z); + return true; } // ========================================================================= From 2f5648729058c70f1fe35a283e5d6cb589f54142 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 23 Jan 2025 20:40:05 +0100 Subject: [PATCH 09/28] assign player later --- src/p_tick.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_tick.c b/src/p_tick.c index 5909a8c59..e9ea16ed0 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -383,8 +383,6 @@ static void P_DeviceRumbleTick(void) UINT16 low = 0; UINT16 high = 0; - player_t *player = ((i == 0) ? &players[consoleplayer] : &players[displayplayers[i]]); - if (!cv_usejoystick[i].value) { continue; @@ -395,6 +393,8 @@ static void P_DeviceRumbleTick(void) continue; } + player_t *player = ((i == 0) ? &players[consoleplayer] : &players[displayplayers[i]]); + if (player->spectator) { continue; From a1d5a2e1f97c8b404990d004cbf31959118a7d4c Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 23 Jan 2025 19:45:23 +0100 Subject: [PATCH 10/28] simplify camtoggledelay and spectatedelay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit just make em an array and use lööp --- src/g_game.c | 59 ++++++++++++++++++++++----------------------------- src/p_local.h | 2 +- 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index cfc99b9a8..b8f793b7f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1269,8 +1269,8 @@ static void G_DoLoadLevel(boolean resetplayer) } static INT32 pausedelay = 0; -static INT32 camtoggledelay, camtoggledelay2, camtoggledelay3, camtoggledelay4 = 0; -static INT32 spectatedelay, spectatedelay2, spectatedelay3, spectatedelay4 = 0; +static INT32 camtoggledelay[MAXSPLITSCREENPLAYERS] = {0,0,0,0}; +static INT32 spectatedelay[MAXSPLITSCREENPLAYERS] = {0,0,0,0}; // // G_Responder @@ -1451,72 +1451,72 @@ boolean G_Responder(event_t *ev) if (ev->data1 == gamecontrol[gc_camtoggle][0] || ev->data1 == gamecontrol[gc_camtoggle][1]) { - if (!camtoggledelay) + if (!camtoggledelay[0]) { - camtoggledelay = NEWTICRATE / 7; + camtoggledelay[0] = NEWTICRATE / 7; CV_SetValue(&cv_chasecam[0], cv_chasecam[0].value ? 0 : 1); } } if (ev->data1 == gamecontrolbis[gc_camtoggle][0] || ev->data1 == gamecontrolbis[gc_camtoggle][1]) { - if (!camtoggledelay2) + if (!camtoggledelay[1]) { - camtoggledelay2 = NEWTICRATE / 7; + camtoggledelay[1] = NEWTICRATE / 7; CV_SetValue(&cv_chasecam[1], cv_chasecam[1].value ? 0 : 1); } } if (ev->data1 == gamecontrol3[gc_camtoggle][0] || ev->data1 == gamecontrol3[gc_camtoggle][1]) { - if (!camtoggledelay3) + if (!camtoggledelay[2]) { - camtoggledelay3 = NEWTICRATE / 7; + camtoggledelay[2] = NEWTICRATE / 7; CV_SetValue(&cv_chasecam[2], cv_chasecam[2].value ? 0 : 1); } } if (ev->data1 == gamecontrol4[gc_camtoggle][0] || ev->data1 == gamecontrol4[gc_camtoggle][1]) { - if (!camtoggledelay4) + if (!camtoggledelay[3]) { - camtoggledelay4 = NEWTICRATE / 7; + camtoggledelay[3] = NEWTICRATE / 7; CV_SetValue(&cv_chasecam[3], cv_chasecam[3].value ? 0 : 1); } } if (ev->data1 == gamecontrol[gc_spectate][0] || ev->data1 == gamecontrol[gc_spectate][1]) { - if (!spectatedelay) + if (!spectatedelay[0]) { - spectatedelay = NEWTICRATE / 7; + spectatedelay[0] = NEWTICRATE / 7; COM_ImmedExecute("changeteam spectator"); } } if (ev->data1 == gamecontrolbis[gc_spectate][0] || ev->data1 == gamecontrolbis[gc_spectate][1]) { - if (!spectatedelay2) + if (!spectatedelay[1]) { - spectatedelay2 = NEWTICRATE / 7; + spectatedelay[1] = NEWTICRATE / 7; COM_ImmedExecute("changeteam2 spectator"); } } if (ev->data1 == gamecontrol3[gc_spectate][0] || ev->data1 == gamecontrol3[gc_spectate][1]) { - if (!spectatedelay3) + if (!spectatedelay[2]) { - spectatedelay3 = NEWTICRATE / 7; + spectatedelay[2] = NEWTICRATE / 7; COM_ImmedExecute("changeteam3 spectator"); } } if (ev->data1 == gamecontrol4[gc_spectate][0] || ev->data1 == gamecontrol4[gc_spectate][1]) { - if (!spectatedelay4) + if (!spectatedelay[3]) { - spectatedelay4 = NEWTICRATE / 7; + spectatedelay[3] = NEWTICRATE / 7; COM_ImmedExecute("changeteam4 spectator"); } } @@ -1953,23 +1953,14 @@ void G_Ticker(boolean run) if (pausedelay) pausedelay--; - if (camtoggledelay) - camtoggledelay--; - if (camtoggledelay2) - camtoggledelay2--; - if (camtoggledelay3) - camtoggledelay3--; - if (camtoggledelay4) - camtoggledelay4--; + for (UINT8 j = 0; j < MAXSPLITSCREENPLAYERS;j++) + { + if (camtoggledelay[i]) + camtoggledelay[i]--; - if (spectatedelay) - spectatedelay--; - if (spectatedelay2) - spectatedelay2--; - if (spectatedelay3) - spectatedelay3--; - if (spectatedelay4) - spectatedelay4--; + if (spectatedelay[i]) + spectatedelay[i]--; + } if (gametic % NAMECHANGERATE == 0) { diff --git a/src/p_local.h b/src/p_local.h index 95f15243c..fd2af3e70 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -299,7 +299,7 @@ void P_ColorTeamMissile(mobj_t *missile, player_t *source); // Special utility to return +1 or -1 depending on mobj's gravity FUNCINLINE static ATTRINLINE SINT8 P_MobjFlip(const mobj_t *mobj) { - return (mobj && mobj->eflags & MFE_VERTICALFLIP) ? -1 : 1; + return (mobj && (mobj->eflags & MFE_VERTICALFLIP)) ? -1 : 1; } fixed_t P_GetMobjGravity(mobj_t *mo); From 8ccb747dcddab13b3e6de18f0922f74c749e51e5 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 24 Jan 2025 20:16:32 +0100 Subject: [PATCH 11/28] j moment --- src/g_game.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index b8f793b7f..419704b70 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1955,11 +1955,11 @@ void G_Ticker(boolean run) for (UINT8 j = 0; j < MAXSPLITSCREENPLAYERS;j++) { - if (camtoggledelay[i]) - camtoggledelay[i]--; + if (camtoggledelay[j]) + camtoggledelay[j]--; - if (spectatedelay[i]) - spectatedelay[i]--; + if (spectatedelay[j]) + spectatedelay[j]--; } if (gametic % NAMECHANGERATE == 0) From 305d408e021ed652063cf69958312821b5420ee2 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 26 Jan 2025 16:18:41 +0100 Subject: [PATCH 12/28] forgor about the banan spin --- src/p_mobj.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index e2099c861..d21afd0d8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7060,8 +7060,22 @@ void P_MobjThinker(mobj_t *mobj) } break; //{ SRB2kart Items - Death States - case MT_ORBINAUT: case MT_BANANA: + { + if (cv_sloperoll.value == 2 && cv_bananthrowroll.value) + { + angle_t spin = FixedMul(FixedDiv(abs(mobj->momz), 8 * mobj->scale), ANGLE_67h); + //mobj->angle -= spin; + + if (cv_bananthrowroll.value == 1) + mobj->sloperoll += spin; // im lazy but this makes sure the banan goes back to upright when it lands lmao + else if (cv_bananthrowroll.value == 2) + mobj->rollangle += spin; + + //if (P_IsObjectOnGround(mobj) && mobj->momz * P_MobjFlip(mobj) <= 0) + } + } + case MT_ORBINAUT: case MT_EGGMANITEM: case MT_SPB: if (P_IsObjectOnGround(mobj)) @@ -7802,6 +7816,18 @@ void P_MobjThinker(mobj_t *mobj) break; } case MT_BANANA: + if (cv_sloperoll.value == 2 && cv_bananthrowroll.value && !P_IsObjectOnGround(mobj)) + { + // tilt n tumble + angle_t spin = FixedMul(FixedDiv(mobj->momz, 8 * mobj->scale), ANGLE_67h); + //mobj->angle += spin; + + if (cv_bananthrowroll.value == 1) + mobj->sloperoll -= spin; // im lazy but this makes sure the banan goes back to upright when it lands lmao + else if (cv_bananthrowroll.value == 2) + mobj->rollangle -= spin; + } + case MT_EGGMANITEM: mobj->friction = ORIG_FRICTION/4; if (mobj->momx || mobj->momy) From 520f92e892c25681872e736ec41debdae8087672 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 26 Jan 2025 17:57:27 +0100 Subject: [PATCH 13/28] handle vote bg fallbacks more gracefully if someone doesent provide a widescreen patch it now falls back to the replaced non widescreen one and vice versa instead of just falling back to what vanilla provides --- src/p_setup.c | 41 +++++++++++++++++++++++++++++++ src/p_setup.h | 5 ++++ src/y_inter.c | 67 +++++++++++++++++++++++++++++++++------------------ 3 files changed, 90 insertions(+), 23 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 3b2ed7714..652062079 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3074,6 +3074,12 @@ boolean P_AddWadFileLocal(const char *wadfilename) return true; } +// check for replacement votescreen backgrounds +boolean wideracereplaced = false; +boolean racereplaced = false; +boolean widebattlereplaced = false; +boolean battlereplaced = false; + // // Add a WAD file and do the per-WAD setup stages. // Call P_MultiSetupWadFiles as soon as possible after any number of these. @@ -3198,6 +3204,41 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local) // TODO: Experimental SPRTINFO support, test first R_LoadSpriteInfoLumps(wadnum, wadfiles[wadnum]->numlumps); + // + // check for votescreen replacements + // + lumpinfo = wadfiles[wadnum]->lumpinfo; + for (i = 0; i < numlumps; i++, lumpinfo++) + { + name = lumpinfo->name; + + // widescreen patch Race + if (!wideracereplaced && !strncmp(name, "INTERSCW", 8)) + { + wideracereplaced = true; + continue; + } + + if (!racereplaced && !strncmp(name, "INTERSCR", 8)) + { + racereplaced = true; + continue; + } + + // widescreen patch Battle + if (!widebattlereplaced && !strncmp(name, "BATTLSCW", 8)) + { + widebattlereplaced = true; + continue; + } + + if (!battlereplaced && !strncmp(name, "BATTLSCR", 8)) + { + battlereplaced = true; + continue; + } + } + refreshdirmenu &= ~REFRESHDIR_GAMEDATA; // Under usual circumstances we'd wait for REFRESHDIR_GAMEDATA to disappear the next frame, but it's a bit too dangerous for that... partadd_stage = 0; return wadnum; diff --git a/src/p_setup.h b/src/p_setup.h index 7f90564e0..e40169a76 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -67,6 +67,11 @@ void HWR_LoadLevel(void); boolean P_AddWadFile(const char *wadfilename, boolean local); boolean P_AddWadFileLocal(const char *wadfilename); +extern boolean wideracereplaced; +extern boolean racereplaced; +extern boolean widebattlereplaced; +extern boolean battlereplaced; + // WARNING: The following functions should be grouped as follows: // any amount of PartialAdds followed by MultiSetups until returned true, // as soon as possible. diff --git a/src/y_inter.c b/src/y_inter.c index 115967509..2603db48a 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -920,7 +920,7 @@ static void Y_UnloadData(void) // // Draw animated patch based on frame counter on vote screen // -static inline void Y_DrawAnimatedVoteScreenPatch(boolean widePatch) +static void Y_DrawAnimatedVoteScreenPatch(boolean widePatch) { char tempAnimPrefix[7]; widePatch ? strcpy(tempAnimPrefix, animWidePrefix) : strcpy(tempAnimPrefix, animPrefix); @@ -939,6 +939,47 @@ static inline void Y_DrawAnimatedVoteScreenPatch(boolean widePatch) currentAnimFrame = (currentAnimFrame + 1 > tempFoundAnimVoteFrames - 1) ? 0 : currentAnimFrame + 1; } +static void Y_DrawVoteScreenPatch(void) +{ + const boolean widescreen = (vid.width / vid.dupx > 320); + const boolean animvote = (foundAnimVoteWideFrames || foundAnimVoteFrames); + + if (animvote) + { + Y_DrawAnimatedVoteScreenPatch((foundAnimVoteWideFrames && widescreen)); + return; + } + + patch_t *votebg = bgpatch; + UINT8 prefgametype = (votelevels[0][1] & ~0x80); + const boolean widebgreplaced = (prefgametype == GT_MATCH) ? widebattlereplaced : wideracereplaced; + const boolean bgreplaced = (prefgametype == GT_MATCH) ? battlereplaced : racereplaced; + + // this is horrid + if (widescreen) + { + if (widebgreplaced) + votebg = widebgpatch; + else if (bgreplaced) + votebg = bgpatch; + else + votebg = widebgpatch; + } + else + { + if (bgreplaced) + votebg = bgpatch; + else if (widebgreplaced) + votebg = widebgpatch; + else + votebg = bgpatch; + } + + V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(votebg->width)/2), + (vid.height / vid.dupy) - SHORT(votebg->height), + V_SNAPTOTOP|V_SNAPTOLEFT, votebg); +} + // // Y_VoteDrawer // @@ -965,28 +1006,8 @@ void Y_VoteDrawer(void) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); - const boolean widescreen = (vid.width / vid.dupx > 320); - - if (foundAnimVoteWideFrames && widescreen) - { - Y_DrawAnimatedVoteScreenPatch(true); - } - else if (foundAnimVoteFrames) - { - Y_DrawAnimatedVoteScreenPatch(false); - } - else if (widebgpatch && widescreen) - { - V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(widebgpatch->width)/2), - (vid.height / vid.dupy) - SHORT(widebgpatch->height), - V_SNAPTOTOP|V_SNAPTOLEFT, widebgpatch); - } - else - { - V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(bgpatch->width)/2), // Keep the width/height adjustments, for screens that are less wide than 320(?) - (vid.height / vid.dupy) - SHORT(bgpatch->height), - V_SNAPTOTOP|V_SNAPTOLEFT, bgpatch); - } + // decides which votebg to draw and draws it + Y_DrawVoteScreenPatch(); for (i = 0; i < 4; i++) // First, we need to figure out the height of this thing... { From a2c1fa5e233791881f9bd5721227b395cf290b02 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 26 Jan 2025 18:18:23 +0100 Subject: [PATCH 14/28] delet if else hell --- src/y_inter.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 2603db48a..42fdb346f 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -950,29 +950,16 @@ static void Y_DrawVoteScreenPatch(void) return; } - patch_t *votebg = bgpatch; + patch_t *votebg = bgpatch; // non widescreen patch + UINT8 prefgametype = (votelevels[0][1] & ~0x80); const boolean widebgreplaced = (prefgametype == GT_MATCH) ? widebattlereplaced : wideracereplaced; const boolean bgreplaced = (prefgametype == GT_MATCH) ? battlereplaced : racereplaced; - // this is horrid - if (widescreen) + if ((widescreen && (widebgreplaced || !bgreplaced)) + || (!widescreen && (widebgreplaced && !bgreplaced))) { - if (widebgreplaced) - votebg = widebgpatch; - else if (bgreplaced) - votebg = bgpatch; - else - votebg = widebgpatch; - } - else - { - if (bgreplaced) - votebg = bgpatch; - else if (widebgreplaced) - votebg = widebgpatch; - else - votebg = bgpatch; + votebg = widebgpatch; } V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(votebg->width)/2), From 5edb0d0e3d80c3d9e9f26aced7dcc6fec60cc590 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 26 Jan 2025 17:29:19 +0100 Subject: [PATCH 15/28] fall through deez --- src/p_mobj.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index d21afd0d8..45688e510 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7061,7 +7061,6 @@ void P_MobjThinker(mobj_t *mobj) break; //{ SRB2kart Items - Death States case MT_BANANA: - { if (cv_sloperoll.value == 2 && cv_bananthrowroll.value) { angle_t spin = FixedMul(FixedDiv(abs(mobj->momz), 8 * mobj->scale), ANGLE_67h); @@ -7074,7 +7073,7 @@ void P_MobjThinker(mobj_t *mobj) //if (P_IsObjectOnGround(mobj) && mobj->momz * P_MobjFlip(mobj) <= 0) } - } + /* FALLTHRU */ case MT_ORBINAUT: case MT_EGGMANITEM: case MT_SPB: @@ -7827,7 +7826,7 @@ void P_MobjThinker(mobj_t *mobj) else if (cv_bananthrowroll.value == 2) mobj->rollangle -= spin; } - + /* FALLTHRU */ case MT_EGGMANITEM: mobj->friction = ORIG_FRICTION/4; if (mobj->momx || mobj->momy) From 7016b77ee89f52cc68cd0fd196ed1171ffa13d7a Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 26 Jan 2025 21:17:20 +0100 Subject: [PATCH 16/28] also rotate eggboxes in air --- 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 45688e510..0334f7925 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7815,6 +7815,7 @@ void P_MobjThinker(mobj_t *mobj) break; } case MT_BANANA: + case MT_EGGMANITEM: if (cv_sloperoll.value == 2 && cv_bananthrowroll.value && !P_IsObjectOnGround(mobj)) { // tilt n tumble @@ -7826,8 +7827,7 @@ void P_MobjThinker(mobj_t *mobj) else if (cv_bananthrowroll.value == 2) mobj->rollangle -= spin; } - /* FALLTHRU */ - case MT_EGGMANITEM: + mobj->friction = ORIG_FRICTION/4; if (mobj->momx || mobj->momy) P_SpawnGhostMobj(mobj); From 5215fa47476d0a8ec42b96157ff8073668a1977c Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Jan 2025 11:21:23 +0100 Subject: [PATCH 17/28] smol optimization comparePolygon return slightly earlier for skywalls and horizonlines --- src/hardware/hw_batching.c | 40 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index 82cfd31db..3a8161ab3 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -141,27 +141,19 @@ static int comparePolygons(const void *p1, const void *p2) PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2; int diff; INT64 diff64; - UINT32 downloaded1 = 0; - UINT32 downloaded2 = 0; - int shader1 = poly1->shader; - int shader2 = poly2->shader; - // make skywalls and horizon lines first in order - if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial) - shader1 = -1; - if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial) - shader2 = -1; - diff = shader1 - shader2; - if (diff != 0) return diff; + int shader1 = (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial) ? -1 : poly1->shader; + int shader2 = (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial) ? -1 : poly2->shader; // skywalls and horizon lines must retain their order for horizon lines to work if (shader1 == -1 && shader2 == -1) return poly1 - poly2; - if (poly1->texture) - downloaded1 = poly1->texture->downloaded; // there should be a opengl texture name here, usable for comparisons - if (poly2->texture) - downloaded2 = poly2->texture->downloaded; + diff = shader1 - shader2; + if (diff != 0) return diff; + + UINT32 downloaded1 = poly1->texture ? poly1->texture->downloaded : 0; // there should be a opengl texture name here, usable for comparisons + UINT32 downloaded2 = poly2->texture ? poly2->texture->downloaded : 0; diff64 = downloaded1 - downloaded2; if (diff64 != 0) return diff64; @@ -190,21 +182,15 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2) int diff; INT64 diff64; - GLMipmap_t *texture1 = poly1->texture; - GLMipmap_t *texture2 = poly2->texture; - UINT32 downloaded1 = 0; - UINT32 downloaded2 = 0; - if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial) - texture1 = NULL; - if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial) - texture2 = NULL; - if (texture1) - downloaded1 = texture1->downloaded; // there should be a opengl texture name here, usable for comparisons - if (texture2) - downloaded2 = texture2->downloaded; + GLMipmap_t *texture1 = (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial) ? NULL : poly1->texture; + GLMipmap_t *texture2 = (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial) ? NULL : poly2->texture; + // skywalls and horizon lines must retain their order for horizon lines to work if (!texture1 && !texture2) return poly1 - poly2; + + UINT32 downloaded1 = texture1 ? texture1->downloaded : 0; // there should be a opengl texture name here, usable for comparisons + UINT32 downloaded2 = texture2 ? texture2->downloaded : 0; diff64 = downloaded1 - downloaded2; if (diff64 != 0) return diff64; From 80f7ddfb312e619ac91ffc5b417c0d591f2a571c Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Jan 2025 14:54:49 +0100 Subject: [PATCH 18/28] i hate conditions --- src/s_sound.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index ce856b36c..b55d59853 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2005,7 +2005,10 @@ void S_InitMapMusic(void) { char *maptitle = G_BuildMapTitle(gamemap); // for some reason, occasionally the title screen music doesent seem to be reset in time, so skipping the intro may make it just continue playing it instead, weird.. - skipintromus = (stricmp(music_name, "titles") != 0) && (maptitle && (stricmp(maptitle, "Wandering Falls") != 0)); // thanks diggle! + skipintromus = true; + if (!stricmp(music_name, "titles") || (maptitle && (!stricmp(maptitle, "Wandering Falls")))) // thanks diggle! + skipintromus = false; + if (maptitle) Z_Free(maptitle); } From 9872640e778ec97c373ffa125763e34bff9ae25b Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Jan 2025 15:32:47 +0100 Subject: [PATCH 19/28] the music system is truly amazing --- src/p_spec.c | 2 +- src/s_sound.c | 31 ++++++++++++++++++++----------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 1051c6103..78fdb9e12 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2080,7 +2080,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 413: // Change music - if (keepmusic && (leveltime <= MUSICSTARTTIME)) //why check for starttime? cause encore music Zzz... + if (keepmusic && (leveltime <= MUSICSTARTTIME)) // why check for starttime? cause encore music Zzz... return; //if (cv_ignoremusicchanges.value && (leveltime >= MUSICSTARTTIME) && !fromlapexec) // keep lap music intanct tho diff --git a/src/s_sound.c b/src/s_sound.c index b55d59853..4c20019d0 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1728,6 +1728,9 @@ static void S_ChangeMusicToQueue(void) S_ClearQueue(); } +static boolean skipmusic = false; +static boolean S_CheckMusicException(const char *music); + void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 position, UINT32 prefadems, UINT32 fadeinms) { char newmusic[7] = {0}; @@ -1748,6 +1751,8 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 strncpy(newmusic, mmusic, 6); + skipmusic = S_CheckMusicException(newmusic); + if (LUA_HookMusicChange(music_name, &hook_param)) return; @@ -1944,6 +1949,20 @@ static const char *musicexception_list[] = { "CHRSHF", "CHRSHP" // no clue what those are tbh }; +// check if the current music is smth we dont want to keep (vote music, etc) +static boolean S_CheckMusicException(const char *music) +{ + for (size_t i = 0; i < sizeof(musicexception_list)/sizeof(musicexception_list[0]); i++) + { + if (!stricmp(music, musicexception_list[i])) + { + return true; + } + } + + return false; +} + void S_ResetKeepAndSpecialMus(void) { keepmusic = skipintromus = false; @@ -1961,17 +1980,7 @@ void S_KeepMusic(void) } else if (oldmap == gamemap && oldencore == encoremode) { - keepmusic = true; - - // check if the current music is smth we dont want to keep (vote music, etc) - for (size_t i = 0; i < sizeof(musicexception_list)/sizeof(musicexception_list[0]); i++) - { - if (stricmp(music_name, musicexception_list[i]) == 0) - { - keepmusic = false; - break; - } - } + keepmusic = !skipmusic && !S_CheckMusicException(music_name); // have to recheck cause lua may have overwritten initial music_change } oldencore = encoremode; From 22c48f19bab8895a629ef739d9d881d1eb3b38e8 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Jan 2025 16:11:53 +0100 Subject: [PATCH 20/28] grow an invinc music also broke stuff cant put it into the music exception list, otherwise it will always disable keepmusic when either one was used even once --- src/s_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index 4c20019d0..99d3a7e8b 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1980,7 +1980,7 @@ void S_KeepMusic(void) } else if (oldmap == gamemap && oldencore == encoremode) { - keepmusic = !skipmusic && !S_CheckMusicException(music_name); // have to recheck cause lua may have overwritten initial music_change + keepmusic = !skipmusic && !S_CheckMusicException(music_name) && stricmp(music_name, "kgrow") && stricmp(music_name, "kinvnc"); // have to recheck cause lua may have overwritten initial music_change } oldencore = encoremode; From 6276243cc4371c8f8e79e5b3e79fbd58c99b360a Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Jan 2025 16:43:48 +0100 Subject: [PATCH 21/28] just keep a copy of musicchange before the lua hook keep music can check for what was it stuff changed last to --- src/s_sound.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 99d3a7e8b..be9e10234 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1728,8 +1728,9 @@ static void S_ChangeMusicToQueue(void) S_ClearQueue(); } -static boolean skipmusic = false; -static boolean S_CheckMusicException(const char *music); +// keep copy of music name before lua hook change +// for custom vote music etc +static char checkmusic[7] = {0}; void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 position, UINT32 prefadems, UINT32 fadeinms) { @@ -1750,8 +1751,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 return; strncpy(newmusic, mmusic, 6); - - skipmusic = S_CheckMusicException(newmusic); + strncpy(checkmusic, mmusic, 6); if (LUA_HookMusicChange(music_name, &hook_param)) return; @@ -1945,16 +1945,17 @@ static const char *musicexception_list[] = { "vote", "voteea", "voteeb", "racent", "krwin", "krok", "krlose", "krfail", "kbwin", "kbok", "kblose", "kstart", "estart", "wait2j", "titles", + "kinvnc", "kgrow", // grow and invinc "SPBA_W", "SPBA_L", // SPB Attack music - "CHRSHF", "CHRSHP" // no clue what those are tbh + "CHRSHF", "CHRSHP" // no clue what those are tbh }; // check if the current music is smth we dont want to keep (vote music, etc) -static boolean S_CheckMusicException(const char *music) +static boolean S_CheckMusicException(void) { for (size_t i = 0; i < sizeof(musicexception_list)/sizeof(musicexception_list[0]); i++) { - if (!stricmp(music, musicexception_list[i])) + if (!stricmp(music_name, musicexception_list[i]) || !stricmp(checkmusic, musicexception_list[i])) { return true; } @@ -1980,7 +1981,7 @@ void S_KeepMusic(void) } else if (oldmap == gamemap && oldencore == encoremode) { - keepmusic = !skipmusic && !S_CheckMusicException(music_name) && stricmp(music_name, "kgrow") && stricmp(music_name, "kinvnc"); // have to recheck cause lua may have overwritten initial music_change + keepmusic = !S_CheckMusicException(); } oldencore = encoremode; From 50fced2867b4374d497c105e16a038bebff8651f Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 21 Jan 2025 00:50:21 +0100 Subject: [PATCH 22/28] =?UTF-8?q?use=20SRB2.2=C2=B4s=20logging=20system?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - creates a new logfile each start instead of overwriting it everytime --- src/filesrch.c | 2 +- src/m_misc.c | 91 +++++++++++++++++++++++++++++++++ src/m_misc.h | 5 ++ src/sdl/i_main.c | 123 ++++++++++++++++++++++++++++++++++++--------- src/sdl/i_system.c | 45 +++++++++++++++++ 5 files changed, 241 insertions(+), 25 deletions(-) diff --git a/src/filesrch.c b/src/filesrch.c index 84766f395..8af9118ba 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -797,7 +797,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut) } else if (ext == EXT_TXT) { - if (!strcmp(dent->d_name, "log.txt") || !strcmp(dent->d_name, "errorlog.txt")) + if (!strncmp(dent->d_name, "log-", 4) || !strcmp(dent->d_name, "errorlog.txt")) ext |= EXT_LOADED; } diff --git a/src/m_misc.c b/src/m_misc.c index a3768120d..6e6658a0a 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2076,3 +2076,94 @@ const char *M_FileError(FILE *fp) else return "end-of-file"; } + +/** Return the number of parts of this path. +*/ +int M_PathParts(const char *path) +{ + int n; + const char *p; + const char *t; + if (path == NULL) + return 0; + for (n = 0, p = path ;; ++n) + { + t = p; + if (( p = strchr(p, PATHSEP[0]) )) + p += strspn(p, PATHSEP); + else + { + if (*t)/* there is something after the final delimiter */ + n++; + break; + } + } + return n; +} + +/** Check whether a path is an absolute path. +*/ +boolean M_IsPathAbsolute(const char *path) +{ +#ifdef _WIN32 + return ( strncmp(&path[1], ":\\", 2) == 0 ); +#else + return ( path[0] == '/' ); +#endif +} + +/** I_mkdir for each part of the path. +*/ +void M_MkdirEachUntil(const char *cpath, int start, int end, int mode) +{ + char path[MAX_WADPATH]; + char *p; + char *t; + + if (end > 0 && end <= start) + return; + + strlcpy(path, cpath, sizeof path); +#ifdef _WIN32 + if (strncmp(&path[1], ":\\", 2) == 0) + p = &path[3]; + else +#endif + p = path; + + if (end > 0) + end -= start; + + for (; start > 0; --start) + { + p += strspn(p, PATHSEP); + if (!( p = strchr(p, PATHSEP[0]) )) + return; + } + p += strspn(p, PATHSEP); + for (;;) + { + if (end > 0 && !--end) + break; + + t = p; + if (( p = strchr(p, PATHSEP[0]) )) + { + *p = '\0'; + I_mkdir(path, mode); + *p = PATHSEP[0]; + p += strspn(p, PATHSEP); + } + else + { + if (*t) + I_mkdir(path, mode); + break; + } + } +} + +void M_MkdirEach(const char *path, int start, int mode) +{ + M_MkdirEachUntil(path, start, -1, mode); +} diff --git a/src/m_misc.h b/src/m_misc.h index c858ae128..a84493ee1 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -99,6 +99,11 @@ void strcatbf(char *s1, const char *s2, const char *s3); const char *M_FileError(FILE *handle); +int M_PathParts (const char *path); +boolean M_IsPathAbsolute (const char *path); +void M_MkdirEach (const char *path, int start, int mode); +void M_MkdirEachUntil (const char *path, int start, int end, int mode); + // counting bits, for weapon ammo code, usually FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size); diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 1d2e2395f..d6a007919 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -20,12 +20,19 @@ #include "../doomdef.h" #include "../m_argv.h" #include "../d_main.h" +#include "../m_misc.h"/* path shit */ #include "../i_system.h" -#ifdef __GNUC__ +#if defined (__GNUC__) || defined (__unix__) #include #endif +#ifdef __unix__ +#include +#endif + +#include "time.h" // For log timestamps + #ifdef HAVE_SDL #ifdef HAVE_TTF @@ -89,6 +96,93 @@ ChDirToExe (void) } #endif +#ifdef LOGMESSAGES +static void InitLogging(void) +{ + const char *logdir = NULL; + time_t my_time; + struct tm * timeinfo; + const char *format; + const char *reldir; + int left; + boolean fileabs; +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) + const char *link; +#endif + + logdir = D_Home(); + + my_time = time(NULL); + timeinfo = localtime(&my_time); + + if (M_CheckParm("-logfile") && M_IsNextParm()) + { + format = M_GetNextParm(); + fileabs = M_IsPathAbsolute(format); + } + else + { + format = "log-%Y-%m-%d_%H-%M-%S.txt"; + fileabs = false; + } + + if (fileabs) + { + strftime(logfilename, sizeof logfilename, format, timeinfo); + } + else + { + if (M_CheckParm("-logdir") && M_IsNextParm()) + reldir = M_GetNextParm(); + else + reldir = "logs"; + + if (M_IsPathAbsolute(reldir)) + { + left = snprintf(logfilename, sizeof logfilename, + "%s"PATHSEP, reldir); + } + else +#ifdef DEFAULTDIR + if (logdir) + { + left = snprintf(logfilename, sizeof logfilename, + "%s"PATHSEP DEFAULTDIR PATHSEP"%s"PATHSEP, logdir, reldir); + } + else +#endif/*DEFAULTDIR*/ + { + left = snprintf(logfilename, sizeof logfilename, + "."PATHSEP"%s"PATHSEP, reldir); + } + + strftime(&logfilename[left], sizeof logfilename - left, + format, timeinfo); + } + + M_MkdirEachUntil(logfilename, + M_PathParts(logdir) - 1, + M_PathParts(logfilename) - 1, 0755); + +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) + logstream = fopen(logfilename, "w"); +#ifdef DEFAULTDIR + if (logdir) + link = va("%s/"DEFAULTDIR"/latest-log.txt", logdir); + else +#endif/*DEFAULTDIR*/ + link = "latest-log.txt"; + unlink(link); + if (symlink(logfilename, link) == -1) + { + I_OutputMsg("Error symlinking latest-log.txt: %s\n", strerror(errno)); + } +#else/*defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)*/ + logstream = fopen("latest-log.txt", "wt+"); +#endif/*defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)*/ +} +#endif + /** \brief The main function @@ -107,7 +201,6 @@ int SDL_main(int argc, char **argv) int main(int argc, char **argv) #endif { - const char *logdir = NULL; myargc = argc; myargv = argv; /// \todo pull out path to exe from this string @@ -136,36 +229,18 @@ int main(int argc, char **argv) ChDirToExe(); #endif - logdir = D_Home(); - #ifdef LOGMESSAGES -#ifdef DEFAULTDIR - if (logdir) - strcpy(logfilename, va("%s/"DEFAULTDIR"/log.txt",logdir)); - else -#endif - strcpy(logfilename, "./log.txt"); - - logstream = fopen(logfilename, "wt"); -#endif + if (!M_CheckParm("-nolog")) + InitLogging(); +#endif/*LOGMESSAGES*/ //I_OutputMsg("I_StartupSystem() ...\n"); I_StartupSystem(); #if defined (_WIN32) { -#if 0 // just load the DLL - p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsDebuggerPresent"); - if ((!pfnIsDebuggerPresent || !pfnIsDebuggerPresent()) -#ifdef BUGTRAP - && !InitBugTrap() -#endif - ) -#endif - { #ifdef DRMINGW - ExcHndlInit(); + ExcHndlInit(); #endif - } } #endif diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 7302a12e1..20514f105 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2502,6 +2502,48 @@ void I_RemoveExitFunc(void (*func)()) } } +#if !(defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)) +static void Shittycopyerror(const char *name) +{ + I_OutputMsg( + "Error copying log file: %s: %s\n", + name, + strerror(errno) + ); +} + +static void Shittylogcopy(void) +{ + char buf[8192]; + FILE *fp; + size_t r; + if (fseek(logstream, 0, SEEK_SET) == -1) + { + Shittycopyerror("fseek"); + } + else if (( fp = fopen(logfilename, "wt") )) + { + while (( r = fread(buf, 1, sizeof buf, logstream) )) + { + if (fwrite(buf, 1, r, fp) < r) + { + Shittycopyerror("fwrite"); + break; + } + } + if (ferror(logstream)) + { + Shittycopyerror("fread"); + } + fclose(fp); + } + else + { + Shittycopyerror(logfilename); + } +} +#endif/*!(defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON))*/ + // // Closes down everything. This includes restoring the initial // palette and video mode, and removing whatever mouse, keyboard, and @@ -2524,6 +2566,9 @@ void I_ShutdownSystem(void) if (logstream) { I_OutputMsg("I_ShutdownSystem(): end of logstream.\n"); +#if !(defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)) + Shittylogcopy(); +#endif fclose(logstream); logstream = NULL; } From bf9b738a0f7bad27bdbd1889207f2282782c558c Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 21 Jan 2025 01:35:10 +0100 Subject: [PATCH 23/28] use SRB2.2s general folder structure - seperate addons folder (download folder remains in home directory unlike RR) - seperate gif and screenshot folders --- src/d_main.c | 7 +++++-- src/d_netcmd.c | 2 ++ src/m_menu.c | 53 +++++++++++++++++++++++++++++--------------------- src/m_menu.h | 3 +++ src/m_misc.c | 44 ++++++++++++++++++++++++++++------------- src/m_misc.h | 2 +- 6 files changed, 72 insertions(+), 39 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index b97f46028..af25ae2ea 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -133,6 +133,7 @@ char srb2home[256] = "."; char srb2path[256] = "."; boolean usehome = true; const char *pandf = "%s" PATHSEP "%s"; +static char addonsdir[MAX_WADPATH]; // // EVENT HANDLING @@ -1437,8 +1438,6 @@ void D_SRB2Main(void) // can't use sprintf since there is %u in savegamename strcatbf(savegamename, srb2home, PATHSEP); - - I_mkdir(srb2home, 0700); #else snprintf(srb2home, sizeof srb2home, "%s", userhome); snprintf(downloaddir, sizeof downloaddir, "%s", userhome); @@ -1475,6 +1474,10 @@ void D_SRB2Main(void) } } + // Create addons dir + snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons"); + I_mkdir(addonsdir, 0755); + D_SetupProtocol(); // rand() needs seeded regardless of password diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 184fdd70f..5e647ff70 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -868,6 +868,8 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_screenshot_option); CV_RegisterVar(&cv_screenshot_folder); CV_RegisterVar(&cv_moviemode); + CV_RegisterVar(&cv_movie_option); + CV_RegisterVar(&cv_movie_folder); // PNG variables CV_RegisterVar(&cv_zlib_level); CV_RegisterVar(&cv_zlib_memory); diff --git a/src/m_menu.c b/src/m_menu.c index ec4f1bca0..a3a3901f1 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1737,37 +1737,40 @@ static menuitem_t OP_DataOptionsMenu[] = static menuitem_t OP_ScreenshotOptionsMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Storage Location", &cv_screenshot_option, 10}, - {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_screenshot_folder, 20}, + {IT_HEADER, NULL, "Screenshots (F8)", NULL, 5}, + {IT_STRING|IT_CVAR, NULL, "Storage Location", &cv_screenshot_option, 15}, + {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_screenshot_folder, 25}, + {IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memory, 55}, + {IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_level, 65}, + {IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategy, 75}, + {IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bits, 85}, - {IT_HEADER, NULL, "Screenshots (F8)", NULL, 50}, - {IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memory, 60}, - {IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_level, 70}, - {IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategy, 80}, - {IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bits, 90}, + {IT_HEADER, NULL, "Movie Mode (F9)", NULL, 100}, + {IT_STRING|IT_CVAR, NULL, "Storage Location", &cv_movie_option, 110}, + {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_movie_folder, 120}, + {IT_STRING|IT_CVAR, NULL, "Capture Mode", &cv_moviemode, 150}, - {IT_HEADER, NULL, "Movie Mode (F9)", NULL, 105}, - {IT_STRING|IT_CVAR, NULL, "Capture Mode", &cv_moviemode, 115}, + {IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 160}, + {IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 170}, - {IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 125}, - {IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 135}, - - {IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 125}, - {IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_levela, 135}, - {IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategya, 145}, - {IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bitsa, 155}, + {IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 160}, + {IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_levela, 170}, + {IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategya, 180}, + {IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bitsa, 190}, }; enum { - op_screenshot_folder = 1, - op_screenshot_capture = 8, - op_screenshot_gif_start = 9, - op_screenshot_gif_end = 10, - op_screenshot_apng_start = 11, - op_screenshot_apng_end = 14, + op_screenshot_folder = 2, + op_movie_folder = 9, + op_screenshot_capture = 10, + op_screenshot_gif_start = 11, + op_screenshot_gif_end = 12, + op_screenshot_apng_start = 13, + op_screenshot_apng_end = 16, }; + static menuitem_t OP_EraseDataMenu[] = { {IT_STRING | IT_CALL, NULL, "Erase Record Data", M_EraseData, 10}, @@ -3425,6 +3428,12 @@ void Addons_option_Onchange(void) (cv_addons_option.value == 3 ? IT_CVAR|IT_STRING|IT_CV_STRING : IT_DISABLED); } +void Moviemode_option_Onchange(void) +{ + OP_ScreenshotOptionsMenu[op_movie_folder].status = + (cv_movie_option.value == 3 ? IT_CVAR|IT_STRING|IT_CV_STRING : IT_DISABLED); +} + void PDistort_menu_Onchange(void) { if (!cv_sloperoll.value) diff --git a/src/m_menu.h b/src/m_menu.h index 72864c669..4ee8615ce 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -286,6 +286,9 @@ void Screenshot_option_Onchange(void); // Addons menu updating void Addons_option_Onchange(void); +// Moviemode menu updating +void Moviemode_option_Onchange(void); + // Player distortion menu updating void PDistort_menu_Onchange(void); diff --git a/src/m_misc.c b/src/m_misc.c index 6e6658a0a..c6dd4175c 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -110,6 +110,9 @@ consvar_t cv_screenshot_folder = {"screenshot_folder", "", CV_SAVE, NULL, NULL, static CV_PossibleValue_t moviemode_cons_t[] = {{MM_GIF, "GIF"}, {MM_APNG, "aPNG"}, {MM_SCREENSHOT, "Screenshots"}, {0, NULL}}; consvar_t cv_moviemode = {"moviemode_mode", "GIF", CV_SAVE|CV_CALL, moviemode_cons_t, Moviemode_mode_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_movie_option = {"movie_option", "Default", CV_SAVE|CV_CALL, screenshot_cons_t, Moviemode_option_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_movie_folder = {"movie_folder", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + static CV_PossibleValue_t zlib_mem_level_t[] = { {1, "(Min Memory) 1"}, {2, "2"}, {3, "3"}, {4, "4"}, {5, "5"}, {6, "6"}, {7, "7"}, @@ -1144,19 +1147,25 @@ static inline moviemode_t M_StartMovieGIF(const char *pathname) void M_StartMovie(void) { #if NUMSCREENS > 2 - const char *pathname = "."; + char pathname[MAX_WADPATH]; if (moviemode) return; - if (cv_screenshot_option.value == 0) - pathname = usehome ? srb2home : srb2path; - else if (cv_screenshot_option.value == 1) - pathname = srb2home; - else if (cv_screenshot_option.value == 2) - pathname = srb2path; - else if (cv_screenshot_option.value == 3 && *cv_screenshot_folder.string != '\0') - pathname = cv_screenshot_folder.string; + if (cv_movie_option.value == 0) + strcpy(pathname, usehome ? srb2home : srb2path); + else if (cv_movie_option.value == 1) + strcpy(pathname, srb2home); + else if (cv_movie_option.value == 2) + strcpy(pathname, srb2path); + else if (cv_movie_option.value == 3 && *cv_movie_folder.string != '\0') + strcpy(pathname, cv_movie_folder.string); + + if (cv_movie_option.value != 3) + { + strcat(pathname, PATHSEP"gifs"PATHSEP); + I_mkdir(pathname, 0755); + } if (rendermode == render_none) I_Error("Can't make a movie without a render system\n"); @@ -1482,7 +1491,8 @@ void M_ScreenShot(void) void M_DoScreenShot(void) { #if NUMSCREENS > 2 - const char *freename = NULL, *pathname = "."; + const char *freename = NULL; + char pathname[MAX_WADPATH]; boolean ret = false; UINT8 *linear = NULL; @@ -1494,13 +1504,19 @@ void M_DoScreenShot(void) return; if (cv_screenshot_option.value == 0) - pathname = usehome ? srb2home : srb2path; + strcpy(pathname, usehome ? srb2home : srb2path); else if (cv_screenshot_option.value == 1) - pathname = srb2home; + strcpy(pathname, srb2home); else if (cv_screenshot_option.value == 2) - pathname = srb2path; + strcpy(pathname, srb2path); else if (cv_screenshot_option.value == 3 && *cv_screenshot_folder.string != '\0') - pathname = cv_screenshot_folder.string; + strcpy(pathname, cv_screenshot_folder.string); + + if (cv_screenshot_option.value != 3) + { + strcat(pathname, PATHSEP"screenshots"PATHSEP); + I_mkdir(pathname, 0755); + } #ifdef USE_PNG freename = Newsnapshotfile(pathname,"png"); diff --git a/src/m_misc.h b/src/m_misc.h index a84493ee1..013da2235 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -30,7 +30,7 @@ typedef enum { extern moviemode_t moviemode; extern consvar_t cv_screenshot_option, cv_screenshot_folder; -extern consvar_t cv_moviemode; +extern consvar_t cv_moviemode, cv_movie_folder, cv_movie_option; extern consvar_t cv_zlib_memory, cv_zlib_level, cv_zlib_strategy, cv_zlib_window_bits; extern consvar_t cv_zlib_memorya, cv_zlib_levela, cv_zlib_strategya, cv_zlib_window_bitsa; extern consvar_t cv_apng_delay; From 2a05f630b3f948d35af6588580c32e78b9e6d92f Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 20 Jan 2025 21:12:06 +0100 Subject: [PATCH 24/28] dont cache all those unused hud graphics --- src/hu_stuff.c | 1 - src/hu_stuff.h | 1 - src/st_stuff.c | 153 ------------------------------------------------- src/st_stuff.h | 6 -- 4 files changed, 161 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 6cbb46148..d7beb2f1c 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -100,7 +100,6 @@ patch_t *rflagico; patch_t *bflagico; patch_t *rmatcico; patch_t *bmatcico; -patch_t *tagico; patch_t *tallminus; //------------------------------------------- diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 66459c716..efea1f9c4 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -101,7 +101,6 @@ extern patch_t *rflagico; extern patch_t *bflagico; extern patch_t *rmatcico; extern patch_t *bmatcico; -extern patch_t *tagico; extern patch_t *tallminus; // set true whenever the tab rankings are being shown for any reason diff --git a/src/st_stuff.c b/src/st_stuff.c index 8b431b2f0..45d364914 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -77,73 +77,6 @@ char *localfacemmapprefix_name[MAXLOCALSKINS]; // minimap*/ // status bar overlay // ------------------------------------------ -// icons for overlay -patch_t *sboscore; // Score logo -patch_t *sbotime; // Time logo -patch_t *sbocolon; // Colon for time -patch_t *sboperiod; // Period for time centiseconds -patch_t *livesback; // Lives icon background -static patch_t *nrec_timer; // Timer for NiGHTS records -static patch_t *sborings; -static patch_t *sboover; -static patch_t *timeover; -static patch_t *stlivex; -static patch_t *rrings; -static patch_t *getall; // Special Stage HUD -static patch_t *timeup; // Special Stage HUD -static patch_t *hunthoming[6]; -static patch_t *itemhoming[6]; -static patch_t *race1; -static patch_t *race2; -static patch_t *race3; -static patch_t *racego; -//static patch_t *ttlnum; -static patch_t *nightslink; -static patch_t *count5; -static patch_t *count4; -static patch_t *count3; -static patch_t *count2; -static patch_t *count1; -static patch_t *count0; -static patch_t *curweapon; -static patch_t *normring; -static patch_t *bouncering; -static patch_t *infinityring; -static patch_t *autoring; -static patch_t *explosionring; -static patch_t *scatterring; -static patch_t *grenadering; -static patch_t *railring; -static patch_t *jumpshield; -static patch_t *forceshield; -static patch_t *ringshield; -static patch_t *watershield; -static patch_t *bombshield; -static patch_t *pityshield; -static patch_t *invincibility; -static patch_t *sneakers; -static patch_t *gravboots; -static patch_t *nonicon; -static patch_t *bluestat; -static patch_t *byelstat; -static patch_t *orngstat; -static patch_t *redstat; -static patch_t *yelstat; -static patch_t *nbracket; -static patch_t *nhud[12]; -static patch_t *nsshud; -static patch_t *narrow[9]; -static patch_t *nredar[8]; // Red arrow -static patch_t *drillbar; -static patch_t *drillfill[3]; -static patch_t *capsulebar; -static patch_t *capsulefill; -patch_t *ngradeletters[7]; -static patch_t *minus5sec; -static patch_t *minicaps; -static patch_t *gotrflag; -static patch_t *gotbflag; - // Midnight Channel: static patch_t *hud_tv1; static patch_t *hud_tv2; @@ -280,8 +213,6 @@ void ST_UnloadGraphics(void) void ST_LoadGraphics(void) { - int i; - // SRB2 border patch st_borderpatchnum = W_GetNumForName("GFZFLR01"); scr_borderpatch = W_CacheLumpNum(st_borderpatchnum, PU_HUDGFX); @@ -291,95 +222,11 @@ void ST_LoadGraphics(void) // but load them in R_AddSkins, that gets called // first anyway // cache the status bar overlay icons (fullscreen mode) - sborings = W_CachePatchName("SBORINGS", PU_HUDGFX); - sboscore = W_CachePatchName("SBOSCORE", PU_HUDGFX); - sboover = W_CachePatchName("SBOOVER", PU_HUDGFX); - timeover = W_CachePatchName("TIMEOVER", PU_HUDGFX); - stlivex = W_CachePatchName("STLIVEX", PU_HUDGFX); - livesback = W_CachePatchName("STLIVEBK", PU_HUDGFX); - rrings = W_CachePatchName("RRINGS", PU_HUDGFX); - sbotime = W_CachePatchName("SBOTIME", PU_HUDGFX); // Time logo - sbocolon = W_CachePatchName("SBOCOLON", PU_HUDGFX); // Colon for time - sboperiod = W_CachePatchName("SBOPERIO", PU_HUDGFX); // Period for time centiseconds - nrec_timer = W_CachePatchName("NGRTIMER", PU_HUDGFX); // Timer for NiGHTS - getall = W_CachePatchName("GETALL", PU_HUDGFX); // Special Stage HUD - timeup = W_CachePatchName("TIMEUP", PU_HUDGFX); // Special Stage HUD - race1 = W_CachePatchName("RACE1", PU_HUDGFX); - race2 = W_CachePatchName("RACE2", PU_HUDGFX); - race3 = W_CachePatchName("RACE3", PU_HUDGFX); - racego = W_CachePatchName("RACEGO", PU_HUDGFX); - nightslink = W_CachePatchName("NGHTLINK", PU_HUDGFX); - count5 = W_CachePatchName("DRWNF0", PU_HUDGFX); - count4 = W_CachePatchName("DRWNE0", PU_HUDGFX); - count3 = W_CachePatchName("DRWND0", PU_HUDGFX); - count2 = W_CachePatchName("DRWNC0", PU_HUDGFX); - count1 = W_CachePatchName("DRWNB0", PU_HUDGFX); - count0 = W_CachePatchName("DRWNA0", PU_HUDGFX); - for (i = 0; i < 6; ++i) - { - hunthoming[i] = W_CachePatchName(va("HOMING%d", i+1), PU_HUDGFX); - itemhoming[i] = W_CachePatchName(va("HOMITM%d", i+1), PU_HUDGFX); - } - - curweapon = W_CachePatchName("CURWEAP", PU_HUDGFX); - normring = W_CachePatchName("RINGIND", PU_HUDGFX); - bouncering = W_CachePatchName("BNCEIND", PU_HUDGFX); - infinityring = W_CachePatchName("INFNIND", PU_HUDGFX); - autoring = W_CachePatchName("AUTOIND", PU_HUDGFX); - explosionring = W_CachePatchName("BOMBIND", PU_HUDGFX); - scatterring = W_CachePatchName("SCATIND", PU_HUDGFX); - grenadering = W_CachePatchName("GRENIND", PU_HUDGFX); - railring = W_CachePatchName("RAILIND", PU_HUDGFX); - jumpshield = W_CachePatchName("WHTVB0", PU_HUDGFX); - forceshield = W_CachePatchName("BLTVB0", PU_HUDGFX); - ringshield = W_CachePatchName("YLTVB0", PU_HUDGFX); - watershield = W_CachePatchName("ELTVB0", PU_HUDGFX); - bombshield = W_CachePatchName("BKTVB0", PU_HUDGFX); - pityshield = W_CachePatchName("GRTVB0", PU_HUDGFX); - invincibility = W_CachePatchName("PINVB0", PU_HUDGFX); - sneakers = W_CachePatchName("SHTVB0", PU_HUDGFX); - gravboots = W_CachePatchName("GBTVB0", PU_HUDGFX); - - tagico = W_CachePatchName("TAGICO", PU_HUDGFX); rflagico = W_CachePatchName("RFLAGICO", PU_HUDGFX); bflagico = W_CachePatchName("BFLAGICO", PU_HUDGFX); rmatcico = W_CachePatchName("RMATCICO", PU_HUDGFX); bmatcico = W_CachePatchName("BMATCICO", PU_HUDGFX); - gotrflag = W_CachePatchName("GOTRFLAG", PU_HUDGFX); - gotbflag = W_CachePatchName("GOTBFLAG", PU_HUDGFX); - nonicon = W_CachePatchName("NONICON", PU_HUDGFX); - - // NiGHTS HUD things - bluestat = W_CachePatchName("BLUESTAT", PU_HUDGFX); - byelstat = W_CachePatchName("BYELSTAT", PU_HUDGFX); - orngstat = W_CachePatchName("ORNGSTAT", PU_HUDGFX); - redstat = W_CachePatchName("REDSTAT", PU_HUDGFX); - yelstat = W_CachePatchName("YELSTAT", PU_HUDGFX); - nbracket = W_CachePatchName("NBRACKET", PU_HUDGFX); - for (i = 0; i < 12; ++i) - nhud[i] = W_CachePatchName(va("NHUD%d", i+1), PU_HUDGFX); - nsshud = W_CachePatchName("NSSHUD", PU_HUDGFX); - minicaps = W_CachePatchName("MINICAPS", PU_HUDGFX); - - for (i = 0; i < 8; ++i) - { - narrow[i] = W_CachePatchName(va("NARROW%d", i+1), PU_HUDGFX); - nredar[i] = W_CachePatchName(va("NREDAR%d", i+1), PU_HUDGFX); - } - - // non-animated version - narrow[8] = W_CachePatchName("NARROW9", PU_HUDGFX); - - drillbar = W_CachePatchName("DRILLBAR", PU_HUDGFX); - for (i = 0; i < 3; ++i) - drillfill[i] = W_CachePatchName(va("DRILLFI%d", i+1), PU_HUDGFX); - capsulebar = W_CachePatchName("CAPSBAR", PU_HUDGFX); - capsulefill = W_CachePatchName("CAPSFILL", PU_HUDGFX); - minus5sec = W_CachePatchName("MINUS5", PU_HUDGFX); - - for (i = 0; i < 7; ++i) - ngradeletters[i] = W_CachePatchName(va("GRADE%d", i), PU_HUDGFX); K_LoadKartHUDGraphics(); diff --git a/src/st_stuff.h b/src/st_stuff.h index 250db1e7f..bb15e827d 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -71,10 +71,6 @@ extern UINT8 stplyrnum; extern lumpnum_t st_borderpatchnum; // patches, also used in intermission extern patch_t *tallnum[10]; -extern patch_t *sboscore; -extern patch_t *sbotime; -extern patch_t *sbocolon; -extern patch_t *sboperiod; extern patch_t *facerankprefix[MAXSKINS]; // ranking extern patch_t *facewantprefix[MAXSKINS]; // wanted extern patch_t *facemmapprefix[MAXSKINS]; // minimap @@ -87,8 +83,6 @@ extern char *facemmapprefix_name[MAXSKINS]; // minimap extern char *localfacerankprefix_name[MAXLOCALSKINS]; // ranking extern char *localfacewantprefix_name[MAXLOCALSKINS]; // wanted extern char *localfacemmapprefix_name[MAXLOCALSKINS]; // minimap*/ -extern patch_t *livesback; -extern patch_t *ngradeletters[7]; /** HUD location information (don't move this comment) */ From 6e81cdcb0184beabe13f7637bae2f466ff5f9335 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 20 Jan 2025 21:30:37 +0100 Subject: [PATCH 25/28] kill even more unused patches + nonexistant crosshair stuff --- src/d_netcmd.c | 4 ---- src/g_game.c | 5 ----- src/g_game.h | 1 - src/hu_stuff.c | 60 -------------------------------------------------- src/hu_stuff.h | 5 ----- src/v_video.c | 2 +- 6 files changed, 1 insertion(+), 76 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 5e647ff70..0168acc0e 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -972,10 +972,6 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_showlocalskinmenus); - //CV_RegisterVar(&cv_crosshair); - //CV_RegisterVar(&cv_crosshair2); - //CV_RegisterVar(&cv_crosshair3); - //CV_RegisterVar(&cv_crosshair4); //CV_RegisterVar(&cv_alwaysfreelook); //CV_RegisterVar(&cv_alwaysfreelook2); //CV_RegisterVar(&cv_chasefreelook); diff --git a/src/g_game.c b/src/g_game.c index 419704b70..86be0e159 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -401,10 +401,6 @@ static CV_PossibleValue_t powermusic_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "SFX consvar_t cv_growmusic = {"growmusic", "On", CV_SAVE, powermusic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_supermusic = {"supermusic", "On", CV_SAVE, powermusic_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_invertmouse2 = {"invertmouse2", "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}; @@ -414,7 +410,6 @@ consvar_t cv_chasefreelook2 = {"chasemlook2", "Off", CV_SAVE, CV_OnOff, NULL, 0, consvar_t cv_mousemove = {"mousemove", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_mousemove2 = {"mousemove2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 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"}, {1, "Left X"}, {2, "Left Y"}, {-1, "Left X-"}, {-2, "Left Y-"}, #if JOYAXISSET > 1 diff --git a/src/g_game.h b/src/g_game.h index 107741d75..9fad6b0c8 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -118,7 +118,6 @@ extern consvar_t cv_songcredits; extern consvar_t cv_showfreeplay; extern consvar_t cv_growmusic, cv_supermusic; extern consvar_t cv_pauseifunfocused; -//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4; extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/; extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index d7beb2f1c..d279c37b9 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -69,7 +69,6 @@ patch_t *hu_font[HU_FONTSIZE]; patch_t *kart_font[KART_FONTSIZE]; // SRB2kart patch_t *tny_font[HU_FONTSIZE]; patch_t *tallnum[10]; // 0-9 -patch_t *nightsnum[10]; // 0-9 // Level title and credits fonts patch_t *lt_font[LT_FONTSIZE]; @@ -102,21 +101,6 @@ patch_t *rmatcico; patch_t *bmatcico; patch_t *tallminus; -//------------------------------------------- -// coop hud -//------------------------------------------- - -patch_t *emeraldpics[7]; -patch_t *tinyemeraldpics[7]; -static patch_t *emblemicon; -static patch_t *tokenicon; - -//------------------------------------------- -// misc vars -//------------------------------------------- - -// crosshair 0 = off, 1 = cross, 2 = angle, 3 = point, see m_menu.c -static patch_t *crosshair[HU_CROSSHAIRS]; // 3 precached crosshair graphics // song credits static patch_t *songcreditbg; @@ -380,8 +364,6 @@ void HU_LoadGraphics(void) { sprintf(buffer, "STTNUM%d", i); tallnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX); - sprintf(buffer, "NGTNUM%d", i); - nightsnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); sprintf(buffer, "PINGN%d", i); pingnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); sprintf(buffer, "OPPRNK0%d", i); @@ -391,32 +373,6 @@ void HU_LoadGraphics(void) // minus for negative tallnums tallminus = (patch_t *)W_CachePatchName("STTMINUS", PU_HUDGFX); - // cache the crosshairs, don't bother to know which one is being used, - // just cache all 3, they're so small anyway. - for (i = 0; i < HU_CROSSHAIRS; i++) - { - sprintf(buffer, "CROSHAI%c", '1'+i); - crosshair[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX); - } - - emblemicon = W_CachePatchName("EMBLICON", PU_HUDGFX); - tokenicon = W_CachePatchName("TOKNICON", PU_HUDGFX); - - emeraldpics[0] = W_CachePatchName("CHAOS1", PU_HUDGFX); - emeraldpics[1] = W_CachePatchName("CHAOS2", PU_HUDGFX); - emeraldpics[2] = W_CachePatchName("CHAOS3", PU_HUDGFX); - emeraldpics[3] = W_CachePatchName("CHAOS4", PU_HUDGFX); - emeraldpics[4] = W_CachePatchName("CHAOS5", PU_HUDGFX); - emeraldpics[5] = W_CachePatchName("CHAOS6", PU_HUDGFX); - emeraldpics[6] = W_CachePatchName("CHAOS7", PU_HUDGFX); - tinyemeraldpics[0] = W_CachePatchName("TEMER1", PU_HUDGFX); - tinyemeraldpics[1] = W_CachePatchName("TEMER2", PU_HUDGFX); - tinyemeraldpics[2] = W_CachePatchName("TEMER3", PU_HUDGFX); - tinyemeraldpics[3] = W_CachePatchName("TEMER4", PU_HUDGFX); - tinyemeraldpics[4] = W_CachePatchName("TEMER5", PU_HUDGFX); - tinyemeraldpics[5] = W_CachePatchName("TEMER6", PU_HUDGFX); - tinyemeraldpics[6] = W_CachePatchName("TEMER7", PU_HUDGFX); - songcreditbg = W_CachePatchName("K_SONGCR", PU_HUDGFX); // cache ping gfx: @@ -2288,22 +2244,6 @@ void HU_Drawer(void) if (gamestate != GS_LEVEL) return; - // draw the crosshair, not when viewing demos nor with chasecam - /*if (!automapactive && !demo.playback) - { - if (cv_crosshair.value && !camera[0].chase && !players[displayplayers[0]].spectator) - HU_DrawCrosshair(); - - if (cv_crosshair2.value && !camera[1].chase && !players[displayplayers[1]].spectator) - HU_DrawCrosshair2(); - - if (cv_crosshair3.value && !camera[2].chase && !players[displayplayers[2]].spectator) - HU_DrawCrosshair3(); - - if (cv_crosshair4.value && !camera[3].chase && !players[displayplayers[3]].spectator) - HU_DrawCrosshair4(); - }*/ - // draw song credits if (cv_songcredits.value) HU_DrawSongCredits(); diff --git a/src/hu_stuff.h b/src/hu_stuff.h index efea1f9c4..acc815617 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -42,8 +42,6 @@ #define CRED_FONTEND 'Z' // the last font character #define CRED_FONTSIZE (CRED_FONTEND - CRED_FONTSTART + 1) -#define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init(); - extern char *shiftxform; // english translation shift table extern char english_shiftxform[]; @@ -90,13 +88,10 @@ extern patch_t *tallnum[10]; extern patch_t *pingnum[10]; extern patch_t *pinggfx[5]; extern patch_t *ranknum[10]; -extern patch_t *nightsnum[10]; extern patch_t *framecounter; extern patch_t *frameslash; extern patch_t *lt_font[LT_FONTSIZE]; extern patch_t *cred_font[CRED_FONTSIZE]; -extern patch_t *emeraldpics[7]; -extern patch_t *tinyemeraldpics[7]; extern patch_t *rflagico; extern patch_t *bflagico; extern patch_t *rmatcico; diff --git a/src/v_video.c b/src/v_video.c index 987a40a03..6a0ad5f16 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -714,7 +714,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca // TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!? offsety = FixedMul(SHORT(patch->topoffset)< Date: Mon, 23 Dec 2024 18:06:56 +0100 Subject: [PATCH 26/28] make those const --- src/p_floor.c | 18 +++++++++--------- src/p_map.c | 10 ++++------ src/p_mobj.c | 4 ++-- src/p_spec.c | 8 ++++---- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index 17e32c089..8e6912523 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2119,11 +2119,11 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) sec = §ors[secnum]; FOFsector = false; - INT32 special = GETSECSPECIAL(sec->special, 2); + const INT32 secspecial = GETSECSPECIAL(sec->special, 2); - if (special == 3 || special == 5) + if (secspecial == 3 || secspecial == 5) floortouch = true; - else if (special >= 1 && special <= 8) + else if (secspecial >= 1 && secspecial <= 8) floortouch = false; else continue; @@ -2255,7 +2255,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) continue; if (!(players[i].mo->subsector->sector == sec - || P_PlayerTouchingSectorSpecial(&players[i], 2, special) == sec)) + || P_PlayerTouchingSectorSpecial(&players[i], 2, secspecial) == sec)) continue; if (floortouch == true && P_IsObjectOnRealGround(players[i].mo, sec)) @@ -2299,9 +2299,9 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) while ((affectPlayer = P_HavePlayersEnteredArea(playersArea, oldPlayersArea, inAndOut)) != -1) { - INT32 special = GETSECSPECIAL(sec->special, 2); + const INT32 secspecial = GETSECSPECIAL(sec->special, 2); - if (special == 2 || special == 3) + if (secspecial == 2 || secspecial == 3) { for (i = 0; i < MAXPLAYERS; i++) { @@ -2920,12 +2920,12 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover) fixed_t a, b, c; mobjtype_t type = MT_ROCKCRUMBLE1; const fixed_t spacing = 48*mapobjectscale; - INT32 special = GETSECSPECIAL(rover->master->frontsector->special, 3); + const INT32 secspecial = GETSECSPECIAL(rover->master->frontsector->special, 3); // If the control sector has a special // of Section3:7-15, use the custom debris. - if (special >= 8) - type = MT_ROCKCRUMBLE1+(special-7); + if (secspecial >= 8) + type = MT_ROCKCRUMBLE1+(secspecial-7); // soundorg z height never gets set normally, so MEH. sec->soundorg.z = sec->floorheight; diff --git a/src/p_map.c b/src/p_map.c index 00a3bb1b2..21965da0b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2407,19 +2407,17 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { //All things are affected by their scale. fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale); - INT32 special = 0; + const INT32 secspecial = (thing->player) ? GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) : 0; if (thing->player) { - special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1); - // If using type Section1:13, double the maxstep. if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) - || special == 13) + || secspecial == 13) maxstep <<= 1; // If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls) else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12) - || special == 12) + || secspecial == 12) maxstep = 0; } @@ -2465,7 +2463,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) else if (maxstep > 0 && !( thing->player && ( P_PlayerTouchingSectorSpecial(thing->player, 1, 14) - || special == 14) + || secspecial == 14) )) // Step down { // If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS diff --git a/src/p_mobj.c b/src/p_mobj.c index 0334f7925..77e65c24f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1887,13 +1887,13 @@ boolean P_CheckDeathPitCollide(mobj_t *mo) I_Assert(mo != NULL); I_Assert(!P_MobjWasRemoved(mo)); - INT32 special = GETSECSPECIAL(mo->subsector->sector->special, 1); + const INT32 secspecial = GETSECSPECIAL(mo->subsector->sector->special, 1); if (((mo->z <= mo->subsector->sector->floorheight && !(mo->eflags & MFE_VERTICALFLIP) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_FLOOR)) || (mo->z + mo->height >= mo->subsector->sector->ceilingheight && (mo->eflags & MFE_VERTICALFLIP) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_CEILING))) - && (special == 6 || special == 7)) + && (secspecial == 6 || secspecial == 7)) return true; return false; diff --git a/src/p_spec.c b/src/p_spec.c index 78fdb9e12..3f9dfd626 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1427,14 +1427,14 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller } else if (caller) { - INT32 special = GETSECSPECIAL(caller->special, 2); + const INT32 secspecial = GETSECSPECIAL(caller->special, 2); - if (special == 6) + if (secspecial == 6) { if (!(ALL7EMERALDS(emeralds))) return false; } - else if (special == 7) // SRB2Kart: reusing for Race Lap executor + else if (secspecial == 7) // SRB2Kart: reusing for Race Lap executor { UINT8 lap; @@ -1468,7 +1468,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller // If we were not triggered by a sector type especially for the purpose, // a Linedef Executor linedef trigger is not handling sector triggers properly, return. - else if ((!special || special > 7) && (specialtype > 322)) + else if ((!secspecial || secspecial > 7) && (specialtype > 322)) { CONS_Alert(CONS_WARNING, M_GetText("Linedef executor trigger isn't handling sector triggers properly!\nspecialtype = %d, if you are not a dev, report this warning instance\nalong with the wad that caused it!\n"), From ce00aef8b14738527f29b6f1d18cbd03ebc73469 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 30 Jan 2025 13:25:12 +0100 Subject: [PATCH 27/28] partly revert this some of those "mightve" been changed at the point of the check --- src/p_floor.c | 2 +- src/p_map.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index 8e6912523..2277de838 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2255,7 +2255,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) continue; if (!(players[i].mo->subsector->sector == sec - || P_PlayerTouchingSectorSpecial(&players[i], 2, secspecial) == sec)) + || P_PlayerTouchingSectorSpecial(&players[i], 2, GETSECSPECIAL(sec->special, 2)) == sec)) continue; if (floortouch == true && P_IsObjectOnRealGround(players[i].mo, sec)) diff --git a/src/p_map.c b/src/p_map.c index 21965da0b..f0ef1fe37 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2407,10 +2407,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { //All things are affected by their scale. fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale); - const INT32 secspecial = (thing->player) ? GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) : 0; if (thing->player) { + const INT32 secspecial = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1); + // If using type Section1:13, double the maxstep. if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) || secspecial == 13) @@ -2463,7 +2464,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) else if (maxstep > 0 && !( thing->player && ( P_PlayerTouchingSectorSpecial(thing->player, 1, 14) - || secspecial == 14) + || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14) )) // Step down { // If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS From 88d5ca0b8af558cc3c1413b40637a62862c5c7b3 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 2 Feb 2025 00:19:38 +0100 Subject: [PATCH 28/28] should revert this completely --- src/p_map.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index f0ef1fe37..f3fe96868 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2410,15 +2410,13 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thing->player) { - const INT32 secspecial = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1); - // If using type Section1:13, double the maxstep. if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) - || secspecial == 13) + || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13) maxstep <<= 1; // If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls) else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12) - || secspecial == 12) + || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 12) maxstep = 0; }