function OnWarpEnter()
	PlaySound("Sounds/SFX/A_Wind2.ogg",-1)
	SetMarker("Memphis\\Warp_0026.wp",0,0)
	SetMarker("Memphis\\Warp_0014.wp",0,0)
	AnimationSetToEnd("d1s1",false)
	AnimationSetToEnd("d2s1",false)
	AnimationSetToEnd("d5s1",false)
	AnimationSetToEnd("d6s1",false)
	if not O_plate_me_017 then
		PutObject("p1s1")
	end
	
	StartAnimationPart("o3s1",170,190,-1,true)
	SetMarker("o3s1",4,0)					


	if not Video_me_017 and PerfumeGiven_me_009 then
		if KnowLili_me_017 then
			PutObject("n1s1")
			SetMarker("n1s1",4,0)
		end
	elseif PerfumeGiven_me_009 then
		PutObject("n2s1")
		if not O_gouge_me_017 then
			PutObject("gos1")
			SetMarker("gos1",2,0)
		end
	end

	if FinishCH5_as then
		AnimationSetToEnd("nus1",false)
	end
	
	if FinishCH6_me then
		StartAnimationPart("o4s1",97,107,-1,true)
		SetMarker("o4s1",4,0)
	end
end

function OnWarpLeave()
end

function OnDialogFinished(dialogName)
	if dialogName=="OUVC0657" then
		SetMarker("o3s1",4,0)
		
	end
	if dialogName=="OUVC0673" or dialogName=="OUVC0611" or dialogName=="MAIA0612" or dialogName=="OUVC0616" or dialogName=="OUVC1053" or dialogName=="OUVC1060" or dialogName=="OUVC1064" or dialogName=="OUVC1068" or dialogName=="OUVC1069" or dialogName=="OUVC1055" or dialogName=="OUVC1124" or dialogName=="MAIA0798" or dialogName=="OUVC1130" or dialogName=="OUVC0674" then
		SetMarker("o3s1",4,0)
		
	end
	if dialogName=="MAIA0660" then
		StartAnimationPart("o3s1",75,170,1,true)
	end
	
	if dialogName=="MAIA1054" or dialogName=="MAIA1061" or dialogName=="MAIA1063" or dialogName=="MAIA1059" or dialogName=="MAIA0654" or dialogName=="MAIA0656" or dialogName=="MAIA0658" or dialogName=="MAIA0660" or dialogName=="MAIA0615" or dialogName=="MAIA0606"  or dialogName=="MAIA0610" then
		StartAnimationPart("o3s1",190,205,-1,true)
	end

	if dialogName=="OUVC0673" or dialogName=="OUVC0611" or dialogName=="MAIA0612" or dialogName=="OUVC0616" or dialogName=="OUVC1053" or dialogName=="OUVC1060" or dialogName=="OUVC1064" or dialogName=="OUVC1068" or dialogName=="OUVC1069" or dialogName=="OUVC1055" or dialogName=="OUVC1124" or dialogName=="MAIA0798" or dialogName=="OUVC1130" or dialogName=="OUVC0674" then
		SetMarker("o3s1",4,0)
		StartAnimationPart("o3s1",170,190,-1,true)
	end

	if dialogName=="OUVC1062" or dialogName=="OUVC1058" or dialogName=="OUVC0655" or dialogName=="OUVC0657" or dialogName=="OUVC0659" or dialogName=="OUVC0607" or dialogName=="OUVC1069" then
		StartAnimationPart("o3s1",170,190,-1,true)
	end

	if dialogName=="MAIA0692" then
		SetMarker("o3s1",4,0)
		AddToBag("J_jonc")
		O_frag_me_017=true
		AddToBag("J_graine_nenuphare")
	end
	if dialogName=="OUVD1129" or dialogName=="OUVD1127" then
		SetMarker("o4s1",4,0)
	end 
	if dialogName=="OUVD1125" or dialogName=="OUVD1129" or dialogName=="OUVD1127" then
		StartAnimationPart("o4s1",97,107,-1,true)
	end
	if dialogName=="MAIA1126" then
		StartAnimationPart("o4s1",108,135,-1,true)
	end
	if dialogName=="MAIA0798" then
		LookAt(263,033)
		StartAnimationPart("o4s1",108,135,-1,true)
		DrawText("OUVD1128","OUVD1128.ogg")
		AddToBag("J_Sel")
	end
end

function OnAnimationFinished(objectName)
	if objectName=="o3s1" then
		StartAnimationPart("o3s1",170,190,-1,true)
	end
end

