GameScreen.textures_path = "graphics/screens/28_cloakroom/location/"

function GameScreen:RestoreScene()
    if(GetState(CURRENT_SCREEN, "state") == "") then
        self:SetItemCursor("diadem_fake", "eye")
        SetState(CURRENT_SCREEN, "state", "ho")
        self:StartHO();
        
    elseif(GetState(CURRENT_SCREEN, "state") == "ho") then
         self:SetItemCursor("diadem_fake", "eye")
        self:StartHO();
        if(GetState(CURRENT_SCREEN, "diadem") == "creating") then
            SetState("screen_028_cloakroom", "diadem", "created")
            self:RemoveItem("diadem_fake")
            DelayedExec(0.1, function()
                self:OnClick("diadem")
            end, 113)
        end
    elseif(GetState(CURRENT_SCREEN, "state") == "finish") then   
        clApplication:LoadLocation("Intro_05")
    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:ZoomZoneLink("cupboard_eye", "028_cloakroom_zoom", "eye");
    
    self:AddHiddenCrystal("crystal_28_part")
    
    self:SetItemSound("mirror", "sound/glass_tap.ogg");
    self:SetItemSound("jug", "sound/metalware_02.ogg");
    self:SetItemSound("vial_02", "sound/metal_hit_28.ogg");
    self:SetItemSound("vial_01", "sound/perfume_28.ogg");
    
    MusicPlay({"sound/music/past.ogg", "sound/ambient/19_ambient.ogg"} , 28) 
end

---------------------------------------------------------------------
function GameScreen:StartHO()
    local ho_end = function()  
        self.mini_game = nil;
        SetState(CURRENT_SCREEN, "ho", "completed") 
        DelayedExec(2.0, function()
                  clApplication:LoadLocation("Intro_05")
        end)
    end

    self.item_list = {
        {obj = {"glove_02", {x = 990, y = 718}}, },
        {obj = {"glove_01", {x = 0, y = 168}}, },
        {obj = {"slipper_02", {x = 902, y = 1051}}, },
        {obj = {"slipper_01", {x = 572, y = 292}}, },
        {obj = {"brooch", {x = 634, y = 1027}},},
        {obj = {"earring_02", {x = 1482, y = 625}}, },
        {obj = {"earring_01", {x = 1088, y = 797}}, },
        {obj = {"feather", {x = 798, y = 34}}, },
        {obj = {"dress", {x = 526, y = 440}}, },
        {obj = {"necklace", {x = 282, y = 829}}, },
        {obj = {"veil", {x = 763, y = 289}}, },
        {obj = {"bracelet_01", {x = 1030, y = 902}}, },
        {obj = {"bracelet_02", {x = 1445, y = 104}}, },
        {obj = {"belt", {x = 429, y = 236}}, },
        {obj = {"diadem", {x = 361, y = 666}}, },
        {obj = {"corset", {x = 698, y = 270}}, zoom = {"028_cloakroom_zoom", "cupboard_hint", 487, 502}},
    }
    
    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, "28_cloakroom", "graphics/screens/28_cloakroom/location/28_cloakroom", 0, 0);
	
    self:CreateObj(OBJ_TYPE.TRIGGER, "mirror", "graphics/screens/28_cloakroom/location/mirror", 1255, 69);
    self:CreateObj(OBJ_TYPE.TRIGGER, "vial_02", "graphics/screens/28_cloakroom/location/vial_02", 1405, 508);
    self:CreateObj(OBJ_TYPE.TRIGGER, "jug", "graphics/screens/28_cloakroom/location/jug", 1149, 731);
    self:CreateObj(OBJ_TYPE.TRIGGER, "vial_01", "graphics/screens/28_cloakroom/location/vial_01", 989, 748);
    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "crystal_28_part", "graphics/screens/28_cloakroom/location/crystal_28_part", 1424, 853);
    
    self:CreateObj(OBJ_TYPE.TRIGGER, "cupboard_eye", "graphics/screens/28_cloakroom/location/cupboard_eye", 503, 515);
    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "glove_02", "graphics/screens/28_cloakroom/location/glove_02_part", 1018, 735);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "glove_01", "graphics/screens/28_cloakroom/location/glove_01_part", 2, 209); 
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "slipper_02", "graphics/screens/28_cloakroom/location/slipper_02_part", 938, 1115); 
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "slipper_01", "graphics/screens/28_cloakroom/location/slipper_01_part", 594, 385);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "belt", "graphics/screens/28_cloakroom/location/belt_part", 542, 187);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "bracelet_01", "graphics/screens/28_cloakroom/location/bracelet_01_part", 1073, 920);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "bracelet_02", "graphics/screens/28_cloakroom/location/bracelet_02_part", 1491, 124);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "veil", "graphics/screens/28_cloakroom/location/veil_part", 779, 319);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "necklace", "graphics/screens/28_cloakroom/location/necklace_part", 308, 817);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "dress", "graphics/screens/28_cloakroom/location/dress_part", 618, 512);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "feather", "graphics/screens/28_cloakroom/location/feather_part", 817, 73);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "brooch", "graphics/screens/28_cloakroom/location/brooch_part", 672, 1048);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "earring_02", "graphics/screens/28_cloakroom/location/earring_02_part", 1541, 670);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "earring_01", "graphics/screens/28_cloakroom/location/earring_01_part", 1106, 837);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "diadem", "graphics/screens/28_cloakroom/location/diadem_part", 419, 688);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "diadem_fake", "graphics/screens/28_cloakroom/location/diadem_part", 419, 688);
    
    clScreenManager:add_screen("hud")   
end

