- some further lightening of compat.h.

This commit is contained in:
Christoph Oelckers 2021-03-24 21:13:36 +01:00
parent 8993095bc0
commit b7e8815133
12 changed files with 88 additions and 141 deletions

View file

@ -643,7 +643,7 @@ typedef struct
int16_t framenum; // calculate the number from the name when declaring
int16_t nexttile;
uint16_t smoothduration;
hudtyp *hudmem[2];
hudtyp hudmem[2];
int8_t skinnum;
char pal;
} tile2model_t;

View file

@ -91,17 +91,12 @@
#include "engineerrors.h"
////////// DEPRECATED: Standard library prefixing //////////
typedef intptr_t ssize_t;
typedef ssize_t bssize_t;
typedef intptr_t bssize_t;
#define BMAX_PATH 256
////////// Metaprogramming structs //////////
using std::enable_if_t;
using native_t = intptr_t;
typedef struct {
@ -121,31 +116,10 @@ typedef struct {
static_assert(sizeof(vec3f_t) == sizeof(float) * 3);
typedef struct {
union { double x; double d; };
union { double y; double u; };
union { double z; double v; };
} vec3d_t;
static_assert(sizeof(vec3d_t) == sizeof(double) * 3);
////////// Language tricks that depend on size_t //////////
#include "basics.h"
////////// Pointer management //////////
#define DO_FREE_AND_NULL(var) do { \
Xfree(var); (var) = NULL; \
} while (0)
////////// Abstract data operations //////////
using std::min;
using std::max;
////////// Bitfield manipulation //////////
static FORCE_INLINE void bitmap_set(uint8_t *const ptr, int const n) { ptr[n>>3] |= 1 << (n&7); }
@ -174,13 +148,4 @@ void bfirst_search_try(T *const list, uint8_t *const bitmap, T *const eltnumptr,
}
}
////////// PANICKING ALLOCATION WRAPPERS //////////
#define Xstrdup(s) (strdup(s))
#define Xmalloc(size) (M_Malloc(size))
#define Xcalloc(nmemb, size) (M_Calloc(nmemb, size))
#define Xrealloc(ptr, size) (M_Realloc(ptr, size))
#define Xfree(ptr) (M_Free(ptr))
#endif // compat_h_

View file

