function OnSceneLoad(screen)
    game_state = {}
    LoadData(screen)
    local pf = play_field
    local level = pf:GetLevelScreen()
    game_state.custom_cursors = {}
    game_state.locked_objects = {}
    game_state.active_objects = {}
	
	play_field:GetObject('impuls'):GetAnimation():SetMode(HGEANIM_FWD + HGEANIM_NOLOOP)
	play_field:GetObject('impuls'):GetAnimation():Stop();
	play_field:GetObject('impuls'):SetOpacity(0)
	play_field:GetObject('cover'):GetAnimation():SetMode(HGEANIM_FWD + HGEANIM_NOLOOP)
	play_field:GetObject('cover'):GetAnimation():Stop();
	play_field:GetObject('cover'):SetOpacity(0)
	--play_field:GetObject('reel_scaled'):SetOpacity(0)

		
	game_state.locker = ReferenceCounter()
    game_state.active_zone = nil
	
	local af = CreateAnimationEffector()
	local obj = play_field:GetObject('turtle1')
	local duration = GetAnimationLength(obj:GetAnimation())
	af:SetMode(_ANIM_LOOP)
	af:SetKey(_TRACK_O, 0, 0)
	af:SetKey(_TRACK_O, duration * 5 - 0.001, 0)
	af:SetKey(_TRACK_O, duration * 5, 1)
	af:SetKey(_TRACK_O, duration * 6, 1)
	af:SetKey(_TRACK_O, duration * 6 + 0.001, 0)
	af:AttachTo(obj)
	af:Play()
	
	local af = CreateAnimationEffector()
	local obj = play_field:GetObject('turtle2')
	local duration = GetAnimationLength(obj:GetAnimation())
	af:SetMode(_ANIM_LOOP)
	af:SetKey(_TRACK_O, 0, 0)
	af:SetKey(_TRACK_O, duration * 4 - 0.001, 0)
	af:SetKey(_TRACK_O, duration * 4, 1)
	af:SetKey(_TRACK_O, duration * 5, 1)
	af:SetKey(_TRACK_O, duration * 5 + 0.001, 0)
	af:AttachTo(obj)
	af:Play()
	
	play_field:GetObject('reel_small'):SetOpacity(0)
	game_state.meta_object = 'cigar5'
end

function OnScreenShown()
end

function OnSceneFree()
    FreeData()
end

function OnUpdate(dt)
end

function OnNotebookOpened()
    --OnSceneStateChanged(play_field)
end


function OnWinConditionsComplete()
end

function OnExit()
end

function OnObjectMouseEnter(object)
    DefaultOnObjectMouseEnter(object)
end

function OnObjectMouseLeave(object)
    DefaultOnObjectMouseLeave(object)
end

function OnObjectMouseDown(object)
    obj_name = object:GetName()
    local pf = play_field
    local is_wrong_click = true
	
    is_wrong_click = DefaultOnObjectMouseDown(object, play_field)

    if is_wrong_click then
        --pf:ShowWrongObjectEffect()
    end
    
    return is_wrong_click;    
end

function OnObjectMouseUp(object)
end

function OnObjectWillBeFound(object)
end

function OnObjectWasFound(object)
end

function OnToolFound(tool)
end

function OnToolApply(tool, object)
    DefaultOnToolApply(tool, object)    
end

function OnObjectReachPanel(object)
end

function OnButtonPress(title)
    DefaultOnButtonPress(title)
end

function OnMouseMove(previous_pos, current_pos)
end

function OnSetTool(tool)
end

function CanBeHinted(obj)
    if locked_object[obj] ~= true then
        return true
    else
        return false
    end
end

function OnLostFocus()
end

function OnGainFocus()
end

function OnMinigameCompleted()
end

