void guard_die_chopped (struct anim *g) { if (fg (&g->p) != CHOPPER) { guard_die_properly (g); return; } g->oaction = g->action; g->action = guard_die_chopped; g->f.flip = (g->f.dir == RIGHT) ? ALLEGRO_FLIP_HORIZONTAL : 0; int dx, dy; if (g->type == SHADOW) { dx = (g->f.dir == LEFT) ? -8 : -7; dy = +47; } else { dx = (g->f.dir == LEFT) ? -10 : -13; dy = (g->type == SKELETON) ? +45 : +43; } ALLEGRO_BITMAP *bitmap = get_guard_die_chopped_bitmap (g->type); place_frame (&g->f, &g->f, bitmap, &g->p, dx, dy); if (g->oaction != guard_die_chopped && ! g->glory_sample) { play_audio (&glory_audio, NULL, g->id); g->glory_sample = true; } g->current_lives = 0; g->xf.b = NULL; }
void guard_die_suddenly (struct anim *g) { if (con (&g->p)->fg == SPIKES_FLOOR || con (&g->p)->fg == CHOPPER) { guard_die_properly (g); return; } g->oaction = g->action; g->action = guard_die_suddenly; g->f.flip = (g->f.dir == RIGHT) ? ALLEGRO_FLIP_HORIZONTAL : 0; struct frameset *frameset = get_guard_die_frameset (g->type); int dy = (g->type == SKELETON) ? +44 : +47; place_frame (&g->f, &g->f, frameset[5].frame, &g->p, (g->f.dir == LEFT) ? +9 : +4, dy); if (g->oaction != guard_die_suddenly) { 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; g->xf.b = NULL; g->hit_by_loose_floor = false; /* fall */ struct pos pm; survey (_m, pos, &g->f, NULL, &pm, NULL); if (is_strictly_traversable (&pm)) { guard_fall (g); return; } /* depressible floors */ update_depressible_floor (g, -12, -28); }
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; }
void guard_die_chopped (struct anim *g) { if (con (&g->p)->fg != CHOPPER) { guard_die_properly (g); return; } g->oaction = g->action; g->action = guard_die_chopped; g->f.flip = (g->f.dir == RIGHT) ? ALLEGRO_FLIP_HORIZONTAL : 0; int dx, dy; if (g->type == SHADOW) { dx = (g->f.dir == LEFT) ? -8 : -7; dy = +47; } else { dx = (g->f.dir == LEFT) ? -10 : -13; dy = (g->type == SKELETON) ? +45 : +43; } ALLEGRO_BITMAP *bitmap = get_guard_die_chopped_bitmap (g->type); place_frame (&g->f, &g->f, bitmap, &g->p, dx, dy); if (g->oaction != guard_die_chopped) { 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; g->xf.b = NULL; }
void guard_die_suddenly (struct anim *g) { enum confg f = fg (&g->p); if ( f == SPIKES_FLOOR || f == CHOPPER) { guard_die_properly (g); return; } g->oaction = g->action; g->action = guard_die_suddenly; g->f.flip = (g->f.dir == RIGHT) ? ALLEGRO_FLIP_HORIZONTAL : 0; struct frameset *frameset = get_guard_die_frameset (g->type); int dy = (g->type == SKELETON) ? +44 : +47; place_frame (&g->f, &g->f, frameset[5].frame, &g->p, (g->f.dir == LEFT) ? +9 : +4, dy); if (g->oaction != guard_die_suddenly && ! g->glory_sample) { play_audio (&glory_audio, NULL, g->id); g->glory_sample = true; } g->current_lives = 0; g->xf.b = NULL; g->hit_by_loose_floor = false; /* fall */ struct pos pm; survey (_m, pos, &g->f, NULL, &pm, NULL); if (is_strictly_traversable (&pm)) { guard_fall (g); return; } /* depressible floors */ update_depressible_floor (g, -12, -28); }