special treatment for cs+ challenges

This commit is contained in:
Alula 2022-02-12 10:12:30 +01:00
parent 3cd95b4427
commit 37cb574907
No known key found for this signature in database
GPG Key ID: 3E00485503A1D8BA
2 changed files with 21 additions and 1 deletions

View File

@ -1,7 +1,7 @@
use std::collections::HashMap;
use std::io::{BufRead, BufReader, Cursor, Read};
use byteorder::{ReadBytesExt, LE};
use byteorder::{LE, ReadBytesExt};
use case_insensitive_hashmap::CaseInsensitiveHashMap;
use crate::case_insensitive_hashmap;
@ -1679,6 +1679,7 @@ impl EngineConstants {
self.soundtracks.insert("Ridiculon".to_owned(), "/base/ogg_ridic/".to_owned());
self.animated_face_table.push(AnimatedFace { face_id: 5, anim_id: 4, anim_frames: vec![(4, 0)] }); // Teethrog fix
self.game.tile_offset_x = 3;
self.game.new_game_player_pos = (13, 8);
}
pub fn rebuild_path_list(&mut self, mod_path: Option<String>, season: Season, settings: &Settings) {
@ -1708,6 +1709,24 @@ impl EngineConstants {
}
}
pub fn special_treatment_for_csplus_mods(&mut self, mod_path: Option<&String>) {
if !self.is_cs_plus {
return;
}
let mut pos = if self.is_switch { (13, 8) } else { (10, 8) };
if let Some(mod_path) = mod_path {
if mod_path == "/TimeTrial/mod/" {
pos = (8, 9);
} else if mod_path == "/boss/mod/" {
pos = (57, 21);
}
}
self.game.new_game_player_pos = pos;
}
pub fn apply_constant_json_files(&mut self) {}
/// Loads bullet.tbl and arms_level.tbl from CS+ files,

View File

@ -312,6 +312,7 @@ impl SharedGameState {
pub fn reload_resources(&mut self, ctx: &mut Context) -> GameResult {
self.constants.rebuild_path_list(self.mod_path.clone(), self.season, &self.settings);
self.constants.special_treatment_for_csplus_mods(self.mod_path.as_ref());
self.constants.load_csplus_tables(ctx)?;
self.constants.load_animated_faces(ctx)?;
let stages = StageData::load_stage_table(ctx, &self.constants.base_paths)?;