mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-27 01:10:51 +00:00
More memory pool crap, startup window log update fixes, gameland light changes and minor polymer fixes
git-svn-id: https://svn.eduke32.com/eduke32@1430 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
980534075a
commit
47a9332a16
16 changed files with 310 additions and 316 deletions
|
@ -26,8 +26,9 @@ RANCID_NETWORKING = 1
|
|||
RELEASE?=1
|
||||
DEBUGANYWAY?=0
|
||||
NOSOUND?=0
|
||||
USE_OPENAL ?= 1
|
||||
USE_OPENAL?=1
|
||||
OPTLEVEL?=2
|
||||
PROFILER?=0
|
||||
|
||||
# Build locations
|
||||
SRC=source
|
||||
|
@ -74,7 +75,7 @@ OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
|
|||
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(SRC)/jaudiolib -D_FORTIFY_SOURCE=2 \
|
||||
# -march=pentium3 -mtune=generic -mmmx -m3dnow -msse -mfpmath=sse
|
||||
OURCXXFLAGS=-fno-exceptions -fno-rtti
|
||||
LIBS=-lm # -lprofiler
|
||||
LIBS=-lm
|
||||
|
||||
NASMFLAGS = -s
|
||||
EXESUFFIX=
|
||||
|
@ -85,6 +86,9 @@ include $(EROOT)/Makefile.shared
|
|||
OBJ=obj_win
|
||||
EOBJ=eobj_win
|
||||
else
|
||||
ifeq (1,$(PROFILER))
|
||||
LIBS+= -lprofiler
|
||||
endif
|
||||
OBJ=obj
|
||||
EOBJ=eobj
|
||||
endif
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SYSTEM_POOL_SIZE (256 * 1048576)
|
||||
|
||||
extern int32_t _buildargc;
|
||||
extern const char **_buildargv;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#endif
|
||||
|
||||
#define REPLACE_SYSTEM_ALLOCATOR
|
||||
#define THREADCACHEMAX 65536
|
||||
#include "nedmalloc.h"
|
||||
|
||||
#ifndef TRUE
|
||||
|
|
|
@ -332,7 +332,7 @@ static inline void polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLfloat*
|
|||
static inline void polymer_transformpoint(float* inpos, float* pos, float* matrix);
|
||||
static inline void polymer_pokesector(int16_t sectnum);
|
||||
static void polymer_extractfrustum(GLfloat* modelview, GLfloat* projection, float* frustum);
|
||||
static int32_t polymer_planeinfrustum(_prplane *plane, float* frustum);
|
||||
static inline int32_t polymer_planeinfrustum(_prplane *plane, float* frustum);
|
||||
static inline void polymer_scansprites(int16_t sectnum, spritetype* tsprite, int32_t* spritesortcnt);
|
||||
// SKIES
|
||||
static void polymer_getsky(void);
|
||||
|
|
|
@ -61,7 +61,7 @@ char *strtolower(char *str, int32_t len)
|
|||
return str;
|
||||
}
|
||||
|
||||
int32_t flushlogwindow = 0;
|
||||
int32_t flushlogwindow = 1;
|
||||
|
||||
static void onvideomodechange(int32_t newmode) { UNREFERENCED_PARAMETER(newmode); }
|
||||
void (*baselayer_onvideomodechange)(int32_t) = onvideomodechange;
|
||||
|
|
|
@ -1815,12 +1815,17 @@ static int32_t defsparser(scriptfile *script)
|
|||
int32_t loaddefinitionsfile(char *fn)
|
||||
{
|
||||
scriptfile *script;
|
||||
int32_t f = flushlogwindow;
|
||||
|
||||
script = scriptfile_fromfile(fn);
|
||||
if (!script) return -1;
|
||||
|
||||
flushlogwindow = 1;
|
||||
initprintf("Loading '%s'\n",fn);
|
||||
flushlogwindow = 0;
|
||||
defsparser(script);
|
||||
|
||||
flushlogwindow = f;
|
||||
scriptfile_close(script);
|
||||
scriptfile_clearsymbols();
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
voxmodel_t *voxmodels[MAXVOXELS];
|
||||
int32_t curextra=MAXTILES;
|
||||
nedpool *model_data_pool;
|
||||
#define MODEL_POOL_SIZE 20971520
|
||||
|
||||
int32_t addtileP(int32_t model,int32_t tile,int32_t pallet)
|
||||
{
|
||||
|
@ -66,39 +68,6 @@ int32_t globalnoeffect=0;
|
|||
|
||||
extern int32_t timerticspersec;
|
||||
|
||||
void freeallmodels()
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
if (models)
|
||||
{
|
||||
for (i=0; i<nextmodelid; i++) mdfree(models[i]);
|
||||
free(models); models = NULL;
|
||||
nummodelsalloced = 0;
|
||||
nextmodelid = 0;
|
||||
}
|
||||
|
||||
memset(tile2model,-1,sizeof(tile2model));
|
||||
curextra=MAXTILES;
|
||||
|
||||
if (vertlist)
|
||||
{
|
||||
free(vertlist);
|
||||
vertlist = NULL;
|
||||
allocmodelverts = maxmodelverts = 0;
|
||||
allocmodeltris = maxmodeltris = 0;
|
||||
}
|
||||
|
||||
if (allocvbos)
|
||||
{
|
||||
bglDeleteBuffersARB(allocvbos, indexvbos);
|
||||
bglDeleteBuffersARB(allocvbos, vertvbos);
|
||||
// free(indexvbos);
|
||||
// free(vertvbos);
|
||||
allocvbos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void freevbos()
|
||||
{
|
||||
int32_t i;
|
||||
|
@ -109,23 +78,49 @@ void freevbos()
|
|||
md3model_t *m = (md3model_t *)models[i];
|
||||
if (m->vbos)
|
||||
{
|
||||
// OSD_Printf("freeing model %d vbo\n",i);
|
||||
// OSD_Printf("freeing model %d vbo\n",i);
|
||||
bglDeleteBuffersARB(m->head.numsurfs, m->vbos);
|
||||
free(m->vbos);
|
||||
nedpfree(model_data_pool, m->vbos);
|
||||
m->vbos = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (allocvbos)
|
||||
if (allocvbos)
|
||||
{
|
||||
bglDeleteBuffersARB(allocvbos, indexvbos);
|
||||
bglDeleteBuffersARB(allocvbos, vertvbos);
|
||||
allocvbos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void freeallmodels()
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
if (models)
|
||||
{
|
||||
bglDeleteBuffersARB(allocvbos, indexvbos);
|
||||
bglDeleteBuffersARB(allocvbos, vertvbos);
|
||||
/*
|
||||
free(indexvbos);
|
||||
free(vertvbos);
|
||||
indexvbos = vertvbos = NULL;
|
||||
*/
|
||||
allocvbos = 0;
|
||||
for (i=0; i<nextmodelid; i++) mdfree(models[i]);
|
||||
nedpfree(model_data_pool, models); models = NULL;
|
||||
nummodelsalloced = 0;
|
||||
nextmodelid = 0;
|
||||
}
|
||||
|
||||
memset(tile2model,-1,sizeof(tile2model));
|
||||
curextra=MAXTILES;
|
||||
|
||||
if (vertlist)
|
||||
{
|
||||
nedpfree(model_data_pool, vertlist);
|
||||
vertlist = NULL;
|
||||
allocmodelverts = maxmodelverts = 0;
|
||||
allocmodeltris = maxmodeltris = 0;
|
||||
}
|
||||
freevbos();
|
||||
|
||||
if (model_data_pool)
|
||||
{
|
||||
neddestroypool(model_data_pool);
|
||||
model_data_pool = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,6 +175,8 @@ void mdinit()
|
|||
{
|
||||
memset(hudmem,0,sizeof(hudmem));
|
||||
freeallmodels();
|
||||
if (!model_data_pool)
|
||||
model_data_pool = nedcreatepool(MODEL_POOL_SIZE, 0);
|
||||
mdinited = 1;
|
||||
}
|
||||
|
||||
|
@ -191,7 +188,7 @@ int32_t md_loadmodel(const char *fn)
|
|||
|
||||
if (nextmodelid >= nummodelsalloced)
|
||||
{
|
||||
ml = (mdmodel_t **)realloc(models,(nummodelsalloced+MODELALLOCGROUP)*sizeof(void*)); if (!ml) return(-1);
|
||||
ml = (mdmodel_t **)nedprealloc(model_data_pool, models,(nummodelsalloced+MODELALLOCGROUP)*sizeof(void*)); if (!ml) return(-1);
|
||||
models = ml; nummodelsalloced += MODELALLOCGROUP;
|
||||
}
|
||||
|
||||
|
@ -310,7 +307,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *
|
|||
ma.fpssc = fpssc;
|
||||
ma.flags = flags;
|
||||
|
||||
map = (mdanim_t*)calloc(1,sizeof(mdanim_t));
|
||||
map = (mdanim_t*)nedpcalloc(model_data_pool, 1,sizeof(mdanim_t));
|
||||
if (!map) return(-4);
|
||||
Bmemcpy(map, &ma, sizeof(ma));
|
||||
|
||||
|
@ -340,13 +337,13 @@ int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32
|
|||
if (sk->palette == (uint8_t)palnum && skinnum == sk->skinnum && surfnum == sk->surfnum) break;
|
||||
if (!sk)
|
||||
{
|
||||
sk = (mdskinmap_t *)calloc(1,sizeof(mdskinmap_t));
|
||||
sk = (mdskinmap_t *)nedpcalloc(model_data_pool, 1,sizeof(mdskinmap_t));
|
||||
if (!sk) return -4;
|
||||
|
||||
if (!skl) m->skinmap = sk;
|
||||
else skl->next = sk;
|
||||
}
|
||||
else if (sk->fn) free(sk->fn);
|
||||
else if (sk->fn) nedpfree(model_data_pool, sk->fn);
|
||||
|
||||
sk->palette = (uint8_t)palnum;
|
||||
sk->skinnum = skinnum;
|
||||
|
@ -354,7 +351,7 @@ int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32
|
|||
sk->param = param;
|
||||
sk->specpower = specpower;
|
||||
sk->specfactor = specfactor;
|
||||
sk->fn = (char *)malloc(strlen(skinfn)+1);
|
||||
sk->fn = (char *)nedpmalloc(model_data_pool, strlen(skinfn)+1);
|
||||
if (!sk->fn) return(-4);
|
||||
strcpy(sk->fn, skinfn);
|
||||
|
||||
|
@ -418,14 +415,14 @@ static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t
|
|||
int32_t r, g, b;
|
||||
|
||||
picfillen = kfilelength(filh);
|
||||
picfil = (char *)malloc(picfillen+1); if (!picfil) { return -1; }
|
||||
picfil = (char *)nedpmalloc(model_data_pool, picfillen+1); if (!picfil) { return -1; }
|
||||
kread(filh, picfil, picfillen);
|
||||
|
||||
// tsizx/y = replacement texture's natural size
|
||||
// xsiz/y = 2^x size of replacement
|
||||
|
||||
kpgetdim(picfil,picfillen,&tsizx,&tsizy);
|
||||
if (tsizx == 0 || tsizy == 0) { free(picfil); return -1; }
|
||||
if (tsizx == 0 || tsizy == 0) { nedpfree(model_data_pool, picfil); return -1; }
|
||||
|
||||
if (!glinfo.texnpot)
|
||||
{
|
||||
|
@ -438,13 +435,13 @@ static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t
|
|||
ysiz = tsizy;
|
||||
}
|
||||
*osizx = tsizx; *osizy = tsizy;
|
||||
pic = (coltype *)malloc(xsiz*ysiz*sizeof(coltype));
|
||||
if (!pic) { free(picfil); return -1; }
|
||||
pic = (coltype *)nedpmalloc(model_data_pool, xsiz*ysiz*sizeof(coltype));
|
||||
if (!pic) { nedpfree(model_data_pool, picfil); return -1; }
|
||||
memset(pic,0,xsiz*ysiz*sizeof(coltype));
|
||||
|
||||
if (kprender(picfil,picfillen,(intptr_t)pic,xsiz*sizeof(coltype),xsiz,ysiz,0,0))
|
||||
{ free(picfil); free(pic); return -1; }
|
||||
free(picfil);
|
||||
{ nedpfree(model_data_pool, picfil); nedpfree(model_data_pool, pic); return -1; }
|
||||
nedpfree(model_data_pool, picfil);
|
||||
|
||||
cptr = &britable[gammabrightness ? 0 : curbrightness][0];
|
||||
r=(glinfo.bgra)?hictinting[pal].b:hictinting[pal].r;
|
||||
|
@ -621,14 +618,14 @@ static int32_t mdloadskin_cached(int32_t fil, texcacheheader *head, int32_t *doa
|
|||
|
||||
if (alloclen < pict.size)
|
||||
{
|
||||
void *picc = realloc(pic, pict.size);
|
||||
void *picc = nedprealloc(model_data_pool, pic, pict.size);
|
||||
if (!picc) goto failure; else pic = picc;
|
||||
alloclen = pict.size;
|
||||
|
||||
picc = realloc(packbuf, alloclen+16);
|
||||
picc = nedprealloc(model_data_pool, packbuf, alloclen+16);
|
||||
if (!picc) goto failure; else packbuf = picc;
|
||||
|
||||
picc = realloc(midbuf, pict.size);
|
||||
picc = nedprealloc(model_data_pool, midbuf, pict.size);
|
||||
if (!picc) goto failure; else midbuf = picc;
|
||||
}
|
||||
|
||||
|
@ -639,14 +636,14 @@ static int32_t mdloadskin_cached(int32_t fil, texcacheheader *head, int32_t *doa
|
|||
if (bglGetError() != GL_NO_ERROR) goto failure;
|
||||
}
|
||||
|
||||
if (midbuf) free(midbuf);
|
||||
if (pic) free(pic);
|
||||
if (packbuf) free(packbuf);
|
||||
if (midbuf) nedpfree(model_data_pool, midbuf);
|
||||
if (pic) nedpfree(model_data_pool, pic);
|
||||
if (packbuf) nedpfree(model_data_pool, packbuf);
|
||||
return 0;
|
||||
failure:
|
||||
if (midbuf) free(midbuf);
|
||||
if (pic) free(pic);
|
||||
if (packbuf) free(packbuf);
|
||||
if (midbuf) nedpfree(model_data_pool, midbuf);
|
||||
if (pic) nedpfree(model_data_pool, pic);
|
||||
if (packbuf) nedpfree(model_data_pool, packbuf);
|
||||
return -1;
|
||||
}
|
||||
// --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF
|
||||
|
@ -768,7 +765,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
|||
else if (!hasalpha) intexfmt = GL_RGB;
|
||||
if (glinfo.bgra) texfmt = GL_BGRA;
|
||||
uploadtexture((doalloc&1), xsiz, ysiz, intexfmt, texfmt, (coltype*)fptr, xsiz, ysiz, 0|8192);
|
||||
free((void*)fptr);
|
||||
nedpfree(model_data_pool, (void*)fptr);
|
||||
}
|
||||
|
||||
if (!m->skinloaded)
|
||||
|
@ -963,7 +960,7 @@ static void mdloadvbos(md3model_t *m)
|
|||
{
|
||||
int32_t i;
|
||||
|
||||
m->vbos = malloc(m->head.numsurfs * sizeof(GLuint));
|
||||
m->vbos = nedpmalloc(model_data_pool, m->head.numsurfs * sizeof(GLuint));
|
||||
bglGenBuffersARB(m->head.numsurfs, m->vbos);
|
||||
|
||||
i = 0;
|
||||
|
@ -987,7 +984,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
|
|||
char st[BMAX_PATH];
|
||||
int32_t i, j, k;
|
||||
|
||||
m = (md2model_t *)calloc(1,sizeof(md2model_t)); if (!m) return(0);
|
||||
m = (md2model_t *)nedpcalloc(model_data_pool, 1,sizeof(md2model_t)); if (!m) return(0);
|
||||
m->mdnum = 2; m->scale = .01f;
|
||||
|
||||
kread(fil,(char *)&head,sizeof(md2head_t));
|
||||
|
@ -1001,7 +998,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
|
|||
head.ofsframes = B_LITTLE32(head.ofsframes); head.ofsglcmds = B_LITTLE32(head.ofsglcmds);
|
||||
head.ofseof = B_LITTLE32(head.ofseof);
|
||||
|
||||
if ((head.id != 0x32504449) || (head.vers != 8)) { free(m); return(0); } //"IDP2"
|
||||
if ((head.id != 0x32504449) || (head.vers != 8)) { nedpfree(model_data_pool, m); return(0); } //"IDP2"
|
||||
|
||||
m->numskins = head.numskins;
|
||||
m->numframes = head.numframes;
|
||||
|
@ -1009,26 +1006,26 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
|
|||
m->numglcmds = head.numglcmds;
|
||||
m->framebytes = head.framebytes;
|
||||
|
||||
m->frames = (char *)calloc(m->numframes,m->framebytes); if (!m->frames) { free(m); return(0); }
|
||||
m->glcmds = (int32_t *)calloc(m->numglcmds,sizeof(int32_t)); if (!m->glcmds) { free(m->frames); free(m); return(0); }
|
||||
m->tris = (md2tri_t *)calloc(head.numtris, sizeof(md2tri_t)); if (!m->tris) { free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
m->uv = (md2uv_t *)calloc(head.numuv, sizeof(md2uv_t)); if (!m->uv) { free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
m->frames = (char *)nedpcalloc(model_data_pool, m->numframes,m->framebytes); if (!m->frames) { nedpfree(model_data_pool, m); return(0); }
|
||||
m->glcmds = (int32_t *)nedpcalloc(model_data_pool, m->numglcmds,sizeof(int32_t)); if (!m->glcmds) { nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
m->tris = (md2tri_t *)nedpcalloc(model_data_pool, head.numtris, sizeof(md2tri_t)); if (!m->tris) { nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
m->uv = (md2uv_t *)nedpcalloc(model_data_pool, head.numuv, sizeof(md2uv_t)); if (!m->uv) { nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
|
||||
klseek(fil,head.ofsframes,SEEK_SET);
|
||||
if (kread(fil,(char *)m->frames,m->numframes*m->framebytes) != m->numframes*m->framebytes)
|
||||
{ free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
{ nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
|
||||
klseek(fil,head.ofsglcmds,SEEK_SET);
|
||||
if (kread(fil,(char *)m->glcmds,m->numglcmds*sizeof(int32_t)) != (int32_t)(m->numglcmds*sizeof(int32_t)))
|
||||
{ free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
{ nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
|
||||
klseek(fil,head.ofstris,SEEK_SET);
|
||||
if (kread(fil,(char *)m->tris,head.numtris*sizeof(md2tri_t)) != (int32_t)(head.numtris*sizeof(md2tri_t)))
|
||||
{ free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
{ nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
|
||||
klseek(fil,head.ofsuv,SEEK_SET);
|
||||
if (kread(fil,(char *)m->uv,head.numuv*sizeof(md2uv_t)) != (int32_t)(head.numuv*sizeof(md2uv_t)))
|
||||
{ free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
{ nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
|
||||
#if B_BIG_ENDIAN != 0
|
||||
{
|
||||
|
@ -1056,16 +1053,16 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
|
|||
if ((st[i] == '/') || (st[i] == '\\')) { i++; break; }
|
||||
if (i<0) i=0;
|
||||
st[i] = 0;
|
||||
m->basepath = (char *)malloc(i+1); if (!m->basepath) { free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
m->basepath = (char *)nedpmalloc(model_data_pool, i+1); if (!m->basepath) { nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
strcpy(m->basepath, st);
|
||||
|
||||
m->skinfn = (char *)calloc(m->numskins,64); if (!m->skinfn) { free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
m->skinfn = (char *)nedpcalloc(model_data_pool, m->numskins,64); if (!m->skinfn) { nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
klseek(fil,head.ofsskins,SEEK_SET);
|
||||
if (kread(fil,m->skinfn,64*m->numskins) != 64*m->numskins)
|
||||
{ free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
{ nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
|
||||
m->texid = (GLuint *)calloc(m->numskins, sizeof(GLuint) * (HICEFFECTMASK+1));
|
||||
if (!m->texid) { free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
m->texid = (GLuint *)nedpcalloc(model_data_pool, m->numskins, sizeof(GLuint) * (HICEFFECTMASK+1));
|
||||
if (!m->texid) { nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
|
||||
maxmodelverts = max(maxmodelverts, m->numverts);
|
||||
maxmodeltris = max(maxmodeltris, head.numtris);
|
||||
|
@ -1074,7 +1071,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
|
|||
|
||||
// the MD2 is now loaded internally - let's begin the MD3 conversion process
|
||||
//OSD_Printf("Beginning md3 conversion.\n");
|
||||
m3 = (md3model_t *)calloc(1, sizeof(md3model_t)); if (!m3) { free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
m3 = (md3model_t *)nedpcalloc(model_data_pool, 1, sizeof(md3model_t)); if (!m3) { nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
m3->mdnum = 3; m3->texid = 0; m3->scale = m->scale;
|
||||
m3->head.id = 0x33504449; m3->head.vers = 15;
|
||||
// this changes the conversion code to do real MD2->MD3 conversion
|
||||
|
@ -1088,8 +1085,8 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
|
|||
m3->numskins = m3->head.numskins;
|
||||
m3->numframes = m3->head.numframes;
|
||||
|
||||
m3->head.frames = (md3frame_t *)calloc(m3->head.numframes, sizeof(md3frame_t)); if (!m3->head.frames) { free(m3); free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
m3->muladdframes = (point3d *)calloc(m->numframes * 2, sizeof(point3d));
|
||||
m3->head.frames = (md3frame_t *)nedpcalloc(model_data_pool, m3->head.numframes, sizeof(md3frame_t)); if (!m3->head.frames) { nedpfree(model_data_pool, m3); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
m3->muladdframes = (point3d *)nedpcalloc(model_data_pool, m->numframes * 2, sizeof(point3d));
|
||||
|
||||
f = (md2frame_t *)(m->frames);
|
||||
|
||||
|
@ -1107,7 +1104,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
|
|||
|
||||
m3->head.tags = NULL;
|
||||
|
||||
m3->head.surfs = (md3surf_t *)calloc(1, sizeof(md3surf_t)); if (!m3->head.surfs) { free(m3->head.frames); free(m3); free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
m3->head.surfs = (md3surf_t *)nedpcalloc(model_data_pool, 1, sizeof(md3surf_t)); if (!m3->head.surfs) { nedpfree(model_data_pool, m3->head.frames); nedpfree(model_data_pool, m3); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
s = m3->head.surfs;
|
||||
|
||||
// model converting
|
||||
|
@ -1124,9 +1121,9 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
|
|||
|
||||
s->shaders = NULL;
|
||||
|
||||
s->tris = (md3tri_t *)calloc(head.numtris, sizeof(md3tri_t)); if (!s->tris) { free(s); free(m3->head.frames); free(m3); free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
s->uv = (md3uv_t *)calloc(s->numverts, sizeof(md3uv_t)); if (!s->uv) { free(s->tris); free(s); free(m3->head.frames); free(m3); free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
s->xyzn = (md3xyzn_t *)calloc(s->numverts * m->numframes, sizeof(md3xyzn_t)); if (!s->xyzn) { free(s->uv); free(s->tris); free(s); free(m3->head.frames); free(m3); free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||
s->tris = (md3tri_t *)nedpcalloc(model_data_pool, head.numtris, sizeof(md3tri_t)); if (!s->tris) { nedpfree(model_data_pool, s); nedpfree(model_data_pool, m3->head.frames); nedpfree(model_data_pool, m3); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
s->uv = (md3uv_t *)nedpcalloc(model_data_pool, s->numverts, sizeof(md3uv_t)); if (!s->uv) { nedpfree(model_data_pool, s->tris); nedpfree(model_data_pool, s); nedpfree(model_data_pool, m3->head.frames); nedpfree(model_data_pool, m3); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
s->xyzn = (md3xyzn_t *)nedpcalloc(model_data_pool, s->numverts * m->numframes, sizeof(md3xyzn_t)); if (!s->xyzn) { nedpfree(model_data_pool, s->uv); nedpfree(model_data_pool, s->tris); nedpfree(model_data_pool, s); nedpfree(model_data_pool, m3->head.frames); nedpfree(model_data_pool, m3); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); }
|
||||
|
||||
//memoryusage += (s->numverts * m->numframes * sizeof(md3xyzn_t));
|
||||
//OSD_Printf("Current model geometry memory usage : %i.\n", memoryusage);
|
||||
|
@ -1180,28 +1177,28 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
|
|||
{
|
||||
mdskinmap_t *sk;
|
||||
|
||||
sk = (mdskinmap_t *)calloc(1,sizeof(mdskinmap_t));
|
||||
sk = (mdskinmap_t *)nedpcalloc(model_data_pool, 1,sizeof(mdskinmap_t));
|
||||
sk->palette = 0;
|
||||
sk->skinnum = 0;
|
||||
sk->surfnum = 0;
|
||||
|
||||
if (m->numskins > 0)
|
||||
{
|
||||
sk->fn = (char *)malloc(strlen(m->basepath)+strlen(m->skinfn)+1);
|
||||
sk->fn = (char *)nedpmalloc(model_data_pool, strlen(m->basepath)+strlen(m->skinfn)+1);
|
||||
strcpy(sk->fn, m->basepath);
|
||||
strcat(sk->fn, m->skinfn);
|
||||
}
|
||||
m3->skinmap = sk;
|
||||
}
|
||||
|
||||
m3->indexes = malloc(sizeof(uint16_t) * s->numtris);
|
||||
m3->vindexes = malloc(sizeof(uint16_t) * s->numtris * 3);
|
||||
m3->maxdepths = malloc(sizeof(float) * s->numtris);
|
||||
m3->indexes = nedpmalloc(model_data_pool, sizeof(uint16_t) * s->numtris);
|
||||
m3->vindexes = nedpmalloc(model_data_pool, sizeof(uint16_t) * s->numtris * 3);
|
||||
m3->maxdepths = nedpmalloc(model_data_pool, sizeof(float) * s->numtris);
|
||||
|
||||
m3->vbos = NULL;
|
||||
|
||||
// die MD2 ! DIE !
|
||||
free(m->texid); free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m);
|
||||
nedpfree(model_data_pool, m->texid); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m);
|
||||
|
||||
return((md2model_t *)m3);
|
||||
}
|
||||
|
@ -1262,7 +1259,7 @@ static md3model_t *md3load(int32_t fil)
|
|||
md3model_t *m;
|
||||
md3surf_t *s;
|
||||
|
||||
m = (md3model_t *)calloc(1,sizeof(md3model_t)); if (!m) return(0);
|
||||
m = (md3model_t *)nedpcalloc(model_data_pool, 1,sizeof(md3model_t)); if (!m) return(0);
|
||||
m->mdnum = 3; m->texid = 0; m->scale = .01;
|
||||
|
||||
m->muladdframes = NULL;
|
||||
|
@ -1275,7 +1272,7 @@ static md3model_t *md3load(int32_t fil)
|
|||
m->head.ofstags = B_LITTLE32(m->head.ofstags); m->head.ofssurfs = B_LITTLE32(m->head.ofssurfs);
|
||||
m->head.eof = B_LITTLE32(m->head.eof);
|
||||
|
||||
if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { free(m); return(0); } //"IDP3"
|
||||
if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { nedpfree(model_data_pool, m); return(0); } //"IDP3"
|
||||
|
||||
m->numskins = m->head.numskins; //<- dead code?
|
||||
m->numframes = m->head.numframes;
|
||||
|
@ -1283,19 +1280,19 @@ static md3model_t *md3load(int32_t fil)
|
|||
ofsurf = m->head.ofssurfs;
|
||||
|
||||
klseek(fil,m->head.ofsframes,SEEK_SET); i = m->head.numframes*sizeof(md3frame_t);
|
||||
m->head.frames = (md3frame_t *)malloc(i); if (!m->head.frames) { free(m); return(0); }
|
||||
m->head.frames = (md3frame_t *)nedpmalloc(model_data_pool, i); if (!m->head.frames) { nedpfree(model_data_pool, m); return(0); }
|
||||
kread(fil,m->head.frames,i);
|
||||
|
||||
if (m->head.numtags == 0) m->head.tags = NULL;
|
||||
else
|
||||
{
|
||||
klseek(fil,m->head.ofstags,SEEK_SET); i = m->head.numtags*sizeof(md3tag_t);
|
||||
m->head.tags = (md3tag_t *)malloc(i); if (!m->head.tags) { free(m->head.frames); free(m); return(0); }
|
||||
m->head.tags = (md3tag_t *)nedpmalloc(model_data_pool, i); if (!m->head.tags) { nedpfree(model_data_pool, m->head.frames); nedpfree(model_data_pool, m); return(0); }
|
||||
kread(fil,m->head.tags,i);
|
||||
}
|
||||
|
||||
klseek(fil,m->head.ofssurfs,SEEK_SET); i = m->head.numsurfs*sizeof(md3surf_t);
|
||||
m->head.surfs = (md3surf_t *)malloc(i); if (!m->head.surfs) { if (m->head.tags) free(m->head.tags); free(m->head.frames); free(m); return(0); }
|
||||
m->head.surfs = (md3surf_t *)nedpmalloc(model_data_pool, i); if (!m->head.surfs) { if (m->head.tags) nedpfree(model_data_pool, m->head.tags); nedpfree(model_data_pool, m->head.frames); nedpfree(model_data_pool, m); return(0); }
|
||||
|
||||
#if B_BIG_ENDIAN != 0
|
||||
{
|
||||
|
@ -1339,11 +1336,11 @@ static md3model_t *md3load(int32_t fil)
|
|||
//OSD_Printf("Current model geometry memory usage : %i.\n", memoryusage);
|
||||
|
||||
|
||||
s->tris = (md3tri_t *)malloc(leng[0]+leng[1]+leng[2]+leng[3]);
|
||||
s->tris = (md3tri_t *)nedpmalloc(model_data_pool, leng[0]+leng[1]+leng[2]+leng[3]);
|
||||
if (!s->tris)
|
||||
{
|
||||
for (surfi--; surfi>=0; surfi--) free(m->head.surfs[surfi].tris);
|
||||
if (m->head.tags) free(m->head.tags); free(m->head.frames); free(m); return(0);
|
||||
for (surfi--; surfi>=0; surfi--) nedpfree(model_data_pool, m->head.surfs[surfi].tris);
|
||||
if (m->head.tags) nedpfree(model_data_pool, m->head.tags); nedpfree(model_data_pool, m->head.frames); nedpfree(model_data_pool, m); return(0);
|
||||
}
|
||||
s->shaders = (md3shader_t *)(((intptr_t)s->tris)+leng[0]);
|
||||
s->uv = (md3uv_t *)(((intptr_t)s->shaders)+leng[1]);
|
||||
|
@ -1412,9 +1409,9 @@ static md3model_t *md3load(int32_t fil)
|
|||
}
|
||||
#endif
|
||||
|
||||
m->indexes = malloc(sizeof(uint16_t) * maxtrispersurf);
|
||||
m->vindexes = malloc(sizeof(uint16_t) * maxtrispersurf * 3);
|
||||
m->maxdepths = malloc(sizeof(float) * maxtrispersurf);
|
||||
m->indexes = nedpmalloc(model_data_pool, sizeof(uint16_t) * maxtrispersurf);
|
||||
m->vindexes = nedpmalloc(model_data_pool, sizeof(uint16_t) * maxtrispersurf * 3);
|
||||
m->maxdepths = nedpmalloc(model_data_pool, sizeof(float) * maxtrispersurf);
|
||||
|
||||
m->vbos = NULL;
|
||||
|
||||
|
@ -1519,7 +1516,7 @@ static void md3postload(md3model_t* m)
|
|||
surfi = 0;
|
||||
while (surfi < m->head.numsurfs)
|
||||
{
|
||||
m->head.surfs[surfi].geometry = malloc(m->head.numframes * m->head.surfs[surfi].numverts * sizeof(float) * 6);
|
||||
m->head.surfs[surfi].geometry = nedpmalloc(model_data_pool, m->head.numframes * m->head.surfs[surfi].numverts * sizeof(float) * 6);
|
||||
|
||||
verti = 0;
|
||||
while (verti < (m->head.numframes * m->head.surfs[surfi].numverts))
|
||||
|
@ -2075,13 +2072,13 @@ static void md3free(md3model_t *m)
|
|||
for (anim=m->animations; anim; anim=nanim)
|
||||
{
|
||||
nanim = anim->next;
|
||||
free(anim);
|
||||
nedpfree(model_data_pool, anim);
|
||||
}
|
||||
for (sk=m->skinmap; sk; sk=nsk)
|
||||
{
|
||||
nsk = sk->next;
|
||||
free(sk->fn);
|
||||
free(sk);
|
||||
nedpfree(model_data_pool, sk->fn);
|
||||
nedpfree(model_data_pool, sk);
|
||||
}
|
||||
|
||||
if (m->head.surfs)
|
||||
|
@ -2089,35 +2086,35 @@ static void md3free(md3model_t *m)
|
|||
for (surfi=m->head.numsurfs-1; surfi>=0; surfi--)
|
||||
{
|
||||
s = &m->head.surfs[surfi];
|
||||
if (s->tris) free(s->tris);
|
||||
if (s->tris) nedpfree(model_data_pool, s->tris);
|
||||
if (m->head.flags == 1337)
|
||||
{
|
||||
if (s->shaders) free(s->shaders);
|
||||
if (s->uv) free(s->uv);
|
||||
if (s->xyzn) free(s->xyzn);
|
||||
if (s->shaders) nedpfree(model_data_pool, s->shaders);
|
||||
if (s->uv) nedpfree(model_data_pool, s->uv);
|
||||
if (s->xyzn) nedpfree(model_data_pool, s->xyzn);
|
||||
}
|
||||
}
|
||||
free(m->head.surfs);
|
||||
nedpfree(model_data_pool, m->head.surfs);
|
||||
}
|
||||
if (m->head.tags) free(m->head.tags);
|
||||
if (m->head.frames) free(m->head.frames);
|
||||
if (m->head.tags) nedpfree(model_data_pool, m->head.tags);
|
||||
if (m->head.frames) nedpfree(model_data_pool, m->head.frames);
|
||||
|
||||
if (m->texid) free(m->texid);
|
||||
if (m->texid) nedpfree(model_data_pool, m->texid);
|
||||
|
||||
if (m->muladdframes) free(m->muladdframes);
|
||||
if (m->muladdframes) nedpfree(model_data_pool, m->muladdframes);
|
||||
|
||||
if (m->indexes) free(m->indexes);
|
||||
if (m->vindexes) free(m->vindexes);
|
||||
if (m->maxdepths) free(m->maxdepths);
|
||||
if (m->indexes) nedpfree(model_data_pool, m->indexes);
|
||||
if (m->vindexes) nedpfree(model_data_pool, m->vindexes);
|
||||
if (m->maxdepths) nedpfree(model_data_pool, m->maxdepths);
|
||||
|
||||
if (m->vbos)
|
||||
{
|
||||
bglDeleteBuffersARB(m->head.numsurfs, m->vbos);
|
||||
free(m->vbos);
|
||||
nedpfree(model_data_pool, m->vbos);
|
||||
m->vbos = NULL;
|
||||
}
|
||||
|
||||
free(m);
|
||||
nedpfree(model_data_pool, m);
|
||||
}
|
||||
|
||||
//---------------------------------------- MD3 LIBRARY ENDS ----------------------------------------
|
||||
|
@ -2144,7 +2141,7 @@ uint32_t gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i
|
|||
int32_t i;
|
||||
|
||||
pic = (coltype *)picbuf; //Correct for GL's RGB order; also apply gamma here..
|
||||
pic2 = (coltype *)malloc(xsiz*ysiz*sizeof(int32_t)); if (!pic2) return((unsigned)-1);
|
||||
pic2 = (coltype *)nedpmalloc(model_data_pool, xsiz*ysiz*sizeof(int32_t)); if (!pic2) return((unsigned)-1);
|
||||
cptr = (char*)&britable[gammabrightness ? 0 : curbrightness][0];
|
||||
if (!is8bit)
|
||||
{
|
||||
|
@ -2173,7 +2170,7 @@ uint32_t gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i
|
|||
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
||||
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
||||
bglTexImage2D(GL_TEXTURE_2D,0,4,xsiz,ysiz,0,GL_RGBA,GL_UNSIGNED_BYTE,(char *)pic2);
|
||||
free(pic2);
|
||||
nedpfree(model_data_pool, pic2);
|
||||
return(rtexid);
|
||||
}
|
||||
|
||||
|
@ -2187,7 +2184,7 @@ static int32_t getvox(int32_t x, int32_t y, int32_t z)
|
|||
|
||||
static void putvox(int32_t x, int32_t y, int32_t z, int32_t col)
|
||||
{
|
||||
if (vnum >= vmax) { vmax = max(vmax<<1,4096); vcol = (voxcol_t *)realloc(vcol,vmax*sizeof(voxcol_t)); }
|
||||
if (vnum >= vmax) { vmax = max(vmax<<1,4096); vcol = (voxcol_t *)nedprealloc(model_data_pool, vcol,vmax*sizeof(voxcol_t)); }
|
||||
|
||||
z += x*yzsiz + y*zsiz;
|
||||
vcol[vnum].p = z; z = ((z*214013)&vcolhashsizm1);
|
||||
|
@ -2395,7 +2392,7 @@ static voxmodel_t *vox2poly()
|
|||
int32_t i, j, x, y, z, v, ov, oz = 0, cnt, sc, x0, y0, dx, dy,*bx0, *by0;
|
||||
void (*daquad)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t);
|
||||
|
||||
gvox = (voxmodel_t *)malloc(sizeof(voxmodel_t)); if (!gvox) return(0);
|
||||
gvox = (voxmodel_t *)nedpmalloc(model_data_pool, sizeof(voxmodel_t)); if (!gvox) return(0);
|
||||
memset(gvox,0,sizeof(voxmodel_t));
|
||||
|
||||
//x is largest dimension, y is 2nd largest dimension
|
||||
|
@ -2403,7 +2400,7 @@ static voxmodel_t *vox2poly()
|
|||
if ((x < y) && (x < z)) x = z; else if (y < z) y = z;
|
||||
if (x < y) { z = x; x = y; y = z; }
|
||||
shcntp = x; i = x*y*sizeof(int32_t);
|
||||
shcntmal = (int32_t *)malloc(i); if (!shcntmal) { free(gvox); return(0); }
|
||||
shcntmal = (int32_t *)nedpmalloc(model_data_pool, i); if (!shcntmal) { nedpfree(model_data_pool, gvox); return(0); }
|
||||
memset(shcntmal,0,i); shcnt = &shcntmal[-shcntp-1];
|
||||
gmaxx = gmaxy = garea = 0;
|
||||
|
||||
|
@ -2411,7 +2408,7 @@ static voxmodel_t *vox2poly()
|
|||
for (i=0; i<7; i++) gvox->qfacind[i] = -1;
|
||||
|
||||
i = ((max(ysiz,zsiz)+1)<<2);
|
||||
bx0 = (int32_t *)malloc(i<<1); if (!bx0) { free(gvox); return(0); }
|
||||
bx0 = (int32_t *)nedpmalloc(model_data_pool, i<<1); if (!bx0) { nedpfree(model_data_pool, gvox); return(0); }
|
||||
by0 = (int32_t *)(((intptr_t)bx0)+i);
|
||||
|
||||
for (cnt=0; cnt<2; cnt++)
|
||||
|
@ -2457,8 +2454,8 @@ static voxmodel_t *vox2poly()
|
|||
|
||||
if (!cnt)
|
||||
{
|
||||
shp = (spoint2d *)malloc(gvox->qcnt*sizeof(spoint2d));
|
||||
if (!shp) { free(bx0); free(gvox); return(0); }
|
||||
shp = (spoint2d *)nedpmalloc(model_data_pool, gvox->qcnt*sizeof(spoint2d));
|
||||
if (!shp) { nedpfree(model_data_pool, bx0); nedpfree(model_data_pool, gvox); return(0); }
|
||||
|
||||
sc = 0;
|
||||
for (y=gmaxy; y; y--)
|
||||
|
@ -2479,7 +2476,7 @@ skindidntfit:
|
|||
mytexo5 = (gvox->mytexx>>5);
|
||||
|
||||
i = (((gvox->mytexx*gvox->mytexy+31)>>5)<<2);
|
||||
zbit = (int32_t *)malloc(i); if (!zbit) { free(bx0); free(gvox); free(shp); return(0); }
|
||||
zbit = (int32_t *)nedpmalloc(model_data_pool, i); if (!zbit) { nedpfree(model_data_pool, bx0); nedpfree(model_data_pool, gvox); nedpfree(model_data_pool, shp); return(0); }
|
||||
memset(zbit,0,i);
|
||||
|
||||
v = gvox->mytexx*gvox->mytexy;
|
||||
|
@ -2498,7 +2495,7 @@ skindidntfit:
|
|||
i--;
|
||||
if (i < 0) //Time-out! Very slow if this happens... but at least it still works :P
|
||||
{
|
||||
free(zbit);
|
||||
nedpfree(model_data_pool, zbit);
|
||||
|
||||
//Re-generate shp[].x/y (box sizes) from shcnt (now head indices) for next pass :/
|
||||
j = 0;
|
||||
|
@ -2521,14 +2518,14 @@ skindidntfit:
|
|||
shp[z].x = x0; shp[z].y = y0; //Overwrite size with top-left location
|
||||
}
|
||||
|
||||
gvox->quad = (voxrect_t *)malloc(gvox->qcnt*sizeof(voxrect_t));
|
||||
if (!gvox->quad) { free(zbit); free(shp); free(bx0); free(gvox); return(0); }
|
||||
gvox->quad = (voxrect_t *)nedpmalloc(model_data_pool, gvox->qcnt*sizeof(voxrect_t));
|
||||
if (!gvox->quad) { nedpfree(model_data_pool, zbit); nedpfree(model_data_pool, shp); nedpfree(model_data_pool, bx0); nedpfree(model_data_pool, gvox); return(0); }
|
||||
|
||||
gvox->mytex = (int32_t *)malloc(gvox->mytexx*gvox->mytexy*sizeof(int32_t));
|
||||
if (!gvox->mytex) { free(gvox->quad); free(zbit); free(shp); free(bx0); free(gvox); return(0); }
|
||||
gvox->mytex = (int32_t *)nedpmalloc(model_data_pool, gvox->mytexx*gvox->mytexy*sizeof(int32_t));
|
||||
if (!gvox->mytex) { nedpfree(model_data_pool, gvox->quad); nedpfree(model_data_pool, zbit); nedpfree(model_data_pool, shp); nedpfree(model_data_pool, bx0); nedpfree(model_data_pool, gvox); return(0); }
|
||||
}
|
||||
}
|
||||
free(shp); free(zbit); free(bx0);
|
||||
nedpfree(model_data_pool, shp); nedpfree(model_data_pool, zbit); nedpfree(model_data_pool, bx0);
|
||||
return(gvox);
|
||||
}
|
||||
|
||||
|
@ -2551,14 +2548,14 @@ static int32_t loadvox(const char *filnam)
|
|||
pal[255] = -1;
|
||||
|
||||
vcolhashsizm1 = 8192-1;
|
||||
vcolhashead = (int32_t *)malloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { kclose(fil); return(-1); }
|
||||
vcolhashead = (int32_t *)nedpmalloc(model_data_pool, (vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { kclose(fil); return(-1); }
|
||||
memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t));
|
||||
|
||||
yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3);
|
||||
vbit = (int32_t *)malloc(i); if (!vbit) { kclose(fil); return(-1); }
|
||||
vbit = (int32_t *)nedpmalloc(model_data_pool, i); if (!vbit) { kclose(fil); return(-1); }
|
||||
memset(vbit,0,i);
|
||||
|
||||
tbuf = (char *)malloc(zsiz*sizeof(uint8_t)); if (!tbuf) { kclose(fil); return(-1); }
|
||||
tbuf = (char *)nedpmalloc(model_data_pool, zsiz*sizeof(uint8_t)); if (!tbuf) { kclose(fil); return(-1); }
|
||||
|
||||
klseek(fil,12,SEEK_SET);
|
||||
for (x=0; x<xsiz; x++)
|
||||
|
@ -2590,7 +2587,7 @@ static int32_t loadvox(const char *filnam)
|
|||
}
|
||||
}
|
||||
|
||||
free(tbuf); kclose(fil); return(0);
|
||||
nedpfree(model_data_pool, tbuf); kclose(fil); return(0);
|
||||
}
|
||||
|
||||
static int32_t loadkvx(const char *filnam)
|
||||
|
@ -2610,7 +2607,7 @@ static int32_t loadkvx(const char *filnam)
|
|||
klseek(fil,(xsiz+1)<<2,SEEK_CUR);
|
||||
ysizp1 = ysiz+1;
|
||||
i = xsiz*ysizp1*sizeof(int16_t);
|
||||
xyoffs = (uint16_t *)malloc(i); if (!xyoffs) { kclose(fil); return(-1); }
|
||||
xyoffs = (uint16_t *)nedpmalloc(model_data_pool, i); if (!xyoffs) { kclose(fil); return(-1); }
|
||||
kread(fil,xyoffs,i); for (i=i/sizeof(int16_t)-1; i>=0; i--) xyoffs[i] = B_LITTLE16(xyoffs[i]);
|
||||
|
||||
klseek(fil,-768,SEEK_END);
|
||||
|
@ -2618,17 +2615,17 @@ static int32_t loadkvx(const char *filnam)
|
|||
{ kread(fil,c,3); pal[i] = B_LITTLE32((((int32_t)c[0])<<18)+(((int32_t)c[1])<<10)+(((int32_t)c[2])<<2)+(i<<24)); }
|
||||
|
||||
yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3);
|
||||
vbit = (int32_t *)malloc(i); if (!vbit) { free(xyoffs); kclose(fil); return(-1); }
|
||||
vbit = (int32_t *)nedpmalloc(model_data_pool, i); if (!vbit) { nedpfree(model_data_pool, xyoffs); kclose(fil); return(-1); }
|
||||
memset(vbit,0,i);
|
||||
|
||||
for (vcolhashsizm1=4096; vcolhashsizm1<(mip1leng>>1); vcolhashsizm1<<=1); vcolhashsizm1--; //approx to numvoxs!
|
||||
vcolhashead = (int32_t *)malloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { free(xyoffs); kclose(fil); return(-1); }
|
||||
vcolhashead = (int32_t *)nedpmalloc(model_data_pool, (vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { nedpfree(model_data_pool, xyoffs); kclose(fil); return(-1); }
|
||||
memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t));
|
||||
|
||||
klseek(fil,28+((xsiz+1)<<2)+((ysizp1*xsiz)<<1),SEEK_SET);
|
||||
|
||||
i = kfilelength(fil)-ktell(fil);
|
||||
tbuf = (char *)malloc(i); if (!tbuf) { free(xyoffs); kclose(fil); return(-1); }
|
||||
tbuf = (char *)nedpmalloc(model_data_pool, i); if (!tbuf) { nedpfree(model_data_pool, xyoffs); kclose(fil); return(-1); }
|
||||
kread(fil,tbuf,i); kclose(fil);
|
||||
|
||||
cptr = tbuf;
|
||||
|
@ -2647,7 +2644,7 @@ static int32_t loadkvx(const char *filnam)
|
|||
}
|
||||
}
|
||||
|
||||
free(tbuf); free(xyoffs); return(0);
|
||||
nedpfree(model_data_pool, tbuf); nedpfree(model_data_pool, xyoffs); return(0);
|
||||
}
|
||||
|
||||
static int32_t loadkv6(const char *filnam)
|
||||
|
@ -2666,7 +2663,7 @@ static int32_t loadkv6(const char *filnam)
|
|||
kread(fil,&i,4); zpiv = (float)(B_LITTLE32(i));
|
||||
kread(fil,&numvoxs,4); numvoxs = B_LITTLE32(numvoxs);
|
||||
|
||||
ylen = (uint16_t *)malloc(xsiz*ysiz*sizeof(int16_t));
|
||||
ylen = (uint16_t *)nedpmalloc(model_data_pool, xsiz*ysiz*sizeof(int16_t));
|
||||
if (!ylen) { kclose(fil); return(-1); }
|
||||
|
||||
klseek(fil,32+(numvoxs<<3)+(xsiz<<2),SEEK_SET);
|
||||
|
@ -2674,11 +2671,11 @@ static int32_t loadkv6(const char *filnam)
|
|||
klseek(fil,32,SEEK_SET);
|
||||
|
||||
yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3);
|
||||
vbit = (int32_t *)malloc(i); if (!vbit) { free(ylen); kclose(fil); return(-1); }
|
||||
vbit = (int32_t *)nedpmalloc(model_data_pool, i); if (!vbit) { nedpfree(model_data_pool, ylen); kclose(fil); return(-1); }
|
||||
memset(vbit,0,i);
|
||||
|
||||
for (vcolhashsizm1=4096; vcolhashsizm1<numvoxs; vcolhashsizm1<<=1); vcolhashsizm1--;
|
||||
vcolhashead = (int32_t *)malloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { free(ylen); kclose(fil); return(-1); }
|
||||
vcolhashead = (int32_t *)nedpmalloc(model_data_pool, (vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { nedpfree(model_data_pool, ylen); kclose(fil); return(-1); }
|
||||
memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t));
|
||||
|
||||
for (x=0; x<xsiz; x++)
|
||||
|
@ -2695,7 +2692,7 @@ static int32_t loadkv6(const char *filnam)
|
|||
z1 = z0+1;
|
||||
}
|
||||
}
|
||||
free(ylen); kclose(fil); return(0);
|
||||
nedpfree(model_data_pool, ylen); kclose(fil); return(0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -2717,16 +2714,16 @@ static int32_t loadvxl(const char *filnam)
|
|||
zpiv = ((float)zsiz)*.5;
|
||||
|
||||
yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3);
|
||||
vbit = (int32_t *)malloc(i); if (!vbit) { kclose(fil); return(-1); }
|
||||
vbit = (int32_t *)nedpmalloc(model_data_pool, i); if (!vbit) { kclose(fil); return(-1); }
|
||||
memset(vbit,-1,i);
|
||||
|
||||
vcolhashsizm1 = 1048576-1;
|
||||
vcolhashead = (int32_t *)malloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { kclose(fil); return(-1); }
|
||||
vcolhashead = (int32_t *)nedpmalloc(model_data_pool, (vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { kclose(fil); return(-1); }
|
||||
memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t));
|
||||
|
||||
//Allocate huge buffer and load rest of file into it...
|
||||
i = kfilelength(fil)-ktell(fil);
|
||||
vbuf = (char *)malloc(i); if (!vbuf) { kclose(fil); return(-1); }
|
||||
vbuf = (char *)nedpmalloc(model_data_pool, i); if (!vbuf) { kclose(fil); return(-1); }
|
||||
kread(fil,vbuf,i);
|
||||
kclose(fil);
|
||||
|
||||
|
@ -2744,17 +2741,17 @@ static int32_t loadvxl(const char *filnam)
|
|||
}
|
||||
v += ((((int32_t)v[2])-((int32_t)v[1])+2)<<2);
|
||||
}
|
||||
free(vbuf); return(0);
|
||||
nedpfree(model_data_pool, vbuf); return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void voxfree(voxmodel_t *m)
|
||||
{
|
||||
if (!m) return;
|
||||
if (m->mytex) free(m->mytex);
|
||||
if (m->quad) free(m->quad);
|
||||
if (m->texid) free(m->texid);
|
||||
free(m);
|
||||
if (m->mytex) nedpfree(model_data_pool, m->mytex);
|
||||
if (m->quad) nedpfree(model_data_pool, m->quad);
|
||||
if (m->texid) nedpfree(model_data_pool, m->texid);
|
||||
nedpfree(model_data_pool, m);
|
||||
}
|
||||
|
||||
voxmodel_t *voxload(const char *filnam)
|
||||
|
@ -2777,13 +2774,13 @@ voxmodel_t *voxload(const char *filnam)
|
|||
vm->xpiv = xpiv; vm->ypiv = ypiv; vm->zpiv = zpiv;
|
||||
vm->is8bit = is8bit;
|
||||
|
||||
vm->texid = (uint32_t *)calloc(MAXPALOOKUPS,sizeof(uint32_t));
|
||||
vm->texid = (uint32_t *)nedpcalloc(model_data_pool, MAXPALOOKUPS,sizeof(uint32_t));
|
||||
if (!vm->texid) { voxfree(vm); vm = 0; }
|
||||
}
|
||||
if (shcntmal) { free(shcntmal); shcntmal = 0; }
|
||||
if (vbit) { free(vbit); vbit = 0; }
|
||||
if (vcol) { free(vcol); vcol = 0; vnum = 0; vmax = 0; }
|
||||
if (vcolhashead) { free(vcolhashead); vcolhashead = 0; }
|
||||
if (shcntmal) { nedpfree(model_data_pool, shcntmal); shcntmal = 0; }
|
||||
if (vbit) { nedpfree(model_data_pool, vbit); vbit = 0; }
|
||||
if (vcol) { nedpfree(model_data_pool, vcol); vcol = 0; vnum = 0; vmax = 0; }
|
||||
if (vcolhashead) { nedpfree(model_data_pool, vcolhashead); vcolhashead = 0; }
|
||||
return(vm);
|
||||
}
|
||||
|
||||
|
@ -2976,8 +2973,8 @@ int32_t mddraw(spritetype *tspr)
|
|||
|
||||
if (r_vbos && (r_vbocount > allocvbos))
|
||||
{
|
||||
indexvbos = realloc(indexvbos, sizeof(GLuint) * r_vbocount);
|
||||
vertvbos = realloc(vertvbos, sizeof(GLuint) * r_vbocount);
|
||||
indexvbos = nedprealloc(model_data_pool, indexvbos, sizeof(GLuint) * r_vbocount);
|
||||
vertvbos = nedprealloc(model_data_pool, vertvbos, sizeof(GLuint) * r_vbocount);
|
||||
|
||||
bglGenBuffersARB(r_vbocount - allocvbos, &(indexvbos[allocvbos]));
|
||||
bglGenBuffersARB(r_vbocount - allocvbos, &(vertvbos[allocvbos]));
|
||||
|
@ -3000,7 +2997,7 @@ int32_t mddraw(spritetype *tspr)
|
|||
|
||||
if (maxmodelverts > allocmodelverts)
|
||||
{
|
||||
point3d *vl = (point3d *)realloc(vertlist,sizeof(point3d)*maxmodelverts);
|
||||
point3d *vl = (point3d *)nedprealloc(model_data_pool, vertlist,sizeof(point3d)*maxmodelverts);
|
||||
if (!vl) { OSD_Printf("ERROR: Not enough memory to allocate %d vertices!\n",maxmodelverts); return 0; }
|
||||
vertlist = vl;
|
||||
allocmodelverts = maxmodelverts;
|
||||
|
|
|
@ -1188,6 +1188,9 @@ void polymer_texinvalidate(void)
|
|||
{
|
||||
int32_t i;
|
||||
|
||||
if (!prsectors[numsectors-1])
|
||||
return;
|
||||
|
||||
i = numsectors-1;
|
||||
while (i >= 0)
|
||||
{
|
||||
|
@ -2949,34 +2952,32 @@ static void polymer_extractfrustum(GLfloat* modelview, GLfloat* projecti
|
|||
i++;
|
||||
}
|
||||
while (i < 4);
|
||||
i = 0;
|
||||
|
||||
if (pr_verbosity >= 3) OSD_Printf("PR : Frustum extracted.\n");
|
||||
}
|
||||
|
||||
static int32_t polymer_planeinfrustum(_prplane *plane, float* frustum)
|
||||
static inline int32_t polymer_planeinfrustum(_prplane *plane, float* frustum)
|
||||
{
|
||||
int32_t i, j, k;
|
||||
float sqdist;
|
||||
|
||||
i = 0;
|
||||
while (i < 5)
|
||||
i = 4;
|
||||
do
|
||||
{
|
||||
j = k = 0;
|
||||
while (j < plane->vertcount)
|
||||
j = k = plane->vertcount - 1;
|
||||
do
|
||||
{
|
||||
sqdist = frustum[(i * 4) + 0] * plane->buffer[(j * 5) + 0] +
|
||||
frustum[(i * 4) + 1] * plane->buffer[(j * 5) + 1] +
|
||||
frustum[(i * 4) + 2] * plane->buffer[(j * 5) + 2] +
|
||||
frustum[(i * 4) + 3];
|
||||
if (sqdist < 0)
|
||||
k++;
|
||||
j++;
|
||||
k -= ((frustum[(i << 2) + 0] * plane->buffer[j + (j << 2) + 0] +
|
||||
frustum[(i << 2) + 1] * plane->buffer[j + (j << 2) + 1] +
|
||||
frustum[(i << 2) + 2] * plane->buffer[j + (j << 2) + 2] +
|
||||
frustum[(i << 2) + 3]) < 0.f);
|
||||
|
||||
}
|
||||
if (k == plane->vertcount)
|
||||
while (j--);
|
||||
|
||||
if (k == -1)
|
||||
return (0); // OUT !
|
||||
i++;
|
||||
}
|
||||
while (i--);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
@ -3781,7 +3782,8 @@ static int32_t polymer_bindmaterial(_prmaterial material, int16_t* lights,
|
|||
programbits |= prprogrambits[PR_BIT_MIRROR_MAP].bit;
|
||||
|
||||
// PR_BIT_FOG
|
||||
programbits |= prprogrambits[PR_BIT_FOG].bit;
|
||||
if (!material.mirrormap)
|
||||
programbits |= prprogrambits[PR_BIT_FOG].bit;
|
||||
|
||||
// PR_BIT_GLOW_MAP
|
||||
if (!curlight && r_glowmapping && material.glowmap)
|
||||
|
|
|
@ -171,6 +171,9 @@ int32_t main(int32_t argc, char *argv[])
|
|||
char *argp;
|
||||
FILE *fp;
|
||||
|
||||
nedcreatepool(SYSTEM_POOL_SIZE, -1);
|
||||
atexit(neddestroysyspool);
|
||||
|
||||
buildkeytranslationtable();
|
||||
|
||||
#ifdef HAVE_GTK2
|
||||
|
@ -334,7 +337,6 @@ void initprintf(const char *f, ...)
|
|||
va_list va;
|
||||
char buf[1024];
|
||||
static char dabuf[1024];
|
||||
static int32_t cnt = 0;
|
||||
|
||||
va_start(va, f);
|
||||
Bvsnprintf(buf, 1024, f, va);
|
||||
|
@ -351,7 +353,7 @@ void initprintf(const char *f, ...)
|
|||
|
||||
Bstrcat(dabuf,buf);
|
||||
|
||||
if (++cnt < 16 || flushlogwindow || Bstrlen(dabuf) > 768)
|
||||
if (flushlogwindow || Bstrlen(dabuf) > 768)
|
||||
{
|
||||
startwin_puts(dabuf);
|
||||
startwin_idle(NULL);
|
||||
|
|
|
@ -275,6 +275,9 @@ int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, in
|
|||
FILE *fp;
|
||||
HDC hdc;
|
||||
|
||||
nedcreatepool(SYSTEM_POOL_SIZE, -1);
|
||||
atexit(neddestroysyspool);
|
||||
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
UNREFERENCED_PARAMETER(nCmdShow);
|
||||
|
||||
|
@ -610,7 +613,6 @@ void initprintf(const char *f, ...)
|
|||
va_list va;
|
||||
char buf[1024];
|
||||
static char dabuf[1024];
|
||||
static int32_t cnt = 0;
|
||||
|
||||
va_start(va, f);
|
||||
Bvsnprintf(buf, 1024, f, va);
|
||||
|
@ -618,15 +620,15 @@ void initprintf(const char *f, ...)
|
|||
|
||||
OSD_Printf(buf);
|
||||
|
||||
if (Bstrlen(dabuf) + Bstrlen(buf) > 1022)
|
||||
{
|
||||
startwin_puts(dabuf);
|
||||
Bmemset(dabuf, 0, sizeof(dabuf));
|
||||
}
|
||||
if ((Bstrlen(dabuf) + Bstrlen(buf) + 2) > sizeof(dabuf))
|
||||
{
|
||||
startwin_puts(dabuf);
|
||||
Bmemset(dabuf, 0, sizeof(dabuf));
|
||||
}
|
||||
|
||||
Bstrcat(dabuf,buf);
|
||||
|
||||
if (++cnt < 16 || flushlogwindow || Bstrlen(dabuf) > 768 || numplayers > 1)
|
||||
if (flushlogwindow || Bstrlen(dabuf) > 768)
|
||||
{
|
||||
startwin_puts(dabuf);
|
||||
handleevents();
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
ReBuildCommandLine="nmake /f Makefile.msvc veryclean all"
|
||||
CleanCommandLine="nmake /f Makefile.msvc veryclean"
|
||||
Output="eduke32.exe"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;SUPERBUILD;POLYMOST;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;SUPERBUILD;POLYMOST;POLYMER;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN"
|
||||
IncludeSearchPath=""
|
||||
ForcedIncludes=""
|
||||
AssemblySearchPath=""
|
||||
|
@ -304,10 +304,6 @@
|
|||
RelativePath=".\build\src\mdsprite.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\build\src\memcpy.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\build\src\mmulti.c"
|
||||
>
|
||||
|
|
|
@ -584,6 +584,7 @@ static void ms(int32_t i)
|
|||
|
||||
// this is the same crap as in game.c's tspr manipulation. puke.
|
||||
#define LIGHTRAD (s->yrepeat * tilesizy[s->picnum+(T5?(*(intptr_t *)T5) + *(((intptr_t *)T5)+2) * T4:0)])
|
||||
#define LIGHTRAD2 (((s->yrepeat) + (rand()%(s->yrepeat>>2))) * tilesizy[s->picnum+(T5?(*(intptr_t *)T5) + *(((intptr_t *)T5)+2) * T4:0)])
|
||||
|
||||
inline void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t range, int32_t color, int32_t priority)
|
||||
{
|
||||
|
@ -617,6 +618,9 @@ inline void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, i
|
|||
|
||||
s->z -= zoffset;
|
||||
|
||||
if (range < ActorExtra[srcsprite].lightmaxrange>>1)
|
||||
ActorExtra[srcsprite].lightmaxrange = 0;
|
||||
|
||||
if (range > ActorExtra[srcsprite].lightmaxrange ||
|
||||
priority != ActorExtra[srcsprite].lightptr->priority ||
|
||||
Bmemcmp(&sprite[srcsprite], ActorExtra[srcsprite].lightptr, sizeof(int32_t) * 3))
|
||||
|
@ -670,51 +674,6 @@ static void G_MoveZombieActors(void)
|
|||
{
|
||||
if (x < 30000)
|
||||
{
|
||||
#ifdef POLYMER
|
||||
switch (DynamicTileMap[s->picnum])
|
||||
{
|
||||
case FLOORFLAME__STATIC:
|
||||
case FIREBARREL__STATIC:
|
||||
case FIREVASE__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
case ATOMICHEALTH__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case FIRE__STATIC:
|
||||
case FIRE2__STATIC:
|
||||
/*
|
||||
if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break;
|
||||
if (s->z > ActorExtra[i].floorz+2048) break;
|
||||
*/
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
case BURNING__STATIC:
|
||||
case BURNING2__STATIC:
|
||||
/*
|
||||
if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break;
|
||||
if (s->z > ActorExtra[i].floorz + 2048) break;
|
||||
*/
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case EXPLOSION2__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),
|
||||
s->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
case FORCERIPPLE__STATIC:
|
||||
// case TRANSPORTERSTAR__STATIC:
|
||||
case TRANSPORTERBEAM__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 80+(80<<8)+(255<<16),PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
case SHRINKEREXPLOSION__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
}
|
||||
#endif // POLYMER
|
||||
|
||||
ActorExtra[i].timetosleep++;
|
||||
if (ActorExtra[i].timetosleep >= (x>>8))
|
||||
{
|
||||
|
@ -1834,8 +1793,6 @@ static void G_MoveStandables(void)
|
|||
|
||||
if (s->picnum == OOZFILTER || s->picnum == SEENINE || s->picnum == SEENINEDEAD || s->picnum == (SEENINEDEAD+1))
|
||||
{
|
||||
if (s->picnum == OOZFILTER && s->xrepeat)
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 6144, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
if (s->shade != -32 && s->shade != -33)
|
||||
{
|
||||
if (s->xrepeat)
|
||||
|
@ -2259,10 +2216,9 @@ CLEAR_THE_BOLT:
|
|||
}
|
||||
goto BOLT;
|
||||
|
||||
case FLOORFLAME__STATIC:
|
||||
case FIREBARREL__STATIC:
|
||||
case FIREVASE__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
case FLOORFLAME__STATIC:
|
||||
case FIREBARREL__STATIC:
|
||||
case FIREVASE__STATIC:
|
||||
case EXPLODINGBARREL__STATIC:
|
||||
case WOODENHORSE__STATIC:
|
||||
case HORSEONSIDE__STATIC:
|
||||
|
@ -2812,23 +2768,7 @@ static void G_MoveWeapons(void)
|
|||
|
||||
switch (DynamicTileMap[s->picnum])
|
||||
{
|
||||
case FREEZEBLAST__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case COOLEXPLOSION1__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<2, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case SHRINKSPARK__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
case FIRELASER__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
case RPG__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME);
|
||||
|
||||
if (DynamicTileMap[s->picnum] == RPG__STATIC && ActorExtra[i].picnum != BOSS2 &&
|
||||
s->xrepeat >= 10 && sector[s->sectnum].lotag != 2)
|
||||
{
|
||||
|
@ -3472,19 +3412,6 @@ static void G_MoveActors(void)
|
|||
}
|
||||
switch (DynamicTileMap[switchpicnum])
|
||||
{
|
||||
case ATOMICHEALTH__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case FIRE__STATIC:
|
||||
case FIRE2__STATIC:
|
||||
/*
|
||||
if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break;
|
||||
if (s->z > ActorExtra[i].floorz+2048) break;
|
||||
*/
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case DUCK__STATIC:
|
||||
case TARGET__STATIC:
|
||||
if (s->cstat&32)
|
||||
|
@ -5229,31 +5156,6 @@ static void G_MoveMisc(void) // STATNUM 5
|
|||
case TRANSPORTERSTAR__STATIC:
|
||||
case TRANSPORTERBEAM__STATIC:
|
||||
{
|
||||
switch (DynamicTileMap[switchpicnum])
|
||||
{
|
||||
case BURNING__STATIC:
|
||||
case BURNING2__STATIC:
|
||||
/*
|
||||
if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break;
|
||||
if (s->z > ActorExtra[i].floorz + 2048) break;
|
||||
*/
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case EXPLOSION2__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1),
|
||||
LIGHTRAD, 255+(95<<8),
|
||||
s->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
case FORCERIPPLE__STATIC:
|
||||
// case TRANSPORTERSTAR__STATIC:
|
||||
case TRANSPORTERBEAM__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 80+(80<<8)+(255<<16),PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
case SHRINKEREXPLOSION__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
}
|
||||
if (!actorscrptr[sprite[i].picnum])
|
||||
goto BOLT;
|
||||
p = A_FindPlayer(s,&x);
|
||||
|
@ -7949,6 +7851,8 @@ void G_MoveWorld(void)
|
|||
#ifdef POLYMER
|
||||
if (getrendermode() == 4)
|
||||
{
|
||||
spritetype *s = &sprite[i];
|
||||
|
||||
if(ActorExtra[i].lightptr != NULL && ActorExtra[i].lightcount)
|
||||
{
|
||||
if (!(--ActorExtra[i].lightcount))
|
||||
|
@ -7977,7 +7881,6 @@ void G_MoveWorld(void)
|
|||
case ACCESSSWITCH__STATIC:
|
||||
case ACCESSSWITCH2__STATIC:
|
||||
{
|
||||
spritetype *s = &sprite[i];
|
||||
int32_t x, y;
|
||||
|
||||
if (s->cstat & 32768 || !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum))
|
||||
|
@ -7997,6 +7900,69 @@ void G_MoveWorld(void)
|
|||
}
|
||||
switch (DynamicTileMap[sprite[i].picnum])
|
||||
{
|
||||
case ATOMICHEALTH__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2<<2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case FIRE__STATIC:
|
||||
case FIRE2__STATIC:
|
||||
/*
|
||||
if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break;
|
||||
if (s->z > ActorExtra[i].floorz+2048) break;
|
||||
*/
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case BURNING__STATIC:
|
||||
case BURNING2__STATIC:
|
||||
/*
|
||||
if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break;
|
||||
if (s->z > ActorExtra[i].floorz + 2048) break;
|
||||
*/
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case OOZFILTER__STATIC:
|
||||
if (s->xrepeat > 4)
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 6144, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
case FLOORFLAME__STATIC:
|
||||
case FIREBARREL__STATIC:
|
||||
case FIREVASE__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case EXPLOSION2__STATIC:
|
||||
if (!ActorExtra[i].lightcount)
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),
|
||||
s->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
case FORCERIPPLE__STATIC:
|
||||
// case TRANSPORTERSTAR__STATIC:
|
||||
case TRANSPORTERBEAM__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 80+(80<<8)+(255<<16),PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
case SHRINKEREXPLOSION__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
case FREEZEBLAST__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case COOLEXPLOSION1__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<3, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case SHRINKSPARK__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
case FIRELASER__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
case RPG__STATIC:
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
|
||||
case DIPSWITCH__STATIC:
|
||||
case DIPSWITCH2__STATIC:
|
||||
case DIPSWITCH3__STATIC:
|
||||
|
@ -8013,7 +7979,6 @@ void G_MoveWorld(void)
|
|||
case ACCESSSWITCH__STATIC:
|
||||
case ACCESSSWITCH2__STATIC:
|
||||
{
|
||||
spritetype *s = &sprite[i];
|
||||
int32_t x, y;
|
||||
|
||||
if (s->cstat & 32768 || !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum))
|
||||
|
|
|
@ -5538,7 +5538,11 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
break;
|
||||
|
||||
case EXPLOSION2__STATIC:
|
||||
G_AddGameLight(0, i, ((sp->yrepeat*tilesizy[sp->picnum])<<1), 8192, 255+(95<<8),sp->yrepeat > 32 ? PR_LIGHT_PRIO_MAX_GAME : PR_LIGHT_PRIO_LOW_GAME);
|
||||
if (sp->yrepeat > 32)
|
||||
{
|
||||
G_AddGameLight(0, i, ((sp->yrepeat*tilesizy[sp->picnum])<<1), 32768, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME);
|
||||
ActorExtra[i].lightcount = 2;
|
||||
}
|
||||
case EXPLOSION2BOT__STATIC:
|
||||
case BURNING__STATIC:
|
||||
case BURNING2__STATIC:
|
||||
|
@ -11263,7 +11267,9 @@ CLEAN_DIRECTORY:
|
|||
}
|
||||
}
|
||||
|
||||
flushlogwindow = 0;
|
||||
loaddefinitions_game(duke3ddef, TRUE);
|
||||
flushlogwindow = 1;
|
||||
|
||||
{
|
||||
struct strllist *s;
|
||||
|
@ -11346,6 +11352,7 @@ CLEAN_DIRECTORY:
|
|||
}
|
||||
|
||||
if (quitevent) return;
|
||||
|
||||
if (!loaddefinitionsfile(duke3ddef))
|
||||
{
|
||||
initprintf("Definitions file '%s' loaded.\n",duke3ddef);
|
||||
|
|
|
@ -5902,6 +5902,8 @@ void C_Compile(const char *filenam)
|
|||
|
||||
initprintf("Compiling: %s (%d bytes)\n",filenam,fs);
|
||||
|
||||
flushlogwindow = 0;
|
||||
|
||||
startcompiletime = getticks();
|
||||
|
||||
mptr = (char *)Bmalloc(fs+1);
|
||||
|
@ -6008,8 +6010,6 @@ void C_Compile(const char *filenam)
|
|||
|
||||
C_SetScriptSize(g_scriptPtr-script+8);
|
||||
|
||||
flushlogwindow = 0;
|
||||
|
||||
initprintf("Script compiled in %dms\n", getticks() - startcompiletime);
|
||||
|
||||
initprintf("Compiled code size: %ld*%d bytes, version %s\n",
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
//-------------------------------------------------------------------------
|
||||
#include "duke3d.h"
|
||||
|
||||
const char *s_buildDate = "20090522";
|
||||
const char *s_buildDate = "20090613";
|
||||
char *MusicPtr = NULL;
|
||||
int32_t g_musicSize;
|
||||
|
||||
|
|
|
@ -85,6 +85,14 @@ int32_t ScanGroups(void)
|
|||
struct grpfile *grp;
|
||||
char *fn;
|
||||
struct Bstat st;
|
||||
#define BUFFER_SIZE (1024 * 1024 * 8)
|
||||
uint8_t *buf = Bmalloc(BUFFER_SIZE);
|
||||
|
||||
if (!buf || 1)
|
||||
{
|
||||
initprintf("Error allocating %d byte buffer to scan GRPs!\n", BUFFER_SIZE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
initprintf("Scanning for GRP files...\n");
|
||||
|
||||
|
@ -131,7 +139,6 @@ int32_t ScanGroups(void)
|
|||
{
|
||||
int32_t b, fh;
|
||||
int32_t crcval;
|
||||
char buf[16*512];
|
||||
|
||||
fh = openfrompath(sidx->name, BO_RDONLY|BO_BINARY, BS_IREAD);
|
||||
if (fh < 0) continue;
|
||||
|
@ -141,10 +148,10 @@ int32_t ScanGroups(void)
|
|||
crc32init((uint32_t *)&crcval);
|
||||
do
|
||||
{
|
||||
b = read(fh, buf, sizeof(buf));
|
||||
b = read(fh, buf, BUFFER_SIZE);
|
||||
if (b > 0) crc32block((uint32_t *)&crcval, (uint8_t *)buf, b);
|
||||
}
|
||||
while (b == sizeof(buf));
|
||||
while (b == BUFFER_SIZE);
|
||||
crc32finish((uint32_t *)&crcval);
|
||||
close(fh);
|
||||
initprintf(" Done\n");
|
||||
|
@ -186,9 +193,13 @@ int32_t ScanGroups(void)
|
|||
fclose(fp);
|
||||
}
|
||||
// initprintf("Found %d recognized GRP %s.\n",i,i>1?"files":"file");
|
||||
if (buf)
|
||||
Bfree(buf);
|
||||
return 0;
|
||||
}
|
||||
initprintf("Found no recognized GRP files!\n");
|
||||
if (buf)
|
||||
Bfree(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue