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.46,1.47


From: Daniel Heck <address@hidden>
Subject: [Enigma-cvs] enigma/src actors.cc,1.46,1.47
Date: Mon, 27 Oct 2003 22:27:55 +0000

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

Modified Files:
        actors.cc 
Log Message:
Support for "drunken" marbles


Index: actors.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/actors.cc,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** actors.cc   22 Oct 2003 00:06:35 -0000      1.46
--- actors.cc   27 Oct 2003 22:27:53 -0000      1.47
***************
*** 564,567 ****
--- 564,569 ----
          bool is_flying() const { return state == JUMPING; }
          bool is_on_floor() const;
+         bool is_drunken() const { return m_drunk_rest_time>0; }
+ 
          bool can_drop_items() const;
          bool can_pickup_items() const;
***************
*** 594,597 ****
--- 596,601 ----
          static const double   SHIELD_TIME = 10.0;
          HaloState             m_halostate;
+ 
+         double m_drunk_rest_time;
      };
  }
***************
*** 600,604 ****
  : Actor(kind, V2()), state(NO_STATE),
    m_shield_rest_time(0),
!   m_halostate(NOHALO)
  
      //, sinkDepth (0), sinkModel(-1)
--- 604,609 ----
  : Actor(kind, V2()), state(NO_STATE),
    m_shield_rest_time(0),
!   m_halostate(NOHALO),
!   m_drunk_rest_time(0)
  
      //, sinkDepth (0), sinkModel(-1)
***************
*** 689,695 ****
      // Shield can be activated in all states except DEAD
  
!     if (state != DEAD && m == "shield") {
!         m_shield_rest_time += SHIELD_TIME;
!         update_halo();
      }
  }
--- 694,705 ----
      // Shield can be activated in all states except DEAD
  
!     if (state != DEAD) {
!         if (m == "shield") {
!             m_shield_rest_time += SHIELD_TIME;
!             update_halo();
!         } 
!         else if (m == "booze") {
!             m_drunk_rest_time += 5.0; // Drunken for 5 more seconds
!         }
      }
  }
***************
*** 705,712 ****
          bool shinep = (xpos + ypos) % 2;
          set_shine_model (shinep);
      }
      else if (state == SINKING) {
!         const double defaultSinkSpeed = 4.0; // 10.0 means : sink in 1 second 
(if absVelocity == 0)
!         const double nonSinkVelocity  = 6.0; // at this velocity don't sink; 
above: raise
  
          double sinkSpeed = defaultSinkSpeed * (1 - length(ai->vel) / 
nonSinkVelocity);
--- 715,731 ----
          bool shinep = (xpos + ypos) % 2;
          set_shine_model (shinep);
+ 
+         if (m_drunk_rest_time > 0) {
+             m_drunk_rest_time -= dtime;
+ //             V2 force (DoubleRand(-1, 1), DoubleRand(-1, 1));
+ //             this->add_force (20 * force);
+         }
      }
      else if (state == SINKING) {
!         // 10.0 means : sink in 1 second (if absVelocity == 0)
!         const double defaultSinkSpeed = 4.0;
! 
!         // at this velocity don't sink; above: raise
!         const double nonSinkVelocity  = 6.0;
  
          double sinkSpeed = defaultSinkSpeed * (1 - length(ai->vel) / 
nonSinkVelocity);
***************
*** 896,902 ****
  }
  
! void
! BasicBall::disable_shield()
! {
      if (has_shield()) {
        m_shield_rest_time = 0;
--- 915,919 ----
  }
  
! void BasicBall::disable_shield() {
      if (has_shield()) {
        m_shield_rest_time = 0;
***************
*** 905,911 ****
  }
  
! bool
! BasicBall::has_shield() const
! {
      return m_shield_rest_time > 0;
  }
--- 922,926 ----
  }
  
! bool BasicBall::has_shield() const {
      return m_shield_rest_time > 0;
  }





reply via email to

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