- floatified FLineOpening.

- some smaller fixes.
This commit is contained in:
Christoph Oelckers 2016-03-25 18:19:54 +01:00
parent 2cf3b20ea8
commit fb8e03d5eb
22 changed files with 182 additions and 151 deletions

View file

@ -1415,17 +1415,10 @@ public:
DVector3 PosRelative(sector_t *sec) const;
DVector3 PosRelative(line_t *line) const;
fixed_t SoundX() const
FVector3 SoundPos() const
{
return _f_X();
}
fixed_t SoundY() const
{
return _f_Y();
}
fixed_t SoundZ() const
{
return _f_Z();
// fixme: This still needs portal handling
return{ float(X()), float(Y()), float(Z()) };
}
DVector3 InterpolatedPosition(double ticFrac) const
{

View file

@ -648,7 +648,7 @@ CUSTOM_CVAR (Int, am_cheat, 0, 0)
#define AM_NUMMARKPOINTS 10
// player _f_radius() for automap checking
// player radius for automap checking
#define PLAYERRADIUS 16*MAPUNIT
// how much the automap moves window per tic in frame-buffer coordinates

View file

@ -458,7 +458,7 @@ void FCajunMaster::SetBodyAt (const DVector3 &pos, int hostnum)
//
//Returns NULL if shouldn't fire
//else an angle (in degrees) are given
//This function assumes actor->player->_f_angle()
//This function assumes actor->player->angle
//has been set an is the main aiming angle.

View file

@ -903,7 +903,7 @@ CCMD(info)
PrintMiscActorInfo(t.linetarget);
}
else Printf("No target found. Info cannot find actors that have "
"the NOBLOCKMAP flag or have height/_f_radius() of 0.\n");
"the NOBLOCKMAP flag or have height/radius of 0.\n");
}
typedef bool (*ActorTypeChecker) (AActor *);

View file

@ -73,7 +73,7 @@ void AFastProjectile::Tick ()
if (tm.ceilingline &&
tm.ceilingline->backsector &&
tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
Z() >= tm.ceilingline->backsector->ceilingplane.ZatPointF(_f_PosRelative(tm.ceilingline)))
Z() >= tm.ceilingline->backsector->ceilingplane.ZatPoint(PosRelative(tm.ceilingline)))
{
// Hack to prevent missiles exploding against the sky.
// Does not handle sky floors.

View file

@ -68,7 +68,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
P_CheckMissileSpawn (trail, self->radius);
}
}
missile->_f_AddZ(missile->_f_velz() >> 2);
missile->AddZ(missile->Vel.Z / 4);
}
return 0;
}

View file

@ -753,23 +753,24 @@ lightlist_t * P_GetPlaneLight(sector_t * sector, secplane_t * plane, bool unders
//==========================================================================
void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef,
fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict)
double x, double y, bool restrict)
{
if(thing)
{
fixed_t thingbot, thingtop;
double thingbot, thingtop;
thingbot = thing->Z();
thingtop = thing->Top();
thingbot = thing->_f_Z();
thingtop = thingbot + (thing->_f_height()==0? 1:thing->_f_height());
extsector_t::xfloor *xf[2] = {&linedef->frontsector->e->XFloor, &linedef->backsector->e->XFloor};
// Check for 3D-floors in the sector (mostly identical to what Legacy does here)
if(xf[0]->ffloors.Size() || xf[1]->ffloors.Size())
{
fixed_t lowestceiling = open.top;
fixed_t highestfloor = open.bottom;
fixed_t lowestfloor[2] = {
double lowestceiling = open.top;
double highestfloor = open.bottom;
double lowestfloor[2] = {
linedef->frontsector->floorplane.ZatPoint(x, y),
linedef->backsector->floorplane.ZatPoint(x, y) };
FTextureID highestfloorpic;
@ -790,20 +791,20 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_SOLID)) continue;
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(x, y);
fixed_t ff_top=rover->top.plane->ZatPoint(x, y);
double ff_bottom=rover->bottom.plane->ZatPoint(x, y);
double ff_top=rover->top.plane->ZatPoint(x, y);
fixed_t delta1 = abs(thingbot - ((ff_bottom + ff_top) / 2));
fixed_t delta2 = abs(thingtop - ((ff_bottom + ff_top) / 2));
double delta1 = fabs(thingbot - ((ff_bottom + ff_top) / 2));
double delta2 = fabs(thingtop - ((ff_bottom + ff_top) / 2));
if(ff_bottom < lowestceiling && delta1 >= delta2)
if(ff_bottom < lowestceiling && delta1 > delta2)
{
lowestceiling = ff_bottom;
lowestceilingpic = *rover->bottom.texture;
lowestceilingsec = j == 0 ? linedef->frontsector : linedef->backsector;
}
if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->_f_Z() >= ff_top))
if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->Z() >= ff_top))
{
highestfloor = ff_top;
highestfloorpic = *rover->top.texture;
@ -811,7 +812,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
highestfloorsec = j == 0 ? linedef->frontsector : linedef->backsector;
highestfloorplanes[j] = rover->top.plane;
}
if(ff_top > lowestfloor[j] && ff_top <= thing->_f_Z() + thing->_f_MaxStepHeight()) lowestfloor[j] = ff_top;
if(ff_top > lowestfloor[j] && ff_top <= thing->Z() + thing->MaxStepHeight) lowestfloor[j] = ff_top;
}
}

