#include "libforest/gbi_extensions.h"
#include "PR/gbi.h"
#include "evw_anime.h"
#include "c_keyframe.h"
#include "ac_npc.h"
#include "ef_effect_control.h"

u8 cKF_ckcb_r_npc_1_walk_ai1_tbl[] = { 56, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 7, 7, 6, 0, 7, 7, 0, 7, 7, 7, 7, 0, 7, 0, 0 };

s16 cKF_kn_npc_1_walk_ai1_tbl[] = { 2, 5, 2, 4, 5, 2, 4, 4, 2, 2, 6, 2, 2, 8, 2, 4, 4, 2, 2, 6, 2, 2, 7, 2, 2, 6, 5,
                                    2, 6, 5, 4, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 2 };

s16 cKF_c_npc_1_walk_ai1_tbl[] = { 0, 0,    900, 0, 0,   1800, 0,    0, 1800, 0, 900, 0, 0, 0,
                                   0, -900, 0,   0, 900, 0,    -900, 0, 0,    0, 0,   0, 0, -900 };

s16 cKF_ds_npc_1_walk_ai1_tbl[] = {
    1,  0,    0,     17, 0,    0,   1,  950,  0,     5,  1000, 0,     9,  950,  0,     13, 1000, 0,    17, 950,  0,
    1,  100,  0,     17, 100,  0,   1,  0,    199,   5,  20,   0,     13, -20,  0,     17, 0,    199,  1,  0,    0,
    5,  -85,  0,     9,  0,    0,   13, -85,  0,     17, 0,    0,     1,  0,    0,     17, 0,    0,    1,  -175, 0,
    9,  -87,  385,   13, -50,  0,   17, -175, 0,     1,  -100, 3728,  5,  250,  0,     13, -450, 0,    17, -100, 3668,
    1,  30,   0,     17, 30,   0,   1,  0,    0,     17, 0,    0,     1,  350,  0,     4,  250,  0,    9,  650,  0,
    12, 250,  -2277, 14, 200,  0,   17, 350,  0,     1,  0,    0,     17, 0,    0,     1,  0,    0,    17, 0,    0,
    1,  -235, -1994, 2,  -275, 0,   6,  -50,  0,     9,  -275, -1714, 10, -300, 0,     12, -120, 2791, 14, -25,  0,
    17, -235, -1994, 1,  0,    0,   17, 0,    0,     1,  88,   -371,  5,  50,   0,     9,  175,  0,    17, 88,   -371,
    1,  -70,  -3469, 5,  -450, 0,   13, 275,  0,     17, -70,  -3469, 1,  -30,  0,     17, -30,  0,    1,  0,    0,
    17, 0,    0,     1,  655,  0,   5,  250,  -2285, 7,  200,  0,     9,  350,  0,     12, 250,  0,    17, 650,  0,
    1,  0,    0,     17, 0,    0,   1,  0,    0,     17, 0,    0,     1,  -275, -1738, 2,  -300, 0,    4,  -120, 2927,
    6,  -25,  0,     10, -275, 0,   14, -50,  0,     17, -275, -1716, 1,  0,    0,     17, 0,    0,    1,  0,    0,
    17, 0,    0,     1,  285,  484, 2,  295,  0,     6,  245,  0,     10, 295,  0,     14, 245,  0,    17, 285,  484,
    1,  -20,  0,     5,  20,   0,   9,  -20,  0,     13, 20,   0,     17, -20,  0,     1,  0,    0,    17, 0,    0,
    1,  -15,  1926,  3,  80,   0,   7,  -100, 0,     11, 80,   0,     15, -100, 0,     17, -15,  1926, 1,  -20,  0,
    5,  20,   0,     9,  -20,  0,   13, 20,   0,     17, -20,  0,     1,  -8,   -250,  4,  -20,  0,    12, 20,   0,
    17, -8,   -250,  1,  -255, 808, 4,  -150, 0,     8,  -270, 0,     12, -150, 0,     16, -270, 0,    17, -255, 808,
    1,  0,    0,     17, 0,    0,   1,  -297, -73,   17, -297, -73,   1,  -699, -30,   17, -699, -30,  1,  0,    0,
    17, 0,    0,     1,  -57,  0,   17, -57,  0,     1,  -98,  -37,   17, -98,  -37,   1,  0,    0,    17, 0,    0,
    1,  -297, -73,   17, -297, -73, 1,  699,  31,    17, 699,  31,    1,  0,    0,     17, 0,    0,    1,  -57,  0,
    17, -57,  0,     1,  98,   37,  17, 98,   37,    1,  0,    0,     17, 0,    0,     1,  0,    0,    17, 0,    0,
    1,  0,    0,     17, 0,    0,   1,  0,    0,     17, 0,    0,     1,  155,  -453,  2,  149,  0,    6,  190,  0,
    10, 149,  0,     14, 190,  0,   17, 155,  -453,  1,  0,    0,     17, 0,    0,     1,  0,    0,    17, 0,    0,
    1,  0,    0,     17, 0,    0,   1,  0,    0,     17, 0,    0
};

static u32 feel_eff_set[] = { 10 };

static aNPC_feel_effect_c feel_eff[] = { { mNpc_FEEL_SAD, 10, ARRAY_COUNT(feel_eff_set), feel_eff_set } };

static int lfoot_se_chk_pat[] = { 1 };

static aNPC_se_data_c lfoot_se_dt[] = { { ARRAY_COUNT(lfoot_se_chk_pat), lfoot_se_chk_pat } };

static int rfoot_se_chk_pat[] = { 9 };

static aNPC_se_data_c rfoot_se_dt[] = { { ARRAY_COUNT(rfoot_se_chk_pat), rfoot_se_chk_pat } };

static aNPC_se_data_table_c se_dt_tbl[] = { { lfoot_se_dt, rfoot_se_dt, aNPC_OTHER_SE_TYPE_NONE, NULL } };

aNPC_Animation_c cKF_ba_r_npc_1_walk_ai1 = {
    { cKF_ckcb_r_npc_1_walk_ai1_tbl, cKF_ds_npc_1_walk_ai1_tbl, cKF_kn_npc_1_walk_ai1_tbl, cKF_c_npc_1_walk_ai1_tbl, -1,
      17 },
    1.0f,
    17.0f,
    cKF_FRAMECONTROL_REPEAT,
    -5.0f,
    NULL,
    aNPC_EYE_TEX0,
    4,
    NULL,
    aNPC_MOUTH_TEX0,
    3,
    -1,
    eEC_EFFECT_DOYON,
    feel_eff,
    se_dt_tbl,
};
