From 0bc95e4b5e256d5324314f8321b6779d1fe74a19 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 1 Jan 2025 23:28:48 +0100 Subject: [PATCH 01/27] speed up camera position checks --- src/p_map.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index ecaf322d2..9b201bab9 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2003,7 +2003,11 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) tmbbox[BOXRIGHT] = x + thiscam->radius; tmbbox[BOXLEFT] = x - thiscam->radius; - newsubsec = R_PointInSubsector(x, y); + if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL) + newsubsec = R_PointInSubsectorFast(x, y); + else + newsubsec = thiscam->subsector; + ceilingline = blockingline = NULL; mapcampointer = thiscam; @@ -2175,7 +2179,13 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) // boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) { - subsector_t *s = R_PointInSubsector(x, y); + subsector_t *s; + + if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL) + s = R_PointInSubsectorFast(x, y); + else + s = thiscam->subsector; + boolean retval = true; boolean itsatwodlevel = false; UINT8 i; @@ -2378,10 +2388,13 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) radius = MAXRADIUS/2; do { - if (thing->flags & MF_NOCLIP) { + if (thing->flags & MF_NOCLIP) + { tryx = x; tryy = y; - } else { + } + else + { if (x-tryx > radius) tryx += radius; else if (x-tryx < -radius) @@ -2525,14 +2538,16 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (!(thing->flags & MF_NOCLIPHEIGHT)) { // Assign thing's standingslope if needed - if (thing->z <= tmfloorz && !(thing->eflags & MFE_VERTICALFLIP)) { + if (thing->z <= tmfloorz && !(thing->eflags & MFE_VERTICALFLIP)) + { if (!startingonground && tmfloorslope) P_HandleSlopeLanding(thing, tmfloorslope); if (thing->momz <= 0) thing->standingslope = tmfloorslope; } - else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) { + else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) + { if (!startingonground && tmceilingslope) P_HandleSlopeLanding(thing, tmceilingslope); From f9f7090b633075c5e5217713b713284125273100 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 1 Jan 2025 23:30:16 +0100 Subject: [PATCH 02/27] save subsector checks for dedi --- src/p_map.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 9b201bab9..41ed6895a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2181,11 +2181,6 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) { subsector_t *s; - if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL) - s = R_PointInSubsectorFast(x, y); - else - s = thiscam->subsector; - boolean retval = true; boolean itsatwodlevel = false; UINT8 i; @@ -2195,6 +2190,11 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) if (dedicated) // this crashes so don't even try it return false; + if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL) + s = R_PointInSubsectorFast(x, y); + else + s = thiscam->subsector; + if (twodlevel) itsatwodlevel = true; else From 2f014bb505375a4d92e27c04301d1b4d99e6ec4e Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 3 Jan 2025 15:56:46 +0100 Subject: [PATCH 03/27] apparently this is slower for everything but rendering --- src/d_clisrv.c | 2 +- src/hardware/hw_main.c | 2 +- src/hardware/hw_portal.c | 2 +- src/p_map.c | 4 ++-- src/p_mobj.c | 4 ++-- src/p_setup.c | 4 ++-- src/p_user.c | 4 ++-- src/r_fps.c | 2 +- src/r_main.h | 11 ----------- src/s_sound.c | 4 ++-- 10 files changed, 14 insertions(+), 25 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 5d04b98e0..4d9270853 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1959,7 +1959,7 @@ static void CL_ReloadReceivedSavegame(void) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { - camera[i].subsector = R_PointInSubsectorFast(camera[i].x, camera[i].y); + camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y); } cl_redownloadinggamestate = false; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 5eefc9c7e..3737b537d 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3172,7 +3172,7 @@ static gl_vissprite_t *HWR_NewVisSprite(void) // Finds a floor through which light does not pass. static fixed_t HWR_OpaqueFloorAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) { - const sector_t *sec = R_PointInSubsectorFast(x, y)->sector; + const sector_t *sec = R_PointInSubsector(x, y)->sector; fixed_t floorz = sec->floorheight; if (sec->ffloors) diff --git a/src/hardware/hw_portal.c b/src/hardware/hw_portal.c index f26e71331..27d77af2e 100644 --- a/src/hardware/hw_portal.c +++ b/src/hardware/hw_portal.c @@ -132,7 +132,7 @@ void HWR_PortalFrame(gl_portal_t* portal) { portalclipline = NULL; portalcullsector = NULL; - viewsector = R_PointInSubsectorFast(viewx, viewy)->sector; + viewsector = R_PointInSubsector(viewx, viewy)->sector; } } diff --git a/src/p_map.c b/src/p_map.c index 41ed6895a..df03bcb76 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2004,7 +2004,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) tmbbox[BOXLEFT] = x - thiscam->radius; if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL) - newsubsec = R_PointInSubsectorFast(x, y); + newsubsec = R_PointInSubsector(x, y); else newsubsec = thiscam->subsector; @@ -2191,7 +2191,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) return false; if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL) - s = R_PointInSubsectorFast(x, y); + s = R_PointInSubsector(x, y); else s = thiscam->subsector; diff --git a/src/p_mobj.c b/src/p_mobj.c index 779546e2b..d0cbe6ae4 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3340,7 +3340,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled if (!itsatwodlevel) P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam); - thiscam->subsector = R_PointInSubsectorFast(thiscam->x, thiscam->y); + thiscam->subsector = R_PointInSubsector(thiscam->x, thiscam->y); thiscam->floorz = tmfloorz; thiscam->ceilingz = tmceilingz; @@ -10418,7 +10418,7 @@ void P_PrecipitationEffects(void) for (y = yl; y <= yh; y += RADIUSSTEP) for (x = xl; x <= xh; x += RADIUSSTEP) { - if (R_PointInSubsectorFast((fixed_t)x, (fixed_t)y)->sector->ceilingpic != skyflatnum) // Found the outdoors! + if (R_PointInSubsector((fixed_t)x, (fixed_t)y)->sector->ceilingpic != skyflatnum) // Found the outdoors! continue; newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, (fixed_t)x, (fixed_t)y, 0); diff --git a/src/p_setup.c b/src/p_setup.c index 0e7f89dcf..477b805db 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2437,7 +2437,7 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam) cam->y = players[pnum].mo->y; cam->z = players[pnum].mo->z; cam->angle = players[pnum].mo->angle; - cam->subsector = R_PointInSubsectorFast(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18) + cam->subsector = R_PointInSubsector(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18) } else { @@ -2462,7 +2462,7 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam) cam->y = thing->y; cam->z = thing->z; cam->angle = FixedAngle((fixed_t)thing->angle << FRACBITS); - cam->subsector = R_PointInSubsectorFast(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18) + cam->subsector = R_PointInSubsector(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18) } } diff --git a/src/p_user.c b/src/p_user.c index 3133ee49b..df5a859ab 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3352,7 +3352,7 @@ void P_DemoCameraMovement(camera_t *cam) democam.soundmobj = awayviewmobj_hack; // update subsector to avoid crashes; - cam->subsector = R_PointInSubsectorFast(cam->x, cam->y); + cam->subsector = R_PointInSubsector(cam->x, cam->y); } void P_ResetCamera(player_t *player, camera_t *thiscam) @@ -3394,7 +3394,7 @@ void P_ResetCamera(player_t *player, camera_t *thiscam) thiscam->relativex = 0; - thiscam->subsector = R_PointInSubsectorFast(thiscam->x,thiscam->y); + thiscam->subsector = R_PointInSubsector(thiscam->x,thiscam->y); thiscam->radius = 20*FRACUNIT; thiscam->height = 16*FRACUNIT; diff --git a/src/r_fps.c b/src/r_fps.c index b861dea56..92eb37a32 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -198,7 +198,7 @@ void R_InterpolateView(fixed_t frac, boolean forceinvalid) viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT); viewplayer = newview->player; - viewsector = R_PointInSubsectorFast(viewx, viewy)->sector; + viewsector = R_PointInSubsector(viewx, viewy)->sector; R_SetupFreelook(); } diff --git a/src/r_main.h b/src/r_main.h index 523e924d5..c66c9bf55 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -140,17 +140,6 @@ FUNCINLINE static ATTRINLINE subsector_t *R_PointInSubsector(fixed_t x, fixed_t return &subsectors[nodenum & ~NF_SUBSECTOR]; } -// uses R_PointOnSideFast -// SHOULD NOT BE USED FOR ANYTHING GAMEPLAY RELATED!! -FUNCINLINE static ATTRINLINE subsector_t *R_PointInSubsectorFast(fixed_t x, fixed_t y) -{ - size_t nodenum = numnodes-1; - - while (!(nodenum & NF_SUBSECTOR)) - nodenum = nodes[nodenum].children[R_PointOnSideFast(x, y, nodes+nodenum)]; - - return &subsectors[nodenum & ~NF_SUBSECTOR]; -} #define R_PointToDist(x, y) R_PointToDist2(viewx, viewy, x, y) #define R_PointToDist2(px2, py2, px1, py1) FixedHypot((px1) - (px2), (py1) - (py2)) diff --git a/src/s_sound.c b/src/s_sound.c index c770957b6..acd066420 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1031,7 +1031,7 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 INT64 x, y, yl, yh, xl, xh; fixed_t newdist; - if (R_PointInSubsectorFast(listensource.x, listensource.y)->sector->ceilingpic == skyflatnum) + if (R_PointInSubsector(listensource.x, listensource.y)->sector->ceilingpic == skyflatnum) approx_dist = 0; else { @@ -1044,7 +1044,7 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 for (y = yl; y <= yh; y += FRACUNIT*64) for (x = xl; x <= xh; x += FRACUNIT*64) { - if (R_PointInSubsectorFast(x, y)->sector->ceilingpic == skyflatnum) + if (R_PointInSubsector(x, y)->sector->ceilingpic == skyflatnum) { // Found the outdoors! newdist = S_CalculateSoundDistance(listensource.x, listensource.y, 0, x, y, 0); From b3b19eff4933d1d4c4956552d616da12ba3915c7 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 13 Jan 2025 07:55:02 +0100 Subject: [PATCH 04/27] this doesent work out breaks some textures not appearing on some maps --- src/r_segs.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index d6f7c9d2a..63f5378d0 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1613,12 +1613,6 @@ static INT64 R_CalcSegDist(seg_t* seg, INT64 x2, INT64 y2) } } -static inline INT32 get_flat_tex (INT32 texnum) -{ - texnum = R_GetTextureNum(texnum); - return textures[texnum]->holes ? 0 : texnum; // R_DrawWallColumn cannot render holey textures -} - // // R_StoreWallRange // A wall segment will be drawn @@ -1874,7 +1868,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) { fixed_t texheight; // single sided line - midtexture = get_flat_tex(sidedef->midtexture); + midtexture = R_GetTextureNum(sidedef->midtexture); texheight = textureheight[midtexture]; // a single sided line is terminal, so it must mark ends markfloor = markceiling = true; @@ -2051,15 +2045,15 @@ void R_StoreWallRange(INT32 start, INT32 stop) { // Special case... use offsets from 2nd side but only if it has a texture. side_t *def = &sides[linedef->sidenum[1]]; - toptexture = get_flat_tex(def->toptexture); + toptexture = R_GetTextureNum(def->toptexture); if (!toptexture) //Second side has no texture, use the first side's instead. - toptexture = get_flat_tex(sidedef->toptexture); + toptexture = R_GetTextureNum(sidedef->toptexture); texheight = textureheight[toptexture]; } else { - toptexture = get_flat_tex(sidedef->toptexture); + toptexture = R_GetTextureNum(sidedef->toptexture); texheight = textureheight[toptexture]; } if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked @@ -2084,7 +2078,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (worldlow > worldbottom || worldlowslope > worldbottomslope) // Only if VISIBLE!!! { // bottom texture - bottomtexture = get_flat_tex(sidedef->bottomtexture); + bottomtexture = R_GetTextureNum(sidedef->bottomtexture); if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked if (linedef->flags & ML_DONTPEGBOTTOM) From d3b8e11783e0e7449b7fffe561c485a6c151fc89 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 11 Jan 2025 22:34:45 +0100 Subject: [PATCH 05/27] one line this --- src/hardware/hw_main.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 0c2de5227..09b8c064d 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2340,31 +2340,19 @@ doaddline: // HWR_CheckBBox // Checks BSP node/subtree bounding box. // Returns true -// if some part of the bbox might be visible. +// if some part of the bbox might be visible. // // modified to use local variables static boolean HWR_CheckBBox(const fixed_t *bspcoord) { - INT32 boxpos; fixed_t px1, py1, px2, py2; angle_t angle1, angle2; // Find the corners of the box // that define the edges from current viewpoint. - if (viewx <= bspcoord[BOXLEFT]) - boxpos = 0; - else if (viewx < bspcoord[BOXRIGHT]) - boxpos = 1; - else - boxpos = 2; - - if (viewy >= bspcoord[BOXTOP]) - boxpos |= 0; - else if (viewy > bspcoord[BOXBOTTOM]) - boxpos |= 1<<2; - else - boxpos |= 2<<2; + const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT ] ? 1 : 2) + + (viewy >= bspcoord[BOXTOP ] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8); if (boxpos == 5) return true; @@ -3093,18 +3081,18 @@ static void HWR_RenderBSPNode(INT32 bspnum) INT32 side; ps_numbspcalls.value.i++; - while (!(bspnum & NF_SUBSECTOR)) // Found a subsector? + while (!(bspnum & NF_SUBSECTOR)) // Keep going until found a subsector { bsp = &nodes[bspnum]; // Decide which side the view point is on. side = R_PointOnSideFast(viewx, viewy, bsp); - // Recursively divide front space. + // Recursively divide front space (toward the viewer). if (HWR_PortalCheckBBox(bsp->bbox[side])) HWR_RenderBSPNode(bsp->children[side]); - // Possibly divide back space + // Possibly divide back space (away from the viewer). if (!(HWR_CheckBBox(bsp->bbox[side^1]) && HWR_PortalCheckBBox(bsp->bbox[side^1]))) return; @@ -5253,12 +5241,12 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl // Set transform. GL_SetTransform(&atransform); - validcount++; - ps_numbspcalls.value.i = 0; ps_numpolyobjects.value.i = 0; PS_START_TIMING(ps_bsptime); + validcount++; + if (cv_glbatching.value) HWR_StartBatching(); From 181c948e867290a31c5a4c1f92f4baf101334d7c Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 13 Jan 2025 08:21:58 +0100 Subject: [PATCH 06/27] toggle for camera turnaround on timeover --- src/p_local.h | 1 + src/p_user.c | 11 +++++++++-- src/r_main.c | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index acb62ad67..720613677 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -135,6 +135,7 @@ extern consvar_t cv_cam_height[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_cam_speed[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_cam_rotate[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_cam_rotspeed[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_cam_timeover[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_tilting; extern consvar_t cv_quaketilt; diff --git a/src/p_user.c b/src/p_user.c index 0e587e659..db81dc522 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3104,6 +3104,13 @@ consvar_t cv_cam_rotspeed[MAXSPLITSCREENPLAYERS] = { {"cam4_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; +consvar_t cv_cam_timeover[MAXSPLITSCREENPLAYERS] = { + {"cam_timeover", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"cam2_timeover", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"cam3_timeover", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"cam4_timeover", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}, +}; + consvar_t cv_tilting = {"tilting", "Off", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_quaketilt = {"quaketilt", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_tiltsmoothing = {"tiltsmoothing", "32", CV_SAVE, CV_Natural, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -3674,8 +3681,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall mo = player->mo; - if (player->pflags & PF_TIMEOVER) // 1 for momentum keep, 2 for turnaround - timeover = (player->kartstuff[k_timeovercam] > 2*TICRATE ? 2 : 1); + if (cv_cam_timeover[num].value && (player->pflags & PF_TIMEOVER)) + timeover = (player->kartstuff[k_timeovercam] > 2*TICRATE ? 2 : 1); // 1 for momentum keep, 2 for turnaround else timeover = 0; diff --git a/src/r_main.c b/src/r_main.c index a156e9e0b..825f65619 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1531,6 +1531,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_cam_speed[i]); CV_RegisterVar(&cv_cam_rotate[i]); CV_RegisterVar(&cv_cam_rotspeed[i]); + CV_RegisterVar(&cv_cam_timeover[i]); } CV_RegisterVar(&cv_tilting); From b963146faafb02578f298805b2e1d51bcf988b50 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Jan 2025 01:51:37 +0100 Subject: [PATCH 07/27] split ra wheel and position number hud offsets kinda ass due to the preset offset, but will just not apply if either was changed from its original position --- src/g_game.h | 23 ++++++++++++----------- src/k_kart.c | 30 ++++++++++++++++-------------- src/m_menu.c | 16 ++++++++++------ 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/src/g_game.h b/src/g_game.h index d092f229f..d82946684 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -149,18 +149,19 @@ extern consvar_t cv_##name##_yoffset; DECL_HUD_OFFSET_X(name)\ DECL_HUD_OFFSET_Y(name) -DECL_HUD_OFFSET(item); // Item box -DECL_HUD_OFFSET(time); // Time -DECL_HUD_OFFSET(laps); // Number of laps -DECL_HUD_OFFSET(dnft); // Countdown (did not finish timer) -DECL_HUD_OFFSET(speed); // Speedometer -DECL_HUD_OFFSET(posi); // Position in race -DECL_HUD_OFFSET(face); // Mini rankings -DECL_HUD_OFFSET(stcd); // Starting countdown +DECL_HUD_OFFSET(item); // Item box +DECL_HUD_OFFSET(time); // Time +DECL_HUD_OFFSET(laps); // Number of laps +DECL_HUD_OFFSET(dnft); // Countdown (did not finish timer) +DECL_HUD_OFFSET(speed); // Speedometer +DECL_HUD_OFFSET(posi); // Position in race +DECL_HUD_OFFSET(wheel); // RA Wheel +DECL_HUD_OFFSET(face); // Mini rankings +DECL_HUD_OFFSET(stcd); // Starting countdown DECL_HUD_OFFSET_Y(chek); // Check gfx -DECL_HUD_OFFSET(mini); // Minimap -DECL_HUD_OFFSET(want); // Wanted -DECL_HUD_OFFSET(stat); // Stats +DECL_HUD_OFFSET(mini); // Minimap +DECL_HUD_OFFSET(want); // Wanted +DECL_HUD_OFFSET(stat); // Stats #undef DECL_HUD_OFFSET #undef DECL_HUD_OFFSET_X diff --git a/src/k_kart.c b/src/k_kart.c index 8afc37819..223f47088 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -57,18 +57,19 @@ consvar_t cv_##name##_yoffset = {"hud_" #name "_yoffset", "0", CV_SAVE, NULL, NU IMPL_HUD_OFFSET_X(name)\ IMPL_HUD_OFFSET_Y(name) -IMPL_HUD_OFFSET(item); // Item box -IMPL_HUD_OFFSET(time); // Time -IMPL_HUD_OFFSET(laps); // Number of laps -IMPL_HUD_OFFSET(dnft); // Countdown (did not finish timer) -IMPL_HUD_OFFSET(speed); // Speedometer -IMPL_HUD_OFFSET(posi); // Position in race -IMPL_HUD_OFFSET(face); // Mini rankings -IMPL_HUD_OFFSET(stcd); // Starting countdown +IMPL_HUD_OFFSET(item); // Item box +IMPL_HUD_OFFSET(time); // Time +IMPL_HUD_OFFSET(laps); // Number of laps +IMPL_HUD_OFFSET(dnft); // Countdown (did not finish timer) +IMPL_HUD_OFFSET(speed); // Speedometer +IMPL_HUD_OFFSET(posi); // Position in race +IMPL_HUD_OFFSET(wheel); // RA Wheel +IMPL_HUD_OFFSET(face); // Mini rankings +IMPL_HUD_OFFSET(stcd); // Starting countdown IMPL_HUD_OFFSET_Y(chek); // Check gfx -IMPL_HUD_OFFSET(mini); // Minimap -IMPL_HUD_OFFSET(want); // Wanted -IMPL_HUD_OFFSET(stat); // Stats +IMPL_HUD_OFFSET(mini); // Minimap +IMPL_HUD_OFFSET(want); // Wanted +IMPL_HUD_OFFSET(stat); // Stats #undef IMPL_HUD_OFFSET #undef IMPL_HUD_OFFSET_X @@ -8365,6 +8366,7 @@ static void K_DrawKartPositionNum(INT32 num) // POSI_X = BASEVIDWIDTH - 51; // 269 // POSI_Y = BASEVIDHEIGHT- 64; // 136 + const boolean wheeloffs = (cv_showinput.value && cv_posi_xoffset.value == 0 && cv_posi_yoffset.value == 0 && cv_wheel_xoffset.value == 0 && cv_wheel_yoffset.value == 0); boolean win = (stplyr->exiting && num == 1); //INT32 X = POSI_X; INT32 W = SHORT(kp_positionnum[0][0]->width); @@ -8372,7 +8374,7 @@ static void K_DrawKartPositionNum(INT32 num) patch_t *localpatch = kp_positionnum[0][0]; //INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT); INT32 fx = 0, fy = 0, fflags = 0; - INT32 xoffs = (cv_showinput.value) ? -48 : 0; + INT32 xoffs = wheeloffs ? -48 : 0; boolean flipdraw = false; // flip the order we draw it in for MORE splitscreen bs. fun. boolean flipvdraw = false; // used only for 2p splitscreen so overtaking doesn't make 1P's position fly off the screen. boolean overtake = false; @@ -8383,7 +8385,7 @@ static void K_DrawKartPositionNum(INT32 num) overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw. } - if (splitscreen || cv_smallposnum.value || cv_showinput.value) + if (splitscreen || cv_smallposnum.value || wheeloffs) scale /= 2; W = FixedMul(W<>FRACBITS; @@ -10196,7 +10198,7 @@ static void K_drawInput(void) static INT32 pn = 0; INT32 target = 0, splitflags = (V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS); - INT32 x = (BASEVIDWIDTH - 32 + cv_posi_xoffset.value)*FRACUNIT, y = (BASEVIDHEIGHT - 24 + cv_posi_yoffset.value)*FRACUNIT; + INT32 x = (BASEVIDWIDTH - 32 + cv_wheel_xoffset.value)*FRACUNIT, y = (BASEVIDHEIGHT - 24 + cv_wheel_yoffset.value)*FRACUNIT; INT32 offs, col; const INT32 accent1 = splitflags|colortranslations[K_GetHudColor()][5]; const INT32 accent2 = splitflags|colortranslations[K_GetHudColor()][9]; diff --git a/src/m_menu.c b/src/m_menu.c index ace9d585e..918ef28f1 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2378,13 +2378,17 @@ static menuitem_t OP_HudOffsetMenu[] = {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_mini_xoffset, 120}, {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_mini_yoffset, 125}, - {IT_HEADER, NULL, "Position / R.A. Wheel", NULL, 135}, - {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_posi_xoffset, 140}, - {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_posi_yoffset, 145}, + {IT_HEADER, NULL, "Position Number", NULL, 135}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_wheel_xoffset, 140}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_wheel_yoffset, 145}, - {IT_HEADER, NULL, "Stat Display", NULL, 155}, - {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_stat_xoffset, 160}, - {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_stat_yoffset, 165}, + {IT_HEADER, NULL, "R.A. Wheel", NULL, 155}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_posi_xoffset, 160}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_posi_yoffset, 165}, + + {IT_HEADER, NULL, "Stat Display", NULL, 175}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_stat_xoffset, 180}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_stat_yoffset, 185}, }; static menuitem_t OP_SaturnCreditsMenu[] = From cea28c591fac985b806be7399b26b6d02a3cc15a Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Jan 2025 17:22:52 +0100 Subject: [PATCH 08/27] slight cleanup minimap head stuff --- src/k_kart.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 223f47088..d176257ab 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9724,7 +9724,7 @@ static void K_drawKartMinimap(void) INT32 i = 0; INT32 x, y; INT32 minimaptrans, splitflags; - SINT8 localplayers[4]; + SINT8 localplayers[MAXSPLITSCREENPLAYERS]; SINT8 numlocalplayers = 0; // Draw the HUD only when playing in a level. @@ -9746,7 +9746,6 @@ static void K_drawKartMinimap(void) y = info.y - (SHORT(minimapinfo.minimap_pic->height)/2); splitflags = info.flags; - if (forceshowhud) minimaptrans = cv_kartminimap.value; else if (timeinmap > 105) @@ -9782,7 +9781,7 @@ static void K_drawKartMinimap(void) y -= SHORT(minimapinfo.minimap_pic->topoffset); // initialize - for (i = 0; i < 4; i++) + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) localplayers[i] = -1; // Player's tiny icons on the Automap. (drawn opposite direction so player 1 is drawn last in splitscreen) @@ -9798,8 +9797,7 @@ static void K_drawKartMinimap(void) if (!stplyr->mo || stplyr->spectator) // do we need the latter..? return; - localplayers[numlocalplayers] = stplyr-players; - numlocalplayers++; + localplayers[numlocalplayers++] = stplyr-players; } else { @@ -9807,31 +9805,29 @@ static void K_drawKartMinimap(void) { if (!playeringame[i]) continue; + if (!players[i].mo || players[i].spectator) continue; - if (i != displayplayers[0] || splitscreen) - { - if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0) - continue; - - if (players[i].kartstuff[k_hyudorotimer] > 0) - { - if (!((players[i].kartstuff[k_hyudorotimer] < 1*TICRATE/2 - || players[i].kartstuff[k_hyudorotimer] > hyudorotime-(1*TICRATE/2)) - && !(leveltime & 1))) - continue; - } - } - if (P_IsDisplayPlayer(&players[i])) { // Draw display players on top of everything else - localplayers[numlocalplayers] = i; - numlocalplayers++; + localplayers[numlocalplayers++] = i; continue; } + // Now we know it's not a display player, handle non-local player exceptions. + if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0) + continue; + + if (players[i].kartstuff[k_hyudorotimer] > 0) + { + if (!((players[i].kartstuff[k_hyudorotimer] < 1*TICRATE/2 + || players[i].kartstuff[k_hyudorotimer] > hyudorotime-(1*TICRATE/2)) + && !(leveltime & 1))) + continue; + } + K_drawKartMinimapHead(players[i].mo, x, y, splitflags); } } @@ -9842,7 +9838,7 @@ static void K_drawKartMinimap(void) for (i = 0; i < numlocalplayers; i++) { - if (i == -1) + if (localplayers[i] == -1) continue; // this doesn't interest us K_drawKartMinimapHead(players[localplayers[i]].mo, x, y, splitflags); } From a9117573fbc210f5e83dd4b3b43a0e07f43481f3 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 8 Jan 2025 05:08:27 +0100 Subject: [PATCH 09/27] add colourized speedlines smth i had laying around in lugstuff --- src/k_kart.c | 69 +++++++++++++++++++++++++++++++++++++++++++--------- src/k_kart.h | 8 +++--- src/m_menu.c | 18 ++++++++------ 3 files changed, 72 insertions(+), 23 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index d176257ab..896b98b30 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -75,6 +75,9 @@ IMPL_HUD_OFFSET(stat); // Stats #undef IMPL_HUD_OFFSET_X #undef IMPL_HUD_OFFSET_Y +static CV_PossibleValue_t colorspeedlines_cons_t[] = {{0, "Off"}, {1, "Normal"}, {2, "+Driftcharge"}, {0, NULL}}; +consvar_t cv_coloredspeedlines = {"colorizedspeedlines", "Off", CV_SAVE, colorspeedlines_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + //extra hud things 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}; @@ -767,6 +770,8 @@ void K_RegisterKartStuff(void) #undef REG_HUD_OFFSET_X #undef REG_HUD_OFFSET_Y + CV_RegisterVar(&cv_coloredspeedlines); + CV_RegisterVar(&cv_showstats); CV_RegisterVar(&cv_showinput); @@ -5111,6 +5116,57 @@ void K_KartPlayerHUDUpdate(player_t *player) player->kartstuff[k_cardanimation] = 0; } +static inline void K_SpawnNormalSpeedLines(player_t *player) +{ + mobj_t *fast = P_SpawnMobj(player->mo->x + (P_RandomRange(-36,36) * player->mo->scale), + player->mo->y + (P_RandomRange(-36,36) * player->mo->scale), + player->mo->z + (player->mo->height/2) + (P_RandomRange(-20,20) * player->mo->scale), + MT_FASTLINE); + + fast->angle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); + fast->momx = 3*player->mo->momx/4; + fast->momy = 3*player->mo->momy/4; + fast->momz = 3*player->mo->momz/4; + P_SetTarget(&fast->target, player->mo); // easier lua access + + K_MatchGenericExtraFlags(fast, player->mo); + + if (cv_coloredspeedlines.value) + { + const boolean goodSpeed = (player->speed >= (3*K_GetKartSpeed(player, false))/4); + + // cant have nice shit cause of synched rng + if (player->kartstuff[k_eggmanexplode]) + { + // Make it red when you have the eggman speed boost + fast->color = SKINCOLOR_RED; + fast->colorized = true; + } + else if (player->kartstuff[k_invincibilitytimer]) + { + fast->color = player->mo->color; + fast->colorized = true; + } + else if (goodSpeed) + { + UINT8 driftcolor = SKINCOLOR_NONE; + + if (cv_coloredspeedlines.value == 2 && player->kartstuff[k_driftboost]) + { + if (player->kartstuff[k_driftboost] <= 20) + driftcolor = SKINCOLOR_SAPPHIRE; + else if (player->kartstuff[k_driftboost] <= 50) + driftcolor = SKINCOLOR_RASPBERRY; + else if (player->kartstuff[k_driftboost] <= 125) + driftcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); + } + + fast->color = (leveltime & 1) ? player->mo->color : driftcolor; + fast->colorized = true; + } + } +} + /** \brief Decreases various kart timers and powers per frame. Called in P_PlayerThink in p_user.c \param player player object passed from P_PlayerThink @@ -5130,18 +5186,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) K_GetKartBoostPower(player); // Speed lines - if ((player->kartstuff[k_sneakertimer] || player->kartstuff[k_driftboost] || player->kartstuff[k_startboost]) && player->speed > 0) + if ((player->kartstuff[k_sneakertimer] || player->kartstuff[k_driftboost] || player->kartstuff[k_startboost] /*|| player->kartstuff[k_eggmanexplode]*/) && player->speed > 0) // gotta love the speedlines calling synched rng :chaosleep: { - mobj_t *fast = P_SpawnMobj(player->mo->x + (P_RandomRange(-36,36) * player->mo->scale), - player->mo->y + (P_RandomRange(-36,36) * player->mo->scale), - player->mo->z + (player->mo->height/2) + (P_RandomRange(-20,20) * player->mo->scale), - MT_FASTLINE); - fast->angle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); - fast->momx = 3*player->mo->momx/4; - fast->momy = 3*player->mo->momy/4; - fast->momz = 3*player->mo->momz/4; - P_SetTarget(&fast->target, player->mo); // easier lua access - K_MatchGenericExtraFlags(fast, player->mo); + K_SpawnNormalSpeedLines(player); } if (player->playerstate == PST_DEAD || player->kartstuff[k_respawn] > 1) // Ensure these are set correctly here diff --git a/src/k_kart.h b/src/k_kart.h index 34c59c622..ac860ab7e 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -22,14 +22,12 @@ boolean K_UseColorHud(void); void K_RegisterKartStuff(void); -extern consvar_t cv_colorizedhud; -extern consvar_t cv_colorizeditembox; -extern consvar_t cv_colorizedhudcolor; +extern consvar_t cv_coloredspeedlines; +extern consvar_t cv_colorizedhud, cv_colorizeditembox, 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_stat_xoffset, cv_stat_yoffset; extern consvar_t cv_showstats; extern consvar_t cv_showlaptimes; extern consvar_t cv_battlespeedo; diff --git a/src/m_menu.c b/src/m_menu.c index 918ef28f1..d8e152209 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2180,16 +2180,18 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 20}, - {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 30}, - {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 35}, + {IT_STRING | IT_CVAR, NULL, "Colourized Speedlines", &cv_coloredspeedlines, 30}, - {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 45}, + {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 40}, + {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 45}, - {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 55}, + {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 55}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 65}, - {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 70}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 80}, // uwu + {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 65}, + + {IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 75}, + {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 80}, + {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 90}, // uwu }; static const char* OP_SaturnTooltips[] = @@ -2197,6 +2199,7 @@ static const char* OP_SaturnTooltips[] = NULL, "How long can the game wait before it kicks you out from the server\nconnecting screen.", "How much speen do you want?", + "Colourize the speedlines in your skincolor if you go fast enough!", "Show Localskin Menus.", "Force menu to only use uppercase.", "Use your desired Keyboard Layout for Text Input\nthis is either the Default, Native or Azerty\nNative does not affect Gameplay only Text!", @@ -2211,6 +2214,7 @@ enum sm_header, sm_waittime, sm_skinselspeed, + sm_colorlines, sm_showlocalskin, op_uppercase_menu, sm_nativkey, From 157ff2df4f057dae1a0b8bdcc15ff19aad93b129 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 9 Jan 2025 18:21:32 +0100 Subject: [PATCH 10/27] make gamestate download show total gamestate size --- src/d_clisrv.c | 21 +++++++++++++++++---- src/d_netfil.c | 3 +++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 775668d5b..7b20c78fe 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1159,7 +1159,8 @@ static inline void CL_DrawConnectionStatus(void) INT32 ccstime = I_GetTime(); // Draw background fade - V_DrawFadeScreen(0xFF00, 16); + if (!menuactive) // menu already draws its own fade + V_DrawFadeScreen(0xFF00, 16); // force default if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES #ifdef HAVE_CURL @@ -1185,10 +1186,22 @@ static inline void CL_DrawConnectionStatus(void) case CL_DOWNLOADSAVEGAME: if (lastfilenum != -1) { + UINT32 currentsize = fileneeded[lastfilenum].currentsize; + UINT32 totalsize = fileneeded[lastfilenum].totalsize; + INT32 dldlength; + cltext = M_GetText("Downloading game state..."); Net_GetNetStat(); + + dldlength = (INT32)((currentsize/(double)totalsize) * 256); + if (dldlength > 256) + dldlength = 256; + V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 111); + V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, dldlength, 8, 96); + V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE, - va(" %4uK",fileneeded[lastfilenum].currentsize>>10)); + va(" %4uK/%4uK",currentsize>>10,totalsize>>10)); + V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE, va("%3.1fK/s ", ((double)getbps)/1024)); } @@ -2683,12 +2696,12 @@ static void CL_ConnectToServer(void) sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home); #endif - cl_mode = CL_SEARCHING; - #ifdef CLIENT_LOADINGSCREEN lastfilenum = -1; #endif + cl_mode = CL_SEARCHING; + #ifdef JOININGAME // Don't get a corrupt savegame error because tmpsave already exists if (FIL_FileExists(tmpsave) && unlink(tmpsave) == -1) diff --git a/src/d_netfil.c b/src/d_netfil.c index fd0bf879c..e488e083e 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -233,6 +233,9 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi void CL_PrepareDownloadSaveGame(const char *tmpsave) { +#ifdef CLIENT_LOADINGSCREEN + lastfilenum = -1; +#endif fileneedednum = 1; fileneeded[0].status = FS_REQUESTED; fileneeded[0].totalsize = UINT32_MAX; From f88290d34ecc88f0ee633392da477bd6096d6a5c Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 9 Jan 2025 20:05:06 +0100 Subject: [PATCH 11/27] kill unarchivevaluedemo just pass if we load from replay or not and do stuff accordingly --- src/lua_script.c | 186 +++++++++++------------------------------------ 1 file changed, 41 insertions(+), 145 deletions(-) diff --git a/src/lua_script.c b/src/lua_script.c index 6f439479e..7ef6f0217 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -940,7 +940,7 @@ static void ArchiveTables(UINT8 **p) } } -static UINT8 UnArchiveValue(UINT8 **p, int TABLESINDEX) +static UINT8 UnArchiveValue(UINT8 **p, int TABLESINDEX, boolean network) { UINT8 type = READUINT8(*p); switch (type) @@ -992,6 +992,12 @@ static UINT8 UnArchiveValue(UINT8 **p, int TABLESINDEX) LUA_PushUserdata(gL, &states[READUINT16(*p)], META_STATE); break; case ARCH_MOBJ: + if (network == false) // for replays :chaosleep: + { + *p += sizeof(UINT32); // Skip this data, we can't read a mobj here, it'd point to garbage and crash the game. + return 3; // Don't set the field + } + LUA_PushUserdata(gL, P_FindNewPosition(READUINT32(*p)), META_MOBJ); break; case ARCH_PLAYER: @@ -1033,106 +1039,6 @@ static UINT8 UnArchiveValue(UINT8 **p, int TABLESINDEX) return 0; } - -// Unarchives from demo_p: -// Return values: -// 0: Normal -// 1: Read table key -// 2: Read table value -// 3: Don't use setfield - -static UINT8 UnArchiveValueDemo(UINT8 **p, int TABLESINDEX, char field[1024]) -{ - UINT8 type = READUINT8(*p); - switch (type) - { - case ARCH_NULL: - lua_pushnil(gL); - break; - case ARCH_BOOLEAN: - lua_pushboolean(gL, READUINT8(*p)); - break; - case ARCH_SIGNED: - lua_pushinteger(gL, READFIXED(*p)); - break; - case ARCH_STRING: - { - UINT16 len = READUINT16(*p); // length of string, including embedded zeros - char *value; - UINT16 i = 0; - // See my comments in the ArchiveValue function; - // it's much the same for reading strings as writing them! - // (i.e. we can't use READSTRING either) - // -- Monster Iestyn 05/08/18 - value = malloc(len); // make temp buffer of size len - // now read the actual string - while (i < len) - value[i++] = READCHAR(*p); // read chars individually, including the embedded zeros - lua_pushlstring(gL, value, len); // push the string (note: this function supports embedded zeros) - free(value); // free the buffer - break; - } - case ARCH_TABLE: - { - UINT16 tid = READUINT16(*p); - lua_rawgeti(gL, TABLESINDEX, tid); - if (lua_isnil(gL, -1)) - { - lua_pop(gL, 1); - lua_newtable(gL); - lua_pushvalue(gL, -1); - lua_rawseti(gL, TABLESINDEX, tid); - return 2; - } - break; - } - case ARCH_MOBJINFO: - LUA_PushUserdata(gL, &mobjinfo[READUINT16(*p)], META_MOBJINFO); - break; - case ARCH_STATE: - LUA_PushUserdata(gL, &states[READUINT16(*p)], META_STATE); - break; - case ARCH_MOBJ: - *p += sizeof(UINT32); // Skip this data, we can't read a mobj here, it'd point to garbage and crash the game. - if (field) - CONS_Alert(CONS_WARNING,"Cannot read mobj_t stored in player variable \'%s\'. Desyncs may occur.\n", field); - else - CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n"); - return 3; // Don't set the field - - case ARCH_PLAYER: - LUA_PushUserdata(gL, &players[READUINT8(*p)], META_PLAYER); - break; - case ARCH_MAPTHING: - LUA_PushUserdata(gL, &mapthings[READUINT16(*p)], META_MAPTHING); - break; - case ARCH_VERTEX: - LUA_PushUserdata(gL, &vertexes[READUINT16(*p)], META_VERTEX); - break; - case ARCH_LINE: - LUA_PushUserdata(gL, &lines[READUINT16(*p)], META_LINE); - break; - case ARCH_SIDE: - LUA_PushUserdata(gL, &sides[READUINT16(*p)], META_SIDE); - break; - case ARCH_SUBSECTOR: - LUA_PushUserdata(gL, &subsectors[READUINT16(*p)], META_SUBSECTOR); - break; - case ARCH_SECTOR: - LUA_PushUserdata(gL, §ors[READUINT16(*p)], META_SECTOR); - break; - case ARCH_SLOPE: - LUA_PushUserdata(gL, P_SlopeById(READUINT16(*p)), META_SLOPE); - break; - case ARCH_MAPHEADER: - LUA_PushUserdata(gL, mapheaderinfo[READUINT16(*p)], META_MAPHEADER); - break; - case ARCH_TEND: - return 1; - } - return 0; -} - static void UnArchiveExtVars(UINT8 **p, void *pointer, boolean network) { int TABLESINDEX; @@ -1152,29 +1058,25 @@ static void UnArchiveExtVars(UINT8 **p, void *pointer, boolean network) TABLESINDEX = lua_gettop(gL); lua_createtable(gL, 0, field_count); // pointer's ext vars subtable - if (network) + for (i = 0; i < field_count; i++) { - for (i = 0; i < field_count; i++) - { - READSTRING(*p, field); + UINT8 ret; + READSTRING(*p, field); - if (UnArchiveValue(p, TABLESINDEX) == 1) - { - CONS_Alert(CONS_ERROR, "Unexpected end marker when reading ExtVars (field '%s')\n", field); - break; - } + ret = UnArchiveValue(p, TABLESINDEX, network); - lua_setfield(gL, -2, field); - } - } - else - { - for (i = 0; i < field_count; i++) + if (ret == 1) { - READSTRING(*p, field); - if (UnArchiveValueDemo(p, TABLESINDEX, field) != 3) // This will return 3 if we shouldn't set this field. - lua_setfield(gL, -2, field); + CONS_Alert(CONS_ERROR, "Unexpected end marker when reading ExtVars (field '%s')\n", field); + break; } + else if (ret == 3) // This will return 3 if we shouldn't set this field. + { + CONS_Alert(CONS_WARNING,"Cannot read mobj_t stored in player variable \'%s\'. Desyncs may occur.\n", field); + continue; + } + + lua_setfield(gL, -2, field); } lua_getfield(gL, LUA_REGISTRYINDEX, LREG_EXTVARS); @@ -1191,7 +1093,7 @@ static int NetUnArchive(lua_State *L) savebuffer_t *save = lua_touserdata(L, lua_upvalueindex(2)); int i, n = lua_gettop(L); for (i = 1; i <= n; i++) - UnArchiveValue(&save->p, TABLESINDEX); + UnArchiveValue(&save->p, TABLESINDEX, true); return n; } @@ -1221,35 +1123,29 @@ static void UnArchiveTables(UINT8 **p, boolean network) { UINT8 ret; - if (network) + ret = UnArchiveValue(p, TABLESINDEX, network); + if (ret == 3) { - if (UnArchiveValue(p, TABLESINDEX) == 1) // read key - break; - - ret = UnArchiveValue(p, TABLESINDEX); - if (ret == 1) - { - CONS_Alert(CONS_ERROR, "Unexpected end of save reached (Corrupted save?)\n"); - lua_pop(gL, 1); // Pop key - break; - } - else if (ret == 2) // read value - n++; + CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n"); + lua_pushnil(gL); } - else + else if (ret == 1) // read key + break; + + ret = UnArchiveValue(p, TABLESINDEX, network); + if (ret == 1) { - ret = UnArchiveValueDemo(p, TABLESINDEX, NULL); - if (ret == 3) - lua_pushnil(gL); - else if (ret == 1) // read key - break; - - ret = UnArchiveValueDemo(p, TABLESINDEX, NULL); - if (ret == 3) - lua_pushnil(gL); - else if (ret == 2) // read value - n++; + CONS_Alert(CONS_ERROR, "Unexpected end of save reached (Corrupted save?)\n"); + lua_pop(gL, 1); // Pop key + break; } + else if (ret == 3) + { + CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n"); + lua_pushnil(gL); + } + else if (ret == 2) // read value + n++; if (lua_isnil(gL, -2)) // if key is nil (if a function etc was accidentally saved) { From 9f9cb833f03484aa7f3df2277d698a57ff1c370d Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 8 Jan 2025 05:50:41 +0100 Subject: [PATCH 12/27] add slight fadeout to spinout rumble --- src/p_tick.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_tick.c b/src/p_tick.c index d9a53dbdd..15a7fbf9b 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -413,7 +413,8 @@ static void P_DeviceRumbleTick(void) if (player->kartstuff[k_spinouttimer]) { - low = high = FRACUNIT / 4; + //low = high = FRACUNIT / 6; + low = high = FixedMul((FRACUNIT / 4), (FixedDiv(player->kartstuff[k_spinouttimer], (3*TICRATE / 2)))); } else if (player->kartstuff[k_sneakertimer] > (sneakertime-(TICRATE/2))) { From 2b725560cc56d9bc214f18e35edc3b33d1c66a78 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 8 Jan 2025 05:51:00 +0100 Subject: [PATCH 13/27] add banandrag rumble lol --- src/p_tick.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/p_tick.c b/src/p_tick.c index 15a7fbf9b..6996b4d4d 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -436,6 +436,11 @@ static void P_DeviceRumbleTick(void) low = high = FRACUNIT / 64; } } + else if (player->kartstuff[k_bananadrag] > TICRATE) + { + if (leveltime & 1) // this is actually funny lel + high = FRACUNIT / 64; + } if (player->kartstuff[k_brakedrift]) { From 47a3de8fe109c2e7521744a9571f83f147f08eb9 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 10 Jan 2025 14:58:58 +0100 Subject: [PATCH 14/27] let "fovchange" work in software --- src/d_player.h | 3 +- src/hardware/hw_main.c | 6 +--- src/hardware/hw_main.h | 2 -- src/lua_playerlib.c | 5 ++- src/p_user.c | 4 +-- src/r_main.c | 76 +++++++++++++++++++++++++++++------------- src/r_main.h | 6 +++- src/r_sky.c | 3 +- 8 files changed, 63 insertions(+), 42 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 140a4a748..6337838bd 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -551,9 +551,8 @@ typedef struct player_s UINT8 hitemvictim; UINT8 splitscreenindex; -#ifdef HWRENDER + fixed_t fovadd; // adjust FOV for hw rendering -#endif } player_t; #endif diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 09b8c064d..b2877444e 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -223,8 +223,6 @@ consvar_t cv_glrenderdistance = {"gr_renderdistance", "Max", CV_SAVE, glrenderdi consvar_t cv_glhorizonlines = {"gr_horizonlines", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_glportals = {"gr_portals", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_glfovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; - consvar_t cv_glpaletterendering = {"gr_paletteshader", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_glpaletterendering_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_glpalettedepth = {"gr_palettedepth", "16 bits", CV_SAVE|CV_CALL, glpalettedepth_cons_t, CV_glpalettedepth_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_glflashpal = {"gr_flashpal", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_glpaletterendering_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -5310,7 +5308,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl // ========================================================================== static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox) { - const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd); + const float fpov = FixedToFloat(R_GetPlayerFov(player)); // set window position gl_viewwindowx = gl_baseviewwindowx; @@ -5532,8 +5530,6 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_glhorizonlines); CV_RegisterVar(&cv_glportals); - CV_RegisterVar(&cv_glfovchange); - CV_RegisterVar(&cv_glpaletterendering); CV_RegisterVar(&cv_glpalettedepth); CV_RegisterVar(&cv_glflashpal); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 52616b7e4..93fbd9c1e 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -181,8 +181,6 @@ extern consvar_t cv_glrenderdistance; extern consvar_t cv_glhorizonlines; extern consvar_t cv_glportals; -extern consvar_t cv_glfovchange; - extern consvar_t cv_glpaletterendering; extern consvar_t cv_glpalettedepth; extern consvar_t cv_glflashpal; diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index dd4cf7b03..32b4abfe7 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -157,9 +157,8 @@ static const udata_field_t player_fields[] = { FIELD(player_t, grieftime, udatalib_getter_tic, udatalib_setter_tic), FIELD(player_t, griefstrikes, udatalib_getter_uint8, udatalib_setter_uint8), FIELD(player_t, splitscreenindex, udatalib_getter_uint8, player_splitscreenindex_noset), -#ifdef HWRENDER FIELD(player_t, fovadd, udatalib_getter_fixed, udatalib_setter_fixed), // Mmm yeah thats definitely synch safe -#endif + // Same as player.name { "sliproll", 0, player_sliproll_getter, player_sliproll_noset }, { "viewrollangle", 0, player_viewrollangle_getter, player_viewrollangle_noset }, @@ -882,4 +881,4 @@ int LUA_PlayerLib(lua_State *L) lua_setglobal(L, "displayplayers"); return 0; -} \ No newline at end of file +} diff --git a/src/p_user.c b/src/p_user.c index db81dc522..17f778ad3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2485,8 +2485,7 @@ static void P_MovePlayer(player_t *player) return; } -#ifdef HWRENDER - if (rendermode == render_opengl && cv_glfovchange.value) + if (cv_fovchange.value) { fixed_t speed; const fixed_t runnyspeed = 20*FRACUNIT; @@ -2506,7 +2505,6 @@ static void P_MovePlayer(player_t *player) } else player->fovadd = 0; -#endif #ifdef FLOORSPLATS if (cv_shadow.value && rendermode == render_soft) diff --git a/src/r_main.c b/src/r_main.c index 825f65619..ba60d2553 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -142,12 +142,14 @@ static CV_PossibleValue_t maxinterpdist_cons_t[] = { {3072, "3072"}, {4096, "4096"}, {6144, "6144"}, {8192, "8192"}, {0, "Infinite"}, {0, NULL}}; -static CV_PossibleValue_t fov_cons_t[] = {{5*FRACUNIT, "MIN"}, {178*FRACUNIT, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t fov_cons_t[] = {{MINFOV*FRACUNIT, "MIN"}, {MAXFOV*FRACUNIT, "MAX"}, {0, NULL}}; static CV_PossibleValue_t translucenthud_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}}; static CV_PossibleValue_t maxportals_cons_t[] = {{0, "MIN"}, {12, "MAX"}, {0, NULL}}; // lmao rendering 32 portals, you're a card static CV_PossibleValue_t homremoval_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Flash"}, {0, NULL}}; +static void R_SetFov(fixed_t playerfov); + static void Fov_OnChange(void); static void FlipCam_OnChange(void); static void FlipCam2_OnChange(void); @@ -199,6 +201,7 @@ consvar_t cv_ripplewater = {"waterripples", "On", CV_SAVE, CV_OnOff, NULL, 0, NU // cap fov, fov too high tears software apart. consvar_t cv_fov = {"fov", "90", CV_FLOAT|CV_CALL|CV_SAVE, fov_cons_t, Fov_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fovchange = {"fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // Okay, whoever said homremoval causes a performance hit should be shot. consvar_t cv_homremoval = {"homremoval", "Yes", CV_SAVE, homremoval_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -894,12 +897,10 @@ void R_SetViewSize(void) // void R_ExecuteSetViewSize(void) { - fixed_t dy; INT32 i; INT32 j; INT32 level; INT32 startmapl; - angle_t fov; setsizeneeded = false; @@ -928,17 +929,10 @@ void R_ExecuteSetViewSize(void) centerxfrac = centerx<> ANGLETOFINESHIFT), viewmorph.zoomneeded); - if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view - fovtan = 17*fovtan/10; - - projection = projectiony = FixedDiv(centerxfrac, fovtan); + R_SetFov(cv_fov.value); R_InitViewBuffer(scaledviewwidth, viewheight); - R_InitTextureMapping(); - // why did we calc all the software crap? #ifdef HWRENDER if (rendermode == render_opengl) @@ -953,19 +947,6 @@ void R_ExecuteSetViewSize(void) for (i = 0; i < viewwidth; i++) screenheightarray[i] = (INT16)viewheight; - // setup sky scaling - R_SetSkyScale(); - - // planes - // this is only used for planes rendering in software mode - j = viewheight*16; - for (i = 0; i < j; i++) - { - dy = (i - viewheight*8)<fovadd; + return max(MINFOV*FRACUNIT, min(fov, MAXFOV*FRACUNIT)); +} + +static void R_SetFov(fixed_t playerfov) +{ + angle_t fov = FixedAngle(playerfov/2) + ANGLE_90; + fovtan = FixedMul(FINETANGENT(fov >> ANGLETOFINESHIFT), viewmorph.zoomneeded); + if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view + fovtan = 17*fovtan/10; + + // this is only used for planes rendering in software mode + INT32 j = viewheight*16; + for (INT32 i = 0; i < j; i++) + { + fixed_t dy = (i - viewheight*8)< Date: Fri, 10 Jan 2025 01:54:31 +0100 Subject: [PATCH 15/27] fix column drawers clamping stuff --- src/r_draw8.c | 110 ++++++++++++-------------------------------------- src/r_plane.c | 1 + src/r_segs.c | 8 ++-- 3 files changed, 30 insertions(+), 89 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index 30fe49372..18ecda5eb 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -60,25 +60,13 @@ void R_DrawColumn_8(void) register const UINT8 *source = dc_source; register const lighttable_t *colormap = dc_colormap; - register INT32 heightmask = dc_texheight-1; + register INT32 heightmask = dc_sourcelength-1; + npow2min = -1; + npow2max = dc_sourcelength; - if (dc_texheight & heightmask) // not a power of 2 -- killough + if (dc_sourcelength & heightmask) // not a power of 2 -- killough { - heightmask++; - heightmask <<= FRACBITS; - - if (dc_sourcelength <= 0) - { - // Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch - // This is to just render it effectively the identity function. - npow2min = INT32_MIN; - npow2max = INT32_MAX; - } - else - { - npow2min = -1; - npow2max = dc_sourcelength; - } + heightmask = dc_texheight << FRACBITS; if (frac < 0) { @@ -192,26 +180,14 @@ void R_Draw2sMultiPatchColumn_8(void) // This is as fast as it gets. register const UINT8 *source = dc_source; register const lighttable_t *colormap = dc_colormap; - register INT32 heightmask = dc_texheight-1; + register INT32 heightmask = dc_sourcelength-1; register UINT8 val; + npow2min = -1; + npow2max = dc_sourcelength; - if (dc_texheight & heightmask) // not a power of 2 -- killough + if (dc_sourcelength & heightmask) // not a power of 2 -- killough { - heightmask++; - heightmask <<= FRACBITS; - - if (dc_sourcelength <= 0) - { - // Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch - // This is to just render it effectively the identity function. - npow2min = INT32_MIN; - npow2max = INT32_MAX; - } - else - { - npow2min = -1; - npow2max = dc_sourcelength; - } + heightmask = dc_texheight << FRACBITS; if (frac < 0) { @@ -343,26 +319,14 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) register const UINT8 *source = dc_source; register const UINT8 *transmap = dc_transmap; register const lighttable_t *colormap = dc_colormap; - register INT32 heightmask = dc_texheight-1; + register INT32 heightmask = dc_sourcelength-1; register UINT8 val; + npow2min = -1; + npow2max = dc_sourcelength; - if (dc_texheight & heightmask) // not a power of 2 -- killough + if (dc_sourcelength & heightmask) // not a power of 2 -- killough { - heightmask++; - heightmask <<= FRACBITS; - - if (dc_sourcelength <= 0) - { - // Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch - // This is to just render it effectively the identity function. - npow2min = INT32_MIN; - npow2max = INT32_MAX; - } - else - { - npow2min = -1; - npow2max = dc_sourcelength; - } + heightmask = dc_texheight << FRACBITS; if (frac < 0) { @@ -535,25 +499,13 @@ void R_DrawTranslucentColumn_8(void) register const UINT8 *source = dc_source; register const UINT8 *transmap = dc_transmap; register const lighttable_t *colormap = dc_colormap; - register INT32 heightmask = dc_texheight - 1; + register INT32 heightmask = dc_sourcelength - 1; + npow2min = -1; + npow2max = dc_sourcelength; - if (dc_texheight & heightmask) + if (dc_sourcelength & heightmask) { - heightmask++; - heightmask <<= FRACBITS; - - if (dc_sourcelength <= 0) - { - // Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch - // This is to just render it effectively the identity function. - npow2min = INT32_MIN; - npow2max = INT32_MAX; - } - else - { - npow2min = -1; - npow2max = dc_sourcelength; - } + heightmask = dc_texheight << FRACBITS; if (frac < 0) { @@ -653,25 +605,13 @@ void R_DrawTranslatedTranslucentColumn_8(void) // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. // This is as fast as it gets. - register INT32 heightmask = dc_texheight - 1; + register INT32 heightmask = dc_sourcelength - 1; + npow2min = -1; + npow2max = dc_sourcelength; - if (dc_texheight & heightmask) + if (dc_sourcelength & heightmask) { - heightmask++; - heightmask <<= FRACBITS; - - if (dc_sourcelength <= 0) - { - // Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch - // This is to just render it effectively the identity function. - npow2min = INT32_MIN; - npow2max = INT32_MAX; - } - else - { - npow2min = -1; - npow2max = dc_sourcelength; - } + heightmask = dc_texheight << FRACBITS; if (frac < 0) { diff --git a/src/r_plane.c b/src/r_plane.c index d8d77457f..c8fd3c2fc 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -654,6 +654,7 @@ static void R_DrawSkyPlane(visplane_t *pl) dc_texturemid = skytexturemid; dc_texheight = textureheight[skytexture] >>FRACBITS; + dc_sourcelength = dc_texheight; for (x = pl->minx; x <= pl->maxx; x++) { diff --git a/src/r_segs.c b/src/r_segs.c index 63f5378d0..a6b839344 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -276,7 +276,7 @@ static void R_Render2sidedMultiPatchColumn(column_t *column) if (dc_yl <= dc_yh && dc_yh < vid.height && dc_yh > 0) { dc_source = (UINT8 *)column + 3; - dc_sourcelength = 0; + dc_sourcelength = column2s_length; if (colfunc == wallcolfunc) twosmultipatchfunc(); @@ -1449,7 +1449,7 @@ static void R_RenderSegLoop (void) dc_texturemid = rw_midtexturemid; dc_source = R_GetColumn(midtexture,texturecolumn); dc_texheight = textureheight[midtexture]>>FRACBITS; - dc_sourcelength = 0; + dc_sourcelength = dc_texheight; colfunc(); // dont draw anything more for this column, since @@ -1497,7 +1497,7 @@ static void R_RenderSegLoop (void) dc_texturemid = rw_toptexturemid; dc_source = R_GetColumn(toptexture,texturecolumn); dc_texheight = textureheight[toptexture]>>FRACBITS; - dc_sourcelength = 0; + dc_sourcelength = dc_texheight; colfunc(); ceilingclip[rw_x] = (INT16)mid; } @@ -1535,7 +1535,7 @@ static void R_RenderSegLoop (void) dc_source = R_GetColumn(bottomtexture, texturecolumn); dc_texheight = textureheight[bottomtexture]>>FRACBITS; - dc_sourcelength = 0; + dc_sourcelength = dc_texheight; colfunc(); floorclip[rw_x] = (INT16)mid; } From 0a58797f7876726b2e9de303df8a202b32b1a05e Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 10 Jan 2025 02:14:31 +0100 Subject: [PATCH 16/27] clamp to length-1 --- src/r_draw8.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index 18ecda5eb..084114fa2 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -62,7 +62,7 @@ void R_DrawColumn_8(void) register INT32 heightmask = dc_sourcelength-1; npow2min = -1; - npow2max = dc_sourcelength; + npow2max = dc_sourcelength-1; if (dc_sourcelength & heightmask) // not a power of 2 -- killough { @@ -183,7 +183,7 @@ void R_Draw2sMultiPatchColumn_8(void) register INT32 heightmask = dc_sourcelength-1; register UINT8 val; npow2min = -1; - npow2max = dc_sourcelength; + npow2max = dc_sourcelength-1; if (dc_sourcelength & heightmask) // not a power of 2 -- killough { @@ -322,7 +322,7 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) register INT32 heightmask = dc_sourcelength-1; register UINT8 val; npow2min = -1; - npow2max = dc_sourcelength; + npow2max = dc_sourcelength-1; if (dc_sourcelength & heightmask) // not a power of 2 -- killough { @@ -499,9 +499,9 @@ void R_DrawTranslucentColumn_8(void) register const UINT8 *source = dc_source; register const UINT8 *transmap = dc_transmap; register const lighttable_t *colormap = dc_colormap; - register INT32 heightmask = dc_sourcelength - 1; + register INT32 heightmask = dc_sourcelength-1; npow2min = -1; - npow2max = dc_sourcelength; + npow2max = dc_sourcelength-1; if (dc_sourcelength & heightmask) { @@ -605,9 +605,9 @@ void R_DrawTranslatedTranslucentColumn_8(void) // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. // This is as fast as it gets. - register INT32 heightmask = dc_sourcelength - 1; + register INT32 heightmask = dc_sourcelength-1; npow2min = -1; - npow2max = dc_sourcelength; + npow2max = dc_sourcelength-1; if (dc_sourcelength & heightmask) { From 4103fac605a99c5dc7abedb8f44c615413a3ae02 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 10 Jan 2025 02:17:38 +0100 Subject: [PATCH 17/27] slight cleanup r_draw8 --- src/r_draw8.c | 60 ++++++++++++++------------------------------------- 1 file changed, 16 insertions(+), 44 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index 084114fa2..1a6e45a5a 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -744,17 +744,14 @@ void R_DrawSpan_8 (void) fixed_t xstep, ystep; register UINT32 bit; - UINT8 *source; - UINT8 *colormap; - register UINT8 *dest; + const UINT8 *source = ds_source; + const UINT8 *colormap = ds_colormap; + register UINT8 *dest = ylookup[ds_y] + columnofs[ds_x1]; const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; register size_t count = (ds_x2 - ds_x1 + 1); size_t i; - xposition = ds_xfrac; yposition = ds_yfrac; - xstep = ds_xstep; ystep = ds_ystep; - // SoM: we only need 6 bits for the integer part (0 thru 63) so the rest // can be used for the fraction part. This allows calculation of the memory address in the // texture with two shifts, an OR and one AND. (see below) @@ -762,12 +759,8 @@ void R_DrawSpan_8 (void) // bit per power of two (obviously) // Ok, because I was able to eliminate the variable spot below, this function is now FASTER // than the original span renderer. Whodathunkit? - xposition <<= nflatshiftup; yposition <<= nflatshiftup; - xstep <<= nflatshiftup; ystep <<= nflatshiftup; - - source = ds_source; - colormap = ds_colormap; - dest = ylookup[ds_y] + columnofs[ds_x1]; + xposition = ds_xfrac << nflatshiftup; yposition = ds_yfrac << nflatshiftup; + xstep = ds_xstep << nflatshiftup; ystep = ds_ystep << nflatshiftup; if (dest+8 > deststop) { @@ -808,14 +801,13 @@ void R_CalcTiltedLighting(fixed_t start, fixed_t end) { // ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version // of this function. Here's my own. - INT32 left = ds_x1, right = ds_x2; - fixed_t step = (end-start)/(ds_x2-ds_x1+1); INT32 i; + fixed_t step = (end-start)/(ds_x2-ds_x1+1); // I wanna do some optimizing by checking for out-of-range segments on either side to fill in all at once, // but I'm too bad at coding to not crash the game trying to do that. I guess this is fast enough for now... - for (i = left; i <= right; i++) + for (i = ds_x1; i <= ds_x2; i++) { tiltlighting[i] = (start += step) >> FRACBITS; @@ -837,7 +829,6 @@ void R_CalcTiltedLighting(fixed_t start, fixed_t end) */ void R_DrawTiltedSpan_8(void) { - // x1, x2 = ds_x1, ds_x2 int width = ds_x2 - ds_x1; double iz, uz, vz; UINT32 u, v; @@ -873,7 +864,6 @@ void R_DrawTiltedSpan_8(void) dest = ylookup[ds_y] + columnofs[ds_x1]; source = ds_source; - //colormap = ds_colormap; #if 0 // The "perfect" reference version of this routine. Pretty slow. // Use it only to see how things are supposed to look. @@ -901,7 +891,6 @@ void R_DrawTiltedSpan_8(void) izstep = ds_szp->x * SPANSIZE; uzstep = ds_sup->x * SPANSIZE; vzstep = ds_svp->x * SPANSIZE; - //x1 = 0; width++; while (width >= SPANSIZE) @@ -978,7 +967,6 @@ void R_DrawTiltedSpan_8(void) */ void R_DrawTiltedTranslucentSpan_8(void) { - // x1, x2 = ds_x1, ds_x2 int width = ds_x2 - ds_x1; double iz, uz, vz; UINT32 u, v; @@ -1014,7 +1002,6 @@ void R_DrawTiltedTranslucentSpan_8(void) dest = ylookup[ds_y] + columnofs[ds_x1]; source = ds_source; - //colormap = ds_colormap; #if 0 // The "perfect" reference version of this routine. Pretty slow. // Use it only to see how things are supposed to look. @@ -1042,7 +1029,6 @@ void R_DrawTiltedTranslucentSpan_8(void) izstep = ds_szp->x * SPANSIZE; uzstep = ds_sup->x * SPANSIZE; vzstep = ds_svp->x * SPANSIZE; - //x1 = 0; width++; while (width >= SPANSIZE) @@ -1120,7 +1106,6 @@ void R_DrawTiltedTranslucentSpan_8(void) */ void R_DrawTiltedTranslucentWaterSpan_8(void) { - // x1, x2 = ds_x1, ds_x2 int width = ds_x2 - ds_x1; double iz, uz, vz; UINT32 u, v; @@ -1158,7 +1143,6 @@ void R_DrawTiltedTranslucentWaterSpan_8(void) dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1; source = ds_source; - //colormap = ds_colormap; #if 0 // The "perfect" reference version of this routine. Pretty slow. // Use it only to see how things are supposed to look. @@ -1186,7 +1170,6 @@ void R_DrawTiltedTranslucentWaterSpan_8(void) izstep = ds_szp->x * SPANSIZE; uzstep = ds_sup->x * SPANSIZE; vzstep = ds_svp->x * SPANSIZE; - //x1 = 0; width++; while (width >= SPANSIZE) @@ -1558,17 +1541,14 @@ void R_DrawTranslucentSpan_8 (void) fixed_t xstep, ystep; register UINT32 bit; - UINT8 *source; - UINT8 *colormap; - register UINT8 *dest; + const UINT8 *source = ds_source; + const UINT8 *colormap = ds_colormap; + register UINT8 *dest = ylookup[ds_y] + columnofs[ds_x1]; const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; register size_t count = (ds_x2 - ds_x1 + 1); size_t i; - xposition = ds_xfrac; yposition = ds_yfrac; - xstep = ds_xstep; ystep = ds_ystep; - // SoM: we only need 6 bits for the integer part (0 thru 63) so the rest // can be used for the fraction part. This allows calculation of the memory address in the // texture with two shifts, an OR and one AND. (see below) @@ -1576,12 +1556,8 @@ void R_DrawTranslucentSpan_8 (void) // bit per power of two (obviously) // Ok, because I was able to eliminate the variable spot below, this function is now FASTER // than the original span renderer. Whodathunkit? - xposition <<= nflatshiftup; yposition <<= nflatshiftup; - xstep <<= nflatshiftup; ystep <<= nflatshiftup; - - source = ds_source; - colormap = ds_colormap; - dest = ylookup[ds_y] + columnofs[ds_x1]; + xposition = ds_xfrac << nflatshiftup; yposition = ds_yfrac << nflatshiftup; + xstep = ds_xstep << nflatshiftup; ystep = ds_ystep << nflatshiftup; while (count >= 8) { @@ -1617,10 +1593,10 @@ void R_DrawTranslucentWaterSpan_8(void) UINT32 xstep, ystep; register UINT32 bit; - UINT8 *source; - UINT8 *colormap; - register UINT8 *dest; - UINT8 *dsrc; + const UINT8 *source = ds_source; + const UINT8 *colormap = ds_colormap; + register UINT8 *dest = ylookup[ds_y] + columnofs[ds_x1]; + register UINT8 *dsrc; register size_t count; size_t i; @@ -1635,9 +1611,6 @@ void R_DrawTranslucentWaterSpan_8(void) xposition = ds_xfrac << nflatshiftup; yposition = (ds_yfrac + ds_waterofs) << nflatshiftup; xstep = ds_xstep << nflatshiftup; ystep = ds_ystep << nflatshiftup; - source = ds_source; - colormap = ds_colormap; - dest = ylookup[ds_y] + columnofs[ds_x1]; dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1; count = ds_x2 - ds_x1 + 1; @@ -1679,7 +1652,6 @@ void R_DrawFogSpan_8(void) register size_t count; colormap = ds_colormap; - //dest = ylookup[ds_y] + columnofs[ds_x1]; dest = &topleft[ds_y *vid.width + ds_x1]; count = ds_x2 - ds_x1 + 1; From ab8cbcb450df91059497b7a86b7654cdd0054a12 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 10 Jan 2025 02:12:13 +0100 Subject: [PATCH 18/27] reinit minimap stuff when a wad is added while ingame --- src/p_local.h | 1 - src/p_setup.c | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 720613677..0c699c35d 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -409,7 +409,6 @@ extern precipmobj_t **precipblocklinks; // special blockmap for precip rendering extern struct minimapinfo { patch_t *minimap_pic; - UINT8 mapthingcount; INT32 min_x, min_y; INT32 max_x, max_y; INT32 map_w, map_h; diff --git a/src/p_setup.c b/src/p_setup.c index 477b805db..3b2ed7714 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2507,8 +2507,6 @@ static void P_InitMinimapInfo(void) if (lumpnum != -1) minimapinfo.minimap_pic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_HUDGFX); - minimapinfo.mapthingcount = 0; - // TODO iterate over mapthings to look for possible user-defined bounds minimapinfo.min_x = bsp->bbox[0][BOXLEFT]; minimapinfo.max_x = bsp->bbox[0][BOXRIGHT]; minimapinfo.min_y = bsp->bbox[0][BOXBOTTOM]; @@ -3229,6 +3227,10 @@ boolean P_MultiSetupWadFiles(boolean fullsetup) ST_LoadGraphics(); ST_ReloadSkinFaceGraphics(); + // reload minimap stuff while were in the map since it may get replaced otherwise + if (gamestate == GS_LEVEL) + P_InitMinimapInfo(); + if (!partadd_important) partadd_stage = -1; // everything done else if (fullsetup) From e4e18f0a628040b1ff4c178388182e68b6945dd7 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 6 Jan 2025 22:40:56 +0100 Subject: [PATCH 19/27] check for 0 to avoid division by 0 --- src/sdl/mixer_sound.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index ced911eba..8059a93df 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -282,6 +282,9 @@ static Mix_Chunk *ds2chunk(void *stream) freq = READUINT16(stream); samples = READUINT32(stream); + if (freq == 0) + return NULL; // division by zero + // convert from signed 8bit ???hz to signed 16bit 44100hz. switch(freq) { From cb4ef15c77e15f0b18d4b79fcecda53a28264aad Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 26 Dec 2024 17:51:06 +0100 Subject: [PATCH 20/27] another attempt at fixing skipintro mus playing titlescreen music --- src/qs22j.c | 1 + src/s_sound.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qs22j.c b/src/qs22j.c index 17f2b7c2e..c610bde4d 100644 --- a/src/qs22j.c +++ b/src/qs22j.c @@ -16,6 +16,7 @@ #include #include + #include "qs22j.h" #define INSORTTHRESH 5 // if n < this use insertion sort diff --git a/src/s_sound.c b/src/s_sound.c index 4181d57d4..453778027 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2044,7 +2044,7 @@ void S_InitMapMusic(void) { char *maptitle = G_BuildMapTitle(gamemap); // for some reason, occasionally the title screen music doesent seem to be reset in time, so skipping the intro may make it just continue playing it instead, weird.. - skipintromus = (stricmp(music_name, "titles") != 0) && (maptitle && (stricmp(maptitle, "Wandering Falls") != 0)); // thanks diggle! + skipintromus = gamestate == GS_LEVEL && (stricmp(music_name, "titles") != 0) && (maptitle && (stricmp(maptitle, "Wandering Falls") != 0)); // thanks diggle! if (maptitle) Z_Free(maptitle); } From ed9adfae684e1162b3e5182d471e985d5a0eec80 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Jan 2025 02:00:31 +0100 Subject: [PATCH 21/27] add toggle to colour sneakertrail flames (thx neppy!) --- src/k_kart.c | 14 +++++++++++++- src/k_kart.h | 2 +- src/m_menu.c | 17 ++++++++++------- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 896b98b30..f4835b288 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -75,9 +75,12 @@ IMPL_HUD_OFFSET(stat); // Stats #undef IMPL_HUD_OFFSET_X #undef IMPL_HUD_OFFSET_Y +// extra colourisation stuff static CV_PossibleValue_t colorspeedlines_cons_t[] = {{0, "Off"}, {1, "Normal"}, {2, "+Driftcharge"}, {0, NULL}}; consvar_t cv_coloredspeedlines = {"colorizedspeedlines", "Off", CV_SAVE, colorspeedlines_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_coloredsneakertrail = {"sneakertrailcolor", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + //extra hud things 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}; @@ -770,7 +773,10 @@ void K_RegisterKartStuff(void) #undef REG_HUD_OFFSET_X #undef REG_HUD_OFFSET_Y + // Colored speedlines CV_RegisterVar(&cv_coloredspeedlines); + // Colored trails + CV_RegisterVar(&cv_coloredsneakertrail); CV_RegisterVar(&cv_showstats); CV_RegisterVar(&cv_showinput); @@ -828,7 +834,6 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_lessflicker); CV_RegisterVar(&cv_mouseturn); - } //} @@ -3491,6 +3496,13 @@ void K_SpawnBoostTrail(player_t *player) flame->angle = travelangle; flame->fuse = TICRATE*2; flame->destscale = player->mo->scale; + + if (cv_coloredsneakertrail.value) + { + flame->colorized = true; + flame->color = player->skincolor; + } + P_SetScale(flame, player->mo->scale); // not K_MatchGenericExtraFlags so that a stolen sneaker can be seen K_FlipFromObject(flame, player->mo); diff --git a/src/k_kart.h b/src/k_kart.h index ac860ab7e..5f0127132 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -22,7 +22,7 @@ boolean K_UseColorHud(void); void K_RegisterKartStuff(void); -extern consvar_t cv_coloredspeedlines; +extern consvar_t cv_coloredspeedlines, cv_coloredsneakertrail; extern consvar_t cv_colorizedhud, cv_colorizeditembox, cv_colorizedhudcolor; extern consvar_t cv_darkitembox; extern consvar_t cv_biglaps; diff --git a/src/m_menu.c b/src/m_menu.c index d8e152209..fbe7e0ffb 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2181,17 +2181,18 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 20}, {IT_STRING | IT_CVAR, NULL, "Colourized Speedlines", &cv_coloredspeedlines, 30}, + {IT_STRING | IT_CVAR, NULL, "Colourized Sneakertrails", &cv_coloredsneakertrail, 35}, - {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 40}, - {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 45}, + {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 45}, + {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 55}, - {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 55}, + {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 60}, - {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 65}, + {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 70}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 75}, - {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 80}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 90}, // uwu + {IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 80}, + {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 85}, + {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 95}, // uwu }; static const char* OP_SaturnTooltips[] = @@ -2200,6 +2201,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?", "Colourize the speedlines in your skincolor if you go fast enough!", + "Colourize the sneaker flame trails in your skincolor!", "Show Localskin Menus.", "Force menu to only use uppercase.", "Use your desired Keyboard Layout for Text Input\nthis is either the Default, Native or Azerty\nNative does not affect Gameplay only Text!", @@ -2215,6 +2217,7 @@ enum sm_waittime, sm_skinselspeed, sm_colorlines, + sm_colorflames, sm_showlocalskin, op_uppercase_menu, sm_nativkey, From 50f1a6118224677517494d6515075f83882bcca5 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Jan 2025 02:27:32 +0100 Subject: [PATCH 22/27] fix having saltyhop disabled forcing player spriteyoffset to be forced 0 just clear out everything on toggle --- src/k_kart.c | 83 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 63 insertions(+), 20 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index f4835b288..eab294c9c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -103,10 +103,38 @@ consvar_t cv_newspeedometer = {"newspeedometer", "Default", CV_SAVE, speedo_cons consvar_t cv_battlespeedo = {"battlespeedo", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //toggle for showing the speedometer in battlemode //hardcode saltyhop mhhm -consvar_t cv_saltyhop = {"hardcodehop", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static void saltyhop_onchange(void); +consvar_t cv_saltyhop = {"hardcodehop", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, saltyhop_onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_saltyhopsfx = {"hardcodehopsfx", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_saltysquish = {"hardcodehopsquish", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static void saltyhop_onchange(void) +{ + // reset everything when toggling saltyhop off + if (!cv_saltyhop.value && (gamestate == GS_LEVEL)) + { + for (INT32 i = 0; i < MAXPLAYERS; i++) + { + player_t *player = &players[i]; + + if (!playeringame[i] || !player->mo) + continue; + + player->mo->spriteyoffset = 0; + player->mo->spriteyscale = 0; + player->mo->spritexscale = 0; + + player->mo->salty_jump = false; + player->mo->salty_zoffset = 0; + player->mo->salty_momz = 0; + + player->mo->salty_ready = false; + player->mo->salty_tapping = false; + player->mo->init_salty = false; + } + } +} + //Colourized HUD consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE|CV_CALL, CV_OnOff, SaturnHud_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}; @@ -3336,38 +3364,55 @@ static void K_StretchPlayerGravity(player_t *p) static void K_QuiteSaltyHop(player_t *p) { + if (!cv_saltyhop.value) + return; + // what the fuck is this haya fixed_t mos = FRACUNIT; // doesnt work correctly if it isnt :/ // ready? - if (!p->kartstuff[k_jmp]) { + if (!p->kartstuff[k_jmp]) + { p->mo->salty_ready = true; p->mo->salty_tapping = false; - } else if (p->mo->salty_ready) { + } + else if (p->mo->salty_ready) + { p->mo->salty_ready = false; p->mo->salty_tapping = true; - } else { + } + else + { p->mo->salty_tapping = false; } // GO! - if (!p->mo->init_salty) { + if (!p->mo->init_salty) + { p->mo->salty_jump = false; p->mo->salty_zoffset = 0; p->mo->salty_momz = 0; p->mo->init_salty = true; } - else if ((p->mo->salty_jump)) { - if (p->mo->eflags & MFE_JUSTHITFLOOR) { + else if ((p->mo->salty_jump)) + { + if (p->mo->eflags & MFE_JUSTHITFLOOR) + { p->mo->salty_zoffset = 0; - } else if (P_IsObjectOnGround(p->mo)) { + } + else if (P_IsObjectOnGround(p->mo)) + { p->mo->salty_zoffset += p->mo->salty_momz; p->mo->salty_momz -= (mos*3/2); - } else { + } + else + { p->mo->salty_zoffset *= (49/50)*mos; p->mo->salty_momz = 0; } - if (p->mo->salty_zoffset <= 0) { + + if (p->mo->salty_zoffset <= 0) + { if (!(p->mo->eflags & MFE_JUSTHITFLOOR) && P_IsObjectOnGround(p->mo) && cv_saltyhopsfx.value) S_StartSound(p->mo, sfx_s268); p->mo->salty_jump = false; @@ -3375,18 +3420,23 @@ static void K_QuiteSaltyHop(player_t *p) p->mo->salty_momz = 0; // shlamma damma p->mo->stretchslam += cv_saltysquish.value ? (8*mos) : 0; - } else if (p->mo->salty_zoffset >= 0 && cv_saltysquish.value) { + } + else if (p->mo->salty_zoffset >= 0 && cv_saltysquish.value) + { // goofy ahh hack p->mo->spriteyscale += (mos/8); p->mo->spritexscale -= (mos/8); } + p->mo->spriteyoffset = p->mo->salty_zoffset; + if (S_SoundPlaying(p->mo, sfx_screec)) S_StopSoundByID(p->mo, sfx_screec); if (S_SoundPlaying(p->mo, sfx_drift)) S_StopSoundByID(p->mo, sfx_drift); } - else if (p->mo->salty_tapping && P_IsObjectOnGround(p->mo) && !p->kartstuff[k_spinouttimer] && !p->kartstuff[k_squishedtimer]) { + else if (p->mo->salty_tapping && P_IsObjectOnGround(p->mo) && !p->kartstuff[k_spinouttimer] && !p->kartstuff[k_squishedtimer]) + { p->mo->salty_jump = true; p->mo->salty_zoffset = 0; p->mo->salty_momz = 6*mos; @@ -6720,14 +6770,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } // salty hop! i wanna die - if (cv_saltyhop.value) - K_QuiteSaltyHop(player); - else { - player->mo->spriteyoffset = 0; - player->mo->salty_jump = false; - player->mo->salty_zoffset = 0; - player->mo->salty_momz = 0; - } + K_QuiteSaltyHop(player); } void K_CalculateBattleWanted(void) From b9e23113c8806cefe45991d7c36c6514f4a13520 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Jan 2025 17:08:16 +0100 Subject: [PATCH 23/27] slightly cleanup gravstretch stuff --- src/g_game.c | 20 --------- src/k_kart.c | 113 +++++++++++++++++++++++++++++++++++---------------- src/k_kart.h | 2 + 3 files changed, 80 insertions(+), 55 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index c4fbec8bc..f12a72620 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -527,26 +527,6 @@ consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS] = { static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}}; consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t stretchfactor_t[] = { - {0, "Off"}, {FRACUNIT/8, "0.125"}, {FRACUNIT/4, "0.250"}, - {3*FRACUNIT/8, "0.375"}, {FRACUNIT/2, "0.500"}, {5*FRACUNIT/8, "0.625"}, - {3*FRACUNIT/4, "0.750"}, {7*FRACUNIT/8, "0.875"}, {FRACUNIT, "Max"}, {0, NULL}}; -consvar_t cv_gravstretch = {"gravstretch", "0", CV_SAVE, stretchfactor_t, NULL, 0, NULL, NULL, 0, 0, NULL}; - -static CV_PossibleValue_t slamsound_t[] = {{0, "Off"}, {1, "On"}, {0, NULL}}; -consvar_t cv_slamsound = {"slamsound", "1", CV_SAVE, slamsound_t, NULL, 0, NULL, NULL, 0, 0, NULL}; - -static CV_PossibleValue_t sloperolldist_cons_t[] = { - /*{256, "256"},*/ {512, "512"}, {768, "768"}, - {1024, "1024"}, {1536, "1536"}, {2048, "2048"}, - {3072, "3072"}, {4096, "4096"}, {6144, "6144"}, - {8192, "8192"}, {0, "Infinite"}, {0, NULL}}; -consvar_t cv_sloperolldist = {"sloperolldist", "Infinite", CV_SAVE, sloperolldist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t sloperoll_cons_t[] = {{0, "Off"}, {1, "Players"}, {2, "Everything"}, {0, NULL}}; -consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, sloperoll_cons_t, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_sparkroll = {"sparkroll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; - consvar_t cv_cechotoggle = {"show_cecho", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #if MAXPLAYERS > 16 diff --git a/src/k_kart.c b/src/k_kart.c index eab294c9c..209f083e1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -102,6 +102,38 @@ CV_PossibleValue_t speedo_cons_t[NUMSPEEDOSTUFF]; consvar_t cv_newspeedometer = {"newspeedometer", "Default", CV_SAVE, speedo_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_battlespeedo = {"battlespeedo", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //toggle for showing the speedometer in battlemode +// funn-E streeetch +static void gravstretch_onchange(void); +static CV_PossibleValue_t stretchfactor_t[] = { + {0, "Off"}, {FRACUNIT/4, "0.250"}, + {3*FRACUNIT/8, "0.375"}, {FRACUNIT/2, "0.500"}, {5*FRACUNIT/8, "0.625"}, + {3*FRACUNIT/4, "0.750"}, {7*FRACUNIT/8, "0.875"}, {FRACUNIT, "Max"}, {0, NULL}}; +consvar_t cv_gravstretch = {"gravstretch", "0", CV_SAVE|CV_CALL|CV_NOINIT, stretchfactor_t, gravstretch_onchange, 0, NULL, NULL, 0, 0, NULL}; + +static void gravstretch_onchange(void) +{ + // reset everything when toggling gravstretch off + if (cv_gravstretch.value == 0) + { + K_ResetPlayerSpriteStuff(); + } +} + +static CV_PossibleValue_t slamsound_t[] = {{0, "Off"}, {1, "On"}, {0, NULL}}; +consvar_t cv_slamsound = {"slamsound", "1", CV_SAVE, slamsound_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + +// sprite rotatuer stuff +static CV_PossibleValue_t sloperolldist_cons_t[] = { + {512, "512"}, {768, "768"}, + {1024, "1024"}, {1536, "1536"}, {2048, "2048"}, + {3072, "3072"}, {4096, "4096"}, {6144, "6144"}, + {8192, "8192"}, {0, "Infinite"}, {0, NULL}}; +consvar_t cv_sloperolldist = {"sloperolldist", "Infinite", CV_SAVE, sloperolldist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t sloperoll_cons_t[] = {{0, "Off"}, {1, "Players"}, {2, "Everything"}, {0, NULL}}; +consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, sloperoll_cons_t, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_sparkroll = {"sparkroll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + //hardcode saltyhop mhhm static void saltyhop_onchange(void); consvar_t cv_saltyhop = {"hardcodehop", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, saltyhop_onchange, 0, NULL, NULL, 0, 0, NULL}; @@ -111,27 +143,9 @@ consvar_t cv_saltysquish = {"hardcodehopsquish", "On", CV_SAVE, CV_OnOff, NULL, static void saltyhop_onchange(void) { // reset everything when toggling saltyhop off - if (!cv_saltyhop.value && (gamestate == GS_LEVEL)) + if (!cv_saltyhop.value) { - for (INT32 i = 0; i < MAXPLAYERS; i++) - { - player_t *player = &players[i]; - - if (!playeringame[i] || !player->mo) - continue; - - player->mo->spriteyoffset = 0; - player->mo->spriteyscale = 0; - player->mo->spritexscale = 0; - - player->mo->salty_jump = false; - player->mo->salty_zoffset = 0; - player->mo->salty_momz = 0; - - player->mo->salty_ready = false; - player->mo->salty_tapping = false; - player->mo->init_salty = false; - } + K_ResetPlayerSpriteStuff(); } } @@ -866,6 +880,34 @@ void K_RegisterKartStuff(void) //} +void K_ResetPlayerSpriteStuff(void) +{ + if (gamestate != GS_LEVEL) + return; + + for (INT32 i = 0; i < MAXPLAYERS; i++) + { + player_t *player = &players[i]; + + if (!playeringame[i] || P_MobjWasRemoved(player->mo)) + continue; + + player->mo->spritexoffset = 0; + player->mo->spriteyoffset = 0; + player->mo->spritexscale = player->mo->realxscale; + player->mo->spriteyscale = player->mo->realyscale; + + // reset saltyhop stuffs too + player->mo->salty_jump = false; + player->mo->salty_zoffset = 0; + player->mo->salty_momz = 0; + + player->mo->salty_ready = false; + player->mo->salty_tapping = false; + player->mo->init_salty = false; + } +} + boolean K_IsPlayerLosing(player_t *player) { INT32 winningpos = 1; @@ -3293,8 +3335,17 @@ static void K_SpawnAIZDust(player_t *player) } } +#define MAXSTRETCHDIV 17476977 + static void K_StretchPlayerGravity(player_t *p) { + if (cv_gravstretch.value == 0) + { + p->mo->spritexscale = p->mo->realxscale; + p->mo->spriteyscale = p->mo->realyscale; + return; + } + I_Assert(p != NULL); I_Assert(p->mo != NULL); I_Assert(!P_MobjWasRemoved(p->mo)); @@ -3302,15 +3353,13 @@ static void K_StretchPlayerGravity(player_t *p) fixed_t mos = FRACUNIT; fixed_t rzs = abs(p->mo->momz); fixed_t zspd = abs(rzs/mos); - fixed_t stretchScaleFactor = 0; - fixed_t rzsDiv = 1; - fixed_t slamDiv = 1; + fixed_t stretchScaleFactor = FixedDiv(FRACUNIT*60, cv_gravstretch.value); + fixed_t rzsDiv, slamDiv; fixed_t dxs = p->mo->realxscale; fixed_t dys = p->mo->realyscale; - stretchScaleFactor = FixedDiv(FRACUNIT*60, cv_gravstretch.value); - if (stretchScaleFactor > 17476977) + if (stretchScaleFactor > MAXSTRETCHDIV) rzsDiv = 0; else rzsDiv = FixedDiv(rzs, stretchScaleFactor); @@ -3320,7 +3369,7 @@ static void K_StretchPlayerGravity(player_t *p) if (p->mo->slamsoundtimer) p->mo->slamsoundtimer--; - if (cv_slamsound.value && (p->mo->eflags & MFE_JUSTHITFLOOR) && p->mo->stretchslam > 4*mos && !p->mo->slamsoundtimer) + if (cv_slamsound.value && (p->mo->eflags & MFE_JUSTHITFLOOR) && !p->mo->slamsoundtimer && (p->mo->stretchslam > 4*mos)) { S_StartSound(p->mo, sfx_s3k4c); p->mo->slamsoundtimer = TICRATE; @@ -3348,7 +3397,7 @@ static void K_StretchPlayerGravity(player_t *p) } else { - if (stretchScaleFactor > 17476977) + if (stretchScaleFactor > MAXSTRETCHDIV) slamDiv = 0; else slamDiv = FixedDiv(p->mo->stretchslam, stretchScaleFactor); @@ -3394,7 +3443,7 @@ static void K_QuiteSaltyHop(player_t *p) p->mo->salty_momz = 0; p->mo->init_salty = true; } - else if ((p->mo->salty_jump)) + else if (p->mo->salty_jump) { if (p->mo->eflags & MFE_JUSTHITFLOOR) { @@ -6649,13 +6698,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->sliproll -= (4*ANG1); } - if (cv_gravstretch.value > 13107) - K_StretchPlayerGravity(player); - else - { - player->mo->spritexscale = player->mo->realxscale; - player->mo->spriteyscale = player->mo->realyscale; - } + K_StretchPlayerGravity(player); if (cv_sloperoll.value && !player->mo->salty_jump) // seeing a character rotate mid-hop looks really janky { diff --git a/src/k_kart.h b/src/k_kart.h index 5f0127132..d913d215c 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -11,6 +11,8 @@ #define KART_FULLTURN 800 +void K_ResetPlayerSpriteStuff(void); + extern UINT8 colortranslations[MAXTRANSLATIONS][16]; extern const char *KartColor_Names[MAXSKINCOLORS]; extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2]; From 62a65c5c1dc2746dd3707a779f3e31989d1e0247 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 13 Jan 2025 08:38:20 +0100 Subject: [PATCH 24/27] save a whopping 2ms from gamestart to race start on texture updating --- src/hardware/hw_cache.c | 8 +++----- src/hardware/r_opengl/r_opengl.c | 34 +++++++++++--------------------- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 65e120002..af06ecba6 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -319,7 +319,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe patch_t *realpatch; INT32 blockwidth, blockheight, blocksize; - INT32 i; + INT32 i, idx; boolean skyspecial = false; //poor hack for Legacy large skies.. RGBA_t *palette; @@ -368,12 +368,10 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX]; - for (j = 0; j < blockheight; j++) + for (idx = 0, j = 0; j < blockheight; j++) { - for (i = 0; i < blockwidth; i++) + for (i = 0; i < blockwidth; i++, idx++) { - int idx = (j*blockwidth+i); - block[4*idx+0] = col.s.red; block[4*idx+1] = col.s.green; block[4*idx+2] = col.s.blue; diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 72bb34e61..6cd27987d 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1581,6 +1581,7 @@ static void GL_UpdateTexture(GLMipmap_t *pTexInfo) INT32 w = pTexInfo->width, h = pTexInfo->height; INT32 i, j; + INT32 idx; const GLubyte *pImgData = (const GLubyte *)pTexInfo->data; const GLvoid *ptex = NULL; @@ -1609,18 +1610,13 @@ static void GL_UpdateTexture(GLMipmap_t *pTexInfo) const int chromakeyed = (pTexInfo->flags & TF_CHROMAKEYED); - for (j = 0; j < h; j++) + for (idx = 0, j = 0; j < h; j++) { - for (i = 0; i < w; i++) + for (i = 0; i < w; i++, idx++) { - int idx = (w*j+i); - if (chromakeyed && (*pImgData == HWR_PATCHES_CHROMAKEY_COLORINDEX)) { - tex[idx].s.red = 0; - tex[idx].s.green = 0; - tex[idx].s.blue = 0; - tex[idx].s.alpha = 0; + tex[idx].s = (byteColor_t){0, 0, 0, 0}; pTexInfo->flags |= TF_TRANSPARENT; // there is a hole in it } else @@ -1649,12 +1645,10 @@ static void GL_UpdateTexture(GLMipmap_t *pTexInfo) ptex = tex = textureBuffer; texformat = GL_LUMINANCE_ALPHA; - for (j = 0; j < h; j++) + for (idx = 0, j = 0; j < h; j++) { - for (i = 0; i < w; i++) + for (i = 0; i < w; i++, idx++) { - int idx = (w*j+i); - tex[idx].s.red = *pImgData; tex[idx].s.green = *pImgData; tex[idx].s.blue = *pImgData; @@ -1669,17 +1663,13 @@ static void GL_UpdateTexture(GLMipmap_t *pTexInfo) ptex = tex = textureBuffer; texformat = GL_ALPHA; - for (j = 0; j < h; j++) - { - for (i = 0; i < w; i++) - { - int idx = (w*j+i); + memset(&tex->s, 255, sizeof(byteColor_t)*w*h); // 255 because the fade mask is modulated with the screen texture, so alpha affects it while the colours don't - tex[idx].s.red = 255; // 255 because the fade mask is modulated with the screen texture, so alpha affects it while the colours don't - tex[idx].s.green = 255; - tex[idx].s.blue = 255; - tex[idx].s.alpha = *pImgData; - pImgData++; + for (idx = 0, j = 0; j < h; j++) + { + for (i = 0; i < w; i++, idx++) + { + tex[idx].s.alpha = *pImgData++; } } break; From 4e4871fe93a0ce89ec8f995ae80b69ee821d4a74 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 13 Jan 2025 15:52:12 +0100 Subject: [PATCH 25/27] remove "errorshitspam" hooklib refactor indirectly fixed the root issue, so this is not needed anymore --- src/m_menu.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index fbe7e0ffb..6c14bdef8 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6154,8 +6154,6 @@ 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) { @@ -6184,11 +6182,10 @@ 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)) && !errorshitspam) + else if (refreshdirmenu & (REFRESHDIR_WARNING | REFRESHDIR_ERROR)) { 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) { @@ -6540,7 +6537,6 @@ 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); @@ -6548,7 +6544,6 @@ static void M_HandleAddons(INT32 choice) 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: From e7d3e031699481e4829896ca40daca5bf84490e8 Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 13 Jan 2025 14:25:14 +0300 Subject: [PATCH 26/27] Clear menus when running 'map' command --- src/d_netcmd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b01f87e5a..0fd28fc25 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2702,6 +2702,8 @@ static void Command_Map_f(void) return; } + M_ClearMenus(true); + last_map_cmd = I_GetTime(); size_t first_option; @@ -2894,6 +2896,7 @@ static void Command_Map_f(void) } fromlevelselect = false; + D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false); Z_Free(realmapname); From cd3e664e6a9080350747b5a1cf1ffb40c9a13c82 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Jan 2025 03:07:46 +0100 Subject: [PATCH 27/27] oops fix menu stuff --- src/k_kart.c | 23 ++++++++++++----------- src/m_menu.c | 8 ++++---- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 209f083e1..0b801dbfd 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -798,18 +798,19 @@ void K_RegisterKartStuff(void) REG_HUD_OFFSET_X(name)\ REG_HUD_OFFSET_Y(name) - REG_HUD_OFFSET(item); // Item box - REG_HUD_OFFSET(time); // Time - REG_HUD_OFFSET(laps); // Number of laps - REG_HUD_OFFSET(dnft); // Countdown (did not finish timer) - REG_HUD_OFFSET(speed); // Speedometer - REG_HUD_OFFSET(posi); // Position in race - REG_HUD_OFFSET(face); // Mini rankings - REG_HUD_OFFSET(stcd); // Starting countdown + REG_HUD_OFFSET(item); // Item box + REG_HUD_OFFSET(time); // Time + REG_HUD_OFFSET(laps); // Number of laps + REG_HUD_OFFSET(dnft); // Countdown (did not finish timer) + REG_HUD_OFFSET(speed); // Speedometer + REG_HUD_OFFSET(posi); // Position in race + REG_HUD_OFFSET(wheel); // Position in race + REG_HUD_OFFSET(face); // Mini rankings + REG_HUD_OFFSET(stcd); // Starting countdown REG_HUD_OFFSET_Y(chek); // Check gfx - REG_HUD_OFFSET(mini); // Minimap - REG_HUD_OFFSET(want); // Wanted - REG_HUD_OFFSET(stat); // Stats + REG_HUD_OFFSET(mini); // Minimap + REG_HUD_OFFSET(want); // Wanted + REG_HUD_OFFSET(stat); // Stats #undef REG_HUD_OFFSET #undef REG_HUD_OFFSET_X diff --git a/src/m_menu.c b/src/m_menu.c index 6c14bdef8..91ca80b58 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2386,12 +2386,12 @@ static menuitem_t OP_HudOffsetMenu[] = {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_mini_yoffset, 125}, {IT_HEADER, NULL, "Position Number", NULL, 135}, - {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_wheel_xoffset, 140}, - {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_wheel_yoffset, 145}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_posi_xoffset, 140}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_posi_yoffset, 145}, {IT_HEADER, NULL, "R.A. Wheel", NULL, 155}, - {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_posi_xoffset, 160}, - {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_posi_yoffset, 165}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_wheel_xoffset, 160}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_wheel_yoffset, 165}, {IT_HEADER, NULL, "Stat Display", NULL, 175}, {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_stat_xoffset, 180},