- Blood: Add mechanism to be able to force QAV interpolation based on picnum for testing purposes and not for end-user usage.

This commit is contained in:
Mitchell Richters 2021-08-23 20:54:30 +10:00
parent 2365be7c95
commit 276c000f9f
4 changed files with 23 additions and 17 deletions

View file

@ -87,6 +87,7 @@ CVARD(Bool, cl_bloodvanillabobbing, true, CVAR_ARCHIVE, "enable/disable Blood's
CVARD(Bool, cl_bloodvanillaexplosions, false, CVAR_ARCHIVE, "enable/disable Blood's vanilla explosion behavior")
CVARD(Bool, cl_bloodvanillaenemies, false, CVAR_ARCHIVE, "enable/disable Blood's vanilla enemy behavior")
CVARD(Bool, cl_bloodqavinterp, true, CVAR_ARCHIVE, "enable/disable Blood's QAV interpolation")
CVARD(Bool, cl_bloodqavforcedinterp, false, CVAR_ARCHIVE, "enable/disable Blood's QAV interpolation forcefully for QAVs that aren't defined as interpolatable")
CVARD(Bool, cl_bloodweapinterp, false, CVAR_ARCHIVE, "enable/disable Blood's weapon interpolation. Depends on 'cl_bloodqavinterp'")
CVARD(Bool, cl_bloodoldweapbalance, false, CVAR_ARCHIVE, "enable/disable legacy 1.0 weapon handling for Blood")

View file

@ -32,6 +32,7 @@ EXTERN_CVAR(Bool, cl_bloodvanillabobbing)
EXTERN_CVAR(Bool, cl_bloodvanillaexplosions)
EXTERN_CVAR(Bool, cl_bloodvanillaenemies)
EXTERN_CVAR(Bool, cl_bloodqavinterp)
EXTERN_CVAR(Bool, cl_bloodqavforcedinterp)
EXTERN_CVAR(Bool, cl_bloodweapinterp)
EXTERN_CVAR(Bool, cl_bloodoldweapbalance)

View file

@ -45,6 +45,22 @@ enum
kQAVIsLoopable = 1 << 0,
};
using QAVPrevTileFinder = TILE_FRAME* (*)(FRAMEINFO* const thisFrame, FRAMEINFO* const prevFrame, const int& i);
struct QAVInterpProps
{
int flags;
QAVPrevTileFinder PrevTileFinder;
TMap<int, TArray<int>> IgnoreData;
bool CanInterpFrameTile(const int& nFrame, const int& i)
{
// Check whether the current frame's tile is skippable.
auto thisFrame = IgnoreData.CheckKey(nFrame);
return thisFrame ? !thisFrame->Contains(i) : true;
}
};
static TMap<FString, QAVPrevTileFinder> qavPrevTileFinders;
static TMap<int, QAVInterpProps> qavInterpProps;
@ -139,11 +155,15 @@ void DrawFrame(double x, double y, double z, double a, TILE_FRAME *pTile, int st
}
}
static QAVInterpProps forcedinterpdata{ 0, qavGetInterpType("picnum") };
void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio)
{
assert(ticksPerFrame > 0);
auto const interpdata = qavInterpProps.CheckKey(res_id);
QAVInterpProps* interpdata = qavInterpProps.CheckKey(res_id);
if (!interpdata && cl_bloodqavforcedinterp) interpdata = &forcedinterpdata;
auto const nFrame = clamp(ticks / ticksPerFrame, 0, nFrames - 1);
FRAMEINFO* const thisFrame = &frames[nFrame];

View file

@ -238,22 +238,6 @@ struct QAV
void Precache(int palette = 0);
};
using QAVPrevTileFinder = TILE_FRAME* (*)(FRAMEINFO* const thisFrame, FRAMEINFO* const prevFrame, const int& i);
struct QAVInterpProps
{
int flags;
QAVPrevTileFinder PrevTileFinder;
TMap<int, TArray<int>> IgnoreData;
bool CanInterpFrameTile(const int& nFrame, const int& i)
{
// Check whether the current frame's tile is skippable.
auto thisFrame = IgnoreData.CheckKey(nFrame);
return thisFrame ? !thisFrame->Contains(i) : true;
}
};
QAV* getQAV(int res_id);
void qavProcessTicker(QAV* const pQAV, int* duration, int* lastTick);
void qavProcessTimer(PLAYER* const pPlayer, QAV* const pQAV, int* duration, double* smoothratio, bool const fixedduration = false);