SCRIPT_CHAPTER

/////////////////////////////////////////////////////////////////
// Déclaration constantes & variables
/////////////////////////////////////////////////////////////////

section DECLARE

// entites

	_CITADIN_ANACHORETE		90
	_ANACHORETE			91
	_CLEF				92
	_PINCES				93
	_PAYSAN_CHRETIEN		149
	_GARDE_MONASTERE		150
	_FRESQUE_ROI			484
	_DUMMY_APPELS_NOVELIUS		572
	_DUMMY_PUITS			599
	_FOUET				685
	_CITADIN_FORGE			753
	_DUMMY_TRAVELLING		5555

// items objet

	_IO_CLEF_CATACOMBE		42
	_IO_PINCES			43

// items indice

	_II_GWEN			18
	_II_NOVELIUS			19
	_II_PORTE			21

// items destinations



// evenements

	// use

	_U_PINCES			2
	_U_CLEF				3
	
	// pick

	// explorer
	
	_E_PINCES			1

	// commentaires

	_C_CORWYN			4
	_C_PORTE_CATACOMBE		5
	_C_PUITS			6
	_C_CLEF				16

	// dialogues

	_D_PAYSAN_CHRETIEN		10
	_D_CITADIN_ANACHORETE		11
	_D_CITADIN_FORGE		12
	_D_ANACHORETE			13
	_D_GARDE_MONASTERE		15

	// CTR

	_CTR_ENTREE_CIRQUE		19
	_CTR_USE_PINCES			21

	// generiques

	_G_SORTIE_CIRQUE		18

	// options cbts

	// cbts
	
	// audio
	
	_A_APPELS_NOVELIUS		20

section END


/////////////////////////////////////////////////////////////////
// Définition des événements
/////////////////////////////////////////////////////////////////

