- ported all pushmove calls to the float version.

This commit is contained in:
Christoph Oelckers 2022-09-30 18:45:47 +02:00
parent f45acdc2a8
commit 7d3babd678
12 changed files with 21 additions and 61 deletions

View file

@ -450,7 +450,6 @@ void InitSpriteLists();
void SetActorZ(DCoreActor* actor, const DVector3& newpos);
void SetActor(DCoreActor* actor, const DVector3& newpos);
// this one should be the final version everything needs to migrate to
inline int clipmove(DVector3& pos, sectortype** const sect, const DVector2& mvec,
double const walldist, double const ceildist, double const flordist, unsigned const cliptype, CollisionBase& result, int clipmoveboxtracenum = 3)
{
@ -462,56 +461,17 @@ inline int clipmove(DVector3& pos, sectortype** const sect, const DVector2& mvec
return result.type;
}
inline int pushmove(vec3_t* const vect, sectortype** const sect, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
uint32_t const cliptype, bool clear = true)
{
int sectno = *sect ? sector.IndexOf(*sect) : -1;
int res = pushmove_(vect, &sectno, walldist, ceildist, flordist, cliptype, clear);
*sect = sectno == -1 ? nullptr : &sector[sectno];
return res;
}
inline int pushmove(DVector3& pos, sectortype** const sect, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
uint32_t const cliptype, bool clear = true)
{
auto vect = vec3_t(pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint);
int sectno = *sect ? sector.IndexOf(*sect) : -1;
int res = pushmove_(&vect, &sectno, walldist, ceildist, flordist, cliptype, clear);
pos = { vect.X * inttoworld, vect.Y * inttoworld, vect.Z * zinttoworld };
*sect = sectno == -1 ? nullptr : &sector[sectno];
return res;
}
inline int pushmove(DVector3& pos, sectortype** const sect, int32_t const walldist, double const ceildist, double const flordist,
uint32_t const cliptype, bool clear = true)
{
auto vect = vec3_t(pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint);
int sectno = *sect ? sector.IndexOf(*sect) : -1;
int res = pushmove_(&vect, &sectno, walldist, int(ceildist * zworldtoint), int(flordist * zworldtoint), cliptype, clear);
pos = { vect.X * inttoworld, vect.Y * inttoworld, vect.Z * zinttoworld };
*sect = sectno == -1 ? nullptr : &sector[sectno];
return res;
}
#if 0
inline int pushmove(DVector3& pos, sectortype** const sect, double const walldist, double const ceildist, double const flordist,
uint32_t const cliptype, bool clear = true)
{
auto vect = vec3_t(pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint);
int sectno = *sect ? sector.IndexOf(*sect) : -1;
int res = pushmove_(&vect, &sectno, walldist * worldtoint, ceildist * worldtoint, flordist * worldtoint, cliptype, clear);
int res = pushmove_(&vect, &sectno, walldist * worldtoint, ceildist * zworldtoint, flordist * zworldtoint, cliptype, clear);
pos = { vect.X * inttoworld, vect.Y * inttoworld, vect.Z * zinttoworld };
*sect = sectno == -1 ? nullptr : &sector[sectno];
return res;
}
#endif
inline int pushmove(DCoreActor* actor, sectortype** const sect, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
uint32_t const cliptype, bool clear = true)
{
return pushmove(actor->spr.pos, sect, walldist, ceildist, flordist, cliptype, clear);
}
tspritetype* renderAddTsprite(tspriteArray& tsprites, DCoreActor* actor);

View file

@ -4736,7 +4736,7 @@ void MoveDude(DBloodActor* actor)
if (pSector->type >= kSectorPath && pSector->type <= kSectorRotate)
{
auto pSector2 = pSector;
if (pushmove(actor, &pSector2, int(wdf * worldtoint), tz, bz, CLIPMASK0) == -1)
if (pushmove(actor->spr.pos, &pSector2, wdf, tz, bz, CLIPMASK0) == -1)
actDamageSprite(actor, actor, kDamageFall, 1000 << 4);
if (pSector2 != nullptr)
pSector = pSector2;

View file

@ -1674,7 +1674,7 @@ void debrisMove(int listIndex)
if (pSector->type >= kSectorPath && pSector->type <= kSectorRotate)
{
auto pSector2 = pSector;
if (pushmove(actor, &pSector2, int(clipDistf * worldtoint), ceilDist, floorDist, CLIPMASK0) != -1)
if (pushmove(actor->spr.pos, &pSector2, clipDistf, ceilDist, floorDist, CLIPMASK0) != -1)
pSector = pSector2;
}

View file

@ -1793,11 +1793,11 @@ void playerProcess(PLAYER* pPlayer)
GetActorExtents(actor, &top, &bottom);
double dzflor = (bottom - actor->spr.pos.Z) / 4;
double dzceil = (actor->spr.pos.Z - top) / 4;
int dw = actor->int_clipdist();
if (!gNoClip)
{
auto pSector = actor->sector();
if (pushmove(actor->spr.pos, &pSector, dw, dzceil, dzflor, CLIPMASK0) == -1)
if (pushmove(actor->spr.pos, &pSector, actor->fClipdist(), dzceil, dzflor, CLIPMASK0) == -1)
actDamageSprite(actor, actor, kDamageFall, 500 << 4);
if (actor->sector() != pSector)
{

View file

@ -5132,7 +5132,7 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO
{
auto sect = actor->sector();
pushmove(actor, &sect, 128, (4 << 8), (4 << 8), CLIPMASK0);
pushmove(actor->spr.pos, &sect, 16., 4., 4., CLIPMASK0);
if (sect != actor->sector() && sect != nullptr)
ChangeActorSect(actor, sect);

View file

@ -623,7 +623,7 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
updatesector(p->pos, &p->cursector);
pushmove(p->pos, &p->cursector, 128, (4 << 8), (20 << 8), CLIPMASK0);
pushmove(p->pos, &p->cursector, 16, 4, 20, CLIPMASK0);
if (floorz > ceilingz + 16 && actor->spr.pal != 1)
p->angle.rotscrnang = DAngle::fromBuild(p->dead_flag + ((floorz + p->pos.Z) * 2));

View file

@ -3118,7 +3118,7 @@ HORIZONLY:
while (ud.clipping == 0)
{
int blocked;
blocked = (pushmove(p->pos, &p->cursector, 164, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
blocked = (pushmove(p->pos, &p->cursector, 10.25, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
if (fabs(pact->floorz - pact->ceilingz) < 48 || blocked)
{

View file

@ -3815,10 +3815,10 @@ HORIZONLY:
if (wal->lotag < 44)
{
dofurniture(clip.hitWall, p->cursector, snum);
pushmove(p->pos, &p->cursector, 172, (4 << 8), (4 << 8), CLIPMASK0);
pushmove(p->pos, &p->cursector, 10.75, 4, 4, CLIPMASK0);
}
else
pushmove(p->pos, &p->cursector, 172, (4 << 8), (4 << 8), CLIPMASK0);
pushmove(p->pos, &p->cursector, 10.75, 4, 4, CLIPMASK0);
}
}
}
@ -3919,9 +3919,9 @@ HORIZONLY:
{
int blocked;
if (pact->native_clipdist() == 64)
blocked = (pushmove(p->pos, &p->cursector, 128, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
blocked = (pushmove(p->pos, &p->cursector, 8, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
else
blocked = (pushmove(p->pos, &p->cursector, 16, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
blocked = (pushmove(p->pos, &p->cursector, 1, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
if (fabs(pact->floorz - pact->ceilingz) < 48 || blocked)
{

View file

@ -1403,7 +1403,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
targ->vel.X = -proj->spr.extra * 0.25;
auto sp = targ->sector();
pushmove(targ, &sp, 128L, (4 << 8), (4 << 8), CLIPMASK0);
pushmove(targ->spr.pos, &sp, 16, 4, 4, CLIPMASK0);
if (sp != targ->sector() && sp != nullptr)
ChangeActorSect(targ, sp);
}

View file

@ -1044,7 +1044,7 @@ void AIPlayer::Tick(RunListEvent* ev)
auto pPlayerSect = pPlayerActor->sector();
pushmove(pPlayerActor, &pPlayerSect, pPlayerActor->int_clipdist(), 5120, -5120, CLIPMASK0);
pushmove(pPlayerActor->spr.pos, &pPlayerSect, pPlayerActor->fClipdist(), 320, -320, CLIPMASK0);
if (pPlayerSect != pPlayerActor->sector()) {
ChangeActorSect(pPlayerActor, pPlayerSect);
}

View file

@ -307,7 +307,7 @@ void AISet::Tick(RunListEvent* ev)
auto nMov = MoveCreature(pActor);
auto sect = pActor->sector();
pushmove(pActor, &sect, pActor->int_clipdist(), 5120, -5120, CLIPMASK0);
pushmove(pActor->spr.pos, &sect, pActor->fClipdist(), 320, -320, CLIPMASK0);
pActor->setsector(sect);
if (pActor->vel.Z > 4000/256.)

View file

@ -2009,7 +2009,7 @@ void DoPlayerSlide(PLAYER* pp)
if (abs(pp->slide_vect.X) < 0.05 && abs(pp->slide_vect.Y) < 0.05)
pp->slide_vect.Zero();
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->int_clipdist()), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
push_ret = pushmove(pp->pos, &pp->cursector, actor->fClipdist(), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0)
{
if (!(pp->Flags & PF_DEAD))
@ -2026,7 +2026,7 @@ void DoPlayerSlide(PLAYER* pp)
clipmove(pp->pos, &pp->cursector, pp->slide_vect, actor->fClipdist(), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
PlayerCheckValidMove(pp);
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->int_clipdist()), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
push_ret = pushmove(pp->pos, &pp->cursector, actor->fClipdist(), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0)
{
if (!(pp->Flags & PF_DEAD))
@ -2172,7 +2172,7 @@ void DoPlayerMove(PLAYER* pp)
}
else
{
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->int_clipdist()), pp->p_ceiling_dist, pp->p_floor_dist - Z(16), CLIPMASK_PLAYER);
push_ret = pushmove(pp->pos, &pp->cursector, actor->fClipdist(), pp->p_ceiling_dist, pp->p_floor_dist - Z(16), CLIPMASK_PLAYER);
if (push_ret < 0)
{
@ -2200,7 +2200,7 @@ void DoPlayerMove(PLAYER* pp)
actor->spr.cstat = save_cstat;
PlayerCheckValidMove(pp);
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->int_clipdist()), pp->p_ceiling_dist, pp->p_floor_dist - Z(16), CLIPMASK_PLAYER);
push_ret = pushmove(pp->pos, &pp->cursector, actor->fClipdist(), pp->p_ceiling_dist, pp->p_floor_dist - Z(16), CLIPMASK_PLAYER);
if (push_ret < 0)
{
@ -4830,7 +4830,7 @@ void DoPlayerCurrent(PLAYER* pp)
auto vect = sectu->angle.ToVector() / 256. * sectu->speed * synctics; // 16384 >> 4 - Beware of clipmove's odd format for vect!
push_ret = pushmove(pp->pos, &pp->cursector, ((int)pp->actor->int_clipdist()), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
push_ret = pushmove(pp->pos, &pp->cursector, pp->actor->fClipdist(), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0)
{
if (!(pp->Flags & PF_DEAD))
@ -4849,7 +4849,7 @@ void DoPlayerCurrent(PLAYER* pp)
clipmove(pp->pos, &pp->cursector, vect, pp->actor->fClipdist(), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
PlayerCheckValidMove(pp);
pushmove(pp->pos, &pp->cursector, ((int)pp->actor->int_clipdist()), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
pushmove(pp->pos, &pp->cursector, pp->actor->fClipdist(), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0)
{
if (!(pp->Flags & PF_DEAD))