function OnWarpEnter() 
	--SetMarker("cs\\Warp_0073.wp" , 0 , 0) 
	SetMarker("cs\\Warp_0070.wp" , 0 , 0) 

--DAY3
	if ETAT_DAY == "D3" then 

	   if GUARD_ON_PASSAGE_0072_D3 then
		-- garde vivant
		StartAnimationPart("hgc1",10,20,-1,false)
		SetMarker("hgc1",4,0)
	  else
		SetMarker("cs\\Warp_0073.wp" , 0 , 0) 
	  end

	 if DEAD_GUARD_PASSAGE_0072_D3 then
		SetMarker("hic1",4,0)
		if not SEEN_GUARD_DEAD_072_D3 then
			SEEN_GUARD_DEAD_072_D3 = true
			PHILIP_DEAD_GUARD_0072_D3 = true
			LookAt(315,37)
			AnimationSetToStart("hic1",true)
		elseif SEEN_GUARD_DEAD_072_D3 and not DEAD_GUARD_MOVED_D3 then
			AnimationSetToStart("hic1",true)
		elseif DEAD_GUARD_MOVED_D3 and not DEAD_GUARD_COVERED then 
			if  LetterW72 and not (WoundW72 or FootPrintW72) then
				-- garde mort
				StartAnimationPart("hic1",31,32,-1,false)
				SetMarker("LETTER_CONSTANCE",4,0)
				SetMarker("hic1",4,0)
			elseif LetterW72 then
				-- garde mort
				StartAnimationPart("hic1",31,32,-1,false)
				SetMarker("hic1",4,0)
			else	
				-- garde mort
				StartAnimationPart("hic1",29,30,-1,false)
				SetMarker("LETTER_CONSTANCE",4,0)
			end
		elseif DEAD_GUARD_COVERED then
			-- garde mort
			StartAnimationPart("hic1",32,33,-1,false)
			SetMarker("hic1",4,0)
		end

		if PHILIP_DEAD_GUARD_0072_D3 then
			-- Jean-Aimé
			StartAnimationPart("hhc1",0,30,-1,false)
			SetMarker("hhc1",4,0)
		end
	end

	end

--DAY4 
	if ETAT_DAY == "D4" then 
		SetMarker("cs\\Warp_0073.wp" , 0 , 0) 
	end
end


function OnAnimationFinished(objectName)
	if ETAT_DAY == "D3" then
		-- garde mort
		if objectName=="hic1" then
			StartAnimationPart("hic1",29,30,-1,false)
			SetMarker("LETTER_CONSTANCE",4,0)
			SetMarker("hic1",4,0)
			DEAD_GUARD_MOVED_D3 = true	
			if not TALKED_TO_JEAN_0072 then
				LookAt(231,10)
				-- Jean-Aimé
				SetMarker("hhc1",-1,0)
				TALKED_TO_JEAN_0072 = true
				if DRESS_MADELEINE then
					-- Jean-Aimé
					StartAnimationPart("hhc1",30,60,-1,false)
					DrawText("Ch2493","Ch2493.ogg",3)
					DrawText("Ch2494","Ch2494.ogg",3)
					DrawText("Ma2495","Ma2495.ogg",0)
					DrawText("Ma2496","Ma2496.ogg",0)
					DrawText("Ch2497","Ch2497.ogg",3)
					DrawText("Ma2498","Ma2498.ogg",0)
					DrawText("Ch2499","Ch2499.ogg",3)
					DrawText("Ma2500","Ma2500.ogg",0)
					DrawText("Ma2501","Ch2501.ogg",0)
				elseif DRESS_CESAR then
					-- Jean-Aimé
					StartAnimationPart("hhc1",30,60,-1,false)
					DrawText("Ch2504","Ch2504.ogg",3)
					DrawText("Ce2505","Ce2505.ogg",1)
					DrawText("Ce2506","Ce2506.ogg",1)
					DrawText("Ch2507","Ch2507.ogg",3)
					DrawText("Ce2508","Ce2508.ogg",1)
					DrawText("Ch2509","Ch2509.ogg",3)
					DrawText("Ce2510","Ce2510.ogg",1)
					DrawText("Ce2511","Ce2511.ogg",1)
				end

			end
		end
	end
end


