From 08fcfb382c0e910ed0999083baa58187c7b29c23 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 27 Dec 2021 19:07:39 +0100 Subject: [PATCH] - the remaining RESET() calls. --- source/games/sw/src/break.cpp | 20 ++++++++++---------- source/games/sw/src/draw.cpp | 6 +++--- source/games/sw/src/girlninj.cpp | 2 +- source/games/sw/src/jweapon.cpp | 2 +- source/games/sw/src/mytypes.h | 1 - source/games/sw/src/ninja.cpp | 6 ++---- source/games/sw/src/panel.cpp | 6 +++--- source/games/sw/src/player.cpp | 6 +++--- source/games/sw/src/rooms.cpp | 2 +- source/games/sw/src/sprite.cpp | 16 ++++++++-------- source/games/sw/src/track.cpp | 12 ++++++------ source/games/sw/src/vis.cpp | 2 +- source/games/sw/src/weapon.cpp | 10 +++++----- 13 files changed, 44 insertions(+), 47 deletions(-) diff --git a/source/games/sw/src/break.cpp b/source/games/sw/src/break.cpp index 6666c8e2f..451d72b12 100644 --- a/source/games/sw/src/break.cpp +++ b/source/games/sw/src/break.cpp @@ -602,23 +602,23 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, int ang, int typ { if (break_info->breaknum == -1) { - RESET(wallp->cstat, CSTAT_WALL_MASKED|CSTAT_WALL_1WAY|CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK); + wallp->cstat &= ~(CSTAT_WALL_MASKED|CSTAT_WALL_1WAY|CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK); wallp->overpicnum = 0; if (wallp->twoSided()) { nwp = wallp->nextWall(); - RESET(nwp->cstat, CSTAT_WALL_MASKED|CSTAT_WALL_1WAY|CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK); + nwp->cstat &= ~(CSTAT_WALL_MASKED|CSTAT_WALL_1WAY|CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK); nwp->overpicnum = 0; } } else { - RESET(wallp->cstat, CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK); + wallp->cstat &= ~(CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK); wallp->overpicnum = break_info->breaknum; if (wallp->twoSided()) { nwp = wallp->nextWall(); - RESET(nwp->cstat, CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK); + nwp->cstat &= ~(CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK); nwp->overpicnum = break_info->breaknum; } } @@ -651,9 +651,9 @@ bool UserBreakWall(WALLp wp) { // do it the old way and get rid of wall - assumed to be masked DoSpawnSpotsForKill(match); - RESET(wp->cstat, flags); + wp->cstat &= ~(flags); if (wp->twoSided()) - RESET(wp->nextWall()->cstat, flags); + wp->nextWall()->cstat &= ~(flags); // clear tags wp->hitag = wp->lotag = 0; @@ -683,9 +683,9 @@ bool UserBreakWall(WALLp wp) else if (SP_TAG8(actor) == 1) { // clear flags - RESET(wp->cstat, flags); + wp->cstat &= ~(flags); if (wp->twoSided()) - RESET(wp->nextWall()->cstat, flags); + wp->nextWall()->cstat &= ~(flags); // clear tags wp->hitag = wp->lotag = 0; if (wp->twoSided()) @@ -699,9 +699,9 @@ bool UserBreakWall(WALLp wp) wp->picnum = SP_TAG5(actor); // clear flags - RESET(wp->cstat, block_flags); + wp->cstat &= ~(block_flags); if (wp->twoSided()) - RESET(wp->nextWall()->cstat, block_flags); + wp->nextWall()->cstat &= ~(block_flags); // clear tags wp->hitag = wp->lotag = 0; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index f47dd3b96..8fdeebc32 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -221,7 +221,7 @@ int DoShadowFindGroundPoint(tspriteptr_t tspr) // because the ceiling and floors get moved out of the way for drawing. save_cstat = tspr->cstat; - RESET(tspr->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); + tspr->cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); FAFgetzrangepoint(tspr->pos.X, tspr->pos.Y, tspr->pos.Z, tspr->sector(), &hiz, &ceilhit, &loz, &florhit); tspr->cstat = save_cstat; @@ -241,7 +241,7 @@ int DoShadowFindGroundPoint(tspriteptr_t tspr) // reset the blocking bit of what you hit and try again - // recursive bak_cstat = hitactor->spr.cstat; - RESET(hitactor->spr.cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); + hitactor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); loz = DoShadowFindGroundPoint(tspr); hitactor->spr.cstat = bak_cstat; } @@ -1006,7 +1006,7 @@ void CircleCamera(int *nx, int *ny, int *nz, sectortype** vsect, binangle *nang, if (!TEST(hitactor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) { auto flag_backup = hitactor->spr.cstat; - RESET(hitactor->spr.cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); + hitactor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); CircleCamera(nx, ny, nz, vsect, nang, q16horiz); hitactor->spr.cstat = flag_backup; diff --git a/source/games/sw/src/girlninj.cpp b/source/games/sw/src/girlninj.cpp index 4455285e8..7227e7a83 100644 --- a/source/games/sw/src/girlninj.cpp +++ b/source/games/sw/src/girlninj.cpp @@ -826,7 +826,7 @@ int DoGirlNinjaSpecial(DSWActor* actor) { if (actor->user.spal == PALETTE_PLAYER5) { - RESET(actor->spr.cstat,CSTAT_SPRITE_TRANSLUCENT); + actor->spr.cstat &= ~(CSTAT_SPRITE_TRANSLUCENT); actor->spr.hitag = 0; actor->spr.shade = -10; } diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index 29d9ab4c5..14efa38e0 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -459,7 +459,7 @@ int DoBloodSpray(DSWActor* actor) actor->user.sy = actor->user.sz; // ceiling and floor are equal - white wall } - RESET(actor->spr.cstat,CSTAT_SPRITE_INVISIBLE); + actor->spr.cstat &= ~(CSTAT_SPRITE_INVISIBLE); ChangeState(actor, s_BloodSprayDrip); } diff --git a/source/games/sw/src/mytypes.h b/source/games/sw/src/mytypes.h index 3b1105932..74d6ec13f 100644 --- a/source/games/sw/src/mytypes.h +++ b/source/games/sw/src/mytypes.h @@ -43,7 +43,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms */ #define TEST(flags,mask) ((flags) & (mask)) -#define RESET(flags,mask) ((flags) &= ~(mask)) #define FLIP(flags,mask) ((flags) ^= (mask)) // mask definitions diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index ca450860d..867f93977 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -1959,7 +1959,7 @@ int DoNinjaGrabThroat(DSWActor* actor) if ((actor->user.WaitTics -= ACTORMOVETICS) <= 0) { UpdateSinglePlayKills(actor); - RESET(actor->user.Flags2, SPR2_DYING); + actor->user.Flags2 &= ~(SPR2_DYING); actor->spr.cstat &= ~(CSTAT_SPRITE_YFLIP); change_actor_stat(actor, STAT_DEAD_ACTOR); actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); @@ -2101,7 +2101,7 @@ int DoNinjaSpecial(DSWActor* actor) { if (actor->user.spal == PALETTE_PLAYER5) { - RESET(actor->spr.cstat,CSTAT_SPRITE_TRANSLUCENT); + actor->spr.cstat &= ~(CSTAT_SPRITE_TRANSLUCENT); actor->spr.hitag = 0; actor->spr.shade = -10; } @@ -2239,8 +2239,6 @@ void PlayerDeathReset(PLAYERp pp) pp->sop_remote = nullptr; pp->sop = nullptr; DoPlayerResetMovement(pp); - //if (pp->CurWpn) - // RESET(pp->CurWpn->flags, PANF_DEATH_HIDE); DamageData[actor->user.WeaponNum].Init(pp); } diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index 299a39c54..5b4cfeaf5 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -353,7 +353,7 @@ void PlayerUpdateAmmo(PLAYERp pp, short UpdateWeaponNum, short value) { // star and mine if (TEST(WeaponIsAmmo, BIT(WeaponNum))) - RESET(pp->WpnFlags, BIT(WeaponNum)); + pp->WpnFlags &= ~(BIT(WeaponNum)); pp->WpnAmmo[WeaponNum] = 0; } @@ -948,7 +948,7 @@ void InitWeaponSword(PLAYERp pp) // 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)) { - RESET(pp->Wpn[WPN_SWORD]->flags, PANF_DEATH_HIDE); + pp->Wpn[WPN_SWORD]->flags &= ~(PANF_DEATH_HIDE); pp->Flags &= ~(PF_WEAPON_RETRACT|PF_WEAPON_DOWN); pSetState(pp->CurWpn, pp->CurWpn->PresentState); return; @@ -1345,7 +1345,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)) { - RESET(pp->Wpn[WPN_STAR]->flags, PANF_DEATH_HIDE); + pp->Wpn[WPN_STAR]->flags &= ~(PANF_DEATH_HIDE); pp->Flags &= ~(PF_WEAPON_RETRACT); pSetState(pp->CurWpn, pp->CurWpn->PresentState); return; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index eb75b824b..2b2c3736e 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1313,7 +1313,7 @@ void DoSpawnTeleporterEffect(DSWActor* actor) effectActor->spr.shade = -40; effectActor->spr.xrepeat = effectActor->spr.yrepeat = 42; effectActor->spr.cstat |= (CSTAT_SPRITE_YCENTER); - RESET(effectActor->spr.cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); + effectActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); effectActor->spr.cstat |= (CSTAT_SPRITE_ALIGNMENT_WALL); } @@ -1331,7 +1331,7 @@ void DoSpawnTeleporterEffectPlace(DSWActor* actor) effectActor->spr.shade = -40; effectActor->spr.xrepeat = effectActor->spr.yrepeat = 42; effectActor->spr.cstat |= (CSTAT_SPRITE_YCENTER); - RESET(effectActor->spr.cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); + effectActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); effectActor->spr.cstat |= (CSTAT_SPRITE_ALIGNMENT_WALL); } @@ -4261,7 +4261,7 @@ void DoPlayerStopDiveNoWarp(PLAYERp pp) pp->Flags &= ~(PF_DIVING|PF_DIVING_IN_LAVA); DoPlayerDivePalette(pp); DoPlayerNightVisionPalette(pp); - RESET(pp->actor->spr.cstat, CSTAT_SPRITE_YCENTER); + pp->actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER); if (pp == Player + screenpeek) { COVER_SetReverb(0); diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index 2b85ab726..596f11116 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -109,7 +109,7 @@ void ResetWallWarpHitscan(sectortype* sect) // Travel all the way around loop setting wall bits do { - RESET(wall_num->cstat, CSTAT_WALL_WARP_HITSCAN); + wall_num->cstat &= ~(CSTAT_WALL_WARP_HITSCAN); wall_num = wall_num->point2Wall(); } while (wall_num != start_wall); diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 57611cd1c..8c69777b7 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -692,7 +692,7 @@ void KillActor(DSWActor* actor) if (actor->user.track != -1) { if (Track[actor->user.track].flags) - RESET(Track[actor->user.track].flags, TF_TRACK_OCCUPIED); + Track[actor->user.track].flags &= ~(TF_TRACK_OCCUPIED); } } @@ -908,7 +908,7 @@ void PicAnimOff(short picnum) if (!anim_type) return; - RESET(picanm[picnum].sf, PICANM_ANIMTYPE_MASK); + picanm[picnum].sf &= ~(PICANM_ANIMTYPE_MASK); } bool IconSpawn(DSWActor* actor) @@ -1589,7 +1589,7 @@ void SpriteSetup(void) // Non ST1 sprites that are tagged like them if (TEST_BOOL1(actor) && actor->spr.picnum != ST1) { - RESET(actor->spr.extra, + actor->spr.extra &= ~( SPRX_BOOL4| SPRX_BOOL5| SPRX_BOOL6| @@ -2822,8 +2822,8 @@ KeyMain: ChangeState(actor, s_Key[num]); - RESET(picanm[actor->spr.picnum].sf, PICANM_ANIMTYPE_MASK); - RESET(picanm[actor->spr.picnum + 1].sf, PICANM_ANIMTYPE_MASK); + picanm[actor->spr.picnum].sf &= ~(PICANM_ANIMTYPE_MASK); + picanm[actor->spr.picnum + 1].sf &= ~(PICANM_ANIMTYPE_MASK); change_actor_stat(actor, STAT_ITEM); actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN | CSTAT_SPRITE_ONE_SIDE); actor->user.Radius = 500; @@ -4231,8 +4231,8 @@ int SpawnItemsMatch(short match) ChangeState(spawnedActor, s_Key[num]); - RESET(picanm[spawnedActor->spr.picnum].sf, PICANM_ANIMTYPE_MASK); - RESET(picanm[spawnedActor->spr.picnum + 1].sf, PICANM_ANIMTYPE_MASK); + picanm[spawnedActor->spr.picnum].sf &= ~(PICANM_ANIMTYPE_MASK); + picanm[spawnedActor->spr.picnum + 1].sf &= ~(PICANM_ANIMTYPE_MASK); SetupItemForJump(itActor, spawnedActor); @@ -4265,7 +4265,7 @@ int NewStateGroup(DSWActor* actor, STATEp StateGroup[]) // turn anims off because people keep setting them in the // art file - RESET(picanm[actor->spr.picnum].sf, PICANM_ANIMTYPE_MASK); + picanm[actor->spr.picnum].sf &= ~(PICANM_ANIMTYPE_MASK); return 0; } diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 7a4e54b4c..c16cf8136 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -876,7 +876,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop) case SO_SHOOT_POINT: ClearOwner(itActor); change_actor_stat(itActor, STAT_SO_SHOOT_POINT); - RESET(itActor->spr.cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); + itActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); break; default: break; @@ -2120,7 +2120,7 @@ void CallbackSOsink(ANIMp ap, void *data) destsect->floorshade = srcsect->floorshade; // destsect->floorz = srcsect->floorz; - RESET(destsect->floorstat, CSTAT_SECTOR_ALIGN); + destsect->floorstat &= ~(CSTAT_SECTOR_ALIGN); destsect->u_defined = true; ASSERT(srcsect->hasU()); @@ -2154,7 +2154,7 @@ void CallbackSOsink(ANIMp ap, void *data) // Take out any blocking walls for(auto& wal : wallsofsector(destsect)) { - RESET(wal.cstat, CSTAT_WALL_BLOCK); + wal.cstat &= ~(CSTAT_WALL_BLOCK); } return; @@ -2421,7 +2421,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny) AnimSet(ANIM_Floorz, *sectp, (*sectp)->floorz + Z((*sectp)->height), 128); (*sectp)->floorshade += (*sectp)->height / 6; - RESET((*sectp)->extra, SECTFX_NO_RIDE); + (*sectp)->extra &= ~(SECTFX_NO_RIDE); } } } @@ -2852,7 +2852,7 @@ void DoAutoTurretObject(SECTOR_OBJECTp sop) void DoActorHitTrackEndPoint(DSWActor* actor) { - RESET(Track[actor->user.track].flags, TF_TRACK_OCCUPIED); + Track[actor->user.track].flags &= ~(TF_TRACK_OCCUPIED); // jump the current track & determine if you should go to another if (TEST(actor->user.Flags, SPR_RUN_AWAY)) @@ -2900,7 +2900,7 @@ void ActorLeaveTrack(DSWActor* actor) return; actor->user.Flags &= ~(SPR_FIND_PLAYER|SPR_RUN_AWAY|SPR_CLIMBING); - RESET(Track[actor->user.track].flags, TF_TRACK_OCCUPIED); + Track[actor->user.track].flags &= ~(TF_TRACK_OCCUPIED); actor->user.track = -1; } diff --git a/source/games/sw/src/vis.cpp b/source/games/sw/src/vis.cpp index 8bc0f8036..ee5348064 100644 --- a/source/games/sw/src/vis.cpp +++ b/source/games/sw/src/vis.cpp @@ -72,7 +72,7 @@ void ProcessVisOn(void) if (own != nullptr) { ASSERT(own->hasU()); - RESET(own->user.Flags2, SPR2_VIS_SHADING); + own->user.Flags2 &= ~(SPR2_VIS_SHADING); } KillActor(actor); } diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 1d18d6e32..f5119544e 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -3184,8 +3184,8 @@ int SpawnShrap(DSWActor* parentActor, DSWActor* secondaryActor, int means, BREAK { // has a user - is programmed change_actor_stat(parentActor, STAT_MISC); - RESET(parentActor->spr.extra, SPRX_BREAKABLE); - RESET(parentActor->spr.cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); + parentActor->spr.extra &= ~(SPRX_BREAKABLE); + parentActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); } } @@ -5180,7 +5180,7 @@ int ActorStdMissile(DSWActor* actor, DSWActor* weapActor) // attempt to see if it was killed ASSERT(goal->spr.insector()); if (goal->hasU()) - RESET(goal->user.Flags, SPR_TARGETED); + goal->user.Flags &= ~(SPR_TARGETED); } return 0; @@ -11570,7 +11570,7 @@ int InitSerpRing(DSWActor* actor) // defaults do change the statnum EnemyDefaults(actorNew, nullptr, nullptr); change_actor_stat(actorNew, STAT_SKIP4); - RESET(actorNew->spr.extra, SPRX_PLAYER_OR_ENEMY); + actorNew->spr.extra &= ~(SPRX_PLAYER_OR_ENEMY); actorNew->spr.clipdist = (128+64) >> 2; actorNew->user.Flags |= (SPR_XFLIP_TOGGLE); @@ -17673,7 +17673,7 @@ int QueueFootPrint(DSWActor* actor) spawnedActor->spr.xoffset = spawnedActor->spr.yoffset = 0; spawnedActor->spr.pos = actor->spr.pos; spawnedActor->spr.ang = actor->spr.ang; - RESET(spawnedActor->user.Flags, SPR_SHADOW); + spawnedActor->user.Flags &= ~(SPR_SHADOW); switch (FootMode) { case BLOOD_FOOT: