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

Diff of /enigma/src/objects.cc

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

revision 1.12 by dheck, Thu Jan 30 20:39:47 2003 UTC revision 1.13 by dheck, Fri Jan 31 17:02:17 2003 UTC
# Line 2575  namespace Line 2575  namespace
2575              return (a->state==BLINKING || a->state==OPENING);              return (a->state==BLINKING || a->state==OPENING);
2576          }          }
2577          static bool not_open(OxydStone *a) {          static bool not_open(OxydStone *a) {
2578              return a->state!=OPEN;              return !(a->state==OPEN || a->state==OPENING);
2579          }          }
2580    
2581          // Stone interface          // Stone interface
# Line 2599  namespace Line 2599  namespace
2599  OxydStone::InstanceList OxydStone::instances;  OxydStone::InstanceList OxydStone::instances;
2600    
2601  OxydStone::OxydStone()  OxydStone::OxydStone()
2602      : PhotoStone("st-oxyd"), state(CLOSED), model_bak(0)  : PhotoStone("st-oxyd")
2603    , state(CLOSED)
2604    , model_bak(0)
2605  {  {
2606      set_attrib("flavor", "b");      set_attrib("flavor", "b");
2607      set_attrib("color", "0");      set_attrib("color", "0");
# Line 2647  OxydStone::change_state(State newstate) Line 2649  OxydStone::change_state(State newstate)
2649    
2650      string modelname = string("st-oxyd") + flavor + color;      string modelname = string("st-oxyd") + flavor + color;
2651    
2652        State oldstate = state;
2653        state = newstate;
2654        
2655      switch (newstate) {      switch (newstate) {
2656      case CLOSED:      case CLOSED:
2657          set_model(string("st-oxyd")+flavor);          set_model(string("st-oxyd")+flavor);
# Line 2657  OxydStone::change_state(State newstate) Line 2662  OxydStone::change_state(State newstate)
2662          break;          break;
2663                    
2664      case OPEN:      case OPEN:
2665          if (state == CLOSED) {          if (oldstate == CLOSED) {
2666              play_sound("st-oxydopen");              play_sound("st-oxydopen");
2667              play_sound("st-oxydopened");              play_sound("st-oxydopened");
2668              set_anim(modelname+"-opening");              set_anim(modelname+"-opening");
2669          } else {          } else {
2670              set_model(modelname + "-open");              set_model(modelname + "-open");
2671            }
2672              /* If this was the last closed oxyd stone, finish the          /* If this was the last closed oxyd stone, finish the
2673                 level */             level */
2674              if (find_if(instances.begin(),instances.end(),not_open)          if (find_if(instances.begin(),instances.end(),not_open)
2675                  ==instances.end())              ==instances.end())
2676              {          {
2677                  enigma::FinishLevel();              enigma::FinishLevel();
             }  
2678          }          }
2679          break;          break;
2680                    
2681      case OPENING:      case OPENING:
2682          play_sound("st-oxydopen");          play_sound("st-oxydopen");
2683          if (state == CLOSED)          if (oldstate == CLOSED)
2684              set_anim(modelname + "-opening");              set_anim(modelname + "-opening");
2685          else if (state == CLOSING)          else if (oldstate == CLOSING)
2686              get_model()->reverse();              get_model()->reverse();
2687    
2688          break;          break;
2689                    
2690      case CLOSING:      case CLOSING:
2691          if (state == CLOSED || state==CLOSING)          if (oldstate == CLOSED || oldstate==CLOSING)
2692              return;              return;
2693    
2694          play_sound("st-oxydclose");          play_sound("st-oxydclose");
2695          if (state == OPENING)          if (oldstate == OPENING)
2696              get_model()->reverse();              get_model()->reverse();
2697          else if (state == BLINKING || state == OPEN) {          else if (oldstate == BLINKING || oldstate == OPEN) {
2698              set_anim(modelname + "-closing");              set_anim(modelname + "-closing");
2699          }          }
2700          break;          break;
2701      }      }
     state = newstate;  
2702  }  }
2703    
2704  void  void

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

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