mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-18 15:11:51 +00:00
Mapster32: Introduce m32_settings.cfg, analogous to settings.cfg, so that you can save your cvars and aliases for the editor.
One potential use is to add r_togglecomposition "0" if you don't like Aero turning on and off every time you switch between 2D mode and 32-bit 3D mode. git-svn-id: https://svn.eduke32.com/eduke32@4344 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
14db3b178d
commit
a21f340553
4 changed files with 55 additions and 3 deletions
|
@ -13,6 +13,9 @@
|
|||
|
||||
#define VERSION "2.0.0devel"
|
||||
|
||||
#define SETUPFILENAME "mapster32.cfg"
|
||||
extern char setupfilename[BMAX_PATH];
|
||||
|
||||
// Build keys
|
||||
#define BK_MOVEFORWARD 0
|
||||
#define BK_MOVEBACKWARD 1
|
||||
|
|
|
@ -346,6 +346,44 @@ int32_t loadsetup(const char *fn)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void writesettings(void) // save binds and aliases to <cfgname>_m32_settings.cfg
|
||||
{
|
||||
BFILE *fp;
|
||||
char *ptr = Bstrdup(setupfilename);
|
||||
char tempbuf[128];
|
||||
|
||||
if (!Bstrcmp(setupfilename, SETUPFILENAME))
|
||||
Bsprintf(tempbuf, "m32_settings.cfg");
|
||||
else Bsprintf(tempbuf, "%s_m32_settings.cfg", strtok(ptr, "."));
|
||||
|
||||
fp = Bfopen(tempbuf, "wt");
|
||||
|
||||
if (fp)
|
||||
{
|
||||
Bfprintf(fp,"// this file is automatically generated by Mapster32\n");
|
||||
Bfprintf(fp,"// these settings take precedence over your main cfg file\n");
|
||||
Bfprintf(fp,"// do not modify if you lack common sense\n");
|
||||
|
||||
OSD_WriteAliases(fp);
|
||||
OSD_WriteCvars(fp);
|
||||
|
||||
Bfclose(fp);
|
||||
|
||||
if (!Bstrcmp(setupfilename, SETUPFILENAME))
|
||||
OSD_Printf("Wrote m32_settings.cfg\n");
|
||||
else OSD_Printf("Wrote %s_m32_settings.cfg\n",ptr);
|
||||
|
||||
Bfree(ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Bstrcmp(setupfilename, SETUPFILENAME))
|
||||
OSD_Printf("Error writing m32_settings.cfg: %s\n", strerror(errno));
|
||||
else OSD_Printf("Error writing %s_m32_settings.cfg: %s\n",ptr,strerror(errno));
|
||||
|
||||
Bfree(ptr);
|
||||
}
|
||||
|
||||
int32_t writesetup(const char *fn)
|
||||
{
|
||||
BFILE *fp;
|
||||
|
@ -654,5 +692,7 @@ int32_t writesetup(const char *fn)
|
|||
|
||||
Bfclose(fp);
|
||||
|
||||
writesettings();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ static char g_modDir[BMAX_PATH];
|
|||
static char levelname[BMAX_PATH];
|
||||
|
||||
// static char *startwin_labeltext = "Starting Mapster32...";
|
||||
static char setupfilename[BMAX_PATH] = "mapster32.cfg";
|
||||
char setupfilename[BMAX_PATH] = SETUPFILENAME;
|
||||
|
||||
int32_t fixmaponsave_sprites = 1;
|
||||
static int32_t fixmaponsave_walls = 0;
|
||||
|
@ -10457,7 +10457,7 @@ int32_t ExtInit(void)
|
|||
#ifdef USE_OPENGL
|
||||
glusetexcache = -1;
|
||||
|
||||
if (Bstrcmp(setupfilename, "mapster32.cfg"))
|
||||
if (Bstrcmp(setupfilename, SETUPFILENAME))
|
||||
initprintf("Using config file \"%s\".\n",setupfilename);
|
||||
|
||||
if (loadsetup(setupfilename) < 0)
|
||||
|
@ -10511,6 +10511,15 @@ int32_t ExtInit(void)
|
|||
OSD_SetParameters(0,2, 0,0, 4,0);
|
||||
registerosdcommands();
|
||||
|
||||
{
|
||||
char *ptr = Bstrdup(setupfilename), *p = strtok(ptr,".");
|
||||
if (!Bstrcmp(setupfilename, SETUPFILENAME))
|
||||
Bsprintf(tempbuf, "m32_settings.cfg");
|
||||
else Bsprintf(tempbuf,"%s_m32_settings.cfg",p);
|
||||
OSD_Exec(tempbuf);
|
||||
Bfree(ptr);
|
||||
}
|
||||
|
||||
// backup pathsearchmode so that a later open
|
||||
// will hopefully be the same file
|
||||
pathsearchmode_oninit = pathsearchmode;
|
||||
|
|
|
@ -735,7 +735,7 @@ void CONFIG_WriteBinds(void) // save binds and aliases to <cfgname>_settings.cfg
|
|||
|
||||
if (fp)
|
||||
{
|
||||
Bfprintf(fp,"// this file automatically generated by EDuke32\n");
|
||||
Bfprintf(fp,"// this file is automatically generated by EDuke32\n");
|
||||
Bfprintf(fp,"// these settings take precedence over your main cfg file\n");
|
||||
Bfprintf(fp,"// do not modify if you lack common sense\n");
|
||||
|
||||
|
|
Loading…
Reference in a new issue