function OnSceneLoad(screen)
    LoadData(screen)
    DefaultOnSceneLoad('data/Scenes/18_Apartment_Main.lua', 'quest', 'data/Scenes/13_Crimeplace_Main.lua')
    
    play_field:GetObject('area_ho'   ):SetVisible(false);
    play_field:GetObject('area_glove'):SetVisible(false);
    
    play_field:GetObject('Layer_glove_over'   ):SetOpacity(0.);
    play_field:GetObject('Layer_glove'        ):SetOpacity(0.);
    play_field:GetObject('Layer_cupboard_open'):SetOpacity(0.);
    
    LinkScene(  'area_lock',
                'CursorGlass',
                'data/Scenes/Minigames/18_lock.lua',
                false);
    
    RegisterToolApplyInfo('14_hammer', 'area_cupboard', nil, nil,   function(tool_name)
                                                                        play_field:GetObject('area_cupboard'):SetVisible(false);
                                                                        play_field:GetObject('area_glove'   ):SetVisible(true);
                                                                        
                                                                        play_field:GetObject('Layer_glove_over'   ):ChangeOpacity(0., 1., 0.4);
                                                                        play_field:GetObject('Layer_glove'        ):ChangeOpacity(0., 1., 0.4);
                                                                        play_field:GetObject('Layer_cupboard_open'):ChangeOpacity(0., 1., 0.4);
                                                                        
                                                                        PlaySound('18_HammerApply');
                                                                    end,
                                                                    function(tool_name)
                                                                        play_field:GetObject('area_cupboard'):SetVisible(false);
                                                                        play_field:GetObject('area_glove'   ):SetVisible(true);
                                                                        
                                                                        play_field:GetObject('Layer_glove_over'   ):SetOpacity(1.);
                                                                        play_field:GetObject('Layer_glove'        ):SetOpacity(1.);
                                                                        play_field:GetObject('Layer_cupboard_open'):SetOpacity(1.);
                                                                    end,
                                                                    function()
                                                                        ShowMonolog('C_18_HAMMER_APPLY_HINT', 'C_18_HAMMER_APPLY_HINT');
                                                                    end);
    
    RegisterToolFindInfo('18_glove', 'area_glove',                  function(tool_name)
                                                                        play_field:GetObject('area_glove'):SetVisible(false);
                                                                        
                                                                        local glove = play_field:GetObject('Layer_glove');
                                                                        glove:DestroyChildren();
                                                                        glove:ChangeOpacity(glove:GetOpacity(), 0., 0.2);
                                                                    end,
                                                                    function(tool_name)
                                                                        play_field:GetObject('area_glove' ):SetVisible(false);
                                                                        play_field:GetObject('Layer_glove'):SetOpacity(0.);
                                                                    end);
    
    RegisterToolApplyInfo('18_glove', 'area_glove_apply', nil, nil, function(tool_name)
                                                                        play_field:GetObject('Layer_ladder'    ):ChangeOpacity(1, 0, 0.2);
                                                                        play_field:GetObject('area_glove_apply'):SetVisible(false);
                                                                        
                                                                        FindTool('18_ladder');
                                                                    end,
                                                                    function(tool_name)
                                                                        play_field:GetObject('Layer_ladder'    ):SetOpacity(0);
                                                                        play_field:GetObject('area_glove_apply'):SetVisible(false);
                                                                    end,
                                                                    function()
                                                                        ShowMonolog('C_18_GLOVE_APPLY_HINT', 'C_18_GLOVE_APPLY_HINT')
                                                                    end);
    
    if HasGameState('MiniGameCompleted', '18_lock') then
    
        if HasGameState('ActionCompleted', game_state.scene_path..'(door_open)') then
            play_field:GetObject('Door_close'):SetOpacity(0);
            play_field:GetObject('area_ho'):SetVisible(true);
        else
            AddGameState('ActionCompleted', game_state.scene_path..'(door_open)');
            play_field:GetObject('area_ho'):SetVisible(true);
            
            TimerDoString("play_field:GetObject('Door_close'):ChangeOpacity(1, 0, OPEN_DOOR_TIME);    PlaySound('18_DoorOpen'); ", ZOOM_ZONE_APPEARING_TIME, play_field:GetTimer());
        end
        
        
        LinkScene(  'area_ho',
                    'CursorUpLeft',
                    'data/Scenes/18_Apartment_HO.lua',
                    true);
    end
    
    if HasGameState('ToolFound', '18_bell') then
        AddNoteToNotebook('BEHIND_THE_STAINED');
    end
