#include "libforest/gbi_extensions.h"

extern u8 sprashC_tex_dummy[];
extern u8 sprashA_tex_dummy[];
extern u8 wave3_tex_dummy[];
extern u8 wave2_tex_dummy[];
extern u8 wave1_tex_dummy[];
extern u8 sand_tex_dummy[];
extern u8 beach_pal_dummy2[];
extern u8 beach2_tex_dummy2[];
extern u8 beach1_tex_dummy2[];
extern u8 cliff_pal_dummy[];
extern u8 earth_pal_dummy[];
extern u8 bridge_1_pal_dummy[];
extern u8 bridge_1_tex_dummy[];
extern u8 water_2_tex_dummy[];
extern u8 water_1_tex_dummy[];
extern u8 river_tex_dummy[];
extern u8 grass_tex_dummy[];
extern u8 earth_tex_dummy[];

static Vtx tmpr3_v[] = {
#include "assets/field/bg/tmpr3_v.inc"
};

extern Gfx tmpr3_modelT[] = {
    gsSPTexture(65535, 65535, 0, 0, G_ON),
    gsDPPipeSync(),
    gsDPSetCombineLERP(PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, 0, COMBINED, 0, SHADE, 0, 0, 0, 0,
                       COMBINED),
    gsDPSetPrimColor(0, 255, 32, 48, 144, 255),
    gsDPSetEnvColor(0x90, 0x80, 0x60, 0xFF),
    gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2),
    gsDPPipeSync(),
    gsDPSetTextureLUT(G_TT_NONE),
    gsDPLoadTextureBlock_4b(beach2_tex_dummy2, G_IM_FMT_I, 32, 16, 15, G_TX_NOMIRROR | G_TX_WRAP,
                            G_TX_NOMIRROR | G_TX_CLAMP, 5, 4, G_TX_NOLOD, G_TX_NOLOD),
    gsSPLoadGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_FOG | G_LIGHTING | G_SHADING_SMOOTH),
    gsSPVertex(&tmpr3_v[199], 26, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
    gsSP2Triangles(4, 5, 0, 0, 5, 1, 0, 0),
    gsSP2Triangles(6, 7, 8, 0, 6, 8, 9, 0),
    gsSP2Triangles(8, 10, 9, 0, 11, 9, 10, 0),
    gsSP2Triangles(0, 12, 4, 0, 3, 13, 0, 0),
    gsSP2Triangles(0, 13, 12, 0, 13, 14, 12, 0),
    gsSP2Triangles(14, 15, 12, 0, 9, 16, 6, 0),
    gsSP2Triangles(9, 17, 16, 0, 11, 17, 9, 0),
    gsSP2Triangles(18, 17, 19, 0, 19, 20, 18, 0),
    gsSP2Triangles(18, 20, 15, 0, 15, 14, 18, 0),
    gsSP2Triangles(17, 21, 19, 0, 17, 22, 21, 0),
    gsSP2Triangles(17, 11, 22, 0, 5, 23, 1, 0),
    gsSP2Triangles(24, 25, 10, 0, 25, 11, 10, 0),
    gsDPPipeSync(),
    gsDPSetCombineLERP(TEXEL1, 0, TEXEL0, TEXEL0, TEXEL1, 0, TEXEL0, 0, PRIMITIVE, 0, SHADE, COMBINED, 0, 0, 0,
                       COMBINED),
    gsDPSetPrimColor(0, 255, 60, 120, 255, 255),
    gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2),
    gsDPLoadTextureBlock(wave1_tex_dummy, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
                         G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsDPLoadMultiBlock(wave2_tex_dummy, 0x0080, 1, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 64, 0, G_TX_NOMIRROR | G_TX_WRAP,
                       G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD),
    gsSPDisplayList(0x09000000),
    gsSPVertex(&tmpr3_v[225], 20, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 0, 2, 0),
    gsSP2Triangles(1, 4, 5, 0, 2, 1, 5, 0),
    gsSP2Triangles(2, 5, 6, 0, 2, 6, 7, 0),
    gsSP2Triangles(3, 2, 7, 0, 8, 3, 7, 0),
    gsSP2Triangles(9, 10, 11, 0, 12, 13, 9, 0),
    gsSP2Triangles(11, 12, 9, 0, 11, 10, 14, 0),
    gsSP2Triangles(11, 14, 15, 0, 15, 14, 16, 0),
    gsSP2Triangles(15, 16, 17, 0, 18, 19, 15, 0),
    gsSP2Triangles(15, 19, 11, 0, 15, 17, 18, 0),
    gsSP1Triangle(11, 19, 12, 0),
    gsDPPipeSync(),
    gsDPLoadTextureBlock(wave1_tex_dummy, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
                         G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsDPLoadMultiBlock(wave3_tex_dummy, 0x0080, 1, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
                       G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsSPDisplayList(0x0A000000),
    gsSPVertex(&tmpr3_v[245], 16, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 0, 2, 0),
    gsSP2Triangles(3, 2, 4, 0, 3, 4, 5, 0),
    gsSP2Triangles(6, 7, 8, 0, 6, 8, 9, 0),
    gsSP2Triangles(10, 6, 9, 0, 10, 9, 11, 0),
    gsSP2Triangles(10, 11, 12, 0, 13, 10, 12, 0),
    gsSP2Triangles(14, 13, 12, 0, 3, 5, 15, 0),
    gsSP2Triangles(6, 3, 15, 0, 6, 15, 7, 0),
    gsDPPipeSync(),
    gsDPSetCombineLERP(PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 1, 0, TEXEL0, TEXEL1, COMBINED, 0, SHADE, TEXEL0,
                       COMBINED, 0, PRIM_LOD_FRAC, PRIMITIVE),
    gsDPSetPrimColor(0, 50, 255, 255, 255, 50),
    gsDPSetEnvColor(0x00, 0x3C, 0xFF, 0xFF),
    gsDPLoadTextureBlock_4b(water_1_tex_dummy, G_IM_FMT_I, 32, 32, 15, G_TX_NOMIRROR | G_TX_WRAP,
                            G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsDPLoadMultiBlock_4b(water_2_tex_dummy, 0x0040, 1, G_IM_FMT_I, 32, 32, 15, G_TX_NOMIRROR | G_TX_WRAP,
                          G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsSPDisplayList(0x08000000),
    gsSPVertex(&tmpr3_v[261], 10, 0),
    gsSP2Triangles(0, 1, 2, 0, 1, 3, 2, 0),
    gsSP2Triangles(4, 5, 6, 0, 5, 7, 6, 0),
    gsSP2Triangles(5, 2, 7, 0, 2, 3, 7, 0),
    gsSP2Triangles(0, 8, 1, 0, 8, 9, 1, 0),
    gsDPPipeSync(),
    gsDPSetCombineLERP(1, 0, PRIMITIVE, TEXEL0, TEXEL1, 0, PRIMITIVE, 0, COMBINED, 0, SHADE, TEXEL1, 0, 0, 0, COMBINED),
    gsDPSetPrimColor(0, 255, 100, 140, 255, 200),
    gsDPLoadTextureBlock_4b(sprashC_tex_dummy, G_IM_FMT_I, 32, 32, 15, G_TX_MIRROR | G_TX_WRAP,
                            G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsDPLoadMultiBlock_4b(sprashA_tex_dummy, 0x0040, 1, G_IM_FMT_I, 32, 32, 15, G_TX_MIRROR | G_TX_WRAP,
                          G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, 1),
    gsSPDisplayList(0x0B000000),
    gsSPVertex(&tmpr3_v[271], 7, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
    gsSP2Triangles(1, 4, 2, 0, 4, 5, 2, 0),
    gsSP1Triangle(1, 6, 4, 0),
    gsSPEndDisplayList(),
};

extern Gfx tmpr3_model[] = {
    gsSPTexture(65535, 65535, 0, 0, G_ON),
    gsDPPipeSync(),
    gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_TEX_EDGE2),
    gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, TEXEL0, PRIMITIVE, 0, COMBINED, 0, 0, 0, 0, COMBINED),
    gsDPSetTextureLUT(G_TT_RGBA16),
    gsDPLoadTLUT_pal16(15, bridge_1_pal_dummy),
    gsDPLoadTextureBlock_4b(bridge_1_tex_dummy, G_IM_FMT_CI, 64, 64, 15, G_TX_MIRROR | G_TX_WRAP,
                            G_TX_MIRROR | G_TX_WRAP, 6, 6, G_TX_NOLOD, G_TX_NOLOD),
    gsDPSetPrimColor(0, 128, 255, 255, 255, 255),
    gsSPLoadGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_FOG | G_LIGHTING | G_SHADING_SMOOTH),
    gsSPVertex(&tmpr3_v[186], 13, 0),
    gsSP2Triangles(0, 1, 2, 0, 1, 3, 2, 0),
    gsSP2Triangles(0, 2, 4, 0, 2, 5, 4, 0),
    gsSP2Triangles(6, 4, 7, 0, 6, 7, 8, 0),
    gsSP2Triangles(9, 0, 4, 0, 9, 4, 6, 0),
    gsSP2Triangles(10, 11, 1, 0, 10, 1, 12, 0),
    gsSP2Triangles(12, 1, 0, 0, 12, 0, 9, 0),
    gsSP2Triangles(5, 7, 4, 0, 11, 3, 1, 0),
    gsDPPipeSync(),
    gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2),
    gsDPLoadTLUT_pal16(15, cliff_pal_dummy),
    gsDPLoadTextureBlock_4b(river_tex_dummy, G_IM_FMT_CI, 64, 32, 15, G_TX_NOMIRROR | G_TX_WRAP,
                            G_TX_NOMIRROR | G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsSPVertex(&tmpr3_v[0], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 1, 3, 2, 0),
    gsSP2Triangles(4, 5, 6, 0, 7, 8, 9, 0),
    gsSP2Triangles(7, 10, 11, 0, 10, 12, 11, 0),
    gsSP2Triangles(13, 14, 12, 0, 13, 15, 14, 0),
    gsSP2Triangles(16, 17, 15, 0, 16, 18, 17, 0),
    gsSP2Triangles(18, 19, 20, 0, 21, 22, 20, 0),
    gsSP2Triangles(23, 24, 22, 0, 25, 26, 24, 0),
    gsSP2Triangles(27, 28, 26, 0, 26, 25, 27, 0),
    gsSP2Triangles(24, 23, 25, 0, 22, 21, 23, 0),
    gsSP2Triangles(20, 19, 21, 0, 16, 19, 18, 0),
    gsSP2Triangles(15, 13, 16, 0, 12, 10, 13, 0),
    gsSP2Triangles(7, 9, 10, 0, 6, 29, 30, 0),
    gsSP1Triangle(29, 31, 30, 0),
    gsSPVertex(&tmpr3_v[32], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0),
    gsSP2Triangles(2, 1, 3, 0, 0, 6, 1, 0),
    gsSP2Triangles(7, 8, 6, 0, 6, 8, 1, 0),
    gsSP2Triangles(9, 10, 7, 0, 9, 11, 10, 0),
    gsSP2Triangles(12, 13, 11, 0, 13, 10, 11, 0),
    gsSP2Triangles(14, 15, 12, 0, 16, 17, 14, 0),
    gsSP2Triangles(18, 19, 16, 0, 20, 21, 18, 0),
    gsSP2Triangles(22, 23, 20, 0, 24, 25, 22, 0),
    gsSP2Triangles(26, 27, 28, 0, 26, 29, 27, 0),
    gsSP2Triangles(29, 30, 27, 0, 31, 25, 24, 0),
    gsSP2Triangles(22, 25, 23, 0, 20, 23, 21, 0),
    gsSP2Triangles(18, 21, 19, 0, 19, 17, 16, 0),
    gsSP2Triangles(14, 17, 15, 0, 15, 13, 12, 0),
    gsDPPipeSync(),
    gsDPLoadTLUT_pal16(15, beach_pal_dummy2),
    gsDPLoadTextureBlock_4b(sand_tex_dummy, G_IM_FMT_CI, 64, 32, 15, G_TX_NOMIRROR | G_TX_WRAP,
                            G_TX_NOMIRROR | G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsSPVertex(&tmpr3_v[64], 14, 0),
    gsSP2Triangles(0, 1, 2, 0, 1, 3, 2, 0),
    gsSP2Triangles(2, 3, 4, 0, 3, 5, 4, 0),
    gsSP2Triangles(6, 7, 8, 0, 7, 9, 8, 0),
    gsSP2Triangles(9, 10, 11, 0, 11, 8, 9, 0),
    gsSP2Triangles(12, 11, 10, 0, 12, 13, 11, 0),
    gsDPPipeSync(),
    gsDPLoadTLUT_pal16(15, earth_pal_dummy),
    gsDPLoadTextureBlock_4b(earth_tex_dummy, G_IM_FMT_CI, 64, 64, 15, G_TX_NOMIRROR | G_TX_WRAP,
                            G_TX_NOMIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD),
    gsSPVertex(&tmpr3_v[78], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 4, 1, 0),
    gsSP2Triangles(5, 6, 4, 0, 7, 8, 6, 0),
    gsSP2Triangles(9, 10, 11, 0, 12, 11, 13, 0),
    gsSP2Triangles(14, 13, 15, 0, 16, 15, 17, 0),
    gsSP2Triangles(18, 19, 10, 0, 20, 21, 22, 0),
    gsSP2Triangles(23, 22, 8, 0, 24, 25, 21, 0),
    gsSP2Triangles(26, 27, 28, 0, 29, 26, 30, 0),
    gsSPVertex(&tmpr3_v[109], 9, 0),
    gsSP2Triangles(0, 1, 2, 0, 1, 3, 4, 0),
    gsSP2Triangles(5, 0, 6, 0, 7, 5, 8, 0),
    gsDPPipeSync(),
    gsDPLoadTLUT_pal16(15, earth_pal_dummy),
    gsDPLoadTextureBlock_4b(grass_tex_dummy, G_IM_FMT_CI, 32, 32, 15, G_TX_NOMIRROR | G_TX_WRAP,
                            G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsSPVertex(&tmpr3_v[118], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 1, 3, 2, 0),
    gsSP2Triangles(4, 5, 6, 0, 5, 1, 0, 0),
    gsSP2Triangles(5, 4, 1, 0, 6, 5, 7, 0),
    gsSP2Triangles(5, 8, 7, 0, 7, 8, 9, 0),
    gsSP2Triangles(9, 8, 10, 0, 8, 11, 10, 0),
    gsSP2Triangles(12, 13, 14, 0, 12, 15, 13, 0),
    gsSP2Triangles(14, 0, 2, 0, 16, 13, 17, 0),
    gsSP2Triangles(17, 13, 18, 0, 19, 20, 21, 0),
    gsSP2Triangles(19, 22, 20, 0, 23, 20, 22, 0),
    gsSP2Triangles(24, 20, 23, 0, 25, 20, 24, 0),
    gsSP2Triangles(18, 20, 25, 0, 20, 26, 21, 0),
    gsSP2Triangles(20, 27, 26, 0, 20, 15, 27, 0),
    gsSP2Triangles(15, 20, 13, 0, 20, 18, 13, 0),
    gsSP2Triangles(28, 29, 30, 0, 29, 31, 30, 0),
    gsSPVertex(&tmpr3_v[150], 22, 0),
    gsSP2Triangles(0, 1, 2, 0, 1, 3, 2, 0),
    gsSP2Triangles(4, 2, 3, 0, 4, 5, 2, 0),
    gsSP2Triangles(6, 7, 5, 0, 7, 8, 9, 0),
    gsSP2Triangles(7, 6, 10, 0, 6, 11, 10, 0),
    gsSP2Triangles(12, 13, 8, 0, 12, 14, 13, 0),
    gsSP2Triangles(12, 15, 14, 0, 12, 16, 15, 0),
    gsSP2Triangles(17, 18, 16, 0, 10, 19, 17, 0),
    gsSP2Triangles(19, 18, 17, 0, 11, 19, 10, 0),
    gsSP2Triangles(11, 20, 19, 0, 20, 21, 19, 0),
    gsSPTexture(65535, 65535, 0, 0, G_ON),
    gsDPPipeSync(),
    gsDPSetCombineLERP(PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, TEXEL0, COMBINED, 0, SHADE, 0, 0, 0, 0,
                       COMBINED),
    gsDPSetPrimColor(0, 255, 200, 184, 144, 255),
    gsDPSetEnvColor(0x90, 0x80, 0x60, 0xFF),
    gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2),
    gsDPPipeSync(),
    gsDPSetTextureLUT(G_TT_NONE),
    gsDPLoadTextureBlock_4b(beach1_tex_dummy2, G_IM_FMT_I, 64, 32, 15, G_TX_NOMIRROR | G_TX_WRAP,
                            G_TX_NOMIRROR | G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsSPVertex(&tmpr3_v[172], 14, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
    gsSP2Triangles(4, 0, 3, 0, 5, 4, 3, 0),
    gsSP2Triangles(6, 7, 8, 0, 9, 10, 6, 0),
    gsSP2Triangles(9, 6, 8, 0, 11, 10, 12, 0),
    gsSP2Triangles(12, 10, 9, 0, 12, 13, 11, 0),
    gsSPEndDisplayList(),
};
