Exemplo 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;
}
Exemplo n.º 2
0
static bool
physics_in (struct anim *k)
{
  struct pos pbb, pmbo, pbf;
  struct frame nf;

  /* inertia */
  if (k->i >= 8 && k->i <= 10) k->inertia = 5;
  else k->inertia = 0;

  /* collision */
  if (is_colliding (&k->f, &k->fo, +0, false, &k->ci)) {
    if (k->i < 7 || k->i > 10) kid_stabilize_collision (k);
    else kid_couch_collision (k);
    return false;
  }

  /* fall */
  next_frame (&k->f, &nf, &k->fo);
  survey (_bb, pos, &nf, NULL, &pbb, NULL);
  survey (_mbo, pos, &nf, NULL, &pmbo, NULL);
  survey (_bf, pos, &nf, NULL, &pbf, NULL);
  if ((is_strictly_traversable (&pbb)
       && is_strictly_traversable (&pmbo) && k->i < 7)
      || (k->i >= 10 && k->i < 13
          && is_strictly_traversable (&pbf)
          && is_strictly_traversable (&pmbo))
      || (k->i >= 13 && is_strictly_traversable (&pmbo))) {
    kid_fall (k);
    return false;
  }

  return true;
}
Exemplo n.º 3
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;
}
Exemplo n.º 4
0
static bool
physics_in (struct anim *k)
{
  struct coord nc; struct pos np, ptf;

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

  /* collision */
  if (is_colliding (&k->f, &k->fo, +0, false, &k->ci)) {
    kid_stabilize_collision (k);
    return false;
  }

  /* fall */
  survey (_tf, pos, &k->f, &nc, &ptf, &np);
  if (is_strictly_traversable (&ptf)) {
    kid_fall (k);
    return false;
  }

  return true;
}