mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
more bug fixes
This commit is contained in:
35
PyTaiko.py
35
PyTaiko.py
@@ -2,6 +2,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
|
import argparse
|
||||||
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
@@ -146,14 +147,36 @@ def main():
|
|||||||
logger.info("Fullscreen enabled")
|
logger.info("Fullscreen enabled")
|
||||||
|
|
||||||
current_screen = Screens.LOADING
|
current_screen = Screens.LOADING
|
||||||
if len(sys.argv) > 1 and Path(sys.argv[1]).exists():
|
|
||||||
current_screen = Screens.GAME
|
if len(sys.argv) == 1:
|
||||||
path = Path(os.path.abspath(sys.argv[1]))
|
pass
|
||||||
|
else:
|
||||||
|
parser = argparse.ArgumentParser(description='Launch game with specified song file')
|
||||||
|
parser.add_argument('song_path', type=str, help='Path to the TJA song file')
|
||||||
|
parser.add_argument('difficulty', type=int, nargs='?', default=None,
|
||||||
|
help='Difficulty level (optional, defaults to max difficulty)')
|
||||||
|
parser.add_argument('--auto', action='store_true',
|
||||||
|
help='Enable auto mode')
|
||||||
|
parser.add_argument('--practice', action='store_true',
|
||||||
|
help='Start in practice mode')
|
||||||
|
args = parser.parse_args()
|
||||||
|
path = Path(args.song_path)
|
||||||
|
if not path.exists():
|
||||||
|
parser.error(f"Song file not found: {args.song_path}")
|
||||||
|
else:
|
||||||
|
path = Path(os.path.abspath(path))
|
||||||
tja = TJAParser(path)
|
tja = TJAParser(path)
|
||||||
max_difficulty = max(tja.metadata.course_data.keys())
|
if args.difficulty is not None:
|
||||||
|
if args.difficulty not in tja.metadata.course_data.keys():
|
||||||
|
parser.error(f"Invalid difficulty: {args.difficulty}. Available: {list(tja.metadata.course_data.keys())}")
|
||||||
|
selected_difficulty = args.difficulty
|
||||||
|
else:
|
||||||
|
selected_difficulty = max(tja.metadata.course_data.keys())
|
||||||
|
current_screen = Screens.GAME_PRACTICE if args.practice else Screens.GAME
|
||||||
global_data.session_data[PlayerNum.P1].selected_song = path
|
global_data.session_data[PlayerNum.P1].selected_song = path
|
||||||
global_data.session_data[PlayerNum.P1].selected_difficulty = max_difficulty
|
global_data.session_data[PlayerNum.P1].selected_difficulty = selected_difficulty
|
||||||
global_data.modifiers[PlayerNum.P1].auto = True
|
global_data.modifiers[PlayerNum.P1].auto = args.auto
|
||||||
|
|
||||||
logger.info(f"Initial screen: {current_screen}")
|
logger.info(f"Initial screen: {current_screen}")
|
||||||
|
|
||||||
audio.set_log_level((log_level-1)//10)
|
audio.set_log_level((log_level-1)//10)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ judge_counter = false
|
|||||||
nijiiro_notes = false
|
nijiiro_notes = false
|
||||||
log_level = 30
|
log_level = 30
|
||||||
fake_online = false
|
fake_online = false
|
||||||
|
practice_mode_bar_delay = 1
|
||||||
|
|
||||||
[nameplate_1p]
|
[nameplate_1p]
|
||||||
name = 'どんちゃん'
|
name = 'どんちゃん'
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class GeneralConfig(TypedDict):
|
|||||||
nijiiro_notes: bool
|
nijiiro_notes: bool
|
||||||
log_level: int
|
log_level: int
|
||||||
fake_online: bool
|
fake_online: bool
|
||||||
|
practice_mode_bar_delay: int
|
||||||
|
|
||||||
class NameplateConfig(TypedDict):
|
class NameplateConfig(TypedDict):
|
||||||
name: str
|
name: str
|
||||||
|
|||||||
@@ -1280,7 +1280,7 @@ class FileNavigator:
|
|||||||
if selected_item.collection == Directory.COLLECTIONS[3]:
|
if selected_item.collection == Directory.COLLECTIONS[3]:
|
||||||
diff_sort = self.diff_sort_level
|
diff_sort = self.diff_sort_level
|
||||||
diffs = ['かんたん', 'ふつう', 'むずかしい', 'おに']
|
diffs = ['かんたん', 'ふつう', 'むずかしい', 'おに']
|
||||||
hori_name = OutlinedText(diffs[min(Difficulty.ONI, self.diff_sort_diff)], 40, ray.WHITE, outline_thickness=5)
|
hori_name = OutlinedText(diffs[min(Difficulty.ONI, self.diff_sort_diff)], tex.skin_config["song_hori_name"].font_size, ray.WHITE, outline_thickness=5)
|
||||||
self.genre_bg = GenreBG(start_box, end_box, hori_name, diff_sort)
|
self.genre_bg = GenreBG(start_box, end_box, hori_name, diff_sort)
|
||||||
|
|
||||||
def select_current_item(self):
|
def select_current_item(self):
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class PracticeGameScreen(GameScreen):
|
|||||||
else:
|
else:
|
||||||
self.player_1.input_log.clear()
|
self.player_1.input_log.clear()
|
||||||
resume_bar_index = max(0, self.scrobble_index)
|
resume_bar_index = max(0, self.scrobble_index)
|
||||||
previous_bar_index = max(0, self.scrobble_index - 1)
|
previous_bar_index = max(0, self.scrobble_index - global_data.config["general"]["practice_mode_bar_delay"])
|
||||||
|
|
||||||
first_bar_time = self.bars[0].hit_ms
|
first_bar_time = self.bars[0].hit_ms
|
||||||
resume_time = self.bars[resume_bar_index].hit_ms - first_bar_time + self.start_delay
|
resume_time = self.bars[resume_bar_index].hit_ms - first_bar_time + self.start_delay
|
||||||
@@ -87,9 +87,9 @@ class PracticeGameScreen(GameScreen):
|
|||||||
self.player_1.total_notes = len([note for note in self.player_1.play_notes if 0 < note.type < 5])
|
self.player_1.total_notes = len([note for note in self.player_1.play_notes if 0 < note.type < 5])
|
||||||
|
|
||||||
self.pause_time = start_time
|
self.pause_time = start_time
|
||||||
if self.song_music is not None:
|
|
||||||
audio.play_music_stream(self.song_music, 'music')
|
audio.play_music_stream(self.song_music, 'music')
|
||||||
audio.seek_music_stream(self.song_music, (self.pause_time - self.start_delay)/1000 - self.tja.metadata.offset)
|
audio.seek_music_stream(self.song_music, (self.pause_time - self.start_delay)/1000 - self.tja.metadata.offset)
|
||||||
|
self.song_started = True
|
||||||
self.start_ms = get_current_ms() - self.pause_time
|
self.start_ms = get_current_ms() - self.pause_time
|
||||||
|
|
||||||
def global_keys(self):
|
def global_keys(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user