From 63a0a11d6470b8cd98950ec76e46050287702553 Mon Sep 17 00:00:00 2001 From: Anthony Samms Date: Fri, 24 Oct 2025 18:54:15 -0400 Subject: [PATCH] add oshiri collab --- libs/background.py | 3 +- libs/bg_collabs/__init__.py | 1 + libs/bg_collabs/buttoburst.py | 1 - libs/bg_collabs/oshiri.py | 74 +++++++++++++++++++++++++++++++++++ libs/bg_objects/bg_normal.py | 2 + libs/bg_objects/don_bg.py | 31 +++------------ 6 files changed, 84 insertions(+), 28 deletions(-) create mode 100644 libs/bg_collabs/oshiri.py diff --git a/libs/background.py b/libs/background.py index a2af782..ab8f0e4 100644 --- a/libs/background.py +++ b/libs/background.py @@ -16,7 +16,8 @@ class Background: COLLABS = { "A3": libs.bg_collabs.a3.Background, "ANIMAL": libs.bg_collabs.animal.Background, - "BUTTOBURST": libs.bg_collabs.buttoburst.Background + "BUTTOBURST": libs.bg_collabs.buttoburst.Background, + "OSHIRI": libs.bg_collabs.oshiri.Background, } def __init__(self, player_num: int, bpm: float, scene_preset: str = ''): """ diff --git a/libs/bg_collabs/__init__.py b/libs/bg_collabs/__init__.py index b7d432c..d0b4300 100644 --- a/libs/bg_collabs/__init__.py +++ b/libs/bg_collabs/__init__.py @@ -1,3 +1,4 @@ from . import a3 from . import animal from . import buttoburst +from . import oshiri diff --git a/libs/bg_collabs/buttoburst.py b/libs/bg_collabs/buttoburst.py index 6e47c3c..14c5fdc 100644 --- a/libs/bg_collabs/buttoburst.py +++ b/libs/bg_collabs/buttoburst.py @@ -4,7 +4,6 @@ from libs.bg_objects.bg_normal import BGNormalBase from libs.bg_objects.chibi import ChibiController from libs.bg_objects.dancer import BaseDancer, BaseDancerGroup from libs.bg_objects.fever import Fever3 -from libs.bg_objects.footer import Footer from libs.bg_objects.renda import RendaController from libs.texture import TextureWrapper from libs.bg_objects.don_bg import DonBG4 diff --git a/libs/bg_collabs/oshiri.py b/libs/bg_collabs/oshiri.py new file mode 100644 index 0000000..bb7b2e5 --- /dev/null +++ b/libs/bg_collabs/oshiri.py @@ -0,0 +1,74 @@ +from libs.animation import Animation +from libs.bg_objects.fever import Fever3 +from libs.bg_objects.bg_fever import BGFeverBase +from libs.bg_objects.bg_normal import BGNormalBase +from libs.bg_objects.chibi import ChibiController +from libs.bg_objects.dancer import BaseDancer, BaseDancerGroup +from libs.bg_objects.don_bg import DonBGBase +from libs.bg_objects.footer import Footer +from libs.bg_objects.renda import RendaController +from libs.texture import TextureWrapper + +class Background: + def __init__(self, tex: TextureWrapper, player_num: int, bpm: float): + self.tex_wrapper = tex + path = 'background/collab/oshiri' + self.max_dancers = 5 + self.don_bg = DonBG(self.tex_wrapper, 0, 1, path) + self.bg_normal = BGNormal(self.tex_wrapper, 0, path) + self.bg_fever = BGFever(self.tex_wrapper, 0, path) + self.footer = Footer(self.tex_wrapper, 0, path) + self.fever = Fever3(self.tex_wrapper, 0, bpm, path) + self.dancer = DancerGroup(self.tex_wrapper, 0, bpm, self.max_dancers, path) + self.renda = RendaController(self.tex_wrapper, 0, path) + self.chibi = ChibiController(self.tex_wrapper, 0, bpm, path) + +class DancerGroup(BaseDancerGroup): + def __init__(self, tex: TextureWrapper, index: int, bpm: float, max_dancers: int, path: str): + self.name = 'dancer_' + str(index) + self.active_count = 0 + tex.load_zip(path, f'dancer/{self.name}') + self.spawn_positions = [2, 1, 3, 0, 4] + self.active_dancers = [None] * max_dancers + self.dancers = [BaseDancer(self.name, 0, bpm, tex), + BaseDancer(self.name, 1, bpm, tex), + BaseDancer(self.name, 1, bpm, tex), + BaseDancer(self.name, 1, bpm, tex), + BaseDancer(self.name, 1, bpm, tex)] + self.add_dancer() + +class DonBG(DonBGBase): + def __init__(self, tex: TextureWrapper, index: int, player_num: int, path: str): + super().__init__(tex, index, player_num, path) + self.move = Animation.create_move(20000, total_distance=-1344) + self.move.start() + self.move.loop = True + def _draw_textures(self, tex: TextureWrapper, fade: float, y: float): + for i in range(16): + tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*168)+self.move.attribute, y=y) + for j in range(3): + tex.draw_texture(self.name, 'overlay', frame=self.is_clear, fade=fade, x=(i*168)+self.move.attribute, y=y+(j*70)) + +class BGNormal(BGNormalBase): + def __init__(self, tex: TextureWrapper, index: int, path: str): + super().__init__(tex, index, path) + + def draw(self, tex: TextureWrapper): + tex.draw_texture(self.name, 'background') + +class BGFever(BGFeverBase): + def __init__(self, tex: TextureWrapper, index: int, path: str): + super().__init__(tex, index, path) + self.overlay_texture_change = Animation.create_texture_change(2049, textures=[(0, 683, 0), (683, 1366, 1), (1366, 2049, 2)]) + + def start(self): + self.overlay_texture_change.start() + self.overlay_texture_change.loop = True + self.transitioned = True + + def update(self, current_time_ms: float): + self.overlay_texture_change.update(current_time_ms) + + def draw(self, tex: TextureWrapper): + tex.draw_texture(self.name, 'background') + tex.draw_texture(self.name, 'overlay', frame=self.overlay_texture_change.attribute) diff --git a/libs/bg_objects/bg_normal.py b/libs/bg_objects/bg_normal.py index a79a863..4507374 100644 --- a/libs/bg_objects/bg_normal.py +++ b/libs/bg_objects/bg_normal.py @@ -16,6 +16,8 @@ class BGNormalBase: def __init__(self, tex: TextureWrapper, index: int, path: str): self.name = "bg_" + str(index) tex.load_zip(path, f'bg_normal/{self.name}') + def update(self, current_time_ms: float): + pass class BGNormal1(BGNormalBase): def __init__(self, tex: TextureWrapper, index: int, path: str): diff --git a/libs/bg_objects/don_bg.py b/libs/bg_objects/don_bg.py index 9fba140..9070c64 100644 --- a/libs/bg_objects/don_bg.py +++ b/libs/bg_objects/don_bg.py @@ -17,6 +17,11 @@ class DonBGBase: self.is_clear = False self.clear_fade = tex.get_animation(1) + def draw(self, tex: TextureWrapper, y: float=0): + self._draw_textures(tex, 1.0, y) + if self.is_clear: + self._draw_textures(tex, self.clear_fade.attribute, y) + def update(self, current_time_ms: float, is_clear: bool): if not self.is_clear and is_clear: self.clear_fade.start() @@ -31,10 +36,6 @@ class DonBG1(DonBGBase): def update(self, current_time_ms: float, is_clear: bool): super().update(current_time_ms, is_clear) self.overlay_move.update(current_time_ms) - def draw(self, tex: TextureWrapper, y: float=0): - self._draw_textures(tex, 1.0, y) - if self.is_clear: - self._draw_textures(tex, self.clear_fade.attribute, y) def _draw_textures(self, tex: TextureWrapper, fade: float, y: float): for i in range(5): tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*328)+self.move.attribute, y=y) @@ -50,10 +51,6 @@ class DonBG2(DonBGBase): def update(self, current_time_ms: float, is_clear: bool): super().update(current_time_ms, is_clear) self.overlay_move.update(current_time_ms) - def draw(self, tex: TextureWrapper, y: float = 0): - self._draw_textures(tex, 1.0, y) - if self.is_clear: - self._draw_textures(tex, self.clear_fade.attribute, y) def _draw_textures(self, tex: TextureWrapper, fade: float, y: float): for i in range(5): tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*328)+self.move.attribute, y=y) @@ -79,11 +76,6 @@ class DonBG3(DonBGBase): self.overlay_move.update(current_time_ms) self.overlay_move_2.update(current_time_ms) - def draw(self, tex: TextureWrapper, y: float = 0): - self._draw_textures(tex, 1.0, y) - if self.is_clear: - self._draw_textures(tex, self.clear_fade.attribute, y) - def _draw_textures(self, tex: TextureWrapper, fade: float, y: float): for i in range(10): tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*164)+self.move.attribute, y=y) @@ -98,10 +90,6 @@ class DonBG4(DonBGBase): def update(self, current_time_ms: float, is_clear: bool): super().update(current_time_ms, is_clear) self.overlay_move.update(current_time_ms) - def draw(self, tex: TextureWrapper, y: float = 0): - self._draw_textures(tex, 1.0, y) - if self.is_clear: - self._draw_textures(tex, self.clear_fade.attribute, y) def _draw_textures(self, tex: TextureWrapper, fade: float, y: float): for i in range(5): @@ -126,11 +114,6 @@ class DonBG5(DonBGBase): self.bounce_down.restart() self.adjust.update(current_time_ms) - def draw(self, tex: TextureWrapper, y: float = 0): - self._draw_textures(tex, 1.0, y) - if self.is_clear: - self._draw_textures(tex, self.clear_fade.attribute, y) - def _draw_textures(self, tex: TextureWrapper, fade: float, y: float): for i in range(5): tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*328)+self.move.attribute, y=y) @@ -144,10 +127,6 @@ class DonBG6(DonBGBase): def update(self, current_time_ms: float, is_clear: bool): super().update(current_time_ms, is_clear) self.overlay_move.update(current_time_ms) - def draw(self, tex: TextureWrapper, y: float = 0): - self._draw_textures(tex, 1.0, y) - if self.is_clear: - self._draw_textures(tex, self.clear_fade.attribute, y) def _draw_textures(self, tex: TextureWrapper, fade: float, y: float): for i in range(5):