function OnWarpEnter() 
	SetMarker("cs\\Warp_0215.wp" , 0 , 0) 
	ImportAnimationWarp("3D\\cs\\Warp_0014")

	-- bougie
	StartAnimationPart("cia1",0,30,-1,false)
	
	if Puzzle_214 then --FALTA PUZZLe y piedra de nostardamus vamos derecho a D3
		Observatory_open = true
	end

	if PuzzlePlanetSolved then
		PutObject("zwa1",false)
	end
	
	if not CoffreW221 then
		AnimationSetToStart("zyan")
	else
		AnimationSetToEnd("zyan")
	end
--------------------------------------------------------------------------- balcon
	if not balcony_open then
		AnimationSetToStart("cxan", false)
		AnimationSetToStart("cyan", false)
	end
--------------------------------------------------------------------------- Nostra	
	if not OpenMachineW21 then
		AnimationSetToEnd("zman",false)
	elseif OpenMachineW21 then
		AnimationSetToStart("zman",false)
	end

	if Observatory_open then 
		SetMarker("cs\\Warp_0221.wp" , 0 , 0) 
	else
		SetMarker("cs\\Warp_0221.wp" , 4 , 0) 

	end

	SetMarker("cs\\Warp_0211.wp" , 0 , 0) 

	if ETAT_DAY == "D3" then 
		
		if AstrochartTaken and not MadeleineTired then
			DrawText("Ma3594","Ma3594.ogg",0) -- La journée a été bien remplie, je suis épuisée.
			MadeleineTired = true
		end

		--if not Observatory_open then 
		--	AnimationSetToStart("bwn1")
		--	SetMarker("bwn1", 4, 0)
		--else
			AnimationSetToEnd("bwn1")
		--end
	  Observatory_open =true
		if not DESK_COVER_MOVED then
			-- couvercle coffre
			AnimationSetToStart("cpan",false)
			StartAnimationPart("cban",1,2,-1,false)
		else
			StartAnimationPart("cban", 2, 3,-1,false)
			if not COFFRET_OPENED  then
				-- couvercle coffre
				AnimationSetToStart("cpan",false)
				if not NOTE_TAKEN_0017_D3 then
					PutObject("cjan",true)
				end
			else
				-- couvercle coffre
				StartAnimationPart("cpan",14,15,-1,false)
			end
		end
		SetMarker("cs\\Warp_0221.wp" , 0 , 0) 
	end
end

function OnWarpLeave()
end

function OnAnimationFinished(objectName) 

		if objectName == "bwn1"  and not Observatory_open then
			AnimationSetToEnd("bwn1")
			Observatory_open = true
			SetMarker("cs\\Warp_0221.wp" , 0 , 0) 
		end

end


function OnWarpObjectHit(objectName)

	if objectName == "3D\\cs\\Warp_0215.wp" then 
		ChangeWarp(objectName)
	end

	if objectName == "3D\\cs\\Warp_0221.wp" and  Observatory_open then 
		ChangeWarp(objectName)
	end

	if objectName == "3D\\cs\\Warp_0221.wp" and not Observatory_open then 
		if Selected("A_medaillon") then
			RemoveFromBag()
			ShowPuzzle(3)
			Puzzle3Activated = true
		elseif Puzzle3Activated and not PuzzleW214OK then
			ShowPuzzle(3)
		else
			DrawText("Ma1962","Ma1962.ogg",0) -- Papa garde toujours cette porte fermée, c'est dommage son observatoire est sans doute l'endroit de la maison que je préfère.

		end
	end

--		ETAT_DAY = "D3"--------------------------------------------------------------------------DEBUGGGGG PASO derecho al dia 3
--		ChangeWarp("3D\\cs\\Warp_0019.wp")
--	   else
--		ChangeWarp(objectName)
--	   end
		--ChangeWarp(objectName)
--	end

	if objectName == "3D\\cs\\Warp_0211.wp" then 
		ChangeWarp(objectName)
	end

end

function PuertaSolved()
		
--			PlaySound("Sounds/SFX/J_Cle.ogg",1)
			PuzzleW214OK = true
			PlaySound("Sounds/SFX/biblio_SOuvre.ogg",1)
			StartAnimation("bwn1",1)
			SetMarker("cs\\Warp_0221.wp" , -1 , 0) 
			PlayMusic("Sounds/Musiques/M_Mandragore.ogg")
end 