From 293f724eb2c254335bea911d1e2060a29a5cf7de Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 4 Jan 2016 18:20:35 +0000 Subject: [PATCH] Unbreak Nexuiz weapon animation. 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 | 6 ++++++ prvm_cmds.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/model_sprite.c b/model_sprite.c index 33117f68..9b8bab23 100644 --- a/model_sprite.c +++ b/model_sprite.c @@ -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); + // 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); } @@ -479,5 +482,8 @@ void Mod_IDS2_Load(dp_model_t *mod, void *buffer, void *bufferend) 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); } diff --git a/prvm_cmds.c b/prvm_cmds.c index e1b248dd..98f819c8 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -99,7 +99,10 @@ void VM_FrameBlendFromFrameGroupBlend(frameblend_t *frameblend, const framegroup 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; -- 2.39.2