;;; Sierra Script 1.0 - (do not remove this comment)
(script# 699)
(include sci.sh)
(use Main)
(use Class_255_0)
(use Sound)
(use Cycle)
(use Game)
(use Feature)
(use Obj)

(public
	Room699 0
)

(local
	newProp
	newProp_2
	newProp_3
	newProp_4
	local4
	local5
	local6
	local7
	local8
	[local9 3]
)
(instance Room699 of Rm
	(properties
		picture 96
		style $0006
	)
	
	(method (init)
		(Load rsVIEW 879)
		(super init:)
		((View new:)
			view: 879
			loop: 0
			cel: 0
			posn: 124 192
			addToPic:
		)
		((View new:)
			view: 879
			loop: 0
			cel: 1
			posn: 165 192
			addToPic:
		)
		((View new:)
			view: 879
			loop: 0
			cel: 2
			posn: 206 192
			addToPic:
		)
		(= local5 global127)
		(= global127 0)
		((= newProp (Prop new:))
			view: 879
			setLoop: 2
			setPri: 15
			setScript: spark1
		)
		((= newProp_2 (Prop new:))
			view: 879
			setLoop: 2
			setPri: 15
			setScript: spark2
		)
		((= newProp_3 (Prop new:))
			view: 879
			setLoop: 2
			setPri: 15
			setScript: spark3
		)
		((= newProp_4 (Prop new:))
			view: 879
			setLoop: 2
			setPri: 15
			setScript: spark4
		)
	)
	
	(method (doit)
		(if (== local7 0)
			(if
			(== (Print 699 0 25 10 81 {Yes} 1 81 {No} 2) 2)
				(gGame restart:)
			)
			(playMusic cue:)
			(= global224 1)
			(= local7 1)
		)
	)
	
	(method (handleEvent pEvent)
		(if (pEvent claimed?) (return 1))
		(pEvent claimed: 1)
		(= local8 0)
		(if local5 (= local5 0) (gGame restart:))
		(return
			(cond 
				(
					(and
						(== (pEvent type?) evKEYBOARD)
						(== (pEvent message?) KEY_F2)
					)
					(pEvent claimed: 1)
					(DoSound sndSET_SOUND (not (DoSound sndSET_SOUND)))
				)
				(
					(or
						(== (pEvent message?) KEY_x)
						(== (pEvent message?) KEY_X)
					)
					(gGame restart:)
				)
				(else (gCast eachElementDo: #dispose) (gRoom newRoom: 98))
			)
		)
	)
)

(instance spark1 of Script
	(properties)
	
	(method (init param1)
		(super init: param1)
		(client init:)
	)
	
	(method (changeState newState &tmp temp0)
		(switch (= state newState)
			(0
				(= temp0 (/ (Random 10 40) 10))
				(client
					posn:
						(switch temp0
							(1 96)
							(2 135)
							(3 230)
							(4 260)
							(else  150)
						)
						(switch temp0
							(1 39)
							(2 158)
							(3 18)
							(4 123)
							(else  100)
						)
					show:
					cycleSpeed: (Random 0 2)
					setCycle: End self
				)
			)
			(1
				(client hide:)
				(= state -1)
				(self cue:)
			)
		)
	)
)

(instance spark2 of Script
	(properties)
	
	(method (init param1)
		(super init: param1)
		(client init:)
	)
	
	(method (changeState newState &tmp temp0)
		(switch (= state newState)
			(0
				(= temp0 (/ (Random 10 40) 10))
				(client
					posn:
						(switch temp0
							(1 80)
							(2 204)
							(3 141)
							(4 267)
						)
						(switch temp0
							(1 83)
							(2 121)
							(3 80)
							(4 97)
						)
					show:
					cycleSpeed: (Random 0 2)
					setCycle: End self
				)
			)
			(1
				(client hide:)
				(= state -1)
				(self cue:)
			)
		)
	)
)

(instance spark3 of Script
	(properties)
	
	(method (init param1)
		(super init: param1)
		(client init:)
	)
	
	(method (changeState newState &tmp temp0)
		(switch (= state newState)
			(0
				(= temp0 (/ (Random 10 40) 10))
				(client
					posn:
						(switch temp0
							(1 197)
							(2 182)
							(3 116)
							(4 104)
						)
						(switch temp0
							(1 47)
							(2 158)
							(3 49)
							(4 185)
						)
					show:
					cycleSpeed: (Random 0 2)
					setCycle: End self
				)
			)
			(1
				(client hide:)
				(= state -1)
				(self cue:)
			)
		)
	)
)

(instance spark4 of Script
	(properties)
	
	(method (init param1)
		(super init: param1)
		(client init:)
	)
	
	(method (changeState newState &tmp temp0)
		(switch (= state newState)
			(0
				(= temp0 (/ (Random 10 40) 10))
				(client
					posn:
						(switch temp0
							(1 141)
							(2 102)
							(3 268)
							(4 210)
						)
						(switch temp0
							(1 80)
							(2 117)
							(3 96)
							(4 112)
						)
					show:
					cycleSpeed: (Random 0 2)
					setCycle: End self
				)
			)
			(1
				(client hide:)
				(= state -1)
				(self cue:)
			)
		)
	)
)

(instance bannerSound of Sound
	(properties
		number 1
	)
)

(instance playMusic of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0 (bannerSound play: self))
			(1 (gRoom newRoom: 98))
		)
	)
)
