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

(public
	Room12 0
)

(local
	[newProp_6 13]
	local13
	local14
	newProp
	newProp_2
	newProp_3
	newProp_4
	newProp_5
	newBlk
	newBlk_2
)
(instance walkingMusic of Sound
	(properties
		number 64
	)
)

(instance caughtMusic of Sound
	(properties
		number 65
	)
)

(instance Room12 of Rm
	(properties
		picture 12
	)
	
	(method (init)
		(= north 6)
		(= south 18)
		(= west 11)
		(= horizon 80)
		(= global101 0)
		(Load rsSOUND 65)
		(gEgo edgeHit: 0)
		(super init:)
		(if global100 (gRoom overlay: 112))
		(= newProp (Prop new:))
		(= newProp_2 (Prop new:))
		(= newProp_3 (Prop new:))
		(= newProp_4 (Prop new:))
		(= newProp_5 (Prop new:))
		(newProp
			isExtra: 1
			view: 688
			loop: 0
			cel: 3
			posn: 265 97
			setPri: 15
			setCycle: Fwd
			cycleSpeed: 2
			ignoreActors:
			init:
		)
		(newProp_2
			isExtra: 1
			view: 688
			loop: 1
			cel: 4
			posn: 12 59
			setPri: 8
			setCycle: Fwd
			cycleSpeed: 2
			ignoreActors:
			init:
		)
		(newProp_3
			isExtra: 1
			view: 688
			loop: 2
			cel: 1
			posn: 210 64
			setPri: 10
			setCycle: Fwd
			cycleSpeed: 2
			ignoreActors:
			init:
		)
		(newProp_4
			isExtra: 1
			view: 688
			loop: 3
			cel: 4
			posn: 154 86
			setPri: 7
			setCycle: Fwd
			cycleSpeed: 2
			ignoreActors:
			init:
		)
		(newProp_5
			isExtra: 1
			view: 688
			loop: 4
			cel: 4
			posn: 98 107
			setPri: 15
			setCycle: Fwd
			cycleSpeed: 2
			ignoreActors:
			init:
		)
		(self setRegions: 509 511)
		(= local14 1)
		(while (< local14 13)
			(= [newProp_6 local14] (Prop new:))
			(++ local14)
		)
		([newProp_6 1]
			view: 695
			loop: 0
			cel: 0
			posn: 29 53
			setPri: 2
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		([newProp_6 2]
			view: 695
			loop: 1
			cel: 0
			posn: 57 61
			setPri: 2
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		([newProp_6 3]
			view: 695
			loop: 2
			cel: 0
			posn: 77 60
			setPri: 7
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		([newProp_6 4]
			view: 695
			loop: 3
			cel: 0
			posn: 147 85
			setPri: 7
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		([newProp_6 5]
			view: 695
			loop: 4
			cel: 0
			posn: 161 87
			setPri: 7
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		([newProp_6 6]
			view: 692
			loop: 4
			cel: 0
			posn: 121 69
			setPri: 6
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		([newProp_6 7]
			view: 696
			loop: 0
			cel: 0
			posn: 206 75
			setPri: 7
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		([newProp_6 8]
			view: 696
			loop: 1
			cel: 0
			posn: 21 63
			setPri: 7
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		([newProp_6 9]
			view: 696
			loop: 2
			cel: 0
			posn: 98 124
			setPri: 7
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		([newProp_6 10]
			view: 694
			loop: 1
			cel: 0
			posn: 231 82
			setPri: 12
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		([newProp_6 11]
			view: 693
			loop: 2
			cel: 0
			posn: 6 85
			setPri: 12
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		([newProp_6 12]
			view: 690
			loop: 0
			cel: 0
			posn: 222 93
			setPri: 8
			cycleSpeed: 1
			ignoreActors:
			init:
			stopUpd:
		)
		(switch gPrevRoomNum
			(west
				(if (<= (gEgo y?) horizon)
					(gEgo posn: 1 (+ horizon (gEgo yStep?) 1))
				else
					(gEgo posn: 1 (gEgo y?))
				)
			)
			(north
				(if (> (gEgo x?) 211)
					(gEgo posn: 210 (+ horizon 2))
				else
					(gEgo posn: (gEgo x?) (+ horizon 2))
				)
			)
			(south
				(if (> (gEgo x?) 77)
					(gEgo posn: 189 188)
				else
					(gEgo posn: 32 188)
				)
			)
			(0 (gEgo x: 290 y: 160))
		)
		(walkingMusic play:)
		(gEgo init: view: 2)
		(= newBlk (Blk new:))
		(= newBlk_2 (Blk new:))
		(newBlk left: 194 top: 115 right: 230 bottom: 118)
		(newBlk_2 left: 170 top: 106 right: 183 bottom: 110)
		(gEgo observeBlocks: newBlk newBlk_2)
	)
	
	(method (doit)
		(super doit:)
		(if
		(and (not global112) (== (gRoom script?) 0))
			(cond 
				((& (gEgo onControl: 0) $0080) (= local13 1) (= local14 2) (gRoom setScript: grabbed))
				((& (gEgo onControl: 0) $2000) (= local13 1) (= local14 3))
				((& (gEgo onControl: 0) $0040) (= local13 1) (= local14 6) (gRoom setScript: grabbed))
				((& (gEgo onControl: 0) $0020) (= local13 1) (= local14 5) (gRoom setScript: grabbed))
				((& (gEgo onControl: 0) $0100) (= local13 2) (= local14 1) (gRoom setScript: grabbed))
				((& (gEgo onControl: 0) $1000) (= local13 2) (= local14 4) (gRoom setScript: grabbed))
				((& (gEgo onControl: 0) $0010) (= local13 2) (= local14 7) (gRoom setScript: grabbed))
				((& (gEgo onControl: 0) $0200) (= local13 2) (= local14 8) (gRoom setScript: grabbed))
				((& (gEgo onControl: 0) $0800) (= local13 2) (= local14 9) (gRoom setScript: grabbed))
				((& (gEgo onControl: 0) $0004)
					(= local13 2)
					(= local14 10)
					(gRoom setScript: grabbed)
				)
				((& (gEgo onControl: 0) $0400)
					(= local13 2)
					(= local14 11)
					(gRoom setScript: grabbed)
				)
				((& (gEgo onControl: 0) $0008)
					(= local13 3)
					(= local14 12)
					(gRoom setScript: grabbed)
				)
			)
		)
	)
	
	(method (dispose)
		(if (IsObject newBlk)
			(newBlk dispose:)
			(newBlk_2 dispose:)
		)
		(super dispose:)
	)
	
	(method (handleEvent pEvent)
		(if (pEvent claimed?) (return 1))
		(return
			(if
				(and
					(== (pEvent type?) evSAID)
					(Said 'look[<around,at][/forest,forest,room]')
				)
				(Print 12 0)
			else
				0
			)
		)
	)
)

(instance grabbed of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(walkingMusic dispose:)
				(caughtMusic play:)
				(proc0_8)
				([newProp_6 local14]
					startUpd:
					setCycle: CT local13 1 self
				)
			)
			(1
				(gEgo dispose:)
				([newProp_6 local14] setCycle: End self)
			)
			(2
				(switch (Random 1 6)
					(1 (Print 12 1))
					(2 (Print 12 2))
					(3 (Print 12 3))
					(4 (Print 12 4))
					(5 (Print 12 5))
					(6 (Print 12 6))
				)
				(= seconds 5)
			)
			(3 (= global127 1))
		)
	)
)
