respect animated textures in ui_infotool

1. include correct current texture
2. print animation chain info

relevant for #301
This commit is contained in:
Ivan Avdeev 2021-12-22 23:45:47 -08:00
parent 7e90b07288
commit 2ae510ee7f
3 changed files with 21 additions and 4 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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 );