engine-c: denser mid-flight combat tracers in KKND_SHOT

This commit is contained in:
local-model/engine-L2-grok-4.5 2026-09-19 10:40:43 +02:00 committed by Hernâni Marques
parent 75c9294202
commit 97662d4440
No known key found for this signature in database
6 changed files with 85 additions and 3 deletions

View file

@ -469,17 +469,41 @@ void snapshot_capture(Game *g, const char *path) {
draw_unit(u, sx, sy);
}
/* projectiles — bright tracers / shells */
/* projectiles — bright tracers / shells with streak tails (KKND2-like) */
for (int i = 0; i < g->bullet_count; i++) {
Bullet *p = &g->bullets[i];
int sx=(int)(p->x-camx), sy=(int)(p->y-camy);
int sx = (int)(p->x - camx), sy = (int)(p->y - camy);
float dx = p->tx - p->x, dy = p->ty - p->y;
float d = sqrtf(dx * dx + dy * dy);
if (d > 1.0f) {
float ux = dx / d, uy = dy / d;
int len = (p->kind == 2) ? 24 : (p->kind == 3) ? 18
: (p->kind == 1) ? 14 : 10;
for (int t = 1; t <= len; t++) {
int tx = sx - (int)(ux * (float)t * 0.75f);
int ty = sy - (int)(uy * (float)t * 0.75f);
uint8_t fade = (uint8_t)(255 - t * 9);
if (p->kind == 2) {
/* laser beam: cyan→magenta streak */
disc(tx, ty, (t < 3) ? 2 : 1, fade, 80, 255);
px(tx, ty, 220, 180, 255);
} else if (p->kind == 3) {
disc(tx, ty, (t < 4) ? 2 : 1, 255, (uint8_t)(120 - t * 4), 30);
} else {
disc(tx, ty, 1, 255, (uint8_t)(200 - t * 8), 50);
}
}
}
int rad = (p->kind == 1 || p->kind == 3) ? 6 : 4;
disc(sx, sy, rad + 1, 255, 160, 40);
disc(sx, sy, rad, 255, 240, 140);
px(sx+1, sy, 255, 255, 220);
px(sx + 1, sy, 255, 255, 220);
if (p->kind == 3) {
disc(sx - 3, sy + 1, 3, 255, 70, 30);
disc(sx + 2, sy - 2, 2, 255, 200, 80);
} else if (p->kind == 2) {
disc(sx, sy, rad + 1, 120, 200, 255);
disc(sx, sy, rad - 1, 240, 220, 255);
}
}