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

(public
	riverReg 0
)
(synonyms
	(brook brook brook)
)

(local
	local0
	gEgoViewer
)
(instance riverReg of Rgn
	(properties)
	
	(method (init)
		(super init:)
		(self setScript: riverActions)
		(Load rsVIEW 21)
	)
	
	(method (dispose)
		((ScriptID 0 4) dispose: delete:)
		(super dispose:)
	)
	
	(method (handleEvent pEvent)
		(super handleEvent: pEvent)
		(if (pEvent claimed?) (return 1))
		(return
			(if (== (pEvent type?) evSAID)
				(cond 
					((Said 'look<in/brook')
						(if
							(or
								(& (= local0 (proc0_2 gEgo 20)) $0008)
								(& local0 $0800)
								(& local0 $0002)
								(& local0 $0200)
							)
							(Print 512 0)
						else
							(proc0_13)
						)
					)
					((or (Said 'look/brook') (Said 'look/water')) (Print 512 1))
					(
						(or
							(Said 'bathe/brook')
							(Said 'bathe')
							(Said 'enter/bathe')
						)
						(Print 512 2)
					)
					(
						(or
							(Said 'fish[/!*]')
							(Said 'fish<enter')
							(Said 'look,capture/fish')
							(Said 'cast/pole')
						)
						(Print 512 3)
					)
					((Said 'wade/brook')
						(if (== global105 0)
							(Print 512 4)
						else
							(Print 512 5)
						)
					)
					((or (Said 'drink') (Said 'get/drink'))
						(cond 
							((!= global105 0) (Print 512 6))
							(
								(or
									(& (= local0 (proc0_2 gEgo 10)) $0008)
									(& local0 $0800)
									(& local0 $0002)
									(& local0 $0200)
								)
								(= global120 (Print 512 7 67 -1 10 88))
								(riverActions changeState: 1)
							)
							(else (proc0_13))
						)
					)
					((Said 'get/water') (Print 512 8))
				)
			else
				0
			)
		)
	)
)

(instance riverActions of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(1
				(proc0_8)
				(= gEgoViewer (gEgo viewer?))
				(gEgo viewer: 0 view: 21 cel: 0 setCycle: End self)
			)
			(2
				((ScriptID 0 4) setReal: self 6)
			)
			(3 (gEgo setCycle: Beg self))
			(4
				(gEgo view: 2 setCycle: Walk viewer: gEgoViewer)
				(proc0_21)
				(proc0_9)
			)
		)
	)
)
