engine-c: denser mid-fight fire/smoke/muzzle/impact for KKND2 combat read
This commit is contained in:
parent
72b2c0dc0a
commit
01c7ab8b76
5 changed files with 112 additions and 57 deletions
|
|
@ -57,12 +57,13 @@ 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 */
|
||||
/* denser impact: fire/laser core + smoke ring + debris */
|
||||
int hit_kind = (b->kind == 2) ? 2 : 1;
|
||||
particle_burst(g, b->tx, b->ty, 7, hit_kind, 255, 200, 80);
|
||||
particle_burst(g, b->tx, b->ty, 4, 0, 90, 80, 60);
|
||||
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, 3, 3, 255, 140, 40);
|
||||
particle_burst(g, b->tx, b->ty, 6, 3, 255, 140, 40);
|
||||
/* swap-remove */
|
||||
g->bullets[i] = g->bullets[g->bullet_count - 1];
|
||||
g->bullet_count--;
|
||||
|
|
@ -73,9 +74,14 @@ void bullet_update(Game *g, float dt) {
|
|||
/* trail — denser muzzle streak for non-ballistic shells */
|
||||
if (b->kind != 0)
|
||||
particle_spawn(g, b->x, b->y, 2, 255, 180, 60);
|
||||
if (b->kind == 1 || b->kind == 3)
|
||||
if (b->kind == 1 || b->kind == 3) {
|
||||
particle_spawn(g, b->x - dx / d * 3.0f, b->y - dy / d * 3.0f,
|
||||
3, 255, 160, 50);
|
||||
particle_spawn(g, b->x - dx / d * 6.0f, b->y - dy / d * 6.0f,
|
||||
1, 255, 140, 40);
|
||||
}
|
||||
if (b->kind == 2)
|
||||
particle_spawn(g, b->x, b->y, 2, 180, 120, 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -89,9 +95,9 @@ void particle_spawn(Game *g, float x, float y, int kind, uint8_t cr, uint8_t cg,
|
|||
p->vx = (float)cosf(ang) * sp;
|
||||
p->vy = (float)sinf(ang) * sp;
|
||||
/* lingering columns: smoke / fire / spark|debris (KKND2 clash plate) */
|
||||
if (kind == 0) p->life = p->max_life = 2.8f;
|
||||
else if (kind == 1) p->life = p->max_life = 1.8f;
|
||||
else p->life = p->max_life = 1.0f;
|
||||
if (kind == 0) p->life = p->max_life = 3.6f;
|
||||
else if (kind == 1) p->life = p->max_life = 2.6f;
|
||||
else p->life = p->max_life = 1.4f;
|
||||
p->r = cr; p->g = cg; p->b = cb;
|
||||
p->kind = kind;
|
||||
}
|
||||
|
|
@ -107,8 +113,9 @@ void particle_update(Game *g, float dt) {
|
|||
p->x += p->vx * dt;
|
||||
p->y += p->vy * dt;
|
||||
p->vx *= 0.92f; p->vy *= 0.92f;
|
||||
if (p->kind == 1) p->vy += 40 * dt; /* fire rises/slows */
|
||||
if (p->kind == 0) p->vy -= 18 * dt; /* smoke drifts up */
|
||||
/* screen-y grows downward: subtract to rise (fire + smoke columns) */
|
||||
if (p->kind == 1) p->vy -= 42 * dt;
|
||||
if (p->kind == 0) p->vy -= 22 * dt;
|
||||
if (p->life <= 0) {
|
||||
g->particles[i] = g->particles[g->particle_count - 1];
|
||||
g->particle_count--;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue