diff --git a/source/games/whaven/src/ai.cpp b/source/games/whaven/src/ai.cpp index 00200e28c..d8d114630 100644 --- a/source/games/whaven/src/ai.cpp +++ b/source/games/whaven/src/ai.cpp @@ -427,7 +427,7 @@ void aiProcess() { int i = actor->GetSpriteIndex(); getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z = zr_florz + (tileHeight(spr.picnum) << 5); @@ -560,8 +560,9 @@ boolean checksector6(DWHActor* actor) { return false; } -int checkfluid(int i, Collision& florHit) { - SPRITE& spr = sprite[i]; +int checkfluid(DWHActor* actor, Collision& florHit) +{ + SPRITE& spr = actor->s(); if (isValidSector(spr.sectnum) && florHit.type == kHitSector && (spr.sector()->floorpicnum == WATER /* || spr.sector()->floorpicnum == LAVA2 */ || spr.sector()->floorpicnum == LAVA || spr.sector()->floorpicnum == SLIME || spr.sector()->floorpicnum == FLOORMIRROR @@ -583,7 +584,7 @@ int checkfluid(int i, Collision& florHit) { void processfluid(DWHActor* actor, Collision& florHit, boolean fly) { SPRITE& spr = actor->s(); - switch (checkfluid(actor->GetSpriteIndex(), florHit)) { + switch (checkfluid(actor, florHit)) { case TYPELAVA: if (!fly) { spr.z += tileHeight(spr.picnum) << 5; diff --git a/source/games/whaven/src/ai.h b/source/games/whaven/src/ai.h index 4d5d95f22..a77e71eb3 100644 --- a/source/games/whaven/src/ai.h +++ b/source/games/whaven/src/ai.h @@ -124,7 +124,7 @@ Collision aimove(DWHActor* actor); Collision aifly(DWHActor* i); void aisearch(PLAYER& plr, DWHActor* i, boolean fly); boolean checksector6(DWHActor* i); -int checkfluid(int i, Collision& florhit); +int checkfluid(DWHActor* i, Collision& florhit); void processfluid(DWHActor* i, Collision& florHit, boolean fly); void castspell(PLAYER& plr, DWHActor* i); void skullycastspell(PLAYER& plr, int i); diff --git a/source/games/whaven/src/aidevil.cpp b/source/games/whaven/src/aidevil.cpp index 3d2fa0284..4e46494c4 100644 --- a/source/games/whaven/src/aidevil.cpp +++ b/source/games/whaven/src/aidevil.cpp @@ -173,7 +173,7 @@ static void attackdevil(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; diff --git a/source/games/whaven/src/aifatwitch.cpp b/source/games/whaven/src/aifatwitch.cpp index 52ba9759c..39bb161a2 100644 --- a/source/games/whaven/src/aifatwitch.cpp +++ b/source/games/whaven/src/aifatwitch.cpp @@ -151,7 +151,7 @@ static void attackfatwitch(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; diff --git a/source/games/whaven/src/aifish.cpp b/source/games/whaven/src/aifish.cpp index e175ffcb1..c458d7f93 100644 --- a/source/games/whaven/src/aifish.cpp +++ b/source/games/whaven/src/aifish.cpp @@ -91,7 +91,7 @@ static void attackfish(PLAYER& plr, DWHActor* actor) spr.z = spr.sector()->floorz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) diff --git a/source/games/whaven/src/aifred.cpp b/source/games/whaven/src/aifred.cpp index 3fd09278a..6aa54e31b 100644 --- a/source/games/whaven/src/aifred.cpp +++ b/source/games/whaven/src/aifred.cpp @@ -191,7 +191,7 @@ static void attackfred(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) diff --git a/source/games/whaven/src/aigoblin.cpp b/source/games/whaven/src/aigoblin.cpp index 84a80cdf6..0d43960c1 100644 --- a/source/games/whaven/src/aigoblin.cpp +++ b/source/games/whaven/src/aigoblin.cpp @@ -237,7 +237,7 @@ static void attackgoblin(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) diff --git a/source/games/whaven/src/aigonzo.cpp b/source/games/whaven/src/aigonzo.cpp index fcba98ab3..43f296cca 100644 --- a/source/games/whaven/src/aigonzo.cpp +++ b/source/games/whaven/src/aigonzo.cpp @@ -363,7 +363,7 @@ static void attackgonzo(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; diff --git a/source/games/whaven/src/aigron.cpp b/source/games/whaven/src/aigron.cpp index 1a8f70ef5..dfe6ca5ed 100644 --- a/source/games/whaven/src/aigron.cpp +++ b/source/games/whaven/src/aigron.cpp @@ -292,7 +292,7 @@ static void attackgron(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) diff --git a/source/games/whaven/src/aiimp.cpp b/source/games/whaven/src/aiimp.cpp index 56c83c9a5..e5fcefb6a 100644 --- a/source/games/whaven/src/aiimp.cpp +++ b/source/games/whaven/src/aiimp.cpp @@ -243,7 +243,7 @@ static void attackimp(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) diff --git a/source/games/whaven/src/aijudy.cpp b/source/games/whaven/src/aijudy.cpp index b7bc1a14e..cad6fbd1b 100644 --- a/source/games/whaven/src/aijudy.cpp +++ b/source/games/whaven/src/aijudy.cpp @@ -163,7 +163,7 @@ static void attackjudy(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; diff --git a/source/games/whaven/src/aikatie.cpp b/source/games/whaven/src/aikatie.cpp index 1e703240c..506db071f 100644 --- a/source/games/whaven/src/aikatie.cpp +++ b/source/games/whaven/src/aikatie.cpp @@ -138,7 +138,7 @@ static void attackkatie(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; diff --git a/source/games/whaven/src/aikobold.cpp b/source/games/whaven/src/aikobold.cpp index 1567cec14..b7fbb13d7 100644 --- a/source/games/whaven/src/aikobold.cpp +++ b/source/games/whaven/src/aikobold.cpp @@ -211,7 +211,7 @@ static void attackkobold(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: case TYPEWATER: diff --git a/source/games/whaven/src/aiminotaur.cpp b/source/games/whaven/src/aiminotaur.cpp index 8a8e11610..895100632 100644 --- a/source/games/whaven/src/aiminotaur.cpp +++ b/source/games/whaven/src/aiminotaur.cpp @@ -215,7 +215,7 @@ static void attackminotaur(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) diff --git a/source/games/whaven/src/ainewguy.cpp b/source/games/whaven/src/ainewguy.cpp index 560a937ee..5ae8c8dbe 100644 --- a/source/games/whaven/src/ainewguy.cpp +++ b/source/games/whaven/src/ainewguy.cpp @@ -270,7 +270,7 @@ static void attacknewguy(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; diff --git a/source/games/whaven/src/airat.cpp b/source/games/whaven/src/airat.cpp index e6544c6f6..17075d37d 100644 --- a/source/games/whaven/src/airat.cpp +++ b/source/games/whaven/src/airat.cpp @@ -73,7 +73,7 @@ static void fleerat(PLAYER& plr, DWHActor* actor) processfluid(actor, zr_florHit, false); - // switch (checkfluid(i, zr_florHit)) { + // switch (checkfluid(actor, zr_florHit)) { // case TYPELAVA: // case TYPEWATER: // spr.z += tileHeight(spr.picnum) << 5; diff --git a/source/games/whaven/src/aiskeleton.cpp b/source/games/whaven/src/aiskeleton.cpp index 3859c8193..96948f595 100644 --- a/source/games/whaven/src/aiskeleton.cpp +++ b/source/games/whaven/src/aiskeleton.cpp @@ -219,7 +219,7 @@ static void attackskeleton(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; diff --git a/source/games/whaven/src/aiskully.cpp b/source/games/whaven/src/aiskully.cpp index 7193abaa2..3e3349918 100644 --- a/source/games/whaven/src/aiskully.cpp +++ b/source/games/whaven/src/aiskully.cpp @@ -150,7 +150,7 @@ static void attackskully(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; diff --git a/source/games/whaven/src/aispider.cpp b/source/games/whaven/src/aispider.cpp index e35e21f7e..865c46410 100644 --- a/source/games/whaven/src/aispider.cpp +++ b/source/games/whaven/src/aispider.cpp @@ -192,7 +192,7 @@ static void attackspider(PLAYER& plr, DWHActor* actor) getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - switch (checkfluid(i, zr_florHit)) { + switch (checkfluid(actor, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0)