Read setup again after compiling scripts

git-svn-id: https://svn.eduke32.com/eduke32@6339 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2017-07-08 05:18:51 +00:00
parent b3b40c9581
commit c23b1fe076
2 changed files with 84 additions and 83 deletions

View file

@ -523,19 +523,21 @@ int32_t CONFIG_ReadSetup(void)
CONFIG_SetDefaults(); CONFIG_SetDefaults();
ud.config.setupread = 1; ud.config.setupread = 1;
pathsearchmode = 1; pathsearchmode = 1;
if (SafeFileExists(g_setupFileName) && ud.config.scripthandle < 0) // JBF 20031211
if (ud.config.scripthandle < 0)
{
if (SafeFileExists(g_setupFileName)) // JBF 20031211
ud.config.scripthandle = SCRIPT_Load(g_setupFileName); ud.config.scripthandle = SCRIPT_Load(g_setupFileName);
#if !defined(EDUKE32_TOUCH_DEVICES) && !defined(EDUKE32_STANDALONE) #if !defined(EDUKE32_TOUCH_DEVICES) && !defined(EDUKE32_STANDALONE)
else if (SafeFileExists(SETUPFILENAME) && ud.config.scripthandle < 0) else if (SafeFileExists(SETUPFILENAME))
{ {
int32_t i; int32_t i;
i=wm_ynbox("Import Configuration Settings", "The configuration file \"%s\" was not found. " i=wm_ynbox("Import Configuration Settings", "The configuration file \"%s\" was not found. "
"Import configuration data from \"%s\"?", g_setupFileName, SETUPFILENAME); "Import configuration data from \"%s\"?", g_setupFileName, SETUPFILENAME);
if (i) ud.config.scripthandle = SCRIPT_Load(SETUPFILENAME); if (i) ud.config.scripthandle = SCRIPT_Load(SETUPFILENAME);
} }
else if (SafeFileExists("duke3d.cfg") && ud.config.scripthandle < 0) else if (SafeFileExists("duke3d.cfg"))
{ {
int32_t i; int32_t i;
i=wm_ynbox("Import Configuration Settings", "The configuration file \"%s\" was not found. " i=wm_ynbox("Import Configuration Settings", "The configuration file \"%s\" was not found. "
@ -543,14 +545,12 @@ int32_t CONFIG_ReadSetup(void)
if (i) ud.config.scripthandle = SCRIPT_Load("duke3d.cfg"); if (i) ud.config.scripthandle = SCRIPT_Load("duke3d.cfg");
} }
#endif #endif
}
pathsearchmode = 0; pathsearchmode = 0;
if (ud.config.scripthandle < 0) return -1; if (ud.config.scripthandle < 0)
return -1;
if (ud.config.scripthandle >= 0)
{
char dummybuf[64];
for (dummy = 0; dummy < MAXRIDECULE; dummy++) for (dummy = 0; dummy < MAXRIDECULE; dummy++)
{ {
@ -561,7 +561,9 @@ int32_t CONFIG_ReadSetup(void)
Bmemset(tempbuf, 0, sizeof(tempbuf)); Bmemset(tempbuf, 0, sizeof(tempbuf));
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]); SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]);
while (Bstrlen(OSD_StripColors(dummybuf,tempbuf)) > 10) char nameBuf[64];
while (Bstrlen(OSD_StripColors(nameBuf, tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf) - 1] = '\0'; tempbuf[Bstrlen(tempbuf) - 1] = '\0';
Bstrncpyz(szPlayerName, tempbuf, sizeof(szPlayerName)); Bstrncpyz(szPlayerName, tempbuf, sizeof(szPlayerName));
@ -573,7 +575,6 @@ int32_t CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup", &ud.config.ForceSetup); SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup", &ud.config.ForceSetup);
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", &ud.config.NoAutoLoad); SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", &ud.config.NoAutoLoad);
// #ifdef _WIN32
if (g_noSetup == 0 && g_modDir[0] == '/') if (g_noSetup == 0 && g_modDir[0] == '/')
{ {
struct Bstat st; struct Bstat st;
@ -588,7 +589,6 @@ int32_t CONFIG_ReadSetup(void)
} }
} }
} }
// #endif
if (g_grpNamePtr == NULL && g_addonNum == 0) if (g_grpNamePtr == NULL && g_addonNum == 0)
{ {
@ -608,14 +608,15 @@ int32_t CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",&ud.config.ScreenWidth); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",&ud.config.ScreenWidth);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos);
windowx = -1; windowx = -1;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32_t *)&windowx);
windowy = -1; windowy = -1;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32_t *)&windowx);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP);
if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32; if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32;
#ifdef POLYMER #ifdef POLYMER
@ -631,8 +632,6 @@ int32_t CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", &ud.config.LastUpdateCheck); SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", &ud.config.LastUpdateCheck);
#endif #endif
}
ud.config.setupread = 1; ud.config.setupread = 1;
return 0; return 0;
} }

View file

@ -6378,6 +6378,8 @@ int app_main(int argc, char const * const * argv)
ud.last_level = (Bstrcpy(ud.rtsname, G_DefaultRtsFile()) == ud.rtsname); ud.last_level = (Bstrcpy(ud.rtsname, G_DefaultRtsFile()) == ud.rtsname);
} }
CONFIG_ReadSetup();
RTS_Init(ud.rtsname); RTS_Init(ud.rtsname);
if (RTS_IsInitialized()) if (RTS_IsInitialized())