function OnWarpObjectHit(objectName)
	if objectName == "f1s1" then

------------------------------------------------------------
	elseif objectName == "o3s1" then
		LookAt(223,025)

		if Cured_me_17 then
			LookAt(223,025)

			SetMarker("o3s1",-1,0)
			StartAnimationPart("o3s1",190,205,-1,true)
			DrawText("OUVC1130","OUVC1130.ogg")
		elseif SemiCured_me_017 and Selected("J_Mouchoir") and not Cured_me_17 then
			Cured_me_17=true
			LookAt(223,025)
			SetMarker("o3s1",-1,0)
			DrawText("MAIA0798","MAIA0798.ogg")
			
		elseif FinishCH6_me then
			LookAt(223,025)
			SetMarker("o3s1",-1,0)
			StartAnimationPart("o3s1",190,205,-1,true)
			DrawText("OUVC1124","OUVC1124.ogg")
		elseif Selected("J_plat_oeuf") then
			LookAt(223,025)
			SetMarker("o3s1",-1,0)
			RemoveFromBag()
			StartAnimationPart("o3s1",190,205,-1,true)
			DrawText("OUVC1068","OUVC1068.ogg")
			GivenEgg_me=true
		elseif Selected("J_calame_encre") then
			RemoveFromBag()
                        PlayMovie("Videos/GC_C05_Montage.ogv", "Videos/cine05.ogg")                                                       -------------HERE STARTS VIDEO
			AddToBag("J_papyrus_complet")
			O_PapComplete_me_017=true
		elseif O_PapComplete_me_017 then
			LookAt(223,025)
			SetMarker("o3s1",-1,0)
			DrawText("MAIA1054","MAIA1054.ogg")
			DrawText("OUVC1055","OUVC1055.ogg")
		elseif GivenEgg_me then
			LookAt(223,025)
			SetMarker("o3s1",-1,0)
			StartAnimationPart("o3s1",190,205,-1,true)
			DrawText("OUVC1069","OUVC1069.ogg")
		elseif O_PapInc_me_021 and Selected("J_Papyrus_incomplet") then
			LookAt(223,025)
			SetMarker("o3s1",-1,0)
			RemoveFromBag()
			DrawText("MAIA1061","MAIA1061.ogg")
			DrawText("OUVC1062","OUVC1062.ogg")
			DrawText("MAIA1063","MAIA1063.ogg")
			DrawText("OUVC1064","OUVC1064.ogg")
			GivenIncompletePap_me=true
		elseif GivenIncompletePap_me then
			LookAt(223,025)
			SetMarker("o3s1",-1,0)
			DrawText("MAIA1063","MAIA1063.ogg")
			DrawText("OUVC1064","OUVC1064.ogg")
		elseif O_PapInc_me_021 then
			LookAt(223,025)
			SetMarker("o3s1",-1,0)
			DrawText("MAIA1057","MAIA1057.ogg")
			DrawText("OUVC1058","OUVC1058.ogg")
			DrawText("MAIA1059","MAIA1059.ogg")
			DrawText("OUVC1060","OUVC1060.ogg")
		elseif FinishCH5_as then
			LookAt(223,025)
			SetMarker("o3s1",-1,0)
			DrawText("MAIA1052","MAIA1052.ogg")
			DrawText("OUVC1053","OUVC1053.ogg")
		elseif not TalkedPamose_me_004 and not PerfumeGiven_me_009 then
			--StartAnimationPart("o3s1",50,70,1,true)
			LookAt(223,025)
			SetMarker("o3s1",-1,0)
			DrawText("MAIA0654","MAIA0654.ogg")
			DrawText("OUVC0655","OUVC0655.ogg")
			DrawText("MAIA0656","MAIA0656.ogg")
			DrawText("OUVC0657","OUVC0657.ogg")
		elseif not PerfumeGiven_me_009 and not KnowName_me_004 then
		--	StartAnimationPart("o3s1",50,70,1,true)
			LookAt(223,025)
			SetMarker("o3s1",-1,0)
			DrawText("MAIA0658","MAIA0658.ogg")
			DrawText("OUVC0659","OUVC0659.ogg")
			DrawText("MAIA0660","MAIA0660.ogg")
			DrawText("OUVC0673","OUVC0673.ogg")
			KnowName_me_004=true
		elseif not PerfumeGiven_me_009 then
			DrawText("OUVC0674","OUVC0674.ogg")
		elseif PerfumeGiven_me_009 and not O_frag_as_017 then	
			if Selected("Gouge") and O_gouge_me_017 then
				SetMarker("o3s1",-1,0)	
				RemoveFromBag()
				DrawText("MAIA0615","MAIA0615.ogg")
				DrawText("OUVC0617","OUVC0617.ogg")
				DrawText("OUVC0618","OUVC0618.ogg")
				DrawText("OUVC0619","OUVC0619.ogg")
				DrawText("MAIA0692","MAIA0692.ogg")
			
			elseif O_frag_me_017 then
				SetMarker("o3s1",-1,0)	
				StartAnimationPart("o3s1",190,205,-1,true)
				DrawText("OUVC0674","OUVC0674.ogg")
						
			elseif  O_gouge_me_017 and not O_frag_me_017 then
				SetMarker("o3s1",-1,0)
				DrawText("MAIA0615","MAIA0615.ogg")
				DrawText("OUVC0616","OUVC0616.ogg")
			
			elseif not O_gouge_me_017 then
				SetMarker("o3s1",-1,0)
				DrawText("MAIA0606","MAIA0606.ogg")
				DrawText("OUVC0607","OUVC0607.ogg")
				DrawText("MAIA0610","MAIA0610.ogg")
				DrawText("OUVC0611","OUVC0611.ogg")
				KnowLili_me_017=true
				SetMarker("n1s1",4,0)
				if not O_Grappin_me_017 then
					DrawText("MAIA0612","MAIA0612.ogg")
				end
			end

		else 
			StartAnimationPart("o3s1",75,170,1,true)
		
		end
		
