mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-09-28 21:19:24 +00:00
Add texture size lookup file
This commit is contained in:
parent
9b3e2837b7
commit
ccd4030dc1
|
@ -92,7 +92,6 @@ pub struct CaretConsts {
|
|||
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
pub struct TextureSizeTable {
|
||||
r#override: bool,
|
||||
sizes: HashMap<String, (u16, u16)>,
|
||||
}
|
||||
|
||||
|
@ -1767,6 +1766,20 @@ impl EngineConstants {
|
|||
|
||||
pub fn apply_constant_json_files(&mut self) {}
|
||||
|
||||
pub fn load_texture_size_hints(&mut self, ctx: &mut Context) -> GameResult {
|
||||
if let Ok(file) = filesystem::open_find(ctx, &self.base_paths, "/texture_sizes.json") {
|
||||
match serde_json::from_reader::<_, TextureSizeTable>(file) {
|
||||
Ok(tex_overrides) => {
|
||||
for (key, (x, y)) in tex_overrides.sizes {
|
||||
self.tex_sizes.insert(key, (x, y));
|
||||
}
|
||||
}
|
||||
Err(err) => log::warn!("Failed to deserialize texture sizes: {}", err),
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Loads bullet.tbl and arms_level.tbl from CS+ files,
|
||||
/// even though they match vanilla 1:1, we should load them for completeness
|
||||
/// or if any crazy person uses it for a CS+ mod...
|
||||
|
|
|
@ -316,6 +316,7 @@ impl SharedGameState {
|
|||
self.constants.special_treatment_for_csplus_mods(self.mod_path.as_ref());
|
||||
self.constants.load_csplus_tables(ctx)?;
|
||||
self.constants.load_animated_faces(ctx)?;
|
||||
self.constants.load_texture_size_hints(ctx)?;
|
||||
let stages = StageData::load_stage_table(ctx, &self.constants.base_paths)?;
|
||||
self.stages = stages;
|
||||
|
||||
|
|
Loading…
Reference in a new issue