/////////////////////////////////////////////////////////////////////
// STEMPTOP.S
/////////////////////////////////////////////////////////////////////

SETUP

	Set gt_ST_TRAP_TIMER 0

	IF gt_FESTIVAL_PREP && !gt_KILLED_ST_HEXC
		Add gt_KILLED_ST_HEXC
		DestroyHexCompass ST_BOTTOM_OUT
	ENDIF

	IF !gt_PLACED_TEMPLE_UPPER_MONSTERS
		Add gt_PLACED_TEMPLE_UPPER_MONSTERS

        SWITCH RAND-2
        CASE 0
    		PlaceC ST_SKEL_1 pST_SKEL_1A1
        CASE 1
    		PlaceC ST_SKEL_1 pST_SKEL_1A2
        ENDSWITCH
        AddControl  ST_SKEL_1   Capture cM_GUARD_STAND1
        AddControl  ST_SKEL_1   Capture cM_GUARD_STAND2
        AddControl  ST_SKEL_1   Capture cM_GUARD_STAND3
        SequenceRandomlySelects   ST_SKEL_1
        SwitchOnSightOfPlayer   ST_SKEL_1 AttackDemo2

        SWITCH RAND-2
        CASE 0
    		PlaceC ST_SKEL_2 pST_SKEL_2A1
        CASE 1
    		PlaceC ST_SKEL_2 pST_SKEL_2A2
        ENDSWITCH
        RestrictedWanderButAttackOnSight ST_SKEL_2

        PlaceC  ST_SKEL_3 pST_SKEL_3A1
        AddControl  ST_SKEL_3   Capture cM_GUARD_STAND1
        AddControl  ST_SKEL_3   Capture cM_GUARD_STAND2
        AddControl  ST_SKEL_3   Capture cM_GUARD_STAND3
        SequenceRandomlySelects   ST_SKEL_3
        SwitchOnSightOfPLayer   ST_SKEL_3 AttackDemo2

        PlaceC  ST_SKEL_4 pST_SKEL_4A1
        AddControl  ST_SKEL_4 MoveCDir pST_SKEL_4A2
        AddControl  ST_SKEL_4 Capture   cM_V6_LOOK_AROUND2_BETTER
        AddControl  ST_SKEL_4 MoveCDir pST_SKEL_4A1
        AddControl  ST_SKEL_4 Capture   cM_V6_LOOK_AROUND2_BETTER
        SequenceLoops   ST_SKEL_4
        SwitchOnSightOfPLayer   ST_SKEL_4 AttackDemo2

        PlaceC  ST_SKEL_5 pST_SKEL_5A1
        AddControl  ST_SKEL_5 MoveCDir pST_SKEL_5A2
        AddControl  ST_SKEL_5   Capture cM_GUARD_STAND2
        AddControl  ST_SKEL_5 MoveCDir pST_SKEL_5A1
        AddControl  ST_SKEL_5   Capture cM_GUARD_STAND2
        SequenceLoops   ST_SKEL_5
        SwitchOnSightOfPLayer   ST_SKEL_5 AttackDemo2

        PlaceC  ST_SKEL_6 pST_SKEL_6A1
        AddControl  ST_SKEL_6 MoveCDir pST_SKEL_6A2
        AddControl  ST_SKEL_6 MoveCDir pST_SKEL_6A1
        SequenceLoops   ST_SKEL_6
        SwitchOnSightOfPLayer   ST_SKEL_6 AttackDemo2

		PlaceC ST_SKEL_7    pST_SKEL_7A1
        RestrictedWanderButAttackOnSight ST_SKEL_7

		PlaceC ST_SKEL_8 pST_SKEL_8A1
        AddControl  ST_SKEL_8   Capture cM_GUARD_STAND1
        AddControl  ST_SKEL_8   Capture cM_GUARD_STAND2
        AddControl  ST_SKEL_8   Capture cM_GUARD_STAND3
        SequenceRandomlySelects   ST_SKEL_8
        SwitchOnSightOfPlayer   ST_SKEL_8 AttackDemo2

        PlaceC  ST_SKEL_9 pST_SKEL_9A1
        AddControl  ST_SKEL_9 MoveCDir pST_SKEL_9A2
        AddControl  ST_SKEL_9 MoveCDir pST_SKEL_9A1
        SequenceLoops   ST_SKEL_9
        SwitchOnSightOfPLayer   ST_SKEL_9 AttackDemo2

        PlaceC  ST_SKEL_10 pST_SKEL_10A1
        AddControl  ST_SKEL_10 MoveCDir pST_SKEL_10A2
        AddControl  ST_SKEL_10 MoveCDir pST_SKEL_10A1
        SequenceLoops   ST_SKEL_10
        SwitchOnSightOfPLayer   ST_SKEL_10 AttackDemo2

		PlaceC ST_SKEL_11 pST_SKEL_11A1
        AddControl  ST_SKEL_11   Capture cM_GUARD_STAND1
        AddControl  ST_SKEL_11   Capture cM_GUARD_STAND2
        AddControl  ST_SKEL_11   Capture cM_GUARD_STAND3
        SequenceRandomlySelects   ST_SKEL_11
        SwitchOnSightOfPlayer   ST_SKEL_11 AttackDemo2

        PlaceC  ST_SKEL_12 pST_SKEL_12A1
        AddControl  ST_SKEL_12 MoveCDir pST_SKEL_12A2
        AddControl  ST_SKEL_12 Capture   cM_V6_LOOK_AROUND2_BETTER
        AddControl  ST_SKEL_12 MoveCDir pST_SKEL_12A1
        AddControl  ST_SKEL_12 Capture   cM_V6_LOOK_AROUND2_BETTER
        SequenceLoops   ST_SKEL_12
        SwitchOnSightOfPLayer   ST_SKEL_12 AttackDemo2

        SWITCH RAND-2
        CASE 0
    		PlaceC ST_SKEL_13 pST_SKEL_13A1
        CASE 1
    		PlaceC ST_SKEL_13 pST_SKEL_13A2
        ENDSWITCH
        RestrictedWanderButAttackOnSight ST_SKEL_13

        SWITCH RAND-2
        CASE 0
    		PlaceC ST_UNDEAD_1 pST_UNDEAD_1A1
        CASE 1
    		PlaceC ST_UNDEAD_1 pST_UNDEAD_1A2
        ENDSWITCH
        RestrictedWanderButAttackOnSight ST_UNDEAD_1

        SWITCH RAND-2
        CASE 0
    		PlaceC ST_UNDEAD_2 pST_UNDEAD_2A1
        CASE 1
    		PlaceC ST_UNDEAD_2 pST_UNDEAD_2A2
        ENDSWITCH
        RestrictedWanderButAttackOnSight ST_UNDEAD_2

        PlaceC  ST_UNDEAD_3 pST_UNDEAD_3A1
        AddControl  ST_UNDEAD_3 MoveC pST_UNDEAD_3A2
        AddControl  ST_UNDEAD_3 MoveC pST_UNDEAD_3A1
        SequenceLoops   ST_UNDEAD_3
        SwitchOnSightOfPlayer   ST_UNDEAD_3 AttackDemo2

        SWITCH RAND-2
        CASE 0
    		PlaceC ST_UNDEAD_4 pST_UNDEAD_4A1
        CASE 1
    		PlaceC ST_UNDEAD_4 pST_UNDEAD_4A2
        ENDSWITCH
        RestrictedWanderButAttackOnSight ST_UNDEAD_4

        SWITCH RAND-2
        CASE 0
    		PlaceC ST_UNDEAD_5 pST_UNDEAD_5A1
        CASE 1
    		PlaceC ST_UNDEAD_5 pST_UNDEAD_5A2
        ENDSWITCH
        RestrictedWanderButAttackOnSight ST_UNDEAD_5

   		PlaceC ST_UNDEAD_6 pST_UNDEAD_6A1
        RestrictedWanderButAttackOnSight ST_UNDEAD_6

        SWITCH RAND-2
        CASE 0
    		PlaceC ST_UNDEAD_7 pST_UNDEAD_7A1
        CASE 1
    		PlaceC ST_UNDEAD_7 pST_UNDEAD_7A2
        ENDSWITCH
        AddControl      ST_UNDEAD_7   Capture cM_TALK_WARNING1
        AddControl      ST_UNDEAD_7   Capture cM_TALK_DISAGREE1
        AddControl      ST_UNDEAD_7   Capture cM_TALK_REFER_SELF1
        AddControl      ST_UNDEAD_7   Capture cM_TALK_CROWD1
        AddControl      ST_UNDEAD_7   Capture cM_TALK_CROWD2
        AddControl      ST_UNDEAD_7   Capture cM_TALK_THREATEN1
        SequenceRandomlySelects   ST_UNDEAD_7
        SwitchOnSightOfPlayer   ST_UNDEAD_7 AttackDemo2

        SWITCH RAND-2
        CASE 0
    		PlaceC ST_UNDEAD_8 pST_UNDEAD_8A1
        CASE 1
    		PlaceC ST_UNDEAD_8 pST_UNDEAD_8A2
        ENDSWITCH
        RestrictedWanderButAttackOnSight ST_UNDEAD_8

        SWITCH RAND-2
        CASE 0
    		PlaceC ST_UNDEAD_9 pST_UNDEAD_9A1
        CASE 1
    		PlaceC ST_UNDEAD_9 pST_UNDEAD_9A2
        ENDSWITCH
        RestrictedWanderButAttackOnSight ST_UNDEAD_9

        SWITCH RAND-2
        CASE 0
    		PlaceC ST_UNDEAD_10 pST_UNDEAD_10A1
        CASE 1
    		PlaceC ST_UNDEAD_10 pST_UNDEAD_10A2
        ENDSWITCH
        RestrictedWanderButAttackOnSight ST_UNDEAD_10

		//find temple quest - both variants
		QLRemove ql012
		QLRemove ql013
		AwardEP xp_TEMPLE_OF_SHADOWS

	ENDIF

