Starting to refactor config stuff
So that I can add in a "Added WADs" and "Removed WADs"
This commit is contained in:
52
src/wad.rs
52
src/wad.rs
@@ -56,6 +56,15 @@ pub struct OpenWad {
|
||||
level_indicies: Vec<usize>,
|
||||
}
|
||||
|
||||
pub fn find_txt_file(path: &PathBuf) -> Option<PathBuf> {
|
||||
// get folder WAD is in
|
||||
// get name of WAD
|
||||
// iterate through all txt/TXT files
|
||||
// if name is like 50% the same/similar, return match
|
||||
// return if found anything, otherwise None
|
||||
None
|
||||
}
|
||||
|
||||
pub fn open_wad(path: &PathBuf) -> OpenWad {
|
||||
let mut file = BufReader::new(File::open(path).unwrap());
|
||||
let header: WadHeader = bincode::deserialize_from(&mut file).unwrap();
|
||||
@@ -174,25 +183,25 @@ pub enum Enemy {
|
||||
impl Enemy {
|
||||
pub fn difficulty_value(enemy: &Self) -> u16 {
|
||||
match enemy {
|
||||
Self::FormerHuman => 2,
|
||||
Self::WolfensteinSs => 2,
|
||||
Self::FormerHumanSergeant => 6,
|
||||
Self::HeavyWeaponDude => 10,
|
||||
Self::Imp => 4,
|
||||
Self::Arachnotron => 14,
|
||||
Self::ArchVile => 30,
|
||||
Self::BaronOfHell => 16,
|
||||
Self::BossBrain => 100,
|
||||
Self::Cacodemon => 14,
|
||||
Self::CyberDemon => 40,
|
||||
Self::HellKnight => 10,
|
||||
Self::LostSoul => 3,
|
||||
Self::Mancubus => 18,
|
||||
Self::PainElemental => 27,
|
||||
Self::Revenant => 23,
|
||||
Self::Spectre => 8,
|
||||
Self::SpiderMastermind => 35,
|
||||
Self::Demon => 7,
|
||||
Self::FormerHuman => 20,
|
||||
Self::WolfensteinSs => 20,
|
||||
Self::FormerHumanSergeant => 60,
|
||||
Self::HeavyWeaponDude => 100,
|
||||
Self::Imp => 40,
|
||||
Self::Arachnotron => 240,
|
||||
Self::ArchVile => 500,
|
||||
Self::BaronOfHell => 250,
|
||||
Self::BossBrain => 1000,
|
||||
Self::Cacodemon => 200,
|
||||
Self::CyberDemon => 500,
|
||||
Self::HellKnight => 150,
|
||||
Self::LostSoul => 30,
|
||||
Self::Mancubus => 280,
|
||||
Self::PainElemental => 470,
|
||||
Self::Revenant => 430,
|
||||
Self::Spectre => 80,
|
||||
Self::SpiderMastermind => 500,
|
||||
Self::Demon => 70,
|
||||
Self::Unknown => 0,
|
||||
}
|
||||
}
|
||||
@@ -311,6 +320,7 @@ mod tests {
|
||||
let freedoom_iwad = PathBuf::from("freedoom1.wad");
|
||||
let ow = open_wad(&freedoom_iwad);
|
||||
let summary = get_enemies_and_health_per_level(ow);
|
||||
let mut levels = Vec::new();
|
||||
for (level_name, (enemy_sum, health_sum)) in summary {
|
||||
let mut enemy_total = 0;
|
||||
for (enemy, num) in enemy_sum {
|
||||
@@ -320,8 +330,10 @@ mod tests {
|
||||
for (hoa, num) in health_sum {
|
||||
health_total += HealthAndArmour::health_value(&hoa) * num;
|
||||
}
|
||||
println!("Level: {}, et: {}, ht: {}, ratio: {}", level_name, enemy_total * 10, health_total, (enemy_total * 10) / health_total);
|
||||
levels.push((enemy_total / health_total, level_name, enemy_total, health_total));
|
||||
}
|
||||
levels.sort();
|
||||
println!("{:#?}", levels);
|
||||
panic!();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user