From 48b0058d3815868961e4557e615a8d3b974f66c9 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 29 Dec 2021 16:53:36 +1100 Subject: [PATCH] - SW: Replace `TEST\(([\w\-\>.()]+),\s?(\w+)\)` with `($1 & $2)`. --- source/games/sw/src/actor.cpp | 8 +- source/games/sw/src/ai.cpp | 18 +-- source/games/sw/src/break.cpp | 16 +-- source/games/sw/src/bunny.cpp | 2 +- source/games/sw/src/cache.cpp | 8 +- source/games/sw/src/coolie.cpp | 2 +- source/games/sw/src/copysect.cpp | 2 +- source/games/sw/src/d_menu.cpp | 2 +- source/games/sw/src/draw.cpp | 28 ++-- source/games/sw/src/input.cpp | 8 +- source/games/sw/src/inv.cpp | 4 +- source/games/sw/src/jweapon.cpp | 14 +- source/games/sw/src/light.cpp | 2 +- source/games/sw/src/light.h | 2 +- source/games/sw/src/morph.cpp | 12 +- source/games/sw/src/panel.cpp | 48 +++---- source/games/sw/src/player.cpp | 100 +++++++------- source/games/sw/src/ripper.cpp | 2 +- source/games/sw/src/ripper2.cpp | 2 +- source/games/sw/src/rooms.cpp | 16 +-- source/games/sw/src/sector.cpp | 20 +-- source/games/sw/src/slidor.cpp | 2 +- source/games/sw/src/spike.cpp | 4 +- source/games/sw/src/sprite.cpp | 52 +++---- source/games/sw/src/track.cpp | 78 +++++------ source/games/sw/src/vator.cpp | 4 +- source/games/sw/src/wallmove.cpp | 4 +- source/games/sw/src/weapon.cpp | 224 +++++++++++++++---------------- source/games/sw/src/zombie.cpp | 6 +- 29 files changed, 345 insertions(+), 345 deletions(-) diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index 92dd41988..4ba5636e2 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -316,7 +316,7 @@ int DoActorSectorDamage(DSWActor* actor) if (sectp->hasU() && sectp->damage) { - if (TEST(sectp->flags, SECTFU_DAMAGE_ABOVE_SECTOR)) + if ((sectp->flags & SECTFU_DAMAGE_ABOVE_SECTOR)) { if ((actor->user.DamageTics -= synctics) < 0) { @@ -405,9 +405,9 @@ int DoActorDebris(DSWActor* actor) break; } - if (TEST(sectp->extra, SECTFX_SINK)) + if ((sectp->extra & SECTFX_SINK)) { - if (TEST(sectp->extra, SECTFX_CURRENT)) + if ((sectp->extra & SECTFX_CURRENT)) { DoDebrisCurrent(actor); } @@ -503,7 +503,7 @@ void KeepActorOnFloor(DSWActor* actor) else depth = 0; - if (TEST(sectp->extra, SECTFX_SINK) && + if ((sectp->extra & SECTFX_SINK) && depth > 35 && actor->user.ActorActionSet && actor->user.ActorActionSet->Swim) { diff --git a/source/games/sw/src/ai.cpp b/source/games/sw/src/ai.cpp index 8219ac3d3..56b31a0d8 100644 --- a/source/games/sw/src/ai.cpp +++ b/source/games/sw/src/ai.cpp @@ -365,7 +365,7 @@ int DoActorPickClosePlayer(DSWActor* actor) TARGETACTOR: // this is only for Zombies right now // zombie target other actors - if (!found && TEST(actor->user.Flags2, SPR2_DONT_TARGET_OWNER)) + if (!found && (actor->user.Flags2 & SPR2_DONT_TARGET_OWNER)) { near_dist = MAX_ACTIVE_RANGE; SWStatIterator it(STAT_ENEMY); @@ -539,7 +539,7 @@ ANIMATORp DoActorActionDecide(DSWActor* actor) if ((dist < CloseRangeDist(actor, actor->user.targetActor) && ICanSee) || (pActor && pActor->hasU() && pActor->user.WeaponNum == WPN_FIST && actor->user.ID != RIPPER2_RUN_R0 && actor->user.ID != RIPPER_RUN_R0)) { - if ((actor->user.ID == COOLG_RUN_R0 && TEST(actor->spr.cstat, CSTAT_SPRITE_TRANSLUCENT)) || TEST(actor->spr.cstat, CSTAT_SPRITE_INVISIBLE)) + if ((actor->user.ID == COOLG_RUN_R0 && (actor->spr.cstat & CSTAT_SPRITE_TRANSLUCENT)) || (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) action = ChooseAction(actor->user.Personality->Evasive); else action = ChooseAction(actor->user.Personality->CloseRange); @@ -548,7 +548,7 @@ ANIMATORp DoActorActionDecide(DSWActor* actor) } // if player is facing me and I'm being attacked - if (Facing(actor, actor->user.targetActor) && TEST(actor->user.Flags, SPR_ATTACKED) && ICanSee) + if (Facing(actor, actor->user.targetActor) && (actor->user.Flags & SPR_ATTACKED) && ICanSee) { // if I'm a target - at least one missile comming at me if (actor->user.Flags & (SPR_TARGETED)) @@ -561,7 +561,7 @@ ANIMATORp DoActorActionDecide(DSWActor* actor) action = InitActorDuck; else { - if ((actor->user.ID == COOLG_RUN_R0 && TEST(actor->spr.cstat, CSTAT_SPRITE_TRANSLUCENT)) || TEST(actor->spr.cstat, CSTAT_SPRITE_INVISIBLE)) + if ((actor->user.ID == COOLG_RUN_R0 && (actor->spr.cstat & CSTAT_SPRITE_TRANSLUCENT)) || (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) action = ChooseAction(actor->user.Personality->Evasive); else action = ChooseAction(actor->user.Personality->Battle); @@ -573,7 +573,7 @@ ANIMATORp DoActorActionDecide(DSWActor* actor) // fighting else { - if ((actor->user.ID == COOLG_RUN_R0 && TEST(actor->spr.cstat, CSTAT_SPRITE_TRANSLUCENT)) || TEST(actor->spr.cstat, CSTAT_SPRITE_INVISIBLE)) + if ((actor->user.ID == COOLG_RUN_R0 && (actor->spr.cstat & CSTAT_SPRITE_TRANSLUCENT)) || (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) action = ChooseAction(actor->user.Personality->Evasive); else action = ChooseAction(actor->user.Personality->Battle); @@ -585,7 +585,7 @@ ANIMATORp DoActorActionDecide(DSWActor* actor) // if player is NOT facing me he is running or unaware of actor else if (ICanSee) { - if ((actor->user.ID == COOLG_RUN_R0 && TEST(actor->spr.cstat, CSTAT_SPRITE_TRANSLUCENT)) || TEST(actor->spr.cstat, CSTAT_SPRITE_INVISIBLE)) + if ((actor->user.ID == COOLG_RUN_R0 && (actor->spr.cstat & CSTAT_SPRITE_TRANSLUCENT)) || (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) action = ChooseAction(actor->user.Personality->Evasive); else action = ChooseAction(actor->user.Personality->Offense); @@ -1093,7 +1093,7 @@ int InitActorAttack(DSWActor* actor) return 0; } - if (TEST(actor->user.targetActor->spr.cstat, CSTAT_SPRITE_TRANSLUCENT)) + if ((actor->user.targetActor->spr.cstat & CSTAT_SPRITE_TRANSLUCENT)) { InitActorRunAway(actor); return 0; @@ -1115,7 +1115,7 @@ int InitActorAttack(DSWActor* actor) // if the guy you are after is dead, look for another and // reposition if (actor->user.targetActor->hasU() && actor->user.targetActor->user.PlayerP && - TEST(actor->user.targetActor->user.PlayerP->Flags, PF_DEAD)) + (actor->user.targetActor->user.PlayerP->Flags & PF_DEAD)) { DoActorPickClosePlayer(actor); InitActorReposition(actor); @@ -1567,7 +1567,7 @@ int InitActorReposition(DSWActor* actor) rnum = RANDOM_P2(8<<8)>>8; dist = Distance(actor->spr.pos.X, actor->spr.pos.Y, actor->user.targetActor->spr.pos.X, actor->user.targetActor->spr.pos.Y); - if (dist < PlayerDist[rnum] || TEST(actor->user.Flags, SPR_RUN_AWAY)) + if (dist < PlayerDist[rnum] || (actor->user.Flags & SPR_RUN_AWAY)) { rnum = RANDOM_P2(8<<8)>>8; ang = FindNewAngle(actor, AWAY, AwayDist[rnum]); diff --git a/source/games/sw/src/break.cpp b/source/games/sw/src/break.cpp index 03a37688d..28bbc91e9 100644 --- a/source/games/sw/src/break.cpp +++ b/source/games/sw/src/break.cpp @@ -477,7 +477,7 @@ BREAK_INFOp SetupWallForBreak(WALLp wallp) wallp->extra |= (WALLFX_DONT_STICK); } - if (wallp->overpicnum > 0 && TEST(wallp->cstat, CSTAT_WALL_MASKED)) + if (wallp->overpicnum > 0 && (wallp->cstat & CSTAT_WALL_MASKED)) { break_info = FindWallBreakInfo(wallp->overpicnum); if (break_info) @@ -504,7 +504,7 @@ BREAK_INFOp SetupSpriteForBreak(DSWActor* actor) { // use certain sprites own blocking for determination - if (TEST(break_info->flags, BF_OVERRIDE_BLOCK)) + if ((break_info->flags & BF_OVERRIDE_BLOCK)) { // if not blocking then skip this code if (!(actor->spr.cstat & CSTAT_SPRITE_BLOCK)) @@ -513,7 +513,7 @@ BREAK_INFOp SetupSpriteForBreak(DSWActor* actor) } } - if (TEST(break_info->flags, BF_BURN)) + if ((break_info->flags & BF_BURN)) actor->spr.extra |= (SPRX_BURNABLE); else actor->spr.extra |= (SPRX_BREAKABLE); @@ -563,13 +563,13 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, int ang, int typ if (nwp->lotag == TAG_WALL_BREAK && nwp->overpicnum > 0 && - TEST(nwp->cstat, CSTAT_WALL_MASKED)) + (nwp->cstat & CSTAT_WALL_MASKED)) { nwp->lotag = 0; } } - if (wallp->overpicnum > 0 && TEST(wallp->cstat, CSTAT_WALL_MASKED)) + if (wallp->overpicnum > 0 && (wallp->cstat & CSTAT_WALL_MASKED)) break_info = FindWallBreakInfo(wallp->overpicnum); else break_info = FindWallBreakInfo(wallp->picnum); @@ -598,7 +598,7 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, int ang, int typ } // change the wall - if (wallp->overpicnum > 0 && TEST(wallp->cstat, CSTAT_WALL_MASKED)) + if (wallp->overpicnum > 0 && (wallp->cstat & CSTAT_WALL_MASKED)) { if (break_info->breaknum == -1) { @@ -947,9 +947,9 @@ int AutoBreakSprite(DSWActor* breakActor, int type) SpawnShrap(breakActor, nullptr, -1, break_info); // kill it or change the pic - if (TEST(break_info->flags, BF_KILL) || break_info->breaknum == -1) + if ((break_info->flags & BF_KILL) || break_info->breaknum == -1) { - if (TEST(break_info->flags, BF_FIRE_FALL)) + if ((break_info->flags & BF_FIRE_FALL)) SpawnBreakFlames(breakActor); breakActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); diff --git a/source/games/sw/src/bunny.cpp b/source/games/sw/src/bunny.cpp index 65480d117..ac36816bb 100644 --- a/source/games/sw/src/bunny.cpp +++ b/source/games/sw/src/bunny.cpp @@ -979,7 +979,7 @@ int DoBunnyQuickJump(DSWActor* actor) if (hitActor->user.ShellNum <= 0 && hitActor->user.WaitTics <= 0 && actor->user.WaitTics <= 0) { - if (TEST(hitActor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((hitActor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { PLAYERp pp = nullptr; diff --git a/source/games/sw/src/cache.cpp b/source/games/sw/src/cache.cpp index fa3a058d2..124da97fa 100644 --- a/source/games/sw/src/cache.cpp +++ b/source/games/sw/src/cache.cpp @@ -80,7 +80,7 @@ void precacheMap(void) j = sec.ceilingpicnum; markTileForPrecache(j, sec.ceilingpal); - if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) + if ((picanm[j].sf & PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) { for (i = 1; i <= picanm[j].num; i++) { @@ -92,7 +92,7 @@ void precacheMap(void) markTileForPrecache(j, sec.floorpal); - if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) + if ((picanm[j].sf & PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) { for (i = 1; i <= picanm[j].num; i++) { @@ -108,7 +108,7 @@ void precacheMap(void) markTileForPrecache(j, wal.pal); - if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) + if ((picanm[j].sf & PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) { for (i = 1; i <= picanm[j].num; i++) { @@ -121,7 +121,7 @@ void precacheMap(void) j = wal.overpicnum; markTileForPrecache(j, wal.pal); - if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) + if ((picanm[j].sf & PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) { for (i = 1; i <= picanm[j].num; i++) { diff --git a/source/games/sw/src/coolie.cpp b/source/games/sw/src/coolie.cpp index 61947719e..dc0ba81ac 100644 --- a/source/games/sw/src/coolie.cpp +++ b/source/games/sw/src/coolie.cpp @@ -436,7 +436,7 @@ void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SETp action, PERSONALITYp perso if (actor->user.lo_sectp) { - if (actor->user.lo_sectp->hasU() && TEST(actor->user.lo_sectp->extra, SECTFX_SINK)) + if (actor->user.lo_sectp->hasU() && (actor->user.lo_sectp->extra & SECTFX_SINK)) { depth = FixedToInt(actor->user.lo_sectp->depth_fixed); } diff --git a/source/games/sw/src/copysect.cpp b/source/games/sw/src/copysect.cpp index 0c48c789c..becc7bf0e 100644 --- a/source/games/sw/src/copysect.cpp +++ b/source/games/sw/src/copysect.cpp @@ -180,7 +180,7 @@ void CopySectorMatch(int match) ChangeActorSect(itActor, dsectp); // check to see if it moved on to a sector object - if (TEST(dsectp->extra, SECTFX_SECTOR_OBJECT)) + if ((dsectp->extra & SECTFX_SECTOR_OBJECT)) { SECTOR_OBJECTp sop; diff --git a/source/games/sw/src/d_menu.cpp b/source/games/sw/src/d_menu.cpp index 2cf495f84..222093536 100644 --- a/source/games/sw/src/d_menu.cpp +++ b/source/games/sw/src/d_menu.cpp @@ -86,7 +86,7 @@ void GameInterface::MenuSound(EMenuSounds snd) bool GameInterface::CanSave() { - return (gamestate == GS_LEVEL && !CommEnabled && numplayers ==1 && /*!DemoMode &&*/ !TEST(Player[myconnectindex].Flags, PF_DEAD)); + return (gamestate == GS_LEVEL && !CommEnabled && numplayers ==1 && /*!DemoMode &&*/ !(Player[myconnectindex].Flags & PF_DEAD)); } bool GameInterface::StartGame(FNewGameStartup& gs) diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 42a5b0256..48b97feaf 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -120,7 +120,7 @@ int GetRotation(tspritetype* tsprite, int& spritesortcnt, int tSpriteNum, int vi if (ownerActor->user.RotNum == 5) { - if (TEST(ownerActor->user.Flags, SPR_XFLIP_TOGGLE)) + if ((ownerActor->user.Flags & SPR_XFLIP_TOGGLE)) { if (rotation <= 4) { @@ -231,7 +231,7 @@ int DoShadowFindGroundPoint(tspriteptr_t tspr) { auto hitactor = florhit.actor(); - if (TEST(hitactor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR)) + if ((hitactor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) { // found a sprite floor return loz; @@ -373,7 +373,7 @@ void DoMotionBlur(tspritetype* tsprite, int& spritesortcnt, tspritetype const * return; } - if (TEST(tsp->extra, SPRX_PLAYER_OR_ENEMY)) + if ((tsp->extra & SPRX_PLAYER_OR_ENEMY)) { z_amt_per_pixel = IntToFixed((int)-ownerActor->user.jump_speed * ACTORMOVETICS)/tsp->xvel; } @@ -401,7 +401,7 @@ void DoMotionBlur(tspritetype* tsprite, int& spritesortcnt, tspritetype const * xrepeat = tsp->xrepeat; yrepeat = tsp->yrepeat; - switch (TEST(ownerActor->user.Flags2, SPR2_BLUR_TAPER)) + switch ((ownerActor->user.Flags2 & SPR2_BLUR_TAPER)) { case 0: repeat_adj = 0; @@ -635,7 +635,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie { if (tsp->statnum != STAT_DEFAULT) { - if (TEST(tActor->user.Flags, SPR_SKIP4)) + if ((tActor->user.Flags & SPR_SKIP4)) { if (tsp->statnum <= STAT_SKIP4_INTERP_END) { @@ -643,7 +643,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie } } - if (TEST(tActor->user.Flags, SPR_SKIP2)) + if ((tActor->user.Flags & SPR_SKIP2)) { if (tsp->statnum <= STAT_SKIP2_INTERP_END) { @@ -660,7 +660,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie tsp->pos.Z = floorz; } - if (r_shadows && TEST(tActor->user.Flags, SPR_SHADOW)) + if (r_shadows && (tActor->user.Flags & SPR_SHADOW)) { DoShadows(tsprite, spritesortcnt, tsp, viewz, camang); } @@ -716,7 +716,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie bool nosectpal=false; // sprite does not take on the new pal if sector flag is set - if (tsectp->hasU() && TEST(tsectp->flags, SECTFU_DONT_COPY_PALETTE)) + if (tsectp->hasU() && (tsectp->flags & SECTFU_DONT_COPY_PALETTE)) { pal = PALETTE_DEFAULT; nosectpal = true; @@ -830,7 +830,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie tsp->shade = int8_t(newshade); } - if (TEST(tsectp->ceilingstat, CSTAT_SECTOR_SKY)) + if ((tsectp->ceilingstat & CSTAT_SECTOR_SKY)) { newshade = tsp->shade; newshade += tsectp->ceilingshade; @@ -856,7 +856,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie tsp->shade = -128; } - if (pp->NightVision && TEST(tsp->extra, SPRX_PLAYER_OR_ENEMY)) + if (pp->NightVision && (tsp->extra & SPRX_PLAYER_OR_ENEMY)) { if (tActor->hasU() && tActor->user.ID == TRASHCAN) continue; // Don't light up trashcan @@ -866,7 +866,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie if (tActor->hasU() && tActor->user.PlayerP) { - if (TEST(tActor->user.Flags2, SPR2_VIS_SHADING)) + if ((tActor->user.Flags2 & SPR2_VIS_SHADING)) { if (Player[screenpeek].actor != tActor) { @@ -925,7 +925,7 @@ void post_analyzesprites(tspritetype* tsprite, int& spritesortcnt) tsp->pos.Y = atsp->pos.Y; // statnum is priority - draw this ALWAYS first at 0 // statnum is priority - draw this ALWAYS last at MAXSTATUS - if (TEST(atsp->extra, SPRX_BURNABLE)) + if ((atsp->extra & SPRX_BURNABLE)) { atsp->statnum = 1; tsp->statnum = 0; @@ -1095,7 +1095,7 @@ void DrawCrosshair(PLAYERp pp) { if (!(CameraTestMode)) { - ::DrawCrosshair(2326, pp->actor->user.Health, -pp->angle.look_anghalf(smoothratio), TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) ? 5 : 0, 2, shadeToLight(10)); + ::DrawCrosshair(2326, pp->actor->user.Health, -pp->angle.look_anghalf(smoothratio), (pp->Flags & PF_VIEW_FROM_OUTSIDE) ? 5 : 0, 2, shadeToLight(10)); } } @@ -1588,7 +1588,7 @@ void drawscreen(PLAYERp pp, double smoothratio) DrawText(twod, font, CR_UNTRANSLATED, 160-w, 100, str, DTA_FullscreenScale, FSMode_Fit320x200, TAG_DONE); } - if (!CommEnabled && TEST(pp->Flags, PF_DEAD)) + if (!CommEnabled && (pp->Flags & PF_DEAD)) { if (ReloadPrompt) { diff --git a/source/games/sw/src/input.cpp b/source/games/sw/src/input.cpp index a56b5ceb0..046622bcc 100644 --- a/source/games/sw/src/input.cpp +++ b/source/games/sw/src/input.cpp @@ -174,22 +174,22 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju if (!SyncInput()) { - if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) + if ((pp->Flags2 & PF2_INPUT_CAN_AIM)) { DoPlayerHorizon(pp, input.horz, scaleAdjust); } - if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL)) + if ((pp->Flags2 & PF2_INPUT_CAN_TURN_GENERAL)) { DoPlayerTurn(pp, input.avel, scaleAdjust); } - if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_VEHICLE)) + if ((pp->Flags2 & PF2_INPUT_CAN_TURN_VEHICLE)) { DoPlayerTurnVehicle(pp, input.avel, pp->pos.Z + Z(10), labs(pp->pos.Z + Z(10) - pp->sop->floor_loz)); } - if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_TURRET)) + if ((pp->Flags2 & PF2_INPUT_CAN_TURN_TURRET)) { DoPlayerTurnTurret(pp, input.avel); } diff --git a/source/games/sw/src/inv.cpp b/source/games/sw/src/inv.cpp index 702a8147e..eea965848 100644 --- a/source/games/sw/src/inv.cpp +++ b/source/games/sw/src/inv.cpp @@ -510,7 +510,7 @@ void InventoryTimer(PLAYERp pp) for (id = InventoryData; id->Name; id++, inv++) { // if timed and active - if (TEST(id->Flags, INVF_TIMED) && pp->InventoryActive[inv]) + if ((id->Flags & INVF_TIMED) && pp->InventoryActive[inv]) { // dec tics pp->InventoryTics[inv] -= synctics; @@ -539,7 +539,7 @@ void InventoryTimer(PLAYERp pp) // every time the player is in an AUTO_USE situation. // This code will decrement the timer and set the Item to InActive // EVERY SINGLE TIME. Relies on the USE function getting called! - if (TEST(id->Flags, INVF_AUTO_USE) && pp->InventoryActive[inv]) + if ((id->Flags & INVF_AUTO_USE) && pp->InventoryActive[inv]) { pp->InventoryTics[inv] -= synctics; if (pp->InventoryTics[inv] <= 0) diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index 5151eca9d..240b8a3dc 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -389,7 +389,7 @@ int DoBloodSpray(DSWActor* actor) short wall_ang; auto hitActor = actor->user.coll.actor(); - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { wall_ang = NORM_ANGLE(hitActor->spr.ang); SpawnMidSplash(actor); @@ -581,7 +581,7 @@ int DoPhosphorus(DSWActor* actor) auto hitActor = actor->user.coll.actor(); - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { wall_ang = NORM_ANGLE(hitActor->spr.ang); WallBounce(actor, wall_ang); @@ -589,7 +589,7 @@ int DoPhosphorus(DSWActor* actor) } else { - if (TEST(hitActor->spr.extra, SPRX_BURNABLE)) + if ((hitActor->spr.extra & SPRX_BURNABLE)) { if (!hitActor->hasU()) SpawnUser(hitActor, hitActor->spr.picnum, nullptr); @@ -788,7 +788,7 @@ int DoChemBomb(DSWActor* actor) auto hitActor = actor->user.coll.actor(); - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { wall_ang = NORM_ANGLE(hitActor->spr.ang); WallBounce(actor, wall_ang); @@ -1013,7 +1013,7 @@ int DoCaltrops(DSWActor* actor) auto hitActor = actor->user.coll.actor(); - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { wall_ang = NORM_ANGLE(hitActor->spr.ang); WallBounce(actor, wall_ang); @@ -1537,7 +1537,7 @@ void SpawnFlashBombOnActor(DSWActor* actor) if (!actor->hasU()) return; // Forget about burnable sprites - if (TEST(actor->spr.extra, SPRX_BURNABLE)) + if ((actor->spr.extra & SPRX_BURNABLE)) return; if (actor != nullptr) @@ -2142,7 +2142,7 @@ int DoFlag(DSWActor* actor) SetCarryFlag(actor); // check to see if sprite is player or enemy - if (TEST(hitActor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((hitActor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { // attach weapon to sprite actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); diff --git a/source/games/sw/src/light.cpp b/source/games/sw/src/light.cpp index 32c3ffc29..f0b302793 100644 --- a/source/games/sw/src/light.cpp +++ b/source/games/sw/src/light.cpp @@ -71,7 +71,7 @@ void SectorLightShade(DSWActor* actor, short intensity) wal.pal = actor->spr.pal; wallcount++; - if (TEST(actor->spr.extra, SPRX_BOOL5)) + if ((actor->spr.extra & SPRX_BOOL5)) { if (wal.twoSided()) { diff --git a/source/games/sw/src/light.h b/source/games/sw/src/light.h index 87bca4596..768fdae58 100644 --- a/source/games/sw/src/light.h +++ b/source/games/sw/src/light.h @@ -42,7 +42,7 @@ inline int8_t LIGHT_MaxBright(DSWActor* a) { return int8_t(SP_TAG5(a)); } inline int8_t LIGHT_MaxDark(DSWActor* sp) { return int8_t(SP_TAG6(sp)); } inline uint8_t& LIGHT_ShadeInc(DSWActor* sp) { return SP_TAG7(sp); } -inline bool LIGHT_Dir(DSWActor* sp) { return (!!(TEST(sp->spr.extra, SPRX_BOOL10))); } +inline bool LIGHT_Dir(DSWActor* sp) { return (!!((sp->spr.extra & SPRX_BOOL10))); } inline void LIGHT_DirChange(DSWActor* sp) { sp->spr.extra ^= SPRX_BOOL10; } int8_t& LIGHT_FloorShade(DSWActor* a) { return a->spr.xoffset; } diff --git a/source/games/sw/src/morph.cpp b/source/games/sw/src/morph.cpp index f1e2f696e..df2fafac5 100644 --- a/source/games/sw/src/morph.cpp +++ b/source/games/sw/src/morph.cpp @@ -123,7 +123,7 @@ short DoSOevent(short match, short state) if (sop->match_event == match) { - if (TEST(sop->flags, SOBJ_WAIT_FOR_EVENT)) + if ((sop->flags & SOBJ_WAIT_FOR_EVENT)) { if (sop->save_vel > 0 || sop->save_spin_speed > 0) { @@ -353,7 +353,7 @@ void MorphTornado(SECTOR_OBJECTp sop) for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) { if ((*sectp)->hasU() && - TEST((*sectp)->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT)) + ((*sectp)->flags & SECTFU_SO_SLOPE_CEILING_TO_POINT)) { #define TOR_LOW (floorz) if (sop->morph_z > TOR_LOW) @@ -445,7 +445,7 @@ void MorphFloor(SECTOR_OBJECTp sop) for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) { if ((*sectp)->hasU() && - TEST((*sectp)->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT)) + ((*sectp)->flags & SECTFU_SO_SLOPE_CEILING_TO_POINT)) { alignflorslope(*sectp, mx, my, floorz + sop->morph_z); } @@ -460,7 +460,7 @@ void SOBJ_AlignFloorToPoint(SECTOR_OBJECTp sop, int x, int y, int z) for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) { if ((*sectp)->hasU() && - TEST((*sectp)->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT)) + ((*sectp)->flags & SECTFU_SO_SLOPE_CEILING_TO_POINT)) { alignflorslope(*sectp, x, y, z); } @@ -475,7 +475,7 @@ void SOBJ_AlignCeilingToPoint(SECTOR_OBJECTp sop, int x, int y, int z) for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) { if ((*sectp)->hasU() && - TEST((*sectp)->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT)) + ((*sectp)->flags & SECTFU_SO_SLOPE_CEILING_TO_POINT)) { alignceilslope(*sectp, x, y, z); } @@ -490,7 +490,7 @@ void SOBJ_AlignFloorCeilingToPoint(SECTOR_OBJECTp sop, int x, int y, int z) for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) { if ((*sectp)->hasU() && - TEST((*sectp)->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT)) + ((*sectp)->flags & SECTFU_SO_SLOPE_CEILING_TO_POINT)) { alignflorslope(*sectp, x, y, z); alignceilslope(*sectp, x, y, z); diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index 66bb0ba9c..9cb054e42 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -798,7 +798,7 @@ void SpawnSwordBlur(PANEL_SPRITEp psp) nsp->picndx = -1; nsp->picnum = psp->picndx; - if (TEST(psp->State->flags, psf_Xflip)) + if ((psp->State->flags & psf_Xflip)) nsp->flags |= (PANF_XFLIP); nsp->rotate_ang = psp->rotate_ang; @@ -943,7 +943,7 @@ void InitWeaponSword(PLAYERp pp) return; // needed for death sequence when the SWORD was your weapon when you died - if (pp->Wpn[WPN_SWORD] && TEST(pp->Wpn[WPN_SWORD]->flags, PANF_DEATH_HIDE)) + if (pp->Wpn[WPN_SWORD] && (pp->Wpn[WPN_SWORD]->flags & PANF_DEATH_HIDE)) { pp->Wpn[WPN_SWORD]->flags &= ~(PANF_DEATH_HIDE); pp->Flags &= ~(PF_WEAPON_RETRACT|PF_WEAPON_DOWN); @@ -1340,7 +1340,7 @@ void InitWeaponStar(PLAYERp pp) } // needed for death sequence when the STAR was your weapon when you died - if (pp->Wpn[WPN_STAR] && TEST(pp->Wpn[WPN_STAR]->flags, PANF_DEATH_HIDE)) + if (pp->Wpn[WPN_STAR] && (pp->Wpn[WPN_STAR]->flags & PANF_DEATH_HIDE)) { pp->Wpn[WPN_STAR]->flags &= ~(PANF_DEATH_HIDE); pp->Flags &= ~(PF_WEAPON_RETRACT); @@ -1741,7 +1741,7 @@ void pSpawnUziClip(PANEL_SPRITEp gun) PlaySound(DIGI_REMOVECLIP, gun->PlayerP,v3df_follow|v3df_dontpan|v3df_doppler|v3df_follow); - if (TEST(gun->flags, PANF_XFLIP)) + if ((gun->flags & PANF_XFLIP)) { New = pSpawnSprite(gun->PlayerP, ps_UziClip, PRI_BACK, gun->x - UZI_CLIP_XOFF, gun->y + UZI_CLIP_YOFF); New->flags |= (PANF_XFLIP); @@ -1769,7 +1769,7 @@ void pSpawnUziReload(PANEL_SPRITEp oclip) nclip = pSpawnSprite(oclip->PlayerP, ps_UziReload, PRI_BACK, oclip->x, UZI_RELOAD_YOFF); nclip->flags |= PANF_WEAPON_SPRITE; - if (TEST(oclip->flags, PANF_XFLIP)) + if ((oclip->flags & PANF_XFLIP)) nclip->flags |= PANF_XFLIP; // move Reload in oposite direction of clip @@ -1798,7 +1798,7 @@ void pUziReload(PANEL_SPRITEp nclip) gun->x -= pspCosVel(gun); gun->y += pspSinVel(gun); - if (TEST(nclip->flags, PANF_XFLIP)) + if ((nclip->flags & PANF_XFLIP)) { if (nclip->x < gun->x) { @@ -1969,14 +1969,14 @@ void InitWeaponUzi(PLAYERp pp) } else // Is player toggling between one and two uzi's? - if (pp->CurWpn->sibling && TEST(pp->Wpn[WPN_UZI]->flags, PANF_PRIMARY) && pp->WpnUziType == 0) + if (pp->CurWpn->sibling && (pp->Wpn[WPN_UZI]->flags & PANF_PRIMARY) && pp->WpnUziType == 0) { if (!(pp->CurWpn->flags & PANF_RELOAD)) InitWeaponUzi2(pp->Wpn[WPN_UZI]); } // if actually picked an uzi up and don't currently have double uzi - if (pp->Flags & (PF_PICKED_UP_AN_UZI) && !TEST(pp->Wpn[WPN_UZI]->flags, PANF_PRIMARY)) + if (pp->Flags & (PF_PICKED_UP_AN_UZI) && !(pp->Wpn[WPN_UZI]->flags & PANF_PRIMARY)) { pp->Flags &= ~(PF_PICKED_UP_AN_UZI); @@ -2388,7 +2388,7 @@ void SpawnUziShell(PANEL_SPRITEp psp) { PLAYERp pp = psp->PlayerP; - if (psp->State && TEST(psp->State->flags, psf_Xflip)) + if (psp->State && (psp->State->flags & psf_Xflip)) { // LEFT side pp->UziShellLeftAlt = !pp->UziShellLeftAlt; @@ -2408,7 +2408,7 @@ void pUziShell(PANEL_SPRITEp psp) { psp->backupx(); - if (psp->State && TEST(psp->State->flags, psf_Xflip)) + if (psp->State && (psp->State->flags & psf_Xflip)) { psp->x -= 3 * synctics; } @@ -2848,7 +2848,7 @@ void pShotgunRest(PANEL_SPRITEp psp) if (pWeaponHideKeys(psp, ps_ShotgunHide)) return; - if (psp->PlayerP->WpnShotgunType == 1 && ammo > 0 && ((ammo % 4) != 0) && lastammo != ammo && TEST(psp->flags, PANF_REST_POS)) + if (psp->PlayerP->WpnShotgunType == 1 && ammo > 0 && ((ammo % 4) != 0) && lastammo != ammo && (psp->flags & PANF_REST_POS)) { force = true; } @@ -3641,7 +3641,7 @@ void pHotheadRest(PANEL_SPRITEp psp) { psp->flags &= ~(PANF_UNHIDE_SHOOT); - //if (TEST(psp->PlayerP->Flags,PF_DIVING)) + //if ((psp->PlayerP->Flags & PF_DIVING)) // return; if (!WeaponOK(psp->PlayerP)) @@ -5568,7 +5568,7 @@ void SpawnFistBlur(PANEL_SPRITEp psp) nsp->picndx = -1; nsp->picnum = psp->picndx; - if (TEST(psp->State->flags, psf_Xflip)) + if ((psp->State->flags & psf_Xflip)) nsp->flags |= (PANF_XFLIP); nsp->rotate_ang = psp->rotate_ang; @@ -6329,7 +6329,7 @@ void pWeaponBob(PANEL_SPRITEp psp, short condition) } } - if (cl_weaponsway && TEST(psp->flags, PANF_BOB)) + if (cl_weaponsway && (psp->flags & PANF_BOB)) { // // // sin_xxx moves the weapon left-right @@ -6518,7 +6518,7 @@ void pDisplaySprites(PLAYERp pp, double smoothratio) if (psp->flags & (PANF_INVISIBLE)) continue; - if (psp->State && TEST(psp->State->flags, psf_Invisible)) + if (psp->State && (psp->State->flags & psf_Invisible)) continue; // if its a weapon sprite and the view is set to the outside don't draw the sprite @@ -6534,7 +6534,7 @@ void pDisplaySprites(PLAYERp pp, double smoothratio) if (pal != PALETTE_DEFAULT) { - if (sectp->hasU() && TEST(sectp->flags, SECTFU_DONT_COPY_PALETTE)) + if (sectp->hasU() && (sectp->flags & SECTFU_DONT_COPY_PALETTE)) pal = PALETTE_DEFAULT; } @@ -6562,7 +6562,7 @@ void pDisplaySprites(PLAYERp pp, double smoothratio) // !FRANK - this was moved from BELOW this IF statement // if it doesn't have a picflag or its in the view - if (sectp && sectp->hasU() && TEST(sectp->flags, SECTFU_DONT_COPY_PALETTE)) + if (sectp && sectp->hasU() && (sectp->flags & SECTFU_DONT_COPY_PALETTE)) pal = 0; } @@ -6574,7 +6574,7 @@ void pDisplaySprites(PLAYERp pp, double smoothratio) if (psp->flags & (PANF_CORNER)) flags |= (RS_TOPLEFT); - if ((psp->State && TEST(psp->State->flags, psf_Xflip)) || TEST(psp->flags, PANF_XFLIP)) + if ((psp->State && (psp->State->flags & psf_Xflip)) || (psp->flags & PANF_XFLIP)) { flags |= (RS_XFLIPHUD); } @@ -6582,9 +6582,9 @@ void pDisplaySprites(PLAYERp pp, double smoothratio) // shading if (psp->State && TEST(psp->State->flags, psf_ShadeHalf|psf_ShadeNone)) { - if (TEST(psp->State->flags, psf_ShadeNone)) + if ((psp->State->flags & psf_ShadeNone)) shade = 0; - else if (TEST(psp->State->flags, psf_ShadeHalf)) + else if ((psp->State->flags & psf_ShadeHalf)) shade /= 2; } @@ -6622,7 +6622,7 @@ void pDisplaySprites(PLAYERp pp, double smoothratio) case BLOODYFIST3_SWING0: case BLOODYFIST3_SWING1: case BLOODYFIST3_SWING2: - if (TEST(flags, RS_XFLIPHUD) && x > 160) + if ((flags & RS_XFLIPHUD) && x > 160) x = 65; else if (!(flags & RS_XFLIPHUD) && x < 160) x = 345; @@ -6646,7 +6646,7 @@ void pDisplaySprites(PLAYERp pp, double smoothratio) else continue; - if (TEST(psp->over[i].flags, psf_ShadeNone)) + if ((psp->over[i].flags & psf_ShadeNone)) overlay_shade = 0; if (picnum) @@ -6695,7 +6695,7 @@ void pNextState(PANEL_SPRITEp psp) // Transition to the next state psp->State = psp->State->NextState; - if (TEST(psp->State->flags, psf_QuickCall)) + if ((psp->State->flags & psf_QuickCall)) { (*psp->State->Animator)(psp); psp->State = psp->State->NextState; @@ -6707,7 +6707,7 @@ void pStatePlusOne(PANEL_SPRITEp psp) psp->tics = 0; psp->State++; - if (TEST(psp->State->flags, psf_QuickCall)) + if ((psp->State->flags & psf_QuickCall)) { (*psp->State->Animator)(psp); psp->State = psp->State->NextState; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 023101ef2..3ce36e3ae 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1154,11 +1154,11 @@ DSWActor* DoPickTarget(DSWActor* actor, uint32_t max_delta_ang, int skip_targets if (skip_targets != 2) // Used for spriteinfo mode { - if (skip_targets && TEST(itActor->user.Flags, SPR_TARGETED)) + if (skip_targets && (itActor->user.Flags & SPR_TARGETED)) continue; // don't pick a dead player - if (itActor->user.PlayerP && TEST(itActor->user.PlayerP->Flags, PF_DEAD)) + if (itActor->user.PlayerP && (itActor->user.PlayerP->Flags & PF_DEAD)) continue; } @@ -1411,7 +1411,7 @@ void DoPlayerSetWadeDepth(PLAYERp pp) else return; - if (TEST(sectp->extra, SECTFX_SINK)) + if ((sectp->extra & SECTFX_SINK)) { // make sure your even in the water if (pp->pos.Z + PLAYER_HEIGHT > pp->lo_sectp->floorz - Z(FixedToInt(pp->lo_sectp->depth_fixed))) @@ -1431,7 +1431,7 @@ void DoPlayerHeight(PLAYERp pp) void DoPlayerJumpHeight(PLAYERp pp) { - if (pp->lo_sectp && TEST(pp->lo_sectp->extra, SECTFX_DYNAMIC_AREA)) + if (pp->lo_sectp && (pp->lo_sectp->extra & SECTFX_DYNAMIC_AREA)) { if (pp->pos.Z + PLAYER_HEIGHT > pp->loz) { @@ -1588,8 +1588,8 @@ void SlipSlope(PLAYERp pp) void DoPlayerHorizon(PLAYERp pp, float const horz, double const scaleAdjust) { - bool const canslopetilt = !(pp->Flags & (PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING)) && pp->cursector && TEST(pp->cursector->floorstat, CSTAT_SECTOR_SLOPE); - pp->horizon.calcviewpitch(pp->pos.vec2, pp->angle.ang, pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursector, scaleAdjust, TEST(pp->Flags, PF_CLIMBING)); + bool const canslopetilt = !(pp->Flags & (PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING)) && pp->cursector && (pp->cursector->floorstat & CSTAT_SECTOR_SLOPE); + pp->horizon.calcviewpitch(pp->pos.vec2, pp->angle.ang, pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursector, scaleAdjust, (pp->Flags & PF_CLIMBING)); pp->horizon.applyinput(horz, &pp->input.actions, scaleAdjust); } @@ -2132,7 +2132,7 @@ void DoPlayerMove(PLAYERp pp) DoPlayerHorizon(pp, pp->input.horz, 1); } - if (pp->insector() && TEST(pp->cursector->extra, SECTFX_DYNAMIC_AREA)) + if (pp->insector() && (pp->cursector->extra & SECTFX_DYNAMIC_AREA)) { if (pp->Flags & (PF_FLYING|PF_JUMPING|PF_FALLING)) { @@ -2160,7 +2160,7 @@ void DoPlayerSectorUpdatePreMove(PLAYERp pp) if (sect == nullptr) return; - if (TEST(pp->cursector->extra, SECTFX_DYNAMIC_AREA)) + if ((pp->cursector->extra & SECTFX_DYNAMIC_AREA)) { updatesectorz(pp->pos.X, pp->pos.Y, pp->pos.Z, §); if (sect == nullptr) @@ -2377,7 +2377,7 @@ void DriveCrush(PLAYERp pp, int *x, int *y) { if (testpointinquad(actor->spr.pos.X, actor->spr.pos.Y, x, y)) { - if (TEST(actor->spr.extra, SPRX_BREAKABLE) && HitBreakSprite(actor, 0)) + if ((actor->spr.extra & SPRX_BREAKABLE) && HitBreakSprite(actor, 0)) continue; if (actor->spr.statnum == STAT_MISSILE) @@ -2386,7 +2386,7 @@ void DriveCrush(PLAYERp pp, int *x, int *y) if (actor->spr.picnum == ST1) continue; - if (TEST(actor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((actor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { if (!(actor->user.Flags & SPR_DEAD) && !(actor->spr.extra & SPRX_BREAKABLE)) continue; @@ -2485,7 +2485,7 @@ void DriveCrush(PLAYERp pp, int *x, int *y) if (actor->spr.pos.Z < sop->crush_z + Z(40)) continue; - if (TEST(actor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((actor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { if (actor->spr.statnum == STAT_ENEMY) { @@ -3024,7 +3024,7 @@ void DoPlayerFall(PLAYERp pp) PlayerSectorBound(pp, Z(1)); - if (sectp->hasU() && (TEST(sectp->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE)) + if (sectp->hasU() && ((sectp->extra & SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE)) { PlaySound(DIGI_SPLASH1, pp, v3df_dontpan); } @@ -3426,7 +3426,7 @@ bool PlayerFallTest(PLAYERp pp, int player_height) // if on a STEEP slope sector and you have not moved off of the sector if (pp->lo_sectp && labs(pp->lo_sectp->floorheinum) > 3000 && - TEST(pp->lo_sectp->floorstat, CSTAT_SECTOR_SLOPE) && + (pp->lo_sectp->floorstat & CSTAT_SECTOR_SLOPE) && pp->lo_sectp == pp->lastcursector) { return false; @@ -3473,7 +3473,7 @@ void DoPlayerCrawl(PLAYERp pp) } } - if (pp->lo_sectp && TEST(pp->lo_sectp->extra, SECTFX_CURRENT)) + if (pp->lo_sectp && (pp->lo_sectp->extra & SECTFX_CURRENT)) { DoPlayerCurrent(pp); } @@ -3504,7 +3504,7 @@ void DoPlayerCrawl(PLAYERp pp) return; } - if (pp->insector() && TEST(pp->cursector->extra, SECTFX_DYNAMIC_AREA)) + if (pp->insector() && (pp->cursector->extra & SECTFX_DYNAMIC_AREA)) { pp->pos.Z = pp->loz - PLAYER_CRAWL_HEIGHT; } @@ -3699,7 +3699,7 @@ bool PlayerOnLadder(PLAYERp pp) int cstat = hit.actor()->spr.cstat; // if the sprite blocking you hit is not a wall sprite there is something between // you and the ladder - if (TEST(cstat, CSTAT_SPRITE_BLOCK) && + if ((cstat & CSTAT_SPRITE_BLOCK) && !(cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { return false; @@ -3760,7 +3760,7 @@ int PlayerInDiveArea(PLAYERp pp) else return false; - if (TEST(sectp->extra, SECTFX_DIVE_AREA)) + if ((sectp->extra & SECTFX_DIVE_AREA)) { CheckFootPrints(pp); return true; @@ -4004,7 +4004,7 @@ void DoPlayerWarpToUnderwater(PLAYERp pp) SWStatIterator it(STAT_DIVE_AREA); while (over_act = it.Next()) { - if (TEST(over_act->spr.sector()->extra, SECTFX_DIVE_AREA) && + if ((over_act->spr.sector()->extra & SECTFX_DIVE_AREA) && over_act->spr.sector()->hasU() && over_act->spr.sector()->number == sectu->number) { @@ -4020,7 +4020,7 @@ void DoPlayerWarpToUnderwater(PLAYERp pp) it.Reset(STAT_UNDERWATER); while (under_act = it.Next()) { - if (TEST(under_act->spr.sector()->extra, SECTFX_UNDERWATER) && + if ((under_act->spr.sector()->extra & SECTFX_UNDERWATER) && under_act->spr.sector()->hasU() && under_act->spr.sector()->number == sectu->number) { @@ -4074,7 +4074,7 @@ void DoPlayerWarpToSurface(PLAYERp pp) SWStatIterator it(STAT_UNDERWATER); while (under_act = it.Next()) { - if (TEST(under_act->spr.sector()->extra, SECTFX_UNDERWATER) && + if ((under_act->spr.sector()->extra & SECTFX_UNDERWATER) && under_act->spr.sector()->hasU() && under_act->spr.sector()->number == sectu->number) { @@ -4090,7 +4090,7 @@ void DoPlayerWarpToSurface(PLAYERp pp) it.Reset(STAT_DIVE_AREA); while (over_act = it.Next()) { - if (TEST(over_act->spr.sector()->extra, SECTFX_DIVE_AREA) && + if ((over_act->spr.sector()->extra & SECTFX_DIVE_AREA) && over_act->spr.sector()->hasU() && over_act->spr.sector()->number == sectu->number) { @@ -4137,7 +4137,7 @@ void DoPlayerDivePalette(PLAYERp pp) { if (pp != Player + screenpeek) return; - if ((pp->DeathType == PLAYER_DEATH_DROWN || TEST((Player+screenpeek)->Flags, PF_DIVING)) && !(pp->Flags & PF_DIVING_IN_LAVA)) + if ((pp->DeathType == PLAYER_DEATH_DROWN || ((Player+screenpeek)->Flags & PF_DIVING)) && !(pp->Flags & PF_DIVING_IN_LAVA)) { SetFadeAmt(pp,-1005,210); // Dive color , org color 208 } @@ -4220,7 +4220,7 @@ void DoPlayerBeginDiveNoWarp(PLAYERp pp) CheckFootPrints(pp); - if (TEST(pp->lo_sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) + if ((pp->lo_sectp->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) { pp->Flags |= (PF_DIVING_IN_LAVA); plActor->user.DamageTics = 0; @@ -4371,7 +4371,7 @@ void DoPlayerDive(PLAYERp pp) } // underwater current - if (pp->lo_sectp && TEST(pp->lo_sectp->extra, SECTFX_CURRENT)) + if (pp->lo_sectp && (pp->lo_sectp->extra & SECTFX_CURRENT)) { DoPlayerCurrent(pp); } @@ -4436,7 +4436,7 @@ void DoPlayerDive(PLAYERp pp) // Only get so close to the ceiling // if its a dive sector without a match or a UNDER2 sector with CANT_SURFACE set - if (sectu && (sectu->number == 0 || TEST(sectu->flags, SECTFU_CANT_SURFACE))) + if (sectu && (sectu->number == 0 || (sectu->flags & SECTFU_CANT_SURFACE))) { // for room over room water the hiz will be the top rooms ceiling if (pp->pos.Z < pp->hiz + pp->ceiling_dist) @@ -4526,7 +4526,7 @@ int DoPlayerTestPlaxDeath(PLAYERp pp) DSWActor* plActor = pp->actor; // landed on a paralax floor - if (pp->lo_sectp && TEST(pp->lo_sectp->floorstat, CSTAT_SECTOR_SKY)) + if (pp->lo_sectp && (pp->lo_sectp->floorstat & CSTAT_SECTOR_SKY)) { PlayerUpdateHealth(pp, -plActor->user.Health); PlayerCheckDeath(pp, nullptr); @@ -4658,7 +4658,7 @@ void DoPlayerWade(PLAYERp pp) { if (pp->KeyPressBits & SB_OPEN) { - if (TEST(pp->cursector->extra, SECTFX_OPERATIONAL)) + if ((pp->cursector->extra & SECTFX_OPERATIONAL)) { pp->KeyPressBits &= ~SB_OPEN; DoPlayerBeginOperate(pp); @@ -4723,7 +4723,7 @@ void DoPlayerWade(PLAYERp pp) return; } - if (pp->lo_sectp && TEST(pp->lo_sectp->extra, SECTFX_CURRENT)) + if (pp->lo_sectp && (pp->lo_sectp->extra & SECTFX_CURRENT)) { DoPlayerCurrent(pp); } @@ -4794,7 +4794,7 @@ void DoPlayerBeginOperateVehicle(PLAYERp pp) pp->DoPlayerAction = DoPlayerOperateVehicle; // temporary set to get weapons down - if (TEST(pp->sop->flags, SOBJ_HAS_WEAPON)) + if ((pp->sop->flags & SOBJ_HAS_WEAPON)) pp->Flags |= (PF_WEAPON_DOWN); ///DamageData[plActor->user.WeaponNum].Init(pp); @@ -4813,7 +4813,7 @@ void DoPlayerBeginOperateTurret(PLAYERp pp) pp->DoPlayerAction = DoPlayerOperateTurret; // temporary set to get weapons down - if (TEST(pp->sop->flags, SOBJ_HAS_WEAPON)) + if ((pp->sop->flags & SOBJ_HAS_WEAPON)) pp->Flags |= (PF_WEAPON_DOWN); ///DamageData[plActor->user.WeaponNum].Init(pp); @@ -4879,7 +4879,7 @@ void DoPlayerBeginOperate(PLAYERp pp) if (sop->controller) return; - if (TEST(sop->flags, SOBJ_REMOTE_ONLY)) + if ((sop->flags & SOBJ_REMOTE_ONLY)) return; if (!sop) @@ -5260,7 +5260,7 @@ void DoPlayerDeathFall(PLAYERp pp) // adjust player height by jump speed pp->pos.Z += pp->jump_speed; - if (pp->lo_sectp && TEST(pp->lo_sectp->extra, SECTFX_SINK)) + if (pp->lo_sectp && (pp->lo_sectp->extra & SECTFX_SINK)) { loz = pp->lo_sectp->floorz; } @@ -5805,7 +5805,7 @@ void DoPlayerHeadDebris(PLAYERp pp) { SECTORp sectp = pp->cursector; - if (TEST(sectp->extra, SECTFX_SINK)) + if ((sectp->extra & SECTFX_SINK)) { DoPlayerSpriteBob(pp, Z(8), Z(4), 3); } @@ -5942,7 +5942,7 @@ void DoPlayerDeathFlip(PLAYERp pp) if (TEST(pp->Flags,PF_JUMPING|PF_FALLING)) { - if (TEST(pp->Flags,PF_JUMPING)) + if ((pp->Flags & PF_JUMPING)) { DoPlayerDeathJump(pp); DoPlayerDeathHoriz(pp, PLAYER_DEATH_HORIZ_UP_VALUE, 2); @@ -5950,7 +5950,7 @@ void DoPlayerDeathFlip(PLAYERp pp) DoJump(pp->actor); } - if (TEST(pp->Flags,PF_FALLING)) + if ((pp->Flags & PF_FALLING)) { DoPlayerDeathFall(pp); DoPlayerDeathHoriz(pp, PLAYER_DEATH_HORIZ_UP_VALUE, 4); @@ -5979,7 +5979,7 @@ void DoPlayerDeathDrown(PLAYERp pp) if (TEST(pp->Flags,PF_JUMPING|PF_FALLING)) { - if (TEST(pp->Flags,PF_JUMPING)) + if ((pp->Flags & PF_JUMPING)) { DoPlayerDeathJump(pp); DoPlayerDeathHoriz(pp, PLAYER_DEATH_HORIZ_UP_VALUE, 2); @@ -5987,7 +5987,7 @@ void DoPlayerDeathDrown(PLAYERp pp) DoJump(pp->actor); } - if (TEST(pp->Flags,PF_FALLING)) + if ((pp->Flags & PF_FALLING)) { pp->pos.Z += Z(2); if (MoveSkip2 == 0) @@ -6014,7 +6014,7 @@ void DoPlayerDeathBounce(PLAYERp pp) if (Prediction) return; - if (pp->lo_sectp && TEST(pp->lo_sectp->extra, SECTFX_SINK)) + if (pp->lo_sectp && (pp->lo_sectp->extra & SECTFX_SINK)) { plActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); NewStateGroup(pp->actor, sg_PlayerHead); @@ -6047,13 +6047,13 @@ void DoPlayerDeathCrumble(PLAYERp pp) if (TEST(pp->Flags,PF_JUMPING|PF_FALLING)) { - if (TEST(pp->Flags,PF_JUMPING)) + if ((pp->Flags & PF_JUMPING)) { DoPlayerDeathJump(pp); DoPlayerDeathHoriz(pp, PLAYER_DEATH_HORIZ_JUMP_VALUE, 4); } - if (TEST(pp->Flags,PF_FALLING)) + if ((pp->Flags & PF_FALLING)) { DoPlayerDeathFall(pp); DoPlayerDeathHoriz(pp, PLAYER_DEATH_HORIZ_FALL_VALUE, 3); @@ -6099,13 +6099,13 @@ void DoPlayerDeathExplode(PLAYERp pp) if (TEST(pp->Flags,PF_JUMPING|PF_FALLING)) { - if (TEST(pp->Flags,PF_JUMPING)) + if ((pp->Flags & PF_JUMPING)) { DoPlayerDeathJump(pp); DoPlayerDeathHoriz(pp, PLAYER_DEATH_HORIZ_JUMP_VALUE, 4); } - if (TEST(pp->Flags,PF_FALLING)) + if ((pp->Flags & PF_FALLING)) { DoPlayerDeathFall(pp); DoPlayerDeathHoriz(pp, PLAYER_DEATH_HORIZ_JUMP_VALUE, 3); @@ -6235,13 +6235,13 @@ void DoPlayerRun(PLAYERp pp) { if ((pp->KeyPressBits & SB_OPEN) && pp->insector()) { - if (TEST(pp->cursector->extra, SECTFX_OPERATIONAL)) + if ((pp->cursector->extra & SECTFX_OPERATIONAL)) { pp->KeyPressBits &= ~SB_OPEN; DoPlayerBeginOperate(pp); return; } - else if (TEST(pp->cursector->extra, SECTFX_TRIGGER)) + else if ((pp->cursector->extra & SECTFX_TRIGGER)) { auto sActor = FindNearSprite(pp->actor, STAT_TRIGGER); if (sActor && SP_TAG5(sActor) == TRIGGER_TYPE_REMOTE_SO) @@ -6304,7 +6304,7 @@ void DoPlayerRun(PLAYERp pp) return; } - if (TEST(pp->cursector->extra, SECTFX_DYNAMIC_AREA)) + if ((pp->cursector->extra & SECTFX_DYNAMIC_AREA)) { pp->pos.Z = pp->loz - PLAYER_HEIGHT; } @@ -6321,25 +6321,25 @@ void PlayerStateControl(DSWActor* actor) actor->user.Tics += synctics; // Skip states if too much time has passed - while (actor->user.Tics >= TEST(actor->user.State->Tics, SF_TICS_MASK)) + while (actor->user.Tics >= (actor->user.State->Tics & SF_TICS_MASK)) { // Set Tics - actor->user.Tics -= TEST(actor->user.State->Tics, SF_TICS_MASK); + actor->user.Tics -= (actor->user.State->Tics & SF_TICS_MASK); // Transition to the next state actor->user.State = actor->user.State->NextState; // !JIM! Added this so I can do quick calls in player states! // Need this in order for floor blood and footprints to not get called more than once. - while (TEST(actor->user.State->Tics, SF_QUICK_CALL)) + while ((actor->user.State->Tics & SF_QUICK_CALL)) { // Call it once and go to the next state (*actor->user.State->Animator)(actor); // if still on the same QUICK_CALL should you // go to the next state. - if (TEST(actor->user.State->Tics, SF_QUICK_CALL)) + if ((actor->user.State->Tics & SF_QUICK_CALL)) actor->user.State = actor->user.State->NextState; } @@ -6356,7 +6356,7 @@ void PlayerStateControl(DSWActor* actor) actor->spr.picnum = actor->user.State->Pic; // Call the correct animator - if (TEST(actor->user.State->Tics, SF_PLAYER_FUNC)) + if ((actor->user.State->Tics & SF_PLAYER_FUNC)) if (actor->user.State->Animator) (*actor->user.State->Animator)(actor); diff --git a/source/games/sw/src/ripper.cpp b/source/games/sw/src/ripper.cpp index 87c8f9bf2..2d0729e6c 100644 --- a/source/games/sw/src/ripper.cpp +++ b/source/games/sw/src/ripper.cpp @@ -1108,7 +1108,7 @@ int DoRipperQuickJump(DSWActor* actor) DSWActor* low = actor->user.lowActor; if (low) { - if (TEST(low->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((low->spr.extra & SPRX_PLAYER_OR_ENEMY)) { NewStateGroup(actor, sg_RipperJumpAttack); // move past the first state diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index 7d735af1f..a626dda81 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -1130,7 +1130,7 @@ int DoRipper2QuickJump(DSWActor* actor) DSWActor* low = actor->user.targetActor; if (low) { - if (TEST(low->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((low->spr.extra & SPRX_PLAYER_OR_ENEMY)) { NewStateGroup(actor, sg_Ripper2JumpAttack); // move past the first state diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index 5f46d47a8..8b718d418 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -136,7 +136,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect, if (hit.hitWall != nullptr) { // hitscan warping - if (TEST(hit.hitWall->cstat, CSTAT_WALL_WARP_HITSCAN)) + if ((hit.hitWall->cstat & CSTAT_WALL_WARP_HITSCAN)) { // back it up a bit to get a correct warp location hit.hitpos.X -= xvect>>9; @@ -168,9 +168,9 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect, // make sure it hit JUST a sector before doing a check if (hit.hitWall == nullptr && hit.actor() == nullptr) { - if (TEST(hit.hitSector->extra, SECTFX_WARP_SECTOR)) + if ((hit.hitSector->extra & SECTFX_WARP_SECTOR)) { - if (TEST(hit.hitSector->firstWall()->cstat, CSTAT_WALL_WARP_HITSCAN)) + if ((hit.hitSector->firstWall()->cstat & CSTAT_WALL_WARP_HITSCAN)) { // hit the floor of a sector that is a warping sector sectortype* newsect = nullptr; @@ -335,10 +335,10 @@ bool SectorZadjust(const Collision& ceilhit, int32_t* hiz, const Collision& flor if (FAF_ConnectFloor(hit_sector)) { // rippers were dying through the floor in $rock - if (TEST(hit_sector->floorstat, CSTAT_SECTOR_FAF_BLOCK_HITSCAN)) + if ((hit_sector->floorstat & CSTAT_SECTOR_FAF_BLOCK_HITSCAN)) break; - if (TEST(hit_sector->extra, SECTFX_Z_ADJUST)) + if ((hit_sector->extra & SECTFX_Z_ADJUST)) { // see if a z adjust ST1 is around z_amt = GetZadjustment(hit_sector, FLOOR_Z_ADJUST); @@ -367,7 +367,7 @@ bool SectorZadjust(const Collision& ceilhit, int32_t* hiz, const Collision& flor } else // default adjustment for plax - if (TEST(hit_sector->floorstat, CSTAT_SECTOR_SKY)) + if ((hit_sector->floorstat & CSTAT_SECTOR_SKY)) { *loz += PlaxFloorGlobZadjust; } @@ -388,7 +388,7 @@ bool SectorZadjust(const Collision& ceilhit, int32_t* hiz, const Collision& flor // don't jack with connect sectors if (FAF_ConnectCeiling(hit_sector)) { - if (TEST(hit_sector->extra, SECTFX_Z_ADJUST)) + if ((hit_sector->extra & SECTFX_Z_ADJUST)) { // see if a z adjust ST1 is around z_amt = GetZadjustment(hit_sector, CEILING_Z_ADJUST); @@ -417,7 +417,7 @@ bool SectorZadjust(const Collision& ceilhit, int32_t* hiz, const Collision& flor } else // default adjustment for plax - if (TEST(hit_sector->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit_sector->ceilingstat & CSTAT_SECTOR_SKY)) { *hiz -= PlaxCeilGlobZadjust; } diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index a56d9957f..21f510ddf 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -404,12 +404,12 @@ void SectorSetup(void) // // /////////////////////////////////// - if (TEST(sectp->extra, SECTFX_SINK)) + if ((sectp->extra & SECTFX_SINK)) { SectorLiquidSet(sectp); } - if (TEST(sectp->floorstat, CSTAT_SECTOR_SKY)) + if ((sectp->floorstat & CSTAT_SECTOR_SKY)) { // don't do a z adjust for FAF area if (sectp->floorpicnum != FAF_PLACE_MIRROR_PIC) @@ -418,7 +418,7 @@ void SectorSetup(void) } } - if (TEST(sectp->ceilingstat, CSTAT_SECTOR_SKY)) + if ((sectp->ceilingstat & CSTAT_SECTOR_SKY)) { // don't do a z adjust for FAF area if (sectp->ceilingpicnum != FAF_PLACE_MIRROR_PIC) @@ -479,7 +479,7 @@ void SectorSetup(void) { case 0: swf->flags |= (SINE_FLOOR); - if (TEST(sectp->floorstat, CSTAT_SECTOR_SLOPE)) + if ((sectp->floorstat & CSTAT_SECTOR_SLOPE)) { swf->flags |= (SINE_SLOPED); } @@ -1067,7 +1067,7 @@ void DoStopSoundSpotMatch(short match) bool TestKillSectorObject(SECTOR_OBJECTp sop) { - if (TEST(sop->flags, SOBJ_KILLABLE)) + if ((sop->flags & SOBJ_KILLABLE)) { KillMatchingCrackSprites(sop->match_event); // get new sectnums @@ -2283,7 +2283,7 @@ void PlayerOperateEnv(PLAYERp pp) SECTORp sectp = pp->cursector; if (pp->insector() && sectp->hasU() && sectp->damage) { - if (TEST(sectp->flags, SECTFU_DAMAGE_ABOVE_SECTOR)) + if ((sectp->flags & SECTFU_DAMAGE_ABOVE_SECTOR)) { PlayerTakeSectorDamage(pp); } @@ -2311,7 +2311,7 @@ void PlayerOperateEnv(PLAYERp pp) { OperateTripTrigger(pp); - if (pp->insector() && TEST(pp->cursector->extra, SECTFX_WARP_SECTOR)) + if (pp->insector() && (pp->cursector->extra & SECTFX_WARP_SECTOR)) { if (!(pp->Flags2 & PF2_TELEPORTED)) { @@ -2339,13 +2339,13 @@ void DoSineWaveFloor(void) swf->sintable_ndx = NORM_ANGLE(swf->sintable_ndx + (synctics << swf->speed_shift)); - if (TEST(flags, SINE_FLOOR)) + if ((flags & SINE_FLOOR)) { newz = swf->floor_origz + MulScale(swf->range, bsin(swf->sintable_ndx), 14); swf->sectp->setfloorz(newz); } - if (TEST(flags, SINE_CEILING)) + if ((flags & SINE_CEILING)) { newz = swf->ceiling_origz + MulScale(swf->range, bsin(swf->sintable_ndx), 14); swf->sectp->setceilingz(newz); @@ -2372,7 +2372,7 @@ void DoSineWaveFloor(void) if (!(sect->floorstat & CSTAT_SECTOR_SLOPE)) continue; - if (TEST(flags, SINE_SLOPED)) + if ((flags & SINE_SLOPED)) { WALLp wal; if (sect->wallnum == 4) diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index 1855e606e..0f8175b28 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -501,7 +501,7 @@ int DoSlidor(DSWActor* actor) SWSectIterator it(actor->spr.sector()); while (auto itActor = it.Next()) { - if (itActor->hasU() && TEST(itActor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if (itActor->hasU() && (itActor->spr.cstat & CSTAT_SPRITE_BLOCK) && (itActor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { // found something blocking so reverse to ON position ReverseSlidor(actor); diff --git a/source/games/sw/src/spike.cpp b/source/games/sw/src/spike.cpp index 9b0b0510c..a91c4b0c9 100644 --- a/source/games/sw/src/spike.cpp +++ b/source/games/sw/src/spike.cpp @@ -255,7 +255,7 @@ void MoveSpritesWithSpike(sectortype* sect) if (actor->hasU()) continue; - if (TEST(actor->spr.extra, SPRX_STAY_PUT_VATOR)) + if ((actor->spr.extra & SPRX_STAY_PUT_VATOR)) continue; getzsofslopeptr(sect, actor->spr.pos.X, actor->spr.pos.Y, &cz, &fz); @@ -342,7 +342,7 @@ int DoSpike(DSWActor* actor) SWSectIterator it(actor->spr.sector()); while (auto itActor = it.Next()) { - if (actor->hasU() && TEST(actor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(actor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if (actor->hasU() && (actor->spr.cstat & CSTAT_SPRITE_BLOCK) && (actor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { ReverseSpike(actor); found = true; diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 5facacd9d..228c0689e 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -698,7 +698,7 @@ void KillActor(DSWActor* actor) // if missile is heading for the sprite, the missile need to know // that it is already dead - if (TEST(actor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((actor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { static int8_t MissileStats[] = {STAT_MISSILE, STAT_MISSILE_SKIP4}; @@ -901,7 +901,7 @@ DSWActor* SpawnActor(int stat, int id, STATEp state, sectortype* sect, int x, in void PicAnimOff(short picnum) { - short anim_type = TEST(picanm[picnum].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT; + short anim_type = (picanm[picnum].sf & PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT; ASSERT(picnum >= 0 && picnum < MAXTILES); @@ -914,7 +914,7 @@ void PicAnimOff(short picnum) bool IconSpawn(DSWActor* actor) { // if multi item and not a modem game - if (TEST(actor->spr.extra, SPRX_MULTI_ITEM)) + if ((actor->spr.extra & SPRX_MULTI_ITEM)) { if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE) return false; @@ -937,7 +937,7 @@ bool ActorTestSpawn(DSWActor* actor) } // Countermeasure for mods that leave the lower skills unpopulated. - int spawnskill = TEST(actor->spr.extra, SPRX_SKILL); + int spawnskill = (actor->spr.extra & SPRX_SKILL); if (MinEnemySkill > 0 && spawnskill == MinEnemySkill) spawnskill = 0; // Skill ranges from -1 (No Monsters) to 3. @@ -1618,7 +1618,7 @@ void SpriteSetup(void) if (actor->spr.lotag == TAG_SPRITE_HIT_MATCH) { // if multi item and not a modem game - if (TEST(actor->spr.extra, SPRX_MULTI_ITEM)) + if ((actor->spr.extra & SPRX_MULTI_ITEM)) { if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE) { @@ -1919,7 +1919,7 @@ void SpriteSetup(void) case SPAWN_ITEMS: { - if (TEST(actor->spr.extra, SPRX_MULTI_ITEM)) + if ((actor->spr.extra & SPRX_MULTI_ITEM)) { if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE) { @@ -1995,7 +1995,7 @@ void SpriteSetup(void) SpawnUser(actor, 0, nullptr); // vator already set - ceiling AND floor vator - if (TEST(sectp->extra, SECTFX_VATOR)) + if ((sectp->extra & SECTFX_VATOR)) { sectp->u_defined = true; sectp->flags |= (SECTFU_VATOR_BOTH); @@ -2439,13 +2439,13 @@ void SpriteSetup(void) { SetSectorWallBits(actor->spr.sector(), WALLFX_DONT_STICK, false, true); - if (TEST(sectp->floorstat, CSTAT_SECTOR_SLOPE)) + if ((sectp->floorstat & CSTAT_SECTOR_SLOPE)) { SP_TAG5(actor) = sectp->floorheinum; sectp->setfloorslope(0); } - if (TEST(sectp->ceilingstat, CSTAT_SECTOR_SLOPE)) + if ((sectp->ceilingstat & CSTAT_SECTOR_SLOPE)) { SP_TAG6(actor) = sectp->ceilingheinum; sectp->setceilingslope(0); @@ -2839,7 +2839,7 @@ KeyMain: case 1852: case 2470: - if (TEST(actor->spr.extra, SPRX_MULTI_ITEM)) + if ((actor->spr.extra & SPRX_MULTI_ITEM)) if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE) { KillActor(actor); @@ -3402,7 +3402,7 @@ NUKE_REPLACEMENT: case BREAK_BOTTLE2: case BREAK_MUSHROOM: - //if (TEST(actor->spr.extra, SPRX_BREAKABLE)) + //if ((actor->spr.extra & SPRX_BREAKABLE)) // break; SpawnUser(actor, actor->spr.picnum, nullptr); @@ -3447,7 +3447,7 @@ NUKE_REPLACEMENT: case 553: case 554: { - if (TEST(actor->spr.extra, SPRX_MULTI_ITEM)) + if ((actor->spr.extra & SPRX_MULTI_ITEM)) { if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE) { @@ -4537,7 +4537,7 @@ bool ActorDrop(DSWActor* actor, int x, int y, int z, sectortype* new_sector, sho Collision ceilhit, florhit; // look only at the center point for a floor sprite - auto save_cstat = TEST(actor->spr.cstat, CSTAT_SPRITE_BLOCK); + auto save_cstat = (actor->spr.cstat & CSTAT_SPRITE_BLOCK); actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK); FAFgetzrangepoint(x, y, z - (ActorSizeZ(actor) >> 1), new_sector, &hiz, &ceilhit, &loz, &florhit); actor->spr.cstat |= (save_cstat); @@ -4554,7 +4554,7 @@ bool ActorDrop(DSWActor* actor, int x, int y, int z, sectortype* new_sector, sho auto hsp = florhit.actor(); // if its a floor sprite and not too far down - if (TEST(hsp->spr.cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR) && + if ((hsp->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) && (labs(loz - z) <= min_height)) { return false; @@ -5423,7 +5423,7 @@ KeyMain: PlaySound(DIGI_ITEM, actor, v3df_dontpan); KillGetWeapon(actor); - if (pp->WpnFlags & (BIT(WPN_UZI)) && TEST(pp->Flags, PF_TWO_UZI)) + if (pp->WpnFlags & (BIT(WPN_UZI)) && (pp->Flags & PF_TWO_UZI)) break; // flag to help with double uzi powerup - simpler but kludgy pp->Flags |= (PF_PICKED_UP_AN_UZI); @@ -5957,11 +5957,11 @@ int StateControl(DSWActor* actor) actor->user.Tics += ACTORMOVETICS; // Skip states if too much time has passed - while (actor->user.Tics >= TEST(actor->user.State->Tics, SF_TICS_MASK)) + while (actor->user.Tics >= (actor->user.State->Tics & SF_TICS_MASK)) { - StateTics = TEST(actor->user.State->Tics, SF_TICS_MASK); + StateTics = (actor->user.State->Tics & SF_TICS_MASK); - if (TEST(actor->user.State->Tics, SF_TIC_ADJUST)) + if ((actor->user.State->Tics & SF_TIC_ADJUST)) { ASSERT(actor->user.Attrib); ASSERT(actor->user.speed < MAX_SPEED); @@ -5977,7 +5977,7 @@ int StateControl(DSWActor* actor) actor->user.State = actor->user.State->NextState; // Look for flags embedded into the Tics variable - while (TEST(actor->user.State->Tics, SF_QUICK_CALL)) + while ((actor->user.State->Tics & SF_QUICK_CALL)) { // Call it once and go to the next state (*actor->user.State->Animator)(actor); @@ -5989,7 +5989,7 @@ int StateControl(DSWActor* actor) // if still on the same QUICK_CALL should you // go to the next state. - if (TEST(actor->user.State->Tics, SF_QUICK_CALL)) + if ((actor->user.State->Tics & SF_QUICK_CALL)) actor->user.State = actor->user.State->NextState; } @@ -6006,7 +6006,7 @@ int StateControl(DSWActor* actor) { ASSERT(actor->user.State); // Set picnum to the correct pic - if (TEST(actor->user.State->Tics, SF_WALL_STATE)) + if ((actor->user.State->Tics & SF_WALL_STATE)) { ASSERT(actor->user.WallP); actor->user.WallP->picnum = actor->user.State->Pic; @@ -6316,7 +6316,7 @@ Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, in if (FAF_ConnectArea(actor->spr.sector())) SetActorZ(actor, &actor->spr.pos); - if (TEST(actor->spr.sector()->extra, SECTFX_WARP_SECTOR)) + if ((actor->spr.sector()->extra & SECTFX_WARP_SECTOR)) { DSWActor* sp_warp; if ((sp_warp = WarpPlane(&actor->spr.pos.X, &actor->spr.pos.Y, &actor->spr.pos.Z, &dasect))) @@ -6502,7 +6502,7 @@ Collision move_missile(DSWActor* actor, int xchange, int ychange, int zchange, i if (FAF_ConnectArea(actor->spr.sector())) SetActorZ(actor, &actor->spr.pos); - if (TEST(actor->spr.sector()->extra, SECTFX_WARP_SECTOR)) + if ((actor->spr.sector()->extra & SECTFX_WARP_SECTOR)) { DSWActor* sp_warp; @@ -6522,7 +6522,7 @@ Collision move_missile(DSWActor* actor, int xchange, int ychange, int zchange, i } } - if (retval.type != kHitNone && TEST(actor->spr.sector()->ceilingstat, CSTAT_SECTOR_SKY)) + if (retval.type != kHitNone && (actor->spr.sector()->ceilingstat & CSTAT_SECTOR_SKY)) { if (actor->spr.pos.Z < actor->spr.sector()->ceilingz) { @@ -6530,7 +6530,7 @@ Collision move_missile(DSWActor* actor, int xchange, int ychange, int zchange, i } } - if (retval.type != kHitNone && TEST(actor->spr.sector()->floorstat, CSTAT_SECTOR_SKY)) + if (retval.type != kHitNone && (actor->spr.sector()->floorstat & CSTAT_SECTOR_SKY)) { if (actor->spr.pos.Z > actor->spr.sector()->floorz) { @@ -6633,7 +6633,7 @@ Collision move_ground_missile(DSWActor* actor, int xchange, int ychange, int cei return retval; } - if (TEST(actor->spr.sector()->extra, SECTFX_WARP_SECTOR)) + if ((actor->spr.sector()->extra & SECTFX_WARP_SECTOR)) { DSWActor* sp_warp; diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 7bf190c52..3a92d98d3 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -139,7 +139,7 @@ short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, int* tr continue; // Skip if already someone on this track - if (TEST(t->flags, TF_TRACK_OCCUPIED)) + if ((t->flags & TF_TRACK_OCCUPIED)) { continue; } @@ -773,7 +773,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop) sop->zorig_floor[sop->num_sectors] = sect->floorz; sop->zorig_ceiling[sop->num_sectors] = sect->ceilingz; - if (TEST(sect->extra, SECTFX_SINK)) + if ((sect->extra & SECTFX_SINK)) sop->zorig_floor[sop->num_sectors] += Z(FixedToInt(sect->depth_fixed)); // lowest and highest floorz's @@ -804,7 +804,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop) if (wal.lotag == TAG_WALL_ALIGN_SLOPE_TO_POINT) sop->morph_wall_point = &wal; - if (wal.extra && TEST(wal.extra, WALLFX_LOOP_OUTER)) + if (wal.extra && (wal.extra & WALLFX_LOOP_OUTER)) FoundOutsideLoop = true; // each wall has this set - for collision detection @@ -928,7 +928,7 @@ cont: // for SPRITE OBJECT sprites, set the actor->user.sz value to the difference // between the zmid and the actor->spr.z - if (TEST(sop->flags, SOBJ_SPRITE_OBJ)) + if ((sop->flags & SOBJ_SPRITE_OBJ)) { int zmid = -9999999; @@ -1365,7 +1365,7 @@ SECTOR_OBJECTp PlayerOnObject(sectortype* match) for (j = 0; j < sop->num_sectors; j++) { - if (sop->sectp[j] == match && TEST(match->extra, SECTFX_OPERATIONAL)) + if (sop->sectp[j] == match && (match->extra & SECTFX_OPERATIONAL)) { return sop; } @@ -1534,7 +1534,7 @@ void MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny) pp->pos.X += nx; pp->pos.Y += ny; - if (TEST(sop->flags, SOBJ_DONT_ROTATE)) + if ((sop->flags & SOBJ_DONT_ROTATE)) { UpdatePlayerSprite(pp); return; @@ -1607,7 +1607,7 @@ void MovePoints(SECTOR_OBJECTp sop, short delta_ang, int nx, int ny) // setting floorz if need be - if (TEST(sop->flags, SOBJ_ZMID_FLOOR)) + if ((sop->flags & SOBJ_ZMID_FLOOR)) sop->zmid = sop->mid_sector->floorz; for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) @@ -1621,7 +1621,7 @@ void MovePoints(SECTOR_OBJECTp sop, short delta_ang, int nx, int ny) if (TEST(wal.extra, WALLFX_LOOP_DONT_SPIN | WALLFX_DONT_MOVE)) continue; - if (wal.extra && TEST(wal.extra, WALLFX_LOOP_OUTER)) + if (wal.extra && (wal.extra & WALLFX_LOOP_OUTER)) { dragpoint(&wal, wal.pos.X + nx, wal.pos.Y + ny); } @@ -1632,18 +1632,18 @@ void MovePoints(SECTOR_OBJECTp sop, short delta_ang, int nx, int ny) rot_ang = delta_ang; - if (TEST(wal.extra, WALLFX_LOOP_REVERSE_SPIN)) + if ((wal.extra & WALLFX_LOOP_REVERSE_SPIN)) rot_ang = -delta_ang; - if (TEST(wal.extra, WALLFX_LOOP_SPIN_2X)) + if ((wal.extra & WALLFX_LOOP_SPIN_2X)) rot_ang = NORM_ANGLE(rot_ang * 2); - if (TEST(wal.extra, WALLFX_LOOP_SPIN_4X)) + if ((wal.extra & WALLFX_LOOP_SPIN_4X)) rot_ang = NORM_ANGLE(rot_ang * 4); rotatepoint(sop->pmid.vec2, wal.pos, rot_ang, &rxy); - if (wal.extra && TEST(wal.extra, WALLFX_LOOP_OUTER)) + if (wal.extra && (wal.extra & WALLFX_LOOP_OUTER)) { dragpoint(&wal, rxy.X, rxy.Y); } @@ -1666,7 +1666,7 @@ PlayerPart: if (!pp->lo_sectp) continue; - if (TEST(pp->lo_sectp->extra, SECTFX_NO_RIDE)) + if ((pp->lo_sectp->extra & SECTFX_NO_RIDE)) { continue; } @@ -1705,7 +1705,7 @@ PlayerPart: actor->spr.pos.Y = sop->ymid - actor->user.sy; // sprites z update - if (TEST(sop->flags, SOBJ_SPRITE_OBJ)) + if ((sop->flags & SOBJ_SPRITE_OBJ)) { // Sprite Objects follow zmid actor->spr.pos.Z = sop->zmid - actor->user.sz; @@ -1730,15 +1730,15 @@ PlayerPart: if (actor->user.Flags & (SPR_ON_SO_SECTOR)) { - if (TEST(sop->flags, SOBJ_DONT_ROTATE)) + if ((sop->flags & SOBJ_DONT_ROTATE)) continue; // IS part of a sector, sprite can do things based on the // current sector it is in - if (TEST(actor->spr.sector()->firstWall()->extra, WALLFX_LOOP_DONT_SPIN)) + if ((actor->spr.sector()->firstWall()->extra & WALLFX_LOOP_DONT_SPIN)) continue; - if (TEST(actor->spr.sector()->firstWall()->extra, WALLFX_LOOP_REVERSE_SPIN)) + if ((actor->spr.sector()->firstWall()->extra & WALLFX_LOOP_REVERSE_SPIN)) { rotatepoint(sop->pmid.vec2, actor->spr.pos.vec2, -delta_ang, &actor->spr.pos.vec2); actor->spr.ang = NORM_ANGLE(actor->spr.ang - delta_ang); @@ -1767,7 +1767,7 @@ PlayerPart: actor->user.oangdiff += getincangle(oldang, actor->spr.ang); - if (TEST(actor->spr.extra, SPRX_BLADE)) + if ((actor->spr.extra & SPRX_BLADE)) { DoBladeDamage(sop->so_actors[i]); } @@ -1788,7 +1788,7 @@ PlayerPart: // in case you are in a whirlpool // move perfectly with the ride in the z direction - if TEST(pp->Flags, PF_CRAWLING) + if (pp->Flags & PF_CRAWLING) { // move up some for really fast moving plats //pp->posz -= PLAYER_HEIGHT + Z(12); @@ -1836,7 +1836,7 @@ void RefreshPoints(SECTOR_OBJECTp sop, int nx, int ny, bool dynamic) // move all walls in sectors back to the original position for (auto& wal : wallsofsector(*sectp)) { - if (!(wal.extra && TEST(wal.extra, WALLFX_DONT_MOVE))) + if (!(wal.extra && (wal.extra & WALLFX_DONT_MOVE))) { dx = x = sop->xmid - sop->xorig[wallcount]; dy = y = sop->ymid - sop->yorig[wallcount]; @@ -1864,7 +1864,7 @@ void RefreshPoints(SECTOR_OBJECTp sop, int nx, int ny, bool dynamic) } } - if (wal.extra && TEST(wal.extra, WALLFX_LOOP_OUTER)) + if (wal.extra && (wal.extra & WALLFX_LOOP_OUTER)) { dragpoint(&wal, dx, dy); } @@ -1979,7 +1979,7 @@ SECTOR_OBJECTp DetectSectorObjectByWall(WALLp wph) for (auto& wal : wallsofsector(*sectp)) { // if outer wall check the NEXTWALL also - if (TEST(wal.extra, WALLFX_LOOP_OUTER)) + if ((wal.extra & WALLFX_LOOP_OUTER)) { if (wal.twoSided() && wph == wal.nextWall()) return sop; @@ -2009,10 +2009,10 @@ void CollapseSectorObject(SECTOR_OBJECTp sop, int nx, int ny) // move all walls in sectors back to the original position for (auto& wal : wallsofsector(*sectp)) { - if (TEST(wal.extra, WALLFX_DONT_MOVE)) + if ((wal.extra & WALLFX_DONT_MOVE)) continue; - if (wal.extra && TEST(wal.extra, WALLFX_LOOP_OUTER)) + if (wal.extra && (wal.extra & WALLFX_LOOP_OUTER)) { dragpoint(&wal, nx, ny); } @@ -2039,27 +2039,27 @@ void MoveZ(SECTOR_OBJECTp sop) // for all sectors for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) { - if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->flags, SECTFU_SO_DONT_BOB)) + if (sop->sectp[i]->hasU() && (sop->sectp[i]->flags & SECTFU_SO_DONT_BOB)) continue; (*sectp)->setfloorz(sop->zorig_floor[i] + sop->bob_diff); } } - if (TEST(sop->flags, SOBJ_MOVE_VERTICAL)) + if ((sop->flags & SOBJ_MOVE_VERTICAL)) { i = AnimGetGoal (ANIM_SopZ, int(sop - SectorObject), nullptr); if (i < 0) sop->flags &= ~(SOBJ_MOVE_VERTICAL); } - if (TEST(sop->flags, SOBJ_ZDIFF_MODE)) + if ((sop->flags & SOBJ_ZDIFF_MODE)) { return; } // move all floors - if (TEST(sop->flags, SOBJ_ZDOWN)) + if ((sop->flags & SOBJ_ZDOWN)) { for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) { @@ -2068,7 +2068,7 @@ void MoveZ(SECTOR_OBJECTp sop) sop->flags &= ~(SOBJ_ZDOWN); } - else if (TEST(sop->flags, SOBJ_ZUP)) + else if ((sop->flags & SOBJ_ZUP)) { for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) { @@ -2092,7 +2092,7 @@ void CallbackSOsink(ANIMp ap, void *data) for (i = 0; sop->sectp[i] != nullptr; i++) { - if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->flags, SECTFU_SO_SINK_DEST)) + if (sop->sectp[i]->hasU() && (sop->sectp[i]->flags & SECTFU_SO_SINK_DEST)) { srcsect = sop->sectp[i]; break; @@ -2167,7 +2167,7 @@ void MoveSectorObjects(SECTOR_OBJECTp sop, short locktics) if (sop->track >= SO_OPERATE_TRACK_START) { - if (TEST(sop->flags, SOBJ_UPDATE_ONCE)) + if ((sop->flags & SOBJ_UPDATE_ONCE)) { sop->flags &= ~(SOBJ_UPDATE_ONCE); RefreshPoints(sop, 0, 0, false); @@ -2219,7 +2219,7 @@ void MoveSectorObjects(SECTOR_OBJECTp sop, short locktics) GlobSpeedSO += delta_ang; } - if (TEST(sop->flags, SOBJ_DYNAMIC)) + if ((sop->flags & SOBJ_DYNAMIC)) { // trick tricks RefreshPoints(sop, nx, ny, true); @@ -2373,7 +2373,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny) for (i = 0; sop->sectp[i] != nullptr; i++) { - if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->flags, SECTFU_SO_SINK_DEST)) + if (sop->sectp[i]->hasU() && (sop->sectp[i]->flags & SECTFU_SO_SINK_DEST)) { dest_sector = sop->sectp[i]; break; @@ -2388,7 +2388,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny) for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) { - if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->flags, SECTFU_SO_DONT_SINK)) + if (sop->sectp[i]->hasU() && (sop->sectp[i]->flags & SECTFU_SO_DONT_SINK)) continue; ndx = AnimSet(ANIM_Floorz, *sectp, dest_sector->floorz, tpoint->tag_high); @@ -2510,7 +2510,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny) // calculate a new angle to the target sop->ang_moving = sop->ang_tgt = getangle(tpoint->x - sop->xmid, tpoint->y - sop->ymid); - if (TEST(sop->flags, SOBJ_ZDIFF_MODE)) + if ((sop->flags & SOBJ_ZDIFF_MODE)) { short i; @@ -2529,7 +2529,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny) // take absolute value and convert to pixels (divide by 256) sop->z_rate = PIXZ(labs(sop->z_rate)); - if (TEST(sop->flags, SOBJ_SPRITE_OBJ)) + if ((sop->flags & SOBJ_SPRITE_OBJ)) { // only modify zmid for sprite_objects AnimSet(ANIM_SopZ, int(sop - SectorObject), nullptr, dz, sop->z_rate); @@ -2548,7 +2548,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny) { // make velocity approach the target velocity - if (TEST(sop->flags, SOBJ_SPEED_UP)) + if ((sop->flags & SOBJ_SPEED_UP)) { if ((sop->vel += (locktics << sop->vel_rate)) >= sop->vel_tgt) { @@ -2556,7 +2556,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny) sop->flags &= ~(SOBJ_SPEED_UP); } } - else if (TEST(sop->flags, SOBJ_SLOW_DOWN)) + else if ((sop->flags & SOBJ_SLOW_DOWN)) { if ((sop->vel -= (locktics << sop->vel_rate)) <= sop->vel_tgt) { @@ -2599,7 +2599,7 @@ void OperateSectorObjectForTics(SECTOR_OBJECTp sop, short newang, int newx, int // for all sectors for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) { - if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->flags, SECTFU_SO_DONT_BOB)) + if (sop->sectp[i]->hasU() && (sop->sectp[i]->flags & SECTFU_SO_DONT_BOB)) continue; (*sectp)->setfloorz(sop->zorig_floor[i] + sop->bob_diff); diff --git a/source/games/sw/src/vator.cpp b/source/games/sw/src/vator.cpp index d0a01f353..f32bffce3 100644 --- a/source/games/sw/src/vator.cpp +++ b/source/games/sw/src/vator.cpp @@ -293,7 +293,7 @@ void MoveSpritesWithSector(sectortype* sect, int z_amt, bool type) } } - if (TEST(actor->spr.extra, SPRX_STAY_PUT_VATOR)) + if ((actor->spr.extra & SPRX_STAY_PUT_VATOR)) continue; if (both) @@ -459,7 +459,7 @@ int DoVator(DSWActor* actor) } } - if (itActor->hasU() && TEST(itActor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if (itActor->hasU() && (itActor->spr.cstat & CSTAT_SPRITE_BLOCK) && (itActor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { // found something blocking so reverse to ON position ReverseVator(actor); diff --git a/source/games/sw/src/wallmove.cpp b/source/games/sw/src/wallmove.cpp index 894fb4e6c..74ddc8dca 100644 --- a/source/games/sw/src/wallmove.cpp +++ b/source/games/sw/src/wallmove.cpp @@ -45,7 +45,7 @@ void SOwallmove(SECTOR_OBJECTp sop, DSWActor* actor, WALLp find_wallp, int dist, short startwall,endwall; SECTORp *sectp; - if (!actor->hasU() || TEST(sop->flags, SOBJ_SPRITE_OBJ)) + if (!actor->hasU() || (sop->flags & SOBJ_SPRITE_OBJ)) return; wallcount = 0; @@ -104,7 +104,7 @@ int DoWallMove(DSWActor* actor) { found = true; - if (TEST(wal.extra, WALLFX_SECTOR_OBJECT)) + if ((wal.extra & WALLFX_SECTOR_OBJECT)) { SECTOR_OBJECTp sop; sop = DetectSectorObjectByWall(&wal); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 8fb741e80..c1c587521 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -2644,7 +2644,7 @@ bool MissileHitMatch(DSWActor* weapActor, int WeaponNum, DSWActor* hitActor) // can be hit by SO only if (SP_TAG7(hitActor) == 4) { - if (TEST(weapActor->user.Flags2, SPR2_SO_MISSILE)) + if ((weapActor->user.Flags2 & SPR2_SO_MISSILE)) { DoMatchEverything(nullptr, hitActor->spr.hitag, -1); return true; @@ -2753,7 +2753,7 @@ int DoLavaErupt(DSWActor* actor) TRAVERSE_CONNECT(pnum) { pp = Player + pnum; - if (pp->insector() && TEST(pp->cursector->extra, SECTFX_TRIGGER)) + if (pp->insector() && (pp->cursector->extra & SECTFX_TRIGGER)) { SWSectIterator it(pp->cursector); while (auto itActor = it.Next()) @@ -3171,7 +3171,7 @@ int SpawnShrap(DSWActor* parentActor, DSWActor* secondaryActor, int means, BREAK shrap_amt = breakinfo->shrap_amt; goto AutoShrap; } - else if (TEST(parentActor->spr.extra, SPRX_BREAKABLE)) + else if ((parentActor->spr.extra & SPRX_BREAKABLE)) { // if no user if (!parentActor->hasU()) @@ -3801,7 +3801,7 @@ int DoVomit(DSWActor* actor) if (actor->user.coll.type == kHitSprite) { - if (TEST(actor->user.coll.actor()->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((actor->user.coll.actor()->spr.extra & SPRX_PLAYER_OR_ENEMY)) { DoDamage(actor->user.coll.actor(), actor); } @@ -4165,7 +4165,7 @@ bool VehicleMoveHit(DSWActor* actor) { SECTORp sectp = actor->user.coll.hitSector; - if (TEST(sectp->extra, SECTFX_SECTOR_OBJECT)) + if ((sectp->extra & SECTFX_SECTOR_OBJECT)) { // shouldn't ever really happen } @@ -4177,13 +4177,13 @@ bool VehicleMoveHit(DSWActor* actor) { auto hitActor = actor->user.coll.actor(); - if (TEST(hitActor->spr.extra, SPRX_BREAKABLE)) + if ((hitActor->spr.extra & SPRX_BREAKABLE)) { HitBreakSprite(hitActor, actor->user.ID); return true; } - if (TEST(hitActor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((hitActor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { if (hitActor != GetOwner(ctrlr)) { @@ -4207,7 +4207,7 @@ bool VehicleMoveHit(DSWActor* actor) { auto wph = actor->user.coll.hitWall; - if (TEST(wph->extra, WALLFX_SECTOR_OBJECT)) + if ((wph->extra & WALLFX_SECTOR_OBJECT)) { // sector object collision if ((hsop = DetectSectorObjectByWall(wph))) @@ -4286,7 +4286,7 @@ bool WeaponMoveHit(DSWActor* actor) } - if (TEST(sectp->extra, SECTFX_SECTOR_OBJECT)) + if ((sectp->extra & SECTFX_SECTOR_OBJECT)) { if ((sop = DetectSectorObject(sectp))) { @@ -4295,7 +4295,7 @@ bool WeaponMoveHit(DSWActor* actor) } } - if (TEST(sectp->ceilingstat, CSTAT_SECTOR_SKY) && sectp->ceilingpicnum != FAF_MIRROR_PIC) + if ((sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpicnum != FAF_MIRROR_PIC) { if (labs(actor->spr.pos.Z - sectp->ceilingz) < ActorSizeZ(actor)) { @@ -4313,13 +4313,13 @@ bool WeaponMoveHit(DSWActor* actor) ASSERT(hitActor->spr.extra != -1); - if (TEST(hitActor->spr.extra, SPRX_BREAKABLE)) + if ((hitActor->spr.extra & SPRX_BREAKABLE)) { HitBreakSprite(hitActor, actor->user.ID); return true; } - if (TEST(hitActor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((hitActor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { // make sure you didn't hit the Owner of the missile if (hitActor != GetOwner(actor)) @@ -4369,7 +4369,7 @@ bool WeaponMoveHit(DSWActor* actor) return true; } - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { if (hitActor->spr.lotag || hitActor->spr.hitag) { @@ -4388,7 +4388,7 @@ bool WeaponMoveHit(DSWActor* actor) ASSERT(wph->extra != -1); - if (TEST(wph->extra, WALLFX_SECTOR_OBJECT)) + if ((wph->extra & WALLFX_SECTOR_OBJECT)) { if ((sop = DetectSectorObjectByWall(wph))) { @@ -4426,7 +4426,7 @@ bool WeaponMoveHit(DSWActor* actor) return true; } - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { if (hitActor->spr.lotag || hitActor->spr.hitag) { @@ -4477,7 +4477,7 @@ int DoFireballFlames(DSWActor* actor) actor->spr.pos.Z = ActorZOfMiddle(attach); - if (TEST(attach->spr.extra, SPRX_BURNABLE)) + if ((attach->spr.extra & SPRX_BURNABLE)) { if ((actor->user.Counter2 & 1) == 0) { @@ -5085,7 +5085,7 @@ int SopCheckKill(SECTOR_OBJECTp sop) { bool killed = false; - if (TEST(sop->flags, SOBJ_BROKEN)) + if ((sop->flags & SOBJ_BROKEN)) return false; // does not have damage @@ -5348,7 +5348,7 @@ int PlayerCheckDeath(PLAYERp pp, DSWActor* weapActor) auto own = GetOwner(weapActor); if (own) pp->KillerActor = own; - else if (TEST(weapActor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + else if ((weapActor->spr.extra & SPRX_PLAYER_OR_ENEMY)) pp->KillerActor = weapActor; } @@ -5483,16 +5483,16 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor) ASSERT(actor->hasU()); // don't hit a dead player - if (actor->user.PlayerP && TEST(actor->user.PlayerP->Flags, PF_DEAD)) + if (actor->user.PlayerP && (actor->user.PlayerP->Flags & PF_DEAD)) { SpawnBlood(actor, weapActor, 0, 0, 0, 0); return 0; } - if (!weapActor || !weapActor->hasU() || TEST(actor->user.Flags, SPR_SUICIDE)) + if (!weapActor || !weapActor->hasU() || (actor->user.Flags & SPR_SUICIDE)) return 0; - if (TEST(weapActor->user.Flags, SPR_SUICIDE)) + if ((weapActor->user.Flags & SPR_SUICIDE)) return 0; if (actor->user.Attrib && RANDOM_P2(1024) > 850) @@ -7276,7 +7276,7 @@ int DoExpDamageTest(DSWActor* actor) if (FAFcansee(itActor, ActorZOfMiddle(itActor), actor, actor->spr.pos.Z)) continue; - if (TEST(itActor->spr.extra, SPRX_BREAKABLE)) + if ((itActor->spr.extra & SPRX_BREAKABLE)) { HitBreakSprite(itActor, actor->user.ID); break_count++; @@ -8002,7 +8002,7 @@ int DoPlasma(DSWActor* actor) { auto hitActor = actor->user.coll.actor(); - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_BLOCK) && !(hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_BLOCK) && !(hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { auto hcstat = hitActor->spr.cstat; @@ -8234,7 +8234,7 @@ int DoGrenade(DSWActor* actor) DoMatchEverything(nullptr, hitActor->spr.hitag, -1); } - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { wall_ang = NORM_ANGLE(hitActor->spr.ang); WallBounce(actor, wall_ang); @@ -8445,7 +8445,7 @@ int DoVulcanBoulder(DSWActor* actor) auto hitActor = actor->user.coll.actor(); - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { wall_ang = NORM_ANGLE(hitActor->spr.ang); WallBounce(actor, wall_ang); @@ -8617,7 +8617,7 @@ int DoMineStuck(DSWActor* actor) ASSERT(attachActor->hasU()); // Is it attached to a dead actor? Blow it up if so. - if (TEST(attachActor->user.Flags, SPR_DEAD) && actor->user.Counter2 < MINE_DETONATE_STATE) + if ((attachActor->user.Flags & SPR_DEAD) && actor->user.Counter2 < MINE_DETONATE_STATE) { actor->user.Counter2 = MINE_DETONATE_STATE; actor->user.WaitTics = SEC(1)/2; @@ -8816,7 +8816,7 @@ int DoMine(DSWActor* actor) if (hitActor->hasU() && hitActor->user.Health <= 0) return false; // JBF: added null check // check to see if sprite is player or enemy - if (TEST(hitActor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((hitActor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { PLAYERp pp; @@ -8844,11 +8844,11 @@ int DoMine(DSWActor* actor) } else { - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { actor->user.Flags2 |= (SPR2_ATTACH_WALL); } - else if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR)) + else if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) { // hit floor if (actor->spr.pos.Z > ((actor->user.hiz + actor->user.loz) >> 1)) @@ -8882,11 +8882,11 @@ int DoMine(DSWActor* actor) actor->user.Flags2 |= (SPR2_ATTACH_WALL); - if (TEST(hit_wall->extra, WALLFX_SECTOR_OBJECT)) + if ((hit_wall->extra & WALLFX_SECTOR_OBJECT)) { } - if (TEST(hit_wall->extra, WALLFX_DONT_STICK)) + if ((hit_wall->extra & WALLFX_DONT_STICK)) { SpawnMineExp(actor); KillActor(actor); @@ -8909,7 +8909,7 @@ int DoMine(DSWActor* actor) actor->user.Flags2 |= (SPR2_ATTACH_CEILING); - if (TEST(hit_sect->extra, SECTFX_SECTOR_OBJECT)) + if ((hit_sect->extra & SECTFX_SECTOR_OBJECT)) { SpawnMineExp(actor); KillActor(actor); @@ -9707,7 +9707,7 @@ void SpawnFireballFlames(DSWActor* actor, DSWActor* enemyActor) if (enemyActor != nullptr) { // test for already burned - if (TEST(enemyActor->spr.extra, SPRX_BURNABLE) && enemyActor->spr.shade > 40) + if ((enemyActor->spr.extra & SPRX_BURNABLE) && enemyActor->spr.shade > 40) return; if (!enemyActor->hasU()) @@ -9721,7 +9721,7 @@ void SpawnFireballFlames(DSWActor* actor, DSWActor* enemyActor) { int sizez = ActorSizeZ(enemyActor) + (ActorSizeZ(enemyActor) >> 2); - if (TEST(enemyActor->spr.extra, SPRX_BURNABLE)) + if ((enemyActor->spr.extra & SPRX_BURNABLE)) return; if (flameActor->user.Counter >= GetRepeatFromHeight(flameActor, sizez)) @@ -9762,7 +9762,7 @@ void SpawnFireballFlames(DSWActor* actor, DSWActor* enemyActor) if (enemyActor != nullptr) { // large flame for trees and such - if (TEST(enemyActor->spr.extra, SPRX_BURNABLE)) + if ((enemyActor->spr.extra & SPRX_BURNABLE)) { int sizez = ActorSizeZ(enemyActor) + (ActorSizeZ(enemyActor) >> 2); actorNew->user.Counter = GetRepeatFromHeight(actorNew, sizez); @@ -9931,7 +9931,7 @@ void SpawnBoltExp(DSWActor* actor) { ASSERT(actor->hasU()); - if (actor->hasU() && TEST(actor->user.Flags, SPR_SUICIDE)) + if (actor->hasU() && (actor->user.Flags & SPR_SUICIDE)) return; PlaySound(DIGI_BOLTEXPLODE, actor, v3df_none); @@ -9962,7 +9962,7 @@ int SpawnBunnyExp(DSWActor* actor) { ASSERT(actor->hasU()); - if (actor->hasU() && TEST(actor->user.Flags, SPR_SUICIDE)) + if (actor->hasU() && (actor->user.Flags & SPR_SUICIDE)) return -1; PlaySound(DIGI_BUNNYDIE3, actor, v3df_none); @@ -9980,7 +9980,7 @@ void SpawnTankShellExp(DSWActor* actor) { ASSERT(actor->hasU()); - if (actor->hasU() && TEST(actor->user.Flags, SPR_SUICIDE)) + if (actor->hasU() && (actor->user.Flags & SPR_SUICIDE)) return; PlaySound(DIGI_BOLTEXPLODE, actor, v3df_none); @@ -10048,7 +10048,7 @@ void SpawnNuclearExp(DSWActor* actor) short rnd_rng; ASSERT(actor->hasU()); - if (actor->hasU() && TEST(actor->user.Flags, SPR_SUICIDE)) + if (actor->hasU() && (actor->user.Flags & SPR_SUICIDE)) return; PlaySound(DIGI_NUCLEAREXP, actor, v3df_dontpan | v3df_doppler); @@ -10124,7 +10124,7 @@ void SpawnTracerExp(DSWActor* actor) DSWActor* expActor; ASSERT(actor->hasU()); - if (actor->hasU() && TEST(actor->user.Flags, SPR_SUICIDE)) + if (actor->hasU() && (actor->user.Flags & SPR_SUICIDE)) return ; if (actor->user.ID == BOLT_THINMAN_R1) @@ -10157,7 +10157,7 @@ void SpawnTracerExp(DSWActor* actor) void SpawnMicroExp(DSWActor* actor) { ASSERT(actor->hasU()); - if (actor->hasU() && TEST(actor->user.Flags, SPR_SUICIDE)) + if (actor->hasU() && (actor->user.Flags & SPR_SUICIDE)) return ; auto expActor = SpawnActor(STAT_MISSILE, MICRO_EXP, s_MicroExp, actor->spr.sector(), @@ -10324,7 +10324,7 @@ void SpawnGrenadeExp(DSWActor* actor) int dx,dy,dz; ASSERT(actor->hasU()); - if (actor->hasU() && TEST(actor->user.Flags, SPR_SUICIDE)) + if (actor->hasU() && (actor->user.Flags & SPR_SUICIDE)) return; PlaySound(DIGI_30MMEXPLODE, actor, v3df_none); @@ -10423,7 +10423,7 @@ void SpawnExpZadjust(DSWActor* actor, DSWActor* expActor, int upper_zsize, int l void SpawnMineExp(DSWActor* actor) { ASSERT(actor->hasU()); - if (actor->hasU() && TEST(actor->user.Flags, SPR_SUICIDE)) + if (actor->hasU() && (actor->user.Flags & SPR_SUICIDE)) return; change_actor_stat(actor, STAT_MISSILE); @@ -10608,7 +10608,7 @@ int DoFireball(DSWActor* actor) { auto hitActor = actor->user.coll.actor(); - if (TEST(hitActor->spr.extra, SPRX_BURNABLE)) + if ((hitActor->spr.extra & SPRX_BURNABLE)) { if (!hitActor->hasU()) SpawnUser(hitActor, hitActor->spr.picnum, nullptr); @@ -10653,7 +10653,7 @@ int DoFindGround(DSWActor* actor) { auto florActor = florhit.actor(); - if (TEST(florActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR)) + if ((florActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) { // found a sprite floor actor->user.lowActor = florActor; @@ -10705,7 +10705,7 @@ int DoFindGroundPoint(DSWActor* actor) { auto florActor = florhit.actor(); - if (TEST(florActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR)) + if ((florActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) { // found a sprite floor actor->user.lowActor = florActor; @@ -10774,7 +10774,7 @@ int DoNapalm(DSWActor* actor) { auto hitActor = actor->user.coll.actor(); - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_BLOCK) && !(hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_BLOCK) && !(hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { auto hcstat = hitActor->spr.cstat; @@ -11946,13 +11946,13 @@ int InitSwordAttack(PLAYERp pp) return 0; } - if (TEST(hitActor->spr.extra, SPRX_BREAKABLE)) + if ((hitActor->spr.extra & SPRX_BREAKABLE)) { HitBreakSprite(hitActor, 0); } // hit a switch? - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) { ShootableSwitch(hitActor); } @@ -11963,7 +11963,7 @@ int InitSwordAttack(PLAYERp pp) { if (hit.hitWall->twoSided()) { - if (TEST(hit.hitWall->nextSector()->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitWall->nextSector()->ceilingstat & CSTAT_SECTOR_SKY)) { if (hit.hitpos.Z < hit.hitWall->nextSector()->ceilingz) { @@ -12127,13 +12127,13 @@ int InitFistAttack(PLAYERp pp) return 0; } - if (TEST(hitActor->spr.extra, SPRX_BREAKABLE)) + if ((hitActor->spr.extra & SPRX_BREAKABLE)) { HitBreakSprite(hitActor,0); } // hit a switch? - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) { ShootableSwitch(hitActor); } @@ -12157,7 +12157,7 @@ int InitFistAttack(PLAYERp pp) { if (hit.hitWall->twoSided()) { - if (TEST(hit.hitWall->nextSector()->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitWall->nextSector()->ceilingstat & CSTAT_SECTOR_SKY)) { if (hit.hitpos.Z < hit.hitWall->nextSector()->ceilingz) { @@ -12794,7 +12794,7 @@ int ContinueHitscan(PLAYERp pp, sectortype* sect, int x, int y, int z, short ang if (labs(hit.hitpos.Z - hit.hitSector->ceilingz) <= Z(1)) { hit.hitpos.Z += Z(16); - if (TEST(hit.hitSector->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY)) return 0; } else if (labs(hit.hitpos.Z - hit.hitSector->floorz) <= Z(1)) @@ -12806,7 +12806,7 @@ int ContinueHitscan(PLAYERp pp, sectortype* sect, int x, int y, int z, short ang { if (hit.hitWall->twoSided()) { - if (TEST(hit.hitWall->nextSector()->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitWall->nextSector()->ceilingstat & CSTAT_SECTOR_SKY)) { if (hit.hitpos.Z < hit.hitWall->nextSector()->ceilingz) { @@ -12835,7 +12835,7 @@ int ContinueHitscan(PLAYERp pp, sectortype* sect, int x, int y, int z, short ang return 0; } - if (TEST(hitActor->spr.extra, SPRX_BREAKABLE)) + if ((hitActor->spr.extra & SPRX_BREAKABLE)) { HitBreakSprite(hit.actor(),0); return 0; @@ -12845,7 +12845,7 @@ int ContinueHitscan(PLAYERp pp, sectortype* sect, int x, int y, int z, short ang return 0; // hit a switch? - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) { ShootableSwitch(hit.actor()); } @@ -12929,7 +12929,7 @@ int InitShotgun(PLAYERp pp) hit.hitpos.Z += Z(16); cstat |= (CSTAT_SPRITE_YFLIP); - if (TEST(hit.hitSector->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY)) continue; if (SectorIsUnderwaterArea(hit.hitSector)) @@ -12941,7 +12941,7 @@ int InitShotgun(PLAYERp pp) } else if (labs(hit.hitpos.Z - hit.hitSector->floorz) <= Z(1)) { - if (TEST(hit.hitSector->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) + if ((hit.hitSector->extra & SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) { SpawnSplashXY(hit.hitpos.X,hit.hitpos.Y,hit.hitpos.Z,hit.hitSector); @@ -12960,7 +12960,7 @@ int InitShotgun(PLAYERp pp) { if (hit.hitWall->twoSided()) { - if (TEST(hit.hitWall->nextSector()->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitWall->nextSector()->ceilingstat & CSTAT_SECTOR_SKY)) { if (hit.hitpos.Z < hit.hitWall->nextSector()->ceilingz) { @@ -13001,7 +13001,7 @@ int InitShotgun(PLAYERp pp) continue; } - if (TEST(hitActor->spr.extra, SPRX_BREAKABLE)) + if ((hitActor->spr.extra & SPRX_BREAKABLE)) { HitBreakSprite(hitActor,0); continue; @@ -13011,7 +13011,7 @@ int InitShotgun(PLAYERp pp) continue; // hit a switch? - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) { ShootableSwitch(hitActor); } @@ -13890,7 +13890,7 @@ bool WallSpriteInsideSprite(DSWActor* wactor, DSWActor* actor) xoff = (int) tileLeftOffset(wactor->spr.picnum) + (int) wactor->spr.xoffset; - if (TEST(wactor->spr.cstat, CSTAT_SPRITE_XFLIP)) + if ((wactor->spr.cstat & CSTAT_SPRITE_XFLIP)) xoff = -xoff; // x delta @@ -15055,7 +15055,7 @@ int BulletHitSprite(DSWActor* actor, DSWActor* hitActor, int hit_x, int hit_y, i short id; // hit a NPC or PC? - if (TEST(hitActor->spr.extra, SPRX_PLAYER_OR_ENEMY)) + if ((hitActor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { // spawn a red splotch // !FRANK! this if was incorrect - its not who is HIT, its who is SHOOTING @@ -15267,7 +15267,7 @@ int InitUzi(PLAYERp pp) hit.hitpos.Z += Z(16); cstat |= (CSTAT_SPRITE_YFLIP); - if (TEST(hit.hitSector->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY)) return 0; if (SectorIsUnderwaterArea(hit.hitSector)) @@ -15279,7 +15279,7 @@ int InitUzi(PLAYERp pp) } else if (labs(hit.hitpos.Z - hit.hitSector->floorz) <= Z(1)) { - if (TEST(hit.hitSector->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) + if ((hit.hitSector->extra & SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) { SpawnSplashXY(hit.hitpos.X,hit.hitpos.Y,hit.hitpos.Z,hit.hitSector); @@ -15299,7 +15299,7 @@ int InitUzi(PLAYERp pp) { if (hit.hitWall->twoSided()) { - if (TEST(hit.hitWall->nextSector()->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitWall->nextSector()->ceilingstat & CSTAT_SECTOR_SKY)) { if (hit.hitpos.Z < hit.hitWall->nextSector()->ceilingz) { @@ -15342,7 +15342,7 @@ int InitUzi(PLAYERp pp) return 0; } - if (TEST(hitActor->spr.extra, SPRX_BREAKABLE) && HitBreakSprite(hitActor,0)) + if ((hitActor->spr.extra & SPRX_BREAKABLE) && HitBreakSprite(hitActor,0)) { return 0; } @@ -15351,7 +15351,7 @@ int InitUzi(PLAYERp pp) return 0; // hit a switch? - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) { ShootableSwitch(hitActor); } @@ -15756,12 +15756,12 @@ int InitSobjMachineGun(DSWActor* actor, PLAYERp pp) hit.hitpos.Z += Z(16); cstat |= (CSTAT_SPRITE_YFLIP); - if (TEST(hit.hitSector->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY)) return 0; } else if (labs(hit.hitpos.Z - hit.hitSector->floorz) <= Z(1)) { - if (TEST(hit.hitSector->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) + if ((hit.hitSector->extra & SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) { SpawnSplashXY(hit.hitpos.X,hit.hitpos.Y,hit.hitpos.Z,hit.hitSector); return 0; @@ -15784,7 +15784,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYERp pp) return 0; } - if (TEST(hitActor->spr.extra, SPRX_BREAKABLE)) + if ((hitActor->spr.extra & SPRX_BREAKABLE)) { HitBreakSprite(hit.actor(), 0); return 0; @@ -15794,7 +15794,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYERp pp) return 0; // hit a switch? - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) { ShootableSwitch(hit.actor()); } @@ -16137,12 +16137,12 @@ int InitTurretMgun(SECTOR_OBJECTp sop) hit.hitpos.Z += Z(16); cstat |= (CSTAT_SPRITE_YFLIP); - if (TEST(hit.hitSector->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY)) continue; } else if (labs(hit.hitpos.Z - hit.hitSector->floorz) <= Z(1)) { - if (TEST(hit.hitSector->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) + if ((hit.hitSector->extra & SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) { SpawnSplashXY(hit.hitpos.X,hit.hitpos.Y,hit.hitpos.Z,hit.hitSector); continue; @@ -16155,7 +16155,7 @@ int InitTurretMgun(SECTOR_OBJECTp sop) { if (hit.hitWall->twoSided()) { - if (TEST(hit.hitWall->nextSector()->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitWall->nextSector()->ceilingstat & CSTAT_SECTOR_SKY)) { if (hit.hitpos.Z < hit.hitWall->nextSector()->ceilingz) { @@ -16184,7 +16184,7 @@ int InitTurretMgun(SECTOR_OBJECTp sop) continue; } - if (TEST(hitActor->spr.extra, SPRX_BREAKABLE)) + if ((hitActor->spr.extra & SPRX_BREAKABLE)) { HitBreakSprite(hit.actor(), 0); continue; @@ -16194,7 +16194,7 @@ int InitTurretMgun(SECTOR_OBJECTp sop) continue; // hit a switch? - if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) + if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && (hitActor->spr.lotag || hitActor->spr.hitag)) { ShootableSwitch(hit.actor()); } @@ -16288,7 +16288,7 @@ int InitEnemyUzi(DSWActor* actor) { if (hit.hitWall->twoSided()) { - if (TEST(hit.hitWall->nextSector()->ceilingstat, CSTAT_SECTOR_SKY)) + if ((hit.hitWall->nextSector()->ceilingstat & CSTAT_SECTOR_SKY)) { if (hit.hitpos.Z < hit.hitWall->nextSector()->ceilingz) { @@ -16808,7 +16808,7 @@ bool WarpToUnderwater(sectortype** psectu, int *x, int *y, int *z) SWStatIterator it(STAT_DIVE_AREA); while (overActor = it.Next()) { - if (TEST(overActor->spr.sector()->extra, SECTFX_DIVE_AREA) && + if ((overActor->spr.sector()->extra & SECTFX_DIVE_AREA) && overActor->spr.sector()->hasU() && overActor->spr.sector()->number == sectu->number) { @@ -16824,7 +16824,7 @@ bool WarpToUnderwater(sectortype** psectu, int *x, int *y, int *z) it.Reset(STAT_UNDERWATER); while (underActor = it.Next()) { - if (TEST(underActor->spr.sector()->extra, SECTFX_UNDERWATER) && + if ((underActor->spr.sector()->extra & SECTFX_UNDERWATER) && underActor->spr.sector()->hasU() && underActor->spr.sector()->number == sectu->number) { @@ -16877,7 +16877,7 @@ bool WarpToSurface(sectortype** psectu, int *x, int *y, int *z) SWStatIterator it(STAT_UNDERWATER); while (underActor = it.Next()) { - if (TEST(underActor->spr.sector()->extra, SECTFX_UNDERWATER) && + if ((underActor->spr.sector()->extra & SECTFX_UNDERWATER) && underActor->spr.sector()->hasU() && underActor->spr.sector()->number == sectu->number) { @@ -16893,7 +16893,7 @@ bool WarpToSurface(sectortype** psectu, int *x, int *y, int *z) it.Reset(STAT_DIVE_AREA); while (overActor = it.Next()) { - if (TEST(overActor->spr.sector()->extra, SECTFX_DIVE_AREA) && + if ((overActor->spr.sector()->extra & SECTFX_DIVE_AREA) && overActor->spr.sector()->hasU() && overActor->spr.sector()->number == sectu->number) { @@ -16943,7 +16943,7 @@ bool SpriteWarpToUnderwater(DSWActor* actor) SWStatIterator it(STAT_DIVE_AREA); while (overActor = it.Next()) { - if (TEST(overActor->spr.sector()->extra, SECTFX_DIVE_AREA) && + if ((overActor->spr.sector()->extra & SECTFX_DIVE_AREA) && overActor->spr.sector()->hasU() && overActor->spr.sector()->number == sectu->number) { @@ -16959,7 +16959,7 @@ bool SpriteWarpToUnderwater(DSWActor* actor) it.Reset(STAT_UNDERWATER); while (underActor = it.Next()) { - if (TEST(underActor->spr.sector()->extra, SECTFX_UNDERWATER) && + if ((underActor->spr.sector()->extra & SECTFX_UNDERWATER) && underActor->spr.sector()->hasU() && underActor->spr.sector()->number == sectu->number) { @@ -17013,7 +17013,7 @@ bool SpriteWarpToSurface(DSWActor* actor) SWStatIterator it(STAT_UNDERWATER); while (underActor = it.Next()) { - if (TEST(underActor->spr.sector()->extra, SECTFX_UNDERWATER) && + if ((underActor->spr.sector()->extra & SECTFX_UNDERWATER) && underActor->spr.sector()->hasU() && underActor->spr.sector()->number == sectu->number) { @@ -17033,7 +17033,7 @@ bool SpriteWarpToSurface(DSWActor* actor) it.Reset(STAT_DIVE_AREA); while (overActor = it.Next()) { - if (TEST(overActor->spr.sector()->extra, SECTFX_DIVE_AREA) && + if ((overActor->spr.sector()->extra & SECTFX_DIVE_AREA) && overActor->spr.sector()->hasU() && overActor->spr.sector()->number == sectu->number) { @@ -17081,10 +17081,10 @@ int SpawnSplash(DSWActor* actor) if (Prediction) return 0; - if (sectu && (TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_NONE)) + if (sectu && ((sectp->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_NONE)) return 0; - if (sectu && TEST(sectp->floorstat, CSTAT_SECTOR_SKY)) + if (sectu && (sectp->floorstat & CSTAT_SECTOR_SKY)) return 0; PlaySound(DIGI_SPLASH1, actor, v3df_none); @@ -17094,7 +17094,7 @@ int SpawnSplash(DSWActor* actor) auto actorNew = SpawnActor(STAT_MISSILE, SPLASH, s_Splash, actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->user.loz, actor->spr.ang, 0); - if (sectu && TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) + if (sectu && (sectp->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) actorNew->user.spal = actorNew->spr.pal = PALETTE_RED_LIGHTING; actorNew->spr.xrepeat = 45; @@ -17109,15 +17109,15 @@ int SpawnSplashXY(int hit_x, int hit_y, int hit_z, sectortype* sectp) if (Prediction) return 0; - if (sectp->hasU() && (TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_NONE)) + if (sectp->hasU() && ((sectp->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_NONE)) return 0; - if (sectp->hasU() && TEST(sectp->floorstat, CSTAT_SECTOR_SKY)) + if (sectp->hasU() && (sectp->floorstat & CSTAT_SECTOR_SKY)) return 0; auto actorNew = SpawnActor(STAT_MISSILE, SPLASH, s_Splash, sectp, hit_x, hit_y, hit_z, 0, 0); - if (sectp->hasU() && TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) + if (sectp->hasU() && (sectp->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) actorNew->user.spal = actorNew->spr.pal = PALETTE_RED_LIGHTING; actorNew->spr.xrepeat = 45; @@ -17411,11 +17411,11 @@ bool TestDontStick(DSWActor* actor, walltype* hit_wall) } - if (TEST(hit_wall->extra, WALLFX_DONT_STICK)) + if ((hit_wall->extra & WALLFX_DONT_STICK)) return true; // if blocking red wallo - if (TEST(hit_wall->cstat, CSTAT_WALL_BLOCK) && hit_wall->twoSided()) + if ((hit_wall->cstat & CSTAT_WALL_BLOCK) && hit_wall->twoSided()) return true; return false; @@ -17524,16 +17524,16 @@ int QueueFloorBlood(DSWActor* actor) DSWActor* spawnedActor = nullptr; - if (TEST(sectp->extra, SECTFX_SINK)||TEST(sectp->extra, SECTFX_CURRENT)) + if ((sectp->extra & SECTFX_SINK)||(sectp->extra & SECTFX_CURRENT)) return -1; // No blood in water or current areas if (actor->user.Flags & (SPR_UNDERWATER) || SpriteInUnderwaterArea(actor) || SpriteInDiveArea(actor)) return -1; // No blood underwater! - if (TEST(actor->spr.sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER) + if ((actor->spr.sector()->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER) return -1; // No prints liquid areas! - if (TEST(actor->spr.sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) + if ((actor->spr.sector()->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) return -1; // Not in lave either if (TestDontStickSector(actor->spr.sector())) @@ -17602,28 +17602,28 @@ int QueueFootPrint(DSWActor* actor) SECTORp sectp = actor->spr.sector(); - if (TEST(sectp->extra, SECTFX_SINK)||TEST(sectp->extra, SECTFX_CURRENT)) + if ((sectp->extra & SECTFX_SINK)||(sectp->extra & SECTFX_CURRENT)) return -1; // No blood in water or current areas if (actor->user.PlayerP) { - if (TEST(actor->user.PlayerP->Flags, PF_DIVING)) + if ((actor->user.PlayerP->Flags & PF_DIVING)) Found = true; // Stupid masked floor stuff! Damn your weirdness! - if (TEST(actor->user.PlayerP->cursector->ceilingstat, CSTAT_SECTOR_SKY)) + if ((actor->user.PlayerP->cursector->ceilingstat & CSTAT_SECTOR_SKY)) Found = true; - if (TEST(actor->user.PlayerP->cursector->floorstat, CSTAT_SECTOR_SKY)) + if ((actor->user.PlayerP->cursector->floorstat & CSTAT_SECTOR_SKY)) Found = true; } if (actor->user.Flags & (SPR_UNDERWATER) || SpriteInUnderwaterArea(actor) || Found || SpriteInDiveArea(actor)) return -1; // No prints underwater! - if (TEST(actor->spr.sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER) + if ((actor->spr.sector()->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER) return -1; // No prints liquid areas! - if (TEST(actor->spr.sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) + if ((actor->spr.sector()->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) return -1; // Not in lave either if (TestDontStickSector(actor->spr.sector())) @@ -17900,13 +17900,13 @@ int DoWallBlood(DSWActor* actor) // This is the FAST queue, it doesn't call any animator functions or states void QueueGeneric(DSWActor* actor, short pic) { - if (TEST(actor->spr.sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER) + if ((actor->spr.sector()->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER) { KillActor(actor); return; } - if (TEST(actor->spr.sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) + if ((actor->spr.sector()->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) { KillActor(actor); return; @@ -17979,13 +17979,13 @@ int DoShellShrap(DSWActor* actor) } // Get rid of shell if they fall in non-divable liquid areas - if (TEST(actor->spr.sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER) + if ((actor->spr.sector()->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER) { KillActor(actor); return 0; } - if (TEST(actor->spr.sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) + if ((actor->spr.sector()->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) { KillActor(actor); return 0; @@ -18278,7 +18278,7 @@ int ShrapKillSprite(DSWActor* actor) bool CheckBreakToughness(BREAK_INFOp break_info, int ID) { - if (TEST(break_info->flags, BF_TOUGH)) + if ((break_info->flags & BF_TOUGH)) { switch (ID) { @@ -18335,7 +18335,7 @@ int DoItemFly(DSWActor* actor) short wall_ang; auto hit_sprite = actor->user.coll.actor(); - if (TEST(hit_sprite->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) + if ((hit_sprite->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { wall_ang = NORM_ANGLE(hit_sprite->spr.ang); WallBounce(actor, wall_ang); @@ -18388,12 +18388,12 @@ void QueueLoWangs(DSWActor* actor) { DSWActor* spawnedActor; - if (TEST(actor->spr.sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER) + if ((actor->spr.sector()->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER) { return; } - if (TEST(actor->spr.sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) + if ((actor->spr.sector()->extra & SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) { return; } diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index a168b40b6..676a0e408 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -808,7 +808,7 @@ void SpawnZombie2(DSWActor* actor) if (ownerActor == nullptr) return; - if (sectu && (TEST(sectp->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE)) + if (sectu && ((sectp->extra & SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE)) return; if (SectorIsUnderwaterArea(actor->spr.sector())) @@ -859,7 +859,7 @@ int DoZombieMove(DSWActor* actor) DSWActor* tActor = actor->user.targetActor; if (tActor && tActor->hasU()) { - if (TEST(tActor->user.Flags, PF_DEAD)) + if ((tActor->user.Flags & PF_DEAD)) DoActorPickClosePlayer(actor); } @@ -910,7 +910,7 @@ int NullZombie(DSWActor* actor) DSWActor* tActor = actor->user.targetActor; if (tActor && tActor->hasU()) { - if (TEST(tActor->user.Flags, PF_DEAD)) + if ((tActor->user.Flags & PF_DEAD)) DoActorPickClosePlayer(actor); }