From: Tim Goya Date: Mon, 5 Feb 2007 16:28:08 +0000 (+0000) Subject: DirtY iCE's patch for dead scripting and bomb badguy counting X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6b491f2062d0f0a0460b317ccb3aef4b4fed8e7e;p=supertux.git DirtY iCE's patch for dead scripting and bomb badguy counting SVN-Revision: 4813 --- diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index fcf3b1f42..0d654bb25 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -354,6 +354,18 @@ BadGuy::kill_fall() } void +BadGuy::run_dead_script() +{ + if (countMe) Sector::current()->get_level()->stats.badguys++; + + // start dead-script + if(dead_script != "") { + std::istringstream stream(dead_script); + Sector::current()->run_script(stream, "dead-script"); + } +} + +void BadGuy::set_state(State state) { if(this->state == state) diff --git a/src/badguy/badguy.hpp b/src/badguy/badguy.hpp index f7ebbfffc..7013542ec 100644 --- a/src/badguy/badguy.hpp +++ b/src/badguy/badguy.hpp @@ -66,6 +66,9 @@ public: * screen (his sprite is turned upside-down) */ virtual void kill_fall(); + + /** Call this, if you use custom kill_fall() or kill_squashed(GameObject& object) */ + virtual void run_dead_script(); /** Writes out the badguy into the included lisp::Writer. Useful e.g. when * converting an old-format level to the new format. diff --git a/src/badguy/mrbomb.cpp b/src/badguy/mrbomb.cpp index dcd71987d..74a0d7e68 100644 --- a/src/badguy/mrbomb.cpp +++ b/src/badguy/mrbomb.cpp @@ -99,6 +99,8 @@ MrBomb::kill_fall() Bomb* bomb = new Bomb(get_pos(), dir, sprite_name ); Sector::current()->add_object(bomb); bomb->explode(); + + run_dead_script(); } void