Exemple #1
0
static bool
flow (struct anim *g)
{
  if (g->oaction != guard_walkb) g->i = -1;

  if (g->i == 1) {
    guard_vigilant (g);
    return false;
  }

  struct frameset *frameset = get_guard_walkb_frameset (g->type);
  select_frame (g, frameset, g->i + 1);

  if (g->i == 0) g->j = 10;
  if (g->i == 1) g->j = 3;

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

  if (g->j == 10) g->xf.dx = -10, g->xf.dy = +16;

  if (g->type == SKELETON) g->xf.dy += -3;
  if (g->type == SHADOW) g->xf.dy += -2;

  return true;
}
Exemple #2
0
static bool
flow (struct anim *k)
{
  if (k->oaction != kid_sword_hit) {
    k->i = -1;
    k->j = 0;
  }

  if (k->i == 4) {
    kid_sword_normal (k);
    return false;
  }

  select_frame (k, kid_sword_hit_frameset, k->i + 1);

  if (k->i == 0) k->j = 28;
  if (k->i == 1) k->j = 32;
  if (k->i == 2) k->j = 29;
  if (k->i == 3) k->j = 7;
  if (k->i == 4) k->j = 17;

  select_xframe (&k->xf, sword_frameset, k->j);

  if (k->i == 0) k->xf.dx = -12, k->xf.dy = +2;
  if (k->i == 1) k->xf.dy += -2;

  return true;
}
Exemple #3
0
void
jaffar_walk (struct anim *jaffar)
{
  jaffar->oaction = jaffar->action;
  jaffar->action = jaffar_walk;
  jaffar->f.flip = (jaffar->f.dir == RIGHT) ? ALLEGRO_FLIP_HORIZONTAL : 0;

  if (jaffar->oaction != jaffar_walk) jaffar->i = -1;

  if (jaffar->i < 5) jaffar->i++;
  else if (jaffar->repeat > 0) jaffar->i = 0, jaffar->repeat--;
  else if (jaffar->i < 7) jaffar->i++;
  else {
    jaffar_normal (jaffar);
    return;
  }

  select_frame (jaffar, walk_frameset, jaffar->i);

  if (jaffar->f.b == jaffar_normal_00) jaffar->fo.dx = -4;
  if (jaffar->f.b == turn_walk_frameset[9].frame)
    jaffar->fo.dx = +17, jaffar->fo.dy = -1,
      next_frame_inv = true;

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

  if (next_frame_inv) next_frame_inv = false;
}
Exemple #4
0
void
jaffar_turn_walk (struct anim *jaffar)
{
  jaffar->oaction = jaffar->action;
  jaffar->action = jaffar_turn_walk;

  if (jaffar->oaction != jaffar_turn_walk) {
    jaffar->f.dir = (jaffar->f.dir == RIGHT) ? LEFT : RIGHT;
    jaffar->i = -1;
  }

  jaffar->f.flip = (jaffar->f.dir == RIGHT) ? 0 : ALLEGRO_FLIP_HORIZONTAL;

  if (jaffar->i < 9) jaffar->i++;
  else {
    jaffar_walk (jaffar);
    return;
  }

  select_frame (jaffar, turn_walk_frameset, jaffar->i);

  next_frame_inv = true;
  next_frame (&jaffar->f, &jaffar->f, &jaffar->fo);
  next_frame_inv = false;
}
Exemple #5
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);
}
Exemple #6
0
static bool
flow (struct anim *g)
{
  if (g->oaction != guard_die) {
    /* place_frame (&g->f, &g->f, guard_die_frameset[0].frame, */
    /*              &g->p, (g->f.dir == LEFT) */
    /*              ? +13 : +21, (g->type == SHADOW) ? +18 : +17); */
    g->i = -1, g->j = 0;
    if (g->type == SKELETON)
      play_audio (&skeleton_audio, NULL, g->id);

    if (! g->glory_sample) {
      play_audio (&glory_audio, NULL, g->id);
      g->glory_sample = true;
    }

    g->xf.b = NULL;
  }

  g->current_lives = 0;

  g->i = g->i < 5 ? g->i + 1 : 5;

  struct frameset *frameset = get_guard_die_frameset (g->type);
  select_frame (g, frameset, g->i);

  if (g->j >= 1) g->fo.dx = g->fo.dy = 0;
  if (g->i == 5) g->j = 1;
  if (g->j == 1) g->j++;

  return true;
}
Exemple #7
0
static bool
flow (struct anim *k)
{
  if (k->oaction != kid_turn)
    k->i = -1, k->misstep = k->hang = false;

  if (! k->turn)
    k->turn = ((k->f.dir == RIGHT) && k->key.left)
      || ((k->f.dir == LEFT) && k->key.right);
  bool run = ((k->f.dir == RIGHT) ? k->key.right : k->key.left)
    && ! k->key.shift;
  bool jump = ((k->f.dir == RIGHT) && k->key.right && k->key.up)
    || ((k->f.dir == LEFT) && k->key.left && k->key.up);
  bool couch = k->key.down;

  if (k->i == 3) {
    int dc = dist_collision (&k->f, false, &k->ci);
    int df = dist_fall (&k->f, false);

    if (k->hang) kid_hang (k);
    else if (k->turn) {
      k->i = -1; k->turn = false;
      k->action = kid_normal;
      kid_turn (k);
    }
    else if (couch) kid_couch (k);
    else if (jump) kid_jump (k);
    else if (run && dc > PLACE_WIDTH && df > PLACE_WIDTH)
      kid_start_run (k);
    else kid_stabilize (k);

    return false;
  }

  if (k->f.b == kid_keep_sword_frameset[9].frame) k->i = 2;

  /* hang */
  if (k->oaction == kid_fall
      || k->oaction == kid_jump
      || k->oaction == kid_run_jump
      || k->oaction == kid_hang_free
      || k->oaction == kid_hang_wall) {
    k->i = 2, k->hang = true;
    place_frame (&k->f, &k->f, kid_turn_frameset[2].frame,
                 &k->hang_pos, (k->f.dir == LEFT)
                 ? 7 : PLACE_WIDTH, +4);
  }

  select_frame (k, kid_turn_frameset, k->i + 1);

  if (k->f.b == kid_stabilize_frameset[0].frame) k->fo.dx = +6;
  if (k->f.b == kid_stabilize_frameset[1].frame) k->fo.dx = +10;
  if (k->f.b == kid_stabilize_frameset[2].frame) k->fo.dx = +8;
  if (k->f.b == kid_stabilize_frameset[3].frame) k->fo.dx = +4;
  if (k->f.b == kid_turn_frameset[3].frame) k->fo.dx = +3;
  if (k->f.b == kid_keep_sword_frameset[9].frame) k->fo.dx = -2;

  return true;
}
Exemple #8
0
static bool
flow (struct anim *k)
{
  struct coord nc; struct pos np, pm, ptf;

  if (k->oaction != kid_jump)
    k->i = -1, k->misstep = k->hang = false;

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

  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 front */
  survey (_m, pos, &k->f, &nc, &pm, &np);
  survey (_tf, pos, &k->f, &nc, &ptf, &np);
  if (k->i >= 8 && k->i <= 10 && hang_front
      && (is_hangable_pos (&pm, k->f.dir)
          || is_hangable_pos (&ptf, k->f.dir))) {
    if (is_hangable_pos (&pm, k->f.dir)) k->hang_pos = pm;
    else if (is_hangable_pos (&ptf, k->f.dir)) k->hang_pos = ptf;
    pos2room (&k->hang_pos, k->f.c.room, &k->hang_pos);
    k->hang = true;
    play_sample (hang_on_fall_sample, k->f.c.room);
    kid_hang (k);
    return false;
  }

  /* hang back */
  survey (_tf, pos, &k->f, &nc, &ptf, &np);
  if (k->i >= 8 && k->i <= 10
      && hang_back && is_hangable_pos (&ptf, back_dir)) {
    k->hang_pos = ptf;
    pos2room (&k->hang_pos, k->f.c.room, &k->hang_pos);
    k->hang = true;
    play_sample (hang_on_fall_sample, k->f.c.room);
    kid_turn (k);
    return false;
  }

  if (k->i == 17) {
    kid_normal (k);
    return false;
  }

  select_frame (k, kid_jump_frameset, k->i + 1);

  if (k->f.b == kid_stabilize_frameset[0].frame) k->fo.dx = +2;
  if (k->f.b == kid_stabilize_frameset[1].frame) k->fo.dx = +6;
  if (k->f.b == kid_stabilize_frameset[2].frame) k->fo.dx = +4;
  if (k->f.b == kid_stabilize_frameset[3].frame) k->fo.dx = +0;

  return true;
}
Exemple #9
0
void
put_at_attack_frame (struct anim *k)
{
  k->enemy_defended_my_attack = 2;
  k->enemy_counter_attacked_myself =
    k->enemy_counter_attacked_myself ? 2 : 0;
  k->i_counter_defended = k->i_counter_defended ? 2 : 0;

  switch (k->type) {
  case NO_ANIM: default: break;
  case KID:
    if (k->i == 3) return;

    k->f = k->of;
    select_frame (k, kid_sword_attack_frameset, 0);
    next_frame (&k->f, &k->f, &k->fo);
    select_frame (k, kid_sword_attack_frameset, 1);
    next_frame (&k->f, &k->f, &k->fo);
    select_frame (k, kid_sword_attack_frameset, 2);

    k->fo.b = kid_sword_attack_defended;
    select_xframe (&k->xf, sword_frameset, 17);
    k->xf.dx = -21;
    k->xf.dy = +11;
    uncollide_back_fight (k);
    next_frame (&k->f, &k->f, &k->fo);
    break;
  case GUARD:
  case FAT_GUARD:
  case VIZIER:
  case SKELETON:
  case SHADOW:
    k->fo.b = get_guard_attack_defended_bitmap (k->type);
    k->fo.dx = +1;
    k->fo.dy = 0;

    select_xframe (&k->xf, sword_frameset, 8);
    k->xf.dx = -13;
    k->xf.dy = -14;
    uncollide_back_fight (k);
    next_frame (&k->f, &k->f, &k->fo);
    break;
  }
}
Exemple #10
0
void
put_at_defense_frame (struct anim *k)
{
  struct frameset *frameset;
  play_audio (&sword_defense_audio, NULL, k->id);

  switch (k->type) {
  case NO_ANIM: default: break;
  case KID:
    select_frame (k, kid_sword_defense_frameset, 0);
    next_frame (&k->f, &k->f, &k->fo);

    select_frame (k, kid_sword_defense_frameset, 1);

    struct anim *ke = get_anim_by_id (k->enemy_id);
    if (ke->type == KID) {
      select_xframe (&k->xf, sword_frameset, 11);
      k->xf.dx = -13;
      k->xf.dy = +5;
    } else select_xframe (&k->xf, sword_frameset, 14);

    k->action = kid_sword_defense;
    uncollide_back_fight (k);
    next_frame (&k->f, &k->f, &k->fo);
    break;
  case GUARD:
  case FAT_GUARD:
  case VIZIER:
  case SKELETON:
  case SHADOW:
    frameset = get_guard_defense_frameset (k->type);
    select_frame (k, frameset, 0);
    select_xframe (&k->xf, sword_frameset, 11);
    k->action = guard_defense;
    uncollide_back_fight (k);
    next_frame (&k->f, &k->f, &k->fo);
    break;
  }

  /* if (k->id == 0) */
  /*   printf ("%s: k->i = %i, k->fo.dx = %i\n", */
  /*           __func__, k->i, k->fo.dx); */
}
static bool
flow (struct anim *k)
{
  if (k->oaction != kid_sword_defense) k->i = -1;

  struct anim *ke = get_anim_by_id (k->enemy_id);
  if (k->i == 2) {
    kid_sword_attack (k);
    return false;
  } else if (k->i == 1 && ke && ke->attack_defended == 2
           && ke->counter_attacked != 2) {
    kid_sword_walkb (k);
    return false;
  } else if (k->i == 1 && ! (ke && ke->attack_defended == 2)) {
    kid_sword_normal (k);
    return false;
  }

  if (k->oaction == kid_sword_attack) {
    select_frame (k, kid_sword_walkb_frameset, 0);
    k->j = 10;
  } else if (k->f.b == kid_sword_walkb_frameset[0].frame) {
    select_frame (k, kid_sword_defense_frameset, 1);
    k->fo.dx += 7;
    k->j = 14;
  } else {
    select_frame (k, kid_sword_defense_frameset, k->i + 1);

    if (k->i == 0) k->j = 28;
    if (k->i == 1) k->j = 14;
    if (k->i == 2) k->j = 15;
  }

  select_xframe (&k->xf, sword_frameset, k->j);

  if (k->oaction == kid_sword_attack) k->fo.dx += +2;

  /* if (k->id == 0) */
  /*   printf ("kid_sword_defense: k->i = %i, k->fo.dx = %i\n", */
  /*           k->i, k->fo.dx); */

  return true;
}
Exemple #12
0
void
flush_cached_frames (void)
{
  /* Since we can't really be sure what the first object allocated was */
  obstack_free (&frame_cache_obstack, 0);
  obstack_init (&frame_cache_obstack);

  current_frame = NULL;		/* Invalidate cache */
  select_frame (NULL, -1);
  annotate_frames_invalid ();
}
Exemple #13
0
void
reinit_frame_cache (void)
{
  flush_cached_frames ();

  /* FIXME: The inferior_ptid test is wrong if there is a corefile.  */
  if (PIDGET (inferior_ptid) != 0)
    {
      select_frame (get_current_frame (), 0);
    }
}
Exemple #14
0
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
    AVFilterContext *ctx = inlink->dst;
    SelectContext *select = ctx->priv;

    select_frame(ctx, frame);
    if (select->select)
        return ff_filter_frame(ctx->outputs[select->select_out], frame);

    av_frame_free(&frame);
    return 0;
}
Exemple #15
0
static bool
flow (struct anim *k)
{
  if (k->oaction != kid_stabilize) {
    k->i = -1, k->misstep = false;
    if (k->oaction == kid_stabilize_collision) {
      k->i = 0; k->collision = true;
    } else k->collision = false;
    if (k->oaction == kid_turn) k->collision = true;
  }

  if (! k->turn)
    k->turn = ((k->f.dir == RIGHT) && k->key.left)
      || ((k->f.dir == LEFT) && k->key.right);
  bool run = (((k->f.dir == RIGHT) && k->key.right)
              || ((k->f.dir == LEFT) && k->key.left))
    && ! k->key.shift;
  bool jump = ((k->f.dir == RIGHT) && k->key.right && k->key.up)
    || ((k->f.dir == LEFT) && k->key.left && k->key.up);
  bool couch = k->key.down;

  int dc = dist_collision (&k->f, false, &k->ci);
  int df = dist_fall (&k->f, false);

  if (k->i >= 0 && ! k->collision) {
    if (couch) {
      kid_couch (k);
      return false;
    } else if (jump) {
      kid_jump (k);
      return false;
    } else if (k->turn) {
      kid_turn (k);
      k->turn = false;
      return false;
    } else if (run && dc > PLACE_WIDTH && df > PLACE_WIDTH) {
      kid_start_run (k);
      return false;
    }
  }

  if (k->i == 3) {
    kid_normal (k);
    k->turn = false;
    return false;
  }

  select_frame (k, kid_stabilize_frameset, k->i + 1);

  if (k->f.b == kid_stop_run_frameset[3].frame) k->fo.dx = -5;

  return true;
}
Exemple #16
0
static bool
flow (struct anim *k)
{
  if (k->oaction != kid_turn_run) k->i = -1;

  if (k->i == 8) {
    kid_run (k);
    return false;
  }

  select_frame (k, kid_turn_run_frameset, k->i + 1);
  return true;
}
Exemple #17
0
/* Generic prepare_to_proceed().  This one should be suitable for most
   targets that support threads. */
