diff --git a/src/ship/map.rs b/src/ship/map.rs index 62d7215..7fe41ae 100644 --- a/src/ship/map.rs +++ b/src/ship/map.rs @@ -8,6 +8,7 @@ use std::fs::File; use byteorder::{LittleEndian, ReadBytesExt}; use crate::ship::monster::MonsterType; +use crate::ship::room::Episode; #[derive(Debug, Copy, Clone)] struct RawMapEnemy { @@ -89,6 +90,10 @@ impl MapEnemies { +#[derive(Debug)] +enum MapEnemyError { + UnknownEnemyId(u32), +} #[derive(Debug, Copy, Clone)] @@ -101,25 +106,100 @@ pub struct MapEnemy { impl MapEnemy { - fn from_raw(enemy: RawMapEnemy /*, battleparam */) -> MapEnemy { - //warn!("loading {} {} {}", enemy.id, enemy.skin, enemy.children); - warn!("{:?}", enemy); - let monster = match (enemy.id, enemy.skin) { - (66, 0) => MonsterType::Monest, - (68, 0) => MonsterType::Booma, - (68, 1) => MonsterType::Gobooma, - (68, 2) => MonsterType::Gigobooma, - - (99, 0) => MonsterType::EvilShark, - - _ => MonsterType::AlRappy, + fn from_raw(enemy: RawMapEnemy, episode: &Episode /*, battleparam */) -> Result { + let monster = match (enemy, episode) { + (RawMapEnemy {id: 64, ..}, _) => MonsterType::Hildebear, + (RawMapEnemy {id: 65, ..}, Episode::Four) => MonsterType::SandRappy, + (RawMapEnemy {id: 65, ..}, _) => MonsterType::RagRappy, + (RawMapEnemy {id: 66, ..}, _) => MonsterType::Monest, + (RawMapEnemy {id: 67, field2: 0, ..}, _) => MonsterType::SavageWolf, + (RawMapEnemy {id: 67, ..}, _) => MonsterType::BarbarousWolf, + (RawMapEnemy {id: 68, skin: 0, ..}, _) => MonsterType::Booma, + (RawMapEnemy {id: 68, skin: 1, ..}, _) => MonsterType::Gobooma, + (RawMapEnemy {id: 68, skin: 2, ..}, _) => MonsterType::Gigobooma, + (RawMapEnemy {id: 96, ..}, _) => MonsterType::GrassAssassin, + (RawMapEnemy {id: 97, ..}, Episode::Two) => MonsterType::DelLily, + (RawMapEnemy {id: 97, ..}, _) => MonsterType::PoisonLily, + (RawMapEnemy {id: 98, ..}, _) => MonsterType::NanoDragon, + (RawMapEnemy {id: 99, skin: 0, ..}, _) => MonsterType::EvilShark, + (RawMapEnemy {id: 99, skin: 1, ..}, _) => MonsterType::PalShark, + (RawMapEnemy {id: 99, skin: 2, ..}, _) => MonsterType::GuilShark, + (RawMapEnemy {id: 100, ..}, _) => MonsterType::PofuillySlime, + (RawMapEnemy {id: 101, ..}, _) => MonsterType::PanArms, + (RawMapEnemy {id: 128, skin: 0, ..}, _) => MonsterType::Dubchic, + (RawMapEnemy {id: 128, skin: 1, ..}, _) => MonsterType::Gillchic, + (RawMapEnemy {id: 129, ..}, _) => MonsterType::Garanz, + (RawMapEnemy {id: 130, field2: 0, ..}, _) => MonsterType::SinowBeat, + (RawMapEnemy {id: 130, ..}, _) => MonsterType::SinowGold, + (RawMapEnemy {id: 131, ..}, _) => MonsterType::Canadine, + (RawMapEnemy {id: 132, ..}, _) => MonsterType::Canane, + (RawMapEnemy {id: 133, ..}, _) => MonsterType::DubchicSwitch, + (RawMapEnemy {id: 160, ..}, _) => MonsterType::Delsaber, + (RawMapEnemy {id: 161, ..}, _) => MonsterType::ChaosSorcerer, + (RawMapEnemy {id: 162, ..}, _) => MonsterType::DarkGunner, + (RawMapEnemy {id: 164, ..}, _) => MonsterType::ChaosBringer, + (RawMapEnemy {id: 165, ..}, _) => MonsterType::DarkBelra, + (RawMapEnemy {id: 166, skin: 0, ..}, _) => MonsterType::Dimenian, + (RawMapEnemy {id: 166, skin: 1, ..}, _) => MonsterType::LaDimenian, + (RawMapEnemy {id: 166, skin: 2, ..}, _) => MonsterType::SoDimenian, + (RawMapEnemy {id: 167, ..}, _) => MonsterType::Bulclaw, + (RawMapEnemy {id: 168, ..}, _) => MonsterType::Claw, + (RawMapEnemy {id: 192, ..}, Episode::One) => MonsterType::Dragon, + (RawMapEnemy {id: 192, ..}, Episode::Two) => MonsterType::GalGryphon, + (RawMapEnemy {id: 193, ..}, _) => MonsterType::DeRolLe, + (RawMapEnemy {id: 194, ..}, _) => MonsterType::VolOptPartA, + (RawMapEnemy {id: 197, ..}, _) => MonsterType::VolOpt, + (RawMapEnemy {id: 200, ..}, _) => MonsterType::DarkFalz, + (RawMapEnemy {id: 202, ..}, _) => MonsterType::Olga, + (RawMapEnemy {id: 203, ..}, _) => MonsterType::BarbaRay, + (RawMapEnemy {id: 204, ..}, _) => MonsterType::GolDragon, + (RawMapEnemy {id: 212, skin: 0, ..}, _) => MonsterType::SinowBeril, + (RawMapEnemy {id: 212, skin: 1, ..}, _) => MonsterType::SinowSpigell, + (RawMapEnemy {id: 213, skin: 0, ..}, _) => MonsterType::Merillias, + (RawMapEnemy {id: 213, skin: 1, ..}, _) => MonsterType::Meriltas, + (RawMapEnemy {id: 214, skin: 0, ..}, _) => MonsterType::Mericarol, + (RawMapEnemy {id: 214, skin: 1, ..}, _) => MonsterType::Merikle, + (RawMapEnemy {id: 214, skin: 2, ..}, _) => MonsterType::Mericus, + (RawMapEnemy {id: 215, skin: 0, ..}, _) => MonsterType::UlGibbon, + (RawMapEnemy {id: 215, skin: 1, ..}, _) => MonsterType::ZolGibbon, + (RawMapEnemy {id: 216, ..}, _) => MonsterType::Gibbles, + (RawMapEnemy {id: 217, ..}, _) => MonsterType::Gee, + (RawMapEnemy {id: 218, ..}, _) => MonsterType::GiGue, + (RawMapEnemy {id: 219, ..}, _) => MonsterType::Deldepth, + (RawMapEnemy {id: 220, ..}, _) => MonsterType::Delbiter, + (RawMapEnemy {id: 221, skin: 0, ..}, _) => MonsterType::Dolmdarl, + (RawMapEnemy {id: 221, skin: 1, ..}, _) => MonsterType::Dolmolm, + (RawMapEnemy {id: 222, ..}, _) => MonsterType::Morfos, + (RawMapEnemy {id: 223, ..}, _) => MonsterType::ReconBox, + (RawMapEnemy {id: 224, ..}, _) => MonsterType::Epsilon, + (RawMapEnemy {id: 224, skin: 0, ..}, _) => MonsterType::SinowZoa, + (RawMapEnemy {id: 224, skin: 1, ..}, _) => MonsterType::SinowZele, + (RawMapEnemy {id: 225, ..}, _) => MonsterType::IllGill, + (RawMapEnemy {id: 272, ..}, _) => MonsterType::Astark, + (RawMapEnemy {id: 273, field2: 0, ..}, _) => MonsterType::SatelliteLizard, + (RawMapEnemy {id: 273, ..}, _) => MonsterType::Yowie, + (RawMapEnemy {id: 274, ..}, _) => MonsterType::MerissaA, + (RawMapEnemy {id: 275, ..}, _) => MonsterType::Girtablulu, + (RawMapEnemy {id: 276, ..}, _) => MonsterType::Zu, + (RawMapEnemy {id: 277, skin: 0, ..}, _) => MonsterType::Boota, + (RawMapEnemy {id: 277, skin: 1, ..}, _) => MonsterType::ZeBoota, + (RawMapEnemy {id: 277, skin: 2, ..}, _) => MonsterType::BaBoota, + (RawMapEnemy {id: 278, ..}, _) => MonsterType::Dorphon, + (RawMapEnemy {id: 279, skin: 0, ..}, _) => MonsterType::Goran, + (RawMapEnemy {id: 279, skin: 1, ..}, _) => MonsterType::PyroGoran, + (RawMapEnemy {id: 279, skin: 2, ..}, _) => MonsterType::GoranDetonator, + (RawMapEnemy {id: 281, skin: 0, ..}, _) => MonsterType::SaintMillion, + (RawMapEnemy {id: 281, skin: 1, ..}, _) => MonsterType::Shambertin, + _ => return Err(MapEnemyError::UnknownEnemyId(enemy.id)) + + //_ => panic!("trying to load unknown monster: {:?}", enemy) }; - MapEnemy { + Ok(MapEnemy { monster: monster, hp: 0, dead: false, - } + }) } fn new(monster: MonsterType) -> MapEnemy { diff --git a/src/ship/monster.rs b/src/ship/monster.rs index d04b3e4..aaaef41 100644 --- a/src/ship/monster.rs +++ b/src/ship/monster.rs @@ -9,23 +9,107 @@ pub enum MonsterParseError { #[derive(Debug, Copy, Clone)] pub enum MonsterType { + Hildebear, + SandRappy, + RagRappy, + Monest, + SavageWolf, + BarbarousWolf, Booma, Gobooma, Gigobooma, - RagRappy, - AlRappy, - BarbarousWolf, - SavageWolf, - Hildebear, - Hildeblue, - Monest, - Mothmant, - + GrassAssassin, + DelLily, + PoisonLily, + NanoDragon, EvilShark, PalShark, GuilShark, - // etc... - + PofuillySlime, + PanArms, + Hidoom, + Migium, + Dubchic, + Gillchic, + Garanz, + SinowBeat, + SinowGold, + Canadine, + RingCanadine, + Canane, + DubchicSwitch, + Delsaber, + ChaosSorcerer, + BeeR, + BeeL, + DarkGunner, + ChaosBringer, + DarkBelra, + Dimenian, + LaDimenian, + SoDimenian, + Bulclaw, + Claw, + Dragon, + GalGryphon, + DeRolLe, + DeRolLeBody, + DeRolLeMine, + VolOptPartA, + VolOptPillar, + VolOptMonitor, + VolOptAmp, + VolOptCore, + VolOptUnused, + VolOpt, + DarkFalz, + DarkFalz1, + DarkFalz2, + DarkFalz3, + Darvant, + UltDarvant, + Olga, + BarbaRay, + GolDragon, + SinowBeril, + SinowSpigell, + Merillias, + Meriltas, + Mericarol, + Merikle, + Mericus, + UlGibbon, + ZolGibbon, + Gibbles, + Gee, + GiGue, + Deldepth, + Delbiter, + Dolmdarl, + Dolmolm, + Morfos, + ReconBox, + Epsilon, + SinowZoa, + SinowZele, + IllGill, + Astark, + SatelliteLizard, + Yowie, + MerissaA, + Girtablulu, + Zu, + Boota, + ZeBoota, + BaBoota, + Dorphon, + Goran, + PyroGoran, + GoranDetonator, + SaintMillion, + Shambertin, + + Mothmant, }