From dbb7267f228dd4f8825c96aa4b9c873c5e340842 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Wed, 9 Jan 2019 15:53:59 -0600 Subject: [PATCH] Missed a few spots --- src/hardware/hw_md2.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 0568151a..63ef8098 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -300,8 +300,12 @@ static md2_model_t *md2_readModel(const char *filename) file = fopen(va("%s"PATHSEP"%s", srb2home, filename), "rb"); if (!file) { - free(model); - return 0; + file = fopen(va("%s"PATHSEP"%s", srb2path, filename), "rb"); + if (!file) + { + free(model); + return 0; + } } // initialize model and read header @@ -500,8 +504,12 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_ png_FILE = fopen(pngfilename, "rb"); if (!png_FILE) { + pngfilename = va("%s"PATHSEP"md2"PATHSEP"%s", srb2path, filename); + FIL_ForceExtension(pngfilename, ".png"); + png_FILE = fopen(pngfilename, "rb"); //CONS_Debug(DBG_RENDER, "M_SavePNG: Error on opening %s for loading\n", filename); - return 0; + if (!png_FILE) + return 0; } png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, @@ -628,7 +636,13 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h, FIL_ForceExtension(pcxfilename, ".pcx"); file = fopen(pcxfilename, "rb"); if (!file) - return 0; + { + pcxfilename = va("%s"PATHSEP"md2"PATHSEP"%s", srb2path, filename); + FIL_ForceExtension(pcxfilename, ".pcx"); + file = fopen(pcxfilename, "rb"); + if (!file) + return 0; + } if (fread(&header, sizeof (PcxHeader), 1, file) != 1) {