components/prboom/p_map.c
/*
 * killough 8/28/98:
 *
 * P_GetFriction()
 *
 * Returns the friction associated with a particular mobj.
 */


Returns the friction associated with a particular mobj.
Returns the friction associated with a particular mobj .
int P_GetFriction(const mobj_t *mo, int *frictionfactor)
{
  int friction = ORIG_FRICTION;
  int movefactor = ORIG_FRICTION_FACTOR;
  const msecnode_t *m;
  const sector_t *sec;
  if (!(mo->flags & (MF_NOCLIP|MF_NOGRAVITY))
      && (mbf_features || (mo->player && !compatibility)) &&
      variable_friction)
    for (m = mo->touching_sectorlist; m; m = m->m_tnext)
      if ((sec = m->m_sector)->special & FRICTION_MASK &&
    (sec->friction < friction || friction == ORIG_FRICTION) &&
    (mo->z <= sec->floorheight ||
     (sec->heightsec != -1 &&
      mo->z <= sectors[sec->heightsec].floorheight &&
      mbf_features)))
  friction = sec->friction, movefactor = sec->movefactor;
  if (frictionfactor)
    *frictionfactor = movefactor;
  return friction;
}
int P_GetFriction ( const mobj_t * mo , int * frictionfactor ) { int friction = ORIG_FRICTION ; int movefactor = ORIG_FRICTION_FACTOR ; const msecnode_t * m ; const sector_t * sec ; if ( ! ( mo -> flags & ( MF_NOCLIP | MF_NOGRAVITY ) ) && ( mbf_features || ( mo -> player && ! compatibility ) ) && variable_friction ) for ( m = mo -> touching_sectorlist ; m ; m = m -> m_tnext ) if ( ( sec = m -> m_sector ) -> special & FRICTION_MASK && ( sec -> friction < friction || friction == ORIG_FRICTION ) && ( mo -> z <= sec -> floorheight || ( sec -> heightsec != -1 && mo -> z <= sectors [ sec -> heightsec ] . floorheight && mbf_features ) ) ) friction = sec -> friction , movefactor = sec -> movefactor ; if ( frictionfactor ) * frictionfactor = movefactor ; return friction ; }
killough 8/28/98:
 P_GetFriction()
killough 8 / 28 / 98 : P_GetFriction ()
/* Assign the friction value to objects on the floor, non-floating,
   * and clipped. Normally the object's friction value is kept at
   * ORIG_FRICTION and this thinker changes it for icy or muddy floors.
   *
   * When the object is straddling sectors with the same
   * floorheight that have different frictions, use the lowest
   * friction value (muddy has precedence over icy).
   */