Expands cheat menu
This commit is contained in:
parent
0344f87da8
commit
71f5c2ac9f
10 changed files with 66 additions and 10 deletions
|
|
@ -7,6 +7,9 @@ pub enum CheatMenuResult {
|
|||
Cancel,
|
||||
Ascend,
|
||||
Descend,
|
||||
Heal,
|
||||
MagicMap,
|
||||
GodMode,
|
||||
}
|
||||
|
||||
pub fn show_cheat_menu(_gs: &mut State, ctx: &mut Rltk) -> CheatMenuResult {
|
||||
|
|
@ -20,8 +23,8 @@ pub fn show_cheat_menu(_gs: &mut State, ctx: &mut Rltk) -> CheatMenuResult {
|
|||
);
|
||||
let x = 1 + x_offset;
|
||||
let mut y = 3 + y_offset;
|
||||
let count = 2;
|
||||
let width = 18;
|
||||
let count = 5;
|
||||
let width = 19;
|
||||
|
||||
ctx.draw_box(x, y, width, (count + 1) as i32, RGB::named(rltk::RED), RGB::named(rltk::BLACK));
|
||||
y += 1;
|
||||
|
|
@ -32,12 +35,28 @@ pub fn show_cheat_menu(_gs: &mut State, ctx: &mut Rltk) -> CheatMenuResult {
|
|||
// Desc
|
||||
ctx.set(x_offset + 2, y, RGB::named(rltk::YELLOW), RGB::named(rltk::BLACK), rltk::to_cp437('d'));
|
||||
ctx.print(x_offset + 4, y, "DESCEND A FLOOR");
|
||||
y += 1;
|
||||
// Heal
|
||||
ctx.set(x_offset + 2, y, RGB::named(rltk::YELLOW), RGB::named(rltk::BLACK), rltk::to_cp437('h'));
|
||||
ctx.print(x_offset + 4, y, "HEAL TO FULL");
|
||||
y += 1;
|
||||
// Reveal map
|
||||
ctx.set(x_offset + 2, y, RGB::named(rltk::YELLOW), RGB::named(rltk::BLACK), rltk::to_cp437('m'));
|
||||
ctx.print(x_offset + 4, y, "MAGIC MAP REVEAL");
|
||||
y += 1;
|
||||
// Godmode
|
||||
ctx.set(x_offset + 2, y, RGB::named(rltk::YELLOW), RGB::named(rltk::BLACK), rltk::to_cp437('g'));
|
||||
ctx.print(x_offset + 4, y, "GOD MODE");
|
||||
y += 1;
|
||||
// Match keys
|
||||
match ctx.key {
|
||||
None => CheatMenuResult::NoResponse,
|
||||
Some(key) => match key {
|
||||
VirtualKeyCode::A => CheatMenuResult::Ascend,
|
||||
VirtualKeyCode::D => CheatMenuResult::Descend,
|
||||
VirtualKeyCode::H => CheatMenuResult::Heal,
|
||||
VirtualKeyCode::M => CheatMenuResult::MagicMap,
|
||||
VirtualKeyCode::G => CheatMenuResult::GodMode,
|
||||
VirtualKeyCode::Escape => CheatMenuResult::Cancel,
|
||||
_ => CheatMenuResult::NoResponse,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use super::{
|
||||
camera, gamelog, gamesystem, rex_assets::RexAssets, ArmourClassBonus, Attributes, Burden, Equipped, Hidden,
|
||||
HungerClock, HungerState, InBackpack, Map, Name, Player, Point, Pools, Position, Prop, Renderable, RunState, Skill,
|
||||
Skills, State, Viewshed,
|
||||
ai::CARRY_CAPACITY_PER_STRENGTH, camera, gamelog, gamesystem, rex_assets::RexAssets, ArmourClassBonus, Attributes,
|
||||
Burden, Equipped, Hidden, HungerClock, HungerState, InBackpack, Map, Name, Player, Point, Pools, Position, Prop,
|
||||
Renderable, RunState, Skill, Skills, State, Viewshed,
|
||||
};
|
||||
use rltk::{Rltk, VirtualKeyCode, RGB};
|
||||
use specs::prelude::*;
|
||||
|
|
@ -139,6 +139,9 @@ pub fn draw_ui(ecs: &World, ctx: &mut Rltk) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if stats.god {
|
||||
ctx.print_color(20, 20, RGB::named(rltk::YELLOW), RGB::named(rltk::BLACK), "--- GODMODE: ON ---");
|
||||
}
|
||||
// Draw equipment
|
||||
let names = ecs.read_storage::<Name>();
|
||||
let mut equipment: Vec<String> = Vec::new();
|
||||
|
|
@ -163,7 +166,11 @@ pub fn draw_ui(ecs: &World, ctx: &mut Rltk) {
|
|||
y,
|
||||
RGB::named(rltk::WHITE),
|
||||
RGB::named(rltk::BLACK),
|
||||
&format!("[{:.1}/{} lbs]", stats.weight, (attributes.strength.base + attributes.strength.modifiers) * 10),
|
||||
&format!(
|
||||
"[{:.1}/{} lbs]",
|
||||
stats.weight,
|
||||
(attributes.strength.base + attributes.strength.modifiers) * CARRY_CAPACITY_PER_STRENGTH
|
||||
),
|
||||
);
|
||||
y += 1;
|
||||
let (player_inventory, _inventory_ids) = get_player_inventory(&ecs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue