diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 837ece2eb..34105811e 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -81,10 +81,10 @@ static inline void get_floorspr_points(T const * const spr, int32_t px, int32_t vec2_t adjofs = { tileLeftOffset(tilenum) + spr->xoffset, tileTopOffset(tilenum) + spr->yoffset }; - if (spr->cstat & 4) + if (spr->cstat & CSTAT_SPRITE_XFLIP) adjofs.x = -adjofs.x; - if (spr->cstat & 8) + if (spr->cstat & CSTAT_SPRITE_YFLIP) adjofs.y = -adjofs.y; vec2_t const center = { ((span.x >> 1) + adjofs.x) * repeat.x, ((span.y >> 1) + adjofs.y) * repeat.y }; diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index b88b91919..e83128bdf 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2767,7 +2767,7 @@ static DBloodActor* actSpawnFloor(DBloodActor* actor) updatesector(x, y, &pSector); int zFloor = getflorzofslopeptr(pSector, x, y); auto spawned = actSpawnSprite(pSector, x, y, zFloor, 3, 0); - if (spawned) spawned->s().cstat &= ~257; + if (spawned) spawned->s().cstat &= ~CSTAT_SPRITE_BLOCK_ALL; return spawned; } @@ -4029,7 +4029,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) pXMissile->goalAng = getangle(pMissile->x - pSpriteHit->x, pMissile->y - pSpriteHit->y) - pSpriteHit->ang; pXMissile->state = 1; actPostSprite(missileActor, kStatFlare); - pMissile->cstat &= ~257; + pMissile->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; break; } } @@ -4141,7 +4141,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) if (gModernMap && pXSpriteHit && pXSpriteHit->state != pXSpriteHit->restState && pXSpriteHit->Impact) trTriggerSprite(actorHit, kCmdSpriteImpact); #endif - pMissile->cstat &= ~257; + pMissile->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; } //--------------------------------------------------------------------------- @@ -4613,7 +4613,7 @@ static Collision MoveThing(DBloodActor* actor) if (actor->xvel || actor->yvel) { auto bakCstat = pSprite->cstat; - pSprite->cstat &= ~257; + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; if ((actor->GetOwner()) && !cl_bloodvanillaexplosions && !VanillaMode()) enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy ClipMove(pSprite->pos, &pSector, actor->xvel >> 12, actor->yvel >> 12, pSprite->clipdist << 2, (pSprite->z - top) / 4, (bottom - pSprite->z) / 4, CLIPMASK0, lhit); @@ -4839,7 +4839,7 @@ void MoveDude(DBloodActor* actor) else { auto bakCstat = pSprite->cstat; - pSprite->cstat &= ~257; + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; ClipMove(pSprite->pos, &pSector, actor->xvel >> 12, actor->yvel >> 12, wd, tz, bz, CLIPMASK0, actor->hit.hit); if (pSector == nullptr) { @@ -5304,7 +5304,7 @@ int MoveMissile(DBloodActor* actor) { pOwner = &Owner->s(); bakCstat = pOwner->cstat; - pOwner->cstat &= ~257; + pOwner->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; } gHitInfo.clearObj(); if (pSprite->type == kMissileFlameSpray) actAirDrag(actor, 0x1000); @@ -5346,7 +5346,7 @@ int MoveMissile(DBloodActor* actor) if (pOwner && !isFlameSprite && !cl_bloodvanillaexplosions && !VanillaMode()) { enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy - pSprite->cstat &= ~257; // remove self collisions for accurate clipmove + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; // remove self collisions for accurate clipmove } Collision clipmoveresult; ClipMove(pos, &pSector2, vx, vy, pSprite->clipdist << 2, (pos.z - top) / 4, (bottom - pos.z) / 4, CLIPMASK0, clipmoveresult, 1); @@ -5624,7 +5624,7 @@ void actActivateGibObject(DBloodActor* actor) if (sound > 0) sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, sound, pSprite->sector()); if (dropmsg > 0) actDropObject(actor, dropmsg); - if (!(pSprite->cstat & 32768) && !(pSprite->flags & kHitagRespawn)) + if (!(pSprite->cstat & CSTAT_SPRITE_INVISIBLE) && !(pSprite->flags & kHitagRespawn)) actPostSprite(actor, kStatFree); } @@ -6796,7 +6796,7 @@ bool actCheckRespawn(DBloodActor* actor) if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { - pSprite->cstat &= ~257; + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; pSprite->pos = actor->basePoint; } evPostActor(actor, nRespawnTime, kCallbackRespawn); @@ -7155,7 +7155,7 @@ void TreeToGibCallback(int, DBloodActor* actor) pXSprite->data3 = 0; pXSprite->health = thingInfo[17].startHealth; pXSprite->data4 = 312; - pSprite->cstat |= 257; + pSprite->cstat |= CSTAT_SPRITE_BLOCK_ALL; } void DudeToGibCallback1(int, DBloodActor* actor) diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index 09caee7af..cfd8f4f92 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -1908,7 +1908,7 @@ void aiInitSprite(DBloodActor* actor) case kDudeSpiderBrown: case kDudeSpiderRed: case kDudeSpiderBlack: - if (pSprite->cstat & 8) pSprite->flags |= 9; + if (pSprite->cstat & CSTAT_SPRITE_YFLIP) pSprite->flags |= 9; else pSprite->flags = 15; break; case kDudeGargoyleFlesh: diff --git a/source/games/blood/src/animatesprite.cpp b/source/games/blood/src/animatesprite.cpp index f01e39af2..1f185cdb4 100644 --- a/source/games/blood/src/animatesprite.cpp +++ b/source/games/blood/src/animatesprite.cpp @@ -75,7 +75,7 @@ tspritetype* viewInsertTSprite(tspritetype* tsprite, int& spritesortcnt, sectort int nTSprite = spritesortcnt; tspritetype *pTSprite = &tsprite[nTSprite]; memset(pTSprite, 0, sizeof(tspritetype)); - pTSprite->cstat = 128; + pTSprite->cstat = CSTAT_SPRITE_YCENTER; pTSprite->xrepeat = 64; pTSprite->yrepeat = 64; pTSprite->ownerActor = nullptr; diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index d3b47edbf..f2cd3bea1 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -42,7 +42,7 @@ DBloodActor* InsertSprite(sectortype* pSector, int nStat) { auto act = static_cast(::InsertActor(RUNTIME_CLASS(DBloodActor), pSector, nStat)); auto pSprite = &act->s(); - pSprite->cstat = 128; + pSprite->cstat = CSTAT_SPRITE_YCENTER; pSprite->clipdist = 32; pSprite->xrepeat = pSprite->yrepeat = 64; return act; diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index da20d84f0..3b9c6922c 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -427,7 +427,7 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in otherZ -= (nOffset*pOther->yrepeat)<<2; assert(height > 0); int height2 = scale(otherZ-gHitInfo.hitpos.z, tileHeight(nPicnum), height); - if (!(pOther->cstat & 8)) + if (!(pOther->cstat & CSTAT_SPRITE_YFLIP)) height2 = tileHeight(nPicnum)-height2; if (height2 >= 0 && height2 < tileHeight(nPicnum)) { @@ -562,7 +562,7 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ, int bakCstat = pSprite->cstat; int32_t nTemp1; - pSprite->cstat &= ~257; + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; getzrange(pSprite->pos, pSprite->sector(), (int32_t*)ceilZ, *ceilColl, (int32_t*)floorZ, *floorColl, nDist, nMask); if (floorColl->type == kHitSector) { diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 621c07c7b..2b85087df 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -6290,7 +6290,7 @@ void useUniMissileGen(DBloodActor* sourceactor, DBloodActor* actor) if (pSprite->cstat & 32) { - if (pSprite->cstat & 8) dz = 0x4000; + if (pSprite->cstat & CSTAT_SPRITE_YFLIP) dz = 0x4000; else dz = -0x4000; } else diff --git a/source/games/blood/src/prediction.cpp b/source/games/blood/src/prediction.cpp index 8d22e2f9f..c06a6ecfd 100644 --- a/source/games/blood/src/prediction.cpp +++ b/source/games/blood/src/prediction.cpp @@ -385,7 +385,7 @@ static void fakeMoveDude(spritetype *pSprite) else { auto bakCstat = pSprite->cstat; - pSprite->cstat &= ~257; + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; ClipMove(&predict.pos, &nSector, predict.xvel >> 12, predict.yvel >> 12, wd, tz, bz, CLIPMASK0, predict.at75.hit); if (nSector == -1) nSector = predict.sector; diff --git a/source/games/blood/src/warp.cpp b/source/games/blood/src/warp.cpp index a97cb97ee..f776bb33d 100644 --- a/source/games/blood/src/warp.cpp +++ b/source/games/blood/src/warp.cpp @@ -123,19 +123,19 @@ void warpInit(TArray& actors) case kMarkerUpLink: pSprite->sector()->upperLink = actor; pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; - pSprite->cstat &= ~257; + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; break; case kMarkerLowLink: pSprite->sector()->lowerLink = actor; pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; - pSprite->cstat &= ~257; + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; break; case kMarkerUpWater: case kMarkerUpStack: case kMarkerUpGoo: pSprite->sector()->upperLink = actor; pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; - pSprite->cstat &= ~257; + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; pSprite->z = getflorzofslopeptr(pSprite->sector(), pSprite->x, pSprite->y); break; case kMarkerLowWater: @@ -143,7 +143,7 @@ void warpInit(TArray& actors) case kMarkerLowGoo: pSprite->sector()->lowerLink = actor; pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; - pSprite->cstat &= ~257; + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; pSprite->z = getceilzofslopeptr(pSprite->sector(), pSprite->x, pSprite->y); break; } diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 6d6943795..b914dab03 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1363,7 +1363,7 @@ void movetongue(DDukeActor *actor, int tongue, int jaw) 8, 8, 0, 0, 0, actor, 5); if (q) { - q->s->cstat = 128; + q->s->cstat = CSTAT_SPRITE_YCENTER; q->s->pal = 8; } } @@ -1375,7 +1375,7 @@ void movetongue(DDukeActor *actor, int tongue, int jaw) 32, 32, 0, 0, 0, actor, 5); if (spawned) { - spawned->s->cstat = 128; + spawned->s->cstat = CSTAT_SPRITE_YCENTER; if (actor->temp_data[1] > 512 && actor->temp_data[1] < (1024)) spawned->s->picnum = jaw + 1; } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index d8382dd2d..da91b62ef 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1740,7 +1740,7 @@ static void weaponcommon_d(DDukeActor* proj) s->xrepeat, s->yrepeat, 0, 0, 0, proj->GetOwner(), 5); if (spawned) { - spawned->s->cstat = 128; + spawned->s->cstat = CSTAT_SPRITE_YCENTER; spawned->s->pal = s->pal; } } @@ -2738,7 +2738,7 @@ static void heavyhbomb(DDukeActor *actor) auto sectp = s->sector(); int x, l; - if ((s->cstat & 32768)) + if ((s->cstat & CSTAT_SPRITE_INVISIBLE)) { t[2]--; if (t[2] <= 0) @@ -2752,8 +2752,8 @@ static void heavyhbomb(DDukeActor *actor) int p = findplayer(actor, &x); - if (x < 1220) s->cstat &= ~257; - else s->cstat |= 257; + if (x < 1220) s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + else s->cstat |= CSTAT_SPRITE_BLOCK_ALL; if (t[3] == 0) { diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index d0d93796c..b5636c3a4 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1434,7 +1434,7 @@ static void weaponcommon_r(DDukeActor *proj) if (x) { - x->s->cstat = 128; + x->s->cstat = CSTAT_SPRITE_YCENTER; x->s->pal = s->pal; } } @@ -2508,7 +2508,7 @@ static void heavyhbomb(DDukeActor *actor) int x, l; auto Owner = actor->GetOwner(); - if ((s->cstat & 32768)) + if ((s->cstat & CSTAT_SPRITE_INVISIBLE)) { t[2]--; if (t[2] <= 0) @@ -2522,8 +2522,8 @@ static void heavyhbomb(DDukeActor *actor) int p = findplayer(actor, &x); - if (x < 1220) s->cstat &= ~257; - else s->cstat |= 257; + if (x < 1220) s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + else s->cstat |= CSTAT_SPRITE_BLOCK_ALL; if (t[3] == 0) { diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 0bbd01bc0..240bd1a63 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -716,7 +716,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in t->ownerActor = nullptr; break; } - if ((Owner->cstat & 32768) == 0) + if ((Owner->cstat & CSTAT_SPRITE_INVISIBLE) == 0) { t->picnum = OwnerAc->dispicnum; t->pal = Owner->pal; diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 15f380e7b..14eb2ffd8 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -945,7 +945,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in t->ownerActor = nullptr; break; } - if ((Owner->cstat & 32768) == 0) + if ((Owner->cstat & CSTAT_SPRITE_INVISIBLE) == 0) { if (Owner->picnum == APLAYER) t->picnum = 1554; diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 6342c6ebd..e4431da46 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -447,7 +447,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int y1 = spry; tilenum = spr->picnum; xoff = tileLeftOffset(tilenum) + spr->xoffset; - if ((spr->cstat & 4) > 0) xoff = -xoff; + if ((spr->cstat & CSTAT_SPRITE_XFLIP) > 0) xoff = -xoff; k = spr->ang; l = spr->xrepeat; dax = bsin(k) * l; @@ -479,8 +479,8 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int tilenum = spr->picnum; xoff = tileLeftOffset(tilenum) + spr->xoffset; yoff = tileTopOffset(tilenum) + spr->yoffset; - if ((spr->cstat & 4) > 0) xoff = -xoff; - if ((spr->cstat & 8) > 0) yoff = -yoff; + if ((spr->cstat & CSTAT_SPRITE_XFLIP) > 0) xoff = -xoff; + if ((spr->cstat & CSTAT_SPRITE_YFLIP) > 0) yoff = -yoff; k = spr->ang; cosang = bcos(k); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index b112c7b2b..33f4d8828 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -3731,7 +3731,7 @@ void LoadActor(DDukeActor *actor, int p, int x) if (actor->s->xrepeat > 60) return; if (ud.respawn_monsters == 1 && actor->s->extra <= 0) return; } - else if (ud.respawn_items == 1 && (actor->s->cstat & 32768)) return; + else if (ud.respawn_items == 1 && (actor->s->cstat & CSTAT_SPRITE_INVISIBLE)) return; if (actor->timetosleep > 1) actor->timetosleep--; @@ -3839,7 +3839,7 @@ void execute(DDukeActor *actor,int p,int x) if (actor->s->xrepeat > 60) goto quit; if (ud.respawn_monsters == 1 && actor->s->extra <= 0) goto quit; } - else if (ud.respawn_items == 1 && (actor->s->cstat & 32768)) goto quit; + else if (ud.respawn_items == 1 && (actor->s->cstat & CSTAT_SPRITE_INVISIBLE)) goto quit; if (actor->timetosleep > 1) actor->timetosleep--; diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 95fd52efb..dfa690e80 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -566,9 +566,9 @@ void playerisdead(int snum, int psectlotag, int fz, int cz) S_StopSound(-1, actor, CHAN_VOICE); - if (s->pal != 1 && (s->cstat & 32768) == 0) s->cstat = 0; + if (s->pal != 1 && (s->cstat & CSTAT_SPRITE_INVISIBLE) == 0) s->cstat = 0; - if (ud.multimode > 1 && (s->pal != 1 || (s->cstat & 32768))) + if (ud.multimode > 1 && (s->pal != 1 || (s->cstat & CSTAT_SPRITE_INVISIBLE))) { if (p->frag_ps != snum) { diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 3472f2faf..e8c1d03a0 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -137,7 +137,7 @@ static void shootfireball(DDukeActor *actor, int p, int sx, int sy, int sz, int spr->yrepeat = 40; } spr->yvel = p; - spr->cstat = 128; + spr->cstat = CSTAT_SPRITE_YCENTER; spr->clipdist = 4; } } @@ -404,9 +404,9 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa } } - s->cstat &= ~257; + s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; hitscan({ sx, sy, sz }, sectp, { bcos(sa), bsin(sa), zvel << 6 }, hit, CLIPMASK1); - s->cstat |= 257; + s->cstat |= CSTAT_SPRITE_BLOCK_ALL; if (hit.hitSector == nullptr) return; @@ -664,7 +664,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, } } - spawned->s->cstat = 128; + spawned->s->cstat = CSTAT_SPRITE_YCENTER; spawned->s->clipdist = 4; sa = s->ang + 32 - (krand() & 63); @@ -834,7 +834,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i spj->yrepeat >>= 1; } - spj->cstat = 128; + spj->cstat = CSTAT_SPRITE_YCENTER; if (atwith == RPG) spj->clipdist = 4; else @@ -973,10 +973,10 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int //RESHOOTGROW: - s->cstat &= ~257; + s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; hitscan({ sx, sy, sz }, sect, { bcos(sa), bsin(sa), zvel << 6 }, hit, CLIPMASK1); - s->cstat |= 257; + s->cstat |= CSTAT_SPRITE_BLOCK_ALL; auto spark = EGS(sect, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, GROWSPARK, -16, 28, 28, sa, 0, 0, actor, 1); if (!spark) return; @@ -1180,7 +1180,7 @@ void shoot_d(DDukeActor* actor, int atwith) if (j) { - j->s->cstat = 128; + j->s->cstat = CSTAT_SPRITE_YCENTER; j->s->clipdist = 32; } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 2007f2bec..cf677ca43 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -260,7 +260,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa } } - s->cstat &= ~257; + s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; hitscan({ sx, sy, sz }, sectp, { bcos(sa), bsin(sa),zvel << 6 }, hit, CLIPMASK1); if (isRRRA() && hit.hitSector != nullptr && (((hit.hitSector->lotag == 160 && zvel > 0) || (hit.hitSector->lotag == 161 && zvel < 0)) @@ -289,7 +289,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa } } - s->cstat |= 257; + s->cstat |= CSTAT_SPRITE_BLOCK_ALL; if (hit.hitSector == nullptr) return; @@ -578,7 +578,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, auto j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4); if (!j) return; j->s->extra += (krand() & 7); - j->s->cstat = 128; + j->s->cstat = CSTAT_SPRITE_YCENTER; j->s->clipdist = 4; sa = s->ang + 32 - (krand() & 63); @@ -738,7 +738,7 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i spawned->s->yrepeat >>= 1; } - spawned->s->cstat = 128; + spawned->s->cstat = CSTAT_SPRITE_YCENTER; if (atwith == RPG || (atwith == RPG2 && isRRRA())) spawned->s->clipdist = 4; else @@ -813,7 +813,7 @@ static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, auto j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4); if (!j) return; j->s->extra += (krand() & 7); - j->s->cstat = 128; + j->s->cstat = CSTAT_SPRITE_YCENTER; j->s->clipdist = 4; sa = s->ang + 32 - (krand() & 63); diff --git a/source/games/duke/src/prediction.cpp b/source/games/duke/src/prediction.cpp index f4a8d61f6..63e6437ca 100644 --- a/source/games/duke/src/prediction.cpp +++ b/source/games/duke/src/prediction.cpp @@ -112,7 +112,7 @@ void fakedomovethings(void) p = &ps[myconnectindex]; backcstat = p->GetActor()->s.cstat; - p->GetActor()->s.cstat &= ~257; + p->GetActor()->s.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; actions = syn->actions; diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index 865aa7817..7a860209d 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -256,7 +256,7 @@ void cacheit_d(void) DukeSectIterator it(§); while (auto j = it.Next()) { - if (j->s->xrepeat != 0 && j->s->yrepeat != 0 && (j->s->cstat & 32768) == 0) + if (j->s->xrepeat != 0 && j->s->yrepeat != 0 && (j->s->cstat & CSTAT_SPRITE_INVISIBLE) == 0) cachespritenum(j->s); } } diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index cfaa04b7a..8ee87aa19 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -1095,7 +1095,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) case HEAVYHBOMB: if (targ->temp_data[0] == 0) { - s->cstat &= ~257; + s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; targ->temp_data[0] = 1; spawn(targ, BURNING); } @@ -1119,7 +1119,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) if (s->picnum == CACTUS) s->picnum = CACTUSBROKE; - s->cstat &= ~257; + s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; // else deletesprite(i); break; } @@ -1256,7 +1256,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) case TOILET: s->picnum = TOILETBROKE; s->cstat |= (krand() & 1) << 2; - s->cstat &= ~257; + s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; spawn(targ, TOILETWATER); S_PlayActorSound(GLASS_BREAKING, targ); break; @@ -1264,7 +1264,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) case STALL: s->picnum = STALLBROKE; s->cstat |= (krand() & 1) << 2; - s->cstat &= ~257; + s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; spawn(targ, TOILETWATER); S_PlayActorSound(GLASS_HEAVYBREAK, targ); break; diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 233fe7038..cd3ff2085 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -2146,7 +2146,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) case UWHIP: if (targ->temp_data[0] == 0) { - s->cstat &= ~257; + s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; targ->temp_data[0] = 1; spawn(targ, BURNING); } @@ -2178,7 +2178,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) if (s->picnum == CACTUS) s->picnum = CACTUSBROKE; - s->cstat &= ~257; + s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; // else deletesprite(i); break; } @@ -2282,7 +2282,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) case TOILET: s->picnum = TOILETBROKE; s->cstat |= (krand() & 1) << 2; - s->cstat &= ~257; + s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; spawn(targ, TOILETWATER); S_PlayActorSound(GLASS_BREAKING, targ); break; @@ -2290,7 +2290,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) case STALL: s->picnum = STALLBROKE; s->cstat |= (krand() & 1) << 2; - s->cstat &= ~257; + s->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; spawn(targ, TOILETWATER); S_PlayActorSound(GLASS_HEAVYBREAK, targ); break; diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 95e0a565b..b44da77e5 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -180,7 +180,7 @@ bool initspriteforspawn(DDukeActor* act, const std::initializer_list &exclu return false; } } - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; if (sp->pal && sp->picnum != TILE_ACCESSSWITCH && sp->picnum != TILE_ACCESSSWITCH2) sp->pal = 0; return false; @@ -189,7 +189,7 @@ bool initspriteforspawn(DDukeActor* act, const std::initializer_list &exclu if (sp->hitag) { ChangeActorStat(act, 12); - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; sp->extra = gs.impact_damage; return false; } @@ -599,7 +599,7 @@ int initreactor(DDukeActor* actj, DDukeActor* actor, bool isrecon) else sp->extra = gs.impact_damage; - sp->cstat |= 257; // Make it hitable + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; // Make it hitable if (ud.multimode < 2 && sp->pal != 0) { diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index d2fdc287f..f7ffc41ea 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -97,7 +97,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* { makeitfall(act); - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; ps[connecthead].max_actors_killed++; if (spj) { @@ -182,11 +182,11 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* case NEON6: case DOMELITE: if (sp->picnum != WATERSPLASH2) - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; [[fallthrough]]; case NUKEBUTTON: if (sp->picnum == DOMELITE) - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; [[fallthrough]]; case JIBS1: case JIBS2: @@ -214,7 +214,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* ChangeActorStat(act, 4); break; case NATURALLIGHTNING: - sp->cstat &= ~257; + sp->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; sp->cstat |= CSTAT_SPRITE_INVISIBLE; break; case TRANSPORTERSTAR: @@ -353,7 +353,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* if (sp->picnum == SPACEMARINE) { sp->extra = 20; - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; } ChangeActorStat(act, 2); break; @@ -424,14 +424,14 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* case PIPE5: case PIPE6: sp->clipdist = 32; - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; [[fallthrough]]; case OCEANSPRITE4: ChangeActorStat(act, 0); break; case FEMMAG1: case FEMMAG2: - sp->cstat &= ~257; + sp->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; ChangeActorStat(act, 0); break; case DUKETAG: @@ -503,7 +503,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* } else { - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; sp->clipdist = 32; } @@ -537,7 +537,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* } else { - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; sp->clipdist = 128; } [[fallthrough]]; @@ -779,7 +779,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* case DUCK: case LETTER: sp->extra = 1; - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; ChangeActorStat(act, 1); break; case OCTABRAINSTAYPUT: @@ -890,7 +890,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* } else { - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; if (sp->picnum != SHARK) ps[myconnectindex].max_actors_killed++; @@ -1178,7 +1178,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* case TOILET: case STALL: sp->lotag = 1; - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; sp->clipdist = 8; act->SetOwner(act); break; diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 6528a8b4e..b71edbd5a 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -73,7 +73,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* sp->xrepeat = 64; sp->yrepeat = 64; sp->extra = sp->lotag; - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; ChangeActorStat(act, 116); break; case PIG + 11: @@ -91,7 +91,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* sp->xrepeat = 32; sp->yrepeat = 32; sp->extra = 0; - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; sp->hitag = 0; ChangeActorStat(act, 117); break; @@ -234,9 +234,9 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case NEON6: case DOMELITE: if (sp->picnum != WATERSPLASH2) - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; if (sp->picnum == DOMELITE) - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; [[fallthrough]]; case JIBS1: case JIBS2: @@ -415,12 +415,12 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case PIPE5: case PIPE6: sp->clipdist = 32; - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; ChangeActorStat(act, 0); break; case FEMMAG1: case FEMMAG2: - sp->cstat &= ~257; + sp->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; ChangeActorStat(act, 0); break; @@ -453,7 +453,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* } else { - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; sp->clipdist = 32; } ChangeActorStat(act, 2); @@ -561,7 +561,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* } else { - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; sp->clipdist = 128; } [[fallthrough]]; @@ -1045,7 +1045,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* } else { - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; if (sp->picnum != 5501) if (actorfella(act)) @@ -1447,7 +1447,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case RRTILE2121: case RRTILE2122: sp->lotag = 1; - sp->cstat |= 257; + sp->cstat |= CSTAT_SPRITE_BLOCK_ALL; sp->clipdist = 8; act->SetOwner(act); break; diff --git a/source/games/exhumed/src/spider.cpp b/source/games/exhumed/src/spider.cpp index 6f91505bc..1d9fef881 100644 --- a/source/games/exhumed/src/spider.cpp +++ b/source/games/exhumed/src/spider.cpp @@ -104,7 +104,7 @@ void AISpider::Tick(RunListEvent* ev) if (spp->nHealth) { - if (sp->cstat & 8) + if (sp->cstat & CSTAT_SPRITE_YFLIP) { sp->z = sp->sector()->ceilingz + GetActorHeight(spp); } @@ -180,7 +180,7 @@ void AISpider::Tick(RunListEvent* ev) case_3: auto pSector =sp->sector(); - if (sp->cstat & 8) + if (sp->cstat & CSTAT_SPRITE_YFLIP) { sp->zvel = 0; sp->z = pSector->ceilingz + (tileHeight(sp->picnum) << 5); @@ -212,7 +212,7 @@ void AISpider::Tick(RunListEvent* ev) if (spp->nAction == 1 && RandomBit()) { - if (sp->cstat & 8) + if (sp->cstat & CSTAT_SPRITE_YFLIP) { sp->cstat ^= 8; sp->zvel = 1; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index bc10064f3..70647de07 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -1760,7 +1760,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int y1 = spry; tilenum = spr->picnum; xoff = (int)tileLeftOffset(tilenum) + (int)spr->xoffset; - if ((spr->cstat & 4) > 0) + if ((spr->cstat & CSTAT_SPRITE_XFLIP) > 0) xoff = -xoff; k = spr->ang; l = spr->xrepeat; @@ -1793,9 +1793,9 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int tilenum = spr->picnum; xoff = (int)tileLeftOffset(tilenum) + (int)spr->xoffset; yoff = (int)tileTopOffset(tilenum) + (int)spr->yoffset; - if ((spr->cstat & 4) > 0) + if ((spr->cstat & CSTAT_SPRITE_XFLIP) > 0) xoff = -xoff; - if ((spr->cstat & 8) > 0) + if ((spr->cstat & CSTAT_SPRITE_YFLIP) > 0) yoff = -yoff; k = spr->ang; diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 207d85adb..5b3e2d374 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -4481,16 +4481,16 @@ void getzrangepoint(int x, int y, int z, sectortype* sect, daz = spr->z; // Only check if sprite's 2-sided or your on the 1-sided side - if (((cstat & 64) != 0) && ((z > daz) == ((cstat & 8) == 0))) + if (((cstat & 64) != 0) && ((z > daz) == ((cstat & CSTAT_SPRITE_YFLIP) == 0))) continue; // Calculate and store centering offset information into xoff&yoff tilenum = spr->picnum; xoff = (int)tileLeftOffset(tilenum) + (int)spr->xoffset; yoff = (int)tileTopOffset(tilenum) + (int)spr->yoffset; - if (cstat & 4) + if (cstat & CSTAT_SPRITE_XFLIP) xoff = -xoff; - if (cstat & 8) + if (cstat & CSTAT_SPRITE_YFLIP) yoff = -yoff; // Calculate all 4 points of the floor sprite.