ソースを参照

Hide cursor when it should be hidden

kiwec 1 ヶ月 前
コミット
3e87701a4b
3 ファイル変更8 行追加23 行削除
  1. 3 10
      src/App/Osu/Osu.cpp
  2. 5 12
      src/App/Osu/OsuBeatmap.cpp
  3. 0 1
      src/App/Osu/OsuBeatmap.h

+ 3 - 10
src/App/Osu/Osu.cpp

@@ -987,10 +987,6 @@ void Osu::update() {
         }
     }
 
-    // it's a bit of a hack, because using cursor visibility to work around SetCursorPos() affecting the windows cursor
-    // in the Mouse class
-    if(!env->isCursorVisible()) env->setCursorVisible(true);
-
     // endless mod
     if(m_bScheduleEndlessModNextBeatmap) {
         m_bScheduleEndlessModNextBeatmap = false;
@@ -1155,11 +1151,8 @@ void Osu::updateMods() {
     if(m_bModAutopilot) m_bModAuto = false;
 
     // handle auto/pilot cursor visibility
-    if(!m_bModAuto && !m_bModAutopilot) {
-        m_bShouldCursorBeVisible = false;
-        env->setCursorVisible(m_bShouldCursorBeVisible);
-    } else if(isInPlayMode()) {
-        m_bShouldCursorBeVisible = true;
+    if(isInPlayMode()) {
+        m_bShouldCursorBeVisible = m_bModAuto || m_bModAutopilot || getSelectedBeatmap()->m_bIsWatchingReplay;
         env->setCursorVisible(m_bShouldCursorBeVisible);
     }
 
@@ -1650,7 +1643,7 @@ void Osu::onPlayStart() {
 
     m_snd_change_check_interval_ref->setValue(0.0f);
 
-    if(m_bModAuto || m_bModAutopilot) {
+    if(m_bModAuto || m_bModAutopilot || getSelectedBeatmap()->m_bIsWatchingReplay) {
         m_bShouldCursorBeVisible = true;
         env->setCursorVisible(m_bShouldCursorBeVisible);
     }

+ 5 - 12
src/App/Osu/OsuBeatmap.cpp

@@ -730,13 +730,11 @@ bool OsuBeatmap::watch(Score score, double start_percent) {
     m_bIsWatchingReplay = true;  // play() resets this to false
     spectated_replay = score.replay;
 
-    env->setCursorVisible(true);
-
     m_osu->m_songBrowser2->m_bHasSelectedAndIsPlaying = true;
     m_osu->m_songBrowser2->setVisible(false);
 
-    m_bIsWaiting = true;  // ensure onPlayStart() will be called by seekPercent()
     seekPercent(start_percent);
+    m_osu->onPlayStart();
 
     return true;
 }
@@ -1112,7 +1110,8 @@ void OsuBeatmap::seekPercent(double percent) {
 
         engine->getSound()->play(m_music);
 
-        onPlayStart();
+        // if there are calculations in there that need the hitobjects to be loaded, also applies speed/pitch
+        onModUpdate(false, false);
     }
 
     if(!m_bIsWatchingReplay) {  // score submission already disabled when watching replay
@@ -2376,7 +2375,8 @@ void OsuBeatmap::update2() {
 
                     m_bIsRestartScheduledQuick = false;
 
-                    onPlayStart();
+                    // if there are calculations in there that need the hitobjects to be loaded, also applies speed/pitch
+                    onModUpdate(false, false);
                 }
             } else
                 m_iCurMusicPos = (engine->getTimeReal() - m_fWaitTime) * 1000.0f * m_osu->getSpeedMultiplier();
@@ -3419,13 +3419,6 @@ Vector2 OsuBeatmap::getFirstPersonCursorDelta() const {
 
 float OsuBeatmap::getHitcircleDiameter() const { return m_fHitcircleDiameter; }
 
-void OsuBeatmap::onPlayStart() {
-    debugLog("OsuBeatmap::onPlayStart()\n");
-
-    // if there are calculations in there that need the hitobjects to be loaded, also applies speed/pitch
-    onModUpdate(false, false);
-}
-
 void OsuBeatmap::saveAndSubmitScore(bool quit) {
     // calculate stars
     double aim = 0.0;

+ 0 - 1
src/App/Osu/OsuBeatmap.h

@@ -407,7 +407,6 @@ class OsuBeatmap {
         }
     }
 
-    void onPlayStart();
     void saveAndSubmitScore(bool quit);
     void onPaused(bool first);