- deal with most of CSTAT_SECTOR_SKY and CSTAT_SECTOR_SLOPE

This commit is contained in:
Christoph Oelckers 2021-12-18 13:14:56 +01:00
parent 98f0886b3d
commit d0a06ae961
24 changed files with 69 additions and 69 deletions

View file

@ -228,11 +228,11 @@ static int cliptestsector(int const dasect, int const nextsect, int32_t const fl
int32_t daz = getflorzofslopeptr(&sector[dasect], pos.x, pos.y);
int32_t daz2 = getflorzofslopeptr(sec2, pos.x, pos.y);
if (daz2 < daz-(1<<8) && (sec2->floorstat&1) == 0)
if (daz2 < daz-(1<<8) && (sec2->floorstat & CSTAT_SECTOR_SKY) == 0)
if (posz >= daz2-(flordist-1)) return 1;
daz = getceilzofslopeptr(&sector[dasect], pos.x, pos.y);
daz2 = getceilzofslopeptr(sec2, pos.x, pos.y);
if (daz2 > daz+(1<<8) && (sec2->ceilingstat&1) == 0)
if (daz2 > daz+(1<<8) && (sec2->ceilingstat & CSTAT_SECTOR_SKY) == 0)
if (posz <= daz2+(ceildist-1)) return 1;
return 0;
@ -242,7 +242,7 @@ static int cliptestsector(int const dasect, int const nextsect, int32_t const fl
int32_t daz2 = sec2->floorz;
int32_t dacz2 = sec2->ceilingz;
if ((sec2->floorstat|sec2->ceilingstat) & 2)
if ((sec2->floorstat|sec2->ceilingstat) & CSTAT_SECTOR_SLOPE)
getcorrectzsofslope(nextsect, pos.x, pos.y, &dacz2, &daz2);
if (daz2 <= dacz2)
@ -253,7 +253,7 @@ static int cliptestsector(int const dasect, int const nextsect, int32_t const fl
int32_t daz = sec->floorz;
int32_t dacz = sec->ceilingz;
if ((sec->floorstat|sec->ceilingstat) & 2)
if ((sec->floorstat|sec->ceilingstat) & CSTAT_SECTOR_SLOPE)
getcorrectzsofslope(dasect, pos.x, pos.y, &dacz, &daz);
int32_t const sec2height = abs(daz2-dacz2);
@ -261,11 +261,11 @@ static int cliptestsector(int const dasect, int const nextsect, int32_t const fl
return ((abs(daz-dacz) > sec2height && // clip if the current sector is taller and the next is too small
sec2height < (ceildist+(CLIPCURBHEIGHT<<1))) ||
((sec2->floorstat&1) == 0 && // parallaxed floor curbs don't clip
((sec2->floorstat & CSTAT_SECTOR_SKY) == 0 && // parallaxed floor curbs don't clip
posz >= daz2-(flordist-1) && // also account for desired z distance tolerance
daz2 < daz-CLIPCURBHEIGHT) || // curbs less tall than 256 z units don't clip
((sec2->ceilingstat&1) == 0 &&
((sec2->ceilingstat & CSTAT_SECTOR_SKY) == 0 &&
posz <= dacz2+(ceildist-1) &&
dacz2 > dacz+CLIPCURBHEIGHT)); // ceilings check the same conditions ^^^^^
}
@ -1007,8 +1007,8 @@ void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBas
if (wal.cstat&dawalclipmask) continue; // XXX?
if (((nextsect->ceilingstat&1) == 0) && (pos.z <= nextsect->ceilingz+(3<<8))) continue;
if (((nextsect->floorstat&1) == 0) && (pos.z >= nextsect->floorz-(3<<8))) continue;
if (((nextsect->ceilingstat & CSTAT_SECTOR_SKY) == 0) && (pos.z <= nextsect->ceilingz+(3<<8))) continue;
if (((nextsect->floorstat & CSTAT_SECTOR_SKY) == 0) && (pos.z >= nextsect->floorz-(3<<8))) continue;
int nextsectno = ::sectnum(nextsect);
if (!clipsectormap[nextsectno])

View file

@ -1586,7 +1586,7 @@ static void polymost_drawalls(int32_t const bunch)
if (globalposz <= fz)
polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, fy0, fy1, sectnum, true);
}
else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1)))
else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat & CSTAT_SECTOR_SKY)))
{
skyzbufferhack = 1;
@ -1639,7 +1639,7 @@ static void polymost_drawalls(int32_t const bunch)
if (globalposz >= cz)
polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, cy0, cy1, sectnum, false);
}
else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1)))
else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat & CSTAT_SECTOR_SKY)))
{
skyzbufferhack = 1;
@ -1685,7 +1685,7 @@ static void polymost_drawalls(int32_t const bunch)
if ((wal->cstat&48) == 16) maskwall[maskwallcnt++] = z;
if (((cy0 < ocy0) || (cy1 < ocy1)) && (!((sec->ceilingstat&sector[nextsectnum].ceilingstat)&1)))
if (((cy0 < ocy0) || (cy1 < ocy1)) && (!((sec->ceilingstat&sector[nextsectnum].ceilingstat) & CSTAT_SECTOR_SKY)))
{
globalpicnum = wal->picnum; globalshade = wal->shade; globalfloorpal = globalpal = (int32_t)((uint8_t)wal->pal);
GLInterface.SetVisibility(sectorVisibility(sec));
@ -1710,7 +1710,7 @@ static void polymost_drawalls(int32_t const bunch)
polymost_domost(x1,ocy1,x0,ocy0,cy1,ocy1,cy0,ocy0);
if (wal->cstat&8) { xtex.u = ogux; ytex.u = oguy; otex.u = oguo; }
}
if (((ofy0 < fy0) || (ofy1 < fy1)) && (!((sec->floorstat&sector[nextsectnum].floorstat)&1)))
if (((ofy0 < fy0) || (ofy1 < fy1)) && (!((sec->floorstat&sector[nextsectnum].floorstat) & CSTAT_SECTOR_SKY)))
{
uwallptr_t nwal;
@ -2820,14 +2820,14 @@ void polymost_drawsprite(int32_t snum)
}
// Clip sprites to ceilings/floors when no parallaxing and not sloped
if (!(tspr->sector()->ceilingstat & 3))
if (!(tspr->sector()->ceilingstat & (CSTAT_SECTOR_SKY|CSTAT_SECTOR_SLOPE)))
{
s0.Y = ((float) (tspr->sector()->ceilingz - globalposz)) * gyxscale * ryp0 + ghoriz;
if (pxy[0].Y < s0.Y)
pxy[0].Y = pxy[1].Y = s0.Y;
}
if (!(tspr->sector()->floorstat & 3))
if (!(tspr->sector()->floorstat & (CSTAT_SECTOR_SKY | CSTAT_SECTOR_SLOPE)))
{
s0.Y = ((float) (tspr->sector()->floorz - globalposz)) * gyxscale * ryp0 + ghoriz;
if (pxy[2].Y > s0.Y)
@ -2972,7 +2972,7 @@ void polymost_drawsprite(int32_t snum)
}
// Clip sprites to ceilings/floors when no parallaxing
if (!(tspr->sector()->ceilingstat & 1))
if (!(tspr->sector()->ceilingstat & CSTAT_SECTOR_SKY))
{
if (tspr->sector()->ceilingz > pos.z - (float)((tspr->yrepeat * tsiz.y) << 2))
{
@ -2980,7 +2980,7 @@ void polymost_drawsprite(int32_t snum)
sc1 = (float)(tspr->sector()->ceilingz - globalposz) * ryp1 + ghoriz;
}
}
if (!(tspr->sector()->floorstat & 1))
if (!(tspr->sector()->floorstat & CSTAT_SECTOR_SKY))
{
if (tspr->sector()->floorz < pos.z)
{

View file

@ -366,7 +366,7 @@ static void ReadSpriteV5(FileReader& fr, spritetype& spr, int& secno)
spr.extra = fr.ReadInt16();
auto sec = spr.sector();
if ((sec->ceilingstat & 1) > 0)
if ((sec->ceilingstat & CSTAT_SECTOR_SKY) > 0)
spr.pal = sec->ceilingpal;
else
spr.pal = sec->floorpal;

View file

@ -6870,7 +6870,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
{
case 1:
{
if (pSector->ceilingstat & 1)
if (pSector->ceilingstat & CSTAT_SECTOR_SKY)
nSurf = kSurfNone;
else
nSurf = surfType[pSector->ceilingpicnum];
@ -6878,7 +6878,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
}
case 2:
{
if (pSector->floorstat & 1)
if (pSector->floorstat & CSTAT_SECTOR_SKY)
nSurf = kSurfNone;
else
nSurf = surfType[pSector->floorpicnum];

View file

@ -684,7 +684,7 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in
XSECTOR const* pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
int nShade = pTSprite->shade;
if ((pSector->ceilingstat&1) && (pSector->floorstat&32768) == 0)
if ((pSector->ceilingstat & CSTAT_SECTOR_SKY) && (pSector->floorstat&32768) == 0)
{
nShade += tileShade[pSector->ceilingpicnum]+pSector->ceilingshade;
}
@ -812,12 +812,12 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in
sectortype *pSector = pTSprite->sector();
int zDiff = (pTSprite->z - pSector->ceilingz) >> 8;
if ((pSector->ceilingstat&1) == 0 && zDiff < 64) {
if ((pSector->ceilingstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) {
viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectCeilGlow);
}
zDiff = (pSector->floorz - pTSprite->z) >> 8;
if ((pSector->floorstat&1) == 0 && zDiff < 64) {
if ((pSector->floorstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) {
viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectFloorGlow);
}
break;

View file

@ -233,7 +233,7 @@ void CFX::fxProcess(void)
{
int32_t floorZ, ceilZ;
getzsofslopeptr(pSector, pSprite->x, pSprite->y, &ceilZ, &floorZ);
if (ceilZ > pSprite->z && !(pSector->ceilingstat&1))
if (ceilZ > pSprite->z && !(pSector->ceilingstat & CSTAT_SECTOR_SKY))
{
remove(actor);
continue;

View file

@ -466,7 +466,7 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in
return 0;
if (gHitInfo.hitpos.z >= nZFloor)
{
if (!(pSector->floorstat&1) || !(pSectorNext->floorstat&1))
if (!(pSector->floorstat & CSTAT_SECTOR_SKY) || !(pSectorNext->floorstat & CSTAT_SECTOR_SKY))
return 0;
return 2;
}
@ -567,7 +567,7 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ,
if (floorColl->type == kHitSector)
{
auto pSector = floorColl->hitSector;
if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (pSector->floorstat & 1))
if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (pSector->floorstat & CSTAT_SECTOR_SKY))
*floorZ = 0x7fffffff;
if (pSector->hasX())
{
@ -586,7 +586,7 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ,
if (ceilColl->type == kHitSector)
{
auto pSector = ceilColl->hitSector;
if ((nClipParallax & PARALLAXCLIP_CEILING) == 0 && (pSector->ceilingstat & 1))
if ((nClipParallax & PARALLAXCLIP_CEILING) == 0 && (pSector->ceilingstat & CSTAT_SECTOR_SKY))
*ceilZ = 0x80000000;
auto actor = barrier_cast<DBloodActor*>(pSector->lowerLink);
if (actor)
@ -609,7 +609,7 @@ void GetZRangeAtXYZ(int x, int y, int z, sectortype* pSector, int *ceilZ, Collis
if (floorColl->type == kHitSector)
{
auto pSector = floorColl->hitSector;
if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (pSector->floorstat & 1))
if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (pSector->floorstat & CSTAT_SECTOR_SKY))
*floorZ = 0x7fffffff;
if (pSector->hasX())
{
@ -628,7 +628,7 @@ void GetZRangeAtXYZ(int x, int y, int z, sectortype* pSector, int *ceilZ, Collis
if (ceilColl->type == kHitSector)
{
auto pSector = ceilColl->hitSector;
if ((nClipParallax & PARALLAXCLIP_CEILING) == 0 && (pSector->ceilingstat & 1))
if ((nClipParallax & PARALLAXCLIP_CEILING) == 0 && (pSector->ceilingstat & CSTAT_SECTOR_SKY))
*ceilZ = 0x80000000;
auto actor = barrier_cast<DBloodActor*>(pSector->lowerLink);
if (actor)

View file

@ -250,7 +250,7 @@ void PreloadCache()
{
tilePrecacheTile(sect.floorpicnum, 0, sect.floorpal);
tilePrecacheTile(sect.ceilingpicnum, 0, sect.ceilingpal);
if ((sect.ceilingstat&1) != 0 && skyTile == -1)
if ((sect.ceilingstat & CSTAT_SECTOR_SKY) != 0 && skyTile == -1)
skyTile = sect.ceilingpicnum;
}
for(auto& wal : walls())

View file

@ -692,7 +692,7 @@ void viewDrawScreen(bool sceneonly)
{
tmpSect = vf0 & (kMaxWalls - 1);
}
int v8 = byte_1CE5C2 > 0 && (sector [tmpSect].ceilingstat & 1);
int v8 = byte_1CE5C2 > 0 && (sector [tmpSect].ceilingstat & CSTAT_SECTOR_SKY);
if (gWeather.at12d8 > 0 || v8)
{
gWeather.Draw(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitch, gWeather.at12d8);

View file

@ -523,7 +523,7 @@ void moveplayers(void)
if (spri->insector())
{
if (spri->sector()->ceilingstat & 1)
if (spri->sector()->ceilingstat & CSTAT_SECTOR_SKY)
spri->shade += (spri->sector()->ceilingshade - spri->shade) >> 1;
else
spri->shade += (spri->sector()->floorshade - spri->shade) >> 1;
@ -1646,7 +1646,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
getglobalz(actor);
if (sectp->ceilingstat & 1)
if (sectp->ceilingstat & CSTAT_SECTOR_SKY)
s->shade += (sectp->ceilingshade - s->shade) >> 1;
else s->shade += (sectp->floorshade - s->shade) >> 1;
@ -2864,7 +2864,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
t[2] += q;
s->ang += q;
bool statstate = (!checkstat || ((sc->floorstat & 1) == 0 && (sc->ceilingstat & 1) == 0));
bool statstate = (!checkstat || ((sc->floorstat & CSTAT_SECTOR_SKY) == 0 && (sc->ceilingstat & CSTAT_SECTOR_SKY) == 0));
if (s->xvel == sc->extra)
{
if (statstate)
@ -2872,7 +2872,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
if (!S_CheckSoundPlaying(actor->lastvx))
S_PlayActorSound(actor->lastvx, actor);
}
if ((!checkstat || !statstate) && (ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat & 1) && rnd(8)))
if ((!checkstat || !statstate) && (ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat & CSTAT_SECTOR_SKY) && rnd(8)))
{
int p = findplayer(actor, &x);
if (x < 20480)
@ -3374,7 +3374,7 @@ void handle_se04(DDukeActor *actor)
auto sj = a2->s;
if (sj->cstat & 16)
{
if (sc->ceilingstat & 1)
if (sc->ceilingstat & CSTAT_SECTOR_SKY)
sj->shade = sc->ceilingshade;
else sj->shade = sc->floorshade;
}
@ -3701,7 +3701,7 @@ void handle_se12(DDukeActor *actor, int planeonly)
{
if (a2->s->cstat & 16)
{
if (sc->ceilingstat & 1)
if (sc->ceilingstat & CSTAT_SECTOR_SKY)
a2->s->shade = sc->ceilingshade;
else a2->s->shade = sc->floorshade;
}
@ -3741,7 +3741,7 @@ void handle_se12(DDukeActor *actor, int planeonly)
{
if (a2->s->cstat & 16)
{
if (sc->ceilingstat & 1)
if (sc->ceilingstat & CSTAT_SECTOR_SKY)
a2->s->shade = sc->ceilingshade;
else a2->s->shade = sc->floorshade;
}

View file

@ -51,7 +51,7 @@ BEGIN_DUKE_NS
bool ceilingspace_d(sectortype* sectp)
{
if (sectp && (sectp->ceilingstat&1) && sectp->ceilingpal == 0)
if (sectp && (sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0)
{
switch(sectp->ceilingpicnum)
{
@ -71,7 +71,7 @@ bool ceilingspace_d(sectortype* sectp)
bool floorspace_d(sectortype* sectp)
{
if (sectp && (sectp->floorstat&1) && sectp->ceilingpal == 0)
if (sectp && (sectp->floorstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0)
{
switch(sectp->floorpicnum)
{
@ -674,7 +674,7 @@ void movefta_d(void)
case NUKEBARRELDENTED:
case NUKEBARRELLEAKED:
case TRIPBOMB:
if (s->sector()->ceilingstat&1)
if (s->sector()->ceilingstat & CSTAT_SECTOR_SKY)
s->shade = s->sector()->ceilingshade;
else s->shade = s->sector()->floorshade;
@ -693,7 +693,7 @@ void movefta_d(void)
}
if (badguy(act))
{
if (s->sector()->ceilingstat & 1)
if (s->sector()->ceilingstat & CSTAT_SECTOR_SKY)
s->shade = s->sector()->ceilingshade;
else s->shade = s->sector()->floorshade;
}
@ -1616,7 +1616,7 @@ static bool weaponhitsector(DDukeActor* proj, const vec3_t& oldpos, bool firebal
if (s->zvel < 0)
{
if (s->sector()->ceilingstat & 1)
if (s->sector()->ceilingstat & CSTAT_SECTOR_SKY)
if (s->sector()->ceilingpal == 0)
{
deletesprite(proj);
@ -2249,7 +2249,7 @@ static void greenslime(DDukeActor *actor)
t[1] += 128;
if (sectp->floorstat & 1)
if (sectp->floorstat & CSTAT_SECTOR_SKY)
{
deletesprite(actor);
return;
@ -2538,7 +2538,7 @@ static void greenslime(DDukeActor *actor)
s->zvel = 0;
s->cstat &= (65535 - 8);
if ((sectp->ceilingstat & 1) || (actor->ceilingz + 6144) < s->z)
if ((sectp->ceilingstat & CSTAT_SECTOR_SKY) || (actor->ceilingz + 6144) < s->z)
{
s->z += 2048;
t[0] = 3;
@ -2571,7 +2571,7 @@ static void greenslime(DDukeActor *actor)
s->xrepeat = 36 + bcos(t[1], -11);
s->yrepeat = 16 + bsin(t[1], -13);
if (rnd(4) && (sectp->ceilingstat & 1) == 0 &&
if (rnd(4) && (sectp->ceilingstat & CSTAT_SECTOR_SKY) == 0 &&
abs(actor->floorz - actor->ceilingz)
< (192 << 8))
{
@ -3885,7 +3885,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (a)
{
if (spr->sector()->ceilingstat & 1)
if (spr->sector()->ceilingstat & CSTAT_SECTOR_SKY)
spr->shade += (spr->sector()->ceilingshade - spr->shade) >> 1;
else spr->shade += (spr->sector()->floorshade - spr->shade) >> 1;

View file

@ -53,7 +53,7 @@ void resetlanepics(void);
bool ceilingspace_r(sectortype* sectp)
{
if (sectp && (sectp->ceilingstat&1) && sectp->ceilingpal == 0)
if (sectp && (sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0)
{
switch(sectp->ceilingpicnum)
{
@ -74,7 +74,7 @@ bool ceilingspace_r(sectortype* sectp)
bool floorspace_r(sectortype* sectp)
{
if (sectp && (sectp->floorstat&1) && sectp->ceilingpal == 0)
if (sectp && (sectp->floorstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0)
{
switch(sectp->floorpicnum)
{
@ -574,7 +574,7 @@ void movefta_r(void)
case NUKEBARREL:
case NUKEBARRELDENTED:
case NUKEBARRELLEAKED:
if (s->sector()->ceilingstat & 1)
if (s->sector()->ceilingstat & CSTAT_SECTOR_SKY)
s->shade = s->sector()->ceilingshade;
else s->shade = s->sector()->floorshade;
@ -596,7 +596,7 @@ void movefta_r(void)
}
if (/*!j &&*/ badguy(act)) // this is like RedneckGDX. j is uninitialized here, i.e. most likely not 0.
{
if (s->sector()->ceilingstat & 1)
if (s->sector()->ceilingstat & CSTAT_SECTOR_SKY)
s->shade = s->sector()->ceilingshade;
else s->shade = s->sector()->floorshade;
@ -1303,7 +1303,7 @@ bool weaponhitsector(DDukeActor *proj, const vec3_t& oldpos)
if (s->zvel < 0)
{
if (s->sector()->ceilingstat & 1)
if (s->sector()->ceilingstat & CSTAT_SECTOR_SKY)
if (s->sector()->ceilingpal == 0)
{
deletesprite(proj);
@ -3808,7 +3808,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
}
if (badguy(actor) && spr->extra <= 0)
{
if (spr->sector()->ceilingstat & 1)
if (spr->sector()->ceilingstat & CSTAT_SECTOR_SKY)
{
if (spr->sector()->shadedsector == 1)
{
@ -3960,7 +3960,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a)
{
if (spr->sector()->ceilingstat & 1)
if (spr->sector()->ceilingstat & CSTAT_SECTOR_SKY)
{
if (spr->sector()->shadedsector == 1)
{

View file

@ -134,7 +134,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
}
if (t->insector())
t->shade = clamp<int>(t->sector()->ceilingstat & 1 ? t->sector()->ceilingshade : t->sector()->floorshade, -127, 127);
t->shade = clamp<int>(t->sector()->ceilingstat & CSTAT_SECTOR_SKY ? t->sector()->ceilingshade : t->sector()->floorshade, -127, 127);
}

View file

@ -119,7 +119,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
}
if (t->insector())
t->shade = clamp<int>(t->sector()->ceilingstat & 1 ? s->shade : t->sector()->floorshade, -127, 127);
t->shade = clamp<int>(t->sector()->ceilingstat & CSTAT_SECTOR_SKY ? s->shade : t->sector()->floorshade, -127, 127);
}

View file

@ -2500,7 +2500,7 @@ int ParseState::parse(void)
parseifelse(PlayerInput(g_p, SB_OPEN));
break;
case concmd_ifoutside:
parseifelse(g_sp->sector()->ceilingstat & 1);
parseifelse(g_sp->sector()->ceilingstat & CSTAT_SECTOR_SKY);
break;
case concmd_ifmultiplayer:
parseifelse(ud.multimode > 1);

View file

@ -197,7 +197,7 @@ inline bool playrunning()
inline void doslopetilting(player_struct* p, double const scaleAdjust = 1)
{
bool const canslopetilt = p->on_ground && p->insector() && p->cursector->lotag != ST_2_UNDERWATER && (p->cursector->floorstat & 2);
bool const canslopetilt = p->on_ground && p->insector() && p->cursector->lotag != ST_2_UNDERWATER && (p->cursector->floorstat & CSTAT_SECTOR_SLOPE);
p->horizon.calcviewpitch(p->pos.vec2, p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursector, scaleAdjust);
}

View file

@ -427,7 +427,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
{
if (zvel < 0)
{
if (hit.hitSector->ceilingstat & 1)
if (hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY)
{
spark->s->xrepeat = 0;
spark->s->yrepeat = 0;
@ -987,7 +987,7 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
if (hit.hitWall == nullptr && hit.actor() == nullptr && hit.hitSector != nullptr)
{
if (zvel < 0 && (hit.hitSector->ceilingstat & 1) == 0)
if (zvel < 0 && (hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY) == 0)
fi.checkhitceiling(hit.hitSector);
}
else if (hit.actor() != nullptr) fi.checkhitsprite(hit.actor(), spark);
@ -1803,7 +1803,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
{
// not jumping or crouching
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (psect->floorstat & 2) && p->pos.z >= (fz - (i << 8) - (16 << 8)))
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (psect->floorstat & CSTAT_SECTOR_SLOPE) && p->pos.z >= (fz - (i << 8) - (16 << 8)))
p->pos.z = fz - (i << 8);
else
{

View file

@ -313,7 +313,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
{
if (zvel < 0)
{
if (hit.hitSector->ceilingstat & 1)
if (hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY)
{
spark->s->xrepeat = 0;
spark->s->yrepeat = 0;
@ -2122,7 +2122,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
if (p->pos.z < (fz - (i << 8))) //falling
{
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (psect->floorstat & 2) && p->pos.z >= (fz - (i << 8) - (16 << 8)))
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (psect->floorstat & CSTAT_SECTOR_SLOPE) && p->pos.z >= (fz - (i << 8) - (16 << 8)))
p->pos.z = fz - (i << 8);
else
{

View file

@ -700,7 +700,7 @@ void prelevel_common(int g)
continue;
}
if (sectp->ceilingstat & 1)
if (sectp->ceilingstat & CSTAT_SECTOR_SKY)
{
//setupbackdrop(sectp->ceilingpicnum);

View file

@ -732,7 +732,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
else
sectp->ceilingz = sectp->floorz = sp->z;
if (sectp->ceilingstat & 1)
if (sectp->ceilingstat & CSTAT_SECTOR_SKY)
{
sectp->ceilingstat ^= 1;
t[3] = 1;
@ -753,7 +753,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
if (wl.twoSided())
{
auto nsec = wl.nextSector();
if (!(nsec->ceilingstat & 1))
if (!(nsec->ceilingstat & CSTAT_SECTOR_SKY))
{
sectp->ceilingpicnum = nsec->ceilingpicnum;
sectp->ceilingshade = nsec->ceilingshade;

View file

@ -337,7 +337,7 @@ void AddFlash(sectortype* pSector, int x, int y, int z, int val)
pSector->floorshade = eax;
if (!(pSector->ceilingstat & 1))
if (!(pSector->ceilingstat & CSTAT_SECTOR_SKY))
{
if (pSector->ceilingpal < 4)
{

View file

@ -185,7 +185,7 @@ void AISpider::Tick(RunListEvent* ev)
sp->zvel = 0;
sp->z = pSector->ceilingz + (tileHeight(sp->picnum) << 5);
if (pSector->ceilingstat & 1)
if (pSector->ceilingstat & CSTAT_SECTOR_SKY)
{
sp->cstat ^= 8;
sp->zvel = 1;

View file

@ -108,7 +108,7 @@ static void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int x, int
if (pTSprite->sector() != nullptr)
{
sectortype *pSector = pTSprite->sector();
int nSectShade = (pSector->ceilingstat & 1) ? pSector->ceilingshade : pSector->floorshade;
int nSectShade = (pSector->ceilingstat & CSTAT_SECTOR_SKY) ? pSector->ceilingshade : pSector->floorshade;
int nShade = pTSprite->shade + nSectShade + 6;
pTSprite->shade = clamp(nShade, -128, 127);
}

View file

@ -284,7 +284,7 @@ void JS_InitMirrors(void)
if (wal.twoSided() && (wal.overpicnum == MIRROR) && (wal.cstat & 32))
{
auto sec = wal.nextSector();
if ((sec->floorstat & 1) == 0)
if ((sec->floorstat & CSTAT_SECTOR_SKY) == 0)
{
if (mirrorcnt >= MAXMIRRORS)
{