END

VIG TempSetup FALSE

	DisableTeleport ST_BOTTOM_OUT
	DisableTeleport ST_LOWER_OUT
	DisableTeleport ST_BOTTOM_OUT
	DisableTeleport ST_LOWER_IN

    SetWeather  0 0 0 0 0 0 0 0

	playmusic rpg13.wav

	AddBigFire 16063 28675
	AddBigFire 5166 28682
	AddBigFire 1073 19471
	AddBigFire 5886 8636
	AddBigFire 3553 816

	FX_Torch 3717 24964 480
	FX_Torch 3709 23684 480
END

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

VIG TeleportGlows FIVESEC

	FX_WhiteFireGlow pTELE_EFFECT
	FX_WhiteFireGlow pTELE_EFFECT2

	IF gt_MORTAN_TEL_ENABLED
		FX_WhiteFireGlow pTEL_CENTRE
	ELSE
		IF INAREA-P-NEAR_NORTAN_TEL && POS-P-mortan_scroll
			FX_BlueFireGlow pTEL_CENTRE
		ENDIF
	ENDIF

END

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

VIG EnableMortanTeleport MSG-MORTAN_TEL_SCROLL

	FX_BlueFireGlow P

	IF !gt_MORTAN_TEL_ENABLED && INAREA-P-NEAR_NORTAN_TEL
	//note the deliberate typo in the area name. do not correct it

		FreezeC ST_SKEL_1
		FreezeC ST_SKEL_2
		FreezeC ST_SKEL_3
		FreezeC ST_SKEL_4
		FreezeC ST_SKEL_5
		FreezeC ST_SKEL_6
		FreezeC ST_SKEL_7
		FreezeC ST_SKEL_8
		FreezeC ST_SKEL_9
		FreezeC ST_SKEL_10
		FreezeC ST_SKEL_11
		FreezeC ST_SKEL_12
		FreezeC ST_SKEL_13
		FreezeC ST_UNDEAD_1
		FreezeC ST_UNDEAD_2
		FreezeC ST_UNDEAD_3
		FreezeC ST_UNDEAD_4
		FreezeC ST_UNDEAD_5
		FreezeC ST_UNDEAD_6
		FreezeC ST_UNDEAD_7
		FreezeC ST_UNDEAD_8
		FreezeC ST_UNDEAD_9
		FreezeC ST_UNDEAD_10

		Add gt_MORTAN_TEL_ENABLED

		Widescreen TRUE

		DeleteObjectsInBackPackWithID P mortan_scroll
		camcut cam01

		Wait 2000
		
		FX_WhiteFireGlow pTEL_CENTRE
		wait 500
		FX_RedFireGlow pTEL_CENTRE
		wait 500
		FX_BlueFireGlow pTEL_CENTRE
		Wait 2500

		
		AwardEP xp_MORTAN_TELEPORT
		Wait 2500

		UnFreezeC ST_SKEL_1
		UnFreezeC ST_SKEL_2
		UnFreezeC ST_SKEL_3
		UnFreezeC ST_SKEL_4
		UnFreezeC ST_SKEL_5
		UnFreezeC ST_SKEL_6
		UnFreezeC ST_SKEL_7
		UnFreezeC ST_SKEL_8
		UnFreezeC ST_SKEL_9
		UnFreezeC ST_SKEL_10
		UnFreezeC ST_SKEL_11
		UnFreezeC ST_SKEL_12
		UnFreezeC ST_SKEL_13
		UnFreezeC ST_UNDEAD_1
		UnFreezeC ST_UNDEAD_2
		UnFreezeC ST_UNDEAD_3
		UnFreezeC ST_UNDEAD_4
		UnFreezeC ST_UNDEAD_5
		UnFreezeC ST_UNDEAD_6
		UnFreezeC ST_UNDEAD_7
		UnFreezeC ST_UNDEAD_8
		UnFreezeC ST_UNDEAD_9
		UnFreezeC ST_UNDEAD_10

		camcut P
		Widescreen FALSE
		EnableTeleport ST_BOTTOM_OUT
	ENDIF
		
