From c31e7ff2b37abbd561a4e20b05fdaf726f50203a Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Fri, 8 Sep 2023 12:44:13 +0200 Subject: [PATCH 1/8] Optimize sprite rendering by ignoring completely occluded sprites backport of the srb2 thing judging by perfstats it often cuts the spritecount in half take with a grain of salt since i barely tested it software mode only btw https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2131?commit_id=b8313ceda283ac0c8dd9ab6141e83a31f0bb9639 --- src/r_main.c | 29 +++-------------- src/r_main.h | 2 +- src/r_things.c | 86 ++++++++++++++++++++++++++++++++++++++++++++------ src/r_things.h | 9 +++--- 4 files changed, 87 insertions(+), 39 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index dc914e79a..484cda6d7 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -37,16 +37,6 @@ #include "hardware/hw_main.h" #endif -//profile stuff --------------------------------------------------------- -//#define TIMING -#ifdef TIMING -#include "p5prof.h" -INT64 mycount; -INT64 mytotal = 0; -//unsigned long nombre = 100000; -#endif -//profile stuff --------------------------------------------------------- - // Fineangles in the SCREENWIDTH wide window. #define FIELDOFVIEW 2048 @@ -197,7 +187,8 @@ consvar_t cv_flipcam4 = {"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, consvar_t cv_shadow = {"shadow", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_skybox = {"skybox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_ffloorclip = {"ffloorclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_ffloorclip = {"r_ffloorclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_spriteclip = {"r_spriteclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_soniccd = {"soniccd", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_allowmlook = {"allowmlook", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showhud = {"showhud", "Yes", CV_CALL, CV_YesNo, R_SetViewSize, 0, NULL, NULL, 0, 0, NULL}; @@ -1765,26 +1756,15 @@ void R_RenderPlayerView(player_t *player) // The head node is the last node output. -//profile stuff --------------------------------------------------------- -#ifdef TIMING - mytotal = 0; - ProfZeroTimer(); -#endif ps_numbspcalls.value.i = ps_numpolyobjects.value.i = ps_numdrawnodes.value.i = 0; PS_START_TIMING(ps_bsptime); R_RenderBSPNode((INT32)numnodes - 1); PS_STOP_TIMING(ps_bsptime); - ps_numsprites.value.i = visspritecount; PS_START_TIMING(ps_sw_spritecliptime); R_ClipSprites(); PS_STOP_TIMING(ps_sw_spritecliptime); -#ifdef TIMING - RDMSR(0x10, &mycount); - mytotal += mycount; // 64bit add - - CONS_Debug(DBG_RENDER, "RenderBSPNode: 0x%d %d\n", *((INT32 *)&mytotal + 1), (INT32)mytotal); -#endif -//profile stuff --------------------------------------------------------- + + ps_numsprites.value.i = numvisiblesprites; // PORTAL RENDERING PS_START_TIMING(ps_sw_portaltime); @@ -1880,6 +1860,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_shadowoffs); CV_RegisterVar(&cv_skybox); CV_RegisterVar(&cv_ffloorclip); + CV_RegisterVar(&cv_spriteclip); CV_RegisterVar(&cv_cam_dist); CV_RegisterVar(&cv_cam_still); diff --git a/src/r_main.h b/src/r_main.h index 70adf1bb5..bd794abeb 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -110,7 +110,7 @@ extern consvar_t cv_homremoval; extern consvar_t cv_chasecam, cv_chasecam2, cv_chasecam3, cv_chasecam4; extern consvar_t cv_flipcam, cv_flipcam2, cv_flipcam3, cv_flipcam4; extern consvar_t cv_shadow, cv_shadowoffs; -extern consvar_t cv_ffloorclip; +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_fov; diff --git a/src/r_things.c b/src/r_things.c index 26dad2f0b..80a7db511 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -589,7 +589,8 @@ void R_DelSpriteDefs(UINT16 wadnum) // // GAME FUNCTIONS // -UINT32 visspritecount; +UINT32 visspritecount, numvisiblesprites; + static UINT32 clippedvissprites; static vissprite_t *visspritechunks[MAXVISSPRITES >> VISSPRITECHUNKBITS] = {NULL}; @@ -661,7 +662,7 @@ void R_InitSprites(void) // void R_ClearSprites(void) { - visspritecount = clippedvissprites = 0; + visspritecount = numvisiblesprites = clippedvissprites = 0; } // @@ -935,10 +936,10 @@ static void R_DrawVisSprite(vissprite_t *vis) { vis->scale = FixedMul(vis->scale, this_scale); vis->scalestep = FixedMul(vis->scalestep, this_scale); - vis->xiscale = FixedDiv(vis->xiscale,this_scale); + vis->xiscale = FixedDiv(vis->xiscale, this_scale); vis->isScaled = true; } - dc_texturemid = FixedDiv(dc_texturemid,this_scale); + dc_texturemid = FixedDiv(dc_texturemid, this_scale); } spryscale = vis->scale; @@ -1195,6 +1196,8 @@ static void R_ProjectSprite(mobj_t *thing) INT32 lindex; vissprite_t *vis; + + spritecut_e cut = SC_NONE; angle_t ang = 0; // gcc 4.6 and lower fix fixed_t iscale; @@ -1348,9 +1351,6 @@ static void R_ProjectSprite(mobj_t *thing) I_Assert(lump < max_spritelumps); - if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES) - this_scale = FixedMul(this_scale, ((skin_t *)thing->skin)->highresscale); - spr_width = spritecachedinfo[lump].width; spr_height = spritecachedinfo[lump].height; spr_offset = spritecachedinfo[lump].offset; @@ -1392,6 +1392,14 @@ static void R_ProjectSprite(mobj_t *thing) // calculate edges of the shape spritexscale = interp.spritexscale; spriteyscale = interp.spriteyscale; + + if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES) + { + fixed_t highresscale = ((skin_t *)thing->skin)->highresscale; + spritexscale = FixedMul(spritexscale, highresscale); + spriteyscale = FixedMul(spriteyscale, highresscale); + } + if (spritexscale < 1 || spriteyscale < 1) return; @@ -2085,12 +2093,15 @@ void R_SortVisSprites(void) best = ds; } } + if (best) + { best->next->prev = best->prev; best->prev->next = best->next; best->next = &vsprsortedhead; best->prev = vsprsortedhead.prev; vsprsortedhead.prev->next = best; vsprsortedhead.prev = best; + } } } @@ -2452,7 +2463,45 @@ static void R_DrawPrecipitationSprite(vissprite_t *spr) R_DrawPrecipitationVisSprite(spr); } -// R_ClipSprites +static boolean R_CheckSpriteVisible(vissprite_t *spr, INT32 x1, INT32 x2) +{ + INT16 sz = spr->sz; + INT16 szt = spr->szt; + + fixed_t texturemid, yscale, scalestep = spr->scalestep; + INT32 height; + + if (scalestep) + { + height = spr->patch->height; + yscale = spr->scale; + scalestep = FixedMul(scalestep, spr->spriteyscale); + + if (spr->thingscale != FRACUNIT) + texturemid = FixedDiv(spr->texturemid, max(spr->thingscale, 1)); + else + texturemid = spr->texturemid; + } + + for (INT32 x = x1; x <= x2; x++) + { + if (scalestep) + { + fixed_t top = centeryfrac - FixedMul(texturemid, yscale); + fixed_t bottom = top + (height * yscale); + szt = (INT16)(top >> FRACBITS); + sz = (INT16)(bottom >> FRACBITS); + yscale += scalestep; + } + + if (spr->cliptop[x] < spr->clipbot[x] && sz > spr->cliptop[x] && szt < spr->clipbot[x]) + return true; + } + + return false; +} + +// R_ClipVisSprite // Clips vissprites without drawing, so that portals can work. -Red void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2) { @@ -2635,8 +2684,15 @@ void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2) spr->clipbot[x] = (INT16)viewheight; if (spr->cliptop[x] == -2) - //Fab : 26-04-98: was -1, now clips against console bottom - spr->cliptop[x] = (INT16)con_clipviewtop; + spr->cliptop[x] = -1; + } + + // Check if it'll be visible + // Not done for floorsprites. + if (cv_spriteclip.value) + { + if (!R_CheckSpriteVisible(spr, x1, x2)) + spr->cut |= SC_NOTVISIBLE; } } @@ -2705,6 +2761,13 @@ void R_ClipSprites(void) for (; clippedvissprites < visspritecount; clippedvissprites++) { vissprite_t *spr = R_GetVisSprite(clippedvissprites); + + if (cv_spriteclip.value + && (spr->szt > vid.height || spr->sz < 0)) + { + spr->cut |= SC_NOTVISIBLE; + continue; + } if (spr->x2 < cx) { @@ -2723,6 +2786,9 @@ void R_ClipSprites(void) } R_ClipVisSprite(spr, spr->x1, spr->x2); + + if ((spr->cut & SC_NOTVISIBLE) == 0) + numvisiblesprites++; } } diff --git a/src/r_things.h b/src/r_things.h index ab4688f91..cb96ffbae 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -109,7 +109,10 @@ typedef enum SC_NONE = 0, SC_TOP = 1, SC_BOTTOM = 2, - SC_VFLIP = 3 + SC_VFLIP = 3, + SC_NOTVISIBLE = 4, + SC_CUTMASK = SC_TOP|SC_BOTTOM|SC_NOTVISIBLE, + SC_FLAGMASK = ~SC_CUTMASK } spritecut_e; // A vissprite_t is a thing that will be drawn during a refresh, @@ -152,8 +155,6 @@ typedef struct vissprite_s extracolormap_t *extra_colormap; // global colormaps - //fixed_t xscale; - // Precalculated top and bottom screen coords for the sprite. fixed_t thingheight; // The actual height of the thing (for 3D floors) sector_t *sector; // The sector containing the thing. @@ -175,7 +176,7 @@ typedef struct vissprite_s INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing } vissprite_t; -extern UINT32 visspritecount; +extern UINT32 visspritecount, numvisiblesprites; void R_ClipSprites(void); void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2); -- 2.54.0 From 58c72ab3458d9f50ee16da55af95f6b94709497a Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Wed, 8 Nov 2023 18:46:41 +0100 Subject: [PATCH 2/8] make it actually do something knew it didnt really work before --- src/r_things.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 12ae1f2ea..115ad1d70 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1472,11 +1472,6 @@ static void R_ProjectSprite(mobj_t *thing) I_Assert(lump < max_spritelumps); - if (thing->localskin && ((skin_t *)thing->localskin)->flags & SF_HIRES) - this_scale = FixedMul(this_scale, ((skin_t *)thing->localskin)->highresscale); - else if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES) - this_scale = FixedMul(this_scale, ((skin_t *)thing->skin)->highresscale); - spr_width = spritecachedinfo[lump].width; spr_height = spritecachedinfo[lump].height; spr_offset = spritecachedinfo[lump].offset; @@ -1519,12 +1514,19 @@ static void R_ProjectSprite(mobj_t *thing) spritexscale = interp.spritexscale; spriteyscale = interp.spriteyscale; - if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES) + if (thing->localskin && ((skin_t *)thing->localskin)->flags & SF_HIRES) + { + fixed_t highresscale = ((skin_t *)thing->localskin)->highresscale; + spritexscale = FixedMul(spritexscale, highresscale); + spriteyscale = FixedMul(spriteyscale, highresscale); + } + else if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES) { fixed_t highresscale = ((skin_t *)thing->skin)->highresscale; spritexscale = FixedMul(spritexscale, highresscale); spriteyscale = FixedMul(spriteyscale, highresscale); } + if (spritexscale < 1 || spriteyscale < 1) return; @@ -2204,6 +2206,14 @@ void R_SortVisSprites(void) bestscale = bestdispoffset = INT32_MAX; for (ds = unsorted.next; ds != &unsorted; ds = ds->next) { + // Remove this sprite if it was determined to not be visible + if (ds->cut & SC_NOTVISIBLE) + { + ds->next->prev = ds->prev; + ds->prev->next = ds->next; + continue; + } + if (ds->sortscale < bestscale) { bestscale = ds->sortscale; @@ -2219,12 +2229,12 @@ void R_SortVisSprites(void) } if (best) { - best->next->prev = best->prev; - best->prev->next = best->next; - best->next = &vsprsortedhead; - best->prev = vsprsortedhead.prev; - vsprsortedhead.prev->next = best; - vsprsortedhead.prev = best; + best->next->prev = best->prev; + best->prev->next = best->next; + best->next = &vsprsortedhead; + best->prev = vsprsortedhead.prev; + vsprsortedhead.prev->next = best; + vsprsortedhead.prev = best; } } } -- 2.54.0 From b8ada40a72b2fd08faf13b25186183069c5b75f0 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Wed, 8 Nov 2023 18:55:21 +0100 Subject: [PATCH 3/8] fix highres sprites --- src/r_things.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 115ad1d70..c89a6c603 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1471,6 +1471,11 @@ static void R_ProjectSprite(mobj_t *thing) } I_Assert(lump < max_spritelumps); + + if (thing->localskin && ((skin_t *)thing->localskin)->flags & SF_HIRES) + this_scale = FixedMul(this_scale, ((skin_t *)thing->localskin)->highresscale); + else if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES) + this_scale = FixedMul(this_scale, ((skin_t *)thing->skin)->highresscale); spr_width = spritecachedinfo[lump].width; spr_height = spritecachedinfo[lump].height; @@ -1514,20 +1519,6 @@ static void R_ProjectSprite(mobj_t *thing) spritexscale = interp.spritexscale; spriteyscale = interp.spriteyscale; - if (thing->localskin && ((skin_t *)thing->localskin)->flags & SF_HIRES) - { - fixed_t highresscale = ((skin_t *)thing->localskin)->highresscale; - spritexscale = FixedMul(spritexscale, highresscale); - spriteyscale = FixedMul(spriteyscale, highresscale); - } - else if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES) - { - fixed_t highresscale = ((skin_t *)thing->skin)->highresscale; - spritexscale = FixedMul(spritexscale, highresscale); - spriteyscale = FixedMul(spriteyscale, highresscale); - } - - if (spritexscale < 1 || spriteyscale < 1) return; -- 2.54.0 From c01bc39659cd07b5aed16377f779bb5f182d73a7 Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 9 Nov 2023 11:20:31 +0300 Subject: [PATCH 4/8] Add stat display --- src/k_kart.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index ce9918d85..4c9317797 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -54,6 +54,10 @@ consvar_t cv_mini_yoffset = {"hud_minimap_yoffset", "0", CV_SAVE, NULL, NULL, 0, consvar_t cv_want_xoffset = {"hud_wanted_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_want_yoffset = {"hud_wanted_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_stat_xoffset = {"hud_stat_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_stat_yoffset = {"hud_stat_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +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}; @@ -679,7 +683,10 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_mini_yoffset); CV_RegisterVar(&cv_want_xoffset); CV_RegisterVar(&cv_want_yoffset); + CV_RegisterVar(&cv_stat_xoffset); + CV_RegisterVar(&cv_stat_yoffset); + CV_RegisterVar(&cv_showstats); CV_RegisterVar(&cv_showinput); CV_RegisterVar(&cv_newspeedometer); @@ -7531,6 +7538,88 @@ INT32 K_calcSplitFlags(INT32 snapflags) return (splitflags|snapflags); } +static void K_drawKartStats(void) +{ + INT32 x, y, flags; + + // For 1-player display + x = 15; + y = 150; + flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT; + + UINT8 splitnum = 0; + + for (; splitnum < MAXSPLITSCREENPLAYERS; ++splitnum) + { + if (stplyr == &players[displayplayers[splitnum]]) + break; + } + + // I tried my best, but this is still mess :/ + if (splitscreen) + { + if (splitscreen == 1) + { + // If we are in 2-player splitscreen, for player 1 we move hud to up and remove snapping + // to bottom + if (splitnum == 0) + { + y /= 2; + flags = V_SNAPTOLEFT; + } + else + { + // Can move it down a bit + y += 20; + } + } + else + { + // In 4-player splitscreen... + flags = 0; + + // ...For players 2 and 4, which are at right side, we move x coordinate... + if (splitnum == 1 || splitnum == 3) + x += BASEVIDWIDTH/2; + // ...Else, for players on left side we can snap position to left... + else + flags |= V_SNAPTOLEFT; + + // ...For players 1 and 2, which are at top side, we move y coordinate... + if (splitnum == 0 || splitnum == 1) + y /= 2; + // ...Else, for players on bottom side we can snap position to bottom + else + { + flags |= V_SNAPTOBOTTOM; + // Can move it down a bit + y += 20; + } + } + } + + // Customizations c: + x += cv_stat_xoffset.value; + y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0); + flags |= V_HUDTRANS; + + if (!splitscreen) + { + // Skin name + 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, 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)); + } + else + { + // In splitscreen, just draw a string with stats + V_DrawString(x, y+10, flags, va("\x84%dS \x87%dW", stplyr->kartspeed, stplyr->kartweight)); + } +} + static void K_drawKartItem(void) { // ITEM_X = BASEVIDWIDTH-50; // 270 @@ -9809,6 +9898,9 @@ void K_drawKartHUD(void) #endif K_drawInput(); + if (!demo.title && cv_showstats.value) + K_drawKartStats(); + if (demo.title) // Draw title logo instead in demo.titles { INT32 x = BASEVIDWIDTH - 32, y = 128, offs; -- 2.54.0 From 018bac2be6a98f0ef890f837f37bd81267a753cb Mon Sep 17 00:00:00 2001 From: NepDisk Date: Thu, 9 Nov 2023 06:13:33 -0500 Subject: [PATCH 5/8] Add menus and redo saturn menu offsets so it fits --- src/k_kart.c | 18 +++++++++++++++--- src/k_kart.h | 3 +++ src/m_menu.c | 35 ++++++++++++++++++++--------------- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 4c9317797..247c549bc 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7540,11 +7540,12 @@ INT32 K_calcSplitFlags(INT32 snapflags) static void K_drawKartStats(void) { - INT32 x, y, flags; + INT32 x, y, spdoffset, flags; // For 1-player display x = 15; y = 150; + spdoffset = 0; flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT; UINT8 splitnum = 0; @@ -7597,10 +7598,21 @@ static void K_drawKartStats(void) } } } - + + //Internal offset for speedometer + if (cv_kartspeedometer.value) + { + if (cv_newspeedometer.value) + spdoffset = -10; + else + spdoffset = -14; + } + else + spdoffset = 0; + // Customizations c: x += cv_stat_xoffset.value; - y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0); + y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset; flags |= V_HUDTRANS; if (!splitscreen) diff --git a/src/k_kart.h b/src/k_kart.h index 1b8e9c7ab..e5dbad724 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -26,6 +26,9 @@ extern consvar_t cv_colorizeditembox; extern consvar_t cv_colorizedhudcolor; extern consvar_t cv_darkitembox; extern consvar_t cv_biglaps; +extern consvar_t cv_stat_xoffset; +extern consvar_t cv_stat_yoffset; +extern consvar_t cv_showstats; boolean K_IsPlayerLosing(player_t *player); boolean K_IsPlayerWanted(player_t *player); diff --git a/src/m_menu.c b/src/m_menu.c index 454b6a3dd..6d0aa0f41 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1721,21 +1721,23 @@ static menuitem_t OP_SaturnMenu[] = { {IT_HEADER, NULL, "Saturn Options", NULL, 0}, {IT_STRING | IT_CVAR, NULL, "Serverqueue waittime", &cv_connectawaittime, 15}, - {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 35}, - {IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 45}, - {IT_STRING | IT_CVAR, NULL, "Small Speedometer", &cv_newspeedometer, 55}, - {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 65}, - {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 75}, - {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 85}, - {IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 95}, - {IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 105}, - {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 115}, - {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 125}, + {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 30}, + {IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 40}, + {IT_STRING | IT_CVAR, NULL, "Small Speedometer", &cv_newspeedometer, 50}, + {IT_STRING | IT_CVAR, NULL, "Stat Display", &cv_showstats, 60}, - {IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 140}, - {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 155}, + {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 75}, + {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 85}, + {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 95}, + {IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 105}, + {IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 115}, + {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 125}, + {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 135}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 170}, // uwu + {IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 150}, + {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 160}, + + {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 175}, // uwu }; enum @@ -1745,6 +1747,7 @@ enum sm_skinselspeed, sm_input, sm_speedometer, + sm_statdisplay, sm_colorhud, sm_colorhud_customcolor, sm_lapemblem, @@ -1798,6 +1801,8 @@ static menuitem_t OP_HudOffsetMenu[] = {IT_STRING | IT_CVAR, NULL, "Miniranking Vertical Offset", &cv_face_yoffset, 130}, {IT_STRING | IT_CVAR, NULL, "Minimap Horizontal Offset", &cv_mini_xoffset, 145}, {IT_STRING | IT_CVAR, NULL, "Minimap Vertical Offset", &cv_mini_yoffset, 155}, + {IT_STRING | IT_CVAR, NULL, "Stat Display Horizontal Offset", &cv_stat_xoffset, 170}, + {IT_STRING | IT_CVAR, NULL, "Stat Display Vertical Offset", &cv_stat_yoffset, 180}, }; static menuitem_t OP_SaturnCreditsMenu[] = @@ -2417,9 +2422,9 @@ menu_t OP_DiscordOptionsDef = DEFAULTMENUSTYLE(NULL, OP_DiscordOptionsMenu, &OP_ #endif menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOptionsDef, 30, 30); -menu_t OP_SaturnDef = DEFAULTMENUSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 15); +menu_t OP_SaturnDef = DEFAULTMENUSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 5); menu_t OP_PlayerDistortDef = DEFAULTMENUSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30); -menu_t OP_HudOffsetDef = DEFAULTMENUSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnDef, 30, 20); +menu_t OP_HudOffsetDef = DEFAULTMENUSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnDef, 30, 5); menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 10); menu_t OP_BirdDef = DEFAULTMENUSTYLE(NULL, OP_BirdMenu, &OP_MainDef, 30, 30); -- 2.54.0 From cc01c576a3a6c62bee288e534dd85a546ee63a9c Mon Sep 17 00:00:00 2001 From: NepDisk Date: Thu, 9 Nov 2023 06:19:26 -0500 Subject: [PATCH 6/8] move zero down for saturn menu by 5 --- 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 6d0aa0f41..040bc348e 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2422,7 +2422,7 @@ menu_t OP_DiscordOptionsDef = DEFAULTMENUSTYLE(NULL, OP_DiscordOptionsMenu, &OP_ #endif menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOptionsDef, 30, 30); -menu_t OP_SaturnDef = DEFAULTMENUSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 5); +menu_t OP_SaturnDef = DEFAULTMENUSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 10); menu_t OP_PlayerDistortDef = DEFAULTMENUSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30); menu_t OP_HudOffsetDef = DEFAULTMENUSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnDef, 30, 5); menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 10); -- 2.54.0 From 6d5d1a13391657adc82871fc66d207f19bedafe8 Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 9 Nov 2023 21:34:40 +0300 Subject: [PATCH 7/8] Fix RA ghosts failing to load --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index 1e7dbd642..b4dfbf074 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -8206,7 +8206,7 @@ void G_AddGhost(char *defdemoname) count = READUINT16(p); while (count--) { - SKIPSTRING(p); + p += 2; SKIPSTRING(p); p++; } -- 2.54.0 From cd804c5984b761fc801bc4dba3e8b9ccd4ddeb92 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 10 Nov 2023 01:01:24 +0100 Subject: [PATCH 8/8] Fix FOFs with transferline flag and many linedefs randomly crashing linenum could go out of bounds if you use more than 4 linedefs for such setup, hence making the game unable to retrieve textures and therefore crashing the games sometimes Visually its not perfect, but you shouldnt do it anyways, atleast it wont crash everything now ty much indev <3 --- src/hardware/hw_main.c | 4 ++-- src/r_segs.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 950c34bd7..6874539fd 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2276,7 +2276,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (rover->master->flags & ML_TFERLINE) { - size_t linenum = gr_curline->linedef-gr_backsector->lines[0]; + size_t linenum = min(gr_curline->linedef-gr_backsector->lines[0], rover->master->frontsector->linecount); newline = rover->master->frontsector->lines[0] + linenum; texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } @@ -2448,7 +2448,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (rover->master->flags & ML_TFERLINE) { - size_t linenum = gr_curline->linedef-gr_backsector->lines[0]; + size_t linenum = min(gr_curline->linedef-gr_backsector->lines[0], rover->master->frontsector->linecount); newline = rover->master->frontsector->lines[0] + linenum; texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } diff --git a/src/r_segs.c b/src/r_segs.c index 53f12ecc6..f897a8b01 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -755,7 +755,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (pfloor->master->flags & ML_TFERLINE) { - size_t linenum = curline->linedef-backsector->lines[0]; + size_t linenum = min(curline->linedef-backsector->lines[0], pfloor->master->frontsector->linecount); newline = pfloor->master->frontsector->lines[0] + linenum; texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } -- 2.54.0