I have no idea, but I have code from Quake1 with something similar, that maybe can help you. Unfortunally I dont know much about the .mdl format and the loading stuff,..
This is a Quake1 function:
//Caches the data if needed void *Mod_Extradata (model_t *mod) { void *r;
r = Cache_Check (&mod->cache);//already loaded if (r) return r;
Mod_LoadModel (mod, true); //Its need to load
if (!mod->cache.data) //failed? Sys_Error ("Mod_Extradata: caching failed"); return mod->cache.data; }
Here its some code that use that function (more Q1 code):
void R_DrawAliasModel (entity_t *ent) { int i, anim, skinnum, texture, fb_texture; float scale; vec3_t mins, maxs; aliashdr_t *paliashdr; model_t *clmodel; maliasframedesc_t *oldframe, *frame;
extern cvar_t r_viewmodelsize, cl_drawgun;
VectorCopy (ent->origin, r_entorigin); VectorSubtract (r_origin, r_entorigin, modelorg);
clmodel = ent->model; paliashdr = (aliashdr_t *) Mod_Extradata (ent->model); //locate the proper data
( Looks like "extradata" its the workload of models, the tris stuff.. or whatever similar. )
I think this a problem with the loading/unloading strategy for models. Your mod are triing to use a model that for some reason can't load, or has been freed. Freed? maybe because whas load on temporal memory, or because for some reason the engine thing its not in-use.
If you change your load strategy (change order or whatever similar) you can avoid your bug. But maybe you are doing something really ugly with memory, like freeing pointers you are suppose not :D
Black Panther wrote:
Just in advance: this is a HL1 problem :)
After executing a few changelevel commands I am getting an error message: "Fatal Error: Mod_Extradata: caching failed". Then the game shuts down. It's not something map specific and only occurs after changeleveling through a bunch of maps.
You may try something like this:
unconnect;wait; command_that_flush_resources;wait; changelevel foo
lets help the engine a bit, maybe you are stresing too much
...
Other people suggested it could be a mdl loading problem (bogus data filling up the cache) but why doesn't it occur every time I try to load a map then?
or a corrupt file, unfortunally the sys error its not that informative...
..
but I guess its not a corrupted file
Regards BlackPanther www.bgmod.com
More Q1 fun reading:
void Mod_ClearAll (void) { int i; model_t *mod;
for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) if (mod->type != mod_alias && mod->type != mod_alias3 ) mod->needload = true;
//That needload mark ExtraData you really need to load }
//Free hunk memory up to host_hunklevel //Can only be called when changing levels! void Host_ClearMemory (void) { D_FlushCaches ();
//Test: //Commenting that line crash the engine // reloading levels on some model draw stuff.. on client! Mod_ClearAll ();
// any data previously allocated on hunk is no longer valid Hunk_FreeToLowMark (host_hunklevel); }
notice the comment "changing levels", ;)
I am sure the work on valve with the original memory handling its very high quality, but as Its optimized for gaming, the original design its somewhat.. heee.. arcade? also HL2 its extreme so maybe you are pushing limits. Something that often you can fix with more memory, a 64 bits version of windows or a Steam update :D
note: all this source come from ezQuake
_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders