Don't count angrystone in level stats
[supertux.git] / src / badguy / willowisp.cpp
index bb48cb4..8e582a9 100644 (file)
 #include "object/player.hpp"
 #include "scripting/squirrel_util.hpp"
 #include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
 #include "supertux/game_session.hpp"
 #include "supertux/object_factory.hpp"
 #include "supertux/sector.hpp"
+#include "util/reader.hpp"
 
 static const float FLYSPEED = 64; /**< speed in px per second */
 static const float TRACK_RANGE = 384; /**< at what distance to start tracking the player */
@@ -43,7 +45,8 @@ WillOWisp::WillOWisp(const Reader& reader) :
   walker(),
   flyspeed(),
   track_range(),
-  vanish_range()
+  vanish_range(),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
 {
   bool running = false;
   flyspeed     = FLYSPEED;
@@ -72,6 +75,9 @@ WillOWisp::WillOWisp(const Reader& reader) :
   sound_manager->preload(SOUNDFILE);
   sound_manager->preload("sounds/warp.wav");
 
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.0f, 0.2f, 0.0f));
+
   sprite->set_action("idle");
 }
 
@@ -84,6 +90,7 @@ WillOWisp::draw(DrawingContext& context)
   context.set_target(DrawingContext::LIGHTMAP);
 
   sprite->draw(context, get_pos(), layer);
+  lightsprite->draw(context, get_bbox().get_middle(), 0);
 
   context.pop_target();
 }
@@ -277,8 +284,8 @@ WillOWisp::expose(HSQUIRRELVM vm, SQInteger table_idx)
     return;
 
   std::cout << "Expose me '" << name << "'\n";
-  Scripting::WillOWisp* interface = static_cast<Scripting::WillOWisp*> (this);
-  expose_object(vm, table_idx, interface, name);
+  scripting::WillOWisp* _this = static_cast<scripting::WillOWisp*> (this);
+  expose_object(vm, table_idx, _this, name);
 }
   
 void
@@ -288,9 +295,7 @@ WillOWisp::unexpose(HSQUIRRELVM vm, SQInteger table_idx)
     return;
 
   std::cout << "UnExpose me '" << name << "'\n";
-  Scripting::unexpose_object(vm, table_idx, name);
+  scripting::unexpose_object(vm, table_idx, name);
 }
 
-IMPLEMENT_FACTORY(WillOWisp, "willowisp");
-
 /* EOF */