Esempio n. 1
0
static bool
physics_in (struct anim *k)
{
  struct pos pmbo, ptf;

  /* inertia */
  k->inertia = 0;
  k->cinertia = 4;

  /* collision */
  if (uncollide (&k->f, &k->fo, _bf, -4, -4, NULL, &k->ci)) {
    kid_stabilize_collision (k);
    return false;
  }

  /* fall */
  survey (_mbo, pos, &k->f, NULL, &pmbo, NULL);
  surveyo (_tf, -4, +0, pos, &k->f, NULL, &ptf, NULL);
  if (is_strictly_traversable (&pmbo)
      || is_strictly_traversable (&ptf)) {
    kid_fall (k);
    return false;
  }

  return true;
}
Esempio n. 2
0
static bool
physics_in (struct anim *k)
{
  /* collision */
  uncollide (&k->f, &k->fo, _bb, +5, +0, &k->fo, NULL);

  return true;
}
Esempio n. 3
0
static bool
physics_in (struct anim *g)
{
  /* collision */
  uncollide (&g->f, &g->fo, _bb, +0, +0, &g->fo, NULL);

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

  return true;
}
Esempio n. 4
0
static bool
physics_in (struct anim *k)
{
  struct coord nc; struct pos np, pm;
  enum confg cm;

  /* collision */
  if (is_colliding (&k->f, &k->fo, +0, false, &k->ci)
      && k->ci.t != MIRROR) {
    if (k->i <= 2 && k->fall)
      uncollide (&k->f, &k->fo, &k->fo, +0, false, &k->ci);
    else {
      kid_stabilize_collision (k);
      return false;
    }
  } else if (is_colliding (&k->f, &k->fo, +2, false, &k->ci)
             && k->ci.t == MIRROR) {
    if (k->i <= 2)
      k->f.c.x += (k->f.dir == LEFT) ? +4 : -4;
    else {
      kid_stabilize_collision (k);
      return false;
    }
  }

  if (! k->fall && kid_door_split_collision (k)) return false;


  /* fall */
  cm = survey (_m, pos, &k->f, &nc, &pm, &np)->fg;
  struct loose_floor *l =
    loose_floor_at_pos (prel (&pm, &np, -1, +0));
  if ((is_strictly_traversable (&pm)
       || (l && l->action == FALL_LOOSE_FLOOR && cm == LOOSE_FLOOR))
      && ! (k->fall && k->i == 0)) {
    kid_fall (k);
    return false;
  }

  return true;
}
Esempio n. 5
0
static bool
physics_in (struct anim *k)
{
  struct pos ptb;

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

  /* collision */
  next_frame_inv = true;
  uncollide (&k->f, &k->fo, _bb, +0, -2, &k->fo, NULL);
  next_frame_inv = false;

  /* fall */
  surveyo (_tb, -2, +0, pos, &k->f, NULL, &ptb, NULL);
  if (is_strictly_traversable (&ptb)) {
    kid_fall (k);
    return false;
  }

  return true;
}
Esempio n. 6
0
static bool
physics_in (struct anim *k)
{
  struct coord nc; struct pos np, pbf, pmbo, pbb;

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

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

  return true;
}
Esempio n. 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;
}
Esempio n. 8
0
static bool
physics_in (struct anim *k)
{
  struct pos pbf, pmbo, pbb;

  /* collision */
  uncollide (&k->f, &k->fo, &k->fo, +0, true, &k->ci);
  if (fight_door_split_collision (k)) return false;

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

  return true;
}
Esempio n. 9
0
static bool
physics_in (struct anim *g)
{
  struct pos pbf, pmt, pmtf, pmtb,
    npmbo, npmbo_nf;
  struct frame nf;
  struct frame_offset fo;

  if (g->i == 0) {
    next_frame (&g->f, &g->f, &g->fo);

    int dirf = (g->f.dir == LEFT) ? -1 : +1;
    int dirb = (g->f.dir == LEFT) ? +1 : -1;
    survey (_mt, pos, &g->f, NULL, &pmt, NULL);
    prel (&pmt, &pmtf, +0, dirf);
    prel (&pmt, &pmtb, +0, dirb);

    if (! is_strictly_traversable (&pmt)
        || ! is_strictly_traversable (&pmtf)
        || ! is_strictly_traversable (&pmtb))
      place_in_initial_fall (g);
  }

  /* fall speed */
  if (g->i > 0)
    g->fo.dx = -g->inertia;
  if (g->i > 4) {
    int speed = +21 + 3 * (g->i - 5);
    g->fo.dy = (speed > 33) ? 33 : speed;
  }

  /* land on ground */
  struct frameset *frameset = get_guard_fall_frameset (g->type);
  fo.b = frameset[g->i > 2 ? 2 : g->i].frame;
  fo.dx = frameset[g->i > 2 ? 2 : g->i].dx;
  fo.dy = frameset[g->i > 2 ? 2 : g->i].dy;

  if (g->i > 0) g->fo.dx = -g->inertia;
  if (g->i > 2) {
    int speed = +21 + 3 * (g->i - 5);
    fo.dy = (speed > 33) ? 33 : speed;
  }
  fo.dy += 8;

  survey (_mbo, pos, &g->f, NULL, NULL, &npmbo);
  next_frame (&g->f, &nf, &fo);
  survey (_mbo, pos, &nf, NULL, NULL, &npmbo_nf);

  if (g->i > 2
      && ! is_strictly_traversable (&npmbo)
      && npmbo.floor != npmbo_nf.floor) {
    g->inertia = g->cinertia = 0;

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

    survey (_bf, pos, &g->f, NULL, &pbf, NULL);
    /* pos2view (&pbf, &pbf); */
    frameset = get_guard_vigilant_frameset (g->type);
    g->f.b = frameset[0].frame;
    place_on_the_ground (&g->f, &g->f.c);

    shake_loose_floor_row (&pbf);

    if (g->i >= 8 && ! g->immortal
        && ! g->fall_immune) {
      g->hurt = true;
      g->splash = true;
      g->current_lives--;

      if (g->i >= 10) g->current_lives = 0;

      if (g->current_lives > 0) g->uncouch_slowly = true;
    } else if (g->i > 3) {
      play_sample (hit_ground_sample, NULL, g->id);
      g->hurt = false;
    } else g->hurt = false;

    stop_sample (scream_sample, NULL, g->id);

    survey (_mt, pos, &g->f, NULL, &pmt, NULL);
    g->p = pmt;

    if (con (&pmt)->fg == SPIKES_FLOOR
        && ! spikes_floor_at_pos (&pmt)->inactive)
      guard_die_spiked (g);
    else if (g->current_lives <= 0) {
      play_sample (hit_ground_fatal_sample, NULL, g->id);
      guard_die_suddenly (g);
      g->death_reason = FALL_DEATH;
    } else {
      place_on_the_ground (&g->f, &g->f.c);
      g->f.c.y++;
      guard_vigilant (g);
    }

    return false;
  }

  return true;
}