Add r_pr_lighting 2, which disables the hard-coded lights while leaving lights added in maps enabled.

This also adds a menu option to control r_pr_lighting.

git-svn-id: https://svn.eduke32.com/eduke32@5406 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2015-10-23 23:00:21 +00:00
parent 3ae7f7ade3
commit f22dbc6fdb
5 changed files with 60 additions and 27 deletions

View file

@ -2133,10 +2133,9 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; } if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; }
//------------ //------------
// Bit 10 is an ugly hack in game.c:G_DoSpriteAnimations() telling md2sprite // TSPR_EXTRA_MDHACK is an ugly hack in game.c:G_DoSpriteAnimations() telling md2sprite
// to use Z-buffer hacks to hide overdraw problems with the // to use Z-buffer hacks to hide overdraw problems with the flat-tsprite-on-floor shadows,
// flat-tsprite-on-floor shadows. // also disabling detail, glow, normal, and specular maps.
// is this still needed?
if (tspr->extra&TSPR_EXTRA_MDHACK) if (tspr->extra&TSPR_EXTRA_MDHACK)
{ {

View file

@ -5685,7 +5685,7 @@ void polymost_initosdfuncs(void)
#ifdef POLYMER #ifdef POLYMER
// polymer cvars // polymer cvars
{ "r_pr_lighting", "enable/disable dynamic lights - restarts renderer", (void *) &pr_lighting, CVAR_BOOL | CVAR_RESTARTVID, 0, 1 }, { "r_pr_lighting", "enable/disable dynamic lights - restarts renderer", (void *) &pr_lighting, CVAR_INT | CVAR_RESTARTVID, 0, 2 },
{ "r_pr_normalmapping", "enable/disable virtual displacement mapping", (void *) &pr_normalmapping, CVAR_BOOL, 0, 1 }, { "r_pr_normalmapping", "enable/disable virtual displacement mapping", (void *) &pr_normalmapping, CVAR_BOOL, 0, 1 },
{ "r_pr_specularmapping", "enable/disable specular mapping", (void *) &pr_specularmapping, CVAR_BOOL, 0, 1 }, { "r_pr_specularmapping", "enable/disable specular mapping", (void *) &pr_specularmapping, CVAR_BOOL, 0, 1 },
{ "r_pr_shadows", "enable/disable dynamic shadows", (void *) &pr_shadows, CVAR_BOOL, 0, 1 }, { "r_pr_shadows", "enable/disable dynamic shadows", (void *) &pr_shadows, CVAR_BOOL, 0, 1 },

View file

@ -784,7 +784,7 @@ void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t
#ifdef POLYMER #ifdef POLYMER
spritetype *s = &sprite[srcsprite]; spritetype *s = &sprite[srcsprite];
if (getrendermode() != REND_POLYMER) if (getrendermode() != REND_POLYMER || pr_lighting != 1)
return; return;
if (actor[srcsprite].lightptr == NULL) if (actor[srcsprite].lightptr == NULL)
@ -7949,6 +7949,9 @@ static void A_DoLight(int32_t i)
A_DeleteLight(i); A_DeleteLight(i);
} }
if (pr_lighting != 1)
return;
for (ii=0; ii<2; ii++) for (ii=0; ii<2; ii++)
{ {
if (sprite[i].picnum <= 0) // oob safety if (sprite[i].picnum <= 0) // oob safety
@ -8260,6 +8263,27 @@ int32_t A_CheckSwitchTile(int32_t i)
return 0; return 0;
} }
void G_RefreshLights(void)
{
#ifdef POLYMER
if (getrendermode() == REND_POLYMER)
{
int32_t i, k = 0;
do
{
i = headspritestat[k++];
while (i >= 0)
{
A_DoLight(i);
i = nextspritestat[i];
}
} while (k < MAXSTATUS);
}
#endif
}
void G_MoveWorld(void) void G_MoveWorld(void)
{ {
extern double g_moveActorsTime; extern double g_moveActorsTime;
@ -8346,24 +8370,7 @@ void G_MoveWorld(void)
} while (k < MAXSTATUS); } while (k < MAXSTATUS);
} }
#ifdef POLYMER G_RefreshLights();
if (getrendermode() == REND_POLYMER)
{
int32_t i, k = 0;
do
{
i = headspritestat[k++];
while (i >= 0)
{
A_DoLight(i);
i = nextspritestat[i];
}
} while (k < MAXSTATUS);
}
#endif
G_DoSectorAnimations(); G_DoSectorAnimations();
G_MoveFX(); //ST 11 G_MoveFX(); //ST 11
} }

View file

