- floatified bmaporgx and bmaporgy, allowing to remove the gross overflow prevention hacks present in the blockmap code.

This commit is contained in:
Christoph Oelckers 2016-03-31 09:23:14 +02:00
parent f41afde545
commit 8fd76f0c8a
16 changed files with 74 additions and 154 deletions

View file

@ -1839,8 +1839,7 @@ void AM_drawGrid (int color)
// Figure out start of vertical gridlines // Figure out start of vertical gridlines
start = minx - extx; start = minx - extx;
double bmorgx = FIXED2DBL(bmaporgx); start = ceil((start - bmaporgx) / MAPBLOCKUNITS) * MAPBLOCKUNITS + bmaporgx;
start = ceil((start - bmorgx) / MAPBLOCKUNITS) * MAPBLOCKUNITS + bmorgx;
end = minx + minlen - extx; end = minx + minlen - extx;
@ -1861,8 +1860,7 @@ void AM_drawGrid (int color)
// Figure out start of horizontal gridlines // Figure out start of horizontal gridlines
start = miny - exty; start = miny - exty;
double bmorgy = FIXED2DBL(bmaporgy); start = ceil((start - bmaporgy) / MAPBLOCKUNITS) * MAPBLOCKUNITS + bmaporgy;
start = ceil((start - bmorgy) / MAPBLOCKUNITS) * MAPBLOCKUNITS + bmorgy;
end = miny + minlen - exty; end = miny + minlen - exty;
// draw horizontal gridlines // draw horizontal gridlines

View file

@ -27,8 +27,18 @@ extern int* blockmaplump; // offsets in blockmap are from here
extern int* blockmap; extern int* blockmap;
extern int bmapwidth; extern int bmapwidth;
extern int bmapheight; // in mapblocks extern int bmapheight; // in mapblocks
extern fixed_t bmaporgx; extern double bmaporgx;
extern fixed_t bmaporgy; // origin of block map extern double bmaporgy; // origin of block map
extern FBlockNode** blocklinks; // for thing chains extern FBlockNode** blocklinks; // for thing chains
inline int GetBlockX(double xpos)
{
return int((xpos - bmaporgx) / MAPBLOCKUNITS);
}
inline int GetBlockY(double ypos)
{
return int((ypos - bmaporgy) / MAPBLOCKUNITS);
}
#endif #endif

View file

@ -44,20 +44,6 @@ struct FCheckPosition
PushTime = 0; PushTime = 0;
FromPMove = false; FromPMove = false;
} }
inline fixed_t _f_X()
{
return FLOAT2FIXED(pos.X);
}
inline fixed_t _f_Y()
{
return FLOAT2FIXED(pos.Y);
}
inline fixed_t _f_Z()
{
return FLOAT2FIXED(pos.Z);
}
}; };

View file

@ -34,7 +34,6 @@ class player_t;
class AActor; class AActor;
struct FPlayerStart; struct FPlayerStart;
class PClassActor; class PClassActor;
struct fixedvec3;
class APlayerPawn; class APlayerPawn;
struct line_t; struct line_t;
struct sector_t; struct sector_t;
@ -61,28 +60,6 @@ struct FTranslatedLineTarget;
extern int bmapnegx; extern int bmapnegx;
extern int bmapnegy; extern int bmapnegy;
inline int GetSafeBlockX(int blockx)
{
blockx >>= MAPBLOCKSHIFT;
return (blockx <= bmapnegx) ? blockx & 0x1FF : blockx;
}
inline int GetSafeBlockX(long long blockx)
{
blockx >>= MAPBLOCKSHIFT;
return int((blockx <= bmapnegx) ? blockx & 0x1FF : blockx);
}
inline int GetSafeBlockY(int blocky)
{
blocky >>= MAPBLOCKSHIFT;
return (blocky <= bmapnegy) ? blocky & 0x1FF: blocky;
}
inline int GetSafeBlockY(long long blocky)
{
blocky >>= MAPBLOCKSHIFT;
return int((blocky <= bmapnegy) ? blocky & 0x1FF: blocky);
}
//#define GRAVITY FRACUNIT //#define GRAVITY FRACUNIT
#define MAXMOVE (30.) #define MAXMOVE (30.)
@ -242,17 +219,11 @@ extern TArray<spechit_t> portalhit;
bool P_TestMobjLocation (AActor *mobj); bool P_TestMobjLocation (AActor *mobj);
bool P_TestMobjZ (AActor *mobj, bool quick=true, AActor **pOnmobj = NULL); bool P_TestMobjZ (AActor *mobj, bool quick=true, AActor **pOnmobj = NULL);
bool P_CheckPosition(AActor *thing, const DVector2 &pos, bool actorsonly = false); bool P_CheckPosition(AActor *thing, const DVector2 &pos, bool actorsonly = false);
inline bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, bool actorsonly = false); bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, bool actorsonly = false);
AActor *P_CheckOnmobj (AActor *thing); AActor *P_CheckOnmobj (AActor *thing);
void P_FakeZMovement (AActor *mo); void P_FakeZMovement (AActor *mo);
bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false); bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false);
bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL); bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL);
/*
inline bool P_TryMove(AActor* thing, double x, double y, int dropoff, const secplane_t * onfloor = NULL)
{
return P_TryMove(thing, FLOAT2FIXED(x), FLOAT2FIXED(y), dropoff, onfloor);
}
*/
bool P_CheckMove(AActor *thing, const DVector2 &pos); bool P_CheckMove(AActor *thing, const DVector2 &pos);
void P_ApplyTorque(AActor *mo); void P_ApplyTorque(AActor *mo);
@ -325,7 +296,6 @@ void P_TraceBleed(int damage, FTranslatedLineTarget *t, AActor *puff); // hitsc
void P_TraceBleed (int damage, AActor *target); // random direction version void P_TraceBleed (int damage, AActor *target); // random direction version
bool P_HitFloor (AActor *thing); bool P_HitFloor (AActor *thing);
bool P_HitWater (AActor *thing, sector_t *sec, const DVector3 &pos, bool checkabove = false, bool alert = true, bool force = false); bool P_HitWater (AActor *thing, sector_t *sec, const DVector3 &pos, bool checkabove = false, bool alert = true, bool force = false);
inline bool P_HitWater(AActor *thing, sector_t *sec, const fixedvec3 &pos, bool checkabove = false, bool alert = true, bool force = false) = delete;
void P_CheckSplash(AActor *self, double distance); void P_CheckSplash(AActor *self, double distance);
struct FRailParams struct FRailParams
@ -389,8 +359,6 @@ bool Check_Sides(AActor *, int, int); // phares
// [RH] // [RH]
const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move); const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move);
inline const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymove) = delete;
// //
// P_SETUP // P_SETUP
// //

View file

