@@ -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 ),
@@ -523,16 +519,6 @@ Player::update(float dt_sec)
523
519
m_second_growup_sound_timer.stop ();
524
520
}
525
521
526
- // Handle player approaching the bottom of the screen while swimming
527
- if (m_falling_below_water) {
528
- m_physic.set_velocity_y (std::min (m_physic.get_velocity_y (), 0 .f ));
529
- }
530
-
531
- if ((get_pos ().y > Sector::get ().get_height () - m_col.m_bbox .get_height ()) && (!m_ghost_mode && m_swimming))
532
- {
533
- m_physic.set_acceleration_y (-WATER_FALLOUT_FORCEBACK_STRENGTH);
534
- }
535
-
536
522
if (m_boost != 0 .f )
537
523
{
538
524
bool sign = std::signbit (m_boost);
@@ -2001,16 +1987,13 @@ Player::check_bounds()
2001
1987
set_pos (Vector (Sector::get ().get_width () - m_col.m_bbox .get_width (), m_col.m_bbox .get_top ()));
2002
1988
}
2003
1989
2004
- m_falling_below_water = false ;
1990
+ // If Tux is swimming, don't allow him to go below the sector
1991
+ if (m_swimming && !m_ghost_mode && m_col.m_bbox .get_bottom () > Sector::get ().get_height ()) {
1992
+ set_pos (Vector (m_col.m_bbox .get_left (), Sector::get ().get_height () - m_col.m_bbox .get_height ()));
1993
+ }
2005
1994
2006
1995
/* fallen out of the level? */
2007
- if (m_swimming) {
2008
- // If swimming, don't kill; just prevent from falling below the ground
2009
- if ((get_pos ().y > Sector::get ().get_height () - 1 ) && (!m_ghost_mode)) {
2010
- set_pos (Vector (get_pos ().x , Sector::get ().get_height () - 1 ));
2011
- m_falling_below_water = true ;
2012
- }
2013
- } else if ((get_pos ().y > Sector::get ().get_height ()) && (!m_ghost_mode)) {
1996
+ if ((get_pos ().y > Sector::get ().get_height ()) && (!m_ghost_mode)) {
2014
1997
kill (true );
2015
1998
return ;
2016
1999
}
0 commit comments