Beispiel #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;
}
Beispiel #2
0
static bool
physics_in (struct anim *k)
{
  struct coord nc; struct pos np, pbf, pmbo, pbb;

  /* collision */
  if (is_colliding (&k->f, &k->fo, +12, true, &k->ci)
      && k->i == 0) {
    kid_sword_normal (k);
    return false;
  }

  /* 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;
}
Beispiel #3
0
static bool
physics_in (struct anim *k)
{
  struct coord nc; struct pos np, pmbo, pbb;

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

  /* fall */
  survey (_mbo, pos, &k->f, &nc, &pmbo, &np);
  survey (_bb, pos, &k->f, &nc, &pbb, &np);
  if (is_strictly_traversable (&pmbo)
      && is_strictly_traversable (&pbb)) {
    kid_fall (k);
    return false;
  }

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

  return true;
}
Beispiel #4
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;
}
Beispiel #5
0
static bool
physics_in (struct anim *k)
{
  struct pos ptf;

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

  return true;
}
Beispiel #6
0
static bool
physics_in (struct anim *k)
{
  struct coord nc; struct pos np, ptf;

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

  return true;
}
Beispiel #7
0
static bool
physics_in (struct anim *k)
{
  struct pos pmbo;

  /* collision */
  uncollide_back_fight (k);

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

  return true;
}
Beispiel #8
0
static bool
physics_in (struct anim *k)
{
  struct coord nc; struct pos np, pbf, pbb;

  /* collision */
  if (kid_door_split_collision (k)) return false;

  /* fall */
  survey (_bf, pos, &k->f, &nc, &pbf, &np);
  survey (_bb, pos, &k->f, &nc, &pbb, &np);
  if (! k->hang
      && is_strictly_traversable (&pbf)
      && is_strictly_traversable (&pbb)) {
    kid_fall (k);
    return false;
  }

  return true;
}
Beispiel #9
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;
}
Beispiel #10
0
static bool
physics_in (struct anim *k)
{
  struct pos pmbo, pbb;

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

  /* collision */
  uncollide_static_kid_normal (k);

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

  return true;
}
Beispiel #11
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;
}
Beispiel #12
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, +4, false, &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;
}
Beispiel #13
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;
}
Beispiel #14
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;
}
Beispiel #15
0
static bool
flow (struct anim *k)
{
  struct pos np;

  if (k->oaction != kid_hang_free)
    k->i = 5, k->j = -1, k->wait = 3, k->reverse = true;

  bool hang_back = ((k->f.dir == LEFT) ? k->key.right : k->key.left)
    && ! k->key.up && k->key.shift;

  int back_dir = (k->f.dir == LEFT) ? RIGHT : LEFT;

    /* hang back */
  if (k->i >= 7
      && hang_back && is_hangable_pos (&k->hang_pos, back_dir)) {
    play_audio (&hang_on_fall_audio, NULL, k->id);
    kid_turn (k);
    return false;
  }

  /* climb */
  if ((k->i < 5 || k->j > -1
       || k->hang_caller != kid_unclimb)
      && k->key.up
      && ! ((k->key.left || k->key.right)
            && k->hang_caller == kid_unclimb)
      && ! k->hang_limit) {
    kid_climb (k);
    return false;
  }

  /* release */
  if ((! k->key.shift || k->hang_limit
       || get_hanged_con (&k->hang_pos, k->f.dir) == NO_FLOOR)
      && (k->i < 5 || k->j > -1)) {
    int dir = (k->f.dir == LEFT) ? -1 : +1;
    k->hang_limit = false;
    if (! is_strictly_traversable (&k->hang_pos)
        && k->i >= 4) {
      place_frame (&k->f, &k->f, kid_vjump_frameset[13].frame,
                   &k->hang_pos, (k->f.dir == LEFT) ? +7 : PLACE_WIDTH + 9, -8);
      kid_vjump (k);
      return false;
    }
    if (! is_strictly_traversable (prel (&k->hang_pos, &np, +0, dir))
        && k->i <= 4) {
      place_frame (&k->f, &k->f, kid_vjump_frameset[13].frame,
                   &k->hang_pos, (k->f.dir == LEFT) ? +7 : PLACE_WIDTH + 5, -8);
      kid_vjump (k);
      return false;
    }
    if (is_strictly_traversable (&k->hang_pos)
        && k->i >= 4) {
      place_frame (&k->f, &k->f, kid_fall_frameset[0].frame,
                   &k->hang_pos, (k->f.dir == LEFT) ? +10 : +22, +4);
      kid_fall (k);
      return false;
    }
    if (is_strictly_traversable (prel (&k->hang_pos, &np, +0, dir))
        && k->i <= 4) {
      place_frame (&k->f, &k->f, kid_fall_frameset[0].frame,
                   &k->hang_pos, (k->f.dir == LEFT)
                   ? -10 : PLACE_WIDTH + 10, +12);
      kid_fall (k);
      return false;
    }
  }

  if (k->reverse && k->i > 0) {
    if (k->i == 4  && k->j++ > 0) k->hang_limit = true;
    k->i--;
  } else if (k->reverse && k->i == 0) {
    if (k->wait == 0) {
      k->reverse = false; k->i++;
    } else k->wait--;
  } else if (! k->reverse
             && ((k->j == 0 && k->i < 12)
                 || (k->j > 0 && k->i < 9))) k->i++;
  else if (! k->reverse
           && ((k->j == 0 && k->i == 12)
               || (k->j > 0 && k->i == 9))) {
    k->reverse = true; k->i--;
  }

  k->fo.b = kid_hang_frameset[k->i].frame;
  k->fo.dx = (k->reverse) ? -kid_hang_frameset[k->i + 1].dx
    : kid_hang_frameset[k->i].dx;
  k->fo.dy = (k->reverse) ? -kid_hang_frameset[k->i + 1].dy
    : kid_hang_frameset[k->i].dy;

  if (k->f.b == kid_hang_13) k->fo.dx = +0, k->fo.dy = +1;

  if (k->reverse && k->j == 0 && k->i == 0
      && k->wait < 3) k->fo.dy = 0;

  return true;
}
Beispiel #16
0
static bool
flow (struct anim *k)
{
  if (k->oaction != kid_hang_wall)
    k->i = 3, k->wait = 0, k->reverse = false;

  bool hang_back = ((k->f.dir == LEFT) ? k->key.right : k->key.left)
    && ! k->key.up && k->key.shift;

  int back_dir = (k->f.dir == LEFT) ? RIGHT : LEFT;

  /* hang back */
  if (k->i == 4 && k->reverse
      && hang_back && is_hangable_pos (&k->hang_pos, back_dir)) {
    play_audio (&hang_on_fall_audio, NULL, k->id);
    kid_turn (k);
    return false;
  }

  if ((! k->key.shift && (k->reverse || k->i > 3))
      || k->hang_limit
      || get_hanged_con (&k->hang_pos, k->f.dir) == NO_FLOOR) {
    if (is_strictly_traversable (&k->hang_pos)) {
      place_frame (&k->f, &k->f, kid_fall_frameset[0].frame,
                   &k->hang_pos,
                   (k->f.dir == LEFT) ? +10 : +22, +4);
      kid_fall (k);
      k->hang_limit = false;
      return false;
    }
    place_frame (&k->f, &k->f, kid_vjump_frameset[13].frame,
                 &k->hang_pos, (k->f.dir == LEFT)
                 ? +12 : PLACE_WIDTH + 2, -8);
    kid_vjump (k);
    k->hang_limit = false;
    return false;
  } if (k->key.up
        && ! ((k->key.left || k->key.right)
              && k->hang_caller == kid_unclimb)
        && ! k->hang_limit) {
    kid_climb (k);
    return false;
  }

  if (! k->reverse && k->i < 6) k->i++;
  else if (! k->reverse && k->i == 6) k->reverse = true;
  else if (k->reverse && k->i > 4 && k->wait == 0)
    k->i--, k->wait = 1;
  else if (k->reverse && k->i >= 4 && k->wait > 0) k->wait--;

  k->fo.b = kid_hang_frameset[k->i].frame;
  k->fo.dx = (k->reverse) ? -kid_hang_frameset[k->i + 1].dx
    : kid_hang_frameset[k->i].dx;
  k->fo.dy = (k->reverse) ? -kid_hang_frameset[k->i + 1].dy
    : kid_hang_frameset[k->i].dy;

  if (k->f.b == kid_hang_13) k->fo.dx = +0, k->fo.dy = +1;

  if (k->reverse && k->wait == 0) {
    k->fo.dx = 0;
    k->fo.dy = 0;
  }

  return true;
}