/[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.25 by dheck, Thu Feb 27 14:16:14 2003 UTC revision 1.26 by mhawlisch, Wed Mar 5 12:18:22 2003 UTC
# Line 2579  namespace Line 2579  namespace
2579    
2580    
2581  //----------------------------------------  //----------------------------------------
2582    // ActorImpulseStone Invisible
2583    //----------------------------------------
2584    namespace
2585    {
2586        class ActorImpulseStoneInvisible : public Stone {
2587            CLONEOBJ(ActorImpulseStoneInvisible);
2588        public:
2589            ActorImpulseStoneInvisible() : Stone("st-actorimpulse_invisible"), state(IDLE) {}
2590        private:
2591            enum State { IDLE, PULSING, BROKEN };
2592            State state;
2593            
2594            void actor_hit (const StoneContact &sc) {
2595                if (state == IDLE) {
2596                    double forcefac = 200;
2597                    sc.actor->add_force (forcefac * normalize(sc.normal));
2598                    play_sound("impulse");
2599                    set_anim("st-actorimpulse-anim");
2600                    state = PULSING;
2601                }
2602            }
2603    
2604            void animcb() {
2605                if (state == PULSING) {
2606                    state = IDLE;
2607                    init_model();
2608                }
2609            }
2610            
2611            //void init_model() {
2612            //      if( state == IDLE)
2613            //              set_model("invisible");
2614            //}
2615        };
2616    }
2617    
2618    
2619    //----------------------------------------
2620  // StoneImpulseStone  // StoneImpulseStone
2621  //  //
2622  // Messages:  // Messages:
# Line 3341  namespace Line 3379  namespace
3379    
3380    
3381  //----------------------------------------  //----------------------------------------
3382    // DeathStone Invisible
3383    //----------------------------------------
3384    
3385    /** \page st-death_invisible Death's Head Stone invivible
3386    
3387    Simply kills all actors that touch it (except for actors that are
3388    immune to these stones). This variant is invisible.
3389    
3390    \image html st-death.png
3391    */
3392    namespace
3393    {
3394        class DeathStoneInvisible : public Stone {
3395            CLONEOBJ(DeathStoneInvisible);
3396        public:
3397            DeathStoneInvisible() : Stone("st-death_invisible"), active(false) {}
3398        private:
3399            bool active;
3400            void actor_hit(const StoneContact &sc)
3401            {
3402                if (!active) {
3403                    SendMessage(sc.actor, "shatter");
3404                    active=true;
3405                    set_anim("st-death-munch");
3406                }
3407            }
3408            void animcb() { set_model("st-death_invisible"); active=false; }
3409        };
3410    }
3411    
3412    
3413    //----------------------------------------
3414  // Coin slot Switch  // Coin slot Switch
3415  //----------------------------------------  //----------------------------------------
3416    
# Line 3487  ObjectRepos::ObjectRepos() Line 3557  ObjectRepos::ObjectRepos()
3557      add_templ(new ChameleonStone);      add_templ(new ChameleonStone);
3558      add_templ(new CoinSlot);      add_templ(new CoinSlot);
3559      add_templ(new DeathStone);      add_templ(new DeathStone);
3560        add_templ(new DeathStoneInvisible);
3561      add_templ(new Door);      add_templ(new Door);
3562      add_templ(new Door_a);      add_templ(new Door_a);
3563      add_templ(new Door_b);      add_templ(new Door_b);
# Line 3512  ObjectRepos::ObjectRepos() Line 3583  ObjectRepos::ObjectRepos()
3583      add_templ(new RubberBandStone);      add_templ(new RubberBandStone);
3584      add_templ(new ShogunStone);      add_templ(new ShogunStone);
3585      add_templ(new ActorImpulseStone);      add_templ(new ActorImpulseStone);
3586        add_templ(new ActorImpulseStoneInvisible);
3587      add_templ(new StoneImpulseStone);      add_templ(new StoneImpulseStone);
3588      add_templ(new SwapStone);      add_templ(new SwapStone);
3589      add_templ(new SwitchStone);      add_templ(new SwitchStone);

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

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