View file

@ -139,7 +139,7 @@ void P_Spawn3DFloors( void );
struct FLineOpening;
void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef,
fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict);
double x, double y, bool restrict);
secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z);
int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, bool floor, fixed_t &cmpz);

View file

@ -36,6 +36,7 @@
#include "templates.h"
#include "p_3dmidtex.h"
#include "p_local.h"
#include "p_terrain.h"
#include "p_maputl.h"
@ -256,6 +257,19 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, f
}
bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, double *ptexbot)
{
fixed_t t, b;
if (P_GetMidTexturePosition(line, sideno, &t, &b))
{
*ptextop = FIXED2DBL(t);
*ptexbot = FIXED2DBL(b);
return true;
}
return false;
}
//============================================================================
//
// P_LineOpening_3dMidtex
@ -273,12 +287,12 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &
return false;
}
fixed_t tt, tb;
double tt, tb;
open.abovemidtex = false;
if (P_GetMidTexturePosition(linedef, 0, &tt, &tb))
{
if (thing->_f_Z() + (thing->_f_height()/2) < (tt + tb)/2)
if (thing->Center() < (tt + tb)/2)
{
if (tb < open.top)
{
@ -288,18 +302,18 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &
}
else
{
if (tt > open.bottom && (!restrict || thing->_f_Z() >= tt))
if (tt > open.bottom && (!restrict || thing->Z() >= tt))
{
open.bottom = tt;
open.abovemidtex = true;
open.floorpic = linedef->sidedef[0]->GetTexture(side_t::mid);
open.floorterrain = TerrainTypes[open.floorpic];
open.frontfloorplane.SetAtHeight(tt, sector_t::floor);
open.backfloorplane.SetAtHeight(tt, sector_t::floor);
open.frontfloorplane.SetAtHeight(FLOAT2FIXED(tt), sector_t::floor);
open.backfloorplane.SetAtHeight(FLOAT2FIXED(tt), sector_t::floor);
}
// returns true if it touches the midtexture
return (abs(thing->_f_Z() - tt) <= thing->_f_MaxStepHeight());
return (fabs(thing->Z() - tt) <= thing->MaxStepHeight);
}
}
return false;

View file

@ -242,36 +242,36 @@ static bool PIT_FindFloorCeiling(FMultiBlockLinesIterator &mit, FMultiBlockLines
// adjust floor / ceiling heights
if (!(flags & FFCF_NOCEILING))
{
if (open.top < tmf._f_ceilingz())
if (open.top < tmf.ceilingz)
{
tmf.ceilingz = open.top;
if (open.topsec != NULL) tmf.ceilingsector = open.topsec;
if (ffcf_verbose) Printf(" Adjust ceilingz to %f\n", FIXED2FLOAT(open.top));
if (ffcf_verbose) Printf(" Adjust ceilingz to %f\n", open.top);
mit.StopUp();
}
}
if (!(flags & FFCF_NOFLOOR))
{
if (open.bottom > tmf._f_floorz())
if (open.bottom > tmf.floorz)
{
tmf.floorz = FIXED2DBL(open.bottom);
tmf.floorz = open.bottom;
if (open.bottomsec != NULL) tmf.floorsector = open.bottomsec;
tmf.touchmidtex = open.touchmidtex;
tmf.abovemidtex = open.abovemidtex;
if (ffcf_verbose) Printf(" Adjust floorz to %f\n", FIXED2FLOAT(open.bottom));
if (ffcf_verbose) Printf(" Adjust floorz to %f\n", open.bottom);
if (tmf.floorz > tmf.dropoffz + tmf.thing->MaxDropOffHeight) mit.StopDown();
}
else if (open.bottom == tmf._f_floorz())
else if (open.bottom == tmf.floorz)
{
tmf.touchmidtex |= open.touchmidtex;
tmf.abovemidtex |= open.abovemidtex;
}
if (open.lowfloor < tmf._f_dropoffz() && open.lowfloor > FIXED_MIN)
if (open.lowfloor < tmf.dropoffz && open.lowfloor > LINEOPEN_MIN)
{
tmf.dropoffz = FIXED2DBL(open.lowfloor);
if (ffcf_verbose) Printf(" Adjust dropoffz to %f\n", FIXED2FLOAT(open.bottom));
tmf.dropoffz = open.lowfloor;
if (ffcf_verbose) Printf(" Adjust dropoffz to %f\n", open.bottom);
if (tmf.floorz > tmf.dropoffz + tmf.thing->MaxDropOffHeight) mit.StopDown();
}
}
@ -915,9 +915,9 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
// If the floor planes on both sides match we should recalculate open.bottom at the actual position we are checking
// This is to avoid bumpy movement when crossing a linedef with the same slope on both sides.
if (open.frontfloorplane == open.backfloorplane && open.bottom > FIXED_MIN)
if (open.frontfloorplane == open.backfloorplane && open.bottom > LINEOPEN_MIN)
{
open.bottom = open.frontfloorplane.ZatPoint(cres.position.x, cres.position.y);
open.bottom = open.frontfloorplane._f_ZatPointF(cres.position.x, cres.position.y);
}
if (rail &&
@ -929,17 +929,17 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
// from either side. How long until somebody reports this as a bug and I'm
// forced to say, "It's not a bug. It's a feature?" Ugh.
(!(level.flags2 & LEVEL2_RAILINGHACK) ||
open.bottom == tm.thing->Sector->floorplane.ZatPoint(ref.x, ref.y)))
open.bottom == tm.thing->Sector->floorplane._f_ZatPointF(ref.x, ref.y)))
{
open.bottom += 32 * FRACUNIT;
open.bottom += 32;
}
// adjust floor / ceiling heights
if (!(cres.portalflags & FFCF_NOCEILING))
{
if (open.top < tm._f_ceilingz())
if (open.top < tm.ceilingz)
{
tm.ceilingz = FIXED2DBL(open.top);
tm.ceilingz = open.top;
tm.ceilingsector = open.topsec;
tm.ceilingpic = open.ceilingpic;
tm.ceilingline = ld;
@ -949,9 +949,9 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
if (!(cres.portalflags & FFCF_NOFLOOR))
{
if (open.bottom > tm._f_floorz())
if (open.bottom > tm.floorz)
{
tm.floorz = FIXED2DBL(open.bottom);
tm.floorz = open.bottom;
tm.floorsector = open.bottomsec;
tm.floorpic = open.floorpic;
tm.floorterrain = open.floorterrain;
@ -959,15 +959,15 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
tm.abovemidtex = open.abovemidtex;
tm.thing->BlockingLine = ld;
}
else if (open.bottom == tm._f_floorz())
else if (open.bottom == tm.floorz)
{
tm.touchmidtex |= open.touchmidtex;
tm.abovemidtex |= open.abovemidtex;
}
if (open.lowfloor < tm._f_dropoffz())
if (open.lowfloor < tm.dropoffz)
{
tm.dropoffz = FIXED2FLOAT(open.lowfloor);
tm.dropoffz = open.lowfloor;
}
}
@ -1022,15 +1022,16 @@ static bool PIT_CheckPortal(FMultiBlockLinesIterator &mit, FMultiBlockLinesItera
return false;
line_t *lp = cres.line->getPortalDestination();
fixed_t zofs = 0;
fixed_t _zofs = 0;
P_TranslatePortalXY(cres.line, cres.position.x, cres.position.y);
P_TranslatePortalZ(cres.line, zofs);
P_TranslatePortalZ(cres.line, _zofs);
double zofs = FIXED2DBL(_zofs);
// fudge a bit with the portal line so that this gets included in the checks that normally only get run on two-sided lines
sector_t *sec = lp->backsector;
if (lp->backsector == NULL) lp->backsector = lp->frontsector;
tm.thing->_f_AddZ(zofs);
tm.thing->AddZ(zofs);
FBoundingBox pbox(cres.position.x, cres.position.y, tm.thing->_f_radius());
FBlockLinesIterator it(pbox);
@ -1058,9 +1059,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._f_ceilingz())
if (open.top - zofs < tm.ceilingz)
{
tm.ceilingz = FIXED2FLOAT(open.top - zofs);
tm.ceilingz = open.top - zofs;
tm.ceilingpic = open.ceilingpic;
/*
tm.ceilingsector = open.topsec;
@ -1070,9 +1071,9 @@ static bool PIT_CheckPortal(FMultiBlockLinesIterator &mit, FMultiBlockLinesItera
ret = true;
}
if (open.bottom - zofs > tm._f_floorz())
if (open.bottom - zofs > tm.floorz)
{
tm.floorz = FIXED2DBL(open.bottom - zofs);
tm.floorz = open.bottom - zofs;
tm.floorpic = open.floorpic;
tm.floorterrain = open.floorterrain;
/*
@ -1084,10 +1085,10 @@ static bool PIT_CheckPortal(FMultiBlockLinesIterator &mit, FMultiBlockLinesItera
ret = true;
}
if (open.lowfloor - zofs < tm._f_dropoffz())
tm.dropoffz = FIXED2FLOAT(open.lowfloor - zofs);
if (open.lowfloor - zofs < tm.dropoffz)
tm.dropoffz = open.lowfloor - zofs;
}
tm.thing->_f_AddZ(-zofs);
tm.thing->AddZ(-zofs);
lp->backsector = sec;
return ret;
@ -2829,22 +2830,22 @@ void FSlide::SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t
// set openrange, opentop, openbottom
P_LineOpening(open, slidemo, li, it.InterceptPoint(in));
if (open.range < slidemo->_f_height())
if (open.range < slidemo->Height)
goto isblocking; // doesn't fit
if (open.top - slidemo->_f_Z() < slidemo->_f_height())
if (open.top < slidemo->Top())
goto isblocking; // mobj is too high
if (open.bottom - slidemo->_f_Z() > slidemo->MaxStepHeight)
if (open.bottom - slidemo->Z() > slidemo->MaxStepHeight)
{
goto isblocking; // too big a step up
}
else if (slidemo->_f_Z() < open.bottom)
else if (slidemo->Z() < open.bottom)
{ // [RH] Check to make sure there's nothing in the way for the step up
fixed_t savedz = slidemo->_f_Z();
slidemo->_f_SetZ(open.bottom);
double savedz = slidemo->Z();
slidemo->SetZ(open.bottom);
bool good = P_TestMobjZ(slidemo);
slidemo->_f_SetZ(savedz);
slidemo->SetZ(savedz);
if (!good)
{
goto isblocking;
@ -3184,13 +3185,13 @@ bool FSlide::BounceTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_
P_LineOpening(open, slidemo, li, it.InterceptPoint(in)); // set openrange, opentop, openbottom
if (open.range < slidemo->_f_height())
if (open.range < slidemo->Height)
goto bounceblocking; // doesn't fit
if (open.top - slidemo->_f_Z() < slidemo->_f_height())
if (open.top < slidemo->Top())
goto bounceblocking; // mobj is too high
if (open.bottom > slidemo->_f_Z())
if (open.bottom > slidemo->Z())
goto bounceblocking; // mobj is too low
continue; // this line doesn't block movement
@ -3814,15 +3815,15 @@ struct aim_t
dist = FixedMul(attackrange, in->frac);
if (open.bottom != FIXED_MIN)
if (open.bottom != LINEOPEN_MIN)
{
pitch = -(int)R_PointToAngle2(0, shootz, dist, open.bottom);
pitch = -(int)R_PointToAngle2(0, shootz, dist, FLOAT2FIXED(open.bottom));
if (pitch < bottompitch) bottompitch = pitch;
}
if (open.top != FIXED_MAX)
if (open.top != LINEOPEN_MAX)
{
pitch = -(int)R_PointToAngle2(0, shootz, dist, open.top);
pitch = -(int)R_PointToAngle2(0, shootz, dist, FLOAT2FIXED(open.top));
if (pitch > toppitch) toppitch = pitch;
}
@ -3840,11 +3841,11 @@ struct aim_t
sector_t *exitsec = frontflag ? li->backsector : li->frontsector;
lastsector = entersec;
// check portal in backsector when aiming up/downward is possible, the line doesn't have portals on both sides and there's actually a portal in the backsector
if ((planestocheck & aim_up) && toppitch < 0 && open.top != FIXED_MAX && !entersec->PortalBlocksMovement(sector_t::ceiling))
if ((planestocheck & aim_up) && toppitch < 0 && open.top != LINEOPEN_MAX && !entersec->PortalBlocksMovement(sector_t::ceiling))
{
EnterSectorPortal(sector_t::ceiling, in->frac, entersec, toppitch, MIN(0, bottompitch));
}
if ((planestocheck & aim_down) && bottompitch > 0 && open.bottom != FIXED_MIN && !entersec->PortalBlocksMovement(sector_t::floor))
if ((planestocheck & aim_down) && bottompitch > 0 && open.bottom != LINEOPEN_MIN && !entersec->PortalBlocksMovement(sector_t::floor))
{
EnterSectorPortal(sector_t::floor, in->frac, entersec, MAX(0, toppitch), bottompitch);
}
@ -5067,8 +5068,8 @@ bool P_NoWayTraverse(AActor *usething, fixed_t startx, fixed_t starty, fixed_t e
if (ld->flags&(ML_BLOCKING | ML_BLOCKEVERYTHING | ML_BLOCK_PLAYERS)) return true;
P_LineOpening(open, NULL, ld, it.InterceptPoint(in));
if (open.range <= 0 ||
open.bottom > usething->_f_Z() + usething->_f_MaxStepHeight() ||
open.top < usething->_f_Top()) return true;
open.bottom > usething->Z() + usething->MaxStepHeight ||
open.top < usething->Top()) return true;
}
return false;
}
@ -6345,7 +6346,7 @@ void P_CreateSecNodeList(AActor *thing, fixed_t x, fixed_t y)
sector_list = P_AddSecnode(ld->frontsector, thing, sector_list);
// Don't assume all lines are 2-sided, since some Things
// like MT_TFOG are allowed regardless of whether their _f_radius() takes
// like MT_TFOG are allowed regardless of whether their radius takes
// them beyond an impassable linedef.
// killough 3/27/98, 4/4/98:

View file

@ -144,13 +144,12 @@ fixed_t P_InterceptVector (const fdivline_t *v2, const fdivline_t *v1)
//
//==========================================================================
void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, int flags)
void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, const DVector2 &pos, const DVector2 *ref, int flags)
{
if (!(flags & FFCF_ONLY3DFLOORS))
{
sector_t *front, *back;
fixed_t fc = 0, ff = 0, bc = 0, bf = 0;
double fc = 0, ff = 0, bc = 0, bf = 0;
if (linedef->backsector == NULL)
{
@ -164,16 +163,16 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
if (!(flags & FFCF_NOPORTALS) && (linedef->flags & ML_PORTALCONNECT))
{
if (!linedef->frontsector->PortalBlocksMovement(sector_t::ceiling)) fc = FIXED_MAX;
if (!linedef->backsector->PortalBlocksMovement(sector_t::ceiling)) bc = FIXED_MAX;
if (!linedef->frontsector->PortalBlocksMovement(sector_t::floor)) ff = FIXED_MIN;
if (!linedef->backsector->PortalBlocksMovement(sector_t::floor)) bf = FIXED_MIN;
if (!linedef->frontsector->PortalBlocksMovement(sector_t::ceiling)) fc = LINEOPEN_MAX;
if (!linedef->backsector->PortalBlocksMovement(sector_t::ceiling)) bc = LINEOPEN_MAX;
if (!linedef->frontsector->PortalBlocksMovement(sector_t::floor)) ff = LINEOPEN_MIN;
if (!linedef->backsector->PortalBlocksMovement(sector_t::floor)) bf = LINEOPEN_MIN;
}
if (fc == 0) fc = front->ceilingplane.ZatPoint(x, y);
if (bc == 0) bc = back->ceilingplane.ZatPoint(x, y);
if (ff == 0) ff = front->floorplane.ZatPoint(x, y);
if (bf == 0) bf = back->floorplane.ZatPoint(x, y);
if (fc == 0) fc = front->ceilingplane.ZatPoint(pos);
if (bc == 0) bc = back->ceilingplane.ZatPoint(pos);
if (ff == 0) ff = front->floorplane.ZatPoint(pos);
if (bf == 0) bf = back->floorplane.ZatPoint(pos);
/*Printf ("]]]]]] %d %d\n", ff, bf);*/
@ -189,7 +188,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
// that imprecisions in the plane equation mean there is a
// good chance that even if a slope and non-slope look like
// they line up, they won't be perfectly aligned.
if (ff == FIXED_MIN || bf == FIXED_MIN || (refx == FIXED_MIN || abs (ff-bf) > 256))
if (ff == -FLT_MIN || bf == -FLT_MIN || ref == NULL || fabs (ff-bf) > 1./256)
{
usefront = (ff > bf);
}
@ -200,7 +199,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
else if ((back->floorplane.a | front->floorplane.b) == 0)
usefront = false;
else
usefront = !P_PointOnLineSide (refx, refy, linedef);
usefront = !P_PointOnLineSide (*ref, linedef);
}
if (usefront)
@ -209,12 +208,12 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
open.bottomsec = front;
open.floorpic = front->GetTexture(sector_t::floor);
open.floorterrain = front->GetTerrain(sector_t::floor);
if (bf != FIXED_MIN) open.lowfloor = bf;
if (bf != -FLT_MIN) open.lowfloor = bf;
else if (!(flags & FFCF_NODROPOFF))
{
// We must check through the portal for the actual dropoff.
// If there's no lines in the lower sections we'd never get a usable value otherwise.
open.lowfloor = back->NextLowestFloorAt(refx, refy, FLOAT2FIXED(back->SkyBoxes[sector_t::floor]->specialf1)-1);
open.lowfloor = back->NextLowestFloorAt(pos.X, pos.Y, back->SkyBoxes[sector_t::floor]->specialf1-1);
}
}
else
@ -223,12 +222,12 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
open.bottomsec = back;
open.floorpic = back->GetTexture(sector_t::floor);
open.floorterrain = back->GetTerrain(sector_t::floor);
if (ff != FIXED_MIN) open.lowfloor = ff;
if (ff != -FLT_MIN) open.lowfloor = ff;
else if (!(flags & FFCF_NODROPOFF))
{
// We must check through the portal for the actual dropoff.
// If there's no lines in the lower sections we'd never get a usable value otherwise.
open.lowfloor = front->NextLowestFloorAt(refx, refy, FLOAT2FIXED(front->SkyBoxes[sector_t::floor]->specialf1) - 1);
open.lowfloor = front->NextLowestFloorAt(pos.X, pos.Y, front->SkyBoxes[sector_t::floor]->specialf1 - 1);
}
}
open.frontfloorplane = front->floorplane;
@ -238,12 +237,12 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
{ // Dummy stuff to have some sort of opening for the 3D checks to modify
open.topsec = NULL;
open.ceilingpic.SetInvalid();
open.top = FIXED_MAX;
open.top = LINEOPEN_MAX;
open.bottomsec = NULL;
open.floorpic.SetInvalid();
open.floorterrain = -1;
open.bottom = FIXED_MIN;
open.lowfloor = FIXED_MAX;
open.bottom = LINEOPEN_MIN;
open.lowfloor = LINEOPEN_MAX;
open.frontfloorplane.SetAtHeight(FIXED_MIN, sector_t::floor);
open.backfloorplane.SetAtHeight(FIXED_MIN, sector_t::floor);
}
@ -251,7 +250,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
// Check 3D floors
if (actor != NULL)
{
P_LineOpening_XFloors(open, actor, linedef, x, y, refx, refy, !!(flags & FFCF_3DRESTRICT));
P_LineOpening_XFloors(open, actor, linedef, pos.X, pos.Y, !!(flags & FFCF_3DRESTRICT));
}
if (actor != NULL && linedef->frontsector != NULL && linedef->backsector != NULL &&
@ -265,7 +264,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
}
// avoid overflows in the opening.
open.range = (fixed_t)MIN<SQWORD>((SQWORD)open.top - open.bottom, FIXED_MAX);
open.range = clamp(open.top - open.bottom, LINEOPEN_MIN, LINEOPEN_MAX);
}
@ -446,7 +445,7 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
{
if (!spawningmapthing || numgamenodes == 0)
{
sector = P_PointInSector(_f_X(), _f_Y());
sector = P_PointInSector(Pos());
}
else
{

View file

@ -57,6 +57,16 @@ inline int P_PointOnLineSidePrecise (fixed_t x, fixed_t y, const line_t *line)
return DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy) > 0;
}
inline int P_PointOnLineSide(double x, double y, const line_t *line)
{
return P_PointOnLineSide(FLOAT2FIXED(x), FLOAT2FIXED(y), line);
}
inline int P_PointOnLineSide(const DVector2 & p, const line_t *line)
{
return P_PointOnLineSide(FLOAT2FIXED(p.X), FLOAT2FIXED(p.Y), line);
}
inline int P_PointOnLineSidePrecise(double x, double y, const line_t *line)
{
return DMulScale32(FLOAT2FIXED(y) - line->v1->y, line->dx, line->v1->x - FLOAT2FIXED(x), line->dy) > 0;
@ -67,10 +77,6 @@ inline int P_PointOnLineSidePrecise(const DVector2 &pt, const line_t *line)
return DMulScale32(FLOAT2FIXED(pt.Y) - line->v1->y, line->dx, line->v1->x - FLOAT2FIXED(pt.X), line->dy) > 0;
}
inline int P_PointOnLineSidePrecise(const DVector3 &pt, const line_t *line)
{
return DMulScale32(FLOAT2FIXED(pt.Y) - line->v1->y, line->dx, line->v1->x - FLOAT2FIXED(pt.X), line->dy) > 0;
}
//==========================================================================
//
@ -117,10 +123,10 @@ inline void P_MakeDivline (const line_t *li, fdivline_t *dl)
struct FLineOpening
{
fixed_t top;
fixed_t bottom;
fixed_t range;
fixed_t lowfloor;
double top;
double bottom;
double range;
double lowfloor;
sector_t *bottomsec;
sector_t *topsec;
FTextureID ceilingpic;
@ -132,11 +138,20 @@ struct FLineOpening
bool abovemidtex;
};
void P_LineOpening (FLineOpening &open, AActor *thing, const line_t *linedef, fixed_t x, fixed_t y, fixed_t refx=FIXED_MIN, fixed_t refy=0, int flags=0);
static const double LINEOPEN_MIN = -FLT_MAX;
static const double LINEOPEN_MAX = FLT_MAX;
void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, const DVector2 &xy, const DVector2 *ref = NULL, int flags = 0);
inline void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, fixed_t x, fixed_t y, fixed_t refx = FIXED_MIN, fixed_t refy = 0, int flags = 0)
{
P_LineOpening(open, thing, linedef, DVector2(FIXED2DBL(x), FIXED2DBL(y)), &DVector2(FIXED2DBL(refx), FIXED2DBL(refy)), flags);
}
inline void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, fixedvec2 xy, fixed_t refx = FIXED_MIN, fixed_t refy = 0, int flags = 0)
{
P_LineOpening(open, thing, linedef, xy.x, xy.y, refx, refy, flags);
}
void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, const DVector2 &xy, fixed_t refx = FIXED_MIN, const DVector2 *ref = NULL, int flags = 0);
class FBoundingBox;
struct polyblock_t;

