From 01bb5491afc280c2fed7ae8c3c1bd08c2ed80d4e Mon Sep 17 00:00:00 2001 From: "Richard C. Gobeille" Date: Sat, 4 Apr 2020 23:40:38 -0700 Subject: [PATCH] Rename G_HaveActor() and G_DefaultActorHealth() for clarity The new names are G_TileHasActor() and G_DefaultActorHealthForTile(). # Conflicts: # source/duke3d/src/duke3d.h --- source/duke3d/src/actors.cpp | 16 ++++++++-------- source/duke3d/src/duke3d.h | 8 ++++---- source/duke3d/src/game.cpp | 4 ++-- source/duke3d/src/gameexec.cpp | 4 ++-- source/duke3d/src/network.cpp | 2 +- source/duke3d/src/player.cpp | 4 ++-- source/duke3d/src/sector.cpp | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 8ff2ceb99..ae46afd22 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -1371,7 +1371,7 @@ ACTOR_STATIC void G_MovePlayers(void) otherPlayerDist = 0; } - if (G_HaveActor(sprite[spriteNum].picnum)) + if (G_TileHasActor(sprite[spriteNum].picnum)) A_Execute(spriteNum, P_GetP(pSprite), otherPlayerDist); pPlayer->q16angvel = P_GetQ16AngleDeltaForTic(pPlayer); @@ -2737,7 +2737,7 @@ DETONATE: case STEAM__STATIC: case CEILINGSTEAM__STATIC: case WATERBUBBLEMAKER__STATIC: - if (!G_HaveActor(sprite[spriteNum].picnum)) + if (!G_TileHasActor(sprite[spriteNum].picnum)) goto next_sprite; { int32_t playerDist; @@ -2911,7 +2911,7 @@ ACTOR_STATIC void Proj_MoveCustom(int const spriteNum) { case PROJECTILE_HITSCAN: { - if (!G_HaveActor(sprite[spriteNum].picnum)) + if (!G_TileHasActor(sprite[spriteNum].picnum)) return; int32_t playerDist; int const playerNum = A_FindPlayer(pSprite, &playerDist); @@ -3198,7 +3198,7 @@ ACTOR_STATIC void G_MoveWeapons(void) { case SHOTSPARK1__STATIC: { - if (!G_HaveActor(sprite[spriteNum].picnum)) + if (!G_TileHasActor(sprite[spriteNum].picnum)) goto next_sprite; int32_t playerDist; int const playerNum = A_FindPlayer(pSprite, &playerDist); @@ -4048,7 +4048,7 @@ ACTOR_STATIC void G_MoveActors(void) if (!WORLDTOUR) goto next_sprite; - if (G_HaveActor(sprite[spriteNum].picnum)) + if (G_TileHasActor(sprite[spriteNum].picnum)) { int32_t playerDist; int const playerNum = A_FindPlayer(pSprite, &playerDist); @@ -5375,7 +5375,7 @@ DETONATEB: } } - if (G_HaveActor(sprite[spriteNum].picnum)) + if (G_TileHasActor(sprite[spriteNum].picnum)) { int32_t playerDist; int const playerNum = A_FindPlayer(pSprite, &playerDist); @@ -5474,7 +5474,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 case LASERSITE__STATIC: #endif { - if (!G_HaveActor(sprite[spriteNum].picnum)) + if (!G_TileHasActor(sprite[spriteNum].picnum)) goto next_sprite; int const playerNum = A_FindPlayer(pSprite, &playerDist); A_Execute(spriteNum, playerNum, playerDist); @@ -5919,7 +5919,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 goto next_sprite; case FIREFLYFLYINGEFFECT__STATIC: - if (WORLDTOUR && G_HaveActor(sprite[spriteNum].picnum)) + if (WORLDTOUR && G_TileHasActor(sprite[spriteNum].picnum)) { int playerDist; int const playerNum = A_FindPlayer(pSprite, &playerDist); diff --git a/source/duke3d/src/duke3d.h b/source/duke3d/src/duke3d.h index 70e378f56..6ad871708 100644 --- a/source/duke3d/src/duke3d.h +++ b/source/duke3d/src/duke3d.h @@ -132,14 +132,14 @@ EDUKE32_STATIC_ASSERT(7 <= MAXTILES-MAXUSERTILES); BEGIN_DUKE_NS -static inline int32_t G_HaveActor(int spriteNum) +static inline int32_t G_TileHasActor(int const tileNum) { - return g_tile[spriteNum].execPtr!=NULL; + return g_tile[tileNum].execPtr!=NULL; } -static inline int32_t G_DefaultActorHealth(int spriteNum) +static inline int32_t G_DefaultActorHealthForTile(int const tileNum) { - return G_HaveActor(spriteNum) ? g_tile[spriteNum].execPtr[0] : 0; + return G_TileHasActor(tileNum) ? g_tile[tileNum].execPtr[0] : 0; } diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index c09a13211..25268b3b5 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -3171,7 +3171,7 @@ int A_Spawn(int spriteNum, int tileNum) } // implementation of the default case - if (G_HaveActor(pSprite->picnum)) + if (G_TileHasActor(pSprite->picnum)) { if (spriteNum == -1 && pSprite->lotag > ud.player_skill) { @@ -3880,7 +3880,7 @@ PALONLY: break; } - if (G_HaveActor(pSprite->picnum)) + if (G_TileHasActor(pSprite->picnum)) { #if !defined LUNATIC if ((unsigned)scrofs_action + ACTION_PARAM_COUNT > (unsigned)g_scriptSize) diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 2ac0eebe4..5191b6539 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -990,7 +990,7 @@ static int32_t A_GetWaterZOffset(int const spriteNum) return 0; // fix for flying/jumping monsters getting stuck in water - if ((AC_MOVFLAGS(pSprite, pActor) & jumptoplayer_only) || (G_HaveActor(pSprite->picnum) && A_GetVerticalVel(pActor) != 0)) + if ((AC_MOVFLAGS(pSprite, pActor) & jumptoplayer_only) || (G_TileHasActor(pSprite->picnum) && A_GetVerticalVel(pActor) != 0)) return 0; return ACTOR_ONWATER_ADDZ; @@ -3954,7 +3954,7 @@ badindex: pActor->flags = 0; pSprite->hitag = 0; - if (G_HaveActor(pSprite->picnum)) + if (G_TileHasActor(pSprite->picnum)) { auto actorptr = g_tile[pSprite->picnum].execPtr; // offsets diff --git a/source/duke3d/src/network.cpp b/source/duke3d/src/network.cpp index ab83926d1..7d2331124 100644 --- a/source/duke3d/src/network.cpp +++ b/source/duke3d/src/network.cpp @@ -918,7 +918,7 @@ static void Net_CopyActorFromNet(const netactor_t* netActor, actor_t *gameActor) bool aiIDChanged = (gameActor->t_data[5] != netActor->t_data_5); // If the sprite is a CON sprite, don't overwrite AC_Action_Count - bool isActor = G_HaveActor(netActor->spr_picnum); + bool isActor = G_TileHasActor(netActor->spr_picnum); // Fixes ambient sound infinite sound replay glitch (stand in the outdoor area of E1L1, the "airplane noise" will get very loud and loop endlessly. bool isSoundActor = (DYNAMICTILEMAP(netActor->picnum) == MUSICANDSFX); diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 702b6f53c..b9e836a54 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -1210,14 +1210,14 @@ static int32_t A_ShootHardcoded(int spriteNum, int projecTile, int shootAng, vec if (playerNum >= 0) { - spawnedSprite = Proj_InsertShotspark(&hitData, spriteNum, projecTile, 10, shootAng, G_DefaultActorHealth(projecTile) + (krand() % 6)); + spawnedSprite = Proj_InsertShotspark(&hitData, spriteNum, projecTile, 10, shootAng, G_DefaultActorHealthForTile(projecTile) + (krand() % 6)); if (P_PostFireHitscan(playerNum, spawnedSprite, &hitData, spriteNum, projecTile, Zvel, -SMALLSMOKE, BULLETHOLE, SHOTSPARK1, 0) < 0) return -1; } else { - spawnedSprite = A_PostFireHitscan(&hitData, spriteNum, projecTile, Zvel, shootAng, G_DefaultActorHealth(projecTile), -SMALLSMOKE, + spawnedSprite = A_PostFireHitscan(&hitData, spriteNum, projecTile, Zvel, shootAng, G_DefaultActorHealthForTile(projecTile), -SMALLSMOKE, SHOTSPARK1); } diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index 0867c79bf..e985bcd0d 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -2072,7 +2072,7 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc) case FUELPOD__STATIC: case SOLARPANNEL__STATIC: case ANTENNA__STATIC: - if (sprite[dmgSrc].extra != G_DefaultActorHealth(SHOTSPARK1)) + if (sprite[dmgSrc].extra != G_DefaultActorHealthForTile(SHOTSPARK1)) { for (bssize_t j=15; j>0; j--) A_InsertSprite(SECT(spriteNum),SX(spriteNum),SY(spriteNum),sector[SECT(spriteNum)].floorz-ZOFFSET4-(j<<9),SCRAP1+(krand()&15),-8,64,64,