mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-07 08:21:59 +00:00
sw_ralias.c and gl_rmain.c are now client clean. this involved a bit of a
revamp of skins. keep an eye out for broken skins (especially in nq)
This commit is contained in:
parent
ddceaf78b3
commit
da8715f27d
23 changed files with 202 additions and 100 deletions
|
@ -86,6 +86,7 @@ typedef struct entity_s
|
||||||
int frame;
|
int frame;
|
||||||
byte *colormap;
|
byte *colormap;
|
||||||
int skinnum; // for Alias models
|
int skinnum; // for Alias models
|
||||||
|
struct skin_s *skin;
|
||||||
|
|
||||||
struct player_info_s *scoreboard; // identify player
|
struct player_info_s *scoreboard; // identify player
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,19 @@ typedef struct skin_s
|
||||||
{
|
{
|
||||||
char name[16];
|
char name[16];
|
||||||
qboolean failedload; // the name isn't a valid skin
|
qboolean failedload; // the name isn't a valid skin
|
||||||
cache_user_t cache;
|
union {
|
||||||
|
cache_user_t cache;
|
||||||
|
struct tex_s *texels;
|
||||||
|
} data;
|
||||||
|
int texture;
|
||||||
int fb_texture;
|
int fb_texture;
|
||||||
} skin_t;
|
} skin_t;
|
||||||
|
|
||||||
extern byte player_8bit_texels[320 * 200];
|
extern byte player_8bit_texels[320 * 200];
|
||||||
extern skin_t skin_cache[MAX_CACHED_SKINS];
|
extern skin_t skin_cache[MAX_CACHED_SKINS];
|
||||||
|
extern int skin_textures;
|
||||||
|
extern int skin_fb_textures;
|
||||||
|
|
||||||
struct tex_s;
|
struct tex_s;
|
||||||
struct player_info_s;
|
struct player_info_s;
|
||||||
struct model_s;
|
struct model_s;
|
||||||
|
@ -54,12 +61,16 @@ struct model_s;
|
||||||
void Skin_Find (struct player_info_s *sc);
|
void Skin_Find (struct player_info_s *sc);
|
||||||
struct tex_s *Skin_Cache (skin_t *skin);
|
struct tex_s *Skin_Cache (skin_t *skin);
|
||||||
void Skin_Flush (void);
|
void Skin_Flush (void);
|
||||||
|
int Skin_Init_Textures (int base);
|
||||||
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 (int top, int bottom, byte *dest);
|
void Skin_Set_Translate (int top, int bottom, byte *dest);
|
||||||
void Skin_Do_Translation (skin_t *player_skin, int slot);
|
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);
|
void Skin_Do_Translation_Model (struct model_s *model, int skinnum, int slot, skin_t *skin);
|
||||||
void Skin_Process (skin_t *skin, struct tex_s *);
|
void Skin_Process (skin_t *skin, struct tex_s *);
|
||||||
|
|
||||||
|
skin_t *Skin_NewTempSkin (void);
|
||||||
|
void Skin_ClearTempSkins (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -91,8 +91,6 @@ extern int cnttextures[2];
|
||||||
extern int particletexture;
|
extern int particletexture;
|
||||||
extern int netgraphtexture;
|
extern int netgraphtexture;
|
||||||
extern int netgraphtexture; // netgraph texture
|
extern int netgraphtexture; // netgraph texture
|
||||||
extern int playertextures;
|
|
||||||
extern int player_fb_textures;
|
|
||||||
|
|
||||||
extern int skytexturenum; // index in cl.loadmodel, not gl texture object
|
extern int skytexturenum; // index in cl.loadmodel, not gl texture object
|
||||||
|
|
||||||
|
|
|
@ -327,8 +327,9 @@ void CL_TimeDemo_f (void);
|
||||||
/*
|
/*
|
||||||
cl_parse.c
|
cl_parse.c
|
||||||
*/
|
*/
|
||||||
|
struct skin_s;
|
||||||
void CL_ParseServerMessage (void);
|
void CL_ParseServerMessage (void);
|
||||||
void CL_NewTranslation (int slot);
|
void CL_NewTranslation (int slot, struct skin_s *skin);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -37,7 +37,9 @@
|
||||||
#include "QF/input.h"
|
#include "QF/input.h"
|
||||||
#include "QF/keys.h"
|
#include "QF/keys.h"
|
||||||
#include "QF/msg.h"
|
#include "QF/msg.h"
|
||||||
|
#include "QF/render.h"
|
||||||
#include "QF/screen.h"
|
#include "QF/screen.h"
|
||||||
|
#include "QF/skin.h"
|
||||||
#include "QF/va.h"
|
#include "QF/va.h"
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
@ -45,7 +47,6 @@
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "r_dynamic.h"
|
#include "r_dynamic.h"
|
||||||
#include "QF/render.h"
|
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
byte *vid_colormap;
|
byte *vid_colormap;
|
||||||
|
@ -571,6 +572,12 @@ CL_RelinkEntities (void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i <= cl.maxclients) {
|
||||||
|
ent->skin = Skin_NewTempSkin ();
|
||||||
|
if (ent->skin)
|
||||||
|
CL_NewTranslation (i - 1, ent->skin);
|
||||||
|
}
|
||||||
|
|
||||||
// rotate binary objects locally
|
// rotate binary objects locally
|
||||||
if (ent->model->flags & EF_ROTATE)
|
if (ent->model->flags & EF_ROTATE)
|
||||||
ent->angles[1] = bobjrotate;
|
ent->angles[1] = bobjrotate;
|
||||||
|
@ -692,6 +699,7 @@ CL_ReadFromServer (void)
|
||||||
Con_Printf ("\n");
|
Con_Printf ("\n");
|
||||||
|
|
||||||
R_ClearEnts ();
|
R_ClearEnts ();
|
||||||
|
Skin_ClearTempSkins ();
|
||||||
|
|
||||||
CL_RelinkEntities ();
|
CL_RelinkEntities ();
|
||||||
CL_UpdateTEnts ();
|
CL_UpdateTEnts ();
|
||||||
|
|
|
@ -400,8 +400,8 @@ CL_ParseUpdate (int bits)
|
||||||
ent->syncbase = 0.0;
|
ent->syncbase = 0.0;
|
||||||
} else
|
} else
|
||||||
forcelink = true; // hack to make null model players work
|
forcelink = true; // hack to make null model players work
|
||||||
if (num > 0 && num <= cl.maxclients)
|
//XXX if (num > 0 && num <= cl.maxclients)
|
||||||
CL_NewTranslation (num - 1);
|
//XXX CL_NewTranslation (num - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bits & U_FRAME)
|
if (bits & U_FRAME)
|
||||||
|
@ -427,8 +427,8 @@ CL_ParseUpdate (int bits)
|
||||||
skin = ent->baseline->skin;
|
skin = ent->baseline->skin;
|
||||||
if (skin != ent->skinnum) {
|
if (skin != ent->skinnum) {
|
||||||
ent->skinnum = skin;
|
ent->skinnum = skin;
|
||||||
if (num > 0 && num <= cl.maxclients)
|
//XXX if (num > 0 && num <= cl.maxclients)
|
||||||
CL_NewTranslation (num - 1);
|
//XXX CL_NewTranslation (num - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bits & U_EFFECTS)
|
if (bits & U_EFFECTS)
|
||||||
|
@ -803,7 +803,7 @@ CL_ParseServerMessage (void)
|
||||||
Host_Error
|
Host_Error
|
||||||
("CL_ParseServerMessage: svc_updatecolors > MAX_SCOREBOARD");
|
("CL_ParseServerMessage: svc_updatecolors > MAX_SCOREBOARD");
|
||||||
cl.scores[i].colors = MSG_ReadByte (net_message);
|
cl.scores[i].colors = MSG_ReadByte (net_message);
|
||||||
CL_NewTranslation (i);
|
//XXX CL_NewTranslation (i);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case svc_particle:
|
case svc_particle:
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "QF/vid.h"
|
#include "QF/vid.h"
|
||||||
|
|
||||||
#include "client.h"
|
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
#include "r_cvar.h"
|
#include "r_cvar.h"
|
||||||
#include "r_dynamic.h"
|
#include "r_dynamic.h"
|
||||||
|
@ -73,9 +72,6 @@ int c_brush_polys, c_alias_polys;
|
||||||
qboolean envmap; // true during envmap command capture
|
qboolean envmap; // true during envmap command capture
|
||||||
|
|
||||||
|
|
||||||
int playertextures; // up to 16 color translated skins
|
|
||||||
int player_fb_textures; // up to 128 skin fullbright maps
|
|
||||||
|
|
||||||
int mirrortexturenum; // quake texturenum, not gltexturenum
|
int mirrortexturenum; // quake texturenum, not gltexturenum
|
||||||
qboolean mirror;
|
qboolean mirror;
|
||||||
mplane_t *mirror_plane;
|
mplane_t *mirror_plane;
|
||||||
|
@ -595,7 +591,6 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea
|
||||||
static void
|
static void
|
||||||
R_DrawAliasModel (entity_t *e)
|
R_DrawAliasModel (entity_t *e)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int lnum;
|
int lnum;
|
||||||
vec3_t dist;
|
vec3_t dist;
|
||||||
float add;
|
float add;
|
||||||
|
@ -710,10 +705,13 @@ R_DrawAliasModel (entity_t *e)
|
||||||
|
|
||||||
// we can't dynamically colormap textures, so they are cached
|
// we can't dynamically colormap textures, so they are cached
|
||||||
// seperately for the players. Heads are just uncolored.
|
// seperately for the players. Heads are just uncolored.
|
||||||
if (currententity->colormap != vid.colormap && !gl_nocolors->int_val) {
|
if (currententity->skin && !gl_nocolors->int_val) {
|
||||||
i = currententity - cl_entities;
|
skin_t *skin = currententity->skin;
|
||||||
if (i >= 1 && i <= cl.maxclients)
|
|
||||||
texture = playertextures - 1 + i;
|
texture = skin->texture;
|
||||||
|
if (gl_fb_models->int_val) {
|
||||||
|
fb_texture = skin->fb_texture;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture (GL_TEXTURE_2D, texture);
|
glBindTexture (GL_TEXTURE_2D, texture);
|
||||||
|
|
|
@ -158,10 +158,7 @@ R_Init (void)
|
||||||
netgraphtexture = texture_extension_number;
|
netgraphtexture = texture_extension_number;
|
||||||
texture_extension_number++;
|
texture_extension_number++;
|
||||||
|
|
||||||
playertextures = texture_extension_number;
|
texture_extension_number = Skin_Init_Textures (texture_extension_number);
|
||||||
texture_extension_number += MAX_CLIENTS;
|
|
||||||
player_fb_textures = texture_extension_number;
|
|
||||||
texture_extension_number += MAX_CACHED_SKINS;
|
|
||||||
|
|
||||||
glEnableClientState (GL_COLOR_ARRAY);
|
glEnableClientState (GL_COLOR_ARRAY);
|
||||||
glEnableClientState (GL_VERTEX_ARRAY);
|
glEnableClientState (GL_VERTEX_ARRAY);
|
||||||
|
|
|
@ -163,31 +163,30 @@ build_skin (int texnum, byte *ptexels, int width, int height,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Skin_Do_Translation (skin_t *player_skin, int slot)
|
Skin_Do_Translation (skin_t *player_skin, int slot, skin_t *skin)
|
||||||
{
|
{
|
||||||
int texnum;
|
int texnum = skin->texture;
|
||||||
int inwidth, inheight;
|
int inwidth, inheight;
|
||||||
byte *original;
|
byte *original;
|
||||||
tex_t *skin;
|
tex_t *skin_texels;
|
||||||
|
|
||||||
if ((skin = (tex_t*)Skin_Cache (player_skin)) != NULL) {
|
if ((skin_texels = (tex_t*)Skin_Cache (player_skin)) != NULL) {
|
||||||
// skin data width
|
// skin data width
|
||||||
inwidth = 320;
|
inwidth = 320;
|
||||||
inheight = 200;
|
inheight = 200;
|
||||||
original = skin->data;
|
original = skin_texels->data;
|
||||||
} else {
|
} else {
|
||||||
original = player_8bit_texels;
|
original = player_8bit_texels;
|
||||||
inwidth = 296;
|
inwidth = 296;
|
||||||
inheight = 194;
|
inheight = 194;
|
||||||
}
|
}
|
||||||
texnum = playertextures + slot;
|
|
||||||
build_skin (texnum, original, inwidth, inheight, 296, 194, false);
|
build_skin (texnum, original, inwidth, inheight, 296, 194, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Skin_Do_Translation_Model (model_t *model, int skinnum, int slot)
|
Skin_Do_Translation_Model (model_t *model, int skinnum, int slot, skin_t *skin)
|
||||||
{
|
{
|
||||||
int texnum;
|
int texnum = skin->texture;
|
||||||
int inwidth, inheight;
|
int inwidth, inheight;
|
||||||
aliashdr_t *paliashdr;
|
aliashdr_t *paliashdr;
|
||||||
byte *original;
|
byte *original;
|
||||||
|
@ -211,7 +210,6 @@ Skin_Do_Translation_Model (model_t *model, int skinnum, int slot)
|
||||||
inwidth = paliashdr->mdl.skinwidth;
|
inwidth = paliashdr->mdl.skinwidth;
|
||||||
inheight = paliashdr->mdl.skinheight;
|
inheight = paliashdr->mdl.skinheight;
|
||||||
|
|
||||||
texnum = playertextures + slot;
|
|
||||||
build_skin (texnum, original, inwidth, inheight, inwidth, inheight, false);
|
build_skin (texnum, original, inwidth, inheight, inwidth, inheight, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,8 +231,8 @@ Skin_Process (skin_t *skin, tex_t *tex)
|
||||||
byte *ptexels = Hunk_TempAlloc (pixels);
|
byte *ptexels = Hunk_TempAlloc (pixels);
|
||||||
|
|
||||||
if (Mod_CalcFullbright (tex->data, ptexels, pixels)) {
|
if (Mod_CalcFullbright (tex->data, ptexels, pixels)) {
|
||||||
skin->fb_texture = player_fb_textures + (skin - skin_cache);
|
skin->fb_texture = skin_fb_textures + (skin - skin_cache);
|
||||||
build_skin (skin->fb_texture, ptexels, tex->width, tex->height,
|
build_skin (skin->fb_texture, ptexels, tex->width, tex->height,
|
||||||
296, 194, true);
|
296, 194, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ Host_Skin_Init_Cvars (void)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CL_NewTranslation (int slot)
|
CL_NewTranslation (int slot, skin_t *skin)
|
||||||
{
|
{
|
||||||
scoreboard_t *player;
|
scoreboard_t *player;
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
|
@ -139,5 +139,8 @@ CL_NewTranslation (int slot)
|
||||||
skinnum = cl_entities[1 + slot].skinnum;
|
skinnum = cl_entities[1 + slot].skinnum;
|
||||||
|
|
||||||
Skin_Set_Translate (top, bottom, dest);
|
Skin_Set_Translate (top, bottom, dest);
|
||||||
Skin_Do_Translation_Model (model, skinnum, slot);
|
memset (skin, 0, sizeof (*skin));
|
||||||
|
skin->texture = skin_textures + slot; //FIXME
|
||||||
|
skin->data.texels = 0; //FIXME
|
||||||
|
Skin_Do_Translation_Model (model, skinnum, slot, skin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
|
#define MAX_TEMP_SKINS 64 //XXX dynamic?
|
||||||
|
|
||||||
extern cvar_t *noskins; // XXX FIXME, this shouldn't be here?
|
extern cvar_t *noskins; // XXX FIXME, this shouldn't be here?
|
||||||
|
|
||||||
cvar_t *baseskin;
|
cvar_t *baseskin;
|
||||||
|
@ -60,6 +62,11 @@ skin_t skin_cache[MAX_CACHED_SKINS];
|
||||||
hashtab_t *skin_hash;
|
hashtab_t *skin_hash;
|
||||||
int numskins;
|
int numskins;
|
||||||
|
|
||||||
|
skin_t temp_skins[MAX_TEMP_SKINS];
|
||||||
|
int num_temp_skins;
|
||||||
|
|
||||||
|
int skin_textures;
|
||||||
|
int skin_fb_textures;
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
skin_get_key (void *_skin, void *unused)
|
skin_get_key (void *_skin, void *unused)
|
||||||
|
@ -120,7 +127,6 @@ Skin_Find (player_info_t *sc)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Skin_Cache
|
Skin_Cache
|
||||||
|
|
||||||
|
@ -148,7 +154,7 @@ Skin_Cache (skin_t *skin)
|
||||||
if (skin->failedload)
|
if (skin->failedload)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
out = Cache_Check (&skin->cache);
|
out = Cache_Check (&skin->data.cache);
|
||||||
if (out)
|
if (out)
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
|
@ -174,7 +180,7 @@ Skin_Cache (skin_t *skin)
|
||||||
}
|
}
|
||||||
pixels = 320 * 200;
|
pixels = 320 * 200;
|
||||||
|
|
||||||
out = Cache_Alloc (&skin->cache, sizeof (tex_t) + pixels, skin->name);
|
out = Cache_Alloc (&skin->data.cache, sizeof (tex_t) + pixels, skin->name);
|
||||||
if (!out)
|
if (!out)
|
||||||
Sys_Error ("Skin_Cache: couldn't allocate");
|
Sys_Error ("Skin_Cache: couldn't allocate");
|
||||||
opix = out->data;
|
opix = out->data;
|
||||||
|
@ -200,13 +206,39 @@ Skin_Flush (void)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < numskins; i++) {
|
for (i = 0; i < numskins; i++) {
|
||||||
if (skin_cache[i].cache.data)
|
if (skin_cache[i].data.cache.data)
|
||||||
Cache_Free (&skin_cache[i].cache);
|
Cache_Free (&skin_cache[i].data.cache);
|
||||||
}
|
}
|
||||||
numskins = 0;
|
numskins = 0;
|
||||||
Hash_FlushTable (skin_hash);
|
Hash_FlushTable (skin_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skin_t *
|
||||||
|
Skin_NewTempSkin (void)
|
||||||
|
{
|
||||||
|
if (num_temp_skins == MAX_TEMP_SKINS)
|
||||||
|
return 0; // ran out
|
||||||
|
return &temp_skins[num_temp_skins++];
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Skin_ClearTempSkins (void)
|
||||||
|
{
|
||||||
|
num_temp_skins = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
Skin_Init_Textures (int base)
|
||||||
|
{
|
||||||
|
skin_textures = base;
|
||||||
|
base += MAX_TEMP_SKINS;
|
||||||
|
skin_fb_textures = base;
|
||||||
|
base += MAX_TEMP_SKINS;
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Skin_Init (void)
|
Skin_Init (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "QF/texture.h"
|
#include "QF/texture.h"
|
||||||
|
|
||||||
#include "client.h"
|
|
||||||
#include "d_ifacea.h"
|
#include "d_ifacea.h"
|
||||||
#include "r_local.h"
|
#include "r_local.h"
|
||||||
|
|
||||||
|
@ -559,6 +558,17 @@ R_AliasSetupSkin (void)
|
||||||
r_affinetridesc.skinwidth = a_skinwidth;
|
r_affinetridesc.skinwidth = a_skinwidth;
|
||||||
r_affinetridesc.seamfixupX16 = (a_skinwidth >> 1) << 16;
|
r_affinetridesc.seamfixupX16 = (a_skinwidth >> 1) << 16;
|
||||||
r_affinetridesc.skinheight = pmdl->skinheight;
|
r_affinetridesc.skinheight = pmdl->skinheight;
|
||||||
|
|
||||||
|
if (currententity->skin) {
|
||||||
|
tex_t *base;
|
||||||
|
|
||||||
|
base = currententity->skin->data.texels;
|
||||||
|
if (base) {
|
||||||
|
r_affinetridesc.pskin = base->data;
|
||||||
|
r_affinetridesc.skinwidth = base->width;
|
||||||
|
r_affinetridesc.skinheight = base->height;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -676,7 +686,7 @@ R_AliasDrawModel (alight_t *plighting)
|
||||||
|
|
||||||
acolormap = currententity->colormap;
|
acolormap = currententity->colormap;
|
||||||
|
|
||||||
if (currententity != &cl.viewent)
|
if (currententity != r_view_model)
|
||||||
ziscale = (float) 0x8000 *(float) 0x10000;
|
ziscale = (float) 0x8000 *(float) 0x10000;
|
||||||
else
|
else
|
||||||
ziscale = (float) 0x8000 *(float) 0x10000 *3.0;
|
ziscale = (float) 0x8000 *(float) 0x10000 *3.0;
|
||||||
|
|
|
@ -73,13 +73,13 @@ Skin_Set_Translate (int top, int bottom, byte *dest)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Skin_Do_Translation (skin_t *player_skin, int slot)
|
Skin_Do_Translation (skin_t *player_skin, int slot, skin_t *skin)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Skin_Do_Translation_Model (model_t *model, int skinnum, int slot)
|
Skin_Do_Translation_Model (model_t *model, int skinnum, int slot, skin_t *skin)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,13 @@
|
||||||
|
|
||||||
#define NET_TIMINGS 256
|
#define NET_TIMINGS 256
|
||||||
#define NET_TIMINGSMASK 255
|
#define NET_TIMINGSMASK 255
|
||||||
|
|
||||||
|
struct skin_s;
|
||||||
|
|
||||||
extern int packet_latency[NET_TIMINGS];
|
extern int packet_latency[NET_TIMINGS];
|
||||||
int CL_CalcNet (void);
|
int CL_CalcNet (void);
|
||||||
void CL_ParseServerMessage (void);
|
void CL_ParseServerMessage (void);
|
||||||
void CL_NewTranslation (int slot);
|
void CL_NewTranslation (int slot, struct skin_s *skin);
|
||||||
qboolean CL_CheckOrDownloadFile (char *filename);
|
qboolean CL_CheckOrDownloadFile (char *filename);
|
||||||
qboolean CL_IsUploading(void);
|
qboolean CL_IsUploading(void);
|
||||||
void CL_NextUpload(void);
|
void CL_NextUpload(void);
|
||||||
|
|
|
@ -40,10 +40,12 @@
|
||||||
#include "QF/console.h"
|
#include "QF/console.h"
|
||||||
#include "QF/msg.h"
|
#include "QF/msg.h"
|
||||||
#include "QF/render.h"
|
#include "QF/render.h"
|
||||||
|
#include "QF/skin.h"
|
||||||
|
|
||||||
#include "cl_cam.h"
|
#include "cl_cam.h"
|
||||||
#include "cl_ents.h"
|
#include "cl_ents.h"
|
||||||
#include "cl_main.h"
|
#include "cl_main.h"
|
||||||
|
#include "cl_parse.h"
|
||||||
#include "cl_pred.h"
|
#include "cl_pred.h"
|
||||||
#include "cl_tent.h"
|
#include "cl_tent.h"
|
||||||
#include "d_iface.h"
|
#include "d_iface.h"
|
||||||
|
@ -452,6 +454,18 @@ CL_LinkPacketEntities (void)
|
||||||
(*ent)->scoreboard = NULL;
|
(*ent)->scoreboard = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((*ent)->scoreboard && !(*ent)->scoreboard->skin)
|
||||||
|
Skin_Find ((*ent)->scoreboard);
|
||||||
|
if ((*ent)->scoreboard && (*ent)->scoreboard->skin) {
|
||||||
|
(*ent)->skin = Skin_NewTempSkin ();
|
||||||
|
if ((*ent)->skin) {
|
||||||
|
i = s1->colormap - 1;
|
||||||
|
CL_NewTranslation (i, (*ent)->skin);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
(*ent)->skin = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// LordHavoc: cleaned up Endy's coding style, and fixed Endy's bugs
|
// LordHavoc: cleaned up Endy's coding style, and fixed Endy's bugs
|
||||||
// Ender: Extend (Colormod) [QSG - Begin]
|
// Ender: Extend (Colormod) [QSG - Begin]
|
||||||
// N.B: All messy code below is the sole fault of LordHavoc and
|
// N.B: All messy code below is the sole fault of LordHavoc and
|
||||||
|
@ -599,6 +613,7 @@ CL_LinkProjectiles (void)
|
||||||
(*ent)->frame = 0;
|
(*ent)->frame = 0;
|
||||||
(*ent)->colormap = vid.colormap;
|
(*ent)->colormap = vid.colormap;
|
||||||
(*ent)->scoreboard = NULL;
|
(*ent)->scoreboard = NULL;
|
||||||
|
(*ent)->skin = NULL;
|
||||||
// LordHavoc: Endy had neglected to do this as part of the QSG
|
// LordHavoc: Endy had neglected to do this as part of the QSG
|
||||||
// VERSION 2 stuff
|
// VERSION 2 stuff
|
||||||
(*ent)->glow_size = 0;
|
(*ent)->glow_size = 0;
|
||||||
|
@ -829,6 +844,17 @@ CL_LinkPlayers (void)
|
||||||
else
|
else
|
||||||
(*ent)->scoreboard = NULL;
|
(*ent)->scoreboard = NULL;
|
||||||
|
|
||||||
|
if ((*ent)->scoreboard && !(*ent)->scoreboard->skin)
|
||||||
|
Skin_Find ((*ent)->scoreboard);
|
||||||
|
if ((*ent)->scoreboard && (*ent)->scoreboard->skin) {
|
||||||
|
(*ent)->skin = Skin_NewTempSkin ();
|
||||||
|
if ((*ent)->skin) {
|
||||||
|
CL_NewTranslation (j, (*ent)->skin);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
(*ent)->skin = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// LordHavoc: more QSG VERSION 2 stuff, FIXME: players don't have
|
// LordHavoc: more QSG VERSION 2 stuff, FIXME: players don't have
|
||||||
// extend stuff
|
// extend stuff
|
||||||
(*ent)->glow_size = 0;
|
(*ent)->glow_size = 0;
|
||||||
|
@ -1031,6 +1057,7 @@ CL_EmitEntities (void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
R_ClearEnts ();
|
R_ClearEnts ();
|
||||||
|
Skin_ClearTempSkins ();
|
||||||
|
|
||||||
CL_LinkPlayers ();
|
CL_LinkPlayers ();
|
||||||
CL_LinkPacketEntities ();
|
CL_LinkPacketEntities ();
|
||||||
|
|
|
@ -970,7 +970,7 @@ CL_ProcessUserInfo (int slot, player_info_t *player)
|
||||||
Skin_Find (player);
|
Skin_Find (player);
|
||||||
|
|
||||||
Sbar_Changed ();
|
Sbar_Changed ();
|
||||||
CL_NewTranslation (slot);
|
//XXX CL_NewTranslation (slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ CL_Skin_Init_Cvars (void)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CL_NewTranslation (int slot)
|
CL_NewTranslation (int slot, skin_t *skin)
|
||||||
{
|
{
|
||||||
player_info_t *player;
|
player_info_t *player;
|
||||||
char s[512];
|
char s[512];
|
||||||
|
@ -219,6 +219,13 @@ CL_NewTranslation (int slot)
|
||||||
player->translations);
|
player->translations);
|
||||||
if (!player->skin)
|
if (!player->skin)
|
||||||
Skin_Find (player);
|
Skin_Find (player);
|
||||||
Skin_Do_Translation (player->skin, slot);
|
memcpy (skin, player->skin, sizeof (*skin));
|
||||||
|
skin->texture = skin_textures + slot; //FIXME
|
||||||
|
skin->data.texels = Skin_Cache(player->skin); //FIXME the breaks cache ownership
|
||||||
|
Skin_Do_Translation (player->skin, slot, skin);
|
||||||
|
} else {
|
||||||
|
memcpy (skin, player->skin, sizeof (*skin));
|
||||||
|
skin->texture = skin_textures + slot; //FIXME
|
||||||
|
skin->data.texels = Skin_Cache(player->skin); //FIXME the breaks cache ownership
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,6 @@
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "QF/vid.h"
|
#include "QF/vid.h"
|
||||||
|
|
||||||
#include "cl_parse.h"
|
|
||||||
#include "client.h"
|
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
#include "r_cvar.h"
|
#include "r_cvar.h"
|
||||||
#include "r_dynamic.h"
|
#include "r_dynamic.h"
|
||||||
|
@ -74,9 +72,6 @@ int c_brush_polys, c_alias_polys;
|
||||||
qboolean envmap; // true during envmap command capture
|
qboolean envmap; // true during envmap command capture
|
||||||
|
|
||||||
|
|
||||||
int playertextures; // up to 16 color translated skins
|
|
||||||
int player_fb_textures; // up to 128 skin fullbright maps
|
|
||||||
|
|
||||||
int mirrortexturenum; // quake texturenum, not gltexturenum
|
int mirrortexturenum; // quake texturenum, not gltexturenum
|
||||||
qboolean mirror;
|
qboolean mirror;
|
||||||
mplane_t *mirror_plane;
|
mplane_t *mirror_plane;
|
||||||
|
@ -596,7 +591,6 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea
|
||||||
static void
|
static void
|
||||||
R_DrawAliasModel (entity_t *e)
|
R_DrawAliasModel (entity_t *e)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int lnum;
|
int lnum;
|
||||||
vec3_t dist;
|
vec3_t dist;
|
||||||
float add;
|
float add;
|
||||||
|
@ -711,22 +705,12 @@ R_DrawAliasModel (entity_t *e)
|
||||||
|
|
||||||
// we can't dynamically colormap textures, so they are cached
|
// we can't dynamically colormap textures, so they are cached
|
||||||
// seperately for the players. Heads are just uncolored.
|
// seperately for the players. Heads are just uncolored.
|
||||||
if (currententity->scoreboard && !gl_nocolors->int_val) {
|
if (currententity->skin && !gl_nocolors->int_val) {
|
||||||
skin_t *skin;
|
skin_t *skin = currententity->skin;
|
||||||
|
|
||||||
i = currententity->scoreboard - cl.players;
|
texture = skin->texture;
|
||||||
if (!currententity->scoreboard->skin) {
|
|
||||||
Skin_Find (currententity->scoreboard);
|
|
||||||
CL_NewTranslation (i);
|
|
||||||
}
|
|
||||||
skin = currententity->scoreboard->skin;
|
|
||||||
if (skin && i >= 0 && i < MAX_CLIENTS)
|
|
||||||
texture = playertextures + i;
|
|
||||||
else
|
|
||||||
skin = 0;
|
|
||||||
if (gl_fb_models->int_val) {
|
if (gl_fb_models->int_val) {
|
||||||
if (skin)
|
fb_texture = skin->fb_texture;
|
||||||
fb_texture = skin->fb_texture;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,10 +158,7 @@ R_Init (void)
|
||||||
netgraphtexture = texture_extension_number;
|
netgraphtexture = texture_extension_number;
|
||||||
texture_extension_number++;
|
texture_extension_number++;
|
||||||
|
|
||||||
playertextures = texture_extension_number;
|
texture_extension_number = Skin_Init_Textures (texture_extension_number);
|
||||||
texture_extension_number += MAX_CLIENTS;
|
|
||||||
player_fb_textures = texture_extension_number;
|
|
||||||
texture_extension_number += MAX_CACHED_SKINS;
|
|
||||||
|
|
||||||
glEnableClientState (GL_COLOR_ARRAY);
|
glEnableClientState (GL_COLOR_ARRAY);
|
||||||
glEnableClientState (GL_VERTEX_ARRAY);
|
glEnableClientState (GL_VERTEX_ARRAY);
|
||||||
|
|
|
@ -163,31 +163,30 @@ build_skin (int texnum, byte *ptexels, int width, int height,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Skin_Do_Translation (skin_t *player_skin, int slot)
|
Skin_Do_Translation (skin_t *player_skin, int slot, skin_t *skin)
|
||||||
{
|
{
|
||||||
int texnum;
|
int texnum = skin->texture;
|
||||||
int inwidth, inheight;
|
int inwidth, inheight;
|
||||||
byte *original;
|
byte *original;
|
||||||
tex_t *skin;
|
tex_t *skin_texels;
|
||||||
|
|
||||||
if ((skin = (tex_t*)Skin_Cache (player_skin)) != NULL) {
|
if ((skin_texels = (tex_t*)Skin_Cache (player_skin)) != NULL) {
|
||||||
// skin data width
|
// skin data width
|
||||||
inwidth = 320;
|
inwidth = 320;
|
||||||
inheight = 200;
|
inheight = 200;
|
||||||
original = skin->data;
|
original = skin_texels->data;
|
||||||
} else {
|
} else {
|
||||||
original = player_8bit_texels;
|
original = player_8bit_texels;
|
||||||
inwidth = 296;
|
inwidth = 296;
|
||||||
inheight = 194;
|
inheight = 194;
|
||||||
}
|
}
|
||||||
texnum = playertextures + slot;
|
|
||||||
build_skin (texnum, original, inwidth, inheight, 296, 194, false);
|
build_skin (texnum, original, inwidth, inheight, 296, 194, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Skin_Do_Translation_Model (model_t *model, int skinnum, int slot)
|
Skin_Do_Translation_Model (model_t *model, int skinnum, int slot, skin_t *skin)
|
||||||
{
|
{
|
||||||
int texnum;
|
int texnum = skin->texture;
|
||||||
int inwidth, inheight;
|
int inwidth, inheight;
|
||||||
aliashdr_t *paliashdr;
|
aliashdr_t *paliashdr;
|
||||||
byte *original;
|
byte *original;
|
||||||
|
@ -211,7 +210,6 @@ Skin_Do_Translation_Model (model_t *model, int skinnum, int slot)
|
||||||
inwidth = paliashdr->mdl.skinwidth;
|
inwidth = paliashdr->mdl.skinwidth;
|
||||||
inheight = paliashdr->mdl.skinheight;
|
inheight = paliashdr->mdl.skinheight;
|
||||||
|
|
||||||
texnum = playertextures + slot;
|
|
||||||
build_skin (texnum, original, inwidth, inheight, inwidth, inheight, false);
|
build_skin (texnum, original, inwidth, inheight, inwidth, inheight, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,8 +231,8 @@ Skin_Process (skin_t *skin, tex_t *tex)
|
||||||
byte *ptexels = Hunk_TempAlloc (pixels);
|
byte *ptexels = Hunk_TempAlloc (pixels);
|
||||||
|
|
||||||
if (Mod_CalcFullbright (tex->data, ptexels, pixels)) {
|
if (Mod_CalcFullbright (tex->data, ptexels, pixels)) {
|
||||||
skin->fb_texture = player_fb_textures + (skin - skin_cache);
|
skin->fb_texture = skin_fb_textures + (skin - skin_cache);
|
||||||
build_skin (skin->fb_texture, ptexels, tex->width, tex->height,
|
build_skin (skin->fb_texture, ptexels, tex->width, tex->height,
|
||||||
296, 194, true);
|
296, 194, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
|
#define MAX_TEMP_SKINS 64 //XXX dynamic?
|
||||||
|
|
||||||
extern cvar_t *noskins; // XXX FIXME, this shouldn't be here?
|
extern cvar_t *noskins; // XXX FIXME, this shouldn't be here?
|
||||||
|
|
||||||
cvar_t *baseskin;
|
cvar_t *baseskin;
|
||||||
|
@ -60,6 +62,11 @@ skin_t skin_cache[MAX_CACHED_SKINS];
|
||||||
hashtab_t *skin_hash;
|
hashtab_t *skin_hash;
|
||||||
int numskins;
|
int numskins;
|
||||||
|
|
||||||
|
skin_t temp_skins[MAX_TEMP_SKINS];
|
||||||
|
int num_temp_skins;
|
||||||
|
|
||||||
|
int skin_textures;
|
||||||
|
int skin_fb_textures;
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
skin_get_key (void *_skin, void *unused)
|
skin_get_key (void *_skin, void *unused)
|
||||||
|
@ -145,7 +152,7 @@ Skin_Cache (skin_t *skin)
|
||||||
if (skin->failedload)
|
if (skin->failedload)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
out = Cache_Check (&skin->cache);
|
out = Cache_Check (&skin->data.cache);
|
||||||
if (out)
|
if (out)
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
|
@ -171,7 +178,7 @@ Skin_Cache (skin_t *skin)
|
||||||
}
|
}
|
||||||
pixels = 320 * 200;
|
pixels = 320 * 200;
|
||||||
|
|
||||||
out = Cache_Alloc (&skin->cache, sizeof (tex_t) + pixels, skin->name);
|
out = Cache_Alloc (&skin->data.cache, sizeof (tex_t) + pixels, skin->name);
|
||||||
if (!out)
|
if (!out)
|
||||||
Sys_Error ("Skin_Cache: couldn't allocate");
|
Sys_Error ("Skin_Cache: couldn't allocate");
|
||||||
opix = out->data;
|
opix = out->data;
|
||||||
|
@ -197,13 +204,38 @@ Skin_Flush (void)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < numskins; i++) {
|
for (i = 0; i < numskins; i++) {
|
||||||
if (skin_cache[i].cache.data)
|
if (skin_cache[i].data.cache.data)
|
||||||
Cache_Free (&skin_cache[i].cache);
|
Cache_Free (&skin_cache[i].data.cache);
|
||||||
}
|
}
|
||||||
numskins = 0;
|
numskins = 0;
|
||||||
Hash_FlushTable (skin_hash);
|
Hash_FlushTable (skin_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skin_t *
|
||||||
|
Skin_NewTempSkin (void)
|
||||||
|
{
|
||||||
|
if (num_temp_skins == MAX_TEMP_SKINS)
|
||||||
|
return 0; // ran out
|
||||||
|
return &temp_skins[num_temp_skins++];
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Skin_ClearTempSkins (void)
|
||||||
|
{
|
||||||
|
num_temp_skins = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
Skin_Init_Textures (int base)
|
||||||
|
{
|
||||||
|
skin_textures = base;
|
||||||
|
base += MAX_TEMP_SKINS;
|
||||||
|
skin_fb_textures = base;
|
||||||
|
base += MAX_TEMP_SKINS;
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Skin_Init (void)
|
Skin_Init (void)
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "QF/texture.h"
|
#include "QF/texture.h"
|
||||||
|
|
||||||
#include "client.h"
|
|
||||||
#include "d_ifacea.h"
|
#include "d_ifacea.h"
|
||||||
#include "r_local.h"
|
#include "r_local.h"
|
||||||
|
|
||||||
|
@ -560,16 +559,14 @@ R_AliasSetupSkin (void)
|
||||||
r_affinetridesc.seamfixupX16 = (a_skinwidth >> 1) << 16;
|
r_affinetridesc.seamfixupX16 = (a_skinwidth >> 1) << 16;
|
||||||
r_affinetridesc.skinheight = pmdl->skinheight;
|
r_affinetridesc.skinheight = pmdl->skinheight;
|
||||||
|
|
||||||
if (currententity->scoreboard) {
|
if (currententity->skin) {
|
||||||
tex_t *base;
|
tex_t *base;
|
||||||
|
|
||||||
if (!currententity->scoreboard->skin)
|
base = currententity->skin->data.texels;
|
||||||
Skin_Find (currententity->scoreboard);
|
|
||||||
base = Skin_Cache (currententity->scoreboard->skin);
|
|
||||||
if (base) {
|
if (base) {
|
||||||
r_affinetridesc.pskin = base->data;
|
r_affinetridesc.pskin = base->data;
|
||||||
r_affinetridesc.skinwidth = 320;
|
r_affinetridesc.skinwidth = base->width;
|
||||||
r_affinetridesc.skinheight = 200;
|
r_affinetridesc.skinheight = base->height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -689,7 +686,7 @@ R_AliasDrawModel (alight_t *plighting)
|
||||||
|
|
||||||
acolormap = currententity->colormap;
|
acolormap = currententity->colormap;
|
||||||
|
|
||||||
if (currententity != &cl.viewent)
|
if (currententity != r_view_model)
|
||||||
ziscale = (float) 0x8000 *(float) 0x10000;
|
ziscale = (float) 0x8000 *(float) 0x10000;
|
||||||
else
|
else
|
||||||
ziscale = (float) 0x8000 *(float) 0x10000 *3.0;
|
ziscale = (float) 0x8000 *(float) 0x10000 *3.0;
|
||||||
|
|
|
@ -73,13 +73,13 @@ Skin_Set_Translate (int top, int bottom, byte *dest)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Skin_Do_Translation (skin_t *player_skin, int slot)
|
Skin_Do_Translation (skin_t *player_skin, int slot, skin_t *skin)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Skin_Do_Translation_Model (model_t *model, int skinnum, int slot)
|
Skin_Do_Translation_Model (model_t *model, int skinnum, int slot, skin_t *skin)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue