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

(public
	Room68 0
)

(local
	newProp
	newAct
	local2
	local3
)
(instance Room68 of Rm
	(properties
		picture 68
		style $0010
		south 17
	)
	
	(method (init)
		(Load rsVIEW 533)
		(Load rsVIEW 536)
		(super init:)
		(self setRegions: 603)
		(if (== global134 4)
			(Load rsVIEW 206)
			(Load rsVIEW 204)
		)
		((View new:)
			view: 536
			loop: 7
			cel: 0
			posn: 77 109
			setPri: 8
			addToPic:
		)
		(= global105 0)
		(if global100
			((Prop new:)
				view: 536
				loop: 4
				posn: 79 98
				setPri: 11
				init:
				setCycle: Fwd
			)
		)
		(= global101 1)
		((= newProp (Prop new:))
			isExtra: 1
			view: 533
			loop: 0
			posn: 223 131
			init:
			setPri: 11
			cycleSpeed: 4
			setCycle: Fwd
		)
		(gEgo
			view: 4
			setLoop: -1
			setCycle: Walk
			illegalBits: -32768
			setStep: 4 2
		)
		(switch gPrevRoomNum
			(67
				(gEgo
					posn: 56 165
					loop: 0
					init:
					baseSetter: (ScriptID 0 1)
				)
			)
			(64
				(gEgo
					posn: 262 167
					loop: 1
					init:
					baseSetter: (ScriptID 0 1)
				)
			)
			(62
				(gEgo posn: 97 79 loop: 2 init: baseSetter: 0)
			)
			(60
				(gEgo posn: 198 81 loop: 2 init: baseSetter: 0)
			)
			(17
				(gEgo
					posn: 153 182
					loop: 3
					init:
					baseSetter: (ScriptID 0 1)
				)
			)
		)
		((= newAct (Act new:))
			illegalBits: 0
			ignoreActors: 1
			setScript: mirrorTricks
		)
		(if
			(and
				(< 0 global134)
				(< global134 255)
				(== global133 gCurRoomNum)
			)
			(proc0_10 603 -1)
		)
	)
	
	(method (doit)
		(if (& (= local2 (gEgo onControl: 0)) $0040)
			(gEgo loop: 2 baseSetter: 0)
			(proc0_18)
			(gRoom newRoom: 17)
		)
		(if (& local2 $0020)
			(gEgo loop: 1 baseSetter: 0)
			(proc0_18)
			(gRoom newRoom: 67)
		)
		(if (& local2 $0010)
			(gEgo loop: 3 baseSetter: 0)
			(proc0_18)
			(gRoom newRoom: 60)
		)
		(if (& local2 $0008)
			(gEgo loop: 3 baseSetter: 0)
			(proc0_18)
			(gRoom newRoom: 62)
		)
		(if (& local2 $0004)
			(gEgo loop: 0 baseSetter: 0)
			(proc0_18)
			(gRoom newRoom: 64)
		)
		(if (and (& local2 $0400) (!= global105 18))
			(= global105 18)
			(gEgo setScript: moveOnTheStairs)
		)
		(super doit:)
	)
	
	(method (handleEvent pEvent)
		(return
			(cond 
				((pEvent claimed?) (return 1))
				((== (pEvent type?) evSAID)
					(cond 
						(
							(or
								(Said 'look[<around][/!*]')
								(Said 'look[<around]/room')
							)
							(Print 68 0)
						)
						(
							(or
								(Said 'is<how<time')
								(Said 'is<how/time')
								(Said 'read/time')
								(Said 'read/clock')
								(Said '[!*]/time')
								(Said 'look/time')
							)
							(Print
								(Format
									@global228
									68
									1
									(if (mod global160 12) (mod global160 12) else 12)
									global159
									(if (and (> global160 11) (< global160 24))
										{P.M.}
									else
										{A.M.}
									)
								)
								80
								{TAMIR TIME}
								67
								-1
								20
								33
								gSmallFont
							)
						)
						((Said 'look>')
							(cond 
								((Said '<behind/painting') (Print 68 2))
								((Said '/painting') (Print 68 3))
								((Said '/mirror')
									(if (gEgo inRect: 161 154 195 189)
										(gEgo loop: 3)
										(Print 68 4)
									else
										(Print 800 1)
									)
								)
								((Said '/chandelier') (Print 68 5))
								((Said '/stair') (Print 68 6))
								((Said '<in/clock') (Print 68 7))
								((Said '/clock') (Print 68 8))
								((Said '/door') (Print 68 9))
								((Said '/wall') (Print 68 10))
								((or (Said '/dirt') (Said '<down')) (Print 68 11))
								((Said '/carpet') (Print 68 12))
								((Said '/table') (Print 68 13))
							)
						)
						((Said 'wind/clock') (Print 68 14))
						((Said 'get/clock') (Print 68 15))
						((Said 'open/clock') (Print 68 7))
						((Said 'get/carpet') (Print 68 16))
						((Said 'get/painting') (Print 68 17))
					)
				)
			)
		)
	)
	
	(method (newRoom newRoomNumber)
		(if (== newRoomNumber 17)
			((ScriptID 603) keep: 0)
			(= global189 0)
		)
		(super newRoom: newRoomNumber)
	)
)

(instance mirrorTricks of Script
	(properties)
	
	(method (init param1)
		(super init: param1)
		(client view: (gEgo view?) setPri: 0 init: hide:)
	)
	
	(method (doit)
		(if (gEgo inRect: 161 154 195 191)
			(client
				show:
				loop:
				(switch (gEgo loop?)
					(0 0)
					(1 1)
					(2 3)
					(3 2)
				)
				cel: (gEgo cel?)
				posn: (gEgo x?) (- 160 (/ (- (gEgo y?) 160) 3))
				setCycle: Walk
			)
		else
			(client hide:)
		)
	)
)

(instance moveOnTheStairs of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(proc0_8)
				(gEgo setStep: 3 3)
				(if (> (gEgo y?) 100)
					(gEgo illegalBits: 0 setMotion: MoveTo 196 81 self)
				else
					(gEgo illegalBits: 0 setMotion: MoveTo 99 139 self)
				)
			)
			(1
				(proc0_7)
				(proc0_9)
				(= global189 1)
				(gEgo setScript: 0 setStep: 4 2)
				(if (< (gEgo y?) 130)
					(gEgo baseSetter: 0)
				else
					(gEgo baseSetter: (ScriptID 0 1))
				)
				(= global105 0)
			)
		)
	)
)
