mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- Duke: cleanup on z-checks, part 1.
This commit is contained in:
parent
4506b5cb08
commit
b853e9caa0
4 changed files with 35 additions and 34 deletions
|
@ -1270,7 +1270,7 @@ void bounce(DDukeActor* actor)
|
|||
int daang = getangle(sectp->firstWall()->delta());
|
||||
|
||||
int k, l;
|
||||
if (actor->int_pos().Z < (actor->actor_int_floorz() + actor->actor_int_ceilingz()) >> 1)
|
||||
if (actor->spr.pos.Z < (actor->floorz + actor->ceilingz) * 0.5)
|
||||
k = sectp->ceilingheinum;
|
||||
else
|
||||
k = sectp->floorheinum;
|
||||
|
@ -1645,7 +1645,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
|
|||
actor->spr.ang += 96;
|
||||
actor->spr.xvel = 128;
|
||||
int j = ssp(actor, CLIPMASK0);
|
||||
if (j != 1 || actor->int_pos().Z > actor->actor_int_floorz())
|
||||
if (j != 1 || actor->spr.pos.Z > actor->floorz)
|
||||
{
|
||||
for (int l = 0; l < 16; l++)
|
||||
RANDOMSCRAP(actor);
|
||||
|
@ -1659,8 +1659,8 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
|
|||
}
|
||||
else
|
||||
{
|
||||
if (actor->int_pos().Z > actor->actor_int_floorz() - (48 << 8))
|
||||
actor->set_int_z(actor->actor_int_floorz() - (48 << 8));
|
||||
if (actor->spr.pos.Z > actor->floorz - 48)
|
||||
actor->spr.pos.Z = actor->floorz - 48;
|
||||
}
|
||||
|
||||
int x;
|
||||
|
@ -1808,7 +1808,7 @@ void ooz(DDukeActor *actor)
|
|||
|
||||
actor->spr.yrepeat = j;
|
||||
actor->spr.xrepeat = x;
|
||||
actor->set_int_z(actor->actor_int_floorz());
|
||||
actor->spr.pos.Z = actor->floorz;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -2320,7 +2320,7 @@ bool bloodpool(DDukeActor* actor, bool puke)
|
|||
int x;
|
||||
int p = findplayer(actor, &x);
|
||||
|
||||
actor->set_int_z(actor->actor_int_floorz() - (FOURSLEIGHT));
|
||||
actor->spr.pos.Z = actor->floorz - FOURSLEIGHT_F;
|
||||
|
||||
if (actor->temp_data[2] < 32)
|
||||
{
|
||||
|
@ -2449,7 +2449,7 @@ void glasspieces(DDukeActor* actor)
|
|||
return;
|
||||
}
|
||||
|
||||
if (actor->int_pos().Z == actor->actor_int_floorz() - (FOURSLEIGHT) && actor->temp_data[0] < 3)
|
||||
if (actor->spr.pos.Z == actor->floorz - FOURSLEIGHT_F && actor->temp_data[0] < 3)
|
||||
{
|
||||
actor->spr.zvel = -((3 - actor->temp_data[0]) << 8) - (krand() & 511);
|
||||
if (sectp->lotag == 2)
|
||||
|
@ -4401,7 +4401,7 @@ void handle_se24(DDukeActor *actor, bool scroll, int shift)
|
|||
wallswitchcheck(a2))
|
||||
continue;
|
||||
|
||||
if (a2->int_pos().Z > (a2->actor_int_floorz() - (16 << 8)))
|
||||
if (a2->spr.pos.Z > a2->floorz - 16)
|
||||
{
|
||||
a2->add_int_pos({ x >> shift , y >> shift, 0 });
|
||||
|
||||
|
@ -4880,7 +4880,7 @@ void makeitfall(DDukeActor* actor)
|
|||
actor->floorz = actor->sector()->floorz;
|
||||
}
|
||||
|
||||
if( actor->int_pos().Z < actor->actor_int_floorz()-(FOURSLEIGHT) )
|
||||
if( actor->spr.pos.Z < actor->floorz - FOURSLEIGHT_F)
|
||||
{
|
||||
if( actor->sector()->lotag == 2 && actor->spr.zvel > 3122 )
|
||||
actor->spr.zvel = 3144;
|
||||
|
@ -4889,9 +4889,9 @@ void makeitfall(DDukeActor* actor)
|
|||
else actor->spr.zvel = 6144;
|
||||
actor->add_int_z(actor->spr.zvel);
|
||||
}
|
||||
if( actor->int_pos().Z >= actor->actor_int_floorz()-(FOURSLEIGHT) )
|
||||
if (actor->spr.pos.Z >= actor->floorz - FOURSLEIGHT_F)
|
||||
{
|
||||
actor->set_int_z(actor->actor_int_floorz() - FOURSLEIGHT);
|
||||
actor->spr.pos.Z = actor->floorz - FOURSLEIGHT_F;
|
||||
actor->spr.zvel = 0;
|
||||
}
|
||||
}
|
||||
|
@ -5113,7 +5113,7 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO
|
|||
}
|
||||
else actor->cgg--;
|
||||
|
||||
if (actor->int_pos().Z < (actor->actor_int_floorz() - FOURSLEIGHT))
|
||||
if (actor->spr.pos.Z < actor->floorz - FOURSLEIGHT_F)
|
||||
{
|
||||
actor->spr.zvel += c;
|
||||
actor->add_int_z(actor->spr.zvel);
|
||||
|
|
|
@ -496,12 +496,12 @@ int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, un
|
|||
}
|
||||
actor->set_int_xy(pos.X, pos.Y);
|
||||
|
||||
if (dasectp != nullptr)
|
||||
if (dasectp != actor->sector())
|
||||
ChangeActorSect(actor, dasectp);
|
||||
int daz = actor->int_pos().Z + ((zchange * TICSPERFRAME) >> 3);
|
||||
if ((daz > actor->actor_int_ceilingz()) && (daz <= actor->actor_int_floorz()))
|
||||
actor->set_int_z(daz);
|
||||
if (dasectp != nullptr && dasectp != actor->sector())
|
||||
ChangeActorSect(actor, dasectp);
|
||||
|
||||
double daz = actor->spr.pos.Z + ((zchange * TICSPERFRAME) >> 3) * zinttoworld;
|
||||
if (daz > actor->ceilingz && daz <= actor->floorz)
|
||||
actor->spr.pos.Z = daz;
|
||||
else if (result.type == kHitNone)
|
||||
return result.setSector(dasectp);
|
||||
|
||||
|
@ -1558,8 +1558,8 @@ static void weaponcommon_d(DDukeActor* proj)
|
|||
proj->spr.zvel = -1;
|
||||
}
|
||||
else
|
||||
if ((proj->int_pos().Z > proj->actor_int_floorz() && proj->sector()->lotag != 1) ||
|
||||
(proj->int_pos().Z > proj->actor_int_floorz() + (16 << 8) && proj->sector()->lotag == 1))
|
||||
if ((proj->spr.pos.Z > proj->floorz && proj->sector()->lotag != 1) ||
|
||||
(proj->spr.pos.Z > proj->floorz + 16 && proj->sector()->lotag == 1))
|
||||
{
|
||||
coll.setSector(proj->sector());
|
||||
if (proj->sector()->lotag != 1)
|
||||
|
@ -2387,8 +2387,7 @@ static void greenslime(DDukeActor *actor)
|
|||
actor->spr.yrepeat = 16 + bsin(actor->temp_data[1], -13);
|
||||
|
||||
if (rnd(4) && (sectp->ceilingstat & CSTAT_SECTOR_SKY) == 0 &&
|
||||
abs(actor->actor_int_floorz() - actor->actor_int_ceilingz())
|
||||
< (192 << 8))
|
||||
fabs(actor->floorz - actor->ceilingz) < 192)
|
||||
{
|
||||
actor->spr.zvel = 0;
|
||||
actor->temp_data[0]++;
|
||||
|
@ -2418,7 +2417,7 @@ static void greenslime(DDukeActor *actor)
|
|||
|
||||
makeitfall(actor);
|
||||
|
||||
if (actor->int_pos().Z > actor->actor_int_floorz() - (8 << 8))
|
||||
if (actor->spr.pos.Z > actor->floorz - 8)
|
||||
{
|
||||
actor->spr.yrepeat -= 4;
|
||||
actor->spr.xrepeat += 2;
|
||||
|
@ -2429,9 +2428,9 @@ static void greenslime(DDukeActor *actor)
|
|||
if (actor->spr.xrepeat > 8) actor->spr.xrepeat -= 4;
|
||||
}
|
||||
|
||||
if (actor->int_pos().Z > actor->actor_int_floorz() - 2048)
|
||||
if (actor->spr.pos.Z > actor->floorz - 8)
|
||||
{
|
||||
actor->set_int_z(actor->actor_int_floorz() - 2048);
|
||||
actor->spr.pos.Z = actor->floorz - 8;
|
||||
actor->temp_data[0] = 0;
|
||||
actor->spr.xvel = 0;
|
||||
}
|
||||
|
@ -2495,8 +2494,8 @@ static void flamethrowerflame(DDukeActor *actor)
|
|||
coll.setSector(actor->sector());
|
||||
actor->spr.zvel = -1;
|
||||
}
|
||||
else if ((actor->int_pos().Z > actor->actor_int_floorz() && actor->sector()->lotag != 1)
|
||||
|| (actor->int_pos().Z > actor->actor_int_floorz() + (16 << 8) && actor->sector()->lotag == 1))
|
||||
else if ((actor->spr.pos.Z > actor->floorz && actor->sector()->lotag != 1)
|
||||
|| (actor->spr.pos.Z > actor->floorz + 16 && actor->sector()->lotag == 1))
|
||||
{
|
||||
coll.setSector(actor->sector());
|
||||
if (actor->sector()->lotag != 1)
|
||||
|
@ -2583,18 +2582,18 @@ static void heavyhbomb(DDukeActor *actor)
|
|||
{
|
||||
makeitfall(actor);
|
||||
|
||||
if (sectp->lotag != 1 && actor->int_pos().Z >= actor->actor_int_floorz() - (FOURSLEIGHT) && actor->spr.yvel < 3)
|
||||
if (sectp->lotag != 1 && actor->spr.pos.Z >= actor->floorz - FOURSLEIGHT_F && actor->spr.yvel < 3)
|
||||
{
|
||||
if (actor->spr.yvel > 0 || (actor->spr.yvel == 0 && actor->actor_int_floorz() == sectp->int_floorz()))
|
||||
if (actor->spr.yvel > 0 || (actor->spr.yvel == 0 && actor->floorz == sectp->floorz))
|
||||
S_PlayActorSound(PIPEBOMB_BOUNCE, actor);
|
||||
actor->spr.zvel = -((4 - actor->spr.yvel) << 8);
|
||||
if (actor->sector()->lotag == 2)
|
||||
actor->spr.zvel >>= 2;
|
||||
actor->spr.yvel++;
|
||||
}
|
||||
if (actor->int_pos().Z < actor->actor_int_ceilingz()) // && sectp->lotag != 2 )
|
||||
if (actor->spr.pos.Z < actor->ceilingz) // && sectp->lotag != 2 )
|
||||
{
|
||||
actor->set_int_z(actor->actor_int_ceilingz() + (3 << 8));
|
||||
actor->spr.pos.Z = actor->ceilingz + 3;
|
||||
actor->spr.zvel = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -415,9 +415,9 @@ int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, un
|
|||
if (dasectp)
|
||||
if ((dasectp != actor->sector()))
|
||||
ChangeActorSect(actor, dasectp);
|
||||
int daz = actor->int_pos().Z + ((zchange * TICSPERFRAME) >> 3);
|
||||
if ((daz > actor->actor_int_ceilingz()) && (daz <= actor->actor_int_floorz()))
|
||||
actor->set_int_z(daz);
|
||||
double daz = actor->spr.pos.Z + ((zchange * TICSPERFRAME) >> 3) * zinttoworld;
|
||||
if (daz > actor->ceilingz && daz <= actor->floorz)
|
||||
actor->spr.pos.Z = daz;
|
||||
else if (result.type == kHitNone)
|
||||
return result.setSector(dasectp);
|
||||
|
||||
|
|
|
@ -434,6 +434,8 @@ enum miscConstants
|
|||
DUKE3D_NO_WIDESCREEN_PINNING = 1 << 0,
|
||||
};
|
||||
|
||||
constexpr double FOURSLEIGHT_F = 1.0;
|
||||
|
||||
enum {
|
||||
MUS_INTRO = 0,
|
||||
MUS_BRIEFING = 1,
|
||||
|
|
Loading…
Reference in a new issue