From 2ae510ee7fae9a2844337d1186d2bd434ee0bb72 Mon Sep 17 00:00:00 2001 From: Ivan Avdeev Date: Wed, 22 Dec 2021 23:45:47 -0800 Subject: [PATCH] respect animated textures in ui_infotool 1. include correct current texture 2. print animation chain info relevant for #301 --- ref_vk/camera.c | 21 ++++++++++++++++++--- ref_vk/vk_brush.c | 2 +- ref_vk/vk_brush.h | 2 ++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ref_vk/camera.c b/ref_vk/camera.c index a580198c..5c84e74d 100644 --- a/ref_vk/camera.c +++ b/ref_vk/camera.c @@ -2,6 +2,7 @@ #include "vk_common.h" #include "vk_math.h" #include "vk_textures.h" +#include "vk_brush.h" #include "ref_params.h" #include "pm_movevars.h" @@ -215,13 +216,27 @@ void XVK_CameraDebugPrintCenterEntity( void ) { if (surf && ent && ent->model && ent->model->surfaces) { const int surface_index = surf - ent->model->surfaces; - const int tex_id = surf->texinfo->texture->gl_texturenum; + const texture_t *current_tex = R_TextureAnimation(ent, surf, NULL); + const int tex_id = current_tex->gl_texturenum; const vk_texture_t* const texture = findTexture( tex_id ); + const texture_t *tex = surf->texinfo->texture; p += Q_snprintf(p, end - p, - "surface index: %d; texture: %s\n", - surface_index, texture ? texture->name : "NONE" + "surface index: %d; texture: %s(%d)\n", + surface_index, texture ? texture->name : "NONE", tex_id ); + + if (tex->anim_total > 0 && tex->anim_next) { + tex = tex->anim_next; + p += Q_snprintf(p, end - p, + "anim textures chain (%d):\n", tex->anim_total); + for (int i = 0; i < tex->anim_total && tex; ++i) { + const vk_texture_t *vkt = findTexture(tex->gl_texturenum); + p += Q_snprintf(p, end - p, + "%d: %s(%d)%s\n", i, vkt ? vkt->name : "NONE", tex->gl_texturenum, tex == current_tex ? " <-" : " "); + tex = tex->anim_next; + } + } } gEngine.CL_CenterPrint(buf, 0.5f); } diff --git a/ref_vk/vk_brush.c b/ref_vk/vk_brush.c index ae79c3cb..38bf5b5f 100644 --- a/ref_vk/vk_brush.c +++ b/ref_vk/vk_brush.c @@ -280,7 +280,7 @@ R_TextureAnimation Returns the proper texture for a given time and surface =============== */ -static const texture_t *R_TextureAnimation( const cl_entity_t *ent, const msurface_t *s, const struct texture_s *base_override ) +const texture_t *R_TextureAnimation( const cl_entity_t *ent, const msurface_t *s, const struct texture_s *base_override ) { const texture_t *base = base_override ? base_override : s->texinfo->texture; int count, reletive; diff --git a/ref_vk/vk_brush.h b/ref_vk/vk_brush.h index 5741b681..cdc01ca2 100644 --- a/ref_vk/vk_brush.h +++ b/ref_vk/vk_brush.h @@ -21,3 +21,5 @@ void VK_BrushModelDestroy( struct model_s *mod ); void VK_BrushModelDraw( const struct cl_entity_s *ent, int render_mode ); void VK_BrushStatsClear( void ); + +const texture_t *R_TextureAnimation( const cl_entity_t *ent, const msurface_t *s, const struct texture_s *base_override );