Cleaning out tree... some light changes, polymer memory pools, some meaningless optimizations, etc

git-svn-id: https://svn.eduke32.com/eduke32@1425 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-06-09 06:19:58 +00:00
parent fab4638ca8
commit 2f86c2a20f
27 changed files with 220 additions and 190 deletions

View file

@ -74,7 +74,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
LIBS=-lm # -lprofiler
NASMFLAGS = -s
EXESUFFIX=

View file

@ -495,7 +495,7 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
#endif /* WIN32 */
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT 0x403
// #define _WIN32_WINNT 0x403
#include <windows.h>
#define HAVE_MMAP 1
#define HAVE_MORECORE 0

View file

@ -277,6 +277,10 @@ typedef struct s_pranimatespritesinfo {
int32_t x, y, a, smoothratio;
} _pranimatespritesinfo;
// MEMORY POOL
#define POLYMER_POOL_SIZE 65572864
extern nedpool* polymer_pool;
// EXTERNAL FUNCTIONS
int32_t polymer_init(void);
void polymer_uninit(void);

View file

@ -1615,7 +1615,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
ch = *kfileptr++; leng--;
if (ch >= 16) { index = ch-12; }
else { index = ch; }
memcpy((void *)&hufnumatbit[index][1],(void *)kfileptr,16); kfileptr += 16;
Bmemcpy((void *)&hufnumatbit[index][1],(void *)kfileptr,16); kfileptr += 16;
leng -= 16;
v = 0; hufcnt[index] = 0;
@ -1624,7 +1624,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
{
hufmaxatbit[index][i] = v+hufnumatbit[index][i];
hufvalatbit[index][i] = hufcnt[index]-v;
memcpy((void *)&huftable[index][hufcnt[index]],(void *)kfileptr,(int32_t)hufnumatbit[index][i]);
Bmemcpy((void *)&huftable[index][hufcnt[index]],(void *)kfileptr,(int32_t)hufnumatbit[index][i]);
if (i <= 10)
for (c=0; c<hufnumatbit[index][i]; c++)
for (j=(1<<(10-i)); j>0; j--)
@ -2040,7 +2040,7 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
for (i=lzcols-1; i>=0; i--) { suffix[i] = (uint8_t)(prefix[i] = i); }
currstr = lzcols+2; numbits = startnumbits; numbitgoal = (lzcols<<1);
blocklen = *ptr++;
memcpy(filbuffer,ptr,blocklen); ptr += blocklen;
Bmemcpy(filbuffer,ptr,blocklen); ptr += blocklen;
bitcnt = 0;
while (1)
{
@ -2051,7 +2051,7 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
*(int16_t *)filbuffer = *(int16_t *)&filbuffer[bitcnt>>3];
i = blocklen-(bitcnt>>3);
blocklen = (int32_t)*ptr++;
memcpy(&filbuffer[i],ptr,blocklen); ptr += blocklen;
Bmemcpy(&filbuffer[i],ptr,blocklen); ptr += blocklen;
bitcnt &= 7; blocklen += i;
}
if (dat == lzcols)
@ -2489,7 +2489,7 @@ static int32_t kddsrend(const char *buf, int32_t leng,
for (y=0; y<ysiz; y++,j+=bpl,buf+=xx)
{
if ((uint32_t)(y+yoff) >= (uint32_t)ydim) continue;
memcpy((void *)j,(void *)buf,xsiz);
Bmemcpy((void *)j,(void *)buf,xsiz);
}
return(0);
}
@ -2995,7 +2995,7 @@ int32_t kzfindfile(char *filnam)
if ((wildst[i] == '/') || (wildst[i] == '\\'))
wildstpathleng = i+1;
memcpy(filnam,wildst,wildstpathleng);
Bmemcpy(filnam,wildst,wildstpathleng);
#if defined(__DOS__)
if (_dos_findfirst(wildst,_A_SUBDIR,&findata))
@ -3036,7 +3036,7 @@ int32_t kzfindfile(char *filnam)
if (srchstat == -2)
while (1)
{
memcpy(filnam,wildst,wildstpathleng);
Bmemcpy(filnam,wildst,wildstpathleng);
#if defined(__DOS__)
if (_dos_findnext(&findata))
{ if (!kzhashbuf) return(0); srchstat = kzlastfnam; break; }
@ -3101,7 +3101,7 @@ static void putbuf4zip(const char *buf, int32_t uncomp0, int32_t uncomp1)
// &gzbufptr[kzfs.pos] ... &gzbufptr[kzfs.endpos];
i0 = max(uncomp0,kzfs.pos);
i1 = min(uncomp1,kzfs.endpos);
if (i0 < i1) memcpy(&gzbufptr[i0],&buf[i0-uncomp0],i1-i0);
if (i0 < i1) Bmemcpy(&gzbufptr[i0],&buf[i0-uncomp0],i1-i0);
}
//returns number of bytes copied

View file

@ -73,7 +73,7 @@ lzwcompbreak2b:
lptr = (int32_t *)compbuf;
if (((bitcnt+7)>>3) < ucompleng) { lptr[0] = LSWAPIB(numnodes); return((bitcnt+7)>>3); }
memcpy(compbuf,ucompbuf,ucompleng); return(ucompleng);
Bmemcpy(compbuf,ucompbuf,ucompleng); return(ucompleng);
}
int32_t lzwuncompress(char *compbuf, int32_t compleng, char *ucompbuf, int32_t ucompleng)
@ -82,7 +82,7 @@ int32_t lzwuncompress(char *compbuf, int32_t compleng, char *ucompbuf, int32_t u
char ch, *ucptr, *suffix;
int32_t ucomp = (int32_t)ucompbuf;
if (compleng >= ucompleng) { memcpy(ucompbuf,compbuf,ucompleng); return ucompleng; }
if (compleng >= ucompleng) { Bmemcpy(ucompbuf,compbuf,ucompleng); return ucompleng; }
totnodes = LSWAPIB(((int32_t *)compbuf)[0]); if (totnodes <= 0 || totnodes >= ucompleng+256) return 0;

View file

@ -49,7 +49,7 @@ typedef unsigned int UINT4;
static void MD4Transform(UINT4 [4], unsigned char [64]);
static void Encode(unsigned char *, UINT4 *, unsigned int);
static void Decode(UINT4 *, unsigned char *, unsigned int);
#define MD4_memcpy memcpy
#define MD4_memcpy Bmemcpy
#define MD4_memset memset
static unsigned char PADDING[64] =

View file

@ -312,7 +312,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *
map = (mdanim_t*)calloc(1,sizeof(mdanim_t));
if (!map) return(-4);
memcpy(map, &ma, sizeof(ma));
Bmemcpy(map, &ma, sizeof(ma));
map->next = m->animations;
m->animations = map;
@ -2356,10 +2356,10 @@ static void addquad(int32_t x0, int32_t y0, int32_t z0, int32_t x1, int32_t y1,
//Extend borders vertically
for (yy=0; yy<VOXBORDWIDTH; yy++)
{
memcpy(&gvox->mytex[(shp[z].y+yy)*gvox->mytexx+shp[z].x],
Bmemcpy(&gvox->mytex[(shp[z].y+yy)*gvox->mytexx+shp[z].x],
&gvox->mytex[(shp[z].y+VOXBORDWIDTH)*gvox->mytexx+shp[z].x],
(x+(VOXBORDWIDTH<<1))<<2);
memcpy(&gvox->mytex[(shp[z].y+y+yy+VOXBORDWIDTH)*gvox->mytexx+shp[z].x],
Bmemcpy(&gvox->mytex[(shp[z].y+y+yy+VOXBORDWIDTH)*gvox->mytexx+shp[z].x],
&gvox->mytex[(shp[z].y+y-1+VOXBORDWIDTH)*gvox->mytexx+shp[z].x],
(x+(VOXBORDWIDTH<<1))<<2);
}
@ -2877,7 +2877,7 @@ int32_t voxdraw(voxmodel_t *m, spritetype *tspr)
//------------
//transform to Build coords
memcpy(omat,mat,sizeof(omat));
Bmemcpy(omat,mat,sizeof(omat));
f = 1.f/64.f;
g = m0.x*f; mat[0] *= g; mat[1] *= g; mat[2] *= g;
g = m0.y*f; mat[4] = omat[8]*g; mat[5] = omat[9]*g; mat[6] = omat[10]*g;

View file

@ -289,10 +289,10 @@ int32_t netread(int32_t *other, char *dabuf, int32_t bufsiz) //0:no packets in
#if (SIMLAG > 1)
i = simlagcnt[*other]%(SIMLAG+1);
*(int16_t *)&simlagfif[*other][i][0] = bufsiz; memcpy(&simlagfif[*other][i][2],dabuf,bufsiz);
*(int16_t *)&simlagfif[*other][i][0] = bufsiz; Bmemcpy(&simlagfif[*other][i][2],dabuf,bufsiz);
simlagcnt[*other]++; if (simlagcnt[*other] < SIMLAG+1) return(0);
i = simlagcnt[*other]%(SIMLAG+1);
bufsiz = *(int16_t *)&simlagfif[*other][i][0]; memcpy(dabuf,&simlagfif[*other][i][2],bufsiz);
bufsiz = *(int16_t *)&simlagfif[*other][i][0]; Bmemcpy(dabuf,&simlagfif[*other][i][2],bufsiz);
#endif
return(1);
@ -641,7 +641,7 @@ void mmulti_dosendpackets(int32_t other) //Host to send intially, client to sen
*(uint16_t *)&pakbuf[k] = (uint16_t)j; k += 2;
*(int32_t *)&pakbuf[k] = i; k += 4;
memcpy(&pakbuf[k],&pakmem[opak[other][i&(FIFSIZ-1)]+2],j); k += j;
Bmemcpy(&pakbuf[k],&pakmem[opak[other][i&(FIFSIZ-1)]+2],j); k += j;
}
*(uint16_t *)&pakbuf[k] = 0; k += 2;
*(uint16_t *)&pakbuf[0] = (uint16_t)k;
@ -664,7 +664,7 @@ void mmulti_sendpacket(int32_t other, char *bufptr, int32_t messleng)
if (pakmemi+messleng+2 > (int32_t)sizeof(pakmem)) pakmemi = 1;
opak[other][ocnt1[other]&(FIFSIZ-1)] = pakmemi;
*(int16_t *)&pakmem[pakmemi] = messleng;
memcpy(&pakmem[pakmemi+2],bufptr,messleng); pakmemi += messleng+2;
Bmemcpy(&pakmem[pakmemi+2],bufptr,messleng); pakmemi += messleng+2;
ocnt1[other]++;
//printf("Send: "); for(i=0;i<messleng;i++) printf("%02x ",bufptr[i]); printf("\n");
@ -793,7 +793,7 @@ int32_t mmulti_getpacket(int32_t *retother, char *bufptr)
if (pakmemi+messleng+2 > (int32_t)sizeof(pakmem)) pakmemi = 1;
ipak[other][j&(FIFSIZ-1)] = pakmemi;
*(int16_t *)&pakmem[pakmemi] = messleng;
memcpy(&pakmem[pakmemi+2],&pakbuf[k],messleng); pakmemi += messleng+2;
Bmemcpy(&pakmem[pakmemi+2],&pakbuf[k],messleng); pakmemi += messleng+2;
}
k += messleng;
messleng = (int32_t)(*(uint16_t *)&pakbuf[k]); k += 2;
@ -811,7 +811,7 @@ int32_t mmulti_getpacket(int32_t *retother, char *bufptr)
j = ipak[i][icnt0[i]&(FIFSIZ-1)];
if (j)
{
messleng = *(int16_t *)&pakmem[j]; memcpy(bufptr,&pakmem[j+2],messleng);
messleng = *(int16_t *)&pakmem[j]; Bmemcpy(bufptr,&pakmem[j+2],messleng);
*retother = i; ipak[i][icnt0[i]&(FIFSIZ-1)] = 0; icnt0[i]++;
//printf("Recv: "); for(i=0;i<messleng;i++) printf("%02x ",bufptr[i]); printf("\n");

View file

@ -433,7 +433,7 @@ int32_t mmulti_getpacket(int32_t *other, char *bufptr)
/* 2ND half of good double-packet */
inlastpacket = 0;
*other = lastpacketfrom;
memcpy(bufptr,lastpacket,lastpacketleng);
Bmemcpy(bufptr,lastpacket,lastpacketleng);
return(lastpacketleng);
}
@ -499,7 +499,7 @@ int32_t mmulti_getpacket(int32_t *other, char *bufptr)
#endif
messleng = ((int32_t)gcom->buffer[3]) + (((int32_t)gcom->buffer[4])<<8);
lastpacketleng = gcom->numbytes-7-messleng;
memcpy(bufptr,&gcom->buffer[messleng+5],lastpacketleng);
Bmemcpy(bufptr,&gcom->buffer[messleng+5],lastpacketleng);
incnt[*other]++;
return(lastpacketleng);
}
@ -520,7 +520,7 @@ int32_t mmulti_getpacket(int32_t *other, char *bufptr)
messleng = gcom->numbytes-5;
memcpy(bufptr,&gcom->buffer[3],messleng);
Bmemcpy(bufptr,&gcom->buffer[3],messleng);
incnt[*other]++;
return(messleng);
@ -535,8 +535,8 @@ int32_t mmulti_getpacket(int32_t *other, char *bufptr)
lastpacketleng = gcom->numbytes-7-messleng;
inlastpacket = 1; lastpacketfrom = *other;
memcpy(bufptr,&gcom->buffer[5],messleng);
memcpy(lastpacket,&gcom->buffer[messleng+5],lastpacketleng);
Bmemcpy(bufptr,&gcom->buffer[5],messleng);
Bmemcpy(lastpacket,&gcom->buffer[messleng+5],lastpacketleng);
incnt[*other] += 2;
return(messleng);

View file

@ -340,7 +340,7 @@ static void _internal_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, in
UNREFERENCED_PARAMETER(pal);
if (len>1023) len=1023;
memcpy(st,ch,len);
Bmemcpy(st,ch,len);
st[len]=0;
if (white<0)
@ -751,7 +751,7 @@ static void OSD_HistoryPrev(void)
if (osdhistorypos >= osdhistorysize-1) return;
osdhistorypos++;
memcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1);
Bmemcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1);
osdeditlen = osdeditcursor = 0;
while (osdeditbuf[osdeditcursor]) osdeditlen++, osdeditcursor++;
if (osdeditcursor<osdeditwinstart)
@ -783,7 +783,7 @@ static void OSD_HistoryNext(void)
}
osdhistorypos--;
memcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1);
Bmemcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1);
osdeditlen = osdeditcursor = 0;
while (osdeditbuf[osdeditcursor]) osdeditlen++, osdeditcursor++;
if (osdeditcursor<osdeditwinstart)
@ -1244,12 +1244,12 @@ void OSD_ResizeDisplay(int32_t w, int32_t h)
memset(newtext, 32, TEXTSIZE);
for (i=j-1; i>=0; i--)
{
memcpy(newtext+newcols*i, osdtext+osdcols*i, k);
memcpy(newfmt+newcols*i, osdfmt+osdcols*i, k);
Bmemcpy(newtext+newcols*i, osdtext+osdcols*i, k);
Bmemcpy(newfmt+newcols*i, osdfmt+osdcols*i, k);
}
memcpy(osdtext, newtext, TEXTSIZE);
memcpy(osdfmt, newfmt, TEXTSIZE);
Bmemcpy(osdtext, newtext, TEXTSIZE);
Bmemcpy(osdfmt, newfmt, TEXTSIZE);
osdcols = newcols;
osdmaxlines = newmaxlines;
osdmaxrows = getrowheight(h)-2;

View file

@ -29,6 +29,8 @@ float pr_specularpower = 15.0f;
float pr_specularfactor = 1.0f;
int32_t pr_atiworkaround = 0;
int32_t r_pr_maxlightpasses = 5; // value of the cvar (not live value), used to detect changes
GLenum mapvbousage = GL_STREAM_DRAW_ARB;
GLenum modelvbousage = GL_STATIC_DRAW_ARB;
@ -564,6 +566,9 @@ int8_t curskyshade;
_pranimatespritesinfo asi;
// MEMORY POOL
nedpool* polymer_pool = NULL;
// EXTERNAL FUNCTIONS
int32_t polymer_init(void)
{
@ -571,6 +576,8 @@ int32_t polymer_init(void)
if (pr_verbosity >= 1) OSD_Printf("Initializing Polymer subsystem...\n");
polymer_pool = nedcreatepool(POLYMER_POOL_SIZE, 0);
Bmemset(&prsectors[0], 0, sizeof(prsectors[0]) * MAXSECTORS);
Bmemset(&prwalls[0], 0, sizeof(prwalls[0]) * MAXWALLS);
@ -587,7 +594,7 @@ int32_t polymer_init(void)
skyboxdatavbo = 0;
if (spriteplane.buffer == NULL) {
spriteplane.buffer = Bcalloc(4, sizeof(GLfloat) * 5);
spriteplane.buffer = nedpmalloc(polymer_pool, 4 * sizeof(GLfloat) * 5);
spriteplane.vertcount = 4;
}
@ -622,6 +629,7 @@ int32_t polymer_init(void)
void polymer_uninit(void)
{
polymer_freeboard();
neddestroypool(polymer_pool);
}
void polymer_glinit(void)
@ -780,19 +788,19 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
dacursectnum = cursectnum;
// unflag all sectors
i = 0;
while (i < numsectors)
i = numsectors-1;
while (i >= 0)
{
prsectors[i]->controlstate = 0;
prsectors[i]->wallsproffset = 0.0f;
prsectors[i]->floorsproffset = 0.0f;
i++;
i--;
}
i = 0;
while (i < numwalls)
i = numwalls-1;
while (i >= 0)
{
prwalls[i]->controlstate = 0;
i++;
i--;
}
getzsofslope(dacursectnum, daposx, daposy, &cursectceilz, &cursectflorz);
@ -802,21 +810,21 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
(daposz > cursectflorz) ||
(daposz < cursectceilz))
{
i = 0;
while (i < numsectors)
i = numsectors-1;
while (i >= 0)
{
polymer_updatesector(i);
polymer_drawsector(i);
polymer_scansprites(i, tsprite, &spritesortcnt);
i++;
i--;
}
i = 0;
while (i < numwalls)
i = numwalls-1;
while (i >= 0)
{
polymer_updatewall(i);
polymer_drawwall(sectorofwall(i), i);
i++;
i--;
}
viewangle = daang;
enddrawing();
@ -1119,18 +1127,12 @@ int16_t polymer_addlight(_prlight* light)
{
int16_t lighti;
if (!pr_lighting)
if (lightcount >= PR_MAXLIGHTS || light->priority > pr_maxlightpriority || !pr_lighting)
return (-1);
if ((light->sector == -1) || (light->sector >= numsectors))
return (-1);
if (lightcount >= PR_MAXLIGHTS)
return (-1);
if (light->priority > pr_maxlightpriority)
return (-1);
lighti = 0;
while ((lighti < PR_MAXLIGHTS) && (prlights[lighti].flags.active)) {
lighti++;
@ -1139,7 +1141,7 @@ int16_t polymer_addlight(_prlight* light)
if (lighti == PR_MAXLIGHTS)
return (-1);
memcpy(&prlights[lighti], light, sizeof(_prlight));
Bmemcpy(&prlights[lighti], light, sizeof(_prlight));
if (light->radius)
polymer_processspotlight(&prlights[lighti]);
@ -1169,6 +1171,18 @@ void polymer_deletelight(int16_t lighti)
lightcount--;
}
void polymer_invalidatelights(void)
{
int32_t i = PR_MAXLIGHTS-1;
do
{
if (prlights[i].flags.active)
prlights[i].flags.invalidate = 1;
}
while (i--);
}
// CORE
static void polymer_displayrooms(int16_t dacursectnum)
{
@ -1229,7 +1243,7 @@ static void polymer_displayrooms(int16_t dacursectnum)
doquery = 0;
i = 0;
i = sec->wallnum-1;
do
{
// this is a couple of fps faster for me... does it mess anything up?
@ -1241,12 +1255,12 @@ static void polymer_displayrooms(int16_t dacursectnum)
if (wall[sec->wallptr + i].nextsector == -1)
doquery = 1;
i++;
i--;
}
while (i < sec->wallnum);
while (i >= 0);
i = 0;
while (i < sec->wallnum)
i = sec->wallnum-1;
while (i >= 0)
{
if ((wall[sec->wallptr + i].nextsector != -1) &&
(wallvisible(globalposx, globalposy, sec->wallptr + i)) &&
@ -1264,7 +1278,7 @@ static void polymer_displayrooms(int16_t dacursectnum)
if ((w->mask.buffer[(0 * 5) + 1] >= w->mask.buffer[(3 * 5) + 1]) &&
(w->mask.buffer[(1 * 5) + 1] >= w->mask.buffer[(2 * 5) + 1]))
{
i++;
i--;
continue;
}
}
@ -1333,10 +1347,10 @@ static void polymer_displayrooms(int16_t dacursectnum)
}
}
i++;
i--;
}
i = 0;
i = sec->wallnum-1;
do
{
if ((queryid[sec->wallptr + i]) &&
@ -1362,9 +1376,9 @@ static void polymer_displayrooms(int16_t dacursectnum)
}
}
i++;
i--;
}
while (i < sec->wallnum);
while (i >= 0);
front++;
}
@ -1391,8 +1405,8 @@ static void polymer_displayrooms(int16_t dacursectnum)
// front++;
// }
i = 0;
while (i < mirrorcount)
i = mirrorcount-1;
while (i >= 0)
{
bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, prrts[0].fbo);
bglPushAttrib(GL_VIEWPORT_BIT);
@ -1469,7 +1483,7 @@ static void polymer_displayrooms(int16_t dacursectnum)
polymer_drawplane(mirrorlist[i].plane);
mirrorlist[i].plane->material.mirrormap = 0;
i++;
i--;
}
spritesortcnt = localspritesortcnt;
@ -1495,7 +1509,6 @@ static void polymer_displayrooms(int16_t dacursectnum)
drawmasks();
bglEnable(GL_CULL_FACE);
}
return;
}
@ -1646,17 +1659,17 @@ static void polymer_freeboard(void)
{
if (prsectors[i])
{
if (prsectors[i]->verts) Bfree(prsectors[i]->verts);
if (prsectors[i]->floor.buffer) Bfree(prsectors[i]->floor.buffer);
if (prsectors[i]->ceil.buffer) Bfree(prsectors[i]->ceil.buffer);
if (prsectors[i]->floor.indices) Bfree(prsectors[i]->floor.indices);
if (prsectors[i]->ceil.indices) Bfree(prsectors[i]->ceil.indices);
if (prsectors[i]->verts) nedpfree(polymer_pool, prsectors[i]->verts);
if (prsectors[i]->floor.buffer) nedpfree(polymer_pool, prsectors[i]->floor.buffer);
if (prsectors[i]->ceil.buffer) nedpfree(polymer_pool, prsectors[i]->ceil.buffer);
if (prsectors[i]->floor.indices) nedpfree(polymer_pool, prsectors[i]->floor.indices);
if (prsectors[i]->ceil.indices) nedpfree(polymer_pool, prsectors[i]->ceil.indices);
if (prsectors[i]->ceil.vbo) bglDeleteBuffersARB(1, &prsectors[i]->ceil.vbo);
if (prsectors[i]->ceil.ivbo) bglDeleteBuffersARB(1, &prsectors[i]->ceil.ivbo);
if (prsectors[i]->floor.vbo) bglDeleteBuffersARB(1, &prsectors[i]->floor.vbo);
if (prsectors[i]->floor.ivbo) bglDeleteBuffersARB(1, &prsectors[i]->floor.ivbo);
Bfree(prsectors[i]);
nedpfree(polymer_pool, prsectors[i]);
prsectors[i] = NULL;
}
@ -1668,16 +1681,16 @@ static void polymer_freeboard(void)
{
if (prwalls[i])
{
if (prwalls[i]->bigportal) Bfree(prwalls[i]->bigportal);
if (prwalls[i]->mask.buffer) Bfree(prwalls[i]->mask.buffer);
if (prwalls[i]->cap) Bfree(prwalls[i]->cap);
if (prwalls[i]->wall.buffer) Bfree(prwalls[i]->wall.buffer);
if (prwalls[i]->bigportal) nedpfree(polymer_pool, prwalls[i]->bigportal);
if (prwalls[i]->mask.buffer) nedpfree(polymer_pool, prwalls[i]->mask.buffer);
if (prwalls[i]->cap) nedpfree(polymer_pool, prwalls[i]->cap);
if (prwalls[i]->wall.buffer) nedpfree(polymer_pool, prwalls[i]->wall.buffer);
if (prwalls[i]->wall.vbo) bglDeleteBuffersARB(1, &prwalls[i]->wall.vbo);
if (prwalls[i]->over.vbo) bglDeleteBuffersARB(1, &prwalls[i]->over.vbo);
if (prwalls[i]->mask.vbo) bglDeleteBuffersARB(1, &prwalls[i]->mask.vbo);
if (prwalls[i]->stuffvbo) bglDeleteBuffersARB(1, &prwalls[i]->stuffvbo);
Bfree(prwalls[i]);
nedpfree(polymer_pool, prwalls[i]);
prwalls[i] = NULL;
}
@ -1795,17 +1808,17 @@ static int32_t polymer_initsector(int16_t sectnum)
if (pr_verbosity >= 2) OSD_Printf("PR : Initalizing sector %i...\n", sectnum);
sec = &sector[sectnum];
s = Bcalloc(1, sizeof(_prsector));
s = nedpcalloc(polymer_pool, 1, sizeof(_prsector));
if (s == NULL)
{
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sector %i : Bmalloc failed.\n", sectnum);
return (0);
}
s->verts = Bcalloc(sec->wallnum, sizeof(GLdouble) * 3);
s->floor.buffer = Bcalloc(sec->wallnum, sizeof(GLfloat) * 5);
s->verts = nedpcalloc(polymer_pool, sec->wallnum, sizeof(GLdouble) * 3);
s->floor.buffer = nedpcalloc(polymer_pool, sec->wallnum, sizeof(GLfloat) * 5);
s->floor.vertcount = sec->wallnum;
s->ceil.buffer = Bcalloc(sec->wallnum, sizeof(GLfloat) * 5);
s->ceil.buffer = nedpcalloc(polymer_pool, sec->wallnum, sizeof(GLfloat) * 5);
s->ceil.vertcount = sec->wallnum;
if ((s->verts == NULL) || (s->floor.buffer == NULL) || (s->ceil.buffer == NULL))
{
@ -2107,8 +2120,8 @@ void PR_CALLBACK polymer_tessvertex(void* vertex, void* sector)
{
if (pr_verbosity >= 2) OSD_Printf("PR : Indice overflow, extending the indices list... !\n");
s->indicescount++;
s->floor.indices = Brealloc(s->floor.indices, s->indicescount * sizeof(GLushort));
s->ceil.indices = Brealloc(s->ceil.indices, s->indicescount * sizeof(GLushort));
s->floor.indices = nedprealloc(polymer_pool, s->floor.indices, s->indicescount * sizeof(GLushort));
s->ceil.indices = nedprealloc(polymer_pool, s->ceil.indices, s->indicescount * sizeof(GLushort));
}
s->ceil.indices[s->curindice] = (intptr_t)vertex;
s->curindice++;
@ -2132,8 +2145,8 @@ static int32_t polymer_buildfloor(int16_t sectnum)
if (s->floor.indices == NULL)
{
s->indicescount = (sec->wallnum - 2) * 3;
s->floor.indices = Bcalloc(s->indicescount, sizeof(GLushort));
s->ceil.indices = Bcalloc(s->indicescount, sizeof(GLushort));
s->floor.indices = nedpcalloc(polymer_pool, s->indicescount, sizeof(GLushort));
s->ceil.indices = nedpcalloc(polymer_pool, s->indicescount, sizeof(GLushort));
}
s->curindice = 0;
@ -2209,7 +2222,7 @@ static int32_t polymer_initwall(int16_t wallnum)
if (pr_verbosity >= 2) OSD_Printf("PR : Initalizing wall %i...\n", wallnum);
w = Bcalloc(1, sizeof(_prwall));
w = nedpcalloc(polymer_pool, 1, sizeof(_prwall));
if (w == NULL)
{
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize wall %i : Bmalloc failed.\n", wallnum);
@ -2217,13 +2230,13 @@ static int32_t polymer_initwall(int16_t wallnum)
}
if (w->mask.buffer == NULL) {
w->mask.buffer = Bcalloc(4, sizeof(GLfloat) * 5);
w->mask.buffer = nedpmalloc(polymer_pool, 4 * sizeof(GLfloat) * 5);
w->mask.vertcount = 4;
}
if (w->bigportal == NULL)
w->bigportal = Bcalloc(4, sizeof(GLfloat) * 5);
w->bigportal = nedpmalloc(polymer_pool, 4 * sizeof(GLfloat) * 5);
if (w->cap == NULL)
w->cap = Bcalloc(4, sizeof(GLfloat) * 3);
w->cap = nedpmalloc(polymer_pool, 4 * sizeof(GLfloat) * 3);
bglGenBuffersARB(1, &w->wall.vbo);
bglGenBuffersARB(1, &w->over.vbo);
@ -2294,7 +2307,7 @@ static void polymer_updatewall(int16_t wallnum)
}
if (w->wall.buffer == NULL) {
w->wall.buffer = Bcalloc(4, sizeof(GLfloat) * 5);
w->wall.buffer = nedpmalloc(polymer_pool, 4 * sizeof(GLfloat) * 5);
w->wall.vertcount = 4;
}
@ -2508,7 +2521,7 @@ static void polymer_updatewall(int16_t wallnum)
if ((overwall) || (wal->cstat & 16) || (wal->cstat & 32))
{
if (w->over.buffer == NULL) {
w->over.buffer = Bcalloc(4, sizeof(GLfloat) * 5);
w->over.buffer = nedpmalloc(polymer_pool, 4 * sizeof(GLfloat) * 5);
w->over.vertcount = 4;
}
@ -2868,20 +2881,15 @@ static inline void polymer_transformpoint(float* inpos, float* pos, float* matr
static inline void polymer_pokesector(int16_t sectnum)
{
sectortype *sec;
_prsector *s;
walltype *wal;
int32_t i;
sec = &sector[sectnum];
s = prsectors[sectnum];
wal = &wall[sec->wallptr];
sectortype *sec = &sector[sectnum];
_prsector *s = prsectors[sectnum];
walltype *wal = &wall[sec->wallptr];
int32_t i = 0;
if (!s->controlstate)
polymer_updatesector(sectnum);
i = 0;
while (i < sec->wallnum)
do
{
if ((wal->nextsector != -1) && (!prsectors[wal->nextsector]->controlstate))
polymer_updatesector(wal->nextsector);
@ -2891,6 +2899,7 @@ static inline void polymer_pokesector(int16_t sectnum)
i++;
wal = &wall[sec->wallptr + i];
}
while (i < sec->wallnum);
}
static void polymer_extractfrustum(GLfloat* modelview, GLfloat* projection, float* frustum)
@ -3517,9 +3526,9 @@ static void polymer_loadmodelvbos(md3model_t* m)
int32_t i;
md3surf_t *s;
m->indices = Bcalloc(m->head.numsurfs, sizeof(GLuint));
m->texcoords = Bcalloc(m->head.numsurfs, sizeof(GLuint));
m->geometry = Bcalloc(m->head.numsurfs, sizeof(GLuint));
m->indices = nedpmalloc(polymer_pool, m->head.numsurfs * sizeof(GLuint));
m->texcoords = nedpmalloc(polymer_pool, m->head.numsurfs * sizeof(GLuint));
m->geometry = nedpmalloc(polymer_pool, m->head.numsurfs * sizeof(GLuint));
bglGenBuffersARB(m->head.numsurfs, m->indices);
bglGenBuffersARB(m->head.numsurfs, m->texcoords);
@ -4208,9 +4217,10 @@ static void polymer_removelight(int16_t lighti)
polymer_deleteplanelight(prlights[lighti].planelist->plane, lighti);
oldhead = prlights[lighti].planelist;
prlights[lighti].planelist = prlights[lighti].planelist->n;
Bfree(oldhead);
nedpfree(polymer_pool, oldhead);
}
prlights[lighti].planecount = 0;
prlights[lighti].planelist = NULL;
}
static void polymer_updatelights(void)
@ -4277,56 +4287,45 @@ static void polymer_resetlights(void)
static inline void polymer_resetplanelights(_prplane* plane)
{
Bmemset(&plane->lights[0], -1, sizeof(plane->lights[0]) * PR_MAXLIGHTS);
Bmemset(&plane->lights[0], -1, sizeof(plane->lights[0]) * plane->lightcount);
plane->lightcount = 0;
}
static void polymer_addplanelight(_prplane* plane, int16_t lighti)
{
int16_t i;
int32_t i = 0;
_prplanelist* oldhead;
if (plane->lightcount == PR_MAXLIGHTS - 1)
return;
i = 0;
do
if (plane->lightcount)
{
if ((plane->lights[i] != -1) && (prlights[plane->lights[i]].priority < prlights[lighti].priority))
{
while (i < plane->lightcount && prlights[plane->lights[i]].priority < prlights[lighti].priority)
i++;
continue;
}
if (plane->lights[i] != -1)
memmove(&plane->lights[i+1], &plane->lights[i], sizeof(int16_t) * (PR_MAXLIGHTS - (i + 1)));
plane->lights[i] = lighti;
plane->lightcount++;
oldhead = prlights[lighti].planelist;
prlights[lighti].planelist = Bcalloc(sizeof(_prplanelist), 1);
prlights[lighti].planelist->n = oldhead;
prlights[lighti].planelist->plane = plane;
prlights[lighti].planecount++;
return;
memmove(&plane->lights[i+1], &plane->lights[i], sizeof(int16_t) * (plane->lightcount - i));
}
while (i < PR_MAXLIGHTS);
plane->lights[i] = lighti;
plane->lightcount++;
oldhead = prlights[lighti].planelist;
prlights[lighti].planelist = nedpmalloc(polymer_pool, sizeof(_prplanelist));
prlights[lighti].planelist->n = oldhead;
prlights[lighti].planelist->plane = plane;
prlights[lighti].planecount++;
}
static inline void polymer_deleteplanelight(_prplane* plane, int16_t lighti)
{
int16_t i;
int32_t i = plane->lightcount-1;
i = plane->lightcount-1;
while (i >= 0)
{
if (plane->lights[i] == lighti)
{
memmove(&plane->lights[i], &plane->lights[i+1], sizeof(int16_t) * (PR_MAXLIGHTS - (i + 1)));
plane->lights[PR_MAXLIGHTS-1] = -1;
memmove(&plane->lights[i], &plane->lights[i+1], sizeof(int16_t) * (plane->lightcount - i));
plane->lightcount--;
return;
}
@ -4337,7 +4336,7 @@ static inline void polymer_deleteplanelight(_prplane* plane, int16_t lighti)
static int32_t polymer_planeinlight(_prplane* plane, _prlight* light)
{
float lightpos[3];
int i, j, k, l;
int32_t i, j, k, l;
if (!plane->vertcount)
return 0;
@ -4375,9 +4374,8 @@ static int32_t polymer_planeinlight(_prplane* plane, _prlight* light)
static void polymer_invalidateplanelights(_prplane* plane)
{
int32_t i;
int32_t i = 0;
i = 0;
while (i < plane->lightcount)
{
if (plane && (plane->lights[i] != -1) && (prlights[plane->lights[i]].flags.active))
@ -4390,12 +4388,9 @@ static void polymer_invalidateplanelights(_prplane* plane)
static void polymer_invalidatesectorlights(int16_t sectnum)
{
int32_t i;
_prsector *s;
_prsector *s = prsectors[sectnum];
_prwall *w;
sectortype *sec;
s = prsectors[sectnum];
sec = &sector[sectnum];
sectortype *sec = &sector[sectnum];
if (!s)
return;
@ -4479,9 +4474,9 @@ static void polymer_processspotlight(_prlight* light)
static inline void polymer_culllight(int16_t lighti)
{
_prlight* light;
int32_t front;
int32_t back;
_prlight* light = &prlights[lighti];
int32_t front = 0;
int32_t back = 1;
int32_t i;
int32_t j;
int32_t zdiff;
@ -4489,9 +4484,6 @@ static inline void polymer_culllight(int16_t lighti)
_prwall *w;
sectortype *sec;
light = &prlights[lighti];
front = 0;
back = 1;
Bmemset(drawingstate, 0, sizeof(int16_t) * numsectors);
drawingstate[light->sector] = 1;
@ -4676,7 +4668,7 @@ static void polymer_initrendertargets(int32_t count)
{
int32_t i;
prrts = Bcalloc(count, sizeof(_prrt));
prrts = nedpcalloc(polymer_pool, count, sizeof(_prrt));
i = 0;
while (i < count)

View file

@ -425,7 +425,7 @@ pthtyp * gltexcache(int32_t dapicnum, int32_t dapalnum, int32_t dameth)
{
if ((pth2->hicr) && (pth2->hicr->filename) && (Bstrcasecmp(pth2->hicr->filename, si->filename) == 0))
{
memcpy(pth, pth2, sizeof(pthtyp));
Bmemcpy(pth, pth2, sizeof(pthtyp));
pth->picnum = dapicnum;
pth->flags = ((dameth&4)>>2) + 2 + ((drawingskybox>0)<<2);
if (pth2->flags & 8) pth->flags |= 8; //hasalpha
@ -1243,7 +1243,7 @@ int32_t gloadtile_art(int32_t dapic, int32_t dapal, int32_t dameth, pthtyp *pth,
pth->picnum = dapic;
pth->palnum = dapal;
pth->effects = 0;
pth->flags = ((dameth&4)>>2) | (hasalpha<<3) | (hasfullbright<<4);
pth->flags = ((dameth&4)>>2) | (hasalpha<<3);
pth->hicr = NULL;
if ((hasfullbright) && (!fullbrightloadingpass))
@ -1252,6 +1252,7 @@ int32_t gloadtile_art(int32_t dapic, int32_t dapal, int32_t dameth, pthtyp *pth,
fullbrightloadingpass = 1;
pth->ofb = (pthtyp *)calloc(1,sizeof(pthtyp));
if (!pth->ofb) return 1;
pth->flags |= (hasfullbright<<4);
if (gloadtile_art(dapic, dapal, dameth, pth->ofb, 1)) return 1;
fullbrightloadingpass = 0;
@ -1739,10 +1740,10 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
{
int32_t *lptr = (int32_t *)pic;
for (y=0; y<tsizy; y++,lptr+=xsiz)
memcpy(&lptr[tsizx],lptr,(xsiz-tsizx)<<2);
Bmemcpy(&lptr[tsizx],lptr,(xsiz-tsizx)<<2);
}
if (ysiz > tsizy) //Copy top to bottom
memcpy(&pic[xsiz*tsizy],pic,(ysiz-tsizy)*xsiz<<2);
Bmemcpy(&pic[xsiz*tsizy],pic,(ysiz-tsizy)*xsiz<<2);
}
if (!glinfo.bgra)
{
@ -5929,6 +5930,17 @@ static int32_t osdcmd_cvar_set_polymost(const osdfuncparm_t *parm)
gltexturemode(parm);
return r;
}
#ifdef POLYMER
else if (!Bstrcasecmp(parm->name, "r_pr_maxlightpasses"))
{
if (pr_maxlightpasses != r_pr_maxlightpasses)
{
}
pr_maxlightpasses = r_pr_maxlightpasses;
return r;
}
#endif
}
#endif
return r;
@ -5981,7 +5993,7 @@ void polymost_initosdfuncs(void)
{ "r_pr_shadowcount", "r_pr_shadowcount: maximal amount of shadow emitting lights on screen - you need to restart the renderer for it to take effect", (void*)&pr_shadowcount, CVAR_INT, 0, 0, 64 },
{ "r_pr_shadowdetail", "r_pr_shadowdetail: sets the shadow map resolution - you need to restart the renderer for it to take effect", (void*)&pr_shadowdetail, CVAR_INT, 0, 0, 5 },
{ "r_pr_shadowfiltering", "r_pr_shadowfiltering: enable/disable shadow edges filtering - you need to restart the renderer for it to take effect", (void*)&pr_shadowfiltering, CVAR_BOOL, 0, 0, 1 },
{ "r_pr_maxlightpasses", "r_pr_maxlightpasses: the maximal amount of lights a single object can by affected by", (void*)&pr_maxlightpasses, CVAR_INT, 0, 0, 512 },
{ "r_pr_maxlightpasses", "r_pr_maxlightpasses: the maximal amount of lights a single object can by affected by", (void*)&r_pr_maxlightpasses, CVAR_INT|CVAR_FUNCPTR, 0, 0, PR_MAXLIGHTS },
{ "r_pr_maxlightpriority", "r_pr_maxlightpriority: lowering that value removes less meaningful lights from the scene", (void*)&pr_maxlightpriority, CVAR_INT, 0, 0, PR_MAXLIGHTPRIORITY },
{ "r_pr_fov", "r_pr_fov: sets the field of vision in build angle", (void*)&pr_fov, CVAR_INT, 0, 0, 1023},
{ "r_pr_billboardingmode", "r_pr_billboardingmode: face sprite display method. 0: classic mode; 1: polymost mode", (void*)&pr_billboardingmode, CVAR_INT, 0, 0, 1 },

View file

@ -318,7 +318,7 @@ scriptfile *scriptfile_fromstring(char *string)
return NULL;
}
memcpy(tx, string, flen);
Bmemcpy(tx, string, flen);
tx[flen] = tx[flen+1] = 0;
scriptfile_preparse(sf,tx,flen);

View file

@ -395,7 +395,7 @@ int32_t startwin_puts(const char *buf)
}
q = p;
while (*q && *q != '\n') q++;
memcpy(workbuf, p, q-p);
Bmemcpy(workbuf, p, q-p);
if (*q == '\n')
{
if (!q[1])

View file

@ -1235,7 +1235,7 @@ static BOOL CALLBACK InitDirectInput_enum(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRe
UNREFERENCED_PARAMETER(pvRef);
#define COPYGUID(d,s) memcpy(&d,&s,sizeof(GUID))
#define COPYGUID(d,s) Bmemcpy(&d,&s,sizeof(GUID))
switch (lpddi->dwDevType&0xff)
{

View file

@ -132,6 +132,10 @@
RelativePath=".\build\include\lzwnew.h"
>
</File>
<File
RelativePath=".\build\include\malloc.c.h"
>
</File>
<File
RelativePath=".\build\include\md4.h"
>
@ -152,6 +156,10 @@
RelativePath=".\build\include\mmultimsgs.h"
>
</File>
<File
RelativePath=".\build\include\nedmalloc.h"
>
</File>
<File
RelativePath=".\build\include\osd.h"
>
@ -296,6 +304,10 @@
RelativePath=".\build\src\mdsprite.c"
>
</File>
<File
RelativePath=".\build\src\memcpy.c"
>
</File>
<File
RelativePath=".\build\src\mmulti.c"
>
@ -308,6 +320,10 @@
RelativePath=".\build\src\mmulti_unstable.c"
>
</File>
<File
RelativePath=".\build\src\nedmalloc.c"
>
</File>
<File
RelativePath=".\build\src\osd.c"
>

View file

@ -616,7 +616,9 @@ inline void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, i
}
s->z -= zoffset;
if (range > ActorExtra[srcsprite].lightmaxrange ||
priority != ActorExtra[srcsprite].lightptr->priority ||
Bmemcmp(&sprite[srcsprite], ActorExtra[srcsprite].lightptr, sizeof(int32_t) * 3))
{
if (range > ActorExtra[srcsprite].lightmaxrange)
@ -627,6 +629,7 @@ inline void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, i
ActorExtra[srcsprite].lightptr->flags.invalidate = 1;
}
ActorExtra[srcsprite].lightptr->priority = priority;
ActorExtra[srcsprite].lightptr->range = range;
ActorExtra[srcsprite].lightptr->color[0] = color&255;
ActorExtra[srcsprite].lightptr->color[1] = (color>>8)&255;
@ -697,7 +700,8 @@ static void G_MoveZombieActors(void)
break;
case EXPLOSION2__STATIC:
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 4096, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
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:
@ -2809,15 +2813,15 @@ static void G_MoveWeapons(void)
switch (DynamicTileMap[s->picnum])
{
case FREEZEBLAST__STATIC:
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
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), 4096, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
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), 2048, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME);
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);
@ -3469,7 +3473,7 @@ static void G_MoveActors(void)
switch (DynamicTileMap[switchpicnum])
{
case ATOMICHEALTH__STATIC:
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
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:
@ -5238,15 +5242,16 @@ static void G_MoveMisc(void) // STATNUM 5
case EXPLOSION2__STATIC:
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1),
(512 * s->yrepeat) / (ActorExtra[i].temp_data[2]+1), 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
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);
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);
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])
@ -7975,7 +7980,7 @@ void G_MoveWorld(void)
spritetype *s = &sprite[i];
int32_t x, y;
if (!inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum))
if (s->cstat & 32768 || !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum))
break;
x = ((sintable[(s->ang+512)&2047])>>7);
@ -7984,7 +7989,7 @@ void G_MoveWorld(void)
s->x += x;
s->y += y;
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 48+(255<<8)+(48<<16),PR_LIGHT_PRIO_LOW_GAME);
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 48+(255<<8)+(48<<16),PR_LIGHT_PRIO_LOW);
s->x -= x;
s->y -= y;
}
@ -8011,7 +8016,7 @@ void G_MoveWorld(void)
spritetype *s = &sprite[i];
int32_t x, y;
if (!inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum))
if (s->cstat & 32768 || !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum))
break;
x = ((sintable[(s->ang+512)&2047])>>7);
@ -8020,7 +8025,7 @@ void G_MoveWorld(void)
s->x += x;
s->y += y;
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 255+(48<<8)+(48<<16),PR_LIGHT_PRIO_LOW_GAME);
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 255+(48<<8)+(48<<16),PR_LIGHT_PRIO_LOW);
s->x -= x;
s->y -= y;
}

