diff --git a/src/actor.h b/src/actor.h index 331c7167a..43a29cdc6 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1101,7 +1101,13 @@ public: FBlockNode *BlockNode; // links in blocks (if needed) struct sector_t *Sector; subsector_t * subsector; - fixed_t floorz, ceilingz; // closest together of contacted secs + fixed_t floorz; double ceilingz; // closest together of contacted secs + + inline fixed_t _f_ceilingz() + { + return FLOAT2FIXED(ceilingz); + } + fixed_t dropoffz; // killough 11/98: the lowest floor over all contacted Sectors. struct sector_t *floorsector; diff --git a/src/b_move.cpp b/src/b_move.cpp index 78fc1c916..cb932eb66 100644 --- a/src/b_move.cpp +++ b/src/b_move.cpp @@ -270,7 +270,7 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm if (!(thing->flags & MF_NOCLIP) ) { fixed_t maxstep = thing->MaxStepHeight; - if (tm.ceilingz - tm.floorz < thing->height) + if (tm._f_ceilingz() - tm.floorz < thing->height) return false; // doesn't fit if (!(thing->flags&MF_MISSILE)) @@ -284,7 +284,7 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm if ( !(thing->flags & MF_TELEPORT) && - tm.ceilingz - thing->_f_Z() < thing->height) + tm.ceilingz < thing->Top()) return false; // mobj must lower itself to fit // jump out of water diff --git a/src/g_doom/a_painelemental.cpp b/src/g_doom/a_painelemental.cpp index 765409fe6..12dfc59d7 100644 --- a/src/g_doom/a_painelemental.cpp +++ b/src/g_doom/a_painelemental.cpp @@ -31,7 +31,7 @@ void A_PainShootSkull (AActor *self, DAngle Angle, PClassActor *spawntype, int f if (self->DamageType == NAME_Massacre) return; // [RH] check to make sure it's not too close to the ceiling - if (self->Top() + 8 > FIXED2FLOAT(self->ceilingz)) + if (self->Top() + 8 > self->ceilingz) { if (self->flags & MF_FLOAT) { diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 92d21b5c9..7abf1ef00 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -1132,7 +1132,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling) } } self->bouncecount = -1; - self->_f_SetZ(self->ceilingz + 4*FRACUNIT, false); + self->SetZ(self->ceilingz + 4, false); return 0; } diff --git a/src/g_hexen/a_korax.cpp b/src/g_hexen/a_korax.cpp index a431b97a3..0bdd21571 100644 --- a/src/g_hexen/a_korax.cpp +++ b/src/g_hexen/a_korax.cpp @@ -48,7 +48,7 @@ const int KORAX_ARM4_HEIGHT = 104*FRACUNIT; const int KORAX_ARM5_HEIGHT = 86*FRACUNIT; const int KORAX_ARM6_HEIGHT = 53*FRACUNIT; -const int KORAX_BOLT_HEIGHT = 48*FRACUNIT; +const double KORAX_BOLT_HEIGHT = 48.; const int KORAX_BOLT_LIFETIME = 3; @@ -473,14 +473,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_KBoltRaise) PARAM_ACTION_PROLOGUE; AActor *mo; - fixed_t z; // Spawn a child upward - z = self->_f_Z() + KORAX_BOLT_HEIGHT; + double z = self->Z() + KORAX_BOLT_HEIGHT; if ((z + KORAX_BOLT_HEIGHT) < self->ceilingz) { - mo = Spawn("KoraxBolt", self->_f_X(), self->_f_Y(), z, ALLOW_REPLACE); + mo = Spawn("KoraxBolt", self->PosAtZ(z), ALLOW_REPLACE); if (mo) { mo->special1 = KORAX_BOLT_LIFETIME; diff --git a/src/g_hexen/a_magelightning.cpp b/src/g_hexen/a_magelightning.cpp index 39f992225..3e58095c7 100644 --- a/src/g_hexen/a_magelightning.cpp +++ b/src/g_hexen/a_magelightning.cpp @@ -161,7 +161,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip) } else if (self->flags3 & MF3_CEILINGHUGGER) { - self->_f_SetZ(self->ceilingz-self->height); + self->SetZ(self->ceilingz - self->_Height()); target = self->tracer; } if (self->flags3 & MF3_FLOORHUGGER) diff --git a/src/g_hexen/a_wraith.cpp b/src/g_hexen/a_wraith.cpp index c71c1851d..0fada85c3 100644 --- a/src/g_hexen/a_wraith.cpp +++ b/src/g_hexen/a_wraith.cpp @@ -31,12 +31,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithInit) { PARAM_ACTION_PROLOGUE; - self->_f_AddZ(48<AddZ(48); // [RH] Make sure the wraith didn't go into the ceiling - if (self->_f_Top() > self->ceilingz) + if (self->Top() > self->ceilingz) { - self->_f_SetZ(self->ceilingz - self->height); + self->SetZ(self->ceilingz - self->_Height()); } self->special1 = 0; // index into floatbob diff --git a/src/g_shared/a_fastprojectile.cpp b/src/g_shared/a_fastprojectile.cpp index ba11ac59e..cfccb5675 100644 --- a/src/g_shared/a_fastprojectile.cpp +++ b/src/g_shared/a_fastprojectile.cpp @@ -117,7 +117,7 @@ void AFastProjectile::Tick () P_ExplodeMissile (this, NULL, NULL); return; } - if (_f_Top() > ceilingz) + if (Top() > ceilingz) { // Hit the ceiling if (ceilingpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE)) @@ -126,7 +126,7 @@ void AFastProjectile::Tick () return; } - _f_SetZ(ceilingz - height); + SetZ(ceilingz - _Height()); P_ExplodeMissile (this, NULL, NULL); return; } diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 55292868c..6a61d4c78 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -426,11 +426,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition) if (self->flags & MF_SPAWNCEILING) { - self->_f_SetZ(self->ceilingz - self->height - self->SpawnPoint[2]); + self->_f_SetZ(self->_f_ceilingz() - self->height - self->SpawnPoint[2]); } else if (self->flags2 & MF2_SPAWNFLOAT) { - fixed_t space = self->ceilingz - self->height - self->floorz; + fixed_t space = self->_f_ceilingz() - self->height - self->floorz; if (space > 48*FRACUNIT) { space -= 40*FRACUNIT; @@ -452,9 +452,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition) // initial spawn. self->_f_SetZ(self->floorz); } - if ((self->flags & MF_SOLID) && (self->_f_Top() > self->ceilingz)) + if ((self->flags & MF_SOLID) && (self->Top() > self->ceilingz)) { // Do the same for the ceiling. - self->_f_SetZ(self->ceilingz - self->height); + self->SetZ(self->ceilingz - self->_Height()); } // Do not interpolate from the position the actor was at when it was // picked up, in case that is different from where it is now. diff --git a/src/g_shared/a_randomspawner.cpp b/src/g_shared/a_randomspawner.cpp index 0566cf0f5..c8b5206b4 100644 --- a/src/g_shared/a_randomspawner.cpp +++ b/src/g_shared/a_randomspawner.cpp @@ -188,11 +188,11 @@ class ARandomSpawner : public AActor // Handle special altitude flags if (newmobj->flags & MF_SPAWNCEILING) { - newmobj->_f_SetZ(newmobj->ceilingz - newmobj->height - SpawnPoint[2]); + newmobj->_f_SetZ(newmobj->_f_ceilingz() - newmobj->height - SpawnPoint[2]); } else if (newmobj->flags2 & MF2_SPAWNFLOAT) { - fixed_t space = newmobj->ceilingz - newmobj->height - newmobj->floorz; + fixed_t space = newmobj->_f_ceilingz() - newmobj->height - newmobj->floorz; if (space > 48*FRACUNIT) { space -= 40*FRACUNIT; diff --git a/src/g_strife/a_inquisitor.cpp b/src/g_strife/a_inquisitor.cpp index f43278e31..d06d5d717 100644 --- a/src/g_strife/a_inquisitor.cpp +++ b/src/g_strife/a_inquisitor.cpp @@ -42,7 +42,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorDecide) } if (self->target->Z() != self->Z()) { - if (self->_f_Top() + 54*FRACUNIT < self->ceilingz) + if (self->Top() + 54 < self->ceilingz) { self->SetState (self->FindState("Jump")); } diff --git a/src/g_strife/a_sentinel.cpp b/src/g_strife/a_sentinel.cpp index ca0142825..5df0a0f51 100644 --- a/src/g_strife/a_sentinel.cpp +++ b/src/g_strife/a_sentinel.cpp @@ -13,7 +13,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob) { PARAM_ACTION_PROLOGUE; - fixed_t minz, maxz; + double minz, maxz; if (self->flags & MF_INFLOAT) { @@ -23,13 +23,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob) if (self->threshold != 0) return 0; - maxz = self->ceilingz - self->height - 16*FRACUNIT; - minz = self->floorz + 96*FRACUNIT; + maxz = self->ceilingz - self->_Height() - 16; + minz = FIXED2FLOAT(self->floorz) + 96; if (minz > maxz) { minz = maxz; } - if (minz < self->_f_Z()) + if (minz < self->Z()) { self->Vel.Z -= 1; } @@ -37,7 +37,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob) { self->Vel.Z += 1; } - self->reactiontime = (minz >= self->_f_Z()) ? 4 : 0; + self->reactiontime = (minz >= self->Z()) ? 4 : 0; return 0; } diff --git a/src/g_strife/a_stalker.cpp b/src/g_strife/a_stalker.cpp index 27cb388f1..8ee07de8a 100644 --- a/src/g_strife/a_stalker.cpp +++ b/src/g_strife/a_stalker.cpp @@ -19,7 +19,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_StalkerChaseDecide) { self->SetState (self->FindState("SeeFloor")); } - else if (self->ceilingz > self->_f_Top()) + else if (self->ceilingz > self->Top()) { self->SetState (self->FindState("Drop")); } diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 5159ac2d1..340f361af 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -552,9 +552,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave) // If the torpedo hit the ceiling, it should still spawn the wave savedz = self->_f_Z(); - if (wavedef && self->ceilingz - self->_f_Z() < wavedef->height) + if (wavedef && self->ceilingz < wavedef->Top()) { - self->_f_SetZ(self->ceilingz - wavedef->height); + self->SetZ(self->ceilingz - wavedef->_Height()); } for (int i = 0; i < 80; ++i) diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 70269c3fa..e54606200 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -408,7 +408,7 @@ bool P_CheckFor3DCeilingHit(AActor * mo) if(rover->flags & FF_SOLID && rover->model->SecActTarget) { - if(mo->ceilingz == rover->bottom.plane->ZatPoint(mo)) + if(mo->_f_ceilingz() == rover->bottom.plane->ZatPoint(mo)) { rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling); return true; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 3049108f7..3a5e90970 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8715,7 +8715,7 @@ scriptwait: case PCD_GETACTORCEILINGZ: { AActor *actor = SingleActorFromTID(STACK(1), activator); - STACK(1) = actor == NULL ? 0 : actor->ceilingz; + STACK(1) = actor == NULL ? 0 : DoubleToACS(actor->ceilingz); } break; @@ -9253,7 +9253,7 @@ scriptwait: switch (STACK(1)) { case PLAYERINFO_TEAM: STACK(2) = userinfo->GetTeam(); break; - case PLAYERINFO_AIMDIST: STACK(2) = userinfo->GetAimDist() * (0x40000000/90.); break; // Yes, this has been returning a BAM since its creation. + case PLAYERINFO_AIMDIST: STACK(2) = (SDWORD)(userinfo->GetAimDist() * (0x40000000/90.)); break; // Yes, this has been returning a BAM since its creation. case PLAYERINFO_COLOR: STACK(2) = userinfo->GetColor(); break; case PLAYERINFO_GENDER: STACK(2) = userinfo->GetGender(); break; case PLAYERINFO_NEVERSWITCH: STACK(2) = userinfo->GetNeverSwitch(); break; diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index d3ee74bba..6460397b0 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -45,7 +45,7 @@ struct sectortype { SWORD wallptr, wallnum; - SDWORD ceilingz, floorz; + SDWORD ceilingZ, floorZ; SWORD ceilingstat, floorstat; SWORD ceilingpicnum, ceilingheinum; SBYTE ceilingshade; @@ -402,7 +402,7 @@ static void LoadSectors (sectortype *bsec) bsec->floorstat = WORD(bsec->floorstat); sec->e = §ors[0].e[i]; - sec->SetPlaneTexZ(sector_t::floor, -(LittleLong(bsec->floorz) << 8)); + sec->SetPlaneTexZ(sector_t::floor, -(LittleLong(bsec->floorZ) << 8)); sec->floorplane.d = -sec->GetPlaneTexZ(sector_t::floor); sec->floorplane.c = FRACUNIT; sec->floorplane.ic = FRACUNIT; @@ -415,7 +415,7 @@ static void LoadSectors (sectortype *bsec) sec->SetPlaneLight(sector_t::floor, SHADE2LIGHT (bsec->floorshade)); sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING); - sec->SetPlaneTexZ(sector_t::ceiling, -(LittleLong(bsec->ceilingz) << 8)); + sec->SetPlaneTexZ(sector_t::ceiling, -(LittleLong(bsec->ceilingZ) << 8)); sec->ceilingplane.d = sec->GetPlaneTexZ(sector_t::ceiling); sec->ceilingplane.c = -FRACUNIT; sec->ceilingplane.ic = -FRACUNIT; @@ -647,13 +647,13 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec) if ((bsec->floorstat & 2) && (bsec->floorheinum != 0)) { // floor is sloped slope.heinum = -LittleShort(bsec->floorheinum); - slope.z[0] = slope.z[1] = slope.z[2] = -bsec->floorz; + slope.z[0] = slope.z[1] = slope.z[2] = -bsec->floorZ; CalcPlane (slope, sectors[i].floorplane); } if ((bsec->ceilingstat & 2) && (bsec->ceilingheinum != 0)) { // ceiling is sloped slope.heinum = -LittleShort(bsec->ceilingheinum); - slope.z[0] = slope.z[1] = slope.z[2] = -bsec->ceilingz; + slope.z[0] = slope.z[1] = slope.z[2] = -bsec->ceilingZ; CalcPlane (slope, sectors[i].ceilingplane); } int linenum = int(intptr_t(sides[bsec->wallptr].linedef)); @@ -699,7 +699,7 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites, mapthings[count].thingid = 0; mapthings[count].x = (sprites[i].x << 12); mapthings[count].y = -(sprites[i].y << 12); - mapthings[count].z = (bsectors[sprites[i].sectnum].floorz - sprites[i].z) << 8; + mapthings[count].z = (bsectors[sprites[i].sectnum].floorZ - sprites[i].z) << 8; mapthings[count].angle = (((2048-sprites[i].ang) & 2047) * 360) >> 11; mapthings[count].ClassFilter = 0xffff; mapthings[count].SkillFilter = 0xffff; diff --git a/src/p_checkposition.h b/src/p_checkposition.h index 4ab67634e..98736df79 100644 --- a/src/p_checkposition.h +++ b/src/p_checkposition.h @@ -20,7 +20,7 @@ struct FCheckPosition // out sector_t *sector; fixed_t floorz; - fixed_t ceilingz; + double ceilingz; fixed_t dropoffz; FTextureID floorpic; int floorterrain; @@ -46,6 +46,12 @@ struct FCheckPosition PushTime = 0; FromPMove = false; } + + inline fixed_t _f_ceilingz() + { + return FLOAT2FIXED(ceilingz); + } + }; diff --git a/src/p_local.h b/src/p_local.h index a3842d1ca..5d06a0504 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -236,7 +236,7 @@ AActor *P_RoughMonsterSearch (AActor *mo, int distance, bool onlyseekable=false) // If "floatok" true, move would be ok -// if within "tmfloorz - tmceilingz". +// if within "tmfloorz - tm_f_ceilingz()". extern msecnode_t *sector_list; // phares 3/16/98 struct spechit_t diff --git a/src/p_map.cpp b/src/p_map.cpp index d16679efc..e86bc66e2 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -242,7 +242,7 @@ static bool PIT_FindFloorCeiling(FMultiBlockLinesIterator &mit, FMultiBlockLines // adjust floor / ceiling heights if (!(flags & FFCF_NOCEILING)) { - if (open.top < tmf.ceilingz) + if (open.top < tmf._f_ceilingz()) { tmf.ceilingz = open.top; if (open.topsec != NULL) tmf.ceilingsector = open.topsec; @@ -291,7 +291,7 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags) sector_t *sec = (!(flags & FFCF_SAMESECTOR) || tmf.thing->Sector == NULL)? P_PointInSector(tmf.x, tmf.y) : tmf.sector; F3DFloor *ffc, *fff; - tmf.ceilingz = sec->NextHighestCeilingAt(tmf.x, tmf.y, tmf.z, tmf.z + tmf.thing->height, flags, &tmf.ceilingsector, &ffc); + tmf.ceilingz = FIXED2DBL(sec->NextHighestCeilingAt(tmf.x, tmf.y, tmf.z, tmf.z + tmf.thing->height, flags, &tmf.ceilingsector, &ffc)); tmf.floorz = tmf.dropoffz = sec->NextLowestFloorAt(tmf.x, tmf.y, tmf.z, flags, tmf.thing->MaxStepHeight, &tmf.floorsector, &fff); if (fff) @@ -343,7 +343,7 @@ void P_FindFloorCeiling(AActor *actor, int flags) actor->floorsector = tmf.floorsector; actor->ceilingpic = tmf.ceilingpic; actor->ceilingsector = tmf.ceilingsector; - if (ffcf_verbose) Printf("Starting with ceilingz = %f, floorz = %f\n", FIXED2FLOAT(tmf.ceilingz), FIXED2FLOAT(tmf.floorz)); + if (ffcf_verbose) Printf("Starting with ceilingz = %f, floorz = %f\n", tmf.ceilingz, FIXED2FLOAT(tmf.floorz)); tmf.touchmidtex = false; tmf.abovemidtex = false; @@ -769,7 +769,7 @@ static int LineIsBelow(line_t *line, AActor *actor) // // // PIT_CheckLine -// Adjusts tmfloorz and tmceilingz as lines are contacted +// Adjusts tmfloorz and tm_f_ceilingz() as lines are contacted // // //========================================================================== @@ -857,7 +857,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec if (state == 1) { // the line should not block but we should set the ceilingz to the portal boundary so that we can't float up into that line. - fixed_t portalz = cres.line->frontsector->SkyBoxes[sector_t::floor]->threshold; + double portalz = FIXED2FLOAT(cres.line->frontsector->SkyBoxes[sector_t::floor]->threshold); if (portalz < tm.ceilingz) { tm.ceilingz = portalz; @@ -936,9 +936,9 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec // adjust floor / ceiling heights if (!(cres.portalflags & FFCF_NOCEILING)) { - if (open.top < tm.ceilingz) + if (open.top < tm._f_ceilingz()) { - tm.ceilingz = open.top; + tm.ceilingz = FIXED2DBL(open.top); tm.ceilingsector = open.topsec; tm.ceilingpic = open.ceilingpic; tm.ceilingline = ld; @@ -1057,9 +1057,9 @@ static bool PIT_CheckPortal(FMultiBlockLinesIterator &mit, FMultiBlockLinesItera P_LineOpening(open, tm.thing, ld, ref.x, ref.y, cres.position.x, cres.position.y, 0); // adjust floor / ceiling heights - if (open.top - zofs < tm.ceilingz) + if (open.top - zofs < tm._f_ceilingz()) { - tm.ceilingz = open.top - zofs; + tm.ceilingz = FIXED2FLOAT(open.top - zofs); tm.ceilingpic = open.ceilingpic; /* tm.ceilingsector = open.topsec; @@ -1625,7 +1625,7 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo { // With noclip2, we must ignore 3D floors and go right to the uppermost ceiling and lowermost floor. tm.floorz = tm.dropoffz = newsec->_f_LowestFloorAt(x, y, &tm.floorsector); - tm.ceilingz = newsec->_f_HighestCeilingAt(x, y, &tm.ceilingsector); + tm.ceilingz = FIXED2DBL(newsec->_f_HighestCeilingAt(x, y, &tm.ceilingsector)); tm.floorpic = tm.floorsector->GetTexture(sector_t::floor); tm.floorterrain = tm.floorsector->GetTerrain(sector_t::floor); tm.ceilingpic = tm.ceilingsector->GetTexture(sector_t::ceiling); @@ -1752,7 +1752,7 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo { return false; } - if (tm.ceilingz - tm.floorz < thing->height) + if (tm._f_ceilingz() - tm.floorz < thing->height) { return false; } @@ -1792,7 +1792,7 @@ bool P_TestMobjLocation(AActor *mobj) if (P_CheckPosition(mobj, mobj->_f_X(), mobj->_f_Y())) { // XY is ok, now check Z mobj->flags = flags; - if ((mobj->_f_Z() < mobj->floorz) || (mobj->_f_Top() > mobj->ceilingz)) + if ((mobj->_f_Z() < mobj->floorz) || (mobj->Top() > mobj->ceilingz)) { // Bad Z return false; } @@ -1943,9 +1943,9 @@ void P_FakeZMovement(AActor *mo) mo->_f_SetZ(mo->floorz); } - if (mo->_f_Top() > mo->ceilingz) + if (mo->Top() > mo->ceilingz) { // hit the ceiling - mo->_f_SetZ(mo->ceilingz - mo->height); + mo->SetZ(mo->ceilingz - mo->_Height()); } } @@ -2054,7 +2054,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, } else if (BlockingMobj->_f_Top() - thing->_f_Z() > thing->MaxStepHeight || (BlockingMobj->Sector->ceilingplane.ZatPoint(x, y) - (BlockingMobj->_f_Top()) < thing->height) - || (tm.ceilingz - (BlockingMobj->_f_Top()) < thing->height)) + || (tm.ceilingz - (BlockingMobj->Top()) < thing->_Height())) { goto pushline; } @@ -2073,7 +2073,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, } else if (thing->flags3 & MF3_CEILINGHUGGER) { - thing->_f_SetZ(tm.ceilingz - thing->height); + thing->SetZ(tm.ceilingz - thing->_Height()); } if (onfloor && tm.floorsector == thing->floorsector) @@ -2082,7 +2082,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, } if (!(thing->flags & MF_NOCLIP)) { - if (tm.ceilingz - tm.floorz < thing->height) + if (tm._f_ceilingz() - tm.floorz < thing->height) { goto pushline; // doesn't fit } @@ -2090,7 +2090,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, tm.floatok = true; if (!(thing->flags & MF_TELEPORT) - && tm.ceilingz - thing->_f_Z() < thing->height + && tm.ceilingz < thing->Top() && !(thing->flags3 & MF3_CEILINGHUGGER) && (!(thing->flags2 & MF2_FLY) || !(thing->flags & MF_NOGRAVITY))) { @@ -2099,12 +2099,12 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, if (thing->flags2 & MF2_FLY && thing->flags & MF_NOGRAVITY) { #if 1 - if (thing->_f_Top() > tm.ceilingz) + if (thing->Top() > tm.ceilingz) goto pushline; #else // When flying, slide up or down blocking lines until the actor // is not blocked. - if (thing->_f_Top() > tm.ceilingz) + if (thing->Top() > tm.ceilingz) { thing->_f_velz() = -8 * FRACUNIT; goto pushline; @@ -2371,7 +2371,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, oldpos = thing->_f_Pos(); oldsector = thing->Sector; thing->floorz = tm.floorz; - thing->ceilingz = tm.ceilingz; + thing->ceilingz= tm.ceilingz; thing->dropoffz = tm.dropoffz; // killough 11/98: keep track of dropoffs thing->floorpic = tm.floorpic; thing->floorterrain = tm.floorterrain; @@ -2543,18 +2543,18 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y) } else if (thing->flags3 & MF3_CEILINGHUGGER) { - newz = tm.ceilingz - thing->height; + newz = tm._f_ceilingz() - thing->height; } if (!(thing->flags & MF_NOCLIP)) { - if (tm.ceilingz - tm.floorz < thing->height) + if (tm._f_ceilingz() - tm.floorz < thing->height) { return false; } if (!(thing->flags & MF_TELEPORT) - && tm.ceilingz - newz < thing->height + && tm.ceilingz - newz < thing->_Height() && !(thing->flags3 & MF3_CEILINGHUGGER) && (!(thing->flags2 & MF2_FLY) || !(thing->flags & MF_NOGRAVITY))) { @@ -2562,7 +2562,7 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y) } if (thing->flags2 & MF2_FLY && thing->flags & MF_NOGRAVITY) { - if (thing->_f_Top() > tm.ceilingz) + if (thing->Top() > tm.ceilingz) return false; } if (!(thing->flags & MF_TELEPORT) && !(thing->flags3 & MF3_FLOORHUGGER)) @@ -3254,7 +3254,7 @@ bool FSlide::BounceWall(AActor *mo) if (BounceTraverse(leadx, leady, leadx + mo->_f_velx(), leady + mo->_f_vely()) && mo->BlockingLine == NULL) { // Could not find a wall, so bounce off the floor/ceiling instead. fixed_t floordist = mo->_f_Z() - mo->floorz; - fixed_t ceildist = mo->ceilingz - mo->_f_Z(); + fixed_t ceildist = mo->_f_ceilingz() - mo->_f_Z(); if (floordist <= ceildist) { mo->FloorBounceMissile(mo->Sector->floorplane); @@ -5679,7 +5679,7 @@ int P_PushUp(AActor *thing, FChangePosition *cpos) unsigned int lastintersect; int mymass = thing->Mass; - if (thing->_f_Top() > thing->ceilingz) + if (thing->Top() > thing->ceilingz) { return 1; } @@ -5884,7 +5884,7 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos) onfloor = thing->_f_Z() <= thing->floorz; P_AdjustFloorCeil(thing, cpos); - if (thing->_f_Top() > thing->ceilingz) + if (thing->Top() > thing->ceilingz) { if (thing->flags4 & MF4_ACTLIKEBRIDGE) { @@ -5893,9 +5893,9 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos) } intersectors.Clear(); fixed_t oldz = thing->_f_Z(); - if (thing->ceilingz - thing->height >= thing->floorz) + if (thing->_f_ceilingz() - thing->height >= thing->floorz) { - thing->_f_SetZ(thing->ceilingz - thing->height); + thing->SetZ(thing->ceilingz - thing->_Height()); } else { @@ -5939,23 +5939,23 @@ void PIT_CeilingRaise(AActor *thing, FChangePosition *cpos) // (or something else?) Things marked as hanging from the ceiling will // stay where they are. if (thing->_f_Z() < thing->floorz && - thing->_f_Top() >= thing->ceilingz - cpos->moveamt && + thing->_f_Top() >= thing->_f_ceilingz() - cpos->moveamt && !(thing->flags & MF_NOLIFTDROP)) { fixed_t oldz = thing->_f_Z(); thing->_f_SetZ(thing->floorz); - if (thing->_f_Top() > thing->ceilingz) + if (thing->Top() > thing->ceilingz) { - thing->_f_SetZ(thing->ceilingz - thing->height); + thing->SetZ(thing->ceilingz - thing->_Height()); } P_CheckFakeFloorTriggers(thing, oldz); } - else if ((thing->flags2 & MF2_PASSMOBJ) && !isgood && thing->_f_Top() < thing->ceilingz) + else if ((thing->flags2 & MF2_PASSMOBJ) && !isgood && thing->Top() < thing->ceilingz) { AActor *onmobj; - if (!P_TestMobjZ(thing, true, &onmobj) && onmobj->_f_Z() <= thing->_f_Z()) + if (!P_TestMobjZ(thing, true, &onmobj) && onmobj->Z() <= thing->Z()) { - thing->_f_SetZ( MIN(thing->ceilingz - thing->height, onmobj->_f_Top())); + thing->SetZ(MIN(thing->ceilingz - thing->_Height(), onmobj->Top())); } } if (thing->player && thing->player->mo == thing) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 8db643148..b5b52a9ea 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2577,20 +2577,20 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) mo->AdjustFloorClip (); } - if (mo->_f_Top() > mo->ceilingz) + if (mo->Top() > mo->ceilingz) { // hit the ceiling if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) && mo->Sector->SecActTarget != NULL && - mo->Sector->ceilingplane.ZatPoint(mo) == mo->ceilingz) + mo->Sector->ceilingplane.ZatPoint(mo) == mo->_f_ceilingz()) { // [RH] Let the sector do something to the actor mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling); } P_CheckFor3DCeilingHit(mo); // [RH] Need to recheck this because the sector action might have // teleported the actor so it is no longer above the ceiling. - if (mo->_f_Top() > mo->ceilingz) + if (mo->Top() > mo->ceilingz) { - mo->_f_SetZ(mo->ceilingz - mo->height); + mo->SetZ(mo->ceilingz - mo->_Height()); if (mo->BounceFlags & BOUNCE_Ceilings) { // ceiling bounce mo->FloorBounceMissile (mo->ceilingsector->ceilingplane); @@ -2764,9 +2764,9 @@ void P_NightmareRespawn (AActor *mobj) // can use P_CheckPosition() properly. mo->_f_SetZ(mo->floorz); } - if (mo->_f_Top() > mo->ceilingz) + if (mo->Top() > mo->ceilingz) { - mo->_f_SetZ(mo->ceilingz - mo->height); + mo->SetZ(mo->ceilingz- mo->_Height()); } } else if (z == ONCEILINGZ) @@ -2786,9 +2786,9 @@ void P_NightmareRespawn (AActor *mobj) // can use P_CheckPosition() properly. mo->_f_SetZ(mo->floorz); } - if (mo->_f_Top() > mo->ceilingz) + if (mo->Top() > mo->ceilingz) { // Do the same for the ceiling. - mo->_f_SetZ(mo->ceilingz - mo->height); + mo->SetZ(mo->ceilingz - mo->_Height()); } } @@ -4002,7 +4002,7 @@ void AActor::CheckSectorTransition(sector_t *oldsec) { P_CheckFor3DFloorHit(this); } - if (_f_Top() == ceilingz) + if (Top() == ceilingz) { P_CheckFor3DCeilingHit(this); } @@ -4193,7 +4193,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t actor->dropoffz = // killough 11/98: for tracking dropoffs actor->floorz = actor->Sector->floorplane.ZatPoint (ix, iy); - actor->ceilingz = actor->Sector->ceilingplane.ZatPoint (ix, iy); + actor->ceilingz = FIXED2DBL(actor->Sector->ceilingplane.ZatPoint (ix, iy)); // The z-coordinate needs to be set once before calling P_FindFloorCeiling // For FLOATRANDZ just use the floor here. @@ -4203,7 +4203,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t } else if (iz == ONCEILINGZ) { - actor->_f_SetZ(actor->ceilingz - actor->height); + actor->SetZ(actor->ceilingz - actor->_Height()); } if (SpawningMapThing || !type->IsDescendantOf (RUNTIME_CLASS(APlayerPawn))) @@ -4246,11 +4246,11 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t } else if (iz == ONCEILINGZ) { - actor->_f_SetZ(actor->ceilingz - actor->height); + actor->SetZ(actor->ceilingz - actor->_Height()); } else if (iz == FLOATRANDZ) { - fixed_t space = actor->ceilingz - actor->height - actor->floorz; + fixed_t space = actor->_f_ceilingz() - actor->height - actor->floorz; if (space > 48*FRACUNIT) { space -= 40*FRACUNIT; @@ -4782,9 +4782,9 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) // "Fix" for one of the starts on exec.wad MAP01: If you start inside the ceiling, // drop down below it, even if that means sinking into the floor. - if (mobj->_f_Top() > mobj->ceilingz) + if (mobj->Top() > mobj->ceilingz) { - mobj->_f_SetZ(mobj->ceilingz - mobj->height, false); + mobj->SetZ(mobj->ceilingz - mobj->_Height(), false); } // [BC] Do script stuff @@ -6698,7 +6698,7 @@ void PrintMiscActorInfo(AActor *query) Printf("\nTID: %d", query->tid); Printf("\nCoord= x: %f, y: %f, z:%f, floor:%f, ceiling:%f.", query->X(), query->Y(), query->Z(), - FIXED2DBL(query->floorz), FIXED2DBL(query->ceilingz)); + FIXED2DBL(query->floorz), query->ceilingz); Printf("\nSpeed= %f, velocity= x:%f, y:%f, z:%f, combined:%f.\n", query->Speed, query->Vel.X, query->Vel.Y, query->Vel.Z, query->Vel.Length()); } diff --git a/src/p_user.cpp b/src/p_user.cpp index 11fd54d9e..6221f3cfb 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -1852,8 +1852,8 @@ void P_CalcHeight (player_t *player) { player->viewz = player->mo->_f_Z() + defaultviewheight; - if (player->viewz > player->mo->ceilingz-4*FRACUNIT) - player->viewz = player->mo->ceilingz-4*FRACUNIT; + if (player->viewz > player->mo->_f_ceilingz()-4*FRACUNIT) + player->viewz = player->mo->_f_ceilingz()-4*FRACUNIT; return; } @@ -1911,9 +1911,9 @@ void P_CalcHeight (player_t *player) { player->viewz -= player->mo->floorclip; } - if (player->viewz > player->mo->ceilingz - 4*FRACUNIT) + if (player->viewz > player->mo->_f_ceilingz() - 4*FRACUNIT) { - player->viewz = player->mo->ceilingz - 4*FRACUNIT; + player->viewz = player->mo->_f_ceilingz() - 4*FRACUNIT; } if (player->viewz < player->mo->floorz + 4*FRACUNIT) { @@ -2415,7 +2415,7 @@ void P_PlayerThink (player_t *player) player->crouching = 0; } if (crouchdir == 1 && player->crouchfactor < 1 && - player->mo->_f_Top() < player->mo->ceilingz) + player->mo->Top() < player->mo->ceilingz) { P_CrouchMove(player, 1); } diff --git a/src/r_things.cpp b/src/r_things.cpp index 736e15ad5..4422a9d57 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -2115,8 +2115,8 @@ void R_DrawSprite (vissprite_t *spr) if (spr->fakeceiling != NULL) { - fixed_t ceilingz = spr->fakeceiling->bottom.plane->Zat0(); - if (viewz < ceilingz && ceilingz == sclipTop) + fixed_t ceilingZ = spr->fakeceiling->bottom.plane->Zat0(); + if (viewz < ceilingZ && ceilingZ == sclipTop) { h = spr->fakeceiling->top.plane->Zat0(); } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index ea9cfb470..25542e6cd 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -939,8 +939,8 @@ static int DoJumpIfCloser(AActor *target, VM_ARGS) } if (self->AproxDistance(target) < dist && (noz || - ((self->_f_Z() > target->_f_Z() && self->_f_Z() - target->_f_Top() < dist) || - (self->_f_Z() <= target->_f_Z() && target->_f_Z() - self->_f_Top() < dist)))) + ((self->Z() > target->Z() && self->Z() - target->Top() < dist) || + (self->Z() <= target->Z() && target->Z() - self->Top() < dist)))) { ACTION_RETURN_STATE(jump); } @@ -3383,7 +3383,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckCeiling) PARAM_ACTION_PROLOGUE; PARAM_STATE(jump); - if (self->_f_Top() >= self->ceilingz) // Height needs to be counted + if (self->Top() >= self->ceilingz) // Height needs to be counted { ACTION_RETURN_STATE(jump); } @@ -4784,7 +4784,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport) if (flags & TF_SENSITIVEZ) { fixed_t posz = (flags & TF_USESPOTZ) ? spot->_f_Z() : spot->floorz; - if ((posz + ref->height > spot->ceilingz) || (posz < spot->floorz)) + if ((posz + ref->height > spot->_f_ceilingz()) || (posz < spot->floorz)) { return numret; } @@ -4793,8 +4793,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport) fixed_t aboveFloor = spot->_f_Z() - spot->floorz; fixed_t finalz = spot->floorz + aboveFloor; - if (spot->_f_Z() + ref->height > spot->ceilingz) - finalz = spot->ceilingz - ref->height; + if (spot->Z() + ref->_Height() > spot->ceilingz) + finalz = spot->_f_ceilingz() - ref->height; else if (spot->_f_Z() < spot->floorz) finalz = spot->floorz; diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 73ba2ee87..2209319df 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -622,7 +622,7 @@ void InitThingdef() symt.AddSymbol(new PField(NAME_Alpha, TypeFixed, VARF_Native, myoffsetof(AActor,alpha))); symt.AddSymbol(new PField(NAME_Angle, TypeFloat64, VARF_Native, myoffsetof(AActor,Angles.Yaw))); symt.AddSymbol(new PField(NAME_Args, array5, VARF_Native, myoffsetof(AActor,args))); - symt.AddSymbol(new PField(NAME_CeilingZ, TypeFixed, VARF_Native, myoffsetof(AActor,ceilingz))); + symt.AddSymbol(new PField(NAME_CeilingZ, TypeFloat64, VARF_Native, myoffsetof(AActor,ceilingz))); symt.AddSymbol(new PField(NAME_FloorZ, TypeFixed, VARF_Native, myoffsetof(AActor,floorz))); symt.AddSymbol(new PField(NAME_Health, TypeSInt32, VARF_Native, myoffsetof(AActor,health))); symt.AddSymbol(new PField(NAME_Mass, TypeSInt32, VARF_Native, myoffsetof(AActor,Mass)));