@@ -162,6 +162,7 @@ class $modify(PlayLayer) {
162162 float m_initial_percent = 0 ;
163163 bool m_show_in_percentage = false ;
164164 bool m_show_in_progress_bar = false ;
165+ bool m_has_edited_progress_sprite = false ;
165166 };
166167
167168 bool init (GJGameLevel* level, bool unk1, bool unk2) {
@@ -257,9 +258,18 @@ class $modify(PlayLayer) {
257258 void updateProgressbar () {
258259 PlayLayer::updateProgressbar ();
259260
260- if (m_isPlatformer) return ;
261- if (!(m_isPracticeMode || m_isTestMode)) return ;
262- if (!Mod::get ()->getSettingValue <bool >(" enabled" )) return ;
261+ bool exit = m_isPlatformer;
262+ exit = exit || !(m_isPracticeMode || m_isTestMode);
263+ exit = exit || !Mod::get ()->getSettingValue <bool >(" enabled" );
264+ if (exit) {
265+ if (m_fields->m_has_edited_progress_sprite ) {
266+ if (m_progressFill) {
267+ m_progressFill->setPositionX (2 .f );
268+ }
269+ m_fields->m_has_edited_progress_sprite = false ;
270+ }
271+ return ;
272+ }
263273
264274 auto from = m_fields->m_initial_percent ;
265275 auto to = this ->getCurrentPercent ();
@@ -271,11 +281,17 @@ class $modify(PlayLayer) {
271281 m_percentageLabel->setString (fmt::format (" {1:.{0}f}-{2:.{0}f}%" , decimal, from_trunc, to_trunc).c_str ());
272282 }
273283
274- if (m_progressFill && m_fields->m_show_in_progress_bar ) {
275- float x = from / 100 .0f * m_progressWidth;
276- float width = (to - from) / 100 .0f * m_progressWidth;
277- m_progressFill->setTextureRect ({ x, 0 .0f , width, m_progressHeight });
278- m_progressFill->setPositionX (2 .0f + x);
284+ if (m_progressFill) {
285+ if (m_fields->m_show_in_progress_bar ) {
286+ float x = from / 100 .0f * m_progressWidth;
287+ float width = (to - from) / 100 .0f * m_progressWidth;
288+ m_progressFill->setTextureRect ({ x, 0 .0f , width, m_progressHeight });
289+ m_progressFill->setPositionX (2 .0f + x);
290+ m_fields->m_has_edited_progress_sprite = true ;
291+ } else if (m_fields->m_has_edited_progress_sprite ) {
292+ m_progressFill->setPositionX (2 .f );
293+ m_fields->m_has_edited_progress_sprite = false ;
294+ }
279295 }
280296 }
281297};
0 commit comments