summaryrefslogtreecommitdiff
path: root/src/renderer/tr_model.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2009-10-03 12:31:59 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:03 +0000
commit304d4258d3a49488f570b8ad71931faa7e5d40ba (patch)
treebf9ec15bd9154305ff9fab2943b3daf25024f8a5 /src/renderer/tr_model.c
parent6e90e4e7861f5cb354487d1fe0f1fd06c385308e (diff)
* Merge ioq3-r1498, by popular demand
Diffstat (limited to 'src/renderer/tr_model.c')
-rw-r--r--src/renderer/tr_model.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/renderer/tr_model.c b/src/renderer/tr_model.c
index b4ca744f..8707d8a7 100644
--- a/src/renderer/tr_model.c
+++ b/src/renderer/tr_model.c
@@ -84,7 +84,10 @@ asked for again.
*/
qhandle_t RE_RegisterModel( const char *name ) {
model_t *mod;
- unsigned *buf;
+ union {
+ unsigned *u;
+ void *v;
+ } buf;
int lod;
int ident;
qboolean loaded = qfalse;
@@ -152,19 +155,19 @@ qhandle_t RE_RegisterModel( const char *name ) {
{
int filesize;
- filesize = ri.FS_ReadFile(name, (void **) &buf);
- if(!buf)
+ filesize = ri.FS_ReadFile(name, (void **) &buf.v);
+ if(!buf.u)
{
ri.Printf (PRINT_WARNING,"RE_RegisterModel: couldn't load %s\n", name);
mod->type = MOD_BAD;
return 0;
}
- ident = LittleLong(*(unsigned *)buf);
+ ident = LittleLong(*(unsigned *)buf.u);
if(ident == MDR_IDENT)
- loaded = R_LoadMDR(mod, buf, filesize, name);
+ loaded = R_LoadMDR(mod, buf.u, filesize, name);
- ri.FS_FreeFile (buf);
+ ri.FS_FreeFile (buf.v);
if(!loaded)
{
@@ -185,26 +188,26 @@ qhandle_t RE_RegisterModel( const char *name ) {
else
Com_sprintf(namebuf, sizeof(namebuf), "%s.%s", filename, fext);
- ri.FS_ReadFile( namebuf, (void **)&buf );
- if ( !buf ) {
+ ri.FS_ReadFile( namebuf, &buf.v );
+ if ( !buf.u ) {
continue;
}
loadmodel = mod;
- ident = LittleLong(*(unsigned *)buf);
+ ident = LittleLong(*(unsigned *)buf.u);
if ( ident == MD4_IDENT ) {
- loaded = R_LoadMD4( mod, buf, name );
+ loaded = R_LoadMD4( mod, buf.u, name );
} else {
if ( ident != MD3_IDENT ) {
ri.Printf (PRINT_WARNING,"RE_RegisterModel: unknown fileid for %s\n", name);
goto fail;
}
- loaded = R_LoadMD3( mod, lod, buf, name );
+ loaded = R_LoadMD3( mod, lod, buf.u, name );
}
- ri.FS_FreeFile (buf);
+ ri.FS_FreeFile (buf.v);
if ( !loaded ) {
if ( lod == 0 ) {