Merge branch 'Saturn-Next' into Saturn-Testing

This commit is contained in:
Alug committed 2025-07-01 15:27:39 +02:00
commit 0241d7fe00
6 files changed
+37 -62

No files matched your search

+3
View File
@@ -16,6 +16,9 @@ $(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\
$(and $(findstring =,$(v)),\
$(eval $(call _predecessor,$(subst =, ,$(v))))))
# aggregate returns seem to happen alot in c++ so just supress em lel
CXXFLAGS+= -Wno-aggregate-return
# -W -Wno-unused
WFLAGS:=-Wall -Wno-trigraphs
+6 -18
View File
@@ -3530,13 +3530,9 @@ static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts
// uncapped/interpolation
interpmobjstate_t interp = {};
float basey, lowy;
INT32 dist = -1;
if (cv_maxinterpdist.value)
dist = std_R_QuickCamDist(spr->mobj->x, spr->mobj->y);
// do interpolation
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && R_CheckInterpDist(spr->mobj))
{
if (precip)
{
@@ -3899,7 +3895,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
return;
const boolean papersprite = (spr->mobj->frame & FF_PAPERSPRITE);
sector_t *sector = spr->mobj->subsector->sector;
const sector_t *sector = spr->mobj->subsector->sector;
if (sector->numlights)
{
@@ -3984,13 +3980,13 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
// colormap test
INT32 lightlevel = 255;
boolean lightset = HWR_OverrideObjectLightLevel(spr->mobj, &lightlevel);
const boolean lightset = HWR_OverrideObjectLightLevel(spr->mobj, &lightlevel);
extracolormap_t *colormap = sector->extra_colormap;
const boolean fullbright = R_ThingIsFullBright(spr->mobj);
if (!lightset)
{
lightlevel = std::min(static_cast<int>(sector->lightlevel), 255);
lightlevel = std::min(static_cast<INT32>(sector->lightlevel), 255);
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false);
}
@@ -4647,7 +4643,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
angle_t camang = 0;
#endif
INT32 heightsec, phs;
INT32 dist = -1;
fixed_t spr_width, spr_height;
fixed_t spr_offset, spr_topoffset;
@@ -4664,10 +4659,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
// uncapped/interpolation
interpmobjstate_t interp = {};
if (cv_maxinterpdist.value)
dist = std_R_QuickCamDist(thing->x, thing->y);
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && R_CheckInterpDist(thing))
{
R_InterpolateMobjState(thing, rendertimefrac, &interp);
}
@@ -5008,7 +5000,6 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
size_t lumpoff;
unsigned rot = 0;
UINT8 flip;
INT32 dist = -1;
if (!thing)
return;
@@ -5022,11 +5013,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
// uncapped/interpolation
interpmobjstate_t interp = {};
if (cv_maxinterpdist.value)
dist = std_R_QuickCamDist(thing->x, thing->y);
// do interpolation
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && R_CheckInterpDist((mobj_t*)thing))
{
R_InterpolatePrecipMobjState(thing, rendertimefrac, &interp);
}
+1 -1
View File
@@ -1187,7 +1187,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
spriteinfo_t *sprinfo;
interpmobjstate_t interp;
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_maxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && R_CheckInterpDist(spr->mobj))
{
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
}
+3 -13
View File
@@ -740,12 +740,9 @@ void R_DrawPlanes(void)
}
}
#ifdef HAVE_THREADS
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Waggregate-return"
tp_sema = srb2::g_main_threadpool->end_sema();
srb2::g_main_threadpool->notify_sema(tp_sema);
srb2::g_main_threadpool->wait_sema(tp_sema);
#pragma GCC diagnostic pop
#endif
}
@@ -771,12 +768,9 @@ void R_DrawSkyPlanes(void)
}
}
#ifdef HAVE_THREADS
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Waggregate-return"
tp_sema = srb2::g_main_threadpool->end_sema();
srb2::g_main_threadpool->notify_sema(tp_sema);
srb2::g_main_threadpool->wait_sema(tp_sema);
#pragma GCC diagnostic pop
#endif
}
@@ -1102,6 +1096,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
// and mercilessly shoved into saturn by chearii 02-02-2025
{
INT32 trans = (10*((256+12) - pl->ffloor->alpha))/255;
if (trans >= 10)
return; // Don't even draw it
@@ -1138,13 +1133,8 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
spanfunctype = SPANDRAWFUNC_WATER;
// Copy the current scene, ugh
top = pl->high-8;
bottom = pl->low+8;
if (top < 0)
top = 0;
if (bottom > vid.height)
bottom = vid.height;
top = std::max(0, pl->high - 8);
bottom = std::min(viewheight, pl->low + 8);
// Only copy the part of the screen we need
UINT8 i = R_GetViewNumber();
+18 -30
View File
@@ -1164,8 +1164,6 @@ fixed_t R_GetSpriteDirectionalLighting(angle_t angle)
return extralight;
}
#define std_R_QuickCamDist(x, y) std::max(abs(((x)>>FRACBITS) - (viewx>>FRACBITS)), abs(((y)>>FRACBITS) - (viewy>>FRACBITS)))
//
// R_ProjectSprite
// Generates a vissprite for a thing
@@ -1206,7 +1204,6 @@ static void R_ProjectSprite(mobj_t *thing)
//SoM: 3/17/2000
fixed_t gz, gzt;
INT32 heightsec, phs;
INT32 dist = -1;
INT32 light = 0;
lighttable_t **lights_array = spritelights;
fixed_t this_scale;
@@ -1233,14 +1230,11 @@ static void R_ProjectSprite(mobj_t *thing)
const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
if (cv_maxinterpdist.value)
dist = std_R_QuickCamDist(thing->x, thing->y);
// uncapped/interpolation
interpmobjstate_t interp = {};
// do interpolation
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && R_CheckInterpDist(oldthing))
{
R_InterpolateMobjState(oldthing, rendertimefrac, &interp);
}
@@ -1862,25 +1856,20 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
fixed_t gz, gzt;
fixed_t this_scale;
INT32 dist = 1;
if (!thing || thing->subsector == NULL)
return;
if (cv_maxinterpdist.value)
dist = std_R_QuickCamDist(thing->x, thing->y);
// uncapped/interpolation
interpmobjstate_t interp = {};
// okay... this is a hack, but weather isn't networked, so it should be ok
if (!P_PrecipThinker(thing))
{
return;
}
// uncapped/interpolation
interpmobjstate_t interp = {};
// do interpolation
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && R_CheckInterpDist((mobj_t*)thing))
{
R_InterpolatePrecipMobjState(thing, rendertimefrac, &interp);
}
@@ -2919,7 +2908,7 @@ boolean R_ThingVisible (mobj_t *thing)
if (splitscreen)
{
if ((viewssnum == 0 && (thing->eflags & MFE_DRAWONLYFORP1))
if ((viewssnum == 0 && (thing->eflags & MFE_DRAWONLYFORP1))
|| (viewssnum == 1 && (thing->eflags & MFE_DRAWONLYFORP2))
|| (viewssnum == 2 && (thing->eflags & MFE_DRAWONLYFORP2))
|| (viewssnum == 3 && (thing->eflags & MFE_DRAWONLYFORP4)))
@@ -2942,6 +2931,16 @@ boolean R_ThingWithinDist(mobj_t *thing, INT32 limit_dist)
return true;
}
boolean R_CheckInterpDist(mobj_t *thing)
{
if (!cv_maxinterpdist.value)
return true;
const INT32 dist = R_QuickCamDist(thing->x, thing->y);
return (dist < cv_maxinterpdist.value);
}
boolean R_ThingIsFullBright(mobj_t *thing)
{
return ((thing->frame & FF_BRIGHTMASK) == FF_FULLBRIGHT);
@@ -2971,19 +2970,8 @@ static void R_DrawMaskedList(drawnode_t* head)
{
drawspandata_t ds = {};
next = r2->prev;
#ifdef HAVE_THREADS
srb2::ThreadPool::Sema tp_sema;
srb2::g_main_threadpool->begin_sema();
#endif
R_DrawSinglePlane(&ds, r2->plane, cv_parallelsoftware.value);
#ifdef HAVE_THREADS
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Waggregate-return"
tp_sema = srb2::g_main_threadpool->end_sema();
srb2::g_main_threadpool->notify_sema(tp_sema);
srb2::g_main_threadpool->wait_sema(tp_sema);
#pragma GCC diagnostic pop
#endif
// Force disable multithreading since it is usually slower because of waiting for each plane to render
R_DrawSinglePlane(&ds, r2->plane, false);
R_DoneWithNode(r2);
r2 = next;
}
+6
View File
@@ -39,7 +39,12 @@ extern "C" {
// as an non-fixed-point integer.
// It is very rough, tho it is used only for optimizing out unnecessary
// interpolation, so it is kinda ok on big distances.
#ifdef __cplusplus
#define R_QuickCamDist(x, y) std::max(std::abs(((x)>>FRACBITS) - (viewx>>FRACBITS)), std::abs(((y)>>FRACBITS) - (viewy>>FRACBITS)))
#else
#define R_QuickCamDist(x, y) max(abs(((x)>>FRACBITS) - (viewx>>FRACBITS)), abs(((y)>>FRACBITS) - (viewy>>FRACBITS)))
#endif
// Constant arrays used for psprite clipping
// and initializing clipping.
@@ -84,6 +89,7 @@ void R_DrawMasked(maskcount_t* masks, INT32 nummasks);
boolean R_ThingVisible(mobj_t *thing);
boolean R_ThingWithinDist(mobj_t *thing, INT32 limit_dist);
boolean R_CheckInterpDist(mobj_t *thing);
boolean R_ThingIsFullBright(mobj_t *thing);
boolean R_ThingIsSemiBright(mobj_t *thing);