diff --git a/source/core/maptypes.h b/source/core/maptypes.h index ce11b29e5..62797a9bd 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -103,6 +103,7 @@ enum EWallBits // names are from Shadow Warrior CSTAT_WALL_TRANSLUCENT = 128, // bit 7: 1 = Transluscence, 0 = not "T" CSTAT_WALL_YFLIP = 256, // bit 8: 1 = y-flipped, 0 = normal "F" CSTAT_WALL_TRANS_FLIP = 512, // bit 9: 1 = Transluscence reversing, 0 = normal "T" + CSTAT_WALL_ANY_EXCEPT_BLOCK = 254, // Duke stupidity CSTAT_WALL_ROTATE_90 = 1<<12, // EDuke32 extension supported by Raze diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index f523ff6bc..45f73b654 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -3309,7 +3309,7 @@ void handle_se03(DDukeActor *actor) if (wal.hitag != 1) { wal.shade = t[0]; - if ((wal.cstat & 2) && wal.twoSided()) + if ((wal.cstat & CSTAT_WALL_BOTTOM_SWAP) && wal.twoSided()) { wal.nextWall()->shade = wal.shade; } @@ -3363,7 +3363,7 @@ void handle_se04(DDukeActor *actor) if (wal.hitag != 1) { wal.shade = t[0]; - if ((wal.cstat & 2) && wal.twoSided()) + if ((wal.cstat & CSTAT_WALL_BOTTOM_SWAP) && wal.twoSided()) wal.nextWall()->shade = wal.shade; } } diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index ad620ad9a..2cd9387b1 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -409,7 +409,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int if (act == pactor || (spr->cstat & 0x8000) || spr->cstat == 257 || spr->xrepeat == 0) continue; col = PalEntry(0, 170, 170); - if (spr->cstat & 1) col = PalEntry(170, 0, 170); + if (spr->cstat & CSTAT_SPRITE_BLOCK) col = PalEntry(170, 0, 170); sprx = spr->x; spry = spr->y; diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index f2709b931..2b1062bf7 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -199,7 +199,7 @@ int hitasprite(DDukeActor* actor, DDukeActor** hitsp) hitscan({ sp->x, sp->y, sp->z - zoff }, sp->sector(), { bcos(sp->ang), bsin(sp->ang), 0 }, hit, CLIPMASK1); if (hitsp) *hitsp = hit.actor(); - if (hit.hitWall != nullptr && (hit.hitWall->cstat & 16) && badguy(actor)) + if (hit.hitWall != nullptr && (hit.hitWall->cstat & CSTAT_WALL_MASKED) && badguy(actor)) return((1 << 30)); return (FindDistance2D(hit.hitpos.x - sp->x, hit.hitpos.y - sp->y)); @@ -1012,7 +1012,7 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i (hit.hitSector->floorz - hit.hitWall->nextSector()->floorz) > (16 << 8)) || (!hit.hitWall->twoSided() && hit.hitSector->lotag == 0))) { - if ((hit.hitWall->cstat & 16) == 0) + if ((hit.hitWall->cstat & CSTAT_WALL_MASKED) == 0) { if (hit.hitWall->twoSided()) { diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 160ba895b..3472f2faf 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -283,7 +283,7 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) else if (hit.hitWall) { - if (hit.hitWall->cstat & 2) + if (hit.hitWall->cstat & CSTAT_WALL_BOTTOM_SWAP) if (hit.hitWall->twoSided()) if (hit.hitpos.z >= (hit.hitWall->nextSector()->floorz)) hit.hitWall =hit.hitWall->nextWall(); @@ -497,7 +497,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa if (hit.hitWall->overpicnum != BIGFORCE) if ((hit.hitWall->twoSided() && hit.hitWall->nextSector()->lotag == 0) || (!hit.hitWall->twoSided() && hit.hitSector->lotag == 0)) - if ((hit.hitWall->cstat & 16) == 0) + if ((hit.hitWall->cstat & CSTAT_WALL_MASKED) == 0) { if (hit.hitWall->twoSided()) { @@ -528,7 +528,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa SKIPBULLETHOLE: - if (hit.hitWall->cstat & 2) + if (hit.hitWall->cstat & CSTAT_WALL_BOTTOM_SWAP) if (hit.hitWall->twoSided()) if (hit.hitpos.z >= (hit.hitWall->nextSector()->floorz)) hit.hitWall = hit.hitWall->nextWall(); @@ -2048,7 +2048,7 @@ int operateTripbomb(int snum) return 0; } - if (j == nullptr && hit.hitWall != nullptr && (hit.hitWall->cstat & 16) == 0) + if (j == nullptr && hit.hitWall != nullptr && (hit.hitWall->cstat & CSTAT_WALL_MASKED) == 0) if ((hit.hitWall->twoSided() && hit.hitWall->nextSector()->lotag <= 2) || (!hit.hitWall->twoSided() && hit.hitSector->lotag <= 2)) if (((hit.hitpos.x - p->pos.x) * (hit.hitpos.x - p->pos.x) + (hit.hitpos.y - p->pos.y) * (hit.hitpos.y - p->pos.y)) < (290 * 290)) { diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index e274e0410..2007f2bec 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -169,7 +169,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, } else if (hit.hitWall) { - if (hit.hitWall->cstat & 2) + if (hit.hitWall->cstat & CSTAT_WALL_BOTTOM_SWAP) if (hit.hitWall->twoSided()) if (hit.hitpos.z >= (hit.hitWall->nextSector()->floorz)) hit.hitWall = hit.hitWall->nextWall(); @@ -390,7 +390,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa if (hit.hitWall->overpicnum != BIGFORCE) if ((hit.hitWall->twoSided() && hit.hitWall->nextSector()->lotag == 0) || (!hit.hitWall->twoSided() && hit.hitSector->lotag == 0)) - if ((hit.hitWall->cstat & 16) == 0) + if ((hit.hitWall->cstat & CSTAT_WALL_MASKED) == 0) { if (hit.hitWall->twoSided()) { @@ -421,7 +421,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa SKIPBULLETHOLE: - if (hit.hitWall->cstat & 2) + if (hit.hitWall->cstat & CSTAT_WALL_BOTTOM_SWAP) if (hit.hitWall->twoSided()) if (hit.hitpos.z >= (hit.hitWall->nextSector()->floorz)) hit.hitWall = hit.hitWall->nextWall(); diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index 6945a8b71..548b08136 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -383,7 +383,7 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors) for (auto& wal : walls()) { - if (wal.overpicnum == MIRROR && (wal.cstat & 32) != 0) + if (wal.overpicnum == MIRROR && (wal.cstat & CSTAT_WALL_1WAY) != 0) { auto sectp = wal.nextSector(); @@ -410,7 +410,7 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors) { case FANSHADOW: case FANSPRITE: - wal.cstat |= 65; + wal.cstat |= CSTAT_WALL_BLOCK | CSTAT_WALL_BLOCK_HITSCAN; animwall[numanimwalls].wall = &wal; numanimwalls++; break; diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index afb476e51..11f7fafc0 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -721,7 +721,7 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors) walltype* wal = &wl; - if (wal->overpicnum == MIRROR && (wal->cstat & 32) != 0) + if (wal->overpicnum == MIRROR && (wal->cstat & CSTAT_WALL_1WAY) != 0) { auto sectp = wal->nextSector(); @@ -747,7 +747,7 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors) switch (wal->overpicnum) { case FANSPRITE: - wal->cstat |= 65; + wal->cstat |= CSTAT_WALL_BLOCK | CSTAT_WALL_BLOCK_HITSCAN; animwall[numanimwalls].wall = wal; numanimwalls++; break; diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 078950011..93ee11a4b 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -139,7 +139,7 @@ void animatewalls_d(void) } - if (wal->cstat & 16) + if (wal->cstat & CSTAT_WALL_MASKED) switch (wal->overpicnum) { case W_FORCEFIELD: @@ -148,7 +148,7 @@ void animatewalls_d(void) t = animwall[p].tag; - if (wal->cstat & 254) + if (wal->cstat & CSTAT_WALL_ANY_EXCEPT_BLOCK) { wal->addxpan(-t / 4096.f); // bcos(t, -12); wal->addypan(-t / 4096.f); // bsin(t, -12); @@ -657,7 +657,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw case OOZFILTER: case EXPLODINGBARREL: lotsofglass(spr, wal, 70); - wal->cstat &= ~16; + wal->cstat &= ~CSTAT_WALL_MASKED; wal->overpicnum = MIRRORBROKE; wal->portalflags = 0; S_PlayActorSound(GLASS_HEAVYBREAK, spr); @@ -665,7 +665,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw } } - if (((wal->cstat & 16) || wal->overpicnum == BIGFORCE) && wal->twoSided()) + if (((wal->cstat & CSTAT_WALL_MASKED) || wal->overpicnum == BIGFORCE) && wal->twoSided()) if (wal->nextSector()->floorz > z) if (wal->nextSector()->floorz - wal->nextSector()->ceilingz) switch (wal->overpicnum) @@ -701,11 +701,11 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw } case FANSPRITE: wal->overpicnum = FANSPRITEBROKE; - wal->cstat &= 65535 - 65; + wal->cstat &= ~(CSTAT_WALL_BLOCK | CSTAT_WALL_BLOCK_HITSCAN); if (wal->twoSided()) { wal->nextWall()->overpicnum = FANSPRITEBROKE; - wal->nextWall()->cstat &= 65535 - 65; + wal->nextWall()->cstat &= ~(CSTAT_WALL_BLOCK | CSTAT_WALL_BLOCK_HITSCAN); } S_PlayActorSound(VENT_BUST, spr); S_PlayActorSound(GLASS_BREAKING, spr); @@ -1615,7 +1615,7 @@ void checksectors_d(int snum) return; } - if (hitscanwall != nullptr && (hitscanwall->cstat & 16)) + if (hitscanwall != nullptr && (hitscanwall->cstat & CSTAT_WALL_MASKED)) if (hitscanwall->lotag) return; } diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 3246b934b..2bd43e8a4 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -254,7 +254,7 @@ void animatewalls_r(void) } - if (wal->cstat & 16) + if (wal->cstat & CSTAT_WALL_MASKED) switch (wal->overpicnum) { case W_FORCEFIELD: @@ -263,7 +263,7 @@ void animatewalls_r(void) t = animwall[p].tag; - if (wal->cstat & 254) + if (wal->cstat & CSTAT_WALL_ANY_EXCEPT_BLOCK) { wal->addxpan(-t / 4096.f); // bcos(t, -12); wal->addypan(-t / 4096.f); // bsin(t, -12); @@ -1003,7 +1003,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw case OOZFILTER: case EXPLODINGBARREL: lotsofglass(spr, wal, 70); - wal->cstat &= ~16; + wal->cstat &= ~CSTAT_WALL_MASKED; wal->overpicnum = MIRRORBROKE; wal->portalflags = 0; S_PlayActorSound(GLASS_HEAVYBREAK, spr); @@ -1011,18 +1011,18 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw } } - if (((wal->cstat & 16) || wal->overpicnum == BIGFORCE) && wal->twoSided()) + if (((wal->cstat & CSTAT_WALL_MASKED) || wal->overpicnum == BIGFORCE) && wal->twoSided()) if (wal->nextSector()->floorz > z) if (wal->nextSector()->floorz - wal->nextSector()->ceilingz) switch (wal->overpicnum) { case FANSPRITE: wal->overpicnum = FANSPRITEBROKE; - wal->cstat &= 65535 - 65; + wal->cstat &= ~(CSTAT_WALL_BLOCK | CSTAT_WALL_BLOCK_HITSCAN); if (wal->twoSided()) { wal->nextWall()->overpicnum = FANSPRITEBROKE; - wal->nextWall()->cstat &= 65535 - 65; + wal->nextWall()->cstat &= ~(CSTAT_WALL_BLOCK | CSTAT_WALL_BLOCK_HITSCAN); } S_PlayActorSound(VENT_BUST, spr); S_PlayActorSound(GLASS_BREAKING, spr); @@ -2549,7 +2549,7 @@ void checksectors_r(int snum) } } - if ((hitscanwall->cstat & 16)) + if ((hitscanwall->cstat & CSTAT_WALL_MASKED)) if (hitscanwall->lotag) return; diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 7950c71ac..378b6c036 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -847,7 +847,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors) { if (!(wal.hitag & 1)) wal.shade = sp->shade; - if ((wal.cstat & 2) && wal.twoSided()) + if ((wal.cstat & CSTAT_WALL_BOTTOM_SWAP) && wal.twoSided()) wal.nextWall()->shade = sp->shade; } break; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index d541f3a36..bc10064f3 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -1703,7 +1703,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int SHOWSPRITE: PalEntry col = GPalette.BaseColors[56]; // 1=white / 31=black / 44=green / 56=pink / 128=yellow / 210=blue / 248=orange / 255=purple - if ((spr->cstat & 1) > 0) + if ((spr->cstat & CSTAT_SPRITE_BLOCK) > 0) col = GPalette.BaseColors[248]; if (actor == peekActor) col = GPalette.BaseColors[31];