View file

@ -1551,7 +1551,7 @@ static void ReadHelpFile(const char *name)
if (tempbuf[charsread-2]==0x0d) tempbuf[charsread-2]=0;
}
memcpy(hp->line[j], tempbuf, 80);
Bmemcpy(hp->line[j], tempbuf, 80);
for (k=charsread; k<80; k++) hp->line[j][k]=0;
@ -1811,7 +1811,7 @@ static void IntegratedHelp()
}
ENDFOR1:
if (pattern[0])
memcpy(oldpattern, pattern, IHELP_PATLEN+1);
Bmemcpy(oldpattern, pattern, IHELP_PATLEN+1);
}
}
else // '1'-'0' on the upper row

View file

@ -5538,7 +5538,7 @@ 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),PR_LIGHT_PRIO_MAX_GAME);
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);
case EXPLOSION2BOT__STATIC:
case BURNING__STATIC:
case BURNING2__STATIC:
@ -7080,7 +7080,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
{
if (ud.showweapons && sprite[g_player[p].ps->i].extra > 0 && g_player[p].ps->curr_weapon > 0)
{
memcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype));
Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype));
tsprite[spritesortcnt].statnum = TSPR_TEMP;
@ -7112,7 +7112,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
if (g_player[p].sync->extbits & (1<<7) && !ud.pause_on)
{
memcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype));
Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype));
tsprite[spritesortcnt].statnum = TSPR_TEMP;
@ -7384,7 +7384,7 @@ PALONLY:
if ((s->z-daz) < (8<<8))
if (g_player[screenpeek].ps->posz < daz)
{
memcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype));
Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype));
tsprite[spritesortcnt].statnum = TSPR_TEMP;

