Browse Source

add ep2 and 4 online maps

pbs
Andy Newjack 5 years ago
parent
commit
d8af58e04a
  1. 311
      src/ship/map.rs

311
src/ship/map.rs

@ -346,7 +346,7 @@ impl MapObject {
} }
#[derive(Debug)]
#[derive(Debug, PartialEq)]
enum MapVariantMode { enum MapVariantMode {
Online, Online,
Offline, Offline,
@ -369,6 +369,35 @@ pub enum MapArea {
DeRolLe, DeRolLe,
VolOpt, VolOpt,
DarkFalz, DarkFalz,
Pioneer2Ep2,
VrTempleAlpha,
VrTempleBeta,
VrSpaceshipAlpha,
VrSpaceshipBeta,
Cca,
JungleAreaNorth,
JungleAreaEast,
Mountain,
Seaside,
SeabedUpper,
SeabedLower,
GalGryphon,
OlgaFlow,
BarbaRay,
GolDragon,
// Seaside2,
// Tower,
Pioneer2Ep4,
CraterEast,
CraterWest,
CraterSouth,
CraterNorth,
CraterInterior,
SubDesert1,
SubDesert2,
SubDesert3,
SaintMillion,
// TestMapEp4,
} }
#[derive(Error, Debug)] #[derive(Error, Debug)]
@ -395,6 +424,35 @@ impl MapArea {
(Episode::One, 12) => Ok(MapArea::DeRolLe), (Episode::One, 12) => Ok(MapArea::DeRolLe),
(Episode::One, 13) => Ok(MapArea::VolOpt), (Episode::One, 13) => Ok(MapArea::VolOpt),
(Episode::One, 14) => Ok(MapArea::DarkFalz), (Episode::One, 14) => Ok(MapArea::DarkFalz),
(Episode::Two, 0) => Ok(MapArea::Pioneer2Ep2),
(Episode::Two, 1) => Ok(MapArea::VrTempleAlpha),
(Episode::Two, 2) => Ok(MapArea::VrTempleBeta),
(Episode::Two, 3) => Ok(MapArea::VrSpaceshipAlpha),
(Episode::Two, 4) => Ok(MapArea::VrSpaceshipBeta),
(Episode::Two, 5) => Ok(MapArea::Cca),
(Episode::Two, 6) => Ok(MapArea::JungleAreaNorth),
(Episode::Two, 7) => Ok(MapArea::JungleAreaEast),
(Episode::Two, 8) => Ok(MapArea::Mountain),
(Episode::Two, 9) => Ok(MapArea::Seaside),
(Episode::Two, 10) => Ok(MapArea::SeabedUpper),
(Episode::Two, 11) => Ok(MapArea::SeabedLower),
(Episode::Two, 12) => Ok(MapArea::GalGryphon),
(Episode::Two, 13) => Ok(MapArea::OlgaFlow),
(Episode::Two, 14) => Ok(MapArea::BarbaRay),
(Episode::Two, 15) => Ok(MapArea::GolDragon),
// (Episode::Two, 16) => Ok(MapArea::Seaside2), // valid map?
// (Episode::Two, 17) => Ok(MapArea::Tower), // valid map?
(Episode::Four, 0) => Ok(MapArea::Pioneer2Ep4),
(Episode::Four, 1) => Ok(MapArea::CraterEast),
(Episode::Four, 2) => Ok(MapArea::CraterWest),
(Episode::Four, 3) => Ok(MapArea::CraterSouth),
(Episode::Four, 4) => Ok(MapArea::CraterNorth),
(Episode::Four, 5) => Ok(MapArea::CraterInterior),
(Episode::Four, 6) => Ok(MapArea::SubDesert1),
(Episode::Four, 7) => Ok(MapArea::SubDesert2),
(Episode::Four, 8) => Ok(MapArea::SubDesert3),
(Episode::Four, 9) => Ok(MapArea::SaintMillion),
// (Episode::Four, 10) => Ok(MapArea::TestMapEp4), // invalid map!
_ => Err(MapAreaError::UnknownMapArea(area)) _ => Err(MapAreaError::UnknownMapArea(area))
} }
} }
@ -415,6 +473,35 @@ impl MapArea {
MapArea::DeRolLe => Some(5), MapArea::DeRolLe => Some(5),
MapArea::VolOpt => Some(7), MapArea::VolOpt => Some(7),
MapArea::DarkFalz => Some(9), MapArea::DarkFalz => Some(9),
MapArea::Pioneer2Ep2 => Some(0),
MapArea::VrTempleAlpha => Some(1),
MapArea::VrTempleBeta => Some(2),
MapArea::VrSpaceshipAlpha => Some(3),
MapArea::VrSpaceshipBeta => Some(4),
MapArea::Cca => Some(5),
MapArea::JungleAreaNorth => Some(6),
MapArea::JungleAreaEast => Some(7),
MapArea::Mountain => Some(8),
MapArea::Seaside => Some(9),
MapArea::SeabedUpper => Some(10),
MapArea::SeabedLower => Some(11),
MapArea::GalGryphon => Some(12),
MapArea::OlgaFlow => Some(13),
MapArea::BarbaRay => Some(14),
MapArea::GolDragon => Some(15),
// MapArea::Seaside2 => Some(16),
// MapArea::Tower => Some(17),
MapArea::Pioneer2Ep4 => Some(0),
MapArea::CraterEast => Some(1),
MapArea::CraterWest => Some(2),
MapArea::CraterSouth => Some(3),
MapArea::CraterNorth => Some(4),
MapArea::CraterInterior => Some(5),
MapArea::SubDesert1 => Some(6),
MapArea::SubDesert2 => Some(7),
MapArea::SubDesert3 => Some(8),
MapArea::SaintMillion => Some(9),
// MapArea::TestMapEp4 => Some(10),
_ => None _ => None
} }
} }
@ -436,6 +523,35 @@ impl MapArea {
MapArea::DeRolLe => 12, MapArea::DeRolLe => 12,
MapArea::VolOpt => 13, MapArea::VolOpt => 13,
MapArea::DarkFalz => 14, MapArea::DarkFalz => 14,
MapArea::Pioneer2Ep2 => 0,
MapArea::VrTempleAlpha => 1,
MapArea::VrTempleBeta => 2,
MapArea::VrSpaceshipAlpha => 3,
MapArea::VrSpaceshipBeta => 4,
MapArea::Cca => 5,
MapArea::JungleAreaNorth => 6,
MapArea::JungleAreaEast => 7,
MapArea::Mountain => 8,
MapArea::Seaside => 9,
MapArea::SeabedUpper => 10,
MapArea::SeabedLower => 11,
MapArea::GalGryphon => 12,
MapArea::OlgaFlow => 13,
MapArea::BarbaRay => 14,
MapArea::GolDragon => 15,
// MapArea::Seaside2 => 16,
// MapArea::Tower => 17,
MapArea::Pioneer2Ep4 => 0,
MapArea::CraterEast => 1,
MapArea::CraterWest => 2,
MapArea::CraterSouth => 3,
MapArea::CraterNorth => 4,
MapArea::CraterInterior => 5,
MapArea::SubDesert1 => 6,
MapArea::SubDesert2 => 7,
MapArea::SubDesert3 => 8,
MapArea::SaintMillion => 9,
// MapArea::TestMapEp4 => 10,
} }
} }
} }
@ -451,31 +567,88 @@ struct MapVariant {
impl MapVariant { impl MapVariant {
fn new(map: MapArea, mode: MapVariantMode) -> MapVariant { fn new(map: MapArea, mode: MapVariantMode) -> MapVariant {
let major = match map {
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 {
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 {
map: map,
mode: mode,
major: major,
minor: minor,
}
// if mode == MapVariantMode::Online {
let major = match map {
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,
MapArea::Pioneer2Ep2 => 0,
MapArea::VrTempleAlpha | MapArea::VrTempleBeta | MapArea::VrSpaceshipAlpha | MapArea::VrSpaceshipBeta => rand::thread_rng().gen_range(0, 1),
MapArea::Cca | MapArea::JungleAreaNorth | MapArea::JungleAreaEast | MapArea::Seaside => rand::thread_rng().gen_range(0, 2),
MapArea::Mountain => rand::thread_rng().gen_range(0, 1),
MapArea::SeabedUpper | MapArea::SeabedLower => rand::thread_rng().gen_range(0, 1),
MapArea::BarbaRay | MapArea::GolDragon | MapArea::GalGryphon | MapArea::OlgaFlow => 0,
MapArea::Pioneer2Ep4 => 0,
MapArea::CraterEast => 0,
MapArea::CraterWest => 1,
MapArea::CraterSouth => 2,
MapArea::CraterNorth => 3,
MapArea::CraterInterior => 0,
MapArea::SubDesert1 | MapArea::SubDesert3 => rand::thread_rng().gen_range(0, 2),
MapArea::SubDesert2 => 0,
MapArea::SaintMillion => 0,
};
let minor = match map {
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,
MapArea::Pioneer2Ep2 => 0,
MapArea::VrTempleAlpha | MapArea::VrTempleBeta | MapArea::VrSpaceshipAlpha | MapArea::VrSpaceshipBeta => 0,
MapArea::Cca | MapArea::JungleAreaNorth | MapArea::JungleAreaEast | MapArea::Seaside => rand::thread_rng().gen_range(0, 2),
MapArea::Mountain => rand::thread_rng().gen_range(0, 1),
MapArea::SeabedUpper | MapArea::SeabedLower => rand::thread_rng().gen_range(0, 1),
MapArea::GalGryphon => 0,
MapArea::OlgaFlow => 0,
MapArea::BarbaRay => 0,
MapArea::GolDragon => 0,
MapArea::Pioneer2Ep4 => 0,
MapArea::CraterEast | MapArea::CraterWest | MapArea::CraterSouth | MapArea::CraterNorth | MapArea::CraterInterior => rand::thread_rng().gen_range(0, 2),
MapArea::SubDesert1 | MapArea::SubDesert3 => 0,
MapArea::SubDesert2 => rand::thread_rng().gen_range(0, 2),
MapArea::SaintMillion => 0,
};
MapVariant {
map: map,
mode: mode,
major: major,
minor: minor,
}
// }
// else {
// let major = match map {
// MapArea::Pioneer2Ep1 | MapArea::Pioneer2Ep2 | MapArea::Pioneer2Ep4 => 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 {
// MapArea::Pioneer2Ep1 | MapArea::Pioneer2Ep2 | MapArea::Pioneer2Ep4 => 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 {
// map: map,
// mode: mode,
// major: major,
// minor: minor,
// }
// }
} }
// TODO: rename to npc_file // TODO: rename to npc_file
fn dat_file(&self) -> String { fn dat_file(&self) -> String {
@ -495,6 +668,32 @@ impl MapVariant {
MapArea::DeRolLe => "data/maps/map_boss02e.dat".into(), MapArea::DeRolLe => "data/maps/map_boss02e.dat".into(),
MapArea::VolOpt => "data/maps/map_boss03e.dat".into(), MapArea::VolOpt => "data/maps/map_boss03e.dat".into(),
MapArea::DarkFalz => "data/maps/map_boss04e.dat".into(), MapArea::DarkFalz => "data/maps/map_boss04e.dat".into(),
MapArea::Pioneer2Ep2 => "data/maps/map_labo00_00e.dat".into(),
MapArea::VrTempleAlpha => format!("data/maps/map_ruins01_0{}_0{}e.dat", self.major, self.minor),
MapArea::VrTempleBeta => format!("data/maps/map_ruins02_0{}_0{}e.dat", self.major, self.minor),
MapArea::VrSpaceshipAlpha => format!("data/maps/map_space01_0{}_0{}e.dat", self.major, self.minor),
MapArea::VrSpaceshipBeta => format!("data/maps/map_space02_0{}_0{}e.dat", self.major, self.minor),
MapArea::Cca => format!("data/maps/map_jungle01_0{}e.dat", self.major),
MapArea::JungleAreaNorth => format!("data/maps/map_jungle02_0{}e.dat", self.major),
MapArea::JungleAreaEast => format!("data/maps/map_jungle03_0{}e.dat", self.major),
MapArea::Mountain => format!("data/maps/map_jungle04_0{}_0{}e.dat", self.major, self.minor),
MapArea::Seaside => format!("data/maps/map_jungle05_0{}e.dat", self.major),
MapArea::SeabedUpper => format!("data/maps/map_seabed01_0{}_0{}e.dat", self.major, self.minor),
MapArea::SeabedLower => format!("data/maps/map_seabed02_0{}_0{}e.dat", self.major, self.minor),
MapArea::GalGryphon => "data/maps/map_boss05e.dat".into(),
MapArea::OlgaFlow => "data/maps/map_boss06e.dat".into(),
MapArea::BarbaRay => "data/maps/map_boss07e.dat".into(),
MapArea::GolDragon => "data/maps/map_boss08e.dat".into(),
MapArea::Pioneer2Ep4 => "data/maps/map_city02_00_00e.dat".into(),
MapArea::CraterEast => format!("data/maps/map_wilds01_0{}_0{}e.dat", self.major, self.minor),
MapArea::CraterWest => format!("data/maps/map_wilds01_0{}_0{}e.dat", self.major, self.minor),
MapArea::CraterSouth => format!("data/maps/map_wilds01_0{}_0{}e.dat", self.major, self.minor),
MapArea::CraterNorth => format!("data/maps/map_wilds01_0{}_0{}e.dat", self.major, self.minor),
MapArea::CraterInterior => format!("data/maps/map_crater01_0{}_0{}e.dat", self.major, self.minor),
MapArea::SubDesert1 => format!("data/maps/map_desert01_0{}_0{}e.dat", self.major, self.minor),
MapArea::SubDesert2 => format!("data/maps/map_desert02_0{}_0{}e.dat", self.major, self.minor),
MapArea::SubDesert3 => format!("data/maps/map_desert03_0{}_0{}e.dat", self.major, self.minor),
MapArea::SaintMillion => "data/maps/map_boss09_00_00e.dat".into(),
} }
} }
@ -515,6 +714,32 @@ impl MapVariant {
MapArea::DeRolLe => "data/maps/map_boss02o.dat".into(), MapArea::DeRolLe => "data/maps/map_boss02o.dat".into(),
MapArea::VolOpt => "data/maps/map_boss03o.dat".into(), MapArea::VolOpt => "data/maps/map_boss03o.dat".into(),
MapArea::DarkFalz => "data/maps/map_boss04o.dat".into(), MapArea::DarkFalz => "data/maps/map_boss04o.dat".into(),
MapArea::Pioneer2Ep2 => "data/maps/map_labo00_00o.dat".into(),
MapArea::VrTempleAlpha => format!("data/maps/map_ruins01_0{}_0{}o.dat", self.major, self.minor),
MapArea::VrTempleBeta => format!("data/maps/map_ruins02_0{}_0{}o.dat", self.major, self.minor),
MapArea::VrSpaceshipAlpha => format!("data/maps/map_space01_0{}_0{}o.dat", self.major, self.minor),
MapArea::VrSpaceshipBeta => format!("data/maps/map_space02_0{}_0{}o.dat", self.major, self.minor),
MapArea::Cca => format!("data/maps/map_jungle01_0{}o.dat", self.major),
MapArea::JungleAreaNorth => format!("data/maps/map_jungle02_0{}o.dat", self.major),
MapArea::JungleAreaEast => format!("data/maps/map_jungle03_0{}o.dat", self.major),
MapArea::Mountain => format!("data/maps/map_jungle04_0{}_0{}o.dat", self.major, self.minor),
MapArea::Seaside => format!("data/maps/map_jungle05_0{}o.dat", self.major),
MapArea::SeabedUpper => format!("data/maps/map_seabed01_0{}_0{}o.dat", self.major, self.minor),
MapArea::SeabedLower => format!("data/maps/map_seabed02_0{}_0{}o.dat", self.major, self.minor),
MapArea::GalGryphon => "data/maps/map_boss05o.dat".into(),
MapArea::OlgaFlow => "data/maps/map_boss06o.dat".into(),
MapArea::BarbaRay => "data/maps/map_boss07o.dat".into(),
MapArea::GolDragon => "data/maps/map_boss08o.dat".into(),
MapArea::Pioneer2Ep4 => "data/maps/map_city02_00_00o.dat".into(),
MapArea::CraterEast => format!("data/maps/map_wilds01_0{}_0{}o.dat", self.major, self.minor),
MapArea::CraterWest => format!("data/maps/map_wilds01_0{}_0{}o.dat", self.major, self.minor),
MapArea::CraterSouth => format!("data/maps/map_wilds01_0{}_0{}o.dat", self.major, self.minor),
MapArea::CraterNorth => format!("data/maps/map_wilds01_0{}_0{}o.dat", self.major, self.minor),
MapArea::CraterInterior => format!("data/maps/map_crater01_0{}_0{}o.dat", self.major, self.minor),
MapArea::SubDesert1 => format!("data/maps/map_desert01_0{}_0{}o.dat", self.major, self.minor),
MapArea::SubDesert2 => format!("data/maps/map_desert02_0{}_0{}o.dat", self.major, self.minor),
MapArea::SubDesert3 => format!("data/maps/map_desert03_0{}_0{}o.dat", self.major, self.minor),
MapArea::SaintMillion => "data/maps/map_boss09_00_00o.dat".into(),
} }
} }
@ -651,7 +876,7 @@ pub enum MapsError {
#[derive(Debug)] #[derive(Debug)]
pub struct Maps { pub struct Maps {
map_variants: [MapVariant; 15],
map_variants: [MapVariant; 15], // Needs to be a vector. There is an unequal number of maps on each episode
enemy_data: Vec<Option<MapEnemy>>, enemy_data: Vec<Option<MapEnemy>>,
object_data: Vec<Option<MapObject>>, object_data: Vec<Option<MapObject>>,
} }
@ -677,6 +902,38 @@ impl Maps {
MapVariant::new(MapArea::DarkFalz, MapVariantMode::Online), MapVariant::new(MapArea::DarkFalz, MapVariantMode::Online),
] ]
}, },
Episode::Two => {
[MapVariant::new(MapArea::Pioneer2Ep2, MapVariantMode::Online),
MapVariant::new(MapArea::VrTempleAlpha, MapVariantMode::Online),
MapVariant::new(MapArea::VrTempleBeta, MapVariantMode::Online),
MapVariant::new(MapArea::VrSpaceshipAlpha, MapVariantMode::Online),
MapVariant::new(MapArea::VrSpaceshipBeta, MapVariantMode::Online),
MapVariant::new(MapArea::Cca, MapVariantMode::Online),
MapVariant::new(MapArea::JungleAreaNorth, MapVariantMode::Online),
MapVariant::new(MapArea::JungleAreaEast, MapVariantMode::Online),
MapVariant::new(MapArea::Mountain, MapVariantMode::Online),
MapVariant::new(MapArea::Seaside, MapVariantMode::Online),
MapVariant::new(MapArea::SeabedUpper, MapVariantMode::Online),
MapVariant::new(MapArea::SeabedLower, MapVariantMode::Online),
MapVariant::new(MapArea::GalGryphon, MapVariantMode::Online),
MapVariant::new(MapArea::OlgaFlow, MapVariantMode::Online),
MapVariant::new(MapArea::BarbaRay, MapVariantMode::Online),
MapVariant::new(MapArea::GolDragon, MapVariantMode::Online),
]
},
Episode::Four => {
[MapVariant::new(MapArea::Pioneer2Ep4, MapVariantMode::Online),
MapVariant::new(MapArea::CraterEast, MapVariantMode::Online),
MapVariant::new(MapArea::CraterWest, MapVariantMode::Online),
MapVariant::new(MapArea::CraterSouth, MapVariantMode::Online),
MapVariant::new(MapArea::CraterNorth, MapVariantMode::Online),
MapVariant::new(MapArea::CraterInterior, MapVariantMode::Online),
MapVariant::new(MapArea::SubDesert1, MapVariantMode::Online),
MapVariant::new(MapArea::SubDesert2, MapVariantMode::Online),
MapVariant::new(MapArea::SubDesert3, MapVariantMode::Online),
MapVariant::new(MapArea::SaintMillion, MapVariantMode::Online),
]
},
_ => panic!() _ => panic!()
}; };

Loading…
Cancel
Save