blob: 1239480b674bee83a3fdd01c4dd41a31060c7b98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
use steam_powered_wyrm::constants::*;
use steam_powered_wyrm::game::map::Map;
use steam_powered_wyrm::geometry::*;
fn main() {
let mut lava_map = [Map::default(); MAX_ROUNDS as usize + 1];
let center = Point2d::new(MAP_SIZE as i8 / 2, MAP_SIZE as i8 / 2);
let center_f64 = Point2d::new(center.x as f64, center.y as f64);
for (round, ref mut map) in lava_map.iter_mut().enumerate() {
let lava_progress = ((round as f64 - LAVA_ROUND_START as f64)
/ (LAVA_ROUND_END - LAVA_ROUND_START) as f64)
.min(1.)
.max(0.);
let safe_radius = (MAP_SIZE / 2) as f64 * (1. - lava_progress) + 1.;
let safe_radius_squared = safe_radius * safe_radius;
for (y, row) in MAP_ROW_SIZE.iter().enumerate() {
for x in row.x_offset..MAP_SIZE - row.x_offset {
let p_f64 = Point2d::new(x as f64, y as f64);
let p = Point2d::new(x as i8, y as i8);
let is_lava = (p_f64 - center_f64).magnitude_squared() > safe_radius_squared;
if is_lava {
map.set(p);
} else {
map.clear(p);
}
}
}
}
println!("pub const LAVA_MAP: [Map; MAX_ROUNDS as usize + 1] = [");
for round in lava_map.iter() {
print!("Map {{ cells: [");
for num in round.cells.iter() {
print!("{:#X}, ", num);
}
println!("] }},");
}
println!("];");
}
|