View file

@ -720,7 +720,7 @@ convertdata:
}
else
{
memcpy(buf,data,br);
Bmemcpy(buf,data,br);
buf += br;
data += br;
}

View file

@ -141,7 +141,7 @@ static void mixer_callback(int32_t chan, void *stream, int32_t len, void *udata)
fxptr = (Uint8 *)(&_DSL_BufferStart[MV_MixPage *
_DSL_BufferSize]);
memcpy(stptr, fxptr+(_DSL_BufferSize-_DSL_remainder), copysize);
Bmemcpy(stptr, fxptr+(_DSL_BufferSize-_DSL_remainder), copysize);
len -= copysize;
_DSL_remainder -= copysize;
@ -160,7 +160,7 @@ static void mixer_callback(int32_t chan, void *stream, int32_t len, void *udata)
copysize = min(len, _DSL_BufferSize);
memcpy(stptr, fxptr, copysize);
Bmemcpy(stptr, fxptr, copysize);
len -= copysize;

View file

@ -467,7 +467,7 @@ static DWORD WINAPI isr(LPVOID parm)
0; })
*/
//copybuf(_DSOUND_MixBuffer + p * _DSOUND_BufferLength, lockptr, _DSOUND_BufferLength >> 2);
memcpy(lockptr, _DSOUND_MixBuffer + p * _DSOUND_BufferLength, _DSOUND_BufferLength);
Bmemcpy(lockptr, _DSOUND_MixBuffer + p * _DSOUND_BufferLength, _DSOUND_BufferLength);
IDirectSoundBuffer_Unlock(lpDSBSecondary, lockptr, lockbytes, lockptr2, lockbytes2);
}

