deworming my simulator

This commit is contained in:
Yonokid
2025-08-28 20:50:53 -04:00
parent 9da7ce7b95
commit 2bf7495020
13 changed files with 257 additions and 382 deletions

View File

@@ -1,14 +1,10 @@
import pyray as ray
from libs.texture import tex
from libs.utils import get_current_ms
from scenes.song_select import ScoreHistory
class DevScreen:
def __init__(self, width: int, height: int):
self.width = width
self.height = height
def __init__(self):
self.width = 1280
self.height = 720
self.screen_init = False
def on_screen_start(self):

View File

@@ -20,9 +20,7 @@ class State:
SELECT_MODE = 1
class EntryScreen:
def __init__(self, width: int, height: int):
self.width = width
self.height = height
def __init__(self):
self.screen_init = False
def load_textures(self):
@@ -51,9 +49,7 @@ class EntryScreen:
self.cloud_resize_loop = tex.get_animation(6)
self.cloud_texture_change = tex.get_animation(7)
self.cloud_fade = tex.get_animation(8)
self.cloud_resize_loop.start()
self.side_select_fade.start()
self.bg_flicker.start()
audio.play_sound(self.bgm)
def on_screen_end(self, next_screen: str):
@@ -101,8 +97,6 @@ class EntryScreen:
self.on_screen_start()
self.side_select_fade.update(get_current_ms())
self.bg_flicker.update(get_current_ms())
if self.bg_flicker.is_finished:
self.bg_flicker.restart()
self.drum_move_1.update(get_current_ms())
self.drum_move_2.update(get_current_ms())
self.drum_move_3.update(get_current_ms())
@@ -110,8 +104,6 @@ class EntryScreen:
self.cloud_texture_change.update(get_current_ms())
self.cloud_fade.update(get_current_ms())
self.cloud_resize_loop.update(get_current_ms())
if self.cloud_resize_loop.is_finished:
self.cloud_resize_loop.restart()
self.box_manager.update(get_current_ms())
if self.box_manager.is_finished():
return self.on_screen_end(self.box_manager.selected_box())
@@ -152,37 +144,30 @@ class EntryScreen:
tex.draw_texture('side_select', '2P', fade=fade)
if self.side == 0:
tex.draw_texture('side_select', '1P_highlight', fade=fade)
tex.textures['side_select']['1P2P_outline'].x = 261
tex.draw_texture('side_select', '1P2P_outline', fade=fade, mirror='horizontal')
tex.draw_texture('side_select', '1P2P_outline', index=0, fade=fade, mirror='horizontal')
elif self.side == 1:
tex.draw_texture('side_select', 'cancel_highlight', fade=fade)
tex.draw_texture('side_select', 'cancel_outline', fade=fade)
else:
tex.draw_texture('side_select', '2P_highlight', fade=fade)
tex.textures['side_select']['1P2P_outline'].x = 762
tex.draw_texture('side_select', '1P2P_outline', fade=fade)
tex.draw_texture('side_select', '1P2P_outline', index=1, fade=fade)
tex.draw_texture('side_select', 'cancel_text', fade=fade)
def draw_player_drum(self):
move_x = self.drum_move_3.attribute
move_y = self.drum_move_1.attribute + self.drum_move_2.attribute
tex.update_attr('side_select', 'red_drum', 'x', move_x)
tex.update_attr('side_select', 'red_drum', 'y', move_y)
tex.update_attr('side_select', 'blue_drum', 'y', move_y)
if self.side == 0:
tex.draw_texture('side_select', 'red_drum')
offset = 0
tex.draw_texture('side_select', 'red_drum', x=move_x, y=move_y)
else:
move_x *= -1
tex.textures['side_select']['cloud'].init_vals['x'] = tex.textures['side_select']['blue_drum'].init_vals['x']
tex.update_attr('side_select', 'blue_drum', 'x', move_x)
tex.draw_texture('side_select', 'blue_drum')
offset = 620
tex.draw_texture('side_select', 'blue_drum', x=move_x, y=move_y)
scale = self.cloud_resize.attribute
if self.cloud_resize.is_finished:
scale = max(1, self.cloud_resize_loop.attribute)
tex.update_attr('side_select', 'cloud', 'x', move_x)
tex.update_attr('side_select', 'cloud', 'y', move_y)
tex.draw_texture('side_select', 'cloud', frame=self.cloud_texture_change.attribute, fade=self.cloud_fade.attribute, scale=scale, center=True)
tex.draw_texture('side_select', 'cloud', x=move_x + offset, y=move_y, frame=self.cloud_texture_change.attribute, fade=self.cloud_fade.attribute, scale=scale, center=True)
def draw_mode_select(self):
self.draw_player_drum()
@@ -201,7 +186,7 @@ class EntryScreen:
tex.draw_texture('global', 'player_entry')
if self.box_manager.is_finished():
ray.draw_rectangle(0, 0, self.width, self.height, ray.BLACK)
ray.draw_rectangle(0, 0, 1280, 720, ray.BLACK)
def draw_3d(self):
pass
@@ -214,8 +199,8 @@ class Box:
if isinstance(self.box_tex_obj.texture, list):
raise Exception("Box texture cannot be iterable")
self.texture = self.box_tex_obj.texture
self.x = self.box_tex_obj.x
self.y = self.box_tex_obj.y
self.x = self.box_tex_obj.x[0]
self.y = self.box_tex_obj.y[0]
self.move = tex.get_animation(10)
self.open = tex.get_animation(11)
self.is_selected = False

