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

Diff of /enigma/src/stones_simple.cc

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

revision 1.9 by dheck, Mon Jun 16 21:46:04 2003 UTC revision 1.10 by dheck, Tue Jun 17 23:11:41 2003 UTC
# Line 354  namespace Line 354  namespace
354          Window() : Stone("st-window"), state(IDLE) {}          Window() : Stone("st-window"), state(IDLE) {}
355      private:      private:
356          bool on_laserhit(Direction /*dir*/) { return true; }          bool on_laserhit(Direction /*dir*/) { return true; }
357          enum State { IDLE, BREAK };          enum State { IDLE, BREAK } state;
         State state;  
358          void actor_hit(const StoneContact &sc)          void actor_hit(const StoneContact &sc)
359          {          {
360              Actor *a = sc.actor;              Actor *a = sc.actor;
361              if( state == IDLE)              if (state == IDLE)
362              {              {
363                  if (a->get_vel() * sc.normal < -25 ) {                  if (a->get_vel() * sc.normal < -25 ) {
364                      play_sound("shatter");                      play_sound("shatter");
# Line 412  namespace Line 411  namespace
411          State state;          State state;
412    
413          void break_me() {          void break_me() {
414              play_sound("explosion1");              if (state == IDLE) {
415              state = BREAK;                  state = BREAK;
416              set_anim("st-stone_break-anim");                  play_sound("explosion1");
417                    set_anim("st-stone_break-anim");
418                }
419          }          }
420    
421          void actor_hit(const StoneContact &sc)          void actor_hit(const StoneContact &sc) {
422          {              if (wielded_item_is(sc.actor, "it-hammer"))
             if( state == IDLE && wielded_item_is(sc.actor, "it-hammer")) {  
423                  break_me();                  break_me();
             }  
424          }          }
425          bool on_laserhit(Direction) {          bool on_laserhit(Direction) {
426              break_me();              break_me();
427              return false;              return false;
428          }          }
429          void animcb() {          void animcb() { KillStone(get_pos()); }
             if (state == BREAK) {  
                 KillStone(get_pos());  
             }  
         }  
430      };      };
431    
432  }  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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