function OnSceneLoad(screen)
    LoadData(screen)
    DefaultOnSceneLoad('data/Scenes/09_Bank_Office_Main.lua', 'quest', 'data/Scenes/08_Bank_Main.lua')
    
    play_field:GetObject('door_open'    ):SetOpacity(0.);
    play_field:GetObject('layer_carpet' ):SetOpacity(0.);
    play_field:GetObject('layer_lever'  ):SetOpacity(0.);
    play_field:GetObject('area_deposit' ):SetVisible(false);
    play_field:GetObject('area_lever'   ):SetVisible(false);
    
    LinkScene(  'area_cupboard',
                'CursorGlass',
                'data/Scenes/09_Bank_Office_Cupboard_HO.lua',
                true);
    
    LinkScene(  'area_table',
                'CursorGlass',
                'data/Scenes/09_Bank_Office_Table_HO.lua',
                true);
                
     RegisterActiveObject('area_door',              function(obj_name)
                                                        play_field:GetObject('area_door'   ):SetVisible(false);
                                                        play_field:GetObject('area_deposit'):SetVisible(true);
                                                        play_field:GetObject('door_open'   ):ChangeOpacity(0., 1., OPEN_DOOR_TIME);
                                                        
                                                        LinkScene('area_deposit',
                                                                  'CursorLeft',
                                                                  'data/Scenes/09_Bank_Office_Depositary.lua',
                                                                  false);
                                                        
                                                        PlaySound('OpenDoor');
                                                    end,
                                                    
                                                    function(obj_name)
                                                        play_field:GetObject('area_door'   ):SetVisible(false);
                                                        play_field:GetObject('area_deposit'):SetVisible(true);
                                                        play_field:GetObject('door_open'   ):SetOpacity(1.);
                                                        
                                                        LinkScene('area_deposit',
                                                                  'CursorLeft',
                                                                  'data/Scenes/09_Bank_Office_Depositary.lua',
                                                                  false);
                                                    end);
    
    RegisterActiveObject('area_carpet',             function(obj_name)
                                                        play_field:GetObject('layer_carpet' ):ChangeOpacity(0., 1., 0.4);
                                                        play_field:GetObject('layer_lever'  ):ChangeOpacity(0., 1., 0.4);
                                                        play_field:GetObject('area_lever'   ):SetVisible(true);
                                                        
                                                        PlaySound('09_MoveŅarpet');
                                                    end,
                                                    function(obj_name)
                                                        play_field:GetObject('layer_carpet' ):SetOpacity(1.);
                                                        play_field:GetObject('layer_lever'  ):SetOpacity(1.);
                                                        play_field:GetObject('area_lever'   ):SetVisible(true);
                                                    end);

    RegisterToolFindInfo('09_lever', 'area_lever',  function(tool_name)
                                                        play_field:GetObject('area_lever'   ):SetVisible(false);
                                                        play_field:GetObject('layer_lever'  ):SetVisible(false);
                                                    end,
                                                    function(tool_name)
                                                        play_field:GetObject('area_lever'   ):SetVisible(false);
                                                        play_field:GetObject('layer_lever'  ):SetVisible(false);
                                                    end);
                                                    
                            
    
    if not HasGameState('MiniGameCompleted', '09_Tails') then
        play_field:GetObject('layer_seyf_open'):SetVisible(false)
    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/09_Bank_Office/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/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_cupboard',anim,430,347,105,0,20,20)
	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_table',anim,712,336,105,0,25,15)
	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_door',anim,92,395,102,0,20,40)
	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_deposit',anim,92,395,103,0,20,40)
	local anim = CreateAnimation('data/Texture/Scenes/Common/Animations/candle.png',0,0,20,40,25,20)
	anim:SetHotSpot(10,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('candle_flame1',anim,741,305,102,0,0.6,0.6)
	local anim = CreateAnimation('data/Texture/Scenes/Common/Animations/candle.png',0,0,20,40,25,22)
	anim:SetHotSpot(10,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('candle_flame2',anim,724,308,102,0,0.6,0.6)
	local anim = CreateAnimation('data/Texture/Scenes/Common/Animations/candle.png',0,0,20,40,25,24)
	anim:SetHotSpot(10,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('candle_flame3',anim,705,307,102,0,0.6,0.6)
	local anim = CreateAnimation('data/Texture/Scenes/Common/Animations/candle.png',0,0,20,40,25,18)
	anim:SetHotSpot(10,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('candle_flame4',anim,468,300,102,0,0.6,0.6)
	local anim = CreateAnimation('data/Texture/Scenes/Common/Animations/candle.png',0,0,20,40,25,21)
	anim:SetHotSpot(10,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('candle_flame5',anim,450,307,102,0,0.6,0.6)
	local anim = CreateAnimation('data/Texture/Scenes/Common/Animations/candle.png',0,0,20,40,25,23)
	anim:SetHotSpot(10,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('candle_flame6',anim,430,297,102,0,0.6,0.6)
	local anim = CreateAnimation('data/Texture/Scenes/09_Bank_Office/Zone_main/Layers/door_open.png',0,0,192,512,1,0)
	anim:SetHotSpot(96,256)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('door_open',anim,96,456,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/05_Gendarmery/Zone_wart/Animations/fly_anim.png',0,0,217,217,8,10)
	anim:SetHotSpot(108,108)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('fly_anim',anim,587,354,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/09_Bank_Office/Zone_main/Layers/layer_seyf_open.png',0,0,123,178,1,0)
	anim:SetHotSpot(61,89)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_seyf_open',anim,392,258,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/09_Bank_Office/Zone_main/Layers/layer_carpet.jpg',0,0,78,43,1,0)
	anim:SetHotSpot(39,21)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_carpet',anim,933,565,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/09_Bank_Office/Zone_main/Layers/layer_lever.png',0,0,41,32,1,0)
	anim:SetHotSpot(20,16)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_lever',anim,945,564,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_carpet',anim,931,562,103,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_lever',anim,945,561,104,0,0.5,0.5)
end

function FreeData(screen)
end
-- CLEAR_ON_SAVE_END
