(script 0)


(local
    var gEgo
    var gGame
    var global2
    var global3
    var global4
    var global5
    var global6[3]
    var global9
    var global10
    var global11
    var global12[3]
    var global15
    var global16
    var global17[2]
    var global19
    var global20 = 999
    var global21 = 997
    var gFont
    var global23[2] = (4 )
    var global25
    var global26 = 1
    var global27
    var global28
    var global29
    var global30[4]
    var global34
    var global35[3] = (0 65535 )
    var gSq5Win
    var global39[24]
    var global63
    var gLb2FtrInit
    var gLb2DoVerbCode
    var gLb2ApproachCode
    var global67[2] = (1 )
    var gSq5IconBar
    var global70[7]
    var gPseudoMouse
    var global78
    var global79 = 60
    var global80
    var global81[3]
    var global84
    var global85[4]
    var gSQ5Narrator
    var global90 = 1
    var gTestMessager
    var global92[2]
    var global94
    var global95[7] = (0 0 0 0 0 0 1234 )
    var global102
    var global103
    var global104 = 100
    var global105
    var gStopGroop
    var global107
    var gGSq5IconBarCurIcon
    var global109
    var global110
    var global111
    var global112[4]
    var gNewSpeakWindow
    var gSq5Win_2
    var global118
    var global119
    var gSq5Music1
    var gSq5Music2
    var global122
    var gGEgoMoveSpeed
    var global124[35]
    var global159
    var gLowlightColor
    var global161
    var global162[8]
    var global170
    var global171[12]
    var global183[18]

)
(procedure public (proc0_1 param1)
    return & global183[(/ param1 16)] (>> $8000 (% param1 16))
)


(procedure public (proc0_2 param1)
    (var temp0)
    = temp0 localproc_6317(param1)
    = global183[(/ param1 16)] (| global183[(/ param1 16)] (>> $8000 (% param1 16)))
    return temp0
)


(procedure public (proc0_3 param1)
    (var temp0)
    = temp0 localproc_6317(param1)
    = global183[(/ param1 16)] (& global183[(/ param1 16)] bnot (>> $8000 (% param1 16)))
    return temp0
)


(procedure public (proc0_4)
    (var temp0)
    (send global80:
        canControl(global109)
        canInput(global110)
    )
    = temp0 0
    (while (< temp0 8)
        (if (& global111 (>> $8000 temp0))
            (send gSq5IconBar:disable(temp0))
        )
        ++temp0
    )
)


(procedure public (proc0_5 param1 param2)
    return 
        (if (& (send param1:onControl(1)) param2)
            return 1
        )(else
            0
        )
)


(procedure public (proc0_6 param1 param2)
    (if ((> paramTotal 0) and (<> param1 -1))
        (send gEgo:view(param1))
        (if ((> paramTotal 1) and (<> param2 -1))
            (send gEgo:loop(param2))
        )
    )(else
        (send gEgo:view(global161))
        (if ((> paramTotal 1) and (<> param2 -1))
            (send gEgo:loop(param2))
        )
    )
    (if ((send gEgo:looper))
        (send ((send gEgo:looper)):dispose())
    )
    322
    (send gEgo:
        view(2 15 1 0 302)
        x
        setSpeed(gGEgoMoveSpeed)
        signal(| (send gEgo:signal) $1000)
        heading(
            (switch ((send gEgo:loop))
                (case 0
                    90
                )
                (case 1
                    270
                )
                (case 2
                    180
                )
                (case 3
                    0
                )
                (case 4
                    135
                )
                (case 5
                    225
                )
                (case 6
                    45
                )
                (case 7
                    315
                )
            )
)
    )
    (send gEgo:
        setLoop(-1)
        setLoop(stopGroop)
        setCycle(egoStopWalk -1 2 0)
        setPri(-1)
        setMotion(0)
        state(| (send gEgo:state) $0002)
    )
)


(procedure public (proc0_8 param1 param2 param3 param4)
    (var temp0, var temp1, var temp2, var temp3, var temp4)
    = temp3 0
    = temp4 0
    (if (IsObject(param2))
        = temp1 (send param2:x)
        = temp2 (send param2:y)
        (if (> paramTotal 2)
            (if (IsObject(param3))
                = temp3 param3
            )(else
                = temp4 param3
            )
            (if (== paramTotal 4)
                = temp3 param4
            )
        )
    )(else
        = temp1 param2
        = temp2 param3
        (if (== paramTotal 4)
            = temp3 param4
        )
    )
    (if (temp4)
        localproc_6805(param2 param1)
    )
    = temp0 GetAngle((send param1:x) (send param1:y) temp1 temp2)
    (send param1:setHeading((= temp0 GetAngle((send param1:x) (send param1:y) temp1 temp2)) 
        (if (IsObject(temp3))
            temp3
        )(else
            0
        )
))
)


