- adjust a few warp functions.

This commit is contained in:
Christoph Oelckers 2021-11-24 23:27:20 +01:00
parent c4e388ef56
commit 4d5c255b08
3 changed files with 11 additions and 13 deletions

View file

@ -19,7 +19,7 @@ void MapColors(short num,COLOR_MAP cm,short create);
int32_t CONFIG_ReadSetup(void);
DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum);
bool WarpSectorInfo(short sectnum, DSWActor** sp_warp);
bool WarpSectorInfo(sectortype* sect, DSWActor** sp_warp);
DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum);
[[deprecated]]

View file

@ -119,17 +119,17 @@ bool FAF_Sector(sectortype* sectnum)
return false;
}
void SetWallWarpHitscan(short sectnum)
void SetWallWarpHitscan(sectortype* sect)
{
DSWActor* sp_warp;
if (!WarpSectorInfo(sectnum, &sp_warp))
if (!WarpSectorInfo(sect, &sp_warp))
return;
if (!sp_warp)
return;
auto start_wall = sector[sectnum].firstWall();
auto start_wall = sect->firstWall();
auto wall_num = start_wall;
// Travel all the way around loop setting wall bits
@ -142,9 +142,9 @@ void SetWallWarpHitscan(short sectnum)
while (wall_num != start_wall);
}
void ResetWallWarpHitscan(short sectnum)
void ResetWallWarpHitscan(sectortype* sect)
{
auto start_wall = sector[sectnum].firstWall();
auto start_wall = sect->firstWall();
auto wall_num = start_wall;
// Travel all the way around loop setting wall bits
@ -192,8 +192,6 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum,
// hitscan warping
if (TEST(wall[hitinfo->wall].cstat, CSTAT_WALL_WARP_HITSCAN))
{
short dest_sect;
MONO_PRINT(ds);
// back it up a bit to get a correct warp location
@ -205,7 +203,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum,
{
vec3_t pos = hitinfo->pos;
dest_sect = hitinfo->sect;
auto dest_sect = &sector[hitinfo->sect];
// hitscan needs to pass through dest sect
ResetWallWarpHitscan(dest_sect);

View file

@ -206,11 +206,11 @@ DSWActor* WarpToArea(DSWActor* sp_from, int32_t* x, int32_t* y, int32_t* z, int*
//
////////////////////////////////////////////////////////////////////////////////
bool WarpSectorInfo(short sectnum, DSWActor** sp_warp)
bool WarpSectorInfo(sectortype* sect, DSWActor** sp_warp)
{
*sp_warp = nullptr;
if (!TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR))
if (!TEST(sect->extra, SECTFX_WARP_SECTOR))
return false;
SWStatIterator it(STAT_WARP);
@ -218,7 +218,7 @@ bool WarpSectorInfo(short sectnum, DSWActor** sp_warp)
{
auto sp = &actor->s();
if (sp->sectnum == sectnum)
if (sp->sector() == sect)
{
// skip - don't teleport
if (SP_TAG10(sp) == 1)
@ -241,7 +241,7 @@ DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum)
if (Prediction)
return nullptr;
if (!WarpSectorInfo(*sectnum, &sp_warp))
if (!WarpSectorInfo(&sector[*sectnum], &sp_warp))
return nullptr;
if (sp_warp)