mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 19:50:12 +01:00
minor bug fixes
This commit is contained in:
@@ -138,6 +138,7 @@ def main():
|
|||||||
|
|
||||||
if next_screen is not None:
|
if next_screen is not None:
|
||||||
current_screen = next_screen
|
current_screen = next_screen
|
||||||
|
global_data.input_locked = 0
|
||||||
|
|
||||||
if global_data.config["general"]["fps_counter"]:
|
if global_data.config["general"]["fps_counter"]:
|
||||||
ray.draw_fps(20, 20)
|
ray.draw_fps(20, 20)
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class BaseAnimation():
|
|||||||
self.is_finished = False
|
self.is_finished = False
|
||||||
self.attribute = 0
|
self.attribute = 0
|
||||||
self.is_started = False
|
self.is_started = False
|
||||||
|
self.unlocked = False
|
||||||
self.loop = loop
|
self.loop = loop
|
||||||
self.lock_input = lock_input
|
self.lock_input = lock_input
|
||||||
|
|
||||||
@@ -46,15 +47,17 @@ class BaseAnimation():
|
|||||||
"""Update the animation based on the current time."""
|
"""Update the animation based on the current time."""
|
||||||
if self.loop and self.is_finished:
|
if self.loop and self.is_finished:
|
||||||
self.restart()
|
self.restart()
|
||||||
if self.lock_input and self.is_finished:
|
if self.lock_input and self.is_finished and not self.unlocked:
|
||||||
global_data.input_locked = False
|
self.unlocked = True
|
||||||
|
global_data.input_locked -= 1
|
||||||
|
|
||||||
def restart(self) -> None:
|
def restart(self) -> None:
|
||||||
self.start_ms = get_current_ms()
|
self.start_ms = get_current_ms()
|
||||||
self.is_finished = False
|
self.is_finished = False
|
||||||
self.delay = self.delay_saved
|
self.delay = self.delay_saved
|
||||||
|
self.unlocked = False
|
||||||
if self.lock_input:
|
if self.lock_input:
|
||||||
global_data.input_locked = True
|
global_data.input_locked += 1
|
||||||
|
|
||||||
def start(self) -> None:
|
def start(self) -> None:
|
||||||
self.is_started = True
|
self.is_started = True
|
||||||
@@ -63,12 +66,12 @@ class BaseAnimation():
|
|||||||
def pause(self):
|
def pause(self):
|
||||||
self.is_started = False
|
self.is_started = False
|
||||||
if self.lock_input:
|
if self.lock_input:
|
||||||
global_data.input_locked = False
|
global_data.input_locked -= 1
|
||||||
|
|
||||||
def unpause(self):
|
def unpause(self):
|
||||||
self.is_started = True
|
self.is_started = True
|
||||||
if self.lock_input:
|
if self.lock_input:
|
||||||
global_data.input_locked = True
|
global_data.input_locked += 1
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
self.restart()
|
self.restart()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class GlobalData:
|
|||||||
total_songs: int = 0
|
total_songs: int = 0
|
||||||
hit_sound: int = 0
|
hit_sound: int = 0
|
||||||
player_num: int = 1
|
player_num: int = 1
|
||||||
input_locked: bool = False
|
input_locked: int = 0
|
||||||
modifiers: Modifiers = field(default_factory=lambda: Modifiers())
|
modifiers: Modifiers = field(default_factory=lambda: Modifiers())
|
||||||
|
|
||||||
global_data = GlobalData()
|
global_data = GlobalData()
|
||||||
|
|||||||
@@ -816,12 +816,16 @@ class Player:
|
|||||||
|
|
||||||
# Get the next note from any of the three lists for BPM and gogo time updates
|
# Get the next note from any of the three lists for BPM and gogo time updates
|
||||||
next_note = None
|
next_note = None
|
||||||
|
candidates = []
|
||||||
if self.don_notes:
|
if self.don_notes:
|
||||||
next_note = self.don_notes[0]
|
candidates.append(self.don_notes[0])
|
||||||
elif self.kat_notes:
|
if self.kat_notes:
|
||||||
next_note = self.kat_notes[0]
|
candidates.append(self.kat_notes[0])
|
||||||
elif self.other_notes:
|
if self.other_notes:
|
||||||
next_note = self.other_notes[0]
|
candidates.append(self.other_notes[0])
|
||||||
|
|
||||||
|
if candidates:
|
||||||
|
next_note = min(candidates, key=lambda note: note.load_ms)
|
||||||
|
|
||||||
if next_note:
|
if next_note:
|
||||||
self.bpm = next_note.bpm
|
self.bpm = next_note.bpm
|
||||||
|
|||||||
@@ -495,14 +495,14 @@ class SongSelectScreen:
|
|||||||
if (self.selected_song and self.state == State.SONG_SELECTED and self.selected_difficulty >= 0):
|
if (self.selected_song and self.state == State.SONG_SELECTED and self.selected_difficulty >= 0):
|
||||||
if global_data.player_num == 2:
|
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', 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_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:
|
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', 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_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:
|
for item in self.navigator.items:
|
||||||
box = item.box
|
box = item.box
|
||||||
|
|||||||
Reference in New Issue
Block a user