- floatified user.hiz and user.loz

This commit is contained in:
Christoph Oelckers 2022-08-20 22:06:00 +02:00
parent d117544da8
commit 306e751a51
12 changed files with 48 additions and 31 deletions

View file

@ -397,7 +397,7 @@ int DoActorDebris(DSWActor* actor)
KillActor(actor);
return 0;
case ZILLA_RUN_R0:
getzsofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y, &actor->user.hiz, &actor->user.loz);
getzsofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &actor->user.hiz, &actor->user.loz);
actor->user.lo_sectp = actor->sector();
actor->user.hi_sectp = actor->sector();
actor->user.lowActor = nullptr;

View file

@ -1328,8 +1328,6 @@ Collision move_scan(DSWActor* actor, int ang, int dist, int *stopx, int *stopy,
int nx,ny;
uint32_t cliptype = CLIPMASK_ACTOR;
int sang;
int loz, hiz;
DSWActor* highActor;
DSWActor* lowActor;
sectortype* lo_sectp,* hi_sectp, *ssp;
@ -1339,9 +1337,9 @@ Collision move_scan(DSWActor* actor, int ang, int dist, int *stopx, int *stopy,
// save off position info
auto pos = actor->spr.pos;
sang = actor->int_ang();
loz = actor->user.int_loz();
hiz = actor->user.int_hiz();
auto sang = actor->spr.angle;
auto loz = actor->user.loz;
auto hiz = actor->user.hiz;
lowActor = actor->user.lowActor;
highActor = actor->user.highActor;
lo_sectp = actor->user.lo_sectp;
@ -1365,7 +1363,7 @@ Collision move_scan(DSWActor* actor, int ang, int dist, int *stopx, int *stopy,
// reset position information
actor->spr.pos = pos;
actor->set_int_ang(sang);
actor->spr.angle = sang;
actor->user.loz = loz;
actor->user.hiz = hiz;
actor->user.lowActor = lowActor;

View file

@ -453,10 +453,10 @@ void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SET* action, PERSONALITY* perso
}
}
if (depth && labs(actor->int_pos().Z - actor->user.int_loz()) < Z(8))
if (depth && abs(actor->spr.pos.Z - actor->user.loz) < 8)
{
actor->add_int_z(Z(depth));
actor->user.loz = actor->int_pos().Z;
actor->user.loz = actor->spr.pos.Z;
actor->backupz();
}

View file

@ -424,13 +424,13 @@ int DoEelMatchPlayerZ(DSWActor* actor)
{
if (actor->user.hi_sectp)
{
actor->user.hiz = actor->sector()->int_ceilingz() + Z(16);
actor->user.hiz = actor->sector()->ceilingz + 16;
actor->user.hi_sectp = actor->sector();
}
else
{
if (actor->user.hiz < actor->sector()->int_ceilingz() + Z(16))
actor->user.hiz = actor->sector()->int_ceilingz() + Z(16);
if (actor->user.hiz < actor->sector()->ceilingz + 16)
actor->user.hiz = actor->sector()->ceilingz + 16;
}
}

View file

@ -930,8 +930,8 @@ struct USER
memset(&WallP, 0, sizeof(USER) - myoffsetof(USER, WallP));
}
int int_loz() const { return loz; }
int int_hiz() const { return hiz; }
int int_loz() const { return loz * zworldtoint; }
int int_hiz() const { return hiz * zworldtoint; }
//
// Variables that can be used by actors and Player
@ -987,7 +987,7 @@ struct USER
int16_t ceiling_dist;
int16_t floor_dist;
int16_t lo_step;
int hiz,loz;
double hiz, loz;
int zclip; // z height to move up for clipmove
int active_range;
sectortype* hi_sectp, *lo_sectp;
@ -1763,10 +1763,30 @@ void FAFgetzrange(vec3_t pos, sectortype* sect,
int32_t* loz, Collision* florhit,
int32_t clipdist, int32_t clipmask);
inline void FAFgetzrange(vec3_t pos, sectortype* sect,
double* hiz, Collision* ceilhit,
double* loz, Collision* florhit,
int32_t clipdist, int32_t clipmask)
{
int32_t hi, lo;
FAFgetzrange(pos, sect, &hi, ceilhit, &lo, florhit, clipdist, clipmask);
*hiz = hi * zinttoworld;
*loz = lo * zinttoworld;
}
void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* sect,
int32_t* hiz, Collision* ceilhit,
int32_t* loz, Collision* florhit);
inline void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* sect,
double* hiz, Collision* ceilhit,
double* loz, Collision* florhit)
{
int32_t hi, lo;
FAFgetzrangepoint(x, y, z, sect, &hi, ceilhit, &lo, florhit);
*hiz = hi * zinttoworld;
*loz = lo * zinttoworld;
}
enum SoundType
{

View file

@ -490,7 +490,7 @@ int DoHornetDeath(DSWActor* actor)
if (actor->user.Flags & (SPR_FALLING))
{
actor->user.loz = actor->user.zclip;
actor->user.loz = actor->user.zclip * zinttoworld;
DoFall(actor);
}
else

View file

@ -472,7 +472,7 @@ int SetupLava(DSWActor* actor)
actor->spr.clipdist = (512) >> 2;
actor->user.Flags |= (SPR_XFLIP_TOGGLE|SPR_ELECTRO_TOLERANT);
actor->user.loz = actor->int_pos().Z;
actor->user.loz = actor->spr.pos.Z;
return 0;
}

