(version 2)
(include "sci.sh")
(exports
    0 FP
    1 proc0_1
    2 proc0_2
    3 proc0_3
    4 proc0_4
    5 proc0_5
    6 proc0_6
    7 proc0_7
    8 proc0_8
    9 proc0_9
    10 fpWin
    11 proc0_11
    12 horsePlopTimer
    13 deathTimer
    14 gasMaskTimer
    15 proc0_15
)
(use "FPIconItem")
(use "FPRoom")
(use "ego")
(use "Print")
(use "DIcon")
(use "Messager")
(use "Blink")
(use "PseudoMouse")
(use "IconI")
(use "Osc")
(use "PolyPath")
(use "Polygon")
(use "StopWalk")
(use "Timer")
(use "Grooper")
(use "SysWindow")
(use "Sound")
(use "Game")
(use "InvI")
(use "Obj")
(script 0)


(local
    gEgo
    gGame
    global2
    global3
    global4
    gOldCast
    gRegions
    gTimers
    gSounds
    gInv
    gOldATPs
    gNumber
    gGNumber
    gNewRoomNumber
    global14
    global15
    global16
    global17
    gNewSet
    gCursorNumber
    gWalkCursor =     999
    global21 =     997
    gFont =     1
    global23 =     4
    gPEvent
    gDialog
    global26 =     1
    global27
    global28
    global29
    global30
    gPicAngle
    gOldFeatures
    global33
    global34
    global35
    gPicNumber =     -1
    global37
    gFpWin
    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
    gFpFtrInit
    gFpDoVerbCode
    gFpApproachCode
    global67 =     1
    global68
    gIconBar
    gOrigX
    gPEventY
    gOldKH
    gOldMH
    gOldDH
    global75
    global76
    gPseudoMouse
    gTheDoits
    gEatTheMice =     60
    gUser
    global81
    gNewSync
    global83
    gNewEventHandler
    gFont_2
    global86
    global87
    gB_moveCnt
    gNarrator
    global90 =     1
    gFpMessager
    global92
    gOldWH
    global94 =     2
    gNewList
    global96
    global97
    global98
    global99
    gStopGroop
    global101 =     6
    gGameMusic1
    gGameMusic2
    global104
    global105
    global106
    global107
    gGUserCanControl
    gGUserCanInput
    global110
    global111
    global112
    global113
    global114
    global115
    global116
    global117
    global118
    global119
    global120 =     1
    global121
    global122
    global123 =     1
    global124
    gGIconBarCurIcon
    gTheNewDButtonValue
    global127
    global128
    gWindMillBladesCel
    global130
    global131
    global132
    gTheVerb
    gBack =     34
    global135 =     673
    global136
    global137
    global138
    global139
    global140
    global141 =     250
    gMedicineBottle
    global143
    global144
    global145
    global146
    global147
    global148
    global149
    global150
    global151
    global152
    global153
    global154
    global155
    global156
    global157
    global158
    global159
    global160
    global161
    global162
    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 param2)
    return 
        (if (& (send param1:onControl(1)) param2)
            return 1
        )(else
            0
        )
)


(procedure public (proc0_2 param1)
    return & global186[(/ param1 16)] (>> $8000 (% param1 16))
)


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


(procedure public (proc0_4 param1)
    (var temp0)
    = temp0 proc0_2(param1)
    = global186[(/ param1 16)] (& global186[(/ param1 16)] bnot (>> $8000 (% param1 16)))
    return temp0
)


(procedure public (proc0_5 param1 param2 param3 param4)
    (var temp0, temp1, temp2, temp3)
    = temp3 0
    (if (IsObject(param2))
        = temp1 (send param2:x)
        = temp2 (send param2:y)
        (if (== paramTotal 3)
            = temp3 param3
        )
    )(else
        = temp1 param2
        = temp2 param3
        (if (== paramTotal 4)
            = temp3 param4
        )
    )
    = temp0 GetAngle((send param1:x) (send param1:y) temp1 temp2)
    (send param1:setHeading(temp0 
        (if (IsObject(temp3))
            temp3
        )(else
            0
        )
))
)


(procedure public (proc0_6 param1 param2)
    (var temp0[120])
    (if (proc999_5(param2 4 3 2 1))
        (send gFpMessager:say(0 param2 0 0 0 0))
    )(else
        (if (Message(msgGET gNumber (send param1:noun) 6 0 1 @temp0))
            (send gFpMessager:say((send param1:noun) 6 0 0 0 gNumber))
        )(else
            (if (Message(msgGET (send param1:modNum) (send param1:noun) 6 0 1 @temp0))
                (send gFpMessager:say((send param1:noun) 6 0 0 0 (send param1:modNum)))
            )(else
                (send gFpMessager:say(0 6 0 0 0 0))
            )
        )
    )
)


(procedure public (proc0_7)
    (var temp0)
    (send gUser:
        canControl(gGUserCanControl)
        canInput(gGUserCanInput)
    )
    = temp0 0
    (while (< temp0 8)
        (if (& global114 (>> $8000 temp0))
            (send gIconBar:disable(temp0))
        )
        ++temp0
    )
)


