dofile('data/Scripts/Scenes/Common.lua');
dofile('data/Scripts/Scenes/Animations/20_NearCollapsedShip_Animations.lua');

------------------------------------------------------------------------------
--
function OnSceneLoad(restoringFromSave)
	InitGameState();

	play_field = playField;
    LoadData();
	play_field = nil;

    RootZoomZone = CreateZoomZone('RootZoomZone', nil, 
                                   nil, 0.0, 
                                   nil, 0.0,
							{'RootBackground',

							 'anchor',
							 'bones',
							 'book',
							 'bottle',
							 'bug',
							 'butterfly',
							 'cactus',
							 'cat',
							 'coconut',
							 'cone',
							 'crab',
							 'feather',
							 'fish',
							 'glove',
							 'handbell',
							 'heron',
							 'hourglass',
							 'ladybird',
							 'leaves',
							 'lizard',
							 'mug',
							 'necklace',
							 'nest',
							 'octopus',
							 'oiler',
							 'pickaxe',
							 'pirateHat',
							 'pot',
							 'ring',
							 'sack',
							 'seagull',
							 'seashell',
							 'seaStar',
							 'shackles',
							 'shield',
							 'ship',
							 'steeringWheel',
							 'stool',
							 'tin',
							 'tortoise',

							 'LayerOverBackpack',
							 'LayerOverCoconut',
							 'LayerOverGlove',
							 'LayerOverHandbell',
							 'LayerOverHelmet',
							 'layerOverKnife',
							 'LayerOverMug',
							 'LayerOverPickaxe',
							 'LayerOverPirateHat',
							 'LayerOverPot',
							 'LayerOverShip',
							 'layerOverSign',
							 'LayerOverSteeringWheel',
							 'LayerOverStool',
							 'LayerOverTin',
							 'LayerOverChest',

							 'seashellBottom',
							 'seashellTopOPenAnimation',
							 'chestBottom',
							 'chestCapOpenAnimation',
							 'backpackClosed',
							 'backpackOpened',
							 'sunLights',

							 'GoldenHelmet',
							 'Key',
							 'Knife',
							 'LetterA',
							 'RopeWithHook',
							 'Sign',
							 'RopeWithHook_onPlace',
							 'Sign_onPlace',
							 'Sign_onPlaceWithLetters',

							 'actZoneBackpack',
							 'actZoneChest',
							 'actZoneSeashell',
							 'actZoneSign',
							 'actZoneRope'},

							{'RopeWithHook_onPlace',
							 'Sign_onPlace',
							 'Sign_onPlaceWithLetters'});

