Bouncing on enemies and trampolines also gets a hight bonus from airflower
[supertux.git] / src / object / player.cpp
index 25b6cef..3af291c 100644 (file)
@@ -132,7 +132,6 @@ Player::Player(PlayerStatus* _player_status, const std::string& name_) :
   jump_early_apex(),
   on_ice(),
   ice_this_frame(),
-  light(1.0f,1.0f,1.0f),
   lightsprite(SpriteManager::current()->create("images/objects/lightmap_light/lightmap_light-tiny.sprite")),
   dir(),
   old_dir(),
@@ -1229,9 +1228,8 @@ Player::draw(DrawingContext& context)
     ;  // don't draw Tux
   else {
     sprite->draw(context, get_pos(), LAYER_OBJECTS + 1);
-    // illuminate Tux in dark areas with earthflower bonus
-    context.get_light( get_bbox().get_middle(), &light );
-    if (light.red + light.green + light.blue < 3.0 && player_status->bonus == EARTH_BONUS){
+    // draw light with earthflower bonus
+    if (player_status->bonus == EARTH_BONUS){
       context.push_target();
       context.set_target(DrawingContext::LIGHTMAP);
       lightsprite->draw(context, get_pos() + Vector(dir==LEFT ? 0 : 32, 0), 0);
@@ -1513,10 +1511,12 @@ Player::get_velocity()
 void
 Player::bounce(BadGuy& )
 {
-  if(controller->hold(Controller::JUMP))
-    physic.set_velocity_y(-520);
-  else
-    physic.set_velocity_y(-300);
+  if(!(player_status->bonus == AIR_BONUS))
+    physic.set_velocity_y(controller->hold(Controller::JUMP) ? -520 : -300);
+  else {
+    physic.set_velocity_y(controller->hold(Controller::JUMP) ? -580 : -340);
+    glide_time = player_status->max_air_time * GLIDE_TIME_PER_FLOWER;
+  }
 }
 
 //scripting Functions Below