gl_model.c (Mod_LoadModel): buf needn't be an unsigned int pointer, made

it into a byte pointer, extracted the mod type from the header by bit shifts.
also removed the unnecessary void pointer variable.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@69 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2010-02-20 00:20:08 +00:00
parent 8e0638e867
commit 18080769da

View file

@ -251,16 +251,15 @@ Loads a model into the cache
*/ */
model_t *Mod_LoadModel (model_t *mod, qboolean crash) model_t *Mod_LoadModel (model_t *mod, qboolean crash)
{ {
void *d; byte *buf;
unsigned *buf;
byte stackbuf[1024]; // avoid dirtying the cache heap byte stackbuf[1024]; // avoid dirtying the cache heap
int mod_type;
if (!mod->needload) if (!mod->needload)
{ {
if (mod->type == mod_alias) if (mod->type == mod_alias)
{ {
d = Cache_Check (&mod->cache); if (Cache_Check (&mod->cache))
if (d)
return mod; return mod;
} }
else else
@ -278,7 +277,7 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
// //
// load the file // load the file
// //
buf = (unsigned *)COM_LoadStackFile (mod->name, stackbuf, sizeof(stackbuf)); buf = COM_LoadStackFile (mod->name, stackbuf, sizeof(stackbuf));
if (!buf) if (!buf)
{ {
if (crash) if (crash)
@ -300,7 +299,8 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
// call the apropriate loader // call the apropriate loader
mod->needload = false; mod->needload = false;
switch (LittleLong(*(unsigned *)buf)) mod_type = (buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24));
switch (mod_type)
{ {
case IDPOLYHEADER: case IDPOLYHEADER:
Mod_LoadAliasModel (mod, buf); Mod_LoadAliasModel (mod, buf);