Adds r_maxfps and some better error messages for cases where the user didn't even copy a grp into their EDuke32 dir

git-svn-id: https://svn.eduke32.com/eduke32@1086 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-10-01 04:38:14 +00:00
parent 02e632b5e2
commit 328011fae4
5 changed files with 77 additions and 29 deletions

View file

@ -422,7 +422,7 @@ static char toupperlookup[256] =
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
};
static int numgroupfiles = 0;
int numgroupfiles = 0;
static int gnumfiles[MAXGROUPFILES];
static int groupfil[MAXGROUPFILES] = {-1,-1,-1,-1,-1,-1,-1,-1};
static int groupfilpos[MAXGROUPFILES];

View file

@ -589,6 +589,7 @@ extern void check_valid_color(int *color,int prev_color);
extern palette_t crosshair_colors;
extern palette_t default_crosshair_colors;
extern char mod_dir[BMAX_PATH];
extern int r_maxfps;
int32 CONFIG_ReadSetup(void)
{
@ -684,6 +685,16 @@ int32 CONFIG_ReadSetup(void)
r_ambientlightrecip = 1.f/r_ambientlight;
}
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxFPS",&r_maxfps);
r_maxfps = max(0,min(1000,r_maxfps));
{
extern int g_FrameDelay;
if (r_maxfps)
g_FrameDelay = (1000/r_maxfps);
else g_FrameDelay = 0;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP);
if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32;
@ -1023,6 +1034,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidContrast",tempbuf);
Bsprintf(tempbuf,"%.2f",r_ambientlight);
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "AmbientLight",tempbuf);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxFPS", r_maxfps, false, false);
#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);

View file

@ -158,6 +158,9 @@ int hud_showmapname = 1;
int leveltexttime = 0;
int r_maxfps = 0;
unsigned int g_FrameDelay = 0;
int kopen4loadfrommod(char *filename, char searchfirst)
{
static char fn[BMAX_PATH];
@ -11356,6 +11359,12 @@ MAIN_LOOP_RESTART:
vscrn();
}
{
static unsigned int lastrender = 0;
if (r_maxfps == 0 || getticks() >= lastrender+g_FrameDelay)
{
lastrender = getticks();
displayrooms(screenpeek,i);
displayrest(i);
@ -11368,9 +11377,6 @@ MAIN_LOOP_RESTART:
gametext(160,70,"PRESS F1 TO ACCEPT, F2 TO DECLINE",0,2+8+16);
}
if (g_player[myconnectindex].ps->gm&MODE_DEMO)
goto MAIN_LOOP_RESTART;
if (debug_on) caches();
checksync();
@ -11382,6 +11388,11 @@ MAIN_LOOP_RESTART:
}
nextpage();
}
}
if (g_player[myconnectindex].ps->gm&MODE_DEMO)
goto MAIN_LOOP_RESTART;
while (!(g_player[myconnectindex].ps->gm&MODE_MENU) && ready2send && totalclock >= ototalclock+TICSPERFRAME)
faketimerhandler();

View file

@ -5634,14 +5634,20 @@ void loadefs(const char *filenam)
fp = kopen4loadfrommod((char *)filenam,loadfromgrouponly);
if (fp == -1) // JBF: was 0
{
extern int numgroupfiles;
if (loadfromgrouponly == 1)
gameexit("Missing CON file(s); replace duke3d.grp with a known good copy.");
else
{
Bsprintf(tempbuf,"CON file `%s' missing.", filenam);
gameexit(tempbuf);
return;
Bsprintf(tempbuf,"'%s' missing CON files, reinstall Duke Nukem 3D.",duke3dgrp);
}
else if (numgroupfiles == 0)
{
Bsprintf(tempbuf,"Duke Nukem 3D was not found in this directory. A copy of '%s' or its contents is needed to run EDuke32.\n"
"You can find '%s' in the \"DN3DINST\" or \"ATOMINST\" directory on your Duke Nukem 3D installation CD-ROM.",
duke3dgrp,duke3dgrp);
}
else Bsprintf(tempbuf,"CON file `%s' missing.", filenam);
gameexit(tempbuf);
//loadfromgrouponly = 1;
return; //Not there

View file

@ -37,6 +37,7 @@ struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat;
float r_ambientlight = 1.0, r_ambientlightrecip = 1.0;
extern int althud_numbertile, althud_numberpal, althud_shadows, althud_flashing, hud_glowingquotes;
extern int hud_showmapname;
extern int r_maxfps;
static inline int osdcmd_quit(const osdfuncparm_t *parm)
{
@ -1401,6 +1402,23 @@ static int osdcmd_visibility(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int osdcmd_maxfps(const osdfuncparm_t *parm)
{
int i;
extern int g_FrameDelay;
if (parm->numparms != 1)
{
OSD_Printf("\"r_maxfps\" is \"%d\"\n",r_maxfps);
return OSDCMD_SHOWHELP;
}
r_maxfps = max(0,min(1000,atol(parm->parms[0])));
if (r_maxfps) g_FrameDelay = (1000/r_maxfps);
else g_FrameDelay = 0;
OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK;
}
int registerosdcommands(void)
{
unsigned int i;
@ -1463,6 +1481,7 @@ int registerosdcommands(void)
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("r_maxfps", "r_maxfps: sets a fps cap",osdcmd_maxfps);
OSD_RegisterFunction("sensitivity","sensitivity <value>: changes the mouse sensitivity", osdcmd_sensitivity);
OSD_RegisterFunction("addlogvar","addlogvar <gamevar>: prints the value of a gamevar", osdcmd_addlogvar);