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

Vtx hnw_v[] = {
#include "assets/hnw_v.inc"
};

Gfx head_hnw_model[] = {
    gsSPMatrix(anime_6_mdl, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW),
    gsSPTexture(0, 0, 0, G_TX_RENDERTILE, G_ON),
    gsSPVertex(hnw_v, 12, 0),
    gsSPMatrix(&anime_6_mdl[1], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW),
    gsSPTexture(0, 0, 0, G_TX_RENDERTILE, G_ON),
    gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2),
    gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, TEXEL0, PRIMITIVE, 0, COMBINED, 0, 0, 0, 0, COMBINED),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 32, anime_4_txt + 0x80),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsDPSetPrimColor(0, 128, 255, 255, 255, 255),
    gsSPVertex(&hnw_v[12], 18, 12),
    gsSPNTrianglesInit_5b(2, 3, 1, 12, 3, 13, 14, 0, 0, 0),
    gsSPNTrianglesInit_5b(2, 2, 15, 16, 4, 2, 17, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 32, anime_4_txt + 0x180),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(2, 7, 18, 19, 0, 7, 20, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 32, anime_4_txt + 0x280),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(2, 6, 21, 22, 6, 10, 23, 0, 0, 0),
    gsSPNTrianglesInit_5b(2, 8, 24, 25, 11, 8, 26, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 32, anime_4_txt + 0x180),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(2, 9, 27, 28, 9, 5, 29, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPVertex(&hnw_v[30], 31, 0),
    gsSPNTrianglesInit_5b(12, 0, 1, 2, 3, 1, 4, 5, 1, 3),
    gsSPNTriangles_5b(1, 5, 2, 3, 6, 7, 2, 5, 7, 2, 8, 9),
    gsSPNTriangles_5b(10, 6, 3, 7, 8, 2, 7, 5, 3, 2, 9, 0),
    gsSPNTriangles_5b(0, 10, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 32, anime_4_txt + 0x80),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(2, 11, 12, 13, 13, 14, 11, 0, 0, 0),
    gsSPNTrianglesInit_5b(2, 15, 16, 17, 17, 18, 15, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 32, anime_4_txt + 0x180),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(2, 19, 20, 21, 21, 22, 19, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 32, anime_4_txt + 0x280),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(2, 23, 24, 25, 25, 26, 23, 0, 0, 0),
    gsSPNTrianglesInit_5b(2, 27, 28, 29, 29, 30, 27, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 32, anime_4_txt + 0x180),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPVertex(&hnw_v[61], 31, 0),
    gsSPNTrianglesInit_5b(2, 0, 1, 2, 2, 3, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 32, anime_4_txt + 0x280),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(12, 4, 5, 6, 7, 8, 6, 7, 9, 10),
    gsSPNTriangles_5b(11, 12, 13, 11, 14, 15, 4, 16, 17, 10, 9, 18),
    gsSPNTriangles_5b(17, 12, 11, 17, 19, 4, 6, 20, 7, 10, 21, 22),
    gsSPNTriangles_5b(6, 23, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x380),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(5, 24, 25, 26, 27, 26, 25, 25, 28, 27),
    gsSPNTriangles_5b(27, 28, 29, 26, 30, 24, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x400),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPVertex(&hnw_v[92], 28, 0),
    gsSPNTrianglesInit_5b(5, 0, 1, 2, 2, 3, 0, 2, 1, 4),
    gsSPNTriangles_5b(4, 5, 2, 6, 0, 3, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x380),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(4, 7, 8, 9, 10, 11, 9, 9, 12, 10),
    gsSPNTriangles_5b(9, 11, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsSPNTrianglesInit_5b(4, 13, 14, 15, 15, 16, 13, 15, 14, 17),
    gsSPNTriangles_5b(17, 18, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x400),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(4, 19, 20, 21, 22, 23, 24, 22, 25, 26),
    gsSPNTriangles_5b(26, 27, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x480),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPVertex(&hnw_v[120], 28, 0),
    gsSPNTrianglesInit_5b(4, 0, 1, 2, 0, 3, 4, 4, 5, 0),
    gsSPNTriangles_5b(2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsSPNTrianglesInit_5b(4, 6, 7, 8, 9, 10, 8, 8, 10, 6),
    gsSPNTriangles_5b(8, 11, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x400),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(4, 12, 13, 14, 14, 15, 12, 16, 17, 18),
    gsSPNTriangles_5b(14, 19, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x380),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(5, 21, 22, 23, 24, 23, 25, 26, 22, 21),
    gsSPNTriangles_5b(23, 24, 21, 25, 27, 24, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x400),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPVertex(&hnw_v[148], 22, 0),
    gsSPNTrianglesInit_5b(5, 0, 1, 2, 3, 4, 5, 6, 2, 7),
    gsSPNTriangles_5b(2, 6, 0, 0, 8, 9, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x480),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(4, 10, 11, 12, 12, 13, 10, 14, 11, 15),
    gsSPNTriangles_5b(14, 12, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsSPNTrianglesInit_5b(4, 16, 17, 18, 19, 17, 20, 17, 16, 20),
    gsSPNTriangles_5b(18, 21, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsSPEndDisplayList(),
};

Gfx handR_hnw_model[] = {
    gsSPTexture(0, 0, 0, G_TX_RENDERTILE, G_ON),
    gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2),
    gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, TEXEL0, PRIMITIVE, 0, COMBINED, 0, 0, 0, 0, COMBINED),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x500),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsDPSetPrimColor(0, 128, 255, 255, 255, 255),
    gsSPVertex(&hnw_v[170], 18, 0),
    gsSPNTrianglesInit_5b(4, 0, 1, 2, 2, 1, 3, 2, 4, 0),
    gsSPNTriangles_5b(3, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x580),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(18, 5, 6, 7, 5, 8, 9, 9, 10, 11),
    gsSPNTriangles_5b(7, 6, 11, 9, 12, 10, 12, 9, 8, 13, 14, 12),
    gsSPNTriangles_5b(11, 15, 9, 12, 14, 16, 7, 17, 13, 9, 15, 5),
    gsSPNTriangles_5b(16, 10, 12, 11, 10, 7, 7, 8, 5, 7, 10, 16),
    gsSPNTriangles_5b(12, 8, 13, 13, 8, 7, 16, 17, 7, 0, 0, 0),
    gsSPEndDisplayList(),
};

Gfx handL_hnw_model[] = {
    gsSPTexture(0, 0, 0, G_TX_RENDERTILE, G_ON),
    gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2),
    gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, TEXEL0, PRIMITIVE, 0, COMBINED, 0, 0, 0, 0, COMBINED),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x500),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsDPSetPrimColor(0, 128, 255, 255, 255, 255),
    gsSPVertex(&hnw_v[188], 18, 0),
    gsSPNTrianglesInit_5b(4, 0, 1, 2, 3, 1, 0, 2, 4, 0),
    gsSPNTriangles_5b(0, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x580),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(18, 5, 6, 7, 8, 9, 7, 10, 11, 8),
    gsSPNTriangles_5b(10, 6, 5, 11, 12, 8, 9, 8, 12, 12, 13, 14),
    gsSPNTriangles_5b(8, 15, 10, 16, 13, 12, 14, 17, 5, 7, 15, 8),
    gsSPNTriangles_5b(12, 11, 16, 5, 11, 10, 7, 9, 5, 16, 11, 5),
    gsSPNTriangles_5b(14, 9, 12, 5, 9, 14, 5, 17, 16, 0, 0, 0),
    gsSPEndDisplayList(),
};

