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

(public
	Room70 0
)

(local
	newView
	local1
	local2
	newProp_8
	newProp
	newProp_2
	newProp_3
	newProp_4
	newProp_5
	newProp_6
	newProp_7
	local11
)
(instance poofSound of Sound
	(properties)
)

(instance Room70 of Rm
	(properties
		picture 70
	)
	
	(method (init)
		(= global101 1)
		(super init:)
		(= newProp (Prop new:))
		(= newProp_2 (Prop new:))
		(= newProp_3 (Prop new:))
		(= newProp_4 (Prop new:))
		(= newProp_5 (Prop new:))
		(= newProp_6 (Prop new:))
		(= newProp_7 (Prop new:))
		(newProp
			isExtra: 1
			view: 668
			loop: 0
			cel: 2
			posn: 120 42
			setPri: 1
			setCycle: Fwd
			cycleSpeed: 1
			ignoreActors:
			init:
		)
		(newProp_2
			isExtra: 1
			view: 668
			loop: 1
			cel: 0
			posn: 171 39
			setPri: 0
			setCycle: Fwd
			cycleSpeed: 1
			ignoreActors:
			init:
		)
		(newProp_3
			isExtra: 1
			view: 668
			loop: 2
			cel: 1
			posn: 142 97
			setPri: 6
			setCycle: Fwd
			cycleSpeed: 1
			ignoreActors:
			init:
		)
		(newProp_4
			isExtra: 1
			view: 668
			loop: 3
			cel: 1
			posn: 121 102
			setPri: 6
			setCycle: Fwd
			cycleSpeed: 1
			ignoreActors:
			init:
		)
		(newProp_5
			isExtra: 1
			view: 668
			loop: 4
			cel: 1
			posn: 131 122
			setPri: 0
			setCycle: Fwd
			cycleSpeed: 1
			ignoreActors:
			init:
		)
		(newProp_6
			isExtra: 1
			view: 668
			loop: 5
			cel: 2
			posn: 105 122
			setPri: 0
			setCycle: Fwd
			cycleSpeed: 1
			ignoreActors:
			init:
		)
		(newProp_7
			isExtra: 1
			view: 668
			loop: 6
			cel: 0
			posn: 145 118
			setPri: 0
			setCycle: Fwd
			cycleSpeed: 1
			ignoreActors:
			init:
		)
		(Load rsVIEW 7)
		(Load rsVIEW 8)
		(Load rsVIEW 377)
		(Load rsVIEW 378)
		(Load rsVIEW 680)
		(Load rsVIEW 21)
		(Load rsVIEW 10)
		(if (== gPrevRoomNum 24)
			(gEgo setScript: swimIn illegalBits: -32768)
		else
			(gEgo
				view: 2
				setStep: 3 2
				illegalBits: -32768
				posn: 224 114
				init:
			)
		)
		(if ((Inv at: 22) ownedBy: 70)
			((= newView (View new:))
				view: 515
				posn: 195 112
				loop: 1
				cel: 0
				init:
				stopUpd:
			)
		)
		(gEgo init:)
		(= global205 0)
	)
	
	(method (doit)
		(super doit:)
		(= local2 (gEgo onControl: 1))
		(if (== (gEgo script?) 0)
			(cond 
				(
					(or
						(gEgo inRect: 142 110 166 125)
						(gEgo inRect: 49 117 111 128)
					)
					(gEgo setScript: sweptOut)
				)
				((& local2 $0001) (= global105 0) (gEgo setCycle: Walk) (gEgo view: 2))
				((& local2 $0800) (gEgo setCycle: Walk) (gEgo view: 7) (= global105 3))
				((& local2 $0002) (gEgo view: 8) (= global105 4) (gEgo setCycle: Fwd))
			)
			(if (gEgo inRect: 209 112 225 120)
				(gEgo baseSetter: (ScriptID 0 1))
			else
				(gEgo baseSetter: 0)
			)
		)
		(if (& (gEgo onControl:) $0040) (gRoom newRoom: 71))
	)
	
	(method (handleEvent pEvent)
		(if (pEvent claimed?) (return 1))
		(return
			(if (== (pEvent type?) evSAID)
				(cond 
					((Said 'look>')
						(cond 
							((Said '/falls') (Print 70 0))
							((Said '/cliff') (Print 70 1))
							((Said '/cave') (Print 70 2))
							((Said '/boulder') (Print 70 3))
							((Said '/flora') (Print 70 4))
							((Said '/dirt')
								(if ((Inv at: 22) ownedBy: 70)
									(Print 70 5)
								else
									(Print 70 6)
								)
							)
							((Said '<under/water,pool')
								(if (== (gEgo view?) 2)
									(Print 70 7)
								else
									(Print 70 8)
								)
							)
							((Said '<in,in/water,pool') (Print 70 9))
							((Said '/falls') (Print 70 10))
							((Said '<in/pool,water') (Print 70 11))
							((Said '/pool,water') (Print 70 12))
							((Said '[<around][/room]')
								(Print
									(Format
										@global228
										70
										13
										(if ((Inv at: 22) ownedBy: 70)
											{You see an old board lying by the cave entrance.}
										else
											{}
										)
									)
								)
							)
						)
					)
					((Said 'climb/cliff') (Print 70 14))
					((Said 'climb/boulder') (Print 70 15))
					((Said 'get/board')
						(if ((Inv at: 22) ownedBy: 70)
							(if (< (gEgo distanceTo: newView) 12)
								(gEgo setScript: boardActions)
								(boardActions changeState: 1)
								(gGame changeScore: 2)
							else
								(Print 800 1)
							)
						else
							(Print 70 16)
						)
					)
					((or (Said 'drink') (Said 'get/drink'))
						(if (== (gEgo view?) 2)
							(if
								(or
									(& (= local1 (proc0_2 gEgo 10)) $0008)
									(& local1 $0800)
									(& local1 $0002)
									(& local1 $0200)
								)
								(gEgo setScript: drinking)
							else
								(Print 800 1)
							)
						else
							(Print 70 17)
						)
					)
					((Said 'get/water') (Print 70 18))
					((Said 'dive,bathe[<enter]')
						(if (== (gEgo view?) 2)
							(Print 70 19)
						else
							(Print 70 20)
						)
					)
				)
			else
				0
			)
		)
	)
	
	(method (newRoom newRoomNumber)
		(proc0_9)
		(gEgo baseSetter: 0)
		(super newRoom: newRoomNumber)
	)
)

