(include "sci.sh")
(use "Main")
(use "n012")
(use "Smopper")
(use "SQEgo")
(use "ScrollableInventory")
(use "ScrollInsetWindow")
(use "DColorButton")
(use "SpeakWindow")
(use "Print")
(use "DIcon")
(use "Messager")
(use "Blink")
(use "PseudoMouse")
(use "Scaler")
(use "BorderWindow")
(use "IconI")
(use "RandCycle")
(use "PolyPath")
(use "Polygon")
(use "StopWalk")
(use "Timer")
(use "Grooper")
(use "Sound")
(use "Sounds")
(use "User")
(use "Obj")
(script 0)


(local
    gEgo
    gSQ5
    gRoom
    global3
    global4
    gCast
    gRegions
    gTimers
    gSounds
    gSq5Inv
    gAddToPics
    gModNum
    gGModNum
    gTheGModNum
    global14
    global15
    global16
    global17
    gNewSet
    gSaveCursor
    global20 = 999
    global21 = 997
    gFont = 1
    global23 = 4
    gPEvent
    gDialog
    global26 = 1
    global27
    global28
    global29
    global30
    gPicAngle
    gFeatures
    global33
    global34
    global35
    global36 = 65535
    global37
    gSq5Win
    global39
    global40
    global41
    global42
    global43
    global44
    global45
    global46
    global47
    global48
    global49
    global50
    global51
    global52
    global53
    global54
    global55
    global56
    global57
    global58
    global59
    global60
    global61
    global62
    gGameControls
    gLb2FtrInit
    gLb2DoVerbCode
    gLb2ApproachCode
    global67 = 1
    global68
    gSq5IconBar
    gPEventX
    gPEventY
    gKeyDownHandler
    gMouseDownHandler
    gDirectionHandler
    global75
    global76
    gPseudoMouse
    gTheDoits
    gEatTheMice = 60
    gUser
    global81
    gNewSync
    global83
    gNewEventHandler
    gFont_2
    global86
    global87
    gCycleCnt
    gSQ5Narrator
    global90 = 1
    gTestMessager
    global92
    gWalkHandler
    global94 = 2
    global95
    global96
    global97
    global98
    global99
    global100
    global101 = 1234
    global102
    global103
    global104 = 100
    global105
    gStopGroop
    global107
    gGSq5IconBarCurIcon
    gGUserCanControl
    gGUserCanInput
    global111
    global112
    gEurekaCurLocation
    gState
    global115
    gNewSpeakWindow
    gSq5Win_2
    global118
    global119
    gSq5Music1
    gSq5Music2
    global122
    gGEgoMoveSpeed
    global124
    global125
    global126
    global127
    global128
    global129
    global130
    global131
    global132
    global133
    global134
    global135
    global136
    global137
    global138
    global139
    global140
    global141
    global142
    global143
    global144
    global145
    global146
    global147
    global148
    global149
    global150
    global151
    global152
    global153
    global154
    global155
    global156
    global157
    global158
    global159
    gLowlightColor
    global161 = 1
    gRegister
    global163
    global164
    global165
    global166
    global167
    global168
    global169
    global170
    global171
    global172
    global173
    global174
    global175
    global176
    global177
    global178
    global179
    global180
    global181
    global182
    global183
    global184
    global185
    global186
    global187
    global188
    global189
    global190
    global191
    global192
    global193
    global194
    global195
    global196
    global197
    global198
    global199
    global200

)
(procedure public (proc0_1 param1)
    return & global183[(/ param1 16)] (>> $8000 (% param1 16))
)


(procedure public (proc0_2 param1)
    (var temp0)
    = temp0 localproc_18ad(param1)
    = global183[(/ param1 16)] (| global183[(/ param1 16)] (>> $8000 (% param1 16)))
    return temp0
)


(procedure public (proc0_3 param1)
    (var temp0)
    = temp0 localproc_18ad(param1)
    = global183[(/ param1 16)] (& global183[(/ param1 16)] bnot (>> $8000 (% param1 16)))
    return temp0
)


(procedure public (proc0_4)
    (var temp0)
    (send gUser:
        canControl(gGUserCanControl)
        canInput(gGUserCanInput)
    )
    = 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, temp1, temp2, temp3, 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_1a95(param2 param1)
    )
    (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 gRoom:newRoom(20))
)


