mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- cleaned up the remaining uses of the integer floorz/ceilingz variables.
This concerns two particularly ugly blocks of code in the move functions - these were fully redone with pure floating point math.
This commit is contained in:
parent
89c0e4234c
commit
4506b5cb08
4 changed files with 43 additions and 46 deletions
|
@ -4810,7 +4810,7 @@ void getglobalz(DDukeActor* actor)
|
|||
|
||||
auto cc = actor->spr.cstat2;
|
||||
actor->spr.cstat2 |= CSTAT2_SPRITE_NOFIND; // don't clip against self. getzrange cannot detect this because it only receives a coordinate.
|
||||
getzrange({ actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (FOURSLEIGHT) }, actor->sector(), &actor->__int_ceilingz, hz, &actor->__int_floorz, lz, zr, CLIPMASK0);
|
||||
getzrange({ actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (FOURSLEIGHT) }, actor->sector(), &actor->ceilingz, hz, &actor->floorz, lz, zr, CLIPMASK0);
|
||||
actor->spr.cstat2 = cc;
|
||||
|
||||
actor->spr.cstat2 &= ~CSTAT2_SPRITE_NOSHADOW;
|
||||
|
@ -4872,7 +4872,7 @@ void makeitfall(DDukeActor* actor)
|
|||
if ((actor->spr.statnum == STAT_ACTOR || actor->spr.statnum == STAT_PLAYER || actor->spr.statnum == STAT_ZOMBIEACTOR || actor->spr.statnum == STAT_STANDABLE))
|
||||
{
|
||||
Collision coll;
|
||||
getzrange({ actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (FOURSLEIGHT) }, actor->sector(), &actor->__int_ceilingz, coll, &actor->__int_floorz, coll, 127, CLIPMASK0);
|
||||
getzrange({ actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (FOURSLEIGHT) }, actor->sector(), &actor->ceilingz, coll, &actor->floorz, coll, 127, CLIPMASK0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3494,7 +3494,6 @@ void moveeffectors_d(void) //STATNUM 3
|
|||
|
||||
void move_d(DDukeActor *actor, int playernum, int xvel)
|
||||
{
|
||||
int l;
|
||||
int goalang, angdif;
|
||||
int daxvel;
|
||||
|
||||
|
@ -3583,17 +3582,20 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
|
|||
{
|
||||
if (actor->spr.picnum == COMMANDER)
|
||||
{
|
||||
actor->__int_floorz = l = getflorzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y);
|
||||
if (actor->int_pos().Z > (l - (8 << 8)))
|
||||
double c, f;
|
||||
getzsofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &c, &f);
|
||||
actor->floorz = f;
|
||||
actor->ceilingz = c;
|
||||
|
||||
if (actor->spr.pos.Z > f - 8)
|
||||
{
|
||||
if (actor->int_pos().Z > (l - (8 << 8))) actor->set_int_z(l - (8 << 8));
|
||||
actor->spr.pos.Z = f - 8;
|
||||
actor->spr.zvel = 0;
|
||||
}
|
||||
|
||||
actor->__int_ceilingz = l = getceilzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y);
|
||||
if ((actor->int_pos().Z - l) < (80 << 8))
|
||||
if (actor->spr.pos.Z < c + 80)
|
||||
{
|
||||
actor->set_int_z(l + (80 << 8));
|
||||
actor->spr.pos.Z = c + 80;
|
||||
actor->spr.zvel = 0;
|
||||
}
|
||||
}
|
||||
|
@ -3601,16 +3603,18 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
|
|||
{
|
||||
if (actor->spr.zvel > 0)
|
||||
{
|
||||
actor->__int_floorz = l = getflorzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y);
|
||||
if (actor->int_pos().Z > (l - (30 << 8)))
|
||||
actor->set_int_z(l - (30 << 8));
|
||||
double f = getflorzofslopeptrf(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
|
||||
actor->floorz = f;
|
||||
if (actor->spr.pos.Z > f - 30)
|
||||
actor->spr.pos.Z = f - 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
actor->__int_ceilingz = l = getceilzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y);
|
||||
if ((actor->int_pos().Z - l) < (50 << 8))
|
||||
double c = getceilzofslopeptrf(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
|
||||
actor->ceilingz = c;
|
||||
if (actor->spr.pos.Z < c + 50)
|
||||
{
|
||||
actor->set_int_z(l + (50 << 8));
|
||||
actor->spr.pos.Z = c + 50;
|
||||
actor->spr.zvel = 0;
|
||||
}
|
||||
}
|
||||
|
@ -3618,22 +3622,22 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
|
|||
}
|
||||
else if (actor->spr.picnum != ORGANTIC)
|
||||
{
|
||||
if (actor->spr.zvel > 0 && actor->__int_floorz < actor->int_pos().Z)
|
||||
actor->set_int_z(actor->__int_floorz);
|
||||
if (actor->spr.zvel > 0 && actor->floorz < actor->spr.pos.Z)
|
||||
actor->spr.pos.Z = actor->floorz;
|
||||
if (actor->spr.zvel < 0)
|
||||
{
|
||||
l = getceilzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y);
|
||||
if ((actor->int_pos().Z - l) < (66 << 8))
|
||||
double c = getceilzofslopeptrf(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
|
||||
if (actor->spr.pos.Z < c + 66)
|
||||
{
|
||||
actor->set_int_z(l + (66 << 8));
|
||||
actor->spr.pos.Z = c + 66;
|
||||
actor->spr.zvel >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (actor->spr.picnum == APLAYER)
|
||||
if ((actor->int_pos().Z - actor->__int_ceilingz) < (32 << 8))
|
||||
actor->set_int_z(actor->__int_ceilingz + (32 << 8));
|
||||
if ((actor->spr.pos.Z - actor->ceilingz) < 32)
|
||||
actor->spr.pos.Z = actor->ceilingz + 32;
|
||||
|
||||
daxvel = actor->spr.xvel;
|
||||
angdif = actor->spr.ang;
|
||||
|
|
|
@ -3024,7 +3024,7 @@ void moveexplosions_r(void) // STATNUM 5
|
|||
if (!money(act, BLOODPOOL)) continue;
|
||||
|
||||
if (act->sector()->lotag == 800)
|
||||
if (act->int_pos().Z >= act->sector()->int_floorz() - (8 << 8))
|
||||
if (act->spr.pos.Z >= act->sector()->floorz - 8)
|
||||
{
|
||||
deletesprite(act);
|
||||
continue;
|
||||
|
@ -3472,7 +3472,6 @@ int adjustfall(DDukeActor *actor, int c)
|
|||
|
||||
void move_r(DDukeActor *actor, int pnum, int xvel)
|
||||
{
|
||||
int l;
|
||||
int goalang, angdif;
|
||||
int daxvel;
|
||||
|
||||
|
@ -3640,43 +3639,38 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
|
|||
{
|
||||
if (actor->spr.zvel > 0)
|
||||
{
|
||||
actor->__int_floorz = l = getflorzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y);
|
||||
if (isRRRA())
|
||||
{
|
||||
if (actor->int_pos().Z > (l - (28 << 8)))
|
||||
actor->set_int_z(l - (28 << 8));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (actor->int_pos().Z > (l - (30 << 8)))
|
||||
actor->set_int_z(l - (30 << 8));
|
||||
}
|
||||
double dist = isRRRA() ? 28 : 30;
|
||||
double f = getflorzofslopeptrf(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
|
||||
actor->floorz = f;
|
||||
if (actor->spr.pos.Z > f - dist)
|
||||
actor->spr.pos.Z = f - dist;
|
||||
}
|
||||
else
|
||||
{
|
||||
actor->__int_ceilingz = l = getceilzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y);
|
||||
if ((actor->int_pos().Z - l) < (50 << 8))
|
||||
double c = getceilzofslopeptrf(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
|
||||
actor->ceilingz = c;
|
||||
if (actor->spr.pos.Z < c + 50)
|
||||
{
|
||||
actor->set_int_z(l + (50 << 8));
|
||||
actor->spr.pos.Z = c + 50;
|
||||
actor->spr.zvel = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (actor->spr.zvel > 0 && actor->__int_floorz < actor->int_pos().Z)
|
||||
actor->set_int_z(actor->__int_floorz);
|
||||
if (actor->spr.zvel > 0 && actor->floorz < actor->spr.pos.Z)
|
||||
actor->spr.pos.Z = actor->floorz;
|
||||
if (actor->spr.zvel < 0)
|
||||
{
|
||||
l = getceilzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y);
|
||||
if ((actor->int_pos().Z - l) < (66 << 8))
|
||||
double c = getceilzofslopeptrf(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
|
||||
if (actor->spr.pos.Z < c + 66)
|
||||
{
|
||||
actor->set_int_z(l + (66 << 8));
|
||||
actor->spr.pos.Z = c + 66;
|
||||
actor->spr.zvel >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (actor->spr.picnum == APLAYER)
|
||||
if ((actor->int_pos().Z - actor->__int_ceilingz) < (32 << 8))
|
||||
actor->set_int_z(actor->__int_ceilingz + (32 << 8));
|
||||
if ((actor->spr.pos.Z - actor->ceilingz) < 32)
|
||||
actor->spr.pos.Z = actor->ceilingz + 32;
|
||||
|
||||
daxvel = actor->spr.xvel;
|
||||
angdif = actor->spr.ang;
|
||||
|
|
|
@ -51,7 +51,6 @@ public:
|
|||
short timetosleep;
|
||||
vec2_t ovel;
|
||||
double floorz, ceilingz;
|
||||
int __int_floorz, __int_ceilingz;
|
||||
union
|
||||
{
|
||||
int saved_ammo;
|
||||
|
|
Loading…
Reference in a new issue