(instance swimIn of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(proc0_8)
				(gEgo
					view: 377
					posn: 158 119
					setCycle: Walk
					setAvoider: Avoid
					setMotion: MoveTo 167 123 self
				)
			)
			(1
				(gEgo setMotion: MoveTo 167 123 self)
			)
			(2
				(gEgo setMotion: MoveTo 183 122 self)
			)
			(3
				(gEgo
					view: 378
					cel: 255
					setCycle: End
					setMotion: MoveTo 207 120 self
				)
			)
			(4
				(poofSound number: 59 play:)
				(= newProp_8 (Prop new:))
				(newProp_8
					view: 680
					posn: (gEgo x?) (gEgo y?)
					loop: 1
					setPri: (+ (gEgo priority?) 1)
					cel: 9
					setCycle: CT 2 -1 self
					init:
				)
			)
			(5
				(gEgo view: 2 setAvoider: 0 setCycle: Walk)
				(newProp_8 setCycle: Beg self)
			)
			(6
				(newProp_8 dispose:)
				(Print 70 21 83)
				(gEgo setScript: 0)
				(proc0_9)
			)
		)
	)
)

(instance boardActions of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(1
				(proc0_8)
				(proc0_3 gEgo newView)
				(gEgo view: 21 cel: 255 setMotion: 0 setCycle: End self)
			)
			(2
				(= global182 1)
				(newView dispose:)
				(gEgo get: 22)
				(gEgo setCycle: Beg self)
			)
			(3
				(gEgo view: 2 setCycle: Walk)
				(proc0_9)
				(gEgo setScript: 0)
			)
		)
	)
)

(instance drinking of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(proc0_8)
				(gEgo view: 21 cel: 255 setCycle: End self)
			)
			(1
				(Timer setReal: self 5)
				(Print 70 22 67 -1 10 88)
			)
			(2 (gEgo setCycle: Beg self))
			(3
				(if gModelessDlg (gModelessDlg dispose:))
				(proc0_9)
				(gEgo view: 2 setCycle: Walk setScript: 0)
			)
		)
	)
)

(instance sweptOut of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(proc0_8)
				(= global205 1)
				(if (gEgo inRect: 142 110 166 125)
					(gEgo setMotion: MoveTo 152 113)
				else
					(gEgo setMotion: MoveTo 80 118)
				)
				(gEgo view: 10 cel: 255 loop: 0 setCycle: End self)
			)
			(1
				(gEgo hide:)
				(gRoom newRoom: 24)
			)
		)
	)
)
