/////////////////////////////////////////////////////////////////////
// WSOUL.S		-	Well of Souls
/////////////////////////////////////////////////////////////////////

SETUP

	IF !gt_PLACED_WSOUL && gt_PURSUE_SKORN_TO_WSOUL
		Add gt_PLACED_WSOUL
		PlaceC SKORN pSKORN
		Add gt_CUE_FINAL_COMBAT
		ChangeProfileToIdentified erev_skorn
		ClearDamaged SKORN

	ENDIF

END

VIG TempSetup FALSE

	SetWeather 0 0 0 0 0 0 0 0
	SwapModel SKORN SkornD
	FX_WellOfSouls pWELL

	CachePortrait PC5.BIN
	CachePortrait SKORNDMN.BIN

//	FX_Torch 7681 5880 830
//	FX_Torch 7548 5880 830
//	FX_Torch 7809 5880 830

	FX_Torch 7679 6910 830
	FX_Torch 7547 6910 830
	FX_Torch 7811 6910 830

	FX_Torch 7150 6400 830
	FX_Torch 7150 6267 830
	FX_Torch 7150 6524 830

	FX_Torch 8200 6400 830
	FX_Torch 8200 6267 830
	FX_Torch 8200 6524 830

END

/////////////////////////////////////////////////////////////////////

VIG FinalCombat gt_CUE_FINAL_COMBAT && (INAREA-P-NEAR_SKORN || DAMAGED-SKORN)

	Remove gt_CUE_FINAL_COMBAT

	Widescreen TRUE

	LookAtTurnFollow SKORN P
	PlaySFXPerson	vampires2.WAV P
	Capture			P		cM_V6_LOOK_AROUND2_BETTER
	UUComplete		P

	Engage			P		SKORN	600
	AddControl		P		LookAtTurn	SKORN

	QuickSay	kows01		SKORNDMN.BIN
	Wait 1000

	LookAtTurn		SKORN	P
	AddControl		SKORN	Capture	cM_TALK_THREATEN1
	AddControl		SKORN	Capture	cM_TALK_THREATEN2
	SequenceLoops	SKORN

	UUComplete P 

	UUSay

	AttackDemo2 SKORN
	StopC P

	Widescreen FALSE

	Add gt_P_V_SKORN_FINAL
	PlayLoopedMusic RPG23.WAV

END

/////////////////////////////////////////////////////////////////////

VIG SkornDead ONESEC && gt_P_V_SKORN_FINAL && ISDEAD-SKORN

	Remove gt_P_V_SKORN_FINAL
	PlayMusic STOP!

	Widescreen TRUE

	Wait 4000
	FX_SkornDiesInAShowerOfGoreAndMulitcolouredSpiritsAndHisSoulIsSuckedInToTheHeartForever SKORN
	AwardEP xp_DEFEAT_SKORN
	Wait 4000

	Capture			P			cM_TALK_THREATEN2
	Say				Hxeg01

	Wait			2500

	UUComplete		P

	QuickSay				kows02		SKORNDMN.BIN
	Wait 1000

	Capture			P			cM_TALK_QUESTION1
	UUSay

	QuickSay		Hxeg02
	Wait			500

	Capture			P			cM_V4_DROP_TO_KNEES2 
	UUSay

	Wait			500

	Widescreen FALSE

	Add mj_DEFEAT_SKORN
	QLRemove ql028

END

/////////////////////////////////////////////////////////////////////

