1. package Physics is 
  2.  
  3.     pragma Pure; 
  4.  
  5.     -- This enumeration describes the physical bounding types of tiles, from 
  6.     -- fully empty to full solid and all the different kinds of slopes. 
  7.     type Clip_Type is ( 
  8.         Passive, 
  9.         OneWay, 
  10.         Wall, 
  11.  
  12.         Slope_45_Up_Floor,   Slope_45_Up_Ceiling, 
  13.         Slope_45_Down_Floor, Slope_45_Down_Ceiling, 
  14.  
  15.         Slope_22_Up_Floor_Thin,   Slope_22_Up_Floor_Wide, 
  16.         Slope_22_Up_Ceiling_Wide, Slope_22_Up_Ceiling_Thin, 
  17.  
  18.         Slope_22_Down_Floor_Wide,   Slope_22_Down_Floor_Thin, 
  19.         Slope_22_Down_Ceiling_Thin, Slope_22_Down_Ceiling_Wide 
  20.     ); 
  21.  
  22.     -- Combines two Clip_Type values and returns the most solid/occlusive one. 
  23.     function "or"( l, r : Clip_Type ) return Clip_Type; 
  24.  
  25.     -- Clips a point to a tile as though the point is moving in the downward 
  26.     -- direction. The amount which the point should be adjusted upward is 
  27.     -- returned in 'adjustY'. 'size' is the size of the tile in pixels and 
  28.     -- 'x', 'y' is the point's location within the area of the tile. 'x' and 'y' 
  29.     -- must be in the range of 0..size-1. 
  30.     -- 
  31.     -- clip    : the clipping type of the tile 
  32.     -- size    : the width/height of the tile 
  33.     -- x, y    : the location of the point to clip within the tile 
  34.     -- adjustY : the distance the point should be moved in the y axis (negative) 
  35.     procedure Clip_Downward( clip    : Clip_Type; 
  36.                              size    : Positive; 
  37.                              x, y    : Natural; 
  38.                              adjustY : out Integer ); 
  39.     pragma Precondition( x < size ); 
  40.     pragma Precondition( y < size ); 
  41.     pragma Postcondition( adjustY <= 0 ); 
  42.     pragma Postcondition( adjustY >= -size ); 
  43.  
  44.     -- Clips a point to a tile as though the point is moving in the upward 
  45.     -- direction. The amount which the point should be adjusted downward is 
  46.     -- returned in 'adjustY'. 'size' is the size of the tile in pixels and 
  47.     -- 'x', 'y' is the point's location within the area of the tile. 'x' and 'y' 
  48.     -- must be in the range of 0..size-1. 
  49.     -- 
  50.     -- clip    : the clipping type of the tile 
  51.     -- size    : the width/height of the tile 
  52.     -- x, y    : the location of the point to clip within the tile 
  53.     -- adjustY : the distance the point should be moved in the y axis (positive) 
  54.     procedure Clip_Upward( clip    : Clip_Type; 
  55.                            size    : Positive; 
  56.                            x, y    : Natural; 
  57.                            adjustY : out Integer ); 
  58.     pragma Precondition( x < size ); 
  59.     pragma Precondition( y < size ); 
  60.     pragma Postcondition( adjustY >= 0 ); 
  61.     pragma Postcondition( adjustY <= size ); 
  62.  
  63.     -- Returns the matching Clip_Type value for a string. The string should be 
  64.     -- the exact name of the enumeration value. 'valid' will return False if 
  65.     -- 'str' is not a valid Clip_Type value. 
  66.     procedure To_Clip_Type( str   : String; 
  67.                             clip  : out Clip_Type; 
  68.                             valid : out Boolean ); 
  69.  
  70.     -- The point at which acceleration is considered to be immediate. Any 
  71.     -- accelerations greater than or equal to this constant will cause an entity 
  72.     -- to immediately reach their target velocity with one tick of the physics 
  73.     -- manager. 
  74.     INSTANT_ACCELERATION : constant Float; 
  75.  
  76. private 
  77.  
  78.     INSTANT_ACCELERATION : constant Float := 100000.0; 
  79.  
  80. end Physics;