]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Unbreak Nexuiz weapon animation.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 4 Jan 2016 18:20:35 +0000 (18:20 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 4 Jan 2016 18:20:35 +0000 (18:20 +0000)
Nexuiz uses h_*.dpm models that are mostly vertex-less (there are 6 dummy ones)
and merely move bones in order to move around the first-person weapon.

This means that these models (or rather, their surface meshes) will be
considered "non-animated" by the rendering code, given their dummy vertices are
never moved by animations.

However, a function to build animation subframes lists from animation group
numbers - which is called by gettaginfo and similar functions that locate
attachment points - falsely looked at the isanimated flag of the surface mesh
to decide whether to really build the list of subframes or not - and this was
wrong, given that statically displayed models that do move tags/bones do exist!

This commit removes this use of the isanimated flag and treats models with
animated and non-animated surface mesh the same for purposes of animation frame
evaluation.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12241 d7cf8633-e32d-0410-b094-e92efae38249

model_sprite.c
prvm_cmds.c

index 33117f6803a15fc13c5645c3155c8754a90af84b..9b8bab23b1aa03a115afd0efef6e0ffa7fbddf8e 100644 (file)
@@ -371,6 +371,9 @@ void Mod_IDSP_Load(dp_model_t *mod, void *buffer, void *bufferend)
                Host_Error("Mod_IDSP_Load: %s has wrong version number (%i). Only %i (quake), %i (HalfLife), and %i (sprite32) supported",
                                        loadmodel->name, version, SPRITE_VERSION, SPRITEHL_VERSION, SPRITE32_VERSION);
 
                Host_Error("Mod_IDSP_Load: %s has wrong version number (%i). Only %i (quake), %i (HalfLife), and %i (sprite32) supported",
                                        loadmodel->name, version, SPRITE_VERSION, SPRITEHL_VERSION, SPRITE32_VERSION);
 
+       // TODO: Note that isanimated only means whether vertices change due to
+       // the animation. This may happen due to sprframe parameters changing.
+       // Mere texture chanegs OTOH shouldn't require isanimated to be 1.
        loadmodel->surfmesh.isanimated = loadmodel->numframes > 1 || (loadmodel->animscenes && loadmodel->animscenes[0].framecount > 1);
 }
 
        loadmodel->surfmesh.isanimated = loadmodel->numframes > 1 || (loadmodel->animscenes && loadmodel->animscenes[0].framecount > 1);
 }
 
@@ -479,5 +482,8 @@ void Mod_IDS2_Load(dp_model_t *mod, void *buffer, void *bufferend)
        loadmodel->radius = modelradius;
        loadmodel->radius2 = modelradius * modelradius;
 
        loadmodel->radius = modelradius;
        loadmodel->radius2 = modelradius * modelradius;
 
+       // TODO: Note that isanimated only means whether vertices change due to
+       // the animation. This may happen due to sprframe parameters changing.
+       // Mere texture chanegs OTOH shouldn't require isanimated to be 1.
        loadmodel->surfmesh.isanimated = loadmodel->numframes > 1 || (loadmodel->animscenes && loadmodel->animscenes[0].framecount > 1);
 }
        loadmodel->surfmesh.isanimated = loadmodel->numframes > 1 || (loadmodel->animscenes && loadmodel->animscenes[0].framecount > 1);
 }
index e1b248dd0169b05f10aa33ea16a110a746969751..98f819c8bd9ae01296834dee20389ee164f0f1c4 100644 (file)
@@ -99,7 +99,10 @@ void VM_FrameBlendFromFrameGroupBlend(frameblend_t *frameblend, const framegroup
 
        memset(blend, 0, MAX_FRAMEBLENDS * sizeof(*blend));
 
 
        memset(blend, 0, MAX_FRAMEBLENDS * sizeof(*blend));
 
-       if (!model || !model->surfmesh.isanimated)
+       // rpolzer: Not testing isanimated here - a model might have
+       // "animations" that move no vertices (but only bones), thus rendering
+       // may assume it's not animated while processing can't.
+       if (!model)
        {
                blend[0].lerp = 1;
                return;
        {
                blend[0].lerp = 1;
                return;