components/prboom/p_map.c
//
// P_TryMove
// Attempt to move to a new position,
// crossing special lines unless MF_TELEPORT is set.
//
P_TryMove
Attempt to move to a new position,
crossing special lines unless MF_TELEPORT is set.
P_TryMove Attempt to move to a new position crossing special lines unless MF_TELEPORT is set .
boolean P_TryMove(mobj_t* thing,fixed_t x,fixed_t y,
                  boolean dropoff) 
  {
  fixed_t oldx;
  fixed_t oldy;
  felldown = floatok = false;               
  if (!P_CheckPosition (thing, x, y))
    return false;   
  if ( !(thing->flags & MF_NOCLIP) )
    {
      if (tmceilingz - tmfloorz < thing->height ||     
    (floatok = true, !(thing->flags & MF_TELEPORT) &&
     tmceilingz - thing->z < thing->height) ||
    (!(thing->flags & MF_TELEPORT) &&
     tmfloorz - thing->z > 24*FRACUNIT))
  return tmunstuck
    && !(ceilingline && untouched(ceilingline))
    && !(  floorline && untouched(  floorline));
      if (!(thing->flags & (MF_DROPOFF|MF_FLOAT))) {
  if (comp[comp_dropoff])
    {
      if ((compatibility || !dropoff
            || (mbf_features && compatibility_level <= prboom_2_compatibility))
          && (tmfloorz - tmdropoffz > 24*FRACUNIT))
        return false;                      
    }
  else
    if (!dropoff || (dropoff==2 &&  
         (tmfloorz-tmdropoffz > 128*FRACUNIT ||
          !thing->target || thing->target->z >tmdropoffz)))
      {
        if (!monkeys || !mbf_features ?
      tmfloorz - tmdropoffz > 24*FRACUNIT :
      thing->floorz  - tmfloorz > 24*FRACUNIT ||
      thing->dropoffz - tmdropoffz > 24*FRACUNIT)
    return false;
      }
    else { 
      felldown = !(thing->flags & MF_NOGRAVITY) &&
        thing->z - tmfloorz > 24*FRACUNIT;
    }
      }
      if (thing->flags & MF_BOUNCES &&    
    !(thing->flags & (MF_MISSILE|MF_NOGRAVITY)) &&
    !sentient(thing) && tmfloorz - thing->z > 16*FRACUNIT)
  return false;  for bouncers under gravity
      : prevent falling objects from going up too many steps
      if (thing->intflags & MIF_FALLING && tmfloorz - thing->z >
    FixedMul(thing->momx,thing->momx)+FixedMul(thing->momy,thing->momy))
  return false;
    }
  P_UnsetThingPosition (thing);
  oldx = thing->x;
  oldy = thing->y;
  thing->floorz = tmfloorz;
  thing->ceilingz = tmceilingz;
  thing->dropoffz = tmdropoffz;      : keep track of dropoffs
  thing->x = x;
  thing->y = y;
  P_SetThingPosition (thing);
  if (! (thing->flags&(MF_TELEPORT|MF_NOCLIP)) )
    while (numspechit--)
      if (spechit[numspechit]->special)  
  {
    int oldside;
    if ((oldside = P_PointOnLineSide(oldx, oldy, spechit[numspechit])) !=
        P_PointOnLineSide(thing->x, thing->y, spechit[numspechit]))
      P_CrossSpecialLine(spechit[numspechit], oldside, thing);
  }
  return true;
  }
boolean P_TryMove ( mobj_t * thing , fixed_t x , fixed_t y , boolean dropoff ) { fixed_t oldx ; fixed_t oldy ; felldown = floatok = false ; if ( ! P_CheckPosition ( thing , x , y ) ) return false ; if ( ! ( thing -> flags & MF_NOCLIP ) ) { if ( tmceilingz - tmfloorz < thing -> height || ( floatok = true , ! ( thing -> flags & MF_TELEPORT ) && tmceilingz - thing -> z < thing -> height ) || ( ! ( thing -> flags & MF_TELEPORT ) && tmfloorz - thing -> z > 24 * FRACUNIT ) ) return tmunstuck && ! ( ceilingline && untouched ( ceilingline ) ) && ! ( floorline && untouched ( floorline ) ) ; if ( ! ( thing -> flags & ( MF_DROPOFF | MF_FLOAT ) ) ) { if ( comp [ comp_dropoff ] ) { if ( ( compatibility || ! dropoff || ( mbf_features && compatibility_level <= prboom_2_compatibility ) ) && ( tmfloorz - tmdropoffz > 24 * FRACUNIT ) ) return false ; } else if ( ! dropoff || ( dropoff == 2 && ( tmfloorz - tmdropoffz > 128 * FRACUNIT || ! thing -> target || thing -> target -> z > tmdropoffz ) ) ) { if ( ! monkeys || ! mbf_features ? tmfloorz - tmdropoffz > 24 * FRACUNIT : thing -> floorz - tmfloorz > 24 * FRACUNIT || thing -> dropoffz - tmdropoffz > 24 * FRACUNIT ) return false ; } else { felldown = ! ( thing -> flags & MF_NOGRAVITY ) && thing -> z - tmfloorz > 24 * FRACUNIT ; } } if ( thing -> flags & MF_BOUNCES && ! ( thing -> flags & ( MF_MISSILE | MF_NOGRAVITY ) ) && ! sentient ( thing ) && tmfloorz - thing -> z > 16 * FRACUNIT ) return false ; if ( thing -> intflags & MIF_FALLING && tmfloorz - thing -> z > FixedMul ( thing -> momx , thing -> momx ) + FixedMul ( thing -> momy , thing -> momy ) ) return false ; } P_UnsetThingPosition ( thing ) ; oldx = thing -> x ; oldy = thing -> y ; thing -> floorz = tmfloorz ; thing -> ceilingz = tmceilingz ; thing -> dropoffz = tmdropoffz ; thing -> x = x ; thing -> y = y ; P_SetThingPosition ( thing ) ; if ( ! ( thing -> flags & ( MF_TELEPORT | MF_NOCLIP ) ) ) while ( numspechit -- ) if ( spechit [ numspechit ] -> special ) { int oldside ; if ( ( oldside = P_PointOnLineSide ( oldx , oldy , spechit [ numspechit ] ) ) != P_PointOnLineSide ( thing -> x , thing -> y , spechit [ numspechit ] ) ) P_CrossSpecialLine ( spechit [ numspechit ] , oldside , thing ) ; } return true ; }
P_TryMove
Attempt to move to a new position,
crossing special lines unless MF_TELEPORT is set.
P_TryMove Attempt to move to a new position crossing special lines unless MF_TELEPORT is set .
// killough 3/15/98: allow dropoff as option // killough 11/98 // solid wall or thing // killough 7/26/98: reformatted slightly // killough 8/1/98: Possibly allow escape if otherwise stuck // doesn't fit // mobj must lower to fit // too big a step up /* killough 3/15/98: Allow certain objects to drop off
       * killough 7/24/98, 8/1/98:
       * Prevent monsters from getting stuck hanging off ledges
       * killough 10/98: Allow dropoffs in controlled circumstances
       * killough 11/98: Improve symmetry of clipping on stairs
       */ // fix demosync bug in mbf compatibility mode // don't stand over a dropoff // large jump down (e.g. dogs) /* dropoff allowed -- check for whether it fell more than 24 */ // killough 8/13/98 // too big a step up for bouncers under gravity // killough 11/98: prevent falling objects from going up too many steps // the move is ok, // so unlink from the old position and link into the new position // killough 11/98: keep track of dropoffs // if any special lines were hit, do the effect // see if the line was crossed