/[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.27 by sfennig, Sat Mar 8 15:39:16 2003 UTC revision 1.28 by dheck, Thu Mar 13 18:07:39 2003 UTC
# Line 258  namespace Line 258  namespace
258          virtual void init_model();          virtual void init_model();
259    
260          // Floor interface          // Floor interface
261          virtual px::V3 get_force(Actor *a);          virtual px::V2 get_force(Actor *a);
262      };      };
263  }  }
264    
# Line 285  void Gradient::init_model() Line 285  void Gradient::init_model()
285      set_model(mname);      set_model(mname);
286  }  }
287    
288  px::V3  px::V2
289  Gradient::get_force(Actor *a)  Gradient::get_force(Actor *a)
290  {  {
291      V3 force;      V2 force;
292      int t = get_type();      int t = get_type();
293    
294      static int xforce[MAXTYPE-MINTYPE+1] = {      static int xforce[MAXTYPE-MINTYPE+1] = {
# Line 307  Gradient::get_force(Actor *a) Line 307  Gradient::get_force(Actor *a)
307          -1, -1,  1,  1,          -1, -1,  1,  1,
308           1, -1,  0,  0           1, -1,  0,  0
309      };      };
310      force = V3(xforce[t-MINTYPE], yforce[t-MINTYPE], 0);      force = V2(xforce[t-MINTYPE], yforce[t-MINTYPE]);
311      force.normalize();      force.normalize();
312      return 25*force;      return 25*force;
313  }  }
# Line 430  void Bridge::animcb() Line 430  void Bridge::animcb()
430    
431  class WhiteTile : public Floor {  class WhiteTile : public Floor {
432  public:  public:
433      V3 get_force(Actor *a, V3 mouseforce) {      V2 get_force(Actor *a, V2 mouseforce) {
434          if (a->get_attrib("blackball"))          if (a->get_attrib("blackball"))
435              return Floor::get_force(a, 0);              return Floor::get_force(a, 0);
436          else          else
# Line 440  public: Line 440  public:
440    
441  class BlackTile : public Floor {  class BlackTile : public Floor {
442  public:  public:
443      V3 get_force(Actor *a, V3 mouseforce) {      V2 get_force(Actor *a, V2 mouseforce) {
444          if (a->get_attrib("whiteball"))          if (a->get_attrib("whiteball"))
445              return Floor::get_force(a, 0);              return Floor::get_force(a, 0);
446          else          else
# Line 505  Stone::Stone(const char * kind) Line 505  Stone::Stone(const char * kind)
505      : TGridObject<GRID_STONES>(kind)      : TGridObject<GRID_STONES>(kind)
506  {}  {}
507    
508  px::V3  px::V2
509  Stone::actor_impulse(const StoneContact &sc)  Stone::actor_impulse(const StoneContact &sc)
510  {  {
511      V3 normal = normalize(sc.normal);      V2 normal = normalize(sc.normal);
512      const V3 &v = sc.actor->get_vel();      const V2 &v = sc.actor->get_vel();
513      return -2*(v*normal)*normal;      return -2*(v*normal)*normal;
514  }  }
515    
# Line 883  namespace Line 883  namespace
883      public:      public:
884          BlockStone() : MovableStone("st-block") {}          BlockStone() : MovableStone("st-block") {}
885      private:      private:
886          V3 get_center() const {          V2 get_center() const {
887              GridPos p = get_pos();              GridPos p = get_pos();
888              return V3(p.x+0.5, p.y+0.5,0);              return V2(p.x+0.5, p.y+0.5);
889          }          }
890    
891          void on_move(){          void on_move(){
# Line 1027  namespace Line 1027  namespace
1027      private:      private:
1028          enum State { IDLE, FRAGILE, BREAK };          enum State { IDLE, FRAGILE, BREAK };
1029          State state;          State state;
1030          void change_state(State newstate) {          void change_state (State newstate) {
1031              if (newstate == BREAK) {              if (newstate == BREAK) {
1032                  state = BREAK;                  state = BREAK;
1033                  play_sound("explosion1");                  play_sound("explosion1");
# Line 1041  namespace Line 1041  namespace
1041                  if (sc.actor->get_attrib("whiteball"))                  if (sc.actor->get_attrib("whiteball"))
1042                      state = FRAGILE;                      state = FRAGILE;
1043              }              }
1044              if( state == FRAGILE) {              if (state == FRAGILE) {
1045                  if (wielded_item_is(sc.actor, "it-hammer"))                  if (wielded_item_is(sc.actor, "it-hammer"))
1046                      change_state(BREAK);                      change_state(BREAK);
1047              }              }

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

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