mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'debugrender-portal' into 'master'
Add debugrender_portal command See merge request KartKrew/Kart!1133
This commit is contained in:
commit
e1e7db4c49
3 changed files with 31 additions and 2 deletions
|
|
@ -33,6 +33,7 @@ consvar_t cv_debugrender_contrast =
|
|||
CVAR_INIT("debugrender_contrast", "0.0", CV_CHEAT | CV_FLOAT, contrast_cons_t, nullptr);
|
||||
|
||||
consvar_t cv_debugrender_spriteclip = CVAR_INIT("debugrender_spriteclip", "Off", CV_CHEAT, CV_OnOff, nullptr);
|
||||
consvar_t cv_debugrender_portal = CVAR_INIT("debugrender_portal", "Off", CV_CHEAT, CV_OnOff, nullptr);
|
||||
|
||||
UINT32 debugrender_highlight;
|
||||
|
||||
|
|
|
|||
29
src/r_main.c
29
src/r_main.c
|
|
@ -1567,7 +1567,7 @@ void R_RenderPlayerView(void)
|
|||
|
||||
// Portal rendering. Hijacks the BSP traversal.
|
||||
ps_sw_portaltime = I_GetPreciseTime();
|
||||
if (portal_base)
|
||||
if (portal_base && !cv_debugrender_portal.value)
|
||||
{
|
||||
portal_t *portal;
|
||||
|
||||
|
|
@ -1622,6 +1622,32 @@ void R_RenderPlayerView(void)
|
|||
R_DrawMasked(masks, nummasks);
|
||||
ps_sw_maskedtime = I_GetPreciseTime() - ps_sw_maskedtime;
|
||||
|
||||
// debugrender_portal: fill portals with red, draw over everything
|
||||
if (portal_base && cv_debugrender_portal.value)
|
||||
{
|
||||
const UINT8 pal = 0x23; // red
|
||||
portal_t *portal;
|
||||
|
||||
for(portal = portal_base; portal; portal = portal_base)
|
||||
{
|
||||
INT32 width = (portal->end - portal->start);
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < width; ++i)
|
||||
{
|
||||
INT32 yl = max(portal->ceilingclip[i] + 1, 0);
|
||||
INT32 yh = min(portal->floorclip[i], viewheight);
|
||||
|
||||
for (; yl < yh; ++yl)
|
||||
{
|
||||
screens[0][portal->start + i + (yl * vid.width)] = pal;
|
||||
}
|
||||
}
|
||||
|
||||
Portal_Remove(portal);
|
||||
}
|
||||
}
|
||||
|
||||
free(masks);
|
||||
}
|
||||
|
||||
|
|
@ -1685,6 +1711,7 @@ void R_RegisterEngineStuff(void)
|
|||
|
||||
CV_RegisterVar(&cv_debugrender_contrast);
|
||||
CV_RegisterVar(&cv_debugrender_spriteclip);
|
||||
CV_RegisterVar(&cv_debugrender_portal);
|
||||
|
||||
COM_AddCommand("debugrender_highlight", Command_Debugrender_highlight);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,8 @@ void Command_Debugrender_highlight(void);
|
|||
|
||||
extern consvar_t
|
||||
cv_debugrender_contrast,
|
||||
cv_debugrender_spriteclip;
|
||||
cv_debugrender_spriteclip,
|
||||
cv_debugrender_portal;
|
||||
|
||||
// Called by startup code.
|
||||
void R_Init(void);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue