File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -48,8 +48,8 @@ struct Toast {
4848static std::deque<Toast> g_toasts;
4949
5050static std::chrono::time_point<std::chrono::steady_clock> g_slideOffTime;
51- static int g_slideOffStart;
52- static int g_slideOff;
51+ static int g_slideOffStart = 0 ;
52+ static int g_slideOff = 0 ;
5353
5454#define STR (s ) #s
5555#define EXP_STR (s ) STR(s)
@@ -364,10 +364,18 @@ void ToastHud::Update() {
364364 int screenWidth, screenHeight;
365365 engine->GetScreenSize (nullptr , screenWidth, screenHeight);
366366
367- g_slideOff = g_slideOffStart - SLIDE_RATE * std::chrono::duration_cast<std::chrono::milliseconds>(now - g_slideOffTime).count () * screenHeight / 1000 / 1000 ;
368- if (g_slideOff < 0 ) {
367+ if (g_slideOffStart != 0 ) {
368+ g_slideOff = g_slideOffStart - SLIDE_RATE * std::chrono::duration_cast<std::chrono::milliseconds>(now - g_slideOffTime).count () * screenHeight / 1000 / 1000 ;
369+ if (g_slideOff < 0 ) {
370+ g_slideOff = 0 ;
371+ }
372+ } else {
369373 g_slideOff = 0 ;
370374 }
375+ if (g_slideOff > 2 * screenHeight) {
376+ console->Print (" Safety check triggered on toast slide\n " );
377+ g_slideOff = 2 * screenHeight; // Stupid BUG!
378+ }
371379}
372380
373381void ToastHud::Paint (int slot) {
You can’t perform that action at this time.
0 commit comments