From 4d19faf60013935901d8475476e26c845e94a968 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 2 Sep 2025 17:19:29 +0100 Subject: [PATCH] Fix RVFXANIM - P_InitPicAnims: Parse RVFXANIM *before* ANIMDEFS in same archive - P_ParseANIMDEFSLump: Account for comment and blank lines so not repeatedly re-evaluating the same line --- src/p_setup.cpp | 2 ++ src/p_spec.c | 35 +++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 4115ec71a..e3a19a57a 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -9785,6 +9785,8 @@ void P_ReduceVFXTextureReload(void) extern "C" void ReduceVFX_OnChange(void); void ReduceVFX_OnChange(void) { + if (con_startup_loadprogress < LOADED_CONFIG) + return; P_ReduceVFXTextureReload(); } diff --git a/src/p_spec.c b/src/p_spec.c index 9ba1572a4..acd67477b 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -180,7 +180,18 @@ void P_InitPicAnims(void) for (w = numwadfiles-1; w >= 0; w--) { UINT16 animdefsLumpNum; - UINT16 photosensLumpNum; + + if (cv_reducevfx.value) + { + // Find RVFXANIM lump in the WAD *first* + animdefsLumpNum = W_CheckNumForNamePwad("RVFXANIM", w, 0); + + while (animdefsLumpNum != INT16_MAX) + { + P_ParseANIMDEFSLump(w, animdefsLumpNum, true); + animdefsLumpNum = W_CheckNumForNamePwad("RVFXANIM", (UINT16)w, animdefsLumpNum + 1); + } + } // Find ANIMDEFS lump in the WAD animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", w, 0); @@ -190,18 +201,6 @@ void P_InitPicAnims(void) P_ParseANIMDEFSLump(w, animdefsLumpNum, false); animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", (UINT16)w, animdefsLumpNum + 1); } - - if (cv_reducevfx.value) - { - // Find RVFXANIM lump in the WAD - photosensLumpNum = W_CheckNumForNamePwad("RVFXANIM", w, 0); - - while (photosensLumpNum != INT16_MAX) - { - P_ParseANIMDEFSLump(w, photosensLumpNum, true); - photosensLumpNum = W_CheckNumForNamePwad("RVFXANIM", (UINT16)w, photosensLumpNum + 1); - } - } } // Define the last one @@ -299,9 +298,13 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum, boolean photosens) { I_Error("Error parsing ANIMDEFS lump: Expected \"TEXTURE\", got \"%s\"",animdefsToken); } - // parse next line - while (*p != '\0' && *p != '\n') ++p; - if (*p == '\n') ++p; + + do // get next content line to parse + { + while (*p != '\0' && *p != '\n') ++p; // skips content of evaluated line + while (*p == '\n') ++p; // skips extra blank lines + } while (*p == '/' && *(p+1) == '/'); // skips comments + animdefsToken = M_GetToken(p); } Z_Free(animdefsToken);