GameScreen.textures_path = "graphics/screens/21_wood/location/"

function GameScreen:RestoreScene()
    if(GetState(CURRENT_SCREEN, "ho") == "") then
        SetState(CURRENT_SCREEN, "ho", "active")
        clScreenManager:add_screen("hud")   
        ItemSetOpacity(HUDScreen.name, 0.0)
    
        local comics_finish = function()
            self.comics = nil;
            SetState(CURRENT_SCREEN, "ho", "active")
            ItemChangeOpacity(HUDScreen.name, 1.0, 0.5)
            DelayedExec(1.0, function()
                self:StartHO();
            end, 113)
        end
        self.comics = clScreenManager:add_screen("021_eve_villager_dlg") 	
        self.comics.on_finish = comics_finish;
        
    elseif(GetState(CURRENT_SCREEN, "ho") == "active") then
        clScreenManager:add_screen("hud")
        self:StartHO();
    elseif(GetState(CURRENT_SCREEN, "ho") == "completed") then   
        clApplication:LoadLocation("022_soup")
    end
    
    for found_item in string.gmatch(GetState(CURRENT_SCREEN, "found_obj"), "[_%a%d]+") do
		ItemRemove(self.name, found_item)
    end 
end


function GameScreen:InitScreen()
    self:LoadScreen()       
         
    self:RestoreScene();
    
    self:AddHiddenCrystal("crystal_21_part")
    
    self:SetItemSound("creek_splash", "sound/creek_splash.ogg");
    self:SetItemSound("branches_03", "sound/branches_03.ogg");
    self:SetItemSound("branches_01", "sound/branches_01.ogg");
    self:SetItemSound("bottle_08", "sound/bottle_08.ogg");
    self:SetItemSound("woodpecker", "sound/woodpecker.ogg");
    self:SetItemSound("bedpan", "sound/bedpan.ogg");
    self:SetItemSound("barrel_wood_02", "sound/barrel_wood_02.ogg");
    self:SetItemSound("squirrel", "sound/squirrel.ogg");
    self:SetItemSound("rat", "sound/rat.ogg");
    self:SetItemSound("horse", {"sound/horse_neigh.ogg", "sound/horse_breath.ogg"});
        
    MusicPlay({"sound/ambient/21_ambient.ogg", "sound/music/past.ogg"} , 21)
end  
---------------------------------------------------------------------
function GameScreen:StartHO()
    local ho_end = function()  
        self.mini_game = nil;
        SetState(CURRENT_SCREEN, "ho", "completed") 
        DelayedExec(2.0, function()
                  clApplication:LoadLocation("022_soup")
        end)
    end

    self.item_list = {
        {obj = {"pail", {x = 796, y = 583}}, },
        {obj = {"sickle_l21", {x = 409, y = 11}}, },
        {obj = {"chopper", {x = 1059, y = 399}}, },
        {obj = {"tobacco_pipe", {x = 1050, y = 878}}, },
        {obj = {"coin_03", {x = 1392, y = 903}},},
        {obj = {"coin_02", {x = 570, y = 1066}}, },
        {obj = {"coin_01", {x = 317, y =869}}, },
        {obj = {"horseshoe", {x = 815, y = 1024}}, },
        {obj = {"chain", {x = 301, y = 1004}}, },
        {obj = {"doll", {x = 954, y = 638}}, },
        {obj = {"hammer_l21", {x = 1490, y = 682}}, },
        {obj = {"whip", {x = 937, y = 5}}, },
        {obj = {"hat", {x = 1473, y = 224}}, },
        {obj = {"axe_l21", {x = 40, y = 353}}, },
    }

    self:SetMiniGame(mgt_hidden_object)   
    self.mini_game.list_type = 2;
    self.mini_game:Init(self.item_list, ho_end);
end

function GameScreen:OnFinish()
end
------------------------------------------------------------------------------------------------------
-------------------------------------------Mouse functions--------------------------------------------
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
function GameScreen:LoadScreen()
	--[[---Background---]]--
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "21_wood", "graphics/screens/21_wood/location/21_wood", 0, 0);
 
    self:CreateObj(OBJ_TYPE.TRIGGER, "creek_splash", "graphics/screens/21_wood/location/creek_splash", 0, 739);
    self:CreateObj(OBJ_TYPE.TRIGGER, "branches_03", "graphics/screens/21_wood/location/branches_03", 0, 331);
    self:CreateObj(OBJ_TYPE.TRIGGER, "branches_01", "graphics/screens/21_wood/location/branches_01", 1295, 400);
    self:CreateObj(OBJ_TYPE.TRIGGER, "woodpecker", "graphics/screens/21_wood/location/woodpecker", 1111, 163);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bedpan", "graphics/screens/21_wood/location/bedpan", 1233, 1037);
    self:CreateObj(OBJ_TYPE.TRIGGER, "barrel_wood_02", "graphics/screens/21_wood/location/barrel_wood_02", 1000, 897);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_08", "graphics/screens/21_wood/location/bottle_08", 591, 784);
    self:CreateObj(OBJ_TYPE.TRIGGER, "squirrel", "graphics/screens/21_wood/location/squirrel", 1405, 234);
    self:CreateObj(OBJ_TYPE.TRIGGER, "rat", "graphics/screens/21_wood/location/rat", 887, 304);
    self:CreateObj(OBJ_TYPE.TRIGGER, "horse", "graphics/screens/21_wood/location/horse", 391, 424);
    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "crystal_21_part", "graphics/screens/21_wood/location/crystal_21_part",1368, 712);

    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "pail", "graphics/screens/21_wood/location/pail_part",833, 685);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "sickle_l21", "graphics/screens/21_wood/location/sickle_l21_part",453, 31);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "chopper", "graphics/screens/21_wood/location/chopper_part",1119, 433);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "tobacco_pipe", "graphics/screens/21_wood/location/tobacco_pipe_part",1102, 920);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "coin_03", "graphics/screens/21_wood/location/coin_03_part",1427, 945);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "coin_02", "graphics/screens/21_wood/location/coin_02_part",613, 1109);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "coin_01", "graphics/screens/21_wood/location/coin_01_part",354, 918);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "horseshoe", "graphics/screens/21_wood/location/horseshoe_part",862, 1099);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "horseshoe_shadow", "graphics/screens/21_wood/location/horseshoe_shadow",794, 1109);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "chain", "graphics/screens/21_wood/location/chain_part",387, 1090);
    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "hammer_l21_shadow", "graphics/screens/21_wood/location/hammer_l21_shadow",1507, 723);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "hammer_l21", "graphics/screens/21_wood/location/hammer_l21_part",1520, 720);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "whip_shadow", "graphics/screens/21_wood/location/whip_shadow",972, 56);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "whip", "graphics/screens/21_wood/location/whip_part",1013, 48);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "hat", "graphics/screens/21_wood/location/hat_part",1530, 253);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "hat_shadow", "graphics/screens/21_wood/location/hat_shadow",1525, 244);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "axe_l21", "graphics/screens/21_wood/location/axe_l21_part",62, 370);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "doll", "graphics/screens/21_wood/location/doll_part",1000, 690);
end

