dofile('data/Scripts/Scenes/Common.lua');
dofile('data/Scripts/Scenes/Animations/10_UndergroundGarden_Animations.lua');

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

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

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

							 'bag',
							 'barrel',
							 'bat',
							 'beads',
							 'book',
							 'bottle',
							 'bug',
							 'bundleOfKeys',
							 'cannon',
							 'caterpillar',
							 'church',
							 'coin1',
							 'coin',
							 'compass',
							 'crown',
							 'demijohn',
							 'dino',
							 'dragon',
							 'eggs',
							 'fan',
							 'feather',
							 'fly',
							 'grasshopper',
							 'gun',
							 'halberd',
							 'handbell',
							 'lantern',
							 'onions',
							 'parrot',
							 'piratHat',
							 'plate',
							 'rifle',
							 'scroll',
							 'skull',
							 'snake',
							 'spider',
							 'statuette',
							 'steeringWheel',
							 'turtle',
							 'vase',

							 'bridge',
							 'LayerOverBridge',
							 'LayerOverBarrel',
							 'LayerOverBook',
							 'LayerOverDemijohn',
							 'layerOverHalberd',
							 'LayerOverLever',
							 'LayerOverRifle',
							 'LayerOverStatuette',
							 'LayerOverCyanCrystal',
							 'bush',
							 'leftWaterfall',
							 'rightWaterfall',
							 'ropeForCrystal',

							 'BlueCrystal_onPlace',
							 'Cross_onPlace',
							 'CyanCrystal_onPlace',
							 'IdolTop_onPlace',
							 'Lever_onPlace',
							 'RedCrystal_onPlace',

							 'smallFlower1',
							 'smallFlower2',

							 'actZoneBridge',
							 'actZoneRedCrystal',
							 'actZoneBlueCrystal',
							 'actZoneLever',
							 'actZoneCyanCrystal',
							 'actZoneIdolTop',

							 'Sabre',
							 'BlueCrystal',
							 'CyanCrystal',
							 'IdolTop',
							 'Lever',
							 'RedCrystal'},

							{},

							{'CyanCrystalGlow',
							 'BlueCrystalGlow',
							 'RedCrystalGlow',
							 'PurpleCrossGlow',
							 'cyanCrystalLightMap'});

if (restoringFromSave == false) then
    AddRandomTasks(true, MISC_TASK_COUNT_24,
		CreateTask('bag'),
		CreateTask('barrel'),
		CreateTask('bat'),
		CreateTask('beads'),
		CreateTask('book'),
		CreateTask('bottle'),
		CreateTask('bug'),
		CreateTask('bundleOfKeys'),
		CreateTask('cannon'),
		CreateTask('caterpillar'),
		CreateTask('church'),
		CreateTask('coin1'),
		CreateTask('coin'),
		CreateTask('compass'),
		CreateTask('crown'),
		CreateTask('demijohn'),
		CreateTask('dino'),
		CreateTask('dragon'),
		CreateTask('eggs'),
		CreateTask('fan'),
		CreateTask('feather'),
		CreateTask('fly'),
		CreateTask('grasshopper'),
		CreateTask('gun'),
		CreateTask('halberd'),
		CreateTask('handbell'),
		CreateTask('lantern'),
		CreateTask('onions'),
		CreateTask('parrot'),
		CreateTask('piratHat'),
		CreateTask('plate'),
		CreateTask('rifle'),
		CreateTask('scroll'),
		CreateTask('skull'),
		CreateTask('snake'),
		CreateTask('spider'),
		CreateTask('statuette'),
		CreateTask('steeringWheel'),
		CreateTask('turtle'),
		CreateTask('vase')
	);

    playField:GetLevelScreen():AddTaskSafe(CreateTask('CyanCrystal'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Lever'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('BlueCrystal'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('IdolTop'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('RedCrystal'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Sabre'));
