/[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.2 by dheck, Sun May 18 19:09:14 2003 UTC revision 1.3 by reallysoft, Mon May 19 12:14:35 2003 UTC
# Line 80  namespace Line 80  namespace
80              }              }
81          }          }
82    
83          void actor_hit (const StoneContact &sc) {          void actor_hit (const StoneContact &/*sc*/) {
84    
85          }          }
86      };      };
# Line 196  namespace Line 196  namespace
196                      set_move_state(false, move_dir);                      set_move_state(false, move_dir);
197                      newStone->set_move_state(true, move_dir);                      newStone->set_move_state(true, move_dir);
198    
199                      if (grabbedActor = dynamic_cast<Actor*>(impulse.sender)) {                      if (( grabbedActor = dynamic_cast<Actor*>(impulse.sender) )) {
200                          ActorInfo *ai = grabbedActor->get_actorinfo();                          ActorInfo *ai = grabbedActor->get_actorinfo();
201                          after_vel       = ai->vel;                          after_vel       = ai->vel;
202    
# Line 305  namespace Line 305  namespace
305  {  {
306      class OneWayStone : public OneWayBase {      class OneWayStone : public OneWayBase {
307      public:      public:
308          OneWayStone(Direction dir=SOUTH) : OneWayBase("st-oneway", dir) {}          OneWayStone(Direction dir=SOUTH) : OneWayBase("st-oneway", dir) {}
309      private:      private:
310          CLONEOBJ(OneWayStone);          CLONEOBJ(OneWayStone);
311          virtual bool actor_may_pass (Actor *a) { return true; }          virtual bool actor_may_pass (Actor */*a*/) { return true; }
312      };      };
313    
314    
315      class OneWayStone_black : public OneWayBase {      class OneWayStone_black : public OneWayBase {
316      public:      public:
317          OneWayStone_black(Direction dir=SOUTH)          OneWayStone_black(Direction dir=SOUTH)
318          : OneWayBase("st-oneway_black",dir) {}              : OneWayBase("st-oneway_black",dir) {}
319      private:      private:
320          CLONEOBJ(OneWayStone_black);          CLONEOBJ(OneWayStone_black);
321          virtual bool actor_may_pass (Actor *a) {          virtual bool actor_may_pass (Actor *a) {
# Line 325  namespace Line 325  namespace
325    
326      class OneWayStone_white : public OneWayBase {      class OneWayStone_white : public OneWayBase {
327      public:      public:
328          OneWayStone_white(Direction dir=SOUTH)          OneWayStone_white(Direction dir=SOUTH)
329          : OneWayBase("st-oneway_white", dir) {}              : OneWayBase("st-oneway_white", dir) {}
330      private:      private:
331          CLONEOBJ(OneWayStone_white);          CLONEOBJ(OneWayStone_white);
332          virtual bool actor_may_pass (Actor *a) {          virtual bool actor_may_pass (Actor *a) {
# Line 465  namespace Line 465  namespace
465          }          }
466    
467          void alarm() {          void alarm() {
468              state              = MOVING;              state = MOVING;
469              GridPos   last_pos = get_pos();              move_stone(get_dir());
             Direction dir      = get_dir();  
   
             move_stone(dir);  
470              state = IDLE;              state = IDLE;
471          }          }
472    
# Line 575  namespace { Line 572  namespace {
572                  case GROWING:                  case GROWING:
573                      change_state(SOLID);                      change_state(SOLID);
574                      break;                      break;
575                    default :
576                        assert(0);
577                        break;
578              }              }
579          }          }
580    
# Line 686  namespace Line 686  namespace
686          void maybe_move_cluster(Cluster &c, bool is_complete, Direction dir);          void maybe_move_cluster(Cluster &c, bool is_complete, Direction dir);
687          void rotate_cluster(const Cluster &c);          void rotate_cluster(const Cluster &c);
688    
689          bool on_laserhit(Direction dir) {          bool on_laserhit(Direction /*dir*/) {
690              return get_connections() == 0;              return get_connections() == 0;
691          }          }
692    
# Line 791  PuzzleStone::find_row_or_column_cluster( Line 791  PuzzleStone::find_row_or_column_cluster(
791  }  }
792    
793  void  void
794  PuzzleStone::maybe_move_cluster(Cluster &c, bool is_complete, Direction dir)  PuzzleStone::maybe_move_cluster(Cluster &c, bool /*is_complete*/, Direction dir)
795  {  {
796      sort(c.begin(), c.end());      sort(c.begin(), c.end());
797      Cluster mc(c);              // Moved cluster      Cluster mc(c);              // Moved cluster
# Line 890  PuzzleStone::rotate_cluster(const Cluste Line 890  PuzzleStone::rotate_cluster(const Cluste
890  }  }
891    
892  StoneResponse  StoneResponse
893  PuzzleStone::collision_response(const StoneContact &sc)  PuzzleStone::collision_response(const StoneContact &/*sc*/)
894  {  {
895      if (get_connections() == NODIRBIT)      if (get_connections() == NODIRBIT)
896          return STONE_PASS;          return STONE_PASS;
# Line 968  namespace Line 968  namespace
968          void actor_contact(Actor *a);          void actor_contact(Actor *a);
969    
970          void animcb();          void animcb();
971          bool on_laserhit(Direction dir) {return state==OPEN;}          bool on_laserhit(Direction /*dir*/) {return state==OPEN;}
972      };      };
973  }  }
974    
# Line 1009  DoorBase::animcb() Line 1009  DoorBase::animcb()
1009    
1010    
1011  StoneResponse  StoneResponse
1012  DoorBase::collision_response(const StoneContact &sc)  DoorBase::collision_response(const StoneContact &/*sc*/)
1013  {  {
1014      return (state == OPEN) ? STONE_PASS:STONE_REBOUND;      return (state == OPEN) ? STONE_PASS:STONE_REBOUND;
1015  }  }
# Line 1244  ShogunStone::on_impulse(const Impulse& i Line 1244  ShogunStone::on_impulse(const Impulse& i
1244      ShogunStone *target = 0;      ShogunStone *target = 0;
1245    
1246      if (Stone *st = GetStone(destpos)) {      if (Stone *st = GetStone(destpos)) {
1247          target = dynamic_cast<ShogunStone*>(GetStone(destpos));          target = dynamic_cast<ShogunStone*>(st);
1248    
1249          /* If the stone at `p' is not a shogun stone or if smallest hole          /* If the stone at `p' is not a shogun stone or if smallest hole
1250             does not fit into target, do not transfer the smallest hole. */             does not fit into target, do not transfer the smallest hole. */
# Line 1401  namespace Line 1401  namespace
1401              else if (st==CLOSING) set_anim("st-stoneimpulse-anim2");              else if (st==CLOSING) set_anim("st-stoneimpulse-anim2");
1402          }          }
1403    
1404          void actor_hit(const StoneContact &sc) {          void actor_hit(const StoneContact &/*sc*/) {
1405              change_state(PULSING);              change_state(PULSING);
1406          }          }
1407    
# Line 1426  namespace Line 1426  namespace
1426              }              }
1427          }          }
1428    
1429          StoneResponse collision_response(const StoneContact &sc) {          StoneResponse collision_response(const StoneContact &/*sc*/) {
1430              return (state == IDLE) ? STONE_PASS : STONE_REBOUND;              return (state == IDLE) ? STONE_PASS : STONE_REBOUND;
1431          }          }
1432          void actor_inside(Actor *a) {          void actor_inside(Actor *a) {
# Line 1711  OxydStone::maybe_open_stone() Line 1711  OxydStone::maybe_open_stone()
1711  }  }
1712    
1713  void  void
1714  OxydStone::actor_hit(const StoneContact &sc)  OxydStone::actor_hit(const StoneContact &/*sc*/)
1715  {  {
1716      maybe_open_stone();      maybe_open_stone();
1717  }  }
# Line 2053  Turnstile_Pivot_Base::set_arms (Directio Line 2053  Turnstile_Pivot_Base::set_arms (Directio
2053  void  void
2054  Turnstile_Pivot_Base::set_arm (Direction dir)  Turnstile_Pivot_Base::set_arm (Direction dir)
2055  {  {
2056      char *names[4] = { "st-turnstile-w",      const char *names[4] = { "st-turnstile-w", "st-turnstile-s",
2057                         "st-turnstile-s",                               "st-turnstile-e", "st-turnstile-n" };
2058                         "st-turnstile-e",      Stone   *st   = MakeStone(names[dir]);
2059                         "st-turnstile-n" };      GridPos  newp = move(get_pos(), dir);
     Stone *st = MakeStone(names[dir]);  
     GridPos newp = move(get_pos(), dir);  
2060      SetStone (newp, st);      SetStone (newp, st);
2061    
2062      if (Item *it = GetItem(newp))      if (Item *it = GetItem(newp))
# Line 2160  Turnstile_Pivot_Base::handleActorsAndIte Line 2158  Turnstile_Pivot_Base::handleActorsAndIte
2158      // Handle items in range :      // Handle items in range :
2159      for (int i = 0; i<8; ++i) {      for (int i = 0; i<8; ++i) {
2160          if (arm_seen[i]) {          if (arm_seen[i]) {
2161              GridPos pos(pv_pos.x+to_x[i], pv_pos.y+to_y[i]);              GridPos item_pos(pv_pos.x+to_x[i], pv_pos.y+to_y[i]);
2162              if (Item *it = GetItem(pos)) it->on_stonehit(this); // hit with pivot (shouldn't matter)              if (Item *it = GetItem(item_pos)) it->on_stonehit(this); // hit with pivot (shouldn't matter)
2163          }          }
2164      }      }
2165    
# Line 2176  Turnstile_Pivot_Base::handleActorsAndIte Line 2174  Turnstile_Pivot_Base::handleActorsAndIte
2174              int       dx        = ac_pos.x-pv_pos.x;              int       dx        = ac_pos.x-pv_pos.x;
2175              int       dy        = ac_pos.y-pv_pos.y;              int       dy        = ac_pos.y-pv_pos.y;
2176    
2177              if (dx<-1 || dx>1 || dy<-1 || dy>1) { // actor is outside of turnstile              if (dx<-1 || dx>1 || dy<-1 || dy>1) { // actor is outside of turnstile but might get touched
2178                  // @@@ FIXME: test if actor was hit by turnstile -> set actor speed  
2179                    // @@@ FIXME: test if actor was touched by rotating turnstile -> set actor speed
2180    
2181              }              }
2182              else {              // actor is inside the turnstile              else {              // actor is inside the turnstile
2183                  int idx_source = to_index[dx+1][dy+1];                  int idx_source = to_index[dx+1][dy+1];
# Line 2254  Turnstile_Pivot_Base::handleActorsAndIte Line 2254  Turnstile_Pivot_Base::handleActorsAndIte
2254                          SendMessage(*ac, "shatter");                          SendMessage(*ac, "shatter");
2255                          break;                          break;
2256                      }                      }
2257                        case STAY: { // do nothing
2258                            break;
2259                        }
2260                  }                  }
2261    
2262                  // @@@ FIXME: it's possible that two actors are moved to the same destination field.                  // @@@ FIXME: it's possible that two actors are moved to the same destination field.

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

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