mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 14:41:55 +00:00
Factor some code in config.c into OSD_WriteAliases(), move symbol_t to osd.c.
git-svn-id: https://svn.eduke32.com/eduke32@4213 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4739d3c00e
commit
8dcee7c8dc
3 changed files with 22 additions and 22 deletions
|
@ -16,17 +16,6 @@ typedef struct {
|
|||
const char *raw;
|
||||
} osdfuncparm_t;
|
||||
|
||||
typedef struct _symbol
|
||||
{
|
||||
const char *name;
|
||||
struct _symbol *next;
|
||||
|
||||
const char *help;
|
||||
int32_t (*func)(const osdfuncparm_t *);
|
||||
} symbol_t;
|
||||
|
||||
extern symbol_t *symbols;
|
||||
|
||||
const char *OSD_StripColors(char *out, const char *in);
|
||||
|
||||
enum cvartype_t
|
||||
|
@ -167,6 +156,7 @@ int32_t OSD_RegisterFunction(const char *name, const char *help, int32_t (*func)
|
|||
|
||||
int32_t osdcmd_cvar_set(const osdfuncparm_t *parm);
|
||||
int32_t OSD_RegisterCvar(const cvar_t *cvar);
|
||||
void OSD_WriteAliases(FILE *fp);
|
||||
void OSD_WriteCvars(FILE *fp);
|
||||
|
||||
// these correspond to the Duke palettes, so they shouldn't really be here
|
||||
|
|
|
@ -11,8 +11,17 @@
|
|||
#include "scancodes.h"
|
||||
#include "crc32.h"
|
||||
|
||||
typedef struct _symbol
|
||||
{
|
||||
const char *name;
|
||||
struct _symbol *next;
|
||||
|
||||
const char *help;
|
||||
int32_t (*func)(const osdfuncparm_t *);
|
||||
} symbol_t;
|
||||
|
||||
static mutex_t m_osdprintf;
|
||||
symbol_t *symbols = NULL;
|
||||
static symbol_t *symbols = NULL;
|
||||
static symbol_t *addnewsymbol(const char *name);
|
||||
static symbol_t *findsymbol(const char *name, symbol_t *startingat);
|
||||
static symbol_t *findexactsymbol(const char *name);
|
||||
|
@ -2153,6 +2162,14 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
void OSD_WriteAliases(FILE *fp)
|
||||
{
|
||||
symbol_t *symb;
|
||||
for (symb=symbols; symb!=NULL; symb=symb->next)
|
||||
if (symb->func == (void *)OSD_ALIAS)
|
||||
Bfprintf(fp, "alias \"%s\" \"%s\"\n", symb->name, symb->help);
|
||||
}
|
||||
|
||||
void OSD_WriteCvars(FILE *fp)
|
||||
{
|
||||
uint32_t i;
|
||||
|
|
|
@ -734,8 +734,6 @@ void CONFIG_WriteBinds(void) // save binds and aliases to <cfgname>_settings.cfg
|
|||
|
||||
if (fp)
|
||||
{
|
||||
symbol_t *symb;
|
||||
|
||||
Bfprintf(fp,"// this file 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");
|
||||
|
@ -752,16 +750,11 @@ void CONFIG_WriteBinds(void) // save binds and aliases to <cfgname>_settings.cfg
|
|||
Bfprintf(fp,"bind \"%s\"%s \"%s\"\n",CONTROL_MouseBinds[i].key,
|
||||
CONTROL_MouseBinds[i].repeat?"":" norepeat",CONTROL_MouseBinds[i].cmdstr);
|
||||
|
||||
for (symb=symbols; symb!=NULL; symb=symb->next)
|
||||
if (symb->func == (void *)OSD_ALIAS)
|
||||
Bfprintf(fp,"alias \"%s\" \"%s\"\n", symb->name, symb->help);
|
||||
|
||||
/* for (i = 0; i < sizeof(cvar)/sizeof(cvarmappings); i++)
|
||||
if (!(cvar[i].type&CVAR_NOSAVE))
|
||||
Bfprintf(fp,"%s \"%d\"\n",cvar[i].name,*(int32_t*)cvar[i].var);
|
||||
*/
|
||||
OSD_WriteAliases(fp);
|
||||
OSD_WriteCvars(fp);
|
||||
|
||||
Bfclose(fp);
|
||||
|
||||
if (!Bstrcmp(setupfilename, SETUPFILENAME))
|
||||
OSD_Printf("Wrote settings.cfg\n");
|
||||
else OSD_Printf("Wrote %s_settings.cfg\n",ptr);
|
||||
|
|
Loading…
Reference in a new issue