Lunatic: initialize test Lua state earlier so that 'setdefname' has an effect.

git-svn-id: https://svn.eduke32.com/eduke32@3528 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-02-25 15:31:24 +00:00
parent e576224bb9
commit d747e26fd0
1 changed files with 24 additions and 25 deletions

View File

@ -9749,6 +9749,28 @@ static void G_Startup(void)
setbasepaltable(basepaltable, BASEPALCOUNT);
#ifdef LUNATIC
if ((i = El_CreateState(&g_ElState, "test")))
{
initprintf("Lunatic: Error initializing global ELua state (code %d)\n", i);
}
else
{
extern const char luaJIT_BC_defs[];
if ((i = L_RunString(&g_ElState, (char *)luaJIT_BC_defs, 0,
LUNATIC_DEFS_BC_SIZE, "defs.ilua")))
{
initprintf("Lunatic: Error preparing global ELua state (code %d)\n", i);
El_DestroyState(&g_ElState);
}
}
if (i)
G_GameExit("Failure setting up Lunatic!");
C_InitQuotes();
#endif
G_InitDynamicTiles();
A_InitEnemyFlags();
@ -10452,6 +10474,7 @@ int32_t app_main(int32_t argc, const char **argv)
}
#endif
numplayers = 1;
playerswhenstarted = ud.multimode; // Lunatic needs this (player[] bound)
if (!g_fakeMultiMode)
{
@ -10459,8 +10482,6 @@ int32_t app_main(int32_t argc, const char **argv)
}
else
{
playerswhenstarted = ud.multimode;
for (i=0; i<ud.multimode-1; i++)
connectpoint2[i] = i+1;
connectpoint2[ud.multimode-1] = -1;
@ -10526,7 +10547,7 @@ int32_t app_main(int32_t argc, const char **argv)
}
}
playerswhenstarted = ud.multimode;
playerswhenstarted = ud.multimode; // XXX: redundant?
ud.last_level = 0;
// the point of this block is to avoid overwriting the default in the cfg while asserting our selection
@ -10598,28 +10619,6 @@ int32_t app_main(int32_t argc, const char **argv)
OSD_Exec("autoexec.cfg");
#ifdef LUNATIC
if ((i = El_CreateState(&g_ElState, "test")))
{
initprintf("Lunatic: Error initializing global ELua state (code %d)\n", i);
}
else
{
extern const char luaJIT_BC_defs[];
if ((i = L_RunString(&g_ElState, (char *)luaJIT_BC_defs, 0,
LUNATIC_DEFS_BC_SIZE, "defs.ilua")))
{
initprintf("Lunatic: Error preparing global ELua state (code %d)\n", i);
El_DestroyState(&g_ElState);
}
}
if (i)
G_GameExit("Failure setting up Lunatic!");
C_InitQuotes();
#endif
if (g_networkMode != NET_DEDICATED_SERVER)
{
if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP) < 0)