mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-03-13 11:43:29 +00:00
more skin cleanups
This commit is contained in:
parent
45bacc2b60
commit
aab3c199a2
5 changed files with 170 additions and 167 deletions
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
|
extern byte player_8bit_texels[320 * 200];
|
||||||
|
|
||||||
void Skin_Find (player_info_t *sc);
|
void Skin_Find (player_info_t *sc);
|
||||||
byte *Skin_Cache (skin_t *skin);
|
byte *Skin_Cache (skin_t *skin);
|
||||||
void Skin_Skins_f (void);
|
void Skin_Skins_f (void);
|
||||||
|
@ -38,6 +40,9 @@ void Skin_AllSkins_f (void);
|
||||||
void Skin_NextDownload (void);
|
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_Set_Translate (player_info_t *player);
|
||||||
|
void Skin_Do_Translation (player_info_t *player);
|
||||||
|
|
||||||
#define RSSHOT_WIDTH 320
|
#define RSSHOT_WIDTH 320
|
||||||
#define RSSHOT_HEIGHT 200
|
#define RSSHOT_HEIGHT 200
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "qendian.h"
|
#include "qendian.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
#include "skin.h"
|
||||||
|
|
||||||
extern model_t *loadmodel;
|
extern model_t *loadmodel;
|
||||||
|
|
||||||
|
@ -66,8 +67,6 @@ extern mtriangle_t triangles[MAXALIASTRIS];
|
||||||
extern trivertx_t *poseverts[MAXALIASFRAMES];
|
extern trivertx_t *poseverts[MAXALIASFRAMES];
|
||||||
extern int posenum;
|
extern int posenum;
|
||||||
|
|
||||||
byte player_8bit_texels[320 * 200];
|
|
||||||
|
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -36,56 +36,18 @@
|
||||||
#include "skin.h"
|
#include "skin.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
/*
|
byte player_8bit_texels[320 * 200];
|
||||||
=====================
|
static byte translate[256];
|
||||||
CL_NewTranslation
|
|
||||||
=====================
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
CL_NewTranslation (int slot)
|
Skin_Set_Translate (player_info_t *player)
|
||||||
{
|
{
|
||||||
int top, bottom;
|
int top;
|
||||||
byte translate[256];
|
int bottom;
|
||||||
unsigned int translate32[256];
|
int i;
|
||||||
int i, j;
|
|
||||||
byte *original;
|
|
||||||
unsigned int pixels[512 * 256], *out;
|
|
||||||
unsigned int scaled_width, scaled_height;
|
|
||||||
int inwidth, inheight;
|
|
||||||
int tinwidth, tinheight;
|
|
||||||
byte *inrow;
|
|
||||||
unsigned int frac, fracstep;
|
|
||||||
player_info_t *player;
|
|
||||||
extern byte player_8bit_texels[320 * 200];
|
|
||||||
char s[512];
|
|
||||||
int playernum = slot;
|
|
||||||
|
|
||||||
if (slot > MAX_CLIENTS)
|
top = bound (0, player->topcolor, 13) * 16;
|
||||||
Host_EndGame ("CL_NewTranslation: slot > MAX_CLIENTS");
|
bottom = bound (0, player->bottomcolor, 13) * 16;
|
||||||
|
|
||||||
player = &cl.players[playernum];
|
|
||||||
if (!player->name[0])
|
|
||||||
return;
|
|
||||||
|
|
||||||
strcpy (s, Info_ValueForKey (player->userinfo, "skin"));
|
|
||||||
COM_StripExtension (s, s);
|
|
||||||
if (player->skin && !strequal (s, player->skin->name))
|
|
||||||
player->skin = NULL;
|
|
||||||
|
|
||||||
if (player->_topcolor != player->topcolor ||
|
|
||||||
player->_bottomcolor != player->bottomcolor || !player->skin) {
|
|
||||||
player->_topcolor = player->topcolor;
|
|
||||||
player->_bottomcolor = player->bottomcolor;
|
|
||||||
|
|
||||||
top = player->topcolor;
|
|
||||||
bottom = player->bottomcolor;
|
|
||||||
top = (top < 0) ? 0 : ((top > 13) ? 13 : top);
|
|
||||||
bottom = (bottom < 0) ? 0 : ((bottom > 13) ? 13 : bottom);
|
|
||||||
top *= 16;
|
|
||||||
bottom *= 16;
|
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
translate[i] = i;
|
|
||||||
|
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
if (top < 128) // the artists made some backwards ranges. sigh.
|
if (top < 128) // the artists made some backwards ranges. sigh.
|
||||||
|
@ -98,6 +60,20 @@ CL_NewTranslation (int slot)
|
||||||
else
|
else
|
||||||
translate[BOTTOM_RANGE + i] = bottom + 15 - i;
|
translate[BOTTOM_RANGE + i] = bottom + 15 - i;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Skin_Do_Translation (player_info_t *player)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
int inwidth, inheight;
|
||||||
|
int tinwidth, tinheight;
|
||||||
|
unsigned int scaled_width, scaled_height;
|
||||||
|
unsigned int frac, fracstep;
|
||||||
|
unsigned int translate32[256];
|
||||||
|
byte *original;
|
||||||
|
unsigned int pixels[512 * 256], *out;
|
||||||
|
byte *inrow;
|
||||||
|
|
||||||
// locate the original skin pixels
|
// locate the original skin pixels
|
||||||
tinwidth = 296; // real model width
|
tinwidth = 296; // real model width
|
||||||
|
@ -117,7 +93,7 @@ CL_NewTranslation (int slot)
|
||||||
|
|
||||||
// because this happens during gameplay, do it fast
|
// because this happens during gameplay, do it fast
|
||||||
// instead of sending it through GL_Upload8()
|
// instead of sending it through GL_Upload8()
|
||||||
glBindTexture (GL_TEXTURE_2D, playertextures + playernum);
|
glBindTexture (GL_TEXTURE_2D, playertextures + (player - cl.players));
|
||||||
|
|
||||||
// FIXME deek: This 512x256 limit sucks!
|
// FIXME deek: This 512x256 limit sucks!
|
||||||
scaled_width = min (gl_max_size->int_val, 512);
|
scaled_width = min (gl_max_size->int_val, 512);
|
||||||
|
@ -181,4 +157,12 @@ CL_NewTranslation (int slot)
|
||||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Skin_Init_Translation (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0; i < 256; i++)
|
||||||
|
translate [i] = i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "cl_parse.h"
|
#include "cl_parse.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
|
#include "host.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "pcx.h"
|
#include "pcx.h"
|
||||||
#include "qendian.h"
|
#include "qendian.h"
|
||||||
|
@ -366,6 +367,7 @@ Skin_Init (void)
|
||||||
Cmd_AddCommand ("skins", Skin_Skins_f, "No Description");
|
Cmd_AddCommand ("skins", Skin_Skins_f, "No Description");
|
||||||
Cmd_AddCommand ("allskins", Skin_AllSkins_f, "No Description");
|
Cmd_AddCommand ("allskins", Skin_AllSkins_f, "No Description");
|
||||||
Cmd_AddCommand ("color", CL_Color_f, "No Description");
|
Cmd_AddCommand ("color", CL_Color_f, "No Description");
|
||||||
|
Skin_Init_Translation ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -381,3 +383,34 @@ Skin_Init_Cvars (void)
|
||||||
bottomcolor = Cvar_Get ("bottomcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO,
|
bottomcolor = Cvar_Get ("bottomcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO,
|
||||||
"Players color on bottom");
|
"Players color on bottom");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
CL_NewTranslation
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
CL_NewTranslation (int slot)
|
||||||
|
{
|
||||||
|
player_info_t *player;
|
||||||
|
char s[512];
|
||||||
|
|
||||||
|
if (slot > MAX_CLIENTS)
|
||||||
|
Host_EndGame ("CL_NewTranslation: slot > MAX_CLIENTS");
|
||||||
|
|
||||||
|
player = &cl.players[slot];
|
||||||
|
if (!player->name[0])
|
||||||
|
return;
|
||||||
|
|
||||||
|
strcpy (s, Info_ValueForKey (player->userinfo, "skin"));
|
||||||
|
COM_StripExtension (s, s);
|
||||||
|
if (player->skin && !strequal (s, player->skin->name))
|
||||||
|
player->skin = NULL;
|
||||||
|
|
||||||
|
if (player->_topcolor != player->topcolor ||
|
||||||
|
player->_bottomcolor != player->bottomcolor || !player->skin) {
|
||||||
|
player->_topcolor = player->topcolor;
|
||||||
|
player->_bottomcolor = player->bottomcolor;
|
||||||
|
|
||||||
|
Skin_Set_Translate (player);
|
||||||
|
Skin_Do_Translation (player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -42,46 +42,19 @@
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "vid.h"
|
#include "vid.h"
|
||||||
|
|
||||||
/*
|
|
||||||
=====================
|
|
||||||
CL_NewTranslation
|
|
||||||
=====================
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
CL_NewTranslation (int slot)
|
Skin_Set_Translate (player_info_t *player)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
byte *dest, *source;
|
byte *dest, *source;
|
||||||
player_info_t *player;
|
|
||||||
char s[512];
|
|
||||||
|
|
||||||
if (slot > MAX_CLIENTS)
|
top = bound (0, player->topcolor, 13) * 16;
|
||||||
Host_EndGame ("CL_NewTranslation: slot > MAX_CLIENTS");
|
bottom = bound (0, player->bottomcolor, 13) * 16;
|
||||||
|
|
||||||
player = &cl.players[slot];
|
|
||||||
|
|
||||||
strcpy (s, Info_ValueForKey (player->userinfo, "skin"));
|
|
||||||
COM_StripExtension (s, s);
|
|
||||||
if (player->skin && !strequal (s, player->skin->name))
|
|
||||||
player->skin = NULL;
|
|
||||||
|
|
||||||
if (player->_topcolor != player->topcolor ||
|
|
||||||
player->_bottomcolor != player->bottomcolor || !player->skin) {
|
|
||||||
player->_topcolor = player->topcolor;
|
|
||||||
player->_bottomcolor = player->bottomcolor;
|
|
||||||
|
|
||||||
dest = player->translations;
|
dest = player->translations;
|
||||||
source = vid.colormap;
|
source = vid.colormap;
|
||||||
memcpy (dest, vid.colormap, sizeof (player->translations));
|
memcpy (dest, vid.colormap, sizeof (player->translations));
|
||||||
top = player->topcolor;
|
|
||||||
if (top > 13 || top < 0)
|
|
||||||
top = 13;
|
|
||||||
top *= 16;
|
|
||||||
bottom = player->bottomcolor;
|
|
||||||
if (bottom > 13 || bottom < 0)
|
|
||||||
bottom = 13;
|
|
||||||
bottom *= 16;
|
|
||||||
|
|
||||||
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
|
||||||
|
@ -98,4 +71,13 @@ CL_NewTranslation (int slot)
|
||||||
dest[BOTTOM_RANGE + j] = source[bottom + 15 - j];
|
dest[BOTTOM_RANGE + j] = source[bottom + 15 - j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Skin_Do_Translation (player_info_t *player)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Skin_Init_Translation (void)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue