X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fobject%2Fplayer.cpp;h=93c10942c364458c0757927adee26271a872d294;hb=8e52a5b000d732e96b1cc461163c4778b434dc27;hp=414f43dd818a59fe8095cbc37468b3f77cce28d0;hpb=a5833e9320250ce1d2f1d6da7510a8ae8d263a73;p=supertux.git diff --git a/src/object/player.cpp b/src/object/player.cpp index 414f43dd8..93c10942c 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -185,7 +185,7 @@ Player::Player(PlayerStatus* _player_status, const std::string& name_) : SoundManager::current()->preload("sounds/skid.wav"); SoundManager::current()->preload("sounds/flip.wav"); SoundManager::current()->preload("sounds/invincible_start.ogg"); - SoundManager::current()->preload("sounds/splash.ogg"); + SoundManager::current()->preload("sounds/splash.wav"); init(); } @@ -416,9 +416,12 @@ Player::update(float elapsed_time) if (backflipping && (backflip_timer.get_timegone() > 0.15f)) { backflipping = false; backflip_direction = 0; - sprite->set_angle(0.0f); - powersprite->set_angle(0.0f); - lightsprite->set_angle(0.0f); + physic.set_velocity_x(0); + if (!stone) { + sprite->set_angle(0.0f); + powersprite->set_angle(0.0f); + lightsprite->set_angle(0.0f); + } // if controls are currently deactivated, we take care of standing up ourselves if (deactivated) @@ -644,6 +647,8 @@ Player::do_standup() { return; if (backflipping) return; + if (stone) + return; if (adjust_height(BIG_TUX_HEIGHT)) { duck = false; @@ -860,6 +865,7 @@ Player::handle_input() if (controller->pressed(Controller::DOWN) && player_status->bonus == EARTH_BONUS && !cooldown_timer.started()) { if (controller->hold(Controller::ACTION) && !ability_timer.started()) { ability_timer.start(player_status->max_earth_time * STONE_TIME_PER_FLOWER); + powersprite->stop_animation(); stone = true; physic.set_gravity_modifier(1.0f); // Undo jump_early_apex } @@ -872,6 +878,9 @@ Player::handle_input() if (stone && (!controller->hold(Controller::ACTION) || ability_timer.get_timeleft() <= 0.5f)) { cooldown_timer.start(ability_timer.get_timegone()/2.0f); //The longer stone form is used, the longer until it can be used again ability_timer.stop(); + sprite->set_angle(0.0f); + powersprite->set_angle(0.0f); + lightsprite->set_angle(0.0f); stone = false; for (int i = 0; i < 8; i++) { @@ -973,8 +982,6 @@ Player::try_grab() // make sure the Portable is a MovingObject MovingObject* moving_object = dynamic_cast (portable); assert(moving_object); - if(moving_object == NULL) - continue; // make sure the Portable isn't currently non-solid if(moving_object->get_group() == COLGROUP_DISABLED) continue; @@ -1064,7 +1071,7 @@ Player::add_bonus(BonusType type, bool animate) // ignore GROWUP_BONUS if we're already big if (type == GROWUP_BONUS) { - if (!player_status->bonus == NO_BONUS) + if (player_status->bonus != NO_BONUS) return true; } @@ -1306,7 +1313,11 @@ Player::draw(DrawingContext& context) } } else { - sprite->draw(context, get_pos(), LAYER_OBJECTS + 1); + if(dying) + sprite->draw(context, get_pos(), Sector::current()->get_foremost_layer() + 1); + else + sprite->draw(context, get_pos(), LAYER_OBJECTS + 1); + if (player_status->bonus == AIR_BONUS) powersprite->draw(context, get_pos(), LAYER_OBJECTS + 1); } @@ -1330,7 +1341,7 @@ Player::collision_tile(uint32_t tile_attributes) if( tile_attributes & Tile::WATER ){ swimming = true; no_water = false; - SoundManager::current()->play( "sounds/splash.ogg" ); + SoundManager::current()->play( "sounds/splash.wav" ); } } #endif @@ -1515,7 +1526,7 @@ Player::kill(bool completely) // TODO: need nice way to handle players dying in co-op mode Sector::current()->effect->fade_out(3.0); - SoundManager::current()->stop_music(3.0); + SoundManager::current()->pause_music(3.0); } }