diff --git a/src/Makefile.cfg b/src/Makefile.cfg deleted file mode 100644 index 2e407ac3f..000000000 --- a/src/Makefile.cfg +++ /dev/null @@ -1,589 +0,0 @@ -# vim: ft=make -# -# Makefile.cfg for SRB2 -# - -# -# GNU compiler & tools' flags -# and other things -# - -# See the following variable don't start with 'GCC'. This is -# to avoid a false positive with the version detection... - -SUPPORTED_GCC_VERSIONS:=\ - 151 150 15\ - 142 141 140 14\ - 132 131 130 13\ - 123 122 121 120 12\ - 114 113 112 111 110 11\ - 105 104 103 102 101 100 10\ - 95 94 93 92 91 90\ - 85 84 83 82 81 80\ - 75 74 73 72 71 70\ - 64 63 62 61 60\ - 55 54 53 52 51 50\ - 49 48 47 46 45 44 43 42 41 40 - -LATEST_GCC_VERSION=14.2.1 - -# gcc or g++ -ifdef PREFIX - CC:=$(PREFIX)-gcc - CXX:=$(PREFIX)-g++ - OBJCOPY?=$(PREFIX)-objcopy - OBJDUMP?=$(PREFIX)-objdump - STRIP?=$(PREFIX)-strip - WINDRES?=$(PREFIX)-windres -else - OBJCOPY?=objcopy - OBJDUMP?=objdump - STRIP?=strip - WINDRES?=windres -endif - -# because Apple screws with us on this -# need to get bintools from homebrew -ifdef MACOSX - CC=clang - CXX=clang - OBJCOPY=gobjcopy - OBJDUMP=gobjdump -endif - -# Automatically set version flag, but not if one was manually set -ifeq (,$(filter GCC%,$(.VARIABLES))) - version:=$(shell $(CC) --version) - # check if this is in fact GCC - ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version)))) - shellversion:=$(shell $(CC) -dumpversion) - - # Try to remove "-win32" - version:=$(subst -win32,.0,$(shellversion)) - - # Turn version into words of major, minor - v:=$(subst ., ,$(version)) - # concat. major minor - v:=$(word 1,$(v))$(word 2,$(v)) - - # If this version is not in the list, default to the latest supported - ifeq (,$(filter $(v),$(SUPPORTED_GCC_VERSIONS))) - $(info\ - Your compiler version, GCC $(version), is not supported by the Makefile.\ - The Makefile will assume GCC $(LATEST_GCC_VERSION).) - GCC$(subst .,,$(LATEST_GCC_VERSION))=1 - else - $(info Detected GCC $(version) (GCC$(v))) - GCC$(v)=1 - endif - endif -endif - -ifdef GCC151 -GCC150=1 -endif - -ifdef GCC15 -GCC150=1 -endif - -ifdef GCC150 -GCC142=1 -endif - -ifdef GCC142 -GCC141=1 -endif - -ifdef GCC141 -GCC140=1 -endif - -ifdef GCC14 -GCC140=1 -endif - -ifdef GCC140 -GCC132=1 -endif - -ifdef GCC132 -GCC131=1 -endif - -ifdef GCC131 -GCC130=1 -endif - -ifdef GCC13 -GCC130=1 -endif - -ifdef GCC130 -GCC123=1 -endif - -ifdef GCC123 -GCC122=1 -endif - -ifdef GCC122 -GCC121=1 -endif - -ifdef GCC121 -GCC120=1 -endif - -ifdef GCC12 -GCC120=1 -endif - -ifdef GCC120 -GCC114=1 -endif - -ifdef GCC114 -GCC113=1 -endif - -ifdef GCC113 -GCC112=1 -endif - -ifdef GCC112 -GCC111=1 -endif - -ifdef GCC111 -GCC110=1 -endif - -ifdef GCC11 -GCC110=1 -endif - -ifdef GCC110 -GCC105=1 -endif - -ifdef GCC105 -GCC104=1 -endif - -ifdef GCC104 -GCC103=1 -endif - -ifdef GCC103 -GCC102=1 -endif - -ifdef GCC102 -GCC101=1 -endif - -ifdef GCC101 -GCC100=1 -endif - -ifdef GCC10 -GCC100=1 -endif - -ifdef GCC100 -GCC93=1 -endif - -ifdef GCC95 -GCC94=1 -endif - -ifdef GCC94 -GCC93=1 -endif - -ifdef GCC93 -GCC92=1 -endif - -ifdef GCC92 -GCC91=1 -endif - -ifdef GCC91 -GCC90=1 -endif - -ifdef GCC90 -GCC85=1 -endif - -ifdef GCC85 -GCC84=1 -endif - -ifdef GCC84 -GCC83=1 -endif - -ifdef GCC83 -GCC82=1 -endif - -ifdef GCC82 -GCC81=1 -endif - -ifdef GCC81 -GCC80=1 -endif - -ifdef GCC80 -GCC75=1 -endif - -ifdef GCC75 -GCC74=1 -endif - -ifdef GCC74 -GCC73=1 -endif - -ifdef GCC73 -GCC72=1 -endif - -ifdef GCC72 -GCC71=1 -endif - -ifdef GCC71 -GCC70=1 -endif - -ifdef GCC70 -GCC64=1 -endif - -ifdef GCC64 -GCC63=1 -endif - -ifdef GCC63 -GCC62=1 -endif - -ifdef GCC62 -GCC61=1 -endif - -ifdef GCC61 -GCC60=1 -endif - -ifdef GCC60 -GCC55=1 -endif - -ifdef GCC55 -GCC54=1 -endif - -ifdef GCC54 -GCC53=1 -endif - -ifdef GCC53 -GCC52=1 -endif - -ifdef GCC52 -GCC51=1 -endif - -ifdef GCC51 -GCC50=1 -endif - -ifdef GCC50 -GCC49=1 -endif - -ifdef GCC49 -GCC48=1 -endif - -ifdef GCC48 -GCC47=1 -endif - -ifdef GCC47 -GCC46=1 -endif - -ifdef GCC46 -GCC45=1 -endif - -ifdef GCC45 -GCC44=1 -endif - -ifdef GCC44 -GCC43=1 -endif - -ifdef GCC43 -GCC42=1 -endif - -ifdef GCC42 -GCC41=1 -endif - -ifdef GCC41 -GCC40=1 -VCHELP=1 -endif - -ifdef GCC295 -GCC29=1 -endif - -OLDWFLAGS:=$(WFLAGS) -# -W -Wno-unused -WFLAGS=-Wall -ifndef GCC295 -#WFLAGS+=-Wno-packed -endif -ifndef RELAXWARNINGS - WFLAGS+=-W -#WFLAGS+=-Wno-sign-compare -ifndef GCC295 - WFLAGS+=-Wno-div-by-zero -endif -#WFLAGS+=-Wsystem-headers -WFLAGS+=-Wfloat-equal -#WFLAGS+=-Wtraditional -ifdef VCHELP - #WFLAGS+=-Wdeclaration-after-statement - WFLAGS+=-Wno-error=declaration-after-statement -endif - WFLAGS+=-Wundef -ifndef GCC295 - WFLAGS+=-Wendif-labels -endif -ifdef GCC41 - WFLAGS+=-Wshadow -endif -#WFLAGS+=-Wlarger-than-%len% - WFLAGS+=-Wpointer-arith -Wbad-function-cast -ifdef GCC45 -#WFLAGS+=-Wc++-compat -endif - WFLAGS+=-Wcast-qual -ifndef NOCASTALIGNWARN - WFLAGS+=-Wcast-align -endif - WFLAGS+=-Wwrite-strings -ifndef ERRORMODE -#WFLAGS+=-Wconversion -ifdef GCC43 - #WFLAGS+=-Wno-sign-conversion -endif -endif - WFLAGS+=-Wsign-compare -ifdef GCC45 - WFLAGS+=-Wlogical-op -endif - WFLAGS+=-Waggregate-return -ifdef HAIKU -ifdef GCC41 - #WFLAGS+=-Wno-attributes -endif -endif -#WFLAGS+=-Wstrict-prototypes -ifdef GCC40 - WFLAGS+=-Wold-style-definition -endif - WFLAGS+=-Wmissing-prototypes -Wmissing-declarations -ifdef GCC40 - WFLAGS+=-Wmissing-field-initializers -endif - WFLAGS+=-Wmissing-noreturn -#WFLAGS+=-Wmissing-format-attribute -#WFLAGS+=-Wno-multichar -#WFLAGS+=-Wno-deprecated-declarations -#WFLAGS+=-Wpacked -#WFLAGS+=-Wpadded -#WFLAGS+=-Wredundant-decls - WFLAGS+=-Wnested-externs -#WFLAGS+=-Wunreachable-code - WFLAGS+=-Winline -ifdef GCC43 - WFLAGS+=-funit-at-a-time - WFLAGS+=-Wlogical-op -endif -ifndef GCC295 - WFLAGS+=-Wdisabled-optimization -endif -endif -WFLAGS+=-Wformat-y2k -ifdef GCC71 -WFLAGS+=-Wno-error=format-overflow=2 -endif -WFLAGS+=-Wformat-security -ifndef GCC29 -#WFLAGS+=-Winit-self -endif -ifdef GCC46 -WFLAGS+=-Wno-suggest-attribute=noreturn -endif - -ifdef NOLDWARNING -LDFLAGS+=-Wl,--as-needed -endif - -ifdef ERRORMODE -WFLAGS+=-Werror -endif - -WFLAGS+=$(OLDWFLAGS) - -ifdef GCC43 - #WFLAGS+=-Wno-error=clobbered -endif -ifdef GCC44 - WFLAGS+=-Wno-error=array-bounds -endif -ifdef GCC46 - WFLAGS+=-Wno-error=suggest-attribute=noreturn -endif -ifdef GCC54 - WFLAGS+=-Wno-logical-op -Wno-error=logical-op -endif -ifdef GCC61 - WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare -endif -ifdef GCC71 - WFLAGS+=-Wno-error=implicit-fallthrough - WFLAGS+=-Wno-implicit-fallthrough - WFLAGS+=-Wno-format-truncation -endif -ifdef GCC81 - WFLAGS+=-Wno-error=format-overflow - WFLAGS+=-Wno-error=stringop-truncation - WFLAGS+=-Wno-error=stringop-overflow - WFLAGS+=-Wno-format-overflow - WFLAGS+=-Wno-stringop-truncation - WFLAGS+=-Wno-stringop-overflow - WFLAGS+=-Wno-error=multistatement-macros -endif - -#indicate platform and what interface use with -ifndef LINUX -ifndef FREEBSD -ifndef CYGWIN32 -ifndef MINGW -ifndef MINGW64 -ifndef SDL -$(error No interface or platform flag defined) -endif -endif -endif -endif -endif -endif - -#determine the interface directory (where you put all i_*.c) -i_net_o=$(OBJDIR)/i_net.o -i_system_o=$(OBJDIR)/i_system.o -i_sound_o=$(OBJDIR)/i_sound.o -i_main_o=$(OBJDIR)/i_main.o -#set OBJDIR and BIN's starting place -OBJDIR=../objs -BIN=../bin -REMOVE?=rm -f -CP?=cp -MKDIR?=mkdir -p -MKISOFS?=mkisofs -DD?=dd -GZIP?=gzip -GZIP_OPTS?=-9 -f -n -GZIP_OPT2=$(GZIP_OPTS) --rsyncable -UPX?=upx -UPX_OPTS?=--best --preserve-build-id -ifndef ECHO -UPX_OPTS+=-q -endif - -#Interface Setup -ifdef LINUX - SDL=1 -ifdef LINUX64 - OBJDIR:=$(OBJDIR)/Linux64 - BIN:=$(BIN)/Linux64 -else - OBJDIR:=$(OBJDIR)/Linux - BIN:=$(BIN)/Linux -endif -else -ifdef FREEBSD - INTERFACE=sdl - SDL=1 - - OBJDIR:=$(OBJDIR)/FreeBSD - BIN:=$(BIN)/FreeBSD -else -ifdef SOLARIS - INTERFACE=sdl - SDL=1 - - OBJDIR:=$(OBJDIR)/Solaris - BIN:=$(BIN)/Solaris -else -ifdef CYGWIN32 - INTERFACE=sdl - SDL=1 - - OBJDIR:=$(OBJDIR)/cygwin - BIN:=$(BIN)/Cygwin -else -ifdef MINGW64 - INTERFACE=win32 - OBJDIR:=$(OBJDIR)/Mingw64 - BIN:=$(BIN)/Mingw64 -else -ifdef MINGW - INTERFACE=win32 - OBJDIR:=$(OBJDIR)/Mingw - BIN:=$(BIN)/Mingw -endif -endif -endif -endif -endif -endif - -ifdef ARCHNAME - OBJDIR:=$(OBJDIR)/$(ARCHNAME) - BIN:=$(BIN)/$(ARCHNAME) -endif - -OBJDUMP_OPTS?=--wide --source --line-numbers -LD=$(CC) - -ifdef SDL - INTERFACE=sdl - OBJDIR:=$(OBJDIR)/SDL -endif - -ifdef DEBUGMODE - OBJDIR:=$(OBJDIR)/Debug - BIN:=$(BIN)/Debug -else - OBJDIR:=$(OBJDIR)/Release - BIN:=$(BIN)/Release -endif diff --git a/src/f_finale.c b/src/f_finale.c index b98570b48..6d062af11 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -540,6 +540,8 @@ static const char *credits[] = { "\"Jin\"", "\"riomccloud\"", "\"chromaticpipe\"", + "\"PAS\"", + "\"$HOME\"", "\"Achii\"", "\"Anonimus\"", "\"scizor300\"", diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 11fe3fed9..f3c073b47 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -377,7 +377,7 @@ void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32 extralight = FixedMul(extralight, CLAMP(*lightlevel, 0, 255) * FRACUNIT / 255); // simple OGL approximation - fixed_t tr = R_PointToDist(spr->mobj->x, spr->mobj->y); + fixed_t tr = R_QuickCamDist(spr->mobj->x, spr->mobj->y) << FRACBITS; fixed_t xscale = FixedDiv((vid.width / 2) << FRACBITS, tr); // Less change in contrast at further distances, to counteract DOOM diminished light @@ -739,10 +739,10 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool UINT8 numplanes, j; vertex_t v; // For determining the closest distance from the line to the camera, to split render planes for minimum distortion; - const float renderdist = 27000.0f; // How far out to properly render the plane - const float farrenderdist = 32768.0f; // From here, raise plane to horizon level to fill in the line with some texture distortion + static constexpr float renderdist = 27000.0f; // How far out to properly render the plane + static constexpr float farrenderdist = 32768.0f; // From here, raise plane to horizon level to fill in the line with some texture distortion - seg_t *line = &segs[subsector->firstline]; + const seg_t *line = &segs[subsector->firstline]; for (i = 0; i < subsector->numlines; i++, line++) { @@ -779,6 +779,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool // Based on the seg length and the distance from the line, split horizon into multiple poly sets to reduce distortion dist = sqrtf((xd*xd) + (yd*yd)) / dist / 16.0f; + if (dist > 100.0f) numplanes = 100; else @@ -1083,12 +1084,12 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, else solid = false; - height = FixedToFloat(P_GetLightZAt(&list[i], v1x, v1y)); + height = FixedToFloat(P_GetLightZAt(&list[i], v1x, v1y)); endheight = FixedToFloat(P_GetLightZAt(&list[i], v2x, v2y)); if (solid) { - bheight = FixedToFloat(P_GetFFloorBottomZAt(list[i].caster, v1x, v1y)); + bheight = FixedToFloat(P_GetFFloorBottomZAt(list[i].caster, v1x, v1y)); endbheight = FixedToFloat(P_GetFFloorBottomZAt(list[i].caster, v2x, v2y)); } @@ -1096,6 +1097,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, { if (solid && top > bheight) top = bheight; + if (solid && endtop > endbheight) endtop = endbheight; } @@ -1111,15 +1113,12 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, endbheight = endrealbot; } - if (endbheight >= endtop) - continue; - - if (bheight >= top) + if ((endbheight >= endtop) || (bheight >= top)) continue; // Found a break // The heights are clamped to ensure the polygon doesn't cross itself. - bot = CLAMP(bheight, realbot, top); + bot = CLAMP(bheight, realbot, top); endbot = CLAMP(endbheight, endrealbot, endtop); Surf->PolyColor.s.alpha = alpha; @@ -1148,6 +1147,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, bot = realbot; endbot = endrealbot; + if ((endtop <= endrealbot) && (top <= realbot)) return; @@ -1388,7 +1388,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // x offset the texture fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset; - float cliplow = (float)texturehpeg; + float cliplow = (float)texturehpeg; float cliphigh = (float)(texturehpeg + (gl_curline->flength*FRACUNIT)); FUINT lightnum = gl_frontsector->lightlevel; @@ -2526,18 +2526,18 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord) if (viewx < bspcoord[BOXLEFT]) // 1,4,6 { if (viewy > bspcoord[BOXTOP]) // 1 - mindist = R_PointToDist(bspcoord[BOXLEFT], bspcoord[BOXTOP]); + mindist = R_QuickCamDist(bspcoord[BOXLEFT], bspcoord[BOXTOP]) << FRACBITS; else if (viewy < bspcoord[BOXBOTTOM]) // 6 - mindist = R_PointToDist(bspcoord[BOXLEFT], bspcoord[BOXBOTTOM]); + mindist = R_QuickCamDist(bspcoord[BOXLEFT], bspcoord[BOXBOTTOM]) << FRACBITS; else // 4 mindist = bspcoord[BOXLEFT] - viewx; } else if (viewx > bspcoord[BOXRIGHT]) // 3,5,8 { if (viewy > bspcoord[BOXTOP]) // 3 - mindist = R_PointToDist(bspcoord[BOXRIGHT], bspcoord[BOXTOP]); + mindist = R_QuickCamDist(bspcoord[BOXRIGHT], bspcoord[BOXTOP]) << FRACBITS; else if (viewy < bspcoord[BOXBOTTOM]) // 8 - mindist = R_PointToDist(bspcoord[BOXRIGHT], bspcoord[BOXBOTTOM]); + mindist = R_QuickCamDist(bspcoord[BOXRIGHT], bspcoord[BOXBOTTOM]) << FRACBITS; else // 5 mindist = viewx - bspcoord[BOXRIGHT]; } @@ -2944,7 +2944,7 @@ static void HWR_Subsector(size_t num) if (sub->validcount == validcount) continue; - sector_t *controlSec = §ors[rover->secnum]; + const sector_t *controlSec = §ors[rover->secnum]; if (!controlSec->moved) continue; @@ -3639,10 +3639,10 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite) hwrpatch = ((GLPatch_t *)gpatch->hardware); // Draw shadow BEFORE sprite - if (cv_shadow.value // Shadows enabled + if (UNLIKELY(cv_shadow.value // Shadows enabled && (spr->mobj->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow. && !(spr->mobj->flags2 & MF2_DEBRIS) // Debris have no corona or shadow. - && (spr->mobj->z >= spr->mobj->floorz)) // Without this, your shadow shows on the floor, even after you die and fall through the ground. + && (spr->mobj->z >= spr->mobj->floorz))) // Without this, your shadow shows on the floor, even after you die and fall through the ground. { //////////////////// // SHADOW SPRITE! // @@ -3753,7 +3753,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite) for (i = 1; i < sector->numlights; i++) { - fixed_t h = P_GetLightZAt(§or->lightlist[i], spr->mobj->x, spr->mobj->y); + const fixed_t h = P_GetLightZAt(§or->lightlist[i], spr->mobj->x, spr->mobj->y); if (!(h <= temp)) continue; @@ -3798,10 +3798,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite) endbheight = endrealbot; } - if (endbheight >= endtop) - continue; - - if (bheight >= top) + if ((endbheight >= endtop) || (bheight >= top)) continue; // Found a break @@ -3960,10 +3957,10 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) } // Draw shadow BEFORE sprite - if (cv_shadow.value // Shadows enabled + if (UNLIKELY(cv_shadow.value // Shadows enabled && (spr->mobj->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow. && !(spr->mobj->flags2 & MF2_DEBRIS) // Debris have no corona or shadow. - && (spr->mobj->z >= spr->mobj->floorz)) // Without this, your shadow shows on the floor, even after you die and fall through the ground. + && (spr->mobj->z >= spr->mobj->floorz))) // Without this, your shadow shows on the floor, even after you die and fall through the ground. { //////////////////// // SHADOW SPRITE! // @@ -4585,7 +4582,7 @@ static void HWR_AddPrecipitationSprites(void) drawdist = ((fixed_t)(cv_drawdist_precip.value) * (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT)); // No to infinite precipitation draw distance. - if (drawdist == 0) + if (cv_drawdist_precip.value == 0) { return; } @@ -5441,10 +5438,11 @@ namespace }; template -void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals) +void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_level, boolean allow_portals) { gl_portallist_t portallist; + const float fpov = FixedToFloat(R_GetPlayerFov(player)); const boolean skybox = (skyboxmo[0] && cv_skybox.value); portallist.base = portallist.cap = NULL; @@ -5586,8 +5584,8 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl }; extern "C" { - void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals) { - HWR_RenderViewpoint(rootportal, fpov, player, stencil_level, allow_portals); + void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_level, boolean allow_portals) { + HWR_RenderViewpoint(rootportal, player, stencil_level, allow_portals); } } @@ -5596,8 +5594,6 @@ extern "C" { // ========================================================================== static void HWR_RenderFrame(player_t *player, boolean skybox) { - const float fpov = FixedToFloat(R_GetPlayerFov(player)); - // set window position gl_viewwindowx = gl_baseviewwindowx; gl_viewwindowy = gl_baseviewwindowy; @@ -5637,9 +5633,9 @@ static void HWR_RenderFrame(player_t *player, boolean skybox) portalclipline = NULL; if (UNLIKELY(HWR_UsePortals())) - HWR_RenderViewpoint(NULL, fpov, player, 0, !skybox); + HWR_RenderViewpoint(NULL, player, 0, !skybox); else - HWR_RenderViewpoint(NULL, fpov, player, 0, !skybox); + HWR_RenderViewpoint(NULL, player, 0, !skybox); // Unset transform and shader GL_SetTransform(NULL); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 7681309c1..2ffbfd506 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -109,8 +109,8 @@ void HWR_SetViewSize(void); void HWR_AddCommands(void); void HWR_RenderPlayerView(void); -void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals); -void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals); +void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_level, boolean allow_portals); +void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_level, boolean allow_portals); void HWR_ClearSkyDome(void); void HWR_BuildSkyDome(void); diff --git a/src/hardware/hw_portal.c b/src/hardware/hw_portal.c index 939a60300..909214171 100644 --- a/src/hardware/hw_portal.c +++ b/src/hardware/hw_portal.c @@ -45,8 +45,8 @@ static gl_portal_t* HWR_Portal_Add (seg_t *seg) // Linked list. if (!currentportallist->base) { - currentportallist->base = portal; - currentportallist->cap = portal; + currentportallist->base = portal; + currentportallist->cap = portal; } else { @@ -146,7 +146,7 @@ static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state) gl_curline = portal->seg; gl_frontsector = portal->seg->frontsector; - gl_backsector = portal->seg->backsector; + gl_backsector = portal->seg->backsector; HWR_ProcessSeg(); gl_drawing_stencil = false; @@ -169,7 +169,7 @@ void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float // go to portal frame lmao HWR_PortalFrame(portal); // call HWR_RenderViewpoint - HWR_RenderPortalViewpoint(portal, fpov, player, stencil_level + 1, true); + HWR_RenderPortalViewpoint(portal, player, stencil_level + 1, true); // return to current frame if (rootportal) HWR_PortalFrame(rootportal); @@ -202,7 +202,9 @@ boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y) // so first check if the point is precisely on the line, and then if not, check the side. vertex_t closest_point; + P_ClosestPointOnLine(x, y, portalclipline, &closest_point); + if (closest_point.x != x || closest_point.y != y) { if (P_PointOnLineSide(x, y, portalclipline) != 1) diff --git a/src/k_hud.c b/src/k_hud.c index 17f8c1e8d..9ceb42860 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -89,13 +89,16 @@ consvar_t cv_highresportrait = {"highresportrait", "Off", CV_SAVE, CV_OnOff, NUL CV_PossibleValue_t inputdisplay_cons_t[NUMINPUTDISPLAYSTUFF]; consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, inputdisplay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -CV_PossibleValue_t minimapdot_cons_t[NUMMINIMAPDOTSTUFF]; -consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t minihead_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Others"}, {0, NULL}}; +consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, minihead_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showminimapnames = {"showminimapnames", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + +CV_PossibleValue_t minimapdot_cons_t[NUMMINIMAPDOTSTUFF]; consvar_t cv_showminimapangle = {"showminimapangle", "Off", CV_SAVE, minimapdot_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_posanim = {"postitionanimation", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_smallposnum = {"smallpositionnumber", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_smoothposition = {"smoothposition", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showlapemblem = {"showlapemblem", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -208,6 +211,7 @@ void K_RegisterKartHudStuff(void) CV_RegisterVar(&cv_posanim); CV_RegisterVar(&cv_smallposnum); + CV_RegisterVar(&cv_smoothposition); CV_RegisterVar(&cv_fancyroulette); @@ -1946,6 +1950,8 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI } } +#define POS_DELAY_TIME 10 + static void K_DrawKartPositionNum(INT32 num) { // POSI_X = BASEVIDWIDTH - 51; // 269 @@ -1964,7 +1970,9 @@ static void K_DrawKartPositionNum(INT32 num) if ((cv_posanim.value && stplyr->kartstuff[k_positiondelay]) || stplyr->exiting) { - scale *= 2; + const UINT8 delay = (stplyr->exiting) ? POS_DELAY_TIME : stplyr->positiondelay; + const fixed_t add = (scale * 3) >> ((r_splitscreen == 1) ? 1 : 2); + scale = cv_smoothposition.value ? scale + min((add * (delay * delay)) / (POS_DELAY_TIME * POS_DELAY_TIME), add) : scale*2; overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw. } @@ -3435,6 +3443,11 @@ static void K_drawKartPlayerCheck(void) } } +static boolean K_useSmallMinimapHead(player_t *player) +{ + return cv_minihead.value == 1 || (cv_minihead.value == 2 && !(player && P_IsDisplayPlayer(player))); +} + static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, INT32 blend, patch_t *icon, UINT8 *colormap, drawinfo_t *dims, boolean scaleme) { // amnum xpos & ypos are the icon's speed around the HUD. @@ -3504,6 +3517,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags) INT32 amxpos, amypos, wntdamxpos, wntdamypos; fixed_t scale = FRACUNIT; patch_t *minimaphead = NULL; + boolean minihead = K_useSmallMinimapHead(mo->player); #ifdef ROTSPRITE angle_t rollangle = 0; @@ -3527,11 +3541,12 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags) V_DrawCenteredSmallStringAtFixed(amxpos + (4*FRACUNIT), amypos - (3*FRACUNIT), V_ALLOWLOWERCASE|flags|V_SkinColorToHighlightcolor(mo->color), player_names[player - players]); } - // thx wanted reticle for having weird offsets very cool - wntdamxpos = cv_minihead.value ? amxpos + (1<width / 4)<height / 4)<x, mobj->y)*FRACUNIT); + const fixed_t rolldist = (cv_sloperolldist.value * mapobjectscale); + const fixed_t m_dist = (R_QuickCamDist(mobj->x, mobj->y) << FRACBITS); return (m_dist <= rolldist); } diff --git a/src/m_menu.c b/src/m_menu.c index 3120018df..f21a649f1 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2471,9 +2471,13 @@ static menuitem_t OP_HudOffsetMenu[] = {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_stat_yoffset, 185}, }; +// FIXME: WE EFFECTIVELY HAVE NO MORE SPACE FOR GREEN RES +// i had to put multiple names into single lines at this point +// we ought to really do something better for this at this point +// absolutely crazy how many people put work into this at this point <3 static menuitem_t OP_SaturnCreditsMenu[] = { - {IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 0}, + {IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 0}, {IT_STRING2+IT_SPACE, NULL, "Alug", NULL, 10}, {IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 20}, @@ -2482,20 +2486,21 @@ static menuitem_t OP_SaturnCreditsMenu[] = {IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 50}, {IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 60}, {IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 70}, + {IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 80}, + {IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 90}, + {IT_STRING2+IT_SPACE, NULL, "PAS", NULL, 100}, + {IT_STRING2+IT_SPACE, NULL, "$HOME", NULL, 110}, + {IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 120}, + {IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 130}, + {IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 140}, + {IT_STRING2+IT_SPACE, NULL, "Lugent", NULL, 150}, - {IT_STRING2+IT_SPACE, NULL, "Sunflower", NULL, 80}, - {IT_STRING2+IT_SPACE, NULL, "Yuz", NULL, 90}, - {IT_STRING2+IT_SPACE, NULL, "Democrab", NULL, 100}, - {IT_STRING2+IT_SPACE, NULL, "EXpand", NULL, 110}, - {IT_STRING2+IT_SPACE, NULL, "Nexit", NULL, 120}, - {IT_STRING2+IT_SPACE, NULL, "Spee", NULL, 130}, - {IT_STRING2+IT_SPACE, NULL, "jin", NULL, 140}, - {IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 150}, - {IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 160}, - {IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 170}, - {IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 180}, - {IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 190}, - {IT_STRING2+IT_SPACE, NULL, "Lugent", NULL, 200}, + {IT_HEADER, NULL, "", NULL, 124}, + + {IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 180}, + {IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 190}, + {IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 200}, + {IT_STRING2+IT_SPACE, NULL, "jin", NULL, 210}, {IT_HEADER, NULL, "Special Thanks <3", NULL, 168}, @@ -2507,7 +2512,7 @@ static menuitem_t OP_SaturnCreditsMenu[] = {IT_STRING, NULL, "", NULL, 258}, // dummy text II }; -// sry we dont have space for this anymore :/ +// sry we dont have space for this anymore :c /*static const char* OP_CreditTooltips[] = { NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, diff --git a/src/r_things.cpp b/src/r_things.cpp index 000139ce1..8f99384c8 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1977,7 +1977,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) vis->gy = interp.y; vis->gz = gz; vis->gzt = gzt; - vis->thingheight = 4*FRACUNIT; + vis->thingheight = 4 << FRACBITS; vis->pz = interp.z; vis->pzt = vis->pz + vis->thingheight; vis->texturemid = vis->gzt - viewz; @@ -2901,12 +2901,12 @@ void R_ClipSprites(drawseg_t* dsstart, portal_t* portal) } /* Check if thing may be drawn from our current view. */ -boolean R_ThingVisible (mobj_t *thing) +boolean R_ThingVisible(mobj_t *thing) { if (UNLIKELY((thing->sprite == SPR_NULL) || (thing->flags2 & MF2_DONTDRAW))) return false; - if (splitscreen) + if (UNLIKELY(splitscreen)) { if ((viewssnum == 0 && (thing->eflags & MFE_DRAWONLYFORP1)) || (viewssnum == 1 && (thing->eflags & MFE_DRAWONLYFORP2)) @@ -2922,7 +2922,7 @@ boolean R_ThingWithinDist(mobj_t *thing, INT32 limit_dist) { if (limit_dist) { - if (P_AproxDistance(viewx-thing->x, viewy-thing->y)/mapobjectscale > limit_dist) + if ((R_QuickCamDist(thing->x, thing->y) << FRACBITS)/mapobjectscale > limit_dist) { return false; } diff --git a/src/s_sound.c b/src/s_sound.c index 85b64d05b..03a70cf89 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1718,16 +1718,15 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms) static void S_QueueMusic(const char *mmusic, UINT16 mflags, boolean looping, UINT32 position, UINT32 fadeinms) { strncpy(queue.name, mmusic, 7); - queue.flags = mflags; - queue.looping = looping; + queue.flags = mflags; + queue.looping = looping; queue.position = position; queue.fadeinms = fadeinms; } static void S_ClearQueue(void) { - queue.name[0] = queue.flags = queue.position = queue.fadeinms = 0; - queue.looping = false; + memset(&queue, 0, sizeof(music_t)); } static void S_ChangeMusicToQueue(void) @@ -1758,7 +1757,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 || demo.title) // SRB2Kart: Demos don't interrupt title screen music return; - strncpy(newmusic, mmusic, 6); + strncpy(newmusic, mmusic, 6); strncpy(checkmusic, mmusic, 6); if (LUA_HookMusicChange(music.name, &hook_param)) @@ -2031,7 +2030,7 @@ void S_KeepMusic(void) } // Sets up the map music in case it should be reloaded -// Special case for keep music +// Special case for keepmusic void S_HandleReloadResetMusic(void) { if (!(mapmusic.flags & MUSIC_RELOADRESET)) @@ -2056,23 +2055,24 @@ void S_HandleReloadResetMusic(void) static boolean S_SkipIntroMusic(void) { - boolean skip = cv_skipintromusic.value; + if (!cv_skipintromusic.value) + return false; - if (!skip) + // check if menu music is playing, otherwise it may continue playing + if (!stricmp(music.name, "titles")) return false; char *maptitle = G_BuildMapTitle(gamemap); // Zzz... - if (maptitle) + if (maptitle && !stricmp(maptitle, "Wandering Falls")) // wandering balls changes its song when the race starts Zzz... { - // check if menu music is playing, otherwise it may continue playing - if (!stricmp(music.name, "titles") || (maptitle && (!stricmp(maptitle, "Wandering Falls")))) // wandering balls changes its song when the race starts Zzz... - skip = false; + Z_Free(maptitle); + return false; } Z_Free(maptitle); - return skip; + return true; } // diff --git a/src/screen.c b/src/screen.c index 67ef0f1dd..40e932442 100644 --- a/src/screen.c +++ b/src/screen.c @@ -349,7 +349,7 @@ double averageFPS = 0.0f; #ifdef USE_FPS_SAMPLES #define MAX_FRAME_TIME (0.05) -#define NUM_FPS_SAMPLES (16) // Number of samples to store +#define NUM_FPS_SAMPLES (32) // Number of samples to store static double total_frame_time = 0.0; static int frame_index; diff --git a/src/sounds.c b/src/sounds.c index c3d92c853..bdfc19b86 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1037,6 +1037,7 @@ sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean S_sfx[i].data = I_GetSfx(&S_sfx[i]); else S_sfx[i].data = NULL; + return i; } }