END

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

VIG UndeadNoises1 ONESEC 
	SWITCH RAND-11
		CASE 1
			IF ONMAP-ST_UNDEAD_1 && !ISDEAD-ST_UNDEAD_1 && !INCOMBAT-ST_UNDEAD_1
				SWITCH RAND-2
					CASE 0
						SWITCH RAND-6
							CASE 0
								PlaySFXPerson undead1.wav ST_UNDEAD_1
							CASE 1
//								PlaySFXPerson undead2.wav ST_UNDEAD_1
							CASE 2
								PlaySFXPerson undead3.wav ST_UNDEAD_1
							CASE 3
								PlaySFXPerson undead5.wav ST_UNDEAD_1
							CASE 4
								PlaySFXPerson undead6.wav ST_UNDEAD_1
							CASE 5
//								PlaySFXPerson undead7.wav ST_UNDEAD_1
						ENDSWITCH 
				ENDSWITCH
			ENDIF
		CASE 2
			IF ONMAP-ST_UNDEAD_2 && !ISDEAD-ST_UNDEAD_2 && !INCOMBAT-ST_UNDEAD_2
				SWITCH RAND-2
					CASE 0
						SWITCH RAND-6
							CASE 0
								PlaySFXPerson undead1.wav ST_UNDEAD_2
							CASE 1