View File

@@ -35,9 +35,8 @@ from libs.video import VideoPlayer
class GameScreen:
JUDGE_X = 414
def __init__(self, width: int, height: int):
self.width = width
self.height = height
def __init__(self):
self.width = 1280
self.current_ms = 0
self.screen_init = False
self.end_ms = 0
@@ -86,7 +85,7 @@ class GameScreen:
self.movie = None
self.song_music = None
tex.load_screen_textures('game')
self.background = Background(self.width, self.height, global_data.player_num)
self.background = Background(global_data.player_num)
self.load_sounds()
self.init_tja(global_data.selected_song, session_data.selected_difficulty)
self.song_info = SongInfo(session_data.song_title, 'TEST')
@@ -1056,7 +1055,6 @@ class KusudamaAnimation:
self.renda_move_up.start()
self.renda_move_down.start()
self.renda_fade_in.start()
self.renda_breathe.start()
self.open.reset()
self.renda_fade_out.reset()
@@ -1085,8 +1083,6 @@ class KusudamaAnimation:
self.breathing.update(current_ms)
self.renda_breathe.update(current_ms)
self.open.update(current_ms)
if self.renda_breathe.is_finished:
self.renda_breathe.restart()
self.is_finished = self.fade_out.is_finished
def draw(self):
y = self.move_down.attribute - self.move_up.attribute
@@ -1255,12 +1251,9 @@ class SongInfo:
self.genre = genre
self.song_title = OutlinedText(song_name, 40, ray.WHITE, ray.BLACK, outline_thickness=5)
self.fade = tex.get_animation(3)
self.fade.start()
def update(self, current_ms: float):
self.fade.update(current_ms)
if self.fade.is_finished:
self.fade.restart()
def draw(self):
tex.draw_texture('song_info', 'song_num', fade=self.fade.attribute, frame=global_data.songs_played % 4)

View File

@@ -10,9 +10,9 @@ from scenes.song_select import SongSelectScreen
class LoadScreen:
def __init__(self, width: int, height: int, song_select_screen: SongSelectScreen):
self.width = width
self.height = height
def __init__(self, song_select_screen: SongSelectScreen):
self.width = 1280
self.height = 720
self.screen_init = False
self.songs_loaded = False
self.navigator_started = False
@@ -20,10 +20,10 @@ class LoadScreen:
self.song_select_screen = song_select_screen
# Progress bar settings
self.progress_bar_width = width * 0.43
self.progress_bar_width = self.width * 0.43
self.progress_bar_height = 50
self.progress_bar_x = (width - self.progress_bar_width) // 2
self.progress_bar_y = height * 0.85
self.progress_bar_x = (self.width - self.progress_bar_width) // 2
self.progress_bar_y = self.height * 0.85
# Thread references
self.loading_thread = None

View File

@@ -22,9 +22,9 @@ class State:
RAINBOW = 2
class ResultScreen:
def __init__(self, width: int, height: int):
self.width = width
self.height = height
def __init__(self):
self.width = 1280
self.height = 720
self.screen_init = False
self.alpha_shader = ray.load_shader('', 'shader/grayscale_alpha.fs')

