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

Diff of /enigma/src/items.cc

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

revision 1.46 by dheck, Mon Jun 16 21:41:31 2003 UTC revision 1.47 by reallysoft, Tue Jun 17 17:14:12 2003 UTC
# Line 369  bool Line 369  bool
369  Hollow::actor_hit(Actor *a)  Hollow::actor_hit(Actor *a)
370  {  {
371      if (whiteball==0 && a->is_kind("ac-whiteball-small") && near_center_p(a)) {      if (whiteball==0 && a->is_kind("ac-whiteball-small") && near_center_p(a)) {
372          whiteball = a;          whiteball  = a;
373          enter_time = SDL_GetTicks();          enter_time = SDL_GetTicks();
374      }      }
375      else if (whiteball==a) {      else if (whiteball==a) {
376          if (!near_center_p(a))          if (!near_center_p(a))
377              whiteball=0;              whiteball = 0;
378          else          else
379              check_if_level_finished();              check_if_level_finished();
380      }      }
381      return false;      return false;
382  }  }
383    
384  /* If every hollow in the level (a) contains a small white ball and  /* If (a) every hollow in the level contains a small white ball,
385     (b) this ball has been inside the hollow for at least MINTIME     (b) the number of small white balls and hollows is equal
386       (c) the ball has been inside the hollow for at least MINTIME
387     milliseconds, finish the level. */     milliseconds, finish the level. */
388  void  void
389  Hollow::check_if_level_finished()  Hollow::check_if_level_finished()
390  {  {
391      const unsigned MINTIME=1000;      const unsigned MINTIME = 1000;
392      for (unsigned i=0; i<instances.size(); ++i) {  
393        unsigned size = instances.size();
394        for (unsigned i=0; i<size; ++i) {
395          Hollow *h=(Hollow*) instances[i];          Hollow *h=(Hollow*) instances[i];
396          if (!h->whiteball || SDL_GetTicks() - h->enter_time < MINTIME)          if (!h->whiteball || SDL_GetTicks() - h->enter_time < MINTIME)
397              return;              return;
398      }      }
399    
400        if (size != player::CountActorsOfKind("ac-whiteball-small"))
401            return;
402    
403      enigma::FinishLevel();      enigma::FinishLevel();
404  }  }
405    
# Line 551  Explosion::animcb() Line 558  Explosion::animcb()
558          SetItem(get_pos(), MakeItem("it-debris"));          SetItem(get_pos(), MakeItem("it-debris"));
559          break;          break;
560      }      }
561    
562  }  }
563    
564    
# Line 744  namespace Line 752  namespace
752      };      };
753  }  }
754    
755  void BlackBomb::burn()  void BlackBomb::burn()
756  {  {
757      if (!m_burning) {      if (!m_burning) {
758          m_burning=true;          m_burning=true;
# Line 1386  namespace Line 1394  namespace
1394          void crack(const GridPos &p) {          void crack(const GridPos &p) {
1395              if (Item *it = GetItem(p))              if (Item *it = GetItem(p))
1396                  SendMessage (it, "crack");                  SendMessage (it, "crack");
1397              else if (Floor *fl = GetFloor(p))              else if (Floor *fl = GetFloor(p))
1398                  if (fl->get_kind() != "fl-abyss" && do_crack()) {                  if (fl->get_kind() != "fl-abyss" && do_crack()) {
1399                      SetItem(p, MakeItem("it-crack"));                      SetItem(p, MakeItem("it-crack"));
1400                  }                  }

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.47

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