require( "scripts/style.lua" );
require( "scripts/ui/style_text.lua" );
require( "scripts/game_sector_loading.lua" );

local kQuestButtonY = 112;

SpawnLevel = function(item_name, x_link, y_link, quest, world, top_quest)
    if GetCount(item_name.."_state") <= 2 then
        return Group
        {
            ButtonVisual
            {
                x = x_link,
                y = y_link,
                name = item_name,
                snd_click = kMenuButtonSound,
				snd_over = kMenuRolloverSound,
                tex_normal = "map/btn_active",
                tex_over   = "map/btn_active_a",
                tex_push   = "map/btn_active_p",
                tex_disabled = "map/not_played",
                tex_locked = "map/not_played",
                actions = {"Map"..tostring(world),},
                layer_click = 10,
                context = {"curr_garden",},
                context_change = function(item, old_val, new_val)
                    Invoke_SetLocked(item_name, (new_val ~= world) or (GetCount(item_name.."_state") == 0));
                    if new_val == world then
                        if (quest == GetCount(top_quest)) then
                            Invoke_SetPosition("g"..tostring(world).."_selector", x_link, y_link)
                            Invoke_StartCurveInfinite("g"..tostring(world).."_selector", "curves/fx_level_selector.xml", "", 0);
                            SetItemCount("curr_quest", quest);
                        end;
                    end;
                end,
                on_create = function()
                end,
                on_click = function()
                    Invoke_SetPosition("g"..tostring(world).."_selector", x_link, y_link)
                    Invoke_StartCurveInfinite("g"..tostring(world).."_selector", "curves/fx_level_selector.xml", "", 0);
                    SetItemCount("curr_quest", quest);
                end,
            },
        };
    end;
    if (GetCount(item_name.."_state") < 4) and (GetCount(item_name.."_state") > 2) then
        return Group
        {
            ButtonVisual
            {
                x = x_link,
                y = y_link,
                name = item_name,
                snd_click = kMenuButtonSound,
				snd_over = kMenuRolloverSound,
                tex_normal = "map/btn_noexpert",
                tex_over   = "map/btn_noexpert_a",
                tex_push   = "map/btn_noexpert_p",
                tex_disabled = "map/not_played",
                tex_locked = "map/not_played",
                actions = {"Map"..tostring(world),},
                layer_click = 10,
                context = {"curr_garden",},
                context_change = function(item, old_val, new_val)
                    Invoke_SetLocked(item_name, (new_val ~= world) or (GetCount(item_name.."_state") == 0));
                    if new_val == world then
                        if (quest == GetCount(top_quest)) then
                            Invoke_SetPosition("g"..tostring(world).."_selector", x_link, y_link)
                            Invoke_StartCurveInfinite("g"..tostring(world).."_selector", "curves/fx_level_selector.xml", "", 0);
                            SetItemCount("curr_quest", quest);
                        end;
                    end;
                end,
                on_create = function()
                end,
                on_click = function()
                    Invoke_SetPosition("g"..tostring(world).."_selector", x_link, y_link)
                    Invoke_StartCurveInfinite("g"..tostring(world).."_selector", "curves/fx_level_selector.xml", "", 0);
                    SetItemCount("curr_quest", quest);
                end,
            },
        };
    end;
    if GetCount(item_name.."_state") == 4 then
        return Group
        {
            ButtonVisual
            {
                x = x_link,
                y = y_link,
                name = item_name,
                snd_click = kMenuButtonSound,
				snd_over = kMenuRolloverSound,
                tex_normal = "map/btn_expert",
                tex_over   = "map/btn_expert_a",
                tex_push   = "map/btn_expert_p",
                tex_disabled = "map/not_played",
                tex_locked = "map/not_played",
                actions = {"Map"..tostring(world),},
                layer_click = 10,
                context = {"curr_garden",},
                context_change = function(item, old_val, new_val)
                    Invoke_SetLocked(item_name, (new_val ~= world) or (GetCount(item_name.."_state") == 0));
                    if new_val == world then
                        if (quest == GetCount(top_quest)) then
                            Invoke_SetPosition("g"..tostring(world).."_selector", x_link, y_link)
                            Invoke_StartCurveInfinite("g"..tostring(world).."_selector", "curves/fx_level_selector.xml", "", 0);
                            SetItemCount("curr_quest", quest);
                        end;
                    end;
                end,
                on_create = function()
                end,
                on_click = function()
                    Invoke_SetPosition("g"..tostring(world).."_selector", x_link, y_link)
                    Invoke_StartCurveInfinite("g"..tostring(world).."_selector", "curves/fx_level_selector.xml", "", 0);
                    SetItemCount("curr_quest", quest);
                end,
            },
        };
    end;