//								PlaySFXPerson undead2.wav ST_UNDEAD_2
							CASE 2
								PlaySFXPerson undead3.wav ST_UNDEAD_2
							CASE 3
								PlaySFXPerson undead5.wav ST_UNDEAD_2
							CASE 4
								PlaySFXPerson undead6.wav ST_UNDEAD_2
							CASE 5
//								PlaySFXPerson undead7.wav ST_UNDEAD_2
						ENDSWITCH 
				ENDSWITCH
			ENDIF
		CASE 3
			IF ONMAP-ST_UNDEAD_3 && !ISDEAD-ST_UNDEAD_3 && !INCOMBAT-ST_UNDEAD_3
				SWITCH RAND-2
					CASE 0
						SWITCH RAND-6
							CASE 0
								PlaySFXPerson undead1.wav ST_UNDEAD_3
							CASE 1
//								PlaySFXPerson undead2.wav ST_UNDEAD_3
							CASE 2
								PlaySFXPerson undead3.wav ST_UNDEAD_3
							CASE 3
								PlaySFXPerson undead5.wav ST_UNDEAD_3
							CASE 4
								PlaySFXPerson undead6.wav ST_UNDEAD_3
							CASE 5
//								PlaySFXPerson undead7.wav ST_UNDEAD_3
						ENDSWITCH 
				ENDSWITCH
			ENDIF
		CASE 4
			IF ONMAP-ST_UNDEAD_4 && !ISDEAD-ST_UNDEAD_4 && !INCOMBAT-ST_UNDEAD_4
				SWITCH RAND-2
					CASE 0
						SWITCH RAND-6
							CASE 0
								PlaySFXPerson undead1.wav ST_UNDEAD_4
							CASE 1
