Holidays: Christmas and Easter beside Halloween, two weeks before to a few days after; decorations in the dungeon and around the title

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-07 22:40:27 +01:00
1 parent c23c4d28ec
commit 8f670554c7
5 files changed
+281 -5

No files matched your search

+28 -5
View File
@@ -509,7 +509,8 @@ impl MB {
}
}
// the season of the real date: 0 none, 1 Halloween (20 Oct - 5 Nov), 2 winter (Dec - Feb)
// the season of the real date: 0 none, 2 winter (Dec - Feb: snow above ground); the holidays
// are in crate::holiday
pub fn season() -> u8 {
thread_local! {
static SEASON: std::cell::Cell<u8> = const { std::cell::Cell::new(255) };
@@ -518,7 +519,6 @@ pub fn season() -> u8 {
if s.get() == 255 {
let (_, m, d, _, _) = crate::cloud::civil(macroquad::miniquad::date::now() as i64);
s.set(match (m, d) {
(10, 20..=31) | (11, 1..=5) => 1,
(12, _) | (1, _) | (2, _) => 2,
_ => 0,
});
@@ -1007,13 +1007,36 @@ fn build_chunk(map: &Map, amb: &[f32], glow: &[f32], cx: i32, cz: i32, atlas: &T
}
// 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);
// Halloween: now and then a glowing pumpkin on the dungeon's plain floor
if season() == 1 && t.kind == Kind::Floor && t.owner == Owner::Player {
// holidays: now and then something on the dungeon's plain floor - a glowing
// pumpkin (Halloween), a little fir tree with a star and a present (Christmas),
// painted eggs (Easter)
let holiday = crate::holiday::current();
if holiday != crate::holiday::NONE && t.kind == Kind::Floor && t.owner == Owner::Player {
let hsh = (x as u32).wrapping_mul(2246822519) ^ (z as u32).wrapping_mul(3266489917);
if (hsh >> 7) % 37 == 0 {
let (cx, cz) = (xf + 0.3 + ((hsh >> 3) % 4) as f32 * 0.1, zf + 0.35);
let pc = col(Vec3::splat(1.4), 1.0);
mb.boxy(vec3(cx - 0.14, 0.0, cz - 0.14), vec3(cx + 0.14, 0.24, cz + 0.14), T_PUMPKIN, pc, pc);
match holiday {
crate::holiday::HALLOWEEN => mb.boxy(vec3(cx - 0.14, 0.0, cz - 0.14), vec3(cx + 0.14, 0.24, cz + 0.14), T_PUMPKIN, pc, pc),
crate::holiday::CHRISTMAS => {
let fc = col(Vec3::splat(1.2), 1.0);
for (w, y0, y1) in [(0.22f32, 0.06f32, 0.26f32), (0.16, 0.24, 0.42), (0.1, 0.4, 0.56)] {
mb.boxy(vec3(cx - w, y0, cz - w), vec3(cx + w, y1, cz + w), crate::gfx::T_FIR, fc, fc);
}
mb.boxy(vec3(cx - 0.03, 0.0, cz - 0.03), vec3(cx + 0.03, 0.08, cz + 0.03), T_BARK, fc, fc);
mb.boxy(vec3(cx - 0.035, 0.56, cz - 0.035), vec3(cx + 0.035, 0.63, cz + 0.035), crate::gfx::T_GIFT, pc, pc);
let gx = cx + 0.26;
mb.boxy(vec3(gx - 0.08, 0.0, cz + 0.02), vec3(gx + 0.08, 0.13, cz + 0.18), crate::gfx::T_GIFT, pc, pc);
}
_ => {
for k in 0..3u32 {
let (ex, ez) = (cx + (k as f32 - 1.0) * 0.16, cz + ((hsh >> (k * 3)) % 3) as f32 * 0.08 - 0.08);
let egg = crate::gfx::T_EGG + (hsh >> (k + 11)) % 2;
mb.boxy(vec3(ex - 0.045, 0.0, ez - 0.035), vec3(ex + 0.045, 0.12, ez + 0.035), egg, pc, pc);
mb.boxy(vec3(ex - 0.03, 0.12, ez - 0.025), vec3(ex + 0.03, 0.15, ez + 0.025), egg, pc, pc);
}
}
}
}
}
if t.plant() {