end

function OnSceneFree(screen)
    DefaultOnSceneFree()
    FreeData(screen)
end

function OnUpdate(dt)
    DefaultOnUpdate(dt)
end

function OnAllItemsFound()
    DefaultOnAllItemsFound()
end

function OnLose()
    DefaultOnLose()
end

function OnExit()
    DefaultOnExit()
end

function OnClose()
    DefaultOnClose()
end

function OnObjectMouseEnter(object)
    DefaultOnObjectMouseEnter(object)
end

function OnObjectMouseLeave(object)
    DefaultOnObjectMouseLeave(object)
end

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

    DefaultOnObjectMouseDownProcessed(is_wrong_click);
end

function OnObjectMouseUp(object)
    DefaultOnObjectMouseUp(object)
end

function OnObjectFound(object)
    DefaultOnObjectFound(object)
end

function OnToolFound(tool)
    DefaultOnToolFound(tool)
end

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

function OnObjectReachPanel(object)
    DefaultOnObjectReachPanel(object)
end

function OnButtonPress(title)
    DefaultOnButtonPress(title)
end

function OnMouseMove(previous_pos, current_pos)
    DefaultOnMouseMove(previous_pos, current_pos)
end

function OnSetTool(tool)
    DefaultOnSetTool(tool)
end

function LevelLoaded(level)
end

function OnSceneDestroy(playfield)
    DefaultOnSceneDestroy(playfield)
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/18_Apartment/Zone_main/Layers/background.jpg',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('background',anim,512,384,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/18_Apartment/Zone_main/Layers/Door_close.png',0,0,247,423,1,0)
	anim:SetHotSpot(123,211)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Door_close',anim,862,322,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_lock',anim,940,360,102,0,10,10)
	local anim = CreateAnimation('data/Texture/Scenes/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_ho',anim,931,357,103,0,7,40)
	local anim = CreateAnimation('data/Texture/Scenes/05_Gendarmery/Zone_wart/Animations/fly_anim.png',0,0,217,217,8,12)
	anim:SetHotSpot(108,108)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('fly_anim_2',anim,318,145,101,0,0.9,0.9)
	local anim = CreateAnimation('data/Texture/Scenes/05_Gendarmery/Zone_wart/Animations/fly_anim.png',0,0,217,217,8,12)
	anim:SetHotSpot(108,108)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('fly_anim_1',anim,640,164,103,0,0.89,0.89)
	local anim = CreateAnimation('data/Texture/Scenes/18_Apartment/Zone_main/Layers/Layer_cupboard_open.png',0,0,84,129,1,0)
	anim:SetHotSpot(42,64)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_cupboard_open',anim,408,474,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/18_Apartment/Zone_main/Layers/Layer_glove.png',0,0,70,17,1,0)
	anim:SetHotSpot(35,8)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_glove',anim,377,529,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/18_Apartment/Zone_main/Layers/Layer_glove_over.png',0,0,45,32,1,0)
	anim:SetHotSpot(22,16)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_glove_over',anim,362,530,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_cupboard',anim,404,470,104,0,13,15)
	local anim = CreateAnimation('data/Texture/Scenes/Common/area_circle.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_glove',anim,382,527,105,0,0.69,0.69)
	local anim = CreateAnimation('data/Texture/Scenes/18_Apartment/Zone_main/Layers/Layer_ladder.png',0,0,77,293,1,0)
	anim:SetHotSpot(38,146)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_ladder',anim,597,351,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/18_Apartment/Zone_main/Layers/Layer_ladder_over_bottom.png',0,0,86,102,1,0)
	anim:SetHotSpot(43,51)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_ladder_over_bottom',anim,596,459,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/18_Apartment/Zone_main/Layers/Layer_ladder_over_top.png',0,0,40,41,1,0)
	anim:SetHotSpot(20,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_ladder_over_top',anim,632,218,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/area_circle.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_glove_apply',anim,590,341,104,0,0.87,2.45)
end

function FreeData(screen)
end
-- CLEAR_ON_SAVE_END
