Skip to content

Commit ef5d2ee

Browse files
committed
Item pocket: make timer gravity-deterministic
Fixes #3624
1 parent 0b3ff9e commit ef5d2ee

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/supertux/player_status.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,12 @@ PlayerStatus::PocketPowerUp::update(float dt_sec)
428428
bool check = m_cooldown_timer.check();
429429
if (!m_cooldown_timer.started() && !check && m_col.m_group != COLGROUP_TOUCHABLE)
430430
{
431-
m_cooldown_timer.start(1.3f);
431+
float sector_gravity = Sector::get().get_gravity();
432+
if (sector_gravity == 0.0f) {
433+
// prevent potential division by zero
434+
sector_gravity = 0.01f;
435+
}
436+
m_cooldown_timer.start(1.3f * 10.0f / sector_gravity);
432437
m_blink_timer.start(.15f, true);
433438
}
434439

0 commit comments

Comments
 (0)