section EVENTS

	USE
	{
		ID		_U_PINCES
		AREA		_CIRQUE
		
		PRIMTRIG
		{
			DIST	400
			ORIENT	"TO"
			ENTITE	_CLEF
		}
		
		ITEM		(_IO_PINCES, _INV_OBJET)
//		ANIM		"aspec 10" "utiliser pince - pause"
	}
	
	USE
	{
		ID		_U_CLEF
		AREA		_CIRQUE
		
		PRIMTRIG
		{
			DIST	300
			ORIENT	"TO"
			ENTITE	_PORTE_CATACOMBE_EXT_N2
		}
		
		ENTITE		_CLEF
		ITEM		(_IO_CLEF_CATACOMBE, _INV_OBJET)
		ANIM		"aspec 2" "utiliser cle - pause"
		STATUS		0
	}

	// ==============================================

	EXPLORE
	{
		ID		_E_PINCES
		AREA		_CIRQUE
		HEIGHT		"H0"
		
		PRIMTRIG
		{
			DIST	200
			ORIENT	"TO"
			ENTITE	_PINCES
		}
		
		ENTITE		_PINCES
		COMMENT		904
		ACTION		1
	}

	// ==============================================

	COMMENT
	{
		ID		_C_CORWYN
		AREA		_CIRQUE
		
		PRIMTRIG
		{
			DIST	2500
			ORIENT	"NONE"
			ENTITE	_ANACHORETE
		}
		
//		COMMENT		200
	}
	
	COMMENT
	{
		ID		_C_PORTE_CATACOMBE
		AREA		_CIRQUE
		
		PRIMTRIG
		{
			DIST	300
			ORIENT	"TO"
			ENTITE	_PORTE_CATACOMBE_EXT_N2
		}
		
		ITEM		(_II_PORTE, _INV_INDIC)
		COMMENT		901
		ACTION		1
	}
	
	COMMENT
	{
		ID		_C_PUITS
		AREA		_CIRQUE
		
		PRIMTRIG
		{
			DIST	400
			ORIENT	"NONE"
			ENTITE	_DUMMY_PUITS
		}
		
		COMMENT		902
	}
	
	COMMENT
	{
		ID		_C_CLEF
		AREA		_CIRQUE
		
		PRIMTRIG
		{
			DIST	400
			ORIENT	"TO"
			ENTITE	_CLEF
		}
		
		COMMENT		903
		PERSIST		1
		ACTION		1
	}

	// ==============================================

	DIALOG
	{
		ID		_D_PAYSAN_CHRETIEN
		AREA		_CIRQUE
		ENTITE		_PAYSAN_CHRETIEN
		
		SECTRIG
		{
			DIST	200
			ORIENT	"FACE"
			ENTITE	_PAYSAN_CHRETIEN
		}
		
		PRIMTRIG
		{
			DIST	250
			ORIENT	"NONE"
			ENTITE	_PAYSAN_CHRETIEN
		}
		
		STAND
		{
			ID	1
			TALK	(11, 12)
			BASEDOC	54
		}
		
		FIN
		{
			ID	1
			TALK	(13, 14)
		}
		
		RETOUR
		{
			ID	1
			TALK	(15, 16)
		}
		
		SUJET
		{
			ID	_II_NOVELIUS
			TALK	(17, 18)
			BASEJEU	9
		}
		
		SUJET
		{
			ID	_II_PORTE
			TALK	(9, 22)
		}
		
		SUJET
		{
			ID	_II_GWEN
			TALK	(19, 20)
			BASEJEU	8
		}
	}
	
	DIALOG
	{
		ID		_D_CITADIN_ANACHORETE
		AREA		_CIRQUE
		ENTITE		_CITADIN_ANACHORETE
		
		SECTRIG
		{
			DIST	200
			ORIENT	"FACE"
			ENTITE	_CITADIN_ANACHORETE
		}
		
		PRIMTRIG
		{
			DIST	250
			ORIENT	"NONE"
			ENTITE	_CITADIN_ANACHORETE
		}
		
		STAND
		{
			ID	1
			TALK	(1, 2)
		}
		
		FIN
		{
			ID	1
			TALK	(3, 4)
		}
		
		RETOUR
		{
			ID	1
			TALK	(5, 6)
		}
		
		SUJET
		{
			ID	_II_NOVELIUS
			TALK	(7, 8)
		}
		
		SUJET
		{
			ID	_II_PORTE
			TALK	(9, 10)
			BASEJEU	10
		}
	}
	
	DIALOG
	{
		ID		_D_CITADIN_FORGE
		AREA		_CIRQUE
		ENTITE		_CITADIN_FORGE
		
		SECTRIG
		{
			DIST	200
			ORIENT	"FACE"
			ENTITE	_CITADIN_FORGE
		}
		
		PRIMTRIG
		{
			DIST	250
			ORIENT	"NONE"
			ENTITE	_CITADIN_FORGE
		}
		
		FIN
		{
			ID	1
			TALK	(23, 24)
		}
		
		RETOUR
		{
			ID	1
			TALK	(25, 26)
		}
	}
	
	DIALOG
	{
		ID		_D_ANACHORETE
		AREA		_CIRQUE
		ENTITE		_ANACHORETE
		
		SECTRIG
		{
			DIST	300
			ORIENT	"FACE"
			ENTITE	_ANACHORETE
		}
		
		PRIMTRIG
		{
			DIST	400
			ORIENT	"NONE"
			ENTITE	_ANACHORETE
		}
		
		STAND
		{
			ID	1
			TALK	(31, 32)
			BASEJEU	7
		}
		
		FIN
		{
			ID	1
			TALK	(33, 700)
		}
		
		RETOUR
		{
			ID	1
			TALK	(35, 700)
		}
		
		SUJET
		{
			ID	_II_NOVELIUS
			TALK	(37, 700)
		}
		
		SUJET
		{
			ID	_II_PORTE
			TALK	(39, 40)
			BASEJEU	11
		}
	}
		
	DIALOG
	{
		ID		_D_GARDE_MONASTERE
		AREA		_CIRQUE
		ENTITE		_GARDE_MONASTERE
		
		SECTRIG
		{
			DIST	200
			ORIENT	"FACE"
			ENTITE	_GARDE_MONASTERE
		}
		
		PRIMTRIG
		{
			DIST	250
			ORIENT	"NONE"
			ENTITE	_GARDE_MONASTERE
		}
		
		FIN
		{
			ID	1
			TALK	(27, 28)
		}
		
		RETOUR
		{
			ID	1
			TALK	(29, 30)
		}
	}
	
	// ==============================================

	ACTION
	{
		ID		_G_SORTIE_CIRQUE
		AREA		_CIRQUE
		
		PRIMTRIG
		{
			ORIENT	"NONE"
			TRIGGER	8
		}
	}
	
	// ==============================================
	
	SOUND
	{
		ID		_A_APPELS_NOVELIUS
		AREA		_CATACOMBE_LVL_1
		
		PRIMTRIG
		{
			DIST	700
			ORIENT	"NONE"
			ENTITE	_DUMMY_APPELS_NOVELIUS
		}
		
		SOUND	"N_aplnov" 100 ""
		
		PERSIST	1
		STATUS	0
	}

section END


/////////////////////////////////////////////////////////////////
// Définition des combats
/////////////////////////////////////////////////////////////////

section COMBATS



section END

/////////////////////////////////////////////////////////////////
// Programme
/////////////////////////////////////////////////////////////////

section INIT

// desactivation sorties non permises

// catacombes lvl 1

	#OBJ_LOAD		(_DUMMY_APPELS_NOVELIUS,	  9, _CATACOMBE_LVL_1, 1, 0, 0)
	#OBJ_LOAD		(_FRESQUE_ROI,			  7, _CATACOMBE_LVL_1, 1, 1, 0)

