Пример #1
0
static bool
flow (struct anim *g)
{
  struct pos pmt;

  bool vigilant = g->key.enter;

  if (g->oaction == guard_normal
      && g->current_lives <= 0
      && anim_cycle > 0) {
    survey (_mt, pos, &g->f, NULL, &pmt, NULL);
    g->p = pmt;
    guard_die (g);
    return false;
  }

  if (g->oaction == guard_normal
      && vigilant
      && anim_cycle > 0) {
    guard_vigilant (g);
    return false;
  }

  g->fo.b = get_guard_normal_bitmap (g->type);
  g->fo.dx = g->fo.dy = +0;

  select_xframe (&g->xf, sword_frameset, 30);

  if (g->type == VIZIER) g->xf.dy += +4;
  if (g->type == SKELETON) g->xf.dx += -5, g->xf.dy += -6;

  return true;
}
Пример #2
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;
}
Пример #3
0
void
guard_resurrect (struct anim *g)
{
  struct pos pm;
  survey (_m, pos, &g->f, NULL, &pm, NULL);
  g->current_lives = g->total_lives;
  g->death_reason = NO_DEATH;
  g->action = guard_normal;
  place_frame (&g->f, &g->f, get_guard_normal_bitmap (g->type),
               &pm, g->f.dir == LEFT ? +16 : +22, +14);
  place_on_the_ground (&g->f, &g->f.c);
  reset_murder_spikes_floor (g->id);
}
Пример #4
0
void
guard_resurrect (struct anim *g)
{
  g->splash = false;
  g->invisible = false;
  if (g->current_lives > 0) return;
  struct pos pm;
  survey (_m, pos, &g->f, NULL, &pm, NULL);
  g->current_lives = g->total_lives;
  g->death_reason = NO_DEATH;
  g->action = guard_normal;
  g->glory_sample = false;
  place_frame (&g->f, &g->f, get_guard_normal_bitmap (g->type),
               &pm, g->f.dir == LEFT ? +16 : +22, +14);
  place_on_the_ground (&g->f, &g->f.c);
  if (fg (&g->p) == SPIKES_FLOOR)
    spikes_floor_at_pos (&g->p)->inactive = false;
}
Пример #5
0
void
draw_start_guards (ALLEGRO_BITMAP *bitmap, enum vm vm)
{
    int i;
    for (i = 0; i < GUARDS; i++) {
        struct guard *g = &global_level.guard[i];
        if (g->type == NO_ANIM) continue;
        struct frame f;
        f.c.room = g->p.room;
        f.b = get_guard_normal_bitmap (g->type);
        f.b = apply_guard_palette (f.b, g->type, g->style, vm);
        f.b = apply_palette (f.b, start_anim_palette);
        f.flip = (g->dir == RIGHT) ? ALLEGRO_FLIP_HORIZONTAL : 0;
        place_frame (&f, &f, f.b, &g->p,
                     g->dir == LEFT ? +16 : +22, +14);
        place_on_the_ground (&f, &f.c);
        draw_frame (bitmap, &f);
    }
}