Exemple #1
0
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);
}
Exemple #2
0
static bool
physics_in (struct anim *g)
{
  /* fall */
  struct pos pm;
  survey (_m, pos, &g->f, NULL, &pm, NULL);
  if (is_strictly_traversable (&pm)) {
    guard_fall (g);
    return false;
  }

  return true;
}
Exemple #3
0
static bool
physics_in (struct anim *g)
{
  struct pos pmbo;

  /* collision */
  uncollide_front_fight (g);

  /* fall */
  survey (_mbo, pos, &g->f, NULL, &pmbo, NULL);
  if (is_strictly_traversable (&pmbo)) {
    g->xf.b = NULL;
    guard_fall (g);
    return false;
  }

  return true;
}
Exemple #4
0
static bool
physics_in (struct anim *g)
{
  struct pos pmbo, pbb;

  /* inertia */
  g->inertia = g->cinertia = 0;

  /* fall */
  survey (_mbo, pos, &g->f, NULL, &pmbo, NULL);
  survey (_bb, pos, &g->f, NULL, &pbb, NULL);
  if (is_strictly_traversable (&pmbo)
      && is_strictly_traversable (&pbb)) {
    guard_fall (g);
    return false;
  }

  return true;
}
Exemple #5
0
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);
}
Exemple #6
0
static bool
physics_in (struct anim *g)
{
  struct pos pmbo;

  /* collision */
  uncollide_static_neutral (g);

  /* inertia */
  g->inertia = g->cinertia = 0;

  /* fall */
  survey (_mbo, pos, &g->f, NULL, &pmbo, NULL);
  if (is_strictly_traversable (&pmbo)) {
    guard_fall (g);
    return false;
  }

  return true;
}
Exemple #7
0
static bool
physics_in (struct anim *g)
{
  struct pos pbf, pmbo, pbb;

  /* collision */
  uncollide (&g->f, &g->fo, &g->fo, +0, true, &g->ci);

  /* fall */
  survey (_bf, pos, &g->f, NULL, &pbf, NULL);
  survey (_mbo, pos, &g->f, NULL, &pmbo, NULL);
  survey (_bb, pos, &g->f, NULL, &pbb, NULL);
  if ((is_strictly_traversable (&pbf)
       || is_strictly_traversable (&pmbo)
       /* || is_strictly_traversable (&pbb) */
       )) {
    g->xf.b = NULL;
    guard_fall (g);
    return false;
  }

  return true;
}