minor bug fixes

This commit is contained in:
Anthony Samms
2025-10-13 21:16:58 -04:00
parent a29572d8ab
commit 0e668f991e
5 changed files with 23 additions and 15 deletions

View File

@@ -138,6 +138,7 @@ def main():
if next_screen is not None:
current_screen = next_screen
global_data.input_locked = 0
if global_data.config["general"]["fps_counter"]:
ray.draw_fps(20, 20)

View File

@@ -33,6 +33,7 @@ class BaseAnimation():
self.is_finished = False
self.attribute = 0
self.is_started = False
self.unlocked = False
self.loop = loop
self.lock_input = lock_input
@@ -46,15 +47,17 @@ class BaseAnimation():
"""Update the animation based on the current time."""
if self.loop and self.is_finished:
self.restart()
if self.lock_input and self.is_finished:
global_data.input_locked = False
if self.lock_input and self.is_finished and not self.unlocked:
self.unlocked = True
global_data.input_locked -= 1
def restart(self) -> None:
self.start_ms = get_current_ms()
self.is_finished = False
self.delay = self.delay_saved
self.unlocked = False
if self.lock_input:
global_data.input_locked = True
global_data.input_locked += 1
def start(self) -> None:
self.is_started = True
@@ -63,12 +66,12 @@ class BaseAnimation():
def pause(self):
self.is_started = False
if self.lock_input:
global_data.input_locked = False
global_data.input_locked -= 1
def unpause(self):
self.is_started = True
if self.lock_input:
global_data.input_locked = True
global_data.input_locked += 1
def reset(self):
self.restart()

View File

@@ -20,7 +20,7 @@ class GlobalData:
total_songs: int = 0
hit_sound: int = 0
player_num: int = 1
input_locked: bool = False
input_locked: int = 0
modifiers: Modifiers = field(default_factory=lambda: Modifiers())
global_data = GlobalData()

View File

@@ -816,12 +816,16 @@ class Player:
# Get the next note from any of the three lists for BPM and gogo time updates
next_note = None
candidates = []
if self.don_notes:
next_note = self.don_notes[0]
elif self.kat_notes:
next_note = self.kat_notes[0]
elif self.other_notes:
next_note = self.other_notes[0]
candidates.append(self.don_notes[0])
if self.kat_notes:
candidates.append(self.kat_notes[0])
if self.other_notes:
candidates.append(self.other_notes[0])
if candidates:
next_note = min(candidates, key=lambda note: note.load_ms)
if next_note:
self.bpm = next_note.bpm

View File

@@ -495,14 +495,14 @@ class SongSelectScreen:
if (self.selected_song and self.state == State.SONG_SELECTED and self.selected_difficulty >= 0):
if global_data.player_num == 2:
tex.draw_texture('global', 'background_diff', frame=self.selected_difficulty, fade=min(0.5, self.selected_diff_fadein.attribute), x=1025, y=-self.selected_diff_bounce.attribute, y2=self.selected_diff_bounce.attribute)
tex.draw_texture('global', 'background_diff_highlight', frame=max(3, self.selected_difficulty), fade=self.selected_diff_highlight_fade.attribute, x=1025)
tex.draw_texture('global', 'background_diff_highlight', frame=min(3, self.selected_difficulty), fade=self.selected_diff_highlight_fade.attribute, x=1025)
tex.draw_texture('global', 'bg_diff_text_bg', x=1025, fade=min(0.5, self.selected_diff_text_fadein.attribute), scale=self.selected_diff_text_resize.attribute, center=True)
tex.draw_texture('global', 'bg_diff_text', frame=self.selected_difficulty, x=1025, fade=self.selected_diff_text_fadein.attribute, scale=self.selected_diff_text_resize.attribute, center=True)
tex.draw_texture('global', 'bg_diff_text', frame=min(3, self.selected_difficulty), x=1025, fade=self.selected_diff_text_fadein.attribute, scale=self.selected_diff_text_resize.attribute, center=True)
else:
tex.draw_texture('global', 'background_diff', frame=self.selected_difficulty, fade=min(0.5, self.selected_diff_fadein.attribute), y=-self.selected_diff_bounce.attribute, y2=self.selected_diff_bounce.attribute)
tex.draw_texture('global', 'background_diff_highlight', frame=max(3, self.selected_difficulty), fade=self.selected_diff_highlight_fade.attribute)
tex.draw_texture('global', 'background_diff_highlight', frame=min(3, self.selected_difficulty), fade=self.selected_diff_highlight_fade.attribute)
tex.draw_texture('global', 'bg_diff_text_bg', fade=min(0.5, self.selected_diff_text_fadein.attribute), scale=self.selected_diff_text_resize.attribute, center=True)
tex.draw_texture('global', 'bg_diff_text', frame=self.selected_difficulty, fade=self.selected_diff_text_fadein.attribute, scale=self.selected_diff_text_resize.attribute, center=True)
tex.draw_texture('global', 'bg_diff_text', frame=min(3, self.selected_difficulty), fade=self.selected_diff_text_fadein.attribute, scale=self.selected_diff_text_resize.attribute, center=True)
for item in self.navigator.items:
box = item.box