@ -2947,7 +2947,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
if (t < 0) if (t < 0)
{ // Desired location is behind (below) the plane { // Desired location is behind (below) the plane
// (i.e. Walking up the plane) // (i.e. Walking up the plane)
if (plane->fixC() < STEEPSLOPE) if (plane->fC() < STEEPSLOPE)
{ // Can't climb up slopes of ~45 degrees or more { // Can't climb up slopes of ~45 degrees or more
if (actor->flags & MF_NOCLIP) if (actor->flags & MF_NOCLIP)
{ {

View file

@ -376,8 +376,8 @@ bool AActor::FixMapthingPos()
{ {
sector_t *secstart = P_PointInSectorBuggy(_f_X(), _f_Y()); sector_t *secstart = P_PointInSectorBuggy(_f_X(), _f_Y());
int blockx = GetSafeBlockX(_f_X() - bmaporgx); int blockx = GetBlockX(X());
int blocky = GetSafeBlockY(_f_Y() - bmaporgy); int blocky = GetBlockY(Y());
bool success = false; bool success = false;
if ((unsigned int)blockx < (unsigned int)bmapwidth && if ((unsigned int)blockx < (unsigned int)bmapwidth &&
@ -519,13 +519,12 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
for (int i = -1; i < (int)check.Size(); i++) for (int i = -1; i < (int)check.Size(); i++)
{ {
DVector3 _pos = i==-1? Pos() : PosRelative(check[i]); DVector3 pos = i==-1? Pos() : PosRelative(check[i]);
fixedvec3 pos = { FLOAT2FIXED(_pos.X), FLOAT2FIXED(_pos.Y),FLOAT2FIXED(_pos.Z) };
int x1 = GetSafeBlockX(pos.x - _f_radius() - bmaporgx); int x1 = GetBlockX(pos.X - radius);
int x2 = GetSafeBlockX(pos.x + _f_radius() - bmaporgx); int x2 = GetBlockX(pos.X + radius);
int y1 = GetSafeBlockY(pos.y - _f_radius() - bmaporgy); int y1 = GetBlockY(pos.Y - radius);
int y2 = GetSafeBlockY(pos.y + _f_radius() - bmaporgy); int y2 = GetBlockY(pos.Y + radius);
if (x1 >= bmapwidth || x2 < 0 || y1 >= bmapheight || y2 < 0) if (x1 >= bmapwidth || x2 < 0 || y1 >= bmapheight || y2 < 0)
{ // thing is off the map { // thing is off the map
@ -639,10 +638,10 @@ FBlockLinesIterator::FBlockLinesIterator(int _minx, int _miny, int _maxx, int _m
void FBlockLinesIterator::init(const FBoundingBox &box) void FBlockLinesIterator::init(const FBoundingBox &box)
{ {
validcount++; validcount++;
maxy = GetSafeBlockY(box.Top() - bmaporgy); maxy = GetBlockY(FIXED2DBL(box.Top()));
miny = GetSafeBlockY(box.Bottom() - bmaporgy); miny = GetBlockY(FIXED2DBL(box.Bottom()));
maxx = GetSafeBlockX(box.Right() - bmaporgx); maxx = GetBlockX(FIXED2DBL(box.Right()));
minx = GetSafeBlockX(box.Left() - bmaporgx); minx = GetBlockX(FIXED2DBL(box.Left()));
Reset(); Reset();
} }
@ -945,10 +944,10 @@ FBlockThingsIterator::FBlockThingsIterator(int _minx, int _miny, int _maxx, int
void FBlockThingsIterator::init(const FBoundingBox &box) void FBlockThingsIterator::init(const FBoundingBox &box)
{ {
maxy = GetSafeBlockY(box.Top() - bmaporgy); maxy = GetBlockY(FIXED2DBL(box.Top()));
miny = GetSafeBlockY(box.Bottom() - bmaporgy); miny = GetBlockY(FIXED2DBL(box.Bottom()));
maxx = GetSafeBlockX(box.Right() - bmaporgx); maxx = GetBlockX(FIXED2DBL(box.Right()));
minx = GetSafeBlockX(box.Left() - bmaporgx); minx = GetBlockX(FIXED2DBL(box.Left()));
ClearHash(); ClearHash();
Reset(); Reset();
} }
@ -1026,9 +1025,9 @@ AActor *FBlockThingsIterator::Next(bool centeronly)
if (centeronly) if (centeronly)
{ {
// Block boundaries for compatibility mode // Block boundaries for compatibility mode
fixed_t blockleft = (curx << MAPBLOCKSHIFT) + bmaporgx; fixed_t blockleft = (curx << MAPBLOCKSHIFT) + FLOAT2FIXED(bmaporgx);
fixed_t blockright = blockleft + MAPBLOCKSIZE; fixed_t blockright = blockleft + MAPBLOCKSIZE;
fixed_t blockbottom = (cury << MAPBLOCKSHIFT) + bmaporgy; fixed_t blockbottom = (cury << MAPBLOCKSHIFT) + FLOAT2FIXED(bmaporgy);
fixed_t blocktop = blockbottom + MAPBLOCKSIZE; fixed_t blocktop = blockbottom + MAPBLOCKSIZE;
// only return actors with the center in this block // only return actors with the center in this block
@ -1517,16 +1516,19 @@ void FPathTraverse::init (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int fl
intercept_index = intercepts.Size(); intercept_index = intercepts.Size();
this->startfrac = startfrac; this->startfrac = startfrac;
if ( ((x1-bmaporgx)&(MAPBLOCKSIZE-1)) == 0) fixed_t _f_bmaporgx = FLOAT2FIXED(bmaporgx);
fixed_t _f_bmaporgy = FLOAT2FIXED(bmaporgy);
if ( ((x1-_f_bmaporgx)&(MAPBLOCKSIZE-1)) == 0)
x1 += FRACUNIT; // don't side exactly on a line x1 += FRACUNIT; // don't side exactly on a line
if ( ((y1-bmaporgy)&(MAPBLOCKSIZE-1)) == 0) if ( ((y1-_f_bmaporgy)&(MAPBLOCKSIZE-1)) == 0)
y1 += FRACUNIT; // don't side exactly on a line y1 += FRACUNIT; // don't side exactly on a line
_x1 = (long long)x1 - bmaporgx; _x1 = (long long)x1 - _f_bmaporgx;
_y1 = (long long)y1 - bmaporgy; _y1 = (long long)y1 - _f_bmaporgy;
x1 -= bmaporgx; x1 -= _f_bmaporgx;
y1 -= bmaporgy; y1 -= _f_bmaporgy;
xt1 = int(_x1 >> MAPBLOCKSHIFT); xt1 = int(_x1 >> MAPBLOCKSHIFT);
yt1 = int(_y1 >> MAPBLOCKSHIFT); yt1 = int(_y1 >> MAPBLOCKSHIFT);
@ -1541,10 +1543,10 @@ void FPathTraverse::init (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int fl
} }
else else
{ {
_x2 = (long long)x2 - bmaporgx; _x2 = (long long)x2 - _f_bmaporgx;
_y2 = (long long)y2 - bmaporgy; _y2 = (long long)y2 - _f_bmaporgy;
x2 -= bmaporgx; x2 -= _f_bmaporgx;
y2 -= bmaporgy; y2 -= _f_bmaporgy;
xt2 = int(_x2 >> MAPBLOCKSHIFT); xt2 = int(_x2 >> MAPBLOCKSHIFT);
yt2 = int(_y2 >> MAPBLOCKSHIFT); yt2 = int(_y2 >> MAPBLOCKSHIFT);
} }
@ -1758,8 +1760,8 @@ AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, in
int count; int count;
AActor *target; AActor *target;
startX = GetSafeBlockX(mo->_f_X()-bmaporgx); startX = GetBlockX(mo->X());
startY = GetSafeBlockY(mo->_f_Y()-bmaporgy); startY = GetBlockY(mo->Y());
validcount++; validcount++;
if (startX >= 0 && startX < bmapwidth && startY >= 0 && startY < bmapheight) if (startX >= 0 && startX < bmapwidth && startY >= 0 && startY < bmapheight)

View file

@ -171,10 +171,8 @@ int bmapheight; // size in mapblocks
int *blockmap; // int for larger maps ([RH] Made int because BOOM does) int *blockmap; // int for larger maps ([RH] Made int because BOOM does)
int *blockmaplump; // offsets in blockmap are from here int *blockmaplump; // offsets in blockmap are from here
fixed_t bmaporgx; // origin of block map double bmaporgx; // origin of block map
fixed_t bmaporgy; double bmaporgy;
int bmapnegx; // min negs of block map before wrapping
int bmapnegy;
FBlockNode** blocklinks; // for thing chains FBlockNode** blocklinks; // for thing chains
@ -3076,15 +3074,10 @@ void P_LoadBlockMap (MapData * map)
} }
bmaporgx = blockmaplump[0] << FRACBITS; bmaporgx = blockmaplump[0];
bmaporgy = blockmaplump[1] << FRACBITS; bmaporgy = blockmaplump[1];
bmapwidth = blockmaplump[2]; bmapwidth = blockmaplump[2];
bmapheight = blockmaplump[3]; bmapheight = blockmaplump[3];
// MAES: set blockmapxneg and blockmapyneg
// E.g. for a full 512x512 map, they should be both
// -1. For a 257*257, they should be both -255 etc.
bmapnegx = bmapwidth > 255 ? bmapwidth - 512 : -257;
bmapnegy = bmapheight > 255 ? bmapheight - 512 : -257;
// clear out mobj chains // clear out mobj chains
count = bmapwidth*bmapheight; count = bmapwidth*bmapheight;

View file

@ -632,9 +632,6 @@ bool SightCheck::P_SightPathTraverse ()
portals.Push({ 0, topslope, bottomslope, sector_t::floor, lastsector->SkyBoxes[sector_t::floor]->Sector->PortalGroup }); portals.Push({ 0, topslope, bottomslope, sector_t::floor, lastsector->SkyBoxes[sector_t::floor]->Sector->PortalGroup });
} }
double bmaporgx = FIXED2DBL(::bmaporgx);
double bmaporgy = FIXED2DBL(::bmaporgy);
x1 -= bmaporgx; x1 -= bmaporgx;
y1 -= bmaporgy; y1 -= bmaporgy;
xt1 = x1 / MAPBLOCKUNITS; xt1 = x1 / MAPBLOCKUNITS;

View file

@ -837,15 +837,6 @@ enum
//Spawns teleport fog. Pass the actor to pluck TeleFogFromType and TeleFogToType. 'from' determines if this is the fog to spawn at the old position (true) or new (false). //Spawns teleport fog. Pass the actor to pluck TeleFogFromType and TeleFogToType. 'from' determines if this is the fog to spawn at the old position (true) or new (false).
void P_SpawnTeleportFog(AActor *mobj, const DVector3 &pos, bool beforeTele = true, bool setTarget = false); void P_SpawnTeleportFog(AActor *mobj, const DVector3 &pos, bool beforeTele = true, bool setTarget = false);
void P_SpawnTeleportFog(AActor *mobj, fixed_t x, fixed_t y, fixed_t z, bool beforeTele = true, bool setTarget = false) = delete;
inline void P_SpawnTeleportFog(AActor *mobj, const fixedvec3 &pos, bool beforeTele = true, bool setTarget = false) = delete;
inline void P_SpawnTeleportFog(AActor *mobj, double x, double y, double z, bool beforeTele = true, bool setTarget = false) = delete;
/*
{
P_SpawnTeleportFog(mobj, FLOAT2FIXED(x), FLOAT2FIXED(y), FLOAT2FIXED(z), beforeTele, setTarget);
}
*/
inline bool P_Teleport(AActor *thing, DVector3 pos, DAngle angle, int flags); inline bool P_Teleport(AActor *thing, DVector3 pos, DAngle angle, int flags);
bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int flags); bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int flags);
bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBOOL reverse); bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBOOL reverse);

View file

@ -165,8 +165,8 @@ void FTraceInfo::EnterSectorPortal(int position, double frac, sector_t *entersec
if (aimdir != -1 && aimdir != position) return; if (aimdir != -1 && aimdir != position) return;
AActor *portal = entersec->SkyBoxes[position]; AActor *portal = entersec->SkyBoxes[position];
if (aimdir == sector_t::ceiling && FLOAT2FIXED(portal->specialf1) < limitz) return; if (aimdir == sector_t::ceiling && portal->specialf1 < limitz) return;
else if (aimdir == sector_t::floor && FLOAT2FIXED(portal->specialf1) > limitz) return; else if (aimdir == sector_t::floor && portal->specialf1 > limitz) return;
FTraceInfo newtrace; FTraceInfo newtrace;
FTraceResults results; FTraceResults results;
@ -785,7 +785,7 @@ bool FTraceInfo::TraceTraverse (int ptflags)
} }
// We have something closer in the storage for portal subtraces. // We have something closer in the storage for portal subtraces.
if (TempResults->HitType != TRACE_HitNone && FIXED2DBL(in->frac) > TempResults->Fraction) if (TempResults->HitType != TRACE_HitNone && in->Frac > TempResults->Fraction)
{ {
break; break;
} }

View file

@ -32,6 +32,7 @@
#include "p_blockmap.h" #include "p_blockmap.h"
#include "p_maputl.h" #include "p_maputl.h"
#include "r_utility.h" #include "r_utility.h"
#include "p_blockmap.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -1095,10 +1096,10 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
ld = sd->linedef; ld = sd->linedef;
top = int((ld->bbox[BOXTOP] - FIXED2DBL(bmaporgy)) / 128.); top = GetBlockY(ld->bbox[BOXTOP]);
bottom = int((ld->bbox[BOXBOTTOM] - FIXED2DBL(bmaporgy)) / 128.); bottom = GetBlockY(ld->bbox[BOXBOTTOM]);
left = int((ld->bbox[BOXLEFT] - FIXED2DBL(bmaporgx)) / 128.); left = GetBlockX(ld->bbox[BOXLEFT]);
right = int((ld->bbox[BOXRIGHT] - FIXED2DBL(bmaporgx)) / 128.); right = GetBlockX(ld->bbox[BOXRIGHT]);
blocked = false; blocked = false;
checker.Clear(); checker.Clear();
@ -1219,10 +1220,10 @@ void FPolyObj::LinkPolyobj ()
vt = Sidedefs[i]->linedef->v2; vt = Sidedefs[i]->linedef->v2;
Bounds.AddToBox(vt->fixX(), vt->fixY()); Bounds.AddToBox(vt->fixX(), vt->fixY());
} }
bbox[BOXRIGHT] = GetSafeBlockX(Bounds.Right() - bmaporgx); bbox[BOXRIGHT] = GetBlockX(FIXED2DBL(Bounds.Right()));
bbox[BOXLEFT] = GetSafeBlockX(Bounds.Left() - bmaporgx); bbox[BOXLEFT] = GetBlockX(FIXED2DBL(Bounds.Left()));
bbox[BOXTOP] = GetSafeBlockY(Bounds.Top() - bmaporgy); bbox[BOXTOP] = GetBlockY(FIXED2DBL(Bounds.Top()));
bbox[BOXBOTTOM] = GetSafeBlockY(Bounds.Bottom() - bmaporgy); bbox[BOXBOTTOM] = GetBlockY(FIXED2DBL(Bounds.Bottom()));
// add the polyobj to each blockmap section // add the polyobj to each blockmap section
for(int j = bbox[BOXBOTTOM]*bmapwidth; j <= bbox[BOXTOP]*bmapwidth; for(int j = bbox[BOXBOTTOM]*bmapwidth; j <= bbox[BOXTOP]*bmapwidth;
j += bmapwidth) j += bmapwidth)

View file

@ -693,8 +693,8 @@ fixedvec2 P_GetOffsetPosition(fixed_t x, fixed_t y, fixed_t dx, fixed_t dy)
// Try some easily discoverable early-out first. If we know that the trace cannot possibly find a portal, this saves us from calling the traverser completely for vast parts of the map. // Try some easily discoverable early-out first. If we know that the trace cannot possibly find a portal, this saves us from calling the traverser completely for vast parts of the map.
if (dx < 128 * FRACUNIT && dy < 128 * FRACUNIT) if (dx < 128 * FRACUNIT && dy < 128 * FRACUNIT)
{ {
fixed_t blockx = GetSafeBlockX(actx - bmaporgx); int blockx = GetBlockX(FIXED2DBL(actx));
fixed_t blocky = GetSafeBlockY(acty - bmaporgy); int blocky = GetBlockY(FIXED2DBL(acty));
if (blockx < 0 || blocky < 0 || blockx >= bmapwidth || blocky >= bmapheight || !PortalBlockmap(blockx, blocky).neighborContainsLines) return dest; if (blockx < 0 || blocky < 0 || blockx >= bmapwidth || blocky >= bmapheight || !PortalBlockmap(blockx, blocky).neighborContainsLines) return dest;
} }
@ -1096,8 +1096,8 @@ void P_CreateLinkedPortals()
{ {
// This is a fatal condition. We have to remove one of the two portals. Choose the one that doesn't match the current plane // This is a fatal condition. We have to remove one of the two portals. Choose the one that doesn't match the current plane
Printf("Error in sector %d: Ceiling portal at z=%d is below floor portal at z=%d\n", i, cz, fz); Printf("Error in sector %d: Ceiling portal at z=%d is below floor portal at z=%d\n", i, cz, fz);
fixed_t cp = -sectors[i].ceilingplane.fixD(); double cp = -sectors[i].ceilingplane.fD();
fixed_t fp = -sectors[i].ceilingplane.fixD(); double fp = -sectors[i].ceilingplane.fD();
if (cp < fp || fz == fp) if (cp < fp || fz == fp)
{ {
sectors[i].SkyBoxes[sector_t::ceiling] = NULL; sectors[i].SkyBoxes[sector_t::ceiling] = NULL;

View file

@ -315,32 +315,6 @@ public:
d = FLOAT2FIXED(dd); d = FLOAT2FIXED(dd);
} }
void changeD(double dd)
{
d += FLOAT2FIXED(dd);
}
fixed_t fixA() const
{
return a;
}
fixed_t fixB() const
{
return b;
}
fixed_t fixC() const
{
return c;
}
fixed_t fixD() const
{
return d;
}
fixed_t fixiC() const
{
return ic;
}
double fA() const double fA() const
{ {
return FIXED2DBL(a); return FIXED2DBL(a);

View file

@ -91,7 +91,7 @@ visplane_t *ceilingplane;
// Empirically verified to be fairly uniform: // Empirically verified to be fairly uniform:
#define visplane_hash(picnum,lightlevel,height) \ #define visplane_hash(picnum,lightlevel,height) \
((unsigned)((picnum)*3+(lightlevel)+((height).fixD())*7) & (MAXVISPLANES-1)) ((unsigned)((picnum)*3+(lightlevel)+(FLOAT2FIXED((height).fD()))*7) & (MAXVISPLANES-1))
// These are copies of the main parameters used when drawing stacked sectors. // These are copies of the main parameters used when drawing stacked sectors.
// When you change the main parameters, you should copy them here too *unless* // When you change the main parameters, you should copy them here too *unless*
@ -605,7 +605,7 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
// always necessary, but it is needed if a floor and ceiling sky are in the // always necessary, but it is needed if a floor and ceiling sky are in the
// same column but separated by a wall. If they both try to reside in the // same column but separated by a wall. If they both try to reside in the
// same visplane, then only the floor sky will be drawn. // same visplane, then only the floor sky will be drawn.
plane.set(0, 0, height.fixC(), 0); plane.set(0., 0., height.fC(), 0.);
isskybox = skybox != NULL && !skybox->bInSkybox; isskybox = skybox != NULL && !skybox->bInSkybox;
} }
else if (skybox != NULL && skybox->bAlways && !skybox->bInSkybox) else if (skybox != NULL && skybox->bAlways && !skybox->bInSkybox)
@ -1564,7 +1564,7 @@ void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
basexfrac = FixedMul (xscale, finecosine[planeang]) + x*xstepscale; basexfrac = FixedMul (xscale, finecosine[planeang]) + x*xstepscale;
baseyfrac = FixedMul (yscale, -finesine[planeang]) + x*ystepscale; baseyfrac = FixedMul (yscale, -finesine[planeang]) + x*ystepscale;
planeheight = abs (FixedMul (pl->height.fixD(), -pl->height.fixiC()) - viewz); planeheight = abs (int(pl->height.fD() * -pl->height.fiC() * 65536) - viewz);
GlobVis = FixedDiv (r_FloorVisibility, planeheight); GlobVis = FixedDiv (r_FloorVisibility, planeheight);
if (fixedlightlev >= 0) if (fixedlightlev >= 0)

View file

@ -162,8 +162,8 @@ enum SICommands
struct FBloodSFX struct FBloodSFX
{ {
DWORD RelVol; // volume, 0-255 DWORD RelVol; // volume, 0-255
fixed_t Pitch; // pitch change int Pitch; // pitch change
fixed_t PitchRange; // range of random pitch int PitchRange; // range of random pitch
DWORD Format; // format of audio 1=11025 5=22050 DWORD Format; // format of audio 1=11025 5=22050
SDWORD LoopStart; // loop position (-1 means no looping) SDWORD LoopStart; // loop position (-1 means no looping)
char RawName[9]; // name of RAW resource char RawName[9]; // name of RAW resource

View file

@ -540,7 +540,7 @@ void S_ParseSndSeq (int levellump)
int delaybase; int delaybase;
float volumebase; float volumebase;
int curseq = -1; int curseq = -1;
fixed_t val; int val;
// First free the old SNDSEQ data. This allows us to reload this for each level // First free the old SNDSEQ data. This allows us to reload this for each level
// and specify a level specific SNDSEQ lump! // and specify a level specific SNDSEQ lump!