Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff
This commit is contained in:
commit
a5de51b039
16 files changed
+322
-484
No files matched your search
@@ -484,6 +484,10 @@ consvar_t cv_showping = {"showping", "Always", CV_SAVE, showping_cons_t, NULL, 0
|
||||
static CV_PossibleValue_t pingmeasurement_cons_t[] = {{0, "Frames"}, {1, "Milliseconds"}, {0, NULL}};
|
||||
consvar_t cv_pingmeasurement = {"pingmeasurement", "Frames", CV_SAVE, pingmeasurement_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_pingicon = {"pingicon", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t cv_pingstyle_cons_t[] = {{0, "New"}, {1, "Old"}, {0, NULL}};
|
||||
consvar_t cv_pingstyle = {"pingstyle", "New", CV_SAVE, cv_pingstyle_cons_t, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_luaimmersion = {"luaimmersion", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -795,6 +799,7 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_showping);
|
||||
CV_RegisterVar(&cv_pingmeasurement);
|
||||
CV_RegisterVar(&cv_pingicon);
|
||||
CV_RegisterVar(&cv_pingstyle);
|
||||
|
||||
#ifdef SEENAMES
|
||||
CV_RegisterVar(&cv_allowseenames);
|
||||
|
||||
@@ -156,6 +156,7 @@ extern consvar_t cv_pingtimeout;
|
||||
extern consvar_t cv_showping;
|
||||
extern consvar_t cv_pingmeasurement;
|
||||
extern consvar_t cv_pingicon;
|
||||
extern consvar_t cv_pingstyle;
|
||||
|
||||
//extern consvar_t cv_smallpos;
|
||||
extern consvar_t cv_showminimapnames;
|
||||
|
||||
@@ -241,7 +241,7 @@ typedef struct FSurfaceInfo FSurfaceInfo;
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
HWD_SET_SHADERS,
|
||||
HWD_SET_PALETTE_SHADER_ENABLED,
|
||||
HWD_PAL_SHADER,
|
||||
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
HWD_SET_TEXTUREANISOTROPICMODE,
|
||||
|
||||
@@ -85,6 +85,7 @@ EXPORT boolean HWRAPI(InitCustomShaders) (void);
|
||||
EXPORT void HWRAPI(StartBatching) (void);
|
||||
EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, int *sNumPolys, int *sNumVerts, int *sNumCalls, int *sNumShaders, int *sNumTextures, int *sNumPolyFlags, int *sNumColors);
|
||||
|
||||
EXPORT void HWRAPI(InitPalette) (int flashnum, boolean skiplut);
|
||||
EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable);
|
||||
EXPORT void HWRAPI(ClearLightTableCache) (void);
|
||||
|
||||
@@ -140,6 +141,7 @@ struct hwdriver_s
|
||||
StartBatching pfnStartBatching;
|
||||
RenderBatches pfnRenderBatches;
|
||||
|
||||
InitPalette pfnInitPalette;
|
||||
AddLightTable pfnAddLightTable;
|
||||
ClearLightTableCache pfnClearLightTableCache;
|
||||
};
|
||||
|
||||
+143
-368
@@ -183,9 +183,9 @@ static void CV_grshaders_OnChange(void)
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
InitPalette(0, false);
|
||||
}
|
||||
HWR_InitPalette(0, false);
|
||||
|
||||
HWD.pfnSetSpecialState(HWD_PAL_SHADER, HWR_ShouldUsePaletteRendering());
|
||||
|
||||
V_SetPalette(0);
|
||||
}
|
||||
@@ -197,6 +197,9 @@ static void CV_useCustomShaders_ONChange(void)
|
||||
{
|
||||
if (HWR_UseShader())
|
||||
HWD.pfnInitCustomShaders();
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
HWR_InitPalette(0, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +210,11 @@ static void CV_Gammaxxx_ONChange(void)
|
||||
V_SetPalette(0);
|
||||
}
|
||||
|
||||
void HWR_InitPalette(int flashnum, boolean skiplut)
|
||||
{
|
||||
HWD.pfnInitPalette(flashnum, skiplut);
|
||||
}
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// Globals
|
||||
@@ -273,20 +281,24 @@ static fixed_t dup_viewx, dup_viewy, dup_viewz;
|
||||
static angle_t gr_aimingangle;
|
||||
static float gr_viewludsin, gr_viewludcos;
|
||||
|
||||
//
|
||||
// PORTALS
|
||||
//
|
||||
// ==========================================================================
|
||||
// Visual portals (attr. Hannu Hanhi)
|
||||
// ==========================================================================
|
||||
|
||||
#define MAX_GRPORTALS 13
|
||||
// Note: portal sorting has not been ported to this
|
||||
//#define PORTALSORTING // Breaks recursive portals :[
|
||||
|
||||
|
||||
// for porting gonna add stuff from r_portal here with adjustments
|
||||
|
||||
typedef struct portal_s
|
||||
enum
|
||||
{
|
||||
struct portal_s *next;
|
||||
GRPORTAL_OFF,
|
||||
GRPORTAL_SEARCH,
|
||||
GRPORTAL_STENCIL,
|
||||
GRPORTAL_DEPTH,
|
||||
GRPORTAL_INSIDE,
|
||||
};
|
||||
|
||||
static int gr_portal = GRPORTAL_OFF;
|
||||
static boolean gl_drawing_stencil = false;
|
||||
typedef struct gl_portal_s
|
||||
{
|
||||
struct gl_portal_s *next;
|
||||
|
||||
// Viewport.
|
||||
fixed_t viewx;
|
||||
@@ -300,36 +312,38 @@ typedef struct portal_s
|
||||
INT32 drawcount; /**< For OpenGL. */
|
||||
|
||||
seg_t *seg;
|
||||
} portal_t;
|
||||
} gl_portal_t;
|
||||
|
||||
typedef struct portallist_s
|
||||
typedef struct gl_portallist_s
|
||||
{
|
||||
portal_t *base;
|
||||
portal_t *cap;
|
||||
} portallist_t;
|
||||
gl_portal_t *base;
|
||||
gl_portal_t *cap;
|
||||
} gl_portallist_t;
|
||||
|
||||
// new thing
|
||||
portallist_t *currentportallist;
|
||||
gl_portallist_t *currentportallist;
|
||||
|
||||
INT32 portalviewside;
|
||||
|
||||
// Linked list for portals.
|
||||
portal_t *portal_base_gl, *portal_cap_gl;
|
||||
gl_portal_t *portal_base_gl, *portal_cap_gl;
|
||||
|
||||
/* For now, these aren't used.
|
||||
// maybe at some point these could be organized better
|
||||
void HWR_Portal_InitList (void)
|
||||
static void HWR_Portal_InitList (void)
|
||||
{
|
||||
portalrender = 0;
|
||||
portal_base_gl = portal_cap_gl = NULL;
|
||||
}
|
||||
|
||||
void HWR_Portal_Remove (portal_t* portal)
|
||||
static void HWR_Portal_Remove(gl_portal_t* portal)
|
||||
{
|
||||
portal_base_gl = portal->next;
|
||||
Z_Free(portal);
|
||||
}
|
||||
*/
|
||||
|
||||
void HWR_Portal_Add2Lines (const INT32 line1, const INT32 line2, seg_t *seg)
|
||||
static void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg)
|
||||
{
|
||||
line_t *start, *dest;
|
||||
|
||||
@@ -340,17 +354,9 @@ void HWR_Portal_Add2Lines (const INT32 line1, const INT32 line2, seg_t *seg)
|
||||
|
||||
vertex_t dest_c, start_c;
|
||||
|
||||
portal_t *portal;
|
||||
gl_portal_t *portal;
|
||||
|
||||
// check for duplicate
|
||||
/*if (currentportallist->base && currentportallist->cap->startline == line1 && currentportallist->cap->clipline == line2)
|
||||
{
|
||||
if (printportals)
|
||||
CONS_Printf("Duplicate portal skipped\n");
|
||||
return;
|
||||
}*/
|
||||
|
||||
portal = Z_Malloc(sizeof(portal_t), PU_STATIC, NULL);
|
||||
portal = Z_Malloc(sizeof(gl_portal_t), PU_STATIC, NULL);
|
||||
|
||||
// Linked list.
|
||||
if (!currentportallist->base)
|
||||
@@ -404,7 +410,7 @@ void HWR_Portal_Add2Lines (const INT32 line1, const INT32 line2, seg_t *seg)
|
||||
portal->clipline = line2;
|
||||
}
|
||||
|
||||
void HWR_PortalFrame(portal_t* portal)
|
||||
static void HWR_PortalFrame(gl_portal_t* portal)
|
||||
{
|
||||
viewx = portal->viewx;
|
||||
viewy = portal->viewy;
|
||||
@@ -429,42 +435,6 @@ void HWR_PortalFrame(portal_t* portal)
|
||||
}
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
GRPORTAL_OFF,
|
||||
GRPORTAL_SEARCH,
|
||||
GRPORTAL_STENCIL,
|
||||
GRPORTAL_DEPTH,
|
||||
GRPORTAL_INSIDE,
|
||||
};
|
||||
|
||||
void HWR_RenderSinglePortal(portal_t *portal, size_t portalnum, float fpov, player_t *player);
|
||||
|
||||
#ifdef PORTALSORTING
|
||||
static portal_t gr_portals[MAX_GRPORTALS];
|
||||
static size_t gr_numportals = 0;
|
||||
|
||||
static void HWR_AddPortal(portal_t *portal);
|
||||
static void HWR_SortPortals(player_t *player, float fpov, INT32 viewnumber, postimg_t *ptype);
|
||||
#endif
|
||||
|
||||
static int gr_portal = GRPORTAL_OFF;
|
||||
static boolean gl_drawing_stencil = false;
|
||||
|
||||
// Culling
|
||||
typedef struct
|
||||
{
|
||||
seg_t *seg;
|
||||
sector_t *frontsector;
|
||||
sector_t *backsector;
|
||||
} gr_portalcullinfo_t;
|
||||
|
||||
static gr_portalcullinfo_t gr_portalsegs[MAX_GRPORTALS];
|
||||
static size_t gr_numportalsegs = 0;
|
||||
|
||||
static sector_t *gr_portalcullsectors[MAX_GRPORTALS];
|
||||
static size_t gr_numportalcullsectors = 0;
|
||||
|
||||
// ==========================================================================
|
||||
// Lighting
|
||||
// ==========================================================================
|
||||
@@ -566,7 +536,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
|
||||
}
|
||||
}
|
||||
|
||||
void HWR_ClearLightTableCache()
|
||||
void HWR_ClearLightTableCache(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWD.pfnClearLightTableCache();
|
||||
@@ -1427,12 +1397,12 @@ int skyWallVertexArrayAllocSize = 65536;// what a mouthful
|
||||
|
||||
boolean gr_collect_skywalls = false;
|
||||
|
||||
void HWR_SkyWallList_Clear()
|
||||
static void HWR_SkyWallList_Clear(void)
|
||||
{
|
||||
skyWallVertexArraySize = 0;
|
||||
}
|
||||
|
||||
void HWR_SkyWallList_Add(FOutVector *wallVerts)
|
||||
static void HWR_SkyWallList_Add(FOutVector *wallVerts)
|
||||
{
|
||||
if (!skyWallVertexArray)
|
||||
{
|
||||
@@ -1451,7 +1421,7 @@ void HWR_SkyWallList_Add(FOutVector *wallVerts)
|
||||
skyWallVertexArraySize++;
|
||||
}
|
||||
|
||||
void HWR_DrawSkyWallList()
|
||||
static void HWR_DrawSkyWallList(void)
|
||||
{
|
||||
int i;
|
||||
FSurfaceInfo surf;
|
||||
@@ -1491,68 +1461,6 @@ void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf)
|
||||
// PF_Occlude is set in HWR_ProjectWall to draw into the depth buffer
|
||||
}
|
||||
|
||||
// HWR_DrawPortalClipWall
|
||||
// Draws an invisible wall that extends to nowhere,
|
||||
// so that portals can be clipped correctly.
|
||||
static void HWR_DrawPortalClipWall(line_t *line)
|
||||
{
|
||||
FOutVector wallVerts[4];
|
||||
FSurfaceInfo Surf;
|
||||
v2d_t vs, ve;
|
||||
fixed_t length = 1000*FRACUNIT;
|
||||
fixed_t temp = 0;
|
||||
|
||||
angle_t angle = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y);
|
||||
angle_t lineangle = 0;
|
||||
|
||||
// no texture
|
||||
HWD.pfnSetTexture(NULL);
|
||||
wallVerts[3].t = wallVerts[2].t = 0;
|
||||
wallVerts[0].t = wallVerts[1].t = 0;
|
||||
wallVerts[0].s = wallVerts[3].s = 0;
|
||||
wallVerts[2].s = wallVerts[1].s = 0;
|
||||
|
||||
//wallVerts[0].w = wallVerts[1].w = wallVerts[2].w = wallVerts[3].w = 1.0f; whatever this is i guess it cant be here
|
||||
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN);
|
||||
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX);
|
||||
|
||||
// first
|
||||
vs.x = FIXED_TO_FLOAT(line->v1->x);
|
||||
vs.y = FIXED_TO_FLOAT(line->v1->y);
|
||||
|
||||
angle -= ANGLE_180;
|
||||
lineangle = (angle >> ANGLETOFINESHIFT);
|
||||
temp = FixedMul(length, FINECOSINE(lineangle));
|
||||
ve.x = vs.x + FIXED_TO_FLOAT(temp);
|
||||
temp = FixedMul(length, FINESINE(lineangle));
|
||||
ve.y = vs.y + FIXED_TO_FLOAT(temp);
|
||||
|
||||
wallVerts[0].x = wallVerts[3].x = ve.x;
|
||||
wallVerts[0].z = wallVerts[3].z = ve.y;
|
||||
wallVerts[2].x = wallVerts[1].x = vs.x;
|
||||
wallVerts[2].z = wallVerts[1].z = vs.y;
|
||||
|
||||
HWR_ProjectWall(wallVerts, &Surf, PF_NoTexture, 255, NULL);
|
||||
|
||||
// second
|
||||
vs.x = FIXED_TO_FLOAT(line->v2->x);
|
||||
vs.y = FIXED_TO_FLOAT(line->v2->y);
|
||||
|
||||
angle += ANGLE_180;
|
||||
lineangle = (angle >> ANGLETOFINESHIFT);
|
||||
temp = FixedMul(length, FINECOSINE(lineangle));
|
||||
ve.x = vs.x + FIXED_TO_FLOAT(temp);
|
||||
temp = FixedMul(length, FINESINE(lineangle));
|
||||
ve.y = vs.y + FIXED_TO_FLOAT(temp);
|
||||
|
||||
wallVerts[0].x = wallVerts[3].x = ve.x;
|
||||
wallVerts[0].z = wallVerts[3].z = ve.y;
|
||||
wallVerts[2].x = wallVerts[1].x = vs.x;
|
||||
wallVerts[2].z = wallVerts[1].z = vs.y;
|
||||
|
||||
HWR_ProjectWall(wallVerts, &Surf, PF_NoTexture, 255, NULL);
|
||||
}
|
||||
|
||||
//
|
||||
// HWR_ProcessSeg
|
||||
// A portion or all of a wall segment will be drawn, from startfrac to endfrac,
|
||||
@@ -2414,7 +2322,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
{
|
||||
ffloor_t * rover;
|
||||
fixed_t highcut = 0, lowcut = 0;
|
||||
fixed_t lowcutslope, highcutslope;
|
||||
fixed_t lowcutslope = 0, highcutslope = 0;
|
||||
|
||||
// Used for height comparisons and etc across FOFs and slopes
|
||||
fixed_t high1, highslope1, low1, lowslope1;
|
||||
@@ -2879,15 +2787,7 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
|
||||
viewc1 = backc1;
|
||||
viewc2 = backc2;
|
||||
}
|
||||
/*
|
||||
// dont clip viewsector when rendering portal contents
|
||||
if (portalclipline)
|
||||
{
|
||||
if (printportals)
|
||||
CONS_Printf("Clipping skipped on portal viewsector\n");
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
// check if camera is outside the bounds of the floor and the ceiling (noclipping)
|
||||
// either above the ceiling or below the floor
|
||||
if ((viewz > viewc1 && viewz > viewc2) || (viewz < viewf1 && viewz < viewf2))
|
||||
@@ -3002,20 +2902,7 @@ void HWR_AddLine(seg_t *line)
|
||||
{
|
||||
vertex_t closest_point;
|
||||
boolean pass = false;
|
||||
/*
|
||||
if (P_PointOnLineSide(line->v1->x, line->v1->y, portalclipline) != portalviewside)
|
||||
{
|
||||
P_ClosestPointOnLine(line->v1->x, line->v1->y, portalclipline, &closest_point);
|
||||
if (closest_point.x != line->v1->x || closest_point.y != line->v1->y)
|
||||
pass = true;
|
||||
}
|
||||
if (!pass && P_PointOnLineSide(line->v2->x, line->v2->y, portalclipline) != portalviewside)
|
||||
{
|
||||
P_ClosestPointOnLine(line->v2->x, line->v2->y, portalclipline, &closest_point);
|
||||
if (closest_point.x != line->v2->x || closest_point.y != line->v2->y)
|
||||
pass = true;
|
||||
}
|
||||
*/
|
||||
|
||||
// similar idea than in PortalCheckBBox, but checking the line vertices instead
|
||||
// TODO could make the check more efficient and not check anything if pass==true from earlier or something
|
||||
P_ClosestPointOnLine(line->v1->x, line->v1->y, portalclipline, &closest_point);
|
||||
@@ -3029,19 +2916,7 @@ void HWR_AddLine(seg_t *line)
|
||||
{
|
||||
if (P_PointOnLineSide(line->v2->x, line->v2->y, portalclipline) != portalviewside)
|
||||
pass = true;
|
||||
}/*
|
||||
P_ClosestPointOnLine(v1x, v1y, portalclipline, &closest_point);
|
||||
if (closest_point.x != v1x || closest_point.y != v1y)
|
||||
{
|
||||
if (P_PointOnLineSide(v1x, v1y, portalclipline) != portalviewside)
|
||||
pass = true;
|
||||
}
|
||||
P_ClosestPointOnLine(v2x, v2y, portalclipline, &closest_point);
|
||||
if (closest_point.x != v2x || closest_point.y != v2y)
|
||||
{
|
||||
if (P_PointOnLineSide(v2x, v2y, portalclipline) != portalviewside)
|
||||
pass = true;
|
||||
}*/
|
||||
if (!pass)
|
||||
return;
|
||||
}
|
||||
@@ -3064,83 +2939,6 @@ void HWR_AddLine(seg_t *line)
|
||||
|
||||
gr_backsector = line->backsector;
|
||||
|
||||
// Portal line
|
||||
/*
|
||||
if (cv_grportals.value && line->linedef->special == 40 && line->side == 0)
|
||||
{
|
||||
if (portalrender < cv_maxportals.value)
|
||||
{
|
||||
// Find the other side!
|
||||
INT32 line2 = P_FindSpecialLineFromTag(40, line->linedef->tag, -1);
|
||||
if (line->linedef == &lines[line2])
|
||||
line2 = P_FindSpecialLineFromTag(40, line->linedef->tag, line2);
|
||||
if (line2 >= 0) // found it!
|
||||
{
|
||||
// oh no :DD
|
||||
if (gr_portal == GRPORTAL_PROCESS)
|
||||
{
|
||||
gr_portal = GRPORTAL_FOUND;
|
||||
return;
|
||||
}
|
||||
|
||||
// Portal processing
|
||||
if ((gr_portal == GRPORTAL_MASKING) || (gr_portal == GRPORTAL_INSIDE))
|
||||
{
|
||||
// masking the view 1
|
||||
if (gr_portal == GRPORTAL_MASKING)
|
||||
{
|
||||
size_t numportal = gr_numportalsegs;
|
||||
if (numportal < MAX_GRPORTALS)
|
||||
{
|
||||
gr_portalsegs[numportal].seg = line;
|
||||
gr_portalsegs[numportal].frontsector = gr_frontsector;
|
||||
gr_portalsegs[numportal].backsector = gr_backsector;
|
||||
gr_numportalsegs++;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the portal
|
||||
HWR_Portal_Add2Lines(line->linedef-lines, line2);
|
||||
|
||||
// masking the view 2
|
||||
if (gr_portal == GRPORTAL_MASKING)
|
||||
{
|
||||
// portal_cap_gl = last added portal
|
||||
portal_t *lastportal = portal_cap_gl;
|
||||
lastportal->drawcount = drawcount++;
|
||||
|
||||
// extend clipping
|
||||
HWR_DrawPortalClipWall(line->linedef);
|
||||
|
||||
// add cull sector
|
||||
if (gr_numportalcullsectors < MAX_GRPORTALS)
|
||||
{
|
||||
sector_t *cullsec = NULL;
|
||||
if (lastportal->clipline != -1)
|
||||
{
|
||||
line_t *grclipline = &lines[lastportal->clipline];
|
||||
cullsec = grclipline->frontsector;
|
||||
}
|
||||
gr_portalcullsectors[gr_numportalcullsectors] = cullsec;
|
||||
gr_numportalcullsectors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gld_clipper_SafeAddClipRange(angle2, angle1);
|
||||
|
||||
if (gr_portal != GRPORTAL_OUTSIDE)
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Recursed TOO FAR (viewing a portal within a portal)
|
||||
// So uhhh, render it as a normal wall instead or something ???
|
||||
}
|
||||
#ifndef PORTALSORTING
|
||||
else if (gr_portal == GRPORTAL_MASKING)
|
||||
return;
|
||||
#endif
|
||||
*/
|
||||
if (line->linedef->special == 40)
|
||||
{
|
||||
if (line->side == 0)
|
||||
@@ -3947,7 +3745,7 @@ skip_stuff_for_portals:
|
||||
// use returned value as multiplier for the added values from p_thrust thing
|
||||
// P_InterceptVector needs divlines which need dx and dy, dx=x2-x1 dy=y2-y1
|
||||
|
||||
boolean HWR_PortalCheckBBox(fixed_t *bspcoord)
|
||||
static boolean HWR_PortalCheckBBox(fixed_t *bspcoord)
|
||||
{
|
||||
vertex_t closest_point;
|
||||
if (!portalclipline)
|
||||
@@ -4020,10 +3818,6 @@ void HWR_RenderBSPNode(INT32 bspnum)
|
||||
return;
|
||||
}
|
||||
|
||||
// in portal checking phase we can stop after one is found
|
||||
//if (gr_portal == GRPORTAL_FOUND)
|
||||
// return;
|
||||
|
||||
// Decide which side the view point is on.
|
||||
side = R_PointOnSide(viewx, viewy, bsp);
|
||||
|
||||
@@ -4031,10 +3825,6 @@ void HWR_RenderBSPNode(INT32 bspnum)
|
||||
if (HWR_PortalCheckBBox(bsp->bbox[side]))
|
||||
HWR_RenderBSPNode(bsp->children[side]);
|
||||
|
||||
// in portal checking phase we can stop after one is found
|
||||
//if (gr_portal == GRPORTAL_FOUND)
|
||||
// return;
|
||||
|
||||
// Possibly divide back space.
|
||||
if (HWR_CheckBBox(bsp->bbox[side^1]) && HWR_PortalCheckBBox(bsp->bbox[side^1]))
|
||||
HWR_RenderBSPNode(bsp->children[side^1]);
|
||||
@@ -4331,7 +4121,7 @@ static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused)
|
||||
{
|
||||
if (spr->precip)
|
||||
if (precip)
|
||||
{
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
@@ -4342,7 +4132,7 @@ static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts
|
||||
}
|
||||
else
|
||||
{
|
||||
if (spr->precip)
|
||||
if (precip)
|
||||
{
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
@@ -5518,7 +5308,6 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
angle_t ang;
|
||||
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||
INT32 heightsec, phs;
|
||||
vector3_t pos;
|
||||
|
||||
fixed_t spr_width, spr_height;
|
||||
fixed_t spr_offset, spr_topoffset;
|
||||
@@ -6142,7 +5931,7 @@ void HWR_ClearClipper(void)
|
||||
}
|
||||
|
||||
// Adds an entry to the clipper for portal rendering
|
||||
void HWR_PortalClipping(portal_t *portal)
|
||||
static void HWR_PortalClipping(gl_portal_t *portal)
|
||||
{
|
||||
angle_t angle1, angle2;
|
||||
|
||||
@@ -6155,14 +5944,84 @@ void HWR_PortalClipping(portal_t *portal)
|
||||
gld_clipper_SafeAddClipRange(angle2, angle1);
|
||||
}
|
||||
|
||||
//
|
||||
// Render portals recursively depth first. With portals disabled only current scene is rendered.
|
||||
//
|
||||
void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals)
|
||||
enum
|
||||
{
|
||||
portallist_t portallist;
|
||||
portal_t *portal;
|
||||
portal_t *portal_temp;
|
||||
HWR_STENCIL_NORMAL,
|
||||
HWR_STENCIL_BEGIN,
|
||||
HWR_STENCIL_REVERSE,
|
||||
HWR_STENCIL_DEPTH,
|
||||
HWR_STENCIL_SKY
|
||||
};
|
||||
|
||||
// Changes the current stencil state.
|
||||
static void HWR_SetStencilState(int state, int level)
|
||||
{
|
||||
if (!cv_nostencil.value && level > -1)
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, state);
|
||||
}
|
||||
|
||||
// Renders a portal segment.
|
||||
static void HWR_RenderPortalSeg(gl_portal_t* portal, int state)
|
||||
{
|
||||
gl_drawing_stencil = true; // do not draw outside of the stencil buffer, idiot.
|
||||
// set our portal state and prepare to render the seg
|
||||
gr_portal = state;
|
||||
gr_curline = portal->seg;
|
||||
gr_frontsector = portal->seg->frontsector;
|
||||
gr_backsector = portal->seg->backsector;
|
||||
HWR_ProcessSeg();
|
||||
gl_drawing_stencil = false;
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
|
||||
// Renders the current viewpoint, though takes portal arguments for recursive portals.
|
||||
static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals);
|
||||
|
||||
// Renders a single portal from the current viewpoint.
|
||||
static void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level)
|
||||
{
|
||||
// draw portal seg to stencil buffer with increment
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_BEGIN, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GRPORTAL_STENCIL);
|
||||
|
||||
// go to portal frame lmao
|
||||
HWR_PortalFrame(portal);
|
||||
// call HWR_RenderViewpoint
|
||||
HWR_RenderViewpoint(portal, fpov, player, stencil_level + 1, true);
|
||||
// return to current frame
|
||||
if (rootportal)
|
||||
HWR_PortalFrame(rootportal);
|
||||
else // current frame is not a portal frame but the main view!
|
||||
{
|
||||
R_SetupFrame(player, false);
|
||||
portalclipline = NULL;
|
||||
}
|
||||
|
||||
// remove portal seg from stencil buffer
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_REVERSE, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GRPORTAL_STENCIL);
|
||||
|
||||
// draw portal seg to depth buffer
|
||||
HWR_ClearClipper();
|
||||
HWR_SetStencilState(HWR_STENCIL_DEPTH, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GRPORTAL_DEPTH);
|
||||
}
|
||||
|
||||
// Renders the current viewpoint, though takes portal arguments for recursive portals.
|
||||
static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals)
|
||||
{
|
||||
gl_portallist_t portallist;
|
||||
gl_portal_t *portal;
|
||||
gl_portal_t *gl_portal_temp;
|
||||
portallist.base = portallist.cap = NULL;
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
|
||||
@@ -6186,75 +6045,14 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
{
|
||||
if (cv_portalline.value && cv_portalline.value != portal->startline)
|
||||
continue;
|
||||
if (!cv_nostencil.value)
|
||||
{
|
||||
// draw portal seg to stencil buffer with increment
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_ClearClipper();
|
||||
gl_drawing_stencil = true;
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, stencil_level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_STENCIL_SEGS);
|
||||
gr_portal = GRPORTAL_STENCIL;
|
||||
gr_frontsector = portal->seg->frontsector;
|
||||
validcount++;
|
||||
HWR_AddLine(portal->seg);
|
||||
gl_drawing_stencil = false;
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
// go to portal frame
|
||||
HWR_PortalFrame(portal);
|
||||
// call RecursivePortalRendering
|
||||
RecursivePortalRendering(portal, fpov, player, stencil_level + 1, true);
|
||||
// return to current frame
|
||||
if (rootportal)
|
||||
HWR_PortalFrame(rootportal);
|
||||
else// current frame is not a portal frame but the main view!
|
||||
{
|
||||
R_SetupFrame(player, false);
|
||||
portalclipline = NULL;
|
||||
}
|
||||
if (!cv_nostencil.value)
|
||||
{
|
||||
// remove portal seg from stencil buffer
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_ClearClipper();
|
||||
gl_drawing_stencil = true;
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, stencil_level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_STENCIL_REVERSE_SEGS);
|
||||
gr_portal = GRPORTAL_STENCIL;
|
||||
gr_frontsector = portal->seg->frontsector;
|
||||
validcount++;
|
||||
HWR_AddLine(portal->seg);
|
||||
gl_drawing_stencil = false;
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
// draw portal seg to depth buffer
|
||||
HWR_ClearClipper();
|
||||
gl_drawing_stencil = true;
|
||||
if (!cv_nostencil.value)
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, stencil_level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_DEPTH_SEGS);
|
||||
gr_portal = GRPORTAL_DEPTH;
|
||||
gr_frontsector = portal->seg->frontsector;
|
||||
validcount++;
|
||||
HWR_AddLine(portal->seg);
|
||||
gl_drawing_stencil = false;
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
HWR_RenderPortal(portal, rootportal, fpov, player, stencil_level);
|
||||
}
|
||||
gr_portal = GRPORTAL_INSIDE;// when portal walls are encountered in following bsp traversal, nothing should be drawn
|
||||
}
|
||||
else
|
||||
gr_portal = GRPORTAL_OFF;// there may be portals and they need to be drawn as regural walls
|
||||
// draw normal things in current frame in current incremented stencil buffer area
|
||||
if (!cv_nostencil.value)
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, stencil_level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_NORMAL);
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
|
||||
if (!cv_portalonly.value || rootportal)
|
||||
{
|
||||
HWR_ClearClipper();
|
||||
@@ -6282,14 +6080,14 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
|
||||
// HAYA: Save the old portal state, and turn portals off while normally rendering the BSP tree.
|
||||
// This fixes specific effects not working, such as horizon lines.
|
||||
int oldportal_state = gr_portal;
|
||||
int oldgl_portal_state = gr_portal;
|
||||
|
||||
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 = oldportal_state;
|
||||
gr_portal = oldgl_portal_state;
|
||||
|
||||
PS_STOP_TIMING(ps_bsptime);
|
||||
|
||||
@@ -6302,15 +6100,13 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
}
|
||||
if (skyWallVertexArraySize)// if there are skywalls to draw using the alternate method
|
||||
{
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_SKY_STENCIL_SEGS);
|
||||
HWR_SetStencilState(HWR_STENCIL_SKY, -1);
|
||||
HWR_DrawSkyWallList();
|
||||
HWR_SkyWallList_Clear();
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, 1);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_NORMAL);
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 1);
|
||||
drewsky = false;
|
||||
HWR_DrawSkyBackground(fpov);
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, 0);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_NORMAL);
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
|
||||
HWD.pfnClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
HWR_SetTransform(fpov, player);// restore transform
|
||||
}
|
||||
@@ -6330,12 +6126,12 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
HWR_RenderDrawNodes();
|
||||
}
|
||||
// free memory from portal list allocated by calls to Add2Lines
|
||||
portal_temp = portallist.base;
|
||||
while (portal_temp)
|
||||
gl_portal_temp = portallist.base;
|
||||
while (gl_portal_temp)
|
||||
{
|
||||
portal_t *nextportal = portal_temp->next;
|
||||
Z_Free(portal_temp);
|
||||
portal_temp = nextportal;
|
||||
gl_portal_t *nextportal = gl_portal_temp->next;
|
||||
Z_Free(gl_portal_temp);
|
||||
gl_portal_temp = nextportal;
|
||||
}
|
||||
|
||||
// TODO: batching at some point
|
||||
@@ -6348,7 +6144,6 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
// ==========================================================================
|
||||
void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
{
|
||||
angle_t a1;
|
||||
const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd);
|
||||
postimg_t *postprocessor = &postimgtype[0];
|
||||
INT32 i;
|
||||
@@ -6466,7 +6261,7 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
validcount++;
|
||||
|
||||
portalclipline = NULL;
|
||||
RecursivePortalRendering(NULL, fpov, player, 0, !skybox);
|
||||
HWR_RenderViewpoint(NULL, fpov, player, 0, !skybox);
|
||||
HWR_SetTransform(fpov, player);// not sure if needed
|
||||
|
||||
// Unset transform and shader
|
||||
@@ -6485,26 +6280,6 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
}
|
||||
|
||||
void HWR_RenderSinglePortal(portal_t *portal, size_t portalnum, float fpov, player_t *player)
|
||||
{
|
||||
portalrender = portal->pass; // Recursiveness depth.
|
||||
|
||||
// Apply the viewpoint stored for the portal.
|
||||
HWR_PortalFrame(portal);
|
||||
HWR_ClearClipper();
|
||||
HWR_ClearSprites();
|
||||
HWR_SetTransform(fpov, player);
|
||||
validcount++;
|
||||
|
||||
// Render the BSP from the new viewpoint.
|
||||
portalcullsector = gr_portalcullsectors[portalnum];
|
||||
HWR_RenderBSPNode((INT32)numnodes - 1);
|
||||
|
||||
HWR_SortVisSprites();
|
||||
HWR_DrawSprites();
|
||||
HWR_RenderDrawNodes();
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// Render the player view.
|
||||
// ==========================================================================
|
||||
|
||||
@@ -114,6 +114,7 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
|
||||
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void HWR_MakeScreenFinalTexture(void);
|
||||
void HWR_DrawScreenFinalTexture(int width, int height);
|
||||
void HWR_InitPalette(int flashnum, boolean skiplut);
|
||||
|
||||
// hw_main.c: Planes
|
||||
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);
|
||||
|
||||
@@ -633,6 +633,7 @@ static boolean gl_batching = false;// are we currently collecting batches?
|
||||
|
||||
static GLint gl_palette[768];
|
||||
boolean gl_palette_initialized = false;
|
||||
static boolean gl_palshader = false;
|
||||
|
||||
static INT32 gl_enable_screen_textures = 1;
|
||||
|
||||
@@ -1276,11 +1277,6 @@ EXPORT boolean HWRAPI(InitCustomShaders) (void)
|
||||
#ifdef GL_SHADERS
|
||||
KillShaders();
|
||||
return LoadShaders();
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
InitPalette(0, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1330,7 +1326,7 @@ GLuint palette_tex_num;
|
||||
// the +2 in the NearestColor call also needs to be adjusted if LUT_SIZE is changed!
|
||||
// the hardcoded values in the shader also need to be adjusted if LUT_SIZE is changed!
|
||||
|
||||
void InitPalette(int flashnum, boolean skiplut)
|
||||
EXPORT void HWRAPI(InitPalette) (int flashnum, boolean skiplut)
|
||||
{
|
||||
int i, r, g, b;
|
||||
|
||||
@@ -1837,7 +1833,7 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
||||
pglEnableClientState(GL_VERTEX_ARRAY); // We always use this one
|
||||
pglEnableClientState(GL_TEXTURE_COORD_ARRAY); // And mostly this one, too
|
||||
|
||||
if ((!gl_palette_initialized) && (HWR_ShouldUsePaletteRendering()))
|
||||
if ((!gl_palette_initialized) && (gl_palshader))
|
||||
InitPalette(0, false); // just gonna put this here for now
|
||||
}
|
||||
|
||||
@@ -2437,7 +2433,7 @@ static int comparePolygons(const void *p1, const void *p2)
|
||||
diff = poly1->texNum - poly2->texNum;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (gl_palshader)
|
||||
{
|
||||
diff = poly1->surf.LightTableId - poly2->surf.LightTableId;
|
||||
if (diff != 0) return diff;
|
||||
@@ -2580,7 +2576,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
if (gl_allowshaders)
|
||||
{
|
||||
Shader_Load(¤tSurfaceInfo, &firstPoly, &firstTint, &firstFade);
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (gl_palshader)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now
|
||||
pglBindTexture(GL_TEXTURE_2D, currentSurfaceInfo.LightTableId);
|
||||
@@ -2697,7 +2693,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
changeState = true;
|
||||
changePolyFlags = true;
|
||||
}
|
||||
if ((gl_allowshaders) && (HWR_ShouldUsePaletteRendering()))
|
||||
if (gl_allowshaders && gl_palshader)
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
|
||||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
||||
@@ -2711,7 +2707,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
changeSurfaceInfo = true;
|
||||
}
|
||||
}
|
||||
else if ((gl_allowshaders) && (!HWR_ShouldUsePaletteRendering()))
|
||||
else if ((gl_allowshaders) && (!gl_palshader))
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
|
||||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
||||
@@ -2842,7 +2838,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
|
||||
Shader_Load(&nextSurfaceInfo, &poly, &tint, &fade);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (gl_palshader)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now
|
||||
pglBindTexture(GL_TEXTURE_2D, nextSurfaceInfo.LightTableId);
|
||||
@@ -2953,7 +2949,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
|
||||
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
|
||||
}
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering() && gl_allowshaders)
|
||||
if (gl_palshader && gl_allowshaders)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);
|
||||
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
|
||||
@@ -3301,6 +3297,10 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case HWD_PAL_SHADER:
|
||||
gl_palshader = Value;
|
||||
break;
|
||||
|
||||
case HWD_SET_TEXTUREFILTERMODE:
|
||||
switch (Value)
|
||||
@@ -4476,7 +4476,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
|
||||
ClearBuffer(true, false, false, &clearColour);
|
||||
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (gl_palshader)
|
||||
{
|
||||
Shader_SetUniforms(NULL, NULL, NULL, NULL); // prepare shader, if it is enabled
|
||||
|
||||
@@ -4492,7 +4492,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
|
||||
|
||||
tex_downloaded = finalScreenTexture;
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (gl_palshader)
|
||||
{
|
||||
pglUseProgram(0);
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
|
||||
@@ -135,6 +135,5 @@ typedef enum
|
||||
|
||||
// in order for custom playpals n shit to work properly
|
||||
extern boolean gl_palette_initialized;
|
||||
void InitPalette(int flashnum, boolean skiplut);
|
||||
|
||||
#endif
|
||||
+81
-43
@@ -2579,54 +2579,92 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags)
|
||||
UINT8 *colormap = NULL;
|
||||
INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
|
||||
INT32 gfxnum; // gfx to draw
|
||||
|
||||
//SRB2/Kart v1.0 style
|
||||
UINT8 numbars = 0; // how many ping bars do we draw?
|
||||
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
|
||||
SINT8 i = 0;
|
||||
SINT8 yoffset = 6;
|
||||
INT32 dx;
|
||||
|
||||
gfxnum = Ping_gfx_num(lag);
|
||||
|
||||
if (measureid == 1)
|
||||
|
||||
if (!cv_pingstyle.value)
|
||||
{
|
||||
if (cv_ticrate.value == 2){
|
||||
V_DrawScaledPatch(x+12 - pingmeasure[measureid]->width, y+22, flags, pingmeasure[measureid]);
|
||||
}else{
|
||||
if (measureid == 1)
|
||||
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (cv_pingicon.value)
|
||||
{
|
||||
if (cv_ticrate.value == 2){
|
||||
V_DrawScaledPatch(x+2, y+13, flags, pinggfx[gfxnum]);
|
||||
}else{
|
||||
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (servermaxping && lag > servermaxping && hu_tick < 4)
|
||||
{
|
||||
// flash ping red if too high
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
|
||||
}
|
||||
|
||||
if (cv_pingmeasurement.value)
|
||||
{
|
||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||
}
|
||||
|
||||
if (cv_ticrate.value == 2){
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+22, flags, lag, colormap);
|
||||
}else{
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, lag, colormap);
|
||||
}
|
||||
|
||||
if (measureid == 0){
|
||||
if (cv_ticrate.value == 2){
|
||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+22, flags, pingmeasure[measureid]);
|
||||
}else{
|
||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_pingicon.value)
|
||||
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
|
||||
|
||||
if (servermaxping && lag > servermaxping && hu_tick < 4)
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE); // flash ping red if too high
|
||||
|
||||
if (cv_pingmeasurement.value)
|
||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, lag, colormap);
|
||||
|
||||
if (measureid == 0)
|
||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
}
|
||||
else if (cv_pingstyle.value) // old style ping
|
||||
{
|
||||
if (cv_pingicon.value)
|
||||
{
|
||||
if (lag < 4)
|
||||
{
|
||||
numbars = 3;
|
||||
barcolor = 184;
|
||||
}
|
||||
else if (lag < 7)
|
||||
{
|
||||
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
|
||||
barcolor = 103;
|
||||
}
|
||||
else if (lag < 10)
|
||||
{
|
||||
numbars = 1;
|
||||
barcolor = 155; // need a better red
|
||||
}
|
||||
else // brazil
|
||||
{
|
||||
numbars = 0;
|
||||
barcolor = 31;
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_pingmeasurement.value)
|
||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||
|
||||
if (vid.width >= 640) // how sad, we're using a shit resolution.
|
||||
{
|
||||
if (measureid == 1)
|
||||
{
|
||||
//dx = x+1 - (V_SmallStringWidth(va("%dms", lag), V_ALLOWLOWERCASE|flags)/2);
|
||||
//V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE|flags, va("%dms", lag));
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, V_ALLOWLOWERCASE|flags, va("%dms", lag));
|
||||
}
|
||||
else if (measureid == 0)
|
||||
{
|
||||
//dx = x+1 - (V_SmallStringWidth(va("d%d", lag), flags)/2);
|
||||
//V_DrawSmallString(dx, y+4, flags, va("d%d", lag));
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, flags, va("d%d", lag));
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_pingicon.value)
|
||||
{
|
||||
for (i=0; (i<3); i++) // Draw the ping bar
|
||||
{
|
||||
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-4, 2, 8-yoffset, 31|flags);
|
||||
if (i < numbars)
|
||||
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-3, 1, 8-yoffset-1, barcolor|flags);
|
||||
|
||||
yoffset -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+15
-13
@@ -1392,7 +1392,7 @@ static const char* OP_VideoTooltips[] =
|
||||
"How far away weather is drawn.",
|
||||
"Toggle being able to see the sky.",
|
||||
"Player field of view.",
|
||||
"Show current game framerate.",
|
||||
"Show current game framerate and select the style.",
|
||||
"Sync game framerate to refresh rate of monitor.",
|
||||
"Set manual framerate cap.",
|
||||
"Size of drift spark pulse.",
|
||||
@@ -1762,23 +1762,24 @@ static menuitem_t OP_HUDOptionsMenu[] =
|
||||
static menuitem_t OP_ChatOptionsMenu[] =
|
||||
{
|
||||
// will ANYONE who doesn't know how to use the console want to touch this one?
|
||||
{IT_STRING | IT_CVAR, NULL, "Chat Mode", &cv_consolechat, 10}, // nonetheless...
|
||||
{IT_STRING | IT_CVAR, NULL, "Chat Mode", &cv_consolechat, 5}, // nonetheless...
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
|
||||
NULL, "Chat Box Width", &cv_chatwidth, 25},
|
||||
NULL, "Chat Box Width", &cv_chatwidth, 20},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
|
||||
NULL, "Chat Box Height", &cv_chatheight, 35},
|
||||
NULL, "Chat Box Height", &cv_chatheight, 30},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Chat Background Tint", &cv_chatbacktint, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Max Chat Messages", &cv_chatlogsize, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Chat Background Tint", &cv_chatbacktint, 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Max Chat Messages", &cv_chatlogsize, 75},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 100}, // shows ping next to framerate if we want to.
|
||||
{IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 110},
|
||||
{IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 120},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Show IP addresses in playerlist", &cv_shownodeip, 140},
|
||||
{IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 95}, // shows ping above the framerate if we want to.
|
||||
{IT_STRING | IT_CVAR, NULL, "Ping display style", &cv_pingstyle, 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 115},
|
||||
{IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 125},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Show IP address in playerlist", &cv_shownodeip, 135},
|
||||
};
|
||||
|
||||
static const char* OP_ChatOptionsTooltips[] =
|
||||
@@ -1791,6 +1792,7 @@ static const char* OP_ChatOptionsTooltips[] =
|
||||
"Spam protection for in-game chat.",
|
||||
"Maxiumum amount of chat messages to look back at.",
|
||||
"Show player ping.",
|
||||
"Choose the looks of the ping display.", // this is ass idk english lmao
|
||||
"Measurement used for ping.",
|
||||
"Visibility of ping icon.",
|
||||
"Should Player IP addresses be printed when using\nthe nodes or listplayers command?",
|
||||
|
||||
@@ -1323,19 +1323,6 @@ static UINT32 queue_fadeinms;
|
||||
musicdef_t *musicdefstart = NULL; // First music definition
|
||||
struct cursongcredit cursongcredit; // Currently displayed song credit info
|
||||
|
||||
musicdef_t soundtestsfx = {
|
||||
"_STSFX", // prevents exactly one valid track name from being used on the sound test
|
||||
"Sound Effects",
|
||||
"",
|
||||
"SEGA, Sonic Team Jr, other sources",
|
||||
1, // show on soundtest page 1
|
||||
0, // with no conditions
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
NULL
|
||||
};
|
||||
|
||||
//
|
||||
// search for music definition in wad
|
||||
//
|
||||
|
||||
@@ -172,7 +172,6 @@ typedef struct musicdef_s
|
||||
struct musicdef_s *next;
|
||||
} musicdef_t;
|
||||
|
||||
extern musicdef_t soundtestsfx;
|
||||
extern musicdef_t *musicdefstart;
|
||||
extern musicdef_t **soundtestdefs;
|
||||
extern INT32 numsoundtestdefs;
|
||||
|
||||
+51
-26
@@ -429,41 +429,65 @@ void SCR_DisplayTicRate(void)
|
||||
INT32 x = 318;
|
||||
double fps = round(averageFPS);
|
||||
INT32 fpsflags = SCR_FPSflags();
|
||||
const char *fps_string;
|
||||
|
||||
INT32 ticcntcolor2 = 0;
|
||||
|
||||
if (gamestate == GS_NULL)
|
||||
return;
|
||||
|
||||
// draw "FPS"
|
||||
if (cv_ticrate.value == 1)
|
||||
V_DrawFixedPatch(306<<FRACBITS, 183<<FRACBITS, FRACUNIT, fpsflags, framecounter, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE));
|
||||
|
||||
if (fps > (benchmark - 5))
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MINT, GTC_CACHE);
|
||||
else if (fps < 20)
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
|
||||
|
||||
if (cap != 0)
|
||||
// new kart counter
|
||||
if ((cv_ticrate.value == 1) || (cv_ticrate.value == 2))
|
||||
{
|
||||
UINT32 digits = 1;
|
||||
UINT32 c2 = cap;
|
||||
// draw "FPS"
|
||||
if (cv_ticrate.value == 1)
|
||||
V_DrawFixedPatch(306<<FRACBITS, 183<<FRACBITS, FRACUNIT, fpsflags, framecounter, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE));
|
||||
|
||||
if (fps > (benchmark - 5))
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MINT, GTC_CACHE);
|
||||
else if (fps < 20)
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
|
||||
|
||||
while (c2 > 0)
|
||||
if (cap != 0)
|
||||
{
|
||||
c2 = c2 / 10;
|
||||
digits++;
|
||||
UINT32 digits = 1;
|
||||
UINT32 c2 = cap;
|
||||
|
||||
while (c2 > 0)
|
||||
{
|
||||
c2 = c2 / 10;
|
||||
digits++;
|
||||
}
|
||||
|
||||
// draw total frame:
|
||||
V_DrawPingNum(x, 190, fpsflags, cap, ticcntcolor);
|
||||
|
||||
x -= digits * 4;
|
||||
|
||||
// draw "/"
|
||||
V_DrawFixedPatch(x<<FRACBITS, 190<<FRACBITS, FRACUNIT, fpsflags, frameslash, ticcntcolor);
|
||||
}
|
||||
|
||||
// draw total frame:
|
||||
V_DrawPingNum(x, 190, fpsflags, cap, ticcntcolor);
|
||||
|
||||
x -= digits * 4;
|
||||
|
||||
// draw "/"
|
||||
V_DrawFixedPatch(x<<FRACBITS, 190<<FRACBITS, FRACUNIT, fpsflags, frameslash, ticcntcolor);
|
||||
// draw our actual framerate
|
||||
V_DrawPingNum(x, 190, fpsflags, fps, ticcntcolor);
|
||||
}
|
||||
else if ((cv_ticrate.value == 3)||(cv_ticrate.value == 4)) // kart v1.0/srb2 counter
|
||||
{
|
||||
if (fps > (benchmark - 5))
|
||||
ticcntcolor2 = V_GREENMAP;
|
||||
else if (fps < 20)
|
||||
ticcntcolor2 = V_REDMAP;
|
||||
|
||||
// draw our actual framerate
|
||||
V_DrawPingNum(x, 190, fpsflags, fps, ticcntcolor);
|
||||
if (cap != 0)
|
||||
fps_string = va("%d/%d\x82", (INT32)fps, cap);
|
||||
else
|
||||
fps_string = va("%d\x82", (INT32)fps);
|
||||
|
||||
if (cv_ticrate.value == 3)
|
||||
V_DrawRightAlignedString(319, 181, V_YELLOWMAP|fpsflags, "FPS");
|
||||
|
||||
V_DrawRightAlignedString(319, 190, ticcntcolor2|fpsflags, fps_string);
|
||||
}
|
||||
}
|
||||
|
||||
// SCR_DisplayLocalPing
|
||||
@@ -476,7 +500,8 @@ void SCR_DisplayLocalPing(void)
|
||||
|
||||
if (cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping)) // only show 2 (warning) if our ping is at a bad level
|
||||
{
|
||||
INT32 dispy = cv_ticrate.value ? 160 : 181;
|
||||
HU_drawPing(307, dispy, ping, fpsflags);
|
||||
INT32 dispy = (cv_ticrate.value == 1) ? 165 : ((cv_ticrate.value == 2 || cv_ticrate.value == 4) ? 172 : ((cv_ticrate.value == 3) ? 163 : 181)); // absolute buttpain
|
||||
|
||||
HU_drawPing(308, dispy, ping, fpsflags);
|
||||
}
|
||||
}
|
||||
@@ -119,6 +119,7 @@ void *hwSym(const char *funcName,void *handle)
|
||||
GETFUNC(StartBatching);
|
||||
GETFUNC(RenderBatches);
|
||||
|
||||
GETFUNC(InitPalette);
|
||||
GETFUNC(AddLightTable);
|
||||
GETFUNC(ClearLightTableCache);
|
||||
|
||||
|
||||
@@ -2152,6 +2152,7 @@ void I_StartupGraphics(void)
|
||||
HWD.pfnStartBatching = hwSym("StartBatching",NULL);
|
||||
HWD.pfnRenderBatches = hwSym("RenderBatches",NULL);
|
||||
|
||||
HWD.pfnInitPalette = hwSym("InitPalette",NULL);
|
||||
HWD.pfnAddLightTable = hwSym("AddLightTable",NULL);
|
||||
HWD.pfnClearLightTableCache = hwSym("ClearLightTableCache",NULL);
|
||||
|
||||
|
||||
+5
-3
@@ -20,6 +20,8 @@
|
||||
#include "r_draw.h"
|
||||
#include "console.h"
|
||||
|
||||
#include "r_fps.h" //vhs effect stuff
|
||||
|
||||
#include "i_video.h" // rendermode
|
||||
#include "z_zone.h"
|
||||
#include "m_misc.h"
|
||||
@@ -42,7 +44,7 @@ UINT8 *screens[5];
|
||||
static CV_PossibleValue_t gamma_cons_t[] = {{0, "MIN"}, {4, "MAX"}, {0, NULL}};
|
||||
static void CV_usegamma_OnChange(void);
|
||||
|
||||
static CV_PossibleValue_t fps_cons_t[] = {{0, "No"}, {1, "Normal"}, {2, "Compact"}, {0, NULL}};
|
||||
static CV_PossibleValue_t fps_cons_t[] = {{0, "No"}, {1, "Normal"}, {2, "Compact"}, {3, "Old"}, {4, "Old Compact"}, {0, NULL}};
|
||||
consvar_t cv_ticrate = {"showfps", "No", CV_SAVE, fps_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_usegamma = {"gamma", "0", CV_SAVE|CV_CALL, gamma_cons_t, CV_usegamma_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -207,7 +209,7 @@ void V_SetPalette(INT32 palettenum)
|
||||
{
|
||||
// reset our palette lookups n shit
|
||||
gl_palette_initialized = false;
|
||||
InitPalette(palettenum, true);
|
||||
HWR_InitPalette(palettenum, true);
|
||||
}
|
||||
else
|
||||
HWR_SetPalette(&pLocalPalette[palettenum*256]);
|
||||
@@ -229,7 +231,7 @@ void V_SetPaletteLump(const char *pal)
|
||||
{
|
||||
// reset our palette lookups n shit
|
||||
gl_palette_initialized = false;
|
||||
InitPalette(0, false);
|
||||
HWR_InitPalette(0, false);
|
||||
}
|
||||
|
||||
HWR_SetPalette(pLocalPalette);
|
||||
|
||||
Reference in new issue
Block a user