mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-07 07:21:10 +00:00
- warp.cpp
This commit is contained in:
parent
21af63dfcc
commit
e98e1a6fea
5 changed files with 68 additions and 80 deletions
|
@ -18,14 +18,12 @@ void InitCheats();
|
||||||
void MapColors(short num,COLOR_MAP cm,short create);
|
void MapColors(short num,COLOR_MAP cm,short create);
|
||||||
int32_t CONFIG_ReadSetup(void);
|
int32_t CONFIG_ReadSetup(void);
|
||||||
|
|
||||||
bool WarpPlaneSectorInfo(short sectnum, SPRITEp* sp_ceiling, SPRITEp* sp_floor);
|
DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum);
|
||||||
SPRITEp WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum);
|
bool WarpSectorInfo(short sectnum, DSWActor** sp_warp);
|
||||||
SPRITEp WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int* sectnum);
|
DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum);
|
||||||
bool WarpSectorInfo(short sectnum, SPRITEp* sp_warp);
|
|
||||||
SPRITEp Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum);
|
|
||||||
|
|
||||||
[[deprecated]]
|
[[deprecated]]
|
||||||
SPRITEp Warp(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum)
|
DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum)
|
||||||
{
|
{
|
||||||
int sect16 = *sectnum;
|
int sect16 = *sectnum;
|
||||||
auto p= Warp(x, y, z, §16);
|
auto p= Warp(x, y, z, §16);
|
||||||
|
@ -34,7 +32,7 @@ SPRITEp Warp(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum)
|
||||||
}
|
}
|
||||||
|
|
||||||
[[deprecated]]
|
[[deprecated]]
|
||||||
SPRITEp WarpPlane(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum)
|
DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum)
|
||||||
{
|
{
|
||||||
int sect16 = *sectnum;
|
int sect16 = *sectnum;
|
||||||
auto p= WarpPlane(x, y, z, §16);
|
auto p= WarpPlane(x, y, z, §16);
|
||||||
|
|
|
@ -1364,6 +1364,7 @@ void DoPlayerWarpTeleporter(PLAYERp pp)
|
||||||
USERp u = ppActor->u();
|
USERp u = ppActor->u();
|
||||||
SPRITEp sp = &ppActor->s();
|
SPRITEp sp = &ppActor->s();
|
||||||
short pnum;
|
short pnum;
|
||||||
|
DSWActor* act_warp;
|
||||||
SPRITEp sp_warp;
|
SPRITEp sp_warp;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -1376,9 +1377,10 @@ void DoPlayerWarpTeleporter(PLAYERp pp)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if ((sp_warp = Warp(&pp->posx, &pp->posy, &pp->posz, &pp->cursectnum)) == nullptr)
|
if ((act_warp = Warp(&pp->posx, &pp->posy, &pp->posz, &pp->cursectnum)) == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
sp_warp = &act_warp->s();
|
||||||
switch (SP_TAG3(sp_warp))
|
switch (SP_TAG3(sp_warp))
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -107,7 +107,7 @@ bool FAF_Sector(short sectnum)
|
||||||
void SetWallWarpHitscan(short sectnum)
|
void SetWallWarpHitscan(short sectnum)
|
||||||
{
|
{
|
||||||
short start_wall, wall_num;
|
short start_wall, wall_num;
|
||||||
SPRITEp sp_warp;
|
DSWActor* sp_warp;
|
||||||
|
|
||||||
if (!WarpSectorInfo(sectnum, &sp_warp))
|
if (!WarpSectorInfo(sectnum, &sp_warp))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -105,7 +105,7 @@ int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust;
|
||||||
void SetSectorWallBits(short sectnum, int bit_mask, bool set_sectwall, bool set_nextwall);
|
void SetSectorWallBits(short sectnum, int bit_mask, bool set_sectwall, bool set_nextwall);
|
||||||
int DoActorDebris(DSWActor* actor);
|
int DoActorDebris(DSWActor* actor);
|
||||||
void ActorWarpUpdatePos(short SpriteNum,short sectnum);
|
void ActorWarpUpdatePos(short SpriteNum,short sectnum);
|
||||||
void ActorWarpType(SPRITEp sp, SPRITEp sp_warp);
|
void ActorWarpType(DSWActor* sp, DSWActor* act_warp);
|
||||||
int MissileZrange(short SpriteNum);
|
int MissileZrange(short SpriteNum);
|
||||||
|
|
||||||
#define ACTIVE_CHECK_TIME (3*120)
|
#define ACTIVE_CHECK_TIME (3*120)
|
||||||
|
@ -6869,16 +6869,15 @@ SpriteControl(void)
|
||||||
int
|
int
|
||||||
move_sprite(int spritenum, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics)
|
move_sprite(int spritenum, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics)
|
||||||
{
|
{
|
||||||
|
auto actor = &swActors[spritenum];
|
||||||
int retval=0, zh;
|
int retval=0, zh;
|
||||||
int dasectnum;
|
int dasectnum;
|
||||||
short tempshort;
|
short tempshort;
|
||||||
SPRITEp spr;
|
SPRITEp spr = &actor->s();
|
||||||
USERp u = User[spritenum].Data();
|
USERp u = actor->u();
|
||||||
short lastsectnum;
|
short lastsectnum;
|
||||||
|
|
||||||
spr = &sprite[spritenum];
|
ASSERT(actor->hasU());
|
||||||
|
|
||||||
ASSERT(u);
|
|
||||||
|
|
||||||
vec3_t clippos = spr->pos;
|
vec3_t clippos = spr->pos;
|
||||||
|
|
||||||
|
@ -6972,11 +6971,11 @@ move_sprite(int spritenum, int xchange, int ychange, int zchange, int ceildist,
|
||||||
|
|
||||||
if (TEST(sector[spr->sectnum].extra, SECTFX_WARP_SECTOR))
|
if (TEST(sector[spr->sectnum].extra, SECTFX_WARP_SECTOR))
|
||||||
{
|
{
|
||||||
SPRITEp sp_warp;
|
DSWActor* sp_warp;
|
||||||
if ((sp_warp = WarpPlane(&spr->x, &spr->y, &spr->z, &dasectnum)))
|
if ((sp_warp = WarpPlane(&spr->x, &spr->y, &spr->z, &dasectnum)))
|
||||||
{
|
{
|
||||||
ActorWarpUpdatePos(spritenum, dasectnum);
|
ActorWarpUpdatePos(spritenum, dasectnum);
|
||||||
ActorWarpType(spr, sp_warp);
|
ActorWarpType(actor, sp_warp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spr->sectnum != lastsectnum)
|
if (spr->sectnum != lastsectnum)
|
||||||
|
@ -6984,7 +6983,7 @@ move_sprite(int spritenum, int xchange, int ychange, int zchange, int ceildist,
|
||||||
if ((sp_warp = Warp(&spr->x, &spr->y, &spr->z, &dasectnum)))
|
if ((sp_warp = Warp(&spr->x, &spr->y, &spr->z, &dasectnum)))
|
||||||
{
|
{
|
||||||
ActorWarpUpdatePos(spritenum, dasectnum);
|
ActorWarpUpdatePos(spritenum, dasectnum);
|
||||||
ActorWarpType(spr, sp_warp);
|
ActorWarpType(actor, sp_warp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7041,8 +7040,9 @@ void ActorWarpUpdatePos(short SpriteNum, short sectnum)
|
||||||
DoActorZrange(SpriteNum);
|
DoActorZrange(SpriteNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MissileWarpType(SPRITEp sp, SPRITEp sp_warp)
|
void MissileWarpType(DSWActor* sp, DSWActor* act_warp)
|
||||||
{
|
{
|
||||||
|
auto sp_warp = &act_warp->s();
|
||||||
switch (SP_TAG1(sp_warp))
|
switch (SP_TAG1(sp_warp))
|
||||||
{
|
{
|
||||||
case WARP_CEILING_PLANE:
|
case WARP_CEILING_PLANE:
|
||||||
|
@ -7056,20 +7056,21 @@ void MissileWarpType(SPRITEp sp, SPRITEp sp_warp)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PlaySound(DIGI_ITEM_SPAWN, sp, v3df_none);
|
PlaySound(DIGI_ITEM_SPAWN, sp, v3df_none);
|
||||||
DoSpawnItemTeleporterEffect(sp);
|
DoSpawnItemTeleporterEffect(&sp->s());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActorWarpType(SPRITEp sp, SPRITEp sp_warp)
|
void ActorWarpType(DSWActor* sp, DSWActor* act_warp)
|
||||||
{
|
{
|
||||||
|
auto sp_warp = &act_warp->s();
|
||||||
switch (SP_TAG3(sp_warp))
|
switch (SP_TAG3(sp_warp))
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PlaySound(DIGI_ITEM_SPAWN, sp, v3df_none);
|
PlaySound(DIGI_ITEM_SPAWN, sp, v3df_none);
|
||||||
DoSpawnTeleporterEffectPlace(&swActors[sp - sprite]);
|
DoSpawnTeleporterEffectPlace(sp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7117,15 +7118,14 @@ MissileZrange(short SpriteNum)
|
||||||
int
|
int
|
||||||
move_missile(int spritenum, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics)
|
move_missile(int spritenum, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics)
|
||||||
{
|
{
|
||||||
|
DSWActor* actor = &swActors[spritenum];
|
||||||
|
USERp u = actor->u();
|
||||||
|
SPRITEp sp = &actor->s();
|
||||||
int retval, zh;
|
int retval, zh;
|
||||||
int dasectnum, tempshort;
|
int dasectnum, tempshort;
|
||||||
SPRITEp sp;
|
|
||||||
USERp u = User[spritenum].Data();
|
|
||||||
short lastsectnum;
|
short lastsectnum;
|
||||||
|
|
||||||
sp = &sprite[spritenum];
|
ASSERT(actor->hasU());
|
||||||
|
|
||||||
ASSERT(u);
|
|
||||||
|
|
||||||
vec3_t clippos = sp->pos;
|
vec3_t clippos = sp->pos;
|
||||||
|
|
||||||
|
@ -7209,12 +7209,12 @@ move_missile(int spritenum, int xchange, int ychange, int zchange, int ceildist,
|
||||||
|
|
||||||
if (TEST(sector[sp->sectnum].extra, SECTFX_WARP_SECTOR))
|
if (TEST(sector[sp->sectnum].extra, SECTFX_WARP_SECTOR))
|
||||||
{
|
{
|
||||||
SPRITEp sp_warp;
|
DSWActor* sp_warp;
|
||||||
|
|
||||||
if ((sp_warp = WarpPlane(&sp->x, &sp->y, &sp->z, &dasectnum)))
|
if ((sp_warp = WarpPlane(&sp->x, &sp->y, &sp->z, &dasectnum)))
|
||||||
{
|
{
|
||||||
MissileWarpUpdatePos(spritenum, dasectnum);
|
MissileWarpUpdatePos(spritenum, dasectnum);
|
||||||
MissileWarpType(sp, sp_warp);
|
MissileWarpType(actor, sp_warp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sp->sectnum != lastsectnum)
|
if (sp->sectnum != lastsectnum)
|
||||||
|
@ -7222,7 +7222,7 @@ move_missile(int spritenum, int xchange, int ychange, int zchange, int ceildist,
|
||||||
if ((sp_warp = Warp(&sp->x, &sp->y, &sp->z, &dasectnum)))
|
if ((sp_warp = Warp(&sp->x, &sp->y, &sp->z, &dasectnum)))
|
||||||
{
|
{
|
||||||
MissileWarpUpdatePos(spritenum, dasectnum);
|
MissileWarpUpdatePos(spritenum, dasectnum);
|
||||||
MissileWarpType(sp, sp_warp);
|
MissileWarpType(actor, sp_warp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7252,17 +7252,16 @@ move_missile(int spritenum, int xchange, int ychange, int zchange, int ceildist,
|
||||||
int
|
int
|
||||||
move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int flordist, uint32_t cliptype, int numtics)
|
move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int flordist, uint32_t cliptype, int numtics)
|
||||||
{
|
{
|
||||||
|
DSWActor* actor = &swActors[spritenum];
|
||||||
|
USERp u = actor->u();
|
||||||
|
SPRITEp sp = &actor->s();
|
||||||
int daz;
|
int daz;
|
||||||
int retval=0;
|
int retval=0;
|
||||||
int dasectnum;
|
int dasectnum;
|
||||||
SPRITEp sp;
|
|
||||||
USERp u = User[spritenum].Data();
|
|
||||||
short lastsectnum;
|
short lastsectnum;
|
||||||
int ox,oy;
|
int ox,oy;
|
||||||
|
|
||||||
sp = &sprite[spritenum];
|
ASSERT(actor->hasU());
|
||||||
|
|
||||||
ASSERT(u);
|
|
||||||
|
|
||||||
// Can't modify sprite sectors
|
// Can't modify sprite sectors
|
||||||
// directly becuase of linked lists
|
// directly becuase of linked lists
|
||||||
|
@ -7407,12 +7406,12 @@ move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int
|
||||||
|
|
||||||
if (TEST(sector[sp->sectnum].extra, SECTFX_WARP_SECTOR))
|
if (TEST(sector[sp->sectnum].extra, SECTFX_WARP_SECTOR))
|
||||||
{
|
{
|
||||||
SPRITEp sp_warp;
|
DSWActor* sp_warp;
|
||||||
|
|
||||||
if ((sp_warp = WarpPlane(&sp->x, &sp->y, &sp->z, &dasectnum)))
|
if ((sp_warp = WarpPlane(&sp->x, &sp->y, &sp->z, &dasectnum)))
|
||||||
{
|
{
|
||||||
MissileWarpUpdatePos(spritenum, dasectnum);
|
MissileWarpUpdatePos(spritenum, dasectnum);
|
||||||
MissileWarpType(sp, sp_warp);
|
MissileWarpType(actor, sp_warp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sp->sectnum != lastsectnum)
|
if (sp->sectnum != lastsectnum)
|
||||||
|
@ -7420,7 +7419,7 @@ move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int
|
||||||
if ((sp_warp = Warp(&sp->x, &sp->y, &sp->z, &dasectnum)))
|
if ((sp_warp = Warp(&sp->x, &sp->y, &sp->z, &dasectnum)))
|
||||||
{
|
{
|
||||||
MissileWarpUpdatePos(spritenum, dasectnum);
|
MissileWarpUpdatePos(spritenum, dasectnum);
|
||||||
MissileWarpType(sp, sp_warp);
|
MissileWarpType(actor, sp_warp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,10 @@ BEGIN_SW_NS
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
extern bool Prediction;
|
extern bool Prediction;
|
||||||
|
DSWActor* WarpToArea(DSWActor* sp_from, int32_t* x, int32_t* y, int32_t* z, int* sectnum);
|
||||||
|
|
||||||
bool
|
bool WarpPlaneSectorInfo(short sectnum, DSWActor** sp_ceiling, DSWActor** sp_floor)
|
||||||
WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor)
|
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
SPRITEp sp;
|
|
||||||
|
|
||||||
*sp_floor = nullptr;
|
*sp_floor = nullptr;
|
||||||
*sp_ceiling = nullptr;
|
*sp_ceiling = nullptr;
|
||||||
|
|
||||||
|
@ -55,10 +52,10 @@ WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor)
|
||||||
if (sectnum < 0 || !TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR))
|
if (sectnum < 0 || !TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
StatIterator it(STAT_WARP);
|
SWStatIterator it(STAT_WARP);
|
||||||
while ((i = it.NextIndex()) >= 0)
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &sprite[i];
|
auto sp = &actor->s();
|
||||||
|
|
||||||
if (sp->sectnum == sectnum)
|
if (sp->sectnum == sectnum)
|
||||||
{
|
{
|
||||||
|
@ -68,11 +65,11 @@ WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor)
|
||||||
|
|
||||||
if (sp->hitag == WARP_CEILING_PLANE)
|
if (sp->hitag == WARP_CEILING_PLANE)
|
||||||
{
|
{
|
||||||
*sp_ceiling = sp;
|
*sp_ceiling = actor;
|
||||||
}
|
}
|
||||||
else if (sp->hitag == WARP_FLOOR_PLANE)
|
else if (sp->hitag == WARP_FLOOR_PLANE)
|
||||||
{
|
{
|
||||||
*sp_floor = sp;
|
*sp_floor = actor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,10 +77,9 @@ WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPRITEp
|
DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum)
|
||||||
WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum)
|
|
||||||
{
|
{
|
||||||
SPRITEp sp_floor, sp_ceiling;
|
DSWActor* sp_floor,* sp_ceiling;
|
||||||
|
|
||||||
if (Prediction)
|
if (Prediction)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -93,7 +89,7 @@ WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum)
|
||||||
|
|
||||||
if (sp_ceiling)
|
if (sp_ceiling)
|
||||||
{
|
{
|
||||||
if (*z <= sp_ceiling->z)
|
if (*z <= sp_ceiling->s().z)
|
||||||
{
|
{
|
||||||
return WarpToArea(sp_ceiling, x, y, z, sectnum);
|
return WarpToArea(sp_ceiling, x, y, z, sectnum);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +97,7 @@ WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum)
|
||||||
|
|
||||||
if (sp_floor)
|
if (sp_floor)
|
||||||
{
|
{
|
||||||
if (*z >= sp_floor->z)
|
if (*z >= sp_floor->s().z)
|
||||||
{
|
{
|
||||||
return WarpToArea(sp_floor, x, y, z, sectnum);
|
return WarpToArea(sp_floor, x, y, z, sectnum);
|
||||||
}
|
}
|
||||||
|
@ -110,14 +106,12 @@ WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPRITEp
|
DSWActor* WarpToArea(DSWActor* sp_from, int32_t* x, int32_t* y, int32_t* z, int* sectnum)
|
||||||
WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int* sectnum)
|
|
||||||
{
|
{
|
||||||
int xoff;
|
int xoff;
|
||||||
int yoff;
|
int yoff;
|
||||||
int zoff;
|
int zoff;
|
||||||
int i;
|
SPRITEp const sp = &sp_from->s();
|
||||||
SPRITEp sp = sp_from;
|
|
||||||
short match;
|
short match;
|
||||||
short to_tag = 0;
|
short to_tag = 0;
|
||||||
short match_rand[16];
|
short match_rand[16];
|
||||||
|
@ -173,32 +167,32 @@ WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int* sectnum)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
StatIterator it(STAT_WARP);
|
SWStatIterator it(STAT_WARP);
|
||||||
while ((i = it.NextIndex()) >= 0)
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
SPRITEp sp = &sprite[i];
|
auto spi = &actor->s();
|
||||||
|
|
||||||
if (sp->lotag == match && sp != sp_from)
|
if (spi->lotag == match && actor != sp_from)
|
||||||
{
|
{
|
||||||
// exp: WARP_CEILING or WARP_CEILING_PLANE
|
// exp: WARP_CEILING or WARP_CEILING_PLANE
|
||||||
if (sp->hitag == to_tag)
|
if (spi->hitag == to_tag)
|
||||||
{
|
{
|
||||||
if (!validSectorIndex(sp->sectnum))
|
if (!validSectorIndex(spi->sectnum))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// determine new x,y,z position
|
// determine new x,y,z position
|
||||||
*x = sp->x + xoff;
|
*x = spi->x + xoff;
|
||||||
*y = sp->y + yoff;
|
*y = spi->y + yoff;
|
||||||
*z = sp->z + zoff;
|
*z = spi->z + zoff;
|
||||||
|
|
||||||
// make sure you warp outside of warp plane
|
// make sure you warp outside of warp plane
|
||||||
*z += z_adj;
|
*z += z_adj;
|
||||||
|
|
||||||
// get new sector
|
// get new sector
|
||||||
*sectnum = sp->sectnum;
|
*sectnum = spi->sectnum;
|
||||||
updatesector(*x, *y, sectnum);
|
updatesector(*x, *y, sectnum);
|
||||||
|
|
||||||
return sp;
|
return actor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,21 +206,17 @@ WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int* sectnum)
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool
|
bool WarpSectorInfo(short sectnum, DSWActor** sp_warp)
|
||||||
WarpSectorInfo(short sectnum, SPRITEp *sp_warp)
|
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
SPRITEp sp;
|
|
||||||
|
|
||||||
*sp_warp = nullptr;
|
*sp_warp = nullptr;
|
||||||
|
|
||||||
if (!TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR))
|
if (!TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
StatIterator it(STAT_WARP);
|
SWStatIterator it(STAT_WARP);
|
||||||
while ((i = it.NextIndex()) >= 0)
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &sprite[i];
|
auto sp = &actor->s();
|
||||||
|
|
||||||
if (sp->sectnum == sectnum)
|
if (sp->sectnum == sectnum)
|
||||||
{
|
{
|
||||||
|
@ -236,7 +226,7 @@ WarpSectorInfo(short sectnum, SPRITEp *sp_warp)
|
||||||
|
|
||||||
if (sp->hitag == WARP_TELEPORTER)
|
if (sp->hitag == WARP_TELEPORTER)
|
||||||
{
|
{
|
||||||
*sp_warp = sp;
|
*sp_warp = actor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,10 +234,9 @@ WarpSectorInfo(short sectnum, SPRITEp *sp_warp)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPRITEp
|
DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum)
|
||||||
Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum)
|
|
||||||
{
|
{
|
||||||
SPRITEp sp_warp;
|
DSWActor* sp_warp;
|
||||||
|
|
||||||
if (Prediction)
|
if (Prediction)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Loading…
Reference in a new issue