#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 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 tmpr4_v[] = {
#include "assets/field/bg/tmpr4_v.inc"
};

extern Gfx tmpr4_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(&tmpr4_v[218], 24, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
    gsSP2Triangles(4, 5, 6, 0, 4, 7, 5, 0),
    gsSP2Triangles(8, 7, 4, 0, 7, 9, 10, 0),
    gsSP2Triangles(9, 11, 10, 0, 7, 12, 9, 0),
    gsSP2Triangles(13, 3, 14, 0, 13, 0, 3, 0),
    gsSP2Triangles(7, 8, 12, 0, 15, 16, 17, 0),
    gsSP2Triangles(15, 18, 16, 0, 18, 11, 16, 0),
    gsSP2Triangles(6, 5, 19, 0, 18, 10, 11, 0),
    gsSP2Triangles(20, 6, 19, 0, 8, 21, 12, 0),
    gsSP2Triangles(22, 20, 23, 0, 20, 19, 23, 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(&tmpr4_v[242], 19, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 3, 1, 0),
    gsSP2Triangles(4, 1, 3, 0, 4, 3, 5, 0),
    gsSP2Triangles(0, 6, 3, 0, 7, 8, 9, 0),
    gsSP2Triangles(10, 9, 11, 0, 9, 8, 11, 0),
    gsSP2Triangles(7, 9, 12, 0, 13, 14, 15, 0),
    gsSP2Triangles(16, 13, 17, 0, 16, 14, 13, 0),
    gsSP1Triangle(13, 15, 18, 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(&tmpr4_v[261], 23, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 3, 1, 0),
    gsSP2Triangles(0, 4, 5, 0, 0, 2, 4, 0),
    gsSP2Triangles(6, 7, 8, 0, 9, 10, 11, 0),
    gsSP2Triangles(12, 9, 11, 0, 12, 11, 13, 0),
    gsSP2Triangles(14, 12, 13, 0, 15, 16, 17, 0),
    gsSP2Triangles(7, 18, 8, 0, 18, 7, 19, 0),
    gsSP2Triangles(20, 18, 19, 0, 15, 17, 10, 0),
    gsSP2Triangles(9, 15, 10, 0, 6, 8, 12, 0),
    gsSP2Triangles(14, 6, 12, 0, 5, 14, 13, 0),
    gsSP2Triangles(5, 13, 21, 0, 5, 21, 0, 0),
    gsSP1Triangle(1, 22, 2, 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(&tmpr4_v[284], 10, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 3, 1, 0),
    gsSP2Triangles(4, 5, 2, 0, 4, 6, 5, 0),
    gsSP2Triangles(2, 5, 0, 0, 7, 6, 8, 0),
    gsSP2Triangles(6, 4, 8, 0, 3, 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(&tmpr4_v[294], 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 tmpr4_model[] = {
    gsSPTexture(65535, 65535, 0, 0, G_ON),
    gsDPPipeSync(),
    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),
    gsDPSetTextureLUT(G_TT_RGBA16),
    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),
    gsDPSetPrimColor(0, 128, 255, 255, 255, 255),
    gsSPLoadGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_FOG | G_LIGHTING | G_SHADING_SMOOTH),
    gsSPVertex(&tmpr4_v[0], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
    gsSP2Triangles(4, 5, 6, 0, 7, 8, 6, 0),
    gsSP2Triangles(8, 4, 6, 0, 9, 10, 11, 0),
    gsSP2Triangles(9, 12, 10, 0, 9, 13, 12, 0),
    gsSP2Triangles(13, 14, 12, 0, 15, 16, 17, 0),
    gsSP2Triangles(18, 17, 19, 0, 17, 16, 19, 0),
    gsSP2Triangles(7, 20, 8, 0, 20, 21, 8, 0),
    gsSP2Triangles(22, 23, 24, 0, 23, 25, 24, 0),
    gsSP2Triangles(26, 22, 27, 0, 22, 24, 27, 0),
    gsSP2Triangles(28, 29, 30, 0, 28, 30, 31, 0),
    gsSPVertex(&tmpr4_v[32], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 3, 1, 0),
    gsSP2Triangles(4, 5, 6, 0, 5, 7, 6, 0),
    gsSP2Triangles(8, 9, 10, 0, 11, 12, 13, 0),
    gsSP2Triangles(14, 15, 16, 0, 2, 17, 0, 0),
    gsSP2Triangles(18, 11, 13, 0, 19, 20, 21, 0),
    gsSP2Triangles(14, 22, 15, 0, 23, 20, 24, 0),
    gsSP2Triangles(22, 17, 25, 0, 26, 12, 11, 0),
    gsSP2Triangles(17, 2, 25, 0, 27, 28, 29, 0),
    gsSP1Triangle(22, 25, 15, 0),
    gsSPVertex(&tmpr4_v[62], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 3, 1, 0),
    gsSP2Triangles(3, 4, 1, 0, 5, 6, 7, 0),
    gsSP2Triangles(8, 9, 10, 0, 11, 12, 13, 0),
    gsSP2Triangles(14, 15, 16, 0, 15, 17, 16, 0),
    gsSP2Triangles(18, 19, 20, 0, 21, 22, 23, 0),
    gsSP2Triangles(23, 24, 25, 0, 26, 27, 12, 0),
    gsSP2Triangles(28, 18, 29, 0, 24, 30, 25, 0),
    gsSP2Triangles(13, 12, 27, 0, 28, 31, 18, 0),
    gsSPVertex(&tmpr4_v[94], 18, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0),
    gsSP2Triangles(6, 2, 7, 0, 8, 5, 4, 0),
    gsSP2Triangles(9, 10, 11, 0, 12, 13, 14, 0),
    gsSP2Triangles(15, 16, 17, 0, 3, 12, 14, 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(&tmpr4_v[112], 13, 0),
    gsSP2Triangles(0, 1, 2, 0, 2, 1, 3, 0),
    gsSP2Triangles(4, 5, 6, 0, 5, 7, 6, 0),
    gsSP2Triangles(8, 2, 3, 0, 9, 10, 11, 0),
    gsSP1Triangle(10, 12, 11, 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(&tmpr4_v[125], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 1, 3, 2, 0),
    gsSP2Triangles(0, 4, 1, 0, 0, 5, 4, 0),
    gsSP2Triangles(0, 6, 5, 0, 7, 8, 9, 0),
    gsSP2Triangles(7, 9, 10, 0, 10, 11, 12, 0),
    gsSP2Triangles(10, 12, 7, 0, 13, 2, 14, 0),
    gsSP2Triangles(13, 14, 15, 0, 16, 17, 18, 0),
    gsSP2Triangles(17, 19, 18, 0, 19, 20, 18, 0),
    gsSP2Triangles(21, 17, 16, 0, 22, 23, 24, 0),
    gsSP2Triangles(25, 26, 23, 0, 25, 23, 22, 0),
    gsSP2Triangles(24, 27, 28, 0, 13, 19, 29, 0),
    gsSP1Triangle(19, 17, 29, 0),
    gsSPVertex(&tmpr4_v[155], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0),
    gsSP2Triangles(3, 6, 4, 0, 7, 8, 9, 0),
    gsSP2Triangles(7, 10, 8, 0, 10, 5, 8, 0),
    gsSP2Triangles(11, 12, 13, 0, 14, 15, 16, 0),
    gsSP2Triangles(17, 1, 0, 0, 18, 2, 19, 0),
    gsSP2Triangles(20, 21, 22, 0, 23, 1, 17, 0),
    gsSP2Triangles(24, 25, 26, 0, 18, 26, 27, 0),
    gsSP2Triangles(28, 18, 27, 0, 29, 18, 28, 0),
    gsSP2Triangles(30, 18, 29, 0, 2, 18, 30, 0),
    gsSP2Triangles(0, 2, 31, 0, 31, 2, 30, 0),
    gsSPVertex(&tmpr4_v[187], 5, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 3, 1, 0),
    gsSP1Triangle(1, 4, 2, 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(&tmpr4_v[192], 13, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 0, 4, 0),
    gsSP2Triangles(5, 6, 7, 0, 6, 3, 8, 0),
    gsSP2Triangles(9, 5, 10, 0, 11, 9, 12, 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(&tmpr4_v[205], 13, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
    gsSP2Triangles(4, 5, 6, 0, 4, 6, 7, 0),
    gsSP2Triangles(8, 9, 10, 0, 8, 11, 9, 0),
    gsSP1Triangle(9, 12, 10, 0),
    gsSPEndDisplayList(),
};