end;

fn_Play = function()
    local g = GetCount("curr_garden");
    local q = GetCount("curr_quest");
    local prefix = "g"..tostring(g).."_q"..tostring(q).."_";
    
    PlaySound("audio/sfx/main_menu/screenswitch.ogg");
    
    -- FIRST GARDEN -- 1 -- FIRST GARDEN -- 1 -- FIRST GARDEN -- 1 --
    if (g == 1) then
        local q_progress = "g1_q"..tostring(q).."_state";
        if GetCount(q_progress) >= 3 then
            result = DisplayDialog {
                "scripts/dlg_yesno.lua",
                title = "restart_garden",
                body ="restart_garden_1",
                image = "interface/dlg_yes_no/restart_1",
            };
            if (result=='yes') then
                GotoGarden_1();
            end;
        else
            GotoGarden_1();
        end;
    end;
    
    -- SECOND GARDEN -- 2 -- SECOND GARDEN -- 2 -- SECOND GARDEN -- 2 --
    if (g == 2) then
        local q_progress = "g2_q"..tostring(q).."_state";
        if GetCount(q_progress) >= 3 then
            result = DisplayDialog {
                "scripts/dlg_yesno.lua",
                title = "restart_garden",
                body ="restart_garden_2",
                image = "interface/dlg_yes_no/restart_1",
            };
            if (result=='yes') then
                GotoGarden_2();
            end;
        else
            GotoGarden_2();
        end;
    end;
    
    -- THIRD GARDEN -- 3 -- THIRD GARDEN -- 3 -- THIRD GARDEN -- 3 --
    if (g == 3) then
        local q_progress = "g3_q"..tostring(q).."_state";
        if GetCount(q_progress) >= 3 then
            result = DisplayDialog {
                "scripts/dlg_yesno.lua",
                title = "restart_garden",
                body ="restart_garden_3",
                image = "interface/dlg_yes_no/restart_1",
            };
            if (result=='yes') then
                GotoGarden_3();
            end;
        else
            GotoGarden_3();
        end;
    end;
    
    -- FOURTH GARDEN -- 4 -- FOURTH GARDEN -- 4 -- FOURTH GARDEN -- 4 --
    if (g == 4) then
        local q_progress = "g4_q"..tostring(q).."_state";
        if GetCount(q_progress) >= 3 then
            result = DisplayDialog {
                "scripts/dlg_yesno.lua",
                title = "restart_garden",
                body ="restart_garden_4",
                image = "interface/dlg_yes_no/restart_1",
            };
            if (result=='yes') then
                GotoGarden_4();
            end;
        else
            GotoGarden_4();
        end;
    end;
    
    -- FIFTH GARDEN -- 5 -- FIFTH GARDEN -- 5 -- FIFTH GARDEN -- 5 --
    if (g == 5) then
        local q_progress = "g5_q"..tostring(q).."_state";
        if GetCount(q_progress) >= 3 then
            result = DisplayDialog {
                "scripts/dlg_yesno.lua",
                title = "restart_garden",
                body ="restart_garden_5",
                image = "interface/dlg_yes_no/restart_1",
            };
            if (result=='yes') then
                GotoGarden_5();
            end;
        else
            GotoGarden_5();
        end;
    end;