(procedure public (proc0_9 param1)
    (if (not paramTotal)
        = global119 1
    )(else
        = global119 param1
    )
    (send global2:newRoom(20))
)


(procedure public (proc0_10 param1 param2)
    (if (not localproc_6061(param1))
        = global15 (+ global15 param2)
        (sq5StatusLineCode:doit())
        localproc_6079(param1)
        (rm0Sound:
            priority(15)
            number(1000)
            loop(1)
            flags(1)
            play()
        )
    )
)


(procedure public (proc0_11)
    (var temp0)
    = temp0 GetPort()
    SetPort(-1)
    Graph(11 0 0 10 320 1 0 -1 -1)
    Graph(12 0 0 10 320 1)
    SetPort(temp0)
)


(procedure public (proc0_12 param1 param2 param3 param4 param5)
    (switch ((send gGame:printLang))
        (case 49
            param1
        )
        (case 34
            param2
        )
        (case 33
            param3
        )
        (case 39
            param4
        )
        (default 
            param5
        )
    )
)


(instance rm0Sound of Sound
    (properties
        priority 15
    )
)
(instance sq5Music1 of Sound
    (properties
        flags 1
    )
)
(instance sq5Music2 of Sound
    (properties
        flags 1
    )
)
(instance stopGroop of Grooper
    (properties)
)
(instance egoStopWalk of FiddleStopWalk
    (properties)
)
(instance ego of SQEgo
    (properties)
)
(instance sq5StatusLineCode of Code
    (properties)

    (method (doit)
        (var temp0[50], var temp50[50], var temp100)
        = temp100 GetPort()
        SetPort(-1)
        Graph(11 0 0 10 320 1 5 -1 -1)
        Graph(12 0 0 10 320 1)
        GetMessage(0 0 29 0 0 1 @temp0)
        Format(@temp50 "%s %d" @temp0 global15)
        Display(@temp50 100 4 1 105 gFont 102 6)
        Display(@temp50 100 6 3 105 gFont 102 4)
        Display(@temp50 100 5 2 105 gFont 102 0)
        Graph(4 0 0 0 319 7 -1 -1)
        Graph(4 0 0 9 0 6 -1 -1)
        Graph(4 9 0 9 319 4 -1 -1)
        Graph(4 0 319 9 319 3 -1 -1)
        Graph(12 0 0 10 319 1)
        SetPort(temp100)
    )

)
(instance sq5IconBar of IconBar
    (properties)

    (method (show)
        (if (IsObject(curInvIcon))
            (send curInvIcon:loop(2))
        )
        (super:show())
        (if (IsObject(curInvIcon))
            (send curInvIcon:loop(1))
        )
    )


    (method (hide params)
        (super:hide(rest params))
        (send gGame:setCursor(global19 1))
    )


    (method (noClickHelp)
        (var temp0, var temp1, var temp2, var temp3, var gSq5WinEraseOnly)
        = temp1 (= temp2 0)
        = temp3 GetPort()
        = gSq5WinEraseOnly (send gSq5Win:eraseOnly)
        (send gSq5Win:eraseOnly(1))
        (while (not (send (= temp0 (send ((send global80:curEvent)):new())):type))
            (if (not (self:isMemberOf(IconBar)))
                (send temp0:localize())
            )
            (if (= temp2 (self:firstTrue(226 temp0)))
                (if ((<> (= temp2 (self:firstTrue(226 temp0))) temp1) and (send temp2:helpVerb))
                    = temp1 temp2
                    (if (global25)
                        (send global25:dispose())
                    )
                    (Print:
                        font(gFont)
                        width(250)
                        addText((send temp2:noun) (send temp2:helpVerb) 0 1 0 0 (send temp2:modNum))
                        modeless(1)
                        init()
                    )
                    Animate((send global5:elements) 0)
                    SetPort(temp3)
                )
            )(else
                (if (global25)
                    (send global25:dispose())
                    Animate((send global5:elements) 0)
                )(else
                    = temp1 0
                )
            )
            (send temp0:dispose())
        )
        (send gSq5Win:eraseOnly(gSq5WinEraseOnly))
        (send gGame:setCursor(999 1))
        (if (global25)
            (send global25:dispose())
            Animate((send global5:elements) 0)
        )
        SetPort(temp3)
        (if (not (send helpIconItem:onMe(temp0)))
            (self:dispatchEvent(temp0))
        )
    )

)
(class SQ5 of Game
    (properties
        script 0
        printLang 1
        _detailLevel 3
        panelObj 0
        panelSelector 0
        handsOffCode 0
        handsOnCode 0
    )

    (method (init)
        (var temp0[7], var temp7)
        Print
        DButton
        DColorButton
        Smopper
        SQEgo
        StopWalk
        BorderWindow
        SpeakWindow
        Polygon
        PolyPath
        Timer
        IconBar
        ScrollInsetWindow
        ScrollableInventory
        ScriptID(982)
        RTRandCycle
        Scaler
        Narrator
        (send (ScriptID(15 0)):init())
        (super:init())
        = gEgo ego
        (User:
            alterEgo(= gEgo ego)
            canControl(0)
            canInput(0)
        )
        = global90 1
        = global34 1
        = global103 DoSound(3)
        = global16 5000
        = gFont 1605
        = gGEgoMoveSpeed 6
        = global79 30
        = global94 2
        = global102 Graph(2)
        = gStopGroop stopGroop
        = gPseudoMouse PseudoMouse
        = global105 1
        (send gEgo:setLoop(gStopGroop))
        (if (== global102 256)
            localproc_6079(0)
        )
        TextFonts(1605 999 1005 1007 1008 2106 1307 2306 5220)
        TextColors(0 15 26 31 34 52 63)
        = global27 "x.yyy.zzz"
        = temp7 FileIO(0 "version" 1)
        FileIO(5 global27 11 = temp7 FileIO(0 "version" 1))
        FileIO(1 temp7)
        proc12_0()
        DisposeScript(12)
        = gSQ5Narrator sQ5Narrator
        = gSq5Win sq5Win
        = gSq5Win_2 sq5Win
        = gTestMessager testMessager
        = gNewSpeakWindow (SpeakWindow:new())
        (send gSq5Win:
            color(0)
            back(global159)
        )
        (send gGame:
            setCursor(global19 1 304 172)
            detailLevel(3)
        )
        (send (= gSq5Music1 sq5Music1):
            number(1)
            owner(self)
            flags(1)
            init()
        )
        (send (= gSq5Music2 sq5Music2):
            number(1)
            owner(self)
            flags(1)
            init()
        )
        = gSq5IconBar sq5IconBar
        (send gSq5IconBar:
            add(icon0 icon1 icon2 icon3 icon4 icon6 icon7 icon8 icon9)
            eachElementDo(110)
            eachElementDo(219 0)
            eachElementDo(220 5)
            curIcon(icon0)
            useIconItem(icon6)
            helpIconItem(icon9)
            walkIconItem(icon0)
            disable(5)
            state(3072)
            disable()
        )
        = global20 999
        = global21 996
        = gLb2DoVerbCode lb2DoVerbCode
        = gLb2FtrInit lb2FtrInit
        = gLb2ApproachCode lb2ApproachCode
        (self:newRoom(100))
    )


    (method (doit params)
        (if (GameIsRestarting())
            (if (proc999_5(global11 100 104 110 106 107))
                localproc_6795()
            )(else
                (sq5StatusLineCode:doit())
            )
            (if (== (= global102 Graph(2)) 256)
                localproc_6079(0)
            )
        )
        (super:doit(rest params))
    )


    (method (play)
        = gGame self
        = global29 GetSaveDir()
        (if (not GameIsRestarting())
            GetCWD(global29)
        )
        (self:
            setCursor(global21 1)
            init()
        )
        (self:setCursor(996 1))
        (while (not global4)
            (self:doit())
        )
    )


    (method (startRoom param1)
        (var temp0[4])
        (if (proc999_5(param1 100 104 110 106 107))
            localproc_6795()
        )(else
            (sq5StatusLineCode:doit())
        )
        (if (gPseudoMouse)
            (send gPseudoMouse:stop())
        )
        (send (ScriptID(11)):doit(param1))
        (if (proc999_5(param1 106 107 200 201 202 203 204 205 206 212 213 215 222 225 226 228 230 240 250 280 290 295))
            ScriptID(210)
        )(else
            (if (proc999_5(param1 110 115 117 119 121 122 123 125 127 132 133 135 137 165 166 195))
                ScriptID(109)
            )(else
                (if (proc999_5(param1 300 305 310 315 320 325 330 335))
                    ScriptID(350)
                )(else
                    (if (proc999_5(param1 500 510 520 530))
                        ScriptID(505)
                    )(else
                        (if (proc999_5(param1 730 740 750 760 770 790))
                            ScriptID(31)
                        )
                    )
                )
            )
        )
        (super:startRoom(param1))
    )


    (method (restart params)
        (var temp0, var temp1)
        = temp1 (send ((send gSq5IconBar:curIcon)):cursor)
        (send gGame:setCursor(999))
        (if (= temp0 (Print:
                font(gFont)
                width(75)
                window(gSq5Win)
                mode(1)
                addText(20 1 0 1 0 0 0)
                addColorButton(1 20 1 0 2 0 40 0)
                addColorButton(0 20 1 0 3 0 50 0)
                init()
            )
)
            (super:restart(rest params))
        )(else
            (send gGame:setCursor(temp1))
        )
    )


    (method (restore params)
        (var temp0[2])
        (super:restore(rest params))
        (send gGame:setCursor((send ((send gSq5IconBar:curIcon)):cursor)))
    )


    (method (save params)
        (super:save(rest params))
        (send gGame:setCursor((send ((send gSq5IconBar:curIcon)):cursor)))
    )


    (method (handleEvent pEvent)
        (var temp0)
        (super:handleEvent(pEvent))
        (if ((send pEvent:claimed))
            return 1
        )
        return 
            (switch ((send pEvent:type))
                (case 4
                    (switch ((send pEvent:message))
                        (case 9
                            (if (not & (send ((send gSq5IconBar:at(6))):signal) $0004)
                                (if (global84)
                                    return global84
                                )
                                = temp0 global19
                                (send global9:showSelf(gEgo))
                                (send gGame:setCursor(temp0 1))
                                (send pEvent:claimed(1))
                            )
                        )
                        (case 17
                            (if (not & (send ((send gSq5IconBar:at(7))):signal) $0004)
                                (send gGame:quitGame())
                                (send pEvent:claimed(1))
                            )
                        )
                        (case 3
                            (if (not & (send ((send gSq5IconBar:at(7))):signal) $0004)
                                = temp0 (send ((send gSq5IconBar:curIcon)):cursor)
                                (send (ScriptID(24 0)):doit())
                                (send global63:dispose())
                                (send gGame:setCursor(temp0 1))
                            )
                        )
                        (case 15360
                            (if ((send gGame:masterVolume()))
                                (send gGame:masterVolume(0))
                            )(else
                                (if (> global103 1)
                                    (send gGame:masterVolume(15))
                                )(else
                                    (send gGame:masterVolume(1))
                                )
                            )
                            (send pEvent:claimed(1))
                        )
                        (case 16128
                            (if (not & (send ((send gSq5IconBar:at(7))):signal) $0004)
                                (if (global84)
                                    return global84
                                )
                                = temp0 global19
                                (send gGame:save())
                                (send gGame:setCursor(temp0 1))
                                (send pEvent:claimed(1))
                            )
                        )
                        (case 16640
                            (if (not & (send ((send gSq5IconBar:at(7))):signal) $0004)
                                (if (global84)
                                    return global84
                                )
                                = temp0 global19
                                (send gGame:restore())
                                (send gGame:setCursor(temp0 1))
                                (send pEvent:claimed(1))
                            )
                        )
                        (case 43
                            (if ((send global80:controls))
                                = gGEgoMoveSpeed (send gEgo:moveSpeed)
                                = gGEgoMoveSpeed proc999_3(0 --gGEgoMoveSpeed)
                                (send gEgo:setSpeed((= gGEgoMoveSpeed proc999_3(0 --gGEgoMoveSpeed))))
                            )
                        )
                        (case 45
                            (if ((send global80:controls))
                                = gGEgoMoveSpeed (send gEgo:moveSpeed)
                                ++gGEgoMoveSpeed
                                (send gEgo:setSpeed(++gGEgoMoveSpeed))
                            )
                        )
                        (case 61
                            (if ((send global80:controls))
                                (send gEgo:setSpeed(6))
                            )
                        )
                        (case 12032
                            (Print:
                                addText("Version number:" 0 0)
                                addText(global27 0 14)
                                init()
                            )
                        )
                        (default 
                            (send pEvent:claimed(0))
                        )
                    )
                )
            )
    )


    (method (setCursor param1 param2 param3 param4)
        (var temp0)
        = temp0 global19
        (if (paramTotal)
            (if (IsObject(param1))
                (send (= global19 param1):init())
            )(else
                SetCursor(= global19 param1 0 0)
            )
        )
        (if ((> paramTotal 1) and not param2)
            SetCursor(996 0 0)
        )
        (if (> paramTotal 2)
            SetCursor(param3 param4)
        )
        return temp0
    )


    (method (quitGame params)
        (var temp0, var temp1)
        = temp1 (send ((send gSq5IconBar:curIcon)):cursor)
        (send gGame:setCursor(999))
        (if (= temp0 (Print:
                font(gFont)
                width(75)
                mode(1)
                addText(19 1 0 1 0 0 0)
                addColorButton(1 19 1 0 2 0 25 0)
                addColorButton(0 19 1 0 3 0 35 0)
                init()
            )
)
            (Print:
                addText(19 1 0 4 0 0 0)
                init()
            )
            (super:quitGame(rest params))
        )(else
            (send gGame:setCursor(temp1))
        )
    )


    (method (pragmaFail)
        (if ((User:canControl()))
            (switch ((send ((send global80:curEvent)):message))
                (case 4
                    (send gTestMessager:say(0 4 0 Random(1 2) 0 0))
                )
                (case 2
                    (send gTestMessager:say(0 2 0 Random(1 2) 0 0))
                )
                (case 24
                    (send gTestMessager:say(0 24 0 0 0 0))
                )
                (default 
                    (if (not proc999_5((send ((send global80:curEvent)):message) 24 1))
                        (send gTestMessager:say(0 7 0 Random(2 3) 0 0))
                    )
                )
            )
        )
    )


    (method (handsOff)
        (if (not gGSq5IconBarCurIcon)
            = gGSq5IconBarCurIcon (send gSq5IconBar:curIcon)
        )
        = global109 (send global80:canControl())
        = global110 (send global80:canInput())
        (send global80:
            canControl(0)
            canInput(0)
        )
        (send gEgo:setMotion(0))
        = global111 0
        (send gSq5IconBar:eachElementDo(96 checkIcon))
        (send gSq5IconBar:curIcon((send gSq5IconBar:at(7))))
        (send gSq5IconBar:disable())
        (send gSq5IconBar:disable(0 1 2 3 4 5 6 7))
        (send gGame:setCursor(996))
    )


    (method (handsOn param1)
        (send gSq5IconBar:enable())
        (send global80:
            canControl(1)
            canInput(1)
        )
        (if (localproc_6061(22))
            (send gSq5IconBar:enable(0 1 3 7))
        )(else
            (send gSq5IconBar:enable(0 1 2 3 4 5 6 7))
        )
        (if (paramTotal and param1)
            localproc_6156()
        )
        (if (not (send gSq5IconBar:curInvIcon))
            (send gSq5IconBar:disable(5))
        )
        (if (gGSq5IconBarCurIcon)
            (send gSq5IconBar:curIcon(gGSq5IconBarCurIcon))
            (send gGame:setCursor((send gGSq5IconBarCurIcon:cursor)))
            = gGSq5IconBarCurIcon 0
            (if ((== (send gSq5IconBar:curIcon) (send gSq5IconBar:at(5))) and not (send gSq5IconBar:curInvIcon))
                (send gSq5IconBar:advanceCurIcon())
            )
        )
        (send gGame:setCursor((send ((send gSq5IconBar:curIcon)):cursor) 1))
        = global19 (send ((send gSq5IconBar:curIcon)):cursor)
    )


    (method (showAbout)
        (send (ScriptID(13 0)):doit())
        DisposeScript(13)
    )


    (method (showControls)
        (var temp0)
        = temp0 (send ((send gSq5IconBar:curIcon)):cursor)
        (send (ScriptID(24 0)):doit())
        (send global63:dispose())
        (send gGame:setCursor(temp0 1))
    )

)
(instance walkCursor of Cursor
    (properties
        view 980
    )

    (method (init params)
        (if (localproc_6061(22))
            = loop 1
        )(else
            (if ((== global11 119) and (== (send gEgo:view) 136))
                = loop 3
            )(else
                = loop 0
            )
        )
        (super:init(rest params))
    )

)
(instance icon0 of IconI
    (properties
        view 990
        loop 0
        cel 0
        cursor 980
        type 20480
        message 3
        signal 65
        maskView 990
        maskLoop 13
        noun 28
        helpVerb 5
    )

    (method (init)
        = lowlightColor gLowlightColor
        = cursor walkCursor
        (super:init())
    )


    (method (show params)
        (if (localproc_6061(22))
            = loop 14
        )(else
            (if ((== global11 119) and (== (send gEgo:view) 136))
                = loop 15
            )(else
                = loop 0
            )
        )
        (super:show(rest params))
    )


    (method (select params)
        (var temp0)
        return 
            (if ((super:select(rest params)))
                (send gSq5IconBar:hide())
                return 1
            )(else
                return 0
            )
    )

)
(instance icon1 of IconI
    (properties
        view 990
        loop 1
        cel 0
        cursor 981
        message 1
        signal 65
        maskView 990
        maskLoop 13
        noun 16
        helpVerb 5
    )

    (method (init)
        = lowlightColor gLowlightColor
        (super:init())
    )

)
(instance icon2 of IconI
    (properties
        view 990
        loop 2
        cel 0
        cursor 982
        message 4
        signal 65
        maskView 990
        maskLoop 13
        noun 6
        helpVerb 5
    )

    (method (init)
        = lowlightColor gLowlightColor
        (super:init())
    )

)
(instance icon3 of IconI
    (properties
        view 990
        loop 3
        cel 0
        cursor 983
        message 2
        signal 65
        maskView 990
        maskLoop 13
        maskCel 4
        noun 26
        helpVerb 5
    )

    (method (init)
        = lowlightColor gLowlightColor
        (super:init())
    )

)
(instance icon4 of IconI
    (properties
        view 990
        loop 10
        cel 1
        cursor 984
        message 24
        signal 65
        maskView 990
        maskLoop 13
        maskCel 4
        noun 2
        helpVerb 5
    )

    (method (init)
        = lowlightColor gLowlightColor
        (super:init())
    )

)
(instance icon6 of IconI
    (properties
        view 990
        loop 4
        cel 0
        cursor 999
        message 0
        signal 65
        maskView 990
        maskLoop 13
        maskCel 4
        noun 4
        helpVerb 5
    )

    (method (init)
        = lowlightColor gLowlightColor
        (super:init())
    )


    (method (select param1)
        (var newEvent, var temp1, var gSq5IconBarCurInvIcon, var temp3, var temp4)
        return 
            (if (& signal $0004)
                0
            )(else
                (if ((paramTotal and param1) and (& signal $0001))
                    (if (= gSq5IconBarCurInvIcon (send gSq5IconBar:curInvIcon))
                        = temp3 (+ (/ (- (- nsRight nsLeft) CelWide((send gSq5IconBarCurInvIcon:view) 2 (send gSq5IconBarCurInvIcon:cel))) 2) nsLeft)
                        = temp4 (+ (+ (send gSq5IconBar:y) (/ (- (- nsBottom nsTop) CelHigh((send gSq5IconBarCurInvIcon:view) 2 (send gSq5IconBarCurInvIcon:cel))) 2)) nsTop)
                    )
                    DrawCel(view loop = temp1 1 nsLeft nsTop -1)
                    (if (= gSq5IconBarCurInvIcon (send gSq5IconBar:curInvIcon))
                        DrawCel((send (= gSq5IconBarCurInvIcon (send gSq5IconBar:curInvIcon)):view) 2 (send gSq5IconBarCurInvIcon:cel) temp3 temp4 -1)
                    )
                    Graph(12 nsTop nsLeft nsBottom nsRight 1)
                    (while (<> (send ((= newEvent (Event:new()))):type) 2)
                        (send newEvent:localize())
                        (if ((self:onMe(newEvent)))
                            (if (not temp1)
                                DrawCel(view loop = temp1 1 nsLeft nsTop -1)
                                (if (= gSq5IconBarCurInvIcon (send gSq5IconBar:curInvIcon))
                                    DrawCel((send (= gSq5IconBarCurInvIcon (send gSq5IconBar:curInvIcon)):view) 2 (send gSq5IconBarCurInvIcon:cel) temp3 temp4 -1)
                                )
                                Graph(12 nsTop nsLeft nsBottom nsRight 1)
                            )
                        )(else
                            (if (temp1)
                                DrawCel(view loop = temp1 0 nsLeft nsTop -1)
                                (if (= gSq5IconBarCurInvIcon (send gSq5IconBar:curInvIcon))
                                    DrawCel((send (= gSq5IconBarCurInvIcon (send gSq5IconBar:curInvIcon)):view) 2 (send gSq5IconBarCurInvIcon:cel) temp3 temp4 -1)
                                )
                                Graph(12 nsTop nsLeft nsBottom nsRight 1)
                            )
                        )
                        (send newEvent:dispose())
                    )
                    (send newEvent:dispose())
                    (if (== temp1 1)
                        DrawCel(view loop 0 nsLeft nsTop -1)
                        (if (= gSq5IconBarCurInvIcon (send gSq5IconBar:curInvIcon))
                            DrawCel((send (= gSq5IconBarCurInvIcon (send gSq5IconBar:curInvIcon)):view) 2 (send gSq5IconBarCurInvIcon:cel) temp3 temp4 -1)
                        )
                        Graph(12 nsTop nsLeft nsBottom nsRight 1)
                    )
                    temp1
                )(else
                    1
                )
            )
    )

)
(instance icon7 of IconI
    (properties
        view 990
        loop 5
        cel 0
        cursor 999
        type 0
        message 0
        signal 67
        maskView 990
        maskLoop 13
        noun 15
        helpVerb 5
    )

    (method (init)
        = lowlightColor gLowlightColor
        (super:init())
    )


    (method (select params)
        (var temp0)
        return 
            (if ((super:select(rest params)))
                (send gSq5IconBar:hide())
                = temp0 global19
                (send global9:showSelf(gEgo))
                (send gGame:setCursor(temp0 1))
                return 1
            )(else
                return 0
            )
    )

)
(instance icon8 of IconI
    (properties
        view 990
        loop 7
        cel 0
        cursor 999
        message 7
        signal 67
        maskView 990
        maskLoop 13
        noun 3
        helpVerb 5
    )

    (method (init)
        = lowlightColor gLowlightColor
        (super:init())
    )


    (method (select params)
        return 
            (if ((super:select(rest params)))
                (send gSq5IconBar:hide())
                (send gGame:showControls())
                return 1
            )(else
                return 0
            )
    )

)
(instance icon9 of IconI
    (properties
        view 990
        loop 9
        cel 0
        cursor 989
        type 8192
        message 5
        signal 3
        maskView 990
        maskLoop 13
        noun 7
        helpVerb 5
    )

    (method (init)
        = lowlightColor gLowlightColor
        (if (global25)
            (send global25:dispose())
        )
        (super:init())
    )

)
(instance checkIcon of Code
    (properties)

    (method (doit param1)
        (if ((send param1:isKindOf(IconI)) and (& (send param1:signal) $0004))
            = global111 (| global111 (>> $8000 (send gSq5IconBar:indexOf(param1))))
        )
    )

)
(instance lb2DoVerbCode of Code
    (properties)

    (method (doit param1 param2)
        (if ((User:canControl()))
            (if (== param2 gEgo)
                (if (GetMessage(2 0 22 param1 0 1))
                    (send gTestMessager:say(22 param1 0 0 0 0))
                )(else
                    (send gTestMessager:say(22 0 0 Random(1 2) 0 0))
                )
            )(else
                (switch (param1)
                    (case 4
                        (send gTestMessager:say(0 4 0 Random(1 2) 0 0))
                    )
                    (case 2
                        (send gTestMessager:say(0 2 0 Random(1 2) 0 0))
                    )
                    (case 24
                        (send gTestMessager:say(0 24 0 1 0 0))
                    )
                    (default 
                        (if (not proc999_5(param1 24 1))
                            (send gTestMessager:say(0 7 0 Random(2 3) 0 0))
                        )
                    )
                )
            )
        )
    )

)
(instance lb2FtrInit of Code
    (properties)

    (method (doit param1)
        (if (== (send param1:sightAngle) 26505)
            (send param1:sightAngle(90))
        )
        (if (== (send param1:actions) 26505)
            (send param1:actions(0))
        )
        (if (not (send param1:approachX) and not (send param1:approachY))
            (send param1:
                approachX((send param1:x))
                approachY((send param1:y))
            )
        )
    )

)
(instance lb2ApproachCode of Code
    (properties)

    (method (doit param1)
        (switch (param1)
            (case 1
                1
            )
            (case 2
                2
            )
            (case 3
                4
            )
            (case 4
                8
            )
            (case 31
                16
            )
            (case 24
                32
            )
            (case 29
                64
            )
            (case 25
                128
            )
            (default 
                32768
            )
        )
    )

)
(instance sq5Win of BorderWindow
    (properties)
)
(instance sQ5Narrator of Narrator
    (properties)

    (method (init params)
        = font gFont
        (self:back(global159))
        (super:init(rest params))
    )

)
(instance testMessager of Messager
    (properties)

    (method (findTalker param1)
        (var temp0)
        = global122 param1
        (switch (param1)
            (case 99
                (if (== global11 666)
                    ScriptID(666 1)
                )(else
                    gSQ5Narrator
                )
            )
            (case 47
                (if (proc999_5(global11 201 206))
                    (if (== global11 201)
                        ScriptID(209 18)
                    )(else
                        ScriptID(global11 18)
                    )
                )(else
                    ScriptID(1882 26)
                )
            )
            (case 26
                (if (proc999_5(global11 119 127 240 1041 660))
                    ScriptID(global11 10)
                )(else
                    ScriptID(1882 26)
                )
            )
            (case 8
                ScriptID(109 7)
            )
            (case 29
                ScriptID(125 1)
            )
            (case 23
                (if (proc999_5(global11 530 730 666 240))
                    ScriptID(global11 11)
                )(else
                    ScriptID(1884 23)
                )
            )
            (case 18
                ScriptID(127 3)
            )
            (case 4
                ScriptID(850 1)
            )
            (case 21
                (if (proc999_5(global11 201 520 1041))
                    ScriptID(global11 12)
                )(else
                    ScriptID(1885 21)
                )
            )
            (case 27
                ScriptID(135 2)
            )
            (case 36
                (if (== global11 801)
                    ScriptID(801 1)
                )(else
                    ScriptID(109 7)
                )
            )
            (case 37
                (if (== global11 801)
                    ScriptID(801 2)
                )(else
                    ScriptID(109 7)
                )
            )
            (case 22
                (if (proc999_5(global11 201 760 520 620 640 660 1040 1041))
                    (if (<> (send global2:curPic) 110)
                        ScriptID(global11 13)
                    )(else
                        ScriptID(1886 22)
                    )
                )(else
                    ScriptID(1886 22)
                )
            )
            (case 25
                (if (proc999_5(global11 104 119 127 201 206 520 850))
                    (if (== global11 201)
                        ScriptID(209 14)
                    )(else
                        ScriptID(global11 14)
                    )
                )(else
                    ScriptID(1883 25)
                )
            )
            (case 3
                ScriptID(global11 14)
            )
            (case 1
                (if (== global11 119)
                    ScriptID(119 2)
                )(else
                    ScriptID(global11 14)
                )
            )
            (case 7
                ScriptID(1040 5)
            )
            (case 19
                (if (proc999_5(global11 104 119 125 135 165 201 228 230 240 520 530 730 750 760 1041 666 850 660 440 450 620 640))
                    (if (proc999_5(global11 730 740 760 790) and not localproc_6061(22))
                        ScriptID(1880 19)
                    )(else
                        ScriptID(global11 15)
                    )
                )(else
                    (switch (global11)
                        (case 510
                            ScriptID(510 1)
                        )
                        (default 
                            ScriptID(1880 19)
                        )
                    )
                )
            )
            (case 17
                ScriptID(119 1)
            )
            (case 28
                ScriptID(135 1)
            )
            (case 24
                (if (proc999_5(global11 201 999))
                    (if (== global11 201)
                        (if (== global170 2)
                            ScriptID(1887 24)
                        )(else
                            ScriptID(209 16)
                        )
                    )(else
                        ScriptID(global11 16)
                    )
                )(else
                    ScriptID(1887 24)
                )
            )
            (case 38
                (if (proc999_5(global11 520))
                    ScriptID(global11 17)
                )(else
                    ScriptID(1891 38)
                )
            )
            (case 46
                (if (proc999_5(global11 450 440))
                    ScriptID(global11 19)
                )(else
                    ScriptID(1895 46)
                )
            )
            (case 5
                ScriptID(115 2)
            )
            (case 6
                ScriptID(117 2)
            )
            (case 42
                ScriptID(510 1)
            )
            (case 43
                ScriptID(510 1)
            )
            (case 45
                ScriptID(520 1)
            )
            (case 49
                ScriptID(500 10)
            )
            (case 9
                ScriptID(500 10)
            )
        )
        (if (= temp0 ScriptID(500 10))
            return 
        )(else
            (super:findTalker(param1))
        )
    )

)
