|
@ -17,14 +17,14 @@ pub fn objects_from_stream(cursor: &mut impl Read, episode: &Episode, map_area: |
|
|
let mut object_data = Vec::new();
|
|
|
let mut object_data = Vec::new();
|
|
|
|
|
|
|
|
|
while let Ok(raw_object) = RawMapObject::from_byte_stream(cursor) {
|
|
|
while let Ok(raw_object) = RawMapObject::from_byte_stream(cursor) {
|
|
|
let object = MapObject::from_raw(raw_object.clone(), *episode, map_area);
|
|
|
|
|
|
|
|
|
let object = MapObject::from_raw(raw_object, *episode, map_area);
|
|
|
object_data.push(object.ok());
|
|
|
object_data.push(object.ok());
|
|
|
}
|
|
|
}
|
|
|
object_data
|
|
|
object_data
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
fn objects_from_map_data(path: PathBuf, episode: &Episode, map_area: &MapArea) -> Vec<Option<MapObject>> {
|
|
|
fn objects_from_map_data(path: PathBuf, episode: &Episode, map_area: &MapArea) -> Vec<Option<MapObject>> {
|
|
|
let mut cursor = File::open(path.clone()).unwrap();
|
|
|
|
|
|
|
|
|
let mut cursor = File::open(path).unwrap();
|
|
|
objects_from_stream(&mut cursor, episode, map_area)
|
|
|
objects_from_stream(&mut cursor, episode, map_area)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
@ -32,8 +32,7 @@ fn parse_enemy(episode: &Episode, map_area: &MapArea, raw_enemy: RawMapEnemy) -> |
|
|
let enemy = MapEnemy::from_raw(raw_enemy, episode, map_area);
|
|
|
let enemy = MapEnemy::from_raw(raw_enemy, episode, map_area);
|
|
|
enemy
|
|
|
enemy
|
|
|
.map_or(vec![None], |monster| {
|
|
|
.map_or(vec![None], |monster| {
|
|
|
let mut monsters = Vec::new();
|
|
|
|
|
|
monsters.push(Some(monster));
|
|
|
|
|
|
|
|
|
let mut monsters = vec![Some(monster)];
|
|
|
|
|
|
|
|
|
match monster.monster {
|
|
|
match monster.monster {
|
|
|
MonsterType::Monest => {
|
|
|
MonsterType::Monest => {
|
|
@ -275,7 +274,7 @@ impl Maps { |
|
|
|
|
|
|
|
|
let maps = Maps {
|
|
|
let maps = Maps {
|
|
|
enemy_data: map_variants.iter().fold(Vec::new(), |mut enemy_data, map_variant| {
|
|
|
enemy_data: map_variants.iter().fold(Vec::new(), |mut enemy_data, map_variant| {
|
|
|
enemy_data.append(&mut enemy_data_from_map_data(&map_variant, &room_mode.episode()));
|
|
|
|
|
|
|
|
|
enemy_data.append(&mut enemy_data_from_map_data(map_variant, &room_mode.episode()));
|
|
|
enemy_data
|
|
|
enemy_data
|
|
|
}),
|
|
|
}),
|
|
|
object_data: map_variants.iter().map(|map_variant| {
|
|
|
object_data: map_variants.iter().map(|map_variant| {
|
|
|