engine-c: SDL ground shadows + type-scale + richer bld silhouettes

This commit is contained in:
local-model/engine-L2-grok-4.5 2026-09-19 11:31:00 +02:00
parent 86c0d6c0b0
commit 7d880ed2fd
No known key found for this signature in database
3 changed files with 90 additions and 40 deletions

View file

@ -182,65 +182,83 @@ SDL_Texture *sprites_make_unit(SDL_Renderer *r, UnitType t, Faction f) {
}
/* ---------------- building sprites ---------------- */
/* Bright concrete pad + BT_* interiors (parity with snapshot draw_bld). */
SDL_Texture *sprites_make_bld(SDL_Renderer *r, BuildingType t, Faction f) {
int w = bld_def(t)->w, h = bld_def(t)->h;
int W = w * TILE, H = h * TILE;
SDL_Surface *s = new_surf(W, H);
SDL_Color base = faction_color(f);
SDL_Color dark = darken(base, 0.5f);
SDL_Color lite = lighten(base, 0.4f);
/* Bright sand pad + dark ridge outline (arid wasteland plate). */
SDL_Color wall = { 198, 168, 108, 255 };
SDL_Color wall2 = { 155, 128, 78, 255 };
const Uint8 ok = 28, og = 24, ob = 18;
SDL_Color lite = lighten(base, 0.35f);
const Uint8 ok = 22, og = 20, ob = 16;
const Uint8 wall = 205, wall2 = 175;
fill_rect(s, 0, 0, W, H, wall2.r, wall2.g, wall2.b, 255);
fill_rect(s, 2, 2, W - 4, H - 4, ok, og, ob, 255);
fill_rect(s, 4, 4, W - 8, H - 8, wall.r, wall.g, wall.b, 255);
ring(s, W/2, H/2, (W<H?W:H)/2 - 3, 2, dark.r, dark.g, dark.b, 255);
/* Bright concrete pad on arid sand */
fill_rect(s, 0, 0, W, H, ok, og, ob, 255);
fill_rect(s, 2, 2, W - 4, H - 4, 210, 185, 130, 255);
fill_rect(s, 4, 4, W - 8, H - 8, wall2, (Uint8)(wall2 - 18), (Uint8)(wall2 - 45), 255);
fill_rect(s, 5, 5, W - 10, H - 10, wall, (Uint8)(wall - 22), (Uint8)(wall - 55), 255);
fill_rect(s, 5, 5, W - 10, 6, (Uint8)(wall + 30), (Uint8)(wall + 10), (Uint8)(wall - 20), 255);
switch (t) {
case BT_BASE:
disc(s, W/2, H/2, W/4, base.r, base.g, base.b, 255);
disc(s, W/2, H/2, W/6, lite.r, lite.g, lite.b, 255);
line(s, W/2, H/2, W/2, 4, 200, 200, 60, 255);
fill_rect(s, 5, 5, W - 10, H - 10, ok, og, ob, 255);
fill_rect(s, 7, 7, W - 14, H - 14, base.r, base.g, base.b, 255);
disc(s, W/2, H/2, W/4, lite.r, lite.g, lite.b, 255);
disc(s, W/2, H/2, W/6, 255, 250, 180, 255);
line(s, W/2, H/2, W/2, 4, 220, 210, 80, 255);
fill_rect(s, W/2 - 2, 4, 4, H/3, 200, 180, 60, 255); /* antenna mast */
break;
case BT_WARFACTORY:
fill_rect(s, 8, 8, W-16, H-16, dark.r, dark.g, dark.b, 255);
fill_rect(s, 12, 12, W-24, 10, base.r, base.g, base.b, 255);
fill_rect(s, 12, H-24, W-24, 10, base.r, base.g, base.b, 255);
fill_rect(s, 5, 5, W - 10, H - 10, ok, og, ob, 255);
fill_rect(s, 7, 7, W - 14, H - 14, base.r, base.g, base.b, 255);
fill_rect(s, 10, 10, W - 20, 12, lite.r, lite.g, lite.b, 255);
fill_rect(s, 10, H - 24, W - 20, 12, lite.r, lite.g, lite.b, 255);
fill_rect(s, W/2 - 4, 8, 8, H - 16, 35, 35, 40, 255); /* bay door */
break;
case BT_REFINERY:
disc(s, W/2, H/2, W/4, 120, 100, 60, 255);
ring(s, W/2, H/2, W/4 - 3, 3, 60, 50, 40, 255);
disc(s, W/2, H/2, W/4 + 2, ok, og, ob, 255);
disc(s, W/2, H/2, W/4, 200, 165, 85, 255);
ring(s, W/2, H/2, W/4 - 3, 3, 90, 70, 45, 255);
fill_rect(s, 8, H - 14, W - 16, 8, 140, 110, 55, 255); /* base slab */
break;
case BT_POWER:
disc(s, W/2, H/2, W/3, 80, 120, 160, 255);
line(s, W/2, 4, W/2, H-4, 220, 240, 255, 255);
line(s, 4, H/2, W-4, H/2, 220, 240, 255, 255);
disc(s, W/2, H/2, W/3 + 1, ok, og, ob, 255);
disc(s, W/2, H/2, W/3, 100, 160, 210, 255);
line(s, W/2, 4, W/2, H - 4, 230, 245, 255, 255);
line(s, 4, H/2, W - 4, H/2, 230, 245, 255, 255);
disc(s, W/2, H/2, 4, 250, 252, 255, 255);
break;
case BT_TURRET:
disc(s, W/2, H/2, W/3, dark.r, dark.g, dark.b, 255);
fill_rect(s, 4, H - 10, W - 8, 8, 55, 50, 42, 255);
disc(s, W/2, H/2, W/3 + 1, ok, og, ob, 255);
disc(s, W/2, H/2, W/3, base.r, base.g, base.b, 255);
disc(s, W/2, H/2, W/5, lite.r, lite.g, lite.b, 255);
line(s, W/2, H/2, W/2 + 12, H/2 - 12, 40, 40, 45, 255);
line(s, W/2, H/2, W/2 + 14, H/2 - 14, 30, 28, 24, 255);
disc(s, W/2 + 12, H/2 - 12, 2, 255, 200, 80, 255); /* barrel tip */
break;
case BT_WALL:
fill_rect(s, 2, 2, W-4, H-4, 70, 66, 60, 255);
line(s, 2, 2, W-2, H-2, 40, 38, 34, 255);
fill_rect(s, 1, 1, W - 2, H - 2, ok, og, ob, 255);
fill_rect(s, 2, 2, W - 4, H - 4, 175, 155, 120, 255);
fill_rect(s, 3, 3, W - 6, 5, 210, 190, 150, 255);
line(s, 2, 2, W - 2, H - 2, 60, 52, 42, 255);
break;
case BT_REPAIR:
fill_rect(s, 8, 8, W-16, H-16, dark.r, dark.g, dark.b, 255);
fill_rect(s, 7, 7, W - 14, H - 14, ok, og, ob, 255);
fill_rect(s, 9, 9, W - 18, H - 18, base.r, base.g, base.b, 255);
ring(s, W/2, H/2, W/4, 3, 120, 220, 120, 255);
line(s, W/2 - 12, H/2, W/2 + 12, H/2, 120, 220, 120, 255);
line(s, W/2, H/2 - 12, W/2, H/2 + 12, 120, 220, 120, 255);
break;
case BT_RESEARCH:
fill_rect(s, 8, 8, W-16, H-16, dark.r, dark.g, dark.b, 255);
disc(s, W/2, H/2, W/5, 180, 150, 60, 255);
line(s, W/2, 6, W/2, H-6, 220, 220, 150, 255);
line(s, 6, H/2, W-6, H/2, 220, 220, 150, 255);
fill_rect(s, 7, 7, W - 14, H - 14, ok, og, ob, 255);
fill_rect(s, 9, 9, W - 18, H - 18, base.r, base.g, base.b, 255);
disc(s, W/2, H/2, W/5, 210, 180, 80, 255);
line(s, W/2, 6, W/2, H - 6, 230, 230, 160, 255);
line(s, 6, H/2, W - 6, H/2, 230, 230, 160, 255);
break;
default:
(void)dark;
break;
}
SDL_Texture *tex = SDL_CreateTextureFromSurface(r, s);