#include "libforest/gbi_extensions.h"

extern u8 rail_pal_dummy[];
extern u8 bush_pal_dummy[];
extern u8 earth_pal_dummy[];
extern u8 station_pal_dummy[];
extern u8 stone_tex_dummy[];
extern u8 station_tex_dummy[];
extern u8 rail_tex_dummy[];
extern u8 grass_tex_dummy[];
extern u8 bush_b_tex_dummy[];
extern u8 bush_a_tex_dummy[];
extern u8 earth_tex_dummy[];

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

extern Gfx tmp4_modelT[] = {
    gsSPEndDisplayList(),
};

extern Gfx tmp4_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, bush_pal_dummy),
    gsDPLoadTextureBlock_4b(bush_a_tex_dummy, G_IM_FMT_CI, 64, 64, 15, G_TX_NOMIRROR | G_TX_WRAP,
                            G_TX_MIRROR | G_TX_CLAMP, 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(&tmp4_v[191], 13, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 0, 4, 0),
    gsSP2Triangles(5, 3, 6, 0, 7, 5, 8, 0),
    gsSP2Triangles(9, 7, 10, 0, 11, 9, 12, 0),
    gsDPPipeSync(),
    gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2),
    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(&tmp4_v[0], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0),
    gsSP2Triangles(4, 6, 7, 0, 8, 9, 0, 0),
    gsSP2Triangles(1, 0, 9, 0, 0, 10, 8, 0),
    gsSP2Triangles(11, 12, 13, 0, 14, 15, 16, 0),
    gsSP2Triangles(15, 17, 16, 0, 18, 14, 19, 0),
    gsSP2Triangles(9, 18, 19, 0, 20, 21, 22, 0),
    gsSP2Triangles(23, 22, 21, 0, 1, 9, 23, 0),
    gsSP2Triangles(24, 25, 3, 0, 8, 18, 9, 0),
    gsSP2Triangles(15, 26, 17, 0, 26, 27, 22, 0),
    gsSP2Triangles(28, 29, 30, 0, 29, 11, 13, 0),
    gsSPVertex(&tmp4_v[31], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0),
    gsSP2Triangles(4, 6, 7, 0, 7, 8, 9, 0),
    gsSP2Triangles(9, 10, 11, 0, 3, 6, 4, 0),
    gsSP2Triangles(6, 8, 7, 0, 8, 10, 9, 0),
    gsSP2Triangles(10, 12, 11, 0, 13, 14, 15, 0),
    gsSP2Triangles(16, 17, 14, 0, 18, 19, 20, 0),
    gsSP2Triangles(0, 21, 22, 0, 0, 23, 21, 0),
    gsSP2Triangles(2, 1, 24, 0, 24, 1, 25, 0),
    gsSP2Triangles(21, 23, 26, 0, 21, 27, 22, 0),
    gsSP2Triangles(28, 29, 26, 0, 29, 18, 30, 0),
    gsSP1Triangle(20, 30, 18, 0),
    gsSPVertex(&tmp4_v[62], 3, 0),
    gsSP1Triangle(0, 1, 2, 0),
    gsDPPipeSync(),
    gsDPLoadTLUT_pal16(15, earth_pal_dummy),
    gsDPLoadTextureBlock_4b(stone_tex_dummy, G_IM_FMT_CI, 64, 64, 15, G_TX_NOMIRROR | G_TX_WRAP,
                            G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD),
    gsSPVertex(&tmp4_v[65], 25, 0),
    gsSP2Triangles(0, 1, 2, 0, 2, 3, 4, 0),
    gsSP2Triangles(2, 1, 3, 0, 0, 5, 1, 0),
    gsSP2Triangles(3, 6, 4, 0, 7, 8, 6, 0),
    gsSP2Triangles(7, 9, 8, 0, 9, 10, 11, 0),
    gsSP2Triangles(12, 13, 11, 0, 14, 15, 13, 0),
    gsSP2Triangles(15, 14, 16, 0, 16, 17, 15, 0),
    gsSP2Triangles(17, 18, 19, 0, 18, 20, 19, 0),
    gsSP2Triangles(20, 21, 19, 0, 20, 22, 21, 0),
    gsSP2Triangles(22, 23, 21, 0, 22, 24, 23, 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_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD),
    gsSPVertex(&tmp4_v[90], 31, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 3, 1, 0),
    gsSP2Triangles(2, 4, 5, 0, 6, 7, 0, 0),
    gsSP2Triangles(8, 9, 6, 0, 10, 11, 8, 0),
    gsSP2Triangles(10, 12, 11, 0, 10, 13, 12, 0),
    gsSP2Triangles(13, 14, 15, 0, 16, 17, 18, 0),
    gsSP2Triangles(19, 16, 20, 0, 17, 21, 22, 0),
    gsSP2Triangles(21, 23, 24, 0, 23, 25, 24, 0),
    gsSP2Triangles(26, 27, 28, 0, 27, 29, 30, 0),
    gsSP1Triangle(29, 19, 30, 0),
    gsDPPipeSync(),
    gsDPLoadTLUT_pal16(15, rail_pal_dummy),
    gsDPLoadTextureBlock_4b(rail_tex_dummy, G_IM_FMT_CI, 64, 64, 15, G_TX_NOMIRROR | G_TX_WRAP,
                            G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD),
    gsSPVertex(&tmp4_v[121], 21, 0),
    gsSP2Triangles(0, 1, 2, 0, 1, 3, 2, 0),
    gsSP2Triangles(4, 1, 0, 0, 4, 5, 1, 0),
    gsSP2Triangles(6, 7, 4, 0, 7, 5, 4, 0),
    gsSP2Triangles(8, 7, 6, 0, 8, 9, 7, 0),
    gsSP2Triangles(9, 10, 7, 0, 10, 11, 7, 0),
    gsSP2Triangles(7, 12, 5, 0, 7, 11, 12, 0),
    gsSP2Triangles(5, 12, 1, 0, 12, 13, 1, 0),
    gsSP2Triangles(1, 14, 3, 0, 1, 13, 14, 0),
    gsSP2Triangles(13, 15, 14, 0, 13, 16, 15, 0),
    gsSP2Triangles(12, 16, 13, 0, 12, 17, 16, 0),
    gsSP2Triangles(11, 18, 12, 0, 18, 17, 12, 0),
    gsSP2Triangles(11, 19, 18, 0, 10, 20, 11, 0),
    gsSP1Triangle(20, 19, 11, 0),
    gsDPPipeSync(),
    gsDPLoadTLUT_pal16(15, station_pal_dummy),
    gsDPLoadTextureBlock_4b(station_tex_dummy, G_IM_FMT_CI, 128, 32, 15, G_TX_MIRROR | G_TX_WRAP,
                            G_TX_NOMIRROR | G_TX_WRAP, 7, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsSPVertex(&tmp4_v[142], 32, 0),
    gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
    gsSP2Triangles(4, 5, 6, 0, 4, 6, 7, 0),
    gsSP2Triangles(4, 8, 5, 0, 9, 10, 11, 0),
    gsSP2Triangles(9, 12, 10, 0, 11, 13, 14, 0),
    gsSP2Triangles(11, 15, 13, 0, 13, 16, 14, 0),
    gsSP2Triangles(11, 10, 15, 0, 17, 18, 19, 0),
    gsSP2Triangles(18, 20, 19, 0, 21, 8, 4, 0),
    gsSP2Triangles(22, 23, 24, 0, 23, 25, 24, 0),
    gsSP2Triangles(26, 27, 28, 0, 26, 28, 29, 0),
    gsSPVertex(&tmp4_v[172], 6, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0),
    gsDPPipeSync(),
    gsDPLoadTLUT_pal16(15, bush_pal_dummy),
    gsDPLoadTextureBlock_4b(bush_b_tex_dummy, G_IM_FMT_CI, 64, 32, 15, G_TX_NOMIRROR | G_TX_WRAP,
                            G_TX_MIRROR | G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD),
    gsSPVertex(&tmp4_v[178], 13, 0),
    gsSP2Triangles(0, 1, 2, 0, 3, 0, 4, 0),
    gsSP2Triangles(5, 6, 7, 0, 1, 5, 8, 0),
    gsSP2Triangles(9, 10, 11, 0, 10, 3, 12, 0),
    gsSPEndDisplayList(),
};
