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,33 +11359,41 @@ MAIN_LOOP_RESTART:
vscrn();
}
displayrooms(screenpeek,i);
displayrest(i);
if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex)
{
Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE FOR MAP",g_player[voting].user_name);
gametext(160,40,tempbuf,0,2+8+16);
Bsprintf(tempbuf,"%s (E%dL%d)",map[vote_episode*MAXLEVELS + vote_map].name,vote_episode+1,vote_map+1);
gametext(160,48,tempbuf,0,2+8+16);
gametext(160,70,"PRESS F1 TO ACCEPT, F2 TO DECLINE",0,2+8+16);
static unsigned int lastrender = 0;
if (r_maxfps == 0 || getticks() >= lastrender+g_FrameDelay)
{
lastrender = getticks();
displayrooms(screenpeek,i);
displayrest(i);
if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex)
{
Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE FOR MAP",g_player[voting].user_name);
gametext(160,40,tempbuf,0,2+8+16);
Bsprintf(tempbuf,"%s (E%dL%d)",map[vote_episode*MAXLEVELS + vote_map].name,vote_episode+1,vote_map+1);
gametext(160,48,tempbuf,0,2+8+16);
gametext(160,70,"PRESS F1 TO ACCEPT, F2 TO DECLINE",0,2+8+16);
}
if (debug_on) caches();
checksync();
if (VOLUMEONE)
{
if (ud.show_help == 0 && show_shareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
rotatesprite((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128,0,0,xdim-1,ydim-1);
}
nextpage();
}
}
if (g_player[myconnectindex].ps->gm&MODE_DEMO)
goto MAIN_LOOP_RESTART;
if (debug_on) caches();
checksync();
if (VOLUMEONE)
{
if (ud.show_help == 0 && show_shareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
rotatesprite((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128,0,0,xdim-1,ydim-1);
}
nextpage();
while (!(g_player[myconnectindex].ps->gm&MODE_MENU) && ready2send && totalclock >= ototalclock+TICSPERFRAME)
faketimerhandler();
}
@ -11486,8 +11497,8 @@ static int opendemoread(int which_demo) // 0 = mine
if (kread(recfilep,(int *)&g_player[i].pteam,sizeof(int)) != sizeof(int)) goto corrupt;
g_player[i].ps->team = g_player[i].pteam;
}
i = ud.reccnt/((TICRATE/TICSPERFRAME)*ud.multimode);
OSD_Printf("demo duration: %d min %d sec\n", i/60, i%60);
i = ud.reccnt/((TICRATE/TICSPERFRAME)*ud.multimode);
OSD_Printf("demo duration: %d min %d sec\n", i/60, i%60);
ud.god = ud.cashman = ud.eog = ud.showallmap = 0;
ud.clipping = ud.scrollmode = ud.overhead_on = ud.pause_on = 0;

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);