View file

@ -191,7 +191,7 @@ static void isr(void *userdata, char *stream, int32_t len)
0; })
*/
//copybuf(_DSOUND_MixBuffer + p * _DSOUND_BufferLength, lockptr, _DSOUND_BufferLength >> 2);
memcpy(lockptr, _DSOUND_MixBuffer + p * _DSOUND_BufferLength, _DSOUND_BufferLength);
Bmemcpy(lockptr, _DSOUND_MixBuffer + p * _DSOUND_BufferLength, _DSOUND_BufferLength);
IDirectSoundBuffer_Unlock(lpDSBSecondary, lockptr, lockbytes, lockptr2, lockbytes2);
}

View file

@ -614,8 +614,8 @@ void CONTROL_ApplyAxis(int32_t axis, ControlInfo *info, controldevice device)
void CONTROL_PollDevices(ControlInfo *info)
{
memcpy(CONTROL_LastMouseAxes, CONTROL_MouseAxes, sizeof(CONTROL_MouseAxes));
memcpy(CONTROL_LastJoyAxes, CONTROL_JoyAxes, sizeof(CONTROL_JoyAxes));
Bmemcpy(CONTROL_LastMouseAxes, CONTROL_MouseAxes, sizeof(CONTROL_MouseAxes));
Bmemcpy(CONTROL_LastJoyAxes, CONTROL_JoyAxes, sizeof(CONTROL_JoyAxes));
memset(CONTROL_MouseAxes, 0, sizeof(CONTROL_MouseAxes));
memset(CONTROL_JoyAxes, 0, sizeof(CONTROL_JoyAxes));
@ -848,9 +848,10 @@ void CONTROL_ClearButton(int32_t whichbutton)
CONTROL_Flags[whichbutton].cleared = TRUE;
}
void CONTROL_ProcessBinds(void)
inline void CONTROL_ProcessBinds(void)
{
if (!bindsenabled) return;
if (!bindsenabled)
return;
{
int32_t i=MAXBOUNDKEYS-1;

View file

@ -1352,7 +1352,7 @@ static void resetpspritevars(char g)
P_ResetStatus(0);
for (i=1; i<ud.multimode; i++)
memcpy(g_player[i].ps,g_player[0].ps,sizeof(DukePlayer_t));
Bmemcpy(g_player[i].ps,g_player[0].ps,sizeof(DukePlayer_t));
if (ud.recstat != 2)
for (i=0; i<ud.multimode; i++)

View file

@ -650,7 +650,7 @@ int32_t startwin_puts(const char *buf)
}
q = p;
while (*q && *q != '\n') q++;
memcpy(workbuf, p, q-p);
Bmemcpy(workbuf, p, q-p);
if (*q == '\n')
{
if (!q[1])

View file

@ -120,7 +120,7 @@ int32_t G_GetVersionFromWebsite(char *buffer)
recv(mysock, (char *)&tempbuf, sizeof(tempbuf), 0);
closesocket(mysock);
memcpy(&otherbuf,&tempbuf,sizeof(otherbuf));
Bmemcpy(&otherbuf,&tempbuf,sizeof(otherbuf));
strtok(otherbuf," ");
if (atol(strtok(NULL," ")) == 200)