#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_flyaway1_tbl[] = { 56, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 7, 7, 0, 7, 7, 7, 7, 0, 2, 0, 0 };

s16 cKF_kn_npc_1_flyaway1_tbl[] = { 2, 5, 6,  8, 12, 7,  6, 7, 5,  2, 6, 2, 2, 8,  2, 6, 7,  5,
                                    2, 6, 2,  2, 8,  2,  2, 2, 2,  2, 2, 2, 8, 12, 7, 3, 11, 20,
                                    2, 2, 12, 3, 11, 20, 2, 2, 12, 2, 2, 2, 2, 12, 2, 4 };

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

s16 cKF_ds_npc_1_flyaway1_tbl[] = {
    1,  0,    0,     49, 0,    0,     1,  1000, 0,    8,  700,  0,     9,  1000, 16588, 10, 1000, 0,
    49, 1000, 0,     1,  0,    0,     4,  0,    0,    6,  -100, -1610, 8,  -150, 0,     11, 0,    0,
    49, 0,    0,     1,  0,    0,     13, 0,    0,    17, 0,    -737,  21, -100, 0,     29, 80,   0,
    37, -80,  0,     45, 60,   0,     49, 0,    -429, 1,  0,    0,     6,  0,    0,     11, -50,  0,
    17, 260,  0,     21, 150,  0,     25, 140,  0,    29, 30,   0,     33, 20,   0,     37, -90,  0,
    41, -100, 0,     45, -210, 0,     49, -220, 0,    1,  0,    0,     11, 0,    0,     17, -150, 0,
    25, 150,  0,     33, -110, 0,     41, 110,  0,    49, -70,  0,     1,  -175, 0,     4,  -130, 0,
    8,  -150, 0,     11, -150, 0,     17, -100, 0,    49, -100, 0,     1,  -100, 0,     8,  -550, 0,
    11, -150, 1870,  17, -290, -334,  25, -350, 0,    37, -230, 535,   49, 100,  0,     1,  25,   0,
    8,  140,  0,     11, 50,   0,     17, 100,  0,    49, 100,  0,     1,  0,    0,     49, 0,    0,
    1,  200,  0,     4,  700,  4508,  8,  950,  0,    11, 200,  -634,  17, 150,  0,     49, 250,  0,
    1,  0,    0,     49, 0,    0,     1,  0,    0,    49, 0,    0,     1,  -100, 0,     4,  -390, -831,
    6,  -420, 0,     8,  -400, 758,   11, 400,  0,    17, -20,  -509,  29, -110, 0,     49, 200,  0,
    1,  0,    0,     49, 0,    0,     1,  175,  0,    4,  130,  0,     8,  150,  0,     11, 150,  0,
    17, 100,  0,     49, 100,  0,     1,  -100, 0,    8,  -550, 0,     11, -150, 1862,  17, -290, -324,
    25, -350, 0,     37, -230, 535,   49, 100,  0,    1,  -25,  0,     8,  -140, 0,     11, -50,  0,
    17, -100, 0,     49, -100, 0,     1,  0,    0,    49, 0,    0,     1,  200,  0,     4,  700,  4506,
    8,  950,  0,     11, 200,  -623,  17, 150,  0,    49, 250,  0,     1,  0,    0,     49, 0,    0,
    1,  0,    0,     49, 0,    0,     1,  -100, 0,    4,  -390, -833,  6,  -420, 0,     8,  -400, 755,
    11, 400,  0,     17, -20,  -512,  29, -110, 0,    49, 200,  0,     1,  0,    0,     49, 0,    0,
    1,  0,    0,     49, 0,    0,     1,  60,   0,    49, 60,   0,     1,  0,    0,     49, 0,    0,
    1,  0,    0,     49, 0,    0,     1,  82,   1348, 49, 82,   1348,  1,  0,    0,     49, 0,    0,
    1,  0,    0,     13, 0,    0,     17, 0,    777,  21, 100,  0,     29, -100, 0,     37, 80,   0,
    45, -80,  0,     49, 0,    480,   1,  2,    -78,  7,  -100, 0,     11, 100,  0,     17, -510, 0,
    21, -360, 0,     25, -400, 0,     29, -240, 0,    33, -280, 0,     37, -120, 0,     41, -160, 0,
    45, 0,    0,     49, -40,  0,     1,  0,    0,    11, 0,    0,     17, 130,  0,     25, -130, 0,
    33, 90,   0,     41, -90,  0,     49, 50,   0,    1,  0,    0,     17, -100, 0,     49, -100, 0,
    1,  58,   0,     12, 0,    -486,  17, -100, 0,    21, 100,  0,     25, -100, 0,     29, 100,  0,
    33, -100, 0,     37, 100,  0,     41, -100, 0,    45, 100,  0,     49, -100, 0,     1,  -564, 240,
    12, 300,  0,     15, -50,  -7497, 17, -600, 0,    19, -300, 6843,  21, 300,  0,     23, -50,  -7497,
    25, -600, 0,     27, -300, 6843,  29, 300,  0,    31, -50,  -7497, 33, -600, 0,     35, -300, 6843,
    37, 300,  0,     39, -50,  -7497, 41, -600, 0,    43, -300, 6843,  45, 300,  0,     47, -50,  -7497,
    49, -600, 0,     1,  0,    0,     49, 0,    0,    1,  -57,  0,     49, -57,  0,     1,  0,    0,
    7,  -350, 0,     14, 600,  0,     19, -300, 0,    22, 600,  0,     27, -300, 0,     30, 600,  0,
    35, -300, 0,     38, 600,  0,     43, -300, 0,    46, 600,  0,     49, 0,    -7771, 1,  0,    0,
    17, 100,  0,     49, 100,  0,     1,  58,   0,    12, 0,    -486,  17, -100, 0,     21, 100,  0,
    25, -100, 0,     29, 100,  0,     33, -100, 0,    37, 100,  0,     41, -100, 0,     45, 100,  0,
    49, -100, 0,     1,  564,  -272,  12, -300, 0,    15, 50,   6314,  17, 600,  0,     19, 300,  -7363,
    21, -300, 0,     23, 50,   6314,  25, 600,  0,    27, 300,  -7363, 29, -300, 0,     31, 50,   6314,
    33, 600,  0,     35, 300,  -7363, 37, -300, 0,    39, 50,   6314,  41, 600,  0,     43, 300,  -7363,
    45, -300, 0,     47, 50,   6314,  49, 600,  0,    1,  0,    0,     49, 0,    0,     1,  -57,  0,
    49, -57,  0,     1,  0,    0,     7,  350,  0,    14, -600, 0,     19, 300,  0,     22, -600, 0,
    27, 300,  0,     30, -600, 0,     35, 300,  0,    38, -600, 0,     43, 300,  0,     46, -600, 0,
    49, 0,    6004,  1,  0,    0,     49, 0,    0,    1,  0,    0,     49, 0,    0,     1,  0,    0,
    49, 0,    0,     1,  0,    0,     49, 0,    0,    1,  0,    0,     6,  -150, 0,     11, 100,  0,
    17, -100, 0,     21, -30,  0,     25, -60,  0,    29, 10,   0,     33, -20,  0,     37, 50,   0,
    41, 20,   0,     45, 90,   0,     49, 60,   0,    1,  0,    0,     49, 0,    0,     1,  0,    0,
    6,  -100, -1802, 11, -450, 0,     17, 0,    0
};

static int other_se_chk_pat[] = { 13, 22, 30, 38, 46 };

static aNPC_other_se_data_c other_se_dt[] = { { { ARRAY_COUNT(other_se_chk_pat), other_se_chk_pat }, 290 } };

static aNPC_se_data_table_c se_dt_tbl[] = { { NULL, NULL, aNPC_OTHER_SE_TYPE1, other_se_dt } };

aNPC_Animation_c cKF_ba_r_npc_1_flyaway1 = {
    { cKF_ckcb_r_npc_1_flyaway1_tbl, cKF_ds_npc_1_flyaway1_tbl, cKF_kn_npc_1_flyaway1_tbl, cKF_c_npc_1_flyaway1_tbl, -1,
      49 },
    1.0f,
    49.0f,
    cKF_FRAMECONTROL_STOP,
    -5.0f,
    NULL,
    aNPC_EYE_TEX1,
    -1,
    NULL,
    aNPC_MOUTH_TEX0,
    0,
    -1,
    -1,
    NULL,
    se_dt_tbl,
};
