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.59,1.60


From: Daniel Heck <address@hidden>
Subject: [Enigma-cvs] enigma/src stones_simple.cc,1.59,1.60
Date: Mon, 27 Oct 2003 22:17:40 +0000

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

Modified Files:
        stones_simple.cc 
Log Message:
* Use new models in Switch
* Use animation  in Switch


Index: stones_simple.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/stones_simple.cc,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** stones_simple.cc    27 Oct 2003 11:48:30 -0000      1.59
--- stones_simple.cc    27 Oct 2003 22:17:38 -0000      1.60
***************
*** 1253,1266 ****
          CLONEOBJ(SwitchStone);
      public:
!         SwitchStone() : OnOffStone("st-switch") {}
      private:
          void init_model() {
!             set_model(is_on() ? "st-switch1" : "st-switch2");
          }
  
          void actor_hit(const StoneContact &/*sc*/) {
              set_on(!is_on());
              PerformAction(this, is_on());
-             play_sound("st-switch");
          }
          const char *collision_sound() { return "st-metal"; }
--- 1253,1279 ----
          CLONEOBJ(SwitchStone);
      public:
!         SwitchStone() : OnOffStone("st-switch"), state(IDLE) {}
      private:
+         enum State { IDLE, TOGGLING } state;
+ 
          void init_model() {
!             set_model(is_on() ? "st-switch-on" : "st-switch-off");
          }
  
          void actor_hit(const StoneContact &/*sc*/) {
+             if (state == IDLE) {
+                 play_sound("st-switch");
+                 state = TOGGLING;
+                 if (is_on())
+                     set_anim("st-switch-turnoff");
+                 else
+                     set_anim("st-switch-turnon");
+             }
+         }
+ 
+         void animcb() {
+             state = IDLE;
              set_on(!is_on());
              PerformAction(this, is_on());
          }
          const char *collision_sound() { return "st-metal"; }





reply via email to

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