/[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.16 by mhawlisch, Wed Apr 2 09:16:46 2003 UTC revision 1.17 by mhawlisch, Wed Apr 2 09:56:39 2003 UTC
# Line 1119  namespace Line 1119  namespace
1119      class Crack : public Item {      class Crack : public Item {
1120          CLONEOBJ(Crack);          CLONEOBJ(Crack);
1121      public:      public:
1122          Crack() : Item("it-crack") {set_attrib("type", 0.0);}          Crack() : Item("it-crack"),anim_end(false) {set_attrib("type", 0.0);}
1123      private:      private:
1124            bool anim_end;
1125            
1126          int get_type() const { return int_attrib("type"); }          int get_type() const { return int_attrib("type"); }
1127    
1128          void init_model() {          void init_model() {
1129              if (int t=get_type()) {              if (int t=get_type()) {
1130                  if( t > 3)                  if( t > 3)
1131                      SetItem(get_pos(), MakeItem("it-debris"));                      set_anim("it-crack_anim1");                
1132                        //SetItem(get_pos(), MakeItem("it-debris"));
1133                  else {                  else {
1134                      char modelname[20];                      char modelname[20];
1135                      sprintf(modelname, "it-crack%d", t);                      sprintf(modelname, "it-crack%d", t);
# Line 1136  namespace Line 1139  namespace
1139              else              else
1140                  set_model("invisible");                  set_model("invisible");
1141          }          }
1142            void animcb() {
1143                if( anim_end) {
1144                    GridPos p= get_pos();
1145                    SetFloor(p, MakeFloor("fl-abyss"));
1146                    KillItem(p);
1147                } else {
1148                    anim_end = true;
1149                    set_anim("it-crack_anim2");
1150                }
1151            }
1152          void actor_enter(Actor *a) {          void actor_enter(Actor *a) {
1153              SendMessage(this, "crack");              SendMessage(this, "crack");
1154              Item *it;  
1155              GridPos p;              if( get_type() < 3) {
1156                        Item *it;
1157              p = move(get_pos(),enigma::NORTH);                  GridPos p;
1158              it = GetItem(p);          
1159                                p = move(get_pos(),enigma::NORTH);
1160              if( it)                  it = GetItem(p);
1161                  SendMessage( it, "crack");                  
1162              else                  if( it)
1163                  SetItem(p, MakeItem("it-crack"));                      SendMessage( it, "crack");
1164                        else {
1165              p = move(get_pos(),enigma::EAST);                      Floor *fl = GetFloor(p);
1166              it = GetItem(p);                      if( fl->get_kind() != "fl-abyss")
1167              if( it)                          SetItem(p, MakeItem("it-crack"));
1168                  SendMessage( it, "crack");                  }
1169              else          
1170                  SetItem(p, MakeItem("it-crack"));                  p = move(get_pos(),enigma::EAST);
1171                        it = GetItem(p);
1172              p = move(get_pos(),enigma::SOUTH);                  if( it)
1173              it = GetItem(p);                      SendMessage( it, "crack");
1174              if( it)                  else {
1175                  SendMessage( it, "crack");                      Floor *fl = GetFloor(p);
1176              else                      if( fl->get_kind() != "fl-abyss")
1177                  SetItem(p, MakeItem("it-crack"));                          SetItem(p, MakeItem("it-crack"));
1178                        }
1179              p = move(get_pos(),enigma::WEST);          
1180              it = GetItem(p);                  p = move(get_pos(),enigma::SOUTH);
1181              if( it)                  it = GetItem(p);
1182                  SendMessage( it, "crack");                  if( it)
1183              else                      SendMessage( it, "crack");
1184                  SetItem(p, MakeItem("it-crack"));                  else {
1185                        Floor *fl = GetFloor(p);
1186                        if( fl->get_kind() != "fl-abyss")
1187                            SetItem(p, MakeItem("it-crack"));
1188                    }
1189            
1190                    p = move(get_pos(),enigma::WEST);
1191                    it = GetItem(p);
1192                    if( it)
1193                        SendMessage( it, "crack");
1194                    else {
1195                        Floor *fl = GetFloor(p);
1196                        if( fl->get_kind() != "fl-abyss")
1197                            SetItem(p, MakeItem("it-crack"));
1198                    }
1199                }
1200          }          }
1201          bool actor_hit(Actor *a) {          bool actor_hit(Actor *a) {
1202                    if( anim_end)
1203                            SendMessage(a, "fall");
1204              return false;              return false;
1205          }          }
1206          void message(const string &msg, const Value &val) {          void message(const string &msg, const Value &val) {

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

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