end

	CreateToolMap(	{'CyanCrystal', 	'actZoneCyanCrystal'},
					{'Lever',   		'actZoneLever'},
					{'BlueCrystal',		'actZoneBlueCrystal'},
					{'IdolTop',   		'actZoneIdolTop'},
					{'RedCrystal',  	'actZoneRedCrystal'},
					{'Sabre',			'bush'});

	SetIconForGameObject(playField:GetObject('bag'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/bag_icon.png');
	SetIconForGameObject(playField:GetObject('barrel'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/barrel_icon.png');
	SetIconForGameObject(playField:GetObject('bat'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/bat_icon.png');
	SetIconForGameObject(playField:GetObject('beads'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/beads_icon.png');
	SetIconForGameObject(playField:GetObject('book'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/book_icon.png');
	SetIconForGameObject(playField:GetObject('bottle'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/bottle_icon.png');
	SetIconForGameObject(playField:GetObject('bug'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/bug_icon.png');
	SetIconForGameObject(playField:GetObject('bundleOfKeys'),'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/bundleOfKeys_icon.png');
	SetIconForGameObject(playField:GetObject('cannon'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/cannon_icon.png');
	SetIconForGameObject(playField:GetObject('caterpillar'),'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/caterpillar_icon.png');
	SetIconForGameObject(playField:GetObject('church'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/church_icon.png');
	SetIconForGameObject(playField:GetObject('coin1'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/coin1_icon.png');
	SetIconForGameObject(playField:GetObject('coin'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/coin_icon.png');
	SetIconForGameObject(playField:GetObject('compass'),	'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/compass_icon.png');
	SetIconForGameObject(playField:GetObject('crown'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/crown_icon.png');
	SetIconForGameObject(playField:GetObject('demijohn'),	'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/demijohn_icon.png');
	SetIconForGameObject(playField:GetObject('dino'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/dino_icon.png');
	SetIconForGameObject(playField:GetObject('dragon'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/dragon_icon.png');
	SetIconForGameObject(playField:GetObject('eggs'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/eggs_icon.png');
	SetIconForGameObject(playField:GetObject('fan'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/fan_icon.png');
	SetIconForGameObject(playField:GetObject('feather'),	'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/feather_icon.png');
	SetIconForGameObject(playField:GetObject('fly'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/fly_icon.png');
	SetIconForGameObject(playField:GetObject('grasshopper'),'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/grasshopper_icon.png');
	SetIconForGameObject(playField:GetObject('gun'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/gun_icon.png');
	SetIconForGameObject(playField:GetObject('halberd'),	'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/halberd_icon.png');
	SetIconForGameObject(playField:GetObject('handbell'),	'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/handbell_icon.png');
	SetIconForGameObject(playField:GetObject('lantern'),	'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/lantern_icon.png');
	SetIconForGameObject(playField:GetObject('onions'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/onions_icon.png');
	SetIconForGameObject(playField:GetObject('parrot'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/parrot_icon.png');
	SetIconForGameObject(playField:GetObject('piratHat'),	'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/piratHat_icon.png');
	SetIconForGameObject(playField:GetObject('plate'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/plate_icon.png');
	SetIconForGameObject(playField:GetObject('rifle'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/rifle_icon.png');
	SetIconForGameObject(playField:GetObject('scroll'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/scroll_icon.png');
	SetIconForGameObject(playField:GetObject('skull'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/skull_icon.png');
	SetIconForGameObject(playField:GetObject('snake'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/snake_icon.png');
	SetIconForGameObject(playField:GetObject('spider'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/spider_icon.png');
	SetIconForGameObject(playField:GetObject('statuette'),	'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/statuette_icon.png');
	SetIconForGameObject(playField:GetObject('steeringWheel'),'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/steeringWheel_icon.png');
	SetIconForGameObject(playField:GetObject('turtle'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/turtle_icon.png');
	SetIconForGameObject(playField:GetObject('vase'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Misc/vase_icon.png');

	SetIconForGameObject(playField:GetObject('CyanCrystal'),'data/Texture/Scenes/10_UndergroundGarden/Items/CyanCrystal_icon.png');
	SetIconForGameObject(playField:GetObject('Lever'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Lever_icon.png');
	SetIconForGameObject(playField:GetObject('BlueCrystal'),'data/Texture/Scenes/10_UndergroundGarden/Items/BlueCrystal_icon.png');
	SetIconForGameObject(playField:GetObject('IdolTop'),	'data/Texture/Scenes/10_UndergroundGarden/Items/IdolTop_icon.png');
	SetIconForGameObject(playField:GetObject('RedCrystal'),	'data/Texture/Scenes/10_UndergroundGarden/Items/RedCrystal_icon.png');
	SetIconForGameObject(playField:GetObject('Sabre'),		'data/Texture/Scenes/10_UndergroundGarden/Items/Sabre_icon.png');

if (restoringFromSave == false) then
	gameState.bridgeFinalPos = {playField:GetObject('bridge'):GetX(), playField:GetObject('bridge'):GetY()};
	gameState.bridgeShift = {55.0, 65.0};
	gameState.ropeFinalPosY = playField:GetObject('ropeForCrystal'):GetY();
	gameState.ropeShift = 200.0;
	gameState.leverInitPosY = playField:GetObject('Lever_onPlace'):GetY();
	gameState.leverShift = 10.0;
	gameState.cursorNearFlowers = false;
	gameState.wildFlowersInitPosY = {playField:GetObject('smallFlower1'):GetY(),
									 playField:GetObject('smallFlower1'):GetY()};
	gameState.wildFlowersShift = 50.0;

	gameState.cyanCrystalOnPlace = false;
	gameState.leverOnPlace = false;
	gameState.blueCrystalOnPlace = false;
	gameState.idolTopOnPlace = false;
	gameState.redCrystalOnPlace = false;
	gameState.sabreUsed = false;

	gameState.bridgeActivated = false;

	gameState.ropeIsDroping = false;
	gameState.bridgeIsMoving = false;
	gameState.flowersAreDroping = false;

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

	AssignActiveZonesGlow({function() return gameState.cyanCrystalOnPlace or
											 not gameState.idolTopOnPlace; end,	'actZoneCyanCrystal',	'CyanCrystal_ghost'},
						  {function() return gameState.leverOnPlace; end,		'actZoneLever',			'Lever_ghost'},
					      {function() return gameState.blueCrystalOnPlace; end,	'actZoneBlueCrystal',	'BlueCrystal_ghost'},
						  {function() return gameState.idolTopOnPlace or
											 not gameState.sabreUsed; end,		'actZoneIdolTop',		'IdolTop_ghost'},
						  {function() return gameState.redCrystalOnPlace; end,	'actZoneRedCrystal',	'RedCrystal_ghost'},
						  {function() return gameState.sabreUsed; end,			'bush',					'Sabre_ghost'});

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

	auxSceneInit(restoringFromSave);
	auxProcessToolObjectStateAnCursorType();
end

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

    StopSound('L10S10');
    StopSound('L10S11');
    StopSound('L10S12');
    StopSound('L10S13');
end

--// Local auxiliary functions - - - - - - - - - - - - - - - - - - - - - - - -
function auxSceneInit(restoringFromSave)
    local initialActions = function()
		ShowLevelIntro(10);
    end
	local regularActions = function()
	    PlaySound('L10S10', true);

	    playField:IgnoreOnTestPoint('CyanCrystalGlow');
	    playField:IgnoreOnTestPoint('cyanCrystalLightMap');
	    playField:IgnoreOnTestPoint('BlueCrystalGlow');
	    playField:IgnoreOnTestPoint('RedCrystalGlow');
	    playField:IgnoreOnTestPoint('PurpleCrossGlow');
		auxSetFibrillationEffector(playField:GetObject('CyanCrystalGlow'), 0.70, 6.5);
		auxSetFibrillationEffector(playField:GetObject('cyanCrystalLightMap'), 0.70, 6.5);
		auxSetFibrillationEffector(playField:GetObject('BlueCrystalGlow'), 0.55, 3.75);
		auxSetFibrillationEffector(playField:GetObject('RedCrystalGlow'),  0.75, 4.0);
		auxSetFibrillationEffector(playField:GetObject('PurpleCrossGlow'), 0.35, 4.25);

		auxStopAnimation('smallFlower1', HGEANIM_FWD + HGEANIM_NOLOOP);
		auxStopAnimation('smallFlower2', HGEANIM_FWD + HGEANIM_NOLOOP);

	    playField:IgnoreOnTestPoint('layerOverHalberd');

		auxCreateUndergroundGardenAnimations(playField:GetObject('RootBackground'));
		auxPlayUndergroundGardenAnimation('EnvTop');
		auxPlayUndergroundGardenAnimation('Ant1');
--		auxPlayUndergroundGardenAnimation('Ant2');
		auxPlayUndergroundGardenAnimation('GroundFog');

		gameState.nextAnimationDelay = 0;

		gameState.ropeIsDroping = false;
		gameState.bridgeIsMoving = false;
		gameState.flowersAreDroping = 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.cyanCrystalOnPlace ~= nil and
			gameState.leverOnPlace ~= nil and
			gameState.blueCrystalOnPlace ~= nil and
			gameState.idolTopOnPlace ~= nil and
			gameState.redCrystalOnPlace ~= nil and
			gameState.sabreUsed ~= nil);

	if (gameState.ropeIsDroping == false) then
		if (gameState.cyanCrystalOnPlace == true) then
			playField:GetObject('CyanCrystalGlow'):SetVisible(true);
			RootZoomZone.UnhideObject('CyanCrystal_onPlace');
		    gameState.customCursors['actZoneCyanCrystal'] = nil;
		else
			playField:GetObject('CyanCrystalGlow'):SetVisible(false);
			RootZoomZone.HideObject('CyanCrystal_onPlace');
			if (gameState.idolTopOnPlace == true) then
			    gameState.customCursors['actZoneCyanCrystal'] = {'CursorArms'};
			else
			    gameState.customCursors['actZoneCyanCrystal'] = nil;
			end
		end
		playField:GetObject('cyanCrystalLightMap'):SetVisible(playField:HasObject('CyanCrystal'));
		if (gameState.flowersAreDroping == false) then
			if (gameState.cyanCrystalOnPlace == true) then
				playField:GetObject('smallFlower1'):SetY(gameState.wildFlowersInitPosY[1] + gameState.wildFlowersShift);
				playField:GetObject('smallFlower2'):SetY(gameState.wildFlowersInitPosY[2] + gameState.wildFlowersShift);
			else
				playField:GetObject('smallFlower1'):SetY(gameState.wildFlowersInitPosY[1]);
				playField:GetObject('smallFlower2'):SetY(gameState.wildFlowersInitPosY[2]);
			end
		end

		if (gameState.idolTopOnPlace == true) then
			RootZoomZone.UnhideObject('IdolTop_onPlace');
			playField:GetObject('ropeForCrystal'):SetY(gameState.ropeFinalPosY);
			gameState.customCursors['actZoneIdolTop'] = nil;
		else
			RootZoomZone.HideObject('IdolTop_onPlace');
			playField:GetObject('ropeForCrystal'):SetY(gameState.ropeFinalPosY - gameState.ropeShift);
			gameState.customCursors['actZoneIdolTop'] = {'CursorArms'};
		end
	end
	playField:GetObject('PurpleCrossGlow'):SetVisible(gameState.idolTopOnPlace);

	if (gameState.bridgeIsMoving == false) then
		if (gameState.leverOnPlace == true) then
			RootZoomZone.UnhideObject('Lever_onPlace');
			if (gameState.bridgeActivated == true) then
				playField:GetObject('bridge'):SetXY(gameState.bridgeFinalPos[1], gameState.bridgeFinalPos[2]);
				playField:GetObject('Lever_onPlace'):SetY(gameState.leverInitPosY + gameState.leverShift);
				gameState.customCursors['actZoneLever'] = nil;
			else
				playField:GetObject('bridge'):SetXY(gameState.bridgeFinalPos[1] + gameState.bridgeShift[1],
													gameState.bridgeFinalPos[2] + gameState.bridgeShift[2]);
				playField:GetObject('Lever_onPlace'):SetY(gameState.leverInitPosY);
				gameState.customCursors['actZoneLever'] = {'CursorArms'};
			end
		else
			RootZoomZone.HideObject('Lever_onPlace');
			playField:GetObject('bridge'):SetXY(gameState.bridgeFinalPos[1] + gameState.bridgeShift[1],
												gameState.bridgeFinalPos[2] + gameState.bridgeShift[2]);
			gameState.customCursors['actZoneLever'] = {'CursorArms'};
		end
	end

	if (gameState.blueCrystalOnPlace == true) then
		RootZoomZone.UnhideObject('BlueCrystal_onPlace');
		gameState.customCursors['actZoneBlueCrystal'] = nil;
	else
		RootZoomZone.HideObject('BlueCrystal_onPlace');
		gameState.customCursors['actZoneBlueCrystal'] = {'CursorArms'};
	end
	playField:GetObject('BlueCrystalGlow'):SetVisible(gameState.blueCrystalOnPlace);

	if (gameState.redCrystalOnPlace == true) then
		RootZoomZone.UnhideObject('RedCrystal_onPlace');
		gameState.customCursors['actZoneRedCrystal'] = nil;
	else
		RootZoomZone.HideObject('RedCrystal_onPlace');
		gameState.customCursors['actZoneRedCrystal'] = {'CursorArms'};
	end
	playField:GetObject('RedCrystalGlow'):SetVisible(gameState.redCrystalOnPlace);

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

--// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxDisableSateFlag(flagName, additinalAction)
	assert(gameState[flagName] ~= nil);
	gameState[flagName] = false;
	if (additinalAction ~= nil) then
		additinalAction();
	end
end

function auxMoveLever()
	local duration = 1.0;
	gameState.bridgeActivated = true;
	gameState.bridgeIsMoving = true;
	TimerDoString('auxDisableSateFlag(\'bridgeIsMoving\');', duration, playField:GetTimer());

	local objLever = playField:GetObject('Lever_onPlace');
	local objBridge = playField:GetObject('bridge');

	objLever:SetY(gameState.leverInitPosY);
	objBridge:SetXY(gameState.bridgeFinalPos[1] + gameState.bridgeShift[1],
					gameState.bridgeFinalPos[2] + gameState.bridgeShift[2]);
	objLever:Move(0.0, gameState.leverShift, 0.5 * duration);
	objBridge:Move(-gameState.bridgeShift[1], -gameState.bridgeShift[2], duration);

	gameState.customCursors['actZoneLever'] = nil;
end

function auxEnableCyanCrystalZone()
	gameState.customCursors['actZoneCyanCrystal'] = {'CursorArms'};
end
function auxDropDownRope()
	local duration = 1.0;
	gameState.idolTopOnPlace = true;
	gameState.ropeIsDroping = true;
	TimerDoString('auxDisableSateFlag(\'ropeIsDroping\', auxEnableCyanCrystalZone);', duration, playField:GetTimer());

	RootZoomZone.UnhideObject('IdolTop_onPlace');

	local objRope = playField:GetObject('ropeForCrystal');

	objRope:SetY(gameState.ropeFinalPosY - gameState.ropeShift);
	objRope:Move(0.0, gameState.ropeShift, duration);

	gameState.customCursors['actZoneIdolTop'] = nil;

	PlaySound('L10S12');
end

function auxUpdateWildFlowers()
	assert(gameState.cursorNearFlowers ~= nil);
	if (gameState.cursorNearFlowers == true and gameState.cyanCrystalOnPlace == false) then
		if (playField:GetObject('smallFlower1'):GetAnimation():IsPlaying() == false) then
			playField:GetObject('smallFlower1'):GetAnimation():Play();
		end
		if (playField:GetObject('smallFlower2'):GetAnimation():IsPlaying() == false) then
			playField:GetObject('smallFlower2'):GetAnimation():Play();
		end
	end
end
function auxHideWildFlowers()
	local duration = 1.0;
	gameState.flowersAreDroping = true;
	TimerDoString('auxDisableSateFlag(\'flowersAreDroping\');', duration, playField:GetTimer());
	
	local objFlower1 = playField:GetObject('smallFlower1');
	local objFlower2 = playField:GetObject('smallFlower2');

	objFlower1:SetY(gameState.wildFlowersInitPosY[1]);
	objFlower2:SetY(gameState.wildFlowersInitPosY[2]);
	objFlower1:Move(0.0, gameState.wildFlowersShift, 0.75 * duration);
	objFlower2:Move(0.0, gameState.wildFlowersShift, duration);
end

--// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxUpdatePeriodicAnimations(dt)
	if (gameState.nextAnimationDelay == 0.0) then
		local animations = {};

		for compositionName, composition in pairs(undergroundGardenCompositions) do
			if (composition:IsCyclic() == false) then
				table.insert(animations, composition:GetName());
			end
		end

		local animName = animations[math.random(1, table.getn(animations))];
		if (animName ~= nil) then
			local composition = auxGetUndergroundGardenAnimation(animName);

            if (composition ~= nil and composition:IsPaused() == true) then
				auxPlayUndergroundGardenAnimation(animName);
			end
		end
		gameState.nextAnimationDelay = math.random(4, 11);
	else
		gameState.nextAnimationDelay = (gameState.nextAnimationDelay - dt >= 0.0 and gameState.nextAnimationDelay - dt or 0.0);
	end
end

--// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxTestLevelCompleteCondition()
	if (gameState.bridgeActivated == true and

		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);

	auxUpdateWildFlowers();
	auxUpdatePeriodicAnimations(dt);
end

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

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

	if (objectName == 'actZoneBridge') then
		gameState.cursorNearFlowers = true;
	end

    DefaultOnObjectMouseEnter(object);
	ActivateActiveZoneGlow(objectName);
end

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

	if (objectName == 'actZoneBridge') then
		gameState.cursorNearFlowers = false;
	end

    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 (objectName == 'actZoneLever' and gameState.leverOnPlace == true and gameState.bridgeActivated == false) then
				gameState.bridgeActivated = true;
				auxMoveLever();
				auxTestLevelCompleteCondition();
				auxProcessToolObjectStateAnCursorType();
                isWrongClick = false;
				PlaySound('L10S11');
			end

	        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 == 'bush' or objectName == 'actZoneIdolTop') and gameState.sabreUsed == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL10_BUSH_TIP1'));
	elseif (objectName == 'actZoneLever' and gameState.leverOnPlace == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL10_LEVER_TIP1'));
	elseif (objectName == 'actZoneRedCrystal' and gameState.redCrystalOnPlace == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL10_REDCRYSTAL_TIP1'));
	elseif (objectName == 'actZoneBlueCrystal' and gameState.blueCrystalOnPlace == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL10_BLUECRYSTAL_TIP1'));
	elseif (objectName == 'actZoneIdolTop' and gameState.idolTopOnPlace == false and gameState.sabreUsed == true) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL10_IDOLTOP_TIP1'));
	elseif (objectName == 'actZoneCyanCrystal' and gameState.cyanCrystalOnPlace == false and gameState.idolTopOnPlace == true) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL10_CYANCRYSTAL_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();
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	if (objectName == 'CyanCrystal') then
		playField:GetObject('cyanCrystalLightMap'):SetVisible(false);
	end
	if (objectName == 'RedCrystal') then
		playField:GetLevelScreen():ShowTip(GetTextString('LEVEL10_REDCRYSTAL_FOUND'));
	end
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	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 == 'CyanCrystal' and objName == gameState.toolMap[toolName] and
		gameState.idolTopOnPlace == true) then
    	gameState.cyanCrystalOnPlace = true;
		toolApplied = true;
		playField:GetLevelScreen():ShowTip(GetTextString('LEVEL10_CYANCRYSTAL_USED'));
		auxHideWildFlowers();
	end
	if (toolName == 'Lever' and objName == gameState.toolMap[toolName]) then
    	gameState.leverOnPlace = true;
		toolApplied = true;
	end
	if (toolName == 'BlueCrystal' and objName == gameState.toolMap[toolName]) then
    	gameState.blueCrystalOnPlace = true;
		toolApplied = true;
	end
	if (toolName == 'IdolTop' and objName == gameState.toolMap[toolName] and
		gameState.sabreUsed == true) then
    	gameState.idolTopOnPlace = true;
		toolApplied = true;
		auxDropDownRope();
	end
	if (toolName == 'RedCrystal' and objName == gameState.toolMap[toolName]) then
    	gameState.redCrystalOnPlace = true;
		toolApplied = true;
	end
	if (toolName == 'Sabre' and objName == gameState.toolMap[toolName]) then
    	gameState.sabreUsed = true;
		toolApplied = true;
		PlaySound('L10S13');
	end
	if (not toolApplied) then
	    playField:GetLevelScreen():ShowTip(GetTextString('WRONG_ITEM_APPLIED_TIP1'),
										   GetTextString('WRONG_ITEM_APPLIED_TIP2'));
	end

	if (gameState.cyanCrystalOnPlace == true and
    	gameState.leverOnPlace == true and
    	gameState.blueCrystalOnPlace == true and
    	gameState.idolTopOnPlace == true and
    	gameState.redCrystalOnPlace == true and
    	gameState.sabreUsed == 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/10_UndergroundGarden/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,98,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/bag.png',0,0,62,79,1,0)
	anim:SetHotSpot(31,39)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bag',anim,230,75,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/barrel.png',0,0,74,94,1,0)
	anim:SetHotSpot(37,47)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('barrel',anim,863,540,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/bat.png',0,0,153,69,1,0)
	anim:SetHotSpot(76,34)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bat',anim,700,213,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/beads.png',0,0,54,87,1,0)
	anim:SetHotSpot(27,43)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('beads',anim,669,53,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/book.png',0,0,58,77,1,0)
	anim:SetHotSpot(29,38)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('book',anim,388,712,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/bottle.png',0,0,25,59,1,0)
	anim:SetHotSpot(12,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bottle',anim,794,516,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/bug.png',0,0,53,56,1,0)
	anim:SetHotSpot(26,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bug',anim,377,153,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/bundleOfKeys.png',0,0,68,87,1,0)
	anim:SetHotSpot(34,43)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bundleOfKeys',anim,350,262,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/cannon.png',0,0,101,59,1,0)
	anim:SetHotSpot(50,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('cannon',anim,535,438,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/caterpillar.png',0,0,78,44,1,0)
	anim:SetHotSpot(39,22)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('caterpillar',anim,858,179,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/church.png',0,0,38,56,1,0)
	anim:SetHotSpot(19,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('church',anim,597,190,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/coin1.png',0,0,40,41,1,0)
	anim:SetHotSpot(20,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('coin1',anim,158,749,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/coin.png',0,0,68,53,1,0)
	anim:SetHotSpot(34,26)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('coin',anim,505,738,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/compass.png',0,0,71,73,1,0)
	anim:SetHotSpot(35,36)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('compass',anim,600,699,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/crown.png',0,0,40,42,1,0)
	anim:SetHotSpot(20,21)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('crown',anim,748,475,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/demijohn.png',0,0,62,92,1,0)
	anim:SetHotSpot(31,46)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('demijohn',anim,914,599,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/dino.png',0,0,157,118,1,0)
	anim:SetHotSpot(78,59)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('dino',anim,840,420,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/dragon.png',0,0,127,72,1,0)
	anim:SetHotSpot(63,36)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('dragon',anim,844,86,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/eggs.png',0,0,35,32,1,0)
	anim:SetHotSpot(17,16)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('eggs',anim,944,122,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/fan.png',0,0,65,56,1,0)
	anim:SetHotSpot(32,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('fan',anim,561,623,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/feather.png',0,0,34,88,1,0)
	anim:SetHotSpot(17,44)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('feather',anim,238,463,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/fly.png',0,0,43,63,1,0)
	anim:SetHotSpot(21,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('fly',anim,214,176,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/grasshopper.png',0,0,55,29,1,0)
	anim:SetHotSpot(27,14)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('grasshopper',anim,316,117,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/gun.png',0,0,79,76,1,0)
	anim:SetHotSpot(39,38)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('gun',anim,459,696,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/halberd.png',0,0,132,133,1,0)
	anim:SetHotSpot(66,66)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('halberd',anim,908,260,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/handbell.png',0,0,41,84,1,0)
	anim:SetHotSpot(20,42)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('handbell',anim,833,603,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/lantern.png',0,0,46,74,1,0)
	anim:SetHotSpot(23,37)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('lantern',anim,841,229,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/onions.png',0,0,54,43,1,0)
	anim:SetHotSpot(27,21)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('onions',anim,296,745,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/parrot.png',0,0,41,91,1,0)
	anim:SetHotSpot(20,45)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('parrot',anim,208,334,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/piratHat.png',0,0,122,90,1,0)
	anim:SetHotSpot(61,45)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('piratHat',anim,671,640,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/plate.png',0,0,87,63,1,0)
	anim:SetHotSpot(43,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('plate',anim,677,732,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/rifle.png',0,0,80,188,1,0)
	anim:SetHotSpot(40,94)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('rifle',anim,322,624,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/scroll.png',0,0,88,60,1,0)
	anim:SetHotSpot(44,30)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('scroll',anim,786,652,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/skull.png',0,0,86,92,1,0)
	anim:SetHotSpot(43,46)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('skull',anim,465,92,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/snake.png',0,0,97,49,1,0)
	anim:SetHotSpot(48,24)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('snake',anim,706,538,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/spider.png',0,0,54,145,1,0)
	anim:SetHotSpot(27,72)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('spider',anim,380,401,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/statuette.png',0,0,37,81,1,0)
	anim:SetHotSpot(18,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('statuette',anim,760,311,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/steeringWheel.png',0,0,83,106,1,0)
	anim:SetHotSpot(41,53)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('steeringWheel',anim,496,600,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/turtle.png',0,0,67,46,1,0)
	anim:SetHotSpot(33,23)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('turtle',anim,580,377,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Misc/vase.png',0,0,72,82,1,0)
	anim:SetHotSpot(36,41)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('vase',anim,783,585,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/bridge.png',0,0,168,116,1,0)
	anim:SetHotSpot(84,58)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bridge',anim,593,544,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/LayerOverBridge.png',0,0,339,170,1,0)
	anim:SetHotSpot(169,85)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverBridge',anim,579,598,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/LayerOverBarrel.png',0,0,64,71,1,0)
	anim:SetHotSpot(32,35)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverBarrel',anim,870,557,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/LayerOverBook.png',0,0,64,84,1,0)
	anim:SetHotSpot(32,42)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverBook',anim,387,713,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/LayerOverDemijohn.png',0,0,66,85,1,0)
	anim:SetHotSpot(33,42)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverDemijohn',anim,927,601,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/layerOverHalberd.png',0,0,69,68,1,0)
	anim:SetHotSpot(43,41)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('layerOverHalberd',anim,960,278,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/LayerOverLever.png',0,0,42,49,1,0)
	anim:SetHotSpot(21,24)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverLever',anim,966,372,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/LayerOverRifle.png',0,0,64,102,1,0)
	anim:SetHotSpot(32,51)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverRifle',anim,347,693,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/LayerOverStatuette.png',0,0,35,79,1,0)
	anim:SetHotSpot(17,39)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverStatuette',anim,760,311,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/LayerOverCyanCrystal.png',0,0,26,24,1,0)
	anim:SetHotSpot(13,12)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverCyanCrystal',anim,691,512,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/bush.png',0,0,204,241,1,0)
	anim:SetHotSpot(102,120)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bush',anim,129,531,109,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/leftWaterfall.png',0,0,108,214,3,8)
	anim:SetHotSpot(54,107)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('leftWaterfall',anim,467,257,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/rightWaterfall.png',0,0,108,253,3,8)
	anim:SetHotSpot(54,126)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('rightWaterfall',anim,701,221,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/ropeForCrystal.png',0,0,69,257,1,0)
	anim:SetHotSpot(34,128)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('ropeForCrystal',anim,556,127,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/BlueCrystal_onPlace.png',0,0,33,45,1,0)
	anim:SetHotSpot(16,22)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('BlueCrystal_onPlace',anim,928,729,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Cross_onPlace.png',0,0,40,54,1,0)
	anim:SetHotSpot(20,27)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Cross_onPlace',anim,157,557,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/CyanCrystal_onPlace.png',0,0,48,57,1,0)
	anim:SetHotSpot(24,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('CyanCrystal_onPlace',anim,554,253,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/IdolTop_onPlace.png',0,0,39,45,1,0)
	anim:SetHotSpot(19,22)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('IdolTop_onPlace',anim,160,511,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Lever_onPlace.png',0,0,71,70,1,0)
	anim:SetHotSpot(35,35)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Lever_onPlace',anim,938,397,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/RedCrystal_onPlace.png',0,0,25,26,1,0)
	anim:SetHotSpot(12,13)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('RedCrystal_onPlace',anim,390,608,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/radialGlow.png',0,0,97,99,1,0)
	anim:SetHotSpot(48,48)
	anim:SetBlendMode(0)
	anim:SetColor('0xFF10AAFF')
	play_field:CreateObject('CyanCrystalGlow',anim,556,251,106,0,7.5,7.5)
	local anim = CreateAnimation('data/Texture/Scenes/Common/radialGlow.png',0,0,97,99,1,0)
	anim:SetHotSpot(48,48)
	anim:SetBlendMode(0)
	anim:SetColor('0xFF4010FF')
	play_field:CreateObject('BlueCrystalGlow',anim,921,724,106,0,2.5,2.5)
	local anim = CreateAnimation('data/Texture/Scenes/Common/radialGlow.png',0,0,97,99,1,0)
	anim:SetHotSpot(48,48)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFF4010')
	play_field:CreateObject('RedCrystalGlow',anim,385,599,106,0,2,2)
	local anim = CreateAnimation('data/Texture/Scenes/Common/radialGlow.png',0,0,97,99,1,0)
	anim:SetHotSpot(48,48)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFF10FF')
	play_field:CreateObject('PurpleCrossGlow',anim,158,556,106,0,1.5,1.75)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/cyanCrystalLightMap.jpg',0,0,108,112,1,0)
	anim:SetHotSpot(54,54)
	anim:SetBlendMode(0)
	anim:SetColor('0x88FFFFFF')
	play_field:CreateObject('cyanCrystalLightMap',anim,674,471,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/flowerFarAnimation.png',0,0,180,138,20,17)
	anim:SetHotSpot(90,69)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('smallFlower1',anim,541,540,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Layers/flowerFarAnimation.png',0,0,180,138,20,13)
	anim:SetHotSpot(90,69)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('smallFlower2',anim,660,531,102,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('actZoneBridge',anim,596,535,108,-25,0.9,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('actZoneRedCrystal',anim,388,608,107,0,0.8,0.8)
	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('actZoneBlueCrystal',anim,925,728,107,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('actZoneLever',anim,937,393,107,0,0.8,0.8)
	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('actZoneCyanCrystal',anim,554,257,104,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('actZoneIdolTop',anim,155,513,107,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/BlueCrystal_ghost.png',0,0,96,96,1,0)
	anim:SetHotSpot(48,48)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('BlueCrystal_ghost',anim,928,729,110,0,0.65,0.65)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/CyanCrystal_ghost.png',0,0,96,96,1,0)
	anim:SetHotSpot(48,48)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('CyanCrystal_ghost',anim,553,255,110,0,0.8,0.8)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/IdolTop_ghost.png',0,0,64,64,1,0)
	anim:SetHotSpot(32,32)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('IdolTop_ghost',anim,160,513,108,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Lever_ghost.png',0,0,80,80,1,0)
	anim:SetHotSpot(40,40)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Lever_ghost',anim,939,397,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/RedCrystal_ghost.png',0,0,32,32,1,0)
	anim:SetHotSpot(16,16)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('RedCrystal_ghost',anim,391,608,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Sabre_ghost.png',0,0,72,160,1,0)
	anim:SetHotSpot(36,80)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Sabre_ghost',anim,156,512,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Sabre.png',0,0,59,153,1,0)
	anim:SetHotSpot(29,76)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Sabre',anim,490,508,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/BlueCrystal.png',0,0,28,34,1,0)
	anim:SetHotSpot(14,17)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('BlueCrystal',anim,707,229,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/CyanCrystal.png',0,0,26,30,1,0)
	anim:SetHotSpot(13,15)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('CyanCrystal',anim,690,506,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/IdolTop.png',0,0,33,41,1,0)
	anim:SetHotSpot(16,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('IdolTop',anim,805,314,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/Lever.png',0,0,46,78,1,0)
	anim:SetHotSpot(23,39)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Lever',anim,286,81,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/10_UndergroundGarden/Items/RedCrystal.png',0,0,15,16,1,0)
	anim:SetHotSpot(7,8)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('RedCrystal',anim,248,576,104,0,1,1)
end

function FreeData()
end
-- CLEAR_ON_SAVE_END
