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

Diff of /enigma/src/world.cc

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

revision 1.67 by dheck, Sun Aug 17 21:28:13 2003 UTC revision 1.68 by dheck, Mon Aug 18 08:37:58 2003 UTC
# Line 831  handle_stone_contact (StoneContact &sc, Line 831  handle_stone_contact (StoneContact &sc,
831  }  }
832    
833  static void  static void
834  handle_contacts(Actor *a, double total_dtime)  handle_contacts(Actor *actor1, double total_dtime)
835  {  {
836      ActorInfo &a1 = *a->get_actorinfo();      ActorInfo &a1 = *actor1->get_actorinfo();
837    
838      /*      /*
839      ** Handle contacts with stones      ** Handle contacts with stones
840      */      */
841      StoneContactList cl;      StoneContactList cl;
842      find_stone_contacts(a, cl);      find_stone_contacts(actor1, cl);
843      for (StoneContactList::iterator i=cl.begin();      for (StoneContactList::iterator i=cl.begin();
844           i != cl.end(); ++i)           i != cl.end(); ++i)
845      {      {
# Line 856  handle_contacts(Actor *a, double total_d Line 856  handle_contacts(Actor *a, double total_d
856      unsigned s=level->actorlist.size();      unsigned s=level->actorlist.size();
857      for (unsigned j=0; j<s; ++j)      for (unsigned j=0; j<s; ++j)
858      {      {
859          if (level->actorlist[j] == a) continue;          Actor     *actor2 = level->actorlist[j];
860            if (actor2 == actor1)
861                continue;
862    
863          ActorInfo &a2 = *level->actorlist[j]->get_actorinfo();          ActorInfo &a2 = *actor2->get_actorinfo();
864          V2         p2 = a2.pos;          V2         p2 = a2.pos;
865          double     r2 = a2.radius;          double     r2 = a2.radius;
866    
# Line 878  handle_contacts(Actor *a, double total_d Line 880  handle_contacts(Actor *a, double total_d
880    
881                  double restitution = 0.95;                  double restitution = 0.95;
882    
883                    actor1->on_hit(actor2);
884                    actor2->on_hit(actor1);
885    
886                  a1.vel += -v1 + (v2*(2*m2) + v1*(m1-m2)) / M;                  a1.vel += -v1 + (v2*(2*m2) + v1*(m1-m2)) / M;
887                  a2.vel += -v2 + (v1*(2*m1) + v2*(m2-m1)) / M;                  a2.vel += -v2 + (v1*(2*m1) + v2*(m2-m1)) / M;
888    

Legend:
Removed from v.1.67  
changed lines
  Added in v.1.68

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