diff --git a/source/games/blood/src/_polymost.cpp b/source/games/blood/src/_polymost.cpp index e8faaa20c..027a395d9 100644 --- a/source/games/blood/src/_polymost.cpp +++ b/source/games/blood/src/_polymost.cpp @@ -260,7 +260,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int ESpriteFlags bakCstat = 0; if (viewPlayer >= 0) { - bakCstat = ESpriteFlags::FromInt(gPlayer[viewPlayer].pSprite->cstat); + bakCstat = gPlayer[viewPlayer].pSprite->cstat; if (gViewPos == 0) { gPlayer[viewPlayer].pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; @@ -292,7 +292,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int ESpriteFlags bakCstat = 0; if (viewPlayer >= 0) { - bakCstat = ESpriteFlags::FromInt(gPlayer[viewPlayer].pSprite->cstat); + bakCstat = gPlayer[viewPlayer].pSprite->cstat; if (gViewPos == 0) { gPlayer[viewPlayer].pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index f0c84993f..32e484a56 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -5303,7 +5303,7 @@ int MoveMissile(DBloodActor* actor) if (Owner && Owner->IsDudeActor()) { pOwner = &Owner->s(); - bakCstat = ESpriteFlags::FromInt(pOwner->cstat); + bakCstat = pOwner->cstat; pOwner->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; } gHitInfo.clearObj(); diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index f2cd3bea1..75ec06cb1 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -526,7 +526,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect pSprite->x = LittleLong(load.x); pSprite->y = LittleLong(load.y); pSprite->z = LittleLong(load.z); - pSprite->cstat = LittleShort(load.cstat); + pSprite->cstat = ESpriteFlags::FromInt(LittleShort(load.cstat)); pSprite->picnum = LittleShort(load.picnum); int secno = LittleShort(load.sectnum); pSprite->statnum = LittleShort(load.statnum); diff --git a/source/games/blood/src/db.h b/source/games/blood/src/db.h index 4fa6f62a5..1dd808c8a 100644 --- a/source/games/blood/src/db.h +++ b/source/games/blood/src/db.h @@ -86,7 +86,7 @@ extern const char *gWeaponText[]; template void GetSpriteExtents(T const * const pSprite, int *top, int *bottom) { *top = *bottom = pSprite->z; - if ((pSprite->cstat & 0x30) != 0x20) + if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR) { int height = tileHeight(pSprite->picnum); int center = height / 2 + tileTopOffset(pSprite->picnum); diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 50ca8b80e..343c0ab3e 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -2809,8 +2809,8 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe auto old = pSprite->cstat; // set new cstat - if ((pSource->flags & kModernTypeFlag1)) pSprite->cstat |= pXSource->data4; // relative - else pSprite->cstat = pXSource->data4 & 0xffff; // absolute + if ((pSource->flags & kModernTypeFlag1)) pSprite->cstat |= ESpriteFlags::FromInt(pXSource->data4); // relative + else pSprite->cstat = ESpriteFlags::FromInt(pXSource->data4 & 0xffff); // absolute // and handle exceptions if ((old & CSTAT_SPRITE_BLOOD_BIT1)) pSprite->cstat |= CSTAT_SPRITE_BLOOD_BIT1; //kSpritePushable @@ -3805,8 +3805,8 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH case 25: return condCmp(pObj->picnum, arg1, arg2, cmpOp); case 26: return condCmp(pObj->pal, arg1, arg2, cmpOp); case 27: return condCmp(pObj->shade, arg1, arg2, cmpOp); - case 28: return (pObj->cstat & arg1); - case 29: return (pObj->hitag & arg1); + case 28: return (pObj->cstat & ESpriteFlags::FromInt(arg1)); + case 29: return (pObj->flags & arg1); case 30: return condCmp(pObj->xrepeat, arg1, arg2, cmpOp); case 31: return condCmp(pObj->xoffset, arg1, arg2, cmpOp); case 32: return condCmp(pObj->yrepeat, arg1, arg2, cmpOp); diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index b68f68e1f..b4f2ab1c3 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -43,7 +43,7 @@ int getlabelvalue(const char* text); static int ccmd_spawn(CCmdFuncPtr parm) { int x = 0, y = 0, z = 0; - int16_t cstat = 0; + ESpriteFlags cstat = 0; int picnum = 0; unsigned int pal = 0; int ang = 0; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 3e5fea42f..e374ddbc8 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -210,7 +210,7 @@ int DoShadowFindGroundPoint(tspriteptr_t sp) SPRITEp hsp; Collision ceilhit, florhit; int hiz, loz = u->loz; - int save_cstat, bak_cstat; + ESpriteFlags save_cstat, bak_cstat; // recursive routine to find the ground - either sector or floor sprite // skips over enemy and other types of sprites @@ -968,7 +968,7 @@ void CircleCamera(int *nx, int *ny, int *nz, sectortype** vsect, binangle *nang, SPRITEp sp; HitInfo hit{}; int i, vx, vy, vz, hx, hy; - int bakcstat, daang; + int daang; PLAYERp pp = &Player[screenpeek]; binangle ang; @@ -987,7 +987,7 @@ void CircleCamera(int *nx, int *ny, int *nz, sectortype** vsect, binangle *nang, // Player sprite of current view sp = &pp->Actor()->s(); - bakcstat = sp->cstat; + auto bakcstat = sp->cstat; RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); // Make sure sector passed to hitscan is correct @@ -1027,12 +1027,11 @@ void CircleCamera(int *nx, int *ny, int *nz, sectortype** vsect, binangle *nang, else { SPRITEp hsp = &hit.actor()->s(); - int flag_backup; // if you hit a sprite that's not a wall sprite - try again if (!TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) { - flag_backup = hsp->cstat; + auto flag_backup = hsp->cstat; RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); CircleCamera(nx, ny, nz, vsect, nang, q16horiz); diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index f8c019616..0c8609d48 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -868,7 +868,7 @@ void JAnalyzeSprites(tspriteptr_t tspr) { // Turn on voxels tspr->picnum = aVoxelArray[tspr->picnum].Voxel; // Get the voxel number - tspr->cstat |= 48; // Set stat to voxelize sprite + tspr->cstat |= CSTAT_SPRITE_ALIGNMENT_SLAB; // Set stat to voxelize sprite } } else @@ -887,7 +887,7 @@ void JAnalyzeSprites(tspriteptr_t tspr) { // Turn on voxels tspr->picnum = aVoxelArray[tspr->picnum].Voxel; // Get the voxel number - tspr->cstat |= 48; // Set stat to voxelize sprite + tspr->cstat |= CSTAT_SPRITE_ALIGNMENT_SLAB; // Set stat to voxelize sprite } break; } diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 87a4189b7..cd3997b7a 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1859,14 +1859,13 @@ void UpdatePlayerSprite(PLAYERp pp) void DoPlayerZrange(PLAYERp pp) { Collision ceilhit, florhit; - short bakcstat; if (!pp->Actor()) return; // Don't let you fall if you're just slightly over a cliff // This function returns the highest and lowest z's // for an entire box, NOT just a point. -Useful for clipping auto sp = &pp->Actor()->s(); - bakcstat = sp->cstat; + auto bakcstat = sp->cstat; RESET(sp->cstat, CSTAT_SPRITE_BLOCK); vec3_t pos = pp->pos; pos.z += Z(8); @@ -2011,7 +2010,6 @@ void DoPlayerMove(PLAYERp pp) auto sp = &pp->Actor()->s(); USERp u = pp->Actor()->u(); int friction; - int save_cstat; int push_ret = 0; // If SO interpolation is disabled, make sure the player's aiming, @@ -2114,7 +2112,7 @@ void DoPlayerMove(PLAYERp pp) pp->oposy = pp->posy; } - save_cstat = sp->cstat; + auto save_cstat = sp->cstat; RESET(sp->cstat, CSTAT_SPRITE_BLOCK); Collision coll; updatesector(pp->posx, pp->posy, &pp->cursector); @@ -2561,7 +2559,6 @@ void DoPlayerMoveVehicle(PLAYERp pp) SPRITEp sp = &actor->s(); auto psp = &pp->Actor()->s(); USERp u = actor->u(); - int save_cstat; int x[4], y[4], ox[4], oy[4]; int wallcount; int count=0; @@ -2660,7 +2657,7 @@ void DoPlayerMoveVehicle(PLAYERp pp) int vel; int ret; - save_cstat = psp->cstat; + auto save_cstat = psp->cstat; RESET(psp->cstat, CSTAT_SPRITE_BLOCK); DoPlayerTurnVehicleRect(pp, x, y, ox, oy); @@ -2715,7 +2712,7 @@ void DoPlayerMoveVehicle(PLAYERp pp) DoPlayerTurnVehicle(pp, pp->input.avel, z, floor_dist); } - save_cstat = psp->cstat; + auto save_cstat = psp->cstat; RESET(psp->cstat, CSTAT_SPRITE_BLOCK); if (pp->sop->clipdist) { diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 9052a88ef..78e4946e7 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -3606,7 +3606,8 @@ int ActorCoughItem(DSWActor* actor) ASSERT(sp->insector()); actorNew = insertActor(sp->sector(), STAT_SPAWN_ITEMS); np = &actorNew->s(); - np->cstat = np->extra = 0; + np->cstat = 0; + np->extra = 0; np->x = sp->x; np->y = sp->y; np->z = SPRITEp_MID(sp); @@ -3647,7 +3648,8 @@ int ActorCoughItem(DSWActor* actor) ASSERT(sp->insector()); actorNew = insertActor(sp->sector(), STAT_SPAWN_ITEMS); np = &actorNew->s(); - np->cstat = np->extra = 0; + np->cstat = 0; + np->extra = 0; np->x = sp->x; np->y = sp->y; np->z = SPRITEp_MID(sp); @@ -3675,7 +3677,8 @@ int ActorCoughItem(DSWActor* actor) ASSERT(sp->insector()); actorNew = insertActor(sp->sector(), STAT_SPAWN_ITEMS); np = &actorNew->s(); - np->cstat = np->extra = 0; + np->cstat = 0; + np->extra = 0; np->x = sp->x; np->y = sp->y; np->z = SPRITEp_MID(sp); @@ -3769,7 +3772,8 @@ int ActorCoughItem(DSWActor* actor) ASSERT(sp->insector()); actorNew = insertActor(sp->sector(), STAT_SPAWN_ITEMS); np = &actorNew->s(); - np->cstat = np->extra = 0; + np->cstat = 0; + np->extra = 0; np->x = sp->x; np->y = sp->y; np->z = SPRITEp_MID(sp); @@ -3827,7 +3831,8 @@ int ActorCoughItem(DSWActor* actor) ASSERT(sp->insector()); actorNew = insertActor(sp->sector(), STAT_SPAWN_ITEMS); np = &actorNew->s(); - np->cstat = np->extra = 0; + np->cstat = 0; + np->extra = 0; np->x = sp->x; np->y = sp->y; np->z = SPRITEp_LOWER(sp)+Z(10); @@ -4576,14 +4581,13 @@ void DoActorZrange(DSWActor* actor) USERp u = actor->u(), wu; SPRITEp sp = &actor->s(), wp; Collision ceilhit, florhit; - short save_cstat; - save_cstat = TEST(sp->cstat, CSTAT_SPRITE_BLOCK); + auto save_cstat = sp->cstat & CSTAT_SPRITE_BLOCK; RESET(sp->cstat, CSTAT_SPRITE_BLOCK); vec3_t pos = sp->pos; pos.z -= DIV2(SPRITEp_SIZE_Z(sp)); FAFgetzrange(pos, sp->sector(), &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_ACTOR); - SET(sp->cstat, save_cstat); + sp->cstat |= save_cstat; u->lo_sectp = u->hi_sectp = nullptr; u->highActor = nullptr; @@ -4659,10 +4663,9 @@ bool ActorDrop(DSWActor* actor, int x, int y, int z, sectortype* new_sector, sho SPRITEp sp = &actor->s(); int hiz, loz; Collision ceilhit, florhit; - short save_cstat; // look only at the center point for a floor sprite - save_cstat = TEST(sp->cstat, CSTAT_SPRITE_BLOCK); + auto save_cstat = TEST(sp->cstat, CSTAT_SPRITE_BLOCK); RESET(sp->cstat, CSTAT_SPRITE_BLOCK); FAFgetzrangepoint(x, y, z - DIV2(SPRITEp_SIZE_Z(sp)), new_sector, &hiz, &ceilhit, &loz, &florhit); SET(sp->cstat, save_cstat); @@ -5172,7 +5175,6 @@ int DoGet(DSWActor* actor) short pnum, key_num; int dist, a,b,c; bool can_see; - int cstat_bak; // For flag stuff USERp nu; @@ -5223,7 +5225,7 @@ int DoGet(DSWActor* actor) continue; } - cstat_bak = sp->cstat; + auto cstat_bak = sp->cstat; SET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); can_see = FAFcansee(sp->x, sp->y, sp->z, sp->sector(), pp->posx, pp->posy, pp->posz, pp->cursector); @@ -6470,7 +6472,7 @@ Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, in // Set the blocking bit to 0 temporarly so FAFgetzrange doesn't pick // up its own sprite - tempshort = spr->cstat; + auto tempstat = spr->cstat; spr->cstat = 0; // I subtracted 8 from the clipdist because actors kept going up on @@ -6482,7 +6484,7 @@ Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, in &globhiz, &globhihit, &globloz, &globlohit, (((int) spr->clipdist) << 2) - GETZRANGE_CLIP_ADJ, cliptype); - spr->cstat = tempshort; + spr->cstat = tempstat; // !AIC - puts getzrange results into USER varaible u->loz, u->hiz, u->lo_sectp, u->hi_sectp, etc. // Takes info from global variables @@ -6611,11 +6613,10 @@ int MissileZrange(DSWActor* actor) { USERp u = actor->u(); SPRITEp sp = &actor->s(); - short tempshort; // Set the blocking bit to 0 temporarly so FAFgetzrange doesn't pick // up its own sprite - tempshort = sp->cstat; + auto tempshort = sp->cstat; RESET(sp->cstat, CSTAT_SPRITE_BLOCK); FAFgetzrangepoint(sp->x, sp->y, sp->z - 1, sp->sector(), @@ -6634,7 +6635,6 @@ Collision move_missile(DSWActor* actor, int xchange, int ychange, int zchange, i SPRITEp sp = &actor->s(); Collision retval{}; int zh; - int tempshort; ASSERT(actor->hasU()); @@ -6673,7 +6673,7 @@ Collision move_missile(DSWActor* actor, int xchange, int ychange, int zchange, i // Set the blocking bit to 0 temporarly so FAFgetzrange doesn't pick // up its own sprite - tempshort = sp->cstat; + auto tempshort = sp->cstat; RESET(sp->cstat, CSTAT_SPRITE_BLOCK); FAFgetzrangepoint(sp->x, sp->y, sp->z - 1, sp->sector(), diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 49338f8a6..4ab6171c5 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -317,7 +317,8 @@ DSWActor* TrackClonePoint(DSWActor* actor) np = &actorNew->s(); - np->cstat = np->extra = 0; + np->cstat = 0; + np->extra = 0; np->x = sp->x; np->y = sp->y; np->z = sp->z; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 19f2b105f..3d44433fc 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -8208,7 +8208,7 @@ int DoPlasmaFountain(DSWActor* actor) { u->WaitTics = 0; - bak_cstat = sp->cstat; + auto bak_cstat = sp->cstat; RESET(sp->cstat, CSTAT_SPRITE_BLOCK); sp->cstat = bak_cstat; @@ -8247,7 +8247,7 @@ int DoPlasma(DSWActor* actor) if (TEST(hsp->cstat, CSTAT_SPRITE_BLOCK) && !TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) { - short hcstat = hsp->cstat; + auto hcstat = hsp->cstat; if (hu && hitActor != u->WpnGoalActor) { @@ -9532,7 +9532,7 @@ int DoRail(DSWActor* actor) if (hs->extra & SPRX_PLAYER_OR_ENEMY) { - short cstat_save = hs->cstat; + auto cstat_save = hs->cstat; RESET(hs->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN|CSTAT_SPRITE_BLOCK_MISSILE); DoRail(actor); @@ -11178,13 +11178,11 @@ int DoFindGround(DSWActor* actor) SPRITEp sp = &actor->s(), hsp; USERp u = actor->u(); Collision ceilhit, florhit; - short save_cstat; - short bak_cstat; // recursive routine to find the ground - either sector or floor sprite // skips over enemy and other types of sprites - save_cstat = sp->cstat; + auto save_cstat = sp->cstat; RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); FAFgetzrange(sp->pos, sp->sector(), &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER); sp->cstat = save_cstat; @@ -11207,7 +11205,7 @@ int DoFindGround(DSWActor* actor) { // reset the blocking bit of what you hit and try again - // recursive - bak_cstat = hsp->cstat; + auto bak_cstat = hsp->cstat; RESET(hsp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); DoFindGround(actor); hsp->cstat = bak_cstat; @@ -11235,13 +11233,11 @@ int DoFindGroundPoint(DSWActor* actor) SPRITEp sp = &actor->s(), hsp; USERp u = actor->u(); Collision ceilhit, florhit; - short save_cstat; - short bak_cstat; // recursive routine to find the ground - either sector or floor sprite // skips over enemy and other types of sprites - save_cstat = sp->cstat; + auto save_cstat = sp->cstat; RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); FAFgetzrangepoint(sp->x, sp->y, sp->z, sp->sector(), &u->hiz, &ceilhit, &u->loz, &florhit); sp->cstat = save_cstat; @@ -11264,7 +11260,7 @@ int DoFindGroundPoint(DSWActor* actor) { // reset the blocking bit of what you hit and try again - // recursive - bak_cstat = hsp->cstat; + auto bak_cstat = hsp->cstat; RESET(hsp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); DoFindGroundPoint(actor); hsp->cstat = bak_cstat; @@ -11327,7 +11323,7 @@ int DoNapalm(DSWActor* actor) if (TEST(hsp->cstat, CSTAT_SPRITE_BLOCK) && !TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) { - short hcstat = hsp->cstat; + auto hcstat = hsp->cstat; sp->x = ox; sp->y = oy; @@ -11509,7 +11505,7 @@ int DoSerpMeteor(DSWActor* actor) if (hu && hu->ID >= SKULL_R0 && hu->ID <= SKULL_SERP) { - short hcstat = hsp->cstat; + auto hcstat = hsp->cstat; sp->x = ox; sp->y = oy; @@ -16134,7 +16130,7 @@ int InitUzi(PLAYERp pp) HitInfo hit{}; int daz, nz; int xvect,yvect,zvect; - short cstat = 0; + ESpriteFlags cstat = 0; uint8_t pal = 0; //static char alternate=0; static int uziclock=0;