add a crc field to aliashdr_t
model_alias.c:
	set it for all models
cl_parse.c:
	set the pmodel and emodel info keys to the crcs of the player and eye
	models
This commit is contained in:
Bill Currie 2001-05-29 17:37:48 +00:00
parent d441a61bf3
commit f0cfc46cb7
3 changed files with 28 additions and 27 deletions

View file

@ -324,6 +324,9 @@ typedef struct {
int poseverts; int poseverts;
int posedata; // numposes*poseverts trivert_t int posedata; // numposes*poseverts trivert_t
int commands; // gl command list with embedded s/t int commands; // gl command list with embedded s/t
unsigned short crc;
int gl_texturenum[MAX_SKINS][4]; int gl_texturenum[MAX_SKINS][4];
int gl_fb_texturenum[MAX_SKINS][4]; int gl_fb_texturenum[MAX_SKINS][4];
int texels[MAX_SKINS]; // only for player skins int texels[MAX_SKINS]; // only for player skins

View file

@ -94,34 +94,13 @@ Mod_LoadAliasModel (model_t *mod, void *buffer)
daliasframetype_t *pframetype; daliasframetype_t *pframetype;
daliasskintype_t *pskintype; daliasskintype_t *pskintype;
int start, end, total; int start, end, total;
#if 0 //XXX FIXME byte *p;
if (!strcmp (loadmodel->name, "progs/player.mdl") || int len;
!strcmp (loadmodel->name, "progs/eyes.mdl")) { unsigned short crc;
unsigned short crc;
byte *p;
int len;
char st[40];
CRC_Init (&crc); CRC_Init (&crc);
for (len = com_filesize, p = buffer; len; len--, p++) for (len = com_filesize, p = buffer; len; len--, p++)
CRC_ProcessByte (&crc, *p); CRC_ProcessByte (&crc, *p);
snprintf (st, sizeof (st), "%d", (int) crc);
Info_SetValueForKey (cls.userinfo,
!strcmp (loadmodel->name,
"progs/player.mdl") ? pmodel_name :
emodel_name, st, MAX_INFO_STRING);
if (cls.state >= ca_connected) {
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
snprintf (st, sizeof (st), "setinfo %s %d",
!strcmp (loadmodel->name,
"progs/player.mdl") ? pmodel_name : emodel_name,
(int) crc);
SZ_Print (&cls.netchan.message, st);
}
}
#endif
start = Hunk_LowMark (); start = Hunk_LowMark ();
@ -142,6 +121,8 @@ Mod_LoadAliasModel (model_t *mod, void *buffer)
pmodel = &pheader->mdl; pmodel = &pheader->mdl;
pheader->model = (byte *) pmodel - (byte *) pheader; pheader->model = (byte *) pmodel - (byte *) pheader;
pheader->crc = crc;
mod->flags = LittleLong (pinmodel->flags); mod->flags = LittleLong (pinmodel->flags);
// //

View file

@ -272,6 +272,8 @@ Model_NextDownload (void)
Netchan_AckPacket (&cls.netchan); Netchan_AckPacket (&cls.netchan);
for (i = 1; i < MAX_MODELS; i++) { for (i = 1; i < MAX_MODELS; i++) {
char *info_key = 0;
if (!cl.model_name[i][0]) if (!cl.model_name[i][0])
break; break;
@ -285,6 +287,21 @@ Model_NextDownload (void)
CL_Disconnect (); CL_Disconnect ();
return; return;
} }
if (strequal (cl.model_name[i], "progs/player.mdl")
&& cl.model_precache[i]->type == mod_alias)
info_key = pmodel_name;
if (strequal (cl.model_name[i], "progs/eyes.mdl")
&& cl.model_precache[i]->type == mod_alias)
info_key = emodel_name;
if (info_key) {
aliashdr_t *ahdr = (aliashdr_t *) Mod_Extradata (cl.model_precache[i]);
Info_SetValueForKey (cls.userinfo, info_key, va ("%d", ahdr->crc),
MAX_INFO_STRING);
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
SZ_Print (&cls.netchan.message, va ("setinfo %s %d", info_key, ahdr->crc));
}
} }
// Something went wrong (probably in the server, probably a TF server) // Something went wrong (probably in the server, probably a TF server)