(version 2)
(include "sci.sh")
(exports
    0 rm66
)
(use "Main")
(use "Class_255_0")
(use "NewFeature")
(use "Cycle")
(use "Game")
(use "User")
(use "PicView")
(use "Obj")
(script 66)



(instance public rm66 of Rm
    (properties
        picture 66
        horizon 103
        north 19
        east 67
        south 67
    )

    (method (init)
        Load(rsVIEW 266)
        (self:style(
            (switch (gGNumber)
                (case north
                    0
                )
                (default 
                    0
                )
            )
))
        (super:init())
        (switch (gGNumber)
            (case north
                (self:setScript(enterMount))
            )
            (default 
                (door:init())
                (send gEgo:
                    posn(303 187)
                    loop(3)
                    init()
                )
                proc0_1()
                (door:stopUpd())
            )
        )
        (ceiling:init())
        (arch:init())
        (wall1:init())
        (wall2:init())
        (wall3:init())
        (if (proc0_12(2))
            proc255_0(66 0)
            proc0_11(2)
        )
    )


    (method (doit)
        (var temp0)
        (if (script)
            (send script:doit())
        )(else
            = temp0 
                (switch ((send ((User:alterEgo)):edgeHit))
                    (case 1
                        north
                    )
                    (case 2
                        east
                    )
                    (case 3
                        south
                    )
                    (case 4
                        west
                    )
                )
            (if (temp0)
                (self:newRoom((= temp0 
                        (switch ((send ((User:alterEgo)):edgeHit))
                            (case 1
                                north
                            )
                            (case 2
                                east
                            )
                            (case 3
                                south
                            )
                            (case 4
                                west
                            )
                        )
)))
            )(else
                (if (& (send gEgo:onControl(1)) $4000)
                    (self:setScript(leaveMount))
                )
            )
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look>'))
                    (if (Said('[<at,around][/room,cave]'))
                        (if (== gGNumber north)
                            proc255_0(66 1)
                        )(else
                            proc255_0(66 2)
                        )
                    )
                )(else
                    (if (Said('climb,climb/wall'))
                        proc255_0(66 3)
                    )
                )
            )
        )
    )

)
(instance door of Prop
    (properties
        x 136
        y 106
        view 266
    )

    (method (handleEvent pEvent)
        (if (Said('look,look/door') or proc255_5(self pEvent 3))
            proc255_0(66 4)
            (send pEvent:claimed(1))
        )(else
            (if (Said('open,open,unlock,knock/door'))
                proc255_0(66 5)
            )
        )
    )

)
(instance doorCloses of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send (ScriptID(0 21)):
                    number(56)
                    loop(1)
                    init()
                    play()
                )
                (door:
                    cel(8)
                    setCycle(Beg self)
                )
            )
            (case 1
                (door:stopUpd())
                (self:dispose())
            )
        )
    )

)
(instance leaveMount of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send (ScriptID(0 21)):
                    number(56)
                    loop(1)
                    init()
                    play()
                )
                (door:setCycle(End self))
            )
            (case 1
                (door:stopUpd())
                (send gEgo:
                    ignoreActors()
                    illegalBits(0)
                    setMotion(MoveTo (send gEgo:x) 103 self)
                )
            )
            (case 2
                (send global2:newRoom(19))
            )
        )
    )

)
(instance enterMount of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    ignoreActors()
                    illegalBits(0)
                    posn(140 113)
                    loop(2)
                    init()
                    setMotion(MoveTo 140 123 self)
                )
                (door:
                    cel(8)
                    setScript(doorCloses)
                    init()
                )
            )
            (case 1
                (send gEgo:stopUpd())
                proc0_3()
                proc0_1()
                (self:dispose())
            )
        )
    )

)
(instance wall1 of NewFeature
    (properties
        x 49
        y 83
        noun 1467
        nsTop 34
        nsLeft 19
        nsBottom 132
        nsRight 80
        description 1523
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 1528
    )
)
(instance wall2 of NewFeature
    (properties
        x 145
        y 67
        noun 1467
        nsTop 27
        nsLeft 79
        nsBottom 108
        nsRight 212
        description 1523
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 1528
    )
)
(instance wall3 of NewFeature
    (properties
        x 249
        y 81
        noun 1467
        nsTop 41
        nsLeft 212
        nsBottom 122
        nsRight 287
        description 1523
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 1528
    )
)
(instance ceiling of NewFeature
    (properties
        x 162
        y 26
        noun 1470
        nsLeft 46
        nsBottom 53
        nsRight 279
        description 1591
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 1599
    )
)
(instance arch of NewFeature
    (properties
        x 272
        y 170
        noun 1473
        nsTop 152
        nsLeft 226
        nsBottom 189
        nsRight 318
        description 1634
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 1639
    )
)
