From 20043f6223159c2b719655bee3554c483af64031 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 25 Sep 2022 10:57:46 +0200 Subject: [PATCH] - use symbolic constants in neartag calls. --- source/core/gamefuncs.h | 7 +++++++ source/games/duke/src/gameexec.cpp | 2 +- source/games/duke/src/sectors_d.cpp | 10 +++++----- source/games/duke/src/sectors_r.cpp | 12 ++++++------ source/games/exhumed/src/player.cpp | 2 +- source/games/sw/src/sector.cpp | 2 +- source/games/sw/src/sector.h | 1 - 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 472e54196..c0c99c725 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -288,6 +288,13 @@ void dragpoint(walltype* wal, const DVector2& pos); int32_t inside(double x, double y, const sectortype* sect); int insidePoly(double x, double y, const DVector2* points, int count); +enum { + NT_Lotag = 1, + NT_Hitag = 2, + NT_NoSpriteCheck = 4 +}; + + //========================================================================== // // slope stuff (many wrappers, one worker only) diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 93f0d95a6..4636f91ea 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -2482,7 +2482,7 @@ int ParseState::parse(void) if( g_ac->sector()->lotag == 0 ) { HitInfo hit{}; - neartag(g_ac->spr.pos.plusZ(-32), g_ac->sector(), g_ac->spr.angle, hit, 48, 1); + neartag(g_ac->spr.pos.plusZ(-32), g_ac->sector(), g_ac->spr.angle, hit, 48, NT_Lotag | NT_NoSpriteCheck); auto sectp = hit.hitSector; if (sectp) { diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 9d42e7e8c..16853e390 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -1595,17 +1595,17 @@ void checksectors_d(int snum) return; } if (p->newOwner != nullptr) - neartag(p->opos, p->GetActor()->sector(), p->angle.oang, near, 80., 1); + neartag(p->opos, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); else { - neartag(p->pos, p->GetActor()->sector(), p->angle.oang, near, 80., 1); + neartag(p->pos, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) - neartag(p->pos.plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., 1); + neartag(p->pos.plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) - neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., 1); + neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) { - neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., 3); + neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag | NT_Hitag); if (near.actor() != nullptr) { switch (near.actor()->spr.picnum) diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index d36f61717..b269649b5 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -2533,21 +2533,21 @@ void checksectors_r(int snum) } return; } - neartag(p->pos, p->GetActor()->sector(), p->angle.oang, near , 80., 3); + neartag(p->pos, p->GetActor()->sector(), p->angle.oang, near , 80., NT_Lotag | NT_Hitag); } if (p->newOwner != nullptr) - neartag(p->opos, p->GetActor()->sector(), p->angle.oang, near, 80., 1); + neartag(p->opos, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); else { - neartag(p->pos, p->GetActor()->sector(), p->angle.oang, near, 80., 1); + neartag(p->pos, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) - neartag(p->pos.plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., 1); + neartag(p->pos.plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) - neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., 1); + neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) { - neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., 3); + neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag | NT_Hitag); if (near.actor() != nullptr) { switch (near.actor()->spr.picnum) diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index ef54efd78..c38627475 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -1364,7 +1364,7 @@ sectdone: HitInfo near; // neartag finds the nearest sector, wall, and sprite which has its hitag and/or lotag set to a value. - neartag(pPlayerActor->spr.pos, pPlayerActor->sector(), pPlayerActor->spr.angle, near, 128., 2); + neartag(pPlayerActor->spr.pos, pPlayerActor->sector(), pPlayerActor->spr.angle, near, 128., NT_Hitag | NT_NoSpriteCheck); DExhumedActor* pActorB; feebtag(pPlayerActor->spr.pos, pPlayerActor->sector(), &pActorB, var_30, 48); diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index f58d7b5a6..62731015f 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -2211,7 +2211,7 @@ bool NearThings(PLAYER* pp) // //--------------------------------------------------------------------------- -short nti_cnt; +static int nti_cnt; void NearTagList(NEAR_TAG_INFO* ntip, PLAYER* pp, double z, double dist, int type, int count) { diff --git a/source/games/sw/src/sector.h b/source/games/sw/src/sector.h index 6f1b03e95..6933a554a 100644 --- a/source/games/sw/src/sector.h +++ b/source/games/sw/src/sector.h @@ -62,7 +62,6 @@ struct NEAR_TAG_INFO walltype* wallp; DSWActor* actor; }; -extern short nti_cnt; void DoSpawnSpotsForKill(short match); void DoSpawnSpotsForDamage(short match);