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; }
static bool flow (struct anim *k) { struct pos pmt; bool keep_sword = k->key.down; bool defense = k->key.up && ! k->key.shift && ! k->key.left && ! k->key.right; bool attack = k->key.shift && ! k->key.up && ! k->key.left && ! k->key.right; bool walkf = ((k->f.dir == RIGHT) && k->key.right) || ((k->f.dir == LEFT) && k->key.left); bool walkb = ((k->f.dir == RIGHT) && k->key.left) || ((k->f.dir == LEFT) && k->key.right); struct anim *ke = get_anim_by_id (k->enemy_id); k->keep_sword_fast = (k->enemy_id != -1 && ke->current_lives > 0 && ! is_anim_fall (&ke->f)); if (k->oaction != kid_sword_normal) k->i = -1; if (k->oaction == kid_sword_normal && k->current_lives <= 0) { survey (_mt, pos, &k->f, NULL, &pmt, NULL); k->p = pmt; kid_die (k); return false; } if (k->oaction == kid_sword_normal) { if (keep_sword) { /* keep_sword_fast = true; */ kid_keep_sword (k); return false; } if (defense) { kid_sword_defense (k); return false; } if (attack) { kid_sword_attack (k); return false; } if (walkf) { kid_sword_walkf (k); return false; } if (walkb) { kid_sword_walkb (k); return false; } } k->fo.b = kid_sword_normal_00; k->fo.dx = k->fo.dy = +0; select_xframe (&k->xf, sword_frameset, 13); if (k->f.b == kid_take_sword_frameset[3].frame) k->fo.dx = -4; if (k->f.b == kid_sword_walkf_frameset[1].frame) k->fo.dx = +5; if (k->f.b == kid_sword_walkb_frameset[1].frame) k->fo.dx = +2; k->i++; return true; }