From 63e5850a86c6c857217a15c605b61128f21d805c Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 17 Aug 2008 09:57:36 +0000 Subject: [PATCH] CON_SETCFGNAME: sets the name of the cfg during CON compile if a cfg wasn't specified on the command line git-svn-id: https://svn.eduke32.com/eduke32@986 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gamedef.c | 29 +++++++++++++++++++++++++++++ polymer/eduke32/source/gamedef.h | 1 + 2 files changed, 30 insertions(+) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 9479545db..06be9fe5c 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -470,6 +470,7 @@ const char *keyw[] = "activatecheat", // 333 "setgamepalette", // 334 "setdefname", // 335 + "setcfgname", // 336 "" }; @@ -4602,6 +4603,34 @@ repeatcase: } return 0; + case CON_SETCFGNAME: + { + scriptptr--; + while (isaltok(*textptr) == 0) + { + if (*textptr == 0x0a) line_number++; + textptr++; + if (*textptr == 0) break; + } + j = 0; + while (isaltok(*textptr)) + { + tempbuf[j] = *(textptr++); + j++; + } + tempbuf[j] = '\0'; + if (Bstrcmp(setupfilename,"duke3d.cfg") == 0) // not set to something else via -cfg + { + char temp[BMAX_PATH]; + Bstrcpy(temp,tempbuf); + CONFIG_WriteSetup(); + Bstrcpy(setupfilename,temp); + CONFIG_ReadSetup(); + } + initprintf("Using config file '%s'.\n",setupfilename); + } + return 0; + case CON_DEFINEGAMETYPE: scriptptr--; transnum(LABEL_DEFINE); diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 42dea5e06..b81ee78d1 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -846,4 +846,5 @@ enum keywords CON_ACTIVATECHEAT, // 333 CON_SETGAMEPALETTE, // 334 CON_SETDEFNAME, // 335 + CON_SETCFGNAME, // 336 };