mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
minor bug fixes
This commit is contained in:
@@ -139,6 +139,8 @@ def main():
|
|||||||
ray.rl_set_blend_factors_separate(RL_SRC_ALPHA, RL_ONE_MINUS_SRC_ALPHA, RL_ONE, RL_ONE_MINUS_SRC_ALPHA, RL_FUNC_ADD, RL_FUNC_ADD)
|
ray.rl_set_blend_factors_separate(RL_SRC_ALPHA, RL_ONE_MINUS_SRC_ALPHA, RL_ONE, RL_ONE_MINUS_SRC_ALPHA, RL_FUNC_ADD, RL_FUNC_ADD)
|
||||||
ray.set_exit_key(ord(global_data.config["keys_1p"]["exit_key"]))
|
ray.set_exit_key(ord(global_data.config["keys_1p"]["exit_key"]))
|
||||||
|
|
||||||
|
ray.hide_cursor()
|
||||||
|
|
||||||
while not ray.window_should_close():
|
while not ray.window_should_close():
|
||||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_F11):
|
if ray.is_key_pressed(ray.KeyboardKey.KEY_F11):
|
||||||
ray.toggle_fullscreen()
|
ray.toggle_fullscreen()
|
||||||
|
|||||||
@@ -551,7 +551,6 @@ class ScoreHistory:
|
|||||||
current_ms (int): The current time in milliseconds.
|
current_ms (int): The current time in milliseconds.
|
||||||
"""
|
"""
|
||||||
self.scores = {k: v for k, v in scores.items() if v is not None}
|
self.scores = {k: v for k, v in scores.items() if v is not None}
|
||||||
print(self.scores)
|
|
||||||
self.difficulty_keys = list(self.scores.keys())
|
self.difficulty_keys = list(self.scores.keys())
|
||||||
self.curr_difficulty_index = 0
|
self.curr_difficulty_index = 0
|
||||||
self.curr_difficulty_index = (self.curr_difficulty_index + 1) % len(self.difficulty_keys)
|
self.curr_difficulty_index = (self.curr_difficulty_index + 1) % len(self.difficulty_keys)
|
||||||
|
|||||||
@@ -120,9 +120,21 @@ def build_song_hashes(output_dir=Path("cache")):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
for diff in tja.metadata.course_data:
|
for diff in tja.metadata.course_data:
|
||||||
diff_notes, _, _, _ = TJAParser.notes_to_position(TJAParser(tja.file_path), diff)
|
diff_notes, branch_m, branch_e, branch_n = TJAParser.notes_to_position(TJAParser(tja.file_path), diff)
|
||||||
diff_hashes[diff] = tja.hash_note_data(diff_notes)
|
diff_hashes[diff] = tja.hash_note_data(diff_notes)
|
||||||
all_notes.play_notes.extend(diff_notes.play_notes)
|
all_notes.play_notes.extend(diff_notes.play_notes)
|
||||||
|
if branch_m:
|
||||||
|
for branch in branch_m:
|
||||||
|
all_notes.play_notes.extend(branch.play_notes)
|
||||||
|
all_notes.bars.extend(branch.bars)
|
||||||
|
if branch_e:
|
||||||
|
for branch in branch_e:
|
||||||
|
all_notes.play_notes.extend(branch.play_notes)
|
||||||
|
all_notes.bars.extend(branch.bars)
|
||||||
|
if branch_n:
|
||||||
|
for branch in branch_n:
|
||||||
|
all_notes.play_notes.extend(branch.play_notes)
|
||||||
|
all_notes.bars.extend(branch.bars)
|
||||||
all_notes.bars.extend(diff_notes.bars)
|
all_notes.bars.extend(diff_notes.bars)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Failed to parse TJA {tja_path}: {e}")
|
print(f"Failed to parse TJA {tja_path}: {e}")
|
||||||
@@ -230,9 +242,27 @@ def process_tja_file(tja_file):
|
|||||||
tja = TJAParser(tja_file)
|
tja = TJAParser(tja_file)
|
||||||
all_notes = NoteList()
|
all_notes = NoteList()
|
||||||
for diff in tja.metadata.course_data:
|
for diff in tja.metadata.course_data:
|
||||||
notes, _, _, _ = TJAParser.notes_to_position(TJAParser(tja.file_path), diff)
|
notes, branch_m, branch_e, branch_n = TJAParser.notes_to_position(TJAParser(tja.file_path), diff)
|
||||||
all_notes.play_notes.extend(notes.play_notes)
|
all_notes.play_notes.extend(notes.play_notes)
|
||||||
|
if branch_m:
|
||||||
|
for branch in branch_m:
|
||||||
|
all_notes.play_notes.extend(branch.play_notes)
|
||||||
|
if branch_e:
|
||||||
|
for branch in branch_e:
|
||||||
|
all_notes.play_notes.extend(branch.play_notes)
|
||||||
|
if branch_n:
|
||||||
|
for branch in branch_n:
|
||||||
|
all_notes.play_notes.extend(branch.play_notes)
|
||||||
all_notes.bars.extend(notes.bars)
|
all_notes.bars.extend(notes.bars)
|
||||||
|
if branch_m:
|
||||||
|
for branch in branch_m:
|
||||||
|
all_notes.bars.extend(branch.bars)
|
||||||
|
if branch_e:
|
||||||
|
for branch in branch_e:
|
||||||
|
all_notes.bars.extend(branch.bars)
|
||||||
|
if branch_n:
|
||||||
|
for branch in branch_n:
|
||||||
|
all_notes.bars.extend(branch.bars)
|
||||||
if all_notes == []:
|
if all_notes == []:
|
||||||
return ''
|
return ''
|
||||||
hash = tja.hash_note_data(all_notes)
|
hash = tja.hash_note_data(all_notes)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from functools import lru_cache
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from libs.global_data import Modifiers
|
from libs.global_data import Modifiers
|
||||||
from libs.utils import get_pixels_per_frame, global_data, strip_comments
|
from libs.utils import get_pixels_per_frame, strip_comments
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=64)
|
@lru_cache(maxsize=64)
|
||||||
|
|||||||
@@ -129,7 +129,22 @@ class GameScreen:
|
|||||||
with sqlite3.connect('scores.db') as con:
|
with sqlite3.connect('scores.db') as con:
|
||||||
session_data = global_data.session_data[global_data.player_num-1]
|
session_data = global_data.session_data[global_data.player_num-1]
|
||||||
cursor = con.cursor()
|
cursor = con.cursor()
|
||||||
notes, _, _, _ = TJAParser.notes_to_position(TJAParser(self.tja.file_path), self.player_1.difficulty)
|
notes, branch_m, branch_e, branch_n = TJAParser.notes_to_position(TJAParser(self.tja.file_path), self.player_1.difficulty)
|
||||||
|
if branch_m:
|
||||||
|
for branch in branch_m:
|
||||||
|
notes.play_notes.extend(branch.play_notes)
|
||||||
|
notes.draw_notes.extend(branch.draw_notes)
|
||||||
|
notes.bars.extend(branch.bars)
|
||||||
|
if branch_e:
|
||||||
|
for branch in branch_e:
|
||||||
|
notes.play_notes.extend(branch.play_notes)
|
||||||
|
notes.draw_notes.extend(branch.draw_notes)
|
||||||
|
notes.bars.extend(branch.bars)
|
||||||
|
if branch_n:
|
||||||
|
for branch in branch_n:
|
||||||
|
notes.play_notes.extend(branch.play_notes)
|
||||||
|
notes.draw_notes.extend(branch.draw_notes)
|
||||||
|
notes.bars.extend(branch.bars)
|
||||||
hash = self.tja.hash_note_data(notes)
|
hash = self.tja.hash_note_data(notes)
|
||||||
check_query = "SELECT score, clear FROM Scores WHERE hash = ? LIMIT 1"
|
check_query = "SELECT score, clear FROM Scores WHERE hash = ? LIMIT 1"
|
||||||
cursor.execute(check_query, (hash,))
|
cursor.execute(check_query, (hash,))
|
||||||
@@ -507,7 +522,7 @@ class Player:
|
|||||||
self.is_drumroll = False
|
self.is_drumroll = False
|
||||||
self.is_balloon = False
|
self.is_balloon = False
|
||||||
else:
|
else:
|
||||||
if len(self.other_notes) == 1:
|
if len(self.other_notes) >= 1:
|
||||||
self.other_notes.popleft()
|
self.other_notes.popleft()
|
||||||
elif (note.hit_ms <= current_ms):
|
elif (note.hit_ms <= current_ms):
|
||||||
if note.type == 5 or note.type == 6:
|
if note.type == 5 or note.type == 6:
|
||||||
|
|||||||
@@ -536,14 +536,17 @@ class SongSelectPlayer:
|
|||||||
prev_diff = self.selected_difficulty
|
prev_diff = self.selected_difficulty
|
||||||
|
|
||||||
if is_l_kat_pressed(self.player_num):
|
if is_l_kat_pressed(self.player_num):
|
||||||
self._navigate_difficulty_left(diffs)
|
ret_val = self._navigate_difficulty_left(diffs)
|
||||||
else: # is_r_kat_pressed()
|
elif is_r_kat_pressed(self.player_num):
|
||||||
self._navigate_difficulty_right(diffs)
|
ret_val = self._navigate_difficulty_right(diffs)
|
||||||
|
|
||||||
if 0 <= self.selected_difficulty <= 4 and self.selected_difficulty != prev_diff:
|
if 0 <= self.selected_difficulty <= 4 and self.selected_difficulty != prev_diff:
|
||||||
self.selected_diff_bounce.start()
|
self.selected_diff_bounce.start()
|
||||||
self.selected_diff_fadein.start()
|
self.selected_diff_fadein.start()
|
||||||
|
|
||||||
|
|
||||||
|
return ret_val
|
||||||
|
|
||||||
if (ray.is_key_pressed(ray.KeyboardKey.KEY_TAB) and
|
if (ray.is_key_pressed(ray.KeyboardKey.KEY_TAB) and
|
||||||
self.selected_difficulty in [3, 4]):
|
self.selected_difficulty in [3, 4]):
|
||||||
return self._toggle_ura_mode()
|
return self._toggle_ura_mode()
|
||||||
@@ -590,7 +593,7 @@ class SongSelectPlayer:
|
|||||||
if (self.selected_difficulty in [3, 4] and 4 in diffs and 3 in diffs):
|
if (self.selected_difficulty in [3, 4] and 4 in diffs and 3 in diffs):
|
||||||
self.ura_toggle = (self.ura_toggle + 1) % 10
|
self.ura_toggle = (self.ura_toggle + 1) % 10
|
||||||
if self.ura_toggle == 0:
|
if self.ura_toggle == 0:
|
||||||
self._toggle_ura_mode()
|
return self._toggle_ura_mode()
|
||||||
elif self.selected_difficulty == -1:
|
elif self.selected_difficulty == -1:
|
||||||
self.prev_diff = self.selected_difficulty
|
self.prev_diff = self.selected_difficulty
|
||||||
self.selected_difficulty = min(diffs)
|
self.selected_difficulty = min(diffs)
|
||||||
|
|||||||
Reference in New Issue
Block a user