From 3a911558692021d069a3564f70565624c8cfcbc6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 26 Nov 2022 14:48:51 +0100 Subject: [PATCH] - use isPlayer function where possible. --- source/games/duke/src/actors_d.cpp | 38 +++++++++++----------- source/games/duke/src/actors_r.cpp | 38 +++++++++++----------- source/games/duke/src/animatesprites_d.cpp | 6 ++-- source/games/duke/src/animatesprites_r.cpp | 10 +++--- source/games/duke/src/player.cpp | 2 +- source/games/duke/src/player_r.cpp | 18 +++++----- source/games/duke/src/sectors_d.cpp | 10 +++--- source/games/duke/src/sectors_r.cpp | 6 ++-- source/games/duke/src/spawn_d.cpp | 4 +-- source/games/duke/src/spawn_r.cpp | 6 ++-- 10 files changed, 69 insertions(+), 69 deletions(-) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 249706c5e31..2d6307298e9 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -179,7 +179,7 @@ bool ifsquished(DDukeActor* actor, int p) if (isRR()) return false; // this function is a no-op in RR's source. bool squishme = false; - if (actor->spr.picnum == APLAYER && ud.clipping) + if (actor->isPlayer() && ud.clipping) return false; auto sectp = actor->sector(); @@ -273,7 +273,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h { if (isWorldTour() && Owner) { - if (Owner->spr.picnum == APLAYER && act2->spr.picnum == APLAYER && ud.coop != 0 && ud.ffire == 0 && Owner != act2) + if (Owner->isPlayer() && act2->isPlayer() && ud.coop != 0 && ud.ffire == 0 && Owner != act2) { continue; } @@ -323,7 +323,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h { if (actor->spr.picnum == SHRINKSPARK || actor->spr.picnum == FLAMETHROWERFLAME) act2-> attackertype = actor->spr.picnum; - else if (actor->spr.picnum != FIREBALL || !Owner || Owner->spr.picnum != APLAYER) + else if (actor->spr.picnum != FIREBALL || !Owner || !Owner->isPlayer()) { if (actor->spr.picnum == LAVAPOOL) act2->attackertype = FLAMETHROWERFLAME; @@ -365,11 +365,11 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h if (act2->spr.picnum != RADIUSEXPLOSION && Owner && Owner->spr.statnum < MAXSTATUS) { - if (act2->spr.picnum == APLAYER) + if (act2->isPlayer()) { int p = act2->spr.yint; - if (isWorldTour() && act2->attackertype == FLAMETHROWERFLAME && Owner->spr.picnum == APLAYER) + if (isWorldTour() && act2->attackertype == FLAMETHROWERFLAME && Owner->isPlayer()) { ps[p].numloogs = -1 - actor->spr.yint; } @@ -503,14 +503,14 @@ int ifhitbyweapon_d(DDukeActor *actor) { if (actor->spr.extra >= 0) { - if (actor->spr.picnum == APLAYER) + if (actor->isPlayer()) { if (ud.god && actor->attackertype != SHRINKSPARK) return -1; p = actor->PlayerIndex(); if (hitowner && - hitowner->spr.picnum == APLAYER && + hitowner->isPlayer() && ud.coop == 1 && ud.ffire == 0) return -1; @@ -525,7 +525,7 @@ int ifhitbyweapon_d(DDukeActor *actor) ps[p].wackedbyactor = hitowner; - if (hitowner->spr.picnum == APLAYER && p != hitowner->PlayerIndex()) + if (hitowner->isPlayer() && p != hitowner->PlayerIndex()) { ps[p].frag_ps = hitowner->PlayerIndex(); } @@ -570,7 +570,7 @@ int ifhitbyweapon_d(DDukeActor *actor) || actor->attackertype != FLAMETHROWERFLAME || actor->hitextra >= 0 || actor->spr.extra > 0 - || actor->spr.picnum != APLAYER + || !actor->isPlayer() || ps[actor->PlayerIndex()].numloogs > 0 || hitowner == nullptr) { @@ -583,7 +583,7 @@ int ifhitbyweapon_d(DDukeActor *actor) actor->spr.extra = 0; ps[p].wackedbyactor = hitowner; - if (hitowner->spr.picnum == APLAYER && hitowner != ps[p].GetActor()) + if (hitowner->isPlayer() && hitowner != ps[p].GetActor()) ps[p].frag_ps = hitowner->PlayerIndex(); // set the proper player index here - this previously set the sprite index... actor->SetHitOwner(ps[p].GetActor()); @@ -804,7 +804,7 @@ static bool movefireball(DDukeActor* actor) static bool weaponhitsprite(DDukeActor* proj, DDukeActor *targ, bool fireball) { if (proj->spr.picnum == FREEZEBLAST && targ->spr.pal == 1) - if (badguy(targ) || targ->spr.picnum == APLAYER) + if (badguy(targ) || targ->isPlayer()) { auto spawned = spawn(targ, TRANSPORTERSTAR); if (spawned) @@ -820,12 +820,12 @@ static bool weaponhitsprite(DDukeActor* proj, DDukeActor *targ, bool fireball) if (!isWorldTour() || proj->spr.picnum != FIREBALL || fireball) fi.checkhitsprite(targ, proj); - if (targ->spr.picnum == APLAYER) + if (targ->isPlayer()) { int p = targ->spr.yint; auto Owner = proj->GetOwner(); - if (ud.multimode >= 2 && fireball && Owner && Owner->spr.picnum == APLAYER) + if (ud.multimode >= 2 && fireball && Owner && Owner->isPlayer()) { ps[p].numloogs = -1 - proj->spr.yint; } @@ -1040,7 +1040,7 @@ static void weaponcommon_d(DDukeActor* proj) { if (proj->spr.picnum == COOLEXPLOSION1) { - if (coll.type == kHitSprite && coll.actor()->spr.picnum != APLAYER) + if (coll.type == kHitSprite && !coll.actor()->isPlayer()) { return; } @@ -1964,7 +1964,7 @@ static void flamethrowerflame(DDukeActor *actor) if (coll.type == kHitSprite) { fi.checkhitsprite(coll.actor(), actor); - if (coll.actor()->spr.picnum == APLAYER) + if (coll.actor()->isPlayer()) S_PlayActorSound(PISTOL_BODYHIT, coll.actor()); } else if (coll.type == kHitWall) @@ -2078,7 +2078,7 @@ static void heavyhbomb(DDukeActor *actor) goto DETONATEB; } - if ( Owner && Owner->spr.picnum == APLAYER) + if ( Owner && Owner->isPlayer()) l = Owner->PlayerIndex(); else l = -1; @@ -2180,7 +2180,7 @@ static void heavyhbomb(DDukeActor *actor) if (ps[p].gotweapon[HANDBOMB_WEAPON] == 0 || Owner == ps[p].GetActor()) fi.addweapon(&ps[p], HANDBOMB_WEAPON, true); - if (!Owner || Owner->spr.picnum != APLAYER) + if (!Owner || !Owner->isPlayer()) { SetPlayerPal(&ps[p], PalEntry(32, 0, 32, 0)); } @@ -2956,7 +2956,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel) { if ((badguy(actor) && actor->spr.extra <= 0) || (actor->opos.X != actor->spr.pos.X) || (actor->opos.Y != actor->spr.pos.Y)) { - if (actor->spr.picnum != APLAYER) actor->backupvec2(); + if (!actor->isPlayer()) actor->backupvec2(); SetActor(actor, actor->spr.pos); } return; @@ -2975,7 +2975,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel) if (a & dodgebullet) dodge(actor); - if (actor->spr.picnum != APLAYER) + if (!actor->isPlayer()) alterang(a, actor, playernum); if (abs(actor->vel.X) < 6 / 16.) actor->vel.X = 0; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 7ddf29372aa..8c3e4f389aa 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -297,7 +297,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h if (act2->spr.picnum != RADIUSEXPLOSION && Owner && Owner->spr.statnum < MAXSTATUS) { - if (act2->spr.picnum == APLAYER) + if (act2->isPlayer()) { int p = act2->PlayerIndex(); if (ps[p].newOwner != nullptr) @@ -405,14 +405,14 @@ int ifhitbyweapon_r(DDukeActor *actor) { if (actor->spr.extra >= 0) { - if (actor->spr.picnum == APLAYER) + if (actor->isPlayer()) { if (ud.god) return -1; p = actor->PlayerIndex(); if (hitowner && - hitowner->spr.picnum == APLAYER && + hitowner->isPlayer() && ud.coop == 1 && ud.ffire == 0) return -1; @@ -427,7 +427,7 @@ int ifhitbyweapon_r(DDukeActor *actor) ps[p].wackedbyactor = hitowner; - if (hitowner->spr.picnum == APLAYER && p != hitowner->PlayerIndex()) + if (hitowner->isPlayer() && p != hitowner->PlayerIndex()) { ps[p].frag_ps = hitowner->PlayerIndex(); } @@ -678,7 +678,7 @@ static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const DVector3 & } } else if (proj->spr.picnum == FREEZEBLAST && targ->spr.pal == 1) - if (badguy(targ) || targ->spr.picnum == APLAYER) + if (badguy(targ) || targ->isPlayer()) { auto star = spawn(proj, TRANSPORTERSTAR); if (star) @@ -693,7 +693,7 @@ static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const DVector3 & fi.checkhitsprite(targ, proj); - if (targ->spr.picnum == APLAYER) + if (targ->isPlayer()) { int p = targ->PlayerIndex(); S_PlayActorSound(PISTOL_BODYHIT, targ); @@ -893,7 +893,7 @@ static void weaponcommon_r(DDukeActor *proj) chickenarrow(proj); break; - case RRTILE1790: + case BOATGRENADE: if (!isRRRA()) break; if (proj->spr.extra) { @@ -913,7 +913,7 @@ static void weaponcommon_r(DDukeActor *proj) Collision coll; movesprite_ex(proj, DVector3(proj->spr.Angles.Yaw.ToVector() * vel, velz), CLIPMASK1, coll); - if ((proj->spr.picnum == RPG || (isRRRA() && isIn(proj->spr.picnum, RPG2, RRTILE1790))) && proj->temp_actor != nullptr) + if ((proj->spr.picnum == RPG || (isRRRA() && isIn(proj->spr.picnum, RPG2, BOATGRENADE))) && proj->temp_actor != nullptr) if ((proj->spr.pos.XY() - proj->temp_actor->spr.pos.XY()).Length() < 16) coll.setSprite(proj->temp_actor); @@ -977,7 +977,7 @@ static void weaponcommon_r(DDukeActor *proj) { if (proj->spr.picnum == RPG) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, -1, RPG_EXPLODE); else if (isRRRA() && proj->spr.picnum == RPG2) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, 150, 247); - else if (isRRRA() && proj->spr.picnum == RRTILE1790) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, 160, RPG_EXPLODE); + else if (isRRRA() && proj->spr.picnum == BOATGRENADE) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, 160, RPG_EXPLODE); else if (proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != FIRELASER && proj->spr.picnum != SHRINKSPARK) { auto spawned = spawn(proj, 1441); @@ -1043,7 +1043,7 @@ void moveweapons_r(void) } [[fallthrough]]; case RPG2: - case RRTILE1790: + case BOATGRENADE: if (!isRRRA()) continue; [[fallthrough]]; case SHRINKSPARK: @@ -1785,7 +1785,7 @@ static void heavyhbomb(DDukeActor *actor) goto DETONATEB; } - if (Owner && Owner->spr.picnum == APLAYER) + if (Owner && Owner->isPlayer()) l = Owner->PlayerIndex(); else l = -1; @@ -1889,14 +1889,14 @@ static void heavyhbomb(DDukeActor *actor) if (ps[p].gotweapon[DYNAMITE_WEAPON] == 0 || Owner == ps[p].GetActor()) fi.addweapon(&ps[p], DYNAMITE_WEAPON, true); - if (!Owner || Owner->spr.picnum != APLAYER) + if (!Owner || !Owner->isPlayer()) { SetPlayerPal(&ps[p], PalEntry(32, 0, 32, 0)); } - if (Owner && (Owner->attackertype != DYNAMITE || ud.respawn_items == 0 || Owner->spr.picnum == APLAYER)) + if (Owner && (Owner->attackertype != DYNAMITE || ud.respawn_items == 0 || Owner->isPlayer())) { - if (actor->spr.picnum == DYNAMITE && Owner->spr.picnum != APLAYER && ud.coop) + if (actor->spr.picnum == DYNAMITE && !Owner->isPlayer() && ud.coop) return; actor->Destroy(); return; @@ -2779,7 +2779,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel) { if ((badguy(actor) && actor->spr.extra <= 0) || (actor->opos.X != actor->spr.pos.X) || (actor->opos.Y != actor->spr.pos.Y)) { - if (actor->spr.picnum != APLAYER) actor->backupvec2(); + if (!actor->isPlayer()) actor->backupvec2(); SetActor(actor, actor->spr.pos); } if (badguy(actor) && actor->spr.extra <= 0) @@ -2811,7 +2811,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel) if (a & dodgebullet) dodge(actor); - if (actor->spr.picnum != APLAYER) + if (!actor->isPlayer()) alterang(a, actor, pnum); if (abs(actor->vel.X) < 6 / 16.) actor->vel.X = 0; @@ -2992,7 +2992,7 @@ static int fallspecial(DDukeActor *actor, int playernum) } else if (actor->sector()->lotag == 802) { - if (actor->spr.picnum != APLAYER && badguy(actor) && actor->spr.pos.Z == actor->floorz - FOURSLEIGHT_F) + if (!actor->isPlayer() && badguy(actor) && actor->spr.pos.Z == actor->floorz - FOURSLEIGHT_F) { spawnguts(actor, PClass::FindActor("DukeJibs6"), 5); S_PlayActorSound(SQUISHED, actor); @@ -3014,7 +3014,7 @@ static int fallspecial(DDukeActor *actor, int playernum) addspritetodelete(); return 0; } - if (actor->spr.picnum != APLAYER && (badguy(actor) || actor->spr.picnum == HEN || actor->spr.picnum == COW || actor->spr.picnum == PIG || actor->spr.picnum == DOGRUN || actor->spr.picnum == RABBIT) && (!isRRRA() || actor->spriteextra < 128)) + if (!actor->isPlayer() && (badguy(actor) || actor->spr.picnum == HEN || actor->spr.picnum == COW || actor->spr.picnum == PIG || actor->spr.picnum == DOGRUN || actor->spr.picnum == RABBIT) && (!isRRRA() || actor->spriteextra < 128)) { actor->spr.pos.Z = actor->floorz - FOURSLEIGHT_F; actor->vel.Z = 8000 / 256.; @@ -3022,7 +3022,7 @@ static int fallspecial(DDukeActor *actor, int playernum) actor->spriteextra++; sphit = 1; } - else if (actor->spr.picnum != APLAYER) + else if (!actor->isPlayer()) { if (!actor->spriteextra) addspritetodelete(); diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index a63a1dee636..d392ce4fb8a 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -163,7 +163,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi if (t->statnum == 99) continue; auto pp = &ps[h->PlayerIndex()]; - if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && pp->newOwner == nullptr && h->GetOwner()) + if (h->spr.statnum != STAT_ACTOR && h->isPlayer() && pp->newOwner == nullptr && h->GetOwner()) { t->pos = h->interpolatedpos(interpfrac); } @@ -507,7 +507,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi t->cstat |= CSTAT_SPRITE_XFLIP; } - if (h->spr.statnum == STAT_DUMMYPLAYER || badguy(h) || (h->spr.picnum == APLAYER && h->GetOwner())) + if (h->spr.statnum == STAT_DUMMYPLAYER || badguy(h) || (h->isPlayer() && h->GetOwner())) { if (t->statnum != 99 && h->spr.picnum != EXPLOSION2 && h->spr.picnum != HANGLIGHT && h->spr.picnum != DOMELITE) { @@ -637,7 +637,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi case FRAMEEFFECT1: if (OwnerAc && OwnerAc->spr.statnum < MAXSTATUS) { - if (OwnerAc->spr.picnum == APLAYER) + if (OwnerAc->isPlayer()) if (ud.cameraactor == nullptr) if (screenpeek == OwnerAc->PlayerIndex() && display_mirror == 0) { diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 614ade9f82a..707c0adf669 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -142,7 +142,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi if (t->statnum == 99) continue; auto pp = &ps[h->PlayerIndex()]; - if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && pp->newOwner == nullptr && h->GetOwner()) + if (h->spr.statnum != STAT_ACTOR && h->isPlayer() && pp->newOwner == nullptr && h->GetOwner()) { t->pos = h->interpolatedpos(interpfrac); h->spr.scale = DVector2(0.375, 0.265625); @@ -636,7 +636,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi if (!isRRRA() && h->spr.picnum == SBMOVE) t->shade = -127; - if (h->spr.statnum == STAT_DUMMYPLAYER || badguy(h) || (h->spr.picnum == APLAYER && h->GetOwner())) + if (h->spr.statnum == STAT_DUMMYPLAYER || badguy(h) || (h->isPlayer() && h->GetOwner())) { if ((h->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0 && t->statnum != 99) { @@ -691,7 +691,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi switch (h->spr.picnum) { case RPG2: - case RRTILE1790: + case BOATGRENADE: if (!isRRRA()) break; [[fallthrough]]; case EXPLOSION2: @@ -838,7 +838,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi case FRAMEEFFECT1: if (OwnerAc && OwnerAc->spr.statnum < MAXSTATUS) { - if (OwnerAc->spr.picnum == APLAYER) + if (OwnerAc->isPlayer()) if (ud.cameraactor == nullptr) if (screenpeek == OwnerAc->PlayerIndex() && display_mirror == 0) { @@ -847,7 +847,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi } if ((OwnerAc->spr.cstat & CSTAT_SPRITE_INVISIBLE) == 0) { - if (OwnerAc->spr.picnum == APLAYER) + if (OwnerAc->isPlayer()) t->picnum = 1554; else t->picnum = OwnerAc->dispicnum; diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 37515c20452..eb15b0ef5f3 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -188,7 +188,7 @@ double hitasprite(DDukeActor* actor, DDukeActor** hitsp) if (badguy(actor)) zoff = 42; - else if (actor->spr.picnum == TILE_APLAYER) zoff = gs.playerheight; + else if (actor->isPlayer()) zoff = gs.playerheight; else zoff = 0; auto pos = actor->spr.pos; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 9d17fee75ef..05dc71a85d1 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -604,7 +604,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw { if (atwith == RPG2) S_PlayActorSound(244, actor); - else if (atwith == RRTILE1790) + else if (atwith == BOATGRENADE) S_PlayActorSound(94, actor); } @@ -631,7 +631,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw if (p < 0) aimed = nullptr; - if (isRRRA() && atwith == RRTILE1790) + if (isRRRA() && atwith == BOATGRENADE) { zvel = -10; vel *= 2; @@ -643,7 +643,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw if (!spawned) return; if (isRRRA()) { - if (atwith == RRTILE1790) + if (atwith == BOATGRENADE) { spawned->spr.extra = 10; spawned->vel.Z = -10; @@ -904,7 +904,7 @@ void shoot_r(DDukeActor* actor, int atwith) return; case RPG2: - case RRTILE1790: + case BOATGRENADE: if (isRRRA()) goto rrra_rpg2; else break; @@ -2426,9 +2426,9 @@ void onBoatMove(int snum, int psectlotag, walltype* wal) void onMotorcycleHit(int snum, DDukeActor* victim) { auto p = &ps[snum]; - if (badguy(victim) || victim->spr.picnum == APLAYER) + if (badguy(victim) || victim->isPlayer()) { - if (victim->spr.picnum != APLAYER) + if (!victim->isPlayer()) { if (numplayers == 1) { @@ -2460,9 +2460,9 @@ void onBoatHit(int snum, DDukeActor* victim) { auto p = &ps[snum]; - if (badguy(victim) || victim->spr.picnum == APLAYER) + if (badguy(victim) || victim->isPlayer()) { - if (victim->spr.picnum != APLAYER) + if (!victim->isPlayer()) { if (numplayers == 1) { @@ -3031,7 +3031,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) { p->MotoSpeed -= 20; p->ammo_amount[BOAT_WEAPON]--; - fi.shoot(pact, RRTILE1790); + fi.shoot(pact, BOATGRENADE); } p->kickback_pic++; if (p->kickback_pic > 20) diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index ae4ce20ee6d..5a5c568e261 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -966,7 +966,7 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj) auto Owner = proj->GetOwner(); - if (Owner && Owner->spr.picnum == APLAYER && targ->spr.picnum != ROTATEGUN && targ->spr.picnum != DRONE) + if (Owner && Owner->isPlayer() && targ->spr.picnum != ROTATEGUN && targ->spr.picnum != DRONE) if (ps[Owner->PlayerIndex()].curr_weapon == SHOTGUN_WEAPON) { fi.shoot(targ, BLOODSPLAT3); @@ -997,14 +997,14 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj) if (targ->spr.statnum != STAT_ZOMBIEACTOR) { - if (proj->spr.picnum == FREEZEBLAST && ((targ->spr.picnum == APLAYER && targ->spr.pal == 1) || (gs.freezerhurtowner == 0 && proj->GetOwner() == targ))) + if (proj->spr.picnum == FREEZEBLAST && ((targ->isPlayer() && targ->spr.pal == 1) || (gs.freezerhurtowner == 0 && proj->GetOwner() == targ))) return; int hitpic = proj->spr.picnum; auto Owner = proj->GetOwner(); - if (Owner && Owner->spr.picnum == APLAYER) + if (Owner && Owner->isPlayer()) { - if (targ->spr.picnum == APLAYER && ud.coop != 0 && ud.ffire == 0) + if (targ->isPlayer() && ud.coop != 0 && ud.ffire == 0) return; auto tOwner = targ->GetOwner(); @@ -1039,7 +1039,7 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj) return; auto hitowner = targ->GetHitOwner(); - if (!hitowner || hitowner->spr.picnum != APLAYER) + if (!hitowner || !hitowner->isPlayer()) if (ud.player_skill >= 3) proj->spr.extra += (proj->spr.extra >> 1); } diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index e5c67eafa64..7cff6b01590 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -1330,7 +1330,7 @@ void checkhitdefault_r(DDukeActor* targ, DDukeActor* proj) auto Owner = proj->GetOwner(); - if (Owner && Owner->spr.picnum == APLAYER && targ->spr.picnum != DRONE) + if (Owner && Owner->isPlayer() && targ->spr.picnum != DRONE) if (ps[Owner->PlayerIndex()].curr_weapon == SHOTGUN_WEAPON) { fi.shoot(targ, BLOODSPLAT3); @@ -1348,7 +1348,7 @@ void checkhitdefault_r(DDukeActor* targ, DDukeActor* proj) if (targ->spr.statnum != 2) { - if (proj->spr.picnum == FREEZEBLAST && ((targ->spr.picnum == APLAYER && targ->spr.pal == 1) || (gs.freezerhurtowner == 0 && proj->GetOwner() == targ))) + if (proj->spr.picnum == FREEZEBLAST && ((targ->isPlayer() && targ->spr.pal == 1) || (gs.freezerhurtowner == 0 && proj->GetOwner() == targ))) return; targ->attackertype = proj->spr.picnum; @@ -1375,7 +1375,7 @@ void checkhitdefault_r(DDukeActor* targ, DDukeActor* proj) } } auto Owner = targ->GetHitOwner(); - if (!Owner || Owner->spr.picnum != APLAYER) + if (!Owner || !Owner->isPlayer()) if (ud.player_skill >= 3) proj->spr.extra += (proj->spr.extra >> 1); } diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index bf8758741d8..a78a7f583c6 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -420,7 +420,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* break; case DUKELYINGDEAD: - if (actj && actj->spr.picnum == APLAYER) + if (actj && actj->isPlayer()) { act->spr.scale = actj->spr.scale; act->spr.shade = actj->spr.shade; @@ -564,7 +564,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* break; } case WATERBUBBLE: - if (actj && actj->spr.picnum == APLAYER) + if (actj && actj->isPlayer()) act->spr.pos.Z -= 16; if (act->spr.picnum == WATERBUBBLE) { diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 011840aa792..26d26541cab 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -168,7 +168,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* if (actj) { act->spr.scale = actj->spr.scale; - if (actj->spr.picnum == APLAYER) + if (actj->isPlayer()) act->temp_data[1] = SMALLSMOKE; else act->temp_data[1] = actj->spr.picnum; @@ -333,7 +333,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* ChangeActorStat(act, STAT_ZOMBIEACTOR); break; case DUKELYINGDEAD: - if (actj && actj->spr.picnum == APLAYER) + if (actj && actj->isPlayer()) { act->spr.scale = actj->spr.scale; act->spr.shade = actj->spr.shade; @@ -451,7 +451,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* break; } case WATERBUBBLE: - if (actj && actj->spr.picnum == APLAYER) + if (actj && actj->isPlayer()) act->spr.pos.Z -= 16; if (act->spr.picnum == WATERBUBBLE) {