- floatification of p_enemy and p_interaction.cpp.

This commit is contained in:
Christoph Oelckers 2016-03-26 20:59:35 +01:00
parent 0c39bdd04c
commit 00ea8662b8
7 changed files with 143 additions and 156 deletions

View file

@ -145,8 +145,8 @@ static bool P_LoadBloodMap (BYTE *data, size_t len, FMapThing **sprites, int *nu
static void LoadSectors (sectortype *bsectors); static void LoadSectors (sectortype *bsectors);
static void LoadWalls (walltype *walls, int numwalls, sectortype *bsectors); static void LoadWalls (walltype *walls, int numwalls, sectortype *bsectors);
static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites, sectortype *bsectors, FMapThing *mapthings); static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites, sectortype *bsectors, FMapThing *mapthings);
static vertex_t *FindVertex (fixed_t x, fixed_t y); static vertex_t *FindVertex (SDWORD x, SDWORD y);
static void CreateStartSpot (fixed_t *pos, FMapThing *start); static void CreateStartSpot (SDWORD *pos, FMapThing *start);
static void CalcPlane (SlopeWork &slope, secplane_t &plane); static void CalcPlane (SlopeWork &slope, secplane_t &plane);
static void Decrypt (void *to, const void *from, int len, int key); static void Decrypt (void *to, const void *from, int len, int key);
@ -232,7 +232,7 @@ bool P_LoadBuildMap (BYTE *data, size_t len, FMapThing **sprites, int *numspr)
numsprites = *(WORD *)(data + 24 + numsectors*sizeof(sectortype) + numwalls*sizeof(walltype)); numsprites = *(WORD *)(data + 24 + numsectors*sizeof(sectortype) + numwalls*sizeof(walltype));
*sprites = new FMapThing[numsprites + 1]; *sprites = new FMapThing[numsprites + 1];
CreateStartSpot ((fixed_t *)(data + 4), *sprites); CreateStartSpot ((SDWORD *)(data + 4), *sprites);
*numspr = 1 + LoadSprites ((spritetype *)(data + 26 + numsectors*sizeof(sectortype) + numwalls*sizeof(walltype)), *numspr = 1 + LoadSprites ((spritetype *)(data + 26 + numsectors*sizeof(sectortype) + numwalls*sizeof(walltype)),
NULL, numsprites, (sectortype *)(data + 22), *sprites + 1); NULL, numsprites, (sectortype *)(data + 22), *sprites + 1);
@ -755,7 +755,7 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites,
// //
//========================================================================== //==========================================================================
vertex_t *FindVertex (fixed_t x, fixed_t y) vertex_t *FindVertex (SDWORD x, SDWORD y)
{ {
int i; int i;
@ -781,7 +781,7 @@ vertex_t *FindVertex (fixed_t x, fixed_t y)
// //
//========================================================================== //==========================================================================
static void CreateStartSpot (fixed_t *pos, FMapThing *start) static void CreateStartSpot (SDWORD *pos, FMapThing *start)
{ {
short angle = LittleShort(*(WORD *)(&pos[3])); short angle = LittleShort(*(WORD *)(&pos[3]));
FMapThing mt = { 0, }; FMapThing mt = { 0, };

View file

@ -124,7 +124,7 @@ void P_RandomChaseDir (AActor *actor);
// sound blocking lines cut off traversal. // sound blocking lines cut off traversal.
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks, AActor *emitter, fixed_t maxdist) void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks, AActor *emitter, double maxdist)
{ {
int i; int i;
line_t* check; line_t* check;
@ -146,7 +146,7 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
for (actor = sec->thinglist; actor != NULL; actor = actor->snext) for (actor = sec->thinglist; actor != NULL; actor = actor->snext)
{ {
if (actor != soundtarget && (!splash || !(actor->flags4 & MF4_NOSPLASHALERT)) && if (actor != soundtarget && (!splash || !(actor->flags4 & MF4_NOSPLASHALERT)) &&
(!maxdist || (actor->AproxDistance(emitter) <= maxdist))) (!maxdist || (actor->Distance2D(emitter) <= maxdist)))
{ {
actor->LastHeard = soundtarget; actor->LastHeard = soundtarget;
} }
@ -162,18 +162,12 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
// I wish there was a better method to do this than randomly looking through the portal at a few places... // I wish there was a better method to do this than randomly looking through the portal at a few places...
if (checkabove) if (checkabove)
{ {
sector_t *upper = sector_t *upper = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->SkyBoxes[sector_t::ceiling]->Scale);
P_PointInSector(check->v1->x + check->dx / 2 + FLOAT2FIXED(sec->SkyBoxes[sector_t::ceiling]->Scale.X),
check->v1->y + check->dy / 2 + FLOAT2FIXED(sec->SkyBoxes[sector_t::ceiling]->Scale.Y));
P_RecursiveSound(upper, soundtarget, splash, soundblocks, emitter, maxdist); P_RecursiveSound(upper, soundtarget, splash, soundblocks, emitter, maxdist);
} }
if (checkbelow) if (checkbelow)
{ {
sector_t *lower = sector_t *lower = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->SkyBoxes[sector_t::floor]->Scale);
P_PointInSector(check->v1->x + check->dx / 2 + FLOAT2FIXED(sec->SkyBoxes[sector_t::ceiling]->Scale.X),
check->v1->y + check->dy / 2 + FLOAT2FIXED(sec->SkyBoxes[sector_t::ceiling]->Scale.Y));
P_RecursiveSound(lower, soundtarget, splash, soundblocks, emitter, maxdist); P_RecursiveSound(lower, soundtarget, splash, soundblocks, emitter, maxdist);
} }
FLinePortal *port = check->getPortal(); FLinePortal *port = check->getPortal();
@ -201,18 +195,18 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
other = check->sidedef[0]->sector; other = check->sidedef[0]->sector;
// check for closed door // check for closed door
if ((sec->floorplane.ZatPoint (check->v1->x, check->v1->y) >= if ((sec->floorplane.ZatPoint (check->v1->fPos()) >=
other->ceilingplane.ZatPoint (check->v1->x, check->v1->y) && other->ceilingplane.ZatPoint (check->v1->fPos()) &&
sec->floorplane.ZatPoint (check->v2->x, check->v2->y) >= sec->floorplane.ZatPoint (check->v2->fPos()) >=
other->ceilingplane.ZatPoint (check->v2->x, check->v2->y)) other->ceilingplane.ZatPoint (check->v2->fPos()))
|| (other->floorplane.ZatPoint (check->v1->x, check->v1->y) >= || (other->floorplane.ZatPoint (check->v1->fPos()) >=
sec->ceilingplane.ZatPoint (check->v1->x, check->v1->y) && sec->ceilingplane.ZatPoint (check->v1->fPos()) &&
other->floorplane.ZatPoint (check->v2->x, check->v2->y) >= other->floorplane.ZatPoint (check->v2->fPos()) >=
sec->ceilingplane.ZatPoint (check->v2->x, check->v2->y)) sec->ceilingplane.ZatPoint (check->v2->fPos()))
|| (other->floorplane.ZatPoint (check->v1->x, check->v1->y) >= || (other->floorplane.ZatPoint (check->v1->fPos()) >=
other->ceilingplane.ZatPoint (check->v1->x, check->v1->y) && other->ceilingplane.ZatPoint (check->v1->fPos()) &&
other->floorplane.ZatPoint (check->v2->x, check->v2->y) >= other->floorplane.ZatPoint (check->v2->fPos()) >=
other->ceilingplane.ZatPoint (check->v2->x, check->v2->y))) other->ceilingplane.ZatPoint (check->v2->fPos())))
{ {
continue; continue;
} }
@ -240,7 +234,7 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void P_NoiseAlert (AActor *target, AActor *emitter, bool splash, fixed_t maxdist) void P_NoiseAlert (AActor *target, AActor *emitter, bool splash, double maxdist)
{ {
if (emitter == NULL) if (emitter == NULL)
return; return;
@ -452,9 +446,9 @@ bool P_HitFriend(AActor * self)
bool P_Move (AActor *actor) bool P_Move (AActor *actor)
{ {
fixed_t tryx, tryy, deltax, deltay, origx, origy; double tryx, tryy, deltax, deltay, origx, origy;
bool try_ok; bool try_ok;
fixed_t speed = actor->_f_speed(); double speed = actor->Speed;
double movefactor = ORIG_FRICTION_FACTOR; double movefactor = ORIG_FRICTION_FACTOR;
double friction = ORIG_FRICTION; double friction = ORIG_FRICTION;
int dropoff = 0; int dropoff = 0;
@ -489,7 +483,7 @@ bool P_Move (AActor *actor)
if ((actor->flags6 & MF6_JUMPDOWN) && target && if ((actor->flags6 & MF6_JUMPDOWN) && target &&
!(target->IsFriend(actor)) && !(target->IsFriend(actor)) &&
actor->AproxDistance(target) < FRACUNIT*144 && actor->Distance2D(target) < 144 &&
pr_dropoff() < 235) pr_dropoff() < 235)
{ {
dropoff = 2; dropoff = 2;
@ -504,39 +498,39 @@ bool P_Move (AActor *actor)
if (friction < ORIG_FRICTION) if (friction < ORIG_FRICTION)
{ // sludge { // sludge
speed = fixed_t(speed * ((ORIG_FRICTION_FACTOR - (ORIG_FRICTION_FACTOR-movefactor)/2)) / ORIG_FRICTION_FACTOR); speed = speed * ((ORIG_FRICTION_FACTOR - (ORIG_FRICTION_FACTOR-movefactor)/2)) / ORIG_FRICTION_FACTOR;
if (speed == 0) if (speed == 0)
{ // always give the monster a little bit of speed { // always give the monster a little bit of speed
speed = ksgn(actor->_f_speed()); speed = actor->Speed;
} }
} }
} }
tryx = (origx = actor->_f_X()) + (deltax = fixed_t (speed * xspeed[actor->movedir])); tryx = (origx = actor->X()) + (deltax = (speed * xspeed[actor->movedir]));
tryy = (origy = actor->_f_Y()) + (deltay = fixed_t (speed * yspeed[actor->movedir])); tryy = (origy = actor->Y()) + (deltay = (speed * yspeed[actor->movedir]));
// Like P_XYMovement this should do multiple moves if the step size is too large // Like P_XYMovement this should do multiple moves if the step size is too large
fixed_t maxmove = actor->_f_radius() - FRACUNIT; double maxmove = actor->radius - 1;
int steps = 1; int steps = 1;
if (maxmove > 0) if (maxmove > 0)
{ {
const fixed_t xspeed = abs (deltax); const double xspeed = fabs (deltax);
const fixed_t yspeed = abs (deltay); const double yspeed = fabs (deltay);
if (xspeed > yspeed) if (xspeed > yspeed)
{ {
if (xspeed > maxmove) if (xspeed > maxmove)
{ {
steps = 1 + xspeed / maxmove; steps = 1 + int(xspeed / maxmove);
} }
} }
else else
{ {
if (yspeed > maxmove) if (yspeed > maxmove)
{ {
steps = 1 + yspeed / maxmove; steps = 1 + int(yspeed / maxmove);
} }
} }
} }
@ -547,12 +541,12 @@ bool P_Move (AActor *actor)
try_ok = true; try_ok = true;
for(int i=1; i < steps; i++) for(int i=1; i < steps; i++)
{ {
try_ok = P_TryMove(actor, origx + Scale(deltax, i, steps), origy + Scale(deltay, i, steps), dropoff, NULL, tm); try_ok = P_TryMove(actor, DVector2(origx + deltax * i / steps, origy + deltay * i / steps), dropoff, NULL, tm);
if (!try_ok) break; if (!try_ok) break;
} }
// killough 3/15/98: don't jump over dropoffs: // killough 3/15/98: don't jump over dropoffs:
if (try_ok) try_ok = P_TryMove (actor, tryx, tryy, dropoff, NULL, tm); if (try_ok) try_ok = P_TryMove (actor, DVector2(tryx, tryy), dropoff, NULL, tm);
// [GrafZahl] Interpolating monster movement as it is done here just looks bad // [GrafZahl] Interpolating monster movement as it is done here just looks bad
// so make it switchable // so make it switchable
@ -563,10 +557,10 @@ bool P_Move (AActor *actor)
if (try_ok && friction > ORIG_FRICTION) if (try_ok && friction > ORIG_FRICTION)
{ {
actor->SetOrigin(origx, origy, actor->_f_Z(), false); actor->SetOrigin(origx, origy, actor->Z(), false);
movefactor *= 1.f / ORIG_FRICTION_FACTOR / 4; movefactor *= 1.f / ORIG_FRICTION_FACTOR / 4;
actor->Vel.X += FIXED2DBL(deltax * movefactor); actor->Vel.X += deltax * movefactor;
actor->Vel.Y += FIXED2DBL(deltay * movefactor); actor->Vel.Y += deltay * movefactor;
} }
// [RH] If a walking monster is no longer on the floor, move it down // [RH] If a walking monster is no longer on the floor, move it down
@ -589,7 +583,7 @@ bool P_Move (AActor *actor)
else else
{ // The monster just hit the floor, so trigger any actions. { // The monster just hit the floor, so trigger any actions.
if (actor->floorsector->SecActTarget != NULL && if (actor->floorsector->SecActTarget != NULL &&
actor->_f_floorz() == actor->floorsector->floorplane.ZatPoint(actor->_f_PosRelative(actor->floorsector))) actor->floorz == actor->floorsector->floorplane.ZatPoint(actor->PosRelative(actor->floorsector)))
{ {
actor->floorsector->SecActTarget->TriggerAction(actor, SECSPAC_HitFloor); actor->floorsector->SecActTarget->TriggerAction(actor, SECSPAC_HitFloor);
} }
@ -704,7 +698,7 @@ bool P_TryWalk (AActor *actor)
// //
//============================================================================= //=============================================================================
void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay) void P_DoNewChaseDir (AActor *actor, double deltax, double deltay)
{ {
dirtype_t d[2]; dirtype_t d[2];
int tdir; int tdir;
@ -715,19 +709,19 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
olddir = (dirtype_t)actor->movedir; olddir = (dirtype_t)actor->movedir;
turnaround = opposite[olddir]; turnaround = opposite[olddir];
if (deltax>10*FRACUNIT) if (deltax > 10)
d[0]= DI_EAST; d[0] = DI_EAST;
else if (deltax<-10*FRACUNIT) else if (deltax < -10)
d[0]= DI_WEST; d[0] = DI_WEST;
else else
d[0]=DI_NODIR; d[0] = DI_NODIR;
if (deltay<-10*FRACUNIT) if (deltay < -10)
d[1]= DI_SOUTH; d[1] = DI_SOUTH;
else if (deltay>10*FRACUNIT) else if (deltay>10)
d[1]= DI_NORTH; d[1] = DI_NORTH;
else else
d[1]=DI_NODIR; d[1] = DI_NODIR;
// try direct route // try direct route
if (d[0] != DI_NODIR && d[1] != DI_NODIR) if (d[0] != DI_NODIR && d[1] != DI_NODIR)
@ -744,7 +738,7 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
// try other directions // try other directions
if (!(actor->flags5 & MF5_AVOIDINGDROPOFF)) if (!(actor->flags5 & MF5_AVOIDINGDROPOFF))
{ {
if ((pr_newchasedir() > 200 || abs(deltay) > abs(deltax))) if ((pr_newchasedir() > 200 || fabs(deltay) > fabs(deltax)))
{ {
swapvalues (d[0], d[1]); swapvalues (d[0], d[1]);
} }
@ -848,25 +842,24 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
void P_NewChaseDir(AActor * actor) void P_NewChaseDir(AActor * actor)
{ {
fixedvec2 delta; DVector2 delta;
actor->strafecount = 0; actor->strafecount = 0;
if ((actor->flags5&MF5_CHASEGOAL || actor->goal == actor->target) && actor->goal!=NULL) if ((actor->flags5&MF5_CHASEGOAL || actor->goal == actor->target) && actor->goal!=NULL)
{ {
delta = actor->_f_Vec2To(actor->goal); delta = actor->Vec2To(actor->goal);
} }
else if (actor->target != NULL) else if (actor->target != NULL)
{ {
delta = actor->_f_Vec2To(actor->target); delta = actor->Vec2To(actor->target);
if (!(actor->flags6 & MF6_NOFEAR)) if (!(actor->flags6 & MF6_NOFEAR))
{ {
if ((actor->target->player != NULL && (actor->target->player->cheats & CF_FRIGHTENING)) || if ((actor->target->player != NULL && (actor->target->player->cheats & CF_FRIGHTENING)) ||
(actor->flags4 & MF4_FRIGHTENED)) (actor->flags4 & MF4_FRIGHTENED))
{ {
delta.x = -delta.x; delta = -delta;
delta.y = -delta.y;
} }
} }
} }
@ -884,7 +877,7 @@ void P_NewChaseDir(AActor * actor)
!(actor->flags2 & MF2_ONMOBJ) && !(actor->flags2 & MF2_ONMOBJ) &&
!(actor->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF)) !(actor->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF))
{ {
FBoundingBox box(actor->_f_X(), actor->_f_Y(), actor->_f_radius()); FBoundingBox box(actor->X(), actor->Y(), actor->radius);
FBlockLinesIterator it(box); FBlockLinesIterator it(box);
line_t *line; line_t *line;
@ -899,8 +892,8 @@ void P_NewChaseDir(AActor * actor)
box.Bottom() < line->bbox[BOXTOP] && box.Bottom() < line->bbox[BOXTOP] &&
box.BoxOnLineSide(line) == -1) box.BoxOnLineSide(line) == -1)
{ {
double front = line->frontsector->floorplane.ZatPointF(actor->_f_PosRelative(line)); double front = line->frontsector->floorplane.ZatPoint(actor->PosRelative(line));
double back = line->backsector->floorplane.ZatPointF(actor->_f_PosRelative(line)); double back = line->backsector->floorplane.ZatPoint(actor->PosRelative(line));
DAngle angle; DAngle angle;
// The monster must contact one of the two floors, // The monster must contact one of the two floors,
@ -933,7 +926,7 @@ void P_NewChaseDir(AActor * actor)
// use different dropoff movement logic in P_TryMove // use different dropoff movement logic in P_TryMove
actor->flags5|=MF5_AVOIDINGDROPOFF; actor->flags5|=MF5_AVOIDINGDROPOFF;
P_DoNewChaseDir(actor, FLOAT2FIXED(deltax), FLOAT2FIXED(deltay)); P_DoNewChaseDir(actor, deltax, deltay);
actor->flags5&=~MF5_AVOIDINGDROPOFF; actor->flags5&=~MF5_AVOIDINGDROPOFF;
// If moving away from dropoff, set movecount to 1 so that // If moving away from dropoff, set movecount to 1 so that
@ -950,7 +943,7 @@ void P_NewChaseDir(AActor * actor)
// MBF code for friends. Cannot be done in ZDoom but left here as a reminder for later implementation. // MBF code for friends. Cannot be done in ZDoom but left here as a reminder for later implementation.
if (actor->flags & target->flags & MF_FRIEND && if (actor->flags & target->flags & MF_FRIEND &&
distfriend << FRACBITS > dist && distfriend > dist &&
!P_IsOnLift(target) && !P_IsUnderDamage(actor)) !P_IsOnLift(target) && !P_IsUnderDamage(actor))
deltax = -deltax, deltay = -deltay; deltax = -deltax, deltay = -deltay;
else else
@ -979,12 +972,12 @@ void P_NewChaseDir(AActor * actor)
if (ismeleeattacker) if (ismeleeattacker)
{ {
actor->strafecount = pr_enemystrafe() & 15; actor->strafecount = pr_enemystrafe() & 15;
delta.x = -delta.x, delta.y = -delta.y; delta = -delta;
} }
} }
} }
P_DoNewChaseDir(actor, delta.x, delta.y); P_DoNewChaseDir(actor, delta.X, delta.Y);
// If strafing, set movecount to strafecount so that old Doom // If strafing, set movecount to strafecount so that old Doom
// logic still works the same, except in the strafing part // logic still works the same, except in the strafing part
@ -1016,7 +1009,7 @@ void P_RandomChaseDir (AActor *actor)
if (actor->flags & MF_FRIENDLY) if (actor->flags & MF_FRIENDLY)
{ {
AActor *player; AActor *player;
fixedvec2 delta; DVector2 delta;
dirtype_t d[3]; dirtype_t d[3];
if (actor->FriendPlayer != 0) if (actor->FriendPlayer != 0)
@ -1038,18 +1031,18 @@ void P_RandomChaseDir (AActor *actor)
{ {
if (pr_newchasedir() & 1 || !P_CheckSight (actor, player)) if (pr_newchasedir() & 1 || !P_CheckSight (actor, player))
{ {
delta = actor->_f_Vec2To(player); delta = actor->Vec2To(player);
if (delta.x>128*FRACUNIT) if (delta.X>128)
d[1]= DI_EAST; d[1]= DI_EAST;
else if (delta.x<-128*FRACUNIT) else if (delta.X<-128)
d[1]= DI_WEST; d[1]= DI_WEST;
else else
d[1]=DI_NODIR; d[1]=DI_NODIR;
if (delta.y<-128*FRACUNIT) if (delta.Y<-128)
d[2]= DI_SOUTH; d[2]= DI_SOUTH;
else if (delta.y>128*FRACUNIT) else if (delta.Y>128)
d[2]= DI_NORTH; d[2]= DI_NORTH;
else else
d[2]=DI_NODIR; d[2]=DI_NODIR;
@ -1057,13 +1050,13 @@ void P_RandomChaseDir (AActor *actor)
// try direct route // try direct route
if (d[1] != DI_NODIR && d[2] != DI_NODIR) if (d[1] != DI_NODIR && d[2] != DI_NODIR)
{ {
actor->movedir = diags[((delta.y<0)<<1) + (delta.x>0)]; actor->movedir = diags[((delta.Y<0)<<1) + (delta.X>0)];
if (actor->movedir != turnaround && P_TryWalk(actor)) if (actor->movedir != turnaround && P_TryWalk(actor))
return; return;
} }
// try other directions // try other directions
if (pr_newchasedir() > 200 || abs(delta.y) > abs(delta.x)) if (pr_newchasedir() > 200 || fabs(delta.Y) > fabs(delta.X))
{ {
swapvalues (d[1], d[2]); swapvalues (d[1], d[2]);
} }
@ -1213,7 +1206,7 @@ bool P_IsVisible(AActor *lookee, AActor *other, INTBOOL allaround, FLookExParams
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#define MONS_LOOK_RANGE (20*64*FRACUNIT) #define MONS_LOOK_RANGE (20*64)
#define MONS_LOOK_LIMIT 64 #define MONS_LOOK_LIMIT 64
bool P_LookForMonsters (AActor *actor) bool P_LookForMonsters (AActor *actor)
@ -1233,7 +1226,7 @@ bool P_LookForMonsters (AActor *actor)
{ // Not a valid monster { // Not a valid monster
continue; continue;
} }
if (mo->AproxDistance (actor) > MONS_LOOK_RANGE) if (mo->Distance2D (actor) > MONS_LOOK_RANGE)
{ // Out of range { // Out of range
continue; continue;
} }
@ -1733,8 +1726,7 @@ bool P_LookForPlayers (AActor *actor, INTBOOL allaround, FLookExParams *params)
if ((player->mo->flags & MF_SHADOW && !(i_compatflags & COMPATF_INVISIBILITY)) || if ((player->mo->flags & MF_SHADOW && !(i_compatflags & COMPATF_INVISIBILITY)) ||
player->mo->flags3 & MF3_GHOST) player->mo->flags3 & MF3_GHOST)
{ {
if ((player->mo->AproxDistance (actor) > (128 << FRACBITS)) if (player->mo->Distance2D (actor) > 128 && player->mo->Vel.XY().LengthSquared() < 5*5)
&& P_AproxDistance (player->mo->_f_velx(), player->mo->_f_vely()) < 5*FRACUNIT)
{ // Player is sneaking - can't detect { // Player is sneaking - can't detect
continue; continue;
} }
@ -1895,7 +1887,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LookEx)
PARAM_STATE_OPT (seestate) { seestate = NULL; } PARAM_STATE_OPT (seestate) { seestate = NULL; }
AActor *targ = NULL; // Shuts up gcc AActor *targ = NULL; // Shuts up gcc
fixed_t dist; double dist;
if (fov == 0) fov = 180.; if (fov == 0) fov = 180.;
FLookExParams params = { fov, minseedist, maxseedist, maxheardist, flags, seestate }; FLookExParams params = { fov, minseedist, maxseedist, maxheardist, flags, seestate };
@ -1936,7 +1928,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LookEx)
} }
else else
{ {
dist = self->AproxDistance (targ); dist = self->Distance2D (targ);
// [KS] If the target is too far away, don't respond to the sound. // [KS] If the target is too far away, don't respond to the sound.
if (maxheardist && dist > maxheardist) if (maxheardist && dist > maxheardist)
@ -2225,7 +2217,7 @@ nosee:
// enhancements. // enhancements.
// //
//============================================================================= //=============================================================================
#define CLASS_BOSS_STRAFE_RANGE 64*10*FRACUNIT #define CLASS_BOSS_STRAFE_RANGE 64*10
void A_DoChase (VMFrameStack *stack, AActor *actor, bool fastchase, FState *meleestate, FState *missilestate, bool playactive, bool nightmarefast, bool dontmove, int flags) void A_DoChase (VMFrameStack *stack, AActor *actor, bool fastchase, FState *meleestate, FState *missilestate, bool playactive, bool nightmarefast, bool dontmove, int flags)
{ {
@ -2598,14 +2590,14 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
if (self->movedir != DI_NODIR) if (self->movedir != DI_NODIR)
{ {
const fixed_t absSpeed = abs (self->_f_speed()); const double absSpeed = fabs (self->Speed);
fixedvec2 viletry = self->Vec2Offset( DVector2 viletry = self->Vec2Offset(
int (absSpeed * xspeed[self->movedir]), absSpeed * xspeed[self->movedir],
int (absSpeed * yspeed[self->movedir]), true); absSpeed * yspeed[self->movedir], true);
FPortalGroupArray check(FPortalGroupArray::PGA_Full3d); FPortalGroupArray check(FPortalGroupArray::PGA_Full3d);
FMultiBlockThingsIterator it(check, viletry.x, viletry.y, self->_f_Z() - 64* FRACUNIT, self->_f_Top() + 64 * FRACUNIT, 32 * FRACUNIT, false, NULL); FMultiBlockThingsIterator it(check, viletry.X, viletry.Y, self->Z() - 64, self->Top() + 64, 32., false, NULL);
FMultiBlockThingsIterator::CheckResult cres; FMultiBlockThingsIterator::CheckResult cres;
while (it.Next(&cres)) while (it.Next(&cres))
{ {
@ -2614,10 +2606,10 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
if (raisestate != NULL) if (raisestate != NULL)
{ {
// use the current actor's _f_radius() instead of the Arch Vile's default. // use the current actor's _f_radius() instead of the Arch Vile's default.
fixed_t maxdist = corpsehit->GetDefault()->_f_radius() + self->_f_radius(); double maxdist = corpsehit->GetDefault()->radius + self->radius;
if (abs(corpsehit->_f_Pos().x - cres.position.x) > maxdist || if (fabs(corpsehit->X() - cres.Position.X) > maxdist ||
abs(corpsehit->_f_Pos().y - cres.position.y) > maxdist) fabs(corpsehit->Y() - cres.Position.Y) > maxdist)
continue; // not actually touching continue; // not actually touching
// Let's check if there are floors in between the archvile and its target // Let's check if there are floors in between the archvile and its target
@ -2868,7 +2860,7 @@ void A_Face(AActor *self, AActor *other, DAngle max_turn, DAngle max_pitch, DAng
target_z = other->Center(); target_z = other->Center();
} }
//Note there is no +32*FRACUNIT on purpose. This is for customization sake. //Note there is no +32 on purpose. This is for customization sake.
//If one doesn't want this behavior, just don't use FAF_BOTTOM. //If one doesn't want this behavior, just don't use FAF_BOTTOM.
if (flags & FAF_BOTTOM) if (flags & FAF_BOTTOM)
target_z = other->Z() + other->GetBobOffset(); target_z = other->Z() + other->GetBobOffset();
@ -3169,7 +3161,7 @@ AInventory *P_DropItem (AActor *source, PClassActor *type, int dropamount, int c
} }
if (style == 2) if (style == 2)
{ {
spawnz = 24*FRACUNIT; spawnz = 24;
} }
else else
{ {
@ -3399,13 +3391,13 @@ void A_BossDeath(AActor *self)
{ {
if (type == NAME_Fatso) if (type == NAME_Fatso)
{ {
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, FRACUNIT, 0, -1, 0, false); EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, 1., 0, -1, 0, false);
return; return;
} }
if (type == NAME_Arachnotron) if (type == NAME_Arachnotron)
{ {
EV_DoFloor (DFloor::floorRaiseByTexture, NULL, 667, FRACUNIT, 0, -1, 0, false); EV_DoFloor (DFloor::floorRaiseByTexture, NULL, 667, 1., 0, -1, 0, false);
return; return;
} }
} }
@ -3414,15 +3406,15 @@ void A_BossDeath(AActor *self)
switch (level.flags & LEVEL_SPECACTIONSMASK) switch (level.flags & LEVEL_SPECACTIONSMASK)
{ {
case LEVEL_SPECLOWERFLOOR: case LEVEL_SPECLOWERFLOOR:
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, FRACUNIT, 0, -1, 0, false); EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, 1., 0, -1, 0, false);
return; return;
case LEVEL_SPECLOWERFLOORTOHIGHEST: case LEVEL_SPECLOWERFLOORTOHIGHEST:
EV_DoFloor (DFloor::floorLowerToHighest, NULL, 666, FRACUNIT, 0, -1, 0, false); EV_DoFloor (DFloor::floorLowerToHighest, NULL, 666, 1., 0, -1, 0, false);
return; return;
case LEVEL_SPECOPENDOOR: case LEVEL_SPECOPENDOOR:
EV_DoDoor (DDoor::doorOpen, NULL, NULL, 666, 8*FRACUNIT, 0, 0, 0); EV_DoDoor (DDoor::doorOpen, NULL, NULL, 666, 8., 0, 0, 0);
return; return;
} }
} }

View file

@ -47,13 +47,9 @@ struct FLookExParams
}; };
void P_DaggerAlert (AActor *target, AActor *emitter); void P_DaggerAlert (AActor *target, AActor *emitter);
void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks, AActor *emitter=NULL, fixed_t maxdist=0); void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks, AActor *emitter=NULL, double maxdist=0);
bool P_HitFriend (AActor *self); bool P_HitFriend (AActor *self);
void P_NoiseAlert (AActor *target, AActor *emmiter, bool splash=false, fixed_t maxdist=0); void P_NoiseAlert (AActor *target, AActor *emmiter, bool splash=false, double maxdist=0);
inline void P_NoiseAlert(AActor *target, AActor *emmiter, bool splash, double maxdist)
{
P_NoiseAlert(target, emmiter, splash, FLOAT2FIXED(maxdist));
}
bool P_CheckMeleeRange2 (AActor *actor); bool P_CheckMeleeRange2 (AActor *actor);
bool P_Move (AActor *actor); bool P_Move (AActor *actor);

View file

@ -85,11 +85,11 @@ FName MeansOfDeath;
// //
void P_TouchSpecialThing (AActor *special, AActor *toucher) void P_TouchSpecialThing (AActor *special, AActor *toucher)
{ {
fixed_t delta = special->_f_Z() - toucher->_f_Z(); double delta = special->Z() - toucher->Z();
// The pickup is at or above the toucher's feet OR // The pickup is at or above the toucher's feet OR
// The pickup is below the toucher. // The pickup is below the toucher.
if (delta > toucher->_f_height() || delta < MIN(-32*FRACUNIT, -special->_f_height())) if (delta > toucher->Height || delta < MIN(-32., -special->Height))
{ // out of reach { // out of reach
return; return;
} }
@ -931,7 +931,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
{ {
DAngle ang; DAngle ang;
player_t *player = NULL; player_t *player = NULL;
fixed_t thrust; double thrust;
int temp; int temp;
int painchance = 0; int painchance = 0;
FState * woundstate = NULL; FState * woundstate = NULL;
@ -1163,27 +1163,21 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
ang = origin->AngleTo(target); ang = origin->AngleTo(target);
} }
// Calculate this as float to avoid overflows so that the thrust = mod == NAME_MDK ? 10 : 32;
// clamping that had to be done here can be removed.
double fltthrust;
fltthrust = mod == NAME_MDK ? 10 : 32;
if (target->Mass > 0) if (target->Mass > 0)
{ {
fltthrust = clamp((damage * 0.125 * kickback) / target->Mass, 0., fltthrust); thrust = clamp((damage * 0.125 * kickback) / target->Mass, 0., thrust);
} }
thrust = FLOAT2FIXED(fltthrust);
// Don't apply ultra-small damage thrust // Don't apply ultra-small damage thrust
if (thrust < FRACUNIT/100) thrust = 0; if (thrust < 0.01) thrust = 0;
// make fall forwards sometimes // make fall forwards sometimes
if ((damage < 40) && (damage > target->health) if ((damage < 40) && (damage > target->health)
&& (target->Z() - origin->Z() > 64) && (target->Z() - origin->Z() > 64)
&& (pr_damagemobj()&1) && (pr_damagemobj()&1)
// [RH] But only if not too fast and not flying // [RH] But only if not too fast and not flying
&& thrust < 10*FRACUNIT && thrust < 10
&& !(target->flags & MF_NOGRAVITY) && !(target->flags & MF_NOGRAVITY)
&& (inflictor == NULL || !(inflictor->flags5 & MF5_NOFORWARDFALL)) && (inflictor == NULL || !(inflictor->flags5 & MF5_NOFORWARDFALL))
) )
@ -1204,7 +1198,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
} }
else else
{ {
target->Thrust(ang, FIXED2DBL(thrust)); target->Thrust(ang, thrust);
} }
} }
} }

View file

@ -232,44 +232,44 @@ FUNC(LS_Polyobj_Stop)
FUNC(LS_Door_Close) FUNC(LS_Door_Close)
// Door_Close (tag, speed, lighttag) // Door_Close (tag, speed, lighttag)
{ {
return EV_DoDoor (DDoor::doorClose, ln, it, arg0, _f_SPEED(arg1), 0, 0, arg2); return EV_DoDoor (DDoor::doorClose, ln, it, arg0, SPEED(arg1), 0, 0, arg2);
} }
FUNC(LS_Door_Open) FUNC(LS_Door_Open)
// Door_Open (tag, speed, lighttag) // Door_Open (tag, speed, lighttag)
{ {
return EV_DoDoor (DDoor::doorOpen, ln, it, arg0, _f_SPEED(arg1), 0, 0, arg2); return EV_DoDoor (DDoor::doorOpen, ln, it, arg0, SPEED(arg1), 0, 0, arg2);
} }
FUNC(LS_Door_Raise) FUNC(LS_Door_Raise)
// Door_Raise (tag, speed, delay, lighttag) // Door_Raise (tag, speed, delay, lighttag)
{ {
return EV_DoDoor (DDoor::doorRaise, ln, it, arg0, _f_SPEED(arg1), TICS(arg2), 0, arg3); return EV_DoDoor (DDoor::doorRaise, ln, it, arg0, SPEED(arg1), TICS(arg2), 0, arg3);
} }
FUNC(LS_Door_LockedRaise) FUNC(LS_Door_LockedRaise)
// Door_LockedRaise (tag, speed, delay, lock, lighttag) // Door_LockedRaise (tag, speed, delay, lock, lighttag)
{ {
return EV_DoDoor (arg2 ? DDoor::doorRaise : DDoor::doorOpen, ln, it, return EV_DoDoor (arg2 ? DDoor::doorRaise : DDoor::doorOpen, ln, it,
arg0, _f_SPEED(arg1), TICS(arg2), arg3, arg4); arg0, SPEED(arg1), TICS(arg2), arg3, arg4);
} }
FUNC(LS_Door_CloseWaitOpen) FUNC(LS_Door_CloseWaitOpen)
// Door_CloseWaitOpen (tag, speed, delay, lighttag) // Door_CloseWaitOpen (tag, speed, delay, lighttag)
{ {
return EV_DoDoor (DDoor::doorCloseWaitOpen, ln, it, arg0, _f_SPEED(arg1), OCTICS(arg2), 0, arg3); return EV_DoDoor (DDoor::doorCloseWaitOpen, ln, it, arg0, SPEED(arg1), OCTICS(arg2), 0, arg3);
} }
FUNC(LS_Door_WaitRaise) FUNC(LS_Door_WaitRaise)
// Door_WaitRaise(tag, speed, delay, wait, lighttag) // Door_WaitRaise(tag, speed, delay, wait, lighttag)
{ {
return EV_DoDoor(DDoor::doorWaitRaise, ln, it, arg0, _f_SPEED(arg1), TICS(arg2), 0, arg4, false, TICS(arg3)); return EV_DoDoor(DDoor::doorWaitRaise, ln, it, arg0, SPEED(arg1), TICS(arg2), 0, arg4, false, TICS(arg3));
} }
FUNC(LS_Door_WaitClose) FUNC(LS_Door_WaitClose)
// Door_WaitRaise(tag, speed, wait, lighttag) // Door_WaitRaise(tag, speed, wait, lighttag)
{ {
return EV_DoDoor(DDoor::doorWaitClose, ln, it, arg0, _f_SPEED(arg1), 0, 0, arg3, false, TICS(arg2)); return EV_DoDoor(DDoor::doorWaitClose, ln, it, arg0, SPEED(arg1), 0, 0, arg3, false, TICS(arg2));
} }
FUNC(LS_Door_Animated) FUNC(LS_Door_Animated)
@ -309,86 +309,86 @@ FUNC(LS_Generic_Door)
tag = arg0; tag = arg0;
lightTag = 0; lightTag = 0;
} }
return EV_DoDoor (type, ln, it, tag, _f_SPEED(arg1), OCTICS(arg3), arg4, lightTag, boomgen); return EV_DoDoor (type, ln, it, tag, SPEED(arg1), OCTICS(arg3), arg4, lightTag, boomgen);
} }
FUNC(LS_Floor_LowerByValue) FUNC(LS_Floor_LowerByValue)
// Floor_LowerByValue (tag, speed, height, change) // Floor_LowerByValue (tag, speed, height, change)
{ {
return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, _f_SPEED(arg1), FRACUNIT*arg2, -1, CHANGE(arg3), false); return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), arg2, -1, CHANGE(arg3), false);
} }
FUNC(LS_Floor_LowerToLowest) FUNC(LS_Floor_LowerToLowest)
// Floor_LowerToLowest (tag, speed, change) // Floor_LowerToLowest (tag, speed, change)
{ {
return EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, _f_SPEED(arg1), 0, -1, CHANGE(arg2), false); return EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false);
} }
FUNC(LS_Floor_LowerToHighest) FUNC(LS_Floor_LowerToHighest)
// Floor_LowerToHighest (tag, speed, adjust, hereticlower) // Floor_LowerToHighest (tag, speed, adjust, hereticlower)
{ {
return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, _f_SPEED(arg1), (arg2-128)*FRACUNIT, -1, 0, false, arg3==1); return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), (arg2-128), -1, 0, false, arg3==1);
} }
FUNC(LS_Floor_LowerToHighestEE) FUNC(LS_Floor_LowerToHighestEE)
// Floor_LowerToHighest (tag, speed, change) // Floor_LowerToHighest (tag, speed, change)
{ {
return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, _f_SPEED(arg1), 0, -1, CHANGE(arg2), false); return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false);
} }
FUNC(LS_Floor_LowerToNearest) FUNC(LS_Floor_LowerToNearest)
// Floor_LowerToNearest (tag, speed, change) // Floor_LowerToNearest (tag, speed, change)
{ {
return EV_DoFloor (DFloor::floorLowerToNearest, ln, arg0, _f_SPEED(arg1), 0, -1, CHANGE(arg2), false); return EV_DoFloor (DFloor::floorLowerToNearest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false);
} }
FUNC(LS_Floor_RaiseByValue) FUNC(LS_Floor_RaiseByValue)
// Floor_RaiseByValue (tag, speed, height, change, crush) // Floor_RaiseByValue (tag, speed, height, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, _f_SPEED(arg1), FRACUNIT*arg2, CRUSH(arg4), CHANGE(arg3), true); return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), arg2, CRUSH(arg4), CHANGE(arg3), true);
} }
FUNC(LS_Floor_RaiseToHighest) FUNC(LS_Floor_RaiseToHighest)
// Floor_RaiseToHighest (tag, speed, change, crush) // Floor_RaiseToHighest (tag, speed, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseToHighest, ln, arg0, _f_SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor (DFloor::floorRaiseToHighest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseToNearest) FUNC(LS_Floor_RaiseToNearest)
// Floor_RaiseToNearest (tag, speed, change, crush) // Floor_RaiseToNearest (tag, speed, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseToNearest, ln, arg0, _f_SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor (DFloor::floorRaiseToNearest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseToLowest) FUNC(LS_Floor_RaiseToLowest)
// Floor_RaiseToLowest (tag, change, crush) // Floor_RaiseToLowest (tag, change, crush)
{ {
// This is merely done for completeness as it's a rather pointless addition. // This is merely done for completeness as it's a rather pointless addition.
return EV_DoFloor (DFloor::floorRaiseToLowest, ln, arg0, 2*FRACUNIT, 0, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor (DFloor::floorRaiseToLowest, ln, arg0, 2., 0, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseAndCrush) FUNC(LS_Floor_RaiseAndCrush)
// Floor_RaiseAndCrush (tag, speed, crush, crushmode) // Floor_RaiseAndCrush (tag, speed, crush, crushmode)
{ {
return EV_DoFloor (DFloor::floorRaiseAndCrush, ln, arg0, _f_SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); return EV_DoFloor (DFloor::floorRaiseAndCrush, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3));
} }
FUNC(LS_Floor_RaiseAndCrushDoom) FUNC(LS_Floor_RaiseAndCrushDoom)
// Floor_RaiseAndCrushDoom (tag, speed, crush, crushmode) // Floor_RaiseAndCrushDoom (tag, speed, crush, crushmode)
{ {
return EV_DoFloor (DFloor::floorRaiseAndCrushDoom, ln, arg0, _f_SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); return EV_DoFloor (DFloor::floorRaiseAndCrushDoom, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3));
} }
FUNC(LS_Floor_RaiseByValueTimes8) FUNC(LS_Floor_RaiseByValueTimes8)
// FLoor_RaiseByValueTimes8 (tag, speed, height, change, crush) // FLoor_RaiseByValueTimes8 (tag, speed, height, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, _f_SPEED(arg1), FRACUNIT*arg2*8, CRUSH(arg4), CHANGE(arg3), true); return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), arg2*8, CRUSH(arg4), CHANGE(arg3), true);
} }
FUNC(LS_Floor_LowerByValueTimes8) FUNC(LS_Floor_LowerByValueTimes8)
// Floor_LowerByValueTimes8 (tag, speed, height, change) // Floor_LowerByValueTimes8 (tag, speed, height, change)
{ {
return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, _f_SPEED(arg1), FRACUNIT*arg2*8, -1, CHANGE(arg3), false); return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), arg2*8, -1, CHANGE(arg3), false);
} }
FUNC(LS_Floor_CrushStop) FUNC(LS_Floor_CrushStop)
@ -400,13 +400,13 @@ FUNC(LS_Floor_CrushStop)
FUNC(LS_Floor_LowerInstant) FUNC(LS_Floor_LowerInstant)
// Floor_LowerInstant (tag, unused, height, change) // Floor_LowerInstant (tag, unused, height, change)
{ {
return EV_DoFloor (DFloor::floorLowerInstant, ln, arg0, 0, arg2*FRACUNIT*8, -1, CHANGE(arg3), false); return EV_DoFloor (DFloor::floorLowerInstant, ln, arg0, 0., arg2*8, -1, CHANGE(arg3), false);
} }
FUNC(LS_Floor_RaiseInstant) FUNC(LS_Floor_RaiseInstant)
// Floor_RaiseInstant (tag, unused, height, change, crush) // Floor_RaiseInstant (tag, unused, height, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseInstant, ln, arg0, 0, arg2*FRACUNIT*8, CRUSH(arg4), CHANGE(arg3), true); return EV_DoFloor (DFloor::floorRaiseInstant, ln, arg0, 0., arg2*8, CRUSH(arg4), CHANGE(arg3), true);
} }
FUNC(LS_Floor_ToCeilingInstant) FUNC(LS_Floor_ToCeilingInstant)
@ -418,57 +418,57 @@ FUNC(LS_Floor_ToCeilingInstant)
FUNC(LS_Floor_MoveToValueTimes8) FUNC(LS_Floor_MoveToValueTimes8)
// Floor_MoveToValueTimes8 (tag, speed, height, negative, change) // Floor_MoveToValueTimes8 (tag, speed, height, negative, change)
{ {
return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, _f_SPEED(arg1), return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, SPEED(arg1),
arg2*FRACUNIT*8*(arg3?-1:1), -1, CHANGE(arg4), false); arg2*8*(arg3?-1:1), -1, CHANGE(arg4), false);
} }
FUNC(LS_Floor_MoveToValue) FUNC(LS_Floor_MoveToValue)
// Floor_MoveToValue (tag, speed, height, negative, change) // Floor_MoveToValue (tag, speed, height, negative, change)
{ {
return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, _f_SPEED(arg1), return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, _f_SPEED(arg1),
arg2*FRACUNIT*(arg3?-1:1), -1, CHANGE(arg4), false); arg2*(arg3?-1:1), -1, CHANGE(arg4), false);
} }
FUNC(LS_Floor_RaiseToLowestCeiling) FUNC(LS_Floor_RaiseToLowestCeiling)
// Floor_RaiseToLowestCeiling (tag, speed, change, crush) // Floor_RaiseToLowestCeiling (tag, speed, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseToLowestCeiling, ln, arg0, _f_SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor (DFloor::floorRaiseToLowestCeiling, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_LowerToLowestCeiling) FUNC(LS_Floor_LowerToLowestCeiling)
// Floor_LowerToLowestCeiling (tag, speed, change) // Floor_LowerToLowestCeiling (tag, speed, change)
{ {
return EV_DoFloor (DFloor::floorLowerToLowestCeiling, ln, arg0, _f_SPEED(arg1), 0, -1, CHANGE(arg2), true); return EV_DoFloor (DFloor::floorLowerToLowestCeiling, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseByTexture) FUNC(LS_Floor_RaiseByTexture)
// Floor_RaiseByTexture (tag, speed, change, crush) // Floor_RaiseByTexture (tag, speed, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseByTexture, ln, arg0, _f_SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor (DFloor::floorRaiseByTexture, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_LowerByTexture) FUNC(LS_Floor_LowerByTexture)
// Floor_LowerByTexture (tag, speed, change, crush) // Floor_LowerByTexture (tag, speed, change, crush)
{ {
return EV_DoFloor (DFloor::floorLowerByTexture, ln, arg0, _f_SPEED(arg1), 0, -1, CHANGE(arg2), true); return EV_DoFloor (DFloor::floorLowerByTexture, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseToCeiling) FUNC(LS_Floor_RaiseToCeiling)
// Floor_RaiseToCeiling (tag, speed, change, crush) // Floor_RaiseToCeiling (tag, speed, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseToCeiling, ln, arg0, _f_SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor (DFloor::floorRaiseToCeiling, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseByValueTxTy) FUNC(LS_Floor_RaiseByValueTxTy)
// Floor_RaiseByValueTxTy (tag, speed, height) // Floor_RaiseByValueTxTy (tag, speed, height)
{ {
return EV_DoFloor (DFloor::floorRaiseAndChange, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, -1, 0, false); return EV_DoFloor (DFloor::floorRaiseAndChange, ln, arg0, SPEED(arg1), arg2, -1, 0, false);
} }
FUNC(LS_Floor_LowerToLowestTxTy) FUNC(LS_Floor_LowerToLowestTxTy)
// Floor_LowerToLowestTxTy (tag, speed) // Floor_LowerToLowestTxTy (tag, speed)
{ {
return EV_DoFloor (DFloor::floorLowerAndChange, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, -1, 0, false); return EV_DoFloor (DFloor::floorLowerAndChange, ln, arg0, SPEED(arg1), arg2, -1, 0, false);
} }
FUNC(LS_Floor_Waggle) FUNC(LS_Floor_Waggle)
@ -498,7 +498,7 @@ FUNC(LS_Floor_TransferNumeric)
FUNC(LS_Floor_Donut) FUNC(LS_Floor_Donut)
// Floor_Donut (pillartag, pillarspeed, slimespeed) // Floor_Donut (pillartag, pillarspeed, slimespeed)
{ {
return EV_DoDonut (arg0, ln, _f_SPEED(arg1), _f_SPEED(arg2)); return EV_DoDonut (arg0, ln, SPEED(arg1), SPEED(arg2));
} }
FUNC(LS_Generic_Floor) FUNC(LS_Generic_Floor)
@ -533,7 +533,7 @@ FUNC(LS_Generic_Floor)
} }
} }
return EV_DoFloor (type, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, return EV_DoFloor (type, ln, arg0, SPEED(arg1), arg2,
(arg4 & 16) ? 20 : -1, arg4 & 7, false); (arg4 & 16) ? 20 : -1, arg4 & 7, false);
} }

View file

@ -4458,7 +4458,7 @@ void AActor::AdjustFloorClip ()
return; return;
} }
double oldclip = _f_floorclip(); double oldclip = Floorclip;
double shallowestclip = INT_MAX; double shallowestclip = INT_MAX;
const msecnode_t *m; const msecnode_t *m;

View file

@ -787,6 +787,11 @@ inline bool EV_DoFloor(DFloor::EFloor floortype, line_t *line, int tag,
{ {
return EV_DoFloor(floortype, line, tag, FLOAT2FIXED(speed), FLOAT2FIXED(height), crush, change, hexencrush, hereticlower); return EV_DoFloor(floortype, line, tag, FLOAT2FIXED(speed), FLOAT2FIXED(height), crush, change, hexencrush, hereticlower);
} }
inline bool EV_DoFloor(DFloor::EFloor floortype, line_t *line, int tag,
double speed, int height, int crush, int change, bool hexencrush, bool hereticlower = false)
{
return EV_DoFloor(floortype, line, tag, FLOAT2FIXED(speed), height, crush, change, hexencrush, hereticlower);
}
bool EV_FloorCrushStop (int tag); bool EV_FloorCrushStop (int tag);
bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed); bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed);