clean up *_skin.c's header dependencies

This commit is contained in:
Bill Currie 2001-05-11 21:23:43 +00:00
parent 86b2363244
commit 74f734df67
4 changed files with 24 additions and 28 deletions

View file

@ -58,8 +58,8 @@ void Skin_NextDownload (void);
void Skin_Init (void); void Skin_Init (void);
void Skin_Init_Cvars (void); void Skin_Init_Cvars (void);
void Skin_Init_Translation (void); void Skin_Init_Translation (void);
void Skin_Set_Translate (struct player_info_s *player); void Skin_Set_Translate (int top, int bottom, byte *dest);
void Skin_Do_Translation (struct player_info_s *player); void Skin_Do_Translation (skin_t *player_skin, int slot);
void Skin_Process (skin_t *skin, struct tex_s *); void Skin_Process (skin_t *skin, struct tex_s *);
#endif #endif

View file

@ -34,24 +34,21 @@
#include "QF/skin.h" #include "QF/skin.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "QF/texture.h" #include "QF/texture.h"
#include "QF/vid.h"
#include "client.h"
#include "glquake.h" #include "glquake.h"
#include "host.h" #include "render.h"
#include "protocol.h"
static byte translate[256]; static byte translate[256];
static unsigned int translate32[256]; static unsigned int translate32[256];
void void
Skin_Set_Translate (player_info_t *player) Skin_Set_Translate (int top, int bottom, byte *dest)
{ {
int top;
int bottom;
int i; int i;
top = bound (0, player->topcolor, 13) * 16; top = bound (0, top, 13) * 16;
bottom = bound (0, player->bottomcolor, 13) * 16; bottom = bound (0, bottom, 13) * 16;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if (top < 128) // the artists made some backwards 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 void
Skin_Do_Translation (player_info_t *player) Skin_Do_Translation (skin_t *player_skin, int slot)
{ {
int texnum; int texnum;
int inwidth, inheight; int inwidth, inheight;
byte *original; byte *original;
tex_t *skin; tex_t *skin;
if (!player->skin) if ((skin = (tex_t*)Skin_Cache (player_skin)) != NULL) {
Skin_Find (player);
if ((skin = (tex_t*)Skin_Cache (player->skin)) != NULL) {
// skin data width // skin data width
inwidth = 320; inwidth = 320;
inheight = 200; inheight = 200;
@ -191,7 +185,7 @@ Skin_Do_Translation (player_info_t *player)
inwidth = 296; inwidth = 296;
inheight = 194; inheight = 194;
} }
texnum = playertextures + (player - cl.players); texnum = playertextures + slot;
build_skin (texnum, original, inwidth, inheight, false); build_skin (texnum, original, inwidth, inheight, false);
} }

View file

@ -40,9 +40,11 @@
#include "QF/compat.h" #include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/hash.h" #include "QF/hash.h"
#include "QF/info.h"
#include "QF/msg.h" #include "QF/msg.h"
#include "QF/pcx.h" #include "QF/pcx.h"
#include "QF/qendian.h" #include "QF/qendian.h"
#include "QF/quakefs.h"
#include "QF/screen.h" #include "QF/screen.h"
#include "QF/skin.h" #include "QF/skin.h"
#include "QF/sys.h" #include "QF/sys.h"
@ -362,7 +364,10 @@ CL_NewTranslation (int slot)
player->_topcolor = player->topcolor; player->_topcolor = player->topcolor;
player->_bottomcolor = player->bottomcolor; player->_bottomcolor = player->bottomcolor;
Skin_Set_Translate (player); Skin_Set_Translate (player->topcolor, player->bottomcolor,
Skin_Do_Translation (player); player->translations);
if (!player->skin)
Skin_Find (player);
Skin_Do_Translation (player->skin, slot);
} }
} }

View file

@ -41,22 +41,19 @@
#include "QF/sys.h" #include "QF/sys.h"
#include "QF/vid.h" #include "QF/vid.h"
#include "client.h" #include "render.h"
#include "host.h"
void void
Skin_Set_Translate (player_info_t *player) Skin_Set_Translate (int top, int bottom, byte *dest)
{ {
int i, j; int i, j;
int top, bottom; byte *source;
byte *dest, *source;
top = bound (0, player->topcolor, 13) * 16; top = bound (0, top, 13) * 16;
bottom = bound (0, player->bottomcolor, 13) * 16; bottom = bound (0, bottom, 13) * 16;
dest = player->translations;
source = vid.colormap; 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) { for (i = 0; i < VID_GRADES; i++, dest += 256, source += 256) {
if (top < 128) // the artists made some backwards if (top < 128) // the artists made some backwards
@ -75,7 +72,7 @@ Skin_Set_Translate (player_info_t *player)
} }
void void
Skin_Do_Translation (player_info_t *player) Skin_Do_Translation (skin_t *player_skin, int slot)
{ {
} }