enigma-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Enigma-cvs] enigma/src actors.cc,1.48,1.49


From: Ralf Westram <address@hidden>
Subject: [Enigma-cvs] enigma/src actors.cc,1.48,1.49
Date: Mon, 03 Nov 2003 14:10:39 +0000

Update of /cvsroot/enigma/enigma/src
In directory subversions:/tmp/cvs-serv22033

Modified Files:
        actors.cc 
Log Message:
- Overlap check with adjacent fields is disabled when actor is
  currently inside a collision (pos may be wrong in that state)
- changed other calls to Actor::move



Index: actors.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/actors.cc,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** actors.cc   30 Oct 2003 19:04:10 -0000      1.48
--- actors.cc   3 Nov 2003 14:10:37 -0000       1.49
***************
*** 30,37 ****
  #include <set>
  
  using px::V2;
  using namespace world;
  
- 
  //----------------------------------------
  // Actor implementation
--- 30,37 ----
  #include <set>
  
+ using namespace std;
  using px::V2;
  using namespace world;
  
  //----------------------------------------
  // Actor implementation
***************
*** 311,315 ****
      set_model(get_kind());
      m_sprite.move (p);
!     move();
  }
  
--- 311,315 ----
      set_model(get_kind());
      m_sprite.move (p);
!     move(false);
  }
  
***************
*** 321,325 ****
      actorinfo.vel = V2();
      m_sprite.move (newpos);
!     move();
  }
  
--- 321,325 ----
      actorinfo.vel = V2();
      m_sprite.move (newpos);
!     move(false);
  }
  
***************
*** 330,335 ****
              double     dist = length(surroundingPos.center()-ai->pos) - 
ai->radius;
  
!             if (dist < 0.65) { // otherwise actor is crashed by stones with 
round edges
!                 // st->warning("actordist is %f", dist);
                  st->actor_inside(ac);
              }
--- 330,338 ----
              double     dist = length(surroundingPos.center()-ai->pos) - 
ai->radius;
  
!             if (dist < 0.65) {  // otherwise actor is crashed by stones with 
round edges
! //                  Log << "ai->   pos=" << ai->pos[0]    << "/" << 
ai->pos[1]    << endl;
! //                  Log << "ai->oldpos=" << ai->oldpos[0] << "/" << 
ai->oldpos[1] << endl;
! //                  Log << "actordist=" << dist << endl;
! //                  Log << "surroundingPos=" << surroundingPos << endl;
                  st->actor_inside(ac);
              }
***************
*** 338,342 ****
  }
  
! void Actor::move() {
      using namespace world;
      GridPos  field(actorinfo.pos);
--- 341,345 ----
  }
  
! void Actor::move(bool inside_collision) {
      using namespace world;
      GridPos  field(actorinfo.pos);
***************
*** 363,369 ****
          st->actor_inside(this);
  
!     // check whether marble overlaps with surrounding fields and
!     // call actor_inside for all stones on overlapped fields
!     {
          double  radius = actorinfo.radius-0.05; // allow a very small overlap
          GridPos lu_field(actorinfo.pos+V2(-radius, -radius));
--- 366,378 ----
          st->actor_inside(this);
  
!     // 'inside_collision' is true when the actor bounces back from a stone.
!     // At that moment it may have a position where it overlaps with the stone,
!     // so overlap checking would "shatter" marbles.
! 
!     if (!inside_collision) {
! 
!         // check whether marble overlaps with surrounding fields and
!         // call actor_inside for all stones on overlapped fields.
! 
          double  radius = actorinfo.radius-0.05; // allow a very small overlap
          GridPos lu_field(actorinfo.pos+V2(-radius, -radius));
***************
*** 388,391 ****
--- 397,401 ----
      }
  
+     // move the actor and save the position
      m_sprite.move (actorinfo.pos);
      on_motion(actorinfo.pos);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]