@ -314,6 +314,7 @@ void G_AddGameLight(int32_t radius,int32_t srcsprite,int32_t zoff
void G_ClearCameraView(DukePlayer_t *ps); void G_ClearCameraView(DukePlayer_t *ps);
void G_DoInterpolations(int32_t smoothratio); void G_DoInterpolations(int32_t smoothratio);
void G_MoveWorld(void); void G_MoveWorld(void);
void G_RefreshLights(void);
int32_t G_SetInterpolation(int32_t * const posptr); int32_t G_SetInterpolation(int32_t * const posptr);
void G_StopInterpolation(int32_t * const posptr); void G_StopInterpolation(int32_t * const posptr);

View file

@ -897,6 +897,12 @@ static MenuEntry_t ME_RENDERERSETUP_DETAILTEX = MAKE_MENUENTRY( "Detail textures
static MenuOption_t MEO_RENDERERSETUP_MODELS = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_NoYes, &usemodels ); static MenuOption_t MEO_RENDERERSETUP_MODELS = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_NoYes, &usemodels );
static MenuEntry_t ME_RENDERERSETUP_MODELS = MAKE_MENUENTRY( "Models:", &MF_BluefontRed, &MEF_SmallOptions, &MEO_RENDERERSETUP_MODELS, Option ); static MenuEntry_t ME_RENDERERSETUP_MODELS = MAKE_MENUENTRY( "Models:", &MF_BluefontRed, &MEF_SmallOptions, &MEO_RENDERERSETUP_MODELS, Option );
#endif #endif
#ifdef POLYMER
static char *MEOSN_RENDERERSETUP_LIGHTS [] ={ "Off", "Full", "Map only", };
static MenuOptionSet_t MEOS_RENDERERSETUP_LIGHTS = MAKE_MENUOPTIONSET(MEOSN_RENDERERSETUP_LIGHTS, NULL, 0x2);
static MenuOption_t MEO_RENDERERSETUP_LIGHTS = MAKE_MENUOPTION(&MF_Bluefont, &MEOS_RENDERERSETUP_LIGHTS, &pr_lighting);
static MenuEntry_t ME_RENDERERSETUP_LIGHTS = MAKE_MENUENTRY("Dynamic lights (Polymer)", &MF_BluefontRed, &MEF_SmallOptions, &MEO_RENDERERSETUP_LIGHTS, Option);
#endif
#ifdef USE_OPENGL #ifdef USE_OPENGL
static MenuEntry_t *MEL_RENDERERSETUP[] = { static MenuEntry_t *MEL_RENDERERSETUP[] = {
@ -909,6 +915,10 @@ static MenuEntry_t *MEL_RENDERERSETUP[] = {
#endif #endif
&ME_Space4, &ME_Space4,
&ME_RENDERERSETUP_MODELS, &ME_RENDERERSETUP_MODELS,
#ifdef POLYMER
&ME_Space4,
&ME_RENDERERSETUP_LIGHTS,
#endif
}; };
#endif #endif
@ -1617,6 +1627,9 @@ static void M_PreMenu(MenuID_t cm)
break; break;
case MENU_RENDERERSETUP: case MENU_RENDERERSETUP:
#ifdef POLYMER
MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_LIGHTS, getrendermode() != REND_POLYMER);
#endif
MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_TEXQUALITY, !usehightile); MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_TEXQUALITY, !usehightile);
MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_PRECACHE, !usehightile); MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_PRECACHE, !usehightile);
#ifndef EDUKE32_GLES #ifndef EDUKE32_GLES
@ -2794,6 +2807,8 @@ static int32_t M_MenuEntryOptionModify(MenuEntry_t *entry, int32_t newOption)
static void M_MenuEntryOptionDidModify(MenuEntry_t *entry) static void M_MenuEntryOptionDidModify(MenuEntry_t *entry)
{ {
int domodechange = 0;
if (entry == &ME_GAMESETUP_AIM_AUTO || if (entry == &ME_GAMESETUP_AIM_AUTO ||
entry == &ME_GAMESETUP_WEAPSWITCH_PICKUP || entry == &ME_GAMESETUP_WEAPSWITCH_PICKUP ||
entry == &ME_PLAYER_NAME || entry == &ME_PLAYER_NAME ||
@ -2806,10 +2821,21 @@ static void M_MenuEntryOptionDidModify(MenuEntry_t *entry)
else if (entry == &ME_RENDERERSETUP_TEXQUALITY) else if (entry == &ME_RENDERERSETUP_TEXQUALITY)
{ {
texcache_invalidate(); texcache_invalidate();
r_downsizevar = r_downsize;
domodechange = 1;
}
#ifdef POLYMER
else if (entry == &ME_RENDERERSETUP_LIGHTS)
domodechange = 1;
#endif
if (domodechange)
{
resetvideomode(); resetvideomode();
if (setgamemode(fullscreen, xdim, ydim, bpp)) if (setgamemode(fullscreen, xdim, ydim, bpp))
OSD_Printf("restartvid: Reset failed...\n"); OSD_Printf("restartvid: Reset failed...\n");
r_downsizevar = r_downsize; onvideomodechange(ud.config.ScreenBPP>8);
G_RefreshLights();
} }
#endif #endif
} }