Time matters and sometimes inelegant solutions take 10 minutes and proper ones take potentially days of planning. And in reality, a released mod will not have missing models. Missing model support is important because it allows you to more rapidly develop mods. It is one of the greatest features in DarkPlaces to make life easy on the modder. Sure this doesn't draw the OpenGL colored pyramid that DP does and does need some sort of fallback media, but if you are developing a mod you are really looking for a hack to allow you to merrily continue momentum and not something to cover a major omission in a mod release.
We begin ...
1. Open gl_model.c [model.c in WinQuakey clients or video_hardware_model.cpp in PSP ones and go to Mod_LoadModel function].
And find this ...
Code: Select all
//
// load the file
//
buf = (unsigned *)COM_LoadStackFile (mod->name, stackbuf, sizeof(stackbuf));
<<<< INSERT CODE BELOW HERE>>>>
if (!buf)
{
if (crash)
Sys_Error ("Mod_LoadModel: %s not found", mod->name);
return NULL;
}
Code: Select all
#define RUNS_WITH_MISSING_MODELS 1
#if RUNS_WITH_MISSING_MODELS
if (!buf && crash)
{
// Reload with another .mdl
buf = (unsigned *)COM_LoadStackFile("missing_model.mdl", stackbuf, sizeof(stackbuf));
if (buf)
{
Con_Printf ("Missing model %s substituted\n", mod->name);
}
}
#endif
Don't worry, it'll still crash if it can't find the substitute model.