|
@ -340,9 +340,8 @@ enum MapVariantMode { |
|
|
Offline,
|
|
|
Offline,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
// TODO: rename this since apparently I'm going to be using it a lot
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
#[derive(Debug)]
|
|
|
pub enum MapVariantType {
|
|
|
|
|
|
|
|
|
pub enum MapArea {
|
|
|
Pioneer2Ep1,
|
|
|
Pioneer2Ep1,
|
|
|
Forest1,
|
|
|
Forest1,
|
|
|
Forest2,
|
|
|
Forest2,
|
|
@ -360,23 +359,48 @@ pub enum MapVariantType { |
|
|
DarkFalz,
|
|
|
DarkFalz,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl MapVariantType {
|
|
|
|
|
|
pub fn area_value(&self) -> Option<u32> {
|
|
|
|
|
|
|
|
|
pub enum MapAreaError {
|
|
|
|
|
|
UnknownMapArea(u32),
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl MapArea {
|
|
|
|
|
|
pub fn from_value(episode: Episode, area: u32) -> Result<MapArea, MapAreaError> {
|
|
|
|
|
|
match (episode, area) {
|
|
|
|
|
|
(Episode::One, 0) => Ok(MapArea::Pioneer2Ep1),
|
|
|
|
|
|
(Episode::One, 1) => Ok(MapArea::Forest1),
|
|
|
|
|
|
(Episode::One, 2) => Ok(MapArea::Forest2),
|
|
|
|
|
|
(Episode::One, 3) => Ok(MapArea::Caves1),
|
|
|
|
|
|
(Episode::One, 4) => Ok(MapArea::Caves2),
|
|
|
|
|
|
(Episode::One, 5) => Ok(MapArea::Caves3),
|
|
|
|
|
|
(Episode::One, 6) => Ok(MapArea::Mines1),
|
|
|
|
|
|
(Episode::One, 7) => Ok(MapArea::Mines2),
|
|
|
|
|
|
(Episode::One, 8) => Ok(MapArea::Ruins1),
|
|
|
|
|
|
(Episode::One, 9) => Ok(MapArea::Ruins2),
|
|
|
|
|
|
(Episode::One, 10) => Ok(MapArea::Ruins3),
|
|
|
|
|
|
(Episode::One, 11) => Ok(MapArea::Dragon),
|
|
|
|
|
|
(Episode::One, 12) => Ok(MapArea::DeRolLe),
|
|
|
|
|
|
(Episode::One, 13) => Ok(MapArea::VolOpt),
|
|
|
|
|
|
(Episode::One, 14) => Ok(MapArea::DarkFalz),
|
|
|
|
|
|
_ => Err(MapAreaError::UnknownMapArea(area))
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn drop_area_value(&self) -> Option<u32> {
|
|
|
match self {
|
|
|
match self {
|
|
|
MapVariantType::Forest1 => Some(0),
|
|
|
|
|
|
MapVariantType::Forest2 => Some(1),
|
|
|
|
|
|
MapVariantType::Caves1 => Some(2),
|
|
|
|
|
|
MapVariantType::Caves2 => Some(3),
|
|
|
|
|
|
MapVariantType::Caves3 => Some(4),
|
|
|
|
|
|
MapVariantType::Mines1 => Some(5),
|
|
|
|
|
|
MapVariantType::Mines2 => Some(6),
|
|
|
|
|
|
MapVariantType::Ruins1 => Some(7),
|
|
|
|
|
|
MapVariantType::Ruins2 => Some(8),
|
|
|
|
|
|
MapVariantType::Ruins3 => Some(9),
|
|
|
|
|
|
MapVariantType::Dragon => Some(2),
|
|
|
|
|
|
MapVariantType::DeRolLe => Some(5),
|
|
|
|
|
|
MapVariantType::VolOpt => Some(7),
|
|
|
|
|
|
MapVariantType::DarkFalz => Some(9),
|
|
|
|
|
|
|
|
|
MapArea::Forest1 => Some(0),
|
|
|
|
|
|
MapArea::Forest2 => Some(1),
|
|
|
|
|
|
MapArea::Caves1 => Some(2),
|
|
|
|
|
|
MapArea::Caves2 => Some(3),
|
|
|
|
|
|
MapArea::Caves3 => Some(4),
|
|
|
|
|
|
MapArea::Mines1 => Some(5),
|
|
|
|
|
|
MapArea::Mines2 => Some(6),
|
|
|
|
|
|
MapArea::Ruins1 => Some(7),
|
|
|
|
|
|
MapArea::Ruins2 => Some(8),
|
|
|
|
|
|
MapArea::Ruins3 => Some(9),
|
|
|
|
|
|
MapArea::Dragon => Some(2),
|
|
|
|
|
|
MapArea::DeRolLe => Some(5),
|
|
|
|
|
|
MapArea::VolOpt => Some(7),
|
|
|
|
|
|
MapArea::DarkFalz => Some(9),
|
|
|
_ => None
|
|
|
_ => None
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -385,31 +409,31 @@ impl MapVariantType { |
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
#[derive(Debug)]
|
|
|
struct MapVariant {
|
|
|
struct MapVariant {
|
|
|
map: MapVariantType,
|
|
|
|
|
|
|
|
|
map: MapArea,
|
|
|
mode: MapVariantMode,
|
|
|
mode: MapVariantMode,
|
|
|
major: u8,
|
|
|
major: u8,
|
|
|
minor: u8,
|
|
|
minor: u8,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl MapVariant {
|
|
|
impl MapVariant {
|
|
|
fn new(map: MapVariantType, mode: MapVariantMode) -> MapVariant {
|
|
|
|
|
|
|
|
|
fn new(map: MapArea, mode: MapVariantMode) -> MapVariant {
|
|
|
let major = match map {
|
|
|
let major = match map {
|
|
|
MapVariantType::Pioneer2Ep1 => 0,
|
|
|
|
|
|
MapVariantType::Forest1 | MapVariantType::Forest2 => 0,
|
|
|
|
|
|
MapVariantType::Caves1 | MapVariantType::Caves2 | MapVariantType::Caves3 => rand::thread_rng().gen_range(0, 3),
|
|
|
|
|
|
MapVariantType::Mines1 | MapVariantType::Mines2 => rand::thread_rng().gen_range(0, 3),
|
|
|
|
|
|
MapVariantType::Ruins1 | MapVariantType::Ruins2 | MapVariantType::Ruins3 => rand::thread_rng().gen_range(0, 3),
|
|
|
|
|
|
MapVariantType::Dragon | MapVariantType::DeRolLe | MapVariantType::VolOpt | MapVariantType::DarkFalz => 0,
|
|
|
|
|
|
|
|
|
MapArea::Pioneer2Ep1 => 0,
|
|
|
|
|
|
MapArea::Forest1 | MapArea::Forest2 => 0,
|
|
|
|
|
|
MapArea::Caves1 | MapArea::Caves2 | MapArea::Caves3 => rand::thread_rng().gen_range(0, 3),
|
|
|
|
|
|
MapArea::Mines1 | MapArea::Mines2 => rand::thread_rng().gen_range(0, 3),
|
|
|
|
|
|
MapArea::Ruins1 | MapArea::Ruins2 | MapArea::Ruins3 => rand::thread_rng().gen_range(0, 3),
|
|
|
|
|
|
MapArea::Dragon | MapArea::DeRolLe | MapArea::VolOpt | MapArea::DarkFalz => 0,
|
|
|
};
|
|
|
};
|
|
|
|
|
|
|
|
|
let minor = match map {
|
|
|
let minor = match map {
|
|
|
MapVariantType::Pioneer2Ep1 => 0,
|
|
|
|
|
|
MapVariantType::Forest1 => rand::thread_rng().gen_range(0, 5),
|
|
|
|
|
|
MapVariantType::Forest2 => rand::thread_rng().gen_range(0, 5),
|
|
|
|
|
|
MapVariantType::Caves1 | MapVariantType::Caves2 | MapVariantType::Caves3 => rand::thread_rng().gen_range(0, 2),
|
|
|
|
|
|
MapVariantType::Mines1 | MapVariantType::Mines2 => rand::thread_rng().gen_range(0, 2),
|
|
|
|
|
|
MapVariantType::Ruins1 | MapVariantType::Ruins2 | MapVariantType::Ruins3 => rand::thread_rng().gen_range(0, 2),
|
|
|
|
|
|
MapVariantType::Dragon | MapVariantType::DeRolLe | MapVariantType::VolOpt | MapVariantType::DarkFalz => 0,
|
|
|
|
|
|
|
|
|
MapArea::Pioneer2Ep1 => 0,
|
|
|
|
|
|
MapArea::Forest1 => rand::thread_rng().gen_range(0, 5),
|
|
|
|
|
|
MapArea::Forest2 => rand::thread_rng().gen_range(0, 5),
|
|
|
|
|
|
MapArea::Caves1 | MapArea::Caves2 | MapArea::Caves3 => rand::thread_rng().gen_range(0, 2),
|
|
|
|
|
|
MapArea::Mines1 | MapArea::Mines2 => rand::thread_rng().gen_range(0, 2),
|
|
|
|
|
|
MapArea::Ruins1 | MapArea::Ruins2 | MapArea::Ruins3 => rand::thread_rng().gen_range(0, 2),
|
|
|
|
|
|
MapArea::Dragon | MapArea::DeRolLe | MapArea::VolOpt | MapArea::DarkFalz => 0,
|
|
|
};
|
|
|
};
|
|
|
|
|
|
|
|
|
MapVariant {
|
|
|
MapVariant {
|
|
@ -422,41 +446,41 @@ impl MapVariant { |
|
|
// TODO: rename to npc_file
|
|
|
// TODO: rename to npc_file
|
|
|
fn dat_file(&self) -> String {
|
|
|
fn dat_file(&self) -> String {
|
|
|
match self.map {
|
|
|
match self.map {
|
|
|
MapVariantType::Pioneer2Ep1 => "data/maps/map_city00_00e.dat".into(),
|
|
|
|
|
|
MapVariantType::Forest1 => format!("data/maps/map_forest01_0{}e.dat", self.minor),
|
|
|
|
|
|
MapVariantType::Forest2 => format!("data/maps/map_forest02_0{}e.dat", self.minor),
|
|
|
|
|
|
MapVariantType::Caves1 => format!("data/maps/map_cave01_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Caves2 => format!("data/maps/map_cave02_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Caves3 => format!("data/maps/map_cave03_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Mines1 => format!("data/maps/map_machine01_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Mines2 => format!("data/maps/map_machine02_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Ruins1 => format!("data/maps/map_ancient01_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Ruins2 => format!("data/maps/map_ancient02_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Ruins3 => format!("data/maps/map_ancient03_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Dragon => "data/maps/map_boss01e.dat".into(),
|
|
|
|
|
|
MapVariantType::DeRolLe => "data/maps/map_boss02e.dat".into(),
|
|
|
|
|
|
MapVariantType::VolOpt => "data/maps/map_boss03e.dat".into(),
|
|
|
|
|
|
MapVariantType::DarkFalz => "data/maps/map_boss04e.dat".into(),
|
|
|
|
|
|
|
|
|
MapArea::Pioneer2Ep1 => "data/maps/map_city00_00e.dat".into(),
|
|
|
|
|
|
MapArea::Forest1 => format!("data/maps/map_forest01_0{}e.dat", self.minor),
|
|
|
|
|
|
MapArea::Forest2 => format!("data/maps/map_forest02_0{}e.dat", self.minor),
|
|
|
|
|
|
MapArea::Caves1 => format!("data/maps/map_cave01_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Caves2 => format!("data/maps/map_cave02_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Caves3 => format!("data/maps/map_cave03_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Mines1 => format!("data/maps/map_machine01_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Mines2 => format!("data/maps/map_machine02_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Ruins1 => format!("data/maps/map_ancient01_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Ruins2 => format!("data/maps/map_ancient02_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Ruins3 => format!("data/maps/map_ancient03_0{}_0{}e.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Dragon => "data/maps/map_boss01e.dat".into(),
|
|
|
|
|
|
MapArea::DeRolLe => "data/maps/map_boss02e.dat".into(),
|
|
|
|
|
|
MapArea::VolOpt => "data/maps/map_boss03e.dat".into(),
|
|
|
|
|
|
MapArea::DarkFalz => "data/maps/map_boss04e.dat".into(),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
fn obj_file(&self) -> String {
|
|
|
fn obj_file(&self) -> String {
|
|
|
match self.map {
|
|
|
match self.map {
|
|
|
MapVariantType::Pioneer2Ep1 => "data/maps/map_city00_00e.dat".into(),
|
|
|
|
|
|
MapVariantType::Forest1 => format!("data/maps/map_forest01_0{}o.dat", self.minor),
|
|
|
|
|
|
MapVariantType::Forest2 => format!("data/maps/map_forest02_0{}o.dat", self.minor),
|
|
|
|
|
|
MapVariantType::Caves1 => format!("data/maps/map_cave01_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Caves2 => format!("data/maps/map_cave02_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Caves3 => format!("data/maps/map_cave03_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Mines1 => format!("data/maps/map_machine01_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Mines2 => format!("data/maps/map_machine02_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Ruins1 => format!("data/maps/map_ancient01_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Ruins2 => format!("data/maps/map_ancient02_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Ruins3 => format!("data/maps/map_ancient03_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapVariantType::Dragon => "data/maps/map_boss01o.dat".into(),
|
|
|
|
|
|
MapVariantType::DeRolLe => "data/maps/map_boss02o.dat".into(),
|
|
|
|
|
|
MapVariantType::VolOpt => "data/maps/map_boss03o.dat".into(),
|
|
|
|
|
|
MapVariantType::DarkFalz => "data/maps/map_boss04o.dat".into(),
|
|
|
|
|
|
|
|
|
MapArea::Pioneer2Ep1 => "data/maps/map_city00_00e.dat".into(),
|
|
|
|
|
|
MapArea::Forest1 => format!("data/maps/map_forest01_0{}o.dat", self.minor),
|
|
|
|
|
|
MapArea::Forest2 => format!("data/maps/map_forest02_0{}o.dat", self.minor),
|
|
|
|
|
|
MapArea::Caves1 => format!("data/maps/map_cave01_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Caves2 => format!("data/maps/map_cave02_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Caves3 => format!("data/maps/map_cave03_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Mines1 => format!("data/maps/map_machine01_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Mines2 => format!("data/maps/map_machine02_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Ruins1 => format!("data/maps/map_ancient01_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Ruins2 => format!("data/maps/map_ancient02_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Ruins3 => format!("data/maps/map_ancient03_0{}_0{}o.dat", self.major, self.minor),
|
|
|
|
|
|
MapArea::Dragon => "data/maps/map_boss01o.dat".into(),
|
|
|
|
|
|
MapArea::DeRolLe => "data/maps/map_boss02o.dat".into(),
|
|
|
|
|
|
MapArea::VolOpt => "data/maps/map_boss03o.dat".into(),
|
|
|
|
|
|
MapArea::DarkFalz => "data/maps/map_boss04o.dat".into(),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
@ -583,21 +607,21 @@ impl Maps { |
|
|
pub fn new(episode: Episode) -> Maps {
|
|
|
pub fn new(episode: Episode) -> Maps {
|
|
|
let map_variants = match episode {
|
|
|
let map_variants = match episode {
|
|
|
Episode::One => {
|
|
|
Episode::One => {
|
|
|
[MapVariant::new(MapVariantType::Pioneer2Ep1, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::Forest1, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::Forest2, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::Caves1, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::Caves2, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::Caves3, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::Mines1, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::Mines2, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::Ruins1, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::Ruins2, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::Ruins3, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::Dragon, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::DeRolLe, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::VolOpt, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapVariantType::DarkFalz, MapVariantMode::Online),
|
|
|
|
|
|
|
|
|
[MapVariant::new(MapArea::Pioneer2Ep1, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::Forest1, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::Forest2, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::Caves1, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::Caves2, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::Caves3, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::Mines1, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::Mines2, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::Ruins1, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::Ruins2, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::Ruins3, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::Dragon, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::DeRolLe, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::VolOpt, MapVariantMode::Online),
|
|
|
|
|
|
MapVariant::new(MapArea::DarkFalz, MapVariantMode::Online),
|
|
|
]
|
|
|
]
|
|
|
},
|
|
|
},
|
|
|
_ => panic!()
|
|
|
_ => panic!()
|
|
|