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

(public
	Room221 0
)

(local
	local0
	[local1 11]
	local12
	local13
	local14
	[local15 4]
	local19
	local20
	[local21 4]
	local25
	local26
	[local27 2]
	local29
	[local30 200]
)
(instance openMusic of Sound
	(properties)
)

(instance Room221 of Rm
	(properties
		picture 201
		style $0008
	)
	
	(method (init)
		(Load rsVIEW 757)
		(Load rsVIEW 758)
		(Load rsVIEW 762)
		(Load rsVIEW 766)
		(Load rsVIEW 768)
		(Load rsVIEW 770)
		(Load rsVIEW 771)
		(Load rsPIC 201)
		(Load rsPIC 205)
		(Load rsPIC 207)
		(self setRegions: 520)
		(super init:)
		(= gUserFont gSmallFont)
		(gRoom setScript: PartTwo)
	)
	
	(method (newRoom newRoomNumber)
		(proc0_21)
		((ScriptID 520) keep: 0)
		(super newRoom: newRoomNumber)
	)
)

(instance PartTwo of Script
	(properties)
	
	(method (changeState newState)
		(gAddToPics dispose:)
		(switch (= state newState)
			(0
				(= local19
					((Act new:)
						view: 768
						loop: 0
						posn: 158 64
						cycleSpeed: 4
						stopUpd:
						init:
						yourself:
					)
				)
				((View new:)
					view: 769
					loop: 3
					posn: 48 139
					setPri: 0
					ignoreActors:
					addToPic:
				)
				((View new:)
					view: 767
					setCel: 3
					setLoop: 0
					posn: 300 144
					addToPic:
				)
				(= local14
					((Act new:)
						view: 764
						loop: 1
						posn: 62 117
						cycleSpeed: 4
						setCycle: Fwd
						setPri: 8
						init:
						yourself:
					)
				)
				(= seconds 2)
			)
			(1
				(= local26
					(Print
						221
						0
						80
						{Rosella}
						67
						1
						140
						70
						150
						80
						{Rosella}
						88
						83
					)
				)
				(= seconds 6)
			)
			(2
				(if gModelessDlg (gModelessDlg dispose:))
				(local19 setLoop: 1 setCycle: Fwd)
				(= local26 (Print 221 1 67 180 40 70 110 88))
				(= seconds 6)
			)
			(3
				(if gModelessDlg (gModelessDlg dispose:))
				(local19 setLoop: 0 setCycle: 0)
				(local14 setLoop: 2 cycleSpeed: 20 setCycle: Fwd)
				(= local26
					(Print 221 2 67 1 134 80 {Rosella} 70 150 88)
				)
				(= seconds 10)
			)
			(4
				(if gModelessDlg (gModelessDlg dispose:))
				(local19 setLoop: 1 setCycle: Fwd)
				(= local26 (Print 221 3 67 180 40 70 110 88))
				(= seconds 12)
			)
			(5
				(if gModelessDlg (gModelessDlg dispose:))
				(gCast eachElementDo: #dispose)
				(gRoom drawPic: 207)
				((View new:)
					view: 766
					loop: 0
					cel: 0
					posn: 230 120
					setPri: 0
					ignoreActors:
					addToPic:
				)
				((View new:)
					view: 763
					cel: 0
					loop: 0
					posn: 137 138
					ignoreActors:
					setPri: 0
					addToPic:
				)
				(= local14
					((Act new:)
						view: 763
						loop: 1
						cel: 0
						posn: 155 109
						setCycle: Fwd
						setPri: 15
						cycleSpeed: 3
						init:
						yourself:
					)
				)
				(= local20
					((Act new:)
						view: 766
						loop: 1
						cel: 0
						posn: 230 106
						setPri: 14
						cycleSpeed: 0
						setCycle: Fwd
						init:
						yourself:
					)
				)
				(= local26
					(Print 221 4 67 1 151 80 {Rosella} 66 15 70 200 88)
				)
				(= seconds 6)
			)
			(6
				(if (== ((ScriptID 520 1) state?) 3)
					(-- state)
					(= seconds 2)
				else
					((ScriptID 520 1) dispose:)
					(openMusic number: 105 play:)
					(self cue:)
				)
			)
			(7
				(if gModelessDlg (gModelessDlg dispose:))
				(local20 dispose:)
				(local14 dispose:)
				(gRoom drawPic: 205)
				((View new:)
					view: 762
					loop: 0
					cel: 0
					posn: 149 110
					ignoreActors:
					setPri: 0
					addToPic:
				)
				(= local20
					((Act new:)
						view: 762
						cycleSpeed: 0
						loop: 1
						cel: 0
						posn: 148 96
						setPri: 6
						setCycle: Fwd
						init:
						yourself:
					)
				)
				(= local29
					((Act new:)
						view: 762
						loop: 4
						cel: 0
						ignoreHorizon:
						posn: 142 18
						setPri: 1
						init:
						yourself:
					)
				)
				(local29 setScript: doSparkle)
				(= local26
					(Print 221 5 80 {Genesta} 67 -1 125 70 300 88)
				)
				(= seconds 10)
			)
			(8
				(if gModelessDlg (gModelessDlg dispose:))
				(= local26
					(Print 221 6 80 {Genesta} 67 -1 125 70 300 88)
				)
				(= seconds 12)
			)
			(9
				(if gModelessDlg (gModelessDlg dispose:))
				(local20 dispose:)
				(local29 setScript: 0 dispose:)
				(gRoom drawPic: 207)
				((View new:)
					view: 766
					loop: 0
					cel: 0
					posn: 230 120
					setPri: 0
					ignoreActors:
					addToPic:
				)
				((View new:)
					view: 763
					cel: 0
					loop: 0
					posn: 137 138
					ignoreActors:
					setPri: 0
					addToPic:
				)
				((View new:)
					view: 766
					cel: 0
					loop: 2
					posn: 230 109
					ignoreActors:
					setPri: 1
					addToPic:
				)
				(= local13
					((Act new:)
						view: 763
						loop: 1
						cel: 0
						posn: 155 109
						setCycle: Fwd
						cycleSpeed: 3
						setPri: 15
						init:
						yourself:
					)
				)
				(= local26
					(Print 221 7 80 {Rosella} 67 1 151 70 200 88)
				)
				(= seconds 9)
			)
			(10
				(if gModelessDlg (gModelessDlg dispose:))
				(local13 view: 766 loop: 3 cel: 0 posn: 230 71 setPri: 2)
				(= local26
					(Print 221 8 80 {Genesta} 67 100 151 70 200 88)
				)
				(= seconds 12)
			)
			(11
				(if gModelessDlg (gModelessDlg dispose:))
				(local13
					view: 763
					setLoop: 1
					setCel: 0
					posn: 155 109
					setCycle: Fwd
					cycleSpeed: 3
				)
				(= local26
					(Print 221 9 80 {Rosella} 67 1 151 70 200 88)
				)
				(= seconds 10)
			)
			(12
				(if gModelessDlg (gModelessDlg dispose:))
				(gRoom drawPic: 205)
				((View new:)
					view: 762
					loop: 0
					cel: 0
					posn: 149 110
					ignoreActors:
					setPri: 0
					addToPic:
				)
				((View new:)
					view: 762
					loop: 2
					cel: 0
					posn: 149 98
					ignoreActors:
					setPri: 1
					addToPic:
				)
				(local13
					view: 762
					setLoop: 3
					setCel: 0
					posn: 149 59
					setCycle: Fwd
					cycleSpeed: 2
					setPri: 15
				)
				(= local29
					((Act new:)
						view: 762
						loop: 4
						cel: 0
						ignoreHorizon:
						posn: 142 18
						setPri: 1
						init:
						yourself:
					)
				)
				(local29 setScript: doSparkle)
				(= local26
					(Print 221 10 80 {Genesta} 67 1 135 70 300 88)
				)
				(= seconds 9)
			)
			(13
				(if gModelessDlg (gModelessDlg dispose:))
				(= local26
					(Print 221 11 80 {Genesta} 67 1 135 70 300 88)
				)
				(= seconds 8)
			)
			(14
				(if gModelessDlg (gModelessDlg dispose:))
				(local29 setScript: 0 dispose:)
				(gRoom drawPic: 207)
				((View new:)
					view: 766
					loop: 0
					cel: 0
					posn: 230 120
					setPri: 0
					ignoreActors:
					addToPic:
				)
				((View new:)
					view: 763
					cel: 0
					loop: 0
					posn: 137 139
					ignoreActors:
					setPri: 0
					addToPic:
				)
				((View new:)
					view: 766
					cel: 0
					loop: 2
					posn: 230 109
					ignoreActors:
					setPri: 1
					addToPic:
				)
				(local13
					view: 763
					loop: 1
					cel: 0
					posn: 155 109
					setCycle: Fwd
					cycleSpeed: 3
					setPri: 15
				)
				(= local12
					((Act new:)
						view: 766
						loop: 4
						cel: 0
						posn: 230 106
						setCycle: Fwd
						cycleSpeed: 3
						setPri: 15
						init:
						yourself:
					)
				)
				(= local26
					(Print 221 12 80 {Rosella} 67 1 151 70 200 88)
				)
				(= seconds 10)
			)
			(15
				(if gModelessDlg (gModelessDlg dispose:))
				(local13 view: 766 loop: 3 cel: 0 posn: 230 71 setPri: 2)
				(= local26
					(Print 221 13 80 {Genesta} 67 100 151 70 200 88)
				)
				(= seconds 8)
			)
			(16
				(if gModelessDlg (gModelessDlg dispose:))
				(local13 dispose:)
				(local12 dispose:)
				(gRoom drawPic: 201)
				(= local19
					((Act new:)
						view: 768
						loop: 1
						setCycle: Fwd
						posn: 158 64
						cycleSpeed: 4
						init:
						yourself:
					)
				)
				((View new:)
					view: 769
					loop: 3
					posn: 48 139
					setPri: 0
					ignoreActors:
					addToPic:
				)
				((View new:)
					view: 767
					setCel: 3
					setLoop: 0
					posn: 300 144
					addToPic:
				)
				(= local14
					((Act new:)
						view: 764
						loop: 0
						posn: 172 94
						cycleSpeed: 4
						stopUpd:
						init:
						yourself:
					)
				)
				(= seconds 3)
			)
			(17
				(= local26
					(Print 221 14 80 {Genesta} 67 -1 130 70 300 88)
				)
				(= seconds 9)
			)
			(18
				(if gModelessDlg (gModelessDlg dispose:))
				(local19
					setLoop: 2
					setCel: 255
					cycleSpeed: 2
					setCycle: End stopMirror
				)
				(= local26 (Print 221 15 80 {Rosella} 67 215 40 88))
				(= seconds 3)
			)
			(19
				(if
					(or
						(== (openMusic prevSignal?) -1)
						(>= (openMusic prevSignal?) 46)
						(>= (openMusic signal?) 46)
					)
					(self cue:)
				else
					(-- state)
					(= seconds 1)
				)
			)
			(20
				(if gModelessDlg (gModelessDlg dispose:))
				(= local25
					((Act new:)
						view: 770
						loop: 0
						posn: (local14 x?) (local14 y?)
						setPri: 15
						ignoreActors:
						cycleSpeed: 2
						setCycle: End self
						init:
						yourself:
					)
				)
			)
			(21
				(local14 dispose:)
				(local25 setLoop: 1 setCycle: End self)
			)
			(22 (gRoom newRoom: 222))
		)
	)
	
	(method (handleEvent pEvent)
		(cond 
			(
				(and
					(== (pEvent type?) evKEYBOARD)
					(== (pEvent message?) KEY_F2)
				)
				(= local0 (DoSound sndSET_SOUND))
				(DoSound sndSET_SOUND (not local0))
			)
			(
				(and
					(== (pEvent type?) evKEYBOARD)
					(== (pEvent message?) KEY_RETURN)
				)
				(gGame restart:)
			)
		)
	)
)

(instance stopRosella of Script
	(properties)
	
	(method (cue)
		(local14 stopUpd:)
	)
)

(instance hideRosella of Script
	(properties)
	
	(method (cue)
		(local14 hide:)
	)
)

(instance stopMirror of Script
	(properties)
	
	(method (cue)
		(local19 stopUpd:)
	)
)

(instance doSparkle of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(= seconds (Random 1 4))
				(local29 hide:)
			)
			(1
				(local29 cel: 255 setCycle: End self show:)
			)
			(2 (self changeState: 0))
		)
	)
)
