/[enigma]/enigma/src/stones_complex.cc
ViewVC logotype

Diff of /enigma/src/stones_complex.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.41 by mhawlisch, Wed Aug 20 15:05:14 2003 UTC revision 1.42 by mhawlisch, Mon Aug 25 13:09:10 2003 UTC
# Line 822  namespace{ Line 822  namespace{
822      class VulcanoStone : public Stone {      class VulcanoStone : public Stone {
823          CLONEOBJ(VulcanoStone);          CLONEOBJ(VulcanoStone);
824      public:      public:
825          enum State {INACTIVE, ACTIVE, FINISHED};          enum State {INACTIVE, ACTIVE, FINISHED, BREAKING};
826          VulcanoStone( State initstate=INACTIVE) : Stone("st-vulcano"), state( initstate) {}          VulcanoStone( State initstate=INACTIVE) : Stone("st-vulcano"), state( initstate) {}
827      private:      private:
828          enum State state;          enum State state;
# Line 832  namespace{ Line 832  namespace{
832                  case FINISHED:                  case FINISHED:
833                  case INACTIVE: set_model( "st-plain"); break;                  case INACTIVE: set_model( "st-plain"); break;
834                  case ACTIVE: set_anim( "st-farting"); break;                  case ACTIVE: set_anim( "st-farting"); break;
835              }                  case BREAKING: set_anim("st-stone_break-anim"); break;
836               }
837          }          }
838                    
839          void animcb() {          void animcb() {
840              // Spread              if( state == ACTIVE) {
841              GridPos p = get_pos();                  // Spread
842              if( DoubleRand(0, 1) > 0.7) spread (move(p, NORTH));                  GridPos p = get_pos();
843              if( DoubleRand(0, 1) > 0.7) spread (move(p, EAST));                  if( DoubleRand(0, 1) > 0.7) spread (move(p, NORTH));
844              if( DoubleRand(0, 1) > 0.7) spread (move(p, SOUTH));                  if( DoubleRand(0, 1) > 0.7) spread (move(p, EAST));
845              if( DoubleRand(0, 1) > 0.7) spread (move(p, WEST));                  if( DoubleRand(0, 1) > 0.7) spread (move(p, SOUTH));
846                    if( DoubleRand(0, 1) > 0.7) spread (move(p, WEST));
847              // Be finished at random time      
848              if( DoubleRand(0, 1) > 0.95)                  // Be finished at random time
849                  state = FINISHED;                  if( DoubleRand(0, 1) > 0.95)
850              init_model();                                      state = FINISHED;
851                    init_model();
852                } else if( state == BREAKING) {
853                    KillStone( get_pos());
854                }
855          }          }
856    
857          void message(const string &msg, const Value &val) {          void message(const string &msg, const Value &val) {
# Line 866  namespace{ Line 871  namespace{
871                  SendMessage( it, "grow");                  SendMessage( it, "grow");
872              }              }
873          }          }
874    
875            void actor_hit(const StoneContact &sc) {
876                Actor *a = sc.actor;
877    
878                if( state == ACTIVE && player::wielded_item_is(a, "it-hammer")) {
879                    state = BREAKING;
880                    init_model();
881                }
882            }
883      };      };
884  }  }
885    

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26