//								PlaySFXPerson undead2.wav ST_UNDEAD_4
							CASE 2
								PlaySFXPerson undead3.wav ST_UNDEAD_4
							CASE 3
								PlaySFXPerson undead5.wav ST_UNDEAD_4
							CASE 4
								PlaySFXPerson undead6.wav ST_UNDEAD_4
							CASE 5
//								PlaySFXPerson undead7.wav ST_UNDEAD_4
						ENDSWITCH 
				ENDSWITCH
			ENDIF
		CASE 5
			IF ONMAP-ST_UNDEAD_5 && !ISDEAD-ST_UNDEAD_5 && !INCOMBAT-ST_UNDEAD_5
				SWITCH RAND-2
					CASE 0
						SWITCH RAND-6
							CASE 0
								PlaySFXPerson undead1.wav ST_UNDEAD_5
							CASE 1
//								PlaySFXPerson undead2.wav ST_UNDEAD_5
							CASE 2
								PlaySFXPerson undead3.wav ST_UNDEAD_5
							CASE 3
								PlaySFXPerson undead5.wav ST_UNDEAD_5
							CASE 4
								PlaySFXPerson undead6.wav ST_UNDEAD_5
							CASE 5
//								PlaySFXPerson undead7.wav ST_UNDEAD_5
						ENDSWITCH 
				ENDSWITCH
			ENDIF
		CASE 6
			IF ONMAP-ST_UNDEAD_6 && !ISDEAD-ST_UNDEAD_6 && !INCOMBAT-ST_UNDEAD_6
				SWITCH RAND-2
					CASE 0
						SWITCH RAND-6
							CASE 0
								PlaySFXPerson undead1.wav ST_UNDEAD_6
							CASE 1
//								PlaySFXPerson undead2.wav ST_UNDEAD_6
							CASE 2
								PlaySFXPerson undead3.wav ST_UNDEAD_6
							CASE 3
								PlaySFXPerson undead5.wav ST_UNDEAD_6
							CASE 4
								PlaySFXPerson undead6.wav ST_UNDEAD_6
							CASE 5
//								PlaySFXPerson undead7.wav ST_UNDEAD_6
						ENDSWITCH 
				ENDSWITCH
			ENDIF
		CASE 7
			IF ONMAP-ST_UNDEAD_7 && !ISDEAD-ST_UNDEAD_7 && !INCOMBAT-ST_UNDEAD_7
				SWITCH RAND-2
					CASE 0
						SWITCH RAND-6
							CASE 0
								PlaySFXPerson undead1.wav ST_UNDEAD_7
							CASE 1
//								PlaySFXPerson undead2.wav ST_UNDEAD_7
							CASE 2
								PlaySFXPerson undead3.wav ST_UNDEAD_7
							CASE 3
								PlaySFXPerson undead5.wav ST_UNDEAD_7
							CASE 4
								PlaySFXPerson undead6.wav ST_UNDEAD_7
							CASE 5
//								PlaySFXPerson undead7.wav ST_UNDEAD_7
						ENDSWITCH 
				ENDSWITCH
			ENDIF
		CASE 8
			IF ONMAP-ST_UNDEAD_8 && !ISDEAD-ST_UNDEAD_8 && !INCOMBAT-ST_UNDEAD_8
				SWITCH RAND-2
					CASE 0
						SWITCH RAND-6
							CASE 0
								PlaySFXPerson undead1.wav ST_UNDEAD_8
							CASE 1
//								PlaySFXPerson undead2.wav ST_UNDEAD_8
							CASE 2
								PlaySFXPerson undead3.wav ST_UNDEAD_8
							CASE 3
								PlaySFXPerson undead5.wav ST_UNDEAD_8
							CASE 4
								PlaySFXPerson undead6.wav ST_UNDEAD_8
							CASE 5