(procedure public (proc0_10 param1 param2)
    (if (not proc0_1(param1))
        = global15 (+ global15 param2)
        (sq5StatusLineCode:doit())
        proc0_2(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 gSQ5: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], temp50[50], 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 param1)
        (super:hide(rest param1))
        (send gSQ5:setCursor(gSaveCursor 1))
    )


    (method (noClickHelp)
        (var temp0, temp1, temp2, temp3, gSq5WinEraseOnly)
        = temp1 (= temp2 0)
        = temp3 GetPort()
        = gSq5WinEraseOnly (send gSq5Win:eraseOnly)
        (send gSq5Win:eraseOnly(1))
        (while (not (send (= temp0 (send ((send gUser: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 (gDialog)
                        (send gDialog: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 gCast:elements) 0)
                    SetPort(temp3)
                )
            )(else
                (if (gDialog)
                    (send gDialog:dispose())
                    Animate((send gCast:elements) 0)
                )(else
                    = temp1 0
                )
            )
            (send temp0:dispose())
        )
        (send gSq5Win:eraseOnly(gSq5WinEraseOnly))
        (send gSQ5:setCursor(999 1))
        (if (gDialog)
            (send gDialog:dispose())
            Animate((send gCast: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], 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())
        (User:
            alterEgo(= gEgo ego)
            canControl(0)
            canInput(0)
        )
        = global90 1
        = global34 1
        = global103 DoSound(3)
        = global16 5000
        = gFont 1605
        = gGEgoMoveSpeed 6
        = gEatTheMice 30
        = global94 2
        = global102 Graph(2)
        = gStopGroop stopGroop
        = gPseudoMouse PseudoMouse
        = global105 1
        (send gEgo:setLoop(gStopGroop))
        (if (== global102 256)
            proc0_2(0)
        )
        TextFonts(1605 999 1005 1007 1008 2106 1307 2306 5220)
        TextColors(0 15 26 31 34 52 63)
        = global27 "x.yyy.zzz"
        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 gSQ5:
            setCursor(gSaveCursor 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 param1)
        (if (GameIsRestarting())
            (if (proc999_5(gModNum 100 104 110 106 107))
                proc0_11()
            )(else
                (sq5StatusLineCode:doit())
            )
            (if (== (= global102 Graph(2)) 256)
                proc0_2(0)
            )
        )
        (super:doit(rest param1))
    )


    (method (play)
        = gSQ5 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))
            proc0_11()
        )(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 param1)
        (var temp0, temp1)
        = temp1 (send ((send gSq5IconBar:curIcon)):cursor)
        (send gSQ5: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 param1))
        )(else
            (send gSQ5:setCursor(temp1))
        )
    )


    (method (restore param1)
        (var temp0[2])
        (super:restore(rest param1))
        (send gSQ5:setCursor((send ((send gSq5IconBar:curIcon)):cursor)))
    )


    (method (save param1)
        (super:save(rest param1))
        (send gSQ5:setCursor((send ((send gSq5IconBar:curIcon)):cursor)))
    )


    (method (handleEvent pEvent)
        (var theGSaveCursor)
        (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 (gNewEventHandler)
                                    return gNewEventHandler
                                )
                                = theGSaveCursor gSaveCursor
                                (send gSq5Inv:showSelf(gEgo))
                                (send gSQ5:setCursor(theGSaveCursor 1))
                                (send pEvent:claimed(1))
                            )
 )
                        )
                        (case 17
                            (
                            (if (not & (send ((send gSq5IconBar:at(7))):signal) $0004)
                                (send gSQ5:quitGame())
                                (send pEvent:claimed(1))
                            )
 )
                        )
                        (case 3
                            (
                            (if (not & (send ((send gSq5IconBar:at(7))):signal) $0004)
                                = theGSaveCursor (send ((send gSq5IconBar:curIcon)):cursor)
                                (send (ScriptID(24 0)):doit())
                                (send gGameControls:dispose())
                                (send gSQ5:setCursor(theGSaveCursor 1))
                            )
 )
                        )
                        (case 15360
                            (
                            (if ((send gSQ5:masterVolume()))
                                (send gSQ5:masterVolume(0))
                            )(else
                                (if (> global103 1)
                                    (send gSQ5:masterVolume(15))
                                )(else
                                    (send gSQ5:masterVolume(1))
                                )
                            )
 (send pEvent:claimed(1))  )
                        )
                        (case 16128
                            (
                            (if (not & (send ((send gSq5IconBar:at(7))):signal) $0004)
                                (if (gNewEventHandler)
                                    return gNewEventHandler
                                )
                                = theGSaveCursor gSaveCursor
                                (send gSQ5:save())
                                (send gSQ5:setCursor(theGSaveCursor 1))
                                (send pEvent:claimed(1))
                            )
 )
                        )
                        (case 16640
                            (
                            (if (not & (send ((send gSq5IconBar:at(7))):signal) $0004)
                                (if (gNewEventHandler)
                                    return gNewEventHandler
                                )
                                = theGSaveCursor gSaveCursor
                                (send gSQ5:restore())
                                (send gSQ5:setCursor(theGSaveCursor 1))
                                (send pEvent:claimed(1))
                            )
 )
                        )
                        (case 43
                            (
                            (if ((send gUser:controls))
                                = gGEgoMoveSpeed (send gEgo:moveSpeed)
                                (send gEgo:setSpeed((= gGEgoMoveSpeed proc999_3(0 --gGEgoMoveSpeed))))
                            )
 )
                        )
                        (case 45
                            (
                            (if ((send gUser:controls))
                                = gGEgoMoveSpeed (send gEgo:moveSpeed)
                                (send gEgo:setSpeed(++gGEgoMoveSpeed))
                            )
 )
                        )
                        (case 61
                            (
                            (if ((send gUser: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 theGSaveCursor_2 param2 param3 param4)
        (var theGSaveCursor)
        = theGSaveCursor gSaveCursor
        (if (paramTotal)
            (if (IsObject(theGSaveCursor_2))
                (send (= gSaveCursor theGSaveCursor_2):init())
            )(else
                SetCursor(= gSaveCursor theGSaveCursor_2 0 0)
            )
        )
        (if ((> paramTotal 1) and not param2)
            SetCursor(996 0 0)
        )
        (if (> paramTotal 2)
            SetCursor(param3 param4)
        )
        return theGSaveCursor
    )


    (method (quitGame param1)
        (var temp0, temp1)
        = temp1 (send ((send gSq5IconBar:curIcon)):cursor)
        (send gSQ5: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 param1))
        )(else
            (send gSQ5:setCursor(temp1))
        )
    )


    (method (pragmaFail)
        (if ((User:canControl()))
            (switch ((send ((send gUser: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 gUser:curEvent)):message) 24 1))
                        (send gTestMessager:say(0 7 0 Random(2 3) 0 0))
                    )
                )
            )
        )
    )


    (method (handsOff)
        (if (not gGSq5IconBarCurIcon)
            = gGSq5IconBarCurIcon (send gSq5IconBar:curIcon)
        )
        = gGUserCanControl (send gUser:canControl())
        = gGUserCanInput (send gUser:canInput())
        (send gUser:
            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 gSQ5:setCursor(996))
    )


    (method (handsOn param1)
        (send gSq5IconBar:enable())
        (send gUser:
            canControl(1)
            canInput(1)
        )
        (if (proc0_1(22))
            (send gSq5IconBar:enable(0 1 3 7))
        )(else
            (send gSq5IconBar:enable(0 1 2 3 4 5 6 7))
        )
        (if (paramTotal and param1)
            proc0_4()
        )
        (if (not (send gSq5IconBar:curInvIcon))
            (send gSq5IconBar:disable(5))
        )
        (if (gGSq5IconBarCurIcon)
            (send gSq5IconBar:curIcon(gGSq5IconBarCurIcon))
            (send gSQ5:setCursor((send gGSq5IconBarCurIcon:cursor)))
            = gGSq5IconBarCurIcon 0
            (if ((== (send gSq5IconBar:curIcon) (send gSq5IconBar:at(5))) and not (send gSq5IconBar:curInvIcon))
                (send gSq5IconBar:advanceCurIcon())
            )
        )
        (send gSQ5:setCursor((send ((send gSq5IconBar:curIcon)):cursor) 1))
        = gSaveCursor (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 gGameControls:dispose())
        (send gSQ5:setCursor(temp0 1))
    )

)
(instance walkCursor of Cursor
    (properties
        view 980
    )

    (method (init param1)
        (if (proc0_1(22))
            = loop 1
        )(else
            (if ((== gModNum 119) and (== (send gEgo:view) 136))
                = loop 3
            )(else
                = loop 0
            )
        )
        (super:init(rest param1))
    )

)
(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 param1)
        (if (proc0_1(22))
            = loop 14
        )(else
            (if ((== gModNum 119) and (== (send gEgo:view) 136))
                = loop 15
            )(else
                = loop 0
            )
        )
        (super:show(rest param1))
    )


    (method (select param1)
        (var temp0)
        return 
            (if ((super:select(rest param1)))
                (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, temp1, gSq5IconBarCurInvIcon, temp3, 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 param1)
        (var theGSaveCursor)
        return 
            (if ((super:select(rest param1)))
                (send gSq5IconBar:hide())
                = theGSaveCursor gSaveCursor
                (send gSq5Inv:showSelf(gEgo))
                (send gSQ5:setCursor(theGSaveCursor 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 param1)
        return 
            (if ((super:select(rest param1)))
                (send gSq5IconBar:hide())
                (send gSQ5: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 (gDialog)
            (send gDialog: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 param1)
        = font gFont
        (self:back(global159))
        (super:init(rest param1))
    )

)
(instance testMessager of Messager
    (properties)

    (method (findTalker param1)
        (var temp0)
        = global122 param1
        (if (= temp0 
            (switch (param1)
                (case 99
                    (
                    (if (== gModNum 666)
                        ScriptID(666 1)
                    )(else
                        gSQ5Narrator
                    )
 )
                )
                (case 47
                    (
                    (if (proc999_5(gModNum 201 206))
                        (if (== gModNum 201)
                            ScriptID(209 18)
                        )(else
                            ScriptID(gModNum 18)
                        )
                    )(else
                        ScriptID(1882 26)
                    )
 )
                )
                (case 26
                    (
                    (if (proc999_5(gModNum 119 127 240 1041 660))
                        ScriptID(gModNum 10)
                    )(else
                        ScriptID(1882 26)
                    )
 )
                )
                (case 8
                    (ScriptID(109 7)  )
                )
                (case 29
                    (ScriptID(125 1)  )
                )
                (case 23
                    (
                    (if (proc999_5(gModNum 530 730 666 240))
                        ScriptID(gModNum 11)
                    )(else
                        ScriptID(1884 23)
                    )
 )
                )
                (case 18
                    (ScriptID(127 3)  )
                )
                (case 4
                    (ScriptID(850 1)  )
                )
                (case 21
                    (
                    (if (proc999_5(gModNum 201 520 1041))
                        ScriptID(gModNum 12)
                    )(else
                        ScriptID(1885 21)
                    )
 )
                )
                (case 27
                    (ScriptID(135 2)  )
                )
                (case 36
                    (
                    (if (== gModNum 801)
                        ScriptID(801 1)
                    )(else
                        ScriptID(109 7)
                    )
 )
                )
                (case 37
                    (
                    (if (== gModNum 801)
                        ScriptID(801 2)
                    )(else
                        ScriptID(109 7)
                    )
 )
                )
                (case 22
                    (
                    (if (proc999_5(gModNum 201 760 520 620 640 660 1040 1041))
                        (if (<> (send gRoom:curPic) 110)
                            ScriptID(gModNum 13)
                        )(else
                            ScriptID(1886 22)
                        )
                    )(else
                        ScriptID(1886 22)
                    )
 )
                )
                (case 25
                    (
                    (if (proc999_5(gModNum 104 119 127 201 206 520 850))
                        (if (== gModNum 201)
                            ScriptID(209 14)
                        )(else
                            ScriptID(gModNum 14)
                        )
                    )(else
                        ScriptID(1883 25)
                    )
 )
                )
                (case 3
                    (ScriptID(gModNum 14)  )
                )
                (case 1
                    (
                    (if (== gModNum 119)
                        ScriptID(119 2)
                    )(else
                        ScriptID(gModNum 14)
                    )
 )
                )
                (case 7
                    (ScriptID(1040 5)  )
                )
                (case 19
                    (
                    (if (proc999_5(gModNum 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(gModNum 730 740 760 790) and not proc0_1(22))
                            ScriptID(1880 19)
                        )(else
                            ScriptID(gModNum 15)
                        )
                    )(else
                        (switch (gModNum)
                            (case 510
                                ScriptID(510 1)
                            )
                            (default 
                                ScriptID(1880 19)
                            )
                        )
                    )
 )
                )
                (case 17
                    (ScriptID(119 1)  )
                )
                (case 28
                    (ScriptID(135 1)  )
                )
                (case 24
                    (
                    (if (proc999_5(gModNum 201 999))
                        (if (== gModNum 201)
                            (if (== global170 2)
                                ScriptID(1887 24)
                            )(else
                                ScriptID(209 16)
                            )
                        )(else
                            ScriptID(gModNum 16)
                        )
                    )(else
                        ScriptID(1887 24)
                    )
 )
                )
                (case 38
                    (
                    (if (proc999_5(gModNum 520))
                        ScriptID(gModNum 17)
                    )(else
                        ScriptID(1891 38)
                    )
 )
                )
                (case 46
                    (
                    (if (proc999_5(gModNum 450 440))
                        ScriptID(gModNum 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) )
                )
            )
)
            return 
        )(else
            (super:findTalker(param1))
        )
    )

)
