From 301e822944a45d6fd654aa6a0f75cc01f03261fb Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Wed, 24 Jun 2020 01:03:59 +0000 Subject: [PATCH] Don't lerp nailgun and super nailgun. Trades smoothness for better muzzle flash Added a cvar to define models that should not be lerped. Taken from Quakespasm. Todo: Use a proper EF_ flag git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12724 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 6 ++++++ model_alias.c | 5 ++++- model_shared.h | 2 ++ prvm_cmds.c | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index 2bb72a67..a205c10d 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -204,6 +204,7 @@ cvar_t r_water_hideplayer = {CVAR_CLIENT | CVAR_SAVE, "r_water_hideplayer", "0", cvar_t r_lerpsprites = {CVAR_CLIENT | CVAR_SAVE, "r_lerpsprites", "0", "enables animation smoothing on sprites"}; cvar_t r_lerpmodels = {CVAR_CLIENT | CVAR_SAVE, "r_lerpmodels", "1", "enables animation smoothing on models"}; +cvar_t r_nolerp_list = {CVAR_CLIENT | CVAR_SAVE, "r_nolerp_list", "progs/v_nail.mdl,progs/v_nail2.mdl,progs/flame.mdl,progs/flame2.mdl,progs/braztall.mdl,progs/brazshrt.mdl,progs/longtrch.mdl,progs/flame_pyre.mdl,progs/v_saw.mdl,progs/v_xfist.mdl,progs/h2stuff/newfire.mdl", "comma separated list of models that will not have their animations smoothed"}; cvar_t r_lerplightstyles = {CVAR_CLIENT | CVAR_SAVE, "r_lerplightstyles", "0", "enable animation smoothing on flickering lights"}; cvar_t r_waterscroll = {CVAR_CLIENT | CVAR_SAVE, "r_waterscroll", "1", "makes water scroll around, value controls how much"}; @@ -3420,6 +3421,7 @@ void GL_Main_Init(void) Cvar_RegisterVariable(&r_lerpsprites); Cvar_RegisterVariable(&r_lerpmodels); + Cvar_RegisterVariable(&r_nolerp_list); Cvar_RegisterVariable(&r_lerplightstyles); Cvar_RegisterVariable(&r_waterscroll); Cvar_RegisterVariable(&r_bloom); @@ -9473,6 +9475,8 @@ static void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldor surfaceindex = bih_surfaces[triangleindex]; surface = surfaces + surfaceindex; texture = surface->texture; + if (!texture) + continue; if (texture->currentmaterialflags & (MATERIALFLAG_BLENDED | MATERIALFLAG_NODEPTHTEST | MATERIALFLAG_SKY | MATERIALFLAG_SHORTDEPTHRANGE | MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION)) continue; if (texture->surfaceflags & Q3SURFACEFLAG_NOMARKS) @@ -9491,6 +9495,8 @@ static void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldor continue; // skip transparent surfaces texture = surface->texture; + if (!texture) + continue; if (texture->currentmaterialflags & (MATERIALFLAG_BLENDED | MATERIALFLAG_NODEPTHTEST | MATERIALFLAG_SKY | MATERIALFLAG_SHORTDEPTHRANGE | MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION)) continue; if (texture->surfaceflags & Q3SURFACEFLAG_NOMARKS) diff --git a/model_alias.c b/model_alias.c index be300a1b..04bc821f 100644 --- a/model_alias.c +++ b/model_alias.c @@ -966,7 +966,7 @@ void Mod_BuildAliasSkinsFromSkinFiles(texture_t *skin, skinfile_t *skinfile, con Mod_LoadTextureFromQ3Shader(loadmodel->mempool, loadmodel->name, skin, stripbuf, true, true, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PICMIP | TEXF_COMPRESS, MATERIALFLAG_WALL); } } - +extern cvar_t r_nolerp_list; #define BOUNDI(VALUE,MIN,MAX) if (VALUE < MIN || VALUE >= MAX) Host_Error("model %s has an invalid ##VALUE (%d exceeds %d - %d)", loadmodel->name, VALUE, MIN, MAX); #define BOUNDF(VALUE,MIN,MAX) if (VALUE < MIN || VALUE >= MAX) Host_Error("model %s has an invalid ##VALUE (%f exceeds %f - %f)", loadmodel->name, VALUE, MIN, MAX); void Mod_IDP0_Load(dp_model_t *mod, void *buffer, void *bufferend) @@ -1044,6 +1044,9 @@ void Mod_IDP0_Load(dp_model_t *mod, void *buffer, void *bufferend) i = LittleLong (pinmodel->flags); loadmodel->effects = ((i & 255) << 24) | (i & 0x00FFFF00); + if (strstr(r_nolerp_list.string, loadmodel->name)) + loadmodel->nolerp = true; + for (i = 0;i < 3;i++) { loadmodel->surfmesh.num_morphmdlframescale[i] = LittleFloat (pinmodel->scale[i]); diff --git a/model_shared.h b/model_shared.h index 0226e701..03456a02 100644 --- a/model_shared.h +++ b/model_shared.h @@ -1060,6 +1060,8 @@ typedef struct model_s // if set, the model contains light information (lightmap, or vertexlight) qboolean lit; float lightmapscale; + + qboolean nolerp; } dp_model_t; diff --git a/prvm_cmds.c b/prvm_cmds.c index 2723076c..81898814 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -108,7 +108,7 @@ void VM_FrameBlendFromFrameGroupBlend(frameblend_t *frameblend, const framegroup return; } - nolerp = (model->type == mod_sprite) ? !r_lerpsprites.integer : !r_lerpmodels.integer; + nolerp = ((model->type == mod_sprite) ? !r_lerpsprites.integer : !r_lerpmodels.integer) || (model->nolerp == true); numframes = model->numframes; for (k = 0, g = framegroupblend;k < MAX_FRAMEGROUPBLENDS;k++, g++) { -- 2.39.2