enigma-cvs
[Top][All Lists]
Advanced

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

[Enigma-cvs] enigma/src stones_simple.cc,1.61,1.62


From: Ralf Westram <address@hidden>
Subject: [Enigma-cvs] enigma/src stones_simple.cc,1.61,1.62
Date: Sun, 09 Nov 2003 11:58:31 +0000

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

Modified Files:
        stones_simple.cc 
Log Message:
- added YinYangStone3
- if marble starts in or is warped into a yinyang stone, it gets grabbed (see 
PerOxyd 2p #64).
  if yinyang stone turns to marble color, the marble is released.



Index: stones_simple.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/stones_simple.cc,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** stones_simple.cc    1 Nov 2003 23:43:42 -0000       1.61
--- stones_simple.cc    9 Nov 2003 11:58:28 -0000       1.62
***************
*** 1897,1900 ****
--- 1897,1916 ----
      protected:
  
+         void releaseActors(int color) {
+             vector<Actor*> actors;
+ 
+             if (GetActorsInsideField(get_pos(), actors))
+                 for (unsigned i = 0; i<actors.size(); ++i) {
+                     Actor *a = actors[i];
+ 
+                     if (a->get_actorinfo()->grabbed &&
+                         a->get_attrib("color") &&
+                         a->int_attrib("color") == color)
+                     {
+                         ReleaseActor(a);
+                     }
+                 }
+         }
+ 
          void turn_white() {
              assert(state == NOCOLOR);
***************
*** 1902,1905 ****
--- 1918,1922 ----
              init_model();
              play_sound("st-magic");
+             releaseActors(1); // white actors
          }
          void turn_black() {
***************
*** 1908,1918 ****
              init_model();
              play_sound("st-magic");
          }
  
          bool is_uncolored() const { return state == NOCOLOR; }
  
-     private:
          enum State { NOCOLOR, WHITE, BLACK } state;
  
          void init_model() {
              switch (state) {
--- 1925,1936 ----
              init_model();
              play_sound("st-magic");
+             releaseActors(0); // black actors
          }
  
          bool is_uncolored() const { return state == NOCOLOR; }
  
          enum State { NOCOLOR, WHITE, BLACK } state;
  
+     private:
          void init_model() {
              switch (state) {
***************
*** 1923,1926 ****
--- 1941,1950 ----
          }
  
+         void actor_inside(Actor *a) {
+             if (is_uncolored() && !a->get_actorinfo()->grabbed) {
+                 GrabActor(a);
+             }
+         }
+ 
          StoneResponse collision_response(const StoneContact &sc)
          {
***************
*** 1972,1975 ****
--- 1996,2028 ----
  }
  
+ //----------------------------------------
+ // YinYang stone 3 (Per.Oxyd compatible)
+ //----------------------------------------
+ namespace
+ {
+     class YinYangStone3 : public YinYangStone {
+         CLONEOBJ(YinYangStone3);
+     public:
+         YinYangStone3() : YinYangStone("st-yinyang3") {}
+     private:
+         void init_model() {
+             switch (state) {
+                 case NOCOLOR: set_model(get_kind()); break;
+                 case WHITE: set_model("st-white4"); break;
+                 case BLACK: set_model("st-black4"); break;
+             }
+         }
+         void actor_hit(const StoneContact &sc) {
+             if (is_uncolored() &&
+                 (player::wielded_item_is(sc.actor, "it-magicwand") ||
+                  player::wielded_item_is(sc.actor, "it-brush")))
+             {
+                 if      (sc.actor->get_attrib("blackball")) turn_white();
+                 else if (sc.actor->get_attrib("whiteball")) turn_black();
+             }
+         }
+     };
+ }
+ 
  
  //----------------------------------------
***************
*** 2400,2403 ****
      Register(new YinYangStone1);
      Register(new YinYangStone2);
! 
  }
--- 2453,2456 ----
      Register(new YinYangStone1);
      Register(new YinYangStone2);
!     Register(new YinYangStone3);
  }





reply via email to

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