View file

@ -131,7 +131,7 @@ protected:
TObjPtr<AActor> m_Source;// Point source if point pusher
DVector2 m_PushVec;
double m_Magnitude; // Vector strength for point pusher
double m_Radius; // Effective _f_radius() for point pusher
double m_Radius; // Effective radius for point pusher
int m_Affectee; // Number of affected sector
friend bool PIT_PushThing (AActor *thing);

View file

@ -199,7 +199,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, fixedvec3 *optpo
}
}
return (user->_f_Top() > open.top);
return (user->Top() > open.top);
}
else if ((TexMan.FindSwitch(side->GetTexture(side_t::bottom))) != NULL)
{
@ -221,7 +221,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, fixedvec3 *optpo
}
}
return (user->_f_Z() < open.bottom);
return (user->Z() < open.bottom);
}
else if ((flags & ML_3DMIDTEX) || (TexMan.FindSwitch(side->GetTexture(side_t::mid))) != NULL)
{
@ -234,7 +234,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, fixedvec3 *optpo
else
{
// no switch found. Check whether the player can touch either top or bottom texture
return (user->_f_Top() > open.top) || (user->_f_Z() < open.bottom);
return (user->Top() > open.top) || (user->Z() < open.bottom);
}
}

View file

@ -427,7 +427,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser)
thing->flags |= MF_SOLID;
thing->Height = info->Height; // [RH] Use real height
thing->radius = info->radius; // [RH] Use real radius
if (!P_CheckPosition (thing, thing->_f_Pos()))
if (!P_CheckPosition (thing, thing->Pos()))
{
thing->flags = oldflags;
thing->radius = oldradius;

View file

@ -102,7 +102,7 @@ static int WriteTHINGS (FILE *file)
mt.x = LittleShort(short(mo->X()));
mt.y = LittleShort(short(mo->Y()));
mt.angle = LittleShort(short(MulScale32 (mo->_f_angle() >> ANGLETOFINESHIFT, 360)));
mt.angle = LittleShort(short(mo->Angles.Yaw.Degrees));
mt.type = LittleShort((short)1);
mt.flags = LittleShort((short)(7|224|MTF_SINGLE));
fwrite (&mt, sizeof(mt), 1, file);

View file

@ -1191,8 +1191,8 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
if ((mobj->flags&MF_SOLID) && !(mobj->flags&MF_NOCLIP))
{
FLineOpening open;
open.top = INT_MAX;
open.bottom = -INT_MAX;
open.top = LINEOPEN_MAX;
open.bottom = LINEOPEN_MIN;
// [TN] Check wether this actor gets blocked by the line.
if (ld->backsector != NULL &&
!(ld->flags & (ML_BLOCKING|ML_BLOCKEVERYTHING))
@ -1201,7 +1201,7 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
&& !((mobj->flags & MF_FLOAT) && (ld->flags & ML_BLOCK_FLOATERS))
&& (!(ld->flags & ML_3DMIDTEX) ||
(!P_LineOpening_3dMidtex(mobj, ld, open) &&
(mobj->_f_Top() < open.top)
(mobj->Top() < open.top)
) || (open.abovemidtex && mobj->Z() > mobj->floorz))
)
{
@ -1233,7 +1233,7 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
// Best use the one facing the player and ignore the back side.
if (ld->sidedef[1] != NULL)
{
int side = P_PointOnLineSidePrecise(mobj->_f_X(), mobj->_f_Y(), ld);
int side = P_PointOnLineSidePrecise(mobj->Pos(), ld);
if (ld->sidedef[side] != sd)
{
continue;

View file

@ -491,7 +491,7 @@ void SDLFB::Update ()
return;
pixels = Surface->pixels;
pitch = Surface->_f_pitch();
pitch = Surface->pitch;
}
if (NotPaletted)

View file

@ -880,6 +880,16 @@ struct sector_t
fixed_t NextHighestCeilingAt(fixed_t x, fixed_t y, fixed_t bottomz, fixed_t topz, int flags = 0, sector_t **resultsec = NULL, F3DFloor **resultffloor = NULL);
fixed_t NextLowestFloorAt(fixed_t x, fixed_t y, fixed_t z, int flags = 0, fixed_t steph = 0, sector_t **resultsec = NULL, F3DFloor **resultffloor = NULL);
inline double NextHighestCeilingAt(double x, double y, double bottomz, double topz, int flags = 0, sector_t **resultsec = NULL, F3DFloor **resultffloor = NULL)
{
return FIXED2DBL(NextHighestCeilingAt(FLOAT2FIXED(x), FLOAT2FIXED(y), FLOAT2FIXED(bottomz), FLOAT2FIXED(topz), flags, resultsec, resultffloor));
}
double NextLowestFloorAt(double x, double y, double z, int flags = 0, double steph = 0, sector_t **resultsec = NULL, F3DFloor **resultffloor = NULL)
{
return FIXED2DBL(NextLowestFloorAt(FLOAT2FIXED(x), FLOAT2FIXED(y), FLOAT2FIXED(z), flags, FLOAT2FIXED(steph), resultsec, resultffloor));
}
// Member variables
fixed_t CenterFloor () const { return floorplane.ZatPoint (centerspot); }
fixed_t CenterCeiling () const { return ceilingplane.ZatPoint (centerspot); }

View file

@ -1106,8 +1106,6 @@ void R_DrawHeightPlanes(fixed_t height)
void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool additive, bool masked)
{
// pl->_f_angle() = pa<<ANGLETOFINESHIFT;
if (pl->left >= pl->right)
return;

View file

@ -173,9 +173,7 @@ void S_NoiseDebug (void)
}
listener.X = FIXED2FLOAT(players[consoleplayer].camera->SoundX());
listener.Y = FIXED2FLOAT(players[consoleplayer].camera->SoundZ());
listener.Z = FIXED2FLOAT(players[consoleplayer].camera->SoundY());
listener = players[consoleplayer].camera->SoundPos();
// Display the oldest channel first.
for (chan = Channels; chan->NextChan != NULL; chan = chan->NextChan)
@ -664,9 +662,10 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
if (players[consoleplayer].camera != NULL)
{
x = players[consoleplayer].camera->SoundX();
y = players[consoleplayer].camera->SoundZ();
z = players[consoleplayer].camera->SoundY();
FVector3 v = players[consoleplayer].camera->SoundPos();
x = FLOAT2FIXED(v.X);
y = FLOAT2FIXED(v.Y);
z = FLOAT2FIXED(v.Z);
}
else
{
@ -693,9 +692,10 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
//assert(actor != NULL);
if (actor != NULL)
{
x = actor->SoundX();
y = actor->SoundZ();
z = actor->SoundY();
FVector3 v = actor->SoundPos();
x = FLOAT2FIXED(v.X);
y = FLOAT2FIXED(v.Y);
z = FLOAT2FIXED(v.Z);
}
break;
@ -764,8 +764,9 @@ static void CalcSectorSoundOrg(const sector_t *sec, int channum, fixed_t *x, fix
// Are we inside the sector? If yes, the closest point is the one we're on.
if (P_PointInSector(*x, *y) == sec)
{
*x = players[consoleplayer].camera->SoundX();
*y = players[consoleplayer].camera->SoundY();
FVector3 p = players[consoleplayer].camera->SoundPos();
*x = FLOAT2FIXED(p.X);
*y = FLOAT2FIXED(p.Y);
}
else
{
@ -1568,9 +1569,10 @@ void S_RelinkSound (AActor *from, AActor *to)
{
chan->Actor = NULL;
chan->SourceType = SOURCE_Unattached;
chan->Point[0] = FIXED2FLOAT(from->SoundX());
chan->Point[1] = FIXED2FLOAT(from->SoundZ());
chan->Point[2] = FIXED2FLOAT(from->SoundY());
FVector3 p = from->SoundPos();
chan->Point[0] = p.X;
chan->Point[1] = p.Y;
chan->Point[2] = p.Z;
}
else
{
@ -1950,16 +1952,14 @@ static void S_SetListener(SoundListener &listener, AActor *listenactor)
{
if (listenactor != NULL)
{
listener.angle = ANGLE2RADF(listenactor->_f_angle());
listener.angle = ToRadians(listenactor->Angles.Yaw);
/*
listener.velocity.X = listenactor->vel.x * (TICRATE/65536.f);
listener.velocity.Y = listenactor->vel.z * (TICRATE/65536.f);
listener.velocity.Z = listenactor->vel.y * (TICRATE/65536.f);
*/
listener.velocity.Zero();
listener.position.X = FIXED2FLOAT(listenactor->SoundX());
listener.position.Y = FIXED2FLOAT(listenactor->SoundZ());
listener.position.Z = FIXED2FLOAT(listenactor->SoundY());
listener.position = listenactor->SoundPos();
listener.underwater = listenactor->waterlevel == 3;
assert(zones != NULL);
listener.Environment = zones[listenactor->Sector->ZoneNumber].Environment;

View file

@ -3297,7 +3297,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst)
// with no relation to the size of the self shattering. I think it should
// base the number of shards on the size of the dead thing, so bigger
// things break up into more shards than smaller things.
// An self with _f_radius() 20 and height 64 creates ~40 chunks.
// An self with radius 20 and height 64 creates ~40 chunks.
numChunks = MAX<int> (4, int(self->radius * self->Height)/32);
i = (pr_burst.Random2()) % (numChunks/4);
for (i = MAX (24, numChunks + i); i >= 0; i--)
@ -3713,7 +3713,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF)
if (!(flags & CLOFF_FROMBASE))
{ // default to hitscan origin
// Synced with hitscan: self->_f_height() is strangely NON-conscientious about getting the right actor for player
// Synced with hitscan: self->Height is strangely NON-conscientious about getting the right actor for player
pos.Z += self->Height *0.5;
if (self->player != NULL)
{