- floatified FMapThing, dropoffz and GetBobOffset
This commit is contained in:
parent
f8cf4bcf3d
commit
f60eac8dc0
20 changed files with 177 additions and 163 deletions
|
|
@ -879,7 +879,7 @@ void P_NewChaseDir(AActor * actor)
|
|||
}
|
||||
|
||||
// Try to move away from a dropoff
|
||||
if (actor->_f_floorz() - actor->dropoffz > actor->MaxDropOffHeight &&
|
||||
if (actor->floorz - actor->dropoffz > actor->MaxDropOffHeight &&
|
||||
actor->Z() <= actor->floorz && !(actor->flags & MF_DROPOFF) &&
|
||||
!(actor->flags2 & MF2_ONMOBJ) &&
|
||||
!(actor->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF))
|
||||
|
|
@ -888,8 +888,8 @@ void P_NewChaseDir(AActor * actor)
|
|||
FBlockLinesIterator it(box);
|
||||
line_t *line;
|
||||
|
||||
fixed_t deltax = 0;
|
||||
fixed_t deltay = 0;
|
||||
double deltax = 0;
|
||||
double deltay = 0;
|
||||
while ((line = it.Next()))
|
||||
{
|
||||
if (line->backsector && // Ignore one-sided linedefs
|
||||
|
|
@ -899,31 +899,31 @@ void P_NewChaseDir(AActor * actor)
|
|||
box.Bottom() < line->bbox[BOXTOP] &&
|
||||
box.BoxOnLineSide(line) == -1)
|
||||
{
|
||||
fixed_t front = line->frontsector->floorplane.ZatPoint(actor->PosRelative(line));
|
||||
fixed_t back = line->backsector->floorplane.ZatPoint(actor->PosRelative(line));
|
||||
angle_t angle;
|
||||
double front = line->frontsector->floorplane.ZatPointF(actor->PosRelative(line));
|
||||
double back = line->backsector->floorplane.ZatPointF(actor->PosRelative(line));
|
||||
DAngle angle;
|
||||
|
||||
// The monster must contact one of the two floors,
|
||||
// and the other must be a tall dropoff.
|
||||
|
||||
if (back == actor->_f_Z() && front < actor->_f_Z() - actor->MaxDropOffHeight)
|
||||
if (back == actor->Z() && front < actor->Z() - actor->MaxDropOffHeight)
|
||||
{
|
||||
angle = R_PointToAngle2(0,0,line->dx,line->dy); // front side dropoff
|
||||
angle = line->Delta().Angle(); // front side dropoff
|
||||
}
|
||||
else if (front == actor->_f_Z() && back < actor->_f_Z() - actor->MaxDropOffHeight)
|
||||
else if (front == actor->Z() && back < actor->Z() - actor->MaxDropOffHeight)
|
||||
{
|
||||
angle = R_PointToAngle2(line->dx,line->dy,0,0); // back side dropoff
|
||||
angle = line->Delta().Angle() + 180.; // back side dropoff
|
||||
}
|
||||
else continue;
|
||||
|
||||
// Move away from dropoff at a standard speed.
|
||||
// Multiple contacted linedefs are cumulative (e.g. hanging over corner)
|
||||
deltax -= finesine[angle >> ANGLETOFINESHIFT]*32;
|
||||
deltay += finecosine[angle >> ANGLETOFINESHIFT]*32;
|
||||
deltax -= 32 * angle.Sin();
|
||||
deltay += 32 * angle.Cos();
|
||||
}
|
||||
}
|
||||
|
||||
if (deltax || deltay)
|
||||
if (deltax != 0 || deltay != 0)
|
||||
{
|
||||
// [Graf Zahl] I have changed P_TryMove to only apply this logic when
|
||||
// being called from here. AVOIDINGDROPOFF activates the code that
|
||||
|
|
@ -933,7 +933,7 @@ void P_NewChaseDir(AActor * actor)
|
|||
|
||||
// use different dropoff movement logic in P_TryMove
|
||||
actor->flags5|=MF5_AVOIDINGDROPOFF;
|
||||
P_DoNewChaseDir(actor, deltax, deltay);
|
||||
P_DoNewChaseDir(actor, FLOAT2FIXED(deltax), FLOAT2FIXED(deltay));
|
||||
actor->flags5&=~MF5_AVOIDINGDROPOFF;
|
||||
|
||||
// If moving away from dropoff, set movecount to 1 so that
|
||||
|
|
@ -2861,30 +2861,29 @@ void A_Face (AActor *self, AActor *other, angle_t _max_turn, angle_t _max_pitch,
|
|||
// disabled and is so by default.
|
||||
if (max_pitch <= 180.)
|
||||
{
|
||||
fixedvec2 pos = self->_f_Vec2To(other);
|
||||
DVector2 dist(pos.x, pos.y);
|
||||
DVector2 dist = self->Vec2To(other);
|
||||
|
||||
// Positioning ala missile spawning, 32 units above foot level
|
||||
fixed_t source_z = self->_f_Z() + 32*FRACUNIT + self->GetBobOffset();
|
||||
fixed_t target_z = other->_f_Z() + 32*FRACUNIT + other->GetBobOffset();
|
||||
double source_z = self->Z() + 32 + self->GetBobOffset();
|
||||
double target_z = other->Z() + 32 + other->GetBobOffset();
|
||||
|
||||
// If the target z is above the target's head, reposition to the middle of
|
||||
// its body.
|
||||
if (target_z >= other->_f_Top())
|
||||
if (target_z >= other->Top())
|
||||
{
|
||||
target_z = other->_f_Z() + (other->_f_height() / 2);
|
||||
target_z = other->Center();
|
||||
}
|
||||
|
||||
//Note there is no +32*FRACUNIT on purpose. This is for customization sake.
|
||||
//If one doesn't want this behavior, just don't use FAF_BOTTOM.
|
||||
if (flags & FAF_BOTTOM)
|
||||
target_z = other->_f_Z() + other->GetBobOffset();
|
||||
target_z = other->Z() + other->GetBobOffset();
|
||||
if (flags & FAF_MIDDLE)
|
||||
target_z = other->_f_Z() + (other->_f_height() / 2) + other->GetBobOffset();
|
||||
target_z = other->Center() + other->GetBobOffset();
|
||||
if (flags & FAF_TOP)
|
||||
target_z = other->_f_Z() + (other->_f_height()) + other->GetBobOffset();
|
||||
target_z = other->Top() + other->GetBobOffset();
|
||||
|
||||
target_z += z_add;
|
||||
target_z += FIXED2FLOAT(z_add);
|
||||
|
||||
double dist_z = target_z - source_z;
|
||||
double ddist = g_sqrt(dist.X*dist.X + dist.Y*dist.Y + dist_z*dist_z);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue