- user.zclip floatified

This commit is contained in:
Christoph Oelckers 2022-08-21 00:01:00 +02:00
parent a93349b445
commit bc853d3a00
10 changed files with 42 additions and 42 deletions

View file

@ -781,7 +781,7 @@ int SetupBunny(DSWActor* actor)
actor->user.Flags |= (SPR_XFLIP_TOGGLE);
actor->user.zclip = Z(16);
actor->user.zclip = (16);
actor->user.floor_dist = (8);
actor->user.ceiling_dist = (8);
actor->user.lo_step = Z(16);

View file

@ -407,11 +407,11 @@ void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SET* action, PERSONALITY* perso
actor->user.RotNum = 5;
actor->spr.clipdist = (256) >> 2;
actor->user.zclip = Z(48);
actor->user.zclip = (48);
actor->user.lo_step = Z(32);
actor->user.floor_dist = (actor->user.int_zclip() - actor->user.lo_step) * zinttoworld;
actor->user.ceiling_dist = (ActorSizeZ(actor) - actor->user.int_zclip()) * zinttoworld;
actor->user.floor_dist = actor->user.zclip - actor->user.lo_step * zinttoworld;
actor->user.ceiling_dist = ActorSizeZ(actor) * zinttoworld - actor->user.zclip;
actor->user.Radius = 400;

View file

@ -394,7 +394,7 @@ int SetupEel(DSWActor* actor)
EelCommon(actor);
actor->user.Flags &= ~(SPR_SHADOW); // Turn off shadows
actor->user.zclip = Z(8);
actor->user.zclip = (8);
return 0;
}

View file

@ -936,7 +936,7 @@ struct USER
int int_z_tgt() const { return z_tgt * zworldtoint; }
int int_ceiling_dist() const { return ceiling_dist * zworldtoint; }
int int_floor_dist() const { return floor_dist * zworldtoint; }
int int_zclip() const { return zclip/* * zworldtoint*/; }
int int_zclip() const { return zclip * zworldtoint; }
//
// Variables that can be used by actors and Player
@ -973,6 +973,7 @@ struct USER
double z_tgt;
double ceiling_dist;
double floor_dist;
double zclip; // z height to move up for clipmove
int Flags;
int Flags2;
@ -995,7 +996,6 @@ struct USER
// clipmove
int16_t lo_step;
int zclip; // z height to move up for clipmove
int active_range;
sectortype* hi_sectp, *lo_sectp;

View file

@ -490,7 +490,7 @@ int DoHornetDeath(DSWActor* actor)
if (actor->user.Flags & (SPR_FALLING))
{
actor->user.loz = actor->user.int_zclip() * zinttoworld;
actor->user.loz = actor->user.zclip;
DoFall(actor);
}
else
@ -500,7 +500,7 @@ int DoHornetDeath(DSWActor* actor)
actor->user.floor_dist = 0;
DoBeginFall(actor);
DoFindGroundPoint(actor);
actor->user.zclip = actor->user.int_loz();
actor->user.zclip = actor->user.loz;
}
if (actor->user.Flags & (SPR_SLIDING))

View file

@ -733,12 +733,12 @@ int SetupSerp(DSWActor* actor)
actor->user.loz = actor->spr.pos.Z;
// amount to move up for clipmove
actor->user.zclip = Z(80);
actor->user.zclip = (80);
// size of step can walk off of
actor->user.lo_step = Z(40);
actor->user.floor_dist = (actor->user.int_zclip() - actor->user.lo_step) * zinttoworld;
actor->user.ceiling_dist = (ActorSizeZ(actor) - actor->user.int_zclip()) * zinttoworld;
actor->user.floor_dist = actor->user.zclip - actor->user.lo_step * zinttoworld;
actor->user.ceiling_dist = ActorSizeZ(actor) * zinttoworld - actor->user.zclip;
return 0;
}

View file

