function OnDressChanged()
	RemoveObject("gpc1")
	RemoveObject("gqc1")
	RemoveObject("grc1")	
	if DRESS_MADELEINE then
		-- reflet Madeleine
		PutObject("gpc1")
	elseif DRESS_CESAR then
		-- reflet César
		PutObject("gqc1")
	elseif DRESS_MONK then
		-- reflet Madeleine en moine
		PutObject("grc1")
	end
end
function OnWarpEnter() 
	SetMarker("cs\\Warp_0064.wp" , 0 , 0) 
	SetMarker("cs\\Warp_0060.wp" , 0 , 0) 

	BlockingGuard = false

	if DRESS_MADELEINE then
		-- reflet Madeleine
		PutObject("gpc1")
	elseif DRESS_CESAR then
		-- reflet César
		PutObject("gqc1")
	elseif DRESS_MONK then
		-- reflet Madeleine en moine
		PutObject("grc1")
	end

	if not GUARD_QUEEN_ROOM_D5 then
		StartAnimationPart("fxc1",10,40,-1,false)
		PutObject("ubc1")
		SetMarker("fxc1",4,0)
	end

	if ETAT_DAY == "D3" then 
		NotExpectedW63 = true
	end 

	if ETAT_DAY == "D4" then 
		if CAN_ENTER_QUEEN_ROOM_D4 then
			NotExpectedW63 = false
		end		
	end
end

function AskSeparation()
	if ETAT_DAY == "D3" then
		if DRESS_CESAR then
			if not TALK_ABOUT_DEAD_GUARD_0073_D3 then
				PushAnswer("Ce2254")
				if SEEN_GUARD_DEAD_072_D3 then
					PushAnswer("Ce2263")
				end
			else
				PushAnswer("Ce2268") -- Vous le connaissiez un peu ?
				if Rose then
					PushAnswer("Ce2270") -- Savez-vous s'il avait une amie ?
				end
			end
			if TALK_ABOUT_CONSTANCE_0063_D3 then
				PushAnswer("Ce2273")
			end
			PushAnswer("3411") -- prendre congé
		elseif DRESS_MADELEINE then
			if not TALK_ABOUT_DEAD_GUARD_0073_D3 then
				PushAnswer("Ma2224")
				if SEEN_GUARD_DEAD_072_D3 then
					PushAnswer("Ma2238")
				end
			else
				PushAnswer("Ma2243")
				PushAnswer("Ma2245")
			end
			if TALK_ABOUT_CONSTANCE_0063_D3 then
				PushAnswer("Ma2249") -- Vous savez où je peux trouver cette demoiselle ?
			end
		end
	end
end

function OnAnswered(textId)
	if ETAT_DAY=="D3" then
		if textId == "Ma2224" then
			StartAnimationPart("fxc1",40,70,-1,false)
			DrawText("G12226","G12226.ogg",7)
		end
		if textId == "Ce2254" then
			StartAnimationPart("fxc1",40,70,-1,false)
			DrawText("G12226","G12226.ogg",7)
		end
		if textId == "Ce2263" then
			StartAnimationPart("fxc1",40,70,-1,false)
			TALK_ABOUT_DEAD_GUARD_0073_D3 = true
			DrawText("G12264","G12264.ogg",7)
			DrawText("Ce2265","Ce2265.ogg",1)
			DrawText("G12266","G12266.ogg",7)
			DrawText("G12267","G12267.ogg",7)
		end
		if textId == "Ce2268" then
			StartAnimationPart("fxc1",40,70,-1,false)
			DrawText("G12269","G12269.ogg",7)
		end
		if textId == "Ce2270" then
			StartAnimationPart("fxc1",40,70,-1,false)
			DrawText("G12271","G12271.ogg",7)
			TALK_ABOUT_CONSTANCE_0063_D3 = true
		end
		if textId == "Ce2273" then
			StartAnimationPart("fxc1",40,70,-1,false)
			DrawText("G12274","G12274.ogg",7)
			DrawText("G12275","G12275.ogg",7)
		end
		
		if textId == "Ma2238" then
			StartAnimationPart("fxc1",40,70,-1,false)
			TALK_ABOUT_DEAD_GUARD_0073_D3 = true
			DrawText("G12241","G12241.ogg",7)
		end
		if textId == "Ma2243" then
			StartAnimationPart("fxc1",40,70,-1,false)
			DrawText("G12244","G12244.ogg",7)
		end
		if textId == "Ma2245" then
			StartAnimationPart("fxc1",40,70,-1,false)
			DrawText("G12246","G12246.ogg",7)
			TALK_ABOUT_CONSTANCE_0063_D3 = true
		end
		if textId == "Ma2249" then -- Vous savez où je peux trouver cette demoiselle ?
			StartAnimationPart("fxc1",40,70,-1,false)
			DrawText("G12250","G12250.ogg",7) -- Sa chambre est derrière vous sur la droite.
			DrawText("G12251","G12251.ogg",7) -- Elle doit y être en ce moment.
		end
		if textId == "3411" then -- prendre congé
			SetMarker("fxc1",4,0)
		end
	end
end


function OnDialogFinished(dialogName)

	if dialogName == "G12227" and NotExpectedW63 and AnimationGuard then
		AnimationGuard = false
		GuardOnPlace = true
	end
	if dialogName == "Ma1087" or dialogName == "G12251" then
		SetMarker("fxc1",4,0)
	end

	if ETAT_DAY == "D3" then
		if dialogName == "G12267" then
			AskSeparation()
		end
		if dialogName == "G12241" then
			AskSeparation()
		end
		if dialogName == "G12226" or dialogName == "G12264" or dialogName == "G12267" or dialogName == "G12269" or dialogName == "G12271" or dialogName == "G12275" or dialogName == "G12241" or dialogName == "G12244" or dialogName == "G12246" or dialogName == "G12251" then
			StartAnimationPart("fxc1",10,40,-1,false)
		end
		if dialogName == "Ma2224" or dialogName == "Ma2238" or dialogName == "Ma2243" or dialogName == "Ma2245" or dialogName == "Ma2249"   then
			StartAnimationPart("fxc1",40,70,-1,false)
		end
		if dialogName == "Ce2254" or dialogName == "Ce2263" or dialogName == "Ce2265"  or dialogName == "Ce2268"  or dialogName == "Ce2270" or dialogName == "Ce2273"  then
			StartAnimationPart("fxc1",40,70,-1,false)
		end
		if dialogName == "G12251" or dialogName == "G12246" or dialogName == "G12244" or dialogName == "G12226" or dialogName == "G12271" or dialogName == "G12269" then
			SetMarker("fxc1",4,0)
		end
	end
	if ETAT_DAY == "D4" then
		if dialogName == "G12232" then
			StartAnimationPart("fxc1",10,40,-1,false)
			SetMarker("fxc1",4,0)
			SetMarker("cs\\Warp_0061.wp" , 0 , 0) 
--			CAN_ENTER_QUEEN_ROOM_D4 = true
		end
		if dialogName == "Ce2254" or dialogName == "Ma2224" then
			StartAnimationPart("fxc1",40,70,-1,false)
		end
		if dialogName == "G12226" then
			StartAnimationPart("fxc1",10,40,-1,false)
			SetMarker("fxc1",4,0)
			SetMarker("cs\\Warp_0061.wp" , 0 , 0) 
		end
		
	end
end

function OnAnimationFinished(objectName)
	if objectName == "fxc1" then
		if GUARD_GOES then
			StartAnimationPart("fxc1",40,70,1,false)
			DrawText("G12226","G12226.ogg",7)
			GUARD_GOES = false
		elseif NotExpectedW63 and BlockingGuard then
			StartAnimationPart("fxc1",40,70,1,false)
			DrawText("G12227","G12227.ogg",7) -- Vous n'êtes pas attendue, je ne peux pas vous laisser entrer.
			BlockingGuard = false
			AnimationGuard = true
		elseif NotExpectedW63 and GuardOnPlace then
			StartAnimationPart("fxc1",10,40,-1,false)
			SetMarker("fxc1",4,0)
			SetMarker("cs\\Warp_0061.wp" , 0 , 0) 		
		end
	end
end

function OnWarpLeave()
end

function OnWarpObjectHit(objectName)

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

	if objectName == "3D\\cs\\Warp_0060.wp" then 
		if ETAT_DAY == "D4" and CAN_ENTER_QUEEN_ROOM_D4 then
			ChangeWarp("3D\\cs\\Warp_0060.wp")
		elseif NotExpectedW63 then
			if not BlockingGuard then
				if DRESS_CESAR then
					StartAnimationPart("fxc1",10,40,1,false)
					SetMarker("fxc1",-1,0)
					SetMarker("cs\\Warp_0061.wp" , -1 , 0) 
					BlockingGuard = true
					GuardOnPlace = false
				else
					DrawText("Ma1087","Ma1087.ogg",0) -- Non, j'ai quelque chose à faire avant...
				end
			end
		else
			ChangeWarp(objectName)
		end
	end

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

		elseif objectName == "fxc1" then
--			SetMarker("fxc1",-1,0)
			if DRESS_CESAR then
				if SEEN_DEAD_GUARD_D3 then
					AskSeparation()
				else
					DrawText("Ce2254","Ce2254.ogg",1) -- Je viens voir Sa Majesté Catherine de Médicis.
					DrawText("G12226","G12226.ogg",7) -- Impossible, Sa Majesté ne reçoit personne.
				end
			else
				DrawText("Ma1087","Ma1087.ogg",0) -- Non, j'ai quelque chose à faire avant...
			end

		end
	end 

--DAY4
	if ETAT_DAY == "D4" then 
		if objectName == "gpc1" then

		elseif objectName == "fxc1" then
			SetMarker("fxc1",-1,0)
			if DRESS_CESAR then
				if not CAN_ENTER_QUEEN_ROOM_D4 then
					DrawText("Ce2254","Ce2254.ogg",1) -- Je viens voir Sa Majesté Catherine de Médicis.
					DrawText("G12226","G12226.ogg",7) -- Impossible, Sa Majesté ne reçoit personne.
				else
					DrawText("Ce2254","Ce2254.ogg",1) -- Je viens voir Sa Majesté Catherine de Médicis.
					DrawText("G12232","G12232.ogg",7) -- Entrez, Sa Majesté veut bien vous recevoir.
				end
			else
				DrawText("Ma1087","Ma1087.ogg",0) -- Non, j'ai quelque chose à faire avant...
			end

		end
	end
end
