- turned some macros into functions.

This commit is contained in:
Christoph Oelckers 2021-11-04 00:03:08 +01:00
parent 64e812bd33
commit 96ebfe808c
2 changed files with 26 additions and 14 deletions

View file

@ -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"

View file

@ -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;