//								PlaySFXPerson undead7.wav ST_UNDEAD_8
						ENDSWITCH 
				ENDSWITCH
			ENDIF
		CASE 9
			IF ONMAP-ST_UNDEAD_9 && !ISDEAD-ST_UNDEAD_9 && !INCOMBAT-ST_UNDEAD_9
				SWITCH RAND-2
					CASE 0
						SWITCH RAND-6
							CASE 0
								PlaySFXPerson undead1.wav ST_UNDEAD_9
							CASE 1
//								PlaySFXPerson undead2.wav ST_UNDEAD_9
							CASE 2
								PlaySFXPerson undead3.wav ST_UNDEAD_9
							CASE 3
								PlaySFXPerson undead5.wav ST_UNDEAD_9
							CASE 4
								PlaySFXPerson undead6.wav ST_UNDEAD_9
							CASE 5
//								PlaySFXPerson undead7.wav ST_UNDEAD_9
						ENDSWITCH 
				ENDSWITCH
			ENDIF
		CASE 10
			IF ONMAP-ST_UNDEAD_10 && !ISDEAD-ST_UNDEAD_10 && !INCOMBAT-ST_UNDEAD_10
				SWITCH RAND-2
					CASE 0
						SWITCH RAND-6
							CASE 0
								PlaySFXPerson undead1.wav ST_UNDEAD_10
							CASE 1
//								PlaySFXPerson undead2.wav ST_UNDEAD_10
							CASE 2
								PlaySFXPerson undead3.wav ST_UNDEAD_10
							CASE 3
								PlaySFXPerson undead5.wav ST_UNDEAD_10
							CASE 4
								PlaySFXPerson undead6.wav ST_UNDEAD_10
							CASE 5
//								PlaySFXPerson undead7.wav ST_UNDEAD_10
						ENDSWITCH 
				ENDSWITCH
			ENDIF
	ENDSWITCH
END

/////////////////////////////////////////////////////////////////////
//	FX_PuzzleBurn p
//	FX_PuzzleFreeze p
//	FX_PuzzleManifest p

VIG TrapTests TENTHSEC

	SWITCH FLAG-gt_ST_TRAP_TIMER
		CASE 0
			Set gt_ST_TRAP_TIMER 1

			IF !OBJINAREA-mace-TRAP_A_CTRL
				IF INAREA-P-TRAP_A_TRIG && !OBJINAREA-mace-TRAP_A_TRIG
					FX_YellowFire P
					SpiritDamage P 20
				ELSE
					SWITCH RAND-20
						CASE 0
							FX_PuzzleFreeze pA_JET_1
						CASE 1
							FX_PuzzleFreeze pA_JET_2
						CASE 2
							FX_PuzzleFreeze pA_JET_3
						CASE 3
							FX_PuzzleFreeze pA_JET_4
					ENDSWITCH
				ENDIF
			ENDIF

		CASE 1
			Set gt_ST_TRAP_TIMER 2

			IF !OBJINAREA-gem-TRAP_B_CTRL
				IF INAREA-P-TRAP_B_FIRE && !OBJINAREA-gem-TRAP_B_FIRE
					FX_PuzzleFreeze pB_JET_1
					FX_PuzzleFreeze pB_JET_2
					FX_PuzzleFreeze pB_JET_3
					FX_PuzzleFreeze pB_JET_4
					WaterDamage P 25
				ELSE
					SWITCH RAND-20
						CASE 0
							FX_PuzzleFreeze pB_JET_1
						CASE 1
							FX_PuzzleFreeze pB_JET_2
						CASE 2
							FX_PuzzleFreeze pB_JET_3
						CASE 3
							FX_PuzzleFreeze pB_JET_4
					ENDSWITCH
				ENDIF
			ENDIF

		CASE 2
			Set gt_ST_TRAP_TIMER 3

			IF !OBJINAREA-mscroll_shield-TRAP_C_CTRL
				IF INAREA-P-TRAP_C_FIRE && !OBJINAREA-mscroll_shield-TRAP_C_TRIG

					FX_PuzzleManifest pC_JET_1
					FX_PuzzleManifest pC_JET_2
					FX_PuzzleManifest pC_JET_3
					FX_PuzzleManifest pC_JET_4
					EarthDamage P 135
				ELSE
					SWITCH RAND-20
						CASE 0
							FX_PuzzleManifest pC_JET_1
						CASE 1
							FX_PuzzleManifest pC_JET_2
						CASE 2
							FX_PuzzleManifest pC_JET_3
						CASE 3
							FX_PuzzleManifest pC_JET_4
					ENDSWITCH
				ENDIF
			ENDIF

		CASE 3
			Set gt_ST_TRAP_TIMER 4

			IF !OBJINAREA-big_stone-TRAP_D_CTRL
				IF INAREA-P-TRAP_D_TRIG
					FX_BurnPerson P
					FireDamage P 15
				ELSE
					SWITCH RAND-20
						CASE 0
							FX_PuzzleBurn pD_JET_1
						CASE 1
							FX_PuzzleBurn pD_JET_2
						CASE 2
							FX_PuzzleBurn pD_JET_3
						CASE 3
							FX_PuzzleBurn pD_JET_4
					ENDSWITCH
				ENDIF
			ENDIF

		CASE 4
			Set gt_ST_TRAP_TIMER 5

			IF !OBJINAREA-big_stone-TRAP_E_CTRL
				IF INAREA-P-TRAP_E_TRIG
					FX_BurnPerson P
					FireDamage P 15
				ELSE
					SWITCH RAND-20
						CASE 0
							FX_PuzzleBurn pE_JET_1
						CASE 1
							FX_PuzzleBurn pE_JET_2
						CASE 2
							FX_PuzzleBurn pE_JET_3
						CASE 3
							FX_PuzzleBurn pE_JET_4
					ENDSWITCH
				ENDIF
			ENDIF

		CASE 5
			Set gt_ST_TRAP_TIMER 0

			IF !OBJINAREA-big_stone-TRAP_F_CTRL
				IF INAREA-P-TRAP_F_TRIG
					FX_BurnPerson P
					FireDamage P 15
				ELSE
					SWITCH RAND-20
						CASE 0
							FX_PuzzleBurn pF_JET_1
						CASE 1
							FX_PuzzleBurn pF_JET_2
						CASE 2
							FX_PuzzleBurn pF_JET_3
						CASE 3
							FX_PuzzleBurn pF_JET_4
					ENDSWITCH
				ENDIF
			ENDIF

	ENDSWITCH

