Some various tweaks and fixes
This commit is contained in:
parent
30de2cd7ce
commit
b6e05b157a
@ -34,6 +34,7 @@ mod voronoi;
|
|||||||
mod voronoi_spawning;
|
mod voronoi_spawning;
|
||||||
mod waveform_collapse;
|
mod waveform_collapse;
|
||||||
|
|
||||||
|
use ::rltk::prelude::*;
|
||||||
use ::specs::prelude::*;
|
use ::specs::prelude::*;
|
||||||
use area_ending_point::{AreaEndingPosition, XEnd, YEnd};
|
use area_ending_point::{AreaEndingPosition, XEnd, YEnd};
|
||||||
use area_starting_points::{AreaStartingPosition, XStart, YStart};
|
use area_starting_points::{AreaStartingPosition, XStart, YStart};
|
||||||
@ -342,7 +343,7 @@ pub fn random_builder(new_depth: i32, width: i32, height: i32) -> BuilderChain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn level_builder(new_depth: i32, width: i32, height: i32) -> BuilderChain {
|
pub fn level_builder(new_depth: i32, width: i32, height: i32) -> BuilderChain {
|
||||||
rltk::console::log(format!("Depth: {}", new_depth));
|
console::log(format!("Depth: {}", new_depth));
|
||||||
match new_depth {
|
match new_depth {
|
||||||
1 => town_builder(new_depth, width, height),
|
1 => town_builder(new_depth, width, height),
|
||||||
2 => forest_builder(new_depth, width, height),
|
2 => forest_builder(new_depth, width, height),
|
||||||
|
@ -148,7 +148,6 @@ impl TownBuilder {
|
|||||||
|
|
||||||
fn buildings(
|
fn buildings(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
||||||
build_data: &mut BuilderMap,
|
build_data: &mut BuilderMap,
|
||||||
available_building_tiles: &mut HashSet<usize>,
|
available_building_tiles: &mut HashSet<usize>,
|
||||||
) -> Vec<(i32, i32, i32, i32)> {
|
) -> Vec<(i32, i32, i32, i32)> {
|
||||||
@ -229,7 +228,6 @@ impl TownBuilder {
|
|||||||
|
|
||||||
fn add_doors(
|
fn add_doors(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
||||||
build_data: &mut BuilderMap,
|
build_data: &mut BuilderMap,
|
||||||
buildings: &mut Vec<(i32, i32, i32, i32)>,
|
buildings: &mut Vec<(i32, i32, i32, i32)>,
|
||||||
wall_gap_y: i32,
|
wall_gap_y: i32,
|
||||||
@ -324,13 +322,12 @@ impl TownBuilder {
|
|||||||
|
|
||||||
fn building_factory(
|
fn building_factory(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
||||||
build_data: &mut BuilderMap,
|
build_data: &mut BuilderMap,
|
||||||
buildings: &[(i32, i32, i32, i32)],
|
buildings: &[(i32, i32, i32, i32)],
|
||||||
building_index: &[(usize, i32, BuildingTag)],
|
building_index: &[(usize, i32, BuildingTag)],
|
||||||
) {
|
) {
|
||||||
for (i, building) in buildings.iter().enumerate() {
|
for (i, _size, build_type) in building_index.iter() {
|
||||||
let build_type = &building_index[i].2;
|
let building = &buildings[*i];
|
||||||
match build_type {
|
match build_type {
|
||||||
BuildingTag::Pub => self.build_pub(building, build_data),
|
BuildingTag::Pub => self.build_pub(building, build_data),
|
||||||
BuildingTag::Temple => self.build_temple(building, build_data),
|
BuildingTag::Temple => self.build_temple(building, build_data),
|
||||||
@ -349,7 +346,6 @@ impl TownBuilder {
|
|||||||
&mut self,
|
&mut self,
|
||||||
building: &(i32, i32, i32, i32),
|
building: &(i32, i32, i32, i32),
|
||||||
build_data: &mut BuilderMap,
|
build_data: &mut BuilderMap,
|
||||||
|
|
||||||
to_place: &mut Vec<&str>,
|
to_place: &mut Vec<&str>,
|
||||||
player_idx: usize,
|
player_idx: usize,
|
||||||
) {
|
) {
|
||||||
@ -481,7 +477,6 @@ impl TownBuilder {
|
|||||||
fn spawn_townsfolk(
|
fn spawn_townsfolk(
|
||||||
&mut self,
|
&mut self,
|
||||||
build_data: &mut BuilderMap,
|
build_data: &mut BuilderMap,
|
||||||
|
|
||||||
available_building_tiles: &mut HashSet<usize>,
|
available_building_tiles: &mut HashSet<usize>,
|
||||||
) {
|
) {
|
||||||
for idx in available_building_tiles.iter() {
|
for idx in available_building_tiles.iter() {
|
||||||
|
@ -338,14 +338,18 @@ impl GameState for State {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
gui::MainMenuResult::Selected { selected } => match selected {
|
gui::MainMenuResult::Selected { selected } => match selected {
|
||||||
gui::MainMenuSelection::NewGame => newrunstate = RunState::PreRun,
|
gui::MainMenuSelection::NewGame => {
|
||||||
|
self.game_over_cleanup();
|
||||||
|
|
||||||
|
newrunstate = RunState::PreRun
|
||||||
|
}
|
||||||
gui::MainMenuSelection::LoadGame => {
|
gui::MainMenuSelection::LoadGame => {
|
||||||
saveload_system::load_game(&mut self.ecs);
|
saveload_system::load_game(&mut self.ecs);
|
||||||
newrunstate = RunState::AwaitingInput;
|
newrunstate = RunState::AwaitingInput;
|
||||||
saveload_system::delete_save();
|
saveload_system::delete_save();
|
||||||
}
|
}
|
||||||
gui::MainMenuSelection::Quit => {
|
gui::MainMenuSelection::Quit => {
|
||||||
::std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -3,6 +3,20 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>Roguelike-game</title>
|
<title>Roguelike-game</title>
|
||||||
|
<style>
|
||||||
|
html, body {
|
||||||
|
background: #000;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas { margin: auto; }
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<canvas id="canvas" width="640" height="480"></canvas>
|
<canvas id="canvas" width="640" height="480"></canvas>
|
||||||
|
Loading…
Reference in New Issue
Block a user