more misc animation fixes

This commit is contained in:
Ricardo Luís Vaz Silva 2025-02-04 17:36:01 -03:00
commit eb7c99b34a
2 changed files with 43 additions and 34 deletions

View file

@ -147,7 +147,7 @@ void RenderModel(FModelRenderer *renderer, float x, float y, float z, FSpriteMod
// so we make the "undistorted" behavior opt-in
if (smf_flags & MDL_CORRECTPIXELSTRETCH)
{
stretch = (smf->modelIDs[0] != -1 ? Models[smf->modelIDs[0]]->getAspectFactor(actor->Level->info->pixelstretch) : 1.f) / actor->Level->info->pixelstretch;
stretch = (smf->modelIDs[0] >= 0 ? Models[smf->modelIDs[0]]->getAspectFactor(actor->Level->info->pixelstretch) : 1.f) / actor->Level->info->pixelstretch;
objectToWorldMatrix.scale(1, stretch, 1);
}
@ -188,7 +188,7 @@ void RenderModel(FModelRenderer *renderer, float x, float y, float z, FSpriteMod
if (!(smf_flags & MDL_CORRECTPIXELSTRETCH))
{
stretch = (smf->modelIDs[0] != -1 ? Models[smf->modelIDs[0]]->getAspectFactor(actor->Level->info->pixelstretch) : 1.f) / actor->Level->info->pixelstretch;
stretch = (smf->modelIDs[0] >= 0 ? Models[smf->modelIDs[0]]->getAspectFactor(actor->Level->info->pixelstretch) : 1.f) / actor->Level->info->pixelstretch;
objectToWorldMatrix.scale(1, stretch, 1);
}
@ -396,7 +396,6 @@ void RenderFrameModels(FModelRenderer *renderer, FLevelLocals *Level, const FSpr
TArray<FTextureID> surfaceskinids;
const TArray<VSMatrix> *boneData;
int boneStartingPosition = -1;
bool evaluatedSingle = false;
@ -522,9 +521,11 @@ void RenderFrameModels(FModelRenderer *renderer, FLevelLocals *Level, const FSpr
bool nextFrame = smfNext && modelframe != modelframenext;
// [RL0] while per-model animations aren't done, DECOUPLEDANIMATIONS does the same as MODELSAREATTACHMENTS
if(!evaluatedSingle)
{
const TArray<VSMatrix> *boneData = nullptr;
FModel* animation = mdl;
const TArray<TRS>* animationData = nullptr;
@ -536,7 +537,7 @@ void RenderFrameModels(FModelRenderer *renderer, FLevelLocals *Level, const FSpr
if(is_decoupled)
{
if(decoupled_frame.frame1 != -1)
if(decoupled_frame.frame1 >= 0)
{
boneData = animation->CalculateBones(actor->modelData->prevAnim, decoupled_frame, inter, animationData);
}
@ -551,8 +552,6 @@ void RenderFrameModels(FModelRenderer *renderer, FLevelLocals *Level, const FSpr
boneStartingPosition = boneData ? screen->mBones->UploadBones(*boneData) : -1;
evaluatedSingle = true;
}
boneData = nullptr;
}
mdl->RenderFrame(renderer, tex, modelframe, nextFrame ? modelframenext : modelframe, nextFrame ? inter : -1.f, translation, ssidp, boneStartingPosition);
@ -986,10 +985,10 @@ void ParseModelDefLump(int Lump)
if (isframe)
{
sc.MustGetString();
if (smf.modelIDs[index] != -1)
if (smf.modelIDs[index] >= 0)
{
FModel *model = Models[smf.modelIDs[index]];
if (smf.animationIDs[index] != -1)
if (smf.animationIDs[index] >= 0)
{
model = Models[smf.animationIDs[index]];
}