diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 8fcd45180..ec02f42aa 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -663,6 +663,13 @@ int32 CONFIG_ReadSetup(void) tempbuf[0] = 0; SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidContrast",&tempbuf[0]); if (tempbuf[0]) vid_contrast = atof(tempbuf); + tempbuf[0] = 0; + SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "AmbientLight",&tempbuf[0]); + if (atof(tempbuf)) + { + r_ambientlight = atof(tempbuf); + r_ambientlightrecip = 1/r_ambientlight; + } #if defined(POLYMOST) && defined(USE_OPENGL) SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP); @@ -963,7 +970,8 @@ void CONFIG_WriteSetup(void) SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidBrightness",tempbuf); Bsprintf(tempbuf,"%.2f",vid_contrast); SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidContrast",tempbuf); - + Bsprintf(tempbuf,"%.2f",r_ambientlight); + SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "AmbientLight",tempbuf); #ifdef _WIN32 SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, false, false); SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, false, false); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index d590503d7..f808cfcf7 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -3891,6 +3891,7 @@ void se40code(int x,int y,int z,int a,int h, int smoothratio) #endif static int oyrepeat=-1; +extern float r_ambientlight; void displayrooms(int snum,int smoothratio) { @@ -3912,7 +3913,7 @@ void displayrooms(int snum,int smoothratio) smoothratio = min(max(smoothratio,0),65536); - visibility = p->visibility; + visibility = p->visibility*(numplayers>1?1:r_ambientlightrecip); if (ud.pause_on || g_player[snum].ps->on_crane > -1) smoothratio = 65536; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 36634e3db..79713c40a 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "duke3d.h" #include "mouse.h" #include "osd.h" +#include "osdcmds.h" #include extern char inputloc; @@ -2441,6 +2442,7 @@ cheat_for_port_credits: "Use models", "Blend model animations", "-", + "Ambient light level", "Use VSync", NULL }; @@ -2457,7 +2459,7 @@ cheat_for_port_credits: io++; } - onbar = 0; + onbar = (probey==11); x = probesm(c,yy+5,0,io); if (x == -1) @@ -2552,6 +2554,18 @@ cheat_for_port_credits: mgametextpal(d,yy, r_animsmoothing && enabled ? "Yes" : "No", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0); break; case 11: + { + int i = (float)r_ambientlight*1024.f; + int j = i; + _bar(1,d+8,yy+7, &i,128,x==io,MENUHIGHLIGHT(io),0,128,4096); + if (i != j) + { + r_ambientlight = (float)i/1024.f; + r_ambientlightrecip = 1/r_ambientlight; + } + break; + } + case 12: { int ovsync = vsync; if (x==io) vsync = !vsync; @@ -3079,11 +3093,11 @@ cheat_for_port_credits: c = (320>>1)-120; #if defined(POLYMOST) && defined(USE_OPENGL) - x = (6+(getrendermode() >= 3)); + x = (7+(getrendermode() >= 3)); #else - x = 6; + x = 7; #endif - onbar = 0; // (probey == 4); + onbar = (!getrendermode() && probey == 6); // (probey == 4); if (probey == 0 || probey == 1 || probey == 2) x = probe(c,50,16,x); else if (probey == 3) @@ -3370,9 +3384,18 @@ cheat_for_port_credits: */ if (!getrendermode()) { + int i = (float)r_ambientlight*1024.f; + int j = i; menutext(c,50+62+16+16,MENUHIGHLIGHT(5),0,"PIXEL DOUBLING"); menutext(c+154,50+62+16+16,MENUHIGHLIGHT(5),0,ud.detail?"OFF":"ON"); modval(0,1,(int *)&ud.detail,1,probey==5); + menutext(c,50+62+16+16+16,MENUHIGHLIGHT(4),PHX(-6),"AMBIENT LIGHT"); + _bar(0,c+171,50+62+16+16+16,&i,128,x==6,MENUHIGHLIGHT(probey),0,128,4096); + if (i != j) + { + r_ambientlight = (float)i/1024.f; + r_ambientlightrecip = 1/r_ambientlight; + } } #if defined(POLYMOST) && defined(USE_OPENGL) else diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 6aa49cdca..72fdc6371 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern int voting, doquicksave; struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; +float r_ambientlight = 1.0, r_ambientlightrecip = 1.0; static inline int osdcmd_quit(const osdfuncparm_t *parm) { @@ -698,8 +699,7 @@ cvarmappings cvar[] = { "r_showfps", "r_showfps: show the frame rate counter", (void*)&ud.tickrate, CVAR_BOOL, 0, 0, 1 }, { "r_shadows", "r_shadows: enable/disable sprite and model shadows", (void*)&ud.shadows, CVAR_BOOL, 0, 0, 1 }, { "r_precache", "r_precache: enable/disable the pre-level caching routine", (void*)&ud.config.useprecache, CVAR_BOOL, 0, 0, 1 }, - { "r_visibility", "r_visibility: sets the global map visibility", (void*)&ud.const_visibility, CVAR_INT|128, 0, INT_MIN, INT_MAX }, - + { "snd_ambience", "snd_ambience: enables/disables ambient sounds", (void*)&ud.config.AmbienceToggle, CVAR_BOOL, 0, 0, 1 }, { "snd_duketalk", "snd_duketalk: enables/disables Duke's speech", (void*)&ud.config.VoiceToggle, CVAR_INT, 0, 0, 2 }, { "snd_fxvolume", "snd_fxvolume: volume of sound effects", (void*)&ud.config.FXVolume, CVAR_INT, 0, 0, 255 }, @@ -1313,6 +1313,22 @@ static int osdcmd_setcrosshairscale(const osdfuncparm_t *parm) return OSDCMD_OK; } +static int osdcmd_visibility(const osdfuncparm_t *parm) +{ + float f; + + if (parm->numparms != 1) + { + OSD_Printf("\"r_ambientlight\" is \"%.1f\"\n",r_ambientlight); + return OSDCMD_SHOWHELP; + } + f = max(0.05f,min(10.f,atof(parm->parms[0]))); + r_ambientlight = f; + r_ambientlightrecip = 1/f; + OSD_Printf("%s\n",parm->raw); + return OSDCMD_OK; +} + int registerosdcommands(void) { unsigned int i; @@ -1373,6 +1389,8 @@ int registerosdcommands(void) OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound); OSD_RegisterFunction("restartvid","restartvid: reinitializes the video mode",osdcmd_restartvid); + OSD_RegisterFunction("r_ambientlight", "r_ambientlight: sets the global map light level",osdcmd_visibility); + OSD_RegisterFunction("sensitivity","sensitivity : changes the mouse sensitivity", osdcmd_sensitivity); OSD_RegisterFunction("addlogvar","addlogvar : prints the value of a gamevar", osdcmd_addlogvar); OSD_RegisterFunction("setvar","setvar : sets the value of a gamevar", osdcmd_setvar); diff --git a/polymer/eduke32/source/osdcmds.h b/polymer/eduke32/source/osdcmds.h index c2d31672c..7ce2b1422 100644 --- a/polymer/eduke32/source/osdcmds.h +++ b/polymer/eduke32/source/osdcmds.h @@ -10,6 +10,8 @@ extern struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; int registerosdcommands(void); +extern float r_ambientlight,r_ambientlightrecip; + enum cvartypes { CVAR_INT,