From 18080769daea5d128ef3bf981b10d30c42cf25c6 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 20 Feb 2010 00:20:08 +0000 Subject: [PATCH] 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 --- Quake/gl_model.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Quake/gl_model.c b/Quake/gl_model.c index 08e5c129..47d3e7ad 100644 --- a/Quake/gl_model.c +++ b/Quake/gl_model.c @@ -251,16 +251,15 @@ Loads a model into the cache */ model_t *Mod_LoadModel (model_t *mod, qboolean crash) { - void *d; - unsigned *buf; + byte *buf; byte stackbuf[1024]; // avoid dirtying the cache heap + int mod_type; if (!mod->needload) { if (mod->type == mod_alias) { - d = Cache_Check (&mod->cache); - if (d) + if (Cache_Check (&mod->cache)) return mod; } else @@ -278,7 +277,7 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash) // // load the file // - buf = (unsigned *)COM_LoadStackFile (mod->name, stackbuf, sizeof(stackbuf)); + buf = COM_LoadStackFile (mod->name, stackbuf, sizeof(stackbuf)); if (!buf) { if (crash) @@ -300,7 +299,8 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash) // call the apropriate loader 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: Mod_LoadAliasModel (mod, buf);