View File

@@ -13,9 +13,7 @@ from libs.utils import (
class SettingsScreen:
def __init__(self, width: int, height: int):
self.width = width
self.height = height
def __init__(self):
self.screen_init = False
self.config = global_data.config
self.headers = list(self.config.keys())

View File

@@ -32,11 +32,10 @@ class State:
class SongSelectScreen:
BOX_CENTER = 444
def __init__(self, screen_width: int, screen_height: int):
def __init__(self, screen_width: int = 1280):
self.screen_init = False
self.root_dir = global_data.config["paths"]["tja_path"]
self.screen_width = screen_width
self.screen_height = screen_height
def load_navigator(self):
self.navigator = FileNavigator(self.root_dir)
@@ -65,7 +64,6 @@ class SongSelectScreen:
self.diff_selector_move_1 = tex.get_animation(26)
self.diff_selector_move_2 = tex.get_animation(27)
self.diff_select_move_right = False
self.background_move.start()
self.state = State.BROWSING
self.selected_difficulty = -3
self.prev_diff = -3
@@ -361,9 +359,6 @@ class SongSelectScreen:
if self.text_fade_out.is_finished:
self.selected_song = True
if self.background_move.is_finished:
self.background_move.restart()
if self.last_texture_index != self.texture_index:
if not self.background_fade_change.is_started:
self.background_fade_change.start()
@@ -775,7 +770,7 @@ class YellowBox:
self.center_width = self.center_out.attribute
self.top_y = self.top_y_out.attribute
self.center_height = self.center_h_out.attribute
self.bottom_y = tex.textures['yellow_box']['yellow_box_bottom_right'].y
self.bottom_y = tex.textures['yellow_box']['yellow_box_bottom_right'].y[0]
self.edge_height = tex.textures['yellow_box']['yellow_box_bottom_right'].height
def reset(self):
@@ -1004,7 +999,6 @@ class DiffSortSelect:
self.bounce_down_2 = tex.get_animation(25)
self.bg_resize.start()
self.diff_fade_in.start()
self.box_flicker.start()
def update(self, current_ms):
self.bg_resize.update(current_ms)
@@ -1014,8 +1008,6 @@ class DiffSortSelect:
self.bounce_down_1.update(current_ms)
self.bounce_up_2.update(current_ms)
self.bounce_down_2.update(current_ms)
if self.box_flicker.is_finished:
self.box_flicker.restart()
def get_random_sort(self):
diff = random.randint(0, 4)
@@ -1113,7 +1105,7 @@ class DiffSortSelect:
if self.confirmation:
texture = tex.textures['diff_sort']['level_box']
ray.draw_rectangle(texture.x, texture.y, texture.x2, texture.y2, ray.fade(ray.BLACK, 0.5))
ray.draw_rectangle(texture.x[0], texture.y[0], texture.x2[0], texture.y2[0], ray.fade(ray.BLACK, 0.5))
y = -self.bounce_up_1.attribute + self.bounce_down_1.attribute - self.bounce_up_2.attribute + self.bounce_down_2.attribute
for i in range(3):
if i == self.confirm_index:
@@ -1146,8 +1138,6 @@ class NeiroSelector:
self.move.start()
self.blue_arrow_fade = tex.get_animation(29)
self.blue_arrow_move = tex.get_animation(30)
self.blue_arrow_move.start()
self.blue_arrow_fade.start()
self.text = OutlinedText(self.sounds[self.selected_sound], 50, ray.WHITE, ray.BLACK)
self.text_2 = OutlinedText(self.sounds[self.selected_sound], 50, ray.WHITE, ray.BLACK)
self.move_sideways = tex.get_animation(31)
@@ -1205,10 +1195,6 @@ class NeiroSelector:
if self.move_sideways.is_finished:
self.text.unload()
self.text = OutlinedText(self.sounds[self.selected_sound], 50, ray.WHITE, ray.BLACK)
if self.blue_arrow_fade.is_finished:
self.blue_arrow_fade.restart()
if self.blue_arrow_move.is_finished:
self.blue_arrow_move.restart()
self.is_finished = self.move.is_finished and self.is_confirmed
def draw(self):
@@ -1262,8 +1248,6 @@ class ModifierSelector:
self.is_finished = False
self.blue_arrow_fade = tex.get_animation(29)
self.blue_arrow_move = tex.get_animation(30)
self.blue_arrow_move.start()
self.blue_arrow_fade.start()
self.move = tex.get_animation(28)
self.move.start()
self.move_sideways = tex.get_animation(31)
@@ -1301,11 +1285,6 @@ class ModifierSelector:
self.text_speed.unload()
self.text_speed = OutlinedText(str(current_value), 30, ray.WHITE, ray.BLACK, outline_thickness=3.5)
if self.blue_arrow_fade.is_finished:
self.blue_arrow_fade.restart()
if self.blue_arrow_move.is_finished:
self.blue_arrow_move.restart()
def confirm(self):
if self.is_confirmed:
return

View File

@@ -18,9 +18,7 @@ class State:
ATTRACT_VIDEO = 2
class TitleScreen:
def __init__(self, width: int, height: int):
self.width = width
self.height = height
def __init__(self):
video_dir = Path(global_data.config["paths"]["video_path"]) / "op_videos"
self.op_video_list = [file for file in video_dir.glob("**/*.mp4")]
video_dir = Path(global_data.config["paths"]["video_path"]) / "attract_videos"
@@ -180,14 +178,14 @@ class WarningScreen:
else:
self.shadow_fade.restart()
self.is_finished = self.chara_1_frame.is_finished
def draw(self, fade: float, fade_2: float):
tex.draw_texture('warning', 'chara_0_shadow', fade=fade_2)
tex.draw_texture('warning', 'chara_0', frame=self.chara_0_frame.attribute, fade=fade)
def draw(self, fade: float, fade_2: float, y_pos: float):
tex.draw_texture('warning', 'chara_0_shadow', fade=fade_2, y=y_pos)
tex.draw_texture('warning', 'chara_0', frame=self.chara_0_frame.attribute, fade=fade, y=y_pos)
tex.draw_texture('warning', 'chara_1_shadow', fade=fade_2)
tex.draw_texture('warning', 'chara_1_shadow', fade=fade_2, y=y_pos)
if -1 < self.chara_1_frame.attribute-1 < 7:
tex.draw_texture('warning', 'chara_1', frame=self.chara_1_frame.attribute-1, fade=self.shadow_fade.attribute)
tex.draw_texture('warning', 'chara_1', frame=self.chara_1_frame.attribute, fade=fade)
tex.draw_texture('warning', 'chara_1', frame=self.chara_1_frame.attribute-1, fade=self.shadow_fade.attribute, y=y_pos)
tex.draw_texture('warning', 'chara_1', frame=self.chara_1_frame.attribute, fade=fade, y=y_pos)
class Board:
def __init__(self):
@@ -209,10 +207,9 @@ class WarningScreen:
self.y_pos = self.move_up.attribute
else:
self.y_pos = self.move_down.attribute
tex.update_attr('warning', 'warning_box', 'y', self.y_pos)
def draw(self):
tex.draw_texture('warning', 'warning_box')
tex.draw_texture('warning', 'warning_box', y=self.y_pos)
def __init__(self, current_ms: float):
@@ -238,10 +235,6 @@ class WarningScreen:
elapsed_time = current_ms - self.start_ms
self.warning_x.update(current_ms, title_screen.sound_warning_error)
self.characters.update(current_ms)
tex.update_attr('warning', 'chara_0', 'y', self.board.y_pos)
tex.update_attr('warning', 'chara_0_shadow', 'y', self.board.y_pos)
tex.update_attr('warning', 'chara_1_shadow', 'y', self.board.y_pos)
tex.update_attr('warning', 'chara_1', 'y', self.board.y_pos)
if self.characters.is_finished:
self.warning_bachi_hit.update(current_ms, title_screen.sound_bachi_hit)
@@ -256,7 +249,7 @@ class WarningScreen:
def draw(self):
self.board.draw()
self.warning_x.draw_bg()
self.characters.draw(self.fade_in.attribute, min(self.fade_in.attribute, 0.75))
self.characters.draw(self.fade_in.attribute, min(self.fade_in.attribute, 0.75), self.board.y_pos)
self.warning_x.draw_fg()
self.warning_bachi_hit.draw()