diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index ac1f91d58..64f62d10a 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1854,6 +1854,7 @@ int AnimSet(int animtype, sectortype* animindex, int thegoal, int thevel) { return AnimSet(animtype, sectnum(animindex), nullptr, thegoal, thevel); } + short AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, SECTOR_OBJECTp data); short AnimSetVelAdj(short anim_ndx, short vel_adj); @@ -1902,7 +1903,7 @@ void FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect, bool FAFcansee(int32_t xs, int32_t ys, int32_t zs, sectortype* sects, int32_t xe, int32_t ye, int32_t ze, sectortype* secte); -void FAFgetzrange(vec3_t pos, int16_t sectnum, +void FAFgetzrange(vec3_t pos, sectortype* sect, int32_t* hiz, Collision* ceilhit, int32_t* loz, Collision* florhit, int32_t clipdist, int32_t clipmask); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 85c290c40..e9deeebc3 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1872,7 +1872,7 @@ void DoPlayerZrange(PLAYERp pp) RESET(sp->cstat, CSTAT_SPRITE_BLOCK); vec3_t pos = pp->pos; pos.z += Z(8); - FAFgetzrange(pos, sectnum(pp->cursector), &pp->hiz, &ceilhit, &pp->loz, &florhit, ((int)sp->clipdist<<2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER); + FAFgetzrange(pos, pp->cursector, &pp->hiz, &ceilhit, &pp->loz, &florhit, ((int)sp->clipdist<<2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER); sp->cstat = bakcstat; Collision ceilColl(ceilhit); diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index 2221ce077..cdd80ef02 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -468,9 +468,8 @@ void WaterAdjust(const Collision& florhit, int32_t* loz) } } -void FAFgetzrange(vec3_t pos, int16_t sectnum, int32_t* hiz, Collision* ceilhit, int32_t* loz, Collision* florhit, int32_t clipdist, int32_t clipmask) +void FAFgetzrange(vec3_t pos, sectortype* sect, int32_t* hiz, Collision* ceilhit, int32_t* loz, Collision* florhit, int32_t clipdist, int32_t clipmask) { - sectortype* sect = §or[sectnum]; int foo1; Collision foo2; bool SkipFAFcheck; @@ -481,7 +480,7 @@ void FAFgetzrange(vec3_t pos, int16_t sectnum, int32_t* hiz, Collision* ceilhit, // because the ceiling and floors get moved out of the way for drawing. // early out to regular routine - if (sectnum < 0 || !FAF_ConnectArea(sect)) + if (sect == nullptr || !FAF_ConnectArea(sect)) { getzrange(pos, sect, hiz, *ceilhit, loz, *florhit, clipdist, clipmask); SectorZadjust(*ceilhit, hiz, *florhit, loz); @@ -568,7 +567,7 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* const sect, updatesectorz(x, y, newz, &uppersect); if (uppersect < 0) - return; // _ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d, sectnum %d", x, y, newz, sectnum); + return; getzrangepoint(x, y, newz, uppersect, hiz, ceilhit, &foo1, &foo2); SectorZadjust(*ceilhit, hiz, trash, nullptr); } @@ -580,7 +579,7 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* const sect, return; updatesectorz(x, y, newz, &lowersect); if (lowersect < 0) - return; // _ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d, sectnum %d", x, y, newz, sectnum); + return; getzrangepoint(x, y, newz, lowersect, &foo1, &foo2, loz, florhit); SectorZadjust(trash, nullptr, *florhit, loz); WaterAdjust(*florhit, loz); diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 2d14243ef..d5b746344 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -4603,7 +4603,7 @@ void DoActorZrange(DSWActor* actor) RESET(sp->cstat, CSTAT_SPRITE_BLOCK); vec3_t pos = sp->pos; pos.z -= DIV2(SPRITEp_SIZE_Z(sp)); - FAFgetzrange(pos, sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_ACTOR); + FAFgetzrange(pos, sp->sector(), &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_ACTOR); SET(sp->cstat, save_cstat); u->lo_sectp = u->hi_sectp = nullptr; @@ -6502,7 +6502,7 @@ Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, in // player. Seems to work ok! vec3_t pos = spr->pos; pos.z -= zh + 1; - FAFgetzrange(pos, spr->sectnum, + FAFgetzrange(pos, spr->sector(), &globhiz, &globhihit, &globloz, &globlohit, (((int) spr->clipdist) << 2) - GETZRANGE_CLIP_ADJ, cliptype); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index c1dabbd65..7ea1e0e3d 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -11184,7 +11184,7 @@ int DoFindGround(DSWActor* actor) save_cstat = sp->cstat; RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); - FAFgetzrange(sp->pos, sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER); + FAFgetzrange(sp->pos, sp->sector(), &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER); sp->cstat = save_cstat; switch (florhit.type)