// cirque

	#OBJ_LOAD		(_PAYSAN_CHRETIEN,		 13, _CIRQUE, 1, 1, 1)
	#OBJ_LOAD		(_CITADIN_ANACHORETE,		  1, _CIRQUE, 1, 1, 1)
	#OBJ_LOAD		(_CITADIN_FORGE,		 12, _CIRQUE, 1, 1, 1)
	#OBJ_LOADMAIND		(_ANACHORETE,		 	  9, _CIRQUE, _FOUET, 1, 1, 1)
	#OBJ_LOAD		(_CLEF,				 14, _CIRQUE, 1, 1, 0)
	#OBJ_LOAD		(_PINCES,			  4, _CIRQUE, 1, 1, 0)
	#OBJ_LOAD		(_GARDE_MONASTERE,		 16, _CIRQUE, 1, 1, 1)
	#OBJ_LOAD		(_DUMMY_PUITS,			 14, _CIRQUE, 1, 0, 0)
	
	#OBJ_LOAD		(_DUMMY_TRAVELLING,		 10, _CIRQUE, 1, 0, 0)
	
// verouillage portes

	#DOO_LOCK		(_PORTE_CATACOMBE_EXT_N1, _CIRQUE)
	#DOO_LOCK		(_PORTE_MONASTERE_EXT_N1, _CIRQUE)

// FXs

	// cirque
	
	#VFX_LOADBOX		(_FX_FEU_DIABLE, 26, _CIRQUE, 0)
	
	#VFX_START		(_FX_FEU_DIABLE)

// colli dummy

	#OBJ_DISABLECOLLIOBJ	(_DUMMY_APPELS_NOVELIUS)
	#OBJ_DISABLECOLLIOBJ	(_DUMMY_PUITS)
	#OBJ_DISABLECOLLIOBJ	(_DUMMY_TRAVELLING)

section END

section LOOP

	OnDialog _D_ANACHORETE sujet _II_PORTE
	{
		#OBJ_ENABLE	(_CLEF)
	}

	OnEvent		_U_CLEF
	{
		#DOO_UNLOCK	(_PORTE_CATACOMBE_EXT_N1, _CIRQUE)
		#EVT_DISABLE	(_C_PORTE_CATACOMBE)
	}

	OnEvent		_C_PORTE_CATACOMBE
	{
		#EVT_ENABLE	(_U_CLEF)
	}

	OnEvent		_C_CLEF
	{
		#EVT_ENABLE	(_E_PINCES)
	}
	
	OnEvent		_G_SORTIE_CIRQUE
	{
		if @INV_OWNPL	(_II_NOVELIUS, _INV_INDIC) = 1
		{
			#INV_REMPL	(_II_NOVELIUS, _INV_INDIC)
		}
		if @INV_OWNPL	(_II_PORTE, _INV_INDIC) = 1
		{
			#INV_REMPL	(_II_PORTE, _INV_INDIC)
		}
		ENDC
	}
	
	OnEvent		_C_CLEF
	{
		#BJE_EVENT	(12, _C_CLEF)
	}
	
	OnEvent		_E_PINCES
	{
		#INV_PUTPL	(_IO_PINCES, _INV_OBJET)
	}
	
	OnEvent		_U_PINCES
	{
		RUN		21
	}

	OnEvent _C_CORWYN
	{
//		RUN		19
	}

section END

/////////////////////////////////////////////////////////////////
// Définition des CTR
/////////////////////////////////////////////////////////////////

section CTR

	CTR
	{
		ID		_CTR_ENTREE_CIRQUE
		
		PROG
		{
			#CAM_FORCE	(2, 1)
			#CAM_LOCK	()
			#CAM_TRACK	(_DUMMY_TRAVELLING)
			#CAM_RETARGET	(0)
			#OBJ_GOTOBOX	(_DUMMY_TRAVELLING, 3, 0)
			SyncGoto	_DUMMY_TRAVELLING
			#NAR_COMMENT	(200)
			#CAM_TRACK	(_BRADWEN)
			#CAM_RETARGET	(1)
			#CAM_UNLOCK	()
		}
	}

	CTR
	{
		ID		_CTR_USE_PINCES
		
		PROG
		{
			#CAM_FORCE	(3, 0)
			#CAM_LOCK	()
			#OBJ_ENMAIND	(_BRADWEN, _PINCES)
			#OBJ_SENDEVENT	(_BRADWEN, "aspec 10")
			SyncState	_BRADWEN "utiliser pince"
			#OBJ_DISABLE	(_CLEF)
			#INV_PUTPL	(_IO_CLEF_CATACOMBE, _INV_OBJET)
			SyncState	_BRADWEN "utiliser pince - pause"
			#OBJ_SUPMAIND	(_BRADWEN)
			#NAR_COMMENT	(905)
			#BJE_EVENT	(13, _U_PINCES)
			#CAM_UNLOCK	()
		}
	}
section END
