From 89e687f166010041126e43d2311a7a942a402c2d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Nov 2021 00:00:51 +0100 Subject: [PATCH] - checkdist --- source/games/whaven/src/ai.cpp | 10 +++++----- source/games/whaven/src/ai.h | 4 ++-- source/games/whaven/src/aidemon.cpp | 4 ++-- source/games/whaven/src/aidevil.cpp | 4 ++-- source/games/whaven/src/aidragon.cpp | 4 ++-- source/games/whaven/src/aifatwitch.cpp | 4 ++-- source/games/whaven/src/aifish.cpp | 6 +++--- source/games/whaven/src/aifred.cpp | 6 +++--- source/games/whaven/src/aigoblin.cpp | 12 ++++++------ source/games/whaven/src/aigonzo.cpp | 10 +++++----- source/games/whaven/src/aigron.cpp | 8 ++++---- source/games/whaven/src/aiguardian.cpp | 4 ++-- source/games/whaven/src/aiimp.cpp | 6 +++--- source/games/whaven/src/aijudy.cpp | 4 ++-- source/games/whaven/src/aikatie.cpp | 4 ++-- source/games/whaven/src/aikobold.cpp | 6 +++--- source/games/whaven/src/aiminotaur.cpp | 6 +++--- source/games/whaven/src/ainewguy.cpp | 6 +++--- source/games/whaven/src/aiskeleton.cpp | 6 +++--- source/games/whaven/src/aiskully.cpp | 4 ++-- source/games/whaven/src/aispider.cpp | 6 +++--- source/games/whaven/src/aiwillow.cpp | 6 +++--- source/games/whaven/src/whani.cpp | 4 ++-- 23 files changed, 67 insertions(+), 67 deletions(-) diff --git a/source/games/whaven/src/ai.cpp b/source/games/whaven/src/ai.cpp index 05a80ea92..770acf177 100644 --- a/source/games/whaven/src/ai.cpp +++ b/source/games/whaven/src/ai.cpp @@ -499,7 +499,7 @@ void aisearch(PLAYER& plr, DWHActor* actor, boolean fly) { else movestat = aimove(actor->GetSpriteIndex()); - if (checkdist(plr, actor->GetSpriteIndex())) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW SetNewStatus(actor, FLEE); @@ -936,15 +936,15 @@ int checkmove(DWHActor* actor, int dax, int day) { return movestat; } -boolean checkdist(PLAYER& plr, int i) { +boolean checkdist(PLAYER& plr, DWHActor* actor) { if (plr.invisibletime > 0 || plr.health <= 0) return false; - return checkdist(i, plr.x, plr.y, plr.z); + return checkdist(actor, plr.x, plr.y, plr.z); } -boolean checkdist(int i, int x, int y, int z) { - SPRITE& spr = sprite[i]; +boolean checkdist(DWHActor* actor, int x, int y, int z) { + SPRITE& spr = actor->s(); int attackdist = 512; int attackheight = 120; diff --git a/source/games/whaven/src/ai.h b/source/games/whaven/src/ai.h index fd1b9fe22..c66770c1b 100644 --- a/source/games/whaven/src/ai.h +++ b/source/games/whaven/src/ai.h @@ -130,8 +130,8 @@ void castspell(PLAYER& plr, int i); void skullycastspell(PLAYER& plr, int i); void attack(PLAYER& plr, int i); int checkmove(DWHActor* actor, int dax, int day); -boolean checkdist(PLAYER& plr, int i); -boolean checkdist(int i, int x, int y, int z); +boolean checkdist(PLAYER& plr, DWHActor* i); +boolean checkdist(DWHActor* i, int x, int y, int z); extern int checksight_ang; boolean checksight(PLAYER& plr, DWHActor* i); void monsterweapon(int i); diff --git a/source/games/whaven/src/aidemon.cpp b/source/games/whaven/src/aidemon.cpp index 86509ea27..b6947bf1a 100644 --- a/source/games/whaven/src/aidemon.cpp +++ b/source/games/whaven/src/aidemon.cpp @@ -34,7 +34,7 @@ static void chasedemon(PLAYER& plr, DWHActor* actor) checksight(plr, actor); - if (!checkdist(plr, i)) { + if (!checkdist(plr, actor)) { checkmove(actor, dax, day); } else { @@ -126,7 +126,7 @@ static void facedemon(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); } diff --git a/source/games/whaven/src/aidevil.cpp b/source/games/whaven/src/aidevil.cpp index 802ed1569..db76537d9 100644 --- a/source/games/whaven/src/aidevil.cpp +++ b/source/games/whaven/src/aidevil.cpp @@ -22,7 +22,7 @@ static void chasedevil(PLAYER& plr, DWHActor* actor) } else { checksight(plr, actor); - if (!checkdist(plr, i)) { + if (!checkdist(plr, actor)) { if ((aimove(i) & kHitTypeMask) == kHitFloor) { spr.ang = (short)((spr.ang + 1024) & 2047); @@ -127,7 +127,7 @@ static void facedevil(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); } diff --git a/source/games/whaven/src/aidragon.cpp b/source/games/whaven/src/aidragon.cpp index 983ffbf46..10c037615 100644 --- a/source/games/whaven/src/aidragon.cpp +++ b/source/games/whaven/src/aidragon.cpp @@ -32,7 +32,7 @@ static void chasedragon(PLAYER& plr, DWHActor* actor) int dax = (bcos(spr.ang) * TICSPERFRAME) << 3; int day = (bsin(spr.ang) * TICSPERFRAME) << 3; checksight(plr, actor); - if (!checkdist(plr, i)) { + if (!checkdist(plr, actor)) { checkmove(actor, dax, day); } else { @@ -302,7 +302,7 @@ static void facedragon(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); } diff --git a/source/games/whaven/src/aifatwitch.cpp b/source/games/whaven/src/aifatwitch.cpp index 4fd62b9b2..738d38339 100644 --- a/source/games/whaven/src/aifatwitch.cpp +++ b/source/games/whaven/src/aifatwitch.cpp @@ -23,7 +23,7 @@ static void chasefatwitch(PLAYER& plr, DWHActor* actor) } else { checksight(plr, actor); - if (!checkdist(i, plr.x, plr.y, plr.z)) { + if (!checkdist(actor, plr.x, plr.y, plr.z)) { int movestat = aimove(i); if ((movestat & kHitTypeMask) == kHitFloor) { @@ -143,7 +143,7 @@ static void facefatwitch(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(i, plr.x, plr.y, plr.z)) + if (checkdist(actor, plr.x, plr.y, plr.z)) SetNewStatus(actor, ATTACK); } diff --git a/source/games/whaven/src/aifish.cpp b/source/games/whaven/src/aifish.cpp index 5d63f90dd..4a7dd2339 100644 --- a/source/games/whaven/src/aifish.cpp +++ b/source/games/whaven/src/aifish.cpp @@ -16,7 +16,7 @@ static void chasefish(PLAYER& plr, DWHActor* actor) short osectnum = spr.sectnum; if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -104,7 +104,7 @@ static void attackfish(PLAYER& plr, DWHActor* actor) if (spr.lotag >= 64) { if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); } @@ -183,7 +183,7 @@ static void facefish(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); } diff --git a/source/games/whaven/src/aifred.cpp b/source/games/whaven/src/aifred.cpp index 90ae201be..bcf4adea3 100644 --- a/source/games/whaven/src/aifred.cpp +++ b/source/games/whaven/src/aifred.cpp @@ -18,7 +18,7 @@ static void chasefred(PLAYER& plr, DWHActor* actor) short osectnum = spr.sectnum; if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -180,7 +180,7 @@ static void facefred(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); checkexplfred(plr, actor); @@ -208,7 +208,7 @@ static void attackfred(PLAYER& plr, DWHActor* actor) if (spr.lotag >= 64) { if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); } diff --git a/source/games/whaven/src/aigoblin.cpp b/source/games/whaven/src/aigoblin.cpp index 38793eec3..739ae24e9 100644 --- a/source/games/whaven/src/aigoblin.cpp +++ b/source/games/whaven/src/aigoblin.cpp @@ -18,7 +18,7 @@ static void chasegoblin(PLAYER& plr, DWHActor* actor) short osectnum = spr.sectnum; if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -157,7 +157,7 @@ static void facegoblin(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); checkexplgoblin(plr, actor); @@ -253,7 +253,7 @@ static void attackgoblin(PLAYER& plr, DWHActor* actor) if (spr.lotag == 31) { if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); } @@ -441,7 +441,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor) processfluid(actor, zr_florhit, false); SetActorPos(actor, &spr.pos); - if (checkdist(i, ownerspr.x, ownerspr.y, ownerspr.z)) { + if (checkdist(actor, ownerspr.x, ownerspr.y, ownerspr.z)) { spr.extra = 2; } else @@ -457,7 +457,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor) k = spr.owner; auto owneractor = &whActors[k]; auto& ownerspr = owneractor->s(); - if (checkdist(i, ownerspr.x, ownerspr.y, ownerspr.z)) { + if (checkdist(actor, ownerspr.x, ownerspr.y, ownerspr.z)) { if ((krand() & 1) != 0) { // goblins are fighting // JSA_DEMO @@ -466,7 +466,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor) if (krand() % 10 > 6) spritesound(S_SWORD1 + (krand() % 6), &spr); - if (checkdist(plr, i)) + if (checkdist(plr, actor)) addhealth(plr, -(krand() & 5)); if (krand() % 100 > 90) { // if k is dead diff --git a/source/games/whaven/src/aigonzo.cpp b/source/games/whaven/src/aigonzo.cpp index 8aa924657..1bbb4443b 100644 --- a/source/games/whaven/src/aigonzo.cpp +++ b/source/games/whaven/src/aigonzo.cpp @@ -23,7 +23,7 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor) case GONZOGSH: if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -116,7 +116,7 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor) case GONZOGSW: if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -354,7 +354,7 @@ static void facegonzo(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (plr.invisibletime < 0 && checkdist(plr, i)) + if (plr.invisibletime < 0 && checkdist(plr, actor)) SetNewStatus(actor, ATTACK); checkexplgonzo(plr, actor); @@ -395,7 +395,7 @@ static void attackgonzo(PLAYER& plr, DWHActor* actor) case KURTPUNCH: if (spr.lotag == 46) { if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); } @@ -427,7 +427,7 @@ static void attackgonzo(PLAYER& plr, DWHActor* actor) case GONZOGSHAT: if (spr.lotag == 31) { if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); } diff --git a/source/games/whaven/src/aigron.cpp b/source/games/whaven/src/aigron.cpp index 1094a32f6..91367cdf6 100644 --- a/source/games/whaven/src/aigron.cpp +++ b/source/games/whaven/src/aigron.cpp @@ -21,7 +21,7 @@ static void chasegron(PLAYER& plr, DWHActor* actor) if (spr.picnum == GRONSW) { if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -73,7 +73,7 @@ static void chasegron(PLAYER& plr, DWHActor* actor) } else { checksight(plr, actor); - if (!checkdist(plr, i)) { + if (!checkdist(plr, actor)) { if ((aimove(i) & kHitTypeMask) == kHitFloor) { spr.ang = (short)((spr.ang + 1024) & 2047); @@ -281,7 +281,7 @@ static void facegron(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); checkexplgron(plr, actor); @@ -310,7 +310,7 @@ static void attackgron(PLAYER& plr, DWHActor* actor) if (spr.lotag == 31) { if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); } diff --git a/source/games/whaven/src/aiguardian.cpp b/source/games/whaven/src/aiguardian.cpp index 280a4ad80..757dbcf24 100644 --- a/source/games/whaven/src/aiguardian.cpp +++ b/source/games/whaven/src/aiguardian.cpp @@ -32,7 +32,7 @@ static void chaseguardian(PLAYER& plr, DWHActor* actor) if (PlayClock % 100 > 70) trailingsmoke(actor,true); - if (!checkdist(plr, i)) { + if (!checkdist(plr, actor)) { checkmove(actor, dax, day); } else { @@ -147,7 +147,7 @@ static void faceguardian(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); } diff --git a/source/games/whaven/src/aiimp.cpp b/source/games/whaven/src/aiimp.cpp index 08ddf5ba8..5beefd7a3 100644 --- a/source/games/whaven/src/aiimp.cpp +++ b/source/games/whaven/src/aiimp.cpp @@ -17,7 +17,7 @@ static void chaseimp(PLAYER& plr, DWHActor* actor) short osectnum = spr.sectnum; if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -192,7 +192,7 @@ static void faceimp(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); checkexplimp(plr, actor); @@ -257,7 +257,7 @@ static void attackimp(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); if (spr.lotag == 32) { //original 64 if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); } diff --git a/source/games/whaven/src/aijudy.cpp b/source/games/whaven/src/aijudy.cpp index 95ea025b9..91553ffd4 100644 --- a/source/games/whaven/src/aijudy.cpp +++ b/source/games/whaven/src/aijudy.cpp @@ -33,7 +33,7 @@ static void chasejudy(PLAYER& plr, DWHActor* actor) } else { checksight(plr, actor); - if (!checkdist(i, plr.x, plr.y, plr.z)) { + if (!checkdist(actor, plr.x, plr.y, plr.z)) { int movestat = aimove(i); if ((movestat & kHitTypeMask) == kHitFloor) { @@ -156,7 +156,7 @@ static void facejudy(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(i, plr.x, plr.y, plr.z)) + if (checkdist(actor, plr.x, plr.y, plr.z)) SetNewStatus(actor, ATTACK); } diff --git a/source/games/whaven/src/aikatie.cpp b/source/games/whaven/src/aikatie.cpp index de069b471..25d0684a6 100644 --- a/source/games/whaven/src/aikatie.cpp +++ b/source/games/whaven/src/aikatie.cpp @@ -23,7 +23,7 @@ static void chasekatie(PLAYER& plr, DWHActor* actor) } else { checksight(plr, actor); - if (!checkdist(i, plr.x, plr.y, plr.z)) { + if (!checkdist(actor, plr.x, plr.y, plr.z)) { int movestat = aimove(i); if ((movestat & kHitTypeMask) == kHitFloor) { @@ -130,7 +130,7 @@ static void facekatie(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(i, plr.x, plr.y, plr.z)) + if (checkdist(actor, plr.x, plr.y, plr.z)) SetNewStatus(actor, ATTACK); } diff --git a/source/games/whaven/src/aikobold.cpp b/source/games/whaven/src/aikobold.cpp index 8a583a7c9..a86889a93 100644 --- a/source/games/whaven/src/aikobold.cpp +++ b/source/games/whaven/src/aikobold.cpp @@ -20,7 +20,7 @@ static void chasekobold(PLAYER& plr, DWHActor* actor) short osectnum = spr.sectnum; if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -162,7 +162,7 @@ static void facekobold(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); checkexplkobold(plr, actor); @@ -225,7 +225,7 @@ static void attackkobold(PLAYER& plr, DWHActor* actor) if (spr.lotag == 34) { if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); } diff --git a/source/games/whaven/src/aiminotaur.cpp b/source/games/whaven/src/aiminotaur.cpp index 4401e9753..31e0db31d 100644 --- a/source/games/whaven/src/aiminotaur.cpp +++ b/source/games/whaven/src/aiminotaur.cpp @@ -17,7 +17,7 @@ static void chaseminotaur(PLAYER& plr, DWHActor* actor) short osectnum = spr.sectnum; if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -202,7 +202,7 @@ static void faceminotaur(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); checkexplminotaur(plr, actor); @@ -230,7 +230,7 @@ static void attackminotaur(PLAYER& plr, DWHActor* actor) if (spr.lotag == 31) { if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); } diff --git a/source/games/whaven/src/ainewguy.cpp b/source/games/whaven/src/ainewguy.cpp index b99fd9d55..62b07022d 100644 --- a/source/games/whaven/src/ainewguy.cpp +++ b/source/games/whaven/src/ainewguy.cpp @@ -34,7 +34,7 @@ static void chasenewguy(PLAYER& plr, DWHActor* actor) short osectnum = spr.sectnum; if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -224,7 +224,7 @@ static void facenewguy(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); } @@ -300,7 +300,7 @@ static void attacknewguy(PLAYER& plr, DWHActor* actor) case NEWGUYPUNCH: if (spr.lotag == 31) { if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); } diff --git a/source/games/whaven/src/aiskeleton.cpp b/source/games/whaven/src/aiskeleton.cpp index fcb842192..a915999de 100644 --- a/source/games/whaven/src/aiskeleton.cpp +++ b/source/games/whaven/src/aiskeleton.cpp @@ -17,7 +17,7 @@ static void chaseskeleton(PLAYER& plr, DWHActor* actor) short osectnum = spr.sectnum; if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -140,7 +140,7 @@ static void faceskeleton(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); checkexplskeleton(plr, actor); @@ -234,7 +234,7 @@ static void attackskeleton(PLAYER& plr, DWHActor* actor) spr.ang = getangle(plr.x - spr.x, plr.y - spr.y); if (spr.lotag == 16) { if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); } diff --git a/source/games/whaven/src/aiskully.cpp b/source/games/whaven/src/aiskully.cpp index 3b73bf7c3..c647cdf6e 100644 --- a/source/games/whaven/src/aiskully.cpp +++ b/source/games/whaven/src/aiskully.cpp @@ -21,7 +21,7 @@ static void chaseskully(PLAYER& plr, DWHActor* actor) } else { checksight(plr, actor); - if (!checkdist(plr, i)) { + if (!checkdist(plr, actor)) { if ((aimove(i) & kHitTypeMask) == kHitFloor) { spr.ang = (short)((spr.ang + 1024) & 2047); @@ -142,7 +142,7 @@ static void faceskully(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); } diff --git a/source/games/whaven/src/aispider.cpp b/source/games/whaven/src/aispider.cpp index 9bf95c24a..92efd61ca 100644 --- a/source/games/whaven/src/aispider.cpp +++ b/source/games/whaven/src/aispider.cpp @@ -17,7 +17,7 @@ static void chasespider(PLAYER& plr, DWHActor* actor) short osectnum = spr.sectnum; if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) { - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shadowtime > 0) { spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); SetNewStatus(actor, FLEE); @@ -181,7 +181,7 @@ static void facespider(PLAYER& plr, DWHActor* actor) else if (cansee) SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); checkexplspider(plr, actor); @@ -207,7 +207,7 @@ static void attackspider(PLAYER& plr, DWHActor* actor) if (spr.lotag >= 64) { if (checksight(plr, actor)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { spr.ang = (short)checksight_ang; attack(plr, i); if (krand() % 100 > ((plr.lvl * 7) + 20)) { diff --git a/source/games/whaven/src/aiwillow.cpp b/source/games/whaven/src/aiwillow.cpp index 6651077a8..365ea17a9 100644 --- a/source/games/whaven/src/aiwillow.cpp +++ b/source/games/whaven/src/aiwillow.cpp @@ -27,7 +27,7 @@ static void chasewillow(PLAYER& plr, DWHActor* actor) int day = (bsin(spr.ang) * TICSPERFRAME) << 3; checksight(plr, actor); - if (!checkdist(plr, i)) { + if (!checkdist(plr, actor)) { checkmove(actor, dax, day); } else { @@ -85,7 +85,7 @@ static void attackwillow(PLAYER& plr, DWHActor* actor) if (spr.lotag < 0) { if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum)) - if (checkdist(plr, i)) { + if (checkdist(plr, actor)) { if (plr.shockme < 0) if ((krand() & 1) != 0) { plr.shockme = 120; @@ -169,7 +169,7 @@ static void facewillow(PLAYER& plr, DWHActor* actor) else SetNewStatus(actor, FLEE); } - if (checkdist(plr, i)) + if (checkdist(plr, actor)) SetNewStatus(actor, ATTACK); } diff --git a/source/games/whaven/src/whani.cpp b/source/games/whaven/src/whani.cpp index 1516d3f9f..a0142b4a8 100644 --- a/source/games/whaven/src/whani.cpp +++ b/source/games/whaven/src/whani.cpp @@ -697,7 +697,7 @@ void animateobjs(PLAYER& plr) { } } - if (checkdist(i, plr.x, plr.y, plr.z)) { + if (checkdist(actor, plr.x, plr.y, plr.z)) { addhealth(plr, -1); flashflag = 1; startredflash(10); @@ -721,7 +721,7 @@ void animateobjs(PLAYER& plr) { SetActorPos(actor, &spr.pos); if (spr.picnum == FBARRELFALL || spr.picnum >= BOULDER && spr.picnum <= BOULDER + 3 - && (checkdist(i, plr.x, plr.y, plr.z))) { + && (checkdist(actor, plr.x, plr.y, plr.z))) { addhealth(plr, -50); startredflash(50); }