blood and entity colour tweak
This commit is contained in:
parent
05011c6de8
commit
2266998e80
3 changed files with 9 additions and 18 deletions
|
|
@ -102,7 +102,7 @@ impl GameState for State {
|
|||
let mut bg = render.bg.add(RGB::from_u8(26, 45, 45)).add(offsets);
|
||||
//bg = bg.add(offsets);
|
||||
if map.bloodstains.contains(&idx) {
|
||||
bg = RGB::from_f32(0.4, 0., 0.);
|
||||
bg = bg.add(RGB::from_f32(0.6, 0., 0.));
|
||||
}
|
||||
if map.visible_tiles[idx] {
|
||||
ctx.set(pos.x, pos.y, render.fg, bg, render.glyph);
|
||||
|
|
|
|||
21
src/map.rs
21
src/map.rs
|
|
@ -3,7 +3,7 @@ use rltk::{Algorithm2D, BaseMap, Point, RandomNumberGenerator, Rltk, RGB};
|
|||
use specs::prelude::*;
|
||||
use std::cmp::{max, min};
|
||||
use std::collections::HashSet;
|
||||
use std::ops::Add;
|
||||
use std::ops::{Add, Mul};
|
||||
|
||||
#[derive(PartialEq, Copy, Clone)]
|
||||
pub enum TileType {
|
||||
|
|
@ -222,7 +222,7 @@ pub fn draw_map(ecs: &World, ctx: &mut Rltk) {
|
|||
// Get our colour offsets. Credit to Brogue for the inspiration here.
|
||||
let offsets = RGB::from_u8(map.red_offset[idx], map.green_offset[idx], map.blue_offset[idx]);
|
||||
if map.revealed_tiles[idx] {
|
||||
let mut fg = offsets;
|
||||
let mut fg = offsets.mul(2.0);
|
||||
// Right now, everything always has the same background. It's a
|
||||
// very dark green, just to distinguish it slightly from the
|
||||
// black that is tiles we've *never* seen.
|
||||
|
|
@ -235,24 +235,15 @@ pub fn draw_map(ecs: &World, ctx: &mut Rltk) {
|
|||
}
|
||||
TileType::Wall => {
|
||||
glyph = wall_glyph(&*map, x, y);
|
||||
fg = fg.add(RGB::from_f32(0.1, 0.8, 0.1));
|
||||
fg = fg.add(RGB::from_f32(0.6, 0.5, 0.25));
|
||||
}
|
||||
}
|
||||
let mut bloody = false;
|
||||
if map.bloodstains.contains(&idx) {
|
||||
bg = bg.add(RGB::from_f32(0.4, 0., 0.));
|
||||
bloody = true;
|
||||
bg = bg.add(RGB::from_f32(0.6, 0., 0.));
|
||||
}
|
||||
if !map.visible_tiles[idx] {
|
||||
fg = fg.to_greyscale();
|
||||
// Manually setting desaturated values since we always know what it will be,
|
||||
// since desaturate is an expensive function. If this stops being the case,
|
||||
// will need to switch to using desaturate
|
||||
if bloody {
|
||||
bg = RGB::from_f32(0.4, 0.4, 0.4);
|
||||
} else {
|
||||
bg = bg.to_greyscale();
|
||||
}
|
||||
fg = fg.mul(0.6);
|
||||
bg = bg.mul(0.6);
|
||||
}
|
||||
ctx.set(x, y, fg, bg, glyph);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ const MAX_ITEMS: i32 = 2;
|
|||
fn monster<S: ToString>(ecs: &mut World, x: i32, y: i32, glyph: rltk::FontCharType, name: S) {
|
||||
ecs.create_entity()
|
||||
.with(Position { x, y })
|
||||
.with(Renderable { glyph: glyph, fg: RGB::named(rltk::RED), bg: RGB::named(rltk::BLACK), render_order: 1 })
|
||||
.with(Renderable { glyph: glyph, fg: RGB::named(rltk::GREEN), bg: RGB::named(rltk::BLACK), render_order: 1 })
|
||||
.with(Viewshed { visible_tiles: Vec::new(), range: 12, dirty: true })
|
||||
.with(Monster {})
|
||||
.with(Name { name: name.to_string() })
|
||||
|
|
@ -163,7 +163,7 @@ fn poison_potion(ecs: &mut World, x: i32, y: i32) {
|
|||
.with(Position { x, y })
|
||||
.with(Renderable {
|
||||
glyph: rltk::to_cp437('i'),
|
||||
fg: RGB::named(rltk::SEAGREEN),
|
||||
fg: RGB::named(rltk::GREEN),
|
||||
bg: RGB::named(rltk::BLACK),
|
||||
render_order: 2,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue