diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 8ddc22ee7..a6fcbed70 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -501,7 +501,7 @@ int cansee(int x1, int y1, int z1, sectortype* sect1, int x2, int y2, int z2, se } - if (!wal->twoSided() || wal->cstat&32) + if (!wal->twoSided() || wal->cstat & CSTAT_WALL_1WAY) return 0; t = DivScale(t,bot, 24); diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 6d7f84367..91d20ed6e 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -301,8 +301,9 @@ void MarkSectorSeen(sectortype* sec) for (auto& wal : wallsofsector(sec)) { if (!wal.twoSided()) continue; - if (wal.cstat & 0x0071) continue; - if (wal.nextWall()->cstat & 0x0071) continue; + const auto bits = (CSTAT_WALL_BLOCK | CSTAT_WALL_MASKED | CSTAT_WALL_1WAY | CSTAT_WALL_BLOCK_HITSCAN); + if (wal.cstat & bits) continue; + if (wal.nextWall()->cstat & bits) continue; auto osec = wal.nextSector(); if (osec->lotag == 32767) continue; if (osec->ceilingz >= osec->floorz) continue; @@ -390,7 +391,7 @@ bool ShowRedLine(int j, int i) { if (sector[i].floorz != sector[i].ceilingz) if (wal->nextSector()->floorz != wal->nextSector()->ceilingz) - if (((wal->cstat | wal->nextWall()->cstat) & (16 + 32)) == 0) + if (((wal->cstat | wal->nextWall()->cstat) & (CSTAT_WALL_MASKED | CSTAT_WALL_1WAY)) == 0) if (sector[i].floorz == wal->nextSector()->floorz) return false; if (sector[i].floorpicnum != wal->nextSector()->floorpicnum) @@ -429,7 +430,7 @@ void drawredlines(int cposx, int cposy, int czoom, int cang) auto osec = wal.nextSector(); if (osec->ceilingz == z1 && osec->floorz == z2) - if (((wal.cstat | wal.nextWall()->cstat) & (16 + 32)) == 0) continue; + if (((wal.cstat | wal.nextWall()->cstat) & (CSTAT_WALL_MASKED | CSTAT_WALL_1WAY)) == 0) continue; if (ShowRedLine(wallnum(&wal), i)) { diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 45f73b654..7c85bf7da 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -4141,13 +4141,13 @@ void handle_se19(DDukeActor *actor, int BIGFORCE) { if (wal.overpicnum == BIGFORCE) { - wal.cstat &= (128 + 32 + 8 + 4 + 2); + wal.cstat &= (CSTAT_WALL_TRANSLUCENT | CSTAT_WALL_1WAY | CSTAT_WALL_XFLIP | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_BOTTOM_SWAP); wal.overpicnum = 0; auto nextwal = wal.nextWall(); if (nextwal != nullptr) { nextwal->overpicnum = 0; - nextwal->cstat &= (128 + 32 + 8 + 4 + 2); + nextwal->cstat &= (CSTAT_WALL_TRANSLUCENT | CSTAT_WALL_1WAY | CSTAT_WALL_XFLIP | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_BOTTOM_SWAP); } } } @@ -4707,12 +4707,12 @@ void handle_se128(DDukeActor *actor) //if (wal->cstat | 32) // this has always been bugged, the condition can never be false. { - wal->cstat &= (255 - 32); - wal->cstat |= 16; + wal->cstat &= ~CSTAT_WALL_1WAY; + wal->cstat |= CSTAT_WALL_MASKED; if (wal->twoSided()) { - wal->nextWall()->cstat &= (255 - 32); - wal->nextWall()->cstat |= 16; + wal->nextWall()->cstat &= ~CSTAT_WALL_1WAY; + wal->nextWall()->cstat |= CSTAT_WALL_MASKED; } } // else return; @@ -4725,9 +4725,9 @@ void handle_se128(DDukeActor *actor) if (t[0] < t[1]) t[0]++; else { - wal->cstat &= (128 + 32 + 8 + 4 + 2); + wal->cstat &= (CSTAT_WALL_TRANSLUCENT | CSTAT_WALL_1WAY | CSTAT_WALL_XFLIP | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_BOTTOM_SWAP); if (nextwal) - nextwal->cstat &= (128 + 32 + 8 + 4 + 2); + nextwal->cstat &= (CSTAT_WALL_TRANSLUCENT | CSTAT_WALL_1WAY | CSTAT_WALL_XFLIP | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_BOTTOM_SWAP); deletesprite(actor); } } diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index 548b08136..865aa7817 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -423,7 +423,7 @@ void prelevel_d(int g, TArray& actors) case W_FORCEFIELD + 2: if (wal.shade > 31) wal.cstat = 0; - else wal.cstat |= 85 + 256; + else wal.cstat |= CSTAT_WALL_BLOCK | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_MASKED | CSTAT_WALL_BLOCK_HITSCAN | CSTAT_WALL_YFLIP; if (wal.lotag && wal.twoSided()) wal.nextWall()->lotag = wal.lotag; diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 63aa2ff46..784957a05 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -1207,7 +1207,7 @@ void operateforcefields_common(DDukeActor *effector, int low, const std::initial wal->lotag = 0; } else - wal->cstat = 85; + wal->cstat = (CSTAT_WALL_BLOCK | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_MASKED | CSTAT_WALL_BLOCK_HITSCAN); } } } diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 93ee11a4b..cfaa04b7a 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -918,7 +918,7 @@ void checkplayerhurt_d(struct player_struct* p, const Collision& coll) auto wal = coll.hitWall; if (p->hurt_delay > 0) p->hurt_delay--; - else if (wal->cstat & 85) switch (wal->overpicnum) + else if (wal->cstat & (CSTAT_WALL_BLOCK | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_MASKED | CSTAT_WALL_BLOCK_HITSCAN)) switch (wal->overpicnum) { case W_FORCEFIELD: case W_FORCEFIELD + 1: diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 2bd43e8a4..233fe7038 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -1421,7 +1421,7 @@ void checkplayerhurt_r(struct player_struct* p, const Collision &coll) auto wal = coll.hitWall; if (p->hurt_delay > 0) p->hurt_delay--; - else if (wal->cstat & 85) switch (wal->overpicnum) + else if (wal->cstat & (CSTAT_WALL_BLOCK | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_MASKED | CSTAT_WALL_BLOCK_HITSCAN)) switch (wal->overpicnum) { case BIGFORCE: p->hurt_delay = 26;