end;

MakeDialog
{
    Map
    {
        name="map",
        x=0,
        y=0,
        w=1024,
        h=768,
        Bitmap
        {
            name="map",
            image="map/back",
            x = 347, y = 6,
        },
        WndTextureScroller
        {
            name = "clouds_4",
            x = 0,
            y = 105,
            w = 1024,
            h = 210,
            tex_name = "map/cloud_2",
            scroll_speed = "40,0",
            timer_settings = {
                name = "ui",
                category = "UI",
            },
        },
        ButtonVisual
        {
            name = "btn_world_5",
            x = 728, y = 237,
            tex_normal = "map/w5_b",
            tex_over   = "map/w5_b_a",
            tex_push   = "map/w5_b_a",
            tex_locked = "map/w5_d",
            on_click = function()
                if GetCount("curr_garden") ~= 5 then
                    EnableWindow("world_1_levels", false);
                    EnableWindow("world_2_levels", false);
                    EnableWindow("world_3_levels", false);
                    EnableWindow("world_4_levels", false);
                    EnableWindow("world_5_levels", true);
                    bmp_active_SetPosition(680, 96);
                    SetItemCount("curr_garden", 5);
                    GM_StartPersistentAction("Map5");
                end;
            end,
            actions = {"Map1","Map2","Map3","Map4"},
            context = {"garden_5_progress",},
            context_change = function(item, old_val, new_val)
                btn_world_5_SetLocked(IsContentLimited() or GetCount("garden_5_progress") == 0);
            end,
            rect = "293,-130;187,16;51,-26;-21,-80;-145,-78;-87,-234;295,-234;",
            layer_click = 1,
            snd_click = kMenuButtonSound,
            snd_over = kMenuRolloverSound,
        },
        ButtonVisual
        {
            name = "btn_world_4",
            x = 332, y = 262,
            tex_normal = "map/w4_b",
            tex_over   = "map/w4_b_a",
            tex_push   = "map/w4_b_a",
            tex_locked = "map/w4_d",
            on_click = function()
                if GetCount("curr_garden") ~= 4 then
                    EnableWindow("world_1_levels", false);
                    EnableWindow("world_2_levels", false);
                    EnableWindow("world_3_levels", false);
                    EnableWindow("world_4_levels", true);
                    EnableWindow("world_5_levels", false);
                    bmp_active_SetPosition(150, 120);
                    SetItemCount("curr_garden", 4);
                    GM_StartPersistentAction("Map4");
                end;
            end,
            actions = {"Map1","Map2","Map3","Map5"},
            context = {"garden_4_progress",},
            context_change = function(item, old_val, new_val)
                btn_world_4_SetLocked(IsContentLimited() or GetCount("garden_4_progress") == 0);
            end,
            rect = "135,-138;-11,-58;-83,-30;-219,-16;-321,-26;-333,-256;155,-260;",
            layer_click = 2,
            snd_click = kMenuButtonSound,
            snd_over = kMenuRolloverSound,
        },
        WndTextureScroller
        {
            name = "clouds_3",
            x = 0,
            y = 275,
            w = 1024,
            h = 210,
            tex_name = "map/cloud_2",
            scroll_speed = "51,0",
            timer_settings = {
                name = "ui",
                category = "UI",
            },
        },
        ButtonVisual
        {
            name = "btn_world_3",
            x = 546, y = 446,
            tex_normal = "map/w3_b",
            tex_over   = "map/w3_b_a",
            tex_push   = "map/w3_b_a",
            tex_locked = "map/w3_d",
            on_click = function()
                if GetCount("curr_garden") ~= 3 then
                    EnableWindow("world_1_levels", false);
                    EnableWindow("world_2_levels", false);
                    EnableWindow("world_3_levels", true);
                    EnableWindow("world_4_levels", false);
                    EnableWindow("world_5_levels", false);
                    bmp_active_SetPosition(512, 384);
                    SetItemCount("curr_garden", 3);
                    GM_StartPersistentAction("Map3");
                end;
            end,
            actions = {"Map1","Map2","Map4","Map5"},
            context = {"garden_3_progress",},
            context_change = function(item, old_val, new_val)
                btn_world_3_SetLocked(IsContentLimited() or GetCount("garden_3_progress") == 0);
            end,
            rect = "-172,-36;-80,28;-46,72;82,72;146,-24;238,-56;236,-132;76,-162;-42,-148;-102,-124;-138,-142;-184,-108;",
            layer_click = 3,
            snd_click = kMenuButtonSound,
            snd_over = kMenuRolloverSound,
        },
        WndTextureScroller
        {
            name = "clouds_2",
            x = 0,
            y = 500,
            w = 1024,
            h = 210,
            tex_name = "map/cloud_1",
            scroll_speed = "68,0",
            timer_settings = {
                name = "ui",
                category = "UI",
            },
        },
        ButtonVisual
        {
            name = "btn_world_2",
            x = 768, y = 544,
            tex_normal = "map/w2_b",
            tex_over   = "map/w2_b_a",
            tex_push   = "map/w2_b_a",
            tex_locked = "map/w2_d",
            on_click = function()
                if GetCount("curr_garden") ~= 2 then
                    EnableWindow("world_1_levels", false);
                    EnableWindow("world_2_levels", true);
                    EnableWindow("world_3_levels", false);
                    EnableWindow("world_4_levels", false);
                    EnableWindow("world_5_levels", false);
                    bmp_active_SetPosition(800, 550);
                    SetItemCount("curr_garden", 2);
                    GM_StartPersistentAction("Map2");
                end;
            end,
            actions = {"Map1","Map3","Map4","Map5"},
            context = {"garden_2_progress",},
            context_change = function(item, old_val, new_val)
                btn_world_2_SetLocked(GetCount("garden_2_progress") == 0);
            end,
            rect = "-100,-64;-155,-17;-143,63;-48,116;165,113;257,11;212,-99;77,-89;45,-132;-98,-122;",
            layer_click = 4,
            snd_click = kMenuButtonSound,
            snd_over = kMenuRolloverSound,
        },
        ButtonVisual
        {
            name = "btn_world_1",
            x = 365, y = 549,
            tex_normal = "map/w1_b",
            tex_over   = "map/w1_b_a",
            tex_push   = "map/w1_b_a",
            tex_locked = "map/w1_b",
            on_create = function()
                local curr_garden = GetCount("curr_garden");
                if curr_garden == 1 then
                    bmp_active_SetPosition(200, 530);
                end;
                if curr_garden == 2 then
                    bmp_active_SetPosition(800, 550);
                end;
                if curr_garden == 3 then
                    bmp_active_SetPosition(512, 384);
                end;
                if curr_garden == 4 then
                    bmp_active_SetPosition(150, 120);
                end;
                if curr_garden == 5 then
                    bmp_active_SetPosition(680, 96);
                end;
            end,
            on_click = function()
                if GetCount("curr_garden") ~= 1 then
                    EnableWindow("world_1_levels", true);
                    EnableWindow("world_2_levels", false);
                    EnableWindow("world_3_levels", false);
                    EnableWindow("world_4_levels", false);
                    EnableWindow("world_5_levels", false);
                    bmp_active_SetPosition(200, 530);
                    SetItemCount("curr_garden", 1);
                    GM_StartPersistentAction("Map1");
                end;
            end,
            actions = {"Map2","Map3","Map4","Map5"},
            rect = "-364,-142;-308,-137;-215,-147;-98,-124;-13,-62;40,-69;75,-49;72,31;-13,81;-205,78;-367,48;",
            layer_click = 5,
            snd_click = kMenuButtonSound,
            snd_over = kMenuRolloverSound,
        },
        
        BitmapVisual
        {
            name="bmp_active",
            image="map/active",
            x = 2000, y = 0,
            blendmode = "additive",


            WndFxSprite
            {
                name = "eden_fx",
                x = 0,
                y = 0,
                w = 330,
                h = 330,
                effect_position = "165,165",
                file_name = "fx/map/eden_sparkles.lua",
                start_activate = true,
                advance = 50,
                timer_settings = {
                    name = "ui",
                    category = "UI",
                },
            },

            ButtonVisual
            {
                name="bmp_eden",
                image="map/eden",
                x = 165, y = 165,
                snd_click = kMenuButtonSound,
                snd_over = kMenuRolloverSound,
                tex_normal = "map/eden",
                tex_over   = "map/eden_a",
                tex_push   = "map/eden_p",
                tex_disabled = "map/eden",
                tex_locked = "map/eden",
                actions = {"Map1","Map2","Map3","Map4","Map5"},
                layer_click = 100,
                rect = "28,69;33,17;20,-16;24,-52;18,-65;3,-72;-14,-66;-27,-54;-25,-23;-34,-12;-38,13;-47,27;-46,48;-25,69;",
                on_click = function()
                    fn_Play();
                end,
            },
        },
        WndTextureScroller
        {
            name = "clouds_1",
            x = 0,
            y = 600,
            w = 1024,
            h = 210,
            tex_name = "map/cloud_1",
            scroll_speed = "102,0",
            timer_settings = {
                name = "ui",
                category = "UI",
            },
        },
        BitmapVisual
        {
            name="world_1_levels",
            image="map/world_1/panel",
            x = 512, y = 693,
            
            BitmapVisual
            {
                name = "g1_selector",
                x = 0,
                y = 300,
                blendmode = "additive",
                image = "map/selector",
            },
            
            SpawnLevel("g1_q1",  215, kQuestButtonY, 1,  1, "g1_top_quest"),
            SpawnLevel("g1_q2",  260, kQuestButtonY, 2,  1, "g1_top_quest"),
            SpawnLevel("g1_q3",  305, kQuestButtonY, 3,  1, "g1_top_quest"),
            SpawnLevel("g1_q4",  350, kQuestButtonY, 4,  1, "g1_top_quest"),
            SpawnLevel("g1_q5",  395, kQuestButtonY, 5,  1, "g1_top_quest"),
            SpawnLevel("g1_q6",  440, kQuestButtonY, 6,  1, "g1_top_quest"),
            SpawnLevel("g1_q7",  485, kQuestButtonY, 7,  1, "g1_top_quest"),
            SpawnLevel("g1_q8",  530, kQuestButtonY, 8,  1, "g1_top_quest"),
            SpawnLevel("g1_q9",  575, kQuestButtonY, 9,  1, "g1_top_quest"),
            SpawnLevel("g1_q10", 620, kQuestButtonY, 10, 1, "g1_top_quest"),
            SpawnLevel("g1_q11", 665, kQuestButtonY, 11, 1, "g1_top_quest"),
            SpawnLevel("g1_q12", 710, kQuestButtonY, 12, 1, "g1_top_quest"),
            SpawnLevel("g1_q13", 755, kQuestButtonY, 13, 1, "g1_top_quest"),
            SpawnLevel("g1_q14", 800, kQuestButtonY, 14, 1, "g1_top_quest"),
            
            SetStyle(TextStyle),
            CreateOndineText(30, CaptionBrown, kCenter+1, 36, "#"..GetString("caption_outline", GetString("garden_1_name")), 350, 30),
            CreateOndineText(30, CaptionYellow, kCenter, 35, "#"..GetString("caption_outline", GetString("garden_1_name")), 350, 30),
        },
        BitmapVisual
        {
            name="world_2_levels",
            image="map/world_2/panel",
            x = 512, y = 693,
            
            BitmapVisual
            {
                name = "g2_selector",
                x = 0,
                y = 300,
                blendmode = "additive",
                image = "map/selector",
            },
            
            SpawnLevel("g2_q1",  215, kQuestButtonY, 1,  2, "g2_top_quest"),
            SpawnLevel("g2_q2",  260, kQuestButtonY, 2,  2, "g2_top_quest"),
            SpawnLevel("g2_q3",  305, kQuestButtonY, 3,  2, "g2_top_quest"),
            SpawnLevel("g2_q4",  350, kQuestButtonY, 4,  2, "g2_top_quest"),
            SpawnLevel("g2_q5",  395, kQuestButtonY, 5,  2, "g2_top_quest"),
            SpawnLevel("g2_q6",  440, kQuestButtonY, 6,  2, "g2_top_quest"),
            SpawnLevel("g2_q7",  485, kQuestButtonY, 7,  2, "g2_top_quest"),
            SpawnLevel("g2_q8",  530, kQuestButtonY, 8,  2, "g2_top_quest"),
            SpawnLevel("g2_q9",  575, kQuestButtonY, 9,  2, "g2_top_quest"),
            SpawnLevel("g2_q10", 620, kQuestButtonY, 10, 2, "g2_top_quest"),
            SpawnLevel("g2_q11", 665, kQuestButtonY, 11, 2, "g2_top_quest"),
            SpawnLevel("g2_q12", 710, kQuestButtonY, 12, 2, "g2_top_quest"),
            SpawnLevel("g2_q13", 755, kQuestButtonY, 13, 2, "g2_top_quest"),
            SpawnLevel("g2_q14", 800, kQuestButtonY, 14, 2, "g2_top_quest"),
            
            SetStyle(TextStyle),
            CreateOndineText(30, CaptionBrown, kCenter+1, 36, "#"..GetString("caption_outline", GetString("garden_2_name")), 350, 30),
            CreateOndineText(30, CaptionYellow, kCenter, 35, "#"..GetString("caption_outline", GetString("garden_2_name")), 350, 30),
        },
        BitmapVisual
        {
            name="world_3_levels",
            image="map/world_3/panel",
            x = 512, y = 693,
            
            BitmapVisual
            {
                name = "g3_selector",
                x = 0,
                y = 300,
                blendmode = "additive",
                image = "map/selector",
            },
            
            SpawnLevel("g3_q1",  215, kQuestButtonY, 1,  3, "g3_top_quest"),
            SpawnLevel("g3_q2",  260, kQuestButtonY, 2,  3, "g3_top_quest"),
            SpawnLevel("g3_q3",  305, kQuestButtonY, 3,  3, "g3_top_quest"),
            SpawnLevel("g3_q4",  350, kQuestButtonY, 4,  3, "g3_top_quest"),
            SpawnLevel("g3_q5",  395, kQuestButtonY, 5,  3, "g3_top_quest"),
            SpawnLevel("g3_q6",  440, kQuestButtonY, 6,  3, "g3_top_quest"),
            SpawnLevel("g3_q7",  485, kQuestButtonY, 7,  3, "g3_top_quest"),
            SpawnLevel("g3_q8",  530, kQuestButtonY, 8,  3, "g3_top_quest"),
            SpawnLevel("g3_q9",  575, kQuestButtonY, 9,  3, "g3_top_quest"),
            SpawnLevel("g3_q10", 620, kQuestButtonY, 10, 3, "g3_top_quest"),
            SpawnLevel("g3_q11", 665, kQuestButtonY, 11, 3, "g3_top_quest"),
            SpawnLevel("g3_q12", 710, kQuestButtonY, 12, 3, "g3_top_quest"),
            SpawnLevel("g3_q13", 755, kQuestButtonY, 13, 3, "g3_top_quest"),
            SpawnLevel("g3_q14", 800, kQuestButtonY, 14, 3, "g3_top_quest"),
            
            SetStyle(TextStyle),
            CreateOndineText(30, CaptionBrown, kCenter+1, 36, "#"..GetString("caption_outline", GetString("garden_3_name")), 350, 30),
            CreateOndineText(30, CaptionYellow, kCenter, 35, "#"..GetString("caption_outline", GetString("garden_3_name")), 350, 30),
        },
        BitmapVisual
        {
            name="world_4_levels",
            image="map/world_4/panel",
            x = 512, y = 693,
            
            BitmapVisual
            {
                name = "g4_selector",
                x = 0,
                y = 300,
                blendmode = "additive",
                image = "map/selector",
            },
            
            SpawnLevel("g4_q1",  215, kQuestButtonY, 1,  4, "g4_top_quest"),
            SpawnLevel("g4_q2",  260, kQuestButtonY, 2,  4, "g4_top_quest"),
            SpawnLevel("g4_q3",  305, kQuestButtonY, 3,  4, "g4_top_quest"),
            SpawnLevel("g4_q4",  350, kQuestButtonY, 4,  4, "g4_top_quest"),
            SpawnLevel("g4_q5",  395, kQuestButtonY, 5,  4, "g4_top_quest"),
            SpawnLevel("g4_q6",  440, kQuestButtonY, 6,  4, "g4_top_quest"),
            SpawnLevel("g4_q7",  485, kQuestButtonY, 7,  4, "g4_top_quest"),
            SpawnLevel("g4_q8",  530, kQuestButtonY, 8,  4, "g4_top_quest"),
            SpawnLevel("g4_q9",  575, kQuestButtonY, 9,  4, "g4_top_quest"),
            SpawnLevel("g4_q10", 620, kQuestButtonY, 10, 4, "g4_top_quest"),
            SpawnLevel("g4_q11", 665, kQuestButtonY, 11, 4, "g4_top_quest"),
            SpawnLevel("g4_q12", 710, kQuestButtonY, 12, 4, "g4_top_quest"),
            SpawnLevel("g4_q13", 755, kQuestButtonY, 13, 4, "g4_top_quest"),
            SpawnLevel("g4_q14", 800, kQuestButtonY, 14, 4, "g4_top_quest"),
            
            SetStyle(TextStyle),
            CreateOndineText(30, CaptionBrown, kCenter+1, 36, "#"..GetString("caption_outline", GetString("garden_4_name")), 350, 30),
            CreateOndineText(30, CaptionYellow, kCenter, 35, "#"..GetString("caption_outline", GetString("garden_4_name")), 350, 30),
        },
        BitmapVisual
        {
            name="world_5_levels",
            image="map/world_5/panel",
            x = 512, y = 693,
            
            BitmapVisual
            {
                name = "g5_selector",
                x = 0,
                y = 300,
                blendmode = "additive",
                image = "map/selector",
            },
            
            SpawnLevel("g5_q1",  215, kQuestButtonY, 1,  5, "g5_top_quest"),
            SpawnLevel("g5_q2",  260, kQuestButtonY, 2,  5, "g5_top_quest"),
            SpawnLevel("g5_q3",  305, kQuestButtonY, 3,  5, "g5_top_quest"),
            SpawnLevel("g5_q4",  350, kQuestButtonY, 4,  5, "g5_top_quest"),
            SpawnLevel("g5_q5",  395, kQuestButtonY, 5,  5, "g5_top_quest"),
            SpawnLevel("g5_q6",  440, kQuestButtonY, 6,  5, "g5_top_quest"),
            SpawnLevel("g5_q7",  485, kQuestButtonY, 7,  5, "g5_top_quest"),
            SpawnLevel("g5_q8",  530, kQuestButtonY, 8,  5, "g5_top_quest"),
            SpawnLevel("g5_q9",  575, kQuestButtonY, 9,  5, "g5_top_quest"),
            SpawnLevel("g5_q10", 620, kQuestButtonY, 10, 5, "g5_top_quest"),
            SpawnLevel("g5_q11", 665, kQuestButtonY, 11, 5, "g5_top_quest"),
            SpawnLevel("g5_q12", 710, kQuestButtonY, 12, 5, "g5_top_quest"),
            SpawnLevel("g5_q13", 755, kQuestButtonY, 13, 5, "g5_top_quest"),
            SpawnLevel("g5_q14", 800, kQuestButtonY, 14, 5, "g5_top_quest"),
            
            SetStyle(TextStyle),
            CreateOndineText(30, CaptionBrown, kCenter+1, 36, "#"..GetString("caption_outline", GetString("garden_5_name")), 350, 30),
            CreateOndineText(30, CaptionYellow, kCenter, 35, "#"..GetString("caption_outline", GetString("garden_5_name")), 350, 30),
        },

        SetStyle(ButtonStyle),
        Button
        {
            font = CreateNamedFont(MinionSbItSymbolSet, 28, ButtonBrown),
            graphics = UIButtonGraphics,
            sound = kMenuButtonSound,
            rolloversound = kMenuRolloverSound,
            flags = kVAlignCenter + kHAlignCenter,
            mask = "buttons/uibutton_alfa",
            label = "back",
            name = "back",
            command = function()
                SwapToModal("scripts/mainmenu.lua");
            end,
            x = 6,
            y = 680,
        },
        Button
        {
            font = CreateNamedFont(MinionSbItSymbolSet, 28, ButtonBrown),
            graphics = UIButtonGraphics,
            sound = kMenuButtonSound,
            rolloversound = kMenuRolloverSound,
            flags = kVAlignCenter + kHAlignCenter,
            label = "play_continue",
            name = "play",
            mask = "buttons/uibutton_alpha",
            command = function()
                fn_Play();
            end,
            x = 872,
            y = 680,
        },
        
        WndFxSprite
        {
            name = "path_12",
            x = 0,
            y = 0,
            w = 1024,
            h = 768,
            effect_position = "0,0",
            file_name = "fx/map/path_12.lua",
            start_activate = true,
            advance = 50,
            timer_settings = {
                name = "ui",
                category = "UI",
            },
        },

        WndFxSprite
        {
            name = "path_23",
            x = 0,
            y = 0,
            w = 1024,
            h = 768,
            effect_position = "0,0",
            file_name = "fx/map/path_23.lua",
            start_activate = true,
            advance = 50,
            timer_settings = {
                name = "ui",
                category = "UI",
            },
        },

        WndFxSprite
        {
            name = "path_34",
            x = 0,
            y = 0,
            w = 1024,
            h = 768,
            effect_position = "0,0",
            file_name = "fx/map/path_34.lua",
            start_activate = true,
            advance = 50,
            timer_settings = {
                name = "ui",
                category = "UI",
            },
        },

        WndFxSprite
        {
            name = "path_45",
            x = 0,
            y = 0,
            w = 1024,
            h = 768,
            effect_position = "0,0",
            file_name = "fx/map/path_45.lua",
            start_activate = true,
            advance = 50,
            timer_settings = {
                name = "ui",
                category = "UI",
            },
        },

        -- top left corner
        Bitmap
        {
            image="map/rama_top",
            x = 32, y = 0,
        },
        Bitmap
        {
            image="map/rama_left",
            x = 0, y = 0,
        },
        -- top right corner
        Bitmap
        {
            image="map/rama_top",
            x = 512, y = 0,
            hflip = true,
        },
        
        Bitmap
        {
            image="map/rama_left",
            x = 992, y = 0,
            hflip = true,
        },
        -- bottom left corner
        Bitmap
        {
            image="map/rama_top",
            x = 32, y = 736,
            vflip = true,
        },
        Bitmap
        {
            image="map/rama_left",
            x = 0, y = 384,
            vflip = true,
        },
        -- bottom right corner
        Bitmap
        {
            image="map/rama_top",
            x = 512, y = 736,
            vflip = true,
            hflip = true,
        },
        Bitmap
        {
            image="map/rama_left",
            x = 992, y = 384,
            vflip = true,
            hflip = true,
        },

    },
};
