mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- YAX is also gone now.
This commit is contained in:
parent
1d9d1396ac
commit
5655015691
9 changed files with 9 additions and 2030 deletions
|
@ -1203,10 +1203,6 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
yax_update((header.version & 0xff00) > 0x700 ? 0 : 1);
|
||||
#endif
|
||||
|
||||
g_loadedMapVersion = 7;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -300,19 +300,8 @@ extern unsigned short nextXSprite[kMaxXSprites];
|
|||
extern unsigned short nextXWall[kMaxXWalls];
|
||||
extern unsigned short nextXSector[kMaxXSectors];
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
static inline bool yax_hasnextwall(int nWall)
|
||||
{
|
||||
return yax_getnextwall(nWall, YAX_CEILING) >= 0 || yax_getnextwall(nWall, YAX_FLOOR) >= 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int GetWallType(int nWall)
|
||||
{
|
||||
#ifdef YAX_ENABLE
|
||||
if (yax_hasnextwall(nWall))
|
||||
return 0;
|
||||
#endif
|
||||
return wall[nWall].type;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,56 +124,8 @@ enum rendmode_t {
|
|||
# define YAX_NEXTWALLBIT(Cf) (1<<(10+Cf))
|
||||
# define YAX_NEXTWALLBITS (YAX_NEXTWALLBIT(0)|YAX_NEXTWALLBIT(1))
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
|
||||
// More user tag hijacking: lotag/extra. :/
|
||||
# define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(int16_t *)(&Ptr[Wall].lotag + (playing_blood ? 1 : 2)*Cf))
|
||||
# define YAX_NEXTWALLDEFAULT(Cf) (playing_blood ? 0 : ((Cf)==YAX_CEILING) ? 0 : -1)
|
||||
extern int16_t yax_bunchnum[MAXSECTORS][2];
|
||||
extern int16_t yax_nextwall[MAXWALLS][2];
|
||||
|
||||
|
||||
# define YAX_NEXTWALL(Wall, Cf) YAX_PTRNEXTWALL(wall, Wall, Cf)
|
||||
|
||||
# define YAX_ITER_WALLS(Wal, Itervar, Cfvar) Cfvar=0, Itervar=(Wal); Itervar!=-1; \
|
||||
Itervar=yax_getnextwall(Itervar, Cfvar), \
|
||||
(void)(Itervar==-1 && Cfvar==0 && (Cfvar=1) && (Itervar=yax_getnextwall((Wal), Cfvar)))
|
||||
|
||||
# define SECTORS_OF_BUNCH(Bunchnum, Cf, Itervar) Itervar = headsectbunch[Cf][Bunchnum]; \
|
||||
Itervar != -1; Itervar = nextsectbunch[Cf][Itervar]
|
||||
|
||||
extern int32_t r_tror_nomaskpass;
|
||||
|
||||
|
||||
int16_t yax_getbunch(int16_t i, int16_t cf);
|
||||
static FORCE_INLINE void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb)
|
||||
{
|
||||
*cb = yax_getbunch(i, YAX_CEILING);
|
||||
*fb = yax_getbunch(i, YAX_FLOOR);
|
||||
}
|
||||
int16_t yax_getnextwall(int16_t wal, int16_t cf);
|
||||
void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall);
|
||||
|
||||
|
||||
void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum);
|
||||
void yax_setbunches(int16_t i, int16_t cb, int16_t fb);
|
||||
int16_t yax_vnextsec(int16_t line, int16_t cf);
|
||||
void yax_update(int32_t resetstat);
|
||||
int32_t yax_getneighborsect(int32_t x, int32_t y, int32_t sectnum, int32_t cf);
|
||||
|
||||
static FORCE_INLINE CONSTEXPR int32_t yax_waltosecmask(int32_t const walclipmask)
|
||||
{
|
||||
// blocking: walstat&1 --> secstat&512
|
||||
// hitscan: walstat&64 --> secstat&2048
|
||||
return ((walclipmask&1)<<9) | ((walclipmask&64)<<5);
|
||||
}
|
||||
void yax_preparedrawrooms(void);
|
||||
void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t,int32_t),
|
||||
int16_t sectnum, int32_t didmirror, int32_t smoothr);
|
||||
#else
|
||||
# define yax_preparedrawrooms()
|
||||
# define yax_drawrooms(SpriteAnimFunc, sectnum, didmirror, smoothr)
|
||||
#endif
|
||||
|
||||
#define CLIPMASK0 (((1)<<16)+1)
|
||||
#define CLIPMASK1 (((256)<<16)+64)
|
||||
|
@ -410,18 +362,6 @@ struct validmode_t {
|
|||
};
|
||||
EXTERN struct validmode_t validmode[MAXVALIDMODES];
|
||||
|
||||
EXTERN int32_t numyaxbunches;
|
||||
#ifdef YAX_ENABLE
|
||||
// Singly-linked list of sectnums grouped by bunches and ceiling (0)/floor (1)
|
||||
// Usage e.g.:
|
||||
// int16_t bunchnum = yax_getbunch(somesector, YAX_CEILING);
|
||||
// Iteration over all sectors whose floor bunchnum equals 'bunchnum' (i.e. "all
|
||||
// floors of the other side"):
|
||||
// for (i=headsectbunch[1][bunchnum]; i!=-1; i=nextsectbunch[1][i])
|
||||
// <do stuff with sector i...>
|
||||
|
||||
EXTERN int16_t headsectbunch[2][YAX_MAXBUNCHES], nextsectbunch[2][MAXSECTORS];
|
||||
#endif
|
||||
|
||||
EXTERN int32_t Numsprites;
|
||||
EXTERN int16_t numsectors, numwalls;
|
||||
|
|
|
@ -248,11 +248,7 @@ static int cliptestsector(int const dasect, int const nextsect, int32_t const fl
|
|||
int32_t dacz2 = sec2->ceilingz;
|
||||
|
||||
if ((sec2->floorstat|sec2->ceilingstat) & 2)
|
||||
#ifdef YAX_ENABLE
|
||||
yax_getzsofslope(nextsect, pos.x, pos.y, &dacz2, &daz2);
|
||||
#else
|
||||
getcorrectzsofslope(nextsect, pos.x, pos.y, &dacz2, &daz2);
|
||||
#endif
|
||||
|
||||
if (daz2 <= dacz2)
|
||||
return 1;
|
||||
|
@ -263,11 +259,7 @@ static int cliptestsector(int const dasect, int const nextsect, int32_t const fl
|
|||
int32_t dacz = sec->ceilingz;
|
||||
|
||||
if ((sec->floorstat|sec->ceilingstat) & 2)
|
||||
#ifdef YAX_ENABLE
|
||||
yax_getzsofslope(dasect, pos.x, pos.y, &dacz, &daz);
|
||||
#else
|
||||
getcorrectzsofslope(dasect, pos.x, pos.y, &dacz, &daz);
|
||||
#endif
|
||||
|
||||
int32_t const sec2height = klabs(daz2-dacz2);
|
||||
|
||||
|
@ -555,20 +547,6 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
|
|||
if (wal->nextsector < 0 || (wal->cstat&dawalclipmask))
|
||||
{
|
||||
clipyou = 1;
|
||||
#ifdef YAX_ENABLE
|
||||
int const cb = yax_getbunch(dasect, YAX_CEILING);
|
||||
|
||||
if (cb >= 0 && (sec->ceilingstat & yax_waltosecmask(dawalclipmask)) == 0)
|
||||
{
|
||||
int const ynw = yax_getnextwall(j, YAX_CEILING);
|
||||
|
||||
if (ynw >= 0 && wall[ynw].nextsector >= 0 && (wall[ynw].cstat & dawalclipmask) == 0)
|
||||
{
|
||||
clipmove_tweak_pos(pos, diff.x, diff.y, p1.x, p1.y, p2.x, p2.y, &v.x, &v.y);
|
||||
clipyou = cliptestsector(dasect, wall[ynw].nextsector, flordist, ceildist, v, pos->z);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (editstatus == 0)
|
||||
{
|
||||
|
@ -1025,11 +1003,6 @@ void getzrange(const vec3_t *pos, int16_t sectnum,
|
|||
|
||||
int32_t clipsectcnt = 0;
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
// YAX round, -1:center, 0:ceiling, 1:floor
|
||||
int32_t mcf=-1;
|
||||
#endif
|
||||
|
||||
uspriteptr_t curspr=NULL; // non-NULL when handling sprite with sector-like clipping
|
||||
int32_t curidx=-1, clipspritecnt = 0;
|
||||
|
||||
|
@ -1053,20 +1026,12 @@ void getzrange(const vec3_t *pos, int16_t sectnum,
|
|||
getzsofslope(sectnum,closest.x,closest.y,ceilz,florz);
|
||||
*ceilhit = sectnum+16384; *florhit = sectnum+16384;
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
origclipsectorlist[0] = sectnum;
|
||||
origclipsectnum = 1;
|
||||
#endif
|
||||
clipsectorlist[0] = sectnum;
|
||||
clipsectnum = 1;
|
||||
clipspritenum = 0;
|
||||
Bmemset(clipsectormap, 0, (numsectors+7)>>3);
|
||||
bitmap_set(clipsectormap, sectnum);
|
||||
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
restart_grand:
|
||||
#endif
|
||||
do //Collect sectors inside your square first
|
||||
{
|
||||
////////// Walls //////////
|
||||
|
@ -1119,10 +1084,6 @@ restart_grand:
|
|||
if (d.y > 0) da.y -= d.y*MAXCLIPDIST; else da.y += d.y*MAXCLIPDIST;
|
||||
if (da.x >= da.y)
|
||||
continue;
|
||||
#ifdef YAX_ENABLE
|
||||
if (mcf==-1 && curspr==NULL)
|
||||
origclipsectorlist[origclipsectnum++] = k;
|
||||
#endif
|
||||
//It actually got here, through all the continue's!!!
|
||||
int32_t daz, daz2;
|
||||
closest = pos->vec2;
|
||||
|
@ -1137,20 +1098,10 @@ restart_grand:
|
|||
getzsofslope(k, closest.x,closest.y, &daz,&daz2);
|
||||
|
||||
{
|
||||
#ifdef YAX_ENABLE
|
||||
int16_t cb, fb;
|
||||
yax_getbunches(k, &cb, &fb);
|
||||
#endif
|
||||
if (daz > *ceilz)
|
||||
#ifdef YAX_ENABLE
|
||||
if (mcf!=YAX_FLOOR && cb < 0)
|
||||
#endif
|
||||
*ceilz = daz, *ceilhit = k+16384;
|
||||
|
||||
if (daz2 < *florz)
|
||||
#ifdef YAX_ENABLE
|
||||
if (mcf!=YAX_CEILING && fb < 0)
|
||||
#endif
|
||||
*florz = daz2, *florhit = k+16384;
|
||||
}
|
||||
}
|
||||
|
@ -1228,22 +1179,13 @@ restart_grand:
|
|||
|
||||
if (clipyou != 0)
|
||||
{
|
||||
if ((pos->z > daz) && (daz > *ceilz
|
||||
#ifdef YAX_ENABLE
|
||||
|| (daz == *ceilz && yax_getbunch(clipsectorlist[i], YAX_CEILING)>=0)
|
||||
#endif
|
||||
))
|
||||
if ((pos->z > daz) && (daz > *ceilz))
|
||||
{
|
||||
*ceilz = daz;
|
||||
*ceilhit = j+49152;
|
||||
}
|
||||
|
||||
if ((pos->z < daz2) && (daz2 < *florz
|
||||
#ifdef YAX_ENABLE
|
||||
// can have a floor-sprite lying directly on the floor!
|
||||
|| (daz2 == *florz && yax_getbunch(clipsectorlist[i], YAX_FLOOR)>=0)
|
||||
#endif
|
||||
))
|
||||
if ((pos->z < daz2) && (daz2 < *florz))
|
||||
{
|
||||
*florz = daz2;
|
||||
*florhit = j+49152;
|
||||
|
@ -1253,104 +1195,6 @@ restart_grand:
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
if (numyaxbunches > 0)
|
||||
{
|
||||
int const dasecclipmask = yax_waltosecmask(dawalclipmask);
|
||||
int16_t cb, fb;
|
||||
|
||||
yax_getbunches(sectnum, &cb, &fb);
|
||||
|
||||
mcf++;
|
||||
clipsectcnt = 0; clipsectnum = 0;
|
||||
|
||||
int didchange = 0;
|
||||
if (cb>=0 && mcf==0 && *ceilhit==sectnum+16384)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<origclipsectnum; i++)
|
||||
{
|
||||
int const j = origclipsectorlist[i];
|
||||
if (yax_getbunch(j, YAX_CEILING) >= 0)
|
||||
if (sector[j].ceilingstat&dasecclipmask)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i==origclipsectnum)
|
||||
for (i=0; i<origclipsectnum; i++)
|
||||
{
|
||||
cb = yax_getbunch(origclipsectorlist[i], YAX_CEILING);
|
||||
if (cb < 0)
|
||||
continue;
|
||||
|
||||
for (bssize_t SECTORS_OF_BUNCH(cb,YAX_FLOOR, j))
|
||||
if (inside(pos->x,pos->y, j)==1)
|
||||
{
|
||||
addclipsect(j);
|
||||
|
||||
closest = pos->vec2;
|
||||
if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE)
|
||||
getsectordist(closest, j, &closest);
|
||||
int const daz = getceilzofslope(j, closest.x, closest.y);
|
||||
|
||||
if (!didchange || daz > *ceilz)
|
||||
didchange=1, *ceilhit = j+16384, *ceilz = daz;
|
||||
}
|
||||
}
|
||||
|
||||
if (clipsectnum==0)
|
||||
mcf++;
|
||||
}
|
||||
else if (mcf==0)
|
||||
mcf++;
|
||||
|
||||
didchange = 0;
|
||||
if (fb>=0 && mcf==1 && *florhit==sectnum+16384)
|
||||
{
|
||||
int i=0;
|
||||
for (; i<origclipsectnum; i++)
|
||||
{
|
||||
int const j = origclipsectorlist[i];
|
||||
if (yax_getbunch(j, YAX_FLOOR) >= 0)
|
||||
if (sector[j].floorstat&dasecclipmask)
|
||||
break;
|
||||
}
|
||||
|
||||
// (almost) same as above, but with floors...
|
||||
if (i==origclipsectnum)
|
||||
for (i=0; i<origclipsectnum; i++)
|
||||
{
|
||||
fb = yax_getbunch(origclipsectorlist[i], YAX_FLOOR);
|
||||
if (fb < 0)
|
||||
continue;
|
||||
|
||||
for (bssize_t SECTORS_OF_BUNCH(fb, YAX_CEILING, j))
|
||||
if (inside(pos->x,pos->y, j)==1)
|
||||
{
|
||||
addclipsect(j);
|
||||
|
||||
closest = pos->vec2;
|
||||
if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE)
|
||||
getsectordist(closest, j, &closest);
|
||||
int const daz = getflorzofslope(j, closest.x,closest.y);
|
||||
|
||||
if (!didchange || daz < *florz)
|
||||
didchange=1, *florhit = j+16384, *florz = daz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clipsectnum > 0)
|
||||
{
|
||||
// sector-like sprite re-init:
|
||||
curidx = -1;
|
||||
curspr = NULL;
|
||||
clipspritecnt = 0; clipspritenum = 0;
|
||||
|
||||
goto restart_grand;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1490,11 +1334,7 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32
|
|||
uspriteptr_t curspr = NULL;
|
||||
int32_t clipspritecnt, curidx=-1;
|
||||
// tmp: { (int32_t)curidx, (spritetype *)curspr, (!=0 if outer sector) }
|
||||
intptr_t tmp[3], *tmpptr=NULL;
|
||||
#ifdef YAX_ENABLE
|
||||
vec3_t newsv;
|
||||
int32_t oldhitsect = -1, oldhitsect2 = -2;
|
||||
#endif
|
||||
intptr_t *tmpptr=NULL;
|
||||
const int32_t dawalclipmask = (cliptype&65535);
|
||||
const int32_t dasprclipmask = (cliptype>>16);
|
||||
|
||||
|
@ -1502,9 +1342,6 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32
|
|||
if (sectnum < 0)
|
||||
return -1;
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
restart_grand:
|
||||
#endif
|
||||
hit->pos.vec2 = hitscangoal;
|
||||
|
||||
clipsectorlist[0] = sectnum;
|
||||
|
@ -1721,48 +1558,6 @@ restart_grand:
|
|||
}
|
||||
while (++tempshortcnt < tempshortnum || clipspritecnt < clipspritenum);
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
if (numyaxbunches == 0 || editstatus)
|
||||
return 0;
|
||||
|
||||
if (hit->sprite==-1 && hit->wall==-1 && hit->sect!=oldhitsect
|
||||
&& hit->sect != oldhitsect2) // 'ping-pong' infloop protection
|
||||
{
|
||||
if (hit->sect == -1 && oldhitsect >= 0)
|
||||
{
|
||||
// this is bad: we didn't hit anything after going through a ceiling/floor
|
||||
Bmemcpy(&hit->pos, &newsv, sizeof(vec3_t));
|
||||
hit->sect = oldhitsect;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 1st, 2nd, ... ceil/floor hit
|
||||
// hit->sect is >=0 because if oldhitsect's init and check above
|
||||
if (SECTORFLD(hit->sect,stat, hitscan_hitsectcf)&yax_waltosecmask(dawalclipmask))
|
||||
return 0;
|
||||
|
||||
i = yax_getneighborsect(hit->pos.x, hit->pos.y, hit->sect, hitscan_hitsectcf);
|
||||
if (i >= 0)
|
||||
{
|
||||
Bmemcpy(&newsv, &hit->pos, sizeof(vec3_t));
|
||||
sectnum = i;
|
||||
sv = &newsv;
|
||||
|
||||
oldhitsect2 = oldhitsect;
|
||||
oldhitsect = hit->sect;
|
||||
hit->sect = -1;
|
||||
|
||||
// sector-like sprite re-init:
|
||||
curspr = 0;
|
||||
curidx = -1;
|
||||
tmpptr = NULL;
|
||||
|
||||
goto restart_grand;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,10 +19,6 @@
|
|||
// FIXME: doesn't work with mirrors.
|
||||
//#define ENGINE_CLEAR_SCREEN
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
# define YAX_MAXDRAWS 8
|
||||
#endif
|
||||
|
||||
extern intptr_t asm1, asm2;
|
||||
extern int32_t globalx1, globaly2;
|
||||
|
||||
|
@ -154,27 +150,6 @@ static FORCE_INLINE int32_t getpalookupsh(int32_t davis) { return getpalookup(da
|
|||
extern void polymost_scansector(int32_t sectnum);
|
||||
#endif
|
||||
int32_t renderAddTsprite(int16_t z, int16_t sectnum);
|
||||
#ifdef YAX_ENABLE
|
||||
extern int32_t g_nodraw, scansector_retfast, scansector_collectsprites;
|
||||
extern int32_t yax_globallev, yax_globalbunch;
|
||||
extern int32_t yax_globalcf, yax_nomaskpass, yax_nomaskdidit;
|
||||
extern uint8_t haveymost[(YAX_MAXBUNCHES+7)>>3];
|
||||
extern uint8_t yax_gotsector[(MAXSECTORS+7)>>3];
|
||||
extern int32_t yax_polymostclearzbuffer;
|
||||
|
||||
static FORCE_INLINE int32_t yax_isislandwall(int32_t line, int32_t cf) { return (yax_vnextsec(line, cf) >= 0); }
|
||||
#endif
|
||||
|
||||
#ifdef YAX_DEBUG
|
||||
extern char m32_debugstr[64][128];
|
||||
extern int32_t m32_numdebuglines;
|
||||
# define yaxdebug(fmt, ...) do { if (m32_numdebuglines<64) snprintf(m32_debugstr[m32_numdebuglines++], 128, fmt, ##__VA_ARGS__); } while (0)
|
||||
# define yaxprintf(fmt, ...) do { Printf(fmt, ##__VA_ARGS__); } while (0)
|
||||
#else
|
||||
# define yaxdebug(fmt, ...)
|
||||
# define yaxprintf(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static FORCE_INLINE void setgotpic(int32_t tilenume)
|
||||
|
|
|
@ -48,14 +48,6 @@ static vsptyp vsp[VSPMAX];
|
|||
static int32_t gtag, viewportNodeCount;
|
||||
static float xbl, xbr, xbt, xbb;
|
||||
static int32_t domost_rejectcount;
|
||||
#ifdef YAX_ENABLE
|
||||
typedef struct { float x, cy[2]; int32_t tag; int16_t n, p, ctag; } yax_vsptyp;
|
||||
static yax_vsptyp yax_vsp[YAX_MAXBUNCHES*2][VSPMAX];
|
||||
typedef struct { float x0, x1, cy[2], fy[2]; } yax_hole_t;
|
||||
static yax_hole_t yax_holecf[2][VSPMAX];
|
||||
static int32_t yax_holencf[2];
|
||||
static int32_t yax_drawcf = -1;
|
||||
#endif
|
||||
|
||||
static float dxb1[MAXWALLSB], dxb2[MAXWALLSB];
|
||||
|
||||
|
@ -277,9 +269,6 @@ int skiptile = -1;
|
|||
static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32_t method, const vec2_16_t &tilesize)
|
||||
{
|
||||
if (method == DAMETH_BACKFACECULL || globalpicnum == skiptile ||
|
||||
#ifdef YAX_ENABLE
|
||||
g_nodraw ||
|
||||
#endif
|
||||
(uint32_t)globalpicnum >= MAXTILES)
|
||||
return;
|
||||
|
||||
|
@ -504,23 +493,6 @@ static inline void vsp_finalize_init(int32_t const vcnt)
|
|||
vsp[VSPMAX-1].n = vcnt; vsp[vcnt].p = VSPMAX-1;
|
||||
}
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
static inline void yax_vsp_finalize_init(int32_t const yaxbunch, int32_t const vcnt)
|
||||
{
|
||||
for (bssize_t i=0; i<vcnt; ++i)
|
||||
{
|
||||
yax_vsp[yaxbunch][i].cy[1] = yax_vsp[yaxbunch][i+1].cy[0]; yax_vsp[yaxbunch][i].ctag = i;
|
||||
yax_vsp[yaxbunch][i].n = i+1; yax_vsp[yaxbunch][i].p = i-1;
|
||||
// vsp[i].tag = -1;
|
||||
}
|
||||
yax_vsp[yaxbunch][vcnt-1].n = 0; yax_vsp[yaxbunch][0].p = vcnt-1;
|
||||
|
||||
//VSPMAX-1 is dummy empty node
|
||||
for (bssize_t i=vcnt; i<VSPMAX; i++) { yax_vsp[yaxbunch][i].n = i+1; yax_vsp[yaxbunch][i].p = i-1; }
|
||||
yax_vsp[yaxbunch][VSPMAX-1].n = vcnt; yax_vsp[yaxbunch][vcnt].p = VSPMAX-1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define COMBINE_STRIPS
|
||||
|
||||
#ifdef COMBINE_STRIPS
|
||||
|
@ -547,23 +519,6 @@ static inline void vsmerge(int const i, int const ni)
|
|||
vsdel(ni);
|
||||
}
|
||||
|
||||
# ifdef YAX_ENABLE
|
||||
static inline void yax_vsdel(int const yaxbunch, int const i)
|
||||
{
|
||||
//Delete i
|
||||
int const pi = yax_vsp[yaxbunch][i].p;
|
||||
int const ni = yax_vsp[yaxbunch][i].n;
|
||||
|
||||
yax_vsp[yaxbunch][ni].p = pi;
|
||||
yax_vsp[yaxbunch][pi].n = ni;
|
||||
|
||||
//Add i to empty list
|
||||
yax_vsp[yaxbunch][i].n = yax_vsp[yaxbunch][VSPMAX - 1].n;
|
||||
yax_vsp[yaxbunch][i].p = VSPMAX - 1;
|
||||
yax_vsp[yaxbunch][yax_vsp[yaxbunch][VSPMAX - 1].n].p = i;
|
||||
yax_vsp[yaxbunch][VSPMAX - 1].n = i;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static inline int32_t vsinsaft(int const i)
|
||||
|
@ -582,23 +537,6 @@ static inline int32_t vsinsaft(int const i)
|
|||
return r;
|
||||
}
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
static inline int32_t yax_vsinsaft(int const yaxbunch, int const i)
|
||||
{
|
||||
//i = next element from empty list
|
||||
int32_t const r = yax_vsp[yaxbunch][VSPMAX - 1].n;
|
||||
yax_vsp[yaxbunch][yax_vsp[yaxbunch][r].n].p = VSPMAX - 1;
|
||||
yax_vsp[yaxbunch][VSPMAX - 1].n = yax_vsp[yaxbunch][r].n;
|
||||
|
||||
yax_vsp[yaxbunch][r] = yax_vsp[yaxbunch][i]; //copy i to r
|
||||
|
||||
//insert r after i
|
||||
yax_vsp[yaxbunch][r].p = i; yax_vsp[yaxbunch][r].n = yax_vsp[yaxbunch][i].n;
|
||||
yax_vsp[yaxbunch][yax_vsp[yaxbunch][i].n].p = r; yax_vsp[yaxbunch][i].n = r;
|
||||
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int32_t domostpolymethod = DAMETH_NOMASK;
|
||||
|
||||
|
@ -858,14 +796,6 @@ skip: ;
|
|||
|
||||
int n = 4;
|
||||
polymost_clipmost(dpxy, n, x0, x1, y0top, y0bot, y1top, y1bot);
|
||||
#ifdef YAX_ENABLE
|
||||
if (g_nodraw)
|
||||
{
|
||||
if (yax_drawcf != -1)
|
||||
yax_holecf[yax_drawcf][yax_holencf[yax_drawcf]++] = { dx0, dx1, vsp[i].cy[0], vsp[i].cy[1], n0.y, n1.y };
|
||||
}
|
||||
else
|
||||
#endif
|
||||
polymost_drawpoly(dpxy, n, domostpolymethod, tilesiz[globalpicnum]);
|
||||
|
||||
vsp[i].cy[0] = n0.y;
|
||||
|
@ -880,14 +810,6 @@ skip: ;
|
|||
|
||||
int n = 3;
|
||||
polymost_clipmost(dpxy, n, x0, x1, y0top, y0bot, y1top, y1bot);
|
||||
#ifdef YAX_ENABLE
|
||||
if (g_nodraw)
|
||||
{
|
||||
if (yax_drawcf != -1)
|
||||
yax_holecf[yax_drawcf][yax_holencf[yax_drawcf]++] = { dx0, dx1, vsp[i].cy[0], vsp[i].cy[1], n0.y, vsp[i].cy[1] };
|
||||
}
|
||||
else
|
||||
#endif
|
||||
polymost_drawpoly(dpxy, n, domostpolymethod, tilesiz[globalpicnum]);
|
||||
|
||||
vsp[i].cy[0] = n0.y;
|
||||
|
@ -901,14 +823,6 @@ skip: ;
|
|||
|
||||
int n = 3;
|
||||
polymost_clipmost(dpxy, n, x0, x1, y0top, y0bot, y1top, y1bot);
|
||||
#ifdef YAX_ENABLE
|
||||
if (g_nodraw)
|
||||
{
|
||||
if (yax_drawcf != -1)
|
||||
yax_holecf[yax_drawcf][yax_holencf[yax_drawcf]++] = { dx0, dx1, vsp[i].cy[0], vsp[i].cy[1], vsp[i].cy[0], n1.y };
|
||||
}
|
||||
else
|
||||
#endif
|
||||
polymost_drawpoly(dpxy, n, domostpolymethod, tilesiz[globalpicnum]);
|
||||
|
||||
vsp[i].cy[1] = n1.y;
|
||||
|
@ -923,14 +837,6 @@ skip: ;
|
|||
|
||||
int n = 4;
|
||||
polymost_clipmost(dpxy, n, x0, x1, y0top, y0bot, y1top, y1bot);
|
||||
#ifdef YAX_ENABLE
|
||||
if (g_nodraw)
|
||||
{
|
||||
if (yax_drawcf != -1)
|
||||
yax_holecf[yax_drawcf][yax_holencf[yax_drawcf]++] = { dx0, dx1, vsp[i].cy[0], vsp[i].cy[1], vsp[i].fy[0], vsp[i].fy[1] };
|
||||
}
|
||||
else
|
||||
#endif
|
||||
polymost_drawpoly(dpxy, n, domostpolymethod, tilesiz[globalpicnum]);
|
||||
|
||||
vsp[i].ctag = vsp[i].ftag = -1;
|
||||
|
@ -952,14 +858,6 @@ skip: ;
|
|||
|
||||
int n = 4;
|
||||
polymost_clipmost(dpxy, n, x0, x1, y0top, y0bot, y1top, y1bot);
|
||||
#ifdef YAX_ENABLE
|
||||
if (g_nodraw)
|
||||
{
|
||||
if (yax_drawcf != -1)
|
||||
yax_holecf[yax_drawcf][yax_holencf[yax_drawcf]++] = { dx0, dx1, n0.y, n1.y, vsp[i].fy[0], vsp[i].fy[1] };
|
||||
}
|
||||
else
|
||||
#endif
|
||||
polymost_drawpoly(dpxy, n, domostpolymethod, tilesiz[globalpicnum]);
|
||||
|
||||
vsp[i].fy[0] = n0.y;
|
||||
|
@ -974,14 +872,6 @@ skip: ;
|
|||
|
||||
int n = 3;
|
||||
polymost_clipmost(dpxy, n, x0, x1, y0top, y0bot, y1top, y1bot);
|
||||
#ifdef YAX_ENABLE
|
||||
if (g_nodraw)
|
||||
{
|
||||
if (yax_drawcf != -1)
|
||||
yax_holecf[yax_drawcf][yax_holencf[yax_drawcf]++] = { dx0, dx1, n0.y, vsp[i].fy[1], vsp[i].fy[0], vsp[i].fy[1] };
|
||||
}
|
||||
else
|
||||
#endif
|
||||
polymost_drawpoly(dpxy, n, domostpolymethod, tilesiz[globalpicnum]);
|
||||
|
||||
vsp[i].fy[0] = n0.y;
|
||||
|
@ -995,14 +885,6 @@ skip: ;
|
|||
|
||||
int n = 3;
|
||||
polymost_clipmost(dpxy, n, x0, x1, y0top, y0bot, y1top, y1bot);
|
||||
#ifdef YAX_ENABLE
|
||||
if (g_nodraw)
|
||||
{
|
||||
if (yax_drawcf != -1)
|
||||
yax_holecf[yax_drawcf][yax_holencf[yax_drawcf]++] = { dx0, dx1, vsp[i].fy[0], n1.y, vsp[i].fy[0], vsp[i].fy[1] };
|
||||
}
|
||||
else
|
||||
#endif
|
||||
polymost_drawpoly(dpxy, n, domostpolymethod, tilesiz[globalpicnum]);
|
||||
|
||||
vsp[i].fy[1] = n1.y;
|
||||
|
@ -1015,14 +897,6 @@ skip: ;
|
|||
|
||||
int n = 4;
|
||||
polymost_clipmost(dpxy, n, x0, x1, y0top, y0bot, y1top, y1bot);
|
||||
#ifdef YAX_ENABLE
|
||||
if (g_nodraw)
|
||||
{
|
||||
if (yax_drawcf != -1)
|
||||
yax_holecf[yax_drawcf][yax_holencf[yax_drawcf]++] = { dx0, dx1, vsp[i].cy[0], vsp[i].cy[1], vsp[i].fy[0], vsp[i].fy[1] };
|
||||
}
|
||||
else
|
||||
#endif
|
||||
polymost_drawpoly(dpxy, n, domostpolymethod, tilesiz[globalpicnum]);
|
||||
|
||||
vsp[i].ctag = vsp[i].ftag = -1;
|
||||
|
@ -1076,381 +950,6 @@ skip: ;
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
static void yax_polymost_domost(const int yaxbunch, float x0, float y0, float x1, float y1)
|
||||
{
|
||||
int const dir = (x0 < x1);
|
||||
|
||||
if (dir) //clip dmost (floor)
|
||||
{
|
||||
y0 -= DOMOST_OFFSET;
|
||||
y1 -= DOMOST_OFFSET;
|
||||
}
|
||||
else //clip umost (ceiling)
|
||||
{
|
||||
if (x0 == x1) return;
|
||||
swapfloat(&x0, &x1);
|
||||
swapfloat(&y0, &y1);
|
||||
y0 += DOMOST_OFFSET;
|
||||
y1 += DOMOST_OFFSET; //necessary?
|
||||
}
|
||||
|
||||
// Test if span is outside screen bounds
|
||||
if (x1 < xbl || x0 > xbr)
|
||||
{
|
||||
domost_rejectcount++;
|
||||
return;
|
||||
}
|
||||
|
||||
vec2f_t dm0 = { x0, y0 };
|
||||
vec2f_t dm1 = { x1, y1 };
|
||||
|
||||
float const slop = (dm1.y - dm0.y) / (dm1.x - dm0.x);
|
||||
|
||||
if (dm0.x < xbl)
|
||||
{
|
||||
dm0.y += slop*(xbl-dm0.x);
|
||||
dm0.x = xbl;
|
||||
}
|
||||
|
||||
if (dm1.x > xbr)
|
||||
{
|
||||
dm1.y += slop*(xbr-dm1.x);
|
||||
dm1.x = xbr;
|
||||
}
|
||||
|
||||
vec2f_t n0, n1;
|
||||
float spx[4];
|
||||
int32_t spt[4];
|
||||
|
||||
for (bssize_t newi, i=yax_vsp[yaxbunch][0].n; i; i=newi)
|
||||
{
|
||||
newi = yax_vsp[yaxbunch][i].n; n0.x = yax_vsp[yaxbunch][i].x; n1.x = yax_vsp[yaxbunch][newi].x;
|
||||
|
||||
if ((dm0.x >= n1.x) || (n0.x >= dm1.x) || (yax_vsp[yaxbunch][i].ctag <= 0)) continue;
|
||||
|
||||
double const dx = double(n1.x)-double(n0.x);
|
||||
double const cy = yax_vsp[yaxbunch][i].cy[0],
|
||||
cv = yax_vsp[yaxbunch][i].cy[1]-cy;
|
||||
|
||||
int scnt = 0;
|
||||
|
||||
//Test if left edge requires split (dm0.x,dm0.y) (nx0,cy(0)),<dx,cv(0)>
|
||||
if ((dm0.x > n0.x) && (dm0.x < n1.x))
|
||||
{
|
||||
double const t = (dm0.x-n0.x)*cv - (dm0.y-cy)*dx;
|
||||
if (((!dir) && (t <= 0.0)) || ((dir) && (t >= 0.0)))
|
||||
{ spx[scnt] = dm0.x; spt[scnt] = -1; scnt++; }
|
||||
}
|
||||
|
||||
//Test for intersection on umost (0) and dmost (1)
|
||||
|
||||
double const d = ((double(dm0.y) - double(dm1.y)) * dx) - ((double(dm0.x) - double(dm1.x)) * cv);
|
||||
|
||||
double const n = ((double(dm0.y) - cy) * dx) - ((double(dm0.x) - double(n0.x)) * cv);
|
||||
|
||||
double const fnx = double(dm0.x) + ((n / d) * (double(dm1.x) - double(dm0.x)));
|
||||
|
||||
if ((fabs(d) > fabs(n)) && (d * n >= 0.0) && (fnx > n0.x) && (fnx < n1.x))
|
||||
spx[scnt] = fnx, spt[scnt++] = 0;
|
||||
|
||||
//Nice hack to avoid full sort later :)
|
||||
if ((scnt >= 2) && (spx[scnt-1] < spx[scnt-2]))
|
||||
{
|
||||
swapfloat(&spx[scnt-1], &spx[scnt-2]);
|
||||
swaplong(&spt[scnt-1], &spt[scnt-2]);
|
||||
}
|
||||
|
||||
//Test if right edge requires split
|
||||
if ((dm1.x > n0.x) && (dm1.x < n1.x))
|
||||
{
|
||||
double const t = (double(dm1.x)- double(n0.x))*cv - (double(dm1.y)- double(cy))*dx;
|
||||
if (((!dir) && (t <= 0.0)) || ((dir) && (t >= 0.0)))
|
||||
{ spx[scnt] = dm1.x; spt[scnt] = -1; scnt++; }
|
||||
}
|
||||
|
||||
yax_vsp[yaxbunch][i].tag = yax_vsp[yaxbunch][newi].tag = -1;
|
||||
|
||||
float const rdx = 1.f/dx;
|
||||
|
||||
for (bssize_t z=0, vcnt=0; z<=scnt; z++,i=vcnt)
|
||||
{
|
||||
float t;
|
||||
|
||||
if (z == scnt)
|
||||
goto skip;
|
||||
|
||||
t = (spx[z]-n0.x)*rdx;
|
||||
vcnt = yax_vsinsaft(yaxbunch, i);
|
||||
yax_vsp[yaxbunch][i].cy[1] = t*cv + cy;
|
||||
yax_vsp[yaxbunch][vcnt].x = spx[z];
|
||||
yax_vsp[yaxbunch][vcnt].cy[0] = yax_vsp[yaxbunch][i].cy[1];
|
||||
yax_vsp[yaxbunch][vcnt].tag = spt[z];
|
||||
|
||||
skip: ;
|
||||
int32_t const ni = yax_vsp[yaxbunch][i].n; if (!ni) continue; //this 'if' fixes many bugs!
|
||||
float const dx0 = yax_vsp[yaxbunch][i].x; if (dm0.x > dx0) continue;
|
||||
float const dx1 = yax_vsp[yaxbunch][ni].x; if (dm1.x < dx1) continue;
|
||||
n0.y = (dx0-dm0.x)*slop + dm0.y;
|
||||
n1.y = (dx1-dm0.x)*slop + dm0.y;
|
||||
|
||||
// dx0 dx1
|
||||
// ~ ~
|
||||
//----------------------------
|
||||
// t0+=0 t1+=0
|
||||
// vsp[i].cy[0] vsp[i].cy[1]
|
||||
//============================
|
||||
// t0+=1 t1+=3
|
||||
//============================
|
||||
// vsp[i].fy[0] vsp[i].fy[1]
|
||||
// t0+=2 t1+=6
|
||||
//
|
||||
// ny0 ? ny1 ?
|
||||
|
||||
int k = 4;
|
||||
|
||||
if (!dir)
|
||||
{
|
||||
if ((yax_vsp[yaxbunch][i].tag == 0) || (n0.y <= yax_vsp[yaxbunch][i].cy[0]+DOMOST_OFFSET)) k--;
|
||||
if ((yax_vsp[yaxbunch][ni].tag == 0) || (n1.y <= yax_vsp[yaxbunch][i].cy[1]+DOMOST_OFFSET)) k -= 3;
|
||||
switch (k)
|
||||
{
|
||||
case 4:
|
||||
{
|
||||
yax_vsp[yaxbunch][i].cy[0] = n0.y;
|
||||
yax_vsp[yaxbunch][i].cy[1] = n1.y;
|
||||
yax_vsp[yaxbunch][i].ctag = gtag;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
{
|
||||
yax_vsp[yaxbunch][i].cy[0] = n0.y;
|
||||
yax_vsp[yaxbunch][i].ctag = gtag;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
yax_vsp[yaxbunch][i].cy[1] = n1.y;
|
||||
yax_vsp[yaxbunch][i].ctag = gtag;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((yax_vsp[yaxbunch][i].tag == 0) || (n0.y >= yax_vsp[yaxbunch][i].cy[0]-DOMOST_OFFSET)) k++;
|
||||
if ((yax_vsp[yaxbunch][ni].tag == 0) || (n1.y >= yax_vsp[yaxbunch][i].cy[1]-DOMOST_OFFSET)) k += 3;
|
||||
switch (k)
|
||||
{
|
||||
case 4:
|
||||
{
|
||||
yax_vsp[yaxbunch][i].cy[0] = n0.y;
|
||||
yax_vsp[yaxbunch][i].cy[1] = n1.y;
|
||||
yax_vsp[yaxbunch][i].ctag = gtag;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
case 6:
|
||||
{
|
||||
yax_vsp[yaxbunch][i].cy[0] = n0.y;
|
||||
yax_vsp[yaxbunch][i].ctag = gtag;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
yax_vsp[yaxbunch][i].cy[1] = n1.y;
|
||||
yax_vsp[yaxbunch][i].ctag = gtag;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gtag++;
|
||||
|
||||
//Combine neighboring vertical strips with matching collinear top&bottom edges
|
||||
//This prevents x-splits from propagating through the entire scan
|
||||
#ifdef COMBINE_STRIPS
|
||||
int i = yax_vsp[yaxbunch][0].n;
|
||||
|
||||
do
|
||||
{
|
||||
int const ni = yax_vsp[yaxbunch][i].n;
|
||||
|
||||
if (yax_vsp[yaxbunch][i].ctag == yax_vsp[yaxbunch][ni].ctag)
|
||||
{
|
||||
yax_vsp[yaxbunch][i].cy[1] = yax_vsp[yaxbunch][ni].cy[1];
|
||||
yax_vsdel(yaxbunch, ni);
|
||||
}
|
||||
else i = ni;
|
||||
}
|
||||
while (i);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int32_t should_clip_cfwall(float x0, float y0, float x1, float y1)
|
||||
{
|
||||
int const dir = (x0 < x1);
|
||||
|
||||
if (dir && yax_globallev >= YAX_MAXDRAWS)
|
||||
return 1;
|
||||
|
||||
if (!dir && yax_globallev <= YAX_MAXDRAWS)
|
||||
return 1;
|
||||
|
||||
if (dir) //clip dmost (floor)
|
||||
{
|
||||
y0 -= DOMOST_OFFSET;
|
||||
y1 -= DOMOST_OFFSET;
|
||||
}
|
||||
else //clip umost (ceiling)
|
||||
{
|
||||
if (x0 == x1) return 1;
|
||||
swapfloat(&x0, &x1);
|
||||
swapfloat(&y0, &y1);
|
||||
y0 += DOMOST_OFFSET;
|
||||
y1 += DOMOST_OFFSET; //necessary?
|
||||
}
|
||||
|
||||
x0 -= DOMOST_OFFSET;
|
||||
x1 += DOMOST_OFFSET;
|
||||
|
||||
// Test if span is outside screen bounds
|
||||
if (x1 < xbl || x0 > xbr)
|
||||
return 1;
|
||||
|
||||
vec2f_t dm0 = { x0, y0 };
|
||||
vec2f_t dm1 = { x1, y1 };
|
||||
|
||||
float const slop = (dm1.y - dm0.y) / (dm1.x - dm0.x);
|
||||
|
||||
if (dm0.x < xbl)
|
||||
{
|
||||
dm0.y += slop*(xbl-dm0.x);
|
||||
dm0.x = xbl;
|
||||
}
|
||||
|
||||
if (dm1.x > xbr)
|
||||
{
|
||||
dm1.y += slop*(xbr-dm1.x);
|
||||
dm1.x = xbr;
|
||||
}
|
||||
|
||||
vec2f_t n0, n1;
|
||||
float spx[6], spcy[6], spfy[6];
|
||||
int32_t spt[6];
|
||||
|
||||
for (bssize_t newi, i=vsp[0].n; i; i=newi)
|
||||
{
|
||||
newi = vsp[i].n; n0.x = vsp[i].x; n1.x = vsp[newi].x;
|
||||
|
||||
if ((dm0.x >= n1.x) || (n0.x >= dm1.x) || (vsp[i].ctag <= 0)) continue;
|
||||
|
||||
float const dx = n1.x-n0.x;
|
||||
float const cy[2] = { vsp[i].cy[0], vsp[i].fy[0] },
|
||||
cv[2] = { vsp[i].cy[1]-cy[0], vsp[i].fy[1]-cy[1] };
|
||||
|
||||
int scnt = 0;
|
||||
|
||||
spx[scnt] = n0.x; spt[scnt] = -1; scnt++;
|
||||
|
||||
//Test if left edge requires split (dm0.x,dm0.y) (nx0,cy(0)),<dx,cv(0)>
|
||||
if ((dm0.x > n0.x) && (dm0.x < n1.x))
|
||||
{
|
||||
float const t = (dm0.x-n0.x)*cv[dir] - (dm0.y-cy[dir])*dx;
|
||||
if (((!dir) && (t < 0.f)) || ((dir) && (t > 0.f)))
|
||||
{ spx[scnt] = dm0.x; spt[scnt] = -1; scnt++; }
|
||||
}
|
||||
|
||||
//Test for intersection on umost (0) and dmost (1)
|
||||
|
||||
float const d[2] = { ((dm0.y - dm1.y) * dx) - ((dm0.x - dm1.x) * cv[0]),
|
||||
((dm0.y - dm1.y) * dx) - ((dm0.x - dm1.x) * cv[1]) };
|
||||
|
||||
float const n[2] = { ((dm0.y - cy[0]) * dx) - ((dm0.x - n0.x) * cv[0]),
|
||||
((dm0.y - cy[1]) * dx) - ((dm0.x - n0.x) * cv[1]) };
|
||||
|
||||
float const fnx[2] = { dm0.x + ((n[0] / d[0]) * (dm1.x - dm0.x)),
|
||||
dm0.x + ((n[1] / d[1]) * (dm1.x - dm0.x)) };
|
||||
|
||||
if ((Bfabsf(d[0]) > Bfabsf(n[0])) && (d[0] * n[0] >= 0.f) && (fnx[0] > n0.x) && (fnx[0] < n1.x))
|
||||
spx[scnt] = fnx[0], spt[scnt++] = 0;
|
||||
|
||||
if ((Bfabsf(d[1]) > Bfabsf(n[1])) && (d[1] * n[1] >= 0.f) && (fnx[1] > n0.x) && (fnx[1] < n1.x))
|
||||
spx[scnt] = fnx[1], spt[scnt++] = 1;
|
||||
|
||||
//Nice hack to avoid full sort later :)
|
||||
if ((scnt >= 2) && (spx[scnt-1] < spx[scnt-2]))
|
||||
{
|
||||
swapfloat(&spx[scnt-1], &spx[scnt-2]);
|
||||
swaplong(&spx[scnt-1], &spx[scnt-2]);
|
||||
}
|
||||
|
||||
//Test if right edge requires split
|
||||
if ((dm1.x > n0.x) && (dm1.x < n1.x))
|
||||
{
|
||||
float const t = (dm1.x-n0.x)*cv[dir] - (dm1.y-cy[dir])*dx;
|
||||
if (((!dir) && (t < 0.f)) || ((dir) && (t > 0.f)))
|
||||
{ spx[scnt] = dm1.x; spt[scnt] = -1; scnt++; }
|
||||
}
|
||||
|
||||
spx[scnt] = n1.x; spt[scnt] = -1; scnt++;
|
||||
|
||||
float const rdx = 1.f/dx;
|
||||
for (bssize_t z=0; z<scnt; z++)
|
||||
{
|
||||
float const t = (spx[z]-n0.x)*rdx;
|
||||
spcy[z] = t*cv[0]+cy[0];
|
||||
spfy[z] = t*cv[1]+cy[1];
|
||||
}
|
||||
|
||||
for (bssize_t z=0; z<scnt-1; z++)
|
||||
{
|
||||
float const dx0 = spx[z];
|
||||
float const dx1 = spx[z+1];
|
||||
n0.y = (dx0-dm0.x)*slop + dm0.y;
|
||||
n1.y = (dx1-dm0.x)*slop + dm0.y;
|
||||
|
||||
// dx0 dx1
|
||||
// ~ ~
|
||||
//----------------------------
|
||||
// t0+=0 t1+=0
|
||||
// vsp[i].cy[0] vsp[i].cy[1]
|
||||
//============================
|
||||
// t0+=1 t1+=3
|
||||
//============================
|
||||
// vsp[i].fy[0] vsp[i].fy[1]
|
||||
// t0+=2 t1+=6
|
||||
//
|
||||
// ny0 ? ny1 ?
|
||||
|
||||
int k = 4;
|
||||
if (dir)
|
||||
{
|
||||
if ((spt[z] == 0) || (n0.y <= spcy[z]+DOMOST_OFFSET)) k--;
|
||||
if ((spt[z+1] == 0) || (n1.y <= spcy[z+1]+DOMOST_OFFSET)) k -= 3;
|
||||
if (k != 0)
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((spt[z] == 1) || (n0.y >= spfy[z]-DOMOST_OFFSET)) k++;
|
||||
if ((spt[z+1] == 1) || (n1.y >= spfy[z+1]-DOMOST_OFFSET)) k += 3;
|
||||
if (k != 8)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// variables that are set to ceiling- or floor-members, depending
|
||||
// on which one is processed right now
|
||||
|
@ -2057,11 +1556,6 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
xtex2.u = ytex2.u = otex2.u = 0;
|
||||
xtex2.v = ytex2.v = otex2.v = 0;
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
yax_holencf[YAX_FLOOR] = 0;
|
||||
yax_drawcf = YAX_FLOOR;
|
||||
#endif
|
||||
|
||||
// Floor
|
||||
|
||||
globalpicnum = sec->floorpicnum;
|
||||
|
@ -2306,11 +1800,6 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
|
||||
// Ceiling
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
yax_holencf[YAX_CEILING] = 0;
|
||||
yax_drawcf = YAX_CEILING;
|
||||
#endif
|
||||
|
||||
globalpicnum = sec->ceilingpicnum;
|
||||
globalshade = sec->ceilingshade;
|
||||
globalpal = sec->ceilingpal;
|
||||
|
@ -2550,53 +2039,8 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
skyzbufferhack = 0;
|
||||
}
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
if (g_nodraw)
|
||||
{
|
||||
int32_t baselevp, checkcf, i, j;
|
||||
int16_t bn[2];
|
||||
baselevp = (yax_globallev == YAX_MAXDRAWS);
|
||||
|
||||
yax_getbunches(sectnum, &bn[0], &bn[1]);
|
||||
checkcf = (bn[0]>=0) + ((bn[1]>=0)<<1);
|
||||
if (!baselevp)
|
||||
checkcf &= (1<<yax_globalcf);
|
||||
|
||||
for (i=0; i<2; i++)
|
||||
if (checkcf&(1<<i))
|
||||
{
|
||||
if ((haveymost[bn[i]>>3]&pow2char[bn[i]&7])==0)
|
||||
{
|
||||
// init yax *most arrays for that bunch
|
||||
haveymost[bn[i]>>3] |= pow2char[bn[i]&7];
|
||||
yax_vsp[bn[i]*2][1].x = xbl;
|
||||
yax_vsp[bn[i]*2][2].x = xbr;
|
||||
yax_vsp[bn[i]*2][1].cy[0] = xbb;
|
||||
yax_vsp[bn[i]*2][2].cy[0] = xbb;
|
||||
yax_vsp_finalize_init(bn[i]*2, 3);
|
||||
yax_vsp[bn[i]*2+1][1].x = xbl;
|
||||
yax_vsp[bn[i]*2+1][2].x = xbr;
|
||||
yax_vsp[bn[i]*2+1][1].cy[0] = xbt;
|
||||
yax_vsp[bn[i]*2+1][2].cy[0] = xbt;
|
||||
yax_vsp_finalize_init(bn[i]*2+1, 3);
|
||||
}
|
||||
|
||||
for (j = 0; j < yax_holencf[i]; j++)
|
||||
{
|
||||
yax_hole_t *hole = &yax_holecf[i][j];
|
||||
yax_polymost_domost(bn[i]*2, hole->x0, hole->cy[0], hole->x1, hole->cy[1]);
|
||||
yax_polymost_domost(bn[i]*2+1, hole->x1, hole->fy[1], hole->x0, hole->fy[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Wall
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
yax_drawcf = -1;
|
||||
#endif
|
||||
|
||||
xtex.d = (ryp0-ryp1)*gxyaspect / (x0-x1);
|
||||
ytex.d = 0;
|
||||
otex.d = ryp0*gxyaspect - xtex.d*x0;
|
||||
|
@ -2612,9 +2056,6 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
Bassert(domostpolymethod == DAMETH_NOMASK);
|
||||
domostpolymethod = DAMETH_WALL;
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
if (yax_nomaskpass==0 || !yax_isislandwall(wallnum, !yax_globalcf) || (yax_nomaskdidit=1, 0))
|
||||
#endif
|
||||
if (nextsectnum >= 0)
|
||||
{
|
||||
fgetzsofslope((usectorptr_t)§or[nextsectnum],n0.x,n0.y,&cz,&fz);
|
||||
|
@ -2648,9 +2089,6 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
if (wal->cstat&256) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //yflip
|
||||
|
||||
pow2xsplit = 1;
|
||||
#ifdef YAX_ENABLE
|
||||
if (should_clip_cfwall(x1,cy1,x0,cy0))
|
||||
#endif
|
||||
polymost_domost(x1,ocy1,x0,ocy0,cy1,ocy1,cy0,ocy0);
|
||||
if (wal->cstat&8) { xtex.u = ogux; ytex.u = oguy; otex.u = oguo; }
|
||||
}
|
||||
|
@ -2686,9 +2124,6 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
if (nwal->cstat&256) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //yflip
|
||||
|
||||
pow2xsplit = 1;
|
||||
#ifdef YAX_ENABLE
|
||||
if (should_clip_cfwall(x0,fy0,x1,fy1))
|
||||
#endif
|
||||
polymost_domost(x0,ofy0,x1,ofy1,ofy0,fy0,ofy1,fy1);
|
||||
if (wal->cstat&(2+8)) { otex.u = oguo; xtex.u = ogux; ytex.u = oguy; }
|
||||
}
|
||||
|
@ -2735,13 +2170,6 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
|
||||
pow2xsplit = 1;
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
// TODO: slopes?
|
||||
|
||||
if (globalposz > sec->floorz && yax_isislandwall(wallnum, YAX_FLOOR))
|
||||
polymost_domost(x1, fy1, x0, fy0, cy1, fy1, cy0, fy0);
|
||||
else
|
||||
#endif
|
||||
polymost_domost(x0, cy0, x1, cy1, cy0, fy0, cy1, fy1);
|
||||
} while (0);
|
||||
}
|
||||
|
@ -2792,9 +2220,6 @@ void polymost_scansector(int32_t sectnum)
|
|||
{
|
||||
sectnum = sectorborder[--sectorbordercnt];
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
if (scansector_collectsprites)
|
||||
#endif
|
||||
for (bssize_t z=headspritesect[sectnum]; z>=0; z=nextspritesect[z])
|
||||
{
|
||||
auto const spr = (uspriteptr_t)&sprite[z];
|
||||
|
@ -2840,9 +2265,6 @@ void polymost_scansector(int32_t sectnum)
|
|||
int const nextsectnum = wal->nextsector; //Scan close sectors
|
||||
|
||||
if (nextsectnum >= 0 && !(wal->cstat&32) && sectorbordercnt < ARRAY_SSIZE(sectorborder))
|
||||
#ifdef YAX_ENABLE
|
||||
if (yax_nomaskpass==0 || !yax_isislandwall(z, !yax_globalcf) || (yax_nomaskdidit=1, 0))
|
||||
#endif
|
||||
if ((gotsector[nextsectnum>>3]&pow2char[nextsectnum&7]) == 0)
|
||||
{
|
||||
double const d = fp1.x*fp2.y - fp2.x*fp1.y;
|
||||
|
@ -2912,10 +2334,6 @@ void polymost_scansector(int32_t sectnum)
|
|||
{
|
||||
bunchfirst[numbunches++] = bunchp2[z];
|
||||
bunchp2[z] = -1;
|
||||
#ifdef YAX_ENABLE
|
||||
if (scansector_retfast)
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3029,12 +2447,7 @@ void polymost_drawrooms()
|
|||
|
||||
polymost_outputGLDebugMessage(3, "polymost_drawrooms()");
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
//if (yax_polymostclearzbuffer)
|
||||
#endif
|
||||
{
|
||||
GLInterface.ClearDepth();
|
||||
}
|
||||
GLInterface.ClearDepth();
|
||||
GLInterface.EnableBlend(false);
|
||||
GLInterface.EnableAlphaTest(false);
|
||||
GLInterface.EnableDepthTest(true);
|
||||
|
@ -3158,59 +2571,6 @@ void polymost_drawrooms()
|
|||
|
||||
polymost_initmosts(sx, sy, n);
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
if (yax_globallev != YAX_MAXDRAWS)
|
||||
{
|
||||
int i, newi;
|
||||
int32_t nodrawbak = g_nodraw;
|
||||
g_nodraw = 1;
|
||||
for (i = yax_vsp[yax_globalbunch*2][0].n; i; i=newi)
|
||||
{
|
||||
newi = yax_vsp[yax_globalbunch*2][i].n;
|
||||
if (!newi)
|
||||
break;
|
||||
polymost_domost(yax_vsp[yax_globalbunch*2][newi].x, yax_vsp[yax_globalbunch*2][i].cy[1]-DOMOST_OFFSET, yax_vsp[yax_globalbunch*2][i].x, yax_vsp[yax_globalbunch*2][i].cy[0]-DOMOST_OFFSET);
|
||||
}
|
||||
for (i = yax_vsp[yax_globalbunch*2+1][0].n; i; i=newi)
|
||||
{
|
||||
newi = yax_vsp[yax_globalbunch*2+1][i].n;
|
||||
if (!newi)
|
||||
break;
|
||||
polymost_domost(yax_vsp[yax_globalbunch*2+1][i].x, yax_vsp[yax_globalbunch*2+1][i].cy[0]+DOMOST_OFFSET, yax_vsp[yax_globalbunch*2+1][newi].x, yax_vsp[yax_globalbunch*2+1][i].cy[1]+DOMOST_OFFSET);
|
||||
}
|
||||
g_nodraw = nodrawbak;
|
||||
|
||||
#ifdef COMBINE_STRIPS
|
||||
i = vsp[0].n;
|
||||
|
||||
do
|
||||
{
|
||||
int const ni = vsp[i].n;
|
||||
|
||||
//POGO: specially treat the viewport nodes so that we will never end up in a situation where we accidentally access the sentinel node
|
||||
if (ni >= viewportNodeCount)
|
||||
{
|
||||
if (Bfabsf(vsp[i].cy[1]-vsp[ni].cy[0]) < 0.1f && Bfabsf(vsp[i].fy[1]-vsp[ni].fy[0]) < 0.1f)
|
||||
{
|
||||
float const dx = 1.f/(vsp[ni].x-vsp[i].x);
|
||||
float const dx2 = 1.f/(vsp[vsp[ni].n].x-vsp[i].x);
|
||||
float const cslop[2] = { vsp[i].cy[1]-vsp[i].cy[0], vsp[ni].cy[1]-vsp[i].cy[0] };
|
||||
float const fslop[2] = { vsp[i].fy[1]-vsp[i].fy[0], vsp[ni].fy[1]-vsp[i].fy[0] };
|
||||
|
||||
if (Bfabsf(cslop[0]*dx-cslop[1]*dx2) < 0.001f && Bfabsf(fslop[0]*dx-fslop[1]*dx2) < 0.001f)
|
||||
{
|
||||
vsmerge(i, ni);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = ni;
|
||||
}
|
||||
while (i);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
numscans = numbunches = 0;
|
||||
|
||||
// MASKWALL_BAD_ACCESS
|
||||
|
|
|
@ -490,11 +490,6 @@ void SaveEngineState()
|
|||
fw->Write(&show2dsector, sizeof(show2dsector));
|
||||
WriteMagic(fw);
|
||||
|
||||
fw->Write(&numyaxbunches, sizeof(numyaxbunches));
|
||||
fw->Write(yax_bunchnum, sizeof(yax_bunchnum));
|
||||
fw->Write(yax_nextwall, sizeof(yax_nextwall));
|
||||
WriteMagic(fw);
|
||||
|
||||
fw->Write(&Numsprites, sizeof(Numsprites));
|
||||
sv_prespriteextsave();
|
||||
fw->Write(spriteext, sizeof(spriteext_t) * MAXSPRITES);
|
||||
|
@ -558,12 +553,6 @@ void LoadEngineState()
|
|||
fr.Read(&show2dsector, sizeof(show2dsector));
|
||||
CheckMagic(fr);
|
||||
|
||||
fr.Read(&numyaxbunches, sizeof(numyaxbunches));
|
||||
fr.Read(yax_bunchnum, sizeof(yax_bunchnum));
|
||||
fr.Read(yax_nextwall, sizeof(yax_nextwall));
|
||||
yax_update(numyaxbunches > 0 ? 2 : 1);
|
||||
CheckMagic(fr);
|
||||
|
||||
fr.Read(&Numsprites, sizeof(Numsprites));
|
||||
fr.Read(spriteext, sizeof(spriteext_t) * MAXSPRITES);
|
||||
fr.Read(wallext, sizeof(wallext_t) * MAXWALLS);
|
||||
|
|
|
@ -153,10 +153,6 @@ uint8_t LoadLevel(int nMap)
|
|||
inity = startPos.y;
|
||||
initz = startPos.z;
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
yax_update(1);
|
||||
#endif
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < kMaxPlayers; i++)
|
||||
|
|
Loading…
Reference in a new issue