Merge branch 'Saturn-Next' into absolutehell

This commit is contained in:
Alug committed 2024-08-15 17:34:50 +02:00
commit ea1b5cd1a9
7 files changed
+69 -65

No files matched your search

+1
View File
@@ -2132,6 +2132,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
{
for (viewd = splits+1; viewd < viewnum; ++viewd)
{
displayplayers[viewd-1] = G_FindView(displayplayers[viewd-1], viewd, onlyactive, playernum < olddisplayplayer);
G_FixCamera(viewd);
}
}
+28 -26
View File
@@ -424,38 +424,40 @@ void HWR_RenderBatches(void)
if (stopFlag) break;
// change state according to change bools and next vars, update current vars and reset bools
if (changeShader)
if (changeState)
{
HWD.pfnSetShader(nextShader);
currentShader = nextShader;
changeShader = false;
if (changeShader)
{
HWD.pfnSetShader(nextShader);
currentShader = nextShader;
changeShader = false;
ps_hw_numshaders.value.i++;
}
if (changeTexture)
{
// texture should be already ready for use from calls to SetTexture during batch collection
HWD.pfnSetTexture(nextTexture);
currentTexture = nextTexture;
changeTexture = false;
ps_hw_numshaders.value.i++;
}
if (changeTexture)
{
// texture should be already ready for use from calls to SetTexture during batch collection
HWD.pfnSetTexture(nextTexture);
currentTexture = nextTexture;
changeTexture = false;
ps_hw_numtextures.value.i++;
}
if (changePolyFlags)
{
currentPolyFlags = nextPolyFlags;
changePolyFlags = false;
ps_hw_numtextures.value.i++;
}
if (changePolyFlags)
{
currentPolyFlags = nextPolyFlags;
changePolyFlags = false;
ps_hw_numpolyflags.value.i++;
}
if (changeSurfaceInfo)
{
currentSurfaceInfo = nextSurfaceInfo;
changeSurfaceInfo = false;
ps_hw_numpolyflags.value.i++;
}
if (changeSurfaceInfo)
{
currentSurfaceInfo = nextSurfaceInfo;
changeSurfaceInfo = false;
ps_hw_numcolors.value.i++;
ps_hw_numcolors.value.i++;
}
}
// and that should be it?
}
// reset the arrays (set sizes to 0)
polygonArraySize = 0;
+1 -1
View File
@@ -17,7 +17,7 @@
#include "hw_data.h"
#include "hw_drv.h"
typedef struct
typedef struct
{
FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused
unsigned int vertsIndex;// location of verts in unsortedVertexArray
-1
View File
@@ -573,7 +573,6 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!grtex->mipmap.downloaded)
HWD.pfnSetTexture(&grtex->mipmap);
HWR_SetCurrentTexture(&grtex->mipmap);
// The system-memory data can be purged now.
+26 -29
View File
@@ -667,31 +667,33 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, angle_t dir, fixed_t delta)
// Render a floor or ceiling convex polygon
void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap)
{
polyvertex_t * pv;
float height; //constant y for all points on the convex flat polygon
FOutVector *v3d;
INT32 nrPlaneVerts; //verts original define of convex flat polygon
INT32 i;
float flatxref,flatyref;
float fflatsize;
INT32 flatflag;
FSurfaceInfo Surf;
FOutVector *v3d;
polyvertex_t *pv;
pslope_t *slope = NULL;
INT32 shader = SHADER_NONE;
size_t nrPlaneVerts;
INT32 i;
float height; // constant y for all points on the convex flat polygon
float flatxref, flatyref = 0.0f;
float fflatsize = 64.0f;
INT32 flatflag = 63;
size_t len;
float tempxsow, tempytow;
float scrollx = 0.0f, scrolly = 0.0f;
angle_t angle = 0;
FSurfaceInfo Surf;
fixed_t tempxsow, tempytow;
pslope_t *slope = NULL;
static FOutVector *planeVerts = NULL;
static UINT16 numAllocedPlaneVerts = 0;
INT32 shader = SHADER_NONE;
// no convex poly were generated for this subsector
if (!xsub->planepoly)
return;
pv = xsub->planepoly->pts;
pv = xsub->planepoly->pts;
nrPlaneVerts = xsub->planepoly->numpts;
if (nrPlaneVerts < 3) //not even a triangle ?
@@ -800,12 +802,6 @@ void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isc
{
angle = InvAngle(angle)>>ANGLETOFINESHIFT;
// This needs to be done so that it scrolls in a different direction after rotation like software
/*tempxsow = FLOAT_TO_FIXED(scrollx);
tempytow = FLOAT_TO_FIXED(scrolly);
scrollx = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
scrolly = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));*/
// This needs to be done so everything aligns after rotation
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
tempxsow = FLOAT_TO_FIXED(flatxref);
@@ -838,7 +834,7 @@ void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isc
vert->y = FIXED_TO_FLOAT(fixedheight);\
}\
}
for (i = 0, v3d = planeVerts; i < nrPlaneVerts; i++,v3d++,pv++)
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++)
SETUP3DVERT(v3d, pv->x, pv->y);
if (slope)
@@ -949,7 +945,7 @@ void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isc
vx = (horizonpts[3].x - gr_viewx) * farrenderdist / renderdist + gr_viewx;
vy = (horizonpts[3].z - gr_viewy) * farrenderdist / renderdist + gr_viewy;
SETUP3DVERT((&horizonpts[4]), vx, vy);
horizonpts[4].y = gr_viewz;
horizonpts[4].y = gr_viewz;
// Draw
HWR_ProcessPolygon(&Surf, horizonpts, 6, PolyFlags, shader, true);
@@ -1325,7 +1321,7 @@ static void HWR_DrawSkyWallList(void)
// Draw walls into the depth buffer so that anything behind is culled properly
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf)
{
//HWD.pfnSetTexture(NULL);
//HWR_SetCurrentTexture(NULL);
// no texture
wallVerts[3].t = wallVerts[2].t = 0;
wallVerts[0].t = wallVerts[1].t = 0;
@@ -1569,7 +1565,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
HWR_DrawSkyWall(wallVerts, &Surf);
}
// Sky Floors
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN);
@@ -5553,16 +5548,14 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, playe
HWD.pfnSetTransform(&atransform);
validcount++;
if (cv_grbatching.value)
HWR_StartBatching();
HWR_AddPrecipitationSprites();
ps_numbspcalls.value.i = 0;
ps_numpolyobjects.value.i = 0;
PS_START_TIMING(ps_bsptime);
if (cv_grbatching.value)
HWR_StartBatching();
if (!rootportal && portallist.base && !skybox)// if portals have been drawn in the main view, then render skywalls differently
gr_collect_skywalls = true;
@@ -5572,11 +5565,15 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, playe
if (gr_portal != GRPORTAL_OFF) // if we already haven't hit the recursion limit or we already ended our portal shenanigans
gr_portal = GRPORTAL_INSIDE; // TURN IT OFF
// Recursively "render" the BSP tree.
HWR_RenderBSPNode((INT32)numnodes-1);
// woo we back
gr_portal = oldgl_portal_state;
HWR_AddPrecipitationSprites();
PS_STOP_TIMING(ps_bsptime);
if (cv_grbatching.value)
+12 -7
View File
@@ -37,19 +37,19 @@ struct directorinfo
INT32 boredom[MAXPLAYERS]; // how long has a given position had no credible attackers?
} directorinfo;
static boolean race_rules(void)
static inline boolean race_rules(void)
{
return gametype = GT_RACE;
return gametype == GT_RACE;
}
static fixed_t P_ScaleFromMap(fixed_t n, fixed_t scale)
static fixed_t ScaleFromMap(fixed_t n, fixed_t scale)
{
return FixedMul(n, FixedDiv(scale, mapobjectscale));
}
static boolean K_DirectorIsEnabled(void)
{
return cv_director.value && (gamestate == GS_LEVEL && (!playeringame[consoleplayer] || players[consoleplayer].spectator || demo.playback));
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (!playeringame[consoleplayer] || players[consoleplayer].spectator || demo.playback));
}
void K_InitDirector(void)
@@ -90,7 +90,7 @@ static fixed_t K_GetDistanceToFinish(player_t player)
break;
}
}
else
else // crappy optimization weeeee
{
for (mo = waypointcap; mo != NULL; mo = mo->tracer)
{
@@ -155,7 +155,7 @@ static void K_UpdateDirectorPositions(void)
continue;
}
directorinfo.gap[position] = P_ScaleFromMap(K_GetFinishGap(directorinfo.sortedplayers[position], directorinfo.sortedplayers[position + 1]), FRACUNIT);
directorinfo.gap[position] = ScaleFromMap(K_GetFinishGap(directorinfo.sortedplayers[position], directorinfo.sortedplayers[position + 1]), FRACUNIT);
if (directorinfo.gap[position] >= BREAKAWAYDIST)
{
@@ -173,7 +173,7 @@ static void K_UpdateDirectorPositions(void)
return;
}
directorinfo.maxdist = P_ScaleFromMap(K_GetDistanceToFinish(players[directorinfo.sortedplayers[0]]), FRACUNIT);
directorinfo.maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfo.sortedplayers[0]]), FRACUNIT);
}
static boolean K_CanSwitchDirector(void)
@@ -188,6 +188,11 @@ static boolean K_CanSwitchDirector(void)
static void K_DirectorSwitch(INT32 player, boolean force)
{
if (!K_DirectorIsEnabled())
{
return;
}
if (P_IsDisplayPlayer(&players[player]))
{
return;
+1 -1
View File
@@ -662,7 +662,7 @@ static void ST_overlayDrawer(void)
// Countdown timer for Race Mode
// ...moved to k_kart.c so we can take advantage of the LAPS_Y value
if (demo.playback || !P_IsLocalPlayer(stplyr))
if ((demo.playback || !P_IsLocalPlayer(stplyr)) && !splitscreen)
{
char directortext[20] = {0};