-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function LoadData(screen)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Layers/bg.jpg',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bg',anim,512,384,80,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Animations/tvset.dds',0,0,93,76,2,10)
	anim:SetHotSpot(47,38)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('tvset',anim,804,259,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Animations/tvset2.dds',0,0,106,88,86,10)
	anim:SetHotSpot(53,44)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('tvset2',anim,611,240,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Animations/tvset3.dds',0,0,100,75,48,10)
	anim:SetHotSpot(50,38)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('tvset3',anim,468,250,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Comics/Sheriff.dds',0,0,532,636,1,0)
	anim:SetHotSpot(266,256)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('Sheriff',anim,734,390,200,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/pixel.jpg',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('pixel',anim,512,384,401,0,128,96)
	local anim = CreateAnimation('data/Texture/Scenes/Common/pixel.jpg',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('pixel1',anim,512,384,401,0,128,96)
	local anim = CreateAnimation('data/Texture/Comics/Museum_director.dds',0,0,504,756,1,0)
	anim:SetHotSpot(252,378)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('Museum_director',anim,454,397,200,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/pixel.jpg',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('pixel2',anim,512,384,401,0,128,96)
	local anim = CreateAnimation('data/Texture/Comics/eyes.png',0,0,79,33,1,0)
	anim:SetHotSpot(39,16)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('eyes',anim,499,212,500,0,1,1)
	local anim = CreateAnimation('data/Texture/Comics/eye_md.png',0,0,20,21,1,0)
	anim:SetHotSpot(10,10)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('eye_md',anim,506,237,202,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/pixel.jpg',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('reel_holder',anim,407,346,140,0,12,9)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/glove.png',0,0,85,50,1,0)
	anim:SetHotSpot(42,25)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('glove',anim,502,456,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/screwdriver.png',0,0,76,14,1,0)
	anim:SetHotSpot(38,7)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('screwdriver',anim,727,296,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/belt.png',0,0,49,123,1,0)
	anim:SetHotSpot(24,61)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('belt',anim,226,679,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Layers/sprait_podzornoy_truby.png',0,0,71,75,1,0)
	anim:SetHotSpot(35,37)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('sprait_podzornoy_truby',anim,203,626,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/bowknot.png',0,0,37,42,1,0)
	anim:SetHotSpot(18,21)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bowknot',anim,401,750,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/cherries.png',0,0,37,52,1,0)
	anim:SetHotSpot(18,26)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('cherries',anim,242,83,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/clothespin.png',0,0,31,37,1,0)
	anim:SetHotSpot(15,18)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('clothespin',anim,302,210,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/fork.png',0,0,33,64,1,0)
	anim:SetHotSpot(16,32)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('fork',anim,323,717,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/hourglass.png',0,0,26,50,1,0)
	anim:SetHotSpot(13,25)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('hourglass',anim,572,164,115,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/lightbulb.png',0,0,60,35,1,0)
	anim:SetHotSpot(30,17)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('lightbulb',anim,947,81,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/matches.png',0,0,55,39,1,0)
	anim:SetHotSpot(27,19)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('matches',anim,729,757,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/onion.png',0,0,33,42,1,0)
	anim:SetHotSpot(16,21)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('onion',anim,899,566,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/ruler.png',0,0,79,31,1,0)
	anim:SetHotSpot(39,15)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('ruler',anim,815,397,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/stick.png',0,0,37,133,1,0)
	anim:SetHotSpot(18,66)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('stick',anim,308,382,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/sword.png',0,0,115,277,1,0)
	anim:SetHotSpot(57,138)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('sword',anim,799,556,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Layers/sprait_polki.png',0,0,93,24,1,0)
	anim:SetHotSpot(46,12)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('sprait_polki',anim,943,101,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Layers/sprait_stula.png',0,0,30,59,1,0)
	anim:SetHotSpot(15,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('sprait_stula',anim,552,455,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Layers/sprait_vazy_2.png',0,0,87,198,1,0)
	anim:SetHotSpot(43,99)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('sprait_vazy_2',anim,780,600,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Animations/displayfinal.dds',0,0,100,70,70,10)
	anim:SetHotSpot(50,35)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('displayfinal',anim,610,239,99,0,1.15,1.15)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Animations/turtle2.png',0,0,332,240,23,8)
	anim:SetHotSpot(166,120)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('turtle2',anim,695,119,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Animations/turtle1.png',0,0,182,222,25,8)
	anim:SetHotSpot(91,111)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('turtle1',anim,778,190,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Animations/blick1.png',0,0,99,69,2,10)
	anim:SetHotSpot(49,35)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('blick1',anim,455,330,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Animations/blick2.png',0,0,85,92,2,10)
	anim:SetHotSpot(43,46)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('blick2',anim,797,352,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Animations/blick3.png',0,0,143,91,2,10)
	anim:SetHotSpot(71,46)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('blick3',anim,622,343,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Layers/bottle.png',0,0,16,72,1,0)
	anim:SetHotSpot(8,36)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bottle',anim,468,358,117,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Layers/sprait_lampochek.png',0,0,64,30,1,0)
	anim:SetHotSpot(32,15)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('sprait_lampochek',anim,393,381,151,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/pixel.jpg',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('control_panel_active_zone',anim,656,372,100,0,13,5)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Animations/impuls.png',0,0,96,47,12,10)
	anim:SetHotSpot(48,24)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('impuls',anim,409,347,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Animations/cover.png',0,0,126,147,6,10)
	anim:SetHotSpot(63,74)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('cover',anim,409,313,112,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Zoom/zoom_bak.jpg',0,0,640,480,1,0)
	anim:SetHotSpot(320,240)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('zoom_bak',anim,512,384,200,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Zoom/accu_active_zone.png',0,0,229,273,1,0)
	anim:SetHotSpot(114,136)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('accu_active_zone',anim,717,460,201,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Zoom/horseshoe.png',0,0,92,75,1,0)
	anim:SetHotSpot(46,37)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('horseshoe',anim,379,177,201,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Zoom/sprait_podkovy.png',0,0,100,100,1,0)
	anim:SetHotSpot(50,50)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('sprait_podkovy',anim,368,173,204,0,0.63,0.63)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Zoom/reel_over.png',0,0,135,165,1,0)
	anim:SetHotSpot(67,82)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('reel_over',anim,429,398,205,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Zoom/reel.png',0,0,127,116,1,0)
	anim:SetHotSpot(63,58)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('reel',anim,442,389,204,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/pixel.jpg',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('monitor',anim,406,346,145,0,12,9)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/wrench.png',0,0,100,37,1,0)
	anim:SetHotSpot(50,18)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('wrench',anim,378,633,100,30,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Layers/reel_small.png',0,0,88,58,1,0)
	anim:SetHotSpot(44,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('reel_small',anim,410,353,113,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/nail.png',0,0,39,17,1,0)
	anim:SetHotSpot(19,8)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('nail',anim,1008,614,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/apple.png',0,0,28,30,1,0)
	anim:SetHotSpot(14,15)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('apple',anim,536,283,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/blinkenlight.png',0,0,35,42,1,0)
	anim:SetHotSpot(17,21)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('blinkenlight',anim,681,306,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/heart.png',0,0,53,59,1,0)
	anim:SetHotSpot(26,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('heart',anim,913,290,100,0,0.8,0.8)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/Items/turtle.png',0,0,64,50,1,0)
	anim:SetHotSpot(32,25)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('turtle',anim,447,603,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/5_ guard_room_2/cigar5.png',0,0,135,98,1,0)
	anim:SetHotSpot(67,49)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('cigar5',anim,963,433,100,0,1,1)
end

function FreeData(screen)
end
-- CLEAR_ON_SAVE_END