View file

@ -851,7 +851,7 @@ void SectorExp(DSWActor* actor, sectortype* sectp, double zh)
// setup vars needed by SectorExp
ChangeActorSect(actor, sectp);
getzsofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y, &actor->user.hiz, &actor->user.loz);
getzsofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &actor->user.hiz, &actor->user.loz);
// spawn explosion
auto exp = SpawnSectorExp(actor);

View file

@ -730,7 +730,7 @@ int SetupSerp(DSWActor* actor)
actor->spr.clipdist = (512) >> 2;
actor->user.Flags |= (SPR_XFLIP_TOGGLE|SPR_ELECTRO_TOLERANT);
actor->user.loz = actor->int_pos().Z;
actor->user.loz = actor->spr.pos.Z;
// amount to move up for clipmove
actor->user.zclip = Z(80);

View file

@ -236,7 +236,7 @@ int SetupSkull(DSWActor* actor)
{
actor->set_int_z(actor->user.int_loz() + Z(tileTopOffset(actor->spr.picnum)));
actor->user.loz = actor->int_pos().Z;
actor->user.loz = actor->spr.pos.Z;
// leave 8 pixels above the ground
actor->add_int_z(ActorSizeToTop(actor) - Z(3));
}
@ -621,7 +621,7 @@ int SetupBetty(DSWActor* actor)
{
actor->set_int_z(actor->user.int_loz() + Z(tileTopOffset(actor->spr.picnum)));
actor->user.loz = actor->int_pos().Z;
actor->user.loz = actor->spr.pos.Z;
// leave 8 pixels above the ground
actor->add_int_z(ActorSizeToTop(actor) - Z(3));
}

View file

@ -863,8 +863,8 @@ void SpawnUser(DSWActor* actor, short id, STATE* state)
// Problem with sprites spawned really close to white sector walls
// cant do a getzrange there
// Just put in some valid starting values
actor->user.loz = actor->sector()->int_floorz();
actor->user.hiz = actor->sector()->int_ceilingz();
actor->user.loz = actor->sector()->floorz;
actor->user.hiz = actor->sector()->ceilingz;
actor->user.lowActor = nullptr;
actor->user.highActor = nullptr;
actor->user.lo_sectp = actor->sector();
@ -4488,8 +4488,8 @@ void DoActorZrange(DSWActor* actor)
int DoActorGlobZ(DSWActor* actor)
{
actor->user.loz = globloz;
actor->user.hiz = globhiz;
actor->user.loz = globloz * zinttoworld;
actor->user.hiz = globhiz * zinttoworld;
actor->user.lo_sectp = actor->user.hi_sectp = nullptr;
actor->user.highActor = nullptr;
@ -4601,7 +4601,6 @@ bool DropAhead(DSWActor* actor, int min_height)
int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
{
int loz, hiz;
DSWActor* highActor;
DSWActor* lowActor;
sectortype* lo_sectp,* hi_sectp;
@ -4618,8 +4617,8 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
// save off x,y values
auto apos = actor->spr.pos;
loz = actor->user.int_loz();
hiz = actor->user.int_hiz();
auto loz = actor->user.loz;
auto hiz = actor->user.hiz;
lowActor = actor->user.lowActor;
highActor = actor->user.highActor;
lo_sectp = actor->user.lo_sectp;
@ -6385,7 +6384,7 @@ int MissileWaterAdjust(DSWActor* actor)
if (sectp && sectp->hasU())
{
if (FixedToInt(sectp->depth_fixed))
actor->user.loz -= Z(FixedToInt(sectp->depth_fixed));
actor->user.loz -= FixedToInt(sectp->depth_fixed);
}
return 0;
}

View file

@ -638,7 +638,7 @@ int NullZilla(DSWActor* actor)
actor->user.hi_sectp = actor->sector();
actor->user.lowActor = nullptr;
actor->user.highActor = nullptr;
actor->set_int_z(actor->user.int_loz());
actor->spr.pos.Z = actor->user.loz;
DoActorSectorDamage(actor);
@ -707,7 +707,7 @@ int DoZillaDeathMelt(DSWActor* actor)
actor->user.hi_sectp = actor->sector();
actor->user.lowActor = nullptr;
actor->user.highActor = nullptr;
actor->set_int_z(actor->user.int_loz());
actor->spr.pos.Z = actor->user.loz;
BossSpriteNum[2] = nullptr;
return 0;