diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index f78137827..f90a47430 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -217,13 +217,6 @@ inline int32_t FIXED(int32_t msw, int32_t lsw) #define SET_SP_TAG13(sp,val) (*((short*)&(sp)->xoffset)) = LittleShort((short)val) #define SET_SP_TAG14(sp,val) (*((short*)&(sp)->xrepeat)) = LittleShort((short)val) -// OVER and UNDER water macros -#define SpriteInDiveArea(sp) (TEST(sector[(sp)->sectnum].extra, SECTFX_DIVE_AREA) ? true : false) -#define SpriteInUnderwaterArea(sp) (TEST(sector[(sp)->sectnum].extra, SECTFX_UNDERWATER|SECTFX_UNDERWATER2) ? true : false) - -#define SectorIsDiveArea(sect) (TEST(sector[sect].extra, SECTFX_DIVE_AREA) ? true : false) -#define SectorIsUnderwaterArea(sect) (TEST(sector[sect].extra, SECTFX_UNDERWATER|SECTFX_UNDERWATER2) ? true : false) - #define TRAVERSE_CONNECT(i) for (i = connecthead; i != -1; i = connectpoint2[i]) @@ -2205,6 +2198,27 @@ struct GameInterface : public ::GameInterface }; +// OVER and UNDER water macros +inline bool SpriteInDiveArea(SPRITEp sp) +{ + return (TEST(sector[(sp)->sectnum].extra, SECTFX_DIVE_AREA) ? true : false); +} + +inline bool SpriteInUnderwaterArea(SPRITEp sp) +{ + return (TEST(sector[(sp)->sectnum].extra, SECTFX_UNDERWATER | SECTFX_UNDERWATER2) ? true : false); +} + +inline bool SectorIsDiveArea(int sect) +{ + return (TEST(sector[sect].extra, SECTFX_DIVE_AREA) ? true : false); +} + +inline bool SectorIsUnderwaterArea(int sect) +{ + return (TEST(sector[sect].extra, SECTFX_UNDERWATER | SECTFX_UNDERWATER2) ? true : false); +} + END_SW_NS #include "swactor.h" diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 85f5794e6..0a5785750 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -19866,12 +19866,10 @@ SpawnSmokePuff(DSWActor* actor) } -int -DoBubble(DSWActor* actor) +int DoBubble(DSWActor* actor) { USER* u = actor->u(); - int SpriteNum = u->SpriteNum; - SPRITEp sp = &sprite[SpriteNum]; + SPRITEp sp = &actor->s(); sp->z -= sp->zvel; sp->zvel += 32; @@ -19893,7 +19891,7 @@ DoBubble(DSWActor* actor) if (sp->z < sector[sp->sectnum].ceilingz) { - if (SectorIsUnderwaterArea(u->hi_sectp - sector)) + if (SectorIsUnderwaterArea(int(u->hi_sectp - sector))) { if (!SpriteWarpToSurface(sp)) { @@ -19938,7 +19936,7 @@ DoBubble(DSWActor* actor) // with the drivables, copy sectors, break sprites, etc void SpriteQueueDelete(DSWActor* actor) { - int i; + size_t i; int SpriteNum = actor->GetSpriteIndex(); for (i = 0; i < MAX_STAR_QUEUE; i++) @@ -19969,7 +19967,7 @@ void SpriteQueueDelete(DSWActor* actor) void QueueReset(void) { - short i; + size_t i; StarQueueHead=0; HoleQueueHead=0; WallBloodQueueHead=0;