static bool flow (struct anim *k) { struct pos hanged_pos; if (k->oaction != kid_unclimb) k->i = 14; if (k->oaction == kid_climb) k->i = 3; if (k->i == 0) { kid_hang (k); return false; } if (k->i == 14) { get_hanged_pos (&k->hang_pos, k->f.dir, &hanged_pos); place_frame (&k->f, &k->f, kid_climb_frameset[13].frame, &hanged_pos, 18, 25); } k->i--; k->fo.b = kid_climb_frameset[k->i].frame; k->fo.dx = -kid_climb_frameset[k->i + 1].dx; k->fo.dy = -kid_climb_frameset[k->i + 1].dy; if (k->oaction == kid_climb) k->fo.dx += +2; if (k->i == 1) k->fo.dx += -3; return true; }
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; }
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; }