From 7b4592377eb5c1640d3ae4fddad1efca78c3b378 Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 27 Nov 2025 18:40:52 +0300 Subject: [PATCH 01/10] Make emote search case insensetive (emotes themself still are case sensetive) --- src/m_emotes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_emotes.cpp b/src/m_emotes.cpp index 3e55ef788..f6ad2db3a 100644 --- a/src/m_emotes.cpp +++ b/src/m_emotes.cpp @@ -200,7 +200,7 @@ emote_t *M_FindEmote(const char *name, int len, int skip) for (auto &pair: emotes) { - if (pair.first.rfind(query) == std::string::npos) + if (strcasestr(pair.first.c_str(), query) == NULL) continue; if (skip > 0) From b09660204ad61f99c4b0038083b5636364e5639c Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 27 Nov 2025 16:17:05 +0100 Subject: [PATCH 02/10] r_bsp: move polyobj renderside check into R_AddPolyObjects uneeded within R_AddLine as outside R_AddPolyObjects this will never be called if currecnt seg is a polyseg --- src/r_bsp.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index e680783dd..0932f9d14 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -322,9 +322,6 @@ static void R_AddLine(seg_t *line) g_portal = NULL; - if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) - return; - // big room fix angle1 = R_PointToAngle64(line->v1->x, line->v1->y); angle2 = R_PointToAngle64(line->v2->x, line->v2->y); @@ -722,6 +719,8 @@ static void R_AddPolyObjects(subsector_t *sub) po = (polyobj_t *)(po->link.next); } + g_portal = NULL; + // for render stats ps_numpolyobjects.value.i += numpolys; @@ -732,8 +731,16 @@ static void R_AddPolyObjects(subsector_t *sub) for (i = 0; i < numpolys; ++i) { qs22j(po_ptrs[i]->segs, po_ptrs[i]->segCount, sizeof(seg_t *), R_PolysegCompare); + for (j = 0; j < po_ptrs[i]->segCount; ++j) - R_AddLine(po_ptrs[i]->segs[j]); + { + seg_t *seg = po_ptrs[i]->segs[j]; + + if (!(seg->polyseg->flags & POF_RENDERSIDES)) + continue; + + R_AddLine(seg); + } } } From 1e394b05300ede6655643174884c4b0ba78d84d9 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 27 Nov 2025 16:20:03 +0100 Subject: [PATCH 03/10] pass frontsector ceiling z to R_Prep3DFloors in both cases "R_Subsector" already got the frontsectors ceiling z, so no need to get it again within R_Prep3DFloors should save some P_GetSectorCeilingZAt per frame --- src/hardware/hw_main.cpp | 2 +- src/r_bsp.cpp | 12 ++++++------ src/r_bsp.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 754878441..f38a084b5 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -2964,7 +2964,7 @@ static void HWR_Subsector(size_t num) if (anyMoved == true) { gl_frontsector->numlights = sub->sector->numlights = 0; - R_Prep3DFloors(gl_frontsector); + R_Prep3DFloors(gl_frontsector, locCeilingHeight); sub->sector->lightlist = gl_frontsector->lightlist; sub->sector->numlights = gl_frontsector->numlights; sub->sector->moved = gl_frontsector->moved = false; diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 0932f9d14..9adcbccf7 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -812,7 +812,7 @@ static void R_Subsector(size_t num) if (anyMoved == true) { frontsector->numlights = sub->sector->numlights = 0; - R_Prep3DFloors(frontsector); + R_Prep3DFloors(frontsector, ceilingcenterz); sub->sector->lightlist = frontsector->lightlist; sub->sector->numlights = frontsector->numlights; sub->sector->moved = frontsector->moved = false; @@ -1062,7 +1062,7 @@ static void R_Subsector(size_t num) // // This function creates the lightlists that the given sector uses to light // floors/ceilings/walls according to the 3D floors. -void R_Prep3DFloors(sector_t *sector) +void R_Prep3DFloors(sector_t *sector, fixed_t secceilz) { ffloor_t *rover; ffloor_t *best; @@ -1088,13 +1088,13 @@ void R_Prep3DFloors(sector_t *sector) if (count != sector->numlights) { Z_Free(sector->lightlist); - sector->lightlist = static_cast(Z_Calloc(sizeof (*sector->lightlist) * count, PU_LEVEL, NULL)); + sector->lightlist = static_cast(Z_Malloc(sizeof(*sector->lightlist) * count, PU_LEVEL, NULL)); sector->numlights = count; } - else - memset(sector->lightlist, 0, sizeof (lightlist_t) * count); - heighttest = P_GetSectorCeilingZAt(sector, sector->soundorg.x, sector->soundorg.y); + memset(sector->lightlist, 0, sizeof(lightlist_t) * count); + + heighttest = secceilz; // sector ceiling z sector->lightlist[0].height = heighttest + 1; sector->lightlist[0].slope = sector->c_slope; diff --git a/src/r_bsp.h b/src/r_bsp.h index 1d00704f7..5f208f015 100644 --- a/src/r_bsp.h +++ b/src/r_bsp.h @@ -65,7 +65,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, boolean R_IsEmptyLine(seg_t *line, const sector_t *front, const sector_t *back); INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside); -void R_Prep3DFloors(sector_t *sector); +void R_Prep3DFloors(sector_t *sector, fixed_t secceilz); #ifdef __cplusplus } // extern "C" From 7cf3bceaff748f9ce19853281b6348b87ea594fa Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 27 Nov 2025 16:21:24 +0100 Subject: [PATCH 04/10] HWR_Subsector: avoid calling HWR_AddSprites on already processed sectors --- src/hardware/hw_main.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index f38a084b5..2752bf36d 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -3170,12 +3170,15 @@ doaddline: // hurdler: false: we only add the sprites, the walls are drawn first if (line) { - // draw sprites first, coz they are clipped to the solidsegs of - // subsectors more 'in front' - if (cv_drawdist.value || current_bsp_culling_distance) - HWR_AddSprites(gl_frontsector); - else - HWR_AddSprites(gl_frontsector); + if (sub->sector->validcount != validcount) + { + // draw sprites first, coz they are clipped to the solidsegs of + // subsectors more 'in front' + if (cv_drawdist.value || current_bsp_culling_distance) + HWR_AddSprites(gl_frontsector); + else + HWR_AddSprites(gl_frontsector); + } //Hurdler: at this point validcount must be the same, but is not because // gl_frontsector doesn't point anymore to sub->sector due to From 3878c2f72af9b9f9228b384cd1343c882d277e8d Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 27 Nov 2025 16:26:50 +0100 Subject: [PATCH 05/10] DoAddLine: add fast check for lines with same front and back sectors without middle tex taken from dsda-doom --- src/hardware/hw_main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 2752bf36d..340aa8413 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -2347,12 +2347,22 @@ static inline void DoAddLine(seg_t* line, angle_t angle1, angle_t angle2) static sector_t tempsec; auto do_addline = [&](bool dontdraw) { + // Single sided line? if (!line->backsector) { gld_clipper_SafeAddClipRange(angle2, angle1); } else { + if (line->frontsector == line->backsector) + { + if (R_GetTextureNum(line->sidedef->midtexture) == 0) + { + //e6y: nothing to do here! + return; + } + } + gl_backsector = R_FakeFlat(gl_backsector, &tempsec, NULL, NULL, true); if (CheckClip(gl_frontsector, gl_backsector)) From 1849d5aadeec7d78a07797c6cc0cb502e9a4fd42 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 27 Nov 2025 16:43:41 +0100 Subject: [PATCH 06/10] R_ProjectSprite: make sprite clipping work with sloped fake floors/ceilings from eternity engine --- src/hardware/hw_main.cpp | 17 +++++++++++------ src/r_things.cpp | 17 +++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 340aa8413..8cf74f58d 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -4924,13 +4924,18 @@ static void HWR_ProjectSprite(mobj_t *thing) if (heightsec != -1 && phs != -1) // only clip things which are in special sectors { - if (gl_viewz < FixedToFloat(sectors[phs].floorheight) ? - FixedToFloat(interp.z) >= FixedToFloat(sectors[heightsec].floorheight) : - gzt < FixedToFloat(sectors[heightsec].floorheight)) + fixed_t secheight; + + secheight = P_GetSectorFloorZAt(§ors[heightsec], viewx, viewy); + if (viewz < P_GetSectorFloorZAt(§ors[phs], interp.x, interp.y) ? + interp.z >= secheight : + gzt < secheight) return; - if (gl_viewz > FixedToFloat(sectors[phs].ceilingheight) ? - gzt < FixedToFloat(sectors[heightsec].ceilingheight) && gl_viewz >= FixedToFloat(sectors[heightsec].ceilingheight) : - FixedToFloat(interp.z) >= FixedToFloat(sectors[heightsec].ceilingheight)) + + secheight = P_GetSectorCeilingZAt(§ors[heightsec], viewx, viewy); + if (viewz > P_GetSectorCeilingZAt(§ors[phs], interp.x, interp.y) ? + gzt < secheight && viewz >= secheight : + interp.z >= secheight) return; } diff --git a/src/r_things.cpp b/src/r_things.cpp index 1fe07b9db..497f5a1ec 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1697,13 +1697,18 @@ static void R_ProjectSprite(mobj_t *thing) if (heightsec != -1 && phs != -1) // only clip things which are in special sectors { - if (viewz < sectors[phs].floorheight ? - interp.z >= sectors[heightsec].floorheight : - gzt < sectors[heightsec].floorheight) + fixed_t secheight; + + secheight = P_GetSectorFloorZAt(§ors[heightsec], viewx, viewy); + if (viewz < P_GetSectorFloorZAt(§ors[phs], interp.x, interp.y) ? + interp.z >= secheight : + gzt < secheight) return; - if (viewz > sectors[phs].ceilingheight ? - gzt < sectors[heightsec].ceilingheight && viewz >= sectors[heightsec].ceilingheight : - interp.z >= sectors[heightsec].ceilingheight) + + secheight = P_GetSectorCeilingZAt(§ors[heightsec], viewx, viewy); + if (viewz > P_GetSectorCeilingZAt(§ors[phs], interp.x, interp.y) ? + gzt < secheight && viewz >= secheight : + interp.z >= secheight) return; } From 2222272d6f943ef0fc3f3af5e1d29cdab2650632 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 27 Nov 2025 16:15:13 +0100 Subject: [PATCH 07/10] remove more unused/uneeded things - delet hw_dll - remove sector_t ceilspeed and floorspeed - remove a bunch of stuff from viewvars_s --- src/d_netcmd.c | 1 + src/hardware/hw_data.h | 4 +- src/hardware/hw_defs.h | 8 +-- src/hardware/hw_dll.h | 67 ----------------------- src/hardware/hw_main.cpp | 18 +++---- src/hardware/hw_portal.h | 2 +- src/hardware/r_opengl/r_opengl.c | 8 --- src/hardware/r_opengl/r_opengl.h | 12 ----- src/p_ceilng.c | 21 -------- src/p_floor.c | 92 +------------------------------- src/p_inter.c | 2 + src/p_spec.c | 3 -- src/r_bsp.cpp | 1 + src/r_defs.h | 9 +--- src/r_fps.h | 4 -- src/r_main.cpp | 29 ++-------- 16 files changed, 28 insertions(+), 253 deletions(-) delete mode 100644 src/hardware/hw_dll.h diff --git a/src/d_netcmd.c b/src/d_netcmd.c index eca887ef8..91f1d8245 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3898,6 +3898,7 @@ static void Got_Teamchange(const UINT8 **cp, INT32 playernum) if (G_BattleGametype()) // SRB2kart { players[playernum].marescore = 0; + if (K_IsPlayerWanted(&players[playernum])) K_CalculateBattleWanted(); } diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index 45d072c28..bb174b205 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -65,7 +65,7 @@ typedef struct GLMipmap_s GLMipmap_t; struct GLMapTexture_s { GLMipmap_t mipmap; - float scaleX; //used for scaling textures on walls + float scaleX; // used for scaling textures on walls float scaleY; }; typedef struct GLMapTexture_s GLMapTexture_t; @@ -74,7 +74,7 @@ typedef struct GLMapTexture_s GLMapTexture_t; struct GLPatch_s { GLMipmap_t *mipmap; - float max_s,max_t; + float max_s, max_t; }; typedef struct GLPatch_s GLPatch_t; diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index ce903c82d..6a8649099 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -79,7 +79,7 @@ typedef struct FColorARGB FColorARGB; // Simple 2D coordinate typedef struct { - FLOAT x,y; + FLOAT x, y; } F2DCoord, v2d_t; // ====================== @@ -142,8 +142,8 @@ enum // Transformed vector, as passed to HWR API typedef struct { - FLOAT x,y,z; - FLOAT s,t; + FLOAT x, y, z; + FLOAT s, t; } FOutVector; typedef struct vbo_vertex_s @@ -173,7 +173,7 @@ typedef struct int rows, columns; int loopcount; - int detail, vertex_count; + int vertex_count; int texture, width, height; boolean rebuild; // VBO needs to be rebuilt diff --git a/src/hardware/hw_dll.h b/src/hardware/hw_dll.h deleted file mode 100644 index 8ee6da2fc..000000000 --- a/src/hardware/hw_dll.h +++ /dev/null @@ -1,67 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 2005 by SRB2 Jr. Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief Win32 DLL and Shared Objects API definitions - -#ifndef __HWR_DLL_H__ -#define __HWR_DLL_H__ - -// Function declaration for exports from the DLL : -// EXPORT HWRAPI() (); -// If _CREATE_DLL_ is defined the above declaration translates to : -// __declspec(dllexport) WINAPI (); -// If _CREATE_DLL_ is NOT DEFINED the above declaration translates to : -// __declspec(dllexport) type> (WINAPI *) (); - -#ifdef _CREATE_DLL_ - #ifdef __cplusplus - #define EXPORT extern "C" - #else - #define EXPORT - #endif - #ifdef _WIN32 - #define HWRAPI(fn) WINAPI fn - #else - #define HWRAPI(fn) fn - #endif -#else // _CREATE_DLL_ - #define EXPORT typedef - #ifdef _WIN32 - #define HWRAPI(fn) (WINAPI *fn) - #else - #define HWRAPI(fn) (*fn) - #endif -#endif - -// ========================================================================== -// MATHS -// ========================================================================== - -// Constants -#define DEGREE (0.017453292519943295769236907684883l) // 2*PI/360 - -void GL_DBG_Printf(const char *format, ...) /*FUNCPRINTF*/; -#define DBG_Printf GL_DBG_Printf - -#if defined (__CYGWIN__) -void _init() __attribute__((constructor)); -void _fini() __attribute__((destructor)); -#else -void _init(); -void _fini(); -#endif - -#endif diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 8cf74f58d..52250bbe8 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -2529,7 +2529,7 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord) // one if statement will split the space in two for one coordinate // for example: // x < BOXLEFT || BOXLEFT || !(x < BOXLEFT) <-- (same as x >= BOXLEFT) - fixed_t mindist;// = min(min(mindist1, mindist2), min(mindist3, mindist4)); + fixed_t mindist = 0;// = min(min(mindist1, mindist2), min(mindist3, mindist4)); // new thing // calculate distance to axis aligned bounding box. @@ -3022,7 +3022,7 @@ static void HWR_Subsector(size_t num) // Hack to make things continue to work around slopes. locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gl_frontsector->ceilingheight, // We now return you to your regularly scheduled rendering. - PF_Occlude, ceilinglightlevel, levelflats[gl_frontsector->ceilingpic].lumpnum,NULL, 255, ceilingcolormap); + PF_Occlude, ceilinglightlevel, levelflats[gl_frontsector->ceilingpic].lumpnum, NULL, 255, ceilingcolormap); } } } @@ -3054,8 +3054,8 @@ static void HWR_Subsector(size_t num) centerHeight = P_GetFFloorBottomZAt(rover, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y); if (centerHeight <= locCeilingHeight && centerHeight >= locFloorHeight && - ((viewz < bottomCullHeight && !(rover->flags & FF_INVERTPLANES)) || - (viewz > bottomCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) + ((viewz < bottomCullHeight && !(rover->flags & FF_INVERTPLANES)) || + (viewz > bottomCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) { if (rover->flags & FF_FOG) { @@ -3099,9 +3099,9 @@ static void HWR_Subsector(size_t num) centerHeight = P_GetFFloorTopZAt(rover, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y); if (centerHeight >= locFloorHeight && - centerHeight <= locCeilingHeight && - ((viewz > topCullHeight && !(rover->flags & FF_INVERTPLANES)) || - (viewz < topCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) + centerHeight <= locCeilingHeight && + ((viewz > topCullHeight && !(rover->flags & FF_INVERTPLANES)) || + (viewz < topCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) { if (rover->flags & FF_FOG) { @@ -5201,7 +5201,6 @@ void HWR_ClearSkyDome(void) sky->rows = sky->columns = 0; sky->loopcount = 0; - sky->detail = 0; sky->texture = -1; sky->width = sky->height = 0; @@ -5220,8 +5219,7 @@ void HWR_BuildSkyDome(void) gl_skyvertex_t *vertex_p; const texture_t *texture = textures[texturetranslation[skytexture]]; - sky->detail = 16; - col_count *= sky->detail; + col_count *= 16; if ((sky->columns != col_count) || (sky->rows != row_count)) HWR_ClearSkyDome(); diff --git a/src/hardware/hw_portal.h b/src/hardware/hw_portal.h index 494110d79..23876281c 100644 --- a/src/hardware/hw_portal.h +++ b/src/hardware/hw_portal.h @@ -65,7 +65,7 @@ extern SINT8 gl_portal_state; // new thing extern gl_portallist_t *currentportallist; -static inline void HWR_SetPortalState (SINT8 state) +static inline void HWR_SetPortalState(SINT8 state) { gl_portal_state = state; } diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 185bc7e8a..5fd9c8537 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1734,14 +1734,6 @@ void GL_SetBlend(FBITFIELD PolyFlags) if (Xor & PF_Modulated) { -#if defined (__unix__) || defined (UNIXCOMMON) - if (oglflags & GLF_NOTEXENV) - { - if (!(PolyFlags & PF_Modulated)) - pglColor4ubv(white); - } - else -#endif if (PolyFlags & PF_Modulated) { // mix texture colour with Surface->PolyColor pglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); diff --git a/src/hardware/r_opengl/r_opengl.h b/src/hardware/r_opengl/r_opengl.h index 256731083..b62c0698c 100644 --- a/src/hardware/r_opengl/r_opengl.h +++ b/src/hardware/r_opengl/r_opengl.h @@ -38,8 +38,6 @@ extern "C" { #endif #endif -#define _CREATE_DLL_ // necessary for Unix AND Windows - #include "../../doomdef.h" #include "../hw_gl.h" #include "../../z_zone.h" @@ -126,18 +124,8 @@ extern GLint maximumAnisotropy; extern boolean supportNPO2tex; extern boolean supportMipMap; -/** \brief OpenGL flags for video driver -*/ -extern INT32 oglflags; - extern GLfloat projMatrix[16]; -typedef enum -{ - GLF_NOZBUFREAD = 0x01, - GLF_NOTEXENV = 0x02, -} oglflags_t; - #ifdef __cplusplus } // extern "C" #endif diff --git a/src/p_ceilng.c b/src/p_ceilng.c index a00d78008..1ec076325 100644 --- a/src/p_ceilng.c +++ b/src/p_ceilng.c @@ -33,7 +33,6 @@ void T_MoveCeiling(ceiling_t *ceiling) { result_e res; - boolean dontupdate = false; if (ceiling->delaytimer) { @@ -69,9 +68,7 @@ void T_MoveCeiling(ceiling_t *ceiling) case instantMoveCeilingByFrontSector: ceiling->sector->ceilingpic = ceiling->texture; ceiling->sector->ceilingdata = NULL; - ceiling->sector->ceilspeed = 0; P_RemoveThinker(&ceiling->thinker); - dontupdate = true; break; case moveCeilingByFrontSector: if (ceiling->texture < -1) // chained linedef executing @@ -83,9 +80,7 @@ void T_MoveCeiling(ceiling_t *ceiling) // case raiseCeilingByLine: case moveCeilingByFrontTexture: ceiling->sector->ceilingdata = NULL; - ceiling->sector->ceilspeed = 0; P_RemoveThinker(&ceiling->thinker); - dontupdate = true; break; case fastCrushAndRaise: @@ -189,9 +184,7 @@ void T_MoveCeiling(ceiling_t *ceiling) case instantMoveCeilingByFrontSector: ceiling->sector->ceilingpic = ceiling->texture; ceiling->sector->ceilingdata = NULL; - ceiling->sector->ceilspeed = 0; P_RemoveThinker(&ceiling->thinker); - dontupdate = true; break; case moveCeilingByFrontSector: @@ -209,9 +202,7 @@ void T_MoveCeiling(ceiling_t *ceiling) // case lowerCeilingByLine: case moveCeilingByFrontTexture: ceiling->sector->ceilingdata = NULL; - ceiling->sector->ceilspeed = 0; P_RemoveThinker(&ceiling->thinker); - dontupdate = true; break; case bounceCeiling: { @@ -290,10 +281,6 @@ void T_MoveCeiling(ceiling_t *ceiling) } break; } - if (!dontupdate) - ceiling->sector->ceilspeed = ceiling->speed*ceiling->direction; - else - ceiling->sector->ceilspeed = 0; } /** Moves a ceiling crusher. @@ -335,12 +322,9 @@ void T_CrushCeiling(ceiling_t *ceiling) switch(ceiling->type) { case crushCeilOnce: - ceiling->sector->ceilspeed = 0; ceiling->sector->ceilingdata = NULL; break; case crushBothOnce: - ceiling->sector->floorspeed = 0; - ceiling->sector->ceilspeed = 0; ceiling->sector->ceilingdata = NULL; break; default: @@ -377,11 +361,6 @@ void T_CrushCeiling(ceiling_t *ceiling) } break; } - - if (ceiling->type == crushBothOnce) - ceiling->sector->floorspeed = ceiling->speed*(-ceiling->direction); - - ceiling->sector->ceilspeed = ceiling->speed*ceiling->direction; } /** Starts a ceiling mover. diff --git a/src/p_floor.c b/src/p_floor.c index f4cc3e992..856d14f09 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -279,7 +279,6 @@ result_e T_MovePlane(sector_t *sector, fixed_t speed, fixed_t dest, boolean crus void T_MoveFloor(floormove_t *movefloor) { result_e res = 0; - boolean dontupdate = false; if (movefloor->delaytimer) { @@ -325,7 +324,6 @@ void T_MoveFloor(floormove_t *movefloor) else movefloor->floordestheight = lines[movefloor->texture].frontsector->floorheight; movefloor->direction = (movefloor->floordestheight < movefloor->sector->floorheight) ? -1 : 1; - movefloor->sector->floorspeed = movefloor->speed * movefloor->direction; movefloor->delaytimer = movefloor->delay; movefloor->sector->moved = true; return; // not break, why did this work? Graue 04-03-2004 @@ -341,7 +339,6 @@ void T_MoveFloor(floormove_t *movefloor) movefloor->speed = movefloor->origspeed = FixedDiv(abs(lines[movefloor->texture].dx),4*FRACUNIT); // forward again, use dx } movefloor->direction = (movefloor->floordestheight < movefloor->sector->floorheight) ? -1 : 1; - movefloor->sector->floorspeed = movefloor->speed * movefloor->direction; movefloor->delaytimer = movefloor->delay; movefloor->sector->moved = true; return; // not break, why did this work? Graue 04-03-2004 @@ -374,7 +371,6 @@ void T_MoveFloor(floormove_t *movefloor) else movefloor->floordestheight = lines[movefloor->texture].frontsector->floorheight; movefloor->direction = (movefloor->floordestheight < movefloor->sector->floorheight) ? -1 : 1; - movefloor->sector->floorspeed = movefloor->speed * movefloor->direction; movefloor->delaytimer = movefloor->delay; movefloor->sector->moved = true; return; // not break, why did this work? Graue 04-03-2004 @@ -390,14 +386,12 @@ void T_MoveFloor(floormove_t *movefloor) movefloor->speed = movefloor->origspeed = FixedDiv(abs(lines[movefloor->texture].dx),4*FRACUNIT); // forward again, use dx } movefloor->direction = (movefloor->floordestheight < movefloor->sector->floorheight) ? -1 : 1; - movefloor->sector->floorspeed = movefloor->speed * movefloor->direction; movefloor->delaytimer = movefloor->delay; movefloor->sector->moved = true; return; // not break, why did this work? Graue 04-03-2004 case crushFloorOnce: movefloor->sector->floordata = NULL; // Clear up the thinker so others can use it P_RemoveThinker(&movefloor->thinker); - movefloor->sector->floorspeed = 0; movefloor->sector->moved = true; return; default: @@ -406,14 +400,8 @@ void T_MoveFloor(floormove_t *movefloor) } movefloor->sector->floordata = NULL; // Clear up the thinker so others can use it - movefloor->sector->floorspeed = 0; P_RemoveThinker(&movefloor->thinker); - dontupdate = true; } - if (!dontupdate) - movefloor->sector->floorspeed = movefloor->speed*movefloor->direction; - else - movefloor->sector->floorspeed = 0; movefloor->sector->moved = true; } @@ -623,22 +611,13 @@ void T_MoveElevator(elevator_t *elevator) { elevator->sector->floordata = NULL; //jff 2/22/98 elevator->sector->ceilingdata = NULL; //jff 2/22/98 - elevator->sector->ceilspeed = 0; - elevator->sector->floorspeed = 0; P_RemoveThinker(&elevator->thinker); // remove elevator from actives dontupdate = true; } } - if (!dontupdate) + if (dontupdate) { - elevator->sector->floorspeed = elevator->speed*elevator->direction; - elevator->sector->ceilspeed = 42; - } - else - { - elevator->sector->floorspeed = 0; - elevator->sector->ceilspeed = 0; elevator->sector->floordata = NULL; elevator->sector->ceilingdata = NULL; } @@ -695,8 +674,6 @@ void T_ContinuousFalling(levelspecthink_t *faller) } } - faller->sector->floorspeed = faller->speed*faller->direction; - faller->sector->ceilspeed = 42; faller->sector->moved = true; #undef speed #undef direction @@ -767,9 +744,7 @@ void T_BounceCheese(levelspecthink_t *bouncer) { bouncer->sector->crumblestate = 1; bouncer->sector->ceilingdata = NULL; - bouncer->sector->ceilspeed = 0; bouncer->sector->floordata = NULL; - bouncer->sector->floorspeed = 0; P_RemoveThinker(&bouncer->thinker); // remove bouncer from actives return; } @@ -795,8 +770,6 @@ void T_BounceCheese(levelspecthink_t *bouncer) T_MovePlane(bouncer->sector, 0, bouncer->sector->floorheight, 0, 0, -1); // update things on floor bouncer->sector->ceilingdata = NULL; bouncer->sector->floordata = NULL; - bouncer->sector->floorspeed = 0; - bouncer->sector->ceilspeed = 0; bouncer->sector->moved = true; P_RemoveThinker(&bouncer->thinker); // remove bouncer from actives return; @@ -810,8 +783,6 @@ void T_BounceCheese(levelspecthink_t *bouncer) T_MovePlane(bouncer->sector, 0, bouncer->sector->floorheight, 0, 0, -1); // update things on floor bouncer->sector->ceilingdata = NULL; bouncer->sector->floordata = NULL; - bouncer->sector->floorspeed = 0; - bouncer->sector->ceilspeed = 0; bouncer->sector->moved = true; P_RemoveThinker(&bouncer->thinker); // remove bouncer from actives return; @@ -827,9 +798,6 @@ void T_BounceCheese(levelspecthink_t *bouncer) T_MovePlane(bouncer->sector, bouncer->speed/2, bouncer->sector->floorheight - 70*FRACUNIT, 0, 0, -1); // move floor - bouncer->sector->floorspeed = -bouncer->speed/2; - bouncer->sector->ceilspeed = 42; - if (bouncer->sector->ceilingheight < bouncer->ceilingwasheight && bouncer->low == 0) // Down { if (abs(bouncer->speed) < 6*FRACUNIT) @@ -878,9 +846,7 @@ void T_BounceCheese(levelspecthink_t *bouncer) T_MovePlane(bouncer->sector, 0, bouncer->sector->ceilingheight, 0, 1, -1); // update things on ceiling T_MovePlane(bouncer->sector, 0, bouncer->sector->floorheight, 0, 0, -1); // update things on floor bouncer->sector->ceilingdata = NULL; - bouncer->sector->floordata = NULL; - bouncer->sector->floorspeed = 0; - bouncer->sector->ceilspeed = 0; + bouncer->sector->floordata = NULL;; bouncer->sector->moved = true; P_RemoveThinker(&bouncer->thinker); // remove bouncer from actives } @@ -920,8 +886,6 @@ void T_StartCrumble(elevator_t *elevator) || (elevator->floordestheight == 0 && elevator->direction == 1)) && elevator->type == elevateContinuous) // No return crumbler { - elevator->sector->ceilspeed = 0; - elevator->sector->floorspeed = 0; return; } @@ -934,9 +898,6 @@ void T_StartCrumble(elevator_t *elevator) elevator->distance = -15*TICRATE; // Timer until platform returns to original position. else { - // Timer isn't up yet, so just keep waiting. - elevator->sector->ceilspeed = 0; - elevator->sector->floorspeed = 0; return; } } @@ -965,8 +926,6 @@ void T_StartCrumble(elevator_t *elevator) else elevator->direction = 1; - elevator->sector->ceilspeed = 0; - elevator->sector->floorspeed = 0; return; } @@ -1050,9 +1009,6 @@ void T_StartCrumble(elevator_t *elevator) 0, // move ceiling elevator->direction ); - - elevator->sector->ceilspeed = 42; - elevator->sector->floorspeed = elevator->speed*elevator->direction; } } } @@ -1063,8 +1019,6 @@ void T_StartCrumble(elevator_t *elevator) elevator->sector->floorheight = elevator->floorwasheight; elevator->sector->floordata = NULL; elevator->sector->ceilingdata = NULL; - elevator->sector->ceilspeed = 0; - elevator->sector->floorspeed = 0; elevator->sector->moved = true; P_RemoveThinker(&elevator->thinker); } @@ -1121,8 +1075,6 @@ void T_MarioBlock(levelspecthink_t *block) P_RemoveThinker(&block->thinker); block->sector->floordata = NULL; block->sector->ceilingdata = NULL; - block->sector->floorspeed = 0; - block->sector->ceilspeed = 0; } for (i = -1; (i = P_FindSectorFromTag((INT16)block->vars[0], i)) >= 0 ;) @@ -1365,8 +1317,6 @@ wegotit: { bridge->sector->floorheight = LOWCEILINGHEIGHT - (bridge->sector->ceilingheight - bridge->sector->floorheight); bridge->sector->ceilingheight = LOWCEILINGHEIGHT; - bridge->sector->ceilspeed = 0; - bridge->sector->floorspeed = 0; goto dorest; } @@ -1422,9 +1372,6 @@ wegotit: DIRECTION // direction ); - bridge->sector->ceilspeed = 42; - bridge->sector->floorspeed = CURSPEED*DIRECTION; - dorest: // Adjust joined sector heights { @@ -1463,8 +1410,6 @@ wegotit: { bridge->sector->floorheight = ORIGCEILINGHEIGHT - (bridge->sector->ceilingheight - bridge->sector->floorheight); bridge->sector->ceilingheight = ORIGCEILINGHEIGHT; - bridge->sector->ceilspeed = 0; - bridge->sector->floorspeed = 0; continue; } @@ -1519,9 +1464,6 @@ wegotit: 0, // floor or ceiling (0 for floor) DIRECTION // direction ); - - bridge->sector->ceilspeed = 42; - bridge->sector->floorspeed = CURSPEED*DIRECTION; } } } @@ -1558,8 +1500,6 @@ wegotit: { bridge->sector->floorheight = ORIGCEILINGHEIGHT - (bridge->sector->ceilingheight - bridge->sector->floorheight); bridge->sector->ceilingheight = ORIGCEILINGHEIGHT; - bridge->sector->ceilspeed = 0; - bridge->sector->floorspeed = 0; continue; } @@ -1614,9 +1554,6 @@ wegotit: 0, // floor or ceiling (0 for floor) DIRECTION // direction ); - - bridge->sector->ceilspeed = 42; - bridge->sector->floorspeed = CURSPEED*DIRECTION; } } } @@ -1642,8 +1579,6 @@ wegotit: { bridge->sector->floorheight = ORIGCEILINGHEIGHT - (bridge->sector->ceilingheight - bridge->sector->floorheight); bridge->sector->ceilingheight = ORIGCEILINGHEIGHT; - bridge->sector->ceilspeed = 0; - bridge->sector->floorspeed = 0; continue; } @@ -1698,9 +1633,6 @@ wegotit: 0, // floor or ceiling (0 for floor) DIRECTION // direction ); - - bridge->sector->ceilspeed = 42; - bridge->sector->floorspeed = CURSPEED*DIRECTION; } } // Update precip @@ -1875,9 +1807,6 @@ void T_ThwompSector(levelspecthink_t *thwomp) if (res == pastdest) thwomp->direction = 0; // stop moving - - thwomp->sector->ceilspeed = 42; - thwomp->sector->floorspeed = thwomp->speed*thwomp->direction; } else if (thwomp->direction < 0) // Crashing down! { @@ -1932,16 +1861,10 @@ void T_ThwompSector(levelspecthink_t *thwomp) thwomp->direction = 1; // start heading back up thwomp->distance = TICRATE; // but only after a small delay } - - thwomp->sector->ceilspeed = 42; - thwomp->sector->floorspeed = thwomp->speed*thwomp->direction; } else // Not going anywhere, so look for players. { thwomp->direction = -1; - - thwomp->sector->ceilspeed = 0; - thwomp->sector->floorspeed = 0; } actionsector->moved = true; @@ -2355,8 +2278,6 @@ void T_RaiseSector(levelspecthink_t *raise) { raise->sector->floorheight = raise->vars[7] - (raise->sector->ceilingheight - raise->sector->floorheight); raise->sector->ceilingheight = raise->vars[7]; - raise->sector->ceilspeed = 0; - raise->sector->floorspeed = 0; return; } @@ -2370,8 +2291,6 @@ void T_RaiseSector(levelspecthink_t *raise) { raise->sector->floorheight = raise->vars[5] - (raise->sector->ceilingheight - raise->sector->floorheight); raise->sector->ceilingheight = raise->vars[5]; - raise->sector->ceilspeed = 0; - raise->sector->floorspeed = 0; return; } @@ -2390,8 +2309,6 @@ void T_RaiseSector(levelspecthink_t *raise) { raise->sector->floorheight = raise->vars[5] - (raise->sector->ceilingheight - raise->sector->floorheight); raise->sector->ceilingheight = raise->vars[5]; - raise->sector->ceilspeed = 0; - raise->sector->floorspeed = 0; return; } raise->vars[8] = 1; @@ -2404,8 +2321,6 @@ void T_RaiseSector(levelspecthink_t *raise) { raise->sector->floorheight = raise->vars[7] - (raise->sector->ceilingheight - raise->sector->floorheight); raise->sector->ceilingheight = raise->vars[7]; - raise->sector->ceilspeed = 0; - raise->sector->floorspeed = 0; return; } raise->vars[8] = -1; @@ -2460,9 +2375,6 @@ void T_RaiseSector(levelspecthink_t *raise) raise->vars[8] // direction ); - raise->sector->ceilspeed = 42; - raise->sector->floorspeed = raise->vars[3]*raise->vars[8]; - for (i = -1; (i = P_FindSectorFromTag(raise->sourceline->tag, i)) >= 0 ;) sectors[i].moved = true; } diff --git a/src/p_inter.c b/src/p_inter.c index 3518684e3..c95735506 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2164,7 +2164,9 @@ static void P_KillPlayer(player_t *player, mobj_t *source) P_SetScale(karmahitbox, player->mo->scale); CONS_Printf(M_GetText("%s lost all of their bumpers!\n"), player_names[player-players]); } + player->kartstuff[k_bumper]--; + if (K_IsPlayerWanted(player)) K_CalculateBattleWanted(); } diff --git a/src/p_spec.c b/src/p_spec.c index c8e36176a..7cf2694d0 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1978,13 +1978,11 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) { P_RemoveThinker(&((elevator_t *)sectors[secnum].floordata)->thinker); sectors[secnum].floordata = sectors[secnum].ceilingdata = NULL; - sectors[secnum].floorspeed = sectors[secnum].ceilspeed = 0; } else // floormove { P_RemoveThinker(&((floormove_t *)sectors[secnum].floordata)->thinker); sectors[secnum].floordata = NULL; - sectors[secnum].floorspeed = 0; } } @@ -1992,7 +1990,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) { P_RemoveThinker(&((ceiling_t *)sectors[secnum].ceilingdata)->thinker); sectors[secnum].ceilingdata = NULL; - sectors[secnum].ceilspeed = 0; } } break; diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 9adcbccf7..ac9ab081b 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -1124,6 +1124,7 @@ void R_Prep3DFloors(sector_t *sector, fixed_t secceilz) bestslope = *rover->t_slope; continue; } + if (rover->flags & FF_DOUBLESHADOW) { heighttest = P_GetFFloorBottomZAt(rover, sector->soundorg.x, sector->soundorg.y); diff --git a/src/r_defs.h b/src/r_defs.h index 876c63485..e6c5866c6 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -397,9 +397,6 @@ typedef struct sector_s // Sprite culling feature struct line_s *cullheight; - // Current speed of ceiling/floor. For Knuckles to hold onto stuff. - fixed_t floorspeed, ceilspeed; - // Eternity engine slope boolean hasslope; // The sector, or one of its visible FOFs, contains a slope } sector_t; @@ -549,12 +546,10 @@ typedef struct seg_s sector_t *backsector; fixed_t length; // precalculated seg length - #ifdef HWRENDER - floatvertex_t fv1; - floatvertex_t fv2; + floatvertex_t fv1; // v1 in floats - precalculated + floatvertex_t fv2; // v2 in floats - precalculated #endif - polyobj_t *polyseg; // Fake contrast calculated on level load diff --git a/src/r_fps.h b/src/r_fps.h index 7ad5e9f16..c1447897e 100644 --- a/src/r_fps.h +++ b/src/r_fps.h @@ -75,15 +75,11 @@ typedef struct { fixed_t y; fixed_t z; boolean sky; - sector_t *sector; player_t *player; angle_t angle; angle_t aim; angle_t roll; - fixed_t cos; - fixed_t sin; - mobj_t *mobj; } viewvars_t; extern viewvars_t *newview; diff --git a/src/r_main.cpp b/src/r_main.cpp index 452ed79c7..af5e821b2 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -1094,7 +1094,7 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y) mobj_t *viewmobj = NULL; -static void R_SetupCommonFrame(player_t * player, sector_t * sector) +static void R_SetupCommonFrame(player_t * player) { newview->player = player; @@ -1104,11 +1104,6 @@ static void R_SetupCommonFrame(player_t * player, sector_t * sector) newview->roll = R_ViewRollAngle(player); - if (sector != NULL) - newview->sector = sector; - else - newview->sector = R_PointInSubsectorFast(newview->x, newview->y)->sector; - R_InterpolateView(R_GetTimeFrac(RTF_CAMERA), false); } @@ -1207,7 +1202,6 @@ void R_SkyboxFrame(UINT8 pnum) { player_t *player = &players[displayplayers[pnum]]; camera_t *thiscam = &camera[pnum]; - sector_t *viewsec = NULL; mapheader_t *mh = mapheaderinfo[gamemap-1]; R_SetViewContext(static_cast(VIEWCONTEXT_SKY1 + pnum)); @@ -1233,9 +1227,6 @@ void R_SkyboxFrame(UINT8 pnum) newview->x = viewmobj->x; newview->y = viewmobj->y; newview->z = (viewmobj->spawnpoint) ? (((fixed_t)viewmobj->spawnpoint->angle) << FRACBITS) : 0; - - if (viewmobj->subsector) - viewsec = viewmobj->subsector->sector; } if (mh) @@ -1243,7 +1234,7 @@ void R_SkyboxFrame(UINT8 pnum) R_SetupSkyScale(player, thiscam, mh); } - R_SetupCommonFrame(player, viewsec); + R_SetupCommonFrame(player); } void R_SetupFrame(UINT8 pnum, boolean skybox) @@ -1251,7 +1242,6 @@ void R_SetupFrame(UINT8 pnum, boolean skybox) player_t *player = &players[displayplayers[pnum]]; camera_t *thiscam = &camera[pnum]; boolean chasecam = (cv_chasecam[pnum].value); - sector_t *viewsec = NULL; R_SetViewContext(static_cast(VIEWCONTEXT_PLAYER1 + pnum)); @@ -1295,10 +1285,7 @@ void R_SetupFrame(UINT8 pnum, boolean skybox) newview->y = viewmobj->y; newview->z = viewmobj->z + 20*FRACUNIT; - if (viewmobj->subsector) - viewsec = viewmobj->subsector->sector; - - R_SetupCommonFrame(player, viewsec); + R_SetupCommonFrame(player); } else if (thiscam && chasecam) // use outside cam view { @@ -1309,10 +1296,7 @@ void R_SetupFrame(UINT8 pnum, boolean skybox) newview->y = thiscam->y; newview->z = thiscam->z + (thiscam->height>>1); - if (thiscam->subsector) - viewsec = thiscam->subsector->sector; - - R_SetupCommonFrame(player, viewsec); + R_SetupCommonFrame(player); } else if (player->mo) // use the player's eyes view { @@ -1323,10 +1307,7 @@ void R_SetupFrame(UINT8 pnum, boolean skybox) newview->y = viewmobj->y; newview->z = player->viewz; - if (viewmobj->subsector) - viewsec = viewmobj->subsector->sector; - - R_SetupCommonFrame(player, viewsec); + R_SetupCommonFrame(player); } } From dc40befa884546afce0f4f92f6aabc95d46427bb Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 27 Nov 2025 18:48:32 +0300 Subject: [PATCH 08/10] Use I_GetTime for animated emotes, so anim argument in M_DrawEmote is not needed --- src/console.c | 4 ++-- src/hu_stuff.c | 13 +++++-------- src/m_emotes.cpp | 5 +++-- src/m_emotes.h | 7 +++---- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/console.c b/src/console.c index e9f4c80ff..d3c2623f4 100644 --- a/src/console.c +++ b/src/console.c @@ -1461,7 +1461,7 @@ static void CON_DrawHudlines(void) if ((emote = M_VerifyEmote((const char *)p, &emotelen))) { - M_DrawScaledEmote(x<= chat_topy) && (y+dy < (chat_bottomy))) { - HU_DrawEmote(x+dx+2, y+dy, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT); + M_DrawEmote(x+dx+2, y+dy, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT); dx += EMOTEWIDTH - charwidth; } j += emotelen; @@ -1874,7 +1871,7 @@ static void HU_DrawChat(void) if ((emote = M_VerifyEmote(w_chat_buf+i, &emotelen))) { - HU_DrawEmote(chatx + c + 2, y-1, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT|t); + M_DrawEmote(chatx + c + 2, y-1, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT|t); c += EMOTEWIDTH - charwidth; i += emotelen-1; drawwidth = EMOTEWIDTH; @@ -1963,7 +1960,7 @@ static void HU_DrawChat(void) hlflag = V_YELLOWMAP; V_DrawSmallString(chatx + boxw + 4 + EMOTEWIDTH, suggesty - (7*skip), hlflag|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va(":%s:", suggest->name)); - HU_DrawEmote(chatx + boxw + 2, suggesty - skip*7, suggest, V_SNAPTOBOTTOM|V_SNAPTOLEFT); + M_DrawEmote(chatx + boxw + 2, suggesty - skip*7, suggest, V_SNAPTOBOTTOM|V_SNAPTOLEFT); ++skip; } @@ -2105,7 +2102,7 @@ static void HU_DrawChat_Old(void) if ((emote = M_VerifyEmote(w_chat_buf+i, &emotelen))) { - HU_DrawScaledEmote((HU_INPUTX + c)<= HU_FONTSTART) //Hurdler: isn't it better like that? diff --git a/src/m_emotes.cpp b/src/m_emotes.cpp index f6ad2db3a..e45dcff58 100644 --- a/src/m_emotes.cpp +++ b/src/m_emotes.cpp @@ -15,6 +15,7 @@ #include #include "m_emotes.h" +#include "i_time.h" // I_GetTime extern "C" { #include "w_wad.h" @@ -248,12 +249,12 @@ emote_t *M_VerifyEmote(const char *name, int *emotelen) return match; } -void M_DrawScaledEmote(fixed_t x, fixed_t y, fixed_t scale, emote_t *emote, tic_t anim, INT32 flags) +void M_DrawScaledEmote(fixed_t x, fixed_t y, fixed_t scale, emote_t *emote, INT32 flags) { if (emote->numframes == 0) return; - const char *lumpname = emote->frames[(anim/emote->timeperframe) % emote->numframes]; + const char *lumpname = emote->frames[(I_GetTime()/emote->timeperframe) % emote->numframes]; patch_t *emotepatch = (patch_t*)W_CachePatchName(lumpname, PU_CACHE); const int CHARHEIGHT = 6; diff --git a/src/m_emotes.h b/src/m_emotes.h index efe3d69a2..594e219f8 100644 --- a/src/m_emotes.h +++ b/src/m_emotes.h @@ -49,10 +49,9 @@ emote_t *M_FindEmote(const char *name, int len, int skips); // needs to be skipped to get past emote name emote_t *M_VerifyEmote(const char *name, int *emotelen); -// Draw the emote, anim should be some kind of timer ticking every game tic -// for animated emotes -#define M_DrawEmote(x, y, emote, anim, flags) M_DrawScaledEmote((x)< Date: Thu, 27 Nov 2025 17:43:05 +0100 Subject: [PATCH 09/10] tiny optimizations k_kart --- src/k_kart.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 141af3481..201438234 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -809,8 +809,10 @@ boolean K_IsPlayerLosing(player_t *player) boolean K_IsPlayerWanted(player_t *player) { UINT8 i; - if (!(G_BattleGametype())) + + if (!G_BattleGametype()) return false; + for (i = 0; i < 4; i++) { if (battlewanted[i] == -1) @@ -818,6 +820,7 @@ boolean K_IsPlayerWanted(player_t *player) if (player == &players[battlewanted[i]]) return true; } + return false; } @@ -1242,7 +1245,9 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) { if (!playeringame[i] || players[i].spectator) continue; + pingame++; + if (players[i].exiting) dontforcespb = true; if (players[i].kartstuff[k_bumper] > bestbumper) @@ -1256,13 +1261,11 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) // This makes the roulette produce the random noises. if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player)) { -#define PLAYROULETTESND S_StartSound(NULL, sfx_itrol1 + ((player->kartstuff[k_itemroulette] / 3) % 8)) for (i = 0; i <= splitscreen; i++) { if (player == &players[displayplayers[i]] && players[displayplayers[i]].kartstuff[k_itemroulette]) - PLAYROULETTESND; + S_StartSound(NULL, sfx_itrol1 + ((player->kartstuff[k_itemroulette] / 3) % 8)); } -#undef PLAYROULETTESND } roulettestop = TICRATE + (3*(pingame - player->kartstuff[k_position])); @@ -1361,8 +1364,9 @@ static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) else { weight = (mobj->player->kartweight)<player->speed > K_GetKartSpeed(mobj->player, false)) - weight += (mobj->player->speed - K_GetKartSpeed(mobj->player, false))/8; + const fixed_t kartspeed = K_GetKartSpeed(mobj->player, false); + if (mobj->player->speed > kartspeed) + weight += (mobj->player->speed - kartspeed)/8; } break; case MT_FALLINGROCK: @@ -1484,9 +1488,9 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) } // if the speed difference is less than this let's assume they're going proportionately faster from each other - if (P_AproxDistance(momdifx, momdify) < (25*mapobjectscale)) + const fixed_t momdiflength = P_AproxDistance(momdifx, momdify); + if (momdiflength < (25*mapobjectscale)) { - fixed_t momdiflength = P_AproxDistance(momdifx, momdify); fixed_t normalisedx = FixedDiv(momdifx, momdiflength); fixed_t normalisedy = FixedDiv(momdify, momdiflength); momdifx = FixedMul((25*mapobjectscale), normalisedx); @@ -1650,7 +1654,7 @@ static void K_UpdateOffroad(player_t *player) // If you are in offroad, a timer starts. if (offroadstrength) { - if (/*K_CheckOffroadCollide(player->mo) &&*/ player->kartstuff[k_offroad] == 0) // With the way offroad is detected now that first check is no longer necessary. -Lat' + if (/*K_CheckOffroadCollide(player->mo) &&*/ player->kartstuff[k_offroad] == 0) // With the way offroad is detected now that first check is no longer necessary. -Lat' player->kartstuff[k_offroad] = (TICRATE/2); if (player->kartstuff[k_offroad] > 0) @@ -2394,7 +2398,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto || player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0 || (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) { - if (!force) // if shoulddamage force, we go THROUGH that. + if (!force) // if shoulddamage force, we go THROUGH that. { K_DoInstashield(player); return; @@ -2439,6 +2443,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto P_SetScale(karmahitbox, player->mo->scale); CONS_Printf(M_GetText("%s lost all of their bumpers!\n"), player_names[player-players]); } + player->kartstuff[k_bumper]--; if (K_IsPlayerWanted(player)) K_CalculateBattleWanted(); @@ -2573,6 +2578,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor) P_SetScale(karmahitbox, player->mo->scale); CONS_Printf(M_GetText("%s lost all of their bumpers!\n"), player_names[player-players]); } + player->kartstuff[k_bumper]--; if (K_IsPlayerWanted(player)) K_CalculateBattleWanted(); @@ -2692,6 +2698,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b P_SetScale(karmahitbox, player->mo->scale); CONS_Printf(M_GetText("%s lost all of their bumpers!\n"), player_names[player-players]); } + player->kartstuff[k_bumper]--; if (K_IsPlayerWanted(player)) K_CalculateBattleWanted(); @@ -2852,9 +2859,9 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 for (i = 0; i < number; i++) { fa = (i*degrees); - v[0] = FixedMul(FINECOSINE(fa),radius); + v[0] = FixedMul(FINECOSINE(fa), radius); v[1] = 0; - v[2] = FixedMul(FINESINE(fa),radius); + v[2] = FixedMul(FINESINE(fa), radius); v[3] = FRACUNIT; res = VectorMatrixMultiply(v, *RotateXMatrix(rotangle)); @@ -6285,7 +6292,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) K_KartUpdatePosition(player); - if (LIKELY(!player->exiting)) + if (!player->exiting) { if (player->kartstuff[k_oldposition] < player->kartstuff[k_position]) // But first, if you lost a place, { From c81cd48552d9e63cda680ceea9ddf47a20b507e2 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 27 Nov 2025 17:39:39 +0100 Subject: [PATCH 10/10] R_ProjectSprite: move fakeflat clipping before light maths so if applicable we have slightly less work --- src/r_things.cpp | 50 ++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/src/r_things.cpp b/src/r_things.cpp index 497f5a1ec..e250e877b 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1612,6 +1612,33 @@ static void R_ProjectSprite(mobj_t *thing) return; } + // killough 3/27/98: exclude things totally separated + // from the viewer, by either water or fake ceilings + // killough 4/11/98: improve sprite clipping for underwater/fake ceilings + + heightsec = thing->subsector->sector->heightsec; + if (viewplayer && viewplayer->mo && viewplayer->mo->subsector) + phs = viewplayer->mo->subsector->sector->heightsec; + else + phs = -1; + + if (heightsec != -1 && phs != -1) // only clip things which are in special sectors + { + fixed_t secheight; + + secheight = P_GetSectorFloorZAt(§ors[heightsec], viewx, viewy); + if (viewz < P_GetSectorFloorZAt(§ors[phs], interp.x, interp.y) ? + interp.z >= secheight : + gzt < secheight) + return; + + secheight = P_GetSectorCeilingZAt(§ors[heightsec], viewx, viewy); + if (viewz > P_GetSectorCeilingZAt(§ors[phs], interp.x, interp.y) ? + gzt < secheight && viewz >= secheight : + interp.z >= secheight) + return; + } + if (thing->frame & FF_ABSOLUTELIGHTLEVEL) { const UINT8 n = R_ThingLightLevel(thing); @@ -1689,29 +1716,6 @@ static void R_ProjectSprite(mobj_t *thing) lights_array = scalelight[lightnum]; } - heightsec = thing->subsector->sector->heightsec; - if (viewplayer && viewplayer->mo && viewplayer->mo->subsector) - phs = viewplayer->mo->subsector->sector->heightsec; - else - phs = -1; - - if (heightsec != -1 && phs != -1) // only clip things which are in special sectors - { - fixed_t secheight; - - secheight = P_GetSectorFloorZAt(§ors[heightsec], viewx, viewy); - if (viewz < P_GetSectorFloorZAt(§ors[phs], interp.x, interp.y) ? - interp.z >= secheight : - gzt < secheight) - return; - - secheight = P_GetSectorCeilingZAt(§ors[heightsec], viewx, viewy); - if (viewz > P_GetSectorCeilingZAt(§ors[phs], interp.x, interp.y) ? - gzt < secheight && viewz >= secheight : - interp.z >= secheight) - return; - } - // store information in a vissprite vis = R_NewVisSprite(); vis->heightsec = heightsec; //SoM: 3/17/2000