------------------------------------------------------------
	elseif objectName == "o4s1" then
			LookAt(271,029)
			if talkOther_me and Selected("J_Mouchoir") and not SemiCured_me_017 then
				DrawText("MAIA1542","MAIA1542.ogg")
				SemiCured_me_017=true
			elseif Cured_me_17 then
				SetMarker(objectName,-1,0)
				StartAnimationPart("o4s1",108,135,-1,true)
				DrawText("OUVD1129","OUVD1129.ogg")
			elseif not talkOther_me then
				talkOther_me=true
				SetMarker(objectName,-1,0)
				StartAnimationPart("o4s1",108,135,-1,true)
				DrawText("OUVD1125","OUVD1125.ogg")
				DrawText("MAIA1126","MAIA1126.ogg")
				DrawText("OUVD1127","OUVD1127.ogg")
			else
				SetMarker(objectName,-1,0)
				StartAnimationPart("o4s1",108,135,-1,true)
				DrawText("OUVD1127","OUVD1127.ogg")					
			end
------------------------------------------------------------
	elseif objectName == "fis1" then

------------------------------------------------------------
	elseif objectName == "gos1" then
		
		if not O_gouge_me_017 then
			O_gouge_me_017=true
			RemoveObject(objectName)
			SetMarker(objectName,-1,0)
			AddToBag("Gouge")
		end
------------------------------------------------------------
	elseif objectName == "n1s1" then
		
		if Selected("J_Grappin") then
			PlayMovie("Videos/GC_C06_Montage.ogv", "Videos/cine06.ogg")
			Video_me_017=true
			RemoveFromBag()
			RemoveObject(objectName)
			SetMarker(objectName,-1,0)
			PutObject("n2s1")
			PutObject("gos1")
			SetMarker("gos1",2,0)
		else
			DrawText("MAIA0613","MAIA0613.ogg")
		end
	
------------------------------------------------------------
	elseif objectName == "n2s1" then

------------------------------------------------------------
	elseif objectName == "nis1" then

------------------------------------------------------------
	elseif objectName == "oss1" then

------------------------------------------------------------
	elseif objectName == "p1s1" then

		
------------------------------------------------------------
	elseif objectName == "p1s2" then

------------------------------------------------------------
	elseif objectName == "p2s1" then

------------------------------------------------------------
	elseif objectName == "wos1" then

------------------------------------------------------------
	elseif objectName == "c2s1" then

------------------------------------------------------------
	elseif objectName == "d1s1" then

------------------------------------------------------------
	elseif objectName == "d2s1" then

------------------------------------------------------------
	elseif objectName == "d3s1" then

------------------------------------------------------------
	elseif objectName == "d5s1" then

------------------------------------------------------------
	elseif objectName == "d6s1" then

------------------------------------------------------------
	elseif objectName == "d7s1" then

------------------------------------------------------------
	elseif objectName == "mcs1" then

------------------------------------------------------------
	elseif objectName == "ors1" then
	
	elseif  objectName=="3D\\Memphis\\Warp_0014.wp" or objectName=="3D\\Memphis\\Warp_0026.wp" then
		ChangeWarp(objectName)
	end
end