int
generic_prepare_to_proceed (int select_it)
{
  ptid_t wait_ptid;
  struct target_waitstatus wait_status;

  /* Get the last target status returned by target_wait().  */
  get_last_target_status (&wait_ptid, &wait_status);

  /* Make sure we were stopped either at a breakpoint, or because
     of a Ctrl-C.  */
  if (wait_status.kind != TARGET_WAITKIND_STOPPED
      || (wait_status.value.sig != TARGET_SIGNAL_TRAP &&
          wait_status.value.sig != TARGET_SIGNAL_INT))
    {
      return 0;
    }

  if (!ptid_equal (wait_ptid, minus_one_ptid)
      && !ptid_equal (inferior_ptid, wait_ptid))
    {
      /* Switched over from WAIT_PID.  */
      CORE_ADDR wait_pc = read_pc_pid (wait_ptid);

      if (wait_pc != read_pc ())
	{
	  if (select_it)
	    {
	      /* Switch back to WAIT_PID thread.  */
	      inferior_ptid = wait_ptid;

	      /* FIXME: This stuff came from switch_to_thread() in
		 thread.c (which should probably be a public function).  */
	      flush_cached_frames ();
	      registers_changed ();
	      stop_pc = wait_pc;
	      select_frame (get_current_frame ());
	    }
          /* We return 1 to indicate that there is a breakpoint here,
             so we need to step over it before continuing to avoid
             hitting it straight away. */
          if (breakpoint_here_p (wait_pc))
            {
	      return 1;
            }
	}
    }
  return 0;
  
}
Exemple #18
0
void
jaffar_raise_arms (struct anim *jaffar)
{
  jaffar->oaction = jaffar->action;
  jaffar->action = jaffar_raise_arms;
  jaffar->f.flip = (jaffar->f.dir == RIGHT) ? ALLEGRO_FLIP_HORIZONTAL : 0;

  if (jaffar->oaction != jaffar_raise_arms) jaffar->i = -1;

  if (jaffar->i < 10) jaffar->i++;

  select_frame (jaffar, raise_arms_frameset, jaffar->i);

  next_frame (&jaffar->f, &jaffar->f, &jaffar->fo);
}
Exemple #19
0
static bool
flow (struct anim *k)
{
  if (k->oaction != kid_misstep) k->i = -1, k->misstep = true;

  if (k->i == 10) {
    place_frame (&k->f, &k->f, kid_normal_00, &k->p,
                 (k->f.dir == LEFT) ? +11 : PLACE_WIDTH + 7, 15);
    kid_normal (k);
    return false;
  }

  select_frame (k, kid_misstep_frameset, k->i + 1);

  return true;
}
Exemple #20
0
//
// Open a frame
//
void open_frame()
{
	char			szFile[MAX_PATH], szFileTitle[MAX_PATH], szName[MAX_PATH], framenum[MAX_PATH];
	int				name_start, name_end;

	// Select frame to open
	if (select_frame(szFile, szFileTitle, &name_start, &name_end))
	{
		// Extract name and path
		memcpy(szName, szFile+name_start, name_end-name_start-1); 
		szName[name_end-name_start-1] = '\0';
		
		memcpy(cur_working_path, szFile, name_start);  // save in global var for future use
		cur_working_path[name_start] = '\0';

		// Verifying correct format of name, e.g. "frame000000.htm".
		// Renamed frames cause a crash
		// http://www.maxinmontreal.com/forums/viewtopic.php?f=156&t=12960
		// ".htm" got already truncated at the end...
		CString name_to_verify = szName;
		if ((name_to_verify.GetLength() != 11)
			|| (name_to_verify.Left(5) != "frame"))
		{
			MessageBox(0, "Incorrect filename.\n"
				"Replay-frames have to be named like \"frame012345.htm\".\n"
				"\n"
				"Ignoring this frame.\n",
				"Error", 0);
			return;
		}
		// Extract frame number
		// 11 bytzes to extract after "frame": 
		// 6 digits, 4 for ".htm" and 1 for NULL.
		const int number_of_bytes_after_frame_prefix = 11; 
		sprintf_s(framenum, number_of_bytes_after_frame_prefix, 
			"%s", szName+5);
		// Truncating ".htm".
		framenum[6] = '\0';

		cur_frame = atoi(framenum);

		// draw the frame
		draw_cur_frame();
	}
}
Exemple #21
0
void
jaffar_open_arms (struct anim *jaffar)
{
  jaffar->oaction = jaffar->action;
  jaffar->action = jaffar_open_arms;
  jaffar->f.flip = (jaffar->f.dir == RIGHT) ? ALLEGRO_FLIP_HORIZONTAL : 0;

  if (jaffar->oaction != jaffar_open_arms) jaffar->i = -1;

  if (jaffar->i < 1) jaffar->i++;

  select_frame (jaffar, open_arms_frameset, jaffar->i);

  if (jaffar->i == 1 && jaffar->f.b == open_arms_frameset[0].frame)
    jaffar->fo.dx = -5;

  next_frame (&jaffar->f, &jaffar->f, &jaffar->fo);
}
static bool
flow (struct anim *k)
{
  if (k->oaction != kid_sword_walkf) k->i = -1;

  if (k->i == 1) {
    kid_sword_normal (k);
    return false;
  }

  select_frame (k, kid_sword_walkf_frameset, k->i + 1);
  select_xframe (&k->xf, sword_frameset, 13);

  if (k->i == 0) k->xf.dx = -19;
  if (k->i == 1) k->xf.dx = -21;

  return true;
}
Exemple #23
0
void
jaffar_lower_arms (struct anim *jaffar)
{
  jaffar->oaction = jaffar->action;
  jaffar->action = jaffar_lower_arms;
  jaffar->f.flip = (jaffar->f.dir == RIGHT) ? ALLEGRO_FLIP_HORIZONTAL : 0;

  if (jaffar->oaction != jaffar_lower_arms) jaffar->i = -1;

  if (jaffar->i < 5) jaffar->i++;
  else {
    jaffar_normal (jaffar);
    return;
  }

  select_frame (jaffar, lower_arms_frameset, jaffar->i);

  next_frame (&jaffar->f, &jaffar->f, &jaffar->fo);
}
Exemple #24
0
static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
{
    SelectContext *select = inlink->dst->priv;

    select->select = select_frame(inlink->dst, picref);
    if (select->select) {
        /* frame was requested through poll_frame */
        if (select->cache_frames) {
            if (!av_fifo_space(select->pending_frames))
                av_log(inlink->dst, AV_LOG_ERROR,
                       "Buffering limit reached, cannot cache more frames\n");
            else
                av_fifo_generic_write(select->pending_frames, &picref,
                                      sizeof(picref), NULL);
            return;
        }
        avfilter_start_frame(inlink->dst->outputs[0], avfilter_ref_buffer(picref, ~0));
    }
}
Exemple #25
0
static bool
flow (struct anim *k)
{
  if (k->oaction != kid_start_run) k->i = -1, k->misstep = false;

  bool run = (k->f.dir == RIGHT) ? k->key.right : k->key.left;
  bool turn_run = (k->f.dir == RIGHT) ? k->key.left : k->key.right;
  bool couch = k->key.down;
  bool jump = ((k->f.dir == RIGHT) && k->key.right && k->key.up)
    || ((k->f.dir == LEFT) && k->key.left && k->key.up);

  if (couch) {
    kid_couch (k);
    return false;
  }

  if (jump && k->i < 3) {
    kid_jump (k);
    return false;
  }

  if ((k->i == 3 || k->i == 4) && turn_run) {
    kid_stop_run (k);
    return false;
  }

  if (k->i == 5) {
    if (run) kid_run (k);
    else kid_stop_run (k);
    return false;
  }

  select_frame (k, kid_start_run_frameset, k->i + 1);

  if (k->f.b == kid_turn_frameset[3].frame) k->fo.dx = +0;
  if (k->f.b == kid_stabilize_frameset[0].frame) k->fo.dx = +2;
  if (k->f.b == kid_stabilize_frameset[1].frame) k->fo.dx = +6;
  if (k->f.b == kid_stabilize_frameset[2].frame) k->fo.dx = +4;
  if (k->f.b == kid_stabilize_frameset[3].frame) k->fo.dx = +0;

  return true;
}
Exemple #26
0
static bool
flow (struct anim *k)
{
  if (k->oaction != kid_sword_walkb) k->i = -1;

  if (k->i == 1) {
    kid_sword_normal (k);
    return false;
  }

  if (k->i == -1) k->j = 10;
  if (k->i == 0) k->j = 17;

  if (k->f.b == kid_sword_attack_frameset[5].frame) k->i = 0;

  select_frame (k, kid_sword_walkb_frameset, k->i + 1);
  select_xframe (&k->xf, sword_frameset, k->j);

  return true;
}
Exemple #27
0
static bool
flow (struct anim *g)
{
  if (g->oaction != guard_die) {
    place_frame (&g->f, &g->f, guard_die_frameset[0].frame,
                 &g->p, (g->f.dir == LEFT)
                 ? +13 : +21, (g->type == SHADOW) ? +18 : +17);
    g->i = -1, g->j = 0;
    if (g->type == SKELETON)
      play_sample (skeleton_sample, NULL, g->id);

    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->xf.b = NULL;
  }

  g->current_lives = 0;

  g->i = g->i < 5 ? g->i + 1 : 5;

  struct frameset *frameset = get_guard_die_frameset (g->type);
  select_frame (g, frameset, g->i);

  if (g->j >= 1) g->fo.dx = g->fo.dy = 0;
  if (g->i == 5) g->j = 1;
  if (g->j == 1) g->j++;

  return true;
}
Exemple #28
0
static bool
flow (struct anim *k)
{
  if (k->oaction != kid_keep_sword) k->i = -1, k->wait = 1;

  if (k->i < 8) k->i++;
  else if (k->i == 8 && k->wait > 0) k->wait--;
  else if (k->i == 8 && k->wait == 0) k->i++, k->wait = 2;
  else if (k->i == 9 && k->wait > 0) k->wait--;
  else {
    if (k->keep_sword_fast) {
      kid_normal (k);
      k->keep_sword_fast = false;
      return false;
    } else {
      /* kid turn will invert kid's direction */
      k->f.dir = (k->f.dir == RIGHT) ? LEFT : RIGHT;
      kid_turn (k);
      return false;
    }
  }

  if (k->keep_sword_fast && k->i % 2 == 0) k->i++, k->wait = 0;

  k->j = 24 + k->i;

  select_frame (k, kid_keep_sword_frameset, k->i);
  if (k->i < 4)
    select_xframe (&k->xf, sword_frameset, k->j);

  if (k->i == 8 && k->wait < 1) k->fo.dx = 0;
  if (k->i == 9 && k->wait < 2) k->fo.dx = 0;
  if (k->keep_sword_fast && k->i % 2)
    k->fo.dx += kid_keep_sword_frameset[k->i - 1].dx;
  if (k->f.b == kid_sword_normal_00) k->fo.dx = +8;

  return true;
}
Exemple #29
0
static bool
flow (struct anim *g)
{
  if (g->oaction != guard_defense) g->i = -1;

  struct anim *ke = get_anim_by_id (g->enemy_id);
  if (g->i == 1) {
    guard_attack (g);
    return false;
  } else if (g->i == 0 && ke && ke->attack_defended == 2
           && ke->counter_attacked != 2) {
    guard_walkb (g);
    return false;
  } else if (g->i == 0 && ! (ke && ke->attack_defended == 2)) {
    guard_vigilant (g);
    return false;
  }

  struct frameset *frameset = get_guard_defense_frameset (g->type);
  select_frame (g, frameset, g->i + 1);

  if (g->i == 0) g->j = 11;

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

  if (g->i == 1) g->xf.b = NULL;

  if (g->oaction == guard_attack) g->fo.dx += +2;

  if (g->type == SKELETON) g->xf.dy += -3;
  if (g->type == SHADOW) g->xf.dy += -2;

  /* if (g->id == 0) */
  /*   printf ("guard_defense: g->i = %i, g->fo.dx = %i\n", */
  /*           g->i, g->fo.dx); */

  return true;
}
Exemple #30
0
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
    SelectContext *select = inlink->dst->priv;

    select->select = select_frame(inlink->dst, frame);
    if (select->select) {
        /* frame was requested through poll_frame */
        if (select->cache_frames) {
            if (!av_fifo_space(select->pending_frames)) {
                av_log(inlink->dst, AV_LOG_ERROR,
                       "Buffering limit reached, cannot cache more frames\n");
                av_frame_free(&frame);
            } else
                av_fifo_generic_write(select->pending_frames, &frame,
                                      sizeof(frame), NULL);
            return 0;
        }
        return ff_filter_frame(inlink->dst->outputs[0], frame);
    }

    av_frame_free(&frame);
    return 0;
}