From bf8a80150d59ffccc5fc1045f409dfd55a4d41fe Mon Sep 17 00:00:00 2001 From: biroder <107300789+biroder@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:41:17 +0200 Subject: [PATCH] Make the `get_headband_spritesheet` function static[ci skip] --- src/components/credits.rs | 6 ++---- src/game/npc/mod.rs | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/credits.rs b/src/components/credits.rs index 155073e..abe85f7 100644 --- a/src/components/credits.rs +++ b/src/components/credits.rs @@ -4,6 +4,7 @@ use crate::framework::context::Context; use crate::framework::error::GameResult; use crate::framework::graphics; use crate::game::frame::Frame; +use crate::game::npc::NPC; use crate::game::scripting::tsc::text_script::IllustrationState; use crate::game::shared_game_state::SharedGameState; use crate::graphics::font::Font; @@ -78,10 +79,7 @@ impl GameEntity<()> for Credits { if state.more_rust { // draw sue's headband separately because rust doesn't let me mutate the texture set multiple times at once - let headband_spritesheet = { - let base = if state.settings.original_textures || state.constants.is_base() { "ogph" } else { "plus" }; - format!("headband/{}/Casts", base) - }; + let headband_spritesheet = NPC::get_headband_spritesheet(state, "Casts"); let batch = state.texture_set.get_or_load_batch(ctx, &state.constants, headband_spritesheet.as_str())?; diff --git a/src/game/npc/mod.rs b/src/game/npc/mod.rs index 69e561f..93bc292 100644 --- a/src/game/npc/mod.rs +++ b/src/game/npc/mod.rs @@ -223,7 +223,7 @@ impl NPC { [42, 92, 280, 284].contains(&self.npc_type) } - fn get_headband_spritesheet(&self, state: &SharedGameState, texture_name: &str) -> String { + pub fn get_headband_spritesheet(state: &SharedGameState, texture_name: &str) -> String { let base_dir = if state.settings.original_textures || state.constants.is_base() { "ogph" } else { "plus" }; format!("headband/{}/{}", base_dir, texture_name) } @@ -677,7 +677,7 @@ impl GameEntity<([&mut Player; 2], &NPCList, &mut Stage, &mut BulletManager, &mu if self.is_sue() && state.more_rust { // draw crab headband - let headband_spritesheet = self.get_headband_spritesheet(state, &*texture_ref); + let headband_spritesheet = Self::get_headband_spritesheet(state, &*texture_ref); let batch = state.texture_set.get_or_load_batch(ctx, &state.constants, headband_spritesheet.as_str())?; batch.add_rect(final_x, final_y, &self.anim_rect); batch.draw(ctx)?;