void guard_die_spiked (struct anim *g) { if (con (&g->p)->fg != SPIKES_FLOOR) { guard_die_properly (g); return; } g->oaction = g->action; g->action = guard_die_spiked; g->f.flip = (g->f.dir == RIGHT) ? ALLEGRO_FLIP_HORIZONTAL : 0; if (g->oaction != guard_die_spiked) { g->splash = true; g->death_reason = SPIKES_DEATH; assert (con (&g->p)->fg == SPIKES_FLOOR); struct spikes_floor *s = spikes_floor_at_pos (&g->p); s->i = 4; s->state = 5; s->inactive = true; s->murdered_anim = g->id; if (g->type == SKELETON) play_sample (skeleton_sample, NULL, g->id); else play_sample (spiked_sample, NULL, g->id); struct anim *ke = get_anim_by_id (g->enemy_id); if (! ke) ke = get_anim_by_id (g->oenemy_id); if (ke && ke->id == current_kid_id && ! g->glory_sample && g->death_reason != SHADOW_FIGHT_DEATH) { play_sample (glory_sample, NULL, ke->id); g->glory_sample = true; } g->oenemy_id = -1; if (ke) upgrade_skill (&ke->skill, &g->skill); } g->current_lives = 0; int dy; if (g->type == SKELETON) dy = +45; else dy = (g->f.dir == LEFT) ? +32 : +31; ALLEGRO_BITMAP *bitmap = get_guard_die_spiked_bitmap (g->type); place_frame (&g->f, &g->f, bitmap, &g->p, (g->f.dir == LEFT) ? +8 : +9, dy); g->xf.b = NULL; }
void guard_die_spiked (struct anim *g) { if (fg (&g->p) != SPIKES_FLOOR) { guard_die_properly (g); return; } g->oaction = g->action; g->action = guard_die_spiked; g->f.flip = (g->f.dir == RIGHT) ? ALLEGRO_FLIP_HORIZONTAL : 0; assert (fg (&g->p) == SPIKES_FLOOR); struct spikes_floor *s = spikes_floor_at_pos (&g->p); if (s->i != 4 || s->state != 5 || ! s->inactive) { s->i = 4; s->state = 5; s->inactive = true; register_changed_pos (&g->p); } if (g->oaction != guard_die_spiked) { g->splash = true; g->death_reason = SPIKES_DEATH; if (g->type == SKELETON) play_audio (&skeleton_audio, NULL, g->id); else play_audio (&spiked_audio, NULL, g->id); if (! g->glory_sample) { play_audio (&glory_audio, NULL, g->id); g->glory_sample = true; } } g->current_lives = 0; int dy; if (g->type == SKELETON) dy = +45; else dy = (g->f.dir == LEFT) ? +32 : +31; ALLEGRO_BITMAP *bitmap = get_guard_die_spiked_bitmap (g->type); place_frame (&g->f, &g->f, bitmap, &g->p, (g->f.dir == LEFT) ? +8 : +9, dy); g->xf.b = NULL; }