Subversion Repositories eduke32

Compare Revisions

Regard whitespace Rev 4984 → Rev 4983

/polymer/eduke32/build/src/engine.c
417,7 → 417,7
int16_t yax_bunchnum[MAXSECTORS][2];
int16_t yax_nextwall[MAXWALLS][2];
 
static inline int32_t yax_islockededge(int32_t line, int32_t cf)
static int32_t yax_islockededge(int32_t line, int32_t cf)
{
return !!(wall[line].cstat&(YAX_NEXTWALLBIT(cf)));
}
441,7 → 441,7
# define YAX_BUNCHNUM(Sect, Cf) YAX_PTRBUNCHNUM(sector, Sect, Cf)
 
# if !defined NEW_MAP_FORMAT
static inline int32_t yax_islockededge(int32_t line, int32_t cf)
static int32_t yax_islockededge(int32_t line, int32_t cf)
{
return (yax_getnextwall(line, cf) >= 0);
}
545,8 → 545,12
// is red, return its nextsector.
int16_t yax_vnextsec(int16_t line, int16_t cf)
{
int16_t const ynw = yax_getnextwall(line, cf);
return (ynw < 0) ? -1 : wall[ynw].nextsector;
int16_t ynw = yax_getnextwall(line, cf);
 
if (ynw < 0)
return -1;
 
return wall[ynw].nextsector;
}
 
 
1305,8 → 1309,8
typedef struct
{
int16_t numsectors, numwalls;
tsectortype *sector;
twalltype *wall;
sectortype *sector;
walltype *wall;
} mapinfo_t;
 
static void mapinfo_set(mapinfo_t *bak, mapinfo_t *newmap)
1315,8 → 1319,8
{
bak->numsectors = numsectors;
bak->numwalls = numwalls;
bak->sector = (tsectortype *)sector;
bak->wall = (twalltype *)wall;
bak->sector = sector;
bak->wall = wall;
}
 
if (newmap)
1323,8 → 1327,8
{
numsectors = newmap->numsectors;
numwalls = newmap->numwalls;
sector = (sectortype *)newmap->sector;
wall = (walltype *)newmap->wall;
sector = newmap->sector;
wall = newmap->wall;
}
}
 
1349,9 → 1353,9
static int16_t pictoidx[MAXTILES]; // maps tile num to clipinfo[] index
static int16_t *tempictoidx;
 
static tsectortype *loadsector;
static twalltype *loadwall, *loadwallinv;
static tspritetype *loadsprite;
static sectortype *loadsector;
static walltype *loadwall, *loadwallinv;
static spritetype *loadsprite;
 
// sectoidx bits
#undef CM_NONE
1380,21 → 1384,27
 
static void clipmapinfo_init()
{
int32_t i;
 
numclipmaps = 0;
numclipsects = 0;
 
DO_FREE_AND_NULL(sectq);
DO_FREE_AND_NULL(sectoidx);
DO_FREE_AND_NULL(tempictoidx);
DO_FREE_AND_NULL(loadsector);
DO_FREE_AND_NULL(loadwall);
DO_FREE_AND_NULL(loadwallinv);
DO_FREE_AND_NULL(loadsprite);
if (sectq) { Bfree(sectq); sectq=NULL; }
if (sectoidx) { Bfree(sectoidx); sectoidx=NULL; }
if (tempictoidx) { Bfree(tempictoidx); tempictoidx=NULL; }
 
// two's complement trick, -1 = 0xff
Bmemset(&pictoidx, -1, sizeof(pictoidx));
Bmemset(&clipmapinfo, 0, sizeof(mapinfo_t));
for (i=0; i<MAXTILES; i++)
pictoidx[i]=-1;
 
if (loadsector) { Bfree(loadsector); loadsector=NULL; }
if (loadwall) { Bfree(loadwall); loadwall=NULL; }
if (loadwallinv) { Bfree(loadwallinv); loadwallinv=NULL; }
if (loadsprite) { Bfree(loadsprite); loadsprite=NULL; }
 
clipmapinfo.numsectors = clipmapinfo.numwalls = 0;
clipmapinfo.sector=NULL;
clipmapinfo.wall=NULL;
 
numsectors = 0;
numwalls = 0;
}
1415,9 → 1425,9
 
clipmapinfo_init();
 
loadsector = (tsectortype *)Xmalloc(MAXSECTORS * sizeof(sectortype));
loadwall = (twalltype *)Xmalloc(MAXWALLS * sizeof(walltype));
loadsprite = (tspritetype *)Xmalloc(MAXSPRITES * sizeof(spritetype));
loadsector = (sectortype *)Xmalloc(MAXSECTORS * sizeof(sectortype));
loadwall = (walltype *)Xmalloc(MAXWALLS * sizeof(walltype));
loadsprite = (spritetype *)Xmalloc(MAXSPRITES * sizeof(spritetype));
 
if (g_clipMapFilesNum)
fisec = (int32_t *)Xcalloc(g_clipMapFilesNum, sizeof (int32_t));
1485,8 → 1495,8
}
 
// shrink
loadsector = (tsectortype *)Xrealloc(loadsector, ournumsectors*sizeof(sectortype));
loadwall = (twalltype *)Xrealloc(loadwall, ournumwalls*sizeof(walltype));
loadsector = (sectortype *)Xrealloc(loadsector, ournumsectors*sizeof(sectortype));
loadwall = (walltype *)Xrealloc(loadwall, ournumwalls*sizeof(walltype));
 
Bmemcpy(sector, loadsector, ournumsectors*sizeof(sectortype));
Bmemcpy(wall, loadwall, ournumwalls*sizeof(walltype));
1762,7 → 1772,7
Bmemcpy(loadwall, wall, ournumwalls*sizeof(walltype));
 
// loadwallinv will contain all walls with inverted orientation for x/y-flip handling
loadwallinv = (twalltype *)Xmalloc(ournumwalls*sizeof(walltype));
loadwallinv = (walltype *)Xmalloc(ournumwalls*sizeof(walltype));
 
{
int32_t j, loopstart, loopend, numloopwalls;
1862,6 → 1872,8
 
static int32_t getscore(int32_t w1c, int32_t w1f, int32_t w2c, int32_t w2f)
{
int32_t minflor, maxceil;
 
if (w1c > w1f)
swaplong(&w1c, &w1f);
if (w2c > w2f)
1869,8 → 1881,8
 
// now: c <= f for each "wall-vline"
 
int32_t maxceil = max(w1c, w2c);
int32_t minflor = min(w1f, w2f);
maxceil = max(w1c, w2c);
minflor = min(w1f, w2f);
 
return minflor-maxceil;
}
2244,7 → 2256,7
static inline int32_t getclipmask(int32_t a, int32_t b, int32_t c, int32_t d)
{
// Ken did this
d = ((a<0)<<3) + ((b<0)<<2) + ((c<0)<<1) + (d<0);
d = ((a<0)*8) + ((b<0)*4) + ((c<0)*2) + (d<0);
return(((d<<4)^0xf0)|d);
}
 
2548,9 → 2560,9
return 0;
}
 
static inline vec2_t get_rel_coords(int32_t const x, int32_t const y)
static vec2_t get_rel_coords(int32_t x, int32_t y)
{
vec2_t const p = {
vec2_t p = {
dmulscale6(y,cosglobalang, -x,singlobalang),
dmulscale6(x,cosviewingrangeglobalang, y,sinviewingrangeglobalang)
};
2711,7 → 2723,11
}
}
#endif
p1 = (w == startwall || wall[w - 1].point2 != w) ? get_rel_coords(x1, y1) : p2;
if (w == startwall || wall[w-1].point2 != w)
p1 = get_rel_coords(x1, y1);
else
p1 = p2;
 
p2 = get_rel_coords(x2, y2);
 
if (p1.y < 256 && p2.y < 256)
10349,15 → 10365,16
static const char *E_GetArtFileName(int32_t tilefilei);
static int32_t E_ReadArtFile(int32_t tilefilei);
 
static inline void clearmapartfilename(void)
static void clearmapartfilename(void)
{
Bmemset(mapartfilename, 0, sizeof(mapartfilename));
mapartfnXXofs = 0;
}
 
static inline void E_RecalcPicSiz(void)
static void E_RecalcPicSiz(void)
{
for (int i=0; i<MAXTILES; i++)
int32_t i;
for (i=0; i<MAXTILES; i++)
set_picsiz(i);
}
 
13648,7 → 13665,7
{
flipmul = flipx*flipy;
if (flipmul==-1)
wall = (walltype *)loadwallinv;
wall = loadwallinv;
}
 
if ((curspr->cstat&128) != (sector[j].CM_CSTAT&128))