Rivers and bridges: water and lava tiles, bridge tool, burning in lava
- New tile kinds (appended for the savegame codec): water, lava, wooden bridge, stone bridge, core shard - Sunken river beds with banks, bridge decks with rails, lava glow and lights - Bridge tool (key U, rooms category): bridges grow from own ground, 30 gold/tile over water, 75 over lava - Selling a bridge drops the units on it into the river (water: swim to the bank, lava: burn) - Cannon blasts and punches knock units back; into lava = burnt (heroes still pay their bounty) - Heroes cannot path through rivers; texts EN/DE; tests for bridges and lava Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
af6be62805
commit
75dc445d3b
9 files changed
+536
-22
No files matched your search
+117
-1
@@ -6,7 +6,7 @@ use macroquad::prelude::*;
|
||||
|
||||
pub const CELL: f32 = 16.0;
|
||||
const ATLAS_COLS: u32 = 16;
|
||||
const ATLAS_ROWS: u32 = 6;
|
||||
const ATLAS_ROWS: u32 = 8;
|
||||
|
||||
// atlas indices (4 variants each)
|
||||
pub const T_ROCK: u32 = 0;
|
||||
@@ -48,6 +48,14 @@ pub const I_CANNON: u32 = 82;
|
||||
pub const I_MAGIC: u32 = 83;
|
||||
pub const T_TEMPLE: u32 = 84; // 4 variants
|
||||
pub const D_ALTAR: u32 = 88;
|
||||
pub const T_WATER: u32 = 96; // 4 variants
|
||||
pub const T_LAVA: u32 = 100; // 4 variants
|
||||
pub const T_BRIDGE: u32 = 104; // 2 variants: wooden planks
|
||||
pub const T_STONEBRIDGE: u32 = 106; // 2 variants: stone slabs (over lava)
|
||||
pub const T_FORTWALL: u32 = 108; // 4 variants: knight fortress masonry
|
||||
pub const D_SHARD: u32 = 112; // shard of the soul core
|
||||
pub const D_BANNER: u32 = 113; // knight banner
|
||||
pub const I_BRIDGE: u32 = 114;
|
||||
|
||||
pub struct Gfx {
|
||||
pub atlas: Texture2D,
|
||||
@@ -533,6 +541,108 @@ fn gen_atlas() -> Image {
|
||||
None
|
||||
}
|
||||
});
|
||||
// ---- campaign terrain
|
||||
for v in 0..4u32 {
|
||||
// water: dark blue with lighter wave crests
|
||||
cv.cell(T_WATER + v, |x, y| {
|
||||
let wave = ((x as f32 * 0.8 + (y as f32 * 0.9 + v as f32 * 1.7).sin() * 2.2) as i32 + y * 2) % 9;
|
||||
let d = (rnd(x, y, v + 120) * 10.0) as i32 - 5;
|
||||
Some(match wave {
|
||||
0 => shade((70, 120, 170), d),
|
||||
1 => shade((50, 92, 140), d),
|
||||
_ => shade((24, 50, 88), d),
|
||||
})
|
||||
});
|
||||
// lava: glowing orange with dark crust plates
|
||||
cv.cell(T_LAVA + v, |x, y| {
|
||||
let crust = rnd(x / 3 + (y / 3) % 2, y / 3, v + 130);
|
||||
let edge = rnd(x, y, v + 131) * 0.25;
|
||||
if crust + edge > 0.85 {
|
||||
Some(shade((60, 22, 14), (rnd(x, y, v + 132) * 14.0) as i32))
|
||||
} else if crust + edge > 0.7 {
|
||||
Some(c(200, 60, 20))
|
||||
} else if hash(x, y, v + 133) % 11 == 0 {
|
||||
Some(c(255, 230, 120))
|
||||
} else {
|
||||
Some(shade((250, 130, 30), (rnd(x, y, v + 134) * 30.0) as i32 - 15))
|
||||
}
|
||||
});
|
||||
// knight fortress walls: pale stone blocks with blue-grey mortar
|
||||
cv.cell(T_FORTWALL + v, |x, y| {
|
||||
let row = y / 5;
|
||||
let off = if row % 2 == 1 { 5 } else { 0 };
|
||||
if y % 5 == 4 || (x + off) % 10 == 9 {
|
||||
return Some(shade((70, 76, 92), (rnd(x, y, v + 140) * 8.0) as i32));
|
||||
}
|
||||
let blk = hash((x + off) / 10, row, v + 141) % 4;
|
||||
Some(shade((150, 150, 160), (rnd(x, y, v + 142) * 12.0) as i32 - 6 + blk as i32 * 5 - 8 + if y % 5 == 0 { 10 } else { 0 }))
|
||||
});
|
||||
}
|
||||
for v in 0..2u32 {
|
||||
// wooden bridge: planks across, two rope rails at the sides
|
||||
cv.cell(T_BRIDGE + v, |x, y| {
|
||||
if x <= 1 || x >= 14 {
|
||||
return Some(if (y + v as i32) % 4 == 0 { c(150, 120, 80) } else { c(96, 70, 42) });
|
||||
}
|
||||
if y % 4 == 0 {
|
||||
return Some(c(40, 26, 16));
|
||||
}
|
||||
let plank = y / 4;
|
||||
let off = (hash(plank, 1, v + 150) % 16) as i32;
|
||||
if (x + off) % 13 == 0 && y % 4 == 2 {
|
||||
return Some(c(60, 40, 24)); // nail
|
||||
}
|
||||
Some(shade((126, 88, 52), (rnd(x, y, v + 151) * 14.0) as i32 - 7 + (plank % 2) * 6))
|
||||
});
|
||||
// stone bridge over lava: big grey slabs, sooty edges
|
||||
cv.cell(T_STONEBRIDGE + v, |x, y| {
|
||||
if x <= 1 || x >= 14 {
|
||||
return Some(shade((60, 56, 56), (rnd(x, y, v + 160) * 10.0) as i32));
|
||||
}
|
||||
Some(stones(x, y, v + 161, (104, 98, 96), (46, 40, 40), 12))
|
||||
});
|
||||
}
|
||||
// shard of the soul core: a glowing red crystal
|
||||
cv.cell(D_SHARD, |x, y| {
|
||||
let (dx, dy) = ((x - 8).abs(), y);
|
||||
if y >= 2 && y <= 14 && dx * 3 <= (if y < 7 { (y - 2) * 4 } else { (15 - y) * 2 }) {
|
||||
Some(if dx == 0 || (x + y) % 5 == 0 { c(255, 170, 170) } else if x < 8 { c(230, 50, 60) } else { c(160, 20, 40) })
|
||||
} else if dy == 15 && (4..=12).contains(&x) {
|
||||
Some(c(80, 30, 40))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
// knight banner: pole with a white-blue banner and a golden sun
|
||||
cv.cell(D_BANNER, |x, y| {
|
||||
if x == 3 {
|
||||
return Some(c(170, 170, 180));
|
||||
}
|
||||
if (4..=13).contains(&x) && (1..=11).contains(&y) {
|
||||
let (dx, dy) = (x - 9, y - 6);
|
||||
if dx * dx + dy * dy <= 5 {
|
||||
return Some(c(240, 200, 60));
|
||||
}
|
||||
return Some(if y == 11 && x % 2 == 0 { c(60, 90, 170) } else if x % 5 == 4 { c(200, 205, 220) } else { c(230, 232, 240) });
|
||||
}
|
||||
None
|
||||
});
|
||||
// bridge tool icon: an arch with planks
|
||||
cv.cell(I_BRIDGE, |x, y| {
|
||||
let (dx, dy) = (x as f32 - 7.5, y as f32 - 13.0);
|
||||
let d = (dx * dx + dy * dy).sqrt();
|
||||
if y <= 6 && y >= 5 && (1..=14).contains(&x) {
|
||||
Some(if x % 3 == 0 { c(70, 46, 26) } else { c(150, 106, 60) })
|
||||
} else if (6.0..7.5).contains(&d) && y >= 6 {
|
||||
Some(c(120, 84, 48))
|
||||
} else if y > 6 && (x == 1 || x == 14) {
|
||||
Some(c(110, 76, 44))
|
||||
} else if y >= 12 && d >= 7.5 && (2..=13).contains(&x) {
|
||||
Some(c(60, 110, 170))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
cv.img
|
||||
}
|
||||
|
||||
@@ -896,6 +1006,7 @@ impl Gfx {
|
||||
let v = var as u32 & 3;
|
||||
match kind {
|
||||
Kind::Rock => T_ROCK + v,
|
||||
Kind::Earth if reinforced && hero => T_FORTWALL + v,
|
||||
Kind::Earth if reinforced => T_REINF + v,
|
||||
Kind::Earth => T_EARTH + v,
|
||||
Kind::Gold => T_GOLD + v,
|
||||
@@ -919,6 +1030,11 @@ impl Gfx {
|
||||
Kind::Torture => T_TORTURE + v,
|
||||
Kind::Temple => T_TEMPLE + v,
|
||||
Kind::Tower => T_CLAIM + v,
|
||||
Kind::Water => T_WATER + v,
|
||||
Kind::Lava => T_LAVA + v,
|
||||
Kind::Bridge => T_BRIDGE + (v & 1),
|
||||
Kind::LavaBridge => T_STONEBRIDGE + (v & 1),
|
||||
Kind::Shard => T_HEROFLOOR + v,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user