function OnDialogFinished(dialogName)

	if dialogName == "G22537" or dialogName == "G22544"  or dialogName == "G22547" then
		StartAnimationPart("hgc1",10,30,-1,true)
		if not BeenIn_062 then
			AskSeparation()
		elseif Ph_Key_051 and O_SmallPacket_058 and not BeenIn_071 then
			AskSeparation()
		else
			SetMarker("hgc1",4,0)
		end
	end
	
	if ETAT_DAY == "D3" then
		if dialogName == "Ce2543" or dialogName == "Ma2536" then
			StartAnimationPart("hgc1",40,60,-1,false)
		end
		if dialogName == "Ch2494" or dialogName == "Ch2497" or dialogName == "Ch2499" or dialogName == "Ch2501" or dialogName == "Ch2504" or dialogName == "Ch2507" or dialogName == "Ch2509"  then
			-- Jean-Aimé
			StartAnimationPart("hhc1",0,30,-1,false)
		end
		if dialogName == "Ma2496" or dialogName == "Ma2498" then
			-- Jean-Aimé
			StartAnimationPart("hhc1",30,60,-1,false)
		end
		if dialogName == "Ce2506" or dialogName == "Ce2508" then	
			-- Jean-Aimé
			StartAnimationPart("hhc1",30,60,-1,false)
		end
		if dialogName == "Ma1811" then	
			SetMarker("hic1", 4, 0)
		end
		if dialogName == "Ch2501" or dialogName == "Ce2511" or dialogName == "Ma2514" or dialogName == "Ma2501" then
--		elseif dialogName == "Ch2499" then
			-- Jean-Aimé
			SetMarker("hhc1",4,0)
		end
		if dialogName =="Ma2533" then
			if not DEAD_GUARD_COVERED and not (WoundW72 or FootPrintW72 or LetterW72) then
				SetMarker("hic1",4,0)
				SetMarker("LETTER_CONSTANCE",4,0)
			else
				SetMarker("hic1",4,0)
			end
		end
	end
end


function AskSeparation()

	 if Ph_Key_051 and O_SmallPacket_058 then
		PushAnswer("Ce2258")
	end
	if not BeenIn_062 then
		PushAnswer("Ce2546")
	end
	PushAnswer("3411")
	
end


function OnAnswered(dialogName)
	if dialogName == "Ce2543" then
		StartAnimationPart("hgc1",40,60,-1,false)
		DrawText("G22544","G22544.ogg",6)
	elseif dialogName == "Ce2546" then
		StartAnimationPart("hgc1",40,60,-1,false)
		DrawText("G22547","G22547.ogg",6)
	elseif dialogName == "Ce2258" then
		StartAnimationPart("hgc1",40,60,-1,false)
		DrawText("G22538","G22538.ogg",6)
	elseif dialogName == "3411" then
		SetMarker("hgc1",4,0)
	end
end


function OnWarpLeave()
end


function OnWarpObjectHit(objectName)

	if objectName == "3D\\cs\\Warp_0073.wp" then
--		if ETAT_DAY == "D3" or ETAT_DAY == "D4" or ETAT_DAY == "D5" then
--			if DEAD_GUARD_PASSAGE_0072_D3 and not  TALKED_TO_JEAN_0072 then
--				DrawText("Ma2514","Ma2514.ogg",0) -- Ce n'est pas le moment. Je dois m'occuper du garde.
--			elseif not  then
--			else
		if ETAT_DAY == "D4" or ETAT_DAY == "D5" then
			ChangeWarp(objectName)
		elseif ETAT_DAY == "D3" and DEAD_GUARD_PASSAGE_0072_D3 and TALKED_TO_JEAN_0072 then
			ChangeWarp(objectName)
		elseif DEAD_GUARD_PASSAGE_0072_D3 and not  TALKED_TO_JEAN_0072 then
				DrawText("Ma2514","Ma2514.ogg",0) -- Ce n'est pas le moment. Je dois m'occuper du garde.
		end
	end

	if objectName == "3D\\cs\\Warp_0070.wp" then 
		if DEAD_GUARD_PASSAGE_0072_D3 and not  TALKED_TO_JEAN_0072 then
			DrawText("Ma2514","Ma2514.ogg",0)
		else
			ChangeWarp(objectName)
		end
	end

--DAY3
	if ETAT_DAY == "D3" then 
		if objectName == "gec1" then

		-- bougies
		elseif objectName == "exc1" then

		-- scribe
		elseif objectName == "gac1" then

		elseif objectName == "hgc1" then
			SetMarker("hgc1",-1,0)
			if DRESS_CESAR then
				DrawText("Ce2543","Ce2543.ogg",1)
				DrawText("G22544","G22544.ogg",6)
			elseif DRESS_MADELEINE then
				DrawText("Ma2536","Ma2536.ogg",0)
				DrawText("G22537","G22537.ogg",6)
			end
		-- Jean-Aimé
		elseif objectName == "hhc1" then
			SetMarker("hhc1",-1,0)
			if not TALKED_TO_JEAN_0072 then
				-- Jean-Aimé
				TALKED_TO_JEAN_0072 = true
				if DRESS_MADELEINE then
					-- Jean-Aimé
					StartAnimationPart("hhc1",30,60,-1,false)
					DrawText("Ch2493","Ch2493.ogg",3) -- Voici donc la neuvième victime de cette funeste prophétie.
					DrawText("Ch2494","Ch2494.ogg",3) -- Tu dois te rendre à l'évidence Madeleine, rien n'enrayera la fatalité.
					DrawText("Ma2495","Ma2495.ogg",0)
					DrawText("Ma2496","Ma2496.ogg",0)
					DrawText("Ch2497","Ch2497.ogg",3)
					DrawText("Ma2498","Ma2498.ogg",0)
					DrawText("Ch2499","Ch2499.ogg",3)
					DrawText("Ma2500","Ma2500.ogg",0)
					DrawText("Ma2501","Ma2501.ogg",0) -- Il y a là un mort et nous devons trouver ce qu'il lui est arrivé !
				elseif DRESS_CESAR then
					-- Jean-Aimé
					StartAnimationPart("hhc1",30,60,-1,false)
					DrawText("Ch2504","Ch2504.ogg",3) -- Tu dois te rendre à l'évidence César, rien n'enrayera la fatalité.
					DrawText("Ce2505","Ce2505.ogg",1) -- Peut-être, mais je peux confondre celui qui s'en fait l'instrument.
					DrawText("Ce2506","Ce2506.ogg",1)
					DrawText("Ch2507","Ch2507.ogg",3)
					DrawText("Ce2508","Ce2508.ogg",1)
					DrawText("Ch2509","Ch2509.ogg",3)
					DrawText("Ce2510","Ce2510.ogg",1)
					DrawText("Ce2511","Ce2511.ogg",1) -- Quoi qu'il en soit, nous en reparlerons plus tard, j'ai mieux à faire que de me quereller. 
				end
			else 
				DrawText("Ma2514","Ma2514.ogg",0) -- Ce n'est pas le moment. Je dois m'occuper du garde.
			end

		-- garde mort
		elseif objectName == "hic1" then
			if not DEAD_GUARD_MOVED_D3 and not LETTER_TAKEN_D3 and not DEAD_GUARD_COVERED_D3 then
				SetMarker("hic1",-1,0)
				StartAnimationPart("hic1",0,29,1,false)
				PlaySound("Sounds/SFX/garde_SeTourne.ogg",1)
			elseif LetterW72 and Selected("C_drap") then
				PlaySound("Sounds/SFX/E_cb_drap_Glisse.ogg",1)
				RemoveFromBag()
				-- garde mort
				StartAnimationPart("hic1",32,33,-1,false)
				DEAD_GUARD_COVERED = true
				SetMarker("hic1",-1,0)
				SetMarker("LETTER_CONSTANCE",-1,0)
			elseif DEAD_GUARD_COVERED then
				SetMarker("hic1",-1,0)
				DrawText("Ma1811","Ma1811.ogg", 0) -- Il ne m'apprendra rien de plus.
			else
				SetMarker("hic1",-1,0)
				SetMarker("LETTER_CONSTANCE",-1,0)
				DrawText("Ma2533","Ma2533.ogg", 0) -- Pourvu que je découvre ce qui se passe avant que quelqu'un d'autre ne meure !
			end

		elseif objectName == "3D\\LETTER_CONSTANCE" then
			if not LetterW72 then
				ShowToolBox("W72_00")
			elseif LetterW72 and not WoundW72 then
				ShowToolBox("W72_01")
			elseif LetterW72 and not FootPrintW72 then
				ShowToolBox("W72_01")
			end


		end
	end
end