Gfx body_hnw_model[] = {
    gsSPTexture(0, 0, 0, G_TX_RENDERTILE, G_ON),
    gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2),
    gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, TEXEL0, PRIMITIVE, 0, COMBINED, 0, 0, 0, 0, COMBINED),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x600),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsDPSetPrimColor(0, 128, 255, 255, 255, 255),
    gsSPVertex(&hnw_v[206], 23, 0),
    gsSPNTrianglesInit_5b(6, 0, 1, 2, 0, 3, 4, 5, 3, 0),
    gsSPNTriangles_5b(0, 2, 5, 6, 1, 0, 0, 4, 6, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x680),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(4, 7, 8, 9, 10, 11, 12, 12, 13, 10),
    gsSPNTriangles_5b(9, 14, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsSPNTrianglesInit_5b(4, 15, 16, 17, 18, 19, 20, 20, 21, 18),
    gsSPNTriangles_5b(17, 22, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x700),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPVertex(&hnw_v[229], 24, 0),
    gsSPNTrianglesInit_5b(8, 0, 1, 2, 3, 4, 5, 6, 7, 8),
    gsSPNTriangles_5b(2, 9, 0, 10, 11, 12, 5, 13, 3, 8, 14, 6),
    gsSPNTriangles_5b(12, 15, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 16, anime_4_txt + 0x780),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(4, 16, 17, 18, 19, 20, 21, 18, 22, 16),
    gsSPNTriangles_5b(21, 23, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsSPVertex(&hnw_v[253], 23, 0),
    gsSPNTrianglesInit_5b(4, 0, 1, 2, 3, 4, 5, 5, 6, 3),
    gsSPNTriangles_5b(2, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsDPSetTextureImage_Dolphin(G_IM_FMT_CI, G_IM_SIZ_4b, 16, 32, anime_4_txt + 0x280),
    gsDPSetTile_Dolphin(G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 15, GX_CLAMP, GX_CLAMP, 0, 0),
    gsSPNTrianglesInit_5b(12, 8, 9, 10, 11, 12, 10, 10, 13, 14),
    gsSPNTriangles_5b(15, 16, 17, 11, 18, 19, 8, 16, 15, 19, 20, 17),
    gsSPNTriangles_5b(19, 21, 11, 17, 20, 15, 15, 9, 8, 17, 22, 19),
    gsSPNTriangles_5b(10, 12, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    gsSPEndDisplayList(),
};

cKF_Joint_R_c cKF_je_r_hnw_tbl[] = { { NULL, 1, cKF_JOINT_FLAG_DISP_OPA, { 0, 419, 0 } },
                                     { body_hnw_model, 1, cKF_JOINT_FLAG_DISP_OPA, { 0, 0, 0 } },
                                     { head_hnw_model, 2, cKF_JOINT_FLAG_DISP_OPA, { 629, 0, 0 } },
                                     { NULL, 1, cKF_JOINT_FLAG_DISP_OPA, { 563, 65065, 0 } },
                                     { handL_hnw_model, 0, cKF_JOINT_FLAG_DISP_OPA, { 0, 0, 0 } },
                                     { NULL, 1, cKF_JOINT_FLAG_DISP_OPA, { 562, 460, 0 } },
                                     { handR_hnw_model, 0, cKF_JOINT_FLAG_DISP_OPA, { 0, 0, 0 } } };

cKF_Skeleton_R_c cKF_bs_r_hnw = { ARRAY_COUNT(cKF_je_r_hnw_tbl), 4, cKF_je_r_hnw_tbl };
