X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fobject%2Fplayer.cpp;h=e1316d25b836b1bd6e82b3ce3a931b14f4886fee;hb=d64bdf284d161cc04cb08dff732978f74d73d78e;hp=cc4dfcf1cc3635d8d20e31baa1b524b99aac684a;hpb=a75415b259e0c4c4e284fbd413a6bb6996b2fa34;p=supertux.git diff --git a/src/object/player.cpp b/src/object/player.cpp index cc4dfcf1c..e1316d25b 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -127,6 +127,8 @@ 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(), last_ground_y(), @@ -219,6 +221,7 @@ Player::init() on_ice = false; ice_this_frame = false; speedlimit = 0; //no special limit + lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE)); on_ground_flag = false; grabbed_object = NULL; @@ -1195,6 +1198,14 @@ 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){ + context.push_target(); + context.set_target(DrawingContext::LIGHTMAP); + lightsprite->draw(context, get_pos() + Vector(dir==LEFT ? 0 : 32, 0), 0); + context.pop_target(); + } } }