engine-c: bigger impact/explosion blooms
This commit is contained in:
parent
d1da64d84b
commit
6ac07fe3a6
5 changed files with 67 additions and 48 deletions
|
|
@ -147,23 +147,25 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
if (n > 0) { cx /= n; cy /= n; }
|
||||
else { cx = clash_x; cy = clash_y; }
|
||||
/* denser mid-fight plate: fire cores + smoke columns + sparks */
|
||||
particle_burst(g, cx, cy, 72, 1, 255, 140, 40);
|
||||
particle_burst(g, cx + 22, cy - 12, 48, 0, 110, 100, 90);
|
||||
particle_burst(g, cx - 18, cy + 14, 52, 2, 255, 230, 90);
|
||||
particle_burst(g, cx + 36, cy + 8, 40, 1, 255, 90, 30);
|
||||
particle_burst(g, cx - 8, cy - 28, 42, 3, 95, 80, 65);
|
||||
particle_burst(g, cx + 12, cy + 30, 36, 1, 255, 170, 55);
|
||||
particle_burst(g, cx - 30, cy - 6, 34, 1, 255, 120, 40);
|
||||
particle_burst(g, cx + 28, cy + 22, 32, 2, 255, 210, 80);
|
||||
particle_burst(g, cx - 40, cy + 18, 30, 1, 255, 100, 35);
|
||||
particle_burst(g, cx + 44, cy - 16, 28, 2, 255, 240, 100);
|
||||
particle_burst(g, cx + 8, cy - 40, 26, 1, 255, 150, 45);
|
||||
particle_burst(g, cx - 22, cy + 36, 26, 0, 120, 110, 95);
|
||||
particle_burst(g, cx + 52, cy + 4, 24, 1, 255, 110, 30);
|
||||
particle_burst(g, cx - 48, cy - 14, 22, 0, 100, 95, 85);
|
||||
particle_burst(g, cx + 16, cy + 48, 20, 3, 85, 70, 55);
|
||||
particle_burst(g, cx - 12, cy - 48, 20, 1, 255, 160, 50);
|
||||
/* bigger impact blooms on plate: denser fire cores + smoke + debris */
|
||||
particle_burst(g, cx, cy, 96, 1, 255, 140, 40);
|
||||
particle_burst(g, cx + 22, cy - 12, 64, 0, 110, 100, 90);
|
||||
particle_burst(g, cx - 18, cy + 14, 60, 2, 255, 230, 90);
|
||||
particle_burst(g, cx + 36, cy + 8, 52, 1, 255, 90, 30);
|
||||
particle_burst(g, cx - 8, cy - 28, 48, 3, 95, 80, 65);
|
||||
particle_burst(g, cx + 12, cy + 30, 48, 1, 255, 170, 55);
|
||||
particle_burst(g, cx - 30, cy - 6, 44, 1, 255, 120, 40);
|
||||
particle_burst(g, cx + 28, cy + 22, 40, 2, 255, 210, 80);
|
||||
particle_burst(g, cx - 40, cy + 18, 40, 1, 255, 100, 35);
|
||||
particle_burst(g, cx + 44, cy - 16, 36, 2, 255, 240, 100);
|
||||
particle_burst(g, cx + 8, cy - 40, 36, 1, 255, 150, 45);
|
||||
particle_burst(g, cx - 22, cy + 36, 34, 0, 120, 110, 95);
|
||||
particle_burst(g, cx + 52, cy + 4, 32, 1, 255, 110, 30);
|
||||
particle_burst(g, cx - 48, cy - 14, 30, 0, 100, 95, 85);
|
||||
particle_burst(g, cx + 16, cy + 48, 28, 3, 85, 70, 55);
|
||||
particle_burst(g, cx - 12, cy - 48, 28, 1, 255, 160, 50);
|
||||
particle_burst(g, cx + 18, cy + 14, 36, 1, 255, 110, 35);
|
||||
particle_burst(g, cx - 24, cy - 18, 32, 3, 255, 150, 45);
|
||||
/* tall stacked building smoke / fire plumes (HQ, walls, turrets) */
|
||||
for (int i = 0; i < g->bld_count; i++) {
|
||||
Building *bl = &g->buildings[i];
|
||||
|
|
@ -276,14 +278,16 @@ int main(int argc, char **argv) {
|
|||
sx2 += u->x; sy2 += u->y; n2++;
|
||||
}
|
||||
if (n2 > 0) { c2x = sx2 / n2; c2y = sy2 / n2; }
|
||||
particle_burst(g, c2x, c2y, 52, 1, 255, 135, 35);
|
||||
particle_burst(g, c2x + 18, c2y - 10, 36, 0, 115, 105, 90);
|
||||
particle_burst(g, c2x - 14, c2y + 12, 40, 2, 255, 220, 85);
|
||||
particle_burst(g, c2x + 26, c2y + 8, 30, 1, 255, 95, 28);
|
||||
particle_burst(g, c2x - 6, c2y - 20, 32, 3, 90, 78, 62);
|
||||
particle_burst(g, c2x + 10, c2y + 24, 28, 1, 255, 160, 50);
|
||||
particle_burst(g, c2x - 28, c2y + 8, 24, 0, 100, 95, 80);
|
||||
particle_burst(g, c2x + 32, c2y - 16, 22, 1, 255, 120, 40);
|
||||
particle_burst(g, c2x, c2y, 72, 1, 255, 135, 35);
|
||||
particle_burst(g, c2x + 18, c2y - 10, 48, 0, 115, 105, 90);
|
||||
particle_burst(g, c2x - 14, c2y + 12, 52, 2, 255, 220, 85);
|
||||
particle_burst(g, c2x + 26, c2y + 8, 40, 1, 255, 95, 28);
|
||||
particle_burst(g, c2x - 6, c2y - 20, 40, 3, 90, 78, 62);
|
||||
particle_burst(g, c2x + 10, c2y + 24, 36, 1, 255, 160, 50);
|
||||
particle_burst(g, c2x - 28, c2y + 8, 32, 0, 100, 95, 80);
|
||||
particle_burst(g, c2x + 32, c2y - 16, 30, 1, 255, 120, 40);
|
||||
particle_burst(g, c2x + 14, c2y + 16, 28, 1, 255, 110, 35);
|
||||
particle_burst(g, c2x - 20, c2y - 12, 24, 3, 255, 150, 45);
|
||||
/* SE building fire/smoke columns (same tall stack) */
|
||||
{
|
||||
const float r2b = 140.0f * 140.0f;
|
||||
|
|
|
|||
|
|
@ -108,13 +108,19 @@ void bullet_update(Game *g, float dt) {
|
|||
Building *t = bld_by_id(g, b->target_bld);
|
||||
if (t) bld_apply_damage(g, t, b->damage);
|
||||
}
|
||||
/* denser impact: fire/laser core + smoke ring + debris */
|
||||
/* bigger KKND2 impact bloom: fire core + smoke ring + debris + flash */
|
||||
int hit_kind = (b->kind == 2) ? 2 : 1;
|
||||
particle_burst(g, b->tx, b->ty, 12, hit_kind, 255, 200, 80);
|
||||
particle_burst(g, b->tx, b->ty, 8, 0, 90, 80, 60);
|
||||
particle_burst(g, b->tx, b->ty, 5, 1, 255, 120, 35);
|
||||
if (b->kind == 1 || b->kind == 3)
|
||||
particle_burst(g, b->tx, b->ty, 6, 3, 255, 140, 40);
|
||||
int shell = (b->kind == 1 || b->kind == 3);
|
||||
particle_burst(g, b->tx, b->ty, shell ? 22 : 14, hit_kind, 255, 200, 80);
|
||||
particle_burst(g, b->tx, b->ty, shell ? 16 : 10, 0, 90, 80, 60);
|
||||
particle_burst(g, b->tx, b->ty, shell ? 12 : 6, 1, 255, 120, 35);
|
||||
particle_burst(g, b->tx + 4, b->ty - 3, shell ? 10 : 5, 1, 255, 170, 50);
|
||||
particle_burst(g, b->tx - 5, b->ty + 4, shell ? 8 : 4, 2, 255, 230, 100);
|
||||
if (shell) {
|
||||
particle_burst(g, b->tx, b->ty, 14, 3, 255, 140, 40);
|
||||
particle_burst(g, b->tx + 8, b->ty + 2, 8, 3, 90, 75, 55);
|
||||
particle_burst(g, b->tx - 6, b->ty - 5, 8, 0, 70, 60, 50);
|
||||
}
|
||||
/* swap-remove */
|
||||
g->bullets[i] = g->bullets[g->bullet_count - 1];
|
||||
g->bullet_count--;
|
||||
|
|
|
|||
|
|
@ -533,14 +533,18 @@ void render_particles(Game *g) {
|
|||
Uint8 a = (Uint8)(255 * life_a);
|
||||
Uint8 rr = (Uint8)(p->r * life_a), gg = (Uint8)(p->g * life_a),
|
||||
bb = (Uint8)(p->b * life_a);
|
||||
int sz = (p->kind == 1) ? 9 : (p->kind == 3) ? 5 : (p->kind == 0) ? 7 : 4;
|
||||
/* larger bloom discs — fire/smoke read as KKND2 explosion cores */
|
||||
int sz = (p->kind == 1) ? 14 : (p->kind == 3) ? 7 : (p->kind == 0) ? 11 : 5;
|
||||
if (p->kind == 0 || p->kind == 1) {
|
||||
draw_particle_disc(g->ren, sx, sy, sz + 2, (Uint8)(rr / 2), (Uint8)(gg / 2),
|
||||
(Uint8)(bb / 2), (Uint8)(a * 0.55f));
|
||||
draw_particle_disc(g->ren, sx, sy, sz + 3, (Uint8)(rr / 2), (Uint8)(gg / 2),
|
||||
(Uint8)(bb / 2), (Uint8)(a * 0.50f));
|
||||
draw_particle_disc(g->ren, sx, sy, sz + 1, rr, gg, bb, a);
|
||||
if (p->kind == 1 && life_a > 0.45f)
|
||||
draw_particle_disc(g->ren, sx, sy - 1, sz / 2 + 1, 255,
|
||||
(Uint8)(220 * life_a), 80, a);
|
||||
if (p->kind == 1 && life_a > 0.40f)
|
||||
draw_particle_disc(g->ren, sx, sy - 2, sz / 2 + 2, 255,
|
||||
(Uint8)(230 * life_a), 90, a);
|
||||
if (p->kind == 1 && life_a > 0.65f)
|
||||
draw_particle_disc(g->ren, sx + 1, sy - 3, sz / 3 + 1, 255,
|
||||
255, 180, a);
|
||||
} else {
|
||||
SDL_SetRenderDrawColor(g->ren, rr, gg, bb, a);
|
||||
SDL_RenderFillRect(g->ren, &(SDL_Rect){ sx - sz/2, sy - sz/2, sz + 1, sz + 1 });
|
||||
|
|
|
|||
|
|
@ -986,13 +986,16 @@ void snapshot_capture(Game *g, const char *path) {
|
|||
if (sx < -12 || sy < -12 || sx > g_sw + 12 || sy > g_sh + 12) continue;
|
||||
float a = p->life / (p->max_life > 0 ? p->max_life : 1.0f);
|
||||
if (a < 0.10f) continue;
|
||||
int sz = (p->kind == 1) ? 9 : (p->kind == 3) ? 5 : (p->kind == 0) ? 7 : 4;
|
||||
/* larger bloom discs — fire/smoke read as KKND2 explosion cores */
|
||||
int sz = (p->kind == 1) ? 14 : (p->kind == 3) ? 7 : (p->kind == 0) ? 11 : 5;
|
||||
uint8_t r = (uint8_t)(p->r * a), gv = (uint8_t)(p->g * a), b = (uint8_t)(p->b * a);
|
||||
if (p->kind == 0 || p->kind == 1) {
|
||||
disc(sx, sy, sz + 2, r / 2, gv / 2, b / 2);
|
||||
disc(sx, sy, sz + 3, r / 2, gv / 2, b / 2);
|
||||
disc(sx, sy, sz + 1, r, gv, b);
|
||||
if (p->kind == 1 && a > 0.45f)
|
||||
disc(sx, sy - 1, sz / 2 + 1, 255, (uint8_t)(220 * a), 80);
|
||||
if (p->kind == 1 && a > 0.40f)
|
||||
disc(sx, sy - 2, sz / 2 + 2, 255, (uint8_t)(230 * a), 90);
|
||||
if (p->kind == 1 && a > 0.65f)
|
||||
disc(sx + 1, sy - 3, sz / 3 + 1, 255, 255, 180);
|
||||
} else {
|
||||
fill_rect(sx - sz/2, sy - sz/2, sz + 1, sz + 1, r, gv, b);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,13 +92,15 @@ void unit_apply_damage(Game *g, Unit *u, float dmg) {
|
|||
if (u->hp <= 0 && !u->dead) {
|
||||
u->dead = 1;
|
||||
u->state = STATE_DEAD;
|
||||
/* denser KKND2-like death: fire core + debris ring + smoke + scorch */
|
||||
particle_burst(g, u->x, u->y, 22, 1, 255, 140, 40);
|
||||
particle_burst(g, u->x, u->y, 14, 3, 90, 80, 70);
|
||||
particle_burst(g, u->x + 6, u->y - 4, 10, 0, 110, 100, 90);
|
||||
particle_burst(g, u->x - 5, u->y + 5, 8, 2, 255, 220, 90);
|
||||
particle_burst(g, u->x + 3, u->y + 7, 8, 1, 60, 50, 45); /* scorch soot */
|
||||
particle_burst(g, u->x - 4, u->y - 6, 6, 0, 70, 55, 40);
|
||||
/* bigger KKND2 death bloom: fire core + debris ring + smoke + scorch */
|
||||
particle_burst(g, u->x, u->y, 32, 1, 255, 140, 40);
|
||||
particle_burst(g, u->x, u->y, 20, 3, 90, 80, 70);
|
||||
particle_burst(g, u->x + 8, u->y - 6, 16, 0, 110, 100, 90);
|
||||
particle_burst(g, u->x - 7, u->y + 6, 14, 2, 255, 220, 90);
|
||||
particle_burst(g, u->x + 4, u->y + 9, 12, 1, 60, 50, 45); /* scorch soot */
|
||||
particle_burst(g, u->x - 5, u->y - 8, 10, 0, 70, 55, 40);
|
||||
particle_burst(g, u->x + 10, u->y + 2, 10, 1, 255, 100, 30);
|
||||
particle_burst(g, u->x - 9, u->y - 3, 8, 3, 255, 160, 50);
|
||||
audio_sfx(2);
|
||||
if (g->cam.shake < 7) g->cam.shake = 7;
|
||||
if (u->faction == g->human)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue