Compare commits

...

4 Commits

Author SHA1 Message Date
Anthony Samms
0fa765e58b Merge pull request #196 from QBaraki/better_hit_lane_effect
feat: added new 'judgment' for LaneHitEffect and makes lane hit effect more accurate
2026-01-15 06:35:36 -05:00
Anthony Samms
0e5100c3d0 Update PyTaikoGreen 2026-01-15 06:35:29 -05:00
Anthony Samms
7111677e0f Update osz.py 2026-01-15 06:34:30 -05:00
QBaraki
a461a4efa9 feat: added new 'judgment' for LaneHitEffect
In order to make the hit lane effect to be arcade accurate,
this variable was introduced.

`Player.check_note()` and `LaneHitEffect.draw()` function has been changed
in order to process such accurate hit lane effect.

Please note that in file `Skins/SkinName/Graphics/game/animation.json`,
the field with `"id": 0` needs to have `initial_opacity` set to `0.3`
for better experiences.
2026-01-06 18:01:53 +07:00
3 changed files with 10 additions and 8 deletions

View File

@@ -33,7 +33,7 @@ class OsuParser:
self.metadata.offset = -30/1000 self.metadata.offset = -30/1000
self.metadata.title["en"] = self.osu_metadata["Version"] self.metadata.title["en"] = self.osu_metadata["Version"]
self.metadata.subtitle["en"] = self.osu_metadata["Creator"] self.metadata.subtitle["en"] = self.osu_metadata["Creator"]
match = re.search(r'\[Events\][\s\S]*?^[ \t]*(\d+),(\d+),"([^"]+)"', osu_file.read_text(), re.MULTILINE) match = re.search(r'\[Events\][\s\S]*?^[ \t]*(\d+),(\d+),"([^"]+)"', osu_file.read_text(encoding='utf-8'), re.MULTILINE)
if match: if match:
self.metadata.bgmovie = osu_file.parent / Path(match.group(3)) self.metadata.bgmovie = osu_file.parent / Path(match.group(3))
self.metadata.course_data[0] = CourseData() self.metadata.course_data[0] = CourseData()

View File

@@ -955,7 +955,7 @@ class Player:
big = curr_note.type == NoteType.DON_L or curr_note.type == NoteType.KAT_L big = curr_note.type == NoteType.DON_L or curr_note.type == NoteType.KAT_L
if (curr_note.hit_ms - good_window_ms) <= ms_from_start <= (curr_note.hit_ms + good_window_ms): if (curr_note.hit_ms - good_window_ms) <= ms_from_start <= (curr_note.hit_ms + good_window_ms):
self.draw_judge_list.append(Judgment(Judgments.GOOD, big, self.is_2p)) self.draw_judge_list.append(Judgment(Judgments.GOOD, big, self.is_2p))
self.lane_hit_effect = LaneHitEffect(Judgments.GOOD, self.is_2p) self.lane_hit_effect = LaneHitEffect(drum_type, Judgments.GOOD, self.is_2p)
self.good_count += 1 self.good_count += 1
self.score += self.base_score self.score += self.base_score
self.base_score_list.append(ScoreCounterAnimation(self.player_num, self.base_score, self.is_2p)) self.base_score_list.append(ScoreCounterAnimation(self.player_num, self.base_score, self.is_2p))
@@ -973,6 +973,7 @@ class Player:
elif (curr_note.hit_ms - ok_window_ms) <= ms_from_start <= (curr_note.hit_ms + ok_window_ms): elif (curr_note.hit_ms - ok_window_ms) <= ms_from_start <= (curr_note.hit_ms + ok_window_ms):
self.draw_judge_list.append(Judgment(Judgments.OK, big, self.is_2p)) self.draw_judge_list.append(Judgment(Judgments.OK, big, self.is_2p))
self.lane_hit_effect = LaneHitEffect(drum_type, Judgments.OK, self.is_2p)
self.ok_count += 1 self.ok_count += 1
self.score += 10 * math.floor(self.base_score / 2 / 10) self.score += 10 * math.floor(self.base_score / 2 / 10)
self.base_score_list.append(ScoreCounterAnimation(self.player_num, 10 * math.floor(self.base_score / 2 / 10), self.is_2p)) self.base_score_list.append(ScoreCounterAnimation(self.player_num, 10 * math.floor(self.base_score / 2 / 10), self.is_2p))
@@ -1036,7 +1037,7 @@ class Player:
self.kusudama_anim = None self.kusudama_anim = None
def spawn_hit_effects(self, drum_type: DrumType, side: Side): def spawn_hit_effects(self, drum_type: DrumType, side: Side):
self.lane_hit_effect = LaneHitEffect(drum_type, self.is_2p) self.lane_hit_effect = LaneHitEffect(drum_type, Judgments.BAD, self.is_2p) # Bad code detected...
self.draw_drum_hit_list.append(DrumHitEffect(drum_type, side, self.is_2p)) self.draw_drum_hit_list.append(DrumHitEffect(drum_type, side, self.is_2p))
def handle_input(self, ms_from_start: float, current_time: float, background: Optional[Background]): def handle_input(self, ms_from_start: float, current_time: float, background: Optional[Background]):
@@ -1461,9 +1462,10 @@ class Judgment:
class LaneHitEffect: class LaneHitEffect:
"""Display a gradient overlay when the player hits the drum""" """Display a gradient overlay when the player hits the drum"""
def __init__(self, type: Judgments | DrumType, is_2p: bool): def __init__(self, type: DrumType, judgment: Judgments, is_2p: bool):
self.is_2p = is_2p self.is_2p = is_2p
self.type = type self.type = type
self.judgment = judgment
self.fade = tex.get_animation(0, is_copy=True) self.fade = tex.get_animation(0, is_copy=True)
self.fade.start() self.fade.start()
self.is_finished = False self.is_finished = False
@@ -1474,12 +1476,12 @@ class LaneHitEffect:
self.is_finished = True self.is_finished = True
def draw(self): def draw(self):
if self.type == Judgments.GOOD: if self.type == DrumType.DON:
tex.draw_texture('lane', 'lane_hit_effect', frame=2, index=self.is_2p, fade=self.fade.attribute)
elif self.type == DrumType.DON:
tex.draw_texture('lane', 'lane_hit_effect', frame=0, index=self.is_2p, fade=self.fade.attribute) tex.draw_texture('lane', 'lane_hit_effect', frame=0, index=self.is_2p, fade=self.fade.attribute)
elif self.type == DrumType.KAT: elif self.type == DrumType.KAT:
tex.draw_texture('lane', 'lane_hit_effect', frame=1, index=self.is_2p, fade=self.fade.attribute) tex.draw_texture('lane', 'lane_hit_effect', frame=1, index=self.is_2p, fade=self.fade.attribute)
if self.judgment == Judgments.GOOD or self.judgment == Judgments.OK:
tex.draw_texture('lane', 'lane_hit_effect', frame=2, index=self.is_2p, fade=self.fade.attribute)
class DrumHitEffect: class DrumHitEffect:
"""Display the side of the drum hit""" """Display the side of the drum hit"""