GameScreen.textures_path = "graphics/screens/29_studio/location/"

function GameScreen:RestoreScene()
    if(GetState(CURRENT_SCREEN, "state") == "") then
        local comics_finish = function()
            self.comics = nil;
            SetState(CURRENT_SCREEN, "state", "ho")
            DelayedExec(1.0, function()
                self:StartHO();
            end, 113)
        end
        self.comics = clScreenManager:add_screen("029_artist_dlg1") 
	
        self.comics.on_finish = comics_finish;
    elseif(GetState(CURRENT_SCREEN, "state") == "ho") then
        self:StartHO();
    elseif(GetState(CURRENT_SCREEN, "state") == "mg") then
        clApplication:LoadLocation("mg_029_portrait")
    elseif(GetState(CURRENT_SCREEN, "state") == "dialog") then  
        SetState(CURRENT_SCREEN, "state", "finish")
        local comics_finish = function()
            clApplication:LoadLocation("030_orchard")
        end
        comics = clScreenManager:add_screen("029_artist_dlg2") 
        comics.on_finish = comics_finish;
    elseif(GetState(CURRENT_SCREEN, "state") == "finish") then   
        clApplication:LoadLocation("030_orchard")
    end
    
    for found_item in string.gmatch(GetState(CURRENT_SCREEN, "found_obj"), "[_%a%d]+") do
		ItemRemove(self.name, found_item)
		ItemRemove(self.name, found_item.."shadow")
    end 
end


function GameScreen:InitScreen()
    self:LoadScreen()       
         
    self:RestoreScene();
    
    
    self:AddHiddenCrystal("crystal_29_part")
    
    self:SetItemSound("bird", {"sound/bird_01.ogg", "sound/bird_02.ogg"});
    self:SetItemSound("metal_pot", "sound/metal_pot_24.ogg");
    self:SetItemSound("bottle_01", "sound/bottle_02.ogg");
    self:SetItemSound("bottle_02", "sound/bottle_03.ogg");
    self:SetItemSound("bottle_03", "sound/bottle_01.ogg");
    self:SetItemSound("bottle_04", "sound/bottle_08.ogg");
    self:SetItemSound("bottle_05", "sound/bottle_05.ogg");
    self:SetItemSound("bottle_06", "sound/bottle_07.ogg");
    
    MusicPlay({"sound/ambient/15_25_29_ambient.ogg", "sound/music/past.ogg"} , 29) 
end

---------------------------------------------------------------------
function GameScreen:StartHO()
    local ho_end = function()  
        self.mini_game = nil;
        local tip_end = function()
            SetState(CURRENT_SCREEN, "state", "mg") 
            clApplication:LoadLocation("mg_029_portrait")
        end
        HUDScreen:ShowTips({path = self.textures_path.."Text_29", x = 310, y = 1112, end_fun = tip_end})
        
    end

    self.item_list = {
        {obj = {"chisel", {x = 949, y = 409}}, },
        {obj = {"glasses", {x = 64, y = 199}}, },
        {obj = {"hourglass", {x = 434, y = 172}}, },
        {obj = {"rag", {x = 1443, y = 446}}, hint = {x = 1433, y = 437}},
        {obj = {"canvas", {x = 935, y = 0}}, hint = {x = 927, y = 0}},
        {obj = {"butterfly", {x = 669, y = 801}} },
        {obj = {"palette_knife", {x = 1034, y = 852}}, },
        {obj = {"charcoal", {x = 286, y = 817}}, },
        {obj = {"pestle", {x = 466, y = 1118}}, hint = {x = 457, y = 1110}},
        {obj = {"mortar", {x = 1251, y = 1015}}, },
        {obj = {"palette", {x = 775, y = 905}}, hint = {x = 766, y = 896}},
        {obj = {"paintbrush", {x = 1451, y = 554}}, hint = {x = 1442, y = 545}},
     }
    
    self:SetMiniGame(mgt_hidden_object)   
    self.mini_game:Init(self.item_list, ho_end);
end

function GameScreen:onObjectClick(item_name)
    if(item_name == "diadem_fake" and GetState(CURRENT_SCREEN, "state") == "ho") then
        clApplication:LoadLocation("mg_028_diadem")
    end
end
------------------------------------------------------------------------------------------------------
-------------------------------------------Mouse functions--------------------------------------------
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
function GameScreen:LoadScreen()
	--[[---Background---]]--
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "29_studio", "graphics/screens/29_studio/location/29_studio",0, 0);
    
    self:CreateObj(OBJ_TYPE.TRIGGER, "bird", "graphics/screens/29_studio/location/bird",1385, 337);
    self:CreateObj(OBJ_TYPE.TRIGGER, "vase_flowers", "graphics/screens/29_studio/location/vase_flowers",575, 814);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_01", "graphics/screens/29_studio/location/bottle_01",1520, 753);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_02", "graphics/screens/29_studio/location/bottle_02",395, 132);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_03", "graphics/screens/29_studio/location/bottle_03",287, 79);
    self:CreateObj(OBJ_TYPE.TRIGGER, "metal_pot", "graphics/screens/29_studio/location/metal_pot",174, 125);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_04", "graphics/screens/29_studio/location/bottle_04",137, 31);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_05", "graphics/screens/29_studio/location/bottle_05",61, 24);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_06", "graphics/screens/29_studio/location/bottle_06",2, 28);
    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "chisel", "graphics/screens/29_studio/location/chisel_part",1017, 429);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "glasses", "graphics/screens/29_studio/location/glasses_part",172, 184);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "hourglass", "graphics/screens/29_studio/location/hourglass_part",449, 196);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "rag_shadow", "graphics/screens/29_studio/location/rag_shadow",1471, 513);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "rag", "graphics/screens/29_studio/location/rag_part",1479, 496);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "canvas", "graphics/screens/29_studio/location/canvas_part",1025, 0);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "butterfly", "graphics/screens/29_studio/location/butterfly_part",734, 853);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "palette_knife", "graphics/screens/29_studio/location/palette_knife_part",1091, 982);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "charcoal", "graphics/screens/29_studio/location/charcoal_part",321, 853);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "pestle", "graphics/screens/29_studio/location/pestle_part",462, 1150);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "mortar", "graphics/screens/29_studio/location/mortar_part",1250, 1076);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "palette", "graphics/screens/29_studio/location/palette_part",810, 942);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "paintbrush", "graphics/screens/29_studio/location/paintbrush_part",1470, 609);
    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "crystal_29_part", "graphics/screens/29_studio/location/crystal_29_part",1061, 1118);
        

    clScreenManager:add_screen("hud")   
end

