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

(public
	Room333 0
)

(local
	newAct
	newAct_2
	newAct_3
	newView
)
(instance uniTheme of Sound
	(properties
		number 32
	)
)

(instance henchTheme of Sound
	(properties
		number 29
	)
)

(instance Room333 of Rm
	(properties)
	
	(method (init)
		(User canControl: 0 canInput: 0)
		(= picture gPrevRoomNum)
		(gEgo edgeHit: 0)
		(gEgo xStep: 4 init:)
		(super init:)
		(if global100 (gRoom overlay: (+ picture 100)))
		(Load rsPIC 30)
		(Load rsPIC 29)
		(Load rsPIC 28)
		(Load rsPIC 20)
		(Load rsPIC 26)
		(Load rsPIC 27)
		(Load rsVIEW 142)
		(Load rsVIEW 143)
		(Load rsVIEW 144)
		(Load rsVIEW 146)
		(Load rsVIEW 140)
		(Load rsVIEW 390)
		(Load rsVIEW 387)
		(Load rsVIEW 60)
		(Load rsVIEW 80)
		(gEgo baseSetter: (ScriptID 0 1))
		(= newView (View new:))
		(self setScript: turnUnicorn)
	)
)

(instance from20 of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(gEgo setMotion: MoveTo 369 180 self)
			)
			(1
				(if global100
					(gRoom drawPic: 27)
					(gRoom overlay: 127)
				else
					(gRoom drawPic: 27)
				)
				(gEgo posn: 30 97)
				(gEgo setMotion: MoveTo 369 100 self)
			)
			(2
				(if global100
					(newView
						view: 600
						loop: 0
						cel: 0
						setPri: 9
						posn: 289 137
						ignoreActors:
						init:
						stopUpd:
					)
					(gRoom drawPic: 28)
					(gRoom overlay: 128)
				else
					(gRoom drawPic: 28)
					(newView
						view: 600
						loop: 1
						cel: 0
						setPri: 10
						posn: 284 131
						init:
						stopUpd:
					)
				)
				(gEgo posn: 30 187)
				(gRoom setScript: from28)
			)
		)
	)
)

(instance from26 of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(gEgo setMotion: MoveTo 369 162 self)
			)
			(1
				(if global100
					(gRoom drawPic: 27)
					(gRoom overlay: 127)
				else
					(gRoom drawPic: 27)
				)
				(gEgo posn: 30 155)
				(gEgo setMotion: MoveTo 369 169 self)
			)
			(2
				(if global100
					(newView
						view: 600
						loop: 0
						cel: 0
						setPri: 10
						posn: 289 137
						init:
						stopUpd:
					)
					(gRoom drawPic: 28)
					(gRoom overlay: 128)
				else
					(gRoom drawPic: 28)
					(newView
						view: 600
						loop: 1
						cel: 0
						setPri: 9
						posn: 284 131
						ignoreActors:
						init:
						stopUpd:
					)
				)
				(gRoom setScript: from28)
			)
		)
	)
)

(instance from27 of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(gEgo setMotion: MoveTo 369 162 self)
			)
			(1
				(if global100
					(newView
						view: 600
						loop: 0
						cel: 0
						setPri: 10
						posn: 289 137
						init:
						stopUpd:
					)
					(gRoom drawPic: 28)
					(gRoom overlay: 128)
				else
					(gRoom drawPic: 28)
					(newView
						view: 600
						loop: 1
						cel: 0
						setPri: 9
						posn: 283 131
						ignoreActors:
						init:
						stopUpd:
					)
				)
				(gRoom setScript: from28)
			)
		)
	)
)

(instance from28 of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(gEgo posn: 30 187 setMotion: MoveTo 369 187 self)
			)
			(1
				(if global100
					(gRoom drawPic: 29)
					(gRoom overlay: 129)
				else
					(gRoom drawPic: 29)
				)
				(newView dispose:)
				(gEgo posn: 30 187 setMotion: MoveTo 369 187 self)
			)
			(2
				(if global100
					(gRoom drawPic: 30)
					(gRoom overlay: 130)
				else
					(gRoom drawPic: 30)
				)
				(gEgo posn: 30 124 setMotion: MoveTo 194 129 self)
			)
			(3
				(gEgo setMotion: MoveTo 369 98 self)
			)
			(4
				(if global100
					(gRoom drawPic: 179)
				else
					(gRoom drawPic: 79)
				)
				(gEgo posn: 65 186)
				(in79 changeState: 1)
			)
		)
	)
)

