From d747e26fd00a2fb720edbac87a2ce05adbbd0f41 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 25 Feb 2013 15:31:24 +0000 Subject: [PATCH] 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 --- polymer/eduke32/source/game.c | 49 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 4580f5f3e..ff5730feb 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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