engine-c: scrap mounds + lingering FX + secondary SE clash

This commit is contained in:
local-model/engine-L2-grok-4.5 2026-09-19 14:20:56 +02:00
parent 0897293f51
commit 4411169cc3
No known key found for this signature in database
5 changed files with 243 additions and 22 deletions

View file

@ -214,6 +214,76 @@ int main(int argc, char **argv) {
spawned++;
}
}
/* secondary SE clash: lingering columns + tracers */
float clash2_x = hx + 40.0f, clash2_y = hy + 70.0f;
float c2x = clash2_x, c2y = clash2_y;
int n2 = 0;
float sx2 = 0, sy2 = 0;
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 - clash2_x, dy = u->y - clash2_y;
if (dx * dx + dy * dy > 140.0f * 140.0f) continue;
sx2 += u->x; sy2 += u->y; n2++;
}
if (n2 > 0) { c2x = sx2 / n2; c2y = sy2 / n2; }
particle_burst(g, c2x, c2y, 40, 1, 255, 135, 35);
particle_burst(g, c2x + 18, c2y - 10, 28, 0, 115, 105, 90);
particle_burst(g, c2x - 14, c2y + 12, 30, 2, 255, 220, 85);
particle_burst(g, c2x + 26, c2y + 8, 22, 1, 255, 95, 28);
particle_burst(g, c2x - 6, c2y - 20, 24, 3, 90, 78, 62);
particle_burst(g, c2x + 10, c2y + 24, 20, 1, 255, 160, 50);
{
int spawned2 = 0;
const float pair_r2 = 150.0f * 150.0f;
const float r2b = 140.0f * 140.0f;
for (int i = 0; i < g->unit_count && spawned2 < 36; i++) {
Unit *a = &g->units[i];
if (a->dead) continue;
float ax = a->x - clash2_x, ay = a->y - clash2_y;
if (ax * ax + ay * ay > r2b) continue;
int shots = 0;
for (int j = 0; j < g->unit_count && spawned2 < 36 && shots < 2; j++) {
Unit *b = &g->units[j];
if (b->dead || b->faction == a->faction) continue;
float dx = b->x - a->x, dy = b->y - a->y;
float d2 = dx * dx + dy * dy;
if (d2 > pair_r2 || d2 < 20.0f * 20.0f) continue;
int kind = (spawned2 % 4 == 0) ? 3
: (spawned2 % 4 == 1) ? 1
: (spawned2 % 4 == 2) ? 2 : 0;
float t = 0.20f + 0.55f * ((spawned2 * 41) % 100) / 100.0f;
bullet_spawn(g, a->x + dx * t, a->y + dy * t,
b->id, -1, 1.0f, a->faction, kind);
spawned2++;
shots++;
}
}
for (int i = 0; i < g->bld_count && spawned2 < 44; i++) {
Building *bl = &g->buildings[i];
if (bl->dead || (bl->type != BT_TURRET && bl->type != BT_BASE))
continue;
float bx = (float)(bl->tx * TILE + bl->w * TILE / 2);
float by = (float)(bl->ty * TILE + bl->h * TILE / 2);
float bdx = bx - clash2_x, bdy = by - clash2_y;
if (bdx * bdx + bdy * bdy > r2b) continue;
int best = -1; float bestd = 1e12f;
for (int j = 0; j < g->unit_count; j++) {
Unit *u = &g->units[j];
if (u->dead || u->faction == bl->faction) continue;
float dx = u->x - bx, dy = u->y - by;
float d2 = dx * dx + dy * dy;
if (d2 < bestd && d2 < pair_r2) { bestd = d2; best = j; }
}
if (best < 0) continue;
Unit *tgt = &g->units[best];
float dx = tgt->x - bx, dy = tgt->y - by;
float t = 0.28f + 0.42f * ((spawned2 * 23) % 100) / 100.0f;
bullet_spawn(g, bx + dx * t, by + dy * t, tgt->id, -1,
2.0f, bl->faction, (spawned2 & 1) ? 1 : 2);
spawned2++;
}
}
}
char path[64]; snprintf(path, sizeof path, "shot_%04d.png", 1);
snapshot_capture(g, path);