engine-c: denser mid-air tracers + artillery/missile arcs
This commit is contained in:
parent
1ef6df4ce5
commit
b4d3388701
7 changed files with 187 additions and 76 deletions
|
|
@ -203,36 +203,39 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
/* Mid-flight shells/missiles/lasers: after ~1s sim most live
|
||||
* bullets have already impacted. Reseed between nearby opposing
|
||||
* pairs so the PNG shows KKND2-like tracers across the clash. */
|
||||
* bullets have already impacted. Reseed from attacker origin with
|
||||
* mid-flight prog so lofted kinds keep their parabolic arc in PNG. */
|
||||
{
|
||||
int spawned = 0;
|
||||
const float pair_r2 = 180.0f * 180.0f;
|
||||
for (int i = 0; i < g->unit_count && spawned < 72; i++) {
|
||||
for (int i = 0; i < g->unit_count && spawned < 110; i++) {
|
||||
Unit *a = &g->units[i];
|
||||
if (a->dead) continue;
|
||||
float ax = a->x - clash_x, ay = a->y - clash_y;
|
||||
if (ax * ax + ay * ay > r2) continue;
|
||||
int shots = 0;
|
||||
for (int j = 0; j < g->unit_count && spawned < 72 && shots < 3; j++) {
|
||||
for (int j = 0; j < g->unit_count && spawned < 110 && shots < 4; 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 = (spawned % 4 == 0) ? 3
|
||||
: (spawned % 4 == 1) ? 1
|
||||
: (spawned % 4 == 2) ? 2 : 0;
|
||||
/* bias shell/missile arcs over MG/laser */
|
||||
int kind = (spawned % 5 == 0) ? 0
|
||||
: (spawned % 5 == 1) ? 2
|
||||
: (spawned % 5 == 2) ? 1
|
||||
: (spawned % 5 == 3) ? 3 : 1;
|
||||
float t = 0.18f + 0.60f * ((spawned * 37) % 100) / 100.0f;
|
||||
float sx = a->x + dx * t;
|
||||
float sy = a->y + dy * t;
|
||||
bullet_spawn(g, sx, sy, b->id, -1, 1.0f, a->faction, kind);
|
||||
int before = g->bullet_count;
|
||||
bullet_spawn(g, a->x, a->y, b->id, -1, 1.0f, a->faction, kind);
|
||||
if (g->bullet_count > before)
|
||||
bullet_place_at_prog(&g->bullets[g->bullet_count - 1], t);
|
||||
spawned++;
|
||||
shots++;
|
||||
}
|
||||
}
|
||||
/* turret / base guns → nearest enemy in clash */
|
||||
for (int i = 0; i < g->bld_count && spawned < 88; i++) {
|
||||
for (int i = 0; i < g->bld_count && spawned < 130; i++) {
|
||||
Building *bl = &g->buildings[i];
|
||||
if (bl->dead || (bl->type != BT_TURRET && bl->type != BT_BASE))
|
||||
continue;
|
||||
|
|
@ -250,10 +253,12 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
if (best < 0) continue;
|
||||
Unit *tgt = &g->units[best];
|
||||
float dx = tgt->x - bx, dy = tgt->y - by;
|
||||
float t = 0.25f + 0.45f * ((spawned * 19) % 100) / 100.0f;
|
||||
bullet_spawn(g, bx + dx * t, by + dy * t, tgt->id, -1,
|
||||
2.0f, bl->faction, (spawned & 1) ? 1 : 2);
|
||||
int kind = (spawned % 3 == 0) ? 3 : 1;
|
||||
int before = g->bullet_count;
|
||||
bullet_spawn(g, bx, by, tgt->id, -1, 2.0f, bl->faction, kind);
|
||||
if (g->bullet_count > before)
|
||||
bullet_place_at_prog(&g->bullets[g->bullet_count - 1], t);
|
||||
particle_burst(g, bx, by - 4.0f, 5, 2, 255, 220, 100);
|
||||
spawned++;
|
||||
}
|
||||
|
|
@ -307,29 +312,32 @@ int main(int argc, char **argv) {
|
|||
int spawned2 = 0;
|
||||
const float pair_r2 = 160.0f * 160.0f;
|
||||
const float r2b = 140.0f * 140.0f;
|
||||
for (int i = 0; i < g->unit_count && spawned2 < 48; i++) {
|
||||
for (int i = 0; i < g->unit_count && spawned2 < 72; 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 < 48 && shots < 3; j++) {
|
||||
for (int j = 0; j < g->unit_count && spawned2 < 72 && shots < 4; 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 < 18.0f * 18.0f) continue;
|
||||
int kind = (spawned2 % 4 == 0) ? 3
|
||||
: (spawned2 % 4 == 1) ? 1
|
||||
: (spawned2 % 4 == 2) ? 2 : 0;
|
||||
int kind = (spawned2 % 5 == 0) ? 0
|
||||
: (spawned2 % 5 == 1) ? 2
|
||||
: (spawned2 % 5 == 2) ? 1
|
||||
: (spawned2 % 5 == 3) ? 3 : 1;
|
||||
float t = 0.18f + 0.58f * ((spawned2 * 41) % 100) / 100.0f;
|
||||
bullet_spawn(g, a->x + dx * t, a->y + dy * t,
|
||||
b->id, -1, 1.0f, a->faction, kind);
|
||||
int before = g->bullet_count;
|
||||
bullet_spawn(g, a->x, a->y, b->id, -1, 1.0f, a->faction, kind);
|
||||
if (g->bullet_count > before)
|
||||
bullet_place_at_prog(&g->bullets[g->bullet_count - 1], t);
|
||||
spawned2++;
|
||||
shots++;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < g->bld_count && spawned2 < 56; i++) {
|
||||
for (int i = 0; i < g->bld_count && spawned2 < 88; i++) {
|
||||
Building *bl = &g->buildings[i];
|
||||
if (bl->dead || (bl->type != BT_TURRET && bl->type != BT_BASE))
|
||||
continue;
|
||||
|
|
@ -347,10 +355,12 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
if (best < 0) continue;
|
||||
Unit *tgt = &g->units[best];
|
||||
float dx = tgt->x - bx, dy = tgt->y - by;
|
||||
float t = 0.26f + 0.44f * ((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);
|
||||
int kind = (spawned2 % 3 == 0) ? 3 : 1;
|
||||
int before = g->bullet_count;
|
||||
bullet_spawn(g, bx, by, tgt->id, -1, 2.0f, bl->faction, kind);
|
||||
if (g->bullet_count > before)
|
||||
bullet_place_at_prog(&g->bullets[g->bullet_count - 1], t);
|
||||
spawned2++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue