mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-30 21:31:03 +00:00
- removed some unused code from engine.cpp.
Looks like editor utilities.
This commit is contained in:
parent
9e81fa89a8
commit
19a26f7959
1 changed files with 0 additions and 147 deletions
|
@ -163,153 +163,6 @@ static void getclosestpointonwall_internal(vec2_t const p, int32_t const dawall,
|
||||||
*closest = { (int32_t)(w.x + ((d.x * i) >> 30)), (int32_t)(w.y + ((d.y * i) >> 30)) };
|
*closest = { (int32_t)(w.x + ((d.x * i) >> 30)), (int32_t)(w.y + ((d.y * i) >> 30)) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// setslope
|
|
||||||
//
|
|
||||||
void setslope(int32_t sectnum, int32_t cf, int16_t slope)
|
|
||||||
{
|
|
||||||
if (slope==0)
|
|
||||||
{
|
|
||||||
SECTORFLD(sectnum,stat, cf) &= ~2;
|
|
||||||
SECTORFLD(sectnum,heinum, cf) = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SECTORFLD(sectnum,stat, cf) |= 2;
|
|
||||||
SECTORFLD(sectnum,heinum, cf) = slope;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define WALLS_ARE_CONSISTENT(k) ((wall[k].x == x2 && wall[k].y == y2) \
|
|
||||||
&& ((wall[wall[k].point2]).x == x1 && (wall[wall[k].point2]).y == y1))
|
|
||||||
|
|
||||||
static int32_t getscore(int32_t w1c, int32_t w1f, int32_t w2c, int32_t w2f)
|
|
||||||
{
|
|
||||||
if (w1c > w1f)
|
|
||||||
std::swap(w1c, w1f);
|
|
||||||
if (w2c > w2f)
|
|
||||||
std::swap(w2c, w2f);
|
|
||||||
|
|
||||||
// now: c <= f for each "wall-vline"
|
|
||||||
|
|
||||||
int32_t maxceil = max(w1c, w2c);
|
|
||||||
int32_t minflor = min(w1f, w2f);
|
|
||||||
|
|
||||||
return minflor-maxceil;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int16_t *chsecptr_onextwall = NULL;
|
|
||||||
|
|
||||||
int32_t checksectorpointer(int16_t i, int16_t sectnum)
|
|
||||||
{
|
|
||||||
int32_t startsec, endsec;
|
|
||||||
int32_t j, k, startwall, endwall, x1, y1, x2, y2, numnewwalls=0;
|
|
||||||
int32_t bestnextwall=-1, bestnextsec=-1, bestwallscore=INT32_MIN;
|
|
||||||
int32_t cz[4], fz[4], tmp[2], tmpscore=0;
|
|
||||||
|
|
||||||
x1 = wall[i].x;
|
|
||||||
y1 = wall[i].y;
|
|
||||||
x2 = (wall[wall[i].point2]).x;
|
|
||||||
y2 = (wall[wall[i].point2]).y;
|
|
||||||
|
|
||||||
k = wall[i].nextwall;
|
|
||||||
if (k >= 0) //Check for early exit
|
|
||||||
{
|
|
||||||
if (WALLS_ARE_CONSISTENT(k))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
wall[k].nextwall = wall[k].nextsector = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((unsigned)wall[i].nextsector < (unsigned)numsectors && wall[i].nextwall < 0)
|
|
||||||
{
|
|
||||||
// if we have a nextsector but no nextwall, take this as a hint
|
|
||||||
// to search only the walls of that sector
|
|
||||||
startsec = wall[i].nextsector;
|
|
||||||
endsec = startsec+1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
startsec = 0;
|
|
||||||
endsec = numsectors;
|
|
||||||
}
|
|
||||||
|
|
||||||
wall[i].nextsector = wall[i].nextwall = -1;
|
|
||||||
|
|
||||||
if (chsecptr_onextwall && (k=chsecptr_onextwall[i])>=0 && wall[k].nextwall<0)
|
|
||||||
{
|
|
||||||
// old next wall found
|
|
||||||
if (WALLS_ARE_CONSISTENT(k))
|
|
||||||
{
|
|
||||||
j = sectorofwall(k);
|
|
||||||
|
|
||||||
wall[i].nextsector = j;
|
|
||||||
wall[i].nextwall = k;
|
|
||||||
wall[k].nextsector = sectnum;
|
|
||||||
wall[k].nextwall = i;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (j=startsec; j<endsec; j++)
|
|
||||||
{
|
|
||||||
if (j == sectnum)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
startwall = sector[j].wallptr;
|
|
||||||
endwall = startwall + sector[j].wallnum;
|
|
||||||
for (k=startwall; k<endwall; k++)
|
|
||||||
{
|
|
||||||
if (!WALLS_ARE_CONSISTENT(k))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Don't create link if the other side is connected to another wall.
|
|
||||||
// The nextwall relation should be definitely one-to-one at all times!
|
|
||||||
if (wall[k].nextwall>=0 && wall[k].nextwall != i)
|
|
||||||
continue;
|
|
||||||
{
|
|
||||||
getzsofslope(sectnum, x1,y1, &cz[0],&fz[0]);
|
|
||||||
getzsofslope(sectnum, x2,y2, &cz[1],&fz[1]);
|
|
||||||
getzsofslope(j, x1,y1, &cz[2],&fz[2]);
|
|
||||||
getzsofslope(j, x2,y2, &cz[3],&fz[3]);
|
|
||||||
|
|
||||||
tmp[0] = getscore(cz[0],fz[0], cz[2],fz[2]);
|
|
||||||
tmp[1] = getscore(cz[1],fz[1], cz[3],fz[3]);
|
|
||||||
|
|
||||||
if ((tmp[0]^tmp[1]) >= 0)
|
|
||||||
tmpscore = tmp[0]+tmp[1];
|
|
||||||
else
|
|
||||||
tmpscore = max(tmp[0], tmp[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bestnextwall == -1 || tmpscore > bestwallscore)
|
|
||||||
{
|
|
||||||
bestwallscore = tmpscore;
|
|
||||||
bestnextwall = k;
|
|
||||||
bestnextsec = j;
|
|
||||||
}
|
|
||||||
|
|
||||||
numnewwalls++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// sectnum -2 means dry run
|
|
||||||
if (bestnextwall >= 0 && sectnum!=-2)
|
|
||||||
{
|
|
||||||
// Printf("w%d new nw=%d (score %d)\n", i, bestnextwall, bestwallscore)
|
|
||||||
wall[i].nextsector = bestnextsec;
|
|
||||||
wall[i].nextwall = bestnextwall;
|
|
||||||
wall[bestnextwall].nextsector = sectnum;
|
|
||||||
wall[bestnextwall].nextwall = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return numnewwalls;
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef WALLS_ARE_CONSISTENT
|
|
||||||
|
|
||||||
int32_t xb1[MAXWALLSB]; // Polymost uses this as a temp array
|
int32_t xb1[MAXWALLSB]; // Polymost uses this as a temp array
|
||||||
static int32_t xb2[MAXWALLSB];
|
static int32_t xb2[MAXWALLSB];
|
||||||
int32_t rx1[MAXWALLSB], ry1[MAXWALLSB];
|
int32_t rx1[MAXWALLSB], ry1[MAXWALLSB];
|
||||||
|
|
Loading…
Reference in a new issue