@@ -129,9 +129,6 @@ const float SMALL_TUX_HEIGHT = 30.8f;
129
129
const float BIG_TUX_HEIGHT = 62 .8f ;
130
130
const float DUCKED_TUX_HEIGHT = 31 .8f ;
131
131
132
- /* * when Tux swims down and approaches the bottom of the screen, push him back up with that strength */
133
- const float WATER_FALLOUT_FORCEBACK_STRENGTH = 1024 .f;
134
-
135
132
bool no_water = true ;
136
133
137
134
} // namespace
@@ -152,7 +149,6 @@ Player::Player(PlayerStatus& player_status, const std::string& name_) :
152
149
m_peekingY(Direction::AUTO),
153
150
m_ability_time(),
154
151
m_stone(false ),
155
- m_falling_below_water(false ),
156
152
m_swimming(false ),
157
153
m_swimboosting(false ),
158
154
m_on_left_wall(false ),
@@ -526,16 +522,6 @@ Player::update(float dt_sec)
526
522
m_second_growup_sound_timer.stop ();
527
523
}
528
524
529
- // Handle player approaching the bottom of the screen while swimming
530
- if (m_falling_below_water) {
531
- m_physic.set_velocity_y (std::min (m_physic.get_velocity_y (), 0 .f ));
532
- }
533
-
534
- if ((get_pos ().y > Sector::get ().get_height () - m_col.m_bbox .get_height ()) && (!m_ghost_mode && m_swimming))
535
- {
536
- m_physic.set_acceleration_y (-WATER_FALLOUT_FORCEBACK_STRENGTH);
537
- }
538
-
539
525
if (m_boost != 0 .f )
540
526
{
541
527
bool sign = std::signbit (m_boost);
@@ -2004,16 +1990,13 @@ Player::check_bounds()
2004
1990
set_pos (Vector (Sector::get ().get_width () - m_col.m_bbox .get_width (), m_col.m_bbox .get_top ()));
2005
1991
}
2006
1992
2007
- m_falling_below_water = false ;
1993
+ // If Tux is swimming, don't allow him to go below the sector
1994
+ if (m_swimming && !m_ghost_mode && m_col.m_bbox .get_bottom () > Sector::get ().get_height ()) {
1995
+ set_pos (Vector (m_col.m_bbox .get_left (), Sector::get ().get_height () - m_col.m_bbox .get_height ()));
1996
+ }
2008
1997
2009
1998
/* fallen out of the level? */
2010
- if (m_swimming) {
2011
- // If swimming, don't kill; just prevent from falling below the ground
2012
- if ((get_pos ().y > Sector::get ().get_height () - 1 ) && (!m_ghost_mode)) {
2013
- set_pos (Vector (get_pos ().x , Sector::get ().get_height () - 1 ));
2014
- m_falling_below_water = true ;
2015
- }
2016
- } else if ((get_pos ().y > Sector::get ().get_height ()) && (!m_ghost_mode)) {
1999
+ if ((get_pos ().y > Sector::get ().get_height ()) && (!m_ghost_mode)) {
2017
2000
kill (true );
2018
2001
return ;
2019
2002
}
0 commit comments