/[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.32 by sfennig, Sun Mar 16 17:32:07 2003 UTC revision 1.33 by sfennig, Sun Mar 16 19:49:24 2003 UTC
# Line 3334  namespace Line 3334  namespace
3334  }  }
3335    
3336  //----------------------------------------  //----------------------------------------
3337    // BombStone1
3338    //
3339    // These stones add a bomb to the player's inventory when touched.
3340    //----------------------------------------
3341    namespace
3342    {
3343        class BombStone1 : public Stone {
3344            CLONEOBJ(BombStone1);
3345            const char *collision_sound() {return "st-stone";}
3346        public:
3347            BombStone1() : Stone("st-bombs1"),state(IDLE) {}
3348        private:
3349            enum State { IDLE, BREAK };
3350            State state;
3351            void actor_hit(const StoneContact &sc);
3352            void change_state (State newstate) {
3353                if (newstate == BREAK) {
3354                    state = BREAK;
3355                    play_sound("explosion1");
3356                    set_anim("st-bombs1-anim");
3357                }
3358            }
3359            void animcb() {
3360                if (state == BREAK)
3361                    KillStone(get_pos());
3362            }
3363            void BombStone1::message(const string &msg, const Value &) {
3364                if (msg =="expl")
3365                    change_state(BREAK);
3366            }
3367         };
3368      }
3369            void BombStone1::actor_hit(const StoneContact &sc)
3370            {
3371                if (player::Inventory *inv = get_inventory(sc.actor))
3372            {
3373                if (!inv->is_full())
3374            {
3375                Item *it = MakeItem("it-blackbomb");
3376                inv->add_item(it);
3377            }
3378        }
3379    }
3380    
3381    //----------------------------------------
3382  // GlassStone  // GlassStone
3383  //  //
3384  // Laser light may pass this stone, but actors may not.  // Laser light may pass this stone, but actors may not.
# Line 3570  ObjectRepos::ObjectRepos() Line 3615  ObjectRepos::ObjectRepos()
3615      add_templ(new BlackStone4);      add_templ(new BlackStone4);
3616      add_templ(new BolderStone);      add_templ(new BolderStone);
3617      add_templ(new BombStone);      add_templ(new BombStone);
3618        add_templ(new BombStone1);
3619      add_templ(new BrickMagic);      add_templ(new BrickMagic);
3620      add_templ(new Brownie);      add_templ(new Brownie);
3621      add_templ(new ChameleonStone);      add_templ(new ChameleonStone);

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33

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