VIG JumpIntoTheWell MSG-od_dWELL

	IDoorOpen dWELL

	Widescreen TRUE

	camcut pos01
	setcammoveconstant 4
	campan pos02
	setcammoveconstant
	campan pos03

	IF mj_DEFEAT_SKORN
		//Say koeg06 SKORNDMN.BIN - used as random taunt
		Capture P cM_CHANT_NOD
		Say Hxeg06
		QuickSay koeg07 SKORNDMN.BIN
		Add f_WONGAME
		Wait 500
	ENDIF

	MoveC P pWELL
	UUComplete P

	IF mj_DEFEAT_SKORN

		<< PLAY FINAL CAPTURE & FANCY SPECIAL EFFECT >>

		freecam
		setcammoveconstant 5
		campan epi
		Capture P cM_TALOS_KNEEL1_KNEEL
		UUComplete P
		FX_UpgradeSword
		Wait 1500
		MakeInvisible P

		RunS Epi	

	ELSE
		WHILE !ISDEAD-P
			FireDamage P 50
			EarthDamage P 50
			WaterDamage P 50
			AirDamage P 50
			SpiritDamage P 50
			Wait 250
		ENDWHILE
	ENDIF

END

/////////////////////////////////////////////////////////////////////

VIG epi FALSE

	widescreen true
	
	// Camera cut to the well of Souls
	//////////////////////////////////

	freecam
	camcut epi

	// Shrink view vol
	//////////////////

	SetInsideLightRadius 512 0
	SetOutsideLightRadius 1024 0

	// Cue The End Music
	////////////////////

	playloopedmusic rpg05.wav

	// The End & Epilogue text
	//////////////////////////

	wait 2000
	sglcredit centre 4000 theend
	wait 5000
	sglcredit centre 4000 eplog0
	wait 5000

	// Shift into Epilogue Music
	////////////////////////////

//	playloopedmusic rpg05.wav

	// Hammer
	/////////

	epiloadleft hammer.bin
	epiloadright hammer5.bin
	epishowleft
	epishowright
	IF f_HAMMER_DEAD
		epitext eplog2
	ELSE
		epitext eplog1
	ENDIF
	UUepi

	// Emma & Will
	//////////////

	epihideleft
	epihideright
	epiloadleft will
	epiloadright emma

	wait 1000
	epishowleft
	epishowright
	IF f_WILL_DEAD
		epitext eplog3
	ELSE
		epitext eplog4
	ENDIF
	UUEpi

	// Chant & Candice
	//////////////////

	epihideleft
	epihideright
	epiloadleft laen
	epiloadright candice5

	wait 1000
	epishowleft
	epishowright
	epitext eplog5
	UUEpi

	// Melissa
	//////////

	epihideleft
	epihideright
	epiloadright mel

	wait 1000
	EpiAlignRight
	epishowright
	epitext eplog6
	UUEpi

	// Elric
	////////

	epihideleft
	epihideright
	EpiAlignLeft
	epiloadleft elric

	wait 1000
	epishowleft
	epitext eplog7
	UUEpi

	epitext eplog8
	UUEpi

	// Show Player and Harbinger
	////////////////////////////

	epihideleft
	epihideright
	epiloadleft pc5.bin
	epiloadright HARBINGR.bin

	wait 1000
	
	playloopedmusic rpg21.wav

	epishowleft
	epishowright

	// Roll the credits
	///////////////////

	creditsunpause
	HideMouse
	wait 5000

	EpiResetMouseClick

	logoff	
	Set gg_PORT 8
	WHILE !CREDITSPAUSED && !CREDITSSKIP

		wait 250
			
		IF gg_PORT=8
			IF gg_LEFT
				EpiNextPortLeft
				Remove gg_LEFT
			ELSE
				EpiNextPortRight
				Add gg_LEFT
			ENDIF
			Set gg_PORT 0
		ELSE
			AddTo gg_PORT 1
		ENDIF

	ENDWHILE
	logon

	creditsreset
	
	// Fade the black
	/////////////////

	Fade 100 5
	UUFade

	// Reset Things
	///////////////

	widescreen false
	epihideleft
	epihideright
	playmusic 0
	normalcam
	RestoreInsideLightRadius 0
	RestoreOutsideLightRadius 0
	EpiTextHide
	SglCreditClear

	ShowMouse

	// EXIT GAME HERE!!!

	gameover
END

/////////////////////////////////////////////////////////////////////
