From f7b4dffcc0fe7f13b3e9473d4cd7a190e897641f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 13 Sep 2002 05:32:28 +0000 Subject: [PATCH] get larger player skins working in gl --- include/QF/skin.h | 3 ++- libs/models/alias/gl_model_alias.c | 2 +- libs/video/renderer/gl/gl_skin.c | 27 ++++++++++++++++++++++++--- libs/video/renderer/sw/sw_skin.c | 6 ++++++ libs/video/renderer/sw32/sw32_skin.c | 5 +++++ qw/source/cl_parse.c | 7 ++++--- 6 files changed, 42 insertions(+), 8 deletions(-) diff --git a/include/QF/skin.h b/include/QF/skin.h index b8848d40d..064d9eb48 100644 --- a/include/QF/skin.h +++ b/include/QF/skin.h @@ -50,7 +50,7 @@ typedef struct skin_s int numfb; } skin_t; -extern byte player_8bit_texels[320 * 200]; +extern byte player_8bit_texels[640 * 400]; extern skin_t skin_cache[MAX_CACHED_SKINS]; extern int skin_textures; extern int skin_fb_textures; @@ -70,6 +70,7 @@ void Skin_Set_Translate (int top, int bottom, void *_dest); void Skin_Do_Translation (skin_t *player_skin, int slot, skin_t *skin); void Skin_Do_Translation_Model (struct model_s *model, int skinnum, int slot, skin_t *skin); +void Skin_Player_Model (struct model_s *model); void Skin_Process (skin_t *skin, struct tex_s *); skin_t *Skin_NewTempSkin (void); diff --git a/libs/models/alias/gl_model_alias.c b/libs/models/alias/gl_model_alias.c index 8fbf1eb0b..ae38c2274 100644 --- a/libs/models/alias/gl_model_alias.c +++ b/libs/models/alias/gl_model_alias.c @@ -52,7 +52,7 @@ static const char rcsid[] = #include "compat.h" -byte player_8bit_texels[320 * 200]; +byte player_8bit_texels[640 * 400]; // a pose is a single set of vertexes. a frame may be diff --git a/libs/video/renderer/gl/gl_skin.c b/libs/video/renderer/gl/gl_skin.c index 4832ebf40..3e5091b04 100644 --- a/libs/video/renderer/gl/gl_skin.c +++ b/libs/video/renderer/gl/gl_skin.c @@ -52,6 +52,8 @@ static const char rcsid[] = static byte translate[256]; static unsigned int translate32[256]; +static int player_width = 296; +static int player_height = 194; void Skin_Set_Translate (int top, int bottom, void *_dest) @@ -191,10 +193,11 @@ Skin_Do_Translation (skin_t *player_skin, int slot, skin_t *skin) original = skin_texels->data; } else { original = player_8bit_texels; - inwidth = 296; - inheight = 194; + inwidth = player_width; + inheight = player_height; } - build_skin (texnum, original, inwidth, inheight, 296, 194, false); + build_skin (texnum, original, inwidth, inheight, + player_width, player_height, false); } void @@ -231,6 +234,24 @@ Skin_Do_Translation_Model (model_t *model, int skinnum, int slot, skin_t *skin) Cache_Release (&model->cache); } +void +Skin_Player_Model (model_t *model) +{ + aliashdr_t *paliashdr; + + player_width = 296; + player_height = 194; + if (!model) // player doesn't have a model yet + return; + if (model->type != mod_alias) // only translate skins on alias models + return; + + paliashdr = Cache_Get (&model->cache); + player_width = paliashdr->mdl.skinwidth; + player_height = paliashdr->mdl.skinheight; + Cache_Release (&model->cache); +} + void Skin_Init_Translation (void) { diff --git a/libs/video/renderer/sw/sw_skin.c b/libs/video/renderer/sw/sw_skin.c index 840f8a728..44a380b4c 100644 --- a/libs/video/renderer/sw/sw_skin.c +++ b/libs/video/renderer/sw/sw_skin.c @@ -88,6 +88,12 @@ Skin_Do_Translation_Model (model_t *model, int skinnum, int slot, skin_t *skin) } +void +Skin_Player_Model (model_t *model) +{ +} + + void Skin_Init_Translation (void) { diff --git a/libs/video/renderer/sw32/sw32_skin.c b/libs/video/renderer/sw32/sw32_skin.c index 5d25bd1dc..56cb4442c 100644 --- a/libs/video/renderer/sw32/sw32_skin.c +++ b/libs/video/renderer/sw32/sw32_skin.c @@ -181,7 +181,12 @@ Skin_Do_Translation (skin_t *player_skin, int slot, skin_t *skin) void Skin_Do_Translation_Model (model_t *model, int skinnum, int slot, skin_t *skin) { +} + +void +Skin_Player_Model (model_t *model) +{ } void diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index 212c5586d..6eb036beb 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -308,15 +308,16 @@ Model_NextDownload (void) } if (strequal (cl.model_name[i], "progs/player.mdl") - && cl.model_precache[i]->type == mod_alias) + && cl.model_precache[i]->type == mod_alias) { info_key = pmodel_name; + Skin_Player_Model (cl.model_precache[i]); + } if (strequal (cl.model_name[i], "progs/eyes.mdl") && cl.model_precache[i]->type == mod_alias) info_key = emodel_name; if (info_key && cl_model_crcs->int_val) { - aliashdr_t *ahdr = Cache_Get - (&cl.model_precache[i]->cache); + aliashdr_t *ahdr = Cache_Get (&cl.model_precache[i]->cache); Info_SetValueForKey (cls.userinfo, info_key, va ("%d", ahdr->crc), 0); MSG_WriteByte (&cls.netchan.message, clc_stringcmd);