Add alternate ANIMDEF lump, RVFXANIM, for altering texture animation speed when reducevfx is on.

This commit is contained in:
Freaky Mutant Man 2025-09-01 19:03:10 +00:00 committed by Eidolon
parent 2cc8b2a28d
commit acc6c0b52f
6 changed files with 51 additions and 8 deletions

View file

@ -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");

View file

@ -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;

View file

@ -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();
}

View file

@ -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);

View file

@ -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);
}

View file

@ -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},