From ab77b88a241933d0190513c62a69f25f618db83c Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 24 Jan 2023 22:32:39 +0000 Subject: [PATCH 1/2] d_main.c: Load scripts.pk3 before all other files, to permit object definitions to be used in weather and terrain --- src/d_main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 50bd9d1d5..d603ae716 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1127,6 +1127,9 @@ static void IdentifyVersion(void) //// #endif //// +#ifdef USE_PATCH_FILE + D_AddFile(startupiwads, va(pandf,srb2waddir,PATCHNAME)); +#endif #if !defined (TESTERS) && !defined (HOSTTESTERS) D_AddFile(startupiwads, va(pandf,srb2waddir,"gfx.pk3")); #endif @@ -1134,9 +1137,6 @@ static void IdentifyVersion(void) D_AddFile(startupiwads, va(pandf,srb2waddir,"chars.pk3")); D_AddFile(startupiwads, va(pandf,srb2waddir,MAPSNAME)); D_AddFile(startupiwads, va(pandf,srb2waddir,"followers.pk3")); -#ifdef USE_PATCH_FILE - D_AddFile(startupiwads, va(pandf,srb2waddir,PATCHNAME)); -#endif #define UNLOCKTESTING #if defined(DEVELOP) && defined(UNLOCKTESTING) D_AddFile(startupiwads, va(pandf,srb2waddir,UNLOCKNAME)); @@ -1439,6 +1439,9 @@ void D_SRB2Main(void) mainwads = 0; #ifndef DEVELOP +#ifdef USE_PATCH_FILE + mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_PATCH_PK3); // patch.pk3 +#endif // Check MD5s of autoloaded files // Note: Do not add any files that ignore MD5! W_VerifyFileMD5(mainwads, ASSET_HASH_MAIN_KART); // main.kart @@ -1447,11 +1450,10 @@ void D_SRB2Main(void) mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_CHARS_PK3); // chars.pk3 mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_MAPS_PK3); // maps.pk3 -- 4 - If you touch this, make sure to touch up the majormods stuff below. mainwads++; W_VerifyFileMd5(mainwads, ASSET_HASH_FOLLOWERS_PK3); // followers.pk3 -#ifdef USE_PATCH_FILE - - mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_PATCH_PK3); // patch.pk3 -#endif #else +#ifdef USE_PATCH_FILE + mainwads++; // scripts.pk3 +#endif #if !defined (TESTERS) && !defined (HOSTTESTERS) mainwads++; // gfx.pk3 #endif @@ -1459,9 +1461,6 @@ void D_SRB2Main(void) mainwads++; // chars.pk3 mainwads++; // maps.pk3 mainwads++; // followers.pk3 -#ifdef USE_PATCH_FILE - mainwads++; // scripts.pk3 -#endif #ifdef UNLOCKTESTING mainwads++; // unlocks.pk3 #endif From 9e1a2a52017f6993b1a717afa6b5b3cbf6287568 Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 27 Jan 2023 19:06:24 +0000 Subject: [PATCH 2/2] lib_freeslot: Init dehacked state so SOC initialised later won't nuke freeslots generated here --- src/deh_lua.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/deh_lua.c b/src/deh_lua.c index f131617c6..b3ad0f1c5 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -41,6 +41,11 @@ static inline int lib_freeslot(lua_State *L) if (!lua_lumploading) return luaL_error(L, "This function cannot be called from within a hook or coroutine!"); + if (!deh_loaded) + initfreeslots(); + + deh_loaded = true; + while (n-- > 0) { s = Z_StrDup(luaL_checkstring(L,1));