Make the get_headband_spritesheet function static[ci skip]

This commit is contained in:
biroder
2024-12-03 22:41:17 +02:00
parent f7e76e09a2
commit bf8a80150d
2 changed files with 4 additions and 6 deletions
+2 -4
View File
@@ -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())?;
+2 -2
View File
@@ -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)?;