- wall and sprite flags in Duke, just simple cases.

This commit is contained in:
Christoph Oelckers 2021-12-18 15:11:21 +01:00
parent e41db411e4
commit b263c3ac6b
12 changed files with 33 additions and 32 deletions

View file

@ -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

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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())
{

View file

@ -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))
{

View file

@ -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();

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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;

View file

@ -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];