@ -49,7 +49,7 @@ void ReverseSpike(DSWActor* actor)
}
// moving toward to OFF pos
if (actor->user.int_z_tgt() == actor->user.int_oz())
if (actor->user.z_tgt == actor->user.oz)
{
if (actor->spr.pos.Z == actor->user.oz)
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
@ -102,7 +102,7 @@ void SetSpikeActive(DSWActor* actor)
actor->user.Tics = 0;
// moving to the ON position
if (actor->user.int_z_tgt() == actor->int_pos().Z)
if (actor->user.z_tgt == actor->spr.pos.Z)
VatorSwitch(SP_TAG2(actor), true);
else
// moving to the OFF position
@ -190,35 +190,35 @@ bool TestSpikeMatchActive(short match)
return false;
}
int DoSpikeMove(DSWActor* actor, int *lptr)
int DoSpikeMove(DSWActor* actor, double *lptr)
{
int zval;
double zval;
zval = *lptr;
// if LESS THAN goal
if (zval < actor->user.int_z_tgt())
if (zval < actor->user.z_tgt)
{
// move it DOWN
zval += (synctics * actor->user.jump_speed);
zval += (synctics * actor->user.jump_speed) * zinttoworld;
actor->user.jump_speed += actor->user.vel_rate * synctics;
// if the other way make it equal
if (zval > actor->user.int_z_tgt())
zval = actor->user.int_z_tgt();
if (zval > actor->user.z_tgt)
zval = actor->user.z_tgt;
}
// if GREATER THAN goal
if (zval > actor->user.int_z_tgt())
if (zval > actor->user.z_tgt)
{
// move it UP
zval -= (synctics * actor->user.jump_speed);
zval -= (synctics * actor->user.jump_speed) * zinttoworld;
actor->user.jump_speed += actor->user.vel_rate * synctics;
if (zval < actor->user.int_z_tgt())
zval = actor->user.int_z_tgt();
if (zval < actor->user.z_tgt)
zval = actor->user.z_tgt;
}
*lptr = zval;
@ -275,10 +275,10 @@ int DoSpike(DSWActor* actor)
SpikeAlign(actor);
// EQUAL this entry has finished
if (actor->user.int_zclip() == actor->user.int_z_tgt())
if (actor->user.zclip == actor->user.z_tgt)
{
// in the ON position
if (actor->user.int_z_tgt() == actor->int_pos().Z)
if (actor->user.z_tgt == actor->spr.pos.Z)
{
// change target
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
@ -322,16 +322,16 @@ int DoSpike(DSWActor* actor)
}
// setup to go back to the original z
if (actor->user.int_zclip() != actor->user.int_oz())
if (actor->user.zclip != actor->user.oz)
{
if (actor->user.WaitTics)
actor->user.Tics = actor->user.WaitTics;
}
}
else // if (*lptr == actor->user.int_z_tgt())
else // if (*lptr == actor->user.z_tgt)
{
// if heading for the OFF (original) position and should NOT CRUSH
if (TEST_BOOL3(actor) && actor->user.int_z_tgt() == actor->user.int_oz())
if (TEST_BOOL3(actor) && actor->user.z_tgt == actor->user.oz)
{
bool found = false;
@ -376,10 +376,10 @@ int DoSpikeAuto(DSWActor* actor)
SpikeAlign(actor);
// EQUAL this entry has finished
if (actor->user.int_zclip() == actor->user.int_z_tgt())
if (actor->user.zclip == actor->user.z_tgt)
{
// in the UP position
if (actor->user.int_z_tgt() == actor->int_pos().Z)
if (actor->user.z_tgt == actor->spr.pos.Z)
{
// change target
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;

View file

@ -2247,7 +2247,7 @@ void SpriteSetup(void)
if (floor_vator)
{
actor->user.zclip = florz;
actor->user.zclip = florz * zinttoworld;
// start off
actor->user.pos.Z = actor->user.int_zclip();
@ -2255,18 +2255,18 @@ void SpriteSetup(void)
if (start_on)
{
// start in the on position
actor->user.zclip = actor->int_pos().Z;
actor->user.zclip = actor->spr.pos.Z;
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
SpikeAlign(actor);
}
// set orig z
actor->user.oz = actor->user.int_zclip() * zinttoworld;
actor->user.oz = actor->user.zclip;
actor->opos.Z = actor->user.oz;
}
else
{
actor->user.zclip = ceilz;
actor->user.zclip = ceilz * zinttoworld;
// start off
actor->user.pos.Z = actor->user.int_zclip();
@ -2274,13 +2274,13 @@ void SpriteSetup(void)
if (start_on)
{
// starting in the on position
actor->user.zclip = actor->int_pos().Z;
actor->user.zclip = actor->spr.pos.Z;
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
SpikeAlign(actor);
}
// set orig z
actor->user.oz = actor->user.int_zclip() * zinttoworld;
actor->user.oz = actor->user.zclip;
actor->opos.Z = actor->user.oz;
}

View file

@ -54,7 +54,7 @@ void ReverseVator(DSWActor* actor)
}
// moving toward to OFF pos
if (actor->user.int_z_tgt() == actor->user.int_oz())
if (actor->user.z_tgt == actor->user.oz)
{
if (actor->spr.pos.Z == actor->user.oz)
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
@ -447,7 +447,7 @@ int DoVator(DSWActor* actor)
else // if (*lptr == actor->user.int_z_tgt())
{
// if heading for the OFF (original) position and should NOT CRUSH
if (TEST_BOOL3(actor) && actor->user.int_z_tgt() == actor->user.int_oz())
if (TEST_BOOL3(actor) && actor->user.z_tgt == actor->user.oz)
{
int i;
bool found = false;
@ -457,7 +457,7 @@ int DoVator(DSWActor* actor)
{
if (itActor->spr.statnum == STAT_ENEMY)
{
if (labs(sectp->int_ceilingz() - sectp->int_floorz()) < ActorSizeZ(itActor))
if (abs(sectp->int_ceilingz() - sectp->int_floorz()) < ActorSizeZ(itActor))
{
InitBloodSpray(itActor, true, -1);
UpdateSinglePlayKills(itActor);
@ -545,7 +545,7 @@ int DoVatorAuto(DSWActor* actor)
if (zval == actor->user.int_z_tgt())
{
// in the UP position
if (actor->user.int_z_tgt() == actor->int_pos().Z)
if (actor->user.z_tgt == actor->spr.pos.Z)
{
// change target
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;

View file

@ -10851,7 +10851,7 @@ int DoBloodWorm(DSWActor* actor)
MissileHitDiveArea(actor);
if (!actor->user.int_z_tgt())
if (!actor->user.z_tgt)
{
// stay alive for 10 seconds
if (++actor->user.Counter3 > 3)