(instance in79 of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(1
				(= newAct (Act new:))
				(h1Actions changeState: 1)
				(= global120 (Print 333 0 67 -1 10 88))
			)
			(2
				(= gNewAct_3 (Act new:))
				(gNewAct_3
					posn: (- (gEgo x?) 7) (gEgo y?)
					view: 381
					loop: 0
					cel: 0
					setPri: (gEgo priority?)
					ignoreActors:
					init:
				)
				(gEgo
					view: 60
					setLoop: 0
					cel: 0
					posn: (- (gNewAct_3 x?) 4) (- (gNewAct_3 y?) 25)
					setPri: 14
					ignoreActors:
					setCycle: End self
				)
				(newAct_2 hide:)
				(newAct_3 hide:)
			)
			(3
				(gEgo
					view: 80
					setLoop: 5
					setCycle: Fwd
					setMotion: MoveTo 24 60 self
				)
			)
			(4
				(gEgo setLoop: 3)
				(Timer setReal: self 2)
			)
			(5
				(gEgo setLoop: 2)
				(Timer setReal: self 2)
			)
			(6
				(gEgo setLoop: 1 setMotion: MoveTo 72 29)
				(Timer setReal: self 2)
			)
			(7
				(gEgo setLoop: 0 setMotion: MoveTo 72 29 self)
			)
			(8
				(gEgo setLoop: -1 setCel: -1)
				(User canControl: 1)
				(User canInput: 1)
				(gRoom newRoom: 92)
			)
		)
	)
)

(instance h1Actions of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(1
				(uniTheme dispose:)
				(henchTheme play:)
				(newAct
					ignoreHorizon:
					posn: 57 7
					view: 142
					setCycle: Walk
					setMotion: MoveTo -10 22 self
					ignoreActors:
					illegalBits: 0
					setPri: 13
					init:
				)
			)
			(2
				(if gModelessDlg (gModelessDlg dispose:))
				(newAct xStep: 4 yStep: 3 setMotion: MoveTo -10 50 self)
				(= newAct_2 (Act new:))
				(newAct_2 setScript: h2Actions)
			)
			(3
				(newAct
					view: 143
					xStep: 6
					yStep: 4
					setMotion: MoveTo 252 66 self
				)
			)
			(4
				(newAct
					view: 144
					xStep: 8
					yStep: 6
					setMotion: MoveTo 89 178 self
				)
				(h2Actions changeState: 1)
			)
			(5
				(newAct view: 146 loop: 1 cel: 0 setCycle: End self)
			)
		)
	)
)

(instance h2Actions of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(1
				(newAct_2
					ignoreHorizon:
					posn: 57 7
					view: 142
					setCycle: Walk
					xStep: 4
					yStep: 3
					setMotion: MoveTo 26 65 self
					ignoreActors:
					illegalBits: 0
					setPri: 15
					init:
				)
			)
			(2
				(newAct_2
					view: 143
					xStep: 6
					yStep: 4
					setMotion: MoveTo 42 120 self
				)
				(= newAct_3 (Act new:))
				(newAct_3 setScript: h3Actions)
				(h3Actions changeState: 1)
			)
			(3
				(newAct_2
					view: 144
					xStep: 8
					yStep: 6
					setMotion: MoveTo 10 185 self
				)
			)
			(4
				(newAct_2
					xStep: 8
					yStep: 6
					setMotion: MoveTo (+ (gEgo x?) 21) (- (gEgo y?) 28) self
				)
			)
			(5
				(proc0_3 newAct_2 gEgo)
				(newAct_2 setCycle: Fwd)
			)
		)
	)
)

(instance h3Actions of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(1
				(newAct_3
					ignoreHorizon:
					posn: 57 7
					view: 142
					setCycle: Walk
					xStep: 4
					yStep: 3
					setMotion: MoveTo 26 65 self
					ignoreActors:
					illegalBits: 0
					setPri: 15
					init:
				)
			)
			(2
				(newAct_3
					view: 143
					xStep: 6
					yStep: 4
					setMotion: MoveTo 42 120 self
				)
			)
			(3
				(newAct_3
					view: 144
					xStep: 8
					yStep: 6
					setMotion: MoveTo 10 185 self
				)
			)
			(4
				(newAct_3
					setMotion: MoveTo (- (gEgo x?) 15) (- (gEgo y?) 25) self
				)
			)
			(5 (in79 changeState: 2))
		)
	)
)

(instance turnUnicorn of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(User canControl: 0 canInput: 0)
				(gEgo setCycle: End self)
				(uniTheme play:)
			)
			(1
				(Print 333 1)
				(if (== (gEgo loop?) 1)
					(gEgo view: 390 cel: 0 loop: 0 setCycle: End self)
				else
					(self changeState: 2)
				)
			)
			(2
				(= global124 999)
				(gEgo view: 387 setCycle: Walk)
				(switch gPrevRoomNum
					(20 (gRoom setScript: from20))
					(26 (gRoom setScript: from26))
					(27 (gRoom setScript: from27))
				)
			)
		)
	)
)