@ -212,10 +212,6 @@ void voxfree(voxmodel_t *m);
voxmodel_t *voxload(int lumpnum);
int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr);
int md3postload_polymer(md3model_t* m);
//int32_t md_thinoutmodel(int32_t modelid, uint8_t *usedframebitmap);
EXTERN void md_freevbos(void);
#endif // defined USE_OPENGL
enum {

View file

@ -210,8 +210,6 @@ enum scripttoken_t
};
static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0;
static char *faketilebuffer = NULL;
static int32_t faketilebuffersiz = 0;
static const char *skyfaces[6] =
{
@ -3196,9 +3194,6 @@ int32_t loaddefinitionsfile(const char *fn, bool loadadds)
if (script)
scriptfile_close(script);
DO_FREE_AND_NULL(faketilebuffer);
faketilebuffersiz = 0;
if (!script) return -1;
Printf(PRINT_NONOTIFY, "\n");

View file

@ -57,7 +57,7 @@ int16_t pskybits_override = -1;
static TArray<TArray<uint8_t>> voxelmemory;
int16_t tiletovox[MAXTILES];
char *voxfilenames[MAXVOXELS];
int voxlumps[MAXVOXELS];
char g_haveVoxels;
//#define kloadvoxel loadvoxel
@ -799,16 +799,13 @@ int32_t qloadkvx(int32_t voxindex, const char *filename)
}
#ifdef USE_OPENGL
if (voxmodels[voxindex])
{
voxfree(voxmodels[voxindex]);
voxmodels[voxindex] = NULL;
}
Xfree(voxfilenames[voxindex]);
voxfilenames[voxindex] = Xstrdup(filename);
#endif
voxlumps[voxindex] = fileSystem.FindFile(filename);
g_haveVoxels = 1;
@ -817,18 +814,15 @@ int32_t qloadkvx(int32_t voxindex, const char *filename)
void vox_undefine(int32_t const tile)
{
ssize_t voxindex = tiletovox[tile];
int voxindex = tiletovox[tile];
if (voxindex < 0)
return;
#ifdef USE_OPENGL
if (voxmodels[voxindex])
{
voxfree(voxmodels[voxindex]);
voxmodels[voxindex] = NULL;
}
DO_FREE_AND_NULL(voxfilenames[voxindex]);
#endif
voxscale[voxindex] = 65536;
voxrotate[voxindex>>3] &= ~(1 << (voxindex&7));

View file

@ -98,27 +98,23 @@ void freeallmodels()
if (models)
{
for (i=0; i<nextmodelid; i++) mdfree(models[i]);
DO_FREE_AND_NULL(models);
M_Free(models);
models = nullptr;
nummodelsalloced = 0;
nextmodelid = 0;
}
memset(tile2model,-1,sizeof(tile2model));
for (i=0; i<MAXTILES; i++)
memset(tile2model[i].hudmem, 0, sizeof(tile2model[i].hudmem));
curextra=MAXTILES;
if (vertlist)
{
DO_FREE_AND_NULL(vertlist);
M_Free(vertlist);
vertlist = nullptr;
allocmodelverts = maxmodelverts = 0;
allocmodeltris = maxmodeltris = 0;
}
#ifdef POLYMER
DO_FREE_AND_NULL(tribuf);
#endif
}
void mdinit()
@ -135,7 +131,7 @@ int32_t md_loadmodel(const char *fn)
if (nextmodelid >= nummodelsalloced)
{
ml = (mdmodel_t **)Xrealloc(models,(nummodelsalloced+MODELALLOCGROUP)*sizeof(void *));
ml = (mdmodel_t **)M_Realloc(models,(nummodelsalloced+MODELALLOCGROUP)*sizeof(void *));
models = ml; nummodelsalloced += MODELALLOCGROUP;
}
@ -247,7 +243,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *
ma.fpssc = fpssc;
ma.flags = flags;
map = (mdanim_t *)Xmalloc(sizeof(mdanim_t));
map = (mdanim_t *)M_Malloc(sizeof(mdanim_t));
memcpy(map, &ma, sizeof(ma));
@ -278,7 +274,7 @@ int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32
break;
if (!sk)
{
sk = (mdskinmap_t *)Xcalloc(1,sizeof(mdskinmap_t));
sk = (mdskinmap_t *)M_Calloc(1,sizeof(mdskinmap_t));
if (!skl) m->skinmap = sk;
else skl->next = sk;
@ -307,9 +303,7 @@ int32_t md_definehud(int32_t modelid, int32_t tilex, vec3f_t add, int32_t angadd
if ((uint32_t)modelid >= (uint32_t)nextmodelid) return -1;
if ((uint32_t)tilex >= (uint32_t)MAXTILES) return -2;
tile2model[tilex].hudmem[(flags>>2)&1] = (hudtyp *)Xmalloc(sizeof(hudtyp));
hudtyp * const hud = tile2model[tilex].hudmem[(flags>>2)&1];
hudtyp * const hud = &tile2model[tilex].hudmem[(flags>>2)&1];
hud->add = add;
hud->angadd = ((int16_t)angadd)|2048;
@ -326,8 +320,6 @@ int32_t md_undefinetile(int32_t tile)
tile2model[tile].modelid = -1;
tile2model[tile].nexttile = -1;
DO_FREE_AND_NULL(tile2model[tile].hudmem[0]);
DO_FREE_AND_NULL(tile2model[tile].hudmem[1]);
return 0;
}
@ -343,8 +335,6 @@ int32_t md_undefinemodel(int32_t modelid)
if (tile2model[i].modelid == modelid)
{
tile2model[i].modelid = -1;
DO_FREE_AND_NULL(tile2model[i].hudmem[0]);
DO_FREE_AND_NULL(tile2model[i].hudmem[1]);
}
if (models)
@ -566,7 +556,7 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
int32_t ournumskins, ournumglcmds;
m = (md2model_t *)Xcalloc(1,sizeof(md2model_t));
m = (md2model_t *)M_Calloc(1,sizeof(md2model_t));
m->mdnum = 2; m->scale = .01f;
fil.Read((char *)&head,sizeof(md2head_t));
@ -582,7 +572,7 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
head.ofseof = LittleLong(head.ofseof);
#endif
if ((head.id != IDP2_MAGIC) || (head.vers != 8)) { Xfree(m); return 0; } //"IDP2"
if ((head.id != IDP2_MAGIC) || (head.vers != 8)) { M_Free(m); return 0; } //"IDP2"
ournumskins = head.numskins ? head.numskins : 1;
ournumglcmds = head.numglcmds ? head.numglcmds : 1;
@ -593,29 +583,29 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
m->numglcmds = head.numglcmds;
m->framebytes = head.framebytes;
m->frames = (char *)Xmalloc(m->numframes*m->framebytes);
m->glcmds = (int32_t *)Xmalloc(ournumglcmds*sizeof(int32_t));
m->tris = (md2tri_t *)Xmalloc(head.numtris*sizeof(md2tri_t));
m->uv = (md2uv_t *)Xmalloc(head.numuv*sizeof(md2uv_t));
m->frames = (char *)M_Malloc(m->numframes*m->framebytes);
m->glcmds = (int32_t *)M_Malloc(ournumglcmds*sizeof(int32_t));
m->tris = (md2tri_t *)M_Malloc(head.numtris*sizeof(md2tri_t));
m->uv = (md2uv_t *)M_Malloc(head.numuv*sizeof(md2uv_t));
fil.Seek(head.ofsframes,FileReader::SeekSet);
if (fil.Read((char *)m->frames,m->numframes*m->framebytes) != m->numframes*m->framebytes)
{ Xfree(m->uv); Xfree(m->tris); Xfree(m->glcmds); Xfree(m->frames); Xfree(m); return 0; }
{ M_Free(m->uv); M_Free(m->tris); M_Free(m->glcmds); M_Free(m->frames); M_Free(m); return 0; }
if (m->numglcmds > 0)
{
fil.Seek(head.ofsglcmds,FileReader::SeekSet);
if (fil.Read((char *)m->glcmds,m->numglcmds*sizeof(int32_t)) != (int32_t)(m->numglcmds*sizeof(int32_t)))
{ Xfree(m->uv); Xfree(m->tris); Xfree(m->glcmds); Xfree(m->frames); Xfree(m); return 0; }
{ M_Free(m->uv); M_Free(m->tris); M_Free(m->glcmds); M_Free(m->frames); M_Free(m); return 0; }
}
fil.Seek(head.ofstris,FileReader::SeekSet);
if (fil.Read((char *)m->tris,head.numtris*sizeof(md2tri_t)) != (int32_t)(head.numtris*sizeof(md2tri_t)))
{ Xfree(m->uv); Xfree(m->tris); Xfree(m->glcmds); Xfree(m->frames); Xfree(m); return 0; }
{ M_Free(m->uv); M_Free(m->tris); M_Free(m->glcmds); M_Free(m->frames); M_Free(m); return 0; }
fil.Seek(head.ofsuv,FileReader::SeekSet);
if (fil.Read((char *)m->uv,head.numuv*sizeof(md2uv_t)) != (int32_t)(head.numuv*sizeof(md2uv_t)))
{ Xfree(m->uv); Xfree(m->tris); Xfree(m->glcmds); Xfree(m->frames); Xfree(m); return 0; }
{ M_Free(m->uv); M_Free(m->tris); M_Free(m->glcmds); M_Free(m->frames); M_Free(m); return 0; }
#if B_BIG_ENDIAN != 0
{
@ -657,15 +647,15 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
if ((st[i] == '/') || (st[i] == '\\')) { i++; break; }
if (i<0) i=0;
st[i] = 0;
m->basepath = (char *)Xmalloc(i+1);
m->basepath = (char *)M_Malloc(i+1);
strcpy(m->basepath, st);
m->skinfn = (char *)Xmalloc(ournumskins*64);
m->skinfn = (char *)M_Malloc(ournumskins*64);
if (m->numskins > 0)
{
fil.Seek(head.ofsskins,FileReader::SeekSet);
if (fil.Read(m->skinfn,64*m->numskins) != 64*m->numskins)
{ Xfree(m->glcmds); Xfree(m->frames); Xfree(m); return 0; }
{ M_Free(m->glcmds); M_Free(m->frames); M_Free(m); return 0; }
}
maxmodelverts = max(maxmodelverts, m->numverts);
@ -675,7 +665,7 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
// the MD2 is now loaded internally - let's begin the MD3 conversion process
//Printf("Beginning md3 conversion.\n");
m3 = (md3model_t *)Xcalloc(1, sizeof(md3model_t));
m3 = (md3model_t *)M_Calloc(1, sizeof(md3model_t));
m3->mdnum = 3; m3->texture = nullptr; m3->scale = m->scale;
m3->head.id = IDP3_MAGIC; m3->head.vers = 15;
@ -688,8 +678,8 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
m3->numskins = m3->head.numskins;
m3->numframes = m3->head.numframes;
m3->head.frames = (md3frame_t *)Xcalloc(m3->head.numframes, sizeof(md3frame_t));
m3->muladdframes = (vec3f_t *)Xcalloc(m->numframes * 2, sizeof(vec3f_t));
m3->head.frames = (md3frame_t *)M_Calloc(m3->head.numframes, sizeof(md3frame_t));
m3->muladdframes = (vec3f_t *)M_Calloc(m->numframes * 2, sizeof(vec3f_t));
f = (md2frame_t *)(m->frames);
@ -707,7 +697,7 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
m3->head.tags = NULL;
m3->head.surfs = (md3surf_t *)Xcalloc(1, sizeof(md3surf_t));
m3->head.surfs = (md3surf_t *)M_Calloc(1, sizeof(md3surf_t));
s = m3->head.surfs;
// model converting
@ -724,9 +714,9 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
s->shaders = NULL;
s->tris = (md3tri_t *)Xcalloc(head.numtris, sizeof(md3tri_t));
s->uv = (md3uv_t *)Xcalloc(s->numverts, sizeof(md3uv_t));
s->xyzn = (md3xyzn_t *)Xcalloc(s->numverts * m->numframes, sizeof(md3xyzn_t));
s->tris = (md3tri_t *)M_Calloc(head.numtris, sizeof(md3tri_t));
s->uv = (md3uv_t *)M_Calloc(s->numverts, sizeof(md3uv_t));
s->xyzn = (md3xyzn_t *)M_Calloc(s->numverts * m->numframes, sizeof(md3xyzn_t));
//memoryusage += (s->numverts * m->numframes * sizeof(md3xyzn_t));
//Printf("Current model geometry memory usage : %i.\n", memoryusage);
@ -771,7 +761,7 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
{
mdskinmap_t *sk;
sk = (mdskinmap_t *)Xcalloc(1,sizeof(mdskinmap_t));
sk = (mdskinmap_t *)M_Calloc(1,sizeof(mdskinmap_t));
sk->palette = 0;
sk->skinnum = 0;
sk->surfnum = 0;
@ -788,12 +778,12 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
m3->skinmap = sk;
}
m3->indexes = (uint16_t *)Xmalloc(sizeof(uint16_t) * s->numtris);
m3->vindexes = (uint16_t *)Xmalloc(sizeof(uint16_t) * s->numtris * 3);
m3->maxdepths = (float *)Xmalloc(sizeof(float) * s->numtris);
m3->indexes = (uint16_t *)M_Malloc(sizeof(uint16_t) * s->numtris);
m3->vindexes = (uint16_t *)M_Malloc(sizeof(uint16_t) * s->numtris * 3);
m3->maxdepths = (float *)M_Malloc(sizeof(float) * s->numtris);
// die MD2 ! DIE !
Xfree(m->skinfn); Xfree(m->basepath); Xfree(m->uv); Xfree(m->tris); Xfree(m->glcmds); Xfree(m->frames); Xfree(m);
M_Free(m->skinfn); M_Free(m->basepath); M_Free(m->uv); M_Free(m->tris); M_Free(m->glcmds); M_Free(m->frames); M_Free(m);
return ((md2model_t *)m3);
}
@ -845,7 +835,7 @@ static md3model_t *md3load(FileReader & fil)
md3model_t *m;
md3surf_t *s;
m = (md3model_t *)Xcalloc(1,sizeof(md3model_t));
m = (md3model_t *)M_Calloc(1,sizeof(md3model_t));
m->mdnum = 3; m->texture = nullptr; m->scale = .01f;
m->muladdframes = NULL;
@ -861,7 +851,7 @@ static md3model_t *md3load(FileReader & fil)
m->head.eof = LittleLong(m->head.eof);
#endif
if ((m->head.id != IDP3_MAGIC) && (m->head.vers != 15)) { Xfree(m); return 0; } //"IDP3"
if ((m->head.id != IDP3_MAGIC) && (m->head.vers != 15)) { M_Free(m); return 0; } //"IDP3"
m->numskins = m->head.numskins; //<- dead code?
m->numframes = m->head.numframes;
@ -869,19 +859,19 @@ static md3model_t *md3load(FileReader & fil)
ofsurf = m->head.ofssurfs;
fil.Seek(m->head.ofsframes,FileReader::SeekSet); i = m->head.numframes*sizeof(md3frame_t);
m->head.frames = (md3frame_t *)Xmalloc(i);
m->head.frames = (md3frame_t *)M_Malloc(i);
fil.Read(m->head.frames,i);
if (m->head.numtags == 0) m->head.tags = NULL;
else
{
fil.Seek(m->head.ofstags,FileReader::SeekSet); i = m->head.numtags*sizeof(md3tag_t);
m->head.tags = (md3tag_t *)Xmalloc(i);
m->head.tags = (md3tag_t *)M_Malloc(i);
fil.Read(m->head.tags,i);
}
fil.Seek(m->head.ofssurfs,FileReader::SeekSet);
m->head.surfs = (md3surf_t *)Xcalloc(m->head.numsurfs, sizeof(md3surf_t));
m->head.surfs = (md3surf_t *)M_Calloc(m->head.numsurfs, sizeof(md3surf_t));
// NOTE: We assume that NULL is represented by all-zeros.
// surfs[0].geometry is for POLYMER_MD_PROCESS_CHECK (else: crashes).
// surfs[i].geometry is for FREE_SURFS_GEOMETRY.
@ -934,7 +924,7 @@ static md3model_t *md3load(FileReader & fil)
//memoryusage += (s->numverts * s->numframes * sizeof(md3xyzn_t));
//Printf("Current model geometry memory usage : %i.\n", memoryusage);
s->tris = (md3tri_t *)Xmalloc((leng[0] + leng[1]) + (leng[2] + leng[3]));
s->tris = (md3tri_t *)M_Malloc((leng[0] + leng[1]) + (leng[2] + leng[3]));
s->shaders = (md3shader_t *)(((intptr_t)s->tris)+leng[0]);
s->uv = (md3uv_t *)(((intptr_t)s->shaders)+leng[1]);
@ -977,9 +967,9 @@ static md3model_t *md3load(FileReader & fil)
ofsurf += s->ofsend;
}
m->indexes = (uint16_t *)Xmalloc(sizeof(uint16_t) * maxtrispersurf);
m->vindexes = (uint16_t *)Xmalloc(sizeof(uint16_t) * maxtrispersurf * 3);
m->maxdepths = (float *)Xmalloc(sizeof(float) * maxtrispersurf);
m->indexes = (uint16_t *)M_Malloc(sizeof(uint16_t) * maxtrispersurf);
m->vindexes = (uint16_t *)M_Malloc(sizeof(uint16_t) * maxtrispersurf * 3);
m->maxdepths = (float *)M_Malloc(sizeof(float) * maxtrispersurf);
return m;
}
@ -1452,12 +1442,12 @@ static void md3free(md3model_t *m)
for (anim=m->animations; anim; anim=nanim)
{
nanim = anim->next;
Xfree(anim);
M_Free(anim);
}
for (sk=m->skinmap; sk; sk=nsk)
{
nsk = sk->next;
Xfree(sk);
M_Free(sk);
}
if (m->head.surfs)
@ -1465,21 +1455,21 @@ static void md3free(md3model_t *m)
for (bssize_t surfi=m->head.numsurfs-1; surfi>=0; surfi--)
{
md3surf_t *s = &m->head.surfs[surfi];
Xfree(s->tris);
Xfree(s->geometry); // FREE_SURFS_GEOMETRY
M_Free(s->tris);
M_Free(s->geometry); // FREE_SURFS_GEOMETRY
}
Xfree(m->head.surfs);
M_Free(m->head.surfs);
}
Xfree(m->head.tags);
Xfree(m->head.frames);
M_Free(m->head.tags);
M_Free(m->head.frames);
Xfree(m->muladdframes);
M_Free(m->muladdframes);
Xfree(m->indexes);
Xfree(m->vindexes);
Xfree(m->maxdepths);
M_Free(m->indexes);
M_Free(m->vindexes);
M_Free(m->maxdepths);
Xfree(m);
M_Free(m);
}
//---------------------------------------- MD3 LIBRARY ENDS ----------------------------------------
@ -1535,7 +1525,7 @@ int32_t polymost_mddraw(tspriteptr_t tspr)
{
if (maxmodelverts > allocmodelverts)
{
vertlist = (vec3f_t *) Xrealloc(vertlist, sizeof(vec3f_t)*maxmodelverts);
vertlist = (vec3f_t *) M_Realloc(vertlist, sizeof(vec3f_t)*maxmodelverts);
allocmodelverts = maxmodelverts;
}

View file

@ -25,6 +25,17 @@ Ken Silverman's official web site: http://www.advsys.net/ken
#include "gamefuncs.h"
#include "hw_drawinfo.h"
typedef struct {
union { double x; double d; };
union { double y; double u; };
union { double z; double v; };
} vec3d_t;
static_assert(sizeof(vec3d_t) == sizeof(double) * 3);
int skiptile = -1;
FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t* tilemap);

