/[enigma]/enigma/src/world.hh
ViewVC logotype

Diff of /enigma/src/world.hh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.33 by dheck, Tue Aug 12 18:28:05 2003 UTC revision 1.33.2.1 by dheck, Mon Sep 22 02:47:20 2003 UTC
# Line 42  namespace world Line 42  namespace world
42    
43  namespace world  namespace world
44  {  {
45      /*  
46       * This class contains the information the physics engine  /*
47       * maintains about dynamic objects ("actors").  ** ActorInfo
48       */  **
49    ** This class contains the information the physics engine maintains
50    ** about dynamic objects ("actors").
51    */
52      class ActorInfo {      class ActorInfo {
53      public:      public:
54          ActorInfo(V2 p, V2 v)          ActorInfo(V2 p, V2 v)
55          : pos(p), vel(v), forceacc(),          : pos(p), vel(v), forceacc(),
56            charge(0), mass(1), radius(1),            charge(0), mass(1), radius(1),
57            grabbed(false),            grabbed(false),
58            last_pos(), oldpos(), oldvel(v), force()            last_pos(), oldpos(), force()
59          {}          {}
60    
61          //          //
# Line 69  namespace world Line 72  namespace world
72          //          //
73          // Variables used internally by the physics engine          // Variables used internally by the physics engine
74          //          //
75          V2 last_pos;            // Position befure current tick          V2 last_pos;            // Position before current tick
76          V2 oldpos;              // Backup position for adaptive stepsize control          V2 oldpos;              // Backup position for enter/leave notification
         V2 oldvel;              // Backup velocity (see oldpos)  
77          V2 force;               // Force used during tick          V2 force;               // Force used during tick
78      };      };
79    
80      /*  /*
81       * Impulse is used to transfer force from one Object to another Object  ** Impulse is used to transfer force from one Object to another Object
82       * (currently only Stones can be the destination of Impulse's)  ** (currently only Stones can be the destination of Impulses).
83       */  */
84      struct Impulse {      struct Impulse {
85          Object    *sender;          Object    *sender;
86          GridPos    dest;          GridPos    dest;
# Line 89  namespace world Line 91  namespace world
91          {}          {}
92      };      };
93    
94    /*
95      /*  ** Things that may happen when an actor hits a stone.
96       * Things that may happen when an actor hits a stone.  */
      */  
97      enum StoneResponse {      enum StoneResponse {
98          STONE_PASS,             // let the actor pass          STONE_PASS,             // Actor passes stone
99          STONE_REBOUND           // rebound the actor          STONE_REBOUND           // Actor bounces off the stone
100      };      };
101    
102      /*  /*
103       * All the information that is necessary to handle collisions  ** StoneContact
104       * between stones and actors.  **
105       */  ** All the information that is necessary to handle collisions between
106    ** stones and actors.
107    */
108      struct StoneContact      struct StoneContact
109      {      {
110          // Constructor.          // Constructor.
111          StoneContact(Actor *a, GridPos p,          StoneContact (Actor *a,
112                       const V2 &cp, const V2 &n);                        GridPos stonepos,
113                          const V2 & contact_point,
114                          const V2 & surface_normal);
115          StoneContact();          StoneContact();
116    
117          // Variables.          // Variables.
# Line 114  namespace world Line 119  namespace world
119          GridPos         stonepos;          GridPos         stonepos;
120          StoneResponse   response;          StoneResponse   response;
121    
122          V2      contact_point;  // Where do the shapes meet? (world coords)          V2      contact_point;  // Where do the shapes meet? (world coordinates)
123          V2      normal;         // The surface normal at the contact point          V2      normal;         // The surface normal at the contact point
124          bool    is_collision;   // Actor moves towards the stone, not away          bool    is_collision;   // Actor moves towards the stone, not away
125          bool    fake_collision;          bool    fake_collision;
# Line 183  namespace world Line 188  namespace world
188      void    UnnameObject (Object *obj);      void    UnnameObject (Object *obj);
189      void    TransferObjectName(Object *source, Object *target);      void    TransferObjectName(Object *source, Object *target);
190      Object *GetNamedObject (const string &name);      Object *GetNamedObject (const string &name);
191        Object *GetObject (const GridLoc &l);
192    
193      bool world::IsLevelBorder(GridPos p);      bool world::IsLevelBorder(GridPos p);
194    
# Line 252  namespace world Line 258  namespace world
258      /* Find all actors at most RANGE units away from CENTER.  Returns      /* Find all actors at most RANGE units away from CENTER.  Returns
259         false if none were found. */         false if none were found. */
260      bool   GetActorsInRange (px::V2 center, double range,      bool   GetActorsInRange (px::V2 center, double range,
261                               std::vector<Actor*>& actors);                               std::vector<Actor*> &actors);
262    
263  //----------------------------------------  //----------------------------------------
264  // Stones  // Stones

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.33.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26