1212from utility_functions import *
1313
1414class Verifier ():
15- def __init__ (self ,screen , score ,speed ,judgement_shown ,bpm ):
16- global fps , high_quality_verifying_graphics
15+ def __init__ (self ,screen , score ,speed ,judgement_shown ,bpm , high_quality_verifying_graphics ):
16+ global fps
1717 self .screen = screen
1818 self .speed = speed
1919 self .score = score
@@ -22,6 +22,7 @@ def __init__(self,screen, score,speed,judgement_shown,bpm):
2222 self .judgement_highest_pos = int ((self .judgement_frames ) * 0.7 )
2323 self .judgement_shown = judgement_shown
2424 self .high_quality_verifying_graphics = high_quality_verifying_graphics
25+ self .verification_show_time = 300 # ms
2526
2627 self .frame_error = int (((10 / fps )* self .speed ) + 1 )
2728 self .song_bpm = bpm
@@ -78,10 +79,21 @@ def node_check(self,nodes_on_screen,tiles_off_screen,events):
7879 if node .check_border () or self .check_pressed (node ,events ):
7980 if node .special == 'BadApple' :
8081 tiles_off_screen .append (node )
82+ nodes_on_screen .remove (node )
83+ if self .check_pressed (node ,events ):
84+ self .verify_judgement_node (node )
85+ else : # lost
86+ self .verify_judgement_node (node ,enforce_Lost = True )
87+ continue
8188 nodes_on_screen .remove (node )
8289 self .verify_judgement_node (node )
8390
8491
92+
93+
94+
95+
96+
8597 def draw_guide_lines_node (self ,nodes_on_screen ,screen ):
8698 for node in nodes_on_screen :
8799 for i in range (len (self .node_judgement_line_half_sizes )):
@@ -95,11 +107,18 @@ def append_verification_tile(self,tile_verification):
95107 if self .high_quality_verifying_graphics :
96108 self .tiles_to_verify .append (tile_verification )
97109 else :
98- time_added_verification = tile_verification + [pygame .time .get_ticks ()]
99- self .tiles_to_verify .append (time_added_verification )
110+ tile_verification .append (pygame .time .get_ticks ())
111+ #print(tile_verification)
112+ self .tiles_to_verify .append (tile_verification )
100113
101114
102- def verify_judgement_node (self ,node ):
115+ def verify_judgement_node (self ,node ,enforce_Lost = False ):
116+ if enforce_Lost :
117+ self .append_verification_tile ([node , ("Lost" , '' ), self .judgement_frames ])
118+ if self .judgement_shown :
119+ print ("Enforced Lost" )
120+ return
121+
103122 result = ''
104123 detail = ''
105124 human_error = node .y - judgement_line
@@ -124,7 +143,7 @@ def verify_judgement_node(self,node):
124143
125144 # print result of Lost/Hit/Perfect on the screen
126145 #print(result)
127- self .tiles_to_verify . append ([node ,(result ,detail ),self .judgement_frames ])
146+ self .append_verification_tile ([node ,(result ,detail ),self .judgement_frames ])
128147
129148
130149 self .score [0 ] += point
@@ -175,7 +194,7 @@ def verify_judgement_hold(self,hold, events):
175194 return
176195 #print(result)
177196 #print("sending %s to"%hold.this_judgement_pos)
178- self .tiles_to_verify . append ([hold ,(result ,detail ),self .judgement_frames ])
197+ self .append_verification_tile ([hold ,(result ,detail ),self .judgement_frames ])
179198 self .score [0 ] += point
180199 self .update_hold_judgement_pos (hold )
181200 if result == "Lost" :
@@ -227,14 +246,32 @@ def draw_judgement(self):
227246 if verification [2 ] <= 1 :
228247 self .tiles_to_verify .remove (verification )
229248 else :
230-
231249 write_text (self .screen , line_axes [verification [0 ].line - 1 ], judgement_line - judgement_text * 3 + self .calc_pos (verification [2 ]), "%s" % (verification [1 ][0 ]), judgement_text , background_color [0 ], highlight_text_color )
232250 write_text (self .screen , line_axes [verification [0 ].line - 1 ],
233251 judgement_line - judgement_text * 3 + self .calc_pos (verification [2 ])+ judgement_text ,
234252 "%s" % (verification [1 ][1 ]), detail_text , background_color [0 ], highlight_text_color )
235253 verification [2 ] -= 1
236254 else :
237- pass
255+ cur_time = pygame .time .get_ticks ()
256+ for i in range (len (self .tiles_to_verify ) - 1 , - 1 , - 1 ):
257+ verification = self .tiles_to_verify [i ]
258+ if cur_time - verification [3 ] > self .verification_show_time :
259+ self .tiles_to_verify .remove (verification )
260+ else :
261+ write_text (self .screen , line_axes [verification [0 ].line - 1 ],
262+ judgement_line - judgement_text * 3 ,
263+ "%s" % (verification [1 ][0 ]), judgement_text , background_color [0 ], highlight_text_color )
264+
265+
238266
239267 def calc_pos (self ,note_stage ):
240- return (max (self .judgement_highest_pos , note_stage ) - self .judgement_highest_pos )
268+ return (max (self .judgement_highest_pos , note_stage ) - self .judgement_highest_pos )
269+
270+
271+
272+
273+
274+
275+
276+
277+
0 commit comments