View file

@ -22,10 +22,7 @@ using namespace Polymost;
void voxfree(voxmodel_t *m)
{
if (!m)
return;
Xfree(m);
if (m) delete m;
}
voxmodel_t *voxload(int lumpnum)
@ -33,8 +30,8 @@ voxmodel_t *voxload(int lumpnum)
FVoxel* voxel = R_LoadKVX(lumpnum);
if (voxel != nullptr)
{
voxmodel_t* vm = (voxmodel_t*)Xmalloc(sizeof(voxmodel_t));
memset(vm, 0, sizeof(voxmodel_t));
voxmodel_t* vm = new voxmodel_t;
*vm = {};
auto pivot = voxel->Mips[0].Pivot;
vm->mdnum = 1; //VOXel model id
vm->scale = vm->bscale = 1.f;
@ -53,7 +50,6 @@ voxmodel_t *voxload(int lumpnum)
}
//Draw voxel model as perfect cubes
// Note: This is a hopeless mess that totally forfeits any chance of using a vertex buffer with its messy coordinate adjustments. :(
int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr)
{
float f, g, k0, zoff;
@ -193,7 +189,7 @@ int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr)
return 1;
}
extern char* voxfilenames[MAXVOXELS];
extern int voxlumps[MAXVOXELS];
void (*PolymostProcessVoxels_Callback)(void) = NULL;
void PolymostProcessVoxels(void)
{
@ -207,17 +203,13 @@ void PolymostProcessVoxels(void)
Printf(PRINT_NONOTIFY, "Generating voxel models for Polymost. This may take a while...\n");
for (bssize_t i = 0; i < MAXVOXELS; i++)
for (int i = 0; i < MAXVOXELS; i++)
{
if (voxfilenames[i])
int lumpnum = voxlumps[i];
if (lumpnum >= 0)
{
int lumpnum = fileSystem.FindFile(voxfilenames[i]);
if (lumpnum >= 0)
{
voxmodels[i] = voxload(lumpnum);
voxmodels[i]->scale = voxscale[i] * (1.f / 65536.f);
}
DO_FREE_AND_NULL(voxfilenames[i]);
voxmodels[i] = voxload(lumpnum);
voxmodels[i]->scale = voxscale[i] * (1.f / 65536.f);
}
}
}

