Fixed MD2 models not loading correctly on Linux

This commit is contained in:
GoldenTails 2018-05-13 14:19:36 -05:00 committed by GitHub
parent 8e5ac64d7c
commit e66e0bb20e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -288,7 +288,8 @@ static md2_model_t *md2_readModel(const char *filename)
if (model == NULL)
return 0;
file = fopen(filename, "rb");
//Filename checking fixed ~Monster Iestyn and Golden
file = fopen(va("%s"PATHSEP"%s", srb2home, filename), "rb");
if (!file)
{
free(model);
@ -477,7 +478,8 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
#endif
#endif
png_FILE_p png_FILE;
char *pngfilename = va("md2/%s", filename);
//Filename checking fixed ~Monster Iestyn and Golden
char *pngfilename = va("%s"PATHSEP"md2"PATHSEP"%s", srb2home, filename);
FIL_ForceExtension(pngfilename, ".png");
png_FILE = fopen(pngfilename, "rb");
@ -605,7 +607,8 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
size_t pw, ph, size, ptr = 0;
INT32 ch, rep;
FILE *file;
char *pcxfilename = va("md2/%s", filename);
//Filename checking fixed ~Monster Iestyn and Golden
char *pcxfilename = va("%s"PATHSEP"md2"PATHSEP"%s", srb2home, filename);
FIL_ForceExtension(pcxfilename, ".pcx");
file = fopen(pcxfilename, "rb");
@ -795,7 +798,8 @@ void HWR_InitMD2(void)
}
// read the md2.dat file
f = fopen("md2.dat", "rt");
//Filename checking fixed ~Monster Iestyn and Golden
f = fopen(va("%s"PATHSEP"%s", srb2home, "md2.dat"), "rt");
if (!f)
{
@ -861,7 +865,8 @@ void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
CONS_Printf("AddPlayerMD2()...\n");
// read the md2.dat file
f = fopen("md2.dat", "rt");
//Filename checking fixed ~Monster Iestyn and Golden
f = fopen(va("%s"PATHSEP"%s", srb2home, "md2.dat"), "rt");
if (!f)
{
@ -906,7 +911,8 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
return;
// Read the md2.dat file
f = fopen("md2.dat", "rt");
//Filename checking fixed ~Monster Iestyn and Golden
f = fopen(va("%s"PATHSEP"%s", srb2home, "md2.dat"), "rt");
if (!f)
{