diff --git a/include/QF/skin.h b/include/QF/skin.h index b66a54092..608c3412f 100644 --- a/include/QF/skin.h +++ b/include/QF/skin.h @@ -58,8 +58,8 @@ void Skin_NextDownload (void); void Skin_Init (void); void Skin_Init_Cvars (void); void Skin_Init_Translation (void); -void Skin_Set_Translate (struct player_info_s *player); -void Skin_Do_Translation (struct player_info_s *player); +void Skin_Set_Translate (int top, int bottom, byte *dest); +void Skin_Do_Translation (skin_t *player_skin, int slot); void Skin_Process (skin_t *skin, struct tex_s *); #endif diff --git a/qw/source/gl_skin.c b/qw/source/gl_skin.c index fed3b4383..bf7d5ac71 100644 --- a/qw/source/gl_skin.c +++ b/qw/source/gl_skin.c @@ -34,24 +34,21 @@ #include "QF/skin.h" #include "QF/sys.h" #include "QF/texture.h" +#include "QF/vid.h" -#include "client.h" #include "glquake.h" -#include "host.h" -#include "protocol.h" +#include "render.h" static byte translate[256]; static unsigned int translate32[256]; void -Skin_Set_Translate (player_info_t *player) +Skin_Set_Translate (int top, int bottom, byte *dest) { - int top; - int bottom; int i; - top = bound (0, player->topcolor, 13) * 16; - bottom = bound (0, player->bottomcolor, 13) * 16; + top = bound (0, top, 13) * 16; + bottom = bound (0, bottom, 13) * 16; for (i = 0; i < 16; i++) { if (top < 128) // the artists made some backwards @@ -171,17 +168,14 @@ build_skin (int texnum, byte *ptexels, int width, int height, qboolean alpha) } void -Skin_Do_Translation (player_info_t *player) +Skin_Do_Translation (skin_t *player_skin, int slot) { int texnum; int inwidth, inheight; byte *original; tex_t *skin; - if (!player->skin) - Skin_Find (player); - - if ((skin = (tex_t*)Skin_Cache (player->skin)) != NULL) { + if ((skin = (tex_t*)Skin_Cache (player_skin)) != NULL) { // skin data width inwidth = 320; inheight = 200; @@ -191,7 +185,7 @@ Skin_Do_Translation (player_info_t *player) inwidth = 296; inheight = 194; } - texnum = playertextures + (player - cl.players); + texnum = playertextures + slot; build_skin (texnum, original, inwidth, inheight, false); } diff --git a/qw/source/skin.c b/qw/source/skin.c index 273ef516d..828dd3d5c 100644 --- a/qw/source/skin.c +++ b/qw/source/skin.c @@ -40,9 +40,11 @@ #include "QF/compat.h" #include "QF/console.h" #include "QF/hash.h" +#include "QF/info.h" #include "QF/msg.h" #include "QF/pcx.h" #include "QF/qendian.h" +#include "QF/quakefs.h" #include "QF/screen.h" #include "QF/skin.h" #include "QF/sys.h" @@ -362,7 +364,10 @@ CL_NewTranslation (int slot) player->_topcolor = player->topcolor; player->_bottomcolor = player->bottomcolor; - Skin_Set_Translate (player); - Skin_Do_Translation (player); + Skin_Set_Translate (player->topcolor, player->bottomcolor, + player->translations); + if (!player->skin) + Skin_Find (player); + Skin_Do_Translation (player->skin, slot); } } diff --git a/qw/source/sw_skin.c b/qw/source/sw_skin.c index d47fbbc38..7d037e4d1 100644 --- a/qw/source/sw_skin.c +++ b/qw/source/sw_skin.c @@ -41,22 +41,19 @@ #include "QF/sys.h" #include "QF/vid.h" -#include "client.h" -#include "host.h" +#include "render.h" void -Skin_Set_Translate (player_info_t *player) +Skin_Set_Translate (int top, int bottom, byte *dest) { int i, j; - int top, bottom; - byte *dest, *source; + byte *source; - top = bound (0, player->topcolor, 13) * 16; - bottom = bound (0, player->bottomcolor, 13) * 16; + top = bound (0, top, 13) * 16; + bottom = bound (0, bottom, 13) * 16; - dest = player->translations; source = vid.colormap; - memcpy (dest, vid.colormap, sizeof (player->translations)); + memcpy (dest, vid.colormap, VID_GRADES*256); for (i = 0; i < VID_GRADES; i++, dest += 256, source += 256) { if (top < 128) // the artists made some backwards @@ -75,7 +72,7 @@ Skin_Set_Translate (player_info_t *player) } void -Skin_Do_Translation (player_info_t *player) +Skin_Do_Translation (skin_t *player_skin, int slot) { }