View file

@ -2,6 +2,7 @@
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#define MAXWIDTH 12000
#define MAXHEIGHT 5000
@ -101,3 +102,6 @@ enum EStateUseFlags
SUF_WEAPON = 4,
SUF_ITEM = 8,
};
using std::min;
using std::max;

View file

@ -934,10 +934,10 @@ bool AddINIFile(const char* pzFile, bool bForce = false)
if (findfrompath(pzFile, &pzFN)) return false; // failed to resolve the filename
if (!FileExists(pzFN))
{
Xfree(pzFN);
M_Free(pzFN);
return false;
} // failed to stat the file
Xfree(pzFN);
M_Free(pzFN);
IniFile* pTempIni = new IniFile(pzFile);
if (!pTempIni->FindSection("Episode1"))
{

View file

@ -632,7 +632,7 @@ void artSetupMapArt(const char* filename)
}
for (bssize_t i = 0; i < MAXARTFILES_TOTAL - MAXARTFILES_BASE; i++)
for (int i = 0; i < MAXARTFILES_TOTAL - MAXARTFILES_BASE; i++)
{
FStringf fullname("%s_%02d.art", filename, i);
TileFiles.LoadArtFile(fullname, filename);

View file

@ -44,7 +44,7 @@ typedef struct
} saveable_module;
template <typename T>
constexpr enable_if_t<!std::is_pointer<T>::value, size_t> SAVE_SIZEOF(T const & obj) noexcept
constexpr std::enable_if_t<!std::is_pointer<T>::value, size_t> SAVE_SIZEOF(T const & obj) noexcept
{
return sizeof(obj);
}