if (restoringFromSave == false) then
    AddRandomTasks(true, MISC_TASK_COUNT_24,
		CreateTask('anchor'),
		CreateTask('bones'),
		CreateTask('book'),
		CreateTask('bottle'),
		CreateTask('bug'),
		CreateTask('butterfly'),
		CreateTask('cactus'),
		CreateTask('cat'),
		CreateTask('coconut'),
		CreateTask('cone'),
		CreateTask('crab'),
		CreateTask('feather'),
		CreateTask('fish'),
		CreateTask('glove'),
		CreateTask('handbell'),
		CreateTask('heron'),
		CreateTask('hourglass'),
		CreateTask('ladybird'),
		CreateTask('leaves'),
		CreateTask('lizard'),
		CreateTask('mug'),
		CreateTask('necklace'),
		CreateTask('nest'),
		CreateTask('octopus'),
		CreateTask('oiler'),
		CreateTask('pickaxe'),
		CreateTask('pirateHat'),
		CreateTask('pot'),
		CreateTask('ring'),
		CreateTask('sack'),
		CreateTask('seagull'),
		CreateTask('seashell'),
		CreateTask('seaStar'),
		CreateTask('shackles'),
		CreateTask('shield'),
		CreateTask('ship'),
		CreateTask('steeringWheel'),
		CreateTask('stool'),
		CreateTask('tin'),
		CreateTask('tortoise')
	);

    playField:GetLevelScreen():AddTaskSafe(CreateTask('GoldenHelmet'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Key'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Knife'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('LetterA'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('RopeWithHook'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Sign'));
end

	CreateToolMap(	{'GoldenHelmet',	'actZoneBackpack'},
					{'Key',				'actZoneChest'},
					{'Knife',			'actZoneSeashell'},
					{'LetterA',   		'actZoneSign'},
					{'RopeWithHook', 	'actZoneRope'},
					{'Sign',			'actZoneSign'});

	SetIconForGameObject(playField:GetObject('anchor'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/anchor_icon.png');
	SetIconForGameObject(playField:GetObject('bones'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/bones_icon.png');
	SetIconForGameObject(playField:GetObject('book'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/book_icon.png');
	SetIconForGameObject(playField:GetObject('bottle'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/bottle_icon.png');
	SetIconForGameObject(playField:GetObject('bug'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/bug_icon.png');
	SetIconForGameObject(playField:GetObject('butterfly'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/butterfly_icon.png');
	SetIconForGameObject(playField:GetObject('cactus'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/cactus_icon.png');
	SetIconForGameObject(playField:GetObject('cat'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/cat_icon.png');
	SetIconForGameObject(playField:GetObject('coconut'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/coconut_icon.png');
	SetIconForGameObject(playField:GetObject('cone'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/cone_icon.png');
	SetIconForGameObject(playField:GetObject('crab'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/crab_icon.png');
	SetIconForGameObject(playField:GetObject('feather'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/feather_icon.png');
	SetIconForGameObject(playField:GetObject('fish'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/fish_icon.png');
	SetIconForGameObject(playField:GetObject('glove'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/glove_icon.png');
	SetIconForGameObject(playField:GetObject('handbell'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/handbell_icon.png');
	SetIconForGameObject(playField:GetObject('heron'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/heron_icon.png');
	SetIconForGameObject(playField:GetObject('hourglass'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/hourglass_icon.png');
	SetIconForGameObject(playField:GetObject('ladybird'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/ladybird_icon.png');
	SetIconForGameObject(playField:GetObject('leaves'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/leaves_icon.png');
	SetIconForGameObject(playField:GetObject('lizard'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/lizard_icon.png');
	SetIconForGameObject(playField:GetObject('mug'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/mug_icon.png');
	SetIconForGameObject(playField:GetObject('necklace'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/necklace_icon.png');
	SetIconForGameObject(playField:GetObject('nest'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/nest_icon.png');
	SetIconForGameObject(playField:GetObject('octopus'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/octopus_icon.png');
	SetIconForGameObject(playField:GetObject('oiler'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/oiler_icon.png');
	SetIconForGameObject(playField:GetObject('pickaxe'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/pickaxe_icon.png');
	SetIconForGameObject(playField:GetObject('pirateHat'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/pirateHat_icon.png');
	SetIconForGameObject(playField:GetObject('pot'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/pot_icon.png');
	SetIconForGameObject(playField:GetObject('ring'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/ring_icon.png');
	SetIconForGameObject(playField:GetObject('sack'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/sack_icon.png');
	SetIconForGameObject(playField:GetObject('seagull'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/seagull_icon.png');
	SetIconForGameObject(playField:GetObject('seashell'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/seashell_icon.png');
	SetIconForGameObject(playField:GetObject('seaStar'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/seaStar_icon.png');
	SetIconForGameObject(playField:GetObject('shackles'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/shackles_icon.png');
	SetIconForGameObject(playField:GetObject('shield'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/shield_icon.png');
	SetIconForGameObject(playField:GetObject('ship'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/ship_icon.png');
	SetIconForGameObject(playField:GetObject('steeringWheel'),'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/steeringWheel_icon.png');
	SetIconForGameObject(playField:GetObject('stool'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/stool_icon.png');
	SetIconForGameObject(playField:GetObject('tin'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/tin_icon.png');
	SetIconForGameObject(playField:GetObject('tortoise'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/tortoise_icon.png');

	SetIconForGameObject(playField:GetObject('GoldenHelmet'),'data/Texture/Scenes/20_NearCollapsedShip/Items/GoldenHelmet_icon.png');
	SetIconForGameObject(playField:GetObject('Key'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Key_icon.png');
	SetIconForGameObject(playField:GetObject('Knife'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Knife_icon.png');
	SetIconForGameObject(playField:GetObject('LetterA'),	'data/Texture/Scenes/20_NearCollapsedShip/Items/LetterA_icon.png');
	SetIconForGameObject(playField:GetObject('RopeWithHook'),'data/Texture/Scenes/20_NearCollapsedShip/Items/RopeWithHook_icon.png');
	SetIconForGameObject(playField:GetObject('Sign'),		'data/Texture/Scenes/20_NearCollapsedShip/Items/Sign_icon.png');

if (restoringFromSave == false) then
	gameState.helmetInBackpack = false;
	gameState.keyUsed = false;
	gameState.knifeUsed = false;
	gameState.letterOnPlace = false;
	gameState.ropeWithHookOnPlace = false;
	gameState.signOnPlace = false;

	gameState.chestIsOpening = false;
	gameState.seashellIsOpening = false;

	gameState.allToolsApplied = false;
	gameState.levelCompleted = false;
end

	AssignActiveZonesGlow({function() return gameState.helmetInBackpack; end,	'actZoneBackpack',	'GoldenHelmet_ghost'},
						  {function() return gameState.keyUsed; end,			'actZoneChest',		'Key_ghost'},
					      {function() return gameState.knifeUsed; end,			'actZoneSeashell',	'Knife_ghost'},
						  {function() return gameState.letterOnPlace or
											not gameState.signOnPlace; end,		'actZoneSign',		'LetterA_ghost'},
						  {function() return gameState.ropeWithHookOnPlace; end,'actZoneRope',		'RopeWithHook_ghost'},
						  {function() return gameState.signOnPlace; end,		'actZoneSign',		'Sign_ghost'});

    ApplyLevelDump(restoringFromSave);
	SetZoneVisible(RootZoomZone, true, false);

	auxSceneInit(restoringFromSave);
	auxProcessToolObjectStateAnCursorType();
end

------------------------------------------------------------------------------
--
function OnSceneFree()
    FreeData()

	StopSound('L20S10');
	StopSound('L20S11');
end

--// Local auxiliary functions - - - - - - - - - - - - - - - - - - - - - - - -
function auxSceneInit(restoringFromSave)
    local initialActions = function()
		ShowLevelIntro(20);
    end
	local regularActions = function()
--		gameState.customCursors[''] = {'CursorZoom'};

		playField:IgnoreOnTestPoint('sunLights');

		playField:IgnoreOnTestPoint('LayerOverBackpack');
		playField:IgnoreOnTestPoint('LayerOverCoconut');
		playField:IgnoreOnTestPoint('LayerOverGlove');
		playField:IgnoreOnTestPoint('LayerOverHandbell');
		playField:IgnoreOnTestPoint('LayerOverHelmet');
		playField:IgnoreOnTestPoint('layerOverKnife');
		playField:IgnoreOnTestPoint('LayerOverMug');
		playField:IgnoreOnTestPoint('LayerOverPickaxe');
		playField:IgnoreOnTestPoint('LayerOverPirateHat');
		playField:IgnoreOnTestPoint('LayerOverPot');
		playField:IgnoreOnTestPoint('LayerOverShip');
		playField:IgnoreOnTestPoint('layerOverSign');
		playField:IgnoreOnTestPoint('LayerOverSteeringWheel');
		playField:IgnoreOnTestPoint('LayerOverStool');
		playField:IgnoreOnTestPoint('LayerOverTin');

		playField:IgnoreOnTestPoint('chestCapOpenAnimation');
		playField:IgnoreOnTestPoint('seashellTopOPenAnimation');

		auxStopAnimation('seashellTopOPenAnimation', HGEANIM_FWD + HGEANIM_NOLOOP);
		auxStopAnimation('chestCapOpenAnimation', HGEANIM_FWD + HGEANIM_NOLOOP);

		auxSetFibrillationEffector(playField:GetObject('sunLights'), 0.95, 20.0);

		auxCreateNearCollapsedShipEnvAnimations(playField:GetObject('RootBackground'));
		auxPlayNearCollapsedShipEnvAnimation('EnvBack');
		auxPlayNearCollapsedShipEnvAnimation('EnvFront');

		gameState.chestIsOpening = false;
		gameState.seashellIsOpening = false;
	end

    if (restoringFromSave == false) then
        initialActions();
	else
    end	
    regularActions();

	if (gameState.levelCompleted == true) then
		gameState.levelCompleted = false;
		auxTestLevelCompleteCondition();
	end
end


function auxProcessToolObjectStateAnCursorType()
    assert(	gameState.helmetInBackpack ~= nil and
			gameState.keyUsed ~= nil and
			gameState.knifeUsed ~= nil and
			gameState.letterOnPlace ~= nil and
			gameState.ropeWithHookOnPlace ~= nil and
			gameState.signOnPlace ~= nil and

			gameState.chestIsOpening ~= nil and
			gameState.seashellIsOpening ~= nil);

	if (gameState.helmetInBackpack == true) then
		RootZoomZone.UnhideObject('backpackClosed');
		RootZoomZone.HideObject('backpackOpened');
		gameState.customCursors['actZoneBackpack'] = nil;
	else
		RootZoomZone.HideObject('backpackClosed');
		RootZoomZone.UnhideObject('backpackOpened');
		gameState.customCursors['actZoneBackpack'] = {'CursorArms'};
	end

	if (gameState.chestIsOpening == false) then
		local anim = playField:GetObject('chestCapOpenAnimation'):GetAnimation();

		anim:Stop();
		if (gameState.keyUsed == true) then
			anim:SetFrame(anim:GetFrames() - 1);
			playField:GetObject('actZoneChest'):SetVisible(false);
			gameState.customCursors['actZoneChest'] = nil;
		else
			anim:SetFrame(0);
			playField:GetObject('actZoneChest'):SetVisible(true);
			gameState.customCursors['actZoneChest'] = {'CursorArms'};
		end
	end

	if (gameState.seashellIsOpening == false) then
		local anim = playField:GetObject('seashellTopOPenAnimation'):GetAnimation();

		anim:Stop();
		if (gameState.knifeUsed == true) then
			anim:SetFrame(anim:GetFrames() - 1);
			playField:GetObject('actZoneSeashell'):SetVisible(false);
			gameState.customCursors['actZoneSeashell'] = nil;
		else
			anim:SetFrame(0);
			playField:GetObject('actZoneSeashell'):SetVisible(true);
			gameState.customCursors['actZoneSeashell'] = {'CursorArms'};
		end
	end

	if (gameState.ropeWithHookOnPlace == true) then
		RootZoomZone.UnhideObject('RopeWithHook_onPlace');
		gameState.customCursors['actZoneRope'] = nil;
	else
		RootZoomZone.HideObject('RopeWithHook_onPlace');
		gameState.customCursors['actZoneRope'] = {'CursorArms'};
	end

	if (gameState.letterOnPlace == true) then
		RootZoomZone.UnhideObject('Sign_onPlaceWithLetters');
	else
		RootZoomZone.HideObject('Sign_onPlaceWithLetters');
	end
	if (gameState.signOnPlace == true) then
		RootZoomZone.UnhideObject('Sign_onPlace');
	else
		RootZoomZone.HideObject('Sign_onPlace');
	end
	if (gameState.signOnPlace == true and gameState.letterOnPlace == true) then
		gameState.customCursors['actZoneSign'] = nil;
	else
		gameState.customCursors['actZoneSign'] = {'CursorArms'};
	end
end

--// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxOpenChest()
	local anim = playField:GetObject('chestCapOpenAnimation'):GetAnimation();
	local duration = auxGetAnimationDuration(anim);

	gameState.chestIsOpening = true;
	TimerDoString('SetGameStateParameter(\'chestIsOpening\', false);', duration, playField:GetTimer());

	playField:GetObject('actZoneChest'):SetVisible(false);
	anim:Play();
end
function auxOpenSeashell()
	local anim = playField:GetObject('seashellTopOPenAnimation'):GetAnimation();
	local duration = auxGetAnimationDuration(anim);

	gameState.seashellIsOpening = true;
	TimerDoString('SetGameStateParameter(\'seashellIsOpening\', false);', duration, playField:GetTimer());

	playField:GetObject('actZoneSeashell'):SetVisible(false);
	anim:Play();
end


--// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxTestLevelCompleteCondition()
	if (
		gameState.allToolsApplied == true and
		gameState.levelCompleted == false and
		playField:GetLevelScreen():HasUncompletedTask() == false) then

		gameState.levelCompleted = true;
		TimerDoString('OnWin();', 2.0, playField:GetTimer());
	end
end
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

------------------------------------------------------------------------------
--
function OnDialogButtonPress(name, param)
end

------------------------------------------------------------------------------
--
function OnUpdate(dt)
    DefaultOnUpdate(dt);
end

------------------------------------------------------------------------------
--
function OnWin()
	DefaultOnWin();
end

------------------------------------------------------------------------------
--
function OnObjectMouseEnter(object)
    local objectName = object:GetName();

    DefaultOnObjectMouseEnter(object);
	ActivateActiveZoneGlow(objectName);
end

------------------------------------------------------------------------------
--
function OnObjectMouseLeave(object)
    local objectName = object:GetName();

    DefaultOnObjectMouseLeave(object);
    DeactivateActiveZoneGlow(objectName);
end

------------------------------------------------------------------------------
--
function OnObjectMouseDown(object)
    local objectName = object:GetName();
    local isWrongClick = true;

	assert(gameState.activeZone ~= nil and gameState.locker:GetNReferences() > 0);

    if (gameState.lockedObjects[objectName] ~= true) then
        if (gameState.activeZone.HasObject(objectName)) then
            isWrongClick = DefaultOnZoomZoneActiveObjectClick(objectName);

			--// ...

	        if (isWrongClick == true and playField:GetLevelScreen():IsTaskObject(objectName)) then
	            auxAttachInPlace(object, playField);
				object:ResetClippingRect();
				--// remove object from zoom-zone which contents it
				assert(gameState.activeZone.objects[objectName] ~= nil);
				gameState.activeZone.objects[objectName] = nil;

                playField:OnObjectFound(object);
                isWrongClick = false;
            end
        else
--			assert(gameState.activeZone ~= RootZoomZone and 
--				   gameState.locker:GetNReferences() > 1 and
--				   'Attempt to close root scene - you have clicked on an object which hasn`t been added to any zoom-zone');
            if (gameState.activeZone ~= RootZoomZone and gameState.locker:GetNReferences() > 1) then
                if (gameState.lockedObjects[gameState.activeZone.activeObject] == nil) then
                    SetZoneVisible(gameState.activeZone, false);
                end
            else
                Log('Lua: OnObjectMouseDown(\''..objectName..'\'): Was made click on object which hasn`t been attached to any zoom-zone');
            end
        end --// if (gameState.activeZone.HasObject(...
    end --// if (gameState.lockedObjects[...

	--// Tips - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	if (objectName == 'actZoneSign' and gameState.signOnPlace == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL20_SIGN_TIP1'));
	elseif (objectName == 'actZoneSign' and gameState.letterOnPlace == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL20_LETTER_TIP1'));
	elseif (objectName == 'actZoneSeashell' and gameState.knifeUsed == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL20_SEASHELL_TIP1'));
	elseif (objectName == 'actZoneChest' and gameState.keyUsed == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL20_CHEST_TIP1'));
	elseif (objectName == 'actZoneBackpack' and gameState.helmetInBackpack == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL20_BACKPACK_TIP1'));
	elseif (objectName == 'actZoneRope' and gameState.ropeWithHookOnPlace == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL20_ROPE_TIP1'));
	else
	    playField:GetLevelScreen():HideTip();
	end
	--//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    DefaultOnObjectClick(object, isWrongClick, not playField:GetLevelScreen():IsTipShown());
    DefaultOnObjectMouseEnter(object);
end

------------------------------------------------------------------------------
--
function OnObjectMouseUp(object)
end

------------------------------------------------------------------------------
--
function OnObjectFound(object)
    local objectName = object:GetName();
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	local objectMustBeHighlighted = DefaultOnObjectFound(object);
	return objectMustBeHighlighted;
end

------------------------------------------------------------------------------
--
function OnToolFound(tool)
end

------------------------------------------------------------------------------
--
function CanToolBeApplied(tool, object)
	local toolName = tool:GetName();
	local objName = object:GetName();
    local canToolBeApplied = true;
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	canToolBeApplied = DefaultCanToolBeApplied(tool, object);
	return canToolBeApplied;
end

------------------------------------------------------------------------------
--
function OnToolApply(tool, object)
	local toolName = tool:GetName();
	local objName = object:GetName();
    local toolApplied = false;

	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	if (toolName == 'GoldenHelmet' and objName == gameState.toolMap[toolName]) then
		gameState.helmetInBackpack = true;
		toolApplied = true;
	end
	if (toolName == 'Key' and objName == gameState.toolMap[toolName]) then
		gameState.keyUsed = true;
		toolApplied = true;
		auxOpenChest();
		PlaySound('L20S11');
	end
	if (toolName == 'Knife' and objName == gameState.toolMap[toolName]) then
		gameState.knifeUsed = true;
		toolApplied = true;
		auxOpenSeashell();
		PlaySound('L20S10');
	end
	if (toolName == 'LetterA' and objName == gameState.toolMap[toolName] and
		gameState.signOnPlace) then
		gameState.letterOnPlace = true;
		toolApplied = true;
        playField:GetLevelScreen():RunMiniGame('data/Scripts/Minigames/Ship.lua');
	end
	if (toolName == 'RopeWithHook' and objName == gameState.toolMap[toolName]) then
		gameState.ropeWithHookOnPlace = true;
		toolApplied = true;
	end
	if (toolName == 'Sign' and objName == gameState.toolMap[toolName]) then
		gameState.signOnPlace = true;
		toolApplied = true;
	end
	if (not toolApplied) then
	    playField:GetLevelScreen():ShowTip(GetTextString('WRONG_ITEM_APPLIED_TIP1'),
										   GetTextString('WRONG_ITEM_APPLIED_TIP2'));
	end

	if (gameState.helmetInBackpack == true and
		gameState.keyUsed == true and
		gameState.knifeUsed == true and
		gameState.letterOnPlace == true and
		gameState.ropeWithHookOnPlace == true and
		gameState.signOnPlace == true and
		gameState.allToolsApplied == false) then

		gameState.allToolsApplied = true;
		if (playField:GetLevelScreen():HasUncompletedTask() == true) then
		    playField:GetLevelScreen():ShowTip(GetTextString('HAVE_TO_FIND_ITEMS_MSG1'),
											   GetTextString('HAVE_TO_FIND_ITEMS_MSG2'));
		else
			auxTestLevelCompleteCondition();
		end
	end

	auxProcessToolObjectStateAnCursorType();
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    DefaultOnObjectMouseEnter(object);
	if (toolApplied == true) then
	    DeactivateActiveZoneDeactivatedGlow(object:GetName());
	end
	return toolApplied;
end

------------------------------------------------------------------------------
--
function OnObjectReachPanel(object)
    local objectName = object:GetName();
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	auxTestLevelCompleteCondition();
end

------------------------------------------------------------------------------
--
function OnButtonPress(zoneName)
    DefaultOnButtonPress(zoneName);
end

------------------------------------------------------------------------------
--
function OnMouseMove(prevMousePos, currentMousePos)
end

------------------------------------------------------------------------------
--
function OnSetTool(tool)
end

------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function LoadData()
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/background.jpg',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('RootBackground',anim,512,384,97,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/anchor.png',0,0,85,123,1,0)
	anim:SetHotSpot(42,61)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('anchor',anim,960,358,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/bones.png',0,0,86,69,1,0)
	anim:SetHotSpot(43,34)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bones',anim,984,563,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/book.png',0,0,128,71,1,0)
	anim:SetHotSpot(64,35)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('book',anim,992,717,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/bottle.png',0,0,103,118,1,0)
	anim:SetHotSpot(51,59)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bottle',anim,371,747,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/bug.png',0,0,63,43,1,0)
	anim:SetHotSpot(31,21)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bug',anim,188,357,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/butterfly.png',0,0,72,46,1,0)
	anim:SetHotSpot(36,23)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('butterfly',anim,146,288,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/cactus.png',0,0,66,84,1,0)
	anim:SetHotSpot(33,42)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('cactus',anim,302,436,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/cat.png',0,0,111,81,1,0)
	anim:SetHotSpot(55,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('cat',anim,376,68,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/coconut.png',0,0,58,62,1,0)
	anim:SetHotSpot(29,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('coconut',anim,465,717,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/cone.png',0,0,34,45,1,0)
	anim:SetHotSpot(17,22)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('cone',anim,281,174,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/crab.png',0,0,69,57,1,0)
	anim:SetHotSpot(34,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('crab',anim,839,489,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/feather.png',0,0,60,97,1,0)
	anim:SetHotSpot(30,48)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('feather',anim,326,681,112,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/fish.png',0,0,102,56,1,0)
	anim:SetHotSpot(51,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('fish',anim,676,715,107,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/glove.png',0,0,88,39,1,0)
	anim:SetHotSpot(44,19)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('glove',anim,668,673,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/handbell.png',0,0,111,79,1,0)
	anim:SetHotSpot(55,39)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('handbell',anim,445,642,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/heron.png',0,0,39,68,1,0)
	anim:SetHotSpot(19,34)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('heron',anim,376,301,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/hourglass.png',0,0,70,134,1,0)
	anim:SetHotSpot(35,67)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('hourglass',anim,996,648,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/ladybird.png',0,0,39,41,1,0)
	anim:SetHotSpot(19,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('ladybird',anim,887,752,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/leaves.png',0,0,66,66,1,0)
	anim:SetHotSpot(33,33)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('leaves',anim,542,392,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/lizard.png',0,0,79,61,1,0)
	anim:SetHotSpot(39,30)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('lizard',anim,600,55,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/mug.png',0,0,67,54,1,0)
	anim:SetHotSpot(33,27)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('mug',anim,156,552,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/necklace.png',0,0,74,117,1,0)
	anim:SetHotSpot(37,58)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('necklace',anim,494,568,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/nest.png',0,0,104,95,1,0)
	anim:SetHotSpot(52,47)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('nest',anim,237,714,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/octopus.png',0,0,89,54,1,0)
	anim:SetHotSpot(44,27)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('octopus',anim,427,468,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/oiler.png',0,0,45,58,1,0)
	anim:SetHotSpot(22,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('oiler',anim,769,544,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/pickaxe.png',0,0,66,92,1,0)
	anim:SetHotSpot(33,46)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('pickaxe',anim,813,227,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/pirateHat.png',0,0,62,73,1,0)
	anim:SetHotSpot(31,36)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('pirateHat',anim,697,87,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/pot.png',0,0,59,55,1,0)
	anim:SetHotSpot(29,27)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('pot',anim,900,608,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/ring.png',0,0,48,35,1,0)
	anim:SetHotSpot(24,17)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('ring',anim,630,211,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/sack.png',0,0,121,120,1,0)
	anim:SetHotSpot(60,60)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('sack',anim,768,671,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/seagull.png',0,0,71,59,1,0)
	anim:SetHotSpot(35,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('seagull',anim,903,58,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/seashell.png',0,0,54,40,1,0)
	anim:SetHotSpot(27,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('seashell',anim,674,743,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/seaStar.png',0,0,87,57,1,0)
	anim:SetHotSpot(43,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('seaStar',anim,730,765,107,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/shackles.png',0,0,110,82,1,0)
	anim:SetHotSpot(55,41)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('shackles',anim,670,584,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/shield.png',0,0,53,55,1,0)
	anim:SetHotSpot(26,27)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('shield',anim,775,381,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/ship.png',0,0,48,75,1,0)
	anim:SetHotSpot(24,37)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('ship',anim,465,287,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/steeringWheel.png',0,0,109,99,1,0)
	anim:SetHotSpot(54,49)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('steeringWheel',anim,902,171,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/stool.png',0,0,102,105,1,0)
	anim:SetHotSpot(51,52)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('stool',anim,175,476,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/tin.png',0,0,64,66,1,0)
	anim:SetHotSpot(32,33)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('tin',anim,748,732,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Misc/tortoise.png',0,0,88,61,1,0)
	anim:SetHotSpot(44,30)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('tortoise',anim,556,603,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverBackpack.png',0,0,114,69,1,0)
	anim:SetHotSpot(57,34)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverBackpack',anim,882,689,106,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverCoconut.png',0,0,105,46,1,0)
	anim:SetHotSpot(52,23)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverCoconut',anim,464,733,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverGlove.png',0,0,100,90,1,0)
	anim:SetHotSpot(50,45)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverGlove',anim,667,672,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverHandbell.png',0,0,90,64,1,0)
	anim:SetHotSpot(45,32)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverHandbell',anim,414,641,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverHelmet.png',0,0,110,50,1,0)
	anim:SetHotSpot(55,25)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverHelmet',anim,244,636,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/layerOverKnife.png',0,0,69,42,1,0)
	anim:SetHotSpot(34,21)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('layerOverKnife',anim,822,755,108,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverMug.png',0,0,95,78,1,0)
	anim:SetHotSpot(47,39)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverMug',anim,156,551,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverPickaxe.png',0,0,73,65,1,0)
	anim:SetHotSpot(36,32)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverPickaxe',anim,830,256,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverPirateHat.png',0,0,88,100,1,0)
	anim:SetHotSpot(44,50)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverPirateHat',anim,697,105,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverPot.png',0,0,80,40,1,0)
	anim:SetHotSpot(40,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverPot',anim,901,623,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverShip.png',0,0,47,27,1,0)
	anim:SetHotSpot(23,13)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverShip',anim,460,322,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/layerOverSign.png',0,0,129,84,1,0)
	anim:SetHotSpot(64,42)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('layerOverSign',anim,852,580,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverSteeringWheel.png',0,0,126,125,1,0)
	anim:SetHotSpot(63,62)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverSteeringWheel',anim,896,174,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverStool.png',0,0,146,78,1,0)
	anim:SetHotSpot(73,39)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverStool',anim,177,516,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverTin.png',0,0,122,65,1,0)
	anim:SetHotSpot(61,32)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverTin',anim,751,739,106,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/LayerOverChest.png',0,0,170,84,1,0)
	anim:SetHotSpot(85,42)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverChest',anim,246,642,111,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/seashellBottom.png',0,0,108,64,1,0)
	anim:SetHotSpot(54,32)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('seashellBottom',anim,591,744,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/seashellTopOPenAnimation.png',0,0,116,92,5,12)
	anim:SetHotSpot(58,46)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('seashellTopOPenAnimation',anim,596,728,108,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/chestBottom.png',0,0,148,76,1,0)
	anim:SetHotSpot(74,38)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('chestBottom',anim,244,637,99,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/chestCapOpenAnimation.png',0,0,163,148,5,12)
	anim:SetHotSpot(81,74)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('chestCapOpenAnimation',anim,232,598,109,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/backpackClosed.png',0,0,88,96,1,0)
	anim:SetHotSpot(44,48)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('backpackClosed',anim,843,660,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/backpackOpened.png',0,0,88,96,1,0)
	anim:SetHotSpot(44,48)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('backpackOpened',anim,843,660,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Layers/sunLights.png',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('sunLights',anim,504,396,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/GoldenHelmet.png',0,0,70,67,1,0)
	anim:SetHotSpot(35,33)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('GoldenHelmet',anim,243,623,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Key.png',0,0,86,30,1,0)
	anim:SetHotSpot(43,15)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Key',anim,591,746,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Knife.png',0,0,81,68,1,0)
	anim:SetHotSpot(40,34)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Knife',anim,847,729,107,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/LetterA.png',0,0,50,58,1,0)
	anim:SetHotSpot(25,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LetterA',anim,205,521,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/RopeWithHook.png',0,0,80,80,1,0)
	anim:SetHotSpot(40,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('RopeWithHook',anim,820,89,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/RopeWithHook_onPlace.png',0,0,51,336,1,0)
	anim:SetHotSpot(25,168)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('RopeWithHook_onPlace',anim,986,395,106,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Sign.png',0,0,125,82,1,0)
	anim:SetHotSpot(62,41)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Sign',anim,867,564,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Sign_onPlace.png',0,0,143,63,1,0)
	anim:SetHotSpot(71,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Sign_onPlace',anim,611,291,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Sign_onPlaceWithLetters.png',0,0,143,63,1,0)
	anim:SetHotSpot(71,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Sign_onPlaceWithLetters',anim,614,290,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneBackpack',anim,839,641,105,0,0.7,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneChest',anim,243,622,110,0,1.3,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneSeashell',anim,596,735,109,0,1,0.7)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneSign',anim,613,293,106,-15,1.4,0.7)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneRope',anim,971,252,108,0,1,0.8)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/GoldenHelmet_ghost.png',0,0,103,101,1,0)
	anim:SetHotSpot(51,51)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('GoldenHelmet_ghost',anim,837,604,110,0,0.7,0.7)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Key_ghost.png',0,0,113,110,1,0)
	anim:SetHotSpot(56,56)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Key_ghost',anim,265,598,110,0,-0.7,0.7)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Knife_ghost.png',0,0,100,90,1,0)
	anim:SetHotSpot(50,50)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Knife_ghost',anim,593,730,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/LetterA_ghost.png',0,0,80,80,1,0)
	anim:SetHotSpot(40,40)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LetterA_ghost',anim,562,304,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/RopeWithHook_ghost.png',0,0,100,100,1,0)
	anim:SetHotSpot(50,50)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('RopeWithHook_ghost',anim,976,256,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/20_NearCollapsedShip/Items/Sign_ghost.png',0,0,160,80,1,0)
	anim:SetHotSpot(80,40)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Sign_ghost',anim,613,292,110,0,1,1)
end

function FreeData()
end
-- CLEAR_ON_SAVE_END
