From d869d22d93e2e0ca6e82ca6206b5a7d1016967da Mon Sep 17 00:00:00 2001 From: Andrew Wong Date: Thu, 4 Sep 2003 10:37:48 +0000 Subject: [PATCH] simplify (use array) --- stepmania/src/LifeMeterBar.cpp | 50 ++++++++-------------------------- 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index 4d6d80c3cd..ab72357b50 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -548,49 +548,21 @@ void LifeMeterBar::UpdateNonstopLifebar(const int cleared, // the lifebar is pretty harsh at 0.4 already (you lose // about 20% of your lifebar); at 0.2 it would be 40%, which // is too harsh at one difficulty level higher. Override. - if (m_fLifeDifficulty >= 0.2) // judge 8 + + int m_iLifeDifficulty = ((1.8 - m_fLifeDifficulty)/0.2); + + // first eight values don't matter + float DifficultyValues[16] = {0,0,0,0,0,0,0,0, + 0.3f, 0.25f, 0.2f, 0.16f, 0.14f, 0.12f, 0.10f, 0.08f}; + + if (m_iLifeDifficulty >= 16) { - m_fLifeDifficulty = 0.3f; - return; - } - if (m_fLifeDifficulty >= 0) // judge 9 - { - m_fLifeDifficulty = 0.25f; - return; - } - if (m_fLifeDifficulty >= -0.2) // judge 10 - { - m_fLifeDifficulty = 0.2f; - return; - } - if (m_fLifeDifficulty >= -0.4) // judge 11 - { - m_fLifeDifficulty = 0.16f; - return; - } - if (m_fLifeDifficulty >= -0.6) // judge 12 - { - m_fLifeDifficulty = 0.14f; - return; - } - if (m_fLifeDifficulty >= -0.8) // judge 13 - { - m_fLifeDifficulty = 0.12f; - return; - } - if (m_fLifeDifficulty >= -1.0) // judge 14 - { - m_fLifeDifficulty = 0.10f; - return; - } - if (m_fLifeDifficulty >= -1.2) // judge 15 - { - m_fLifeDifficulty = 0.08f; + // judge 16 or higher + m_fLifeDifficulty = 0.04f; return; } - // judge 16 or higher - m_fLifeDifficulty = 0.04f; + m_fLifeDifficulty = DifficultyValues[m_iLifeDifficulty]; return; }