diff --git a/source/games/whaven/src/ai.cpp b/source/games/whaven/src/ai.cpp index c017b023a..9bf8dc7c4 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(i, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z = zr_florz + (tileHeight(spr.picnum) << 5); @@ -457,7 +457,7 @@ Collision aimove(DWHActor* actor) spr.z += WH2GRAVITYCONSTANT; else spr.z += GRAVITYCONSTANT; - return moveStat.setSector(zr_florhit); + return zr_florHit; } } @@ -541,7 +541,7 @@ void aisearch(PLAYER& plr, DWHActor* actor, boolean fly) { if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, fly); + processfluid(actor, zr_florHit, fly); SetActorPos(actor, &spr.pos); } @@ -560,9 +560,9 @@ boolean checksector6(DWHActor* actor) { return false; } -int checkfluid(int i, int zr_florhit) { +int checkfluid(int i, Collision& florHit) { SPRITE& spr = sprite[i]; - if (isValidSector(spr.sectnum) && (zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == WATER + if (isValidSector(spr.sectnum) && florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == WATER /* || sector[spr.sectnum].floorpicnum == LAVA2 */ || sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == SLIME || sector[spr.sectnum].floorpicnum == FLOORMIRROR /* @@ -581,9 +581,9 @@ int checkfluid(int i, int zr_florhit) { return TYPENONE; } -void processfluid(DWHActor* actor, int zr_florhit, boolean fly) { +void processfluid(DWHActor* actor, Collision& florHit, boolean fly) { SPRITE& spr = actor->s(); - switch (checkfluid(actor->GetSpriteIndex(), zr_florhit)) { + switch (checkfluid(actor->GetSpriteIndex(), 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 c61b99d81..4d5d95f22 100644 --- a/source/games/whaven/src/ai.h +++ b/source/games/whaven/src/ai.h @@ -124,8 +124,8 @@ Collision aimove(DWHActor* actor); Collision aifly(DWHActor* i); void aisearch(PLAYER& plr, DWHActor* i, boolean fly); boolean checksector6(DWHActor* i); -int checkfluid(int i, int zr_florhit); -void processfluid(DWHActor* i, int zr_florhit, boolean fly); +int checkfluid(int i, Collision& florhit); +void processfluid(DWHActor* i, Collision& florHit, boolean fly); void castspell(PLAYER& plr, DWHActor* i); void skullycastspell(PLAYER& plr, int i); void attack(PLAYER& plr, int i); diff --git a/source/games/whaven/src/aidemon.cpp b/source/games/whaven/src/aidemon.cpp index 958f3af21..80de7fbe6 100644 --- a/source/games/whaven/src/aidemon.cpp +++ b/source/games/whaven/src/aidemon.cpp @@ -54,7 +54,7 @@ static void chasedemon(PLAYER& plr, DWHActor* actor) checksector6(actor); - processfluid(actor, zr_florhit, true); + processfluid(actor, zr_florHit, true); if (sector[osectnum].lotag == KILLSECTOR && spr.z + (8 << 8) >= sector[osectnum].floorz) { spr.hitag--; @@ -64,7 +64,7 @@ static void chasedemon(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { if (spr.z + (8 << 8) >= sector[osectnum].floorz) { spr.hitag--; @@ -178,7 +178,7 @@ static void fleedemon(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, true); + processfluid(actor, zr_florHit, true); SetActorPos(actor, &spr.pos); } diff --git a/source/games/whaven/src/aidevil.cpp b/source/games/whaven/src/aidevil.cpp index ad461a5c6..d976fd427 100644 --- a/source/games/whaven/src/aidevil.cpp +++ b/source/games/whaven/src/aidevil.cpp @@ -51,7 +51,7 @@ static void chasedevil(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -96,7 +96,7 @@ static void paindevil(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } @@ -160,7 +160,7 @@ static void fleedevil(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } @@ -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(i, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; diff --git a/source/games/whaven/src/aidragon.cpp b/source/games/whaven/src/aidragon.cpp index 9459dc1f3..85da8df91 100644 --- a/source/games/whaven/src/aidragon.cpp +++ b/source/games/whaven/src/aidragon.cpp @@ -58,7 +58,7 @@ static void chasedragon(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -99,7 +99,7 @@ static void fleedragon(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } @@ -267,7 +267,7 @@ static void paindragon(PLAYER& plr, DWHActor* actor) spr.lotag -= TICSPERFRAME; aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } diff --git a/source/games/whaven/src/aifatwitch.cpp b/source/games/whaven/src/aifatwitch.cpp index fc265feb5..ea63b76f5 100644 --- a/source/games/whaven/src/aifatwitch.cpp +++ b/source/games/whaven/src/aifatwitch.cpp @@ -51,7 +51,7 @@ static void chasefatwitch(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -110,7 +110,7 @@ static void painfatwitch(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } @@ -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(i, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; @@ -202,7 +202,7 @@ static void fleefatwitch(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } diff --git a/source/games/whaven/src/aifish.cpp b/source/games/whaven/src/aifish.cpp index 56b6e3927..1f3a7702e 100644 --- a/source/games/whaven/src/aifish.cpp +++ b/source/games/whaven/src/aifish.cpp @@ -61,7 +61,7 @@ static void chasefish(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -71,7 +71,7 @@ static void chasefish(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -91,7 +91,7 @@ static void attackfish(PLAYER& plr, DWHActor* actor) spr.z = sector[spr.sectnum].floorz; - switch (checkfluid(i, zr_florhit)) { + switch (checkfluid(i, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) @@ -138,7 +138,7 @@ static void skirmishfish(PLAYER& plr, DWHActor* actor) if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); diff --git a/source/games/whaven/src/aifred.cpp b/source/games/whaven/src/aifred.cpp index 5e59fbee6..64f4dbee1 100644 --- a/source/games/whaven/src/aifred.cpp +++ b/source/games/whaven/src/aifred.cpp @@ -63,7 +63,7 @@ static void chasefred(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -73,7 +73,7 @@ static void chasefred(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -100,7 +100,7 @@ static void skirmishfred(PLAYER& plr, DWHActor* actor) if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -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(i, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) @@ -254,7 +254,7 @@ static void fleefred(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -274,7 +274,7 @@ static void painfred(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); checkexplfred(plr, actor); diff --git a/source/games/whaven/src/aigoblin.cpp b/source/games/whaven/src/aigoblin.cpp index 376c5cebf..14c535f5d 100644 --- a/source/games/whaven/src/aigoblin.cpp +++ b/source/games/whaven/src/aigoblin.cpp @@ -69,7 +69,7 @@ static void chasegoblin(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -79,7 +79,7 @@ static void chasegoblin(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -123,7 +123,7 @@ static void paingoblin(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); checkexplgoblin(plr, actor); @@ -192,7 +192,7 @@ static void fleegoblin(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -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(i, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) @@ -336,7 +336,7 @@ static void skirmishgoblin(PLAYER& plr, DWHActor* actor) if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -433,7 +433,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor) else spr.ang = getangle(ownerspr.x - spr.x, ownerspr.y - spr.y); } - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); if (checkdist(actor, ownerspr.x, ownerspr.y, ownerspr.z)) { @@ -485,7 +485,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor) spr.extra = 1; } - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -499,7 +499,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor) if (aimove(actor).type != kHitNone) spr.ang = (short)(krand() & 2047); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); diff --git a/source/games/whaven/src/aigonzo.cpp b/source/games/whaven/src/aigonzo.cpp index 7cf407f3b..da28c9539 100644 --- a/source/games/whaven/src/aigonzo.cpp +++ b/source/games/whaven/src/aigonzo.cpp @@ -169,7 +169,7 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -179,7 +179,7 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -239,7 +239,7 @@ static void skirmishgonzo(PLAYER& plr, DWHActor* actor) if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -316,7 +316,7 @@ static void paingonzo(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); checkexplgonzo(plr, actor); @@ -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(i, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; @@ -475,7 +475,7 @@ static void fleegonzo(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); diff --git a/source/games/whaven/src/aigron.cpp b/source/games/whaven/src/aigron.cpp index 4fa3c87f3..5a940ad9c 100644 --- a/source/games/whaven/src/aigron.cpp +++ b/source/games/whaven/src/aigron.cpp @@ -101,7 +101,7 @@ static void chasegron(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -111,7 +111,7 @@ static void chasegron(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -168,7 +168,7 @@ static void skirmishgron(PLAYER& plr, DWHActor* actor) if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -244,7 +244,7 @@ static void paingron(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); checkexplgron(plr, actor); @@ -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(i, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) @@ -367,7 +367,7 @@ static void fleegron(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); diff --git a/source/games/whaven/src/aiguardian.cpp b/source/games/whaven/src/aiguardian.cpp index 854fcf215..1cb171c4c 100644 --- a/source/games/whaven/src/aiguardian.cpp +++ b/source/games/whaven/src/aiguardian.cpp @@ -51,7 +51,7 @@ static void chaseguardian(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, true); + processfluid(actor, zr_florHit, true); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -64,7 +64,7 @@ static void chaseguardian(PLAYER& plr, DWHActor* actor) if (!isValidSector(spr.sectnum)) return; - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -188,7 +188,7 @@ static void fleeguardian(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, true); + processfluid(actor, zr_florHit, true); SetActorPos(actor, &spr.pos); } diff --git a/source/games/whaven/src/aiimp.cpp b/source/games/whaven/src/aiimp.cpp index 7c630e66c..48a7ce4b8 100644 --- a/source/games/whaven/src/aiimp.cpp +++ b/source/games/whaven/src/aiimp.cpp @@ -70,7 +70,7 @@ static void chaseimp(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -80,7 +80,7 @@ static void chaseimp(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -115,7 +115,7 @@ static void painimp(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } @@ -228,7 +228,7 @@ static void fleeimp(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -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(i, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) @@ -299,7 +299,7 @@ static void skirmishimp(PLAYER& plr, DWHActor* actor) if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); diff --git a/source/games/whaven/src/aijudy.cpp b/source/games/whaven/src/aijudy.cpp index f123a8bac..8b92c5606 100644 --- a/source/games/whaven/src/aijudy.cpp +++ b/source/games/whaven/src/aijudy.cpp @@ -61,7 +61,7 @@ static void chasejudy(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -120,7 +120,7 @@ static void painjudy(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } @@ -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(i, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; @@ -215,7 +215,7 @@ static void fleejudy(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } diff --git a/source/games/whaven/src/aikatie.cpp b/source/games/whaven/src/aikatie.cpp index ec8ba068b..af98e57d2 100644 --- a/source/games/whaven/src/aikatie.cpp +++ b/source/games/whaven/src/aikatie.cpp @@ -51,7 +51,7 @@ static void chasekatie(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -95,7 +95,7 @@ static void painkatie(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } @@ -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(i, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; @@ -194,7 +194,7 @@ static void fleekatie(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } diff --git a/source/games/whaven/src/aikobold.cpp b/source/games/whaven/src/aikobold.cpp index 33885dd8b..01c367fd5 100644 --- a/source/games/whaven/src/aikobold.cpp +++ b/source/games/whaven/src/aikobold.cpp @@ -73,7 +73,7 @@ static void chasekobold(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -83,7 +83,7 @@ static void chasekobold(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -127,7 +127,7 @@ static void painkobold(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); checkexplkobold(plr, actor); @@ -196,7 +196,7 @@ static void fleekobold(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -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(i, zr_florHit)) { case TYPELAVA: case TYPEWATER: @@ -319,7 +319,7 @@ static void skirmishkobold(PLAYER& plr, DWHActor* actor) if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); diff --git a/source/games/whaven/src/aiminotaur.cpp b/source/games/whaven/src/aiminotaur.cpp index d726acd07..f1e5a54f2 100644 --- a/source/games/whaven/src/aiminotaur.cpp +++ b/source/games/whaven/src/aiminotaur.cpp @@ -70,7 +70,7 @@ static void chaseminotaur(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -80,7 +80,7 @@ static void chaseminotaur(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -122,7 +122,7 @@ static void skirmishminotaur(PLAYER& plr, DWHActor* actor) if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -168,7 +168,7 @@ static void painminotaur(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); checkexplminotaur(plr, actor); @@ -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(i, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) @@ -298,7 +298,7 @@ static void fleeminotaur(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); diff --git a/source/games/whaven/src/ainewguy.cpp b/source/games/whaven/src/ainewguy.cpp index cc6f0c882..db99afe24 100644 --- a/source/games/whaven/src/ainewguy.cpp +++ b/source/games/whaven/src/ainewguy.cpp @@ -87,7 +87,7 @@ static void chasenewguy(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -97,7 +97,7 @@ static void chasenewguy(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -155,7 +155,7 @@ static void skirmishnewguy(PLAYER& plr, DWHActor* actor) if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -191,7 +191,7 @@ static void painnewguy(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } @@ -257,7 +257,7 @@ static void fleenewguy(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } @@ -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(i, 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 5f3e9c1ee..735fed65b 100644 --- a/source/games/whaven/src/airat.cpp +++ b/source/games/whaven/src/airat.cpp @@ -71,16 +71,16 @@ static void fleerat(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); - // switch (checkfluid(i, zr_florhit)) { + // switch (checkfluid(i, zr_florHit)) { // case TYPELAVA: // case TYPEWATER: // spr.z += tileHeight(spr.picnum) << 5; // break; // } - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA2 || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; diff --git a/source/games/whaven/src/aiskeleton.cpp b/source/games/whaven/src/aiskeleton.cpp index b977a46dc..3143633d5 100644 --- a/source/games/whaven/src/aiskeleton.cpp +++ b/source/games/whaven/src/aiskeleton.cpp @@ -70,7 +70,7 @@ static void chaseskeleton(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -80,7 +80,7 @@ static void chaseskeleton(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -177,7 +177,7 @@ static void fleeskeleton(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -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(i, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; @@ -323,7 +323,7 @@ static void skirmishskeleton(PLAYER& plr, DWHActor* actor) if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); diff --git a/source/games/whaven/src/aiskully.cpp b/source/games/whaven/src/aiskully.cpp index 50f0cd8e4..54c52f963 100644 --- a/source/games/whaven/src/aiskully.cpp +++ b/source/games/whaven/src/aiskully.cpp @@ -48,7 +48,7 @@ static void chaseskully(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -107,7 +107,7 @@ static void painskully(PLAYER& plr, DWHActor* actor) } aimove(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } @@ -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(i, zr_florHit)) { case TYPELAVA: case TYPEWATER: spr.z += tileHeight(spr.picnum) << 5; @@ -201,7 +201,7 @@ static void fleeskully(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); } diff --git a/source/games/whaven/src/aispider.cpp b/source/games/whaven/src/aispider.cpp index 01ca04f1e..1a74003fe 100644 --- a/source/games/whaven/src/aispider.cpp +++ b/source/games/whaven/src/aispider.cpp @@ -70,7 +70,7 @@ static void chasespider(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -80,7 +80,7 @@ static void chasespider(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA2 || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -122,7 +122,7 @@ static void skirmishspider(PLAYER& plr, DWHActor* actor) if ((spr.sectnum != osectnum) && (sector[spr.sectnum].lotag == 10)) warpsprite(actor); - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); @@ -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(i, zr_florHit)) { case TYPELAVA: spr.hitag--; if (spr.hitag < 0) @@ -261,7 +261,7 @@ static void fleespider(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, false); + processfluid(actor, zr_florHit, false); SetActorPos(actor, &spr.pos); diff --git a/source/games/whaven/src/aiwillow.cpp b/source/games/whaven/src/aiwillow.cpp index 82a433f9c..0da203337 100644 --- a/source/games/whaven/src/aiwillow.cpp +++ b/source/games/whaven/src/aiwillow.cpp @@ -51,7 +51,7 @@ static void chasewillow(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, true); + processfluid(actor, zr_florHit, true); if (sector[osectnum].lotag == KILLSECTOR) { spr.hitag--; @@ -61,7 +61,7 @@ static void chasewillow(PLAYER& plr, DWHActor* actor) SetActorPos(actor, &spr.pos); - if ((zr_florhit & kHitTypeMask) == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA + if (zr_florHit.type == kHitSector && (sector[spr.sectnum].floorpicnum == LAVA || sector[spr.sectnum].floorpicnum == LAVA1 || sector[spr.sectnum].floorpicnum == ANILAVA)) { spr.hitag--; if (spr.hitag < 0) @@ -206,7 +206,7 @@ static void fleewillow(PLAYER& plr, DWHActor* actor) if (checksector6(actor)) return; - processfluid(actor, zr_florhit, true); + processfluid(actor, zr_florHit, true); SetActorPos(actor, &spr.pos); } diff --git a/source/games/whaven/src/input.cpp b/source/games/whaven/src/input.cpp index edfb50ebd..b0ae9527d 100644 --- a/source/games/whaven/src/input.cpp +++ b/source/games/whaven/src/input.cpp @@ -197,7 +197,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) void processinput(int num) { - int goalz, lohit = 0, loz = 0, tics, xvect, yvect; + int goalz, loz = 0, tics, xvect, yvect; int oldposx, oldposy; int dist; @@ -246,13 +246,14 @@ void processinput(int num) { getzrange(plr.x, plr.y, plr.z, plr.sector, 128, CLIPMASK0); loz = zr_florz; - lohit = zr_florhit; + auto lohit = zr_florHit; sprite[plr.spritenum].cstat ^= 1; - if ((lohit & 0xc000) == 49152) { - if ((sprite[lohit & 4095].z - plr.z) <= (getPlayerHeight() << 8)) - onsprite = (short)(lohit & 4095); + if (lohit.type == kHitSprite) { + auto& spr = lohit.actor->s(); + if ((spr.z - plr.z) <= (getPlayerHeight() << 8)) + onsprite = lohit.actor->GetSpriteIndex(); } else onsprite = -1; diff --git a/source/games/whaven/src/wh.cpp b/source/games/whaven/src/wh.cpp index af308a183..a94bb4fec 100644 --- a/source/games/whaven/src/wh.cpp +++ b/source/games/whaven/src/wh.cpp @@ -25,10 +25,14 @@ short floormirrorsector[64]; int floormirrorcnt; // We owe this to Java. Unfortunately WitchavenGDX was a bit sloppy with the use of its global variables so the wrapper is here to stay. :( -int zr_ceilz, zr_ceilhit, zr_florz, zr_florhit; +int zr_ceilz, zr_florz; +Collision zr_florHit; void getzrange(int x, int y, int z, short sectnum, int walldist, int cliptype) { - ::getzrange(x, y, z, sectnum, &zr_ceilz, &zr_ceilhit, &zr_florz, &zr_florhit, walldist, cliptype); + int zr_ceilhit; // The game does not use this. + int lflorhit; + ::getzrange(x, y, z, sectnum, &zr_ceilz, &zr_ceilhit, &zr_florz, &lflorhit, walldist, cliptype); + zr_florHit.setFromEngine(lflorhit); } //This was done better. Strange. diff --git a/source/games/whaven/src/wh.h b/source/games/whaven/src/wh.h index 19c9b309c..feb40b056 100644 --- a/source/games/whaven/src/wh.h +++ b/source/games/whaven/src/wh.h @@ -163,7 +163,8 @@ extern uint8_t wallshadearray[MAXWALLS]; extern short floormirrorsector[64]; extern int floormirrorcnt; -extern int zr_ceilz, zr_ceilhit, zr_florz, zr_florhit; +extern int zr_ceilz, zr_florz; +extern Collision zr_florHit; void getzrange(int x, int y, int z, short sectnum, int walldist, int cliptype); struct Neartag { diff --git a/source/games/whaven/src/whobj.cpp b/source/games/whaven/src/whobj.cpp index 5ae55827f..5f7da8be2 100644 --- a/source/games/whaven/src/whobj.cpp +++ b/source/games/whaven/src/whobj.cpp @@ -1349,7 +1349,7 @@ void newstatus(short sn, int seq) { (spr.clipdist) << 2, CLIPMASK0); spr.z = zr_florz; - if ((zr_florhit & kHitTypeMask) == kHitSector) { + if (zr_florHit.type == kHitSector) { if (spr.sectnum != MAXSECTORS && (sector[spr.sectnum].floorpicnum == WATER || sector[spr.sectnum].floorpicnum == SLIME)) { if (spr.picnum == MINOTAURDEAD) {