engine-c: arid KKND2-like showcase shot + kitchen claim DONE
This commit is contained in:
parent
575d7d29b8
commit
b5a89c9b47
11 changed files with 739 additions and 84 deletions
|
|
@ -118,11 +118,48 @@ int main(int argc, char **argv) {
|
|||
* draw the world to an RGBA buffer with the software renderer and save a
|
||||
* PNG. Avoids the broken GPU readback on this box entirely. */
|
||||
if (shot_mode) {
|
||||
float pre = 8.0f;
|
||||
/* Mid-fight default: short so the raid pack is still dense in-frame
|
||||
* (env KKND_SHOT_T overrides; 3.5s emptied the clash before). */
|
||||
float pre = 1.0f;
|
||||
if (getenv("KKND_SHOT_T")) pre = (float)atof(getenv("KKND_SHOT_T"));
|
||||
float hdt = 1.0f / 30.0f;
|
||||
int steps = (int)(pre / hdt);
|
||||
for (int i = 0; i < steps; i++) engine_update(g, hdt);
|
||||
/* Particle life is short (~0.5–1.2s); reseed FX at the live clash so
|
||||
* the PNG shows explosions/smoke instead of a quiet mid-fight plate. */
|
||||
{
|
||||
/* FX at raid clash near human HQ (ignore far-base garrison). */
|
||||
float hx = 0, hy = 0;
|
||||
{
|
||||
int sx = g->map.spawn_x[g->human], sy = g->map.spawn_y[g->human];
|
||||
map_tile_to_world(sx, sy, &hx, &hy);
|
||||
}
|
||||
float clash_x = hx + 88.0f, clash_y = hy - 48.0f;
|
||||
float cx = 0, cy = 0;
|
||||
int n = 0;
|
||||
const float r2 = 220.0f * 220.0f;
|
||||
for (int i = 0; i < g->unit_count; i++) {
|
||||
Unit *u = &g->units[i];
|
||||
if (u->dead || u->faction == g->human) continue;
|
||||
float dx = u->x - clash_x, dy = u->y - clash_y;
|
||||
if (dx * dx + dy * dy > r2) continue;
|
||||
cx += u->x; cy += u->y; n++;
|
||||
}
|
||||
if (n > 0) { cx /= n; cy /= n; }
|
||||
else { cx = clash_x; cy = clash_y; }
|
||||
particle_burst(g, cx, cy, 56, 1, 255, 140, 40);
|
||||
particle_burst(g, cx + 22, cy - 12, 36, 0, 110, 100, 90);
|
||||
particle_burst(g, cx - 18, cy + 14, 40, 2, 255, 230, 90);
|
||||
particle_burst(g, cx + 36, cy + 8, 30, 1, 255, 90, 30);
|
||||
particle_burst(g, cx - 8, cy - 28, 32, 3, 95, 80, 65);
|
||||
particle_burst(g, cx + 12, cy + 30, 28, 1, 255, 170, 55);
|
||||
particle_burst(g, cx - 30, cy - 6, 26, 1, 255, 120, 40);
|
||||
particle_burst(g, cx + 28, cy + 22, 24, 2, 255, 210, 80);
|
||||
particle_burst(g, cx - 40, cy + 18, 22, 1, 255, 100, 35);
|
||||
particle_burst(g, cx + 44, cy - 16, 20, 2, 255, 240, 100);
|
||||
particle_burst(g, cx + 8, cy - 40, 18, 1, 255, 150, 45);
|
||||
particle_burst(g, cx - 22, cy + 36, 18, 0, 120, 110, 95);
|
||||
}
|
||||
char path[64]; snprintf(path, sizeof path, "shot_%04d.png", 1);
|
||||
snapshot_capture(g, path);
|
||||
engine_log("snapshot -> %s", path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue