(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "brain")
(use "MoveToY")
(use "SQRoom")
(use "PolyPath")
(use "Class_950_0")
(use "n958")
(use "Sound")
(use "Cycle")
(use "User")
(use "PicView")
(use "Obj")
(script 541)


(local
    local0[3] = (9 20 31 )
    local9[3] = (7 17 27 )
    local6[5] = (6 16 26 36 48 )
    local11
    local12[4]

)
(procedure (localproc_000e)
    Display("888" 100 + (keyPad:x) 54 + (keyPad:y) local0[local11] 102 global129 101 0 105 30)
)


(procedure (localproc_0041 param1 param2 param3)
    (send param1:
        nsLeft((send param1:x))
        nsTop((send param1:y))
        nsRight(+ (send param1:x) param2)
        nsBottom(+ (send param1:y) param3)
    )
)


(instance public rm541 of SQRoom
    (properties
        picture 541
        north 525
        south 540
        vanishingX 0
        vanishingY 65506
    )

    (method (init)
        (var temp0, temp1, temp2)
        proc958_0(128 516 502 517 515)
        Load(rsCURSOR 69)
        Load(rsSOUND 854 855 856 857 858 859 860 861 862 863 885 153)
        (send gEgo:init())
        (self:setRegions(704))
        (super:init())
        (send gLongSong:
            number(885)
            loop(-1)
            vol(127)
            playBed()
        )
        (brain:
            makePolygon(0 0 33 0 215 189 0 189)
            makePolygon(40 0 318 0 319 189 241 189 219 165 192 157)
            level(2)
        )
        (send global1:setCursor(69 1))
        (smallKeyPad:init())
        = temp1 0
        (if (>= (= temp2 global185) 4096)
            = temp1 1
            = temp2 (- temp2 4096)
        )
        (if (temp1)
            (smoke0:
                setCel(3)
                init()
                stopUpd()
            )
            (smoke1:
                setCel(3)
                init()
                stopUpd()
            )
            (smoke2:
                setCel(3)
                init()
                stopUpd()
            )
        )
        (beam0:
            setLoop(temp1)
            setCel(= temp0 (% temp2 16))
            init()
        )
        (beam1:
            setLoop(temp1)
            setCel(= temp0 (% (= temp2 (/ temp2 16)) 16))
            init()
        )
        (beam2:
            setLoop(temp1)
            setCel(= temp0 (= temp2 (/ temp2 16)))
            init()
        )
        (switch (gWest)
            (case north
                (self:setScript(enterScript 0 1))
            )
            (default 
                (self:setScript(enterScript 0 3))
            )
        )
        (roomFeature:init())
    )


    (method (doit param1)
        (super:doit(rest param1))
        (if (script)
        )(else
            (if (== (send ((send global9:at(12))):state) 1)
                (self:setScript(smokeScript))
                (send ((send global9:at(12))):state(0))
            )(else
                (if (proc0_5(gEgo 8))
                    (brain:exitDir(
                        (if (> (send gEgo:y) 100)
                            135
                        )(else
                            315
                        )
))
                )
            )
        )
    )


    (method (newRoom param1)
        (if ((== param1 (send global2:south)) and (brain:formatting))
            proc0_10(0 19)
        )(else
            (send gLongSong:fade())
            (if ((send global5:contains(smoke0)))
                = global185 4096
            )(else
                = global185 0
            )
            = global185 (+ (= global185 (+ (= global185 (+ global185 (* (beam2:cel) 256))) (* (beam1:cel) 16))) (beam0:cel))
            (super:newRoom(param1))
        )
    )

)
(instance smallKeyPad of Feature
    (properties
        x 248
        y 147
        nsTop 136
        nsLeft 240
        nsBottom 158
        nsRight 256
        description "keypad"
        sightAngle 90
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 2
                (send global2:setScript(startKeyPadScript))
            )
            (case 1
                (send global2:setScript(startKeyPadScript))
            )
            (default 
                (super:doVerb(param1 rest param2))
            )
        )
    )

)
(instance beam0 of Prop
    (properties
        x 190
        y 157
        description "beam"
        sightAngle 90
        view 516
        cel 9
        signal 16384
    )

    (method (init param1)
        (super:init(rest param1))
        (if (loop)
            = lookStr "The beams glow dully in the smokey air."
        )(else
            = lookStr "You see what looks like beam emitters, but no beams."
        )
    )


    (method (doit param1)
        (super:doit(rest param1))
        (if ((not (send global2:script) and (<> cel 7)) and (< GetDistance((self:x) (self:y) (send gEgo:x) (send gEgo:y)) 5))
            (send global2:setScript(egoFryScript))
        )
    )


    (method (cue)
        (rotate:stop())
        (super:cue())
        (send gIconBar:enable(0))
        (self:setScript(0))
    )

)
(instance beam1 of Prop
    (properties
        x 151
        y 117
        description "beam"
        sightAngle 90
        view 516
        cel 5
        signal 16384
    )

    (method (init param1)
        (super:init(rest param1))
        (if (loop)
            = lookStr "The beams glow dully in the smokey air."
        )(else
            = lookStr "You see what looks like beam emitters, but no beams."
        )
    )


    (method (doit param1)
        (super:doit(rest param1))
        (if ((not (send global2:script) and (<> cel 7)) and (< GetDistance((self:x) (self:y) (send gEgo:x) (send gEgo:y)) 5))
            (send global2:setScript(egoFryScript))
        )
    )


    (method (cue)
        (rotate:stop())
        (super:cue())
        (send gIconBar:enable(0))
        (self:setScript(0))
    )

)
(instance beam2 of Prop
    (properties
        x 110
        y 77
        description "beam"
        sightAngle 90
        view 516
        cel 13
        signal 16384
    )

    (method (init param1)
        (super:init(rest param1))
        (if (loop)
            = lookStr "The beams glow dully in the smokey air."
        )(else
            = lookStr "You see what looks like beam emitters, but no beams."
        )
    )


    (method (doit param1)
        (super:doit(rest param1))
        (if ((not (send global2:script) and (<> cel 7)) and (< GetDistance((self:x) (self:y) (send gEgo:x) (send gEgo:y)) 5))
            (send global2:setScript(egoFryScript))
        )
    )


    (method (cue)
        (rotate:stop())
        (super:cue())
        (send gIconBar:enable(0))
        (self:setScript(0))
        (if (((== cel 7) and (== (beam0:cel) 7)) and (== (beam1:cel) 7))
            proc0_11(59 15)
        )
    )

)
(instance smoke0 of Prop
    (properties)
)
(instance smoke1 of Prop
    (properties)
)
(instance smoke2 of Prop
    (properties)
)
(instance blinker of Prop
    (properties
        view 502
        loop 2
        priority 14
        signal 16400
    )

    (method (doit)
        (super:doit())
        (self:
            x(+ (keyPad:x) 53)
            y(+ (keyPad:y) (+ local0[local11] 4))
        )
    )

)
(instance hand of View
    (properties
        view 502
        cel 2
        priority 15
        signal 16
    )

    (method (doit)
        (var UserCurEvent, UserCurEventX, temp2)
        (if (not & (send ((= UserCurEvent (User:curEvent))):type) $0007)
            GlobalToLocal(UserCurEvent)
            = UserCurEventX (send UserCurEvent:x)
            = temp2 (+ (send UserCurEvent:y) 10)
            (if (proc999_4((keyPad:x) (keyPad:y) + (keyPad:x) CelWide((keyPad:view) (keyPad:loop) (keyPad:cel)) + (keyPad:y) CelHigh((keyPad:view) (keyPad:loop) (keyPad:cel)) UserCurEventX temp2))
                (send global1:setCursor(69 1))
                (self:
                    show()
                    x(UserCurEventX)
                    y(temp2)
                )
            )(else
                (send global1:setCursor(global20 1))
                (self:hide())
            )
        )
        (super:doit())
    )

)
(instance keyPad of View
    (properties
        x 220
        y 40
        view 502
    )

    (method (init param1)
        (super:init(rest param1))
        (self:signal(257))
        (send gSq4MouseDownHandler:addToFront(self))
        (send gSq4KeyDownHandler:addToFront(self))
        (User:mapKeyToDir(0))
        (send gIconBar:disable())
        (oneBut:
            init(@local12)
            who(oneDown)
        )
        (twoBut:
            init(@local12)
            who(twoDown)
        )
        (threeBut:
            init(@local12)
            who(threeDown)
        )
        (fourBut:
            init(@local12)
            who(fourDown)
        )
        (fiveBut:
            init(@local12)
            who(fiveDown)
        )
        (sixBut:
            init(@local12)
            who(sixDown)
        )
        (sevenBut:
            init(@local12)
            who(sevenDown)
        )
        (eightBut:
            init(@local12)
            who(eightDown)
        )
        (nineBut:
            init(@local12)
            who(nineDown)
        )
        (zeroBut:
            init(@local12)
            who(zeroDown)
        )
        (enterBut:init())
        (quitBut:init())
        (oneDown:
            init()
            hide()
        )
        (twoDown:
            init()
            hide()
        )
        (threeDown:
            init()
            hide()
        )
        (fourDown:
            init()
            hide()
        )
        (fiveDown:
            init()
            hide()
        )
        (sixDown:
            init()
            hide()
        )
        (sevenDown:
            init()
            hide()
        )
        (eightDown:
            init()
            hide()
        )
        (nineDown:
            init()
            hide()
        )
        (zeroDown:
            init()
            hide()
        )
        (enterDown:
            init()
            hide()
        )
        (hand:
            init()
            hide()
            x(+ (keyPad:x) 50)
            y(+ (keyPad:y) 20)
        )
        (blinker:
            init()
            setCycle(Fwd)
        )
    )


    (method (dispose param1)
        (super:dispose(rest param1))
        (User:mapKeyToDir(1))
        (send global1:setCursor((send ((send gIconBar:curIcon)):cursor) 1))
        (send gSq4KeyDownHandler:delete(self))
        (send gSq4MouseDownHandler:delete(self))
        (oneBut:dispose())
        (twoBut:dispose())
        (threeBut:dispose())
        (fourBut:dispose())
        (fiveBut:dispose())
        (sixBut:dispose())
        (sevenBut:dispose())
        (eightBut:dispose())
        (nineBut:dispose())
        (zeroBut:dispose())
        (enterBut:dispose())
        (quitBut:dispose())
        (oneDown:dispose())
        (twoDown:dispose())
        (threeDown:dispose())
        (fourDown:dispose())
        (fiveDown:dispose())
        (sixDown:dispose())
        (sevenDown:dispose())
        (eightDown:dispose())
        (nineDown:dispose())
        (zeroDown:dispose())
        (enterDown:dispose())
        (blinker:dispose())
        (hand:dispose())
        proc0_3()
    )


    (method (handleEvent pEvent)
        (if (proc255_5(self pEvent))
            (send pEvent:claimed(1))
        )
    )

)
(class KeyPadButton of Feature
    (properties
        x 0
        y 0
        z 0
        heading 0
        noun 0
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        description 0
        sightAngle 26505
        actions 26505
        onMeCheck 26505
        lookStr 0
        theString 0
        strToCat 0
        keyEquiv 0
        maxLen 0
        who 0
        tone 0
    )

    (method (init theTheString)
        (super:init())
        = theString theTheString
        (send gSq4MouseDownHandler:addToFront(self))
        (send gSq4KeyDownHandler:addToFront(self))
    )


    (method (doit)
        (send who:setScript(Clone(keyFlashScript) 0 tone))
        (if (< StrLen(theString) maxLen)
            localproc_000e()
            StrCat(theString strToCat)
            Display(theString 100 + (+ (keyPad:x) 54) (* (- maxLen StrLen(theString)) 4) + (keyPad:y) local0[local11] 102 global142 101 0 105 30)
        )
    )


    (method (dispose)
        (send gSq4KeyDownHandler:delete(self))
        (send gSq4MouseDownHandler:delete(self))
        (super:dispose())
    )


    (method (handleEvent pEvent)
        (switch ((send pEvent:type))
            (case 4
                (if (== (send pEvent:message) keyEquiv)
                    (send pEvent:claimed(1))
                    (self:doit())
                )
            )
            (case 1
                (if (proc255_5(self pEvent))
                    (send pEvent:claimed(1))
                    (self:doit())
                )
            )
        )
    )

)
(instance beep of Sound
    (properties)
)
(instance rotate of Sound
    (properties
        number 153
    )
)
(instance keyFlashScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send client:show())
                (beep:
                    number(register)
                    play()
                )
                = cycles 2
            )
            (case 1
                (send client:
                    hide()
                    setScript(0)
                )
            )
        )
    )

)
(class CA of Cycle
    (properties
        client 0
        caller 0
        cycleDir 1
        cycleCnt 0
        completed 0
        celCnt 0
    )

    (method (init param1 param2 theCaller)
        (super:init(param1))
        = celCnt 
            (if (< param2 1)
                1
            )(else
                param2
            )
        (if (== paramTotal 3)
            = caller theCaller
        )
    )


    (method (doit)
        (var temp0[2])
        (send client:)
        --celCnt
        (if (not celCnt)
            (self:cycleDone())
        )
    )


    (method (cycleDone)
        = completed 1
        (if (caller)
            = global37 1
        )(else
            (self:motionCue())
        )
    )

)
(instance enterBut of Feature
    (properties)

    (method (init param1)
        (super:init(rest param1))
        (send gSq4MouseDownHandler:addToFront(self))
        (send gSq4KeyDownHandler:addToFront(self))
        (self:
            x(+ (keyPad:x) local9[0])
            y(+ (keyPad:y) local6[3])
        )
        localproc_0041(self 19 8)
    )


    (method (dispose param1)
        (super:dispose(rest param1))
        (send gSq4MouseDownHandler:delete(self))
        (send gSq4KeyDownHandler:delete(self))
    )


    (method (handleEvent pEvent)
        (var temp0, temp1, temp2)
        (if ((super:handleEvent(pEvent)))
        )(else
            (if (((== (send pEvent:type) 4) and (== (send pEvent:message) 13)) or proc255_5(self pEvent))
                (send pEvent:claimed(1))
                (enterDown:setScript(Clone(keyFlashScript) 0 864))
                localproc_000e()
                = temp0 ReadNumber(@local12)
                = temp2 StrLen(@local12)
                = local12 0
                (if (((> temp0 360) or (< temp0 1)) or (< temp2 3))
                    0
                )(else
                    (send gIconBar:disable())
                    = temp1 (/ temp0 12)
                    (switch (local11)
                        (case 0
                            (if (not temp1)
                                (beam0:cue())
                            )(else
                                (rotate:play())
                                (beam0:setCycle(CA temp1 beam0))
                            )
                        )
                        (case 1
                            (if (not temp1)
                                (beam1:cue())
                            )(else
                                (rotate:play())
                                (beam1:setCycle(CA temp1 beam1))
                            )
                        )
                        (case 2
                            (if (not temp1)
                                (beam2:cue())
                            )(else
                                (rotate:play())
                                (beam2:setCycle(CA temp1 beam2))
                            )
                        )
                    )
                )
                (if (> ++local11 2)
                    = local11 0
                )
            )
        )
    )

)
(instance quitBut of Feature
    (properties)

    (method (init param1)
        (super:init(rest param1))
        (send gSq4MouseDownHandler:addToFront(self))
        (send gSq4KeyDownHandler:addToFront(self))
        (self:
            x(+ (keyPad:x) local9[0])
            y(+ (keyPad:y) local6[4])
        )
        localproc_0041(self 19 8)
    )


    (method (dispose param1)
        (super:dispose(rest param1))
        (beep:
            number(865)
            play()
        )
        (send gSq4MouseDownHandler:delete(self))
        (send gSq4KeyDownHandler:delete(self))
    )


    (method (handleEvent pEvent)
        (if ((super:handleEvent(pEvent)))
        )(else
            (if (((== (send pEvent:type) 4) and proc999_5((send pEvent:message) 88 120)) or proc255_5(self pEvent))
                (send pEvent:claimed(1))
                = local12 0
                (keyPad:dispose())
                (send gIconBar:enable())
            )
        )
    )

)
(instance oneBut of KeyPadButton
    (properties
        strToCat "1"
        keyEquiv 49
        maxLen 3
        tone 854
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[0])
            y(+ (keyPad:y) local6[0])
        )
        localproc_0041(self 8 8)
    )

)
(instance twoBut of KeyPadButton
    (properties
        strToCat "2"
        keyEquiv 50
        maxLen 3
        tone 855
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[1])
            y(+ (keyPad:y) local6[0])
        )
        localproc_0041(self 8 8)
    )

)
(instance threeBut of KeyPadButton
    (properties
        strToCat "3"
        keyEquiv 51
        maxLen 3
        tone 856
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[2])
            y(+ (keyPad:y) local6[0])
        )
        localproc_0041(self 8 8)
    )

)
(instance fourBut of KeyPadButton
    (properties
        strToCat "4"
        keyEquiv 52
        maxLen 3
        tone 857
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[0])
            y(+ (keyPad:y) local6[1])
        )
        localproc_0041(self 8 8)
    )

)
(instance fiveBut of KeyPadButton
    (properties
        strToCat "5"
        keyEquiv 53
        maxLen 3
        tone 858
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[1])
            y(+ (keyPad:y) local6[1])
        )
        localproc_0041(self 8 8)
    )

)
(instance sixBut of KeyPadButton
    (properties
        strToCat "6"
        keyEquiv 54
        maxLen 3
        tone 859
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[2])
            y(+ (keyPad:y) local6[1])
        )
        localproc_0041(self 8 8)
    )

)
(instance sevenBut of KeyPadButton
    (properties
        strToCat "7"
        keyEquiv 55
        maxLen 3
        tone 860
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[0])
            y(+ (keyPad:y) local6[2])
        )
        localproc_0041(self 8 8)
    )

)
(instance eightBut of KeyPadButton
    (properties
        strToCat "8"
        keyEquiv 56
        maxLen 3
        tone 861
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[1])
            y(+ (keyPad:y) local6[2])
        )
        localproc_0041(self 8 8)
    )

)
(instance nineBut of KeyPadButton
    (properties
        strToCat "9"
        keyEquiv 57
        maxLen 3
        tone 862
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[2])
            y(+ (keyPad:y) local6[2])
        )
        localproc_0041(self 8 8)
    )

)
(instance zeroBut of KeyPadButton
    (properties
        strToCat "0"
        keyEquiv 48
        maxLen 3
        tone 863
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[2])
            y(+ (keyPad:y) local6[3])
        )
        localproc_0041(self 8 8)
    )

)
(instance oneDown of Prop
    (properties
        view 502
        loop 1
        priority 15
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[0])
            y(+ (keyPad:y) local6[0])
        )
    )

)
(instance twoDown of Prop
    (properties
        view 502
        loop 1
        cel 1
        priority 15
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[1])
            y(+ (keyPad:y) local6[0])
        )
    )

)
(instance threeDown of Prop
    (properties
        view 502
        loop 1
        cel 2
        priority 15
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[2])
            y(+ (keyPad:y) local6[0])
        )
    )

)
(instance fourDown of Prop
    (properties
        view 502
        loop 1
        cel 3
        priority 15
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[0])
            y(+ (keyPad:y) local6[1])
        )
    )

)
(instance fiveDown of Prop
    (properties
        view 502
        loop 1
        cel 4
        priority 15
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[1])
            y(+ (keyPad:y) local6[1])
        )
    )

)
(instance sixDown of Prop
    (properties
        view 502
        loop 1
        cel 5
        priority 15
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[2])
            y(+ (keyPad:y) local6[1])
        )
    )

)
(instance sevenDown of Prop
    (properties
        view 502
        loop 1
        cel 6
        priority 15
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[0])
            y(+ (keyPad:y) local6[2])
        )
    )

)
(instance eightDown of Prop
    (properties
        view 502
        loop 1
        cel 7
        priority 15
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[1])
            y(+ (keyPad:y) local6[2])
        )
    )

)
(instance nineDown of Prop
    (properties
        view 502
        loop 1
        cel 8
        priority 15
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[2])
            y(+ (keyPad:y) local6[2])
        )
    )

)
(instance zeroDown of Prop
    (properties
        view 502
        loop 1
        cel 9
        priority 15
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[2])
            y(+ (keyPad:y) local6[3])
        )
    )

)
(instance enterDown of Prop
    (properties
        view 502
        loop 1
        cel 10
        priority 15
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            x(+ (keyPad:x) local9[0])
            y(+ (keyPad:y) local6[3])
        )
    )

)
(instance enterScript of Script
    (properties)

    (method (changeState newState)
        (var temp0, temp1, temp2, temp3)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (== register 1)
                    = temp0 47
                    = temp1 7
                    = temp2 33
                    = temp3 135
                )(else
                    = temp0 277
                    = temp1 242
                    = temp2 (- 189 (* (send gEgo:yStep) 4))
                    = temp3 315
                )
                (send gEgo:
                    illegalBits(0)
                    x(temp0)
                    y(temp1)
                    setHeading(temp3)
                    setMotion(MoveToY temp2 self)
                )
            )
            (case 1
                (send gEgo:
                    illegalBits(32768)
                    setPri(-1)
                )
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance egoFryScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (beam0:setPri(9))
                (beam1:setPri(7))
                (beam2:setPri(3))
                (send gEgo:
                    view(515)
                    setLoop(4)
                    setCycle(Fwd)
                )
                (send gLongSong2:
                    number(139)
                    vol(127)
                    loop(1)
                    play()
                )
                = cycles 8
            )
            (case 1
                (send gEgo:
                    setLoop(5)
                    setCel(0)
                    cycleSpeed(1)
                    setCycle(End)
                )
                = seconds 5
            )
            (case 2
                proc0_10(8)
            )
        )
    )

)
(instance smokeScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:setMotion(PolyPath 216 181 self))
            )
            (case 1
                (send gEgo:
                    view(515)
                    setLoop(2)
                    cycleSpeed(1)
                    setCycle(End self)
                )
            )
            (case 2
                (send gEgo:
                    setLoop(3)
                    setCel(0)
                    setCycle(End self)
                )
                (send gLongSong2:
                    number(846)
                    vol(127)
                    loop(1)
                    play()
                )
            )
            (case 3
                (smoke0:
                    init()
                    setCycle(End)
                )
                = cycles 2
            )
            (case 4
                proc0_1(7 0)
                (beam0:
                    setLoop(1)
                    lookStr("The beams glow dully in the smokey air.")
                )
                (smoke1:
                    init()
                    setCycle(End)
                )
                = cycles 2
            )
            (case 5
                (beam1:
                    setLoop(1)
                    lookStr("The beams glow dully in the smokey air.")
                )
                (smoke2:
                    init()
                    setCycle(End self)
                )
            )
            (case 6
                (smoke0:stopUpd())
                (smoke1:stopUpd())
                (smoke2:stopUpd())
                (beam2:
                    setLoop(1)
                    lookStr("The beams glow dully in the smokey air.")
                )
                = cycles 6
            )
            (case 7
                Print("You cast the old stogie to the ground.")
                (send gEgo:put(12 global11))
                proc0_11(58 10)
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance startKeyPadScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:setMotion(PolyPath (smallKeyPad:x) (smallKeyPad:y) self))
            )
            (case 1
                (send gEgo:setHeading(90 self))
            )
            (case 2
                (keyPad:init())
                (self:dispose())
            )
        )
    )

)
(instance roomFeature of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "laser tunnel"
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 1
                (if (>= global185 4096)
                    Print("Thin cigar smoke fills the long tunnel, making the laser beams glow dully.")
                )(else
                    Print("This long tunnel contains three circular steel bands, each containing nozzle-like projections.")
                )
            )
            (default 
                (super:doVerb(param1 rest param2))
            )
        )
    )

)