(procedure public (proc0_8 param1)
    (if (param1)
        (send gIconBar:
            delete(icon0)
            addToFront((icon10:
                    init()
                    yourself()
                )
)
        )
        (if (== (send gIconBar:curIcon) icon0)
            (send gIconBar:
                curIcon(icon10)
                walkIconItem(0)
            )
            (send gGame:setCursor((icon10:cursor)))
        )
    )(else
        (send gIconBar:
            delete(icon10)
            addToFront((icon0:
                    init()
                    yourself()
                )
)
        )
        (if (== (send gIconBar:curIcon) icon10)
            (send gIconBar:
                curIcon(icon0)
                walkIconItem(icon0)
            )
            (send gGame:setCursor((icon0:cursor)))
        )
    )
)


(procedure public (proc0_9 param1 param2)
    (if (not param1)
        = global127 0
        = global128 0
        (send gIconBar:disable(4))
    )(else
        = global127 param1
        (if ((> paramTotal 1) and (== param1 1000))
            = global128 param2
        )
        (send gIconBar:enable(4))
    )
)


(procedure public (proc0_11 param1)
    (if (param1)
        (send gIconBar:
            delete(icon0)
            addToFront((icon11:
                    init()
                    yourself()
                )
)
        )
        (if (== (send gIconBar:curIcon) icon0)
            (send gIconBar:
                curIcon(icon11)
                walkIconItem(0)
            )
            (send gGame:setCursor((icon11:cursor)))
        )
    )(else
        (send gIconBar:
            delete(icon11)
            addToFront((icon0:
                    init()
                    yourself()
                )
)
        )
        (if (== (send gIconBar:curIcon) icon11)
            (send gIconBar:
                curIcon(icon0)
                walkIconItem(icon0)
            )
            (send gGame:setCursor((icon0:cursor)))
        )
    )
)


(procedure public (proc0_15 param1 param2 param3)
    (var temp0, temp1)
    (if ((< paramTotal 2) or (== param2 0))
        = param2 1
    )
    (if ((== paramTotal 0) or (== param1 1))
        = temp0 100
        (while (> temp0 0)
            Palette(palSET_INTENSITY 0 256 temp0)
            = temp0 (- temp0 param2)
        )
    )(else
        = temp0 0
        (while (< temp0 100)
            Palette(palSET_INTENSITY 0 256 temp0)
            = temp0 (+ temp0 param2)
        )
    )
    (if ((== paramTotal 3) and param3)
        (send param3:cue())
    )
)


