engine-c: scaffold beams + bld damage FX + wear showcase

This commit is contained in:
local-model/engine-L2-grok-4.5 2026-09-19 12:03:13 +02:00
parent a086ab23a6
commit b2469dbcde
No known key found for this signature in database
3 changed files with 114 additions and 4 deletions

View file

@ -318,8 +318,48 @@ static void draw_bld(Building *b, int sx, int sy) {
default:
break;
}
if (b->build < 1.0f)
fill_rect(sx, sy, W, (int)(H * b->build), 255, 255, 255);
/* construction scaffold: yard posts/rails/braces (not flat white wash) */
if (b->build < 1.0f) {
int mid = sy + (int)(H * b->build);
if (mid > sy + 2)
fill_rect(sx + 2, sy + 2, W - 4, mid - sy - 2, 235, 232, 220);
line(sx, sy, sx, sy + H, 175, 145, 85);
line(sx + W - 1, sy, sx + W - 1, sy + H, 175, 145, 85);
line(sx, sy, sx + W, sy, 205, 175, 105);
line(sx, mid, sx + W, mid, 215, 185, 115);
line(sx, sy + H - 1, sx + W, sy + H - 1, 155, 125, 70);
line(sx + 2, sy + 2, sx + W - 2, sy + H - 2, 150, 120, 65);
line(sx + W - 2, sy + 2, sx + 2, sy + H - 2, 150, 120, 65);
if (W >= 48)
line(sx + W / 2, sy, sx + W / 2, sy + H, 165, 135, 75);
/* progress tick above pad */
fill_rect(sx, sy - 7, W, 4, 55, 50, 40);
fill_rect(sx, sy - 7, (int)(W * b->build + 0.5f), 4, 120, 220, 120);
}
/* battle damage: scorch patches + crack lines + rubble chips */
if (b->max_hp > 0 && b->hp < b->max_hp * 0.95f) {
float dmg = 1.0f - (b->hp / b->max_hp);
int pw = W / 4; if (pw < 3) pw = 3;
int ph = H / 5; if (ph < 2) ph = 2;
fill_rect(sx + W / 4, sy + H / 3, pw, ph, 45, 35, 25);
if (dmg > 0.3f)
fill_rect(sx + W / 2, sy + H / 2, pw, ph, 55, 40, 28);
line(sx + 3, sy + H / 4, sx + W / 2, sy + (H * 2) / 3, 28, 24, 18);
line(sx + W / 2, sy + (H * 2) / 3, sx + W - 3, sy + H / 3, 28, 24, 18);
if (dmg > 0.5f) {
line(sx + W / 3, sy + 2, sx + W / 3 + 3, sy + H - 2, 22, 18, 14);
fill_rect(sx + 2, sy + H - 4, 5, 3, 95, 78, 55);
fill_rect(sx + W - 9, sy + H - 5, 7, 4, 85, 70, 50);
}
/* thin HP bar so damage reads in KKND_SHOT */
{
int by = sy - 6;
float f = b->hp / b->max_hp;
fill_rect(sx - 1, by - 1, W + 2, 5, 20, 18, 14);
fill_rect(sx, by, W, 3, 55, 48, 36);
fill_rect(sx, by, (int)(W * f + 0.5f), 3, br, bg, 40);
}
}
}
void snapshot_capture(Game *g, const char *path) {