Skip to content

Commit

Permalink
engine: temporarily fix loading studio models with split texture model
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Jun 10, 2024
1 parent f047749 commit f4b4546
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions engine/common/mod_studio.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,11 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
byte *in, *out;
size_t size1, size2;

#if !XASH_DEDICATED
// TODO: Mod_StudioLoadTextures will crash if passed a merged studio model!
ref.dllFuncs.Mod_StudioLoadTextures( mod, thdr );
#endif

// give space for textures and skinrefs
size1 = thdr->numtextures * sizeof( mstudiotexture_t );
size2 = thdr->numskinfamilies * thdr->numskinref * sizeof( short );
Expand Down Expand Up @@ -917,13 +922,12 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
mod->cache.data = Mem_Calloc( mod->mempool, phdr->length );
memcpy( mod->cache.data, buffer, phdr->length );
phdr = mod->cache.data;
}


#if !XASH_DEDICATED
if( !Host_IsDedicated( ))
ref.dllFuncs.Mod_StudioLoadTextures( mod, phdr );
if( !Host_IsDedicated( ))
ref.dllFuncs.Mod_StudioLoadTextures( mod, phdr );
#endif
}

// NOTE: we may not want to keep raw textures in memory. just cutoff model pointer above texture base
phdr = Mod_MaybeTruncateStudioTextureData( mod );
Expand Down

0 comments on commit f4b4546

Please sign in to comment.