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.50,1.51


From: Ralf Westram <address@hidden>
Subject: [Enigma-cvs] enigma/src actors.cc,1.50,1.51
Date: Wed, 12 Nov 2003 09:33:50 +0000

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

Modified Files:
        actors.cc 
Log Message:
- rotors return to their starting position if they
  loose actor focus and they do not follow dead/respawning actors
- BasicBall !is_movable if DISAPPEARING (=> rotor doesn't get wild there)
- added default attributes to ac-killerball
  (mouseforce=2, color=1, whiteball=1 and controllers=3)



Index: actors.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/actors.cc,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** actors.cc   9 Nov 2003 11:51:37 -0000       1.50
--- actors.cc   12 Nov 2003 09:33:48 -0000      1.51
***************
*** 454,465 ****
  
      vector<Actor *> actors;
      GetActorsInRange (get_pos(), range, actors);
  
      for (size_t i=0; i<actors.size(); ++i) {
          Actor *a = actors[i];
!         if (a->get_attrib ("whiteball") || a->get_attrib("blackball")) {
!             this->add_force (normalize(a->get_pos() - get_pos()) * force);
          }
      }
      Actor::think(dtime);
  }
--- 454,474 ----
  
      vector<Actor *> actors;
+     bool            focussed = false;
      GetActorsInRange (get_pos(), range, actors);
  
      for (size_t i=0; i<actors.size(); ++i) {
          Actor *a = actors[i];
!         if ((a->get_attrib ("whiteball") || a->get_attrib("blackball")) &&
!             a->is_movable())
!         {
!             add_force (normalize(a->get_pos() - get_pos()) * force);
!             focussed = true;
          }
      }
+ 
+     if (!focussed) { // no actors focussed -> return to start position
+         add_force(normalize(get_respawnpos()-get_pos()) * force);
+     }
+ 
      Actor::think(dtime);
  }
***************
*** 509,537 ****
  
  //----------------------------------------
- // Killerball
- //----------------------------------------
- namespace
- {
-     class Killerball : public Actor {
-         CLONEACTOR(Killerball);
-     public:
- 
-         Killerball() : Actor ("ac-killerball", V2()) {
-             world::ActorInfo *ai = get_actorinfo();
-             ai->radius = 13/64.0;
-             ai->mass = 0.7;
- 
-             assert(ai->radius <= Actor::get_max_radius());
-         }
-         bool is_dead() const { return false; }
- 
-       void on_hit(Actor *a) {
-           SendMessage(a, "shatter");
-       }
-     };
- }
- 
- 
- //----------------------------------------
  // CannonBall
  //----------------------------------------
--- 518,521 ----
***************
*** 616,620 ****
  
          bool is_dead() const;
!       bool is_movable() const { return (state!=DEAD && state!=RESURRECTED); }
          bool is_flying() const { return state == JUMPING; }
          bool is_on_floor() const;
--- 600,604 ----
  
          bool is_dead() const;
!       bool is_movable() const { return (state!=DEAD && state!=RESURRECTED && 
state!=DISAPPEARING); }
          bool is_flying() const { return state == JUMPING; }
          bool is_on_floor() const;
***************
*** 1059,1073 ****
              set_attrib("controllers", Value(3.0));
          }
  
!         void on_hit(Actor *a) {
!             if (dynamic_cast<BlackBall*>(a) &&
!                 int_attrib("mouseforce") != 0)
!                 // passive small whiteball do not shatter (see PerOxyd 
Linkgame #60)
!             {
!                 // collision between WhiteBall_Small and blackball shatters 
blackball
! //                 SendMessage(a, "shatter");
!             }
          }
      };
  }
  
--- 1043,1071 ----
              set_attrib("controllers", Value(3.0));
          }
+     };
  
!     class Killerball : public Actor {
!         CLONEACTOR(Killerball);
!     public:
! 
!         Killerball() : Actor ("ac-killerball", V2()) {
!             world::ActorInfo *ai = get_actorinfo();
!             ai->radius = 13/64.0;
!             ai->mass = 0.7;
! 
!             assert(ai->radius <= Actor::get_max_radius());
! 
!             set_attrib("mouseforce", Value(2.0));
!             set_attrib("color", Value(1.0));
!             set_attrib("whiteball", Value(true));
!             set_attrib("controllers", Value(3.0));
          }
+         bool is_dead() const { return false; }
+ 
+       void on_hit(Actor *a) {
+           SendMessage(a, "shatter");
+       }
      };
+ 
  }
  





reply via email to

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