DirtY iCE's patch for dead scripting and bomb badguy counting
authorTim Goya <tuxdev103@gmail.com>
Mon, 5 Feb 2007 16:28:08 +0000 (16:28 +0000)
committerTim Goya <tuxdev103@gmail.com>
Mon, 5 Feb 2007 16:28:08 +0000 (16:28 +0000)
SVN-Revision: 4813

src/badguy/badguy.cpp
src/badguy/badguy.hpp
src/badguy/mrbomb.cpp

index fcf3b1f..0d654bb 100644 (file)
@@ -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)
index f7ebbff..7013542 100644 (file)
@@ -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.
index dcd7198..74a0d7e 100644 (file)
@@ -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