END

VIG TestTraps FALSE

	FX_PuzzleFreeze pA_JET_1
	FX_PuzzleFreeze pA_JET_2
	FX_PuzzleFreeze pA_JET_3
	FX_PuzzleFreeze pA_JET_4

	FX_PuzzleFreeze pB_JET_1
	FX_PuzzleFreeze pB_JET_2
	FX_PuzzleFreeze pB_JET_3
	FX_PuzzleFreeze pB_JET_4

	FX_PuzzleManifest pC_JET_1
	FX_PuzzleManifest pC_JET_2
	FX_PuzzleManifest pC_JET_3
	FX_PuzzleManifest pC_JET_4

	FX_PuzzleBurn pD_JET_1
	FX_PuzzleBurn pD_JET_2
	FX_PuzzleBurn pD_JET_3
	FX_PuzzleBurn pD_JET_4

	FX_PuzzleBurn pE_JET_1
	FX_PuzzleBurn pE_JET_2
	FX_PuzzleBurn pE_JET_3
	FX_PuzzleBurn pE_JET_4

	FX_PuzzleBurn pF_JET_1
	FX_PuzzleBurn pF_JET_2
	FX_PuzzleBurn pF_JET_3
	FX_PuzzleBurn pF_JET_4

END

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

VIG TeleAppear gg_TELE_INVIS
	Remove gg_TELE_INVIS
	FX_Visible P
END

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

VIG Tele1 INAREA-P-Tele1
	FX_Invisible P
	StopC P
	Wait 2000
	PostMsg m_ST_LOWER_IN
	Add gg_TELE_INVIS
END

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

VIG Tele2 INAREA-P-Tele2
	FX_Invisible P
	StopC P
	Wait 2000
	PostMsg m_ST_LOWER_OUT
	Add gg_TELE_INVIS
END

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

VIG Tele3 gt_MORTAN_TEL_ENABLED && INAREA-P-Tele3
	FX_Invisible P
	StopC P
	Wait 2000
	PostMsg t_SB_BOTTOM_IN
	Add gg_TELE_INVIS
END

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