Merge branch 'master' into next

This commit is contained in:
Alam Ed Arias 2018-07-07 16:42:50 -04:00
commit 17570c1ad6
2 changed files with 22 additions and 9 deletions

View file

@ -33,6 +33,7 @@
#include "hw_drv.h" #include "hw_drv.h"
#include "hw_light.h" #include "hw_light.h"
#include "hw_md2.h" #include "hw_md2.h"
#include "../d_main.h"
#include "../r_bsp.h" #include "../r_bsp.h"
#include "../r_main.h" #include "../r_main.h"
#include "../m_misc.h" #include "../m_misc.h"
@ -67,6 +68,10 @@
#endif #endif
#endif #endif
#ifndef errno
#include "errno.h"
#endif
#define NUMVERTEXNORMALS 162 #define NUMVERTEXNORMALS 162
float avertexnormals[NUMVERTEXNORMALS][3] = { float avertexnormals[NUMVERTEXNORMALS][3] = {
{-0.525731f, 0.000000f, 0.850651f}, {-0.525731f, 0.000000f, 0.850651f},
@ -288,7 +293,8 @@ static md2_model_t *md2_readModel(const char *filename)
if (model == NULL) if (model == NULL)
return 0; return 0;
file = fopen(filename, "rb"); //Filename checking fixed ~Monster Iestyn and Golden
file = fopen(va("%s"PATHSEP"%s", srb2home, filename), "rb");
if (!file) if (!file)
{ {
free(model); free(model);
@ -477,7 +483,8 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
#endif #endif
#endif #endif
png_FILE_p png_FILE; 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"); FIL_ForceExtension(pngfilename, ".png");
png_FILE = fopen(pngfilename, "rb"); png_FILE = fopen(pngfilename, "rb");
@ -605,7 +612,8 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
size_t pw, ph, size, ptr = 0; size_t pw, ph, size, ptr = 0;
INT32 ch, rep; INT32 ch, rep;
FILE *file; 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"); FIL_ForceExtension(pcxfilename, ".pcx");
file = fopen(pcxfilename, "rb"); file = fopen(pcxfilename, "rb");
@ -795,11 +803,12 @@ void HWR_InitMD2(void)
} }
// read the md2.dat file // 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) if (!f)
{ {
CONS_Printf("%s", M_GetText("Error while loading md2.dat\n")); CONS_Printf("%s %s\n", M_GetText("Error while loading md2.dat:"), strerror(errno));
nomd2s = true; nomd2s = true;
return; return;
} }
@ -861,7 +870,8 @@ void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
CONS_Printf("AddPlayerMD2()...\n"); CONS_Printf("AddPlayerMD2()...\n");
// read the md2.dat file // 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) if (!f)
{ {
@ -906,7 +916,8 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
return; return;
// Read the md2.dat file // 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) if (!f)
{ {
@ -1347,7 +1358,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames; frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames;
buff = md2->model->glCommandBuffer; buff = md2->model->glCommandBuffer;
curr = &md2->model->frames[frame]; curr = &md2->model->frames[frame];
if (cv_grmd2.value == 1) if (cv_grmd2.value == 1 && tics <= durs)
{ {
// frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation // frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
if (spr->mobj->frame & FF_ANIMATE) if (spr->mobj->frame & FF_ANIMATE)

View file

@ -56,7 +56,9 @@ typedef off_t off64_t;
#endif #endif
#endif #endif
#if defined (_WIN32) #if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3))
#define PRIdS "u"
#elif defined (_WIN32)
#define PRIdS "Iu" #define PRIdS "Iu"
#elif defined (_PSP) || defined (_arch_dreamcast) || defined (DJGPP) || defined (_WII) || defined (_NDS) || defined (_PS3) #elif defined (_PSP) || defined (_arch_dreamcast) || defined (DJGPP) || defined (_WII) || defined (_NDS) || defined (_PS3)
#define PRIdS "u" #define PRIdS "u"