From 98e4595d0e25ac077ca8fc2fc6600b79b2f085db Mon Sep 17 00:00:00 2001 From: Tyler Young Date: Sat, 14 Jan 2023 13:56:37 -0500 Subject: [PATCH] Add support for replacing missing models Replaces with missing_model.mdl. --- source/console.c | 4 +++- source/gl_model.c | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/console.c b/source/console.c index add7243..4645149 100644 --- a/source/console.c +++ b/source/console.c @@ -1203,9 +1203,11 @@ void Con_DrawConsole (int lines, qboolean drawinput) GL_SetCanvas (CANVAS_CONSOLE); // draw the background - Draw_ConsoleBackground (); + if (!console_enabled && !developer.value) return; + + Draw_ConsoleBackground (); // draw the buffer text rows = (con_vislines +7)/8; diff --git a/source/gl_model.c b/source/gl_model.c index ed4d146..5eb18ef 100644 --- a/source/gl_model.c +++ b/source/gl_model.c @@ -334,9 +334,11 @@ qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash) buf = COM_LoadStackFile (mod->name, stackbuf, sizeof(stackbuf), & mod->path_id); if (!buf) { - if (crash) - Host_Error ("Mod_LoadModel: %s not found", mod->name); //johnfitz -- was "Mod_NumForName" - return NULL; + buf = (unsigned*)COM_LoadStackFile ("models/missing_model.mdl", stackbuf, sizeof(stackbuf), NULL); + if (buf){ + Con_Printf ("Missing model %s substituted\n", mod->name); + } + return mod; } // @@ -382,7 +384,7 @@ Loads in a model for the given name qmodel_t *Mod_ForName (const char *name, qboolean crash) { qmodel_t *mod; - + mod = Mod_FindName (name); return Mod_LoadModel (mod, crash);