Holiday headwear on every unit: Christmas hats, carved pumpkins, bunny ears

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-08 00:04:26 +01:00
1 parent 6ff1cc5f8d
commit a24fc51605
2 files changed
+111 -1

No files matched your search

+30
View File
@@ -2048,6 +2048,36 @@ impl R3d {
}
}
}
// the holidays' headwear on everybody (both styles): a Christmas hat, a carved
// pumpkin, bunny ears
let holiday = crate::holiday::current();
if holiday != crate::holiday::NONE && !white && e.captive == 0 && !sleeping {
let an = match pic {
Some(p) => Gfx::hd_anchor(p),
None => crate::gfx::small_anchor(e.kind, v),
};
let at = |fx: f32, fy: f32| {
let fx = if mirror { 1.0 - fx } else { fx };
corner((fx - 0.5) * 1.2 * w, (1.0 - fy) * 1.2 * h - 0.1 * h) + toward * 0.01
};
let mid = (an.head.0 + an.head.1) * 0.5;
let hw = (an.head.1 - an.head.0).max(0.12);
let neck = an.top + (an.shoulder - an.top) * 0.75;
let (x0, y0, x1, y1, part) = match holiday {
crate::holiday::CHRISTMAS => (mid - hw * 0.62, an.top - hw * 0.75, mid + hw * 0.72, an.top + hw * 0.2, crate::gfx::GEAR_SANTA),
crate::holiday::HALLOWEEN => (mid - hw * 0.68, an.top - hw * 0.25, mid + hw * 0.68, neck, crate::gfx::GEAR_PUMPKIN),
_ => (mid - hw * 0.5, an.top - hw * 0.95, mid + hw * 0.5, an.top + hw * 0.05, crate::gfx::GEAR_EARS),
};
let gt = crate::gfx::GEAR_TEX as f32;
let (mut a0, b0) = (part.0 as f32 / gt, part.1 as f32 / gt);
let (mut a1, b1) = ((part.0 + part.2) as f32 / gt, (part.1 + part.3) as f32 / gt);
if mirror {
std::mem::swap(&mut a0, &mut a1);
}
let k = (a * 1.3).min(1.0);
let hc = [(255.0 * k) as u8, (255.0 * k) as u8, (255.0 * k) as u8, 255];
mb_gear.quad([at(x0, y0), at(x1, y0), at(x1, y1), at(x0, y1)], [vec2(a0, b0), vec2(a1, b0), vec2(a1, b1), vec2(a0, b1)], [hc; 4], [toward; 4]);
}
let mb = match pic {
Some(_) if fine => &mut mb_hd,
Some(_) => &mut mb_hd32,