enigma-cvs
[Top][All Lists]
Advanced

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

[Enigma-cvs] enigma/src stones_complex.cc,1.45.2.6,1.45.2.7


From: Daniel Heck <address@hidden>
Subject: [Enigma-cvs] enigma/src stones_complex.cc,1.45.2.6,1.45.2.7
Date: Sat, 11 Oct 2003 12:37:26 +0000

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

Modified Files:
      Tag: enigma0_80_rc
        stones_complex.cc 
Log Message:
Coinslot: use other model if active


Index: stones_complex.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/stones_complex.cc,v
retrieving revision 1.45.2.6
retrieving revision 1.45.2.7
diff -C2 -d -r1.45.2.6 -r1.45.2.7
*** stones_complex.cc   6 Oct 2003 19:31:33 -0000       1.45.2.6
--- stones_complex.cc   11 Oct 2003 12:37:24 -0000      1.45.2.7
***************
*** 2464,2485 ****
  //----------------------------------------
  
- /** \page st-coinslot Coin Slot Stone
- 
- Coin Slots are switches that must be activated by inserting coins.
- The more coins you put in, the longer the switch will stay activated
- 
- \subsection coinslota Attributes
- 
- - \b cost            how many on-time bought for coin1
- - \b interval        on-time remaining
- - \b target, \b action   as usual
- 
- \subsection coinslote Example
- 
- \verbatim
- set_stone("st-coinslot", 20,13,{action="openclose", target="door", cost=1})
- \endverbatim
- */
- 
  namespace
  {
--- 2464,2467 ----
***************
*** 2493,2507 ****
          double remaining_time;
  
!         // Private methods.
!         void init_model() {
!             set_model(state==ACTIVE ? "st-coinslot" : "st-coinslot");
!             // st-coinslot-filled
!         }
  
          void actor_hit(const StoneContact &sc);
          const char *collision_sound() { return "st-metal"; }
  
!         void animcb() { init_model(); }
!         void tick(double dtime);
          void change_state(State newstate);
      };
--- 2475,2490 ----
          double remaining_time;
  
!         // GridObject interface
!         void init_model();
!         void animcb();
! 
!         // TimeHandler interface
!         void tick(double dtime);
  
+         // Stone interface
          void actor_hit(const StoneContact &sc);
          const char *collision_sound() { return "st-metal"; }
  
!         // Private methods.
          void change_state(State newstate);
      };
***************
*** 2511,2519 ****
  : OnOffStone("st-coinslot"), state(INACTIVE), remaining_time(0)
  {
-     set_attrib("cost", 1.0);
  }
  
! void
! CoinSlot::change_state(State newstate)
  {
      if (state == newstate) return;
--- 2494,2505 ----
  : OnOffStone("st-coinslot"), state(INACTIVE), remaining_time(0)
  {
  }
  
! void CoinSlot::init_model() {
!     set_model(state==ACTIVE ? "st-coinslot-active" : "st-coinslot");
! }
! 
! 
! void CoinSlot::change_state(State newstate)
  {
      if (state == newstate) return;
***************
*** 2530,2537 ****
      }
      state = newstate;
  }
  
! void
! CoinSlot::tick(double dtime)
  {
      assert(remaining_time > 0);
--- 2516,2528 ----
      }
      state = newstate;
+     init_model();
  }
  
! void CoinSlot::animcb() { 
!     change_state(ACTIVE);
!     init_model(); 
! }
! 
! void CoinSlot::tick(double dtime)
  {
      assert(remaining_time > 0);
***************
*** 2539,2549 ****
      remaining_time -= dtime;
      if (remaining_time <= 0)
-     {
          change_state(INACTIVE);
-     }
  }
  
! void
! CoinSlot::actor_hit(const StoneContact &sc)
  {
      if (player::wielded_item_is(sc.actor, "it-coin"))
--- 2530,2537 ----
      remaining_time -= dtime;
      if (remaining_time <= 0)
          change_state(INACTIVE);
  }
  
! void CoinSlot::actor_hit(const StoneContact &sc)
  {
      if (player::wielded_item_is(sc.actor, "it-coin"))
***************
*** 2559,2563 ****
  
              set_anim("st-coin2slot");
-             change_state(ACTIVE);
              delete it;
          }
--- 2547,2550 ----





reply via email to

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