- FAFgetzrangepoint + ActorDrop

This commit is contained in:
Christoph Oelckers 2021-11-25 17:12:41 +01:00
parent 959c3bc18b
commit 1a7cc6d782
7 changed files with 11 additions and 26 deletions

View file

@ -592,7 +592,7 @@ void KeepActorOnFloor(DSWActor* actor)
{
int ceilz, florz;
Collision ctrash, ftrash;
FAFgetzrangepoint(sp->x, sp->y, sp->z, sp->sectnum,
FAFgetzrangepoint(sp->x, sp->y, sp->z, sp->sector(),
&ceilz, &ctrash, &florz, &ftrash);
u->oz = sp->z = florz;

View file

@ -221,7 +221,7 @@ int DoShadowFindGroundPoint(tspriteptr_t sp)
save_cstat = sp->cstat;
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
FAFgetzrangepoint(sp->x, sp->y, sp->z, sp->sectnum, &hiz, &ceilhit, &loz, &florhit);
FAFgetzrangepoint(sp->x, sp->y, sp->z, sp->sector(), &hiz, &ceilhit, &loz, &florhit);
sp->cstat = save_cstat;
switch (florhit.type)

View file

@ -1926,7 +1926,7 @@ void FAFgetzrange(vec3_t pos, int16_t sectnum,
int32_t* loz, Collision* florhit,
int32_t clipdist, int32_t clipmask);
void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, int16_t sectnum,
void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* sect,
int32_t* hiz, Collision* ceilhit,
int32_t* loz, Collision* florhit);

View file

@ -570,11 +570,11 @@ void FAFgetzrange(vec3_t pos, int16_t sectnum, int32_t* hiz, Collision* ceilhit,
}
}
void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, int16_t const sectnum,
void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* const sect,
int32_t* hiz, Collision* ceilhit,
int32_t* loz, Collision* florhit)
{
auto sect = &sector[sectnum];
int sectnum = ::sectnum(sect);
int foo1;
Collision foo2;
bool SkipFAFcheck;

View file

@ -665,20 +665,6 @@ sectortype* FindNextSectorByTag(sectortype* sect, int tag)
}
int SectorDistance(short sect1, int sect2)
{
if (sect1 < 0 || sect2 < 0)
return 9999999;
auto wall1 = sector[sect1].firstWall();
auto wall2 = sector[sect2].firstWall();
// return the distance between the two sectors.
return Distance(wall1->x, wall1->y, wall2->x, wall2->y);
}
short DoSpawnActorTrigger(short match)
{
short spawn_count = 0;

View file

@ -4683,7 +4683,7 @@ int DoActorGlobZ(DSWActor* actor)
}
bool ActorDrop(DSWActor* actor, int x, int y, int z, short new_sector, short min_height)
bool ActorDrop(DSWActor* actor, int x, int y, int z, sectortype* new_sector, short min_height)
{
SPRITEp sp = &actor->s();
int hiz, loz;
@ -4739,7 +4739,6 @@ bool DropAhead(DSWActor* actor, int min_height)
{
SPRITEp sp = &actor->s();
int dax, day;
int newsector;
// dax = sp->x + MOVEx(128, sp->ang);
// day = sp->y + MOVEy(128, sp->ang);
@ -4747,7 +4746,7 @@ bool DropAhead(DSWActor* actor, int min_height)
dax = sp->x + MOVEx(256, sp->ang);
day = sp->y + MOVEy(256, sp->ang);
newsector = sp->sectnum;
auto newsector = sp->sector();
updatesector(dax, day, &newsector);
// look straight down for a drop
@ -4826,7 +4825,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
return false;
}
if (ActorDrop(actor, sp->x, sp->y, sp->z, sp->sectnum, u->lo_step))
if (ActorDrop(actor, sp->x, sp->y, sp->z, sp->sector(), u->lo_step))
{
// cancel move
sp->x = x;
@ -6655,7 +6654,7 @@ MissileZrange(DSWActor* actor)
tempshort = sp->cstat;
RESET(sp->cstat, CSTAT_SPRITE_BLOCK);
FAFgetzrangepoint(sp->x, sp->y, sp->z - 1, sp->sectnum,
FAFgetzrangepoint(sp->x, sp->y, sp->z - 1, sp->sector(),
&globhiz, &globhihit, &globloz, &globlohit);
sp->cstat = tempshort;
@ -6714,7 +6713,7 @@ Collision move_missile(DSWActor* actor, int xchange, int ychange, int zchange, i
tempshort = sp->cstat;
RESET(sp->cstat, CSTAT_SPRITE_BLOCK);
FAFgetzrangepoint(sp->x, sp->y, sp->z - 1, sp->sectnum,
FAFgetzrangepoint(sp->x, sp->y, sp->z - 1, sp->sector(),
&globhiz, &globhihit, &globloz, &globlohit);
sp->cstat = tempshort;

View file

@ -11249,7 +11249,7 @@ int DoFindGroundPoint(DSWActor* actor)
save_cstat = sp->cstat;
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
FAFgetzrangepoint(sp->x, sp->y, sp->z, sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit);
FAFgetzrangepoint(sp->x, sp->y, sp->z, sp->sector(), &u->hiz, &ceilhit, &u->loz, &florhit);
sp->cstat = save_cstat;
switch (florhit.type)