From badf395dade232b74e8327949b45d6bcd846602f Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 10 Nov 2023 22:37:40 +0100 Subject: [PATCH 001/112] Remove WIndows shake thing noone likes it also theres been reports of this thing triggering false positives in anti viruses --- src/d_main.c | 2 -- src/doomstat.h | 2 -- src/i_system.h | 2 -- src/m_menu.c | 2 -- src/p_local.h | 1 - src/p_tick.c | 2 -- src/p_user.c | 1 - src/r_main.c | 1 - src/sdl/i_system.c | 6 ------ src/sdl/i_video.c | 3 --- 10 files changed, 22 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 3d946dd85..ed5363c13 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -94,8 +94,6 @@ // platform independant focus loss UINT8 window_notinfocus = false; -INT32 window_x; -INT32 window_y; // // DEMO LOOP diff --git a/src/doomstat.h b/src/doomstat.h index fc4c38733..3f90eb531 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -108,8 +108,6 @@ extern boolean digital_disabled; extern boolean menuactive; // Menu overlaid? extern UINT8 paused; // Game paused? extern UINT8 window_notinfocus; // are we in focus? (backend independant -- handles auto pausing and display of "focus lost" message) -extern INT32 window_x; -extern INT32 window_y; extern boolean nodrawers; extern boolean noblit; diff --git a/src/i_system.h b/src/i_system.h index 05826c79e..87198c923 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -369,6 +369,4 @@ const char *I_ClipboardPaste(void); void I_RegisterSysCommands(void); -void I_CursedWindowMovement(int xd, int yd); - #endif diff --git a/src/m_menu.c b/src/m_menu.c index c61b2b6bc..59fb8342b 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1918,8 +1918,6 @@ static menuitem_t OP_TiltMenu[] = {IT_STRING | IT_CVAR, NULL, "Smoothing Divisor", &cv_tiltsmoothing, 20}, {IT_STRING | IT_CVAR, NULL, "Also Tilt During Quakes", &cv_actionmovie, 40}, - - {IT_STRING | IT_CVAR, NULL, "\x85" "Window Shaking During Quakes", &cv_windowquake, 60}, }; enum diff --git a/src/p_local.h b/src/p_local.h index bb7c62046..df8df412e 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -142,7 +142,6 @@ extern consvar_t cv_quaketilt; extern consvar_t cv_tiltsmoothing; extern consvar_t cv_actionmovie; -extern consvar_t cv_windowquake; extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate; extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate; diff --git a/src/p_tick.c b/src/p_tick.c index 38900db9f..39e32e4c8 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -772,8 +772,6 @@ void P_Ticker(boolean run) quake.x = M_RandomRange(-ir,ir); quake.y = M_RandomRange(-ir,ir); quake.z = M_RandomRange(-ir,ir); - if (cv_windowquake.value) - I_CursedWindowMovement(FixedInt(quake.x), FixedInt(quake.y)); ir >>= 2; ir = M_RandomRange(-ir,ir); if (ir < 0) diff --git a/src/p_user.c b/src/p_user.c index 9a660b70e..fb300829e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7159,7 +7159,6 @@ consvar_t cv_quaketilt = {"quaketilt", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, consvar_t cv_tiltsmoothing = {"tiltsmoothing", "32", CV_SAVE, CV_Natural, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_actionmovie = {"actionmovie", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_windowquake = {"windowquake", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; fixed_t t_cam_dist = -42; fixed_t t_cam_height = -42; diff --git a/src/r_main.c b/src/r_main.c index 1beb80c8a..d2907b2aa 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1940,7 +1940,6 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_quaketilt); CV_RegisterVar(&cv_tiltsmoothing); CV_RegisterVar(&cv_actionmovie); - CV_RegisterVar(&cv_windowquake); CV_RegisterVar(&cv_driftsparkpulse); CV_RegisterVar(&cv_gravstretch); diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 7a9d48678..a2eb279f8 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1034,12 +1034,6 @@ INT32 I_GetKey (void) return rc; } -void -I_CursedWindowMovement (int xd, int yd) -{ - SDL_SetWindowPosition(window, window_x + xd, window_y + yd); -} - // // I_JoyScale // diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 82e279093..d3085b14b 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -640,9 +640,6 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) break; case SDL_WINDOWEVENT_MAXIMIZED: break; - case SDL_WINDOWEVENT_MOVED: - window_x = evt.data1; - window_y = evt.data2; } if (mousefocus && kbfocus) -- 2.54.0 From 5cfe9a4c4ee5c3bf5892f0c07c12695733d7aab5 Mon Sep 17 00:00:00 2001 From: Indev Date: Sat, 11 Nov 2023 18:27:24 +0300 Subject: [PATCH 002/112] Optimize gif recording in opengl a bit --- src/hardware/hw_draw.c | 5 ++++- src/m_anigif.c | 26 +++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 8f94abbba..cfb9fae2c 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -1138,10 +1138,13 @@ static inline boolean saveTGA(const char *file_name, void *buffer, UINT8 *HWR_GetScreenshot(void) { - UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf)); + static UINT8 *buf = NULL; + + buf = realloc(buf, vid.width * vid.height * 3); if (!buf) return NULL; + // returns 24bit 888 RGB HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf); return buf; diff --git a/src/m_anigif.c b/src/m_anigif.c index 8071f030d..744651319 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -465,19 +465,23 @@ static size_t gifframe_size = 8192; static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr) { UINT8 r, g, b; - size_t src = 0, dest = 0; - size_t size = (vid.width * vid.height * 3); + size_t src, dest; + int x, y; InitColorLUT(); - while (src < size) + for (x = 0; x < vid.width; x += scrbuf_downscaleamt) { - r = (UINT8)linear[src]; - g = (UINT8)linear[src + 1]; - b = (UINT8)linear[src + 2]; - scr[dest] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS]; - src += (3 * scrbuf_downscaleamt); - dest += scrbuf_downscaleamt; + for (y = 0; y < vid.height; y += scrbuf_downscaleamt) + { + dest = y*vid.width + x; + src = dest*3; + + r = (UINT8)linear[src]; + g = (UINT8)linear[src + 1]; + b = (UINT8)linear[src + 2]; + scr[dest] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS]; + } } } #endif @@ -514,7 +518,7 @@ static void GIF_framewrite(void) { UINT8 *linear = HWR_GetScreenshot(); GIF_rgbconvert(linear, movie_screen); - free(linear); + //free(linear); // Allocated 'statically', no need to free now } #endif } @@ -530,7 +534,7 @@ static void GIF_framewrite(void) { UINT8 *linear = HWR_GetScreenshot(); GIF_rgbconvert(linear, screens[0]); - free(linear); + //free(linear); // Allocated 'statically', no need to free now } #endif -- 2.54.0 From 25b5e5f51094487780de711473a322f369b25b93 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 11 Nov 2023 17:39:17 +0100 Subject: [PATCH 003/112] Revert "localskin rework incoming!!!!!" This reverts commit 6196185d62f5dc8f4aaad30a9c86385220612011. --- src/d_player.h | 4 ++-- src/k_kart.c | 31 ++++++++----------------------- src/r_draw.c | 27 --------------------------- src/r_draw.h | 3 --- 4 files changed, 10 insertions(+), 55 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 4d61474fb..c9329fe9c 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -416,8 +416,8 @@ typedef struct player_s UINT8 skincolor; INT32 skin; - INT32 localskin; // current localskin number - boolean skinlocal; // determines if localskin is a skin already loaded in the server + INT32 localskin; + boolean skinlocal; UINT32 score; // player score fixed_t dashspeed; // dashing speed diff --git a/src/k_kart.c b/src/k_kart.c index 1b2249bcd..247c549bc 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7615,28 +7615,13 @@ static void K_drawKartStats(void) y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset; flags |= V_HUDTRANS; - INT32 skinnum; - skin_t fakeskin; - fakeskin = skins[stplyr->skin]; - skinnum = stplyr->skin; - - // local skinner - if (stplyr->localskin) - { - skinnum = stplyr->localskin - 1; - if (stplyr->mo->skinlocal) - fakeskin = localskins[stplyr->localskin - 1]; - else - fakeskin = skins[stplyr->localskin - 1]; - } - if (!splitscreen) { // Skin name - V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), fakeskin.realname)); + V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), skins[stplyr->skin].realname)); // Icon and stats - V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(stplyr->mo->skin, stplyr->mo->localskin, stplyr->skincolor, GTC_CACHE, stplyr->mo->skinlocal)); + V_DrawMappedPatch(x, y, flags, W_CachePatchName(skins[stplyr->skin].facerank, PU_CACHE), R_GetTranslationColormap(stplyr->skin, stplyr->skincolor, GTC_CACHE)); V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE)); V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE)); } @@ -8401,7 +8386,7 @@ static boolean K_drawKartPositionFaces(void) { player_t *p; p = &players[rankplayer[i]]; - V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceRank(p), colormap); + V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap); } #ifdef HAVE_BLUA @@ -8491,7 +8476,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I { player_t *p; p = &players[tab[i].num]; - V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(p), colormap); + V_DrawMappedPatch(x, y-4, 0, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap); } /*if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] > 0) -- not enough space for this { @@ -8899,7 +8884,7 @@ static void K_drawKartWanted(void) if (players[battlewanted[i]].skincolor) { colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE); - V_DrawFixedPatch(x<skinlocal) ? localfacewantprefix : facewantprefix )[( (p->localskin) ? p->localskin-1 : p->skin )] : ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )]), colormap); /*if (basey2) // again with 4p stuff V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap);*/ } @@ -9027,7 +9012,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat amypos = amnumypos + ((y + AutomapPic->height/2 - (( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin]->height/2))<color) // 'default' color - V_DrawSciencePatch(amxpos, amypos, flags, R_GetSkinFaceMini(mo->player), FRACUNIT); + V_DrawSciencePatch(amxpos, amypos, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], FRACUNIT); else { UINT8 *colormap = R_GetTranslationColormap((mo->colorized) ? TC_RAINBOW : skin, mo->color, GTC_CACHE); @@ -9035,12 +9020,12 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat if (cv_minihead.value == 1) { colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal); - V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT/2, flags, R_GetSkinFaceMini(mo->player), colormap); + V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT/2, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap); } else if (cv_minihead.value == 0) { colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal); - V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, R_GetSkinFaceMini(mo->player), colormap); + V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap); } if (cv_showminimapnames.value && !(modeattacking || gamestate == GS_TIMEATTACK)) diff --git a/src/r_draw.c b/src/r_draw.c index b745c6d10..ae30df6cc 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -579,33 +579,6 @@ UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors return RGetTranslationColormap(( skin - skins ), color, flags, false); } -patch_t* R_GetSkinFaceRank(player_t* ply) -{ - if (ply->skinlocal && ply->localskin) - return localfacerankprefix[ply->localskin - 1]; - else if (ply->localskin) - return facerankprefix[ply->localskin - 1]; - return facerankprefix[ply->skin]; -} - -patch_t* R_GetSkinFaceWant(player_t* ply) -{ - if (ply->skinlocal && ply->localskin) - return localfacewantprefix[ply->localskin - 1]; - else if (ply->localskin) - return facewantprefix[ply->localskin - 1]; - return facewantprefix[ply->skin]; -} - -patch_t* R_GetSkinFaceMini(player_t* ply) -{ - if (ply->skinlocal && ply->localskin) - return localfacemmapprefix[ply->localskin - 1]; - else if (ply->localskin) - return facemmapprefix[ply->localskin - 1]; - return facemmapprefix[ply->skin]; -} - /** \brief Flushes cache of translation colormaps. Flushes cache of translation colormaps, but doesn't actually free the diff --git a/src/r_draw.h b/src/r_draw.h index ddcf596fa..b4e3fb651 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -117,9 +117,6 @@ extern lumpnum_t viewborderlump[8]; void R_InitTranslationTables(void); UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags); UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local); -patch_t* R_GetSkinFaceRank(player_t* ply); -patch_t* R_GetSkinFaceWant(player_t* ply); -patch_t* R_GetSkinFaceMini(player_t* ply); void R_FlushTranslationColormapCache(void); UINT8 R_GetColorByName(const char *name); -- 2.54.0 From 76047e75d5b5ea9c16541075b50a929514159257 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sat, 11 Nov 2023 21:01:53 +0100 Subject: [PATCH 004/112] Toggle for FOF wall cutoff when slopes was testing things, so might aswell add this --- src/hardware/hw_main.c | 114 +++++++++++++++++++++++++++++++---------- src/hardware/hw_main.h | 1 + 2 files changed, 87 insertions(+), 28 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 6874539fd..5bde675e6 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -102,6 +102,8 @@ consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, consvar_t cv_grbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grfofcut = {"gr_fofcut", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + static CV_PossibleValue_t grrenderdistance_cons_t[] = { {0, "Max"}, {1, "1024"}, {2, "2048"}, {3, "4096"}, {4, "6144"}, {5, "8192"}, {6, "12288"}, {7, "16384"}, {0, NULL}}; @@ -2254,10 +2256,21 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom INT32 texnum; line_t * newline = NULL; // Multi-Property FOF - lowcut = max(worldbottom, worldlow); - highcut = min(worldtop, worldhigh); - lowcutslope = max(worldbottomslope, worldlowslope); - highcutslope = min(worldtopslope, worldhighslope); + if (!cv_grfofcut.value) + { + ///TODO add slope support (fixing cutoffs, proper wall clipping) - maybe just disable highcut/lowcut if either sector or FOF has a slope + /// to allow fun plane intersecting in OGL? But then people would abuse that and make software look bad. :C + highcut = gr_frontsector->ceilingheight < gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight; + lowcut = gr_frontsector->floorheight > gr_backsector->floorheight ? gr_frontsector->floorheight : gr_backsector->floorheight; + } + else + { + lowcut = max(worldbottom, worldlow); + highcut = min(worldtop, worldhigh); + lowcutslope = max(worldbottomslope, worldlowslope); + highcutslope = min(worldtopslope, worldhighslope); + } + if (gr_backsector->ffloors) { @@ -2266,11 +2279,20 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES) || (rover->flags & FF_INVERTSIDES)) continue; - SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) - SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) + if (!cv_grfofcut.value) + { + if (*rover->topheight < lowcut || *rover->bottomheight > highcut) + continue; + } + else + { + SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) + SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) + + if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) + continue; + } - if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) - continue; texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture); @@ -2286,17 +2308,31 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight; l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight; lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight; - // Adjust the heights so the FOF does not overlap with top and bottom textures. - if (h >= highcut && hS >= highcutslope) + + + if (!cv_grfofcut.value) { - h = highcut; - hS = highcutslope; + if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) + h = hS = highcut; + if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut) + l = lS = lowcut; } - if (l <= lowcut && lS <= lowcutslope) + else { - l = lowcut; - lS = lowcutslope; + // Adjust the heights so the FOF does not overlap with top and bottom textures. + if (h >= highcut && hS >= highcutslope) + { + h = highcut; + hS = highcutslope; + } + if (l <= lowcut && lS <= lowcutslope) + { + l = lowcut; + lS = lowcutslope; + } } + + //Hurdler: HW code starts here //FIXME: check if peging is correct // set top/bottom coords @@ -2438,11 +2474,20 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES) || !(rover->flags & FF_ALLSIDES)) continue; - SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) - SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) + if (!cv_grfofcut.value) + { + if (*rover->topheight < lowcut || *rover->bottomheight > highcut) + continue; + } + else + { + SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) + SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) + + if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) + continue; + } - if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) - continue; texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture); @@ -2457,17 +2502,29 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight; l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight; lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight; - // Adjust the heights so the FOF does not overlap with top and bottom textures. - if (h >= highcut && hS >= highcutslope) + + if (!cv_grfofcut.value) { - h = highcut; - hS = highcutslope; + if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) + h = hS = highcut; + if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut) + l = lS = lowcut; } - if (l <= lowcut && lS <= lowcutslope) + else { - l = lowcut; - lS = lowcutslope; + // Adjust the heights so the FOF does not overlap with top and bottom textures. + if (h >= highcut && hS >= highcutslope) + { + h = highcut; + hS = highcutslope; + } + if (l <= lowcut && lS <= lowcutslope) + { + l = lowcut; + lS = lowcutslope; + } } + //Hurdler: HW code starts here //FIXME: check if peging is correct // set top/bottom coords @@ -5026,7 +5083,7 @@ void HWR_RenderDrawNodes(void) { planeinfo_t *plane = &drawnode->u.plane; - // We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes. + // We aren't traversing the BSP tree, so make gr_frontsector null to avoid crashes. gr_frontsector = NULL; if (!(plane->blend & PF_NoTexture)) @@ -5038,7 +5095,7 @@ void HWR_RenderDrawNodes(void) { polyplaneinfo_t *polyplane = &drawnode->u.polyplane; - // We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes. + // We aren't traversing the BSP tree, so make gr_frontsector null to avoid crashes. gr_frontsector = NULL; if (!(polyplane->blend & PF_NoTexture)) @@ -6304,6 +6361,7 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_grsolvetjoin); CV_RegisterVar(&cv_grbatching); + CV_RegisterVar(&cv_grfofcut); CV_RegisterVar(&cv_grscreentextures); CV_RegisterVar(&cv_grrenderdistance); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index b5761e202..d13b02bb7 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -162,6 +162,7 @@ void HWR_CorrectSWTricks(void); // Console variables extern consvar_t cv_grshaders; +extern consvar_t cv_grfofcut; extern consvar_t cv_grshearing; extern consvar_t cv_grfov; extern consvar_t cv_grmdls; -- 2.54.0 From 7ca88fb131383ee2f3e296fb83923b36b0258538 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sat, 11 Nov 2023 21:29:44 +0100 Subject: [PATCH 005/112] make it save lol --- src/hardware/hw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 5bde675e6..2572dfc38 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -102,7 +102,7 @@ consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, consvar_t cv_grbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grfofcut = {"gr_fofcut", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grfofcut = {"gr_fofcut", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t grrenderdistance_cons_t[] = { {0, "Max"}, {1, "1024"}, {2, "2048"}, {3, "4096"}, {4, "6144"}, {5, "8192"}, -- 2.54.0 From 91ed5c4871bc7e8e6e2904956adc127a09c6804c Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sat, 11 Nov 2023 21:38:12 +0100 Subject: [PATCH 006/112] why did i remove this back then?? --- src/hardware/hw_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 2572dfc38..7981eef66 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4800,9 +4800,15 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr) HWR_Lighting(&Surf, lightlevel, colormap); } - if (spr->mobj->frame & FF_TRANSMASK) + if (spr->mobj->flags2 & MF2_SHADOW) + { + Surf.PolyColor.s.alpha = 0x40; + blend = PF_Translucent; + } + else if (spr->mobj->frame & FF_TRANSMASK) blend = HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf); else + { // BP: i agree that is little better in environement but it don't // work properly under glide nor with fogcolor to ffffff :( -- 2.54.0 From e74a28a2c143d481ea0bcf0f23adebbca9473982 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sat, 11 Nov 2023 22:08:48 +0100 Subject: [PATCH 007/112] Fix old big room fix no idea what i was thinking but kart does use viewx and viewy for those originially, so just let me do a 64bit version of R_PointToAngleEx --- src/hardware/hw_main.c | 12 ++++++------ src/r_bsp.c | 8 ++++---- src/r_main.c | 42 ++++++++++++++++++++++++++---------------- src/r_main.h | 2 +- 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 7981eef66..5e86ba885 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2815,8 +2815,8 @@ void HWR_AddLine(seg_t *line) } // OPTIMIZE: quickly reject orthogonal back sides. - angle1 = R_PointToAngle64(v1x, v1y); - angle2 = R_PointToAngle64(v2x, v2y); + angle1 = R_PointToAngleEx64(viewx, viewy, v1x, v1y); + angle2 = R_PointToAngleEx64(viewx, viewy, v2x, v2y); // do an extra culling check when rendering portals // check if any line vertex is on the viewable side of the portal target line @@ -3111,8 +3111,8 @@ boolean HWR_CheckBBox(fixed_t *bspcoord) if (mindist > current_bsp_culling_distance) return false; } - angle1 = R_PointToAngle64(px1, py1); - angle2 = R_PointToAngle64(px2, py2); + angle1 = R_PointToAngleEx64(viewx, viewy, px1, py1); + angle2 = R_PointToAngleEx64(viewx, viewy, px2, py2); return gld_clipper_SafeCheckRange(angle2, angle1); } @@ -5965,8 +5965,8 @@ void HWR_PortalClipping(portal_t *portal) line_t *line = &lines[portal->clipline]; - angle1 = R_PointToAngleEx(viewx, viewy, line->v1->x, line->v1->y); - angle2 = R_PointToAngleEx(viewx, viewy, line->v2->x, line->v2->y); + angle1 = R_PointToAngleEx64(viewx, viewy, line->v1->x, line->v1->y); + angle2 = R_PointToAngleEx64(viewx, viewy, line->v2->x, line->v2->y); // clip things that are not inside the portal window from our viewpoint gld_clipper_SafeAddClipRange(angle2, angle1); diff --git a/src/r_bsp.c b/src/r_bsp.c index 2de30d2ab..f0dcbd80e 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -410,8 +410,8 @@ static void R_AddLine(seg_t *line) return; // big room fix - angle1 = R_PointToAngle64(line->v1->x, line->v1->y); - angle2 = R_PointToAngle64(line->v2->x, line->v2->y); + angle1 = R_PointToAngleEx64(viewx, viewy, line->v1->x, line->v1->y); + angle2 = R_PointToAngleEx64(viewx, viewy, line->v2->x, line->v2->y); curline = line; // Clip to view edges. @@ -613,8 +613,8 @@ static boolean R_CheckBBox(const fixed_t *bspcoord) check = checkcoord[boxpos]; // big room fix - angle1 = R_PointToAngle64(bspcoord[check[0]], bspcoord[check[1]]) - viewangle; - angle2 = R_PointToAngle64(bspcoord[check[2]], bspcoord[check[3]]) - viewangle; + angle1 = R_PointToAngleEx64(viewx, viewy, bspcoord[check[0]], bspcoord[check[1]]) - viewangle; + angle2 = R_PointToAngleEx64(viewx, viewy, bspcoord[check[2]], bspcoord[check[3]]) - viewangle; if ((signed)angle1 < (signed)angle2) { diff --git a/src/r_main.c b/src/r_main.c index d2907b2aa..6bf1bd2ad 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -395,22 +395,6 @@ angle_t R_PointToAngle(fixed_t x, fixed_t y) 0; } -angle_t R_PointToAngle64(INT64 x, INT64 y) -{ - return (y -= viewy, (x -= viewx) || y) ? - x >= 0 ? - y >= 0 ? - (x > y) ? tantoangle[SlopeDivEx(y,x)] : // octant 0 - ANGLE_90-tantoangle[SlopeDivEx(x,y)] : // octant 1 - x > (y = -y) ? 0-tantoangle[SlopeDivEx(y,x)] : // octant 8 - ANGLE_270+tantoangle[SlopeDivEx(x,y)] : // octant 7 - y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDivEx(y,x)] : // octant 3 - ANGLE_90 + tantoangle[SlopeDivEx(x,y)] : // octant 2 - (x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDivEx(y,x)] : // octant 4 - ANGLE_270-tantoangle[SlopeDivEx(x,y)] : // octant 5 - 0; -} - angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y) { return (y -= pviewy, (x -= pviewx) || y) ? @@ -505,6 +489,32 @@ angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1) 0; } +angle_t R_PointToAngleEx64(INT64 x2, INT64 y2, INT64 x1, INT64 y1) +{ + INT64 dx = x1 - x2; + INT64 dy = y1 - y2; + + // Check for potential overflow or underflow + if (dx < INT64_MIN || dx > INT64_MAX || dy < INT64_MIN || dy > INT64_MAX) + { + x1 = (INT64)(dx / 2 + x2); + y1 = (INT64)(dy / 2 + y2); + } + + return (y1 -= y2, (x1 -= x2) || y1) ? + x1 >= 0 ? + y1 >= 0 ? + (x1 > y1) ? tantoangle[SlopeDivEx(y1, x1)] : // octant 0 + ANGLE_90 - tantoangle[SlopeDivEx(x1, y1)] : // octant 1 + x1 > (y1 = -y1) ? 0 - tantoangle[SlopeDivEx(y1, x1)] : // octant 8 + ANGLE_270 + tantoangle[SlopeDivEx(x1, y1)] : // octant 7 + y1 >= 0 ? (x1 = -x1) > y1 ? ANGLE_180 - tantoangle[SlopeDivEx(y1, x1)] : // octant 3 + ANGLE_90 + tantoangle[SlopeDivEx(x1, y1)] : // octant 2 + (x1 = -x1) > (y1 = -y1) ? ANGLE_180 + tantoangle[SlopeDivEx(y1, x1)] : // octant 4 + ANGLE_270 - tantoangle[SlopeDivEx(x1, y1)] : // octant 5 + 0; +} + // // R_ScaleFromGlobalAngle // Returns the texture mapping scale for the current line (horizontal span) diff --git a/src/r_main.h b/src/r_main.h index 167d96625..036401ef9 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -68,9 +68,9 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ]; INT32 R_PointOnSide(fixed_t x, fixed_t y, node_t *node); INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line); angle_t R_PointToAngle(fixed_t x, fixed_t y); -angle_t R_PointToAngle64(INT64 x, INT64 y); angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1); angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1); +angle_t R_PointToAngleEx64(INT64 x2, INT64 y2, INT64 x1, INT64 y1); fixed_t R_PointToDist(fixed_t x, fixed_t y); fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1); angle_t R_PlayerSliptideAngle(player_t *player); -- 2.54.0 From 00c20f7c8c9efb5b346d0b47921a54fcbb81c528 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sun, 12 Nov 2023 00:39:04 +0100 Subject: [PATCH 008/112] revert this thing just incase, dont wanna break high res support --- src/r_things.c | 1 - src/screen.h | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index c89a6c603..97d38288a 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1483,7 +1483,6 @@ static void R_ProjectSprite(mobj_t *thing) spr_topoffset = spritecachedinfo[lump].topoffset; #ifdef ROTSPRITE - if (thing->player) { sliptiderollangle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), ((cv_sloperoll.value == 1) ? thing->player->sliproll*(thing->player->sliptidemem) : 0)); diff --git a/src/screen.h b/src/screen.h index a4ddbfdb1..d379b73ab 100644 --- a/src/screen.h +++ b/src/screen.h @@ -43,8 +43,8 @@ #define MAXVIDWIDTH 320 #define MAXVIDHEIGHT 200 #else -#define MAXVIDWIDTH 2560 // don't set this too high because actually -#define MAXVIDHEIGHT 1440 // lots of tables are allocated with the MAX size. +#define MAXVIDWIDTH 3840 // don't set this too high because actually +#define MAXVIDHEIGHT 2160 // lots of tables are allocated with the MAX size. #endif #define BASEVIDWIDTH 320 // NEVER CHANGE THIS! This is the original #define BASEVIDHEIGHT 200 // resolution of the graphics. -- 2.54.0 From 44b2937ea1c8636ffc16166fe5392c054c447962 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Nov 2023 01:46:58 +0100 Subject: [PATCH 009/112] Avoid a devision by zero in Splitwall and make it static --- src/hardware/hw_main.c | 25 ++++++++++++++++--------- src/hardware/hw_main.h | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 5e86ba885..715f1d6f2 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1089,7 +1089,7 @@ void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend // // HWR_SplitWall // -void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags) +static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags) { /* SoM: split up and light walls according to the lightlist. This may also include leaving out parts @@ -1103,6 +1103,8 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa float endrealtop, endrealbot, endtop, endbot; float endpegt, endpegb, endpegmul; float endheight = 0.0f, endbheight = 0.0f; + + float diff; fixed_t v1x = FLOAT_TO_FIXED(wallVerts[0].x); fixed_t v1y = FLOAT_TO_FIXED(wallVerts[0].z); // not a typo @@ -1121,12 +1123,19 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa realtop = top = wallVerts[3].y; realbot = bot = wallVerts[0].y; + diff = top - bot; + pegt = wallVerts[3].t; pegb = wallVerts[0].t; - pegmul = (pegb - pegt) / (top - bot); - if (fpclassify(pegmul) == FP_NAN) + // Lactozilla: If both heights of a side lay on the same position, then this wall is a triangle. + // To avoid division by zero, which would result in a NaN, we check if the vertical difference + // between the two vertices is not zero. + if (fpclassify(diff) == FP_ZERO) pegmul = 0.0; + else + pegmul = (pegb - pegt) / diff; + #ifdef ESLOPE endrealtop = endtop = wallVerts[2].y; @@ -1136,15 +1145,14 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa endpegmul = (endpegb - endpegt) / (endtop - endbot); #endif - if (fpclassify(endpegmul) == FP_NAN) + if (fpclassify(diff) == FP_ZERO) endpegmul = 0.0; + else + endpegmul = (endpegb - endpegt) / diff; for (i = 0; i < sector->numlights; i++) { -#ifdef ESLOPE - if (endtop < endrealbot) -#endif - if (top < realbot) + if (endtop < endrealbot && top < realbot) return; if (!(list[i].flags & FF_NOSHADE)) @@ -2436,7 +2444,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom lightnum = rover->master->frontsector->lightlevel; lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y); - Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); if (gr_frontsector->numlights) diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index d13b02bb7..8f24cabe0 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -127,7 +127,7 @@ void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap); void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap); void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 texnum, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap); -void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags); +static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags); void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf); void HWR_DrawSkyBackground(float fpov); -- 2.54.0 From 284845aad64a281b929748c38658779e3438a328 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Nov 2023 02:08:36 +0100 Subject: [PATCH 010/112] Cleanup Splitwall and remove smth we dont need Perhaps not removing the endpegmul setting to 0 in some cases caused many of those division by zero crashes aswell since i reverted the stuff relating to this a while back --- src/hardware/hw_main.c | 51 +++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 715f1d6f2..a62607320 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1089,12 +1089,10 @@ void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend // // HWR_SplitWall // +// SoM: split up and light walls according to the lightlist. +// This may also include leaving out parts of the wall that can't be seen static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags) { - /* SoM: split up and light walls according to the - lightlist. This may also include leaving out parts - of the wall that can't be seen */ - float realtop, realbot, top, bot; float pegt, pegb, pegmul; float height = 0.0f, bheight = 0.0f; @@ -1106,17 +1104,12 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, float diff; - fixed_t v1x = FLOAT_TO_FIXED(wallVerts[0].x); - fixed_t v1y = FLOAT_TO_FIXED(wallVerts[0].z); // not a typo - fixed_t v2x = FLOAT_TO_FIXED(wallVerts[1].x); - fixed_t v2y = FLOAT_TO_FIXED(wallVerts[1].z); // not a typo - // compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly - // use this as a temp var to store P_GetZAt's return value each time - fixed_t temp; + fixed_t v1x = FloatToFixed(wallVerts[0].x); + fixed_t v1y = FloatToFixed(wallVerts[0].z); + fixed_t v2x = FloatToFixed(wallVerts[1].x); + fixed_t v2y = FloatToFixed(wallVerts[1].z); #endif - INT32 solid, i; - lightlist_t * list = sector->lightlist; const UINT8 alpha = Surf->PolyColor.s.alpha; FUINT lightnum = HWR_CalcWallLight(sector->lightlevel, v1x, v1y, v2x, v2y); extracolormap_t *colormap = NULL; @@ -1139,21 +1132,19 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, #ifdef ESLOPE endrealtop = endtop = wallVerts[2].y; - endrealbot = endbot = wallVerts[1].y; + endrealbot = endbot = wallVerts[1].y; endpegt = wallVerts[2].t; endpegb = wallVerts[1].t; endpegmul = (endpegb - endpegt) / (endtop - endbot); #endif - if (fpclassify(diff) == FP_ZERO) - endpegmul = 0.0; - else - endpegmul = (endpegb - endpegt) / diff; - for (i = 0; i < sector->numlights; i++) + for (INT32 i = 0; i < sector->numlights; i++) { if (endtop < endrealbot && top < realbot) return; + + lightlist_t *list = sector->lightlist; if (!(list[i].flags & FF_NOSHADE)) { @@ -1171,7 +1162,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, } } - solid = false; + boolean solid = false; if ((sector->lightlist[i].flags & FF_CUTSOLIDS) && !(cutflag & FF_EXTRA)) solid = true; @@ -1190,11 +1181,9 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, #ifdef ESLOPE if (list[i].slope) - { - temp = P_GetZAt(list[i].slope, v1x, v1y); - height = FIXED_TO_FLOAT(temp); - temp = P_GetZAt(list[i].slope, v2x, v2y); - endheight = FIXED_TO_FLOAT(temp); + { + height = FixedToFloat(P_GetZAt(list[i].slope, v1x, v1y)); + endheight = FixedToFloat(P_GetZAt(list[i].slope, v2x, v2y)); } else height = endheight = FIXED_TO_FLOAT(list[i].height); @@ -1202,10 +1191,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, { if (*list[i].caster->b_slope) { - temp = P_GetZAt(*list[i].caster->b_slope, v1x, v1y); - bheight = FIXED_TO_FLOAT(temp); - temp = P_GetZAt(*list[i].caster->b_slope, v2x, v2y); - endbheight = FIXED_TO_FLOAT(temp); + bheight = FixedToFloat(P_GetZAt(*list[i].caster->b_slope, v1x, v1y)); + endbheight = FixedToFloat(P_GetZAt(*list[i].caster->b_slope, v2x, v2y)); } else bheight = endbheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight); @@ -1234,10 +1221,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, { if (list[i+1].slope) { - temp = P_GetZAt(list[i+1].slope, v1x, v1y); - bheight = FIXED_TO_FLOAT(temp); - temp = P_GetZAt(list[i+1].slope, v2x, v2y); - endbheight = FIXED_TO_FLOAT(temp); + bheight = FixedToFloat(P_GetZAt(list[i+1].slope, v1x, v1y)); + endbheight = FixedToFloat(P_GetZAt(list[i+1].slope, v2x, v2y)); } else bheight = endbheight = FIXED_TO_FLOAT(list[i+1].height); -- 2.54.0 From fcf0836e7b7bd674a5ecbfa30be7ef3e0a62eeb9 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Nov 2023 16:09:34 +0100 Subject: [PATCH 011/112] Fix shadows from sometimes crashing on mapload this properly fixes the mapchange spam from crashing the game P_RunShadows, like any other thinker function, should also be called in preticker not just ticker potentioally also fixes other issues --- src/p_mobj.c | 35 +++++++++++++++++++++++------------ src/p_tick.c | 2 ++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 12653d39d..ad437585f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6063,13 +6063,22 @@ static void P_AddOverlay(mobj_t *thing) static void P_RemoveOverlay(mobj_t *thing) { mobj_t *mo; + if (overlaycap == thing) + { + P_SetTarget(&overlaycap, thing->hnext); + P_SetTarget(&thing->hnext, NULL); + return; + } + for (mo = overlaycap; mo; mo = mo->hnext) - if (mo->hnext == thing) - { - P_SetTarget(&mo->hnext, thing->hnext); - P_SetTarget(&thing->hnext, NULL); - return; - } + { + if (mo->hnext != thing) + continue; + + P_SetTarget(&mo->hnext, thing->hnext); + P_SetTarget(&thing->hnext, NULL); + return; + } } void P_RunShadows(void) @@ -6175,12 +6184,14 @@ static void P_RemoveShadow(mobj_t *thing) } for (mo = shadowcap; mo; mo = mo->hnext) - if (mo->hnext == thing) - { - P_SetTarget(&mo->hnext, thing->hnext); - P_SetTarget(&thing->hnext, NULL); - return; - } + { + if (mo->hnext != thing) + continue; + + P_SetTarget(&mo->hnext, thing->hnext); + P_SetTarget(&thing->hnext, NULL); + return; + } } void A_BossDeath(mobj_t *mo); diff --git a/src/p_tick.c b/src/p_tick.c index 39e32e4c8..c3d12e77b 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -918,6 +918,8 @@ void P_PreTicker(INT32 frames) // Run shield positioning //P_RunShields(); P_RunOverlays(); + + P_RunShadows(); P_UpdateSpecials(); P_RespawnSpecials(); -- 2.54.0 From 2a492369149395c59ffb0fa17e0c272101fbf230 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Nov 2023 16:43:33 +0100 Subject: [PATCH 012/112] Fix colourizedhudcolor not respecting your colourized hud choice make the stuff also grey out in the menu if you disable stuff --- src/k_kart.c | 8 +++++--- src/m_menu.c | 19 +++++++++++++++++++ src/m_menu.h | 3 +++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 247c549bc..579b2f85a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8,6 +8,7 @@ #include "hu_stuff.h" #include "g_game.h" #include "m_random.h" +#include "m_menu.h" // ffdhidshfuisduifigergho9igj89dgodhfih AAAAAAAAAA #include "p_local.h" #include "p_slopes.h" #include "r_draw.h" @@ -66,10 +67,9 @@ consvar_t cv_saltyhopsfx = {"hardcodehopsfx", "On", CV_SAVE, CV_OnOff, NULL, 0, consvar_t cv_saltysquish = {"hardcodehopsquish", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //Colourized HUD -consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE|CV_CALL, CV_OnOff, Saturn_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_colorizeditembox = {"colorizeditembox", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; - static CV_PossibleValue_t HudColor_cons_t[MAXSKINCOLORS+1]; consvar_t cv_colorizedhudcolor = {"colorizedhudcolor", "Skin Color", CV_SAVE, HudColor_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -594,7 +594,9 @@ UINT8 K_GetKartColorByName(const char *name) UINT8 K_GetHudColor() { if (stplyr && players - stplyr != consoleplayer) return stplyr->skincolor; - if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value; + if (cv_colorizedhud.value){ + if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value; + } return cv_playercolor.value; } diff --git a/src/m_menu.c b/src/m_menu.c index 59fb8342b..fa1bc8232 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1773,6 +1773,7 @@ enum sm_speedometer, sm_statdisplay, sm_colorhud, + sm_coloritem, sm_colorhud_customcolor, sm_lapemblem, sm_mapnames, @@ -2808,6 +2809,24 @@ void Bird_menu_Onchange(void) OP_AdvancedBirdMenu[respawnfadein].status = status; } +//menu code is nice +void Saturn_menu_Onchange(void) +{ + UINT16 status; + + if (cv_colorizedhud.value) + { + status = IT_STRING | IT_CVAR; + } + else + { + status = IT_GRAYEDOUT; + } + + OP_SaturnMenu[sm_coloritem].status = status; + OP_SaturnMenu[sm_colorhud_customcolor].status = status; +} + // ========================================================================== // END ORGANIZATION STUFF. // ========================================================================== diff --git a/src/m_menu.h b/src/m_menu.h index 07bd7a850..d8726623b 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -272,6 +272,9 @@ void PDistort_menu_Onchange(void); // Bird menu updating void Bird_menu_Onchange(void); +// Saturn menu updating +void Saturn_menu_Onchange(void); + void M_ReplayHut(INT32 choice); void M_SetPlaybackMenuPointer(void); -- 2.54.0 From c4d8de471ee435767499c60295fd4e94b1583160 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sun, 12 Nov 2023 16:56:52 +0100 Subject: [PATCH 013/112] P-MeterSpeedometer by @NepDisk thx much --- src/d_main.c | 8 ++++ src/d_main.h | 1 + src/k_kart.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++--- src/m_menu.c | 13 ++++-- 4 files changed, 138 insertions(+), 8 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index ed5363c13..0c77b9557 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -919,6 +919,7 @@ boolean snw_speedo; // snowy speedometer check boolean clr_hud; // colour hud check boolean big_lap; // bigger lap counter boolean big_lap_color; // bigger lap counter but colour +boolean kartzspeedo; // kartZ speedometer static void IdentifyVersion(void) { @@ -1293,6 +1294,13 @@ void D_SRB2Main(void) // check for bigger lap count but color** its color bitch if (W_CheckMultipleLumps("K_SCLAPB", "K_SCLA2B", NULL)) big_lap_color = true; + + // kartzspeedo + if (W_CheckMultipleLumps("K_KZSP1", "K_KZSP2", "K_KZSP3", "K_KZSP4", "K_KZSP5", \ + "K_KZSP6", "K_KZSP7", "K_KZSP8", "K_KZSP9", "K_KZSP10", "K_KZSP11", "K_KZSP12", \ + "K_KZSP13", "K_KZSP14", "K_KZSP15", "K_KZSP16", "K_KZSP17", "K_KZSP18", "K_KZSP19", \ + "K_KZSP20", "K_KZSP21", "K_KZSP22", "K_KZSP23", "K_KZSP24", "K_KZSP25", NULL)) + kartzspeedo = true; } // diff --git a/src/d_main.h b/src/d_main.h index 8c91be487..d342cd13d 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -32,6 +32,7 @@ extern boolean snw_speedo; // snowy speedometer check extern boolean clr_hud; // colour hud check extern boolean big_lap; // bigger lap counter extern boolean big_lap_color; //bigger lap counter but colour +extern boolean kartzspeedo; //kartZ speedo // the infinite loop of D_SRB2Loop() called from win_main for windows version void D_SRB2Loop(void) FUNCNORETURN; diff --git a/src/k_kart.c b/src/k_kart.c index 579b2f85a..bf0e657d6 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -60,7 +60,8 @@ consvar_t cv_stat_yoffset = {"hud_stat_yoffset", "0", CV_SAVE, NULL, NULL, 0, NU consvar_t cv_showstats = {"showstats", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_newspeedometer = {"newspeedometer", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t speedo_cons_t[] = {{0, "Default"}, {1, "Small"}, {2, "PMeter"}}; +consvar_t cv_newspeedometer = {"newspeedometer", "Default", CV_SAVE, speedo_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_saltyhop = {"hardcodehop", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_saltyhopsfx = {"hardcodehopsfx", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -692,6 +693,7 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_showinput); CV_RegisterVar(&cv_newspeedometer); + CV_RegisterVar(&cv_saltyhop); CV_RegisterVar(&cv_saltyhopsfx); CV_RegisterVar(&cv_saltysquish); @@ -6953,6 +6955,10 @@ static patch_t *skp_smallstickerclr; static patch_t *kp_itemmulstickerclr[2]; static patch_t *kp_itembgclr[4]; + +//Kartz speedo +static patch_t *kp_kartzspeedo[25]; + static patch_t *kp_startcountdown[16]; static patch_t *kp_racefinish[6]; @@ -7069,8 +7075,41 @@ void K_LoadKartHUDGraphics(void) if (snw_speedo){ skp_smallstickerclr = W_CachePatchName("SC_SMSTC", PU_HUDGFX); } + } + //KartZ speedo + if (kartzspeedo){ + + kp_kartzspeedo[0] = W_CachePatchName("K_KZSP1", PU_HUDGFX); + kp_kartzspeedo[1] = W_CachePatchName("K_KZSP2", PU_HUDGFX); + kp_kartzspeedo[2] = W_CachePatchName("K_KZSP3", PU_HUDGFX); + kp_kartzspeedo[3] = W_CachePatchName("K_KZSP4", PU_HUDGFX); + kp_kartzspeedo[4] = W_CachePatchName("K_KZSP5", PU_HUDGFX); + kp_kartzspeedo[5] = W_CachePatchName("K_KZSP6", PU_HUDGFX); + kp_kartzspeedo[6] = W_CachePatchName("K_KZSP7", PU_HUDGFX); + kp_kartzspeedo[7] = W_CachePatchName("K_KZSP8", PU_HUDGFX); + kp_kartzspeedo[8] = W_CachePatchName("K_KZSP9", PU_HUDGFX); + kp_kartzspeedo[9] = W_CachePatchName("K_KZSP10", PU_HUDGFX); + kp_kartzspeedo[10] = W_CachePatchName("K_KZSP11", PU_HUDGFX); + kp_kartzspeedo[11] = W_CachePatchName("K_KZSP12", PU_HUDGFX); + kp_kartzspeedo[12] = W_CachePatchName("K_KZSP13", PU_HUDGFX); + kp_kartzspeedo[13] = W_CachePatchName("K_KZSP14", PU_HUDGFX); + kp_kartzspeedo[14] = W_CachePatchName("K_KZSP15", PU_HUDGFX); + kp_kartzspeedo[15] = W_CachePatchName("K_KZSP16", PU_HUDGFX); + kp_kartzspeedo[16] = W_CachePatchName("K_KZSP17", PU_HUDGFX); + kp_kartzspeedo[17] = W_CachePatchName("K_KZSP18", PU_HUDGFX); + kp_kartzspeedo[18] = W_CachePatchName("K_KZSP19", PU_HUDGFX); + kp_kartzspeedo[19] = W_CachePatchName("K_KZSP20", PU_HUDGFX); + kp_kartzspeedo[20] = W_CachePatchName("K_KZSP21", PU_HUDGFX); + kp_kartzspeedo[21] = W_CachePatchName("K_KZSP22", PU_HUDGFX); + kp_kartzspeedo[22] = W_CachePatchName("K_KZSP23", PU_HUDGFX); + kp_kartzspeedo[23] = W_CachePatchName("K_KZSP24", PU_HUDGFX); + kp_kartzspeedo[24] = W_CachePatchName("K_KZSP25", PU_HUDGFX); + + + } + // Starting countdown kp_startcountdown[0] = W_CachePatchName("K_CNT3A", PU_HUDGFX); kp_startcountdown[1] = W_CachePatchName("K_CNT2A", PU_HUDGFX); @@ -7604,7 +7643,7 @@ static void K_drawKartStats(void) //Internal offset for speedometer if (cv_kartspeedometer.value) { - if (cv_newspeedometer.value) + if (cv_newspeedometer.value == 1 && snw_speedo) spdoffset = -10; else spdoffset = -14; @@ -8637,6 +8676,12 @@ static void K_drawKartSpeedometer(void) return; fixed_t convSpeed = 0; + + //KartZ speedo + fixed_t fuspeed = 0; + INT32 spdpatch = 0; + INT32 kartspd = 0; + INT32 speedtype = 0; INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); @@ -8665,7 +8710,7 @@ static void K_drawKartSpeedometer(void) } // man. - if ((!cv_newspeedometer.value) || (cv_newspeedometer.value && !snw_speedo)) + if ((!cv_newspeedometer.value) || (cv_newspeedometer.value == 1 && !snw_speedo) || (cv_newspeedometer.value == 2 && !kartzspeedo) ) { switch (speedtype) { case 1: @@ -8684,7 +8729,7 @@ static void K_drawKartSpeedometer(void) V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%4d %%", convSpeed)); } } - else if (cv_newspeedometer.value && snw_speedo) { // why bother if we dont? + else if (cv_newspeedometer.value == 1 && snw_speedo ) { // why bother if we dont? if (!cv_colorizedhud.value || !clr_hud) V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, (V_HUDTRANS|splitflags), (skp_smallsticker)); else @@ -8698,7 +8743,76 @@ static void K_drawKartSpeedometer(void) V_DrawRankNum(SPDM_X + 26, SPDM_Y + 4, V_HUDTRANS|splitflags, convSpeed, 3, NULL); V_DrawScaledPatch(SPDM_X + 31, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_speedpatches[cv_kartspeedometer.value]); - + + } + // Kart Z speedo bullshit... + // Draw the Speed counter. + // Warning large if statement below... + else if (cv_newspeedometer.value == 2 && kartzspeedo){ + + fuspeed = FixedMul(stplyr->speed, mapobjectscale); + + if (fuspeed < 2*FRACUNIT && fuspeed > 0) + spdpatch = 0; + else if (fuspeed < 5*FRACUNIT && fuspeed > 1*FRACUNIT) + spdpatch = 1; + else if (fuspeed < 7*FRACUNIT && fuspeed > 4*FRACUNIT) + spdpatch = 2; + else if (fuspeed < 10*FRACUNIT && fuspeed > 6*FRACUNIT) + spdpatch = 3; + else if (fuspeed < 12*FRACUNIT && fuspeed > 9*FRACUNIT) + spdpatch = 4; + else if (fuspeed < 15*FRACUNIT && fuspeed > 11*FRACUNIT) + spdpatch = 5; + else if (fuspeed < 17*FRACUNIT && fuspeed > 14*FRACUNIT) + spdpatch = 6; + else if (fuspeed < 20*FRACUNIT && fuspeed > 16*FRACUNIT) + spdpatch = 7; + else if (fuspeed < 22*FRACUNIT && fuspeed > 19*FRACUNIT) + spdpatch = 8; + else if (fuspeed < 25*FRACUNIT && fuspeed > 21*FRACUNIT) + spdpatch = 9; + else if (fuspeed < 27*FRACUNIT && fuspeed > 24*FRACUNIT) + spdpatch = 10; + else if (fuspeed < 30*FRACUNIT && fuspeed > 26*FRACUNIT) + spdpatch = 11; + else if (fuspeed < 32*FRACUNIT && fuspeed > 29*FRACUNIT) + spdpatch = 12; + else if (fuspeed < 35*FRACUNIT && fuspeed > 31*FRACUNIT) + spdpatch = 13; + else if (fuspeed < 37*FRACUNIT && fuspeed > 34*FRACUNIT) + spdpatch = 14; + else if (fuspeed < 40*FRACUNIT && fuspeed > 36*FRACUNIT) + spdpatch = 15; + else if (fuspeed < 42*FRACUNIT && fuspeed > 39*FRACUNIT) + spdpatch = 16; + else if (fuspeed < 45*FRACUNIT && fuspeed > 41*FRACUNIT) + spdpatch = 17; + else if (fuspeed < 47*FRACUNIT && fuspeed > 44*FRACUNIT) + spdpatch = 18; + else if (fuspeed < 50*FRACUNIT && fuspeed > 46*FRACUNIT) + spdpatch = 19; + else if (fuspeed < 52*FRACUNIT && fuspeed > 49*FRACUNIT) + spdpatch = 20; + else if (fuspeed < 55*FRACUNIT && fuspeed > 51*FRACUNIT) + spdpatch = 21; + else if (fuspeed < 57*FRACUNIT && fuspeed > 54*FRACUNIT && (leveltime&4)) + spdpatch = 24; + else if (fuspeed < 57*FRACUNIT && fuspeed > 54*FRACUNIT && !(leveltime&4)) + spdpatch = 23; + else if (fuspeed < 60*FRACUNIT && fuspeed > 56*FRACUNIT && (leveltime&4)) + spdpatch = 24; + else if (fuspeed < 60*FRACUNIT && fuspeed > 56*FRACUNIT && !(leveltime&4)) + spdpatch = 23; + else if (fuspeed > 59*FRACUNIT && (leveltime&4)) + spdpatch = 24; + else if (fuspeed > 59*FRACUNIT && !(leveltime&4)) + spdpatch = 23; + + + V_DrawScaledPatch(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, kp_kartzspeedo[spdpatch]); + + } } diff --git a/src/m_menu.c b/src/m_menu.c index fa1bc8232..6f6dc13ba 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1727,7 +1727,7 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 20}, {IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 25}, - {IT_STRING | IT_CVAR, NULL, "Small Speedometer", &cv_newspeedometer, 30}, + {IT_STRING | IT_CVAR, NULL, "Speedometer Style", &cv_newspeedometer, 30}, {IT_STRING | IT_CVAR, NULL, "Stat Display", &cv_showstats, 35}, {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 40}, {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 45}, @@ -1749,7 +1749,7 @@ static const char* OP_SaturnTooltips[] = "How long can the game wait before it kicks you out from the server\nconnecting screen.", "How much speen do you want?", "Displays the input display outside of Record Attack. Also adjusts the\nposition scale to match.", - "Enable the smaller speedometer.", + "Change what style the speedometer is.", "Enable the stat display.", "Enable colorized hud.", "Enable the colorized itembox when colorized hud is enabled.", @@ -4027,8 +4027,15 @@ void M_Init(void) OP_VideoOptionsMenu[op_video_ogl].status = IT_DISABLED; #endif - if (!snw_speedo) // why bother? + if (!snw_speedo && !kartzspeedo) // why bother? OP_SaturnMenu[sm_speedometer].status = IT_GRAYEDOUT; + + if (!snw_speedo && kartzspeedo) + OP_SaturnMenu[sm_speedometer].text = "Speedometer (No Small)"; + + if (snw_speedo && !kartzspeedo) + OP_SaturnMenu[sm_speedometer].text = "Speedometer (No PMeter)"; + if (!clr_hud){ // uhguauhauguuhee OP_SaturnMenu[sm_colorhud].status = IT_GRAYEDOUT; -- 2.54.0 From 2ca7c8178fb1d58405f2e2369efe406231684a55 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sun, 12 Nov 2023 16:57:38 +0100 Subject: [PATCH 014/112] Implement tooltips for rest of the menus (Aside from HUD and data options) by @NepDisk ty much --- src/m_menu.c | 547 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 474 insertions(+), 73 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 6f6dc13ba..b4cd2b9e2 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1159,6 +1159,19 @@ static menuitem_t OP_ControlsMenu[] = {IT_STRING | IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth, 70}, }; +static const char* OP_ControlsTooltips[] = +{ + + "Setup player 1 controls.", + "Setup player 2 controls.", + "Setup player 3 controls.", + "Setup player 4 controls.", + + "Allowed amount of comtrols per key.", + "Turn smoothing for non-analog turning.", + +}; + static menuitem_t OP_AllControlsMenu[] = { {IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0}, @@ -1331,6 +1344,29 @@ static menuitem_t OP_VideoOptionsMenu[] = #endif }; +static const char* OP_VideoTooltips[] = +{ + "Resolution game runs at.", +#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) + "Enable fullscreen.", +#endif + "Gamma (brightness) of the game.", + "How far away objects are drawn.", + "How far away weather is drawn.", + "Toggle being able to see the sky.", + "Player field of view.", + "Show current game framerate.", + "Sync game framerate to refresh rate of monitor.", + "Set manual framerate cap.", + "Size of drift spark pulse.", + "Force menu to only use uppercase.", +#ifdef HWRENDER + "Options for OpenGL renderer.", +#endif + "Experimental graphical options.", +}; + + enum { op_video_res = 0, @@ -1361,27 +1397,47 @@ static menuitem_t OP_VideoModeMenu[] = #ifdef HWRENDER static menuitem_t OP_OpenGLOptionsMenu[] = { - {IT_STRING | IT_CVAR, NULL, "3D Models", &cv_grmdls, 5}, - {IT_STRING | IT_CVAR, NULL, "Fallback Player 3D Model", &cv_grfallbackplayermodel, 15}, + {IT_STRING | IT_CVAR, NULL, "3D Models", &cv_grmdls, 15}, + {IT_STRING | IT_CVAR, NULL, "Fallback Player 3D Model", &cv_grfallbackplayermodel, 20}, {IT_STRING | IT_CVAR, NULL, "Shaders", &cv_grshaders, 25}, //{IT_STRING|IT_CVAR, NULL, "Use custom Shaders", &cv_grusecustomshaders, 35}, - {IT_STRING | IT_CVAR, NULL, "Palette Rendering", &cv_grpaletteshader, 35}, - {IT_STRING | IT_CVAR, NULL, "Flashpals in Palette Renderer", &cv_grflashpal, 45}, - {IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_secbright, 55}, + {IT_STRING | IT_CVAR, NULL, "Palette Rendering", &cv_grpaletteshader, 30}, + {IT_STRING | IT_CVAR, NULL, "Flashpals in Palette Renderer", &cv_grflashpal, 35}, + {IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_secbright, 40}, - {IT_STRING|IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 70}, - {IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 80}, - {IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 90}, + {IT_STRING|IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 50}, + {IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 55}, + {IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 60}, + {IT_STRING|IT_CVAR, NULL, "Visual Portals", &cv_grportals, 65}, - {IT_STRING|IT_CVAR, NULL, "Visual Portals", &cv_grportals, 100}, + {IT_STRING|IT_CVAR, NULL, "Wall Contrast Style", &cv_grfakecontrast, 75}, + {IT_STRING|IT_CVAR, NULL, "Slope Contrast", &cv_grslopecontrast, 80}, + {IT_STRING|IT_CVAR, NULL, "Sprite Billboarding", &cv_grspritebillboarding, 85}, + {IT_STRING|IT_CVAR, NULL, "Software Perspective", &cv_grshearing, 90}, + {IT_STRING|IT_CVAR, NULL, "Rendering Distance", &cv_grrenderdistance, 95}, - {IT_STRING|IT_CVAR, NULL, "Wall Contrast Style", &cv_grfakecontrast, 120}, - {IT_STRING|IT_CVAR, NULL, "Slope Contrast", &cv_grslopecontrast, 130}, - {IT_STRING|IT_CVAR, NULL, "Sprite Billboarding", &cv_grspritebillboarding, 140}, - {IT_STRING|IT_CVAR, NULL, "Software Perspective", &cv_grshearing, 150}, - {IT_STRING|IT_CVAR, NULL, "Rendering Distance", &cv_grrenderdistance, 160}, + {IT_SUBMENU|IT_STRING, NULL, "Gamma...", &OP_OpenGLColorDef, 105}, +}; + +static const char* OP_OpenGLTooltips[] = +{ + "Use 3D models.", + "Fallback 3D model for characters that don't have any.", + "Graphical Shaders.", + "Recreates the look of software mode.", + "Flash palettes for palette rendering.", + "Minimum shader brightness. This is set in sector brightness values.", + "Bit-depth of textures.", + "Filter to use on textures.", + "Anisotropic filtering.", + "Recreates an effect from software mode that is used on some maps.", + "The look of the wall contrast effect.", + "Wall contrast but for slopes.", + "Should sprites always face the camera?", + "Recreates the look of software mode camera perspective.", + "How far the game world should be drawn.", + "Gamma (brightness) of colors.", - {IT_SUBMENU|IT_STRING, NULL, "Gamma...", &OP_OpenGLColorDef, 170}, }; static menuitem_t OP_OpenGLColorMenu[] = @@ -1427,6 +1483,26 @@ static menuitem_t OP_SoundOptionsMenu[] = {IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 155} }; +static const char* OP_SoundTooltips[] = +{ + + "Turn Sound effects on or off.", + "Volume of sound effects.", + "Turn Sound effects on or off.", + "Volume of music.", + "Reverse left and right channels of audio.", + "Surround Sound.", + "Chat notification sound.", + "Frequency of character voice lines.", + "Should the powerup warning be a sound effect or music?", + "Testing sounds...", + "Should the game play music while unfocused?", + "Should the game play sound while unfocused?", + "Options for advanced sound settings.", + +}; + + static menuitem_t OP_SoundAdvancedMenu[] = { #ifdef HAVE_OPENMPT @@ -1445,6 +1521,24 @@ static menuitem_t OP_SoundAdvancedMenu[] = {IT_STRING | IT_CVAR, NULL, "Invulnerability Music", &cv_supermusic, 137}, }; +static const char* OP_SoundAdvancedTooltips[] = +{ +#ifdef HAVE_OPENMPT + NULL, + + "Filter used to resample tracker instruments.", + "Resample tracker modules to sound similar to Paula hardware.", +#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4 + "Which Amiga should be used for .mod playback?", +#endif + "How far should the four channels in .mod be panned?", +#endif + NULL, + "Should the Grow music be on or off?", + "Should the Invulnerability music be on or off?", + +}; + static menuitem_t OP_DataOptionsMenu[] = { @@ -1590,6 +1684,20 @@ static menuitem_t OP_ChatOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 120}, }; +static const char* OP_ChatOptionsTooltips[] = +{ + "Chat mode used for in-game chat.", + "Width of chat box.", + "Height of chat box.", + "Chatbox background.", + "Fadeout time for new chat message.", + "Spam protection for in-game chat.", + "Maxiumum amount of chat messages to look back at.", + "Show player ping.", + "Measurement used for ping.", + "Visibility of ping icon.", +}; + static menuitem_t OP_GameOptionsMenu[] = { {IT_STRING | IT_SUBMENU, NULL, "Random Item Toggles...", &OP_MonitorToggleDef, 10}, @@ -1609,6 +1717,23 @@ static menuitem_t OP_GameOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Restrict Character Changes", &cv_restrictskinchange, 150}, }; +static const char* OP_GameTooltips[] = +{ + "Toggles for all in-game items.", + "Configure gameplay options related to Neptune client.", + "Speed of game in race mode.", + "Speed of game in battle mode.", + "Crazier item rolls.", + "Mirror mode.", + "Number of laps.", + "Countdown for other players when people finish.", + "Time limit for battle mode.", + "Number of bumpers to start with in battle mode.", + "Allow players to come back via karma in battle mode.", + "Force everyone to use the same character.", + "Prevent character changes.", +}; + static menuitem_t OP_ServerOptionsMenu[] = { #ifndef NONET @@ -1632,6 +1757,27 @@ static menuitem_t OP_ServerOptionsMenu[] = #endif }; +static const char* OP_ServerOptionsTooltips[] = +{ +#ifndef NONET + "Name of server.", +#endif + + "Length of intermission after races.", + "How the next map to be played is choosen.", + "How long map voting is.", + "Amount of map rows in voting.", + "How often should other gamemodes appear.", +#ifndef NONET + "Max amount of players allowed in this server", + "Allow players to join this server.", + "Allow players to download addons.", + "Who has permission to pause the server?", + "Completely mute in game chat.", + "Options for advanced server settings.", +#endif +}; + #ifndef NONET static menuitem_t OP_AdvServerOptionsMenu[] = { @@ -1653,6 +1799,24 @@ static menuitem_t OP_AdvServerOptionsMenu[] = }; #endif +#ifndef NONET +static const char* OP_AdvServerOptionsTooltips[] = +{ + + "Server used for master server.", + "Attempts to resynchronise player to server.", + "Maximum allowed delay.", + "Delay timeout in seconds.", + "Connection timeout in tics.", + "Join timeout in tics", + "Max file size sent in killobytes.", + "Packet rate for file transfers.", + "Log ip addresses of players who join.", + "Log player resync attempts.", + "Log player file transfers.", +}; +#endif + /*static menuitem_t OP_NetgameOptionsMenu[] = { {IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 10}, @@ -1759,9 +1923,9 @@ static const char* OP_SaturnTooltips[] = "Minimize the player icons on the minimap.", "Disables the flicker effect on Midnight Channel.", - NULL, - NULL, - NULL, + "Options for player distortion effects.", + "Move position of HUD elements.", + "See the people who helped make this project possible!", }; enum @@ -1798,6 +1962,20 @@ static menuitem_t OP_PlayerDistortMenu[] = {IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 140}, }; +static const char* OP_PlayerDistortTooltips[] = +{ + NULL, + "Player rotation on slopes.", + "Distance player rotation should be visable.", + "Player rotation when sliptiding.", + "Player squash and stretch.", + "Player landing sound effect.", + "Kart hopping while drifting. This is purely visual.", + "Player hop sound effect.", + "Player hop squash and stretch.", + +}; + enum { sloperotate, @@ -1881,6 +2059,13 @@ static menuitem_t OP_SaturnCreditsMenu[] = {IT_STRING, NULL, "", NULL, 200}, // dummy text III }; +static const char* OP_CreditTooltips[] = +{ + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, + "Thanks everyone! <3", +}; + + static menuitem_t OP_BirdMenu[] = { {IT_HEADER, NULL, "Crazy", NULL, 0}, @@ -1901,6 +2086,24 @@ static menuitem_t OP_BirdMenu[] = {IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 120}, }; +static const char* OP_BirdTooltips[] = +{ + NULL, + "Options for screen tilting.", + NULL, + "Show player names in replay playback.", + "Show FREE PLAY text when in a empty server.", + NULL, + "Only show one battle choice in map vote", + "Amount of encore choices in map vote.", + NULL, + "Resume level music from last position after music change.", + "Restart Special music if item is used again.", + + "Options for advanced music settings.", + +}; + static menuitem_t OP_ForkedBirdMenu[] = { {IT_HEADER, NULL, "Local Skins", NULL, 0}, @@ -1921,6 +2124,15 @@ static menuitem_t OP_TiltMenu[] = {IT_STRING | IT_CVAR, NULL, "Also Tilt During Quakes", &cv_actionmovie, 40}, }; +static const char* OP_TiltTooltips[] = +{ + "Camera tilting during gameplay.", + "Tilt camera while turning.", + "Smoothing value used.", + "Tilt during screen quakes.", + +}; + enum { tilting, @@ -1942,6 +2154,18 @@ static menuitem_t OP_AdvancedBirdMenu[] = {IT_STRING | IT_CVAR, NULL, "Resync Special Music Only", &cv_music_resync_powerups_only, 70}, }; +static const char* OP_AdvancedBirdTooltips[] = +{ + "Music fading.", + "Fade in music after Invincibility.", + "Fade in music after Grow.", + "Fade out music before respawning.", + "Fade in music while respawning.", + "Threshold for syncing music.", + "Only sync special music.", + +}; + enum { fading, @@ -2392,7 +2616,7 @@ menu_t OP_VideoOptionsDef = &OP_MainDef, OP_VideoOptionsMenu, M_DrawVideoMenu, - 30, 30, + 30, 20, 0, NULL, NULL @@ -2418,12 +2642,13 @@ menu_t OP_SoundOptionsDef = &OP_MainDef, OP_SoundOptionsMenu, M_DrawSkyRoom, - 30, 30, + 30, 20, 0, NULL, NULL }; + menu_t OP_HUDOptionsDef = { "M_HUD", @@ -2437,14 +2662,15 @@ menu_t OP_HUDOptionsDef = NULL }; + menu_t OP_ChatOptionsDef = DEFAULTMENUSTYLE("M_HUD", OP_ChatOptionsMenu, &OP_HUDOptionsDef, 30, 30); menu_t OP_SoundAdvancedDef = DEFAULTMENUSTYLE("M_SOUND", OP_SoundAdvancedMenu, &OP_SoundOptionsDef, 30, 30); -menu_t OP_GameOptionsDef = DEFAULTMENUSTYLE("M_GAME", OP_GameOptionsMenu, &OP_MainDef, 30, 30); -menu_t OP_ServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 24, 30); +menu_t OP_GameOptionsDef = DEFAULTMENUSTYLE("M_GAME", OP_GameOptionsMenu, &OP_MainDef, 30, 20); +menu_t OP_ServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 24, 20); #ifndef NONET -menu_t OP_AdvServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_AdvServerOptionsMenu, &OP_ServerOptionsDef, 24, 30); +menu_t OP_AdvServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_AdvServerOptionsMenu, &OP_ServerOptionsDef, 24, 20); #endif //menu_t OP_NetgameOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_NetgameOptionsMenu, &OP_ServerOptionsDef, 30, 30); @@ -2464,7 +2690,7 @@ menu_t OP_MonitorToggleDef = }; #ifdef HWRENDER -menu_t OP_OpenGLOptionsDef = DEFAULTMENUSTYLE("M_VIDEO", OP_OpenGLOptionsMenu, &OP_VideoOptionsDef, 30, 20); +menu_t OP_OpenGLOptionsDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_OpenGLOptionsMenu, &OP_VideoOptionsDef, 30, 30); menu_t OP_OpenGLColorDef = { @@ -4365,6 +4591,58 @@ static void M_DrawMenuTitle(void) } } +// TODO: This is fucking terrible. +static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT32 box_x, INT32 alpha) +{ + const char* icopy = strdup(str); + const char** clines = NULL; + INT16 num_lines = 0; + + if (icopy == NULL) return; + + char* token = strtok(icopy, "\n"); + + while (token != NULL) + { + const char* line = strdup(token); + + if (line == NULL) return; + + clines = (const char**)realloc(clines, (num_lines + 1) * sizeof(const char*)); + clines[num_lines] = line; + num_lines++; + + token = strtok(NULL, "\n"); + } + + free(icopy); + + INT16 yoffset; + yoffset = (((5*10 - num_lines*10))); + + // Draw BG first,,, + for (int i = 0; i < num_lines; i++) + { + V_DrawFill(0, (y + yoffset - 6)+5, vid.width, 11, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); + yoffset += 11; + } + + yoffset = (((5*10 - num_lines*10))); + + // THEN the text + for (int i = 0; i < num_lines; i++) + { + V_DrawCenteredThinString(x, y + yoffset, option, clines[i]); + V_DrawCenteredThinString(x, y + yoffset, option|V_YELLOWMAP|((9 - alpha) << V_ALPHASHIFT), clines[i]); + yoffset += 10; + // Remember to free the memory for each line when you're done with it. + free((void*)clines[i]); + } + + free(clines); +} + + static void M_DrawGenericMenu(void) { INT32 x, y, w, i, cursory = 0; @@ -4507,6 +4785,165 @@ static void M_DrawGenericMenu(void) W_CachePatchName("M_CURSOR", PU_CACHE)); V_DrawString(currentMenu->x, cursory, lowercase|highlightflags, currentMenu->menuitems[itemOn].text); } + + + // dumb hack + // tooltips + + if (currentMenu == &OP_ControlsDef) + { + if (!(OP_ControlsTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ControlsTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + if (currentMenu == &OP_VideoOptionsDef) + { + if (!(OP_VideoTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_VideoTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + if (currentMenu == &OP_SoundOptionsDef) + { + if (!(OP_SoundTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SoundTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + if (currentMenu == &OP_SoundAdvancedDef) + { + if (!(OP_SoundAdvancedTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SoundAdvancedTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + + if (currentMenu == &OP_ExpOptionsDef) + { + if (!(OP_ExpTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ExpTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + if (currentMenu == &OP_ChatOptionsDef) + { + if (!(OP_ChatOptionsTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ChatOptionsTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + + if (currentMenu == &OP_GameOptionsDef) + { + if (!(OP_GameTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_GameTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + if (currentMenu == &OP_ServerOptionsDef) + { + if (!(OP_ServerOptionsTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ServerOptionsTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + if (currentMenu == &OP_AdvServerOptionsDef) + { + if (!(OP_AdvServerOptionsTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_AdvServerOptionsTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + + + if (currentMenu == &OP_PlayerDistortDef) + { + if (!(OP_PlayerDistortTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_PlayerDistortTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + + + if (currentMenu == &OP_SaturnCreditsDef) // C: + { + if (!(OP_CreditTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_CreditTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + if (currentMenu == &OP_BirdDef) + { + if (!(OP_BirdTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_BirdTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + if (currentMenu == &OP_TiltDef) + { + if (!(OP_TiltTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_TiltTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + if (currentMenu == &OP_AdvancedBirdDef) + { + if (!(OP_AdvancedBirdTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_AdvancedBirdTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + } static void M_DrawGenericBackgroundMenu(void) @@ -4517,56 +4954,7 @@ static void M_DrawGenericBackgroundMenu(void) #define scrollareaheight 72 -// TODO: This is fucking terrible. -static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT32 box_x, INT32 alpha) -{ - const char* icopy = strdup(str); - const char** clines = NULL; - INT16 num_lines = 0; - if (icopy == NULL) return; - - char* token = strtok(icopy, "\n"); - - while (token != NULL) - { - const char* line = strdup(token); - - if (line == NULL) return; - - clines = (const char**)realloc(clines, (num_lines + 1) * sizeof(const char*)); - clines[num_lines] = line; - num_lines++; - - token = strtok(NULL, "\n"); - } - - free(icopy); - - INT16 yoffset; - yoffset = (((5*10 - num_lines*10))); - - // Draw BG first,,, - for (int i = 0; i < num_lines; i++) - { - V_DrawFill(0, (y + yoffset - 6)+5, vid.width, 11, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); - yoffset += 11; - } - - yoffset = (((5*10 - num_lines*10))); - - // THEN the text - for (int i = 0; i < num_lines; i++) - { - V_DrawCenteredThinString(x, y + yoffset, option, clines[i]); - V_DrawCenteredThinString(x, y + yoffset, option|V_YELLOWMAP|((9 - alpha) << V_ALPHASHIFT), clines[i]); - yoffset += 10; - // Remember to free the memory for each line when you're done with it. - free((void*)clines[i]); - } - - free(clines); -} // note that alphakey is multiplied by 2 for scrolling menus to allow greater usage in UINT8 range. static void M_DrawGenericScrollMenu(void) @@ -4700,6 +5088,19 @@ static void M_DrawGenericScrollMenu(void) W_CachePatchName("M_CURSOR", PU_CACHE)); // dumb hack + // tooltips + if (currentMenu == &OP_OpenGLOptionsDef) + { + if (!(OP_OpenGLTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_OpenGLTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + if (currentMenu == &OP_SaturnDef) { if (!(OP_SaturnTooltips[itemOn] == NULL)) -- 2.54.0 From 41cf467f2ac347e5ba3d44e1b3274a9517b916d0 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Nov 2023 16:58:26 +0100 Subject: [PATCH 015/112] Revert "Revert "localskin rework incoming!!!!!"" This reverts commit 25b5e5f51094487780de711473a322f369b25b93. --- src/d_player.h | 4 ++-- src/k_kart.c | 31 +++++++++++++++++++++++-------- src/r_draw.c | 27 +++++++++++++++++++++++++++ src/r_draw.h | 3 +++ 4 files changed, 55 insertions(+), 10 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index c9329fe9c..4d61474fb 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -416,8 +416,8 @@ typedef struct player_s UINT8 skincolor; INT32 skin; - INT32 localskin; - boolean skinlocal; + INT32 localskin; // current localskin number + boolean skinlocal; // determines if localskin is a skin already loaded in the server UINT32 score; // player score fixed_t dashspeed; // dashing speed diff --git a/src/k_kart.c b/src/k_kart.c index bf0e657d6..39fb8bbca 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7656,13 +7656,28 @@ static void K_drawKartStats(void) y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset; flags |= V_HUDTRANS; + INT32 skinnum; + skin_t fakeskin; + fakeskin = skins[stplyr->skin]; + skinnum = stplyr->skin; + + // local skinner + if (stplyr->localskin) + { + skinnum = stplyr->localskin - 1; + if (stplyr->mo->skinlocal) + fakeskin = localskins[stplyr->localskin - 1]; + else + fakeskin = skins[stplyr->localskin - 1]; + } + if (!splitscreen) { // Skin name - V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), skins[stplyr->skin].realname)); + V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), fakeskin.realname)); // Icon and stats - V_DrawMappedPatch(x, y, flags, W_CachePatchName(skins[stplyr->skin].facerank, PU_CACHE), R_GetTranslationColormap(stplyr->skin, stplyr->skincolor, GTC_CACHE)); + V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(stplyr->mo->skin, stplyr->mo->localskin, stplyr->skincolor, GTC_CACHE, stplyr->mo->skinlocal)); V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE)); V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE)); } @@ -8427,7 +8442,7 @@ static boolean K_drawKartPositionFaces(void) { player_t *p; p = &players[rankplayer[i]]; - V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap); + V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceRank(p), colormap); } #ifdef HAVE_BLUA @@ -8517,7 +8532,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I { player_t *p; p = &players[tab[i].num]; - V_DrawMappedPatch(x, y-4, 0, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap); + V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(p), colormap); } /*if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] > 0) -- not enough space for this { @@ -9000,7 +9015,7 @@ static void K_drawKartWanted(void) if (players[battlewanted[i]].skincolor) { colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE); - V_DrawFixedPatch(x<skinlocal) ? localfacewantprefix : facewantprefix )[( (p->localskin) ? p->localskin-1 : p->skin )] : ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )]), colormap); + V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap);*/ } @@ -9128,7 +9143,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat amypos = amnumypos + ((y + AutomapPic->height/2 - (( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin]->height/2))<color) // 'default' color - V_DrawSciencePatch(amxpos, amypos, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], FRACUNIT); + V_DrawSciencePatch(amxpos, amypos, flags, R_GetSkinFaceMini(mo->player), FRACUNIT); else { UINT8 *colormap = R_GetTranslationColormap((mo->colorized) ? TC_RAINBOW : skin, mo->color, GTC_CACHE); @@ -9136,12 +9151,12 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat if (cv_minihead.value == 1) { colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal); - V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT/2, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap); + V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT/2, flags, R_GetSkinFaceMini(mo->player), colormap); } else if (cv_minihead.value == 0) { colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal); - V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap); + V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, R_GetSkinFaceMini(mo->player), colormap); } if (cv_showminimapnames.value && !(modeattacking || gamestate == GS_TIMEATTACK)) diff --git a/src/r_draw.c b/src/r_draw.c index ae30df6cc..b745c6d10 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -579,6 +579,33 @@ UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors return RGetTranslationColormap(( skin - skins ), color, flags, false); } +patch_t* R_GetSkinFaceRank(player_t* ply) +{ + if (ply->skinlocal && ply->localskin) + return localfacerankprefix[ply->localskin - 1]; + else if (ply->localskin) + return facerankprefix[ply->localskin - 1]; + return facerankprefix[ply->skin]; +} + +patch_t* R_GetSkinFaceWant(player_t* ply) +{ + if (ply->skinlocal && ply->localskin) + return localfacewantprefix[ply->localskin - 1]; + else if (ply->localskin) + return facewantprefix[ply->localskin - 1]; + return facewantprefix[ply->skin]; +} + +patch_t* R_GetSkinFaceMini(player_t* ply) +{ + if (ply->skinlocal && ply->localskin) + return localfacemmapprefix[ply->localskin - 1]; + else if (ply->localskin) + return facemmapprefix[ply->localskin - 1]; + return facemmapprefix[ply->skin]; +} + /** \brief Flushes cache of translation colormaps. Flushes cache of translation colormaps, but doesn't actually free the diff --git a/src/r_draw.h b/src/r_draw.h index b4e3fb651..ddcf596fa 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -117,6 +117,9 @@ extern lumpnum_t viewborderlump[8]; void R_InitTranslationTables(void); UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags); UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local); +patch_t* R_GetSkinFaceRank(player_t* ply); +patch_t* R_GetSkinFaceWant(player_t* ply); +patch_t* R_GetSkinFaceMini(player_t* ply); void R_FlushTranslationColormapCache(void); UINT8 R_GetColorByName(const char *name); -- 2.54.0 From 42e04ce981fdaa255a1947b0e3f3e20aacb2b897 Mon Sep 17 00:00:00 2001 From: hayaunderscore Date: Sun, 12 Nov 2023 04:58:10 +0800 Subject: [PATCH 016/112] haya you fucking dumbass never use mo->player here again --- src/k_kart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 39fb8bbca..a3c432e79 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9143,7 +9143,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat amypos = amnumypos + ((y + AutomapPic->height/2 - (( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin]->height/2))<color) // 'default' color - V_DrawSciencePatch(amxpos, amypos, flags, R_GetSkinFaceMini(mo->player), FRACUNIT); + V_DrawSciencePatch(amxpos, amypos, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], FRACUNIT); else { UINT8 *colormap = R_GetTranslationColormap((mo->colorized) ? TC_RAINBOW : skin, mo->color, GTC_CACHE); @@ -9151,12 +9151,12 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat if (cv_minihead.value == 1) { colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal); - V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT/2, flags, R_GetSkinFaceMini(mo->player), colormap); + V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT/2, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap); } else if (cv_minihead.value == 0) { colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal); - V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, R_GetSkinFaceMini(mo->player), colormap); + V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap); } if (cv_showminimapnames.value && !(modeattacking || gamestate == GS_TIMEATTACK)) -- 2.54.0 From f167db0cc646e141cbdbea5adaf83b608d639fd9 Mon Sep 17 00:00:00 2001 From: hayaunderscore Date: Sun, 12 Nov 2023 06:00:25 +0800 Subject: [PATCH 017/112] Fix weird stutter on grow and invinc music stutters --- src/k_kart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index a3c432e79..11f69a5b0 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6018,7 +6018,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) P_SetScale(overlay, player->mo->scale); } player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds - if (P_IsLocalPlayer(player)) + if (P_IsLocalPlayer(player) && cv_supermusic.value) S_ChangeMusicSpecial("kinvnc"); else S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmi : sfx_kinvnc)); @@ -6223,7 +6223,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (cv_kartdebugshrink.value && !modeattacking && !player->bot) player->mo->destscale = (6*player->mo->destscale)/8; player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds - if (P_IsLocalPlayer(player)) + if (P_IsLocalPlayer(player) && cv_growmusic.value) S_ChangeMusicSpecial("kgrow"); else S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow)); -- 2.54.0 From 2290c1955b01371d2705fd9c11e79964fc03e1e8 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sun, 12 Nov 2023 17:04:45 +0100 Subject: [PATCH 018/112] oops we dont have that menu lol --- src/m_menu.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index b4cd2b9e2..cdaa9356c 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4832,17 +4832,6 @@ static void M_DrawGenericMenu(void) } - - if (currentMenu == &OP_ExpOptionsDef) - { - if (!(OP_ExpTooltips[itemOn] == NULL)) - { - M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ExpTooltips[itemOn], 30, coolalphatimer); - if (coolalphatimer > 0 && interpTimerHackAllow) - coolalphatimer--; - } - } - if (currentMenu == &OP_ChatOptionsDef) { if (!(OP_ChatOptionsTooltips[itemOn] == NULL)) -- 2.54.0 From 30602a8eb76072dafab2cf8c62a11261c2590bc4 Mon Sep 17 00:00:00 2001 From: Indev Date: Sun, 12 Nov 2023 19:10:51 +0300 Subject: [PATCH 019/112] Fix crash related to localskins and stat display --- src/k_kart.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 11f69a5b0..58d6a9e07 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7656,28 +7656,25 @@ static void K_drawKartStats(void) y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset; flags |= V_HUDTRANS; - INT32 skinnum; - skin_t fakeskin; - fakeskin = skins[stplyr->skin]; - skinnum = stplyr->skin; + skin_t *fakeskin; + fakeskin = &skins[stplyr->skin]; // local skinner - if (stplyr->localskin) + if (stplyr->localskin) { - skinnum = stplyr->localskin - 1; - if (stplyr->mo->skinlocal) - fakeskin = localskins[stplyr->localskin - 1]; + if (stplyr->skinlocal) + fakeskin = &localskins[stplyr->localskin - 1]; else - fakeskin = skins[stplyr->localskin - 1]; + fakeskin = &skins[stplyr->localskin - 1]; } if (!splitscreen) { // Skin name - V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), fakeskin.realname)); + V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), fakeskin->realname)); // Icon and stats - V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(stplyr->mo->skin, stplyr->mo->localskin, stplyr->skincolor, GTC_CACHE, stplyr->mo->skinlocal)); + V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal)); V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE)); V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE)); } -- 2.54.0 From 994fd6354f5d6a21f4a58377588d74fb3a1f271b Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sun, 12 Nov 2023 17:30:08 +0100 Subject: [PATCH 020/112] fix kk typo lol fixes the X symbol with itembox offsets changed --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 58d6a9e07..6ce90f229 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8010,7 +8010,7 @@ static void K_drawKartItem(void) V_DrawString(fx+24, fy+31, V_ALLOWLOWERCASE|V_HUDTRANS|fflags, va("x%d", stplyr->kartstuff[k_itemamount])); else { - V_DrawScaledPatch(fy+28, fy+41, V_HUDTRANS|fflags, kp_itemx); + V_DrawScaledPatch(fx+28, fy+41, V_HUDTRANS|fflags, kp_itemx); V_DrawKartString(fx+38, fy+36, V_HUDTRANS|fflags, va("%d", stplyr->kartstuff[k_itemamount])); } } -- 2.54.0 From 955c7f0cfb45cff5b8fa67d73e674a63e33f87c4 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sun, 12 Nov 2023 17:56:59 +0100 Subject: [PATCH 021/112] remove some tooltips for things we dont have --- src/m_menu.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index cdaa9356c..cf7f15c6d 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1363,7 +1363,6 @@ static const char* OP_VideoTooltips[] = #ifdef HWRENDER "Options for OpenGL renderer.", #endif - "Experimental graphical options.", }; @@ -1766,7 +1765,6 @@ static const char* OP_ServerOptionsTooltips[] = "Length of intermission after races.", "How the next map to be played is choosen.", "How long map voting is.", - "Amount of map rows in voting.", "How often should other gamemodes appear.", #ifndef NONET "Max amount of players allowed in this server", @@ -2093,15 +2091,14 @@ static const char* OP_BirdTooltips[] = NULL, "Show player names in replay playback.", "Show FREE PLAY text when in a empty server.", - NULL, - "Only show one battle choice in map vote", - "Amount of encore choices in map vote.", + //NULL, + //"Only show one battle choice in map vote", + //"Amount of encore choices in map vote.", NULL, "Resume level music from last position after music change.", "Restart Special music if item is used again.", "Options for advanced music settings.", - }; static menuitem_t OP_ForkedBirdMenu[] = -- 2.54.0 From ccf6840cd5047c1c539f35275ec7216350398434 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Nov 2023 18:21:16 +0100 Subject: [PATCH 022/112] forgor and fixuer typos :p --- src/m_menu.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index cf7f15c6d..95a209754 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1719,9 +1719,7 @@ static menuitem_t OP_GameOptionsMenu[] = static const char* OP_GameTooltips[] = { "Toggles for all in-game items.", - "Configure gameplay options related to Neptune client.", "Speed of game in race mode.", - "Speed of game in battle mode.", "Crazier item rolls.", "Mirror mode.", "Number of laps.", @@ -1807,7 +1805,7 @@ static const char* OP_AdvServerOptionsTooltips[] = "Delay timeout in seconds.", "Connection timeout in tics.", "Join timeout in tics", - "Max file size sent in killobytes.", + "Max file size sent in kilobytes.", "Packet rate for file transfers.", "Log ip addresses of players who join.", "Log player resync attempts.", @@ -1913,9 +1911,9 @@ static const char* OP_SaturnTooltips[] = "Displays the input display outside of Record Attack. Also adjusts the\nposition scale to match.", "Change what style the speedometer is.", "Enable the stat display.", - "Enable colorized hud.", - "Enable the colorized itembox when colorized hud is enabled.", - "The color to use instead of the player color when colorized hud is enabled.", + "Enable colourized hud.", + "Enable the colourized itembox when colourized hud is enabled.", + "The colour to use instead of the player colour when colourized hud is enabled.", "Show the big 'LAP' text on a lap change.", "Show player names on the minimap.", "Minimize the player icons on the minimap.", -- 2.54.0 From 2fe912eebf900144a08450b81cf30749ac684c23 Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 13 Nov 2023 01:35:49 +0300 Subject: [PATCH 023/112] Fix compilation with NOTHREADS --- src/http-mserv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/http-mserv.c b/src/http-mserv.c index 8358a2454..7ad84b71f 100644 --- a/src/http-mserv.c +++ b/src/http-mserv.c @@ -87,9 +87,13 @@ Printf_url (const char *url) { boolean startup; +#ifdef HAVE_THREADS I_lock_mutex(&con_mutex); startup = con_startup; I_unlock_mutex(con_mutex); +#else + startup = con_startup; +#endif if (cv_masterserver_debug.value) (startup ? I_OutputMsg : CONS_Printf)( -- 2.54.0 From 3700dc3bae55a6e0498fad4f54894fb778991f34 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Sun, 12 Nov 2023 19:10:07 -0500 Subject: [PATCH 024/112] Fix P-meter speedo not scaling on mobjscaled map --- src/k_kart.c | 59 ++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 6ce90f229..ea1dff824 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8692,7 +8692,6 @@ static void K_drawKartSpeedometer(void) //KartZ speedo fixed_t fuspeed = 0; INT32 spdpatch = 0; - INT32 kartspd = 0; INT32 speedtype = 0; INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); @@ -8762,63 +8761,63 @@ static void K_drawKartSpeedometer(void) // Warning large if statement below... else if (cv_newspeedometer.value == 2 && kartzspeedo){ - fuspeed = FixedMul(stplyr->speed, mapobjectscale); + fuspeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT; - if (fuspeed < 2*FRACUNIT && fuspeed > 0) + if (fuspeed < 2 && fuspeed > 0) spdpatch = 0; - else if (fuspeed < 5*FRACUNIT && fuspeed > 1*FRACUNIT) + else if (fuspeed < 5 && fuspeed > 1) spdpatch = 1; - else if (fuspeed < 7*FRACUNIT && fuspeed > 4*FRACUNIT) + else if (fuspeed < 7 && fuspeed > 4) spdpatch = 2; - else if (fuspeed < 10*FRACUNIT && fuspeed > 6*FRACUNIT) + else if (fuspeed < 10 && fuspeed > 6) spdpatch = 3; - else if (fuspeed < 12*FRACUNIT && fuspeed > 9*FRACUNIT) + else if (fuspeed < 12 && fuspeed > 9) spdpatch = 4; - else if (fuspeed < 15*FRACUNIT && fuspeed > 11*FRACUNIT) + else if (fuspeed < 15 && fuspeed > 11) spdpatch = 5; - else if (fuspeed < 17*FRACUNIT && fuspeed > 14*FRACUNIT) + else if (fuspeed < 17 && fuspeed > 14) spdpatch = 6; - else if (fuspeed < 20*FRACUNIT && fuspeed > 16*FRACUNIT) + else if (fuspeed < 20 && fuspeed > 16) spdpatch = 7; - else if (fuspeed < 22*FRACUNIT && fuspeed > 19*FRACUNIT) + else if (fuspeed < 22 && fuspeed > 19) spdpatch = 8; - else if (fuspeed < 25*FRACUNIT && fuspeed > 21*FRACUNIT) + else if (fuspeed < 25 && fuspeed > 21) spdpatch = 9; - else if (fuspeed < 27*FRACUNIT && fuspeed > 24*FRACUNIT) + else if (fuspeed < 27 && fuspeed > 24) spdpatch = 10; - else if (fuspeed < 30*FRACUNIT && fuspeed > 26*FRACUNIT) + else if (fuspeed < 30 && fuspeed > 26) spdpatch = 11; - else if (fuspeed < 32*FRACUNIT && fuspeed > 29*FRACUNIT) + else if (fuspeed < 32 && fuspeed > 29) spdpatch = 12; - else if (fuspeed < 35*FRACUNIT && fuspeed > 31*FRACUNIT) + else if (fuspeed < 35 && fuspeed > 31) spdpatch = 13; - else if (fuspeed < 37*FRACUNIT && fuspeed > 34*FRACUNIT) + else if (fuspeed < 37 && fuspeed > 34) spdpatch = 14; - else if (fuspeed < 40*FRACUNIT && fuspeed > 36*FRACUNIT) + else if (fuspeed < 40 && fuspeed > 36) spdpatch = 15; - else if (fuspeed < 42*FRACUNIT && fuspeed > 39*FRACUNIT) + else if (fuspeed < 42 && fuspeed > 39) spdpatch = 16; - else if (fuspeed < 45*FRACUNIT && fuspeed > 41*FRACUNIT) + else if (fuspeed < 45 && fuspeed > 41) spdpatch = 17; - else if (fuspeed < 47*FRACUNIT && fuspeed > 44*FRACUNIT) + else if (fuspeed < 47 && fuspeed > 44) spdpatch = 18; - else if (fuspeed < 50*FRACUNIT && fuspeed > 46*FRACUNIT) + else if (fuspeed < 50 && fuspeed > 46) spdpatch = 19; - else if (fuspeed < 52*FRACUNIT && fuspeed > 49*FRACUNIT) + else if (fuspeed < 52 && fuspeed > 49) spdpatch = 20; - else if (fuspeed < 55*FRACUNIT && fuspeed > 51*FRACUNIT) + else if (fuspeed < 55 && fuspeed > 51) spdpatch = 21; - else if (fuspeed < 57*FRACUNIT && fuspeed > 54*FRACUNIT && (leveltime&4)) + else if (fuspeed < 57 && fuspeed > 54 && (leveltime&4)) spdpatch = 24; - else if (fuspeed < 57*FRACUNIT && fuspeed > 54*FRACUNIT && !(leveltime&4)) + else if (fuspeed < 57 && fuspeed > 54 && !(leveltime&4)) spdpatch = 23; - else if (fuspeed < 60*FRACUNIT && fuspeed > 56*FRACUNIT && (leveltime&4)) + else if (fuspeed < 60 && fuspeed > 56 && (leveltime&4)) spdpatch = 24; - else if (fuspeed < 60*FRACUNIT && fuspeed > 56*FRACUNIT && !(leveltime&4)) + else if (fuspeed < 60 && fuspeed > 56 && !(leveltime&4)) spdpatch = 23; - else if (fuspeed > 59*FRACUNIT && (leveltime&4)) + else if (fuspeed > 59 && (leveltime&4)) spdpatch = 24; - else if (fuspeed > 59*FRACUNIT && !(leveltime&4)) + else if (fuspeed > 59 && !(leveltime&4)) spdpatch = 23; -- 2.54.0 From 6d24d5a44a56413988bf1e9cc1b993b6b01c5694 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 13 Nov 2023 18:53:56 +0100 Subject: [PATCH 025/112] reset palshader lookup if you toggle the thing otherwise it can sometimes screw up and show garbage colors when toggling idk if this is the right way tho --- src/hardware/hw_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index a62607320..810bd2c1a 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -187,6 +187,7 @@ static void CV_grpaletteshader_OnChange(void) { if (cv_grshaders.value) { + InitPalette(0, false); HWD.pfnSetSpecialState(HWD_SET_PALETTE_SHADER_ENABLED, cv_grpaletteshader.value); gr_use_palette_shader = cv_grpaletteshader.value; V_SetPalette(0); -- 2.54.0 From ec97111d26c64d6433a23b91c8ba7809ebb14691 Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 13 Nov 2023 21:38:13 +0300 Subject: [PATCH 026/112] Make K_GetHudColor use player skincolor instead of color cvar when possible. Also fix compilation warning --- src/k_kart.c | 4 ++-- src/k_kart.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index ea1dff824..c5daf317d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -592,13 +592,13 @@ UINT8 K_GetKartColorByName(const char *name) return 0; } -UINT8 K_GetHudColor() +UINT8 K_GetHudColor(void) { if (stplyr && players - stplyr != consoleplayer) return stplyr->skincolor; if (cv_colorizedhud.value){ if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value; } - return cv_playercolor.value; + return (stplyr ? stplyr->skincolor : cv_playercolor.value); } //} diff --git a/src/k_kart.h b/src/k_kart.h index e5dbad724..86a7b1e45 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -17,7 +17,7 @@ extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2]; void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor); void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local); UINT8 K_GetKartColorByName(const char *name); -UINT8 K_GetHudColor(); +UINT8 K_GetHudColor(void); void K_RegisterKartStuff(void); -- 2.54.0 From 7163194ce9642cd96f4c6433133e26f514e5b834 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 13 Nov 2023 21:52:18 +0100 Subject: [PATCH 027/112] fixup paletteshader stuff uaghgegheuaghuagheghg now every dumb edge case should be covered and the palette should never turn to garbage if you toggle stuff around --- src/hardware/hw_main.c | 26 +++++++++++++++++++++----- src/hardware/hw_main.h | 2 ++ src/hardware/r_opengl/r_opengl.c | 4 ++-- src/st_stuff.c | 6 +++--- src/v_video.c | 9 +++++---- 5 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 810bd2c1a..73db9b1a2 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -69,6 +69,7 @@ static void CV_anisotropic_ONChange(void); static void CV_screentextures_ONChange(void); static void CV_useCustomShaders_ONChange(void); static void CV_grpaletteshader_OnChange(void); +static void CV_grshaders_OnChange(void); static void CV_Gammaxxx_ONChange(void); static CV_PossibleValue_t grgamma_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}}; @@ -139,12 +140,12 @@ static INT32 current_bsp_culling_distance = 0; consvar_t cv_grscreentextures = {"gr_screentextures", "On", CV_CALL, CV_OnOff, CV_screentextures_ONChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grshaders = {"gr_shaders", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grshaders = {"gr_shaders", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grusecustomshaders = {"gr_usecustomshaders", "Yes", CV_CALL|CV_SAVE, CV_OnOff, CV_useCustomShaders_ONChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grpaletteshader = {"gr_paletteshader", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_grpaletteshader_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grflashpal = {"gr_flashpal", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grflashpal = {"gr_flashpal", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grmdls = {"gr_mdls", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grfallbackplayermodel = {"gr_fallbackplayermodel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -189,12 +190,27 @@ static void CV_grpaletteshader_OnChange(void) { InitPalette(0, false); HWD.pfnSetSpecialState(HWD_SET_PALETTE_SHADER_ENABLED, cv_grpaletteshader.value); - gr_use_palette_shader = cv_grpaletteshader.value; + gr_use_palette_shader = cv_grpaletteshader.value; V_SetPalette(0); } } } + +static void CV_grshaders_OnChange(void) +{ + if (rendermode == render_opengl) + { + if (cv_grpaletteshader.value) + { + InitPalette(0, false); + V_SetPalette(0); + } + } +} + + + // change the palette directly to see the change static void CV_Gammaxxx_ONChange(void) { @@ -517,7 +533,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col Surface->LightInfo.fade_start = (colormap != NULL) ? colormap->fadestart : 0; Surface->LightInfo.fade_end = (colormap != NULL) ? colormap->fadeend : 31; - if (gr_use_palette_shader) + if (gr_use_palette_shader && cv_grshaders.value) { if (!colormap) { @@ -6499,7 +6515,7 @@ void HWR_DoPostProcessor(player_t *player) // Armageddon Blast Flash! // Could this even be considered postprocessor? - if ((player->flashcount) && !(cv_grshaders.value && cv_grpaletteshader.value && cv_grflashpal.value)) + if ((player->flashcount) && !(cv_grshaders.value && gr_use_palette_shader && cv_grflashpal.value)) { FOutVector v[4]; FSurfaceInfo Surf; diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 8f24cabe0..bf433c15e 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -44,6 +44,8 @@ extern float gr_basewindowcenterx, gr_basewindowcentery; extern unsigned msaa; extern boolean a2c; +extern gr_use_palette_shader; + extern FTransform atransform; extern float gr_viewsin, gr_viewcos; diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 47d7e6932..fd9e5759c 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2320,8 +2320,8 @@ static int comparePolygons(const void *p1, const void *p2) if (gl_use_palette_shader) { - diff = poly1->surf.LightTableId - poly2->surf.LightTableId; - if (diff != 0) return diff; + diff = poly1->surf.LightTableId - poly2->surf.LightTableId; + if (diff != 0) return diff; } diff = poly1->polyFlags - poly2->polyFlags; diff --git a/src/st_stuff.c b/src/st_stuff.c index 9bc182d17..5fbaca124 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -245,7 +245,7 @@ void ST_doPaletteStuff(void) palette = 0; #ifdef HWRENDER - if ((rendermode == render_opengl && !cv_grpaletteshader.value) || (rendermode == render_opengl && cv_grpaletteshader.value && !cv_grflashpal.value)) + if ((rendermode == render_opengl && !cv_grpaletteshader.value) || (rendermode == render_opengl && gr_use_palette_shader && !cv_grflashpal.value)) palette = 0; // No flashpals here in OpenGL #endif @@ -254,7 +254,7 @@ void ST_doPaletteStuff(void) st_palette = palette; #ifdef HWRENDER - if (rendermode == render_soft || (rendermode == render_opengl && cv_grpaletteshader.value && cv_grflashpal.value)) + if (rendermode == render_soft || (rendermode == render_opengl && gr_use_palette_shader && cv_grflashpal.value)) #else if (rendermode != render_none) #endif @@ -2207,7 +2207,7 @@ void ST_Drawer(void) //25/08/99: Hurdler: palette changes is done for all players, // not only player1! That's why this part // of code is moved somewhere else. - if (rendermode == render_soft || (rendermode == render_opengl && cv_grpaletteshader.value && cv_grflashpal.value)) + if (rendermode == render_soft || (rendermode == render_opengl && gr_use_palette_shader && cv_grflashpal.value)) #endif if (rendermode != render_none) ST_doPaletteStuff(); diff --git a/src/v_video.c b/src/v_video.c index 3bcd9db50..6916fdffd 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -203,14 +203,14 @@ void V_SetPalette(INT32 palettenum) #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) { // in palette rendering mode, we already manage our palette ourselves - if (cv_grpaletteshader.value == 1) + if (gr_use_palette_shader) { // reset our palette lookups n shit gl_palette_initialized = false; InitPalette(palettenum, true); } else - HWR_SetPalette(pLocalPalette); + HWR_SetPalette(&pLocalPalette[palettenum*256]); } #if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) else @@ -225,13 +225,14 @@ void V_SetPaletteLump(const char *pal) LoadPalette(pal); #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) { - if (cv_grpaletteshader.value == 1) + if (gr_use_palette_shader) { // reset our palette lookups n shit gl_palette_initialized = false; InitPalette(0, false); } - HWR_SetPalette(pLocalPalette); + else + HWR_SetPalette(pLocalPalette); } #if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) else -- 2.54.0 From 2ffc7293af49e0f3ffad6f9a2081069e3af9d493 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Mon, 13 Nov 2023 22:44:23 +0100 Subject: [PATCH 028/112] screw it, revamp the whole thing blurgh like this theres never a condition where paletteshader shit runs even if you have shaders turned off and stuff --- src/hardware/hw_main.c | 60 ++++++++++++++++---------------- src/hardware/hw_main.h | 2 -- src/hardware/r_opengl/r_opengl.c | 23 +++++------- src/st_stuff.c | 6 ++-- src/v_video.c | 8 ++--- 5 files changed, 46 insertions(+), 53 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 73db9b1a2..5632bfa62 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -61,15 +61,12 @@ struct hwdriver_s hwdriver; // Commands and console variables // ========================================================================== -// keep the state here instead of in the cv var, so it always matches the state in r_opengl.c -int gr_use_palette_shader = 0; - static void CV_filtermode_ONChange(void); static void CV_anisotropic_ONChange(void); static void CV_screentextures_ONChange(void); static void CV_useCustomShaders_ONChange(void); static void CV_grpaletteshader_OnChange(void); -static void CV_grshaders_OnChange(void); +static void CV_flashpal_OnChange(void); static void CV_Gammaxxx_ONChange(void); static CV_PossibleValue_t grgamma_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}}; @@ -140,12 +137,12 @@ static INT32 current_bsp_culling_distance = 0; consvar_t cv_grscreentextures = {"gr_screentextures", "On", CV_CALL, CV_OnOff, CV_screentextures_ONChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grshaders = {"gr_shaders", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grshaders = {"gr_shaders", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grusecustomshaders = {"gr_usecustomshaders", "Yes", CV_CALL|CV_SAVE, CV_OnOff, CV_useCustomShaders_ONChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grpaletteshader = {"gr_paletteshader", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_grpaletteshader_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grflashpal = {"gr_flashpal", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grflashpal = {"gr_flashpal", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_flashpal_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grmdls = {"gr_mdls", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grfallbackplayermodel = {"gr_fallbackplayermodel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -155,6 +152,12 @@ consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "On", CV_SAVE, CV_ consvar_t cv_grfakecontrast = {"gr_fakecontrast", "Standard", CV_SAVE, grfakecontrast_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grslopecontrast = {"gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + +boolean HWR_ShouldUsePaletteRendering(void) +{ + return (cv_grpaletteshader.value && cv_grshaders.value); +} + static void CV_filtermode_ONChange(void) { if (rendermode == render_opengl) @@ -186,22 +189,20 @@ static void CV_grpaletteshader_OnChange(void) { if (rendermode == render_opengl) { - if (cv_grshaders.value) - { - InitPalette(0, false); - HWD.pfnSetSpecialState(HWD_SET_PALETTE_SHADER_ENABLED, cv_grpaletteshader.value); - gr_use_palette_shader = cv_grpaletteshader.value; + InitPalette(0, false); + + if (HWR_ShouldUsePaletteRendering()) + { V_SetPalette(0); - } + } } } - -static void CV_grshaders_OnChange(void) +static void CV_flashpal_OnChange(void) { if (rendermode == render_opengl) { - if (cv_grpaletteshader.value) + if (HWR_ShouldUsePaletteRendering()) { InitPalette(0, false); V_SetPalette(0); @@ -209,8 +210,6 @@ static void CV_grshaders_OnChange(void) } } - - // change the palette directly to see the change static void CV_Gammaxxx_ONChange(void) { @@ -218,6 +217,7 @@ static void CV_Gammaxxx_ONChange(void) V_SetPalette(0); } + // ========================================================================== // Globals // ========================================================================== @@ -533,7 +533,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col Surface->LightInfo.fade_start = (colormap != NULL) ? colormap->fadestart : 0; Surface->LightInfo.fade_end = (colormap != NULL) ? colormap->fadeend : 31; - if (gr_use_palette_shader && cv_grshaders.value) + if (HWR_ShouldUsePaletteRendering()) { if (!colormap) { @@ -887,7 +887,7 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei else if (PolyFlags & PF_Ripple) HWD.pfnSetShader(5); // water shader else - HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 9 : 1); // floor shader PolyFlags |= PF_ColorMapped; } @@ -1046,7 +1046,7 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf) if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 2); // wall shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 2); // wall shader } HWD.pfnDrawPolygon(&pSurf, wallVerts, 4, i|PF_Modulated|PF_Decal, false); @@ -1084,7 +1084,7 @@ void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 2); // wall shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 2); // wall shader blendmode |= PF_ColorMapped; } @@ -3332,7 +3332,7 @@ void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 9 : 1); // floor shader blendmode |= PF_ColorMapped; } @@ -4149,7 +4149,7 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 9 : 1); // floor shader } HWD.pfnDrawPolygon(&sSurf, swallVerts, 4, PF_Translucent|PF_Modulated, false); @@ -4521,7 +4521,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 3); // sprite shader blend |= PF_ColorMapped; } @@ -4566,7 +4566,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 3); // sprite shader blend |= PF_ColorMapped; } @@ -4724,7 +4724,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 3); // sprite shader blend |= PF_ColorMapped; } @@ -4829,7 +4829,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr) if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 3); // sprite shader blend |= PF_ColorMapped; } @@ -6479,7 +6479,7 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, { if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 2); // wall shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 2); // wall shader blendmode |= PF_ColorMapped; } } @@ -6515,7 +6515,7 @@ void HWR_DoPostProcessor(player_t *player) // Armageddon Blast Flash! // Could this even be considered postprocessor? - if ((player->flashcount) && !(cv_grshaders.value && gr_use_palette_shader && cv_grflashpal.value)) + if ((player->flashcount) && !(HWR_ShouldUsePaletteRendering() && cv_grflashpal.value)) { FOutVector v[4]; FSurfaceInfo Surf; @@ -6642,7 +6642,7 @@ void HWR_MakeScreenFinalTexture(void) void HWR_DrawScreenFinalTexture(int width, int height) { - if (gr_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) HWD.pfnSetShader(11); //post processing HWD.pfnDrawScreenFinalTexture(width, height); } diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index bf433c15e..8f24cabe0 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -44,8 +44,6 @@ extern float gr_basewindowcenterx, gr_basewindowcentery; extern unsigned msaa; extern boolean a2c; -extern gr_use_palette_shader; - extern FTransform atransform; extern float gr_viewsin, gr_viewcos; diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index fd9e5759c..0e5222e11 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -629,7 +629,6 @@ static boolean gl_shaderprogramchanged = true; static boolean gl_batching = false;// are we currently collecting batches? static GLint gl_palette[768]; -static INT32 gl_use_palette_shader = 0; boolean gl_palette_initialized = false; static INT32 gl_enable_screen_textures = 1; @@ -1251,7 +1250,7 @@ EXPORT boolean HWRAPI(InitCustomShaders) (void) KillShaders(); return LoadShaders(); - if (gl_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) { InitPalette(0, false); } @@ -2318,7 +2317,7 @@ static int comparePolygons(const void *p1, const void *p2) diff = poly1->texNum - poly2->texNum; if (diff != 0) return diff; - if (gl_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) { diff = poly1->surf.LightTableId - poly2->surf.LightTableId; if (diff != 0) return diff; @@ -2461,7 +2460,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i if (gl_allowshaders) { Shader_Load(¤tSurfaceInfo, &firstPoly, &firstTint, &firstFade); - if (gl_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) { pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now pglBindTexture(GL_TEXTURE_2D, currentSurfaceInfo.LightTableId); @@ -2578,7 +2577,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i changeState = true; changePolyFlags = true; } - if ((gl_allowshaders) && (gl_use_palette_shader)) + if ((gl_allowshaders) && (HWR_ShouldUsePaletteRendering())) { if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba || currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba || @@ -2592,7 +2591,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i changeSurfaceInfo = true; } } - else if ((gl_allowshaders) && (!gl_use_palette_shader)) + else if ((gl_allowshaders) && (!HWR_ShouldUsePaletteRendering())) { if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba || currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba || @@ -2723,7 +2722,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i Shader_Load(&nextSurfaceInfo, &poly, &tint, &fade); - if (gl_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) { pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now pglBindTexture(GL_TEXTURE_2D, nextSurfaceInfo.LightTableId); @@ -2834,7 +2833,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI fade.alpha = byte2float[pSurf->FadeColor.s.alpha]; } - if (gl_use_palette_shader && gl_allowshaders) + if (HWR_ShouldUsePaletteRendering() && gl_allowshaders) { pglActiveTexture(GL_TEXTURE2); pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId); @@ -3182,10 +3181,6 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value) break; } break; - - case HWD_SET_PALETTE_SHADER_ENABLED: - gl_use_palette_shader = Value; - break; case HWD_SET_TEXTUREFILTERMODE: switch (Value) @@ -4258,7 +4253,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height) // prepare shader, if it is enabled Shader_SetUniforms(NULL, NULL, NULL, NULL); - if (gl_use_palette_shader && cv_grshaders.value) + if (HWR_ShouldUsePaletteRendering()) { pglUseProgram(gl_shaderprograms[8].program); // palette shader pglActiveTexture(GL_TEXTURE1); @@ -4272,7 +4267,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height) tex_downloaded = finalScreenTexture; - if (gl_use_palette_shader && cv_grshaders.value) + if (HWR_ShouldUsePaletteRendering()) { pglUseProgram(0); pglActiveTexture(GL_TEXTURE0); diff --git a/src/st_stuff.c b/src/st_stuff.c index 5fbaca124..527f4e914 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -245,7 +245,7 @@ void ST_doPaletteStuff(void) palette = 0; #ifdef HWRENDER - if ((rendermode == render_opengl && !cv_grpaletteshader.value) || (rendermode == render_opengl && gr_use_palette_shader && !cv_grflashpal.value)) + if ((rendermode == render_opengl && !cv_grpaletteshader.value) || (rendermode == render_opengl && HWR_ShouldUsePaletteRendering() && !cv_grflashpal.value)) palette = 0; // No flashpals here in OpenGL #endif @@ -254,7 +254,7 @@ void ST_doPaletteStuff(void) st_palette = palette; #ifdef HWRENDER - if (rendermode == render_soft || (rendermode == render_opengl && gr_use_palette_shader && cv_grflashpal.value)) + if (rendermode == render_soft || (rendermode == render_opengl && HWR_ShouldUsePaletteRendering() && cv_grflashpal.value)) #else if (rendermode != render_none) #endif @@ -2207,7 +2207,7 @@ void ST_Drawer(void) //25/08/99: Hurdler: palette changes is done for all players, // not only player1! That's why this part // of code is moved somewhere else. - if (rendermode == render_soft || (rendermode == render_opengl && gr_use_palette_shader && cv_grflashpal.value)) + if (rendermode == render_soft || (rendermode == render_opengl && HWR_ShouldUsePaletteRendering() && cv_grflashpal.value)) #endif if (rendermode != render_none) ST_doPaletteStuff(); diff --git a/src/v_video.c b/src/v_video.c index 6916fdffd..508e86c9a 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -203,7 +203,7 @@ void V_SetPalette(INT32 palettenum) #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) { // in palette rendering mode, we already manage our palette ourselves - if (gr_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) { // reset our palette lookups n shit gl_palette_initialized = false; @@ -225,14 +225,14 @@ void V_SetPaletteLump(const char *pal) LoadPalette(pal); #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) { - if (gr_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) { // reset our palette lookups n shit gl_palette_initialized = false; InitPalette(0, false); } - else - HWR_SetPalette(pLocalPalette); + + HWR_SetPalette(pLocalPalette); } #if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) else -- 2.54.0 From d33c1e83de63adcedd22024f1105074b9b5ebca5 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 14 Nov 2023 02:28:59 +0100 Subject: [PATCH 029/112] Revert "refactor weather switching" This reverts commit 873a611b33b0a3ef62633c1e8327c86ab0617655. eeh i dont trust it tbh --- src/p_mobj.c | 15 +++++++-- src/p_spec.c | 93 ++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 88 insertions(+), 20 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index ad437585f..148273491 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10370,7 +10370,7 @@ void P_SpawnPrecipitation(void) subsector_t *precipsector = NULL; precipmobj_t *rainmo = NULL; - if (dedicated || !(cv_drawdist_precip.value) || curWeather == PRECIP_NONE || curWeather == PRECIP_STORM_NORAIN) // SRB2Kart + if (dedicated || /*!cv_precipdensity*/!cv_drawdist_precip.value || curWeather == PRECIP_NONE) // SRB2Kart return; // Use the blockmap to narrow down our placing patterns @@ -10413,13 +10413,22 @@ void P_SpawnPrecipitation(void) } else // everything else. rainmo = P_SpawnRainMobj(x, y, height, MT_RAIN); - if (curWeather == PRECIP_BLANK) - rainmo->precipflags |= PCF_INVISIBLE; // Randomly assign a height, now that floorz is set. rainmo->z = M_RandomRange(rainmo->floorz>>FRACBITS, rainmo->ceilingz>>FRACBITS)<flags = mobjinfo[MT_RAIN].flags; st = &states[mobjinfo[MT_RAIN].spawnstate]; @@ -2053,7 +2092,7 @@ void P_SwitchWeather(INT32 weathernum) precipmobj->precipflags |= PCF_RAIN; //think->function.acp1 = (actionf_p1)P_RainThinker; } - else if (weathernum == PRECIP_SNOW) // Rain To Snow + else if (swap == PRECIP_SNOW) // Rain To Snow { INT32 z; @@ -2078,7 +2117,7 @@ void P_SwitchWeather(INT32 weathernum) //think->function.acp1 = (actionf_p1)P_SnowThinker; } - else // Remove precip, but keep it around for reuse. + else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse. { //think->function.acp1 = (actionf_p1)P_NullPrecipThinker; @@ -2092,31 +2131,48 @@ void P_SwitchWeather(INT32 weathernum) case PRECIP_SNOW: // snow curWeather = PRECIP_SNOW; - if (purge) + if (!swap) P_SpawnPrecipitation(); break; case PRECIP_RAIN: // rain { + boolean dontspawn = false; + + if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES) + dontspawn = true; + curWeather = PRECIP_RAIN; - if (purge) + if (!dontspawn && !swap) P_SpawnPrecipitation(); break; } case PRECIP_STORM: // storm { + boolean dontspawn = false; + + if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES) + dontspawn = true; + curWeather = PRECIP_STORM; - if (purge) + if (!dontspawn && !swap) P_SpawnPrecipitation(); break; } case PRECIP_STORM_NOSTRIKES: // storm w/o lightning { - if (purge) + boolean dontspawn = false; + + if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES) + dontspawn = true; + + curWeather = PRECIP_STORM_NOSTRIKES; + + if (!dontspawn && !swap) P_SpawnPrecipitation(); break; @@ -2124,11 +2180,14 @@ void P_SwitchWeather(INT32 weathernum) case PRECIP_STORM_NORAIN: // storm w/o rain curWeather = PRECIP_STORM_NORAIN; + if (!swap) + P_SpawnPrecipitation(); + break; - case PRECIP_BLANK: //preloaded + case PRECIP_BLANK: curWeather = PRECIP_BLANK; - if (purge) + if (!swap) P_SpawnPrecipitation(); break; -- 2.54.0 From dfccca4026ad34132155710a5a98c54925cc8c60 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 14 Nov 2023 06:08:38 +0100 Subject: [PATCH 030/112] Add a toggle to cut precip in half ye this pretty much cuts the weather thinker count in half since weather spawns all mobjs regardless of distance setting its good for ppl who like weather effects but have weaker hardware --- src/p_mobj.c | 12 ++++++++++-- src/r_main.c | 2 ++ src/r_main.h | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 148273491..c52bb05be 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10381,8 +10381,16 @@ void P_SpawnPrecipitation(void) //for (j = 0; j < cv_precipdensity.value; ++j) -- density is 1 for kart always { - x = basex + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); - y = basey + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); + if (cv_lessprecip.value) + { + x = basex*1.5 + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); + y = basey*1.5 + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); + } + else + { + x = basex + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); + y = basey + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); + } precipsector = R_IsPointInSubsector(x, y); diff --git a/src/r_main.c b/src/r_main.c index 6bf1bd2ad..8df79fa77 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -198,6 +198,7 @@ consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, N consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //consvar_t cv_drawdist_nights = {"drawdist_nights", "2048", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_precip_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //consvar_t cv_precipdensity = {"precipdensity", "Moderate", CV_SAVE, precipdensity_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // cap fov, fov too high tears software apart. @@ -1906,6 +1907,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_drawdist); //CV_RegisterVar(&cv_drawdist_nights); CV_RegisterVar(&cv_drawdist_precip); + CV_RegisterVar(&cv_lessprecip); CV_RegisterVar(&cv_fov); CV_RegisterVar(&cv_chasecam); diff --git a/src/r_main.h b/src/r_main.h index 036401ef9..6a7ea7da6 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -113,7 +113,7 @@ extern consvar_t cv_flipcam, cv_flipcam2, cv_flipcam3, cv_flipcam4; extern consvar_t cv_shadow, cv_shadowoffs; extern consvar_t cv_ffloorclip, cv_spriteclip; extern consvar_t cv_translucency; -extern consvar_t /*cv_precipdensity,*/ cv_drawdist, /*cv_drawdist_nights,*/ cv_drawdist_precip; +extern consvar_t /*cv_precipdensity,*/ cv_drawdist, /*cv_drawdist_nights,*/ cv_drawdist_precip, cv_lessprecip; extern consvar_t cv_fov; extern consvar_t cv_skybox; extern consvar_t cv_tailspickup; -- 2.54.0 From ddd6488b556d6a1c61a2f092ed4d4aa6f94a3381 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 14 Nov 2023 18:27:20 +0100 Subject: [PATCH 031/112] Fix typos and reword some stuff --- src/d_netfil.c | 2 +- src/m_menu.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index 0f835ddd2..a51d44f80 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -1342,7 +1342,7 @@ void CURLGetFile(void) if (easyres == CURLE_HTTP_RETURNED_ERROR) curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, &response_code); - easy_handle_error = (response_code) ? va("HTTP reponse code %ld", response_code) : curl_easy_strerror(easyres); + easy_handle_error = (response_code) ? va("HTTP response code %ld", response_code) : curl_easy_strerror(easyres); curl_curfile->status = FS_FALLBACK; curl_curfile->currentsize = curl_origfilesize; curl_curfile->totalsize = curl_origtotalfilesize; diff --git a/src/m_menu.c b/src/m_menu.c index 95a209754..abda573bd 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1167,7 +1167,7 @@ static const char* OP_ControlsTooltips[] = "Setup player 3 controls.", "Setup player 4 controls.", - "Allowed amount of comtrols per key.", + "Allowed amount of controls per key.", "Turn smoothing for non-analog turning.", }; @@ -1495,10 +1495,10 @@ static const char* OP_SoundTooltips[] = "Frequency of character voice lines.", "Should the powerup warning be a sound effect or music?", "Testing sounds...", - "Should the game play music while unfocused?", - "Should the game play sound while unfocused?", + "Should the games music play while unfocused?", + "Should the games sound play while unfocused?", "Options for advanced sound settings.", - + }; @@ -1719,7 +1719,7 @@ static menuitem_t OP_GameOptionsMenu[] = static const char* OP_GameTooltips[] = { "Toggles for all in-game items.", - "Speed of game in race mode.", + "Driving speed of game in race mode.", "Crazier item rolls.", "Mirror mode.", "Number of laps.", @@ -1765,7 +1765,7 @@ static const char* OP_ServerOptionsTooltips[] = "How long map voting is.", "How often should other gamemodes appear.", #ifndef NONET - "Max amount of players allowed in this server", + "Max amount of players allowed in this server.", "Allow players to join this server.", "Allow players to download addons.", "Who has permission to pause the server?", -- 2.54.0 From 4b8bc463581a179d53ef5ca9d7267f1b88c5491f Mon Sep 17 00:00:00 2001 From: NepDisk Date: Tue, 14 Nov 2023 03:10:37 -0500 Subject: [PATCH 032/112] Master server 'b gone. Makes disabling the define actually alone the compile to work --- src/d_clisrv.c | 5 ++++- src/doomdef.h | 2 +- src/i_tcp.c | 4 ++++ src/m_menu.c | 40 ++++++++++++++++++++++++++++++++++------ src/mserv.c | 16 +++++++++++++++- src/mserv.h | 13 +++++++++---- 6 files changed, 67 insertions(+), 13 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 6e56d3ac4..68206d485 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1939,12 +1939,13 @@ static void CL_LoadReceivedSavegame(void) static void SendAskInfo(INT32 node) { tic_t asktime; - + #ifdef MASTERSERVER if (node != 0 && node != BROADCASTADDR && cv_rendezvousserver.string[0]) { I_NetRequestHolePunch(node); } + #endif MASTERSERVER asktime = I_GetTime(); @@ -6155,6 +6156,7 @@ static void UpdatePingTable(void) static void RenewHolePunch(void) { +#ifdef MASTERSERVER if (cv_rendezvousserver.string[0]) { static time_t past; @@ -6167,6 +6169,7 @@ static void RenewHolePunch(void) past = now; } } +#endif } // Handle timeouts to prevent definitive freezes from happenning diff --git a/src/doomdef.h b/src/doomdef.h index f41a02782..e05265ed5 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -638,7 +638,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; #define GL_SHADERS #if defined (HAVE_CURL) && ! defined (NONET) -#define MASTERSERVER +//#define MASTERSERVER #else #undef UPDATE_ALERT #endif diff --git a/src/i_tcp.c b/src/i_tcp.c index 9162d61ae..ca2e5ea26 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -611,6 +611,7 @@ is_external_address (UINT32 p) static boolean hole_punch(ssize_t c) { +#ifdef MASTERSERVER /* See ../doc/Holepunch-Protocol.txt */ if (cv_rendezvousserver.string[0] && c == 10 && holepunchpacket->magic == hole_punch_magic && @@ -631,6 +632,7 @@ static boolean hole_punch(ssize_t c) { return false; } +#endif } // Returns true if a packet was received from a new node, false in all other cases @@ -1366,6 +1368,7 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port) static void rendezvous(int size) { +#ifdef MASTERSERVER char *addrs = strdup(cv_rendezvousserver.string); char *host = strtok(addrs, ":"); @@ -1396,6 +1399,7 @@ static void rendezvous(int size) } free(addrs); +#endif } static void SOCK_RequestHolePunch(INT32 node) diff --git a/src/m_menu.c b/src/m_menu.c index abda573bd..fbaf86b97 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1048,7 +1048,11 @@ static menuitem_t MP_MainMenu[] = {IT_HEADER, NULL, "Join a game", NULL, 132-24}, #ifndef NONET +#ifndef MASTERSERVER + {IT_GRAYEDOUT, NULL, "Internet server browser...",NULL, 142-24}, +#else {IT_STRING|IT_CALL, NULL, "Internet server browser...",M_PreConnectMenu, 142-24}, +#endif {IT_STRING|IT_CALL, NULL, "Join last server", M_ConnectLastServer, 150-24}, {IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 158-24}, #else @@ -1065,7 +1069,11 @@ static menuitem_t MP_MainMenu[] = static menuitem_t MP_ServerMenu[] = { {IT_STRING|IT_CVAR, NULL, "Max. Player Count", &cv_maxplayers, 10}, +#ifndef MASTERSERVER + {IT_GRAYEDOUT, NULL, "Advertise", NULL, 20}, +#else {IT_STRING|IT_CVAR, NULL, "Advertise", &cv_advertise, 20}, +#endif {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Server Name", &cv_servername, 30}, {IT_STRING|IT_CVAR, NULL, "Game Type", &cv_newgametype, 68}, @@ -1777,9 +1785,15 @@ static const char* OP_ServerOptionsTooltips[] = #ifndef NONET static menuitem_t OP_AdvServerOptionsMenu[] = { - {IT_STRING | IT_CVAR | IT_CV_STRING, - NULL, "Server Browser Address", &cv_masterserver, 10}, +#ifndef MASTERSERVER + {IT_GRAYEDOUT, + NULL, "Server Browser Address", NULL, 10}, +#else + {IT_STRING | IT_CVAR | IT_CV_STRING, + + NULL, "Server Browser Address", &cv_masterserver, 10}, +#endif {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 40}, {IT_STRING | IT_CVAR, NULL, "Delay limit (frames)", &cv_maxping, 50}, {IT_STRING | IT_CVAR, NULL, "Delay timeout (s)", &cv_pingtimeout, 60}, @@ -9892,6 +9906,7 @@ static void M_DrawConnectMenu(void) highlightflags, va("%u of %d", serverlistpage+1, numPages)); // Did you change the Server Browser address? Have a little reminder. + #ifdef MASTERSERVER if (CV_IsSetToDefault(&cv_masterserver)) mservflags = mservflags|highlightflags|V_30TRANS; else @@ -9900,6 +9915,7 @@ static void M_DrawConnectMenu(void) mservflags, va("MS: %s", cv_masterserver.string)); M_DrawServerCountAndHorizontalBar(); + #endif // When switching pages, slide the old page and the // new page across the screen @@ -10011,6 +10027,7 @@ void M_SortServerList(void) #ifdef UPDATE_ALERT static void M_CheckMODVersion(int id) { +#ifdef MASTERSERVER char updatestring[500]; const char *updatecheck = GetMODVersion(id); if(updatecheck) @@ -10024,6 +10041,7 @@ static void M_CheckMODVersion(int id) I_unlock_mutex(m_menu_mutex); #endif } +#endif MASTERSERVER } #endif/*UPDATE_ALERT*/ @@ -10031,6 +10049,7 @@ static void M_CheckMODVersion(int id) static void Check_new_version_thread (int *id) { +#ifdef MASTERSERVER M_SetWaitingMode(M_WAITING_VERSION); M_CheckMODVersion(*id); @@ -10043,6 +10062,7 @@ Check_new_version_thread (int *id) { free(id); } +#endif MASTERSERVER } #endif/*defined (UPDATE_ALERT) && defined (HAVE_THREADS)*/ @@ -10108,6 +10128,7 @@ boolean firstDismissedNagThisBoot = true; static void M_HandleMasterServerResetChoice(event_t *ev) { +#ifdef MASTERSERVER INT32 choice = -1; choice = ev->data1; @@ -10132,31 +10153,34 @@ static void M_HandleMasterServerResetChoice(event_t *ev) } } } +#endif } static void M_PreStartServerMenu(INT32 choice) { - (void)choice; + (void)choice; +#ifdef MASTERSERVER if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0) { M_StartMessage(M_GetText("Hey! You've changed the Server Browser address.\n\nYou won't be able to host games on the official Server Browser.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\x80\nPress any other key to continue anyway.\n"),M_PreStartServerMenuChoice,MM_EVENTHANDLER); return; } - +#endif M_StartServerMenu(-1); + } static void M_PreConnectMenu(INT32 choice) { (void)choice; - +#ifdef MASTERSERVER if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0) { M_StartMessage(M_GetText("Hey! You've changed the Server Browser address.\n\nYou won't be able to see games from the official Server Browser.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\x80\nPress any other key to continue anyway.\n"),M_PreConnectMenuChoice,MM_EVENTHANDLER); return; } - +#endif M_ConnectMenuModChecks(-1); } @@ -10399,7 +10423,9 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) static void M_DrawServerMenu(void) { + M_DrawLevelSelectOnly(false, false); + #ifdef MASTERSERVER if (currentMenu == &MP_ServerDef && cv_advertise.value) // Remind players where they're hosting. { int mservflags = V_ALLOWLOWERCASE; @@ -10409,7 +10435,9 @@ static void M_DrawServerMenu(void) mservflags = mservflags|warningflags; V_DrawCenteredThinString(BASEVIDWIDTH/2, BASEVIDHEIGHT-12, mservflags, va("Master Server: %s", cv_masterserver.string)); } + #endif M_DrawGenericMenu(); + } static void M_MapChange(INT32 choice) diff --git a/src/mserv.c b/src/mserv.c index 5c33cfe88..e39201eba 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -57,8 +57,12 @@ static void Command_Listserv_f(void); #endif/*MASTERSERVER*/ + + static void Update_parameters (void); +#ifdef MASTERSERVER + static void MasterServer_OnChange(void); static void Advertise_OnChange(void); @@ -69,16 +73,22 @@ static CV_PossibleValue_t masterserver_update_rate_cons_t[] = { {0, NULL} }; +#endif + +#ifdef MASTERSERVER consvar_t cv_masterserver = {"masterserver", "https://ms.kartkrew.org/ms/api", CV_SAVE|CV_CALL, NULL, MasterServer_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_rendezvousserver = {"holepunchserver", "relay.kartkrew.org", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +#endif consvar_t cv_servername = {"servername", "SRB2Kart server", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_server_contact = {"server_contact", "", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters, 0, NULL, NULL, 0, 0, NULL}; - +#ifdef MASTERSERVER consvar_t cv_masterserver_update_rate = {"masterserver_update_rate", "15", CV_SAVE|CV_CALL|CV_NOINIT, masterserver_update_rate_cons_t, MasterClient_Ticker, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_advertise = {"advertise", "No", CV_NETVAR|CV_CALL|CV_NOINIT, CV_YesNo, Advertise_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_masterserver_nagattempts = {"masterserver_nagattempts", "5", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; +#endif + #if defined (MASTERSERVER) && defined (HAVE_THREADS) int ms_QueryId; @@ -98,6 +108,7 @@ UINT16 current_port = 0; void AddMServCommands(void) { #ifndef NONET +#ifdef MASTERSERVER CV_RegisterVar(&cv_masterserver); CV_RegisterVar(&cv_masterserver_update_rate); CV_RegisterVar(&cv_masterserver_timeout); @@ -106,6 +117,7 @@ void AddMServCommands(void) CV_RegisterVar(&cv_masterserver_nagattempts); CV_RegisterVar(&cv_advertise); CV_RegisterVar(&cv_rendezvousserver); +#endif CV_RegisterVar(&cv_servername); CV_RegisterVar(&cv_server_contact); #ifdef MASTERSERVER @@ -564,6 +576,7 @@ static void MasterServer_OnChange(void) static void Advertise_OnChange(void) { +#ifdef MASTERSERVER int different; if (cv_advertise.value) @@ -595,4 +608,5 @@ Advertise_OnChange(void) { M_PopupMasterServerRules(); } +#endif } diff --git a/src/mserv.h b/src/mserv.h index c4c2d078f..10199d3b0 100644 --- a/src/mserv.h +++ b/src/mserv.h @@ -51,9 +51,12 @@ typedef struct #endif // ================================ GLOBALS =============================== - -extern consvar_t cv_masterserver, cv_servername; +#ifdef MASTERSERVER +extern consvar_t cv_masterserver; +#endif +extern consvar_t cv_servername; extern consvar_t cv_server_contact; +#ifdef MASTERSERVER extern consvar_t cv_masterserver_update_rate; extern consvar_t cv_masterserver_timeout; extern consvar_t cv_masterserver_debug; @@ -63,7 +66,7 @@ extern consvar_t cv_rendezvousserver; extern consvar_t cv_advertise; extern consvar_t cv_masterserver_nagattempts; - +#endif #ifdef HAVE_THREADS extern int ms_QueryId; extern I_mutex ms_QueryId_mutex; @@ -71,7 +74,7 @@ extern I_mutex ms_QueryId_mutex; extern msg_server_t *ms_ServerList; extern I_mutex ms_ServerList_mutex; #endif - +#ifdef MASTERSERVER void RegisterServer(void); void UnregisterServer(void); @@ -97,3 +100,5 @@ int HMS_compare_mod_version (char *buffer, size_t size_of_buffer); const char * HMS_fetch_rules (char *buffer, size_t size_of_buffer); #endif + +#endif \ No newline at end of file -- 2.54.0 From 3526a52827b29c428aa316f7b82a9e659a855ea1 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Tue, 14 Nov 2023 06:45:46 -0500 Subject: [PATCH 033/112] Allow holepunching to be disabled via a new define plus part 2 to masterserver --- src/d_clisrv.c | 15 ++++++++++----- src/d_net.c | 6 ++++++ src/doomdef.h | 1 + src/i_net.h | 11 +++++++++-- src/i_tcp.c | 21 +++++++++++++++------ src/m_menu.c | 32 ++++++++++++++++++++++---------- src/mserv.c | 19 +++++++++++++------ src/mserv.h | 6 +++++- 8 files changed, 81 insertions(+), 30 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 68206d485..18f914200 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1939,13 +1939,13 @@ static void CL_LoadReceivedSavegame(void) static void SendAskInfo(INT32 node) { tic_t asktime; - #ifdef MASTERSERVER + #ifdef HOLEPUNCH if (node != 0 && node != BROADCASTADDR && cv_rendezvousserver.string[0]) { I_NetRequestHolePunch(node); } - #endif MASTERSERVER + #endif asktime = I_GetTime(); @@ -6154,9 +6154,9 @@ static void UpdatePingTable(void) } } +#ifdef HOLEPUNCH static void RenewHolePunch(void) { -#ifdef MASTERSERVER if (cv_rendezvousserver.string[0]) { static time_t past; @@ -6169,8 +6169,8 @@ static void RenewHolePunch(void) past = now; } } -#endif } +#endif // Handle timeouts to prevent definitive freezes from happenning static void HandleNodeTimeouts(void) @@ -6204,11 +6204,14 @@ void NetKeepAlive(void) #ifdef MASTERSERVER MasterClient_Ticker(); #endif - + + #ifdef HOLEPUNCH if (netgame && serverrunning) { RenewHolePunch(); } + #endif + if (client) { @@ -6321,10 +6324,12 @@ void NetUpdate(void) MasterClient_Ticker(); // Acking the Master Server #endif + #ifdef HOLEPUNCH if (netgame && serverrunning) { RenewHolePunch(); } + #endif if (client) { diff --git a/src/d_net.c b/src/d_net.c index a4cc3a3be..08e9f1610 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -51,7 +51,9 @@ doomcom_t *doomcom = NULL; /// \brief network packet data, points inside doomcom doomdata_t *netbuffer = NULL; /// \brief hole punching packet, also points inside doomcom +#ifdef HOLEPUNCH holepunch_t *holepunchpacket = NULL; +#endif #ifdef DEBUGFILE FILE *debugfile = NULL; // put some net info in a file during the game @@ -75,8 +77,10 @@ boolean (*I_NetCanGet)(void) = NULL; void (*I_NetCloseSocket)(void) = NULL; void (*I_NetFreeNodenum)(INT32 nodenum) = NULL; SINT8 (*I_NetMakeNodewPort)(const char *address, const char* port) = NULL; +#ifdef HOLEPUNCH void (*I_NetRequestHolePunch)(INT32 node) = NULL; void (*I_NetRegisterHolePunch)(void) = NULL; +#endif boolean (*I_NetOpenSocket)(void) = NULL; boolean (*I_Ban) (INT32 node) = NULL; void (*I_ClearBans)(void) = NULL; @@ -1349,7 +1353,9 @@ boolean D_CheckNetGame(void) I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES); netbuffer = (doomdata_t *)(void *)&doomcom->data; + #ifdef HOLEPUNCH holepunchpacket = (holepunch_t *)(void *)&doomcom->data; + #endif #ifdef DEBUGFILE if (M_CheckParm("-debugfile")) diff --git a/src/doomdef.h b/src/doomdef.h index e05265ed5..ba5a1d73c 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -639,6 +639,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; #if defined (HAVE_CURL) && ! defined (NONET) //#define MASTERSERVER +//#define HOLEPUNCH #else #undef UPDATE_ALERT #endif diff --git a/src/i_net.h b/src/i_net.h index b9da94ec4..c3391a1ed 100644 --- a/src/i_net.h +++ b/src/i_net.h @@ -79,19 +79,24 @@ typedef struct char data[MAXPACKETLENGTH]; } ATTRPACK doomcom_t; +#ifdef HOLEPUNCH typedef struct { INT32 magic; INT32 addr; INT16 port; } ATTRPACK holepunch_t; +#endif #if defined(_MSC_VER) #pragma pack() #endif extern doomcom_t *doomcom; + +#ifdef HOLEPUNCH extern holepunch_t *holepunchpacket; +#endif /** \brief return packet in doomcom struct */ @@ -152,12 +157,14 @@ extern void (*I_NetCloseSocket)(void); /** \brief send a hole punching request */ +#ifdef HOLEPUNCH extern void (*I_NetRequestHolePunch)(INT32 node); - +#endif /** \brief register this machine on the hole punching server */ +#ifdef HOLEPUNCH extern void (*I_NetRegisterHolePunch)(void); - +#endif extern boolean (*I_Ban) (INT32 node); extern void (*I_ClearBans)(void); diff --git a/src/i_tcp.c b/src/i_tcp.c index ca2e5ea26..1ebffc59b 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -201,8 +201,10 @@ static size_t broadcastaddresses = 0; static boolean nodeconnected[MAXNETNODES+1]; static banned_t *banned; /* See ../doc/Holepunch-Protocol.txt */ +#ifdef HOLEPUNCH static const INT32 hole_punch_magic = MSBF_LONG (0x52eb11); #endif +#endif static size_t numbans = 0; static size_t banned_size = 0; @@ -609,9 +611,10 @@ is_external_address (UINT32 p) } } +#ifdef HOLEPUNCH static boolean hole_punch(ssize_t c) { -#ifdef MASTERSERVER + /* See ../doc/Holepunch-Protocol.txt */ if (cv_rendezvousserver.string[0] && c == 10 && holepunchpacket->magic == hole_punch_magic && @@ -632,8 +635,9 @@ static boolean hole_punch(ssize_t c) { return false; } -#endif + } +#endif // Returns true if a packet was received from a new node, false in all other cases static boolean SOCK_Get(void) @@ -657,11 +661,12 @@ static boolean SOCK_Get(void) break; } #endif - +#ifdef HOLEPUNCH if (hole_punch(c)) { break; } +#endif // find remote node number for (j = 1; j <= MAXNETNODES; j++) //include LAN @@ -1365,10 +1370,9 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port) } /* See ../doc/Holepunch-Protocol.txt */ - +#ifdef HOLEPUNCH static void rendezvous(int size) { -#ifdef MASTERSERVER char *addrs = strdup(cv_rendezvousserver.string); char *host = strtok(addrs, ":"); @@ -1394,12 +1398,13 @@ static void rendezvous(int size) if (tic == refreshtic) { + #ifdef HOLEPUNCH holepunchpacket->magic = hole_punch_magic; + #endif sendto(mysockets[0], doomcom->data, size, 0, &rzv.any, sizeof rzv.ip4); } free(addrs); -#endif } static void SOCK_RequestHolePunch(INT32 node) @@ -1421,6 +1426,8 @@ static void SOCK_RegisterHolePunch(void) } #endif +#endif + static boolean SOCK_OpenSocket(void) { #ifndef NONET @@ -1443,9 +1450,11 @@ static boolean SOCK_OpenSocket(void) I_NetCanSend = SOCK_CanSend; I_NetCanGet = SOCK_CanGet; #endif +#ifdef HOLEPUNCH I_NetRequestHolePunch = SOCK_RequestHolePunch; I_NetRegisterHolePunch = SOCK_RegisterHolePunch; +#endif // build the socket but close it first SOCK_CloseSocket(); diff --git a/src/m_menu.c b/src/m_menu.c index fbaf86b97..bdcd540b4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -273,12 +273,16 @@ static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef; // Multiplayer #ifndef NONET static void M_PreStartServerMenu(INT32 choice); +#ifdef MASTERSERVER static void M_PreStartServerMenuChoice(event_t *ev); static void M_PreConnectMenu(INT32 choice); static void M_PreConnectMenuChoice(event_t *ev); +#endif static void M_StartServerMenu(INT32 choice); +#ifdef MASTERSERVER static void M_ConnectMenu(INT32 choice); static void M_ConnectMenuModChecks(INT32 choice); +#endif static void M_Refresh(INT32 choice); static void M_Connect(INT32 choice); #endif @@ -9802,6 +9806,7 @@ static void M_Refresh(INT32 choice) #endif/*MASTERSERVER*/ } +#ifdef MASTERSERVER static void M_DrawServerCountAndHorizontalBar(void) { const char *text; @@ -9844,6 +9849,7 @@ static void M_DrawServerCountAndHorizontalBar(void) V_DrawFill(1, currentMenu->y+32, center - radius - 2, 1, 0); V_DrawFill(center + radius + 2, currentMenu->y+32, BASEVIDWIDTH - 1, 1, 0); } +#endif static void M_DrawServerLines(INT32 x, INT32 page) { @@ -10025,9 +10031,9 @@ void M_SortServerList(void) #ifndef NONET #ifdef UPDATE_ALERT +#ifdef MASTERSERVER static void M_CheckMODVersion(int id) { -#ifdef MASTERSERVER char updatestring[500]; const char *updatecheck = GetMODVersion(id); if(updatecheck) @@ -10041,15 +10047,16 @@ static void M_CheckMODVersion(int id) I_unlock_mutex(m_menu_mutex); #endif } -#endif MASTERSERVER } +#endif //MASTERSERVER #endif/*UPDATE_ALERT*/ #if defined (UPDATE_ALERT) && defined (HAVE_THREADS) +#ifdef MASTERSERVER static void Check_new_version_thread (int *id) { -#ifdef MASTERSERVER + M_SetWaitingMode(M_WAITING_VERSION); M_CheckMODVersion(*id); @@ -10062,10 +10069,12 @@ Check_new_version_thread (int *id) { free(id); } -#endif MASTERSERVER + } +#endif #endif/*defined (UPDATE_ALERT) && defined (HAVE_THREADS)*/ +#ifdef MASTERSERVER static void M_ConnectMenu(INT32 choice) { (void)choice; @@ -10110,6 +10119,7 @@ static void M_ConnectMenu(INT32 choice) #endif/*defined (MASTERSERVER) && defined (HAVE_THREADS)*/ } + static void M_ConnectMenuModChecks(INT32 choice) { (void)choice; @@ -10123,12 +10133,12 @@ static void M_ConnectMenuModChecks(INT32 choice) M_ConnectMenu(-1); } +#endif boolean firstDismissedNagThisBoot = true; - +#ifdef MASTERSERVER static void M_HandleMasterServerResetChoice(event_t *ev) { -#ifdef MASTERSERVER INT32 choice = -1; choice = ev->data1; @@ -10153,8 +10163,9 @@ static void M_HandleMasterServerResetChoice(event_t *ev) } } } -#endif + } +#endif static void M_PreStartServerMenu(INT32 choice) { @@ -10170,17 +10181,17 @@ static void M_PreStartServerMenu(INT32 choice) M_StartServerMenu(-1); } - +#ifdef MASTERSERVER static void M_PreConnectMenu(INT32 choice) { (void)choice; -#ifdef MASTERSERVER + if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0) { M_StartMessage(M_GetText("Hey! You've changed the Server Browser address.\n\nYou won't be able to see games from the official Server Browser.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\x80\nPress any other key to continue anyway.\n"),M_PreConnectMenuChoice,MM_EVENTHANDLER); return; } -#endif + M_ConnectMenuModChecks(-1); } @@ -10195,6 +10206,7 @@ static void M_PreConnectMenuChoice(event_t *ev) M_HandleMasterServerResetChoice(ev); M_ConnectMenuModChecks(-1); } +#endif #endif //NONET //=========================================================================== diff --git a/src/mserv.c b/src/mserv.c index e39201eba..6945154c4 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -77,8 +77,12 @@ static CV_PossibleValue_t masterserver_update_rate_cons_t[] = { #ifdef MASTERSERVER consvar_t cv_masterserver = {"masterserver", "https://ms.kartkrew.org/ms/api", CV_SAVE|CV_CALL, NULL, MasterServer_OnChange, 0, NULL, NULL, 0, 0, NULL}; +#endif + +#ifdef HOLEPUNCH consvar_t cv_rendezvousserver = {"holepunchserver", "relay.kartkrew.org", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; #endif + consvar_t cv_servername = {"servername", "SRB2Kart server", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_server_contact = {"server_contact", "", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters, 0, NULL, NULL, 0, 0, NULL}; #ifdef MASTERSERVER @@ -116,8 +120,11 @@ void AddMServCommands(void) CV_RegisterVar(&cv_masterserver_token); CV_RegisterVar(&cv_masterserver_nagattempts); CV_RegisterVar(&cv_advertise); +#endif +#ifdef HOLEPUNCH CV_RegisterVar(&cv_rendezvousserver); #endif + CV_RegisterVar(&cv_servername); CV_RegisterVar(&cv_server_contact); #ifdef MASTERSERVER @@ -560,23 +567,23 @@ Update_parameters (void) } #endif/*MASTERSERVER*/ } - +#ifdef MASTERSERVER static void MasterServer_OnChange(void) { -#ifdef MASTERSERVER + UnregisterServer(); Set_api(cv_masterserver.string); if (Online()) RegisterServer(); -#endif/*MASTERSERVER*/ -} +} +#endif/*MASTERSERVER*/ +#ifdef MASTERSERVER static void Advertise_OnChange(void) { -#ifdef MASTERSERVER int different; if (cv_advertise.value) @@ -608,5 +615,5 @@ Advertise_OnChange(void) { M_PopupMasterServerRules(); } -#endif } +#endif diff --git a/src/mserv.h b/src/mserv.h index 10199d3b0..5a74771a4 100644 --- a/src/mserv.h +++ b/src/mserv.h @@ -61,12 +61,16 @@ extern consvar_t cv_masterserver_update_rate; extern consvar_t cv_masterserver_timeout; extern consvar_t cv_masterserver_debug; extern consvar_t cv_masterserver_token; -extern consvar_t cv_rendezvousserver; extern consvar_t cv_advertise; extern consvar_t cv_masterserver_nagattempts; #endif + +#ifdef HOLEPUNCH +extern consvar_t cv_rendezvousserver; +#endif + #ifdef HAVE_THREADS extern int ms_QueryId; extern I_mutex ms_QueryId_mutex; -- 2.54.0 From 79582ce73de890a02bfdf7da2c4d4fed00e74e25 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 14 Nov 2023 18:31:19 +0100 Subject: [PATCH 034/112] we use them tho its good to future proof just in case --- src/doomdef.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index ba5a1d73c..b95f1608b 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -638,8 +638,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; #define GL_SHADERS #if defined (HAVE_CURL) && ! defined (NONET) -//#define MASTERSERVER -//#define HOLEPUNCH +#define MASTERSERVER +#define HOLEPUNCH #else #undef UPDATE_ALERT #endif -- 2.54.0 From 25e60a98822317a883626c21fe695bad35fb4ab8 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 14 Nov 2023 19:35:37 +0100 Subject: [PATCH 035/112] ugh toggling shaders also needs to reset palette shit sometimes --- src/hardware/hw_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 5632bfa62..b051fb7fe 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -66,7 +66,7 @@ static void CV_anisotropic_ONChange(void); static void CV_screentextures_ONChange(void); static void CV_useCustomShaders_ONChange(void); static void CV_grpaletteshader_OnChange(void); -static void CV_flashpal_OnChange(void); +static void CV_grshaders_OnChange(void); static void CV_Gammaxxx_ONChange(void); static CV_PossibleValue_t grgamma_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}}; @@ -137,12 +137,12 @@ static INT32 current_bsp_culling_distance = 0; consvar_t cv_grscreentextures = {"gr_screentextures", "On", CV_CALL, CV_OnOff, CV_screentextures_ONChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grshaders = {"gr_shaders", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grshaders = {"gr_shaders", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grusecustomshaders = {"gr_usecustomshaders", "Yes", CV_CALL|CV_SAVE, CV_OnOff, CV_useCustomShaders_ONChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grpaletteshader = {"gr_paletteshader", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_grpaletteshader_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grflashpal = {"gr_flashpal", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_flashpal_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grflashpal = {"gr_flashpal", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grmdls = {"gr_mdls", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grfallbackplayermodel = {"gr_fallbackplayermodel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -198,7 +198,7 @@ static void CV_grpaletteshader_OnChange(void) } } -static void CV_flashpal_OnChange(void) +static void CV_grshaders_OnChange(void) { if (rendermode == render_opengl) { -- 2.54.0 From 7cc4d1f60151219e54b7388427b46e8d913d77fd Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 14 Nov 2023 20:02:07 +0100 Subject: [PATCH 036/112] simplify this stuff idk why i didnt do it like this in the first place tbh no need for 3 seperate onchanges, i can just do shit like this all of them pretty much did the same anyways now the shader and all two palshader toggles reset palette stuff when it detects that youre in palrender mode aaaA --- src/hardware/hw_main.c | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index b051fb7fe..0c51d3f8d 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -65,7 +65,6 @@ static void CV_filtermode_ONChange(void); static void CV_anisotropic_ONChange(void); static void CV_screentextures_ONChange(void); static void CV_useCustomShaders_ONChange(void); -static void CV_grpaletteshader_OnChange(void); static void CV_grshaders_OnChange(void); static void CV_Gammaxxx_ONChange(void); @@ -140,7 +139,7 @@ consvar_t cv_grscreentextures = {"gr_screentextures", "On", CV_CALL, CV_OnOff, consvar_t cv_grshaders = {"gr_shaders", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grusecustomshaders = {"gr_usecustomshaders", "Yes", CV_CALL|CV_SAVE, CV_OnOff, CV_useCustomShaders_ONChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grpaletteshader = {"gr_paletteshader", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_grpaletteshader_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grpaletteshader = {"gr_paletteshader", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grflashpal = {"gr_flashpal", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -176,28 +175,6 @@ static void CV_screentextures_ONChange(void) HWD.pfnSetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_grscreentextures.value); } -static void CV_useCustomShaders_ONChange(void) -{ - if (rendermode == render_opengl) - { - if (cv_grshaders.value) - HWD.pfnInitCustomShaders(); - } -} - -static void CV_grpaletteshader_OnChange(void) -{ - if (rendermode == render_opengl) - { - InitPalette(0, false); - - if (HWR_ShouldUsePaletteRendering()) - { - V_SetPalette(0); - } - } -} - static void CV_grshaders_OnChange(void) { if (rendermode == render_opengl) @@ -210,6 +187,15 @@ static void CV_grshaders_OnChange(void) } } +static void CV_useCustomShaders_ONChange(void) +{ + if (rendermode == render_opengl) + { + if (cv_grshaders.value) + HWD.pfnInitCustomShaders(); + } +} + // change the palette directly to see the change static void CV_Gammaxxx_ONChange(void) { -- 2.54.0 From 32d4a38b9e01fc1b3c5a1e6a6724afba07dc8436 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 14 Nov 2023 20:06:11 +0100 Subject: [PATCH 037/112] just always reset palette regardless the palshader palette however only gets reset when you enter palshader mode AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --- src/hardware/hw_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 0c51d3f8d..cecb59333 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -182,8 +182,9 @@ static void CV_grshaders_OnChange(void) if (HWR_ShouldUsePaletteRendering()) { InitPalette(0, false); - V_SetPalette(0); } + + V_SetPalette(0); } } -- 2.54.0 From 673a03e03314ae52b5174281082d94b3484b838b Mon Sep 17 00:00:00 2001 From: NepDisk Date: Mon, 13 Nov 2023 12:34:57 -0500 Subject: [PATCH 038/112] Stat display enable and disable luahook --- src/k_kart.c | 13 +++++++++++-- src/lua_hud.h | 1 + src/lua_hudlib.c | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index c5daf317d..32f9f526d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7590,13 +7590,19 @@ static void K_drawKartStats(void) flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT; UINT8 splitnum = 0; - + for (; splitnum < MAXSPLITSCREENPLAYERS; ++splitnum) { if (stplyr == &players[displayplayers[splitnum]]) break; } - + +#ifdef HAVE_BLUA + if (!LUA_HudEnabled(hud_statdisplay)) + return; +#endif + + // I tried my best, but this is still mess :/ if (splitscreen) { @@ -10038,6 +10044,9 @@ void K_drawKartHUD(void) K_drawInput(); if (!demo.title && cv_showstats.value) +#ifdef HAVE_BLUA + if (LUA_HudEnabled(hud_statdisplay)) +#endif K_drawKartStats(); if (demo.title) // Draw title logo instead in demo.titles diff --git a/src/lua_hud.h b/src/lua_hud.h index 26b8cf0b0..db759bbfa 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -31,6 +31,7 @@ enum hud { hud_battlecomebacktimer, // comeback timer in battlefullscreen. separated for ease of use. hud_wanted, hud_speedometer, + hud_statdisplay, hud_freeplay, hud_rankings, // Tab rankings diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index f58d9ca72..340bc1352 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -54,6 +54,7 @@ static const char *const hud_disable_options[] = { "battlecomebacktimer", // come back timer in battlefullscreen "wanted", "speedometer", + "statdisplay", "freeplay", "rankings", NULL}; -- 2.54.0 From 84140f3faa64f95f6574e732b517188663506835 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 15 Nov 2023 10:11:25 +0100 Subject: [PATCH 039/112] Revert "why did i remove this back then??" i saw what this did again fix for avoiding precip crash, cause precip doesent have that stuff This reverts commit 2e4e0a8554538c841fb4c7be63449b32365d6bc0. --- src/hardware/hw_main.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index cecb59333..705f52288 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4796,15 +4796,9 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr) HWR_Lighting(&Surf, lightlevel, colormap); } - if (spr->mobj->flags2 & MF2_SHADOW) - { - Surf.PolyColor.s.alpha = 0x40; - blend = PF_Translucent; - } - else if (spr->mobj->frame & FF_TRANSMASK) + if (spr->mobj->frame & FF_TRANSMASK) blend = HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf); else - { // BP: i agree that is little better in environement but it don't // work properly under glide nor with fogcolor to ffffff :( -- 2.54.0 From 7a4ef35e7b53515bf5f7b46f9efef7caee11ab2c Mon Sep 17 00:00:00 2001 From: NepDisk Date: Wed, 15 Nov 2023 12:14:32 -0500 Subject: [PATCH 040/112] forgot discord support ugh... --- src/discord.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/discord.c b/src/discord.c index ea9bc66b9..3024943c0 100644 --- a/src/discord.c +++ b/src/discord.c @@ -480,14 +480,18 @@ void DRPC_UpdatePresence(void) // Server info if (netgame) { +#ifdef MASTERSERVER if (cv_advertise.value) { discordPresence.state = "Public"; } else { +#endif discordPresence.state = "Private"; +#ifdef MASTERSERVER } +#endif discordPresence.partyId = server_context; // Thanks, whoever gave us Mumble support, for implementing the EXACT thing Discord wanted for this field! discordPresence.partySize = D_NumPlayers(); // Players in server -- 2.54.0 From 268300913d538864d8bc43d06de938bbc1b33706 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Wed, 15 Nov 2023 13:15:11 -0500 Subject: [PATCH 041/112] fix for real this time --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 32f9f526d..21d98a40a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -60,7 +60,7 @@ consvar_t cv_stat_yoffset = {"hud_stat_yoffset", "0", CV_SAVE, NULL, NULL, 0, NU consvar_t cv_showstats = {"showstats", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t speedo_cons_t[] = {{0, "Default"}, {1, "Small"}, {2, "PMeter"}}; +static CV_PossibleValue_t speedo_cons_t[] = {{1, "Default"}, {2, "Small"}, {3, "P-Meter"}, {0, NULL}}; consvar_t cv_newspeedometer = {"newspeedometer", "Default", CV_SAVE, speedo_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_saltyhop = {"hardcodehop", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -- 2.54.0 From 840c7ea154a1d6f002f8a7813c2c6b3c2266062c Mon Sep 17 00:00:00 2001 From: NepDisk Date: Wed, 15 Nov 2023 13:33:13 -0500 Subject: [PATCH 042/112] Update speedometer code to refernce new values --- src/k_kart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 21d98a40a..6fd0a7819 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7649,7 +7649,7 @@ static void K_drawKartStats(void) //Internal offset for speedometer if (cv_kartspeedometer.value) { - if (cv_newspeedometer.value == 1 && snw_speedo) + if (cv_newspeedometer.value == 2 && snw_speedo) spdoffset = -10; else spdoffset = -14; @@ -8727,7 +8727,7 @@ static void K_drawKartSpeedometer(void) } // man. - if ((!cv_newspeedometer.value) || (cv_newspeedometer.value == 1 && !snw_speedo) || (cv_newspeedometer.value == 2 && !kartzspeedo) ) + if ((cv_newspeedometer.value == 1) || (cv_newspeedometer.value == 2 && !snw_speedo) || (cv_newspeedometer.value == 3 && !kartzspeedo) ) { switch (speedtype) { case 1: @@ -8746,7 +8746,7 @@ static void K_drawKartSpeedometer(void) V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%4d %%", convSpeed)); } } - else if (cv_newspeedometer.value == 1 && snw_speedo ) { // why bother if we dont? + else if (cv_newspeedometer.value == 2 && snw_speedo ) { // why bother if we dont? if (!cv_colorizedhud.value || !clr_hud) V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, (V_HUDTRANS|splitflags), (skp_smallsticker)); else @@ -8765,7 +8765,7 @@ static void K_drawKartSpeedometer(void) // Kart Z speedo bullshit... // Draw the Speed counter. // Warning large if statement below... - else if (cv_newspeedometer.value == 2 && kartzspeedo){ + else if (cv_newspeedometer.value == 3 && kartzspeedo){ fuspeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT; -- 2.54.0 From d04a6ad5ee2755d753d146e405b407c587762517 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 15 Nov 2023 19:45:22 +0100 Subject: [PATCH 043/112] Add more cvars to menu and lower minimum vote time --- src/d_netcmd.c | 2 +- src/hardware/hw_main.c | 2 +- src/hardware/hw_main.h | 1 + src/m_menu.c | 22 ++++++++++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 7c1f4bbed..eb246a199 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -412,7 +412,7 @@ consvar_t cv_kartdebugcheckpoint = {"kartdebugcheckpoint", "Off", CV_NOSHOWHELP, consvar_t cv_kartdebugnodes = {"kartdebugnodes", "Off", CV_NOSHOWHELP, 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[] = {{10, "MIN"}, {3600, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t votetime_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, NULL}}; consvar_t cv_votetime = {"votetime", "20", CV_NETVAR, votetime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_ringslinger = {"ringslinger", "No", CV_NETVAR|CV_NOSHOWHELP|CV_CALL|CV_CHEAT, CV_YesNo, diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 705f52288..bfab25199 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -133,7 +133,7 @@ static INT32 current_bsp_culling_distance = 0; // - water and heat wave effects // - intermission background // - full screen scaling (use native resolution or windowed mode to avoid this) -consvar_t cv_grscreentextures = {"gr_screentextures", "On", CV_CALL, CV_OnOff, +consvar_t cv_grscreentextures = {"gr_screentextures", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_screentextures_ONChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grshaders = {"gr_shaders", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 8f24cabe0..70d368c95 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -184,6 +184,7 @@ extern consvar_t cv_grbatching; extern consvar_t cv_grrenderdistance; extern consvar_t cv_grusecustomshaders; extern consvar_t cv_grpaletteshader; +extern consvar_t cv_grscreentextures; extern consvar_t cv_grflashpal; extern consvar_t cv_grportals; extern consvar_t cv_nostencil; diff --git a/src/m_menu.c b/src/m_menu.c index bdcd540b4..9bbb0bcaa 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1405,6 +1405,28 @@ static menuitem_t OP_VideoModeMenu[] = {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleVideoMode, '\0'}, // dummy menuitem for the control func }; +static menuitem_t OP_ExpOptionsMenu[] = +{ + {IT_HEADER, NULL, "Experimental Options", NULL, 10}, + {IT_STRING|IT_CVAR, NULL, "Interpolation Distance", &cv_grmaxinterpdist, 35}, + {IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 55}, + {IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 65}, + + {IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 85}, + +}; + + +static const char* OP_ExpTooltips[] = +{ + NULL, + "How far interpolation should take effect.", + "Should weather be interpolated? Weather should look about the\nsame but perform a bit better when disabled.", + "When weather is on this will cut the object amount used in half.", + "Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.", + +}; + #ifdef HWRENDER static menuitem_t OP_OpenGLOptionsMenu[] = { -- 2.54.0 From cf101ccc5d9df5ed5b55b3d4e2fc1da0196bda94 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 15 Nov 2023 19:51:05 +0100 Subject: [PATCH 044/112] add "experimental video options" menu for a few things that might be interesting for some also make some adjustments --- src/m_menu.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 9bbb0bcaa..1cdd419ec 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -316,7 +316,7 @@ static void M_ChangeControl(INT32 choice); static void M_ResetControls(INT32 choice); // Video & Sound -menu_t OP_VideoOptionsDef, OP_VideoModeDef; +menu_t OP_VideoOptionsDef, OP_VideoModeDef, OP_ExpOptionsDef; #ifdef HWRENDER menu_t OP_OpenGLOptionsDef, OP_OpenGLColorDef; #endif @@ -1347,13 +1347,14 @@ static menuitem_t OP_VideoOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 90}, {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 100}, {IT_STRING | IT_CVAR, NULL, "FPS Cap", &cv_fpscap, 110}, - {IT_STRING | IT_CVAR, NULL, "Drift spark pulse size",&cv_driftsparkpulse, 125}, - {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 135}, - + {IT_STRING | IT_CVAR, NULL, "Drift spark pulse size",&cv_driftsparkpulse, 120}, + {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 130}, #ifdef HWRENDER - {IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 145}, + {IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 140}, #endif + {IT_SUBMENU|IT_STRING, NULL, "Experimental Options...", &OP_ExpOptionsDef, 150}, + }; static const char* OP_VideoTooltips[] = @@ -1375,6 +1376,7 @@ static const char* OP_VideoTooltips[] = #ifdef HWRENDER "Options for OpenGL renderer.", #endif + "Experimental graphical options.", }; @@ -1408,23 +1410,20 @@ static menuitem_t OP_VideoModeMenu[] = static menuitem_t OP_ExpOptionsMenu[] = { {IT_HEADER, NULL, "Experimental Options", NULL, 10}, - {IT_STRING|IT_CVAR, NULL, "Interpolation Distance", &cv_grmaxinterpdist, 35}, - {IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 55}, - {IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 65}, - - {IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 85}, - + {IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 45}, + {IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 55}, +#ifdef HWRENDER + {IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 75}, +#endif }; static const char* OP_ExpTooltips[] = { NULL, - "How far interpolation should take effect.", "Should weather be interpolated? Weather should look about the\nsame but perform a bit better when disabled.", "When weather is on this will cut the object amount used in half.", "Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.", - }; #ifdef HWRENDER @@ -2741,6 +2740,8 @@ menu_t OP_OpenGLColorDef = }; #endif +menu_t OP_ExpOptionsDef = DEFAULTMENUSTYLE("M_VIDEO", OP_ExpOptionsMenu, &OP_VideoOptionsDef, 30, 30); + menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE("M_DATA", OP_DataOptionsMenu, &OP_MainDef, 60, 30); menu_t OP_ScreenshotOptionsDef = DEFAULTMENUSTYLE("M_SCSHOT", OP_ScreenshotOptionsMenu, &OP_DataOptionsDef, 30, 30); menu_t OP_AddonsOptionsDef = DEFAULTMENUSTYLE("M_ADDONS", OP_AddonsOptionsMenu, &OP_DataOptionsDef, 30, 30); @@ -4866,6 +4867,15 @@ static void M_DrawGenericMenu(void) } } + if (currentMenu == &OP_ExpOptionsDef) + { + if (!(OP_ExpTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ExpTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } if (currentMenu == &OP_ChatOptionsDef) { -- 2.54.0 From 16b3687774bd4c8aa6c77d5c8862588efa9a7597 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Wed, 15 Nov 2023 19:58:13 +0100 Subject: [PATCH 045/112] forgor --- src/m_menu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/m_menu.c b/src/m_menu.c index 1cdd419ec..724d5000b 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1400,6 +1400,7 @@ enum #ifdef HWRENDER op_video_ogl, #endif + op_video_exp, }; static menuitem_t OP_VideoModeMenu[] = -- 2.54.0 From 48e3c14d30fb73a033f2bdff3cfc6f3897683c3f Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Wed, 15 Nov 2023 20:09:09 +0100 Subject: [PATCH 046/112] hide screentex toggle in software its an opengl only thing, so no need to toggle if in software mode --- src/m_menu.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 724d5000b..61944a77a 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1418,7 +1418,6 @@ static menuitem_t OP_ExpOptionsMenu[] = #endif }; - static const char* OP_ExpTooltips[] = { NULL, @@ -1427,6 +1426,17 @@ static const char* OP_ExpTooltips[] = "Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.", }; +enum +{ + op_exp_header, + op_exp_precipinter, + op_exp_lessprecip, +#ifdef HWRENDER + op_exp_grscrtx, +#endif +}; + + #ifdef HWRENDER static menuitem_t OP_OpenGLOptionsMenu[] = { @@ -4287,7 +4297,10 @@ void M_Init(void) #ifdef HWRENDER // Permanently hide some options based on render mode if (rendermode == render_soft) + { OP_VideoOptionsMenu[op_video_ogl].status = IT_DISABLED; + OP_ExpOptionsMenu[op_exp_grscrtx].status = IT_DISABLED; + } #endif if (!snw_speedo && !kartzspeedo) // why bother? -- 2.54.0 From dc1dfe0d4de67d0a075bb2723726a60bd52a5794 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 15 Nov 2023 20:13:19 +0100 Subject: [PATCH 047/112] smh --- src/m_menu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index 61944a77a..a8509b2f4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1423,7 +1423,9 @@ static const char* OP_ExpTooltips[] = NULL, "Should weather be interpolated? Weather should look about the\nsame but perform a bit better when disabled.", "When weather is on this will cut the object amount used in half.", +#ifdef HWRENDER "Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.", +#endif }; enum -- 2.54.0 From 7f7ea2c59293ef29d19a8b21d39da8b3d73a32f9 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Wed, 15 Nov 2023 20:47:28 +0100 Subject: [PATCH 048/112] reset camera when joining from spec camera look never got reset when you enter a game from spec, so if you looked up or down, you also did so ingame lol --- src/p_user.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index fb300829e..4041ce212 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8063,6 +8063,9 @@ boolean P_SpectatorJoinGame(player_t *player) // Partial code reproduction from p_tick.c autobalance code. else if (G_GametypeHasTeams()) { + if (P_IsLocalPlayer(player)) + localaiming[0] = 0; + INT32 changeto = 0; INT32 z, numplayersred = 0, numplayersblue = 0; @@ -8113,6 +8116,9 @@ boolean P_SpectatorJoinGame(player_t *player) // Joining in game from firing. else { + if (P_IsLocalPlayer(player)) + localaiming[0] = 0; + if (player->mo) { P_RemoveMobj(player->mo); -- 2.54.0 From 53febafd50de5e5c140a991b780b787cbe2da055 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 15 Nov 2023 20:53:25 +0100 Subject: [PATCH 049/112] eeh do it later idk looks better imo --- src/p_user.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 4041ce212..6a3e1ab95 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8062,10 +8062,7 @@ boolean P_SpectatorJoinGame(player_t *player) // Pressing fire assigns you to a team that needs players if allowed. // Partial code reproduction from p_tick.c autobalance code. else if (G_GametypeHasTeams()) - { - if (P_IsLocalPlayer(player)) - localaiming[0] = 0; - + { INT32 changeto = 0; INT32 z, numplayersred = 0, numplayersblue = 0; @@ -8101,6 +8098,10 @@ boolean P_SpectatorJoinGame(player_t *player) player->kartstuff[k_spectatewait] = 0; player->ctfteam = changeto; player->playerstate = PST_REBORN; + + //reset camera + if (P_IsLocalPlayer(player)) + localaiming[0] = 0; //Reset away view if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer) @@ -8115,10 +8116,7 @@ boolean P_SpectatorJoinGame(player_t *player) } // Joining in game from firing. else - { - if (P_IsLocalPlayer(player)) - localaiming[0] = 0; - + { if (player->mo) { P_RemoveMobj(player->mo); @@ -8129,6 +8127,10 @@ boolean P_SpectatorJoinGame(player_t *player) player->kartstuff[k_spectatewait] = 0; player->playerstate = PST_REBORN; + //reset camera + if (P_IsLocalPlayer(player)) + localaiming[0] = 0; + //Reset away view if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer) displayplayers[0] = consoleplayer; -- 2.54.0 From 9ae1f207353cf964b55d10cd8775f00f1835cbdf Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 15 Nov 2023 21:24:39 +0100 Subject: [PATCH 050/112] actually only do it if its not centered --- src/p_user.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 6a3e1ab95..517e6a07f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8099,8 +8099,8 @@ boolean P_SpectatorJoinGame(player_t *player) player->ctfteam = changeto; player->playerstate = PST_REBORN; - //reset camera - if (P_IsLocalPlayer(player)) + //center camera if its not already + if ((P_IsLocalPlayer(player)) && localaiming[0] != 0) localaiming[0] = 0; //Reset away view @@ -8127,8 +8127,8 @@ boolean P_SpectatorJoinGame(player_t *player) player->kartstuff[k_spectatewait] = 0; player->playerstate = PST_REBORN; - //reset camera - if (P_IsLocalPlayer(player)) + //center camera if its not already + if ((P_IsLocalPlayer(player)) && localaiming[0] != 0) localaiming[0] = 0; //Reset away view -- 2.54.0 From 71486a498246b73a1a75081c0263c5631e86d2e6 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 15 Nov 2023 23:17:42 +0100 Subject: [PATCH 051/112] opengl vhs effect im in so much pain --- src/hardware/hw_drv.h | 2 + src/hardware/hw_main.c | 9 +++ src/hardware/hw_main.h | 2 + src/hardware/r_opengl/r_opengl.c | 104 +++++++++++++++++++++++++++++++ src/sdl/hwsym_sdl.c | 1 + src/sdl/i_video.c | 1 + src/v_video.c | 25 +++++++- 7 files changed, 142 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index bcf627236..65f201ee6 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -63,6 +63,7 @@ EXPORT void HWRAPI(EndScreenWipe) (void); EXPORT void HWRAPI(DoScreenWipe) (void); EXPORT void HWRAPI(DrawIntermissionBG) (void); EXPORT void HWRAPI(MakeScreenTexture) (void); +EXPORT void HWRAPI(RenderVhsEffect) (INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize); EXPORT void HWRAPI(MakeScreenFinalTexture) (void); EXPORT void HWRAPI(DrawScreenFinalTexture) (int width, int height); @@ -117,6 +118,7 @@ struct hwdriver_s DoScreenWipe pfnDoScreenWipe; DrawIntermissionBG pfnDrawIntermissionBG; MakeScreenTexture pfnMakeScreenTexture; + RenderVhsEffect pfnRenderVhsEffect; MakeScreenFinalTexture pfnMakeScreenFinalTexture; DrawScreenFinalTexture pfnDrawScreenFinalTexture; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index bfab25199..754ed0301 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -117,6 +117,8 @@ consvar_t cv_secbright = {"secbright", "0", CV_SAVE, secbright_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grfovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_grvhseffect = {"gr_vhseffect", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // values for the far clipping plane static float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f}; @@ -6388,6 +6390,8 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_grpaletteshader); CV_RegisterVar(&cv_grflashpal); + + CV_RegisterVar(&cv_grvhseffect); } // -------------------------------------------------------------------------- @@ -6616,6 +6620,11 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum) HWD.pfnDoScreenWipe(); } +void HWR_RenderVhsEffect(INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize) +{ + HWD.pfnRenderVhsEffect(upbary, downbary, updistort, downdistort, barsize); +} + void HWR_MakeScreenFinalTexture(void) { HWD.pfnMakeScreenFinalTexture(); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 70d368c95..08540b362 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -107,6 +107,7 @@ void HWR_StartScreenWipe(void); void HWR_EndScreenWipe(void); void HWR_DrawIntermissionBG(void); void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum); +void HWR_RenderVhsEffect(INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize); void HWR_MakeScreenFinalTexture(void); void HWR_DrawScreenFinalTexture(int width, int height); @@ -189,6 +190,7 @@ extern consvar_t cv_grflashpal; extern consvar_t cv_grportals; extern consvar_t cv_nostencil; extern consvar_t cv_secbright; +extern consvar_t cv_grvhseffect; extern CV_PossibleValue_t granisotropicmode_cons_t[]; diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 0e5222e11..d86df4838 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -4157,6 +4157,110 @@ EXPORT void HWRAPI(MakeScreenTexture) (void) tex_downloaded = screentexture; } +EXPORT void HWRAPI(RenderVhsEffect) (INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize) +{ + INT32 texsize = 512; + float xfix, yfix; + float fix[8]; + GLubyte color[4] = {255, 255, 255, 255}; + float i; + + float screenVerts[12] = + { + -1.0f, -1.0f, 1.0f, + -1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, + 1.0f, -1.0f, 1.0f + }; + + // look for power of two that is large enough for the screen + while (texsize < screen_width || texsize < screen_height) + texsize <<= 1; + + xfix = 1/((float)(texsize)/((float)((screen_width)))); + yfix = 1/((float)(texsize)/((float)((screen_height)))); + + // Slight fuzziness + MakeScreenTexture(); + SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest); + pglBindTexture(GL_TEXTURE_2D, screentexture); + + fix[2] = (float)(rand() / 255) / -22000 * xfix; + + for (i = 0; i < 1; i += 0.01) + { + color[3] = (float)(rand() * 70 / 256) + 40; + fix[0] = fix[2]; + fix[2] = (float)(rand() / 255) / -22000 * xfix; + fix[6] = fix[0] + xfix; + fix[4] = fix[2] + xfix; + fix[1] = fix[7] = i*yfix; + fix[3] = fix[5] = (i+0.015)*yfix; + + screenVerts[1] = screenVerts[10] = 2*i - 1.0f; + screenVerts[4] = screenVerts[7] = screenVerts[1] + 0.03; + + pglColor4ubv(color); + + pglTexCoordPointer(2, GL_FLOAT, 0, fix); + pglVertexPointer(3, GL_FLOAT, 0, screenVerts); + pglDrawArrays(GL_TRIANGLE_FAN, 0, 4); + } + + // Upward bar + MakeScreenTexture(); + pglBindTexture(GL_TEXTURE_2D, screentexture); + color[0] = color[1] = color[2] = 190; + color[3] = 250; + pglColor4ubv(color); + + fix[0] = 0.0f; + fix[6] = xfix; + fix[2] = (float)updistort / screen_width * xfix; + fix[4] = fix[2] + fix[6]; + + screenVerts[1] = screenVerts[10] = 2.0f*upbary/screen_height - 1.0f; + screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/screen_height; + + fix[1] = fix[7] = (float)upbary/screen_height * yfix; + fix[3] = fix[5] = fix[1] + (float)barsize/2/screen_height * yfix; + + pglTexCoordPointer(2, GL_FLOAT, 0, fix); + pglVertexPointer(3, GL_FLOAT, 0, screenVerts); + pglDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + fix[1] = fix[7] += (fix[3] - fix[7])*2; + screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2; + pglTexCoordPointer(2, GL_FLOAT, 0, fix); + pglVertexPointer(3, GL_FLOAT, 0, screenVerts); + pglDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + // Downward bar + MakeScreenTexture(); + pglBindTexture(GL_TEXTURE_2D, screentexture); + + fix[0] = 0.0f; + fix[6] = xfix; + fix[2] = (float)downdistort / screen_width * -xfix; + fix[4] = fix[2] + fix[6]; + + screenVerts[1] = screenVerts[10] = 2.0f*downbary/screen_height - 1.0f; + screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/screen_height; + + fix[1] = fix[7] = (float)downbary/screen_height * yfix; + fix[3] = fix[5] = fix[1] + (float)barsize/2/screen_height * yfix; + + pglTexCoordPointer(2, GL_FLOAT, 0, fix); + pglVertexPointer(3, GL_FLOAT, 0, screenVerts); + pglDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + fix[1] = fix[7] += (fix[3] - fix[7])*2; + screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2; + pglTexCoordPointer(2, GL_FLOAT, 0, fix); + pglVertexPointer(3, GL_FLOAT, 0, screenVerts); + pglDrawArrays(GL_TRIANGLE_FAN, 0, 4); +} + EXPORT void HWRAPI(MakeScreenFinalTexture) (void) { INT32 texsize = 512; diff --git a/src/sdl/hwsym_sdl.c b/src/sdl/hwsym_sdl.c index 4af37ee42..81cf4f29f 100644 --- a/src/sdl/hwsym_sdl.c +++ b/src/sdl/hwsym_sdl.c @@ -99,6 +99,7 @@ void *hwSym(const char *funcName,void *handle) GETFUNC(DoScreenWipe); GETFUNC(DrawIntermissionBG); GETFUNC(MakeScreenTexture); + GETFUNC(RenderVhsEffect); GETFUNC(MakeScreenFinalTexture); GETFUNC(DrawScreenFinalTexture); diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index d3085b14b..06bece476 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -2132,6 +2132,7 @@ void I_StartupGraphics(void) HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL); HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL); HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL); + HWD.pfnRenderVhsEffect = hwSym("RenderVhsEffect",NULL); HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL); HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL); diff --git a/src/v_video.c b/src/v_video.c index 508e86c9a..1fc9be187 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1153,11 +1153,32 @@ void V_DrawVhsEffect(boolean rewind) if (rewind) V_DrawVhsEffect(false); // experimentation - upbary -= FixedMul(vid.dupy * (rewind ? 3 : 1.8f), renderdeltatics); - downbary += FixedMul(vid.dupy * (rewind ? 2 : 1), renderdeltatics); + if (R_UsingFrameInterpolation()) // omg i fucking hate interp so much, its a bit smoother but still not great whatever, atleast like this shit wont completely go nuts when youre on high framerates + { + if (renderisnewtic) + { + upbary -= FixedMul(vid.dupy * (rewind ? 3 : 1.8f), 22937*3); + downbary += FixedMul(vid.dupy * (rewind ? 2 : 1), 22937*3); + } + } + else + { + upbary -= vid.dupy * (rewind ? 3 : 1.8f); + downbary += vid.dupy * (rewind ? 2 : 1); + } + + if (upbary < -barsize) upbary = vid.height; if (downbary > vid.height) downbary = -barsize; +#ifdef HWRENDER + if ((rendermode == render_opengl) && (cv_grvhseffect.value)) + { + HWR_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize); + return; + } +#endif + for (y = 0; y < vid.height; y+=2) { thismapstart = normalmapstart; -- 2.54.0 From 8d607594ff91e482f1c331193c8caeaea93d1b45 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 15 Nov 2023 23:38:36 +0100 Subject: [PATCH 052/112] add stuff to menu --- src/m_menu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index a8509b2f4..03f0ea2ae 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1413,8 +1413,11 @@ static menuitem_t OP_ExpOptionsMenu[] = {IT_HEADER, NULL, "Experimental Options", NULL, 10}, {IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 45}, {IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 55}, + + {IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_vhseffect, 75}, #ifdef HWRENDER {IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 75}, + {IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_grvhseffect, 85}, #endif }; @@ -1423,8 +1426,10 @@ static const char* OP_ExpTooltips[] = NULL, "Should weather be interpolated? Weather should look about the\nsame but perform a bit better when disabled.", "When weather is on this will cut the object amount used in half.", + "Show a VHS-like effect when the game is paused or youre rewinding replays.", #ifdef HWRENDER "Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.", + "Show a VHS-like effect when the game is paused or youre rewinding replays.", #endif }; @@ -1433,8 +1438,10 @@ enum op_exp_header, op_exp_precipinter, op_exp_lessprecip, + op_exp_vhs, #ifdef HWRENDER op_exp_grscrtx, + op_exp_grvhs, #endif }; @@ -4302,7 +4309,11 @@ void M_Init(void) { OP_VideoOptionsMenu[op_video_ogl].status = IT_DISABLED; OP_ExpOptionsMenu[op_exp_grscrtx].status = IT_DISABLED; + OP_ExpOptionsMenu[op_exp_grvhs].status = IT_DISABLED; } + + if (rendermode == render_opengl) + OP_ExpOptionsMenu[op_exp_vhs].status = IT_DISABLED; #endif if (!snw_speedo && !kartzspeedo) // why bother? -- 2.54.0 From 4e6dc920338c1d4b9a2c58e188dc0de986238efa Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Thu, 16 Nov 2023 03:15:18 +0100 Subject: [PATCH 053/112] fix "Resynching..." speeding up with interpolation :p --- src/hu_stuff.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index c8399407b..c40df3836 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -184,8 +184,6 @@ static INT32 cechoflags = 0; // HEADS UP INIT //====================================================================== -static tic_t resynch_ticker = 0; - #ifndef NONET // just after static void Command_Say_f(void); @@ -2466,12 +2464,18 @@ void HU_Drawer(void) // draw desynch text if (hu_resynching) { + static UINT32 resynch_ticker = 0; char resynch_text[14]; UINT32 i; - strcpy(resynch_text, "Resynching"); - for (i = 0; i < (resynch_ticker / 16) % 4; i++) - strcat(resynch_text, "."); + // Animate the dots + if (renderisnewtic) + { + resynch_ticker++; //tic tic tic tic tic + } + strcpy(resynch_text, "Resynching"); + for (i = 0; i < (resynch_ticker / 16) % 4; i++) + strcat(resynch_text, "."); V_DrawCenteredString(BASEVIDWIDTH/2, 180, V_YELLOWMAP | V_ALLOWLOWERCASE, resynch_text); } -- 2.54.0 From 3c078c66768fcfb44cabc4ee3b086e40962ea376 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 16 Nov 2023 03:22:52 +0100 Subject: [PATCH 054/112] uhh should be fixed_t or not? --- src/hardware/hw_drv.h | 2 +- src/hardware/hw_main.c | 2 +- src/hardware/hw_main.h | 2 +- src/hardware/r_opengl/r_opengl.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index 65f201ee6..56055a9dc 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -63,7 +63,7 @@ EXPORT void HWRAPI(EndScreenWipe) (void); EXPORT void HWRAPI(DoScreenWipe) (void); EXPORT void HWRAPI(DrawIntermissionBG) (void); EXPORT void HWRAPI(MakeScreenTexture) (void); -EXPORT void HWRAPI(RenderVhsEffect) (INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize); +EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize); EXPORT void HWRAPI(MakeScreenFinalTexture) (void); EXPORT void HWRAPI(DrawScreenFinalTexture) (int width, int height); diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 754ed0301..7fce89e04 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -6620,7 +6620,7 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum) HWD.pfnDoScreenWipe(); } -void HWR_RenderVhsEffect(INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize) +void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize) { HWD.pfnRenderVhsEffect(upbary, downbary, updistort, downdistort, barsize); } diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 08540b362..2f3f58fbf 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -107,7 +107,7 @@ void HWR_StartScreenWipe(void); void HWR_EndScreenWipe(void); void HWR_DrawIntermissionBG(void); void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum); -void HWR_RenderVhsEffect(INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize); +void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize); void HWR_MakeScreenFinalTexture(void); void HWR_DrawScreenFinalTexture(int width, int height); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index d86df4838..ebb21a8fc 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -4157,7 +4157,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (void) tex_downloaded = screentexture; } -EXPORT void HWRAPI(RenderVhsEffect) (INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize) +EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize) { INT32 texsize = 512; float xfix, yfix; -- 2.54.0 From d1becfcf0c4bf53740ec0c26e665026f72d410aa Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Thu, 16 Nov 2023 17:19:13 +0100 Subject: [PATCH 055/112] this is better like srb2 does it, but kk forgor --- src/hu_stuff.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index c40df3836..b8c50060d 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -184,6 +184,8 @@ static INT32 cechoflags = 0; // HEADS UP INIT //====================================================================== +static tic_t resynch_ticker = 0; + #ifndef NONET // just after static void Command_Say_f(void); @@ -1140,6 +1142,10 @@ void HU_Ticker(void) } if (cechotimer > 0) --cechotimer; + + // Animate the desynch dots + if (hu_resynching) + resynch_ticker++; //tic tic tic tic tic HU_TickSongCredits(); } @@ -2464,18 +2470,12 @@ void HU_Drawer(void) // draw desynch text if (hu_resynching) { - static UINT32 resynch_ticker = 0; char resynch_text[14]; UINT32 i; - // Animate the dots - if (renderisnewtic) - { - resynch_ticker++; //tic tic tic tic tic - } - strcpy(resynch_text, "Resynching"); - for (i = 0; i < (resynch_ticker / 16) % 4; i++) - strcat(resynch_text, "."); + strcpy(resynch_text, "Resynching"); + for (i = 0; i < (resynch_ticker / 16) % 4; i++) + strcat(resynch_text, "."); V_DrawCenteredString(BASEVIDWIDTH/2, 180, V_YELLOWMAP | V_ALLOWLOWERCASE, resynch_text); } -- 2.54.0 From b03faeff25f22c8fb74c9361cb533bb00053f7e5 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Thu, 16 Nov 2023 03:26:09 -0500 Subject: [PATCH 056/112] Do highresportaits for saturn specfically --- src/k_kart.c | 19 ++++++++++++++++--- src/k_kart.h | 1 + src/m_menu.c | 27 +++++++++++++++------------ src/y_inter.c | 20 ++++++++++++++++---- 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 6fd0a7819..98e4e8e27 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -78,6 +78,8 @@ consvar_t cv_darkitembox = {"darkitembox", "On", CV_SAVE, CV_OnOff, NULL, 0, NUL consvar_t cv_biglaps = {"biglaphud", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // here for ppl who dont want to make 2 more patches for their custom hud +consvar_t cv_highresportrait = {"highresportrait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + // SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H: // gamespeed is cc (0 for easy, 1 for normal, 2 for hard) @@ -707,6 +709,8 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_biglaps); + CV_RegisterVar(&cv_highresportrait); + CV_RegisterVar(&cv_slamsound); CV_RegisterVar(&cv_minihead); @@ -7680,7 +7684,10 @@ static void K_drawKartStats(void) V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), fakeskin->realname)); // Icon and stats - V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal)); + if (cv_highresportrait.value) + V_DrawSmallMappedPatch(x, y, flags, R_GetSkinFaceWant(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal)); + else + V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal)); V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE)); V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE)); } @@ -8445,7 +8452,10 @@ static boolean K_drawKartPositionFaces(void) { player_t *p; p = &players[rankplayer[i]]; - V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceRank(p), colormap); + if (cv_highresportrait.value) + V_DrawSmallMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceWant(p), colormap); + else + V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceRank(p), colormap); } #ifdef HAVE_BLUA @@ -8535,7 +8545,10 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I { player_t *p; p = &players[tab[i].num]; - V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(p), colormap); + if (cv_highresportrait.value) + V_DrawSmallMappedPatch(x, y-4, 0, R_GetSkinFaceWant(p), colormap); + else + V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(p), colormap); } /*if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] > 0) -- not enough space for this { diff --git a/src/k_kart.h b/src/k_kart.h index 86a7b1e45..40353f5df 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -26,6 +26,7 @@ extern consvar_t cv_colorizeditembox; extern consvar_t cv_colorizedhudcolor; extern consvar_t cv_darkitembox; extern consvar_t cv_biglaps; +extern consvar_t cv_highresportrait; extern consvar_t cv_stat_xoffset; extern consvar_t cv_stat_yoffset; extern consvar_t cv_showstats; diff --git a/src/m_menu.c b/src/m_menu.c index 03f0ea2ae..66da182c2 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1948,18 +1948,19 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 25}, {IT_STRING | IT_CVAR, NULL, "Speedometer Style", &cv_newspeedometer, 30}, {IT_STRING | IT_CVAR, NULL, "Stat Display", &cv_showstats, 35}, - {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 40}, - {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 45}, - {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 50}, - {IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 55}, - {IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 60}, - {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 65}, - {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 70}, + {IT_STRING | IT_CVAR, NULL, "Higher Resoultion Portraits", &cv_highresportrait, 40}, + {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 45}, + {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 50}, + {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 56}, + {IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 60}, + {IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 65}, + {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 70}, + {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 75}, - {IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 80}, - {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 85}, + {IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 85}, + {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 90}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 95}, // uwu + {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 105}, // uwu }; static const char* OP_SaturnTooltips[] = @@ -1970,9 +1971,10 @@ static const char* OP_SaturnTooltips[] = "Displays the input display outside of Record Attack. Also adjusts the\nposition scale to match.", "Change what style the speedometer is.", "Enable the stat display.", + "Enable the use of the higher resoultion want icons instead of rank\nfor some places.", "Enable colourized hud.", - "Enable the colourized itembox when colourized hud is enabled.", - "The colour to use instead of the player colour when colourized hud is enabled.", + "Enable the colorized itembox when colourized hud is enabled.", + "The color to use instead of the player color when colourized hud is enabled.", "Show the big 'LAP' text on a lap change.", "Show player names on the minimap.", "Minimize the player icons on the minimap.", @@ -1991,6 +1993,7 @@ enum sm_input, sm_speedometer, sm_statdisplay, + sm_highresport, sm_colorhud, sm_coloritem, sm_colorhud_customcolor, diff --git a/src/y_inter.c b/src/y_inter.c index e23669951..ba5f89785 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -541,11 +541,20 @@ void Y_IntermissionDrawer(void) // i fucking hate this i fucking hate this i hate this so much if (!players[data.match.num[i]].skinlocal) { if (!players[data.match.num[i]].localskin) - V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[*data.match.character[i]], colormap); + if (cv_highresportrait.value) + V_DrawSmallMappedPatch(x+16, y-4, 0, facewantprefix[*data.match.character[i]], colormap); + else + V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[*data.match.character[i]], colormap); else - V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[players[data.match.num[i]].localskin - 1], colormap); + if (cv_highresportrait.value) + V_DrawSmallMappedPatch(x+16, y-4, 0, facewantprefix[players[data.match.num[i]].localskin - 1], colormap); + else + V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[players[data.match.num[i]].localskin - 1], colormap); } else { - V_DrawMappedPatch(x+16, y-4, 0, localfacerankprefix[players[data.match.num[i]].localskin - 1], colormap); + if (cv_highresportrait.value) + V_DrawSmallMappedPatch(x+16, y-4, 0, localfacewantprefix[players[data.match.num[i]].localskin - 1], colormap); + else + V_DrawMappedPatch(x+16, y-4, 0, localfacerankprefix[players[data.match.num[i]].localskin - 1], colormap); } } @@ -1320,7 +1329,10 @@ void Y_VoteDrawer(void) if (players[i].skincolor) { UINT8 *colormap = R_GetTranslationColormap(players[i].skin, players[i].skincolor, GTC_CACHE); - V_DrawMappedPatch(x+24, y+9, V_SNAPTOLEFT, (players[i].skinlocal ? localfacerankprefix : facerankprefix)[((players[i].localskin) ? players[i].localskin-1 : players[i].skin)], colormap); + if (cv_highresportrait.value) + V_DrawSmallMappedPatch(x+24, y+9, V_SNAPTOLEFT, (players[i].skinlocal ? localfacewantprefix : facewantprefix)[((players[i].localskin) ? players[i].localskin-1 : players[i].skin)], colormap); + else + V_DrawMappedPatch(x+24, y+9, V_SNAPTOLEFT, (players[i].skinlocal ? localfacerankprefix : facerankprefix)[((players[i].localskin) ? players[i].localskin-1 : players[i].skin)], colormap); } if (!splitscreen && i == consoleplayer) -- 2.54.0 From ff04b83ec0d6d3126bfce68930efee29199bed47 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Thu, 16 Nov 2023 03:35:24 -0500 Subject: [PATCH 057/112] English (UK) --- src/m_menu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 66da182c2..c5c3249f9 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1948,7 +1948,7 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 25}, {IT_STRING | IT_CVAR, NULL, "Speedometer Style", &cv_newspeedometer, 30}, {IT_STRING | IT_CVAR, NULL, "Stat Display", &cv_showstats, 35}, - {IT_STRING | IT_CVAR, NULL, "Higher Resoultion Portraits", &cv_highresportrait, 40}, + {IT_STRING | IT_CVAR, NULL, "Higher Resolution Portraits", &cv_highresportrait, 40}, {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 45}, {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 50}, {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 56}, @@ -1971,9 +1971,9 @@ static const char* OP_SaturnTooltips[] = "Displays the input display outside of Record Attack. Also adjusts the\nposition scale to match.", "Change what style the speedometer is.", "Enable the stat display.", - "Enable the use of the higher resoultion want icons instead of rank\nfor some places.", + "Enable the use of the higher resolution want icons instead of rank\nfor some places.", "Enable colourized hud.", - "Enable the colorized itembox when colourized hud is enabled.", + "Enable the colourized itembox when colourized hud is enabled.", "The color to use instead of the player color when colourized hud is enabled.", "Show the big 'LAP' text on a lap change.", "Show player names on the minimap.", -- 2.54.0 From 54542031a1fe13ded1731f866190bd6578d326fd Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 16 Nov 2023 20:20:49 +0300 Subject: [PATCH 058/112] Fix the opengl VHS effect on linux --- src/hardware/r_opengl/r_opengl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index ebb21a8fc..ed083307e 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -4185,13 +4185,12 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest); pglBindTexture(GL_TEXTURE_2D, screentexture); - fix[2] = (float)(rand() / 255) / -22000 * xfix; + fix[2] = (float)(rand() % 128) / -22000 * xfix; - for (i = 0; i < 1; i += 0.01) + for (i = 0; i < 1; i += 2.f/vid.height) { - color[3] = (float)(rand() * 70 / 256) + 40; fix[0] = fix[2]; - fix[2] = (float)(rand() / 255) / -22000 * xfix; + fix[2] = (float)(rand() % 128) / -22000 * xfix; fix[6] = fix[0] + xfix; fix[4] = fix[2] + xfix; fix[1] = fix[7] = i*yfix; -- 2.54.0 From ccbb894a6ba9b70aa6f9e548b71e260f9c531311 Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 16 Nov 2023 21:16:56 +0300 Subject: [PATCH 059/112] Remove repeating code in VHS effect --- src/hardware/r_opengl/r_opengl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index ed083307e..d558a0834 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -4185,12 +4185,10 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest); pglBindTexture(GL_TEXTURE_2D, screentexture); - fix[2] = (float)(rand() % 128) / -22000 * xfix; - for (i = 0; i < 1; i += 2.f/vid.height) { - fix[0] = fix[2]; fix[2] = (float)(rand() % 128) / -22000 * xfix; + fix[0] = fix[2]; fix[6] = fix[0] + xfix; fix[4] = fix[2] + xfix; fix[1] = fix[7] = i*yfix; -- 2.54.0 From 49aaa2525502d9f9cbd6b17da0962b48d7fd2115 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Thu, 16 Nov 2023 22:52:56 -0500 Subject: [PATCH 060/112] Mouse Controls for saturn --- src/d_netcmd.c | 2 ++ src/d_netcmd.h | 2 ++ src/g_game.c | 4 ++-- src/k_kart.c | 3 +++ src/m_menu.c | 48 ++++++++++++++++++++++++++++++++++++++---------- 5 files changed, 47 insertions(+), 12 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index eb246a199..e483d846d 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -301,6 +301,8 @@ INT32 cv_debug; consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse2, 0, NULL, NULL, 0, 0, NULL}; +//WTF +consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2 consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 9b6d99b25..e21fdbb6f 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -41,6 +41,8 @@ extern consvar_t cv_splitplayers; extern consvar_t cv_seenames, cv_allowseenames; #endif extern consvar_t cv_usemouse; +//WTF +extern consvar_t cv_mouseturn; extern consvar_t cv_usejoystick; extern consvar_t cv_usejoystick2; extern consvar_t cv_usejoystick3; diff --git a/src/g_game.c b/src/g_game.c index b4dfbf074..2a482bfaa 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1427,9 +1427,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) side += ((axis * sidemove[0]) >> 10); } - // Specator mouse turning - if (player->spectator) + if (player->spectator || cv_mouseturn.value) { + //THIS WORKS WTF???????? cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8))); cmd->driftturn = (INT16)(cmd->driftturn - ((mousex*(encoremode ? -1 : 1)*8))); } diff --git a/src/k_kart.c b/src/k_kart.c index 98e4e8e27..387979682 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -720,6 +720,9 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_stagetitle); CV_RegisterVar(&cv_lessflicker); + + CV_RegisterVar(&cv_mouseturn); + } //} diff --git a/src/m_menu.c b/src/m_menu.c index c5c3249f9..8b5597dad 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1166,9 +1166,11 @@ static menuitem_t OP_ControlsMenu[] = {IT_CALL | IT_STRING, NULL, "Player 3 Controls...", &M_Setup3PControlsMenu, 30}, {IT_CALL | IT_STRING, NULL, "Player 4 Controls...", &M_Setup4PControlsMenu, 40}, + + {IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 60}, - {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 60}, - {IT_STRING | IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth, 70}, + {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 80}, + {IT_STRING | IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth, 90}, }; static const char* OP_ControlsTooltips[] = @@ -1179,6 +1181,9 @@ static const char* OP_ControlsTooltips[] = "Setup player 3 controls.", "Setup player 4 controls.", + "Options for mouse control.", + + "Allowed amount of controls per key.", "Turn smoothing for non-analog turning.", @@ -1298,22 +1303,34 @@ static menuitem_t OP_JoystickSetMenu[] = {IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*8)+5}, }; -/*static menuitem_t OP_MouseOptionsMenu[] = +//WTF +static menuitem_t OP_MouseOptionsMenu[] = { {IT_STRING | IT_CVAR, NULL, "Use Mouse", &cv_usemouse, 10}, - {IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook, 30}, - {IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook, 40}, - {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove, 50}, - {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 60}, + //{IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook, 30}, + //{IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook, 40}, + {IT_STRING | IT_CVAR, NULL, "Mouse Turning", &cv_mouseturn, 20}, + {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 30}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse X Speed", &cv_mousesens, 70}, + NULL, "Mouse X Speed", &cv_mousesens, 40}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse Y Speed", &cv_mouseysens, 80}, + NULL, "Mouse Y Speed", &cv_mouseysens, 50}, }; -static menuitem_t OP_Mouse2OptionsMenu[] = +static const char* OP_MouseTooltips[] = +{ + + "Enable the use of the mouse.", + "Turn using the mouse.", + "Invert mouse movements.", + "Mouse horizontal sensitivity.", + "Mouse vertical sensitivity.", + +}; + +/*static menuitem_t OP_Mouse2OptionsMenu[] = { {IT_STRING | IT_CVAR, NULL, "Use Mouse 2", &cv_usemouse2, 10}, {IT_STRING | IT_CVAR, NULL, "Second Mouse Serial Port", @@ -2648,6 +2665,8 @@ menu_t OP_MainDef = }; menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 60, 30); +//WTF +menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30); menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef); menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 60, 30); menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 60, 30); @@ -4866,6 +4885,15 @@ static void M_DrawGenericMenu(void) } } + if (currentMenu == &OP_MouseOptionsDef) + { + if (!(OP_MouseTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_MouseTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } if (currentMenu == &OP_VideoOptionsDef) { -- 2.54.0 From 10953dbb3ad065fe6018fe4c14a83d665302b036 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Fri, 17 Nov 2023 20:29:07 +0100 Subject: [PATCH 061/112] add toggle to hide player ip addresses in nodes or listplayers command also add "listplayers" command, which is pretty much the same as "nodes" but with colors and it looks better tho kept "nodes" command just in case its needed for smth --- src/d_clisrv.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++- src/d_clisrv.h | 2 ++ src/d_netcmd.c | 1 + src/m_menu.c | 7 ++-- 4 files changed, 100 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 18f914200..c3dba1690 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -171,6 +171,8 @@ static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL}; consvar_t cv_showjoinaddress = {"showjoinaddress", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_shownodeip = {"showipinnodelist", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, NULL}}; consvar_t cv_playbackspeed = {"playbackspeed", "1", 0, playbackspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -3346,7 +3348,7 @@ static void Command_Nodes(void) { CONS_Printf("%.2u: %*s", i, (int)maxlen, player_names[i]); CONS_Printf(" - %.2d", playernode[i]); - if (I_GetNodeAddress && (address = I_GetNodeAddress(playernode[i])) != NULL) + if ((I_GetNodeAddress && (address = I_GetNodeAddress(playernode[i])) != NULL) && (cv_shownodeip.value)) CONS_Printf(" - %s", address); if (IsPlayerAdmin(i)) @@ -3360,6 +3362,94 @@ static void Command_Nodes(void) } } +//Screw the base game nodes lets replace with listplayers instead. +static void Command_Listplayers(void) +{ + const char *address; + int width = 0; + + boolean admin; + boolean spectator; + + /* + Mode of player status for an individual player (admin, spectator). + 1 for admin + 2 for spectator + 4 for both + */ + int mode = 0; + + INT32 totalplayers = 0; + + const char *cc; + const char *pcc; + + INT32 i; + int n; + + for (i = 0; i < MAXPLAYERS; ++i) + if (playeringame[i]) + { + n = strlen(player_names[i]); + if (n > width) + width = n; + + if (mode != 7) + { + admin = IsPlayerAdmin(i); + spectator = players[i].spectator; + + if (admin) + mode |= 1; + if (spectator) + mode |= 2; + if (admin && spectator) + mode |= 4; + } + } + + for (i = 0; i < MAXPLAYERS; ++i) + if (playeringame[i]) + { + admin = IsPlayerAdmin(i); + spectator = players[i].spectator; + + if (admin) + cc = "\x85";/* red */ + else if (spectator) + cc = "\x86";/* gray */ + else + cc = ""; + + pcc = HU_SkinColorToConsoleColor(players[i].skincolor); + + CONS_Printf("%.2d: ""%s""%-*s""\x80", i, pcc,width, player_names[i]); + + if ((I_GetNodeAddress && (address = I_GetNodeAddress(playernode[i])) != NULL) && (cv_shownodeip.value)) + CONS_Printf(" -- %s", address); + else/* print spacer */ + { + /* ...but not if there's a crammed status and were admin */ + if (mode != 7 || !admin) + CONS_Printf(" -- ");/* -- self */ + } + + if (admin) + CONS_Printf(M_GetText("%s"" (admin)"),cc); + if (spectator) + CONS_Printf(M_GetText("%s"" (spectator)"),cc); + + CONS_Printf("\n"); + + totalplayers++; + } + + if (totalplayers == 1) + CONS_Printf("\nThere is 1 player in the game.\n"); + else + CONS_Printf("\nThere are %d players in the game.\n", totalplayers); +} + static void Command_Ban(void) { if (COM_Argc() < 2) @@ -3925,6 +4015,7 @@ void D_ClientServerInit(void) COM_AddCommand("reloadbans", Command_ReloadBan); COM_AddCommand("connect", Command_connect); COM_AddCommand("nodes", Command_Nodes); + COM_AddCommand("listplayers", Command_Listplayers); #ifdef HAVE_CURL COM_AddCommand("set_http_login", Command_set_http_login); COM_AddCommand("list_http_logins", Command_list_http_logins); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 65fd3c9a9..b1bc9ffcc 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -515,6 +515,8 @@ extern consvar_t cv_kicktime; extern consvar_t cv_showjoinaddress; extern consvar_t cv_playbackspeed; +extern consvar_t cv_shownodeip; + #define BASEPACKETSIZE offsetof(doomdata_t, u) #define FILETXHEADER offsetof(filetx_pak, data) #define BASESERVERTICSSIZE offsetof(doomdata_t, u.serverpak.cmds[0]) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index e483d846d..389c91a60 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -776,6 +776,7 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_joinnextround); #endif CV_RegisterVar(&cv_showjoinaddress); + CV_RegisterVar(&cv_shownodeip); CV_RegisterVar(&cv_blamecfail); #endif diff --git a/src/m_menu.c b/src/m_menu.c index 8b5597dad..ebd6b8971 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1749,8 +1749,10 @@ static menuitem_t OP_ChatOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Max Chat Messages", &cv_chatlogsize, 80}, {IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 100}, // shows ping next to framerate if we want to. - {IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 110}, - {IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 120}, + {IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 110}, + {IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 120}, + + {IT_STRING | IT_CVAR, NULL, "Show IP addresses in playerlist", &cv_shownodeip, 140}, }; static const char* OP_ChatOptionsTooltips[] = @@ -1765,6 +1767,7 @@ static const char* OP_ChatOptionsTooltips[] = "Show player ping.", "Measurement used for ping.", "Visibility of ping icon.", + "Should Player IP addresses be printed when using\nthe nodes or listplayers command?", }; static menuitem_t OP_GameOptionsMenu[] = -- 2.54.0 From 16f8299c4a814d4ecc78194b25694ee2d3fb5139 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 17 Nov 2023 20:48:27 +0100 Subject: [PATCH 062/112] fix admin menu stuff uuuuhhh --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index ebd6b8971..edc6460a0 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4064,7 +4064,7 @@ void M_StartControlPanel(void) Dummymenuplayer_OnChange(); - if (server) + if ((server || IsPlayerAdmin(consoleplayer))) { MPauseMenu[mpause_switchmap].status = IT_STRING | IT_CALL; MPauseMenu[mpause_addons].status = IT_STRING | IT_CALL; -- 2.54.0 From cc408cc859b3d8044ff3bf330327efa6df38da1c Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 17 Nov 2023 23:28:53 +0100 Subject: [PATCH 063/112] fix not being able to close warning screen when a mod spams warnings lmao --- src/m_menu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index edc6460a0..8fc8b91d1 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6155,6 +6155,8 @@ static void M_AddonsClearName(INT32 choice) M_StopMessage(choice); } +int errorshitspam = 0; // prevent the warning screen from crapping itself when errors get spammed lmao + // returns whether to do message draw static boolean M_AddonsRefresh(void) { @@ -6183,10 +6185,11 @@ static boolean M_AddonsRefresh(void) else message = va("%c%s\x80\nA file was not loaded.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); } - else if (refreshdirmenu & (REFRESHDIR_WARNING|REFRESHDIR_ERROR)) + else if ((refreshdirmenu & (REFRESHDIR_WARNING | REFRESHDIR_ERROR)) && !errorshitspam) { S_StartSound(NULL, sfx_s224); message = va("%c%s\x80\nA file was loaded with %s.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname, ((refreshdirmenu & REFRESHDIR_ERROR) ? "errors" : "warnings")); + errorshitspam = 1; // you already said that shit } else if (majormods && !prevmajormods) { @@ -6529,12 +6532,16 @@ static void M_HandleAddons(INT32 choice) if (DumbStartsWith("KC_", dirmenu[dir_on[menudepthleft]]+DIR_STRING) || DumbStartsWith("kc_", dirmenu[dir_on[menudepthleft]]+DIR_STRING)) { M_StartMessage(va("%c%s\x80\nYou are loading a local skin.\nLocal skins will not be usable\nafter going back from\nthe title screen.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING); COM_BufAddText(va("addskins \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING)); + errorshitspam = 0; // reset it so it can show the warning screen again lmao } else S_StartSound(NULL, sfx_s26d); } else + { COM_BufAddText(va("addfile \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING)); + errorshitspam = 0; // reset it so it can show the warning screen again lmao + } break; default: S_StartSound(NULL, sfx_s26d); -- 2.54.0 From ec1123251fdebf003d1cc93af0ec55efbe86d8ef Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 17 Nov 2023 23:45:17 +0100 Subject: [PATCH 064/112] fix sliptide toggle for 3d models --- src/hardware/hw_md2.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 140c42c1f..ab015d862 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1366,15 +1366,19 @@ void HWR_DrawMD2(gr_vissprite_t *spr) angle_t sliptideroll = 0; if (spr->mobj->player) - sliptideroll = ((cv_sloperoll.value) ? spr->mobj->player->sliproll : 0); + sliptideroll = ((cv_sloperoll.value && cv_sliptideroll.value) ? spr->mobj->player->sliproll : 0); - if ((spr->mobj->rollangle)||sliptideroll) + if ((spr->mobj->rollangle)||(sliptideroll && cv_sliptideroll.value)) { angle_t rollang = 0; rollfactor = ((spr->mobj->rollmodel == true) ? 1 : 0); - if (spr->mobj->player) - rollang = (spr->mobj->rollangle*rollfactor) + (sliptideroll*spr->mobj->player->sliptidemem); + if (spr->mobj->player){ + if (sliptideroll && cv_sliptideroll.value) + rollang = (spr->mobj->rollangle*rollfactor) + (sliptideroll*spr->mobj->player->sliptidemem); + else + rollang = (spr->mobj->rollangle*rollfactor); + } else rollang = (spr->mobj->rollangle*rollfactor); @@ -1423,7 +1427,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr) HWD.pfnSetShader(4); // model shader { - float this_scale = FIXED_TO_FLOAT(interp.scale); + float this_scale = FIXED_TO_FLOAT(interp.scale); float xs = this_scale * FIXED_TO_FLOAT(interp.spritexscale); float ys = this_scale * FIXED_TO_FLOAT(interp.spriteyscale); -- 2.54.0 From 7a2f925078affc7e983f0aa5a66764977d06e425 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sat, 18 Nov 2023 05:09:45 +0100 Subject: [PATCH 065/112] Make module music volume more accurate from https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2215 --- src/sdl/mixer_sound.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 57072ee3c..ad894895f 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -696,8 +696,8 @@ static void mix_gme(void *udata, Uint8 *stream, int len) music_volume = 18; // apply volume to stream - for (i = 0, p = (short *)stream; i < len/2; i++, p++) - *p = ((INT32)*p) * (music_volume*internal_volume/100)*2 / 40; + for (i = 0, p = (short *)stream; i < len / 2; i++, p++) + *p = ((INT32)*p) * music_volume * internal_volume / 100 / 20; } #endif @@ -721,8 +721,8 @@ static void mix_openmpt(void *udata, Uint8 *stream, int len) music_volume = 18; // apply volume to stream - for (i = 0, p = (short *)stream; i < len/2; i++, p++) - *p = ((INT32)*p) * (music_volume*internal_volume/100)*2 / 40; + for (i = 0, p = (short *)stream; i < len / 2; i++, p++) + *p = ((INT32)*p) * music_volume * internal_volume / 100 / 20; } #endif -- 2.54.0 From 78018e1f78f39bbc0bd32ed3c25559c5b5231eed Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sat, 18 Nov 2023 05:13:04 +0100 Subject: [PATCH 066/112] I_SetSongTrack(int) should be I_SetSongTrack(INT32) https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2213 --- src/dummy/i_sound.c | 2 +- src/sdl/mixer_sound.c | 2 +- src/sdl/sdl_sound.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dummy/i_sound.c b/src/dummy/i_sound.c index f09158e01..ff01bdff0 100644 --- a/src/dummy/i_sound.c +++ b/src/dummy/i_sound.c @@ -169,7 +169,7 @@ void I_SetMusicVolume(UINT8 volume) (void)volume; } -boolean I_SetSongTrack(int track) +boolean I_SetSongTrack(INT32 track) { (void)track; return false; diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index ad894895f..ce9a8b12f 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -1375,7 +1375,7 @@ void I_SetMusicVolume(UINT8 volume) Mix_VolumeMusic(get_real_volume(music_volume)); } -boolean I_SetSongTrack(int track) +boolean I_SetSongTrack(INT32 track) { #ifdef HAVE_LIBGME diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 5c93642bd..2f8fa7b5d 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -1476,7 +1476,7 @@ void I_SetMusicVolume(UINT8 volume) (void)volume; } -boolean I_SetSongTrack(int track) +boolean I_SetSongTrack(INT32 track) { (void)track; return false; -- 2.54.0 From 0b4e70faf367127af32a236abac59130c3e21d57 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Fri, 17 Nov 2023 23:48:04 -0500 Subject: [PATCH 067/112] perfstats for PreThinkFrame and PostThinkFrame plus small rewrite --- src/d_netcmd.c | 2 +- src/lua_hooklib.c | 75 ++++++++++++------ src/m_perfstats.c | 196 ++++++++++++++++++++++++++++++++++++++++------ src/m_perfstats.h | 5 ++ src/p_tick.c | 7 ++ 5 files changed, 236 insertions(+), 49 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 389c91a60..ec2b71271 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -511,7 +511,7 @@ static CV_PossibleValue_t skinselectspin_cons_t[] = { consvar_t cv_skinselectspin = {"skinselectspin", "5", CV_SAVE, skinselectspin_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t perfstats_cons_t[] = { - {0, "Off"}, {1, "Rendering"}, {2, "Logic"}, {3, "ThinkFrame"}, {0, NULL}}; + {0, "Off"}, {1, "Rendering"}, {2, "Logic"}, {3, "ThinkFrame"}, {4, "PreThinkFrame"}, {5, "PostThinkFrame"}, {0, NULL}}; consvar_t cv_perfstats = {"perfstats", "Off", CV_CALL, perfstats_cons_t, PS_PerfStats_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_ps_thinkframe_page = {"ps_thinkframe_page", "1", CV_CALL, CV_Natural, PS_ThinkFrame_Page_OnChange, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index d9344f65f..1e6a5cb29 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -430,6 +430,9 @@ void LUAh_PlayerJoin(int playernum) void LUAh_PreThinkFrame(void) { hook_p hookp; + // variables used by perf stats + int hook_index = 0; + precise_t time_taken = 0; if (!gL || !(hooksAvailable[hook_PreThinkFrame/8] & (1<<(hook_PreThinkFrame%8)))) return; @@ -437,19 +440,32 @@ void LUAh_PreThinkFrame(void) for (hookp = roothook; hookp; hookp = hookp->next) { - if (hookp->type != hook_PreThinkFrame) - continue; - - lua_pushfstring(gL, FMT_HOOKID, hookp->id); - lua_gettable(gL, LUA_REGISTRYINDEX); - if (lua_pcall(gL, 0, 0, 1)) { - if (!hookp->error || cv_debug & DBG_LUA) - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); - lua_pop(gL, 1); - hookp->error = true; + if (hookp->type == hook_PreThinkFrame) + { + if (cv_perfstats.value == 4) + time_taken = I_GetPreciseTime(); + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + if (lua_pcall(gL, 0, 0, 1)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + } + if (cv_perfstats.value == 4) + { + lua_Debug ar; + time_taken = I_GetPreciseTime() - time_taken; + // we need the function, let's just retrieve it again + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_getinfo(gL, ">S", &ar); + PS_SetPreThinkFrameHookInfo(hook_index, time_taken, ar.short_src); + hook_index++; + } } - } + } lua_pop(gL, 1); // Pop error handler } @@ -498,6 +514,9 @@ void LUAh_ThinkFrame(void) void LUAh_PostThinkFrame(void) { hook_p hookp; + // variables used by perf stats + int hook_index = 0; + precise_t time_taken = 0; if (!gL || !(hooksAvailable[hook_PostThinkFrame/8] & (1<<(hook_PostThinkFrame%8)))) return; @@ -505,19 +524,31 @@ void LUAh_PostThinkFrame(void) for (hookp = roothook; hookp; hookp = hookp->next) { - if (hookp->type != hook_PostThinkFrame) - continue; - - lua_pushfstring(gL, FMT_HOOKID, hookp->id); - lua_gettable(gL, LUA_REGISTRYINDEX); - if (lua_pcall(gL, 0, 0, 1)) { - if (!hookp->error || cv_debug & DBG_LUA) - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); - lua_pop(gL, 1); - hookp->error = true; + if (hookp->type == hook_PostThinkFrame) + { + if (cv_perfstats.value == 5) + time_taken = I_GetPreciseTime(); + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + if (lua_pcall(gL, 0, 0, 1)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + } + if (cv_perfstats.value == 5) + { + lua_Debug ar; + time_taken = I_GetPreciseTime() - time_taken; + // we need the function, let's just retrieve it again + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_getinfo(gL, ">S", &ar); + PS_SetPostThinkFrameHookInfo(hook_index, time_taken, ar.short_src); + hook_index++; + } } } - lua_pop(gL, 1); // Pop error handler } diff --git a/src/m_perfstats.c b/src/m_perfstats.c index 11c0414b0..937635536 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -63,7 +63,10 @@ static ps_metric_t ps_removecount = {0}; ps_metric_t ps_checkposition_calls = {0}; +ps_metric_t ps_lua_prethinkframe_time = {0}; ps_metric_t ps_lua_thinkframe_time = {0}; +ps_metric_t ps_lua_postthinkframe_time = {0}; + ps_metric_t ps_lua_mobjhooks = {0}; ps_metric_t ps_otherlogictime = {0}; @@ -156,7 +159,9 @@ perfstatrow_t gamelogic_rows[] = { {" mobjs ", " Mobjs: ", &ps_thlist_times[THINK_MOBJ], PS_TIME|PS_LEVEL}, {" dynslop", " Dynamic slopes: ", &ps_thlist_times[THINK_DYNSLOPE], PS_TIME|PS_LEVEL}, {" precip ", " Precipitation: ", &ps_thlist_times[THINK_PRECIP], PS_TIME|PS_LEVEL},*/ + {" lprethinkf", " LUAh_PreThinkFrame:", &ps_lua_prethinkframe_time, PS_TIME|PS_LEVEL}, {" lthinkf", " LUAh_ThinkFrame:", &ps_lua_thinkframe_time, PS_TIME|PS_LEVEL}, + {" lpostthinkf", " LUAh_PostThinkFrame:", &ps_lua_postthinkframe_time, PS_TIME|PS_LEVEL}, {" other ", " Other: ", &ps_otherlogictime, PS_TIME|PS_LEVEL}, {0} }; @@ -189,10 +194,43 @@ int ps_frame_index = 0; int ps_tick_index = 0; // dynamically allocated resizeable array for thinkframe hook stats +ps_hookinfo_t *prethinkframe_hooks = NULL; +int prethinkframe_hooks_length = 0; +int prethinkframe_hooks_capacity = 16; + ps_hookinfo_t *thinkframe_hooks = NULL; int thinkframe_hooks_length = 0; int thinkframe_hooks_capacity = 16; +ps_hookinfo_t *postthinkframe_hooks = NULL; +int postthinkframe_hooks_length = 0; +int postthinkframe_hooks_capacity = 16; + +void PS_SetPreThinkFrameHookInfo(int index, precise_t time_taken, char* short_src) +{ + if (!prethinkframe_hooks) + { + // array needs to be initialized + prethinkframe_hooks = Z_Calloc(sizeof(ps_hookinfo_t) * prethinkframe_hooks_capacity, PU_STATIC, NULL); + } + if (index >= prethinkframe_hooks_capacity) + { + // array needs more space, realloc with double size + int new_capacity = prethinkframe_hooks_capacity * 2; + prethinkframe_hooks = Z_Realloc(prethinkframe_hooks, + sizeof(ps_hookinfo_t) * new_capacity, PU_STATIC, NULL); + // initialize new memory with zeros so the pointers in the structs are null + memset(&prethinkframe_hooks[prethinkframe_hooks_capacity], 0, + sizeof(ps_hookinfo_t) * prethinkframe_hooks_capacity); + prethinkframe_hooks_capacity = new_capacity; + } + prethinkframe_hooks[index].time_taken.value.p = time_taken; + memcpy(prethinkframe_hooks[index].short_src, short_src, LUA_IDSIZE * sizeof(char)); + // since the values are set sequentially from begin to end, the last call should leave + // the correct value to this variable + prethinkframe_hooks_length = index + 1; +} + void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src) { if (!thinkframe_hooks) @@ -218,6 +256,33 @@ void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src) thinkframe_hooks_length = index + 1; } +void PS_SetPostThinkFrameHookInfo(int index, precise_t time_taken, char* short_src) +{ + if (!postthinkframe_hooks) + { + // array needs to be initialized + postthinkframe_hooks = Z_Calloc(sizeof(ps_hookinfo_t) * postthinkframe_hooks_capacity, PU_STATIC, NULL); + } + if (index >= postthinkframe_hooks_capacity) + { + // array needs more space, realloc with double size + int new_capacity = postthinkframe_hooks_capacity * 2; + postthinkframe_hooks = Z_Realloc(postthinkframe_hooks, + sizeof(ps_hookinfo_t) * new_capacity, PU_STATIC, NULL); + // initialize new memory with zeros so the pointers in the structs are null + memset(&postthinkframe_hooks[postthinkframe_hooks_capacity], 0, + sizeof(ps_hookinfo_t) * postthinkframe_hooks_capacity); + postthinkframe_hooks_capacity = new_capacity; + } + postthinkframe_hooks[index].time_taken.value.p = time_taken; + memcpy(postthinkframe_hooks[index].short_src, short_src, LUA_IDSIZE * sizeof(char)); + // since the values are set sequentially from begin to end, the last call should leave + // the correct value to this variable + postthinkframe_hooks_length = index + 1; +} + + + static boolean PS_HighResolution(void) { return (vid.width >= 640 && vid.height >= 400); @@ -578,7 +643,11 @@ void PS_UpdateTickStats(void) ps_tictime.value.p - ps_playerthink_time.value.p - ps_thinkertime.value.p - - ps_lua_thinkframe_time.value.p; + ps_lua_prethinkframe_time.value.p - + ps_lua_thinkframe_time.value.p - + ps_lua_postthinkframe_time.value.p; + + PS_CountThinkers(); } @@ -590,21 +659,37 @@ void PS_UpdateTickStats(void) PS_UpdateRowHistories(misc_calls_rows, false); } } - if (cv_perfstats.value == 3 && cv_ps_samplesize.value > 1 && PS_IsLevelActive()) + if (cv_ps_samplesize.value > 1) { - int i; - for (i = 0; i < thinkframe_hooks_length; i++) + if(cv_perfstats.value >= 3 && PS_IsLevelActive()) { - PS_UpdateMetricHistory(&thinkframe_hooks[i].time_taken, true, false, false); + int i; + if (cv_perfstats.value == 3) + { + for (i = 0; i < thinkframe_hooks_length; i++) + PS_UpdateMetricHistory(&thinkframe_hooks[i].time_taken, true, false, false); + } + else if (cv_perfstats.value == 4) + { + for (i = 0; i < prethinkframe_hooks_length; i++) + PS_UpdateMetricHistory(&prethinkframe_hooks[i].time_taken, true, false, false); + } + else if (cv_perfstats.value == 5) + { + for (i = 0; i < postthinkframe_hooks_length; i++) + PS_UpdateMetricHistory(&postthinkframe_hooks[i].time_taken, true, false, false); + } } - } - if (cv_perfstats.value && cv_ps_samplesize.value > 1) - { - ps_tick_index++; - if (ps_tick_index >= cv_ps_samplesize.value) - ps_tick_index = 0; - if (ps_tick_samples_left) - ps_tick_samples_left--; + if (cv_perfstats.value) + { + ps_tick_index++; + if (ps_tick_index >= cv_ps_samplesize.value) + ps_tick_index = 0; + if (ps_tick_samples_left) + ps_tick_samples_left--; + + } + } } @@ -624,7 +709,7 @@ static void PS_DrawDescriptorHeader(void) int samples_left = max(ps_frame_samples_left, ps_tick_samples_left); int x, y; - if (cv_perfstats.value == 3) + if (cv_perfstats.value >= 3) { x = 2; y = 0; @@ -717,21 +802,20 @@ static void PS_DrawGameLogicStats(void) #define WIDTH 106 #define HEIGHT 4 #define MAX_X 214 -#define MAX_Y 192 +#define MAX_Y 182 #define START_X 2 #define START_Y 4 #define PAGE_ENTRIES ((MAX_Y - START_Y) / HEIGHT) -static void PS_DrawThinkFrameStats(void) +static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook) { char s[100]; int i; - int maxpage = thinkframe_hooks_length/PAGE_ENTRIES + 1; + int maxpage = 0; int page = max(1, min(cv_ps_thinkframe_page.value, maxpage)); - - int pagestart = min((page - 1)*PAGE_ENTRIES, thinkframe_hooks_length); - int pageend = min(pagestart + PAGE_ENTRIES, thinkframe_hooks_length); + int pagestart = 0; + int pageend = 0; // text writing position int x = START_X; int y = START_Y; @@ -741,19 +825,41 @@ static void PS_DrawThinkFrameStats(void) last_mod_name[0] = '\0'; INT32 total = 0; + //Decide page length based and drawn text on choosen thinker type + if (cv_perfstats.value == 3){ + maxpage = thinkframe_hooks_length/PAGE_ENTRIES + 1; + pagestart = min((page - 1)*PAGE_ENTRIES, thinkframe_hooks_length); + pageend = min(pagestart + PAGE_ENTRIES, thinkframe_hooks_length); + + V_DrawSmallString(MAX_X-50, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "ThinkFrame"); + } + else if (cv_perfstats.value == 4){ + maxpage = prethinkframe_hooks_length/PAGE_ENTRIES + 1; + pagestart = min((page - 1)*PAGE_ENTRIES, prethinkframe_hooks_length); + pageend = min(pagestart + PAGE_ENTRIES, prethinkframe_hooks_length); + V_DrawSmallString(MAX_X-60, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "PreThinkFrame"); + } + else if (cv_perfstats.value == 5){ + maxpage = postthinkframe_hooks_length/PAGE_ENTRIES + 1; + pagestart = min((page - 1)*PAGE_ENTRIES, postthinkframe_hooks_length); + pageend = min(pagestart + PAGE_ENTRIES, postthinkframe_hooks_length); + V_DrawSmallString(MAX_X-65, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "PostThinkFrame"); + + } + PS_DrawDescriptorHeader(); - for (i = 0; i < thinkframe_hooks_length; i++) + for (i = 0; i < hook_length; i++) { #define NEXT_ROW() y += HEIGHT; - INT32 value = PS_GetMetricScreenValue(&thinkframe_hooks[i].time_taken, true); + INT32 value = PS_GetMetricScreenValue(&hook[i].time_taken, true); total += value; if (i < pagestart || i >= pageend) continue; - char* str = thinkframe_hooks[i].short_src; + char* str = hook[i].short_src; char* tempstr = tempbuffer; int len = (int)strlen(str); char* str_ptr; @@ -808,6 +914,8 @@ static void PS_DrawThinkFrameStats(void) snprintf(s, sizeof s - 1, "PAGE %d", page); V_DrawSmallString(START_X, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, s); } + + } void PS_ThinkFrame_Page_OnChange(void) @@ -828,6 +936,24 @@ void PS_ThinkFrame_Page_OnChange(void) #undef PAGE_ENTRIES + + +static void PS_DrawPreThinkFrameStats(void) +{ + draw_think_frame_stats(prethinkframe_hooks_length, prethinkframe_hooks); +} + +static void PS_DrawThinkFrameStats(void) +{ + draw_think_frame_stats(thinkframe_hooks_length, thinkframe_hooks); +} + +static void PS_DrawPostThinkFrameStats(void) +{ + draw_think_frame_stats(postthinkframe_hooks_length, postthinkframe_hooks); +} + + void M_DrawPerfStats(void) { if (cv_perfstats.value == 1) // rendering @@ -841,7 +967,7 @@ void M_DrawPerfStats(void) // tics when frame skips happen PS_DrawGameLogicStats(); } - else if (cv_perfstats.value == 3) // lua thinkframe + else if (cv_perfstats.value >= 3) // lua thinkframe { if (!PS_IsLevelActive()) return; @@ -850,13 +976,23 @@ void M_DrawPerfStats(void) // Low resolutions can't really use V_DrawSmallString that is used by thinkframe stats. // A low-res version using V_DrawThinString could be implemented, // but it would have much less space for information. - V_DrawThinString(80, 92, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, "Perfstats 3 is not available"); + V_DrawThinString(80, 92, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, "Lua Perfstats is not available"); V_DrawThinString(80, 100, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, "for resolutions below 640x400."); + return; } - else + if (cv_perfstats.value == 3) { PS_DrawThinkFrameStats(); } + else if (cv_perfstats.value == 4) + { + PS_DrawPreThinkFrameStats(); + } + else if (cv_perfstats.value == 5) + { + PS_DrawPostThinkFrameStats(); + } + } } @@ -867,10 +1003,18 @@ static void PS_ClearHistory(void) Z_FreeTags(PU_PERFSTATS, PU_PERFSTATS); // thinkframe hook metric history pointers need to be cleared manually + for (i = 0; i < prethinkframe_hooks_length; i++) + { + prethinkframe_hooks[i].time_taken.history = NULL; + } for (i = 0; i < thinkframe_hooks_length; i++) { thinkframe_hooks[i].time_taken.history = NULL; } + for (i = 0; i < postthinkframe_hooks_length; i++) + { + postthinkframe_hooks[i].time_taken.history = NULL; + } ps_frame_index = ps_tick_index = 0; // PS_UpdateMetricHistory will set these correctly when it runs diff --git a/src/m_perfstats.h b/src/m_perfstats.h index d9ce6d171..ade7efd33 100644 --- a/src/m_perfstats.h +++ b/src/m_perfstats.h @@ -44,12 +44,17 @@ extern ps_metric_t ps_thlist_times[]; extern ps_metric_t ps_checkposition_calls; +extern ps_metric_t ps_lua_prethinkframe_time; extern ps_metric_t ps_lua_thinkframe_time; +extern ps_metric_t ps_lua_postthinkframe_time; extern ps_metric_t ps_lua_mobjhooks; extern ps_metric_t ps_otherlogictime; +void PS_SetPreThinkFrameHookInfo(int index, precise_t time_taken, char* short_src); void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src); +void PS_SetPostThinkFrameHookInfo(int index, precise_t time_taken, char* short_src); + void PS_UpdateTickStats(void); diff --git a/src/p_tick.c b/src/p_tick.c index c3d12e77b..6bad0f856 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -662,7 +662,10 @@ void P_Ticker(boolean run) ps_checkposition_calls.value.i = 0; #ifdef HAVE_BLUA + PS_START_TIMING(ps_lua_prethinkframe_time); LUAh_PreThinkFrame(); + PS_STOP_TIMING(ps_lua_prethinkframe_time); + #endif PS_START_TIMING(ps_playerthink_time); @@ -823,7 +826,11 @@ void P_Ticker(boolean run) D_MapChange(gamemap, gametype, encoremode, true, 0, false, false); #ifdef HAVE_BLUA + + PS_START_TIMING(ps_lua_postthinkframe_time); LUAh_PostThinkFrame(); + PS_STOP_TIMING(ps_lua_postthinkframe_time); + #endif } -- 2.54.0 From 84cc8d10a73213617580bc4a287b0e9e8d0a61fd Mon Sep 17 00:00:00 2001 From: NepDisk Date: Sat, 18 Nov 2023 00:16:47 -0500 Subject: [PATCH 068/112] Quick bug fix for pages --- src/m_perfstats.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/m_perfstats.c b/src/m_perfstats.c index 937635536..04e51a657 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -813,7 +813,7 @@ static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook) char s[100]; int i; int maxpage = 0; - int page = max(1, min(cv_ps_thinkframe_page.value, maxpage)); + int page = 0; int pagestart = 0; int pageend = 0; // text writing position @@ -828,6 +828,7 @@ static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook) //Decide page length based and drawn text on choosen thinker type if (cv_perfstats.value == 3){ maxpage = thinkframe_hooks_length/PAGE_ENTRIES + 1; + page = max(1, min(cv_ps_thinkframe_page.value, maxpage)); pagestart = min((page - 1)*PAGE_ENTRIES, thinkframe_hooks_length); pageend = min(pagestart + PAGE_ENTRIES, thinkframe_hooks_length); @@ -835,12 +836,14 @@ static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook) } else if (cv_perfstats.value == 4){ maxpage = prethinkframe_hooks_length/PAGE_ENTRIES + 1; + page = max(1, min(cv_ps_thinkframe_page.value, maxpage)); pagestart = min((page - 1)*PAGE_ENTRIES, prethinkframe_hooks_length); pageend = min(pagestart + PAGE_ENTRIES, prethinkframe_hooks_length); V_DrawSmallString(MAX_X-60, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "PreThinkFrame"); } else if (cv_perfstats.value == 5){ maxpage = postthinkframe_hooks_length/PAGE_ENTRIES + 1; + page = max(1, min(cv_ps_thinkframe_page.value, maxpage)); pagestart = min((page - 1)*PAGE_ENTRIES, postthinkframe_hooks_length); pageend = min(pagestart + PAGE_ENTRIES, postthinkframe_hooks_length); V_DrawSmallString(MAX_X-65, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "PostThinkFrame"); -- 2.54.0 From e248b85380ddaa2b656f7747a9351cae81d4705c Mon Sep 17 00:00:00 2001 From: Indev Date: Sat, 18 Nov 2023 19:40:58 +0300 Subject: [PATCH 069/112] Apply translucenthud for the VIEWPOINT text --- src/st_stuff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 527f4e914..ac7eb9c41 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1971,8 +1971,8 @@ static void ST_overlayDrawer(void) strlcpy(name, player_names[stplyr-players], 13);*/ // Show name of player being displayed - V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, 0, M_GetText("VIEWPOINT:")); - V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_ALLOWLOWERCASE, player_names[stplyr-players]); + V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, V_HUDTRANS, M_GetText("VIEWPOINT:")); + V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_HUDTRANS|V_ALLOWLOWERCASE, player_names[stplyr-players]); } } else if (!demo.title) -- 2.54.0 From cf8ef69fed73e98c2c93406c5e3feff25cfef4fb Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 19 Nov 2023 00:51:27 +0100 Subject: [PATCH 070/112] fix an overflow crash in terminal lul could hold down the a key before and make the game crash from https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2206 --- src/sdl/i_system.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index a2eb279f8..a3813767c 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -666,6 +666,7 @@ void I_GetConsoleEvents(void) return; ev.type = ev_console; + ev.data1 = 0; if (read(STDIN_FILENO, &key, 1) == -1 || !key) return; @@ -692,7 +693,7 @@ void I_GetConsoleEvents(void) } else return; } - else + else if (tty_con.cursor < sizeof (tty_con.buffer)) { // push regular character ev.data1 = tty_con.buffer[tty_con.cursor] = key; -- 2.54.0 From 7ba146b4ff73ca85ece907917b4c7111e2e95b6b Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 5 Nov 2023 21:00:03 +0100 Subject: [PATCH 071/112] Improve file search performance on Linux and FreeBSD from: https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2198 --- src/filesrch.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/filesrch.c b/src/filesrch.c index d51ef9516..8a213670c 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -396,9 +396,19 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want // okay, now we actually want searchpath to incorporate d_name strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name); +#if defined(__linux__) || defined(__FreeBSD__) + if (dent->d_type == DT_UNKNOWN) + if (lstat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode)) + dent->d_type = DT_DIR; + + // Linux and FreeBSD has a special field for file type on dirent, so use that to speed up lookups. + // FIXME: should we also follow symlinks? + if (dent->d_type == DT_DIR && depthleft) +#else if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat ; // was the file (re)moved? can't stat it else if (S_ISDIR(fsstat.st_mode) && depthleft) +#endif { searchpathindex[--depthleft] = strlen(searchpath) + 1; dirhandle[depthleft] = opendir(searchpath); -- 2.54.0 From d77ccd0dfc757d4c1f41866ff54f1253db6072c0 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 19 Nov 2023 01:28:28 +0100 Subject: [PATCH 072/112] fixeur symlinks i hope --- src/filesrch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/filesrch.c b/src/filesrch.c index 8a213670c..2e54929bb 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -400,10 +400,13 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want if (dent->d_type == DT_UNKNOWN) if (lstat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode)) dent->d_type = DT_DIR; + else if (lstat(searchpath,&fsstat) == 0 && S_ISLNK(fsstat.st_mode)) + dent->d_type = DT_LNK; + // Linux and FreeBSD has a special field for file type on dirent, so use that to speed up lookups. // FIXME: should we also follow symlinks? - if (dent->d_type == DT_DIR && depthleft) + if ((dent->d_type == DT_DIR && depthleft) || (dent->d_type == DT_LNK && depthleft)) #else if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat ; // was the file (re)moved? can't stat it -- 2.54.0 From 38c612a752aa084f4df989a0e47485f666e4064b Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 19 Nov 2023 02:27:42 +0100 Subject: [PATCH 073/112] add "find" command to search for for cvars its better than "help", more organized and it shows any variable containing what you searched for from https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2217 --- src/command.c | 101 ++++++++++++++++++++++++++++++++++++++------------ src/console.c | 18 ++------- 2 files changed, 81 insertions(+), 38 deletions(-) diff --git a/src/command.c b/src/command.c index 2a9c40227..165cbb584 100644 --- a/src/command.c +++ b/src/command.c @@ -49,6 +49,7 @@ static void COM_CEchoDuration_f(void); static void COM_Exec_f(void); static void COM_Wait_f(void); static void COM_Help_f(void); +static void COM_Find_f(void); static void COM_Toggle_f(void); static void COM_Add_f(void); @@ -299,6 +300,7 @@ void COM_Init(void) COM_AddCommand("exec", COM_Exec_f); COM_AddCommand("wait", COM_Wait_f); COM_AddCommand("help", COM_Help_f); + COM_AddCommand("find", COM_Find_f); COM_AddCommand("toggle", COM_Toggle_f); COM_AddCommand("add", COM_Add_f); RegisterNetXCmd(XD_NETVAR, Got_NetVar); @@ -820,7 +822,7 @@ static void COM_Help_f(void) if (cvar) { CONS_Printf("\x82""Variable %s:\n", cvar->name); - CONS_Printf(M_GetText(" flags :")); + CONS_Printf(M_GetText(" flags: ")); if (cvar->flags & CV_SAVE) CONS_Printf("AUTOSAVE "); if (cvar->flags & CV_FLOAT) @@ -874,30 +876,9 @@ static void COM_Help_f(void) return; } - CONS_Printf("No exact match, searching...\n"); - // commands - CONS_Printf("\x82""Commands:\n"); - for (cmd = com_commands; cmd; cmd = cmd->next) - { - if (!strstr(cmd->name, help)) - continue; - CONS_Printf("%s ",cmd->name); - i++; - } + CONS_Printf("No variable or command named %s", help); + CONS_Printf("\x82""\nCheck wiki.srb2.org for more or try typing help without arguments\n"); - // variables - CONS_Printf("\x82""\nVariables:\n"); - for (cvar = consvar_vars; cvar; cvar = cvar->next) - { - if ((cvar->flags & CV_NOSHOWHELP) || (!strstr(cvar->name, help))) - continue; - CONS_Printf("%s ", cvar->name); - i++; - } - - CONS_Printf("\x82""\nCheck wiki.srb2.org for more or type help \n"); - - CONS_Debug(DBG_GAMELOGIC, "\x87Total : %d\n", i); } return; } @@ -927,6 +908,78 @@ static void COM_Help_f(void) } } + +static void COM_Find_f(void) +{ + static char prefix[80]; + xcommand_t *cmd; + consvar_t *cvar; + cmdalias_t *alias; + const char *match; + const char *help; + size_t helplen; + boolean matchesany; + + if (COM_Argc() != 2) + { + CONS_Printf(M_GetText("find : Search for variables, commands and aliases containing \n")); + return; + } + + help = COM_Argv(1); + helplen = strlen(help); + CONS_Printf("\x82""Variables:\n"); + matchesany = false; + for (cvar = consvar_vars; cvar; cvar = cvar->next) + { + if (cvar->flags & CV_NOSHOWHELP) + continue; + match = strstr(cvar->name, help); + if (match != NULL) + { + memcpy(prefix, cvar->name, match - cvar->name); + prefix[match - cvar->name] = '\0'; + CONS_Printf(" %s\x83%s\x80%s\n", prefix, help, &match[helplen]); + matchesany = true; + } + } + if (!matchesany) + CONS_Printf(" (none)\n"); + + CONS_Printf("\x82""Commands:\n"); + matchesany = false; + for (cmd = com_commands; cmd; cmd = cmd->next) + { + match = strstr(cmd->name, help); + if (match != NULL) + { + memcpy(prefix, cmd->name, match - cmd->name); + prefix[match - cmd->name] = '\0'; + CONS_Printf(" %s\x83%s\x80%s\n", prefix, help, &match[helplen]); + matchesany = true; + } + } + if (!matchesany) + CONS_Printf(" (none)\n"); + + CONS_Printf("\x82""Aliases:\n"); + matchesany = false; + for (alias = com_alias; alias; alias = alias->next) + { + match = strstr(alias->name, help); + if (match != NULL) + { + memcpy(prefix, alias->name, match - alias->name); + prefix[match - alias->name] = '\0'; + CONS_Printf(" %s\x83%s\x80%s\n", prefix, help, &match[helplen]); + matchesany = true; + } + } + if (!matchesany) + CONS_Printf(" (none)\n"); +} + + /** Toggles a console variable. Useful for on/off values. * * This works on on/off, yes/no values only diff --git a/src/console.c b/src/console.c index 21c9eb695..73eac9ff9 100644 --- a/src/console.c +++ b/src/console.c @@ -869,7 +869,9 @@ boolean CON_Responder(event_t *ev) static UINT8 consdown = false; // console is treated differently due to rare usage // sequential completions a la 4dos - static char completion[80]; + static char completioncmd[80 + sizeof("find ")] = "find "; + static char *completion = &completioncmd[sizeof("find ")-1]; + static INT32 comskips, varskips; const char *cmd = ""; @@ -948,7 +950,6 @@ boolean CON_Responder(event_t *ev) // show all cvars/commands that match what we have inputted if (key == KEY_TAB) { - size_t i, len; if (!completion[0]) { @@ -957,19 +958,8 @@ boolean CON_Responder(event_t *ev) strcpy(completion, inputlines[inputline]); comskips = varskips = 0; } - len = strlen(completion); - //first check commands - CONS_Printf("\nCommands:\n"); - for (i = 0, cmd = COM_CompleteCommand(completion, i); cmd; cmd = COM_CompleteCommand(completion, ++i)) - CONS_Printf(" \x83" "%s" "\x80" "%s\n", completion, cmd+len); - if (i == 0) CONS_Printf(" (none)\n"); - - //now we move on to CVARs - CONS_Printf("Variables:\n"); - for (i = 0, cmd = CV_CompleteVar(completion, i); cmd; cmd = CV_CompleteVar(completion, ++i)) - CONS_Printf(" \x83" "%s" "\x80" "%s\n", completion, cmd+len); - if (i == 0) CONS_Printf(" (none)\n"); + COM_BufInsertText(completioncmd); return true; } -- 2.54.0 From f346f075ee47cb0248bd99cdefdeae9f85c8e732 Mon Sep 17 00:00:00 2001 From: hayaunderscore Date: Sun, 19 Nov 2023 13:05:51 +0800 Subject: [PATCH 074/112] Fix localskin options not being available for server admins --- src/m_menu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 8fc8b91d1..9759d4f28 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4068,8 +4068,11 @@ void M_StartControlPanel(void) { MPauseMenu[mpause_switchmap].status = IT_STRING | IT_CALL; MPauseMenu[mpause_addons].status = IT_STRING | IT_CALL; - MPauseMenu[mpause_addlocalskins].status = IT_DISABLED; - MPauseMenu[mpause_localskin].status = IT_DISABLED; + if (!IsPlayerAdmin(consoleplayer)) + { + MPauseMenu[mpause_addlocalskins].status = IT_DISABLED; + MPauseMenu[mpause_localskin].status = IT_DISABLED; + } if (G_GametypeHasTeams()) MPauseMenu[mpause_scramble].status = IT_STRING | IT_SUBMENU; } -- 2.54.0 From 7d66da2b94d64ee4fb622cc587c86a64dd8e2904 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sun, 19 Nov 2023 06:43:29 +0100 Subject: [PATCH 075/112] lol --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 9759d4f28..ca4d16bd2 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1971,7 +1971,7 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Higher Resolution Portraits", &cv_highresportrait, 40}, {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 45}, {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 50}, - {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 56}, + {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 55}, {IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 60}, {IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 65}, {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 70}, -- 2.54.0 From bf2c786a02c8e7cd19719253b40339a8e6db4083 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 19 Nov 2023 08:02:13 +0100 Subject: [PATCH 076/112] make pause menu look more like vanilla now that some things get disabled I HATE MENU CODE AAAAAAAAAAAAa --- src/m_menu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index ca4d16bd2..6f1d92835 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4051,7 +4051,7 @@ void M_StartControlPanel(void) // Reset these in case splitscreen messes things up MPauseMenu[mpause_addons].alphaKey = 8; - MPauseMenu[mpause_addlocalskins].alphaKey = 16; + MPauseMenu[mpause_addlocalskins].alphaKey = 8; MPauseMenu[mpause_scramble].alphaKey = 8; MPauseMenu[mpause_switchmap].alphaKey = 24; @@ -4068,11 +4068,17 @@ void M_StartControlPanel(void) { MPauseMenu[mpause_switchmap].status = IT_STRING | IT_CALL; MPauseMenu[mpause_addons].status = IT_STRING | IT_CALL; + if (!IsPlayerAdmin(consoleplayer)) { MPauseMenu[mpause_addlocalskins].status = IT_DISABLED; MPauseMenu[mpause_localskin].status = IT_DISABLED; + + MPauseMenu[mpause_options].alphaKey = 64; + MPauseMenu[mpause_title].alphaKey = 80; + MPauseMenu[mpause_quit].alphaKey = 88; } + if (G_GametypeHasTeams()) MPauseMenu[mpause_scramble].status = IT_STRING | IT_SUBMENU; } -- 2.54.0 From bb9f7c81966acbf101c1d3e421b7d9f291be167a Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 19 Nov 2023 08:46:34 +0100 Subject: [PATCH 077/112] also hide the other localskin menu in option menu when youre server --- src/m_menu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index 6f1d92835..bb5d56935 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7605,6 +7605,8 @@ static void M_Options(INT32 choice) OP_MainDef.prevMenu = currentMenu; M_SetupNextMenu(&OP_MainDef); + + OP_MainMenu[11].status = (Playing() &&(server &&(!IsPlayerAdmin(consoleplayer)))) ? (IT_DISABLED) : (IT_CALL|IT_STRING); } static void M_Manual(INT32 choice) -- 2.54.0 From d06f923066b94f9fb71aeaa681bb8e0d068213b7 Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 20 Nov 2023 16:10:02 +0300 Subject: [PATCH 078/112] Fix filesearch trying to open file symlinks as directory --- src/filesrch.c | 8 +++++++- src/w_wad.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/filesrch.c b/src/filesrch.c index 2e54929bb..e493f8786 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -401,8 +401,14 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want if (lstat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode)) dent->d_type = DT_DIR; else if (lstat(searchpath,&fsstat) == 0 && S_ISLNK(fsstat.st_mode)) - dent->d_type = DT_LNK; + dent->d_type = DT_LNK; + // Symlinks aren't always directory symlinks. Dunno if this would resolve recursive + // symlinks, but i think stat already does that + if (dent->d_type == DT_LNK && stat(searchpath,&fsstat) == 0 && !S_ISDIR(fsstat.st_mode)) + { + dent->d_type = DT_UNKNOWN; + } // Linux and FreeBSD has a special field for file type on dirent, so use that to speed up lookups. // FIXME: should we also follow symlinks? diff --git a/src/w_wad.c b/src/w_wad.c index 0914ec963..950b80d9a 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -202,7 +202,7 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors) // If findfile finds the file, the full path will be returned // in filenamebuf == *filename. - if (findfile(filenamebuf, NULL, true)) + if (findfile(filenamebuf, NULL, true) == FS_FOUND) { if ((handle = fopen_utf8(*filename, "rb")) == NULL) { -- 2.54.0 From 02cd4e753dd4c8873844f04235f90105d5051a9b Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Mon, 20 Nov 2023 22:40:41 +0100 Subject: [PATCH 079/112] make software horizonlines also extend fofs --- src/r_segs.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index f897a8b01..0c4e1d763 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2653,8 +2653,22 @@ void R_StoreWallRange(INT32 start, INT32 stop) { ffloor[i].f_pos >>= 4; ffloor[i].f_pos_slope >>= 4; - ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); - ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(range); + if (linedef->special == 41) // Horizon lines extend FOFs in contact with them too. + { + ffloor[i].f_step = 0; + ffloor[i].f_frac = (centeryfrac>>4); + topfrac++; // Prevent 1px HOM + } + else + { +#ifdef ESLOPE + ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); + ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(range); +#else + ffloor[i].f_step = FixedMul(-rw_scalestep, ffloor[i].f_pos); + ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); +#endif + } } } -- 2.54.0 From e49e6b899876c3411c64444c775629ef659393ac Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 21 Nov 2023 17:02:10 +0100 Subject: [PATCH 080/112] toggle for playing music while paused --- src/d_netcmd.c | 2 +- src/g_game.c | 2 +- src/s_sound.c | 3 +++ src/s_sound.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ec2b71271..f9b4dcddd 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3085,7 +3085,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum) if (paused) { - if (!menuactive || netgame) + if ((!menuactive || netgame) && (!cv_pausemusic.value)) S_PauseAudio(); } else diff --git a/src/g_game.c b/src/g_game.c index 2a482bfaa..6f7bce1cd 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1965,7 +1965,7 @@ boolean G_Responder(event_t *ev) paused = true; S_PauseAudio(); } - else if (paused) + else if ((paused) && (!cv_pausemusic.value)) S_PauseAudio(); else S_ResumeAudio(); diff --git a/src/s_sound.c b/src/s_sound.c index 30e40c7e0..bbbd7a6d3 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -96,6 +96,8 @@ consvar_t cv_gamesounds = {"sounds", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, consvar_t cv_playmusicifunfocused = {"playmusicifunfocused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playsoundifunfocused = {"playsoundsifunfocused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_pausemusic = {"playmusicifpaused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; + static CV_PossibleValue_t music_resync_threshold_cons_t[] = { {0, "MIN"}, {1000, "MAX"}, @@ -272,6 +274,7 @@ void S_RegisterSoundStuff(void) CV_RegisterVar(&cv_playmusicifunfocused); CV_RegisterVar(&cv_playsoundifunfocused); + CV_RegisterVar(&cv_pausemusic); CV_RegisterVar(&cv_music_resync_threshold); CV_RegisterVar(&cv_music_resync_powerups_only); diff --git a/src/s_sound.h b/src/s_sound.h index bc1a73563..19ce89037 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -42,6 +42,7 @@ extern consvar_t cv_gamemidimusic; extern consvar_t cv_gamesounds; extern consvar_t cv_playmusicifunfocused; extern consvar_t cv_playsoundifunfocused; +extern consvar_t cv_pausemusic; #ifdef HAVE_OPENMPT extern consvar_t cv_modfilter; -- 2.54.0 From cbd59a04f62368867e71ccb70f6658db30a49efe Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 21 Nov 2023 17:34:07 +0100 Subject: [PATCH 081/112] toggle for localskin menus well wanna be able to toggle things --- src/d_netcmd.c | 4 ++++ src/d_netcmd.h | 1 + src/m_menu.c | 26 +++++++++++++++----------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f9b4dcddd..51f0aad22 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -295,6 +295,8 @@ consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Sk // haha I've beaten you now, ONLINE consvar_t cv_localskin = {"internal___localskin", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_showlocalskinmenus = {"showlocalskinmenus", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; + consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; INT32 cv_debug; @@ -970,6 +972,8 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_luaimmersion); CV_RegisterVar(&cv_fakelocalskin); + + CV_RegisterVar(&cv_showlocalskinmenus); //CV_RegisterVar(&cv_crosshair); //CV_RegisterVar(&cv_crosshair2); diff --git a/src/d_netcmd.h b/src/d_netcmd.h index e21fdbb6f..d6274573a 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -166,6 +166,7 @@ extern consvar_t cv_showlapemblem; extern consvar_t cv_showviewpointtext; extern consvar_t cv_luaimmersion; extern consvar_t cv_fakelocalskin; +extern consvar_t cv_showlocalskinmenus; extern consvar_t cv_skipmapcheck; diff --git a/src/m_menu.c b/src/m_menu.c index bb5d56935..3b3c67e8c 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4048,6 +4048,9 @@ void M_StartControlPanel(void) MPauseMenu[mpause_psetup].status = IT_DISABLED; MISC_ChangeTeamMenu[0].status = IT_DISABLED; MISC_ChangeSpectateMenu[0].status = IT_DISABLED; + + MPauseMenu[mpause_addlocalskins].status = IT_STRING | IT_CALL; + MPauseMenu[mpause_localskin].status = IT_STRING | IT_CALL; // Reset these in case splitscreen messes things up MPauseMenu[mpause_addons].alphaKey = 8; @@ -4069,19 +4072,20 @@ void M_StartControlPanel(void) MPauseMenu[mpause_switchmap].status = IT_STRING | IT_CALL; MPauseMenu[mpause_addons].status = IT_STRING | IT_CALL; - if (!IsPlayerAdmin(consoleplayer)) - { - MPauseMenu[mpause_addlocalskins].status = IT_DISABLED; - MPauseMenu[mpause_localskin].status = IT_DISABLED; - - MPauseMenu[mpause_options].alphaKey = 64; - MPauseMenu[mpause_title].alphaKey = 80; - MPauseMenu[mpause_quit].alphaKey = 88; - } - if (G_GametypeHasTeams()) MPauseMenu[mpause_scramble].status = IT_STRING | IT_SUBMENU; } + + if (server || (!cv_showlocalskinmenus.value)) + { + MPauseMenu[mpause_addlocalskins].status = IT_DISABLED; + MPauseMenu[mpause_localskin].status = IT_DISABLED; + + MPauseMenu[mpause_options].alphaKey = 64; + MPauseMenu[mpause_title].alphaKey = 80; + MPauseMenu[mpause_quit].alphaKey = 88; + } + if (splitscreen) { @@ -7606,7 +7610,7 @@ static void M_Options(INT32 choice) OP_MainDef.prevMenu = currentMenu; M_SetupNextMenu(&OP_MainDef); - OP_MainMenu[11].status = (Playing() &&(server &&(!IsPlayerAdmin(consoleplayer)))) ? (IT_DISABLED) : (IT_CALL|IT_STRING); + OP_MainMenu[11].status = ((Playing() &&(server &&(!IsPlayerAdmin(consoleplayer)))) || (!cv_showlocalskinmenus.value)) ? (IT_DISABLED) : (IT_CALL|IT_STRING); } static void M_Manual(INT32 choice) -- 2.54.0 From ab8d3e2642a924799ad6b264f36b9f354ee34c15 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Tue, 21 Nov 2023 13:29:35 -0500 Subject: [PATCH 082/112] Change default offset so stat display doesn't go over mr --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 387979682..52dd3816a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7665,7 +7665,7 @@ static void K_drawKartStats(void) spdoffset = 0; // Customizations c: - x += cv_stat_xoffset.value; + x += 18 + cv_stat_xoffset.value; y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset; flags |= V_HUDTRANS; -- 2.54.0 From 095ec063fbdee8cc5f24f34555a55a93e843abc2 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 21 Nov 2023 22:22:03 +0100 Subject: [PATCH 083/112] spriteoffsets should be 0 + a little more oraganized --- src/p_saveg.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 64153a279..530a0834c 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1976,14 +1976,20 @@ static void LoadMobjThinker(actionf_p1 thinker) mobj->thinker.function.acp1 = thinker; mobj->rollangle = 0; - mobj->spritexoffset = mobj->spriteyoffset = mobj->old_spritexoffset = mobj->old_spriteyoffset = FRACUNIT; - mobj->spritexscale = mobj->spriteyscale = mobj->old_spritexscale = mobj->old_spriteyscale = FRACUNIT; - mobj->realxscale = mobj->realyscale = FRACUNIT; + mobj->sloperoll = 0; + mobj->reservexydir = 0; + mobj->reservezangle = 0; + + mobj->spritexoffset = mobj->old_spritexoffset = 0; + mobj->spriteyoffset = mobj->old_spriteyoffset = 0; + mobj->spritexscale = mobj->old_spritexscale = FRACUNIT; + mobj->spriteyscale = mobj->old_spriteyscale = FRACUNIT; + mobj->realxscale = FRACUNIT; + mobj->realyscale = FRACUNIT; + mobj->stretchslam = 0; mobj->slamsoundtimer = 0; - mobj->sloperoll = mobj->reservezangle = mobj->reservexydir = 0; - mobj->z = z; mobj->floorz = floorz; mobj->ceilingz = ceilingz; -- 2.54.0 From 2d25fabe64cafb1793462c2b92dada97d5068f0d Mon Sep 17 00:00:00 2001 From: Indev Date: Wed, 22 Nov 2023 01:48:41 +0300 Subject: [PATCH 084/112] Fix few missing packet type names in d_net.c --- src/d_clisrv.c | 2 +- src/d_net.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index c3dba1690..ee554eabc 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5391,7 +5391,7 @@ static void HandlePacketFromPlayer(SINT8 node) } else { - DEBFILE(va("frame not in bound: %u\n", neededtic)); + DEBFILE(va("frame not in bound: %u (bounds are from %u to %u)\n", neededtic, realstart, realend)); /*if (realend < neededtic - 2 * TICRATE || neededtic + 2 * TICRATE < realstart) I_Error("Received an out of order PT_SERVERTICS packet!\n" "Got tics %d-%d, needed tic %d\n\n" diff --git a/src/d_net.c b/src/d_net.c index 08e9f1610..b0bb637c4 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -831,6 +831,10 @@ static const char *packettypename[NUMPACKETTYPE] = "CLIENTJOIN", "NODETIMEOUT", "RESYNCHING", + + "TELLFILESNEEDED", + "MOREFILESNEEDED", + "PING" }; -- 2.54.0 From 1d40c26fd92bcf919d6f7d8fd19333168be630a7 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 22 Nov 2023 06:47:42 +0100 Subject: [PATCH 085/112] make players snap when looking back and using sloperoll always looked a bit weird tbh --- src/k_kart.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 52dd3816a..63c0a3445 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3240,7 +3240,6 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes lookAngle = R_PointToAngle2(camera[pNum].x, camera[pNum].y, p->mo->x, p->mo->y); - if (!R_PointToDist(p->mo->x, p->mo->y)) lookAngle = p->mo->angle; @@ -3266,7 +3265,11 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes an = (lookAngle - xydirection); final_slope = -(FixedMul(FINESINE(an>>ANGLETOFINESHIFT), zangle)); - an = (INT32)(final_slope - p->tilt_sprite) / 3; // instead of just a direct snap + + if (camspin) + an = (INT32)(final_slope - p->tilt_sprite); // do a direct snap + else + an = (INT32)(final_slope - p->tilt_sprite) / 3; // instead of just a direct snap if (an) p->tilt_sprite += an; -- 2.54.0 From 429976faf81af32d8498563ff55f0c74238b6bf0 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 22 Nov 2023 08:27:16 +0100 Subject: [PATCH 086/112] a --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 63c0a3445..fe8fa6d29 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3266,7 +3266,7 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes an = (lookAngle - xydirection); final_slope = -(FixedMul(FINESINE(an>>ANGLETOFINESHIFT), zangle)); - if (camspin) + if (camspin[pNum]) an = (INT32)(final_slope - p->tilt_sprite); // do a direct snap else an = (INT32)(final_slope - p->tilt_sprite) / 3; // instead of just a direct snap -- 2.54.0 From 3adad0ed18e07363f1e3f710e1a9b3b2602361d5 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Sun, 19 Nov 2023 09:14:10 -0500 Subject: [PATCH 087/112] Add Saturn peeps to credits :D --- src/f_finale.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 1b5310e01..2d9a45e8c 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -520,6 +520,19 @@ static const char *credits[] = { "Karol \"Fooruman\" D""\x1E""browski", // DÄ…browski, accents in srb2 :ytho: "\"Virt\"", "", + "\1Saturn", + "\"Alufolie91\" aka \"Alug\"", + "\"Indev\"", + "\"Haya\"", + "\"NepDisk\"", + "\"Xyzzy\"", + " ", + "\"Sunflower\" aka \"AnimeSonic\"", + "\"Yuz\" aka \"Yuzler\"", + "\"Democrab\"", + "\"Expand\" aka \"Maver\"", + "\"Nexit\"", + "", "\1Special Thanks", "SEGA", "Sonic Team", @@ -559,10 +572,11 @@ static struct { {224, 80+(216*13), "K_ITMINE", SKINCOLOR_BRONZE}, {224, 80+(216*14), "K_ITTHNS", SKINCOLOR_RASPBERRY}, {224, 80+(216*15), "K_ITINV1", SKINCOLOR_GREY}, + {224, 80+(216*16), "K_ITSINK", SKINCOLOR_PINETREE}, // This Tyler52 gag is troublesome // Alignment should be ((spaces+1 * 100) + (headers+1 * 38) + (lines * 15)) // Current max image spacing: (216*17) - {112, (16*100)+(19*38)+(103*15), "TYLER52", SKINCOLOR_NONE}, + {112, (17*100)+(20*38)+(114*15), "TYLER52", SKINCOLOR_NONE}, {0, 0, NULL, SKINCOLOR_NONE} }; @@ -596,6 +610,7 @@ void F_StartCredits(void) timetonext = 2*TICRATE; } + void F_CreditDrawer(void) { UINT16 i; @@ -925,7 +940,6 @@ void F_GameEndTicker(void) D_StartTitle(); } - // ============== // TITLE SCREEN // ============== @@ -988,7 +1002,7 @@ void F_TitleScreenDrawer(void) else { INT32 transval = 0; - + if (finalecount <= (50+(9<<1))) transval = (finalecount - 50)>>1; -- 2.54.0 From f62642f8559d89c2d3ae7276179703e7fcd430f6 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 22 Nov 2023 20:54:19 +0100 Subject: [PATCH 088/112] your hudcolor choice should overwrite everything else also "fixes" the splitscreen issue thats been mentioned, now whichever hudcolor you choose gets applied, regardless of splitscreen or if you sswitch viewpoints --- src/k_kart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index fe8fa6d29..e199fd01c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -595,11 +595,11 @@ UINT8 K_GetKartColorByName(const char *name) } UINT8 K_GetHudColor(void) -{ - if (stplyr && players - stplyr != consoleplayer) return stplyr->skincolor; +{ if (cv_colorizedhud.value){ if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value; } + if (stplyr && P_IsLocalPlayer(stplyr)) return stplyr->skincolor; return (stplyr ? stplyr->skincolor : cv_playercolor.value); } -- 2.54.0 From f99e516e630b4b8e82d90af066a1baf68f697b97 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Wed, 22 Nov 2023 23:00:34 -0500 Subject: [PATCH 089/112] SkinSearch command. --- src/d_netcmd.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 51f0aad22..5a23cbed0 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -195,6 +195,8 @@ static void Command_Isgamemodified_f(void); static void Command_Cheats_f(void); static void Command_ListSkins(void); +static void Command_SkinSearch(void); + #ifdef _DEBUG static void Command_Togglemodified_f(void); @@ -1165,6 +1167,7 @@ void D_RegisterClientCommands(void) #endif COM_AddCommand("listskins", Command_ListSkins); + COM_AddCommand("skinsearch", Command_SkinSearch); } /** @@ -6067,6 +6070,36 @@ static void Command_ListSkins(void) } } +static void Command_SkinSearch(void) +{ + size_t i; + UINT16 s; + UINT16 ic = 0; + //skin_t *skininput = &skins[s]; + for (i = 1; i < COM_Argc(); i++){ + for( s = 0 ; s < numallskins ; s++ ) + { + skin_t *skininput = &skins[s]; + if (strcasestr(skininput->realname,COM_Argv(i))) + { + ic++; + CONS_Printf("%d. %s%s:\x80 %s\n", ic,HU_SkinColorToConsoleColor(skininput->prefcolor),skininput->realname,skininput->name); + } + } + } + CONS_Printf("Total %d skins.\n", ic); +} + +/* +static void COM_Echo_f(void) +{ + size_t i; + + for (i = 1; i < COM_Argc(); i++) + CONS_Printf("%s ", COM_Argv(i)); + CONS_Printf("\n"); +}*/ + /** Sends a color change for the console player, unless that player is moving. * \sa cv_playercolor, Color2_OnChange, Skin_OnChange * \author Graue -- 2.54.0 From 03fb7fd1451ded1291cea323982de5c98367bd32 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Thu, 23 Nov 2023 00:05:39 -0500 Subject: [PATCH 090/112] Oops forgot to remove this --- src/d_netcmd.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 5a23cbed0..8ddbdabb0 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -6090,16 +6090,6 @@ static void Command_SkinSearch(void) CONS_Printf("Total %d skins.\n", ic); } -/* -static void COM_Echo_f(void) -{ - size_t i; - - for (i = 1; i < COM_Argc(); i++) - CONS_Printf("%s ", COM_Argv(i)); - CONS_Printf("\n"); -}*/ - /** Sends a color change for the console player, unless that player is moving. * \sa cv_playercolor, Color2_OnChange, Skin_OnChange * \author Graue -- 2.54.0 From 0b59c156a0cb19f8a05a40a36aea5965afc399af Mon Sep 17 00:00:00 2001 From: NepDisk Date: Thu, 23 Nov 2023 00:10:17 -0500 Subject: [PATCH 091/112] Merge branch 'cleanedupcharpicker' into stacking-dev Merge the new character select menu I created --- src/d_main.c | 7 ++ src/d_main.h | 2 + src/d_netcmd.c | 4 +- src/d_netcmd.h | 3 +- src/m_menu.c | 231 +++++++++++++++++++++++++++++++++++++++++++------ src/r_things.c | 1 + 6 files changed, 220 insertions(+), 28 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 0c77b9557..f4de2d32a 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -920,6 +920,7 @@ boolean clr_hud; // colour hud check boolean big_lap; // bigger lap counter boolean big_lap_color; // bigger lap counter but colour boolean kartzspeedo; // kartZ speedometer +boolean statdp; // New stat static void IdentifyVersion(void) { @@ -1301,6 +1302,12 @@ void D_SRB2Main(void) "K_KZSP13", "K_KZSP14", "K_KZSP15", "K_KZSP16", "K_KZSP17", "K_KZSP18", "K_KZSP19", \ "K_KZSP20", "K_KZSP21", "K_KZSP22", "K_KZSP23", "K_KZSP24", "K_KZSP25", NULL)) kartzspeedo = true; + + + // new stat + if (W_CheckMultipleLumps("K_STATNB", "K_STATN1", "K_STATN2", "K_STATN3", "K_STATN4", \ + "K_STATN5", "K_STATN6", NULL)) + statdp = true; } // diff --git a/src/d_main.h b/src/d_main.h index d342cd13d..6924b666c 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -33,6 +33,8 @@ extern boolean clr_hud; // colour hud check extern boolean big_lap; // bigger lap counter extern boolean big_lap_color; //bigger lap counter but colour extern boolean kartzspeedo; //kartZ speedo +extern boolean statdp; //kartZ speedo + // the infinite loop of D_SRB2Loop() called from win_main for windows version void D_SRB2Loop(void) FUNCNORETURN; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 8ddbdabb0..67b875617 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -529,8 +529,8 @@ consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_ consvar_t cv_showtrackaddon = {"showtrackaddon", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t skinselectmenu_t[] = {{SKINMENUTYPE_SCROLL, "Scroll"}, {SKINMENUTYPE_2D, "2d"}, {SKINMENUTYPE_GRID, "Grid"}, {0, NULL}}; -consvar_t cv_skinselectmenu = {"skinselectmenu", "Grid", CV_SAVE, skinselectmenu_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t skinselectmenu_t[] = {{SKINMENUTYPE_SCROLL, "Scroll"}, {SKINMENUTYPE_2D, "2d"}, {SKINMENUTYPE_GRID, "Grid"}, {SKINMENUTYPE_EXTENDED, "Extended"}, {0, NULL}}; +consvar_t cv_skinselectmenu = {"skinselectmenu", "Extended", CV_SAVE, skinselectmenu_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t skinselectgridsort_t[] ={ { SKINMENUSORT_REALNAME, "Real name" }, diff --git a/src/d_netcmd.h b/src/d_netcmd.h index d6274573a..0f44840d8 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -186,7 +186,8 @@ typedef enum { SKINMENUTYPE_SCROLL = 0, SKINMENUTYPE_2D, // 1 - SKINMENUTYPE_GRID // 2 + SKINMENUTYPE_GRID, // 2 + SKINMENUTYPE_EXTENDED // 3 } skinmenutype_t; typedef enum diff --git a/src/m_menu.c b/src/m_menu.c index 3b3c67e8c..f6dd2f823 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1096,7 +1096,7 @@ static menuitem_t MP_OfflineServerMenu[] = {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 130}, }; - +//Char select static menuitem_t MP_PlayerSetupMenu[] = { {IT_KEYHANDLER | IT_STRING, NULL, "Name", M_HandleSetupMultiPlayer, 0}, @@ -1104,6 +1104,9 @@ static menuitem_t MP_PlayerSetupMenu[] = {IT_KEYHANDLER | IT_STRING, NULL, "Color", M_HandleSetupMultiPlayer, 152}, }; + + + #ifndef NONET static menuitem_t MP_ConnectMenu[] = { @@ -10934,6 +10937,9 @@ static boolean setupm_skinlockedselect; #define SKINGRIDWIDTH 8 #define SKINGRIDHEIGHT 6 +#define SKINGRIDNEWWIDTH 8 +#define SKINGRIDNEWHEIGHT 9 + static char *sortNames[] = { "Name", "Internal name", @@ -10975,9 +10981,12 @@ static void M_DrawSetupMultiPlayerMenu(void) // use generic drawer for cursor, items and title M_DrawGenericMenu(); - // draw name string + // Offsets switch (cv_skinselectmenu.value) { + case SKINMENUTYPE_EXTENDED: + nameboxaddy = 6; + break; case SKINMENUTYPE_GRID: nameboxaddy = 6; break; @@ -10986,6 +10995,8 @@ static void M_DrawSetupMultiPlayerMenu(void) break; } + + M_DrawTextBox(mx + 32, my - 8 + nameboxaddy, MAXPLAYERNAME, 1); V_DrawString(mx + 40, my + nameboxaddy, V_ALLOWLOWERCASE, setupm_name); @@ -10997,6 +11008,32 @@ static void M_DrawSetupMultiPlayerMenu(void) st = V_StringWidth(skins[setupm_fakeskin].realname, 0); switch (cv_skinselectmenu.value) { + case SKINMENUTYPE_EXTENDED: +#define GETSELECTEDSKINNAME (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].realname : skins[setupm_fakeskin].realname) +#define GETSELECTEDSPEED (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartspeed : skins[setupm_fakeskin].kartspeed) +#define GETSELECTEDWEIGHT (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartweight : skins[setupm_fakeskin].kartweight) + + int statoffset = 0; + tw = V_StringWidth("Character", 0);//V_StringWidth(GETSELECTEDSKINNAME, 0); + st = V_StringWidth(GETSELECTEDSKINNAME, 0); + + INT32 selectedskin = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin); + speed = skins[selectedskin].kartspeed; + weight = skins[selectedskin].kartweight; + + V_DrawString((mx+(tw/2)) - (st/2), my + 37, + ((MP_PlayerSetupMenu[2].status & IT_TYPE) == IT_SPACE ? V_TRANSLUCENT : 0) | highlightflags | V_ALLOWLOWERCASE, + GETSELECTEDSKINNAME); + if (statdp == true) + statoffset = 50; + else + statoffset = 113; + + V_DrawString(statx - statoffset, staty - 10, V_6WIDTHSPACE, va("\x84%dS \x87%dW", GETSELECTEDSPEED, GETSELECTEDWEIGHT)); +#undef GETSELECTEDSKINNAME +#undef GETSELECTEDSPEED +#undef GETSELECTEDWEIGHT + break; case SKINMENUTYPE_GRID: #define GETSELECTEDSKINNAME (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].realname : skins[setupm_fakeskin].realname) tw = V_StringWidth("Character", 0);//V_StringWidth(GETSELECTEDSKINNAME, 0); @@ -11047,6 +11084,16 @@ static void M_DrawSetupMultiPlayerMenu(void) st = V_StringWidth(KartColor_Names[setupm_fakecolor], 0); switch (cv_skinselectmenu.value) { + case SKINMENUTYPE_EXTENDED: + V_DrawString(mx, my + 164, highlightflags | V_ALLOWLOWERCASE, KartColor_Names[setupm_fakecolor]); // SRB2kart + if (itemOn == 2) + { + V_DrawCharacter(mx - 10/* - st*/ - (skullAnimCounter/5), my + 164, + '\x1C' | highlightflags, false); // left arrow + V_DrawCharacter(mx + 2 + st + (skullAnimCounter/5), my + 164, + '\x1D' | highlightflags, false); // right arrow + } + break; case SKINMENUTYPE_GRID: case SKINMENUTYPE_2D: V_DrawString(mx, my + 152, highlightflags | V_ALLOWLOWERCASE, KartColor_Names[setupm_fakecolor]); // SRB2kart @@ -11074,6 +11121,52 @@ static void M_DrawSetupMultiPlayerMenu(void) switch (cv_skinselectmenu.value) { + case SKINMENUTYPE_EXTENDED: + // SRB2Kart: draw the stat backer + //This is where stats and shit would go. + // gonna put the sorttype here as well + V_DrawSmallString(statx-3, staty-37, V_6WIDTHSPACE|highlightflags, "Sort:"); + V_DrawSmallString(statx+17, staty-37, V_6WIDTHSPACE|highlightflags, sortNames[cv_skinselectgridsort.value]); + if (itemOn == 1) + V_DrawSmallString(statx+101, staty-37, V_6WIDTHSPACE|highlightflags, "BS: change"); + +#define GETSELECTEDSPEED (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartspeed : skins[setupm_fakeskin].kartspeed) +#define GETSELECTEDWEIGHT (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartweight : skins[setupm_fakeskin].kartweight) + + if (statdp == true) + { + int i; + //Background + V_DrawScaledPatch(statx - 50, staty + 4, 0, W_CachePatchName("K_STATNB", PU_CACHE)); + + //Speed + for (i = 0; i < GETSELECTEDSPEED; i++) // draw the stat bars + { + if (i == 0) + V_DrawScaledPatch(statx - 45, staty + 63, 0, W_CachePatchName("K_STATN1", PU_CACHE)); + else if (i == GETSELECTEDSPEED -1 ) + V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN3", PU_CACHE)); + else + V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN2", PU_CACHE)); + } + + //Weight + for (i = 0; i < GETSELECTEDWEIGHT; i++) // draw the stat bars + { + + if (i == 0) + V_DrawScaledPatch(statx - 30, staty + 63, 0, W_CachePatchName("K_STATN4", PU_CACHE)); + else if (i == GETSELECTEDWEIGHT -1) + V_DrawScaledPatch(statx - 30, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN6", PU_CACHE)); + else + V_DrawScaledPatch(statx - 30, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN5", PU_CACHE)); + } + } +#undef GETSELECTEDSPEED +#undef GETSELECTEDWEIGHT + + + break; case SKINMENUTYPE_GRID: // SRB2Kart: draw the stat backer // labels @@ -11160,6 +11253,47 @@ static void M_DrawSetupMultiPlayerMenu(void) switch (cv_skinselectmenu.value) { + //Skin grid stuff + case SKINMENUTYPE_EXTENDED: + int gridyoffset = 10; + for (s = 0; s < SKINGRIDNEWWIDTH*SKINGRIDNEWHEIGHT; s++) + { + INT32 x = ((s % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH) - 8) + 100 + SKINXSHIFT; //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; + INT32 y = ((s / SKINGRIDNEWWIDTH) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2)) + gridyoffset); //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; + INT32 calcs = s + (setupm_skinypos * SKINGRIDNEWWIDTH); + INT32 skinn; + patch_t *face; + UINT8 *cmap; + + if (calcs < numskins) + skinn = skinsorted[calcs]; + else if (s % SKINGRIDNEWWIDTH == 0) + break; //really conveniant place to break out here + else + { + V_DrawFill(x, y, 16, 16, 239); + continue; + } + + face = facerankprefix[skinn]; + cmap = R_GetTranslationColormap(skinn, skins[skinn].prefcolor, GTC_MENUCACHE); + + V_DrawFixedPatch(x << FRACBITS, y << FRACBITS, FRACUNIT, 0, face, cmap); + } + + if (itemOn == 1) //has to be on skin select part + { + patch_t *cursor; + INT32 curx = (((setupm_skinselect % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH/2)) + SKINXSHIFT) + 20; + INT32 cury = (((setupm_skinselect / SKINGRIDNEWWIDTH) - setupm_skinypos) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2))+ gridyoffset); + + UINT8 cursorframe = (I_GetTime() / 4) % 7; + + cursor = W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_CACHE); + V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL); + } + + break; case SKINMENUTYPE_GRID: for (s = 0; s < SKINGRIDWIDTH*SKINGRIDHEIGHT; s++) { @@ -11294,7 +11428,11 @@ static void M_DrawSetupMultiPlayerMenu(void) #define charw 72 #define indexwidth 8 { - const INT32 colwidth = ((BASEVIDWIDTH-(2*mx))-charw)/(2*indexwidth); + INT32 colwidth = ((BASEVIDWIDTH-(2*mx))-charw)/(2*indexwidth); + + if (cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED) + colwidth = colwidth - 10; + INT32 j = -colwidth; INT16 col = setupm_fakecolor - colwidth; INT32 x = mx; @@ -11397,6 +11535,13 @@ static void M_DrawSetupMultiPlayerMenu(void) else sprdef = &skins[0].spritedef; break; + case SKINMENUTYPE_EXTENDED: + skintodisplay = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin); + if (R_SkinAvailable(skins[skintodisplay].name) != -1) + sprdef = &skins[R_SkinAvailable(skins[skintodisplay].name)].spritedef; + else + sprdef = &skins[0].spritedef; + break; case SKINMENUTYPE_GRID: skintodisplay = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin); if (R_SkinAvailable(skins[skintodisplay].name) != -1) @@ -11485,15 +11630,22 @@ static void M_HandleSetupMultiPlayer(INT32 choice) S_StartSound(NULL,sfx_menu1); // Tails break; } - else if (cv_skinselectmenu.value == SKINMENUTYPE_GRID) //grid skin select menu + else if (cv_skinselectmenu.value == SKINMENUTYPE_GRID || cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED) //grid skin select menu { if (itemOn == 1) //if we are on the skin select menu { if (setupm_skinselect < ROUNDSKINSUPTO8 - SKINGRIDWIDTH) //if we arent at the bottom of the menu { setupm_skinselect += SKINGRIDWIDTH; - if (setupm_skinselect >= ((setupm_skinypos-1)+SKINGRIDHEIGHT)*8 && setupm_skinypos < (ROUNDSKINSUPTO8/8)-SKINGRIDHEIGHT) - setupm_skinypos++; + + if (cv_skinselectmenu.value == SKINMENUTYPE_GRID){ + if (setupm_skinselect >= ((setupm_skinypos-1)+SKINGRIDHEIGHT)*8 && setupm_skinypos < (ROUNDSKINSUPTO8/8)-SKINGRIDHEIGHT) + setupm_skinypos++; + } + else if (cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED){ + if (setupm_skinselect >= ((setupm_skinypos-1)+SKINGRIDHEIGHT)*8+24 && setupm_skinypos < (ROUNDSKINSUPTO8/8)-SKINGRIDHEIGHT+24) + setupm_skinypos++; + } } else { @@ -11532,7 +11684,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice) S_StartSound(NULL,sfx_menu1); // Tails break; } - else if (cv_skinselectmenu.value == SKINMENUTYPE_GRID) + else if (cv_skinselectmenu.value == SKINMENUTYPE_GRID || cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED) { if (itemOn == 1) { @@ -11551,8 +11703,16 @@ static void M_HandleSetupMultiPlayer(INT32 choice) else if (itemOn == 2) { setupm_skinselect = numskins - 1; - setupm_skinypos = (((numskins / SKINGRIDWIDTH) - (SKINGRIDHEIGHT-1)) > 0 ? ((numskins / SKINGRIDWIDTH) - (SKINGRIDHEIGHT-1)) : 0); - M_PrevOpt(); + if (cv_skinselectmenu.value == SKINMENUTYPE_GRID){ + setupm_skinypos = (((numskins / SKINGRIDWIDTH) - (SKINGRIDHEIGHT-1)) > 0 ? ((numskins / SKINGRIDWIDTH) - (SKINGRIDHEIGHT-1)) : 0); + M_PrevOpt(); + } + else if (cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED){ + setupm_skinypos = (((numskins / SKINGRIDWIDTH) - (SKINGRIDHEIGHT-1)-2) > 0 ? ((numskins / SKINGRIDWIDTH) - (SKINGRIDHEIGHT-1)-2) : 0); + M_PrevOpt(); + + } + } else M_PrevOpt(); @@ -11584,7 +11744,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice) } break; } - else if (cv_skinselectmenu.value == SKINMENUTYPE_GRID && itemOn == 1) + else if ((cv_skinselectmenu.value == SKINMENUTYPE_GRID || cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED) && itemOn == 1) { if (setupm_skinselect > 0) { @@ -11596,7 +11756,10 @@ static void M_HandleSetupMultiPlayer(INT32 choice) { INT32 roundedskins = ROUNDSKINSUPTO8; setupm_skinselect = roundedskins-1; - setupm_skinypos = (((roundedskins/8) - SKINGRIDHEIGHT) > 0 ? (roundedskins/8) - SKINGRIDHEIGHT : 0); + if (cv_skinselectmenu.value == SKINMENUTYPE_GRID) + setupm_skinypos = (((roundedskins/8) - SKINGRIDHEIGHT) > 0 ? (roundedskins/8) - SKINGRIDHEIGHT : 0); + else if (cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED) + setupm_skinypos = (((roundedskins/8) - SKINGRIDHEIGHT-2) > 0 ? (roundedskins/8) - SKINGRIDHEIGHT-2 : 0); } S_StartSound(NULL, sfx_menu1); break; @@ -11634,13 +11797,19 @@ static void M_HandleSetupMultiPlayer(INT32 choice) } break; } - else if (cv_skinselectmenu.value == SKINMENUTYPE_GRID && itemOn == 1) + else if ((cv_skinselectmenu.value == SKINMENUTYPE_GRID || cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED) && itemOn == 1) { if (setupm_skinselect < ROUNDSKINSUPTO8 - 1) { setupm_skinselect++; - if (setupm_skinselect >= ((setupm_skinypos-1)+SKINGRIDHEIGHT)*8 && setupm_skinypos < (ROUNDSKINSUPTO8/8)-SKINGRIDHEIGHT) - setupm_skinypos++; + if (cv_skinselectmenu.value == SKINMENUTYPE_GRID){ + if (setupm_skinselect >= ((setupm_skinypos-1)+SKINGRIDHEIGHT)*8 && setupm_skinypos < (ROUNDSKINSUPTO8/8)-SKINGRIDHEIGHT) + setupm_skinypos++; + } + else if (cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED){ + if (setupm_skinselect >= ((setupm_skinypos-1)+SKINGRIDHEIGHT)*8+24 && setupm_skinypos < (ROUNDSKINSUPTO8/8)-SKINGRIDHEIGHT+24) + setupm_skinypos++; + } } else { @@ -11682,7 +11851,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice) setupm_name[l-1] =0; } } - else if (cv_skinselectmenu.value == SKINMENUTYPE_GRID && itemOn == 1) + else if ((cv_skinselectmenu.value == SKINMENUTYPE_GRID || cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED) && itemOn == 1) { // change sort for select menu (damn now i have to add another cvar...) // now we have the cvar @@ -11701,7 +11870,6 @@ static void M_HandleSetupMultiPlayer(INT32 choice) } } break; - case KEY_DEL: if (cv_skinselectmenu.value) BREAKWHENLOCKED @@ -11737,7 +11905,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice) S_StartSound(NULL,sfx_menu1); } } - else if (cv_skinselectmenu.value == SKINMENUTYPE_GRID && itemOn == 1 && setupm_skinselect < numskins) + else if ((cv_skinselectmenu.value == SKINMENUTYPE_GRID || cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED ) && itemOn == 1 && setupm_skinselect < numskins) { setupm_fakeskin = skinsorted[setupm_skinselect]; S_StartSound(NULL, sfx_s221); @@ -11745,16 +11913,22 @@ static void M_HandleSetupMultiPlayer(INT32 choice) break; default: - if (choice < 32 || choice > 127 || itemOn != 0) + if (choice < 32 || choice > 127) break; - l = strlen(setupm_name); - if (l < MAXPLAYERNAME) - { - S_StartSound(NULL,sfx_menu1); // Tails - setupm_name[l] =(char)choice; - setupm_name[l+1] =0; + if (itemOn == 0){ + l = strlen(setupm_name); + if (l < MAXPLAYERNAME) + { + S_StartSound(NULL,sfx_menu1); // Tails + setupm_name[l] =(char)choice; + setupm_name[l+1] =0; + } } break; + + + + } #undef BREAKWHENLOCKED @@ -11789,6 +11963,12 @@ case SKINMENUTYPE_2D:\ MP_PlayerSetupMenu[2].alphaKey = 164;\ MP_PlayerSetupDef.y = 6;\ break;\ +case SKINMENUTYPE_EXTENDED:\ + MP_PlayerSetupMenu[0].alphaKey = 6;\ + MP_PlayerSetupMenu[1].alphaKey = 25;\ + MP_PlayerSetupMenu[2].alphaKey = 152;\ + MP_PlayerSetupDef.y = 6;\ + break;\ case SKINMENUTYPE_GRID:\ MP_PlayerSetupMenu[0].alphaKey = 6;\ MP_PlayerSetupMenu[1].alphaKey = 25;\ @@ -11818,6 +11998,7 @@ static void M_SetupMultiPlayer(INT32 choice) setupm_cvskin = &cv_skin; setupm_cvcolor = &cv_playercolor; setupm_cvname = &cv_playername; + setupm_skinxpos = 4; setupm_skinypos = 0; setupm_skinlockedselect = false; @@ -11968,7 +12149,7 @@ static boolean M_QuitMultiPlayerMenu(void) } // you know what? always putting these in the buffer won't hurt anything. COM_BufAddText (va("%s \"%s\"\n",setupm_cvskin->name,skins[setupm_fakeskin].name)); - COM_BufAddText (va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor)); + COM_BufAddText (va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor)); return true; } diff --git a/src/r_things.c b/src/r_things.c index 97d38288a..d64aa58a3 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2992,6 +2992,7 @@ UINT8 skinstatscount[9][9] = { UINT8 skinsorted[MAXSKINS]; skin_t localskins[MAXSKINS]; skin_t allskins[MAXSKINS*2]; + // FIXTHIS: don't work because it must be inistilised before the config load //#define SKINVALUES #ifdef SKINVALUES -- 2.54.0 From 2b1dc82bfae9de5de781b26c026290388bbbe1c6 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Fri, 24 Nov 2023 16:27:00 -0500 Subject: [PATCH 092/112] Fix complilation due to menu code --- src/m_menu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index f6dd2f823..eac593f18 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -10971,6 +10971,8 @@ static void M_DrawSetupMultiPlayerMenu(void) INT32 sltw, actw, hetw; UINT8 skintodisplay; INT32 nameboxaddy = 0; + int statoffset = 0; + int gridyoffset = 0; mx = MP_PlayerSetupDef.x; my = MP_PlayerSetupDef.y; @@ -11013,7 +11015,7 @@ static void M_DrawSetupMultiPlayerMenu(void) #define GETSELECTEDSPEED (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartspeed : skins[setupm_fakeskin].kartspeed) #define GETSELECTEDWEIGHT (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartweight : skins[setupm_fakeskin].kartweight) - int statoffset = 0; + statoffset = 0; tw = V_StringWidth("Character", 0);//V_StringWidth(GETSELECTEDSKINNAME, 0); st = V_StringWidth(GETSELECTEDSKINNAME, 0); @@ -11255,7 +11257,7 @@ static void M_DrawSetupMultiPlayerMenu(void) { //Skin grid stuff case SKINMENUTYPE_EXTENDED: - int gridyoffset = 10; + gridyoffset = 10; for (s = 0; s < SKINGRIDNEWWIDTH*SKINGRIDNEWHEIGHT; s++) { INT32 x = ((s % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH) - 8) + 100 + SKINXSHIFT; //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; -- 2.54.0 From 5813c2b3c37b47a92836f66b06839cdb821b2bb4 Mon Sep 17 00:00:00 2001 From: hayaunderscore Date: Sat, 25 Nov 2023 10:37:57 +0800 Subject: [PATCH 093/112] Experimental SPRTINFO support Based of leftover code from patch rotation --- src/hardware/hw_main.c | 2 +- src/p_setup.c | 3 +++ src/r_patch.c | 14 ++++++++++++++ src/r_things.c | 16 +++++++++++++--- src/r_things.h | 1 + 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 7fce89e04..ec59ea794 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5395,7 +5395,7 @@ void HWR_ProjectSprite(mobj_t *thing) { sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef; #ifdef ROTSPRITE - sprinfo = &spriteinfo[thing->sprite]; + sprinfo = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->sprinfo; #endif } else diff --git a/src/p_setup.c b/src/p_setup.c index d8dcbb877..3167d8462 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3587,6 +3587,9 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local) if (!mapsadded) CONS_Printf(M_GetText("No maps added\n")); + // TODO: Experimental SPRTINFO support, test first + R_LoadSpriteInfoLumps(wadnum, wadfiles[wadnum]->numlumps); + 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/r_patch.c b/src/r_patch.c index 4c5bc0f2d..5e457e912 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -640,6 +640,19 @@ static void R_ParseSpriteInfo(boolean spr2) { R_ParseSpriteInfoFrame(info); Z_Free(sprinfoToken); + if (spr2) + { + if (!foundskins) + I_Error("Error parsing SPRTINFO lump: No skins specified in this sprite2 definition"); + for (i = 0; i < foundskins; i++) + { + size_t skinnum = skinnumbers[i]; + skin_t *skin = &skins[skinnum]; + M_Memcpy(&skin->sprinfo, info, sizeof(spriteinfo_t)); + CONS_Printf("Successfully added SPRTINFO definition for skin \"%s\"\n", skin->name); + } + } + else M_Memcpy(&spriteinfo[sprnum], info, sizeof(spriteinfo_t)); } else @@ -694,6 +707,7 @@ void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum) sprinfoToken = M_GetToken(sprinfoText); while (sprinfoToken != NULL) { + CONS_Printf("Attempting to parse le SPRTINFO lump for ya..\n"); if (!stricmp(sprinfoToken, "SPRITE")) R_ParseSpriteInfo(false); else if (!stricmp(sprinfoToken, "SPRITE2")) diff --git a/src/r_things.c b/src/r_things.c index d64aa58a3..d08b57501 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -643,9 +643,12 @@ void R_InitSprites(void) // it can be is do before loading config for skin cvar possible value R_InitSkins(); - for (i = 0; i < numwadfiles; i++) + for (i = 0; i < numwadfiles; i++) + { R_AddSkins((UINT16)i, false); - + R_LoadSpriteInfoLumps(i, wadfiles[i]->numlumps); + } + // // check if all sprites have frames // @@ -1400,7 +1403,7 @@ static void R_ProjectSprite(mobj_t *thing) { sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef; #ifdef ROTSPRITE - sprinfo = &spriteinfo[thing->sprite]; + sprinfo = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->sprinfo; #endif if (rot >= sprdef->numframes) @@ -3085,6 +3088,7 @@ void R_InitSkins(void) skin->spritedef.numframes = sprites[SPR_PLAY].numframes; skin->spritedef.spriteframes = sprites[SPR_PLAY].spriteframes; + skin->sprinfo = spriteinfo[SPR_PLAY]; ST_LoadFaceGraphics(skin->facerank, skin->facewant, skin->facemmap, 0); // Set values for Sonic skin @@ -3609,6 +3613,7 @@ next_token: free(buf2); lump++; // if no sprite defined use spirte just after this one + INT32 sprnum; if (skin->sprite[0] == '\0') { const char *csprname = W_CheckNameForNumPwad(wadnum, lump); @@ -3619,6 +3624,9 @@ next_token: lastlump++; // allocate (or replace) sprite frames, and set spritedef R_AddSingleSpriteDef(csprname, &skin->spritedef, wadnum, lump, lastlump); + + // i feel like generally most skin authors just use PLAY here, so just assume PLAY + sprnum = SPR_PLAY; } else { @@ -3666,6 +3674,8 @@ next_token: R_AddSingleSpriteDef(sprname, &skin->spritedef, wadnum, lstart, lend); } + sprnum = numspritelumps - 1; + // I don't particularly care about skipping to the end of the used frames. // We could be using frames from ANYWHERE in the current WAD file, including // right before us, which is a terrible idea. diff --git a/src/r_things.h b/src/r_things.h index 7c10e7ec2..966ff3df1 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -79,6 +79,7 @@ typedef struct { char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin spritedef_t spritedef; + spriteinfo_t sprinfo; UINT16 wadnum; char sprite[4]; // Sprite name, if seperated from S_SKIN. skinflags_t flags; -- 2.54.0 From 3ede4eb1a6e65314901066c6436eafbd0c251969 Mon Sep 17 00:00:00 2001 From: hayaunderscore Date: Sat, 25 Nov 2023 11:15:01 +0800 Subject: [PATCH 094/112] Remove this dumb debug print --- src/r_patch.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/r_patch.c b/src/r_patch.c index 5e457e912..cafd8e853 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -649,7 +649,6 @@ static void R_ParseSpriteInfo(boolean spr2) size_t skinnum = skinnumbers[i]; skin_t *skin = &skins[skinnum]; M_Memcpy(&skin->sprinfo, info, sizeof(spriteinfo_t)); - CONS_Printf("Successfully added SPRTINFO definition for skin \"%s\"\n", skin->name); } } else -- 2.54.0 From b533dbee55fc911fb9d05e2515c30a5bf982fe52 Mon Sep 17 00:00:00 2001 From: hayaunderscore Date: Sat, 25 Nov 2023 11:32:24 +0800 Subject: [PATCH 095/112] Localskin support probably --- src/r_patch.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/r_patch.c b/src/r_patch.c index cafd8e853..f69be9de3 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -629,7 +629,7 @@ static void R_ParseSpriteInfo(boolean spr2) strlwr(skinName); Z_Free(sprinfoToken); - skinnum = R_SkinAvailable(skinName); + skinnum = R_AnySkinAvailable(skinName); if (skinnum == -1) I_Error("Error parsing SPRTINFO lump: Unknown skin \"%s\"", skinName); @@ -647,7 +647,11 @@ static void R_ParseSpriteInfo(boolean spr2) for (i = 0; i < foundskins; i++) { size_t skinnum = skinnumbers[i]; - skin_t *skin = &skins[skinnum]; + skin_t *skin; + if (allskins[skinnum].localskin) + skin = &localskins[allskins[skinnum].localnum]; + else + skin = &skins[allskins[skinnum].localnum]; M_Memcpy(&skin->sprinfo, info, sizeof(spriteinfo_t)); } } -- 2.54.0 From 146a80e91cf75a1c4a1989dca715016156ed12eb Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Sat, 25 Nov 2023 10:38:24 +0100 Subject: [PATCH 096/112] Dont mark this shit as modify doofus --- src/w_wad.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/w_wad.c b/src/w_wad.c index 950b80d9a..a856042b9 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -2137,6 +2137,9 @@ int W_VerifyNMUSlumps(const char *filename) {"MKFNT", 5}, // Kart font changes {"K_", 2}, // Kart graphic changes {"MUSICDEF", 8}, // Kart song definitions + {"SP_", 3}, // Speedometer changes do not count either. + {"SC_", 3}, // No idea what the SC_SMSTC thing does, ask nepdisk idk + {"SPRTINFO", 8}, // Sprite info #ifdef HWRENDER {"SHADERS", 7}, -- 2.54.0 From 40a8554cc96ef26117d2c03f2cf5885a39738b4b Mon Sep 17 00:00:00 2001 From: Indev Date: Sun, 26 Nov 2023 23:52:07 +0300 Subject: [PATCH 097/112] Attempt to fix rare 'server player kick' bug --- src/d_clisrv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ee554eabc..43ff5a45e 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4307,6 +4307,13 @@ static void Got_RemovePlayer(UINT8 **p, INT32 playernum) pnum = READUINT8(*p); reason = READUINT8(*p); + if (pnum == serverplayer) + { + CONS_Alert(CONS_WARNING, "Attempt to remove server player\n"); + + return; + } + CL_RemovePlayer(pnum, reason); #ifdef HAVE_DISCORDRPC -- 2.54.0 From 882554a3fe8e23641cae51a293610a3fc073b401 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Nov 2023 04:10:39 +0100 Subject: [PATCH 098/112] splitwallfix toggle idk maybe some still get worse performance from this --- src/hardware/hw_main.c | 36 ++++++++++++++++++++++++++++++++---- src/hardware/hw_main.h | 1 + 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index ec59ea794..ae285dd27 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -101,6 +101,8 @@ consvar_t cv_grbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL consvar_t cv_grfofcut = {"gr_fofcut", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_splitwallfix = {"splitwallfix", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + static CV_PossibleValue_t grrenderdistance_cons_t[] = { {0, "Max"}, {1, "1024"}, {2, "2048"}, {3, "4096"}, {4, "6144"}, {5, "8192"}, {6, "12288"}, {7, "16384"}, {0, NULL}}; @@ -1122,6 +1124,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, realtop = top = wallVerts[3].y; realbot = bot = wallVerts[0].y; + diff = top - bot; pegt = wallVerts[3].t; @@ -1135,7 +1138,6 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, else pegmul = (pegb - pegt) / diff; - #ifdef ESLOPE endrealtop = endtop = wallVerts[2].y; endrealbot = endbot = wallVerts[1].y; @@ -1144,7 +1146,6 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, endpegmul = (endpegb - endpegt) / (endtop - endbot); #endif - for (INT32 i = 0; i < sector->numlights; i++) { if (endtop < endrealbot && top < realbot) @@ -1187,12 +1188,13 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, #ifdef ESLOPE if (list[i].slope) - { + { height = FixedToFloat(P_GetZAt(list[i].slope, v1x, v1y)); - endheight = FixedToFloat(P_GetZAt(list[i].slope, v2x, v2y)); + endheight = FixedToFloat(P_GetZAt(list[i].slope, v2x, v2y)); } else height = endheight = FIXED_TO_FLOAT(list[i].height); + if (solid) { if (*list[i].caster->b_slope) @@ -1249,6 +1251,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, } #endif + if (cv_splitwallfix.value) + { #ifdef ESLOPE if (endbheight > endtop) endbot = endtop; @@ -1265,6 +1269,27 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, #ifdef ESLOPE endbot = min(max(endbheight, endrealbot), endtop); #endif + }else{ +#ifdef ESLOPE + if (endbheight >= endtop) +#endif + if (bheight >= top) + continue; + + //Found a break; + bot = bheight; + + if (bot < realbot) + bot = realbot; + +#ifdef ESLOPE + endbot = endbheight; + + if (endbot < endrealbot) + endbot = endrealbot; +#endif + } + Surf->PolyColor.s.alpha = alpha; @@ -6360,7 +6385,10 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_grbatching); CV_RegisterVar(&cv_grfofcut); + CV_RegisterVar(&cv_splitwallfix); + CV_RegisterVar(&cv_grscreentextures); + CV_RegisterVar(&cv_grrenderdistance); CV_RegisterVar(&cv_grgammablue); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 2f3f58fbf..c8c25c03a 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -164,6 +164,7 @@ void HWR_CorrectSWTricks(void); // Console variables extern consvar_t cv_grshaders; extern consvar_t cv_grfofcut; +extern consvar_t cv_splitwallfix; extern consvar_t cv_grshearing; extern consvar_t cv_grfov; extern consvar_t cv_grmdls; -- 2.54.0 From fb8cdbb9cc0bfff8698b7d8089d0b5aca79d9ce7 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Nov 2023 04:23:28 +0100 Subject: [PATCH 099/112] only do it like that in pal rendering mode --- src/hardware/hw_main.c | 64 +++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index ae285dd27..03e829010 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1157,15 +1157,27 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, { if (pfloor && (pfloor->flags & FF_FOG)) { - colormap = pfloor->master->frontsector->extra_colormap; - lightnum = pfloor->master->frontsector->lightlevel; - lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y); + if (HWR_ShouldUsePaletteRendering()) + { + colormap = pfloor->master->frontsector->extra_colormap; + lightnum = pfloor->master->frontsector->lightlevel; + lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y); + }else{ + lightnum = HWR_CalcWallLight(pfloor->master->frontsector->lightlevel, v1x, v1y, v2x, v2y); + colormap = pfloor->master->frontsector->extra_colormap; + } } else { - colormap = list[i].extra_colormap; - lightnum = *list[i].lightlevel; - lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y); + if (HWR_ShouldUsePaletteRendering()) + { + colormap = list[i].extra_colormap; + lightnum = *list[i].lightlevel; + lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y); + }else{ + lightnum = HWR_CalcWallLight(*list[i].lightlevel, v1x, v1y, v2x, v2y); + colormap = list[i].extra_colormap; + } } } @@ -1599,10 +1611,16 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT)); } - colormap = gr_frontsector->extra_colormap; - lightnum = gr_frontsector->lightlevel; - lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y); - + if (HWR_ShouldUsePaletteRendering()) + { + colormap = gr_frontsector->extra_colormap; + lightnum = gr_frontsector->lightlevel; + lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y); + }else{ + lightnum = HWR_CalcWallLight(gr_frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y); + colormap = gr_frontsector->extra_colormap; + } + if (gr_frontsector) Surf.PolyColor.s.alpha = 255; @@ -2456,10 +2474,16 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom blendmode = PF_Fog|PF_NoTexture; - colormap = rover->master->frontsector->extra_colormap; - lightnum = rover->master->frontsector->lightlevel; - lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y); - + if (HWR_ShouldUsePaletteRendering()) + { + colormap = rover->master->frontsector->extra_colormap; + lightnum = rover->master->frontsector->lightlevel; + lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y); + }else{ + lightnum = HWR_CalcWallLight(rover->master->frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y); + colormap = rover->master->frontsector->extra_colormap; + } + Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); if (gr_frontsector->numlights) @@ -2601,9 +2625,15 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom blendmode = PF_Fog|PF_NoTexture; - colormap = rover->master->frontsector->extra_colormap; - lightnum = rover->master->frontsector->lightlevel; - lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y); + if (HWR_ShouldUsePaletteRendering()) + { + colormap = rover->master->frontsector->extra_colormap; + lightnum = rover->master->frontsector->lightlevel; + lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y); + }else{ + lightnum = HWR_CalcWallLight(rover->master->frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y); + colormap = rover->master->frontsector->extra_colormap; + } Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); -- 2.54.0 From 7ce3d0c733aa0b601e2cc91261d6aba839f63c2e Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Nov 2023 04:40:13 +0100 Subject: [PATCH 100/112] add toggle for texture zfight fix --- src/hardware/hw_main.c | 72 +++++++++++++++++++++++++++++++----------- src/hardware/hw_main.h | 1 + 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 03e829010..ed31a3c9d 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -101,6 +101,8 @@ consvar_t cv_grbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL consvar_t cv_grfofcut = {"gr_fofcut", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fofzfightfix = {"fofzfightfix", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + consvar_t cv_splitwallfix = {"splitwallfix", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t grrenderdistance_cons_t[] = { @@ -1324,13 +1326,23 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, wallVerts[2].y = wallVerts[3].y = top; wallVerts[0].y = wallVerts[1].y = bot; #endif - - if (cutflag & FF_FOG) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap); - else if (cutflag & FF_TRANSLUCENT) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap); - else - HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); + if (cv_fofzfightfix.value) + { + if (cutflag & FF_FOG) + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap); + else if (cutflag & FF_TRANSLUCENT) + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap); + else + HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); + }else{ + if (cutflag & FF_FOG) + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture, true, lightnum, colormap); + else if (cutflag & FF_TRANSLUCENT) + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent, false, lightnum, colormap); + else + HWR_ProjectWall(wallVerts, Surf, PF_Masked, lightnum, colormap); + } + top = bot; #ifdef ESLOPE @@ -1368,12 +1380,22 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, wallVerts[0].y = wallVerts[1].y = bot; #endif - if (cutflag & FF_FOG) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap); - else if (cutflag & FF_TRANSLUCENT) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap); - else - HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); + if (cv_fofzfightfix.value) + { + if (cutflag & FF_FOG) + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap); + else if (cutflag & FF_TRANSLUCENT) + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap); + else + HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); + }else{ + if (cutflag & FF_FOG) + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture, true, lightnum, colormap); + else if (cutflag & FF_TRANSLUCENT) + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent, false, lightnum, colormap); + else + HWR_ProjectWall(wallVerts, Surf, PF_Masked, lightnum, colormap); + } } // skywall list system for fixing portal issues by postponing skywall rendering (and using stencil buffer for them) @@ -2152,16 +2174,27 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // Render midtextures on two-sided lines with a z-buffer offset. // This will cause the midtexture appear on top, if a FOF overlaps with it. - blendmode |= PF_Decal; + if (cv_fofzfightfix.value) + blendmode |= PF_Decal; if (!gl_drawing_stencil && gr_frontsector->numlights) { - if (!(blendmode & PF_Masked)) - HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_TRANSLUCENT, NULL, PF_Decal); - else + if (cv_fofzfightfix.value) { - HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_CUTLEVEL, NULL, PF_Decal); - } + if (!(blendmode & PF_Masked)) + HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_TRANSLUCENT, NULL, PF_Decal); + else + { + HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_CUTLEVEL, NULL, PF_Decal); + } + }else{ + if (!(blendmode & PF_Masked)) + HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_TRANSLUCENT, NULL, 0); + else + { + HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_CUTLEVEL, NULL, 0); + } + } } else if (!gl_drawing_stencil && !(blendmode & PF_Masked)) HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, blendmode, false, lightnum, colormap); @@ -6415,6 +6448,7 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_grbatching); CV_RegisterVar(&cv_grfofcut); + CV_RegisterVar(&cv_fofzfightfix); CV_RegisterVar(&cv_splitwallfix); CV_RegisterVar(&cv_grscreentextures); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index c8c25c03a..b86c4b70a 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -164,6 +164,7 @@ void HWR_CorrectSWTricks(void); // Console variables extern consvar_t cv_grshaders; extern consvar_t cv_grfofcut; +extern consvar_t cv_fofzfightfix; extern consvar_t cv_splitwallfix; extern consvar_t cv_grshearing; extern consvar_t cv_grfov; -- 2.54.0 From 29edb49861a5c0d627c8c52d98e3d696d4cd19d7 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Nov 2023 05:20:33 +0100 Subject: [PATCH 101/112] toggle for slope midtexture pegging fix --- src/hardware/hw_main.c | 127 +++++++++++++++++++++++++++++++++-------- src/hardware/hw_main.h | 1 + 2 files changed, 103 insertions(+), 25 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index ed31a3c9d..8d57baf2e 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -105,6 +105,8 @@ consvar_t cv_fofzfightfix = {"fofzfightfix", "On", CV_SAVE, CV_OnOff, NULL, 0, N consvar_t cv_splitwallfix = {"splitwallfix", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_slopepegfix = {"slopepegfix", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + static CV_PossibleValue_t grrenderdistance_cons_t[] = { {0, "Max"}, {1, "1024"}, {2, "2048"}, {3, "4096"}, {4, "6144"}, {5, "8192"}, {6, "12288"}, {7, "16384"}, {0, NULL}}; @@ -2006,6 +2008,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom popentopslope = min(worldtopslope, worldhighslope); popenbottomslope = max(worldbottomslope, worldlowslope); +#else + popentop = min(front->ceilingheight, back->ceilingheight); + popenbottom = max(front->floorheight, back->floorheight); +#endif } #ifdef ESLOPE @@ -2070,38 +2076,108 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom l = max(polybottom, lowcut); hS = min(highcutslope, polytopslope); lS = max(polybottomslope, lowcutslope); - + // PEGGING fixed_t texturevpeg, texturevpegslope; + + grTex = HWR_GetTexture(gr_midtexture); + + if (cv_slopepegfix.value) + { + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + { + texturevpeg = midtexheight - h + polybottom; + texturevpegslope = midtexheight - hS + polybottomslope; + } + else + { + texturevpeg = polytop - h; + texturevpegslope = polytopslope - hS; + } + + wallVerts[3].t = texturevpeg * grTex->scaleY; + wallVerts[0].t = (h - l + texturevpeg) * grTex->scaleY; + wallVerts[2].t = texturevpegslope * grTex->scaleY; + wallVerts[1].t = (hS - lS + texturevpegslope) * grTex->scaleY; + wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; + wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; - if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) - { - texturevpeg = midtexheight - h + polybottom; - texturevpegslope = midtexheight - hS + polybottomslope; + // set top/bottom coords + // Take the texture peg into account, rather than changing the offsets past + // where the polygon might not be. + wallVerts[3].y = FIXED_TO_FLOAT(h); + wallVerts[0].y = FIXED_TO_FLOAT(l); + wallVerts[2].y = FIXED_TO_FLOAT(hS); + wallVerts[1].y = FIXED_TO_FLOAT(lS); } else { - texturevpeg = polytop - h; - texturevpegslope = polytopslope - hS; - } - - grTex = HWR_GetTexture(gr_midtexture); - - wallVerts[3].t = texturevpeg * grTex->scaleY; - wallVerts[0].t = (h - l + texturevpeg) * grTex->scaleY; - wallVerts[2].t = texturevpegslope * grTex->scaleY; - wallVerts[1].t = (hS - lS + texturevpegslope) * grTex->scaleY; - wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; - wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; - - // set top/bottom coords - // Take the texture peg into account, rather than changing the offsets past - // where the polygon might not be. - wallVerts[3].y = FIXED_TO_FLOAT(h); - wallVerts[0].y = FIXED_TO_FLOAT(l); - wallVerts[2].y = FIXED_TO_FLOAT(hS); - wallVerts[1].y = FIXED_TO_FLOAT(lS); + // PEGGING +#ifdef ESLOPE + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) +#else + if (gr_linedef->flags & ML_DONTPEGBOTTOM) #endif + texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom; + else + texturevpeg = polytop - h; + + wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY; + wallVerts[0].t = wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY; + wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; + wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; + + // set top/bottom coords + // Take the texture peg into account, rather than changing the offsets past + // where the polygon might not be. + wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h); + wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l); + +#ifdef ESLOPE + // Correct to account for slopes + { + fixed_t midtextureslant; + + if (gr_linedef->flags & ML_EFFECT2) + midtextureslant = 0; + else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + midtextureslant = worldlow < worldbottom + ? worldbottomslope-worldbottom + : worldlowslope-worldlow; + else + midtextureslant = worldtop < worldhigh + ? worldtopslope-worldtop + : worldhighslope-worldhigh; + + polytop += midtextureslant; + polybottom += midtextureslant; + + highcut += worldtop < worldhigh + ? worldtopslope-worldtop + : worldhighslope-worldhigh; + lowcut += worldlow < worldbottom + ? worldbottomslope-worldbottom + : worldlowslope-worldlow; + + // Texture stuff + h = min(highcut, polytop); + l = max(polybottom, lowcut); + + { + // PEGGING + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom; + else + texturevpeg = polytop - h; + wallVerts[2].t = texturevpeg * grTex->scaleY; + wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY; + } + + wallVerts[2].y = FIXED_TO_FLOAT(h); + wallVerts[1].y = FIXED_TO_FLOAT(l); + } +#endif + } // set alpha for transparent walls (new boom and legacy linedef types) FBITFIELD blendmode; @@ -6450,6 +6526,7 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_grfofcut); CV_RegisterVar(&cv_fofzfightfix); CV_RegisterVar(&cv_splitwallfix); + CV_RegisterVar(&cv_slopepegfix); CV_RegisterVar(&cv_grscreentextures); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index b86c4b70a..21495504c 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -166,6 +166,7 @@ extern consvar_t cv_grshaders; extern consvar_t cv_grfofcut; extern consvar_t cv_fofzfightfix; extern consvar_t cv_splitwallfix; +extern consvar_t cv_slopepegfix; extern consvar_t cv_grshearing; extern consvar_t cv_grfov; extern consvar_t cv_grmdls; -- 2.54.0 From e15c9558faec219d9a0adc5fa3d8debbb53d83e7 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Nov 2023 05:20:33 +0100 Subject: [PATCH 102/112] toggle for slope midtexture pegging fix also fixes a wrong ESLOPE ifdef --- src/hardware/hw_main.c | 127 +++++++++++++++++++++++++++++++++-------- src/hardware/hw_main.h | 1 + 2 files changed, 103 insertions(+), 25 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index ed31a3c9d..8d57baf2e 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -105,6 +105,8 @@ consvar_t cv_fofzfightfix = {"fofzfightfix", "On", CV_SAVE, CV_OnOff, NULL, 0, N consvar_t cv_splitwallfix = {"splitwallfix", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_slopepegfix = {"slopepegfix", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + static CV_PossibleValue_t grrenderdistance_cons_t[] = { {0, "Max"}, {1, "1024"}, {2, "2048"}, {3, "4096"}, {4, "6144"}, {5, "8192"}, {6, "12288"}, {7, "16384"}, {0, NULL}}; @@ -2006,6 +2008,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom popentopslope = min(worldtopslope, worldhighslope); popenbottomslope = max(worldbottomslope, worldlowslope); +#else + popentop = min(front->ceilingheight, back->ceilingheight); + popenbottom = max(front->floorheight, back->floorheight); +#endif } #ifdef ESLOPE @@ -2070,38 +2076,108 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom l = max(polybottom, lowcut); hS = min(highcutslope, polytopslope); lS = max(polybottomslope, lowcutslope); - + // PEGGING fixed_t texturevpeg, texturevpegslope; + + grTex = HWR_GetTexture(gr_midtexture); + + if (cv_slopepegfix.value) + { + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + { + texturevpeg = midtexheight - h + polybottom; + texturevpegslope = midtexheight - hS + polybottomslope; + } + else + { + texturevpeg = polytop - h; + texturevpegslope = polytopslope - hS; + } + + wallVerts[3].t = texturevpeg * grTex->scaleY; + wallVerts[0].t = (h - l + texturevpeg) * grTex->scaleY; + wallVerts[2].t = texturevpegslope * grTex->scaleY; + wallVerts[1].t = (hS - lS + texturevpegslope) * grTex->scaleY; + wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; + wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; - if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) - { - texturevpeg = midtexheight - h + polybottom; - texturevpegslope = midtexheight - hS + polybottomslope; + // set top/bottom coords + // Take the texture peg into account, rather than changing the offsets past + // where the polygon might not be. + wallVerts[3].y = FIXED_TO_FLOAT(h); + wallVerts[0].y = FIXED_TO_FLOAT(l); + wallVerts[2].y = FIXED_TO_FLOAT(hS); + wallVerts[1].y = FIXED_TO_FLOAT(lS); } else { - texturevpeg = polytop - h; - texturevpegslope = polytopslope - hS; - } - - grTex = HWR_GetTexture(gr_midtexture); - - wallVerts[3].t = texturevpeg * grTex->scaleY; - wallVerts[0].t = (h - l + texturevpeg) * grTex->scaleY; - wallVerts[2].t = texturevpegslope * grTex->scaleY; - wallVerts[1].t = (hS - lS + texturevpegslope) * grTex->scaleY; - wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; - wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; - - // set top/bottom coords - // Take the texture peg into account, rather than changing the offsets past - // where the polygon might not be. - wallVerts[3].y = FIXED_TO_FLOAT(h); - wallVerts[0].y = FIXED_TO_FLOAT(l); - wallVerts[2].y = FIXED_TO_FLOAT(hS); - wallVerts[1].y = FIXED_TO_FLOAT(lS); + // PEGGING +#ifdef ESLOPE + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) +#else + if (gr_linedef->flags & ML_DONTPEGBOTTOM) #endif + texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom; + else + texturevpeg = polytop - h; + + wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY; + wallVerts[0].t = wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY; + wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; + wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; + + // set top/bottom coords + // Take the texture peg into account, rather than changing the offsets past + // where the polygon might not be. + wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h); + wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l); + +#ifdef ESLOPE + // Correct to account for slopes + { + fixed_t midtextureslant; + + if (gr_linedef->flags & ML_EFFECT2) + midtextureslant = 0; + else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + midtextureslant = worldlow < worldbottom + ? worldbottomslope-worldbottom + : worldlowslope-worldlow; + else + midtextureslant = worldtop < worldhigh + ? worldtopslope-worldtop + : worldhighslope-worldhigh; + + polytop += midtextureslant; + polybottom += midtextureslant; + + highcut += worldtop < worldhigh + ? worldtopslope-worldtop + : worldhighslope-worldhigh; + lowcut += worldlow < worldbottom + ? worldbottomslope-worldbottom + : worldlowslope-worldlow; + + // Texture stuff + h = min(highcut, polytop); + l = max(polybottom, lowcut); + + { + // PEGGING + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom; + else + texturevpeg = polytop - h; + wallVerts[2].t = texturevpeg * grTex->scaleY; + wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY; + } + + wallVerts[2].y = FIXED_TO_FLOAT(h); + wallVerts[1].y = FIXED_TO_FLOAT(l); + } +#endif + } // set alpha for transparent walls (new boom and legacy linedef types) FBITFIELD blendmode; @@ -6450,6 +6526,7 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_grfofcut); CV_RegisterVar(&cv_fofzfightfix); CV_RegisterVar(&cv_splitwallfix); + CV_RegisterVar(&cv_slopepegfix); CV_RegisterVar(&cv_grscreentextures); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index b86c4b70a..21495504c 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -166,6 +166,7 @@ extern consvar_t cv_grshaders; extern consvar_t cv_grfofcut; extern consvar_t cv_fofzfightfix; extern consvar_t cv_splitwallfix; +extern consvar_t cv_slopepegfix; extern consvar_t cv_grshearing; extern consvar_t cv_grfov; extern consvar_t cv_grmdls; -- 2.54.0 From cc996759be73c206757df16864f04e0fdf535f1a Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Nov 2023 05:35:20 +0100 Subject: [PATCH 103/112] add stuff the experimental video stuff idk description could be better but i suck at writing lmao those three things were introduced back in v.5.3 internal (before release) which was the version which had some performance regression those were looked into and from my testing saturn often performs better than vanilla however those features still may tax computers from others, so i decided to make toggles for those things --- src/m_menu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index eac593f18..22be3f8e7 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1438,6 +1438,10 @@ static menuitem_t OP_ExpOptionsMenu[] = #ifdef HWRENDER {IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 75}, {IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_grvhseffect, 85}, + + {IT_STRING | IT_CVAR, NULL, "Splitwall/Slope texture fix", &cv_splitwallfix, 105}, + {IT_STRING | IT_CVAR, NULL, "Slope midtexture peg fix", &cv_slopepegfix, 115}, + {IT_STRING | IT_CVAR, NULL, "ZFighting fix for fofs", &cv_fofzfightfix, 125}, #endif }; @@ -1450,6 +1454,9 @@ static const char* OP_ExpTooltips[] = #ifdef HWRENDER "Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.", "Show a VHS-like effect when the game is paused or youre rewinding replays.", + "Fixes issues that resulted in Textures sticking from the ground sometimes.\n This may be CPU heavy and result in worse performance in some cases.", + "Fixes issues that resulted in Textures not being properly skewed\n example: Fences on slopes that didnt show proper.\n This may be CPU heavy and result in worse performance in some cases.", + "Fixes issues that resulted in Textures on Floor over Floors ZFighting heavily.", #endif }; @@ -1462,6 +1469,9 @@ enum #ifdef HWRENDER op_exp_grscrtx, op_exp_grvhs, + op_exp_spltwal, + op_exp_pegging, + op_exp_fofzfight, #endif }; @@ -4351,6 +4361,9 @@ void M_Init(void) OP_VideoOptionsMenu[op_video_ogl].status = IT_DISABLED; OP_ExpOptionsMenu[op_exp_grscrtx].status = IT_DISABLED; OP_ExpOptionsMenu[op_exp_grvhs].status = IT_DISABLED; + OP_ExpOptionsMenu[op_exp_spltwal].status = IT_DISABLED; + OP_ExpOptionsMenu[op_exp_pegging].status = IT_DISABLED; + OP_ExpOptionsMenu[op_exp_fofzfight].status = IT_DISABLED; } if (rendermode == render_opengl) -- 2.54.0 From caf05f59234f79d57d24333bd2d0473245cbe325 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Nov 2023 05:48:02 +0100 Subject: [PATCH 104/112] e --- src/hardware/hw_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 8d57baf2e..2ce496ae1 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1152,7 +1152,10 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, for (INT32 i = 0; i < sector->numlights; i++) { - if (endtop < endrealbot && top < realbot) +#ifdef ESLOPE + if (endtop < endrealbot) +#endif + if (top < realbot) return; lightlist_t *list = sector->lightlist; -- 2.54.0 From d0f9993385ec27b69ef9573c3b157e41c6d7d99a Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Mon, 27 Nov 2023 06:09:02 +0100 Subject: [PATCH 105/112] add more stuff to experimental video menu + smol cleanup might aswell add the other things --- src/m_menu.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 22be3f8e7..d22d29494 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1431,17 +1431,21 @@ static menuitem_t OP_VideoModeMenu[] = static menuitem_t OP_ExpOptionsMenu[] = { {IT_HEADER, NULL, "Experimental Options", NULL, 10}, - {IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 45}, - {IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 55}, + {IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 35}, + {IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 45}, - {IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_vhseffect, 75}, + {IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_vhseffect, 65}, + + {IT_STRING | IT_CVAR, NULL, "FFloorclip", &cv_ffloorclip, 85}, + {IT_STRING | IT_CVAR, NULL, "Spriteclip", &cv_spriteclip, 95}, #ifdef HWRENDER - {IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 75}, - {IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_grvhseffect, 85}, + {IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 65}, + {IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_grvhseffect, 75}, - {IT_STRING | IT_CVAR, NULL, "Splitwall/Slope texture fix", &cv_splitwallfix, 105}, - {IT_STRING | IT_CVAR, NULL, "Slope midtexture peg fix", &cv_slopepegfix, 115}, - {IT_STRING | IT_CVAR, NULL, "ZFighting fix for fofs", &cv_fofzfightfix, 125}, + {IT_STRING | IT_CVAR, NULL, "Splitwall/Slope texture fix", &cv_splitwallfix, 95}, + {IT_STRING | IT_CVAR, NULL, "Slope midtexture peg fix", &cv_slopepegfix, 105}, + {IT_STRING | IT_CVAR, NULL, "ZFighting fix for fofs", &cv_fofzfightfix, 115}, + {IT_STRING | IT_CVAR, NULL, "FOF wall cutoff for slopes", &cv_grfofcut, 125}, #endif }; @@ -1451,12 +1455,15 @@ static const char* OP_ExpTooltips[] = "Should weather be interpolated? Weather should look about the\nsame but perform a bit better when disabled.", "When weather is on this will cut the object amount used in half.", "Show a VHS-like effect when the game is paused or youre rewinding replays.", + "Hides 3DFloors which are not visible\npotentially resulting in a performance boost.", + "Hides Sprites which are not visible\npotentially resulting in a performance boost.", #ifdef HWRENDER "Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.", "Show a VHS-like effect when the game is paused or youre rewinding replays.", "Fixes issues that resulted in Textures sticking from the ground sometimes.\n This may be CPU heavy and result in worse performance in some cases.", "Fixes issues that resulted in Textures not being properly skewed\n example: Fences on slopes that didnt show proper.\n This may be CPU heavy and result in worse performance in some cases.", "Fixes issues that resulted in Textures on Floor over Floors ZFighting heavily.", + "Toggle for FOF wall cutoff when slopes.", #endif }; @@ -1466,12 +1473,15 @@ enum op_exp_precipinter, op_exp_lessprecip, op_exp_vhs, + op_exp_ffclip, + op_exp_sprclip, #ifdef HWRENDER op_exp_grscrtx, op_exp_grvhs, op_exp_spltwal, op_exp_pegging, op_exp_fofzfight, + op_exp_fofcut, #endif }; @@ -4364,10 +4374,14 @@ void M_Init(void) OP_ExpOptionsMenu[op_exp_spltwal].status = IT_DISABLED; OP_ExpOptionsMenu[op_exp_pegging].status = IT_DISABLED; OP_ExpOptionsMenu[op_exp_fofzfight].status = IT_DISABLED; + OP_ExpOptionsMenu[op_exp_fofcut].status = IT_DISABLED; } - if (rendermode == render_opengl) + if (rendermode == render_opengl){ OP_ExpOptionsMenu[op_exp_vhs].status = IT_DISABLED; + OP_ExpOptionsMenu[op_exp_ffclip].status = IT_DISABLED; + OP_ExpOptionsMenu[op_exp_sprclip].status = IT_DISABLED; + } #endif if (!snw_speedo && !kartzspeedo) // why bother? -- 2.54.0 From 2b75d0b26bc4213e2eab86b3d085ed656c6a30dd Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Nov 2023 18:35:38 +0100 Subject: [PATCH 106/112] replace those with gl error messages instead --- src/hardware/r_opengl/r_opengl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index d558a0834..02e7382c1 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1222,7 +1222,7 @@ EXPORT void HWRAPI(LoadCustomShader) (int number, char *shader, size_t size, boo return; if (number < 1 || number > MAXSHADERS) - I_Error("LoadCustomShader(): cannot load shader %d (max %d)", number, MAXSHADERS); + GL_MSG_Error("LoadCustomShader(): cannot load shader %d (max %d)", number, MAXSHADERS); if (fragment) { @@ -1375,7 +1375,7 @@ void InitPalette(int flashnum, boolean skiplut) pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); if (!pglTexImage3D) - I_Error("pglTexImage3D is NULL!"); + GL_MSG_Error("pglTexImage3D is NULL!"); pglTexImage3D(GL_TEXTURE_3D, 0, internalFormat, LUT_SIZE, LUT_SIZE, LUT_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, pal_lookup_tex); free(pal_lookup_tex); } @@ -1597,7 +1597,7 @@ EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable) ltcachetail->next = NULL; pglGenTextures(1, <cachetail->id); if (!ltcachetail->id) - I_Error("hwr lighttable cache entry id is zero"); + GL_MSG_Error("hwr lighttable cache entry id is zero"); pglBindTexture(GL_TEXTURE_2D, ltcachetail->id); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -- 2.54.0 From 3610096c35ff3730d955bd0da20d38d64fa61d54 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Nov 2023 19:05:17 +0100 Subject: [PATCH 107/112] this always annoyed me why was it always offcenter like that? --- src/m_menu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index d22d29494..73f7348c3 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -11608,7 +11608,7 @@ static void M_DrawSetupMultiPlayerMenu(void) patch = W_CachePatchNum(sprframe->lumppat[speenframe], PU_CACHE); // draw box around guy - V_DrawFill(mx + 43 - (charw/2), my+65, charw, 84, 239); + V_DrawFill(mx + 36 - (charw/2), my+65, charw, 84, 239); // draw player sprite if (setupm_fakecolor) // inverse should never happen @@ -11617,13 +11617,13 @@ static void M_DrawSetupMultiPlayerMenu(void) if (skins[skintodisplay].flags & SF_HIRES) { - V_DrawFixedPatch((mx+43)< Date: Mon, 27 Nov 2023 21:46:18 +0100 Subject: [PATCH 108/112] hopefully fix older hardware crashing even if they dont use palshader also guard the last InitPalette, we do not need to call it if we dont use palshader also if either pglTexImage3D or ltcachetail->id is null, the game wont crash now, instead returns, and turns off the palshader so all should work hopefully --- src/hardware/r_opengl/r_opengl.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 02e7382c1..ef306fcf5 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1222,7 +1222,7 @@ EXPORT void HWRAPI(LoadCustomShader) (int number, char *shader, size_t size, boo return; if (number < 1 || number > MAXSHADERS) - GL_MSG_Error("LoadCustomShader(): cannot load shader %d (max %d)", number, MAXSHADERS); + I_Error("LoadCustomShader(): cannot load shader %d (max %d)", number, MAXSHADERS); if (fragment) { @@ -1307,6 +1307,12 @@ void InitPalette(int flashnum, boolean skiplut) { int i, r, g, b; + if (!pglTexImage3D){ + GL_MSG_Error("pglTexImage3D is NULL!"); + CV_Set(&cv_grpaletteshader, "Off"); // turn that thing off if you cant use it + return; + } + //Hudler: 16/10/99: added for OpenGL gamma correction RGBA_t gamma_correction = {0x7F7F7F7F}; @@ -1374,8 +1380,6 @@ void InitPalette(int flashnum, boolean skiplut) pglBindTexture(GL_TEXTURE_3D, palette_tex_num); pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - if (!pglTexImage3D) - GL_MSG_Error("pglTexImage3D is NULL!"); pglTexImage3D(GL_TEXTURE_3D, 0, internalFormat, LUT_SIZE, LUT_SIZE, LUT_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, pal_lookup_tex); free(pal_lookup_tex); } @@ -1584,6 +1588,12 @@ EXPORT void HWRAPI(ClearMipMapCache) (void) EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable) { + if (!ltcachetail->id){ + GL_MSG_Error("HWR Lighttable cache entry id is zero"); + CV_Set(&cv_grpaletteshader, "Off"); // turn that thing off if you cant use it + return; + } + LightTableCacheEntry_t *cache_entry = malloc(sizeof(LightTableCacheEntry_t)); if (!ltcachetail) { @@ -1596,8 +1606,6 @@ EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable) } ltcachetail->next = NULL; pglGenTextures(1, <cachetail->id); - if (!ltcachetail->id) - GL_MSG_Error("hwr lighttable cache entry id is zero"); pglBindTexture(GL_TEXTURE_2D, ltcachetail->id); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -1734,7 +1742,7 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, pglEnableClientState(GL_VERTEX_ARRAY); // We always use this one pglEnableClientState(GL_TEXTURE_COORD_ARRAY); // And mostly this one, too - if (!gl_palette_initialized) + if ((!gl_palette_initialized) && (HWR_ShouldUsePaletteRendering())) InitPalette(0, false); // just gonna put this here for now } -- 2.54.0 From dc190be6b3771f22992bc68d6c345b048be6d8ce Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Mon, 27 Nov 2023 21:58:28 +0100 Subject: [PATCH 109/112] Zzz... AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --- src/hardware/r_opengl/r_opengl.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index ef306fcf5..ba0c5bef0 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1307,12 +1307,6 @@ void InitPalette(int flashnum, boolean skiplut) { int i, r, g, b; - if (!pglTexImage3D){ - GL_MSG_Error("pglTexImage3D is NULL!"); - CV_Set(&cv_grpaletteshader, "Off"); // turn that thing off if you cant use it - return; - } - //Hudler: 16/10/99: added for OpenGL gamma correction RGBA_t gamma_correction = {0x7F7F7F7F}; @@ -1380,6 +1374,13 @@ void InitPalette(int flashnum, boolean skiplut) pglBindTexture(GL_TEXTURE_3D, palette_tex_num); pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + if (!pglTexImage3D){ + GL_MSG_Error("pglTexImage3D is NULL!"); + CV_Set(&cv_grpaletteshader, "Off"); // turn that thing off if you cant use it + return; + } + pglTexImage3D(GL_TEXTURE_3D, 0, internalFormat, LUT_SIZE, LUT_SIZE, LUT_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, pal_lookup_tex); free(pal_lookup_tex); } @@ -1588,12 +1589,6 @@ EXPORT void HWRAPI(ClearMipMapCache) (void) EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable) { - if (!ltcachetail->id){ - GL_MSG_Error("HWR Lighttable cache entry id is zero"); - CV_Set(&cv_grpaletteshader, "Off"); // turn that thing off if you cant use it - return; - } - LightTableCacheEntry_t *cache_entry = malloc(sizeof(LightTableCacheEntry_t)); if (!ltcachetail) { @@ -1606,6 +1601,11 @@ EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable) } ltcachetail->next = NULL; pglGenTextures(1, <cachetail->id); + if (!ltcachetail->id){ + GL_MSG_Error("HWR Lighttable cache entry id is zero"); + CV_Set(&cv_grpaletteshader, "Off"); // turn that thing off if you cant use it + return; + } pglBindTexture(GL_TEXTURE_2D, ltcachetail->id); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -- 2.54.0 From 4cb3b5bc0d2c8595416c9cc9d61b39aec49d688a Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Mon, 27 Nov 2023 22:28:28 +0100 Subject: [PATCH 110/112] fix hudcolor when returning from time attacking --- src/k_kart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index e199fd01c..f3932fbac 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -599,8 +599,8 @@ UINT8 K_GetHudColor(void) if (cv_colorizedhud.value){ if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value; } - if (stplyr && P_IsLocalPlayer(stplyr)) return stplyr->skincolor; - return (stplyr ? stplyr->skincolor : cv_playercolor.value); + if (stplyr && P_IsLocalPlayer(stplyr) && gamestate == GS_LEVEL) return stplyr->skincolor; + return ((stplyr && gamestate == GS_LEVEL) ? stplyr->skincolor : cv_playercolor.value); } //} @@ -8083,7 +8083,6 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI } } - if (!cv_colorizedhud.value || !clr_hud) V_DrawScaledPatch(TX, TY, splitflags, ((mode == 2) ? kp_lapstickerwide : kp_timestickerwide)); else -- 2.54.0 From 9de9b72940bc2cb63801a91c090ef75531c188cc Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Mon, 27 Nov 2023 22:34:02 +0100 Subject: [PATCH 111/112] do the same for lighttable tex --- src/hardware/r_opengl/r_opengl.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index ba0c5bef0..b69a3c951 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1600,6 +1600,21 @@ EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable) ltcachetail = cache_entry; } ltcachetail->next = NULL; + + GLenum internalFormat; + if (gl_version[0] == '1' || gl_version[0] == '2') + { + // if the OpenGL version is below 3.0, then the GL_R8 format may not be available. + // so use GL_LUMINANCE8 instead to get a single component 8-bit format + // (it is possible to have access to shaders even in some OpenGL 1.x systems, + // so palette rendering can still possibly be achieved there) + internalFormat = GL_LUMINANCE8; + } + else + { + internalFormat = GL_R8; + } + pglGenTextures(1, <cachetail->id); if (!ltcachetail->id){ GL_MSG_Error("HWR Lighttable cache entry id is zero"); @@ -1609,7 +1624,7 @@ EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable) pglBindTexture(GL_TEXTURE_2D, ltcachetail->id); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - pglTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 256, 32, 0, GL_RED, GL_UNSIGNED_BYTE, lighttable); + pglTexImage2D(GL_TEXTURE_2D, 0, internalFormat, 256, 32, 0, GL_RED, GL_UNSIGNED_BYTE, lighttable); // restore previously bound texture if (!gl_batching) -- 2.54.0 From c2ddac2c1eb1365aadd21a160543c6fa1a7947df Mon Sep 17 00:00:00 2001 From: Indev Date: Tue, 28 Nov 2023 01:46:28 +0300 Subject: [PATCH 112/112] Allow using localskins for any kind of mobj from lua --- src/hardware/hw_main.c | 2 +- src/lua_mobjlib.c | 41 ++++++++++++++++++++++++++++++++++------- src/r_things.c | 2 +- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 2ce496ae1..de4ddc765 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5558,7 +5558,7 @@ void HWR_ProjectSprite(mobj_t *thing) rot = thing->frame&FF_FRAMEMASK; //Fab : 02-08-98: 'skin' override spritedef currently used for skin - if (thing->skin && thing->sprite == SPR_PLAY) + if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY) { sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef; #ifdef ROTSPRITE diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index cfc5c8e5f..06c56645f 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -217,7 +217,7 @@ UNIMPLEMENTED(mobjnum) // For some dumb reason it is valid to set sloperoll, even though it is read // only -int mobj_sloperoll_noop(lua_State *L) { return 0; } +int mobj_sloperoll_noop(lua_State *L) { (void)L; return 0; } // Now other getters/setters with arbitary logic @@ -415,13 +415,40 @@ int mobj_localskin_setter(lua_State *L) { mobj_t *mo = GETMO(); - // TODO - add ability to set localskin to non-player mobjs - // Will probably just need to reimplement SetLocalPlayerSkin as something - // like SetLocalObjectSkin - if (!mo->player) - return luaL_error(L, "mobj.localskin can't be set for non-player mobjs!"); + if (mo->player) + { + SetLocalPlayerSkin(mo->player - players, luaL_checkstring(L, 2), NULL); + } + else + { + INT32 i; + char skin[SKINNAMESIZE+1]; // all skin names are limited to this length + strlcpy(skin, luaL_checkstring(L, 2), sizeof skin); + strlwr(skin); // all skin names are lowercase + + // Try localskins + for (i = 0; i < numlocalskins; i++) + { + if (stricmp(localskins[i].name, skin) == 0) + { + mo->localskin = &localskins[i]; + mo->skinlocal = true; + return 0; + } + } + + // Try other skins + for (i = 0; i < numskins; i++) + { + if (fastcmp(skins[i].name, skin)) + { + mo->localskin = &skins[i]; + mo->skinlocal = false; + return 0; + } + } + } - SetLocalPlayerSkin(mo->player - players, luaL_checkstring(L, 2), NULL); return 0; } diff --git a/src/r_things.c b/src/r_things.c index d08b57501..6334716ce 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1399,7 +1399,7 @@ static void R_ProjectSprite(mobj_t *thing) rot = thing->frame&FF_FRAMEMASK; //Fab : 02-08-98: 'skin' override spritedef currently used for skin - if (thing->skin && thing->sprite == SPR_PLAY) + if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY) { sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef; #ifdef ROTSPRITE -- 2.54.0