(version 2)
(include "sci.sh")
(exports
    0 rm320
    1 rightGuardTalker
    2 leftGuardTalker
    3 rightGuardTalker
    4 leftGuardTalker
)
(use "Main")
(use "TellerIcon")
(use "GloryTalker")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "Rev")
(use "Cycle")
(use "Game")
(use "View")
(use "Obj")
(script 320)


(local
    local0[6] = (0 18 17 20 19 999 )
    local6[6] = (0 -2 3 -4 13 999 )
    local12[5] = (0 8 -9 -11 999 )
    local17[5] = (0 6 7 5 999 )
    local22[3] = (0 10 999 )
    local25[3] = (0 12 999 )
    local28[6] = (0 -2 -3 -4 -13 999 )
    local34[6] = (0 -2 -3 -4 -13 999 )
    local40[6] = (0 -2 3 4 13 999 )
    local46[5] = (0 8 -9 -11 999 )
    local51[8] = (0 21 22 23 24 25 26 999 )
    local59[4] = (0 28 29 999 )
    local63[4]
    local67[7]
    local74[5]
    local79[5]
    local84[7]
    local91[6] = (0 -2 -4 -9 -11 999 )
    local97[6] = (0 -2 -4 -9 -11 999 )

)
(instance public rm320 of Rm
    (properties
        noun 11
        picture 320
        vanishingY -58
    )

    (method (init param1)
        proc958_0(128 196 191)
        = local63[0] @local0
        = local67[0] @local6
        = local67[1] @local12
        = local67[2] @local17
        = local67[3] @local22
        = local67[4] @local25
        = local84[0] @local40
        = local84[1] @local46
        = local84[3] @local51
        = local84[4] @local59
        = local74[0] @local28
        = local79[0] @local34
        proc0_2()
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(0 135 0 0 319 0 319 124 310 136 296 136 275 55 249 55 273 139 260 140 236 133 132 148 92 129 97 120 97 103 82 99 87 120 73 123 58 123 43 114 63 103 44 91 41 112 27 120 11 124)
                yourself()
            )
 (send ((Polygon:new())):
                type(2)
                init(0 163 4 159 4 146 14 144 21 134 40 131 48 134 36 137 99 153 129 163 304 143 319 189 0 189)
                yourself()
            )
))
        (tell:init(gOwner @local0 @local63))
        (send gOwner:
            noun(3)
            init()
            normalize()
            xStep(2)
            yStep(1)
            setScale(415)
        )
        (leftGuardTell:init(leftGuard 
            (if (global121)
                @local34
            )(else
                @local28
            )
 
            (if (global121)
                @local79
            )(else
                @local74
            )
))
        (leftGuard:
            noun(
                (if (global121)
                    4
                )(else
                    2
                )
)
            init()
            stopUpd()
            approachVerbs(4 2)
        )
        (rightGuardTell:init(rightGuard 
            (if (global121)
                @local40
            )(else
                @local6
            )
 
            (if (global121)
                @local84
            )(else
                @local67
            )
 
            (if (global121)
                @local97
            )(else
                @local91
            )
))
        (rightGuard:
            noun(
                (if (global121)
                    5
                )(else
                    1
                )
)
            init()
            stopUpd()
            approachVerbs(4 2)
        )
        (tallGay1:init())
        (tallGay2:init())
        (temple:init())
        (toKing:init())
        (toJudge:init())
        (magicshop:init())
        (dome:init())
        (spire:init())
        (super:init(rest param1))
        (send gLongSong:
            number(320)
            setLoop(-1)
            play()
        )
        (switch (gGClientModNum)
            (case 270
                (send gOwner:
                    x(-17)
                    y(180)
                )
                (self:setScript(sFrom270))
            )
            (case 330
                (send gOwner:
                    x(60)
                    y(111)
                )
                (self:setScript(sFrom330))
            )
            (case 350
                (send gOwner:
                    x(271)
                    y(105)
                )
                (self:setScript(sFrom350))
            )
            (case 210
                (send gOwner:
                    x(319)
                    y(164)
                )
                (self:setScript(sFrom210))
            )
            (default 
                (send gOwner:
                    x(100)
                    y(123)
                    view(1)
                )
                (self:setScript(sFrom340))
            )
        )
    )


    (method (doit param1)
        (var temp0, gOwnerMover)
        (super:doit(rest param1))
        (if (script)
        )(else
            = temp0 (send gOwner:onControl(1))
            (if (not temp0)
            )(else
                (if (== temp0 2)
                    = gOwnerMover (send gOwner:mover)
                    (if (gOwnerMover)
                        (if (== OnControl(4 (send ((= gOwnerMover (send gOwner:mover))):x) (send gOwnerMover:y)) 2)
                            (send global2:setScript(sTo270))
                        )
                    )
                )(else
                    (if (== temp0 4)
                        = gOwnerMover (send gOwner:mover)
                        (if (gOwnerMover)
                            (if (== OnControl(4 (send ((= gOwnerMover (send gOwner:mover))):x) (send gOwnerMover:y)) 4)
                                proc0_2()
                                (send global2:setScript(noEnterKings))
                            )
                        )
                    )(else
                        (if (== temp0 8)
                            = gOwnerMover (send gOwner:mover)
                            (if (gOwnerMover)
                                (if (== OnControl(4 (send ((= gOwnerMover (send gOwner:mover))):x) (send gOwnerMover:y)) 8)
                                    proc0_2()
                                    (send global2:setScript(noEnterJudgement))
                                )
                            )
                        )(else
                            (if (== temp0 16)
                                = gOwnerMover (send gOwner:mover)
                                (if (gOwnerMover)
                                    (if (== OnControl(4 (send ((= gOwnerMover (send gOwner:mover))):x) (send gOwnerMover:y)) 16)
                                        (send global2:setScript(sTo350))
                                    )
                                )
                            )(else
                                (if (== temp0 32)
                                    = gOwnerMover (send gOwner:mover)
                                    (if (gOwnerMover)
                                        (if (== OnControl(4 (send ((= gOwnerMover (send gOwner:mover))):x) (send gOwnerMover:y)) 32)
                                            (send global2:setScript(sTo210))
                                        )
                                    )
                                )(else
                                    (if (not < (send gOwner:x) 315)
                                        (send global2:setScript(sTo210))
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )


    (method (dispose)
        UnLoad(128 196)
        UnLoad(128 191)
        (super:dispose())
    )

)
(instance sTo270 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath 0 155 self))
            )
            (case 1
                (send gLongSong:fade(0 5 10 1))
                (send global2:newRoom(270))
            )
        )
    )

)
(instance sFrom210 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath 280 141 self))
            )
            (case 1
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance noEnterKings of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setMotion(0))
                (leftGuard:setCycle(End self))
            )
            (case 1
                (if (global121)
                    (send gQg3Messager:say(5 6 1 0 self))
                )(else
                    (send gQg3Messager:say(1 6 1 0 self))
                )
            )
            (case 2
                (leftGuard:setCycle(Beg self))
            )
            (case 3
                (leftGuard:stopUpd())
                (send gOwner:
                    setCycle(Rev)
                    setLoop(6)
                    setMotion(PolyPath - (send gOwner:x) 4 + (send gOwner:y) 4 self)
                )
            )
            (case 4
                (send gOwner:normalize())
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance noEnterJudgement of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setMotion(0))
                (rightGuard:setCycle(End self))
            )
            (case 1
                (if (global121)
                    (send gQg3Messager:say(5 6 1 0 self))
                )(else
                    (send gQg3Messager:say(1 6 1 0 self))
                )
            )
            (case 2
                (rightGuard:setCycle(Beg self))
            )
            (case 3
                (rightGuard:stopUpd())
                (send gOwner:
                    setCycle(Rev)
                    setLoop(6)
                    setMotion(MoveTo - (send gOwner:x) 5 + (send gOwner:y) 3 self)
                )
            )
            (case 4
                (send gOwner:normalize())
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance sTo350 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gLongSong:fade(0 5 10 1))
                (send gOwner:setMotion(PolyPath 273 98 self))
            )
            (case 1
                (send global2:newRoom(350))
            )
        )
    )

)
(instance sTo210 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(MoveTo (+ (send gOwner:x) 4) (+ (send gOwner:y) 11) self))
            )
            (case 1
                (send gLongSong:fade(0 5 10 1))
                (send global2:newRoom(210))
            )
        )
    )

)
(instance sFrom270 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setMotion(MoveTo 29 128 self))
            )
            (case 1
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance sFrom330 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setMotion(PolyPath 27 122 self))
            )
            (case 1
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance sFrom340 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:
                    view(1)
                    setLoop(5)
                    setCycle(Walk)
                    setMotion(PolyPath 75 124 self)
                )
            )
            (case 1
                (send gOwner:
                    view(0)
                    normalize()
                )
                = cycles 1
            )
            (case 2
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance sFrom350 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setMotion(MoveTo 282 138 self))
            )
            (case 1
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance sExit of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (<= (send gOwner:x) 5)
                    = register 270
                    (send gOwner:setMotion(MoveTo (- (send gOwner:x) 20) (+ (send gOwner:y) 30) self))
                )(else
                    = register 210
                    (send gOwner:setMotion(MoveTo (+ (send gOwner:x) 20) (+ (send gOwner:y) 30) self))
                )
            )
            (case 1
                (send global2:newRoom(register))
            )
        )
    )

)
(instance rightGuard of Actor
    (properties
        x 105
        y 128
        approachX 98
        approachY 134
        view 197
        signal $4000
    )
)
(instance leftGuard of Actor
    (properties
        x 30
        y 116
        approachX 28
        approachY 122
        view 192
        signal $4000
    )
)
(instance magicshop of Feature
    (properties
        x 28
        y 171
        noun 14
        nsTop 154
        nsLeft 4
        nsBottom 189
        nsRight 53
    )
)
(instance dome of Feature
    (properties
        x 209
        y 164
        noun 9
        nsTop 153
        nsLeft 174
        nsBottom 176
        nsRight 245
    )
)
(instance spire of Feature
    (properties
        x 211
        y 129
        noun 15
        nsTop 106
        nsLeft 202
        nsBottom 152
        nsRight 220
    )
)
(instance tallGay1 of Feature
    (properties
        x 140
        y 75
        noun 6
        nsTop 7
        nsLeft 123
        nsBottom 144
        nsRight 157
    )
)
(instance tallGay2 of Feature
    (properties
        x 11
        y 58
        noun 7
        nsTop 2
        nsLeft 1
        nsBottom 115
        nsRight 21
    )
)
(instance temple of Feature
    (properties
        x 260
        y 39
        noun 8
        nsTop 28
        nsLeft 244
        nsBottom 51
        nsRight 277
    )
)
(instance toKing of Feature
    (properties
        x 48
        y 103
        noun 12
        nsTop 94
        nsLeft 43
        nsBottom 112
        nsRight 54
    )
)
(instance toJudge of Feature
    (properties
        x 94
        y 112
        noun 13
        nsTop 104
        nsLeft 90
        nsBottom 120
        nsRight 98
    )
)
(instance tell of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(18 not global121 20 global121 17 not global121 19 global121))
    )

)
(instance leftGuardTell of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(-2 -3 -4 -13))
    )


    (method (doChild)
        (if (global121)
            (send gQg3Messager:say(4 5 14))
        )(else
            (send gQg3Messager:say(2 5 14))
        )
        return 0
    )

)
(instance rightGuardTell of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(-2 -3 -4 -13))
    )

)
(instance public leftGuardTalker of GloryTalker
    (properties
        x 5
        y 2
        view 194
        loop 1
        talkWidth 260
        back 57
        textX 20
        textY 150
        backColor 11
    )

    (method (init param1)
        (super:init(leftGuardBust leftGuardEyes leftGuardMouth rest param1))
    )

)
(instance leftGuardMouth of Prop
    (properties
        nsTop 47
        nsLeft 49
        view 194
    )
)
(instance leftGuardEyes of Prop
    (properties
        nsTop 33
        nsLeft 42
        view 194
        loop 2
    )
)
(instance leftGuardBust of View
    (properties
        nsTop 24
        nsLeft 30
        view 193
        loop 3
    )
)
(instance public rightGuardTalker of GloryTalker
    (properties
        x 200
        y 2
        view 193
        loop 1
        talkWidth 260
        back 57
        textX -175
        textY 150
        backColor 11
    )

    (method (init param1)
        (super:init(rightGuardBust rightGuardEyes rightGuardMouth rest param1))
    )

)
(instance rightGuardMouth of Prop
    (properties
        nsTop 47
        nsLeft 23
        view 193
    )
)
(instance rightGuardEyes of Prop
    (properties
        nsTop 33
        nsLeft 29
        view 193
        loop 2
    )
)
(instance rightGuardBust of View
    (properties
        nsTop 24
        nsLeft 40
        view 193
        loop 3
    )
)
