@@ -51,10 +51,8 @@ class $modify(HorribleGJBaseGameLayer, GJBaseGameLayer) {
5151 if (m_isPracticeMode && !m_fields->m_currentQuiz ) {
5252 // pause the game
5353 auto gm = GameManager::sharedState ();
54- if (auto playLayer = PlayLayer::get ()) {
55- playLayer->pauseGame (true );
56-
57- }
54+ if (auto playLayer = PlayLayer::get ()) playLayer->pauseGame (true );
55+
5856 if (auto quiz = MathQuiz::create ()) {
5957#ifdef GEODE_IS_WINDOWS
6058 CCEGLView::sharedOpenGLView ()->showCursor (true );
@@ -69,19 +67,22 @@ class $modify(HorribleGJBaseGameLayer, GJBaseGameLayer) {
6967
7068 // do something like if answer is right, just do PlayLayer::resumeGame()
7169 // then do something like if answer is wrong, do PlayLayer::resetLevelFromStart()
72- // if the user do a keyBack, the absolutely do PlayLayer::resetLevelFromStart() :trol:
70+ // if the user do a keyBack, then absolutely do PlayLayer::resetLevelFromStart() :trol:
7371 };
7472
7573 if (horribleMod->getSavedValue <bool >(" ads" , false )) {
7674 m_fields->m_adCooldown += p0;
75+
7776 static float nextAdTime = 0 .f ;
7877 auto gm = GameManager::sharedState ();
78+
7979 if (nextAdTime == 0 .f || m_fields->m_adCooldown >= nextAdTime) {
8080 // Randomize next ad time between 20 and 40 seconds
8181 nextAdTime = 20 .f + static_cast <float >(rand () % 21 ); // 20 to 40 inclusive
8282 m_fields->m_adCooldown = 0 .f ;
8383
8484 log::warn (" ad time!" );
85+
8586#ifdef GEODE_IS_WINDOWS
8687 // Show cursor when ad appears
8788 CCEGLView::sharedOpenGLView ()->showCursor (true );
@@ -99,14 +100,13 @@ class $modify(HorribleGJBaseGameLayer, GJBaseGameLayer) {
99100 } else {
100101 m_fields->m_currentAd = nullptr ;
101102 };
102- }
103+ };
104+
103105#ifdef GEODE_IS_WINDOWS
104106 // Hide cursor if ad popup is closed
105- if (!m_fields->m_currentAd && !CCScene::get ()->getChildByID (" ad" _spr)) {
106- CCEGLView::sharedOpenGLView ()->showCursor (false );
107- }
107+ if (!m_fields->m_currentAd && !CCScene::get ()->getChildByID (" ad" _spr)) CCEGLView::sharedOpenGLView ()->showCursor (false );
108108#endif
109- }
109+ };
110110
111111 GJBaseGameLayer::update (p0);
112112 };
0 commit comments