(class FPSound of Sound
    (properties
        nodePtr 0
        handle 0
        flags $0000
        number 0
        vol 127
        priority 0
        loop 1
        signal $0000
        prevSignal 0
        dataInc 0
        min 0
        sec 0
        frame 0
        client 0
        owner 0
    )

    (method (play param1)
        (if (not 
        (if (<= 0 (- number 2000))
            (<= (- number 2000) 999)
        )
 and (<= DoSound(sndGET_POLYPHONY) 11))
            = number (+ (% number 1000) 1000)
        )
        (super:play(rest param1))
    )

)
(instance gameMusic1 of FPSound
    (properties
        flags $0001
    )
)
(instance gameMusic2 of FPSound
    (properties
        flags $0001
    )
)
(instance pointsSound of FPSound
    (properties
        flags $0001
        number 2141
    )

    (method (check param1)
        (super:check(rest param1))
        (if (== prevSignal -1)
            (self:dispose())
        )
    )

)
(class Actions of Code
    (properties)

    (method (doVerb)
        return 0
    )

)
(instance stopGroop of Grooper
    (properties)
)
(instance walkCursor of Cursor
    (properties)
)
(instance lookCursor of Cursor
    (properties
        view 1
    )
)
(instance doCursor of Cursor
    (properties
        view 2
    )
)
(instance talkCursor of Cursor
    (properties
        view 3
    )
)
(instance exitCursor of Cursor
    (properties
        view 6
    )
)
(instance gunCursor of Cursor
    (properties
        view 10
    )
)
(class public FP of Game
    (properties
        script 0
        printLang 0
        _detailLevel 3
        panelObj 0
        panelSelector 0
        handsOffCode 0
        handsOnCode 0
    )

    (method (init)
        (var temp0[22])
        Print
        DButton
        StopWalk
        Polygon
        PolyPath
        Timer
        FPRoom
        ego
        IconBar
        Inv
        FPIconItem
        ScriptID(982)
        Narrator
        Osc
        (super:init())
        = global27 "x.yyy.zzz"
        = global111 "991-999-9999"
        = global112 "9999-999999"
        = global113 "992-999-9999"
        (send (ScriptID(14 0)):init())
        DisposeScript(14)
        (send (ScriptID(15 0)):init())
        = gWalkCursor walkCursor
        = gFpDoVerbCode fpDoVerbCode
        = gFpFtrInit fpFtrInit
        = gFpApproachCode fpApproachCode
        = gStopGroop stopGroop
        = gFpMessager fpMessager
        = gNewList (List:new())
        (send gNewList:
            name("altPolys")
            add()
        )
        = gPseudoMouse PseudoMouse
        = gGameMusic1 gameMusic1
        (send gGameMusic1:
            owner(self)
            init()
        )
        = gGameMusic2 gameMusic2
        (send gGameMusic2:
            owner(self)
            init()
        )
        = gIconBar IconBar
        (send gIconBar:
            add(icon0 icon1 icon2 icon3 icon4 icon6 icon7 icon8 icon9 icon5)
            eachElementDo(#init)
            eachElementDo(#highlightColor 37)
            eachElementDo(#lowlightColor 33)
            curIcon(icon0)
            useIconItem(icon6)
            helpIconItem(icon9)
            walkIconItem(icon0)
            disable(5)
            disable()
            state(3072)
        )
        (send gIconBar:disable(9))
        proc0_9(0)
        (if (FileIO(fiEXISTS "10.scr"))
            = global110 1
        )(else
            = global110 0
        )
        (if (GameIsRestarting())
            MemorySegment(1 @global107)
        )(else
            (if (FileIO(fiEXISTS "29.scr"))
                = global107 29
            )(else
                = global107 28
            )
        )
        (send gIconBar:enable())
        = gEgo ego
        (send gUser:
            alterEgo(gEgo)
            canControl(0)
            canInput(0)
        )
        (send gEgo:get(-1 16))
        (self:newRoom(global107))
    )


    (method (replay param1)
        (var temp0)
        = gFpWin fpWin
        = gWalkCursor walkCursor
        (super:replay(rest param1))
    )


    (method (newRoom newRoomNumber)
        (send gGame:setCursor(global21))
        (send gPseudoMouse:stop())
        (if (gDialog)
            (send gDialog:dispose())
        )
        (if (IsObject(gNewEventHandler) and (send gNewEventHandler:elements))
            (send gNewEventHandler:eachElementDo(#dispose 1))
        )
        (send gNarrator:
            x(-1)
            y(-1)
            disposeWhenDone(1)
            talkWidth(0)
            keepWindow(0)
            modeless(0)
            showTitle(0)
            name("Narrator")
        )
        (send gIconBar:disable())
        (if (> global127 1000)
            (switch (global127)
                (case 1610
                    = global138 0
                    proc0_4(84)
                    = global119 13
                    (send (ScriptID(0 13)):setReal(ScriptID(0 13) 0 15))
                )
                (case 1230
                    proc0_3(80)
                )
                (case 1250
                    proc0_3(80)
                )
                (case 1630
                    proc0_3(80)
                )
                (case 1240
                    proc0_3(80)
                )
                (case 1026
                    (if (<> gGameMusic1 638)
                        (send gGameMusic1:fade())
                    )
                    (send gGameMusic2:fade())
                )
            )
            = global127 (- global127 1000)
        )
        (super:newRoom(newRoomNumber))
    )


    (method (startRoom param1)
        (var temp0, temp1, temp2[2])
        (send (ScriptID(11)):doit(param1))
        = temp1 0
        (while (< temp1 (send gTimers:size))
            = temp0 (send gTimers:at(0))
            (send gTimers:delete(temp0))
            (send gTimers:add(temp0))
            ++temp1
        )
        (if ((<> (- MemoryInfo(1) 2) MemoryInfo(0)) and (Print:
            addText(1 0 0 1 0 0 10)
            addButton(0 1 0 1 1 0 12 10)
            addButton(1 1 0 2 1 70 12 10)
            init()
        )
)
            SetDebug()
        )
        (if ((((>= global119 7) and (<= global119 9)) or (> global119 21)) or proc0_2(1))
            proc0_4(59)
        )(else
            (if (not proc0_2(59))
                proc0_3(59)
                proc0_3(71)
            )
        )
        (if (proc0_2(59) and proc999_5(param1 220 230 235 240 250))
            ScriptID(90)
        )
        (if ((== global119 22) and proc999_5(param1 220 235 240 250 400))
            ScriptID(91)
        )
        (if (global110 and not proc999_5(param1 100))
            (send (ScriptID(10 0)):init())
        )
        (if (proc999_5(global127 param1 1000))
            proc0_9(0)
        )
        (send gIconBar:enable())
        (super:startRoom(param1))
        (if (((send gEgo:cycler) and not (send gEgo:looper)) and (send ((send gEgo:cycler)):isKindOf(StopWalk)))
            (send gEgo:setLoop(stopGroop))
        )
        (if (== (send gIconBar:curIcon) (send gIconBar:at(5)))
            (send gIconBar:curIcon((send gIconBar:at(0))))
        )
    )


    (method (restart)
        (if (proc999_5(gNumber 29 99))
            (send gGame:setCursor(997 1 304 172))
            (send global2:
                style(6)
                drawPic(780)
            )
            (send gOldCast:eachElementDo(#hide))
            Animate((send gOldCast:elements) 0)
            MemorySegment(0 @global107 2)
            (super:restart())
        )(else
            = gWalkCursor (send ((send gIconBar:curIcon)):cursor)
            (send gGame:setCursor(999 1 124 115))
            (if ((Print:
                font(gFont)
                addTitle(18 0 4 1 0)
                addText(18 0 1 1 0 3 0)
                addButton(1 18 0 5 1 90 35 0)
                addButton(0 18 0 6 1 50 35 0)
                init()
            )
)
                PalVary(pvUNINIT)
                Palette(palSET_INTENSITY 0 256 100)
                (send gGame:setCursor(997 1 304 172))
                (send global2:
                    style(6)
                    drawPic(780)
                )
                (send gOldCast:eachElementDo(#hide))
                Animate((send gOldCast:elements) 0)
                MemorySegment(0 @global107 2)
                SetVideoMode(0)
                (super:restart())
            )(else
                (send gGame:setCursor(gWalkCursor))
            )
        )
    )


    (method (restore param1)
        (var theGFpWin, theGWalkCursor, temp2, temp3)
        = theGWalkCursor gWalkCursor
        = gWalkCursor 999
        = theGFpWin gFpWin
        = gFpWin SysWindow
        (super:restore(rest param1))
        = gFpWin theGFpWin
        = gWalkCursor theGWalkCursor
        = temp2 (send ((send gIconBar:curIcon)):cursor)
        (if (== temp2 999)
            (send gGame:setCursor(global21))
        )(else
            (send gGame:setCursor(temp2))
        )
    )


    (method (save param1)
        (var theGFpWin, theGWalkCursor, temp2)
        = theGWalkCursor gWalkCursor
        = gWalkCursor 999
        = theGFpWin gFpWin
        = gFpWin SysWindow
        (super:save(rest param1))
        = gFpWin theGFpWin
        = gWalkCursor theGWalkCursor
        = temp2 (send ((send gIconBar:curIcon)):cursor)
        (if (== temp2 999)
            (send gGame:setCursor(global21))
        )(else
            (send gGame:setCursor(temp2))
        )
    )


    (method (handleEvent pEvent)
        (var theGWalkCursor, temp1)
        (if ((send pEvent:claimed))
            return 1
        )
        return 
            (switch ((send pEvent:type))
                (case 4
                    (switch ((send pEvent:message))
                        (case 9
                            (if (not & (send ((send gIconBar:at(6))):signal) $0004)
                                (if (gNewEventHandler)
                                    return gNewEventHandler
                                )
                                (send (ScriptID(15 2)):doit(gEgo))
                                (send gEgo:showInv())
                                (send pEvent:claimed(1))
                            )
                        )
                        (case 3840
                            (if (not & (send ((send gIconBar:at(6))):signal) $0004)
                                (if (gNewEventHandler)
                                    return gNewEventHandler
                                )
                                (send (ScriptID(15 2)):doit(gEgo))
                                (send gEgo:showInv())
                                (send pEvent:claimed(1))
                            )
                        )
                        (case 17
                            (send gGame:quitGame())
                            (send pEvent:claimed(1))
                        )
                        (case 3
                            (if (not & (send ((send gIconBar:at(7))):signal) $0004)
                                = theGWalkCursor gWalkCursor
                                = gWalkCursor 999
                                (send gGame:showControls())
                                = gWalkCursor theGWalkCursor
                                = temp1 (send ((send gIconBar:curIcon)):cursor)
                                (if (== temp1 999)
                                    (send gGame:setCursor(global21))
                                )(else
                                    (send gGame:setCursor(temp1))
                                )
                                (send pEvent:claimed(1))
                            )
                        )
                        (case 15360
                            (if ((send gGame:masterVolume()))
                                (send gGame:masterVolume(0))
                            )(else
                                (if (> global106 1)
                                    (send gGame:masterVolume(15))
                                )(else
                                    (send gGame:masterVolume(1))
                                )
                            )
                            (send pEvent:claimed(1))
                        )
                        (case 16128
                            (if (not 
                            (if (& (send ((send gIconBar:at(7))):signal) $0004)
                            )(else
                                & (send gIconBar:state) $0004
                            )
)
                                (if (gNewEventHandler)
                                    return gNewEventHandler
                                )
                                (send gGame:save())
                                (send pEvent:claimed(1))
                            )
                        )
                        (case 16640
                            (if (not 
                            (if (& (send ((send gIconBar:at(7))):signal) $0004)
                            )(else
                                & (send gIconBar:state) $0004
                            )
)
                                (if (gNewEventHandler)
                                    return gNewEventHandler
                                )
                                (send gGame:restore())
                                (send pEvent:claimed(1))
                            )
                        )
                        (case 17152
                            (if (not 
                            (if (& (send ((send gIconBar:at(7))):signal) $0004)
                            )(else
                                & (send gIconBar:state) $0004
                            )
)
                                (send gGame:restart())
                                (send pEvent:claimed(1))
                            )
                        )
                        (case 43
                            (if ((send gUser:controls))
                                (send gEgo:setSpeed(proc999_3(0 (- (send gEgo:moveSpeed) 1))))
                            )
                        )
                        (case 45
                            (if ((send gUser:controls))
                                (send gEgo:setSpeed((+ (send gEgo:moveSpeed) 1)))
                            )
                        )
                        (case 61
                            (if ((send gUser:controls))
                                (send gEgo:setSpeed(6))
                            )
                        )
                    )
                )
            )
    )


    (method (setCursor cursorNumber param2 param3 param4)
        (var theGCursorNumber)
        = theGCursorNumber gCursorNumber
        (if (paramTotal)
            (if (IsObject(cursorNumber))
                = gCursorNumber cursorNumber
                (send gCursorNumber:init())
            )(else
                = gCursorNumber cursorNumber
                SetCursor(gCursorNumber 0 0)
            )
        )
        (if ((> paramTotal 1) and not param2)
            SetCursor(996 0 0)
        )
        (if (> paramTotal 2)
            (if (< param3 0)
                = param3 0
            )
            (if (< param4 0)
                = param4 0
            )
            SetCursor(param3 param4)
        )
        return theGCursorNumber
    )


    (method (quitGame)
        (send (ScriptID(31 0)):
            init()
            show()
            dispose()
        )
    )


    (method (pragmaFail)
        (if (gDialog)
            (send gDialog:dispose())
        )
        (if ((send gUser:canInput()))
            (send gFpMessager:say(0 (send ((send gUser:curEvent)):message)))
        )
    )


    (method (handsOff)
        (if (not gGIconBarCurIcon)
            = gGIconBarCurIcon (send gIconBar:curIcon)
        )
        = gGUserCanControl (send gUser:canControl())
        = gGUserCanInput (send gUser:canInput())
        (send gUser:
            canControl(0)
            canInput(0)
        )
        (send gEgo:setMotion(0))
        = global114 0
        (send gIconBar:eachElementDo(#perform checkIcon))
        (send gIconBar:curIcon((send gIconBar:at(7))))
        (send gIconBar:disable(0 1 2 3 5 6))
        (if (not HaveMouse())
            (send gGame:setCursor(996))
        )(else
            (send gGame:setCursor(global21))
        )
    )


    (method (handsOn param1)
        (send gUser:
            canControl(1)
            canInput(1)
        )
        (send gIconBar:enable(0 1 2 3 5 6))
        (if (not (send global2:inset()))
            (send gIconBar:enable(7))
        )
        (if (paramTotal and param1)
            proc0_7()
        )
        (if (not (send gIconBar:curInvIcon))
            (send gIconBar:disable(5))
        )
        (if (gGIconBarCurIcon and ((<> gGIconBarCurIcon icon10) or (== (send gIconBar:at(0)) icon10)))
            (send gIconBar:curIcon(gGIconBarCurIcon))
            (send gGame:setCursor((send gGIconBarCurIcon:cursor)))
            (if ((== (send gIconBar:curIcon) (send gIconBar:at(5))) and not (send gIconBar:curInvIcon))
                (send gIconBar:advanceCurIcon())
            )
        )
        = gGIconBarCurIcon 0
        (send gGame:setCursor((send ((send gIconBar:curIcon)):cursor) 1))
    )


    (method (points param1 param2)
        (if ((> paramTotal 1) and proc0_3(param2))
            = param1 0
        )
        (if (param1)
            (pointsSound:play())
            (send gGame:changeScore(param1))
        )
    )


    (method (showControls)
        (var temp0)
        (send (ScriptID(24 0)):
            init()
            show()
            dispose()
        )
    )


    (method (showAbout)
        (send (ScriptID(13 0)):doit())
    )

)
(instance public horsePlopTimer of Timer
    (properties)

    (method (cue)
        proc0_4(29)
        (if (not proc0_2(14))
            proc0_4(53)
            (switch (Random(0 2))
                (case 0
                    = global141 220
                )
                (case 1
                    = global141 230
                )
                (case 2
                    = global141 250
                )
            )
            (if (== global141 gNumber)
                (switch (gNumber)
                    (case 220
                        = global141 230
                    )
                    (case 230
                        = global141 250
                    )
                    (case 250
                        = global141 220
                    )
                )
            )
        )
        (if (== gNumber 660)
            (send global2:notify())
        )
    )

)
(instance public deathTimer of Timer
    (properties)

    (method (cue)
        (switch (global119)
            (case 8
                = global122 1
            )
            (case 9
                = global122 20
            )
            (case 10
                = global122 16
            )
            (case 13
                = global122 19
            )
            (case 14
                = global122 17
            )
            (case 20
                = global122 15
            )
            (default 
                (if (proc0_2(146))
                    (self:setReal(self 0 15))
                )(else
                    = global122 18
                )
            )
        )
        (if (not proc0_2(146))
            (send global2:newRoom(99))
        )
    )

)
(instance public gasMaskTimer of Timer
    (properties)

    (method (cue)
        (if (proc0_2(70))
            = global122 1
            (send global2:newRoom(99))
        )(else
            (send gFpMessager:say(22 0 0 0 0 0))
            proc0_3(70)
            (self:setReal(self 40))
        )
    )

)
(instance icon0 of IconI
    (properties
        view 990
        loop 0
        cel 0
        type $5000
        message 3
        signal $0041
        maskView 990
        maskLoop 9
        noun 1
        helpVerb 7
    )

    (method (init)
        = cursor walkCursor
        (super:init())
    )


    (method (select param1)
        (var temp0)
        return 
            (if ((super:select(rest param1)))
                (send gIconBar:hide())
                return 1
            )(else
                return 0
            )
    )

)
(instance icon1 of IconI
    (properties
        view 990
        loop 1
        cel 0
        message 1
        signal $0041
        maskView 990
        maskLoop 9
        noun 2
        helpVerb 7
    )

    (method (init)
        = cursor lookCursor
        (super:init())
    )

)
(instance icon2 of IconI
    (properties
        view 990
        loop 2
        cel 0
        message 4
        signal $0041
        maskView 990
        maskLoop 9
        noun 3
        helpVerb 7
    )

    (method (init)
        = cursor doCursor
        (super:init())
    )

)
(instance icon3 of IconI
    (properties
        view 990
        loop 3
        cel 0
        message 2
        signal $0041
        maskView 990
        maskLoop 9
        noun 4
        helpVerb 7
    )

    (method (init)
        = cursor talkCursor
        (super:init())
    )

)
(instance icon4 of IconI
    (properties
        view 990
        loop 4
        cel 0
        cursor 999
        message 0
        signal $0043
        maskView 990
        maskLoop 9
        maskCel 2
        noun 13
        helpVerb 7
    )

    (method (select param1)
        return 
            (if (global127)
                (super:select(rest param1))
                (send gIconBar:hide())
                (if ((Print:
                    posn(49 82)
                    width(220)
                    addTitle(5 0 4 1 0)
                    addText(5 0 1 1 0 0 0)
                    addButton(0 5 0 3 1 180 28 0)
                    addButton(1 5 0 2 1 133 28 0)
                    init()
                )
)
                    (if (== global127 1000)
                        (if (IsObject(global128))
                            (send global128:cue())
                            proc0_9(0)
                        )(else
                            proc921_0("ERROR: Object passed to SetFFRoom isn't an object you silly person!")
                        )
                    )(else
                        (send global2:newRoom(global127))
                        = global127 (+ global127 1000)
                    )
                )
            )(else
                return 0
            )
    )

)
(instance icon5 of IconI
    (properties
        view 990
        loop 11
        cel 0
        cursor 999
        signal $0043
        maskView 990
        maskLoop 11
        noun 14
        helpVerb 7
    )

    (method (show param1)
        (var temp0[7], temp7[4])
        (super:show(rest param1))
        Format(@temp0 0 0 global15 global16)
        TextSize(@temp7 @temp0 global121 0)
        Display(@temp0 102 25 105 global121 100 + (- nsLeft 3) (/ (- 50 temp7[3]) 2) + nsTop 16)
    )

)
(instance icon6 of IconI
    (properties
        view 990
        loop 5
        cel 0
        cursor 999
        message 0
        signal $0041
        maskView 990
        maskLoop 9
        maskCel 1
        noun 9
        helpVerb 7
    )

    (method (select param1)
        (var newEvent, temp1, gIconBarCurInvIcon, temp3, temp4)
        return 
            (if (& signal $0004)
                0
            )(else
                (if ((paramTotal and param1) and (& signal $0001))
                    = gIconBarCurInvIcon (send gIconBar:curInvIcon)
                    (if (gIconBarCurInvIcon)
                        = temp3 (+ (/ (- (- nsRight nsLeft) CelWide((send gIconBarCurInvIcon:view) (- (send gIconBarCurInvIcon:loop) 1) (send gIconBarCurInvIcon:cel))) 2) nsLeft)
                        = temp4 (+ (+ (send gIconBar:y) (/ (- (- nsBottom nsTop) CelHigh((send gIconBarCurInvIcon:view) (- (send gIconBarCurInvIcon:loop) 1) (send gIconBarCurInvIcon:cel))) 2)) nsTop)
                    )
                    = temp1 1
                    DrawCel(view loop temp1 nsLeft nsTop -1)
                    = gIconBarCurInvIcon (send gIconBar:curInvIcon)
                    (if (gIconBarCurInvIcon)
                        DrawCel((send (= gIconBarCurInvIcon (send gIconBar:curInvIcon)):view) - (send gIconBarCurInvIcon:loop) 1 (send gIconBarCurInvIcon:cel) temp3 temp4 -1)
                    )
                    Graph(grUPDATE_BOX nsTop nsLeft nsBottom nsRight 1)
                    (while (<> (send ((= newEvent (Event:new()))):type) 2)
                        (send newEvent:localize())
                        (if ((self:onMe(newEvent)))
                            (if (not temp1)
                                = temp1 1
                                DrawCel(view loop temp1 nsLeft nsTop -1)
                                = gIconBarCurInvIcon (send gIconBar:curInvIcon)
                                (if (gIconBarCurInvIcon)
                                    DrawCel((send (= gIconBarCurInvIcon (send gIconBar:curInvIcon)):view) - (send gIconBarCurInvIcon:loop) 1 (send gIconBarCurInvIcon:cel) temp3 temp4 -1)
                                )
                                Graph(grUPDATE_BOX nsTop nsLeft nsBottom nsRight 1)
                            )
                        )(else
                            (if (temp1)
                                = temp1 0
                                DrawCel(view loop temp1 nsLeft nsTop -1)
                                = gIconBarCurInvIcon (send gIconBar:curInvIcon)
                                (if (gIconBarCurInvIcon)
                                    DrawCel((send (= gIconBarCurInvIcon (send gIconBar:curInvIcon)):view) - (send gIconBarCurInvIcon:loop) 1 (send gIconBarCurInvIcon:cel) temp3 temp4 -1)
                                )
                                Graph(grUPDATE_BOX nsTop nsLeft nsBottom nsRight 1)
                            )
                        )
                        (send newEvent:dispose())
                    )
                    (send newEvent:dispose())
                    (if (== temp1 1)
                        DrawCel(view loop 0 nsLeft nsTop -1)
                        = gIconBarCurInvIcon (send gIconBar:curInvIcon)
                        (if (gIconBarCurInvIcon)
                            DrawCel((send (= gIconBarCurInvIcon (send gIconBar:curInvIcon)):view) - (send gIconBarCurInvIcon:loop) 1 (send gIconBarCurInvIcon:cel) temp3 temp4 -1)
                        )
                        Graph(grUPDATE_BOX nsTop nsLeft nsBottom nsRight 1)
                    )
                    temp1
                )(else
                    1
                )
            )
    )

)
(instance icon7 of IconI
    (properties
        view 990
        loop 6
        cel 0
        cursor 999
        type $0000
        message 0
        signal $0043
        maskView 990
        maskLoop 9
        noun 6
        helpVerb 7
    )

    (method (select param1)
        return 
            (if ((super:select(rest param1)))
                (send gIconBar:hide())
                (send (ScriptID(15 2)):doit(gEgo))
                (send gEgo:showInv())
                return 1
            )(else
                return 0
            )
    )

)
(instance icon8 of IconI
    (properties
        view 990
        loop 7
        cel 0
        cursor 999
        message 7
        signal $0043
        maskView 990
        maskLoop 9
        noun 7
        helpVerb 7
    )

    (method (select param1)
        return 
            (if ((super:select(rest param1)))
                (send gIconBar:hide())
                (send gGame:showControls())
                return 1
            )(else
                return 0
            )
    )

)
(instance icon9 of IconI
    (properties
        view 990
        loop 8
        cel 0
        cursor 9
        type $2000
        message 7
        signal $0003
        maskView 990
        maskLoop 9
        noun 8
        helpVerb 7
    )
)
(instance icon10 of IconI
    (properties
        view 990
        loop 10
        cel 0
        message 8
        signal $0041
        maskView 990
        maskLoop 9
        noun 10
        helpVerb 7
    )

    (method (init)
        = cursor exitCursor
        (self:
            highlightColor(37)
            lowlightColor(33)
        )
        (super:init())
    )


    (method (select param1)
        (var temp0)
        return 
            (if ((super:select(rest param1)))
                (send gIconBar:hide())
                return 1
            )(else
                return 0
            )
    )

)
(instance icon11 of IconI
    (properties
        view 990
        loop 12
        cel 0
        message 3
        signal $0041
        maskView 990
        maskLoop 9
        noun 3
        helpVerb 7
    )

    (method (init)
        = cursor gunCursor
        (self:
            highlightColor(37)
            lowlightColor(33)
        )
        (super:init())
    )


    (method (select param1)
        (var temp0)
        return 
            (if ((super:select(rest param1)))
                (send gIconBar:hide())
                return 1
            )(else
                return 0
            )
    )

)
(instance checkIcon of Code
    (properties)

    (method (doit param1)
        (if ((send param1:isKindOf(IconI)) and (& (send param1:signal) $0004))
            = global114 (| global114 (>> $8000 (send gIconBar:indexOf(param1))))
        )
    )

)
(instance fpDoVerbCode of Code
    (properties)

    (method (doit param1 param2)
        proc0_6(param2 param1)
    )

)
(instance fpFtrInit of Code
    (properties)

    (method (doit param1)
        (if (== (send param1:sightAngle) 26505)
            (send param1:sightAngle(40))
        )
        (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 fpMessager of Messager
    (properties)

    (method (findTalker param1)
        (var temp0)
        = temp0 
            (switch (param1)
                (case 99
                    gNarrator
                )
                (case 49
                    ScriptID(1800 49)
                )
                (case 55
                    ScriptID(1801 55)
                )
                (case 40
                    ScriptID(1802 40)
                )
                (case 43
                    ScriptID(1803 43)
                )
                (case 48
                    ScriptID(1804 48)
                )
                (case 45
                    ScriptID(1805 45)
                )
                (case 44
                    ScriptID(1806 44)
                )
                (case 46
                    ScriptID(1807 46)
                )
                (case 3
                    ScriptID(1808 3)
                )
                (case 59
                    ScriptID(1809 59)
                )
                (case 50
                    ScriptID(1810 50)
                )
                (case 53
                    ScriptID(1811 53)
                )
                (case 56
                    ScriptID(1812 56)
                )
                (case 58
                    ScriptID(1813 58)
                )
                (case 57
                    ScriptID(1814 57)
                )
                (case 54
                    ScriptID(1815 54)
                )
                (case 52
                    ScriptID(1816 52)
                )
                (case 47
                    ScriptID(1817 47)
                )
                (case 51
                    ScriptID(1818 51)
                )
                (case 42
                    ScriptID(1819 42)
                )
                (case 5
                    ScriptID(1826 5)
                )
                (case 6
                    ScriptID(1832 6)
                )
                (case 29
                    ScriptID(1834 7)
                )
                (case 8
                    ScriptID(1827 8)
                )
                (case 9
                    ScriptID(1839 9)
                )
                (case 10
                    ScriptID(1840 10)
                )
                (case 11
                    ScriptID(1841 11)
                )
                (case 12
                    ScriptID(1844 12)
                )
                (case 2
                    ScriptID(1845 2)
                )
                (case 1
                    ScriptID(1846 1)
                )
                (case 15
                    ScriptID(90 1)
                )
                (case 20
                    ScriptID(90 1)
                )
                (case 13
                    ScriptID(90 1)
                )
                (case 19
                    ScriptID(90 1)
                )
                (case 23
                    ScriptID(90 1)
                )
                (case 17
                    ScriptID(90 1)
                )
                (case 27
                    ScriptID(90 1)
                )
                (case 7
                    ScriptID(90 1)
                )
                (case 21
                    ScriptID(90 1)
                )
                (case 14
                    ScriptID(90 1)
                )
                (case 25
                    ScriptID(90 1)
                )
                (case 26
                    ScriptID(90 1)
                )
                (case 16
                    ScriptID(90 1)
                )
                (case 18
                    ScriptID(90 1)
                )
                (case 4
                    ScriptID(90 1)
                )
                (case 24
                    ScriptID(90 1)
                )
                (case 22
                    ScriptID(90 1)
                )
                (case 28
                    ScriptID(90 1)
                )
                (case 30
                    ScriptID(1847 30)
                )
            )
        (if (temp0)
            return 
        )(else
            (super:findTalker(param1))
        )
    )

)
(instance fpApproachCode of Code
    (properties)

    (method (doit param1)
        (switch (param1)
            (case 1
                1
            )
            (case 2
                2
            )
            (case 3
                4
            )
            (case 4
                8
            )
            (case 8
                16
            )
            (default 
                -32768
            )
        )
    )

)
(instance public fpWin of SysWindow
    (properties
        type $0080
    )

    (method (open)
        (var temp0, temp1, theLsTop, theLsLeft, temp4)
        (switch (global120)
            (case 1
                = temp1 0
            )
            (case 2
                (if (proc0_2(1))
                    = temp1 2
                )(else
                    = temp1 1
                )
            )
            (case 3
                = temp1 3
            )
            (case 4
                = temp1 4
            )
            (case 5
                = temp1 4
            )
        )
        = lsLeft (- (- left 3) 15)
        = lsTop (- (- top 3) 
            (if (title)
                25
            )(else
                15
            )
)
        = lsRight (+ (+ right 3) 15)
        = lsBottom proc999_3((+ bottom 3) (+ (+ lsTop CelHigh(994 temp1 0)) 3))
        = priority 15
        (super:open())
        = temp0 GetPort()
        SetPort(0)
        Graph(grFILL_BOX top left bottom right 3 gBack 15)
        (if (title)
            = top (- top 10)
        )
        Graph(grDRAW_LINE - top 1 - left 1 - top 1 right 17 15)
        Graph(grDRAW_LINE - top 1 - left 1 bottom - left 1 17 15)
        Graph(grDRAW_LINE bottom - left 1 bottom right 17 15)
        Graph(grDRAW_LINE - top 1 right bottom right 17 15)
        Graph(grDRAW_LINE - top 2 - left 2 - top 2 + right 1 19 15)
        Graph(grDRAW_LINE - top 2 - left 2 + bottom 1 - left 2 19 15)
        Graph(grDRAW_LINE + bottom 1 - left 2 + bottom 1 + right 1 19 15)
        Graph(grDRAW_LINE - top 2 + right 1 + bottom 1 + right 1 19 15)
        Graph(grDRAW_LINE - top 3 - left 3 - top 3 + right 2 16 15)
        Graph(grDRAW_LINE - top 3 - left 3 + bottom 2 - left 3 16 15)
        Graph(grDRAW_LINE + bottom 2 - left 3 + bottom 2 + right 2 16 15)
        Graph(grDRAW_LINE - top 3 + right 2 + bottom 2 + right 2 16 15)
        Graph(grUPDATE_BOX - top 3 - left 3 + bottom 3 + right 3 1)
        (switch (global120)
            (case 1
                = theLsLeft (+ lsLeft 2)
                = temp4 (- (- lsRight 15) 14)
                = theLsTop lsTop
            )
            (case 2
                (if (proc0_2(1))
                    = theLsLeft lsLeft
                    = temp4 (- (- lsRight 15) 13)
                    = theLsTop (+ lsTop 2)
                )(else
                    = theLsLeft (+ lsLeft 8)
                    = temp4 (- (- lsRight 15) 14)
                    = theLsTop (+ lsTop 4)
                )
            )
            (case 3
                = theLsLeft (+ lsLeft 6)
                = temp4 (- (- lsRight 15) 40)
                = theLsTop (+ lsTop 11)
            )
            (case 4
                = theLsLeft (+ lsLeft 7)
                = temp4 (- (- lsRight 15) 14)
                = theLsTop (+ lsTop 8)
            )
            (case 5
                = theLsLeft (+ lsLeft 7)
                = temp4 (- (- lsRight 15) 14)
                = theLsTop (+ lsTop 8)
            )
        )
        DrawCel(994 temp1 0 theLsLeft theLsTop -1)
        DrawCel(994 temp1 1 temp4 theLsTop -1)
        SetPort(temp0)
    )

)
