示例#1
0
void
mouse_run (struct anim *m)
{
  m->oaction = m->action;
  m->action = mouse_run;
  m->f.flip = (m->f.dir == LEFT) ? 0 : ALLEGRO_FLIP_HORIZONTAL;

  m->dc = dist_collision (&m->f, false, &m->ci) + 4;
  m->df = dist_fall (&m->f, false);
  m->dl = dist_con (&m->f, _bf, pos, -4, false, LOOSE_FLOOR);

  if (is_colliding (&m->f, &m->fo, m->dc, false, &m->ci)
      && m->ci.t == DOOR)
    m->dc = PLACE_WIDTH + 1;
  if (! cutscene && (m->dc < 12 || m->df < 12 || m->dl < 12)) {
    mouse_normal (m);
    return;
  }

  if (m->oaction != mouse_run) m->i = -1;

  if (m->i == 1) m->i = 0;
  else m->i++;

  select_frame (m, run_frameset, m->i);

  if (m->oaction == mouse_normal) m->fo.dy = -2;

  next_frame (&m->f, &m->f, &m->fo);

  if (m->i == 0) update_depressible_floor (m, -1, -9);
  else if (m->i == 1) update_depressible_floor (m, -2, -11);
}
示例#2
0
static void
physics_out (struct anim *g)
{
  /* depressible floors */
  if (g->i == 0) update_depressible_floor (g, 0, -34);
  else if (g->i == 1) update_depressible_floor (g, -1, -27);
  else keep_depressible_floor (g);
}
示例#3
0
static void
physics_out (struct anim *k)
{
  /* depressible floors */
  if (k->i == 3) update_depressible_floor (k, -4, -33);
  else if (k->i == 4) update_depressible_floor (k, -1, -24);
  else keep_depressible_floor (k);
}
示例#4
0
static void
physics_out (struct anim *g)
{
  /* sound */
  if (g->i == 4) play_audio (&sword_attack_audio, NULL, g->id);

  /* depressible floors */
  if (g->i == 3) update_depressible_floor (g, -4, -41);
  else if (g->i == 4) update_depressible_floor (g, -9, -48);
  else if (g->i == 6) update_depressible_floor (g, -3, -33);
  else if (g->i == 7) update_depressible_floor (g, -1, -24);
  else keep_depressible_floor (g);
}
示例#5
0
static void
physics_out (struct anim *k)
{
  /* depressible floors */
  if (k->i == 2) update_depressible_floor (k, -7, -13);
  else if (k->i == 5) update_depressible_floor (k, -5, -30);
  else if (k->i == 6) update_depressible_floor (k, -4, -11);
  else keep_depressible_floor (k);

  /* sound */
  if (k->oaction == kid_run_jump)
    play_sample (step_sample, k->f.c.room);
  if (k->i == 2 || k->i == 6)
    play_sample (step_sample, k->f.c.room);
}
示例#6
0
struct anim *
create_guard (struct anim *g0, struct anim *g1, struct pos *p, enum dir dir)
{
    if (! g0) {
        g1->f.b = get_guard_normal_bitmap (g1->type);
        g1->fo.b = g1->f.b;
        g1->action = guard_normal;
        g1->total_lives = 3;
        g1->current_lives = 3;
        g1->enemy_id = -1;
        g1->oenemy_id = -1;
        g1->fight = true;
        g1->has_sword = true;
        g1->skill.counter_attack_prob = -1;
        g1->skill.counter_defense_prob = -1;
        g1->glory_sample = false;

        if (g1->type == SHADOW) g1->shadow = true;

        place_frame (&g1->f, &g1->f, g1->f.b, p,
                     g1->f.dir == LEFT ? +16 : +22, +14);
        place_on_the_ground (&g1->f, &g1->f.c);

        update_depressible_floor (g1, -7, -26);
    }

    return g1;
}
示例#7
0
void
mouse_normal (struct anim *m)
{
  m->oaction = m->action;
  m->action = mouse_normal;
  m->f.flip = (m->f.dir == LEFT) ? 0 : ALLEGRO_FLIP_HORIZONTAL;

  if (m->oaction != mouse_normal) m->i = 0;

  if (m->i == 12) {
    m->f.dir = (m->f.dir == LEFT) ? RIGHT : LEFT;
    mouse_run (m);
    return;
  }

  m->fo.b = mouse_normal_00;
  m->fo.dx = m->fo.dy = +0;

  if (m->oaction == mouse_run) m->fo.dy = +2;

  next_frame (&m->f, &m->f, &m->fo);

  update_depressible_floor (m, -2, -5);

  m->i++;
}
示例#8
0
static void
physics_out (struct anim *k)
{
  /* depressible floors */
  if (k->i == 5) update_depressible_floor (k, -16, -19);
  else keep_depressible_floor (k);
}
示例#9
0
static void
physics_out (struct anim *k)
{
  /* depressible floors */
  if (k->collision && k->i == 1)
    update_depressible_floor (k, -13, -18);
  else keep_depressible_floor (k);
}
示例#10
0
static void
physics_out (struct anim *k)
{
  /* depressible floors */
  if (k->f.b == kid_take_sword_frameset[3].frame)
    update_depressible_floor (k, -2, -27);
  else keep_depressible_floor (k);
}
示例#11
0
static void
physics_out (struct anim *k)
{
  struct pos pmbo;

  /* depressible floors */
  if (k->i == 8) clear_depressible_floor (k);
  else if (k->i == 11) update_depressible_floor (k, -11, -15);
  else if (k->i == 14) update_depressible_floor (k, 0, -6);
  else keep_depressible_floor (k);

  /* loose floor shaking */
  survey (_mbo, pos, &k->f, NULL, &pmbo, NULL);
  if (k->i == 12) shake_loose_floor_row (&pmbo);

  /* sound */
  if (k->i == 11 || k->i == 14) play_sample (step_sample, NULL, k->id);
}
示例#12
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);
}
示例#13
0
static void
physics_out (struct anim *g)
{
  /* depressible floors */
  if (g->i == 0) update_depressible_floor (g, -6, -12);
  else if (g->i == 1) update_depressible_floor (g, -5, -12);
  else if (g->i == 2) update_depressible_floor (g, -4, -13);
  else if (g->i == 3) update_depressible_floor (g, -2, -18);
  else if (g->i == 4) update_depressible_floor (g, 0, -27);
  else if (g->i == 5) update_depressible_floor (g, -12, -28);
  else keep_depressible_floor (g);
}
示例#14
0
static void
physics_out (struct anim *k)
{
  /* depressible floors */
  if (k->i == 0) update_depressible_floor (k, -4, -27);
  else if (k->i == 1) update_depressible_floor (k, -9, -28);
  else if (k->i == 2) update_depressible_floor (k, -11, -29);
  else if (k->i == 3) update_depressible_floor (k, -6, -27);
  else if (k->i == 4) update_depressible_floor (k, -10, -31);
  else if (k->i == 5) update_depressible_floor (k, -17, -29);
  else keep_depressible_floor (k);
}
示例#15
0
static void
physics_out (struct anim *k)
{
  /* depressible floors */
  if (k->i == 0) update_depressible_floor (k, -7, -9);
  else if (k->i == 2) update_depressible_floor (k, -1, -13);
  else if (k->i == 5) update_depressible_floor (k, -19, -20);
  else if (k->i == 7) update_depressible_floor (k, -12, -22);
  else if (k->i == 8) update_depressible_floor (k, -9, -10);
  else if (k->i == 11) update_depressible_floor (k, -6, -12);
  else keep_depressible_floor (k);
}
示例#16
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);
}
示例#17
0
static void
physics_out (struct anim *g)
{
  /* depressible floors */
  update_depressible_floor (g, -7, -26);
}