mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
model.h:
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:
parent
d441a61bf3
commit
f0cfc46cb7
3 changed files with 28 additions and 27 deletions
|
@ -324,6 +324,9 @@ typedef struct {
|
|||
int poseverts;
|
||||
int posedata; // numposes*poseverts trivert_t
|
||||
int commands; // gl command list with embedded s/t
|
||||
|
||||
unsigned short crc;
|
||||
|
||||
int gl_texturenum[MAX_SKINS][4];
|
||||
int gl_fb_texturenum[MAX_SKINS][4];
|
||||
int texels[MAX_SKINS]; // only for player skins
|
||||
|
|
|
@ -94,34 +94,13 @@ Mod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
daliasframetype_t *pframetype;
|
||||
daliasskintype_t *pskintype;
|
||||
int start, end, total;
|
||||
#if 0 //XXX FIXME
|
||||
if (!strcmp (loadmodel->name, "progs/player.mdl") ||
|
||||
!strcmp (loadmodel->name, "progs/eyes.mdl")) {
|
||||
unsigned short crc;
|
||||
byte *p;
|
||||
int len;
|
||||
char st[40];
|
||||
byte *p;
|
||||
int len;
|
||||
unsigned short crc;
|
||||
|
||||
CRC_Init (&crc);
|
||||
for (len = com_filesize, p = buffer; len; len--, 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
|
||||
CRC_Init (&crc);
|
||||
for (len = com_filesize, p = buffer; len; len--, p++)
|
||||
CRC_ProcessByte (&crc, *p);
|
||||
|
||||
start = Hunk_LowMark ();
|
||||
|
||||
|
@ -142,6 +121,8 @@ Mod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
pmodel = &pheader->mdl;
|
||||
pheader->model = (byte *) pmodel - (byte *) pheader;
|
||||
|
||||
pheader->crc = crc;
|
||||
|
||||
mod->flags = LittleLong (pinmodel->flags);
|
||||
|
||||
//
|
||||
|
|
|
@ -272,6 +272,8 @@ Model_NextDownload (void)
|
|||
Netchan_AckPacket (&cls.netchan);
|
||||
|
||||
for (i = 1; i < MAX_MODELS; i++) {
|
||||
char *info_key = 0;
|
||||
|
||||
if (!cl.model_name[i][0])
|
||||
break;
|
||||
|
||||
|
@ -285,6 +287,21 @@ Model_NextDownload (void)
|
|||
CL_Disconnect ();
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue