Room levels 2 and 3, researched in the library: a quarter better each, brighter, with gold trim
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f7b550a6b1
commit
9b49bc2c9d
23 files changed
+171
-10
No files matched your search
@@ -440,6 +440,15 @@ impl MB {
|
||||
}
|
||||
}
|
||||
|
||||
// the researched level of the room on tile t (1: none)
|
||||
fn room_level_at(map: &Map, t: &Tile) -> u8 {
|
||||
if map.upgrades.is_empty() {
|
||||
return 1;
|
||||
}
|
||||
let (Some(r), side) = (room_index(t.kind), t.owner.side()) else { return 1 };
|
||||
map.upgrades.iter().find(|u| u.0 == side && u.1 as usize == r).map_or(1, |u| u.2)
|
||||
}
|
||||
|
||||
// Ambient light field: own territory is lit, foreign areas are dim
|
||||
fn ambient_field(map: &Map) -> Vec<f32> {
|
||||
let mut f = vec![0.0f32; n()];
|
||||
@@ -453,6 +462,11 @@ fn ambient_field(map: &Map) -> Vec<f32> {
|
||||
if map.sky(i) {
|
||||
f[i] = 1.6;
|
||||
}
|
||||
// rooms of a higher level shine brighter
|
||||
let lv = room_level_at(map, t);
|
||||
if lv > 1 && f[i] > 0.0 {
|
||||
f[i] += 0.25 * (lv - 1) as f32;
|
||||
}
|
||||
if t.river() == Some(Kind::Lava) {
|
||||
f[i] = f[i].max(0.8); // lava lights up its surroundings
|
||||
}
|
||||
@@ -853,6 +867,26 @@ fn build_chunk(map: &Map, amb: &[f32], glow: &[f32], cx: i32, cz: i32, atlas: &T
|
||||
if !solid_at(map, x - 1, z) && !outdoors {
|
||||
ln.strip(vec3(xf, 0.0, zf), vec3(xf, 0.0, zf + 1.0), Vec3::Y, OUTLINE_W, OUTLINE_C);
|
||||
}
|
||||
// a room of a higher level: gold trim along its border (twice at level 3)
|
||||
let lv = room_level_at(map, &t);
|
||||
if lv > 1 {
|
||||
let gold = col(vec3(1.0, 0.78, 0.25), 1.0);
|
||||
for (d, &(dx, dz)) in DIR4.iter().enumerate() {
|
||||
if map.get(x + dx, z + dz).map_or(false, |o| o.kind == t.kind && o.owner == t.owner) {
|
||||
continue;
|
||||
}
|
||||
for k in 0..(lv - 1) {
|
||||
let m = 0.08 + 0.12 * k as f32;
|
||||
let (p, q) = match d {
|
||||
0 => (vec3(xf + m, 0.012, zf + m), vec3(xf + 1.0 - m, 0.012, zf + m)),
|
||||
1 => (vec3(xf + 1.0 - m, 0.012, zf + m), vec3(xf + 1.0 - m, 0.012, zf + 1.0 - m)),
|
||||
2 => (vec3(xf + 1.0 - m, 0.012, zf + 1.0 - m), vec3(xf + m, 0.012, zf + 1.0 - m)),
|
||||
_ => (vec3(xf + m, 0.012, zf + 1.0 - m), vec3(xf + m, 0.012, zf + m)),
|
||||
};
|
||||
ln.strip(p, q, Vec3::Y, OUTLINE_W * 1.5, gold);
|
||||
}
|
||||
}
|
||||
}
|
||||
// room decor
|
||||
let dc = col(lava_lit(Vec3::splat(amb_at(amb, xf + 0.5, zf + 0.5)), lava_at(glow, xf + 0.5, zf + 0.5)), 1.0);
|
||||
if t.plant() {
|
||||
@@ -1083,6 +1117,10 @@ fn rgba(u: u32) -> Color {
|
||||
|
||||
fn chunk_sig(map: &Map, cx: i32, cz: i32) -> u64 {
|
||||
let mut h: u64 = 1469598103934665603;
|
||||
// researched room levels change the light and the trim of every room
|
||||
for u in &map.upgrades {
|
||||
h = (h ^ (u.0 as u64 | (u.1 as u64) << 8 | (u.2 as u64) << 16)).wrapping_mul(1099511628211);
|
||||
}
|
||||
for z in cz * CHUNK - 3..(cz + 1) * CHUNK + 3 {
|
||||
for x in cx * CHUNK - 3..(cx + 1) * CHUNK + 3 {
|
||||
let v = match map.get(x, z) {
|
||||
|
||||
Reference in new issue
Block a user