diff --git a/src/cvars.cpp b/src/cvars.cpp index efe23893c..b39d1005b 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -559,7 +559,9 @@ static constexpr const char* kNetDemoRecordDefault = consvar_t cv_recordmultiplayerdemos = Server("netdemo_record", kNetDemoRecordDefault).values({{0, "Disabled"}, {1, "Manual Save"}, {2, "Auto Save"}}); -consvar_t cv_reducevfx = Server("reducevfx", "No").yes_no(); +void ReduceVFX_OnChange(void); +consvar_t cv_reducevfx = Server("reducevfx", "No").yes_no().onchange(ReduceVFX_OnChange); + consvar_t cv_screenshake = Server("screenshake", "Full").values({{0, "Off"}, {1, "Half"}, {2, "Full"}}); consvar_t cv_rendezvousserver = Server("holepunchserver", "relay.kartkrew.org"); diff --git a/src/p_maputl.c b/src/p_maputl.c index 5d4a3102b..319e74b17 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -430,7 +430,11 @@ P_GetMidtextureTopBottom { side_t *side = &sides[linedef->sidenum[0]]; fixed_t textop, texbottom, texheight; - INT32 texnum = R_GetTextureNum(side->midtexture); // make sure the texture is actually valid + //Attempt to decouple collision from animation + INT32 texnum = side->midtexture; // make sure the texture is actually valid + //Sanity check on toaster's suggestion + if (texnum < 0 || texnum >= numtextures) + texnum = 0; sector_t *front = linedef->frontsector; sector_t *back = linedef->backsector; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 433450c7b..594f05f2a 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -9547,3 +9547,19 @@ boolean P_MultiSetupWadFiles(boolean fullsetup) partadd_stage++; return false; } + +// +// Let's see if this works +// +void P_ReduceVFXTextureReload(void) +{ + P_InitPicAnims(); +} + +// Let's see if *this* works +extern "C" void ReduceVFX_OnChange(void); +void ReduceVFX_OnChange(void) +{ + P_ReduceVFXTextureReload(); +} + diff --git a/src/p_setup.h b/src/p_setup.h index e338c19ed..fa0b3267e 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -141,6 +141,7 @@ boolean P_MultiSetupWadFiles(boolean fullsetup); SINT8 P_PartialAddGetStage(void); extern UINT16 partadd_earliestfile; +void P_ReduceVFXTextureReload(void); boolean P_RunSOC(const char *socfilename); void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num); diff --git a/src/p_spec.c b/src/p_spec.c index ad65a109d..b376cf23b 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -149,8 +149,8 @@ static void GrowAnimDefs(void) } // A prototype; here instead of p_spec.h, so they're "private" -void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum); -void P_ParseAnimationDefintion(void); +void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum, boolean photosens); +void P_ParseAnimationDefintion(boolean photosens); /** Sets up texture and flat animations. * @@ -176,15 +176,28 @@ void P_InitPicAnims(void) for (w = numwadfiles-1; w >= 0; w--) { UINT16 animdefsLumpNum; + UINT16 photosensLumpNum; // Find ANIMDEFS lump in the WAD animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", w, 0); while (animdefsLumpNum != INT16_MAX) { - P_ParseANIMDEFSLump(w, animdefsLumpNum); + 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 @@ -234,7 +247,7 @@ void P_InitPicAnims(void) animdefs = NULL; } -void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum) +void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum, boolean photosens) { char *animdefsLump; size_t animdefsLumpLength; @@ -267,7 +280,7 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum) if (stricmp(animdefsToken, "TEXTURE") == 0) { Z_Free(animdefsToken); - P_ParseAnimationDefintion(); + P_ParseAnimationDefintion(photosens); } else if (stricmp(animdefsToken, "FLAT") == 0) { @@ -291,7 +304,7 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum) Z_Free((void *)animdefsText); } -void P_ParseAnimationDefintion(void) +void P_ParseAnimationDefintion(boolean photosens) { char *animdefsToken; size_t animdefsTokenLength; @@ -432,6 +445,12 @@ void P_ParseAnimationDefintion(void) { I_Error("Error parsing ANIMDEFS lump: Expected a positive integer for \"%s\"'s animation speed, got \"%s\"", animdefs[i].startname, animdefsToken); } + // Not letting anyone mess up a photosensitivity feature like this. + if ((photosens) && animSpeed < 8) + { + CONS_Alert(CONS_WARNING, M_GetText("RVFXANIM: Animation speed of \"%s\" is less than 8 - automatically set to 8\n"), animdefs[i].startname); + animSpeed = 8; + } animdefs[i].speed = animSpeed; Z_Free(animdefsToken); } diff --git a/src/w_wad.cpp b/src/w_wad.cpp index 19eeef715..188c68283 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -2405,6 +2405,7 @@ int W_VerifyNMUSlumps(const char *filename, boolean exit_on_error) {"MKFNT", 5}, // Kart font changes {"K_", 2}, // Kart graphic changes {"MUSICDEF", 8}, // Kart song definitions + {"RVFXANIM", 8}, // Photosensitivity texture animation changes #ifdef HWRENDER {"SHADERS", 7},