(include "sci.sh")
(use "Class_255_0")
(use "n802")
(use "RegionPath")
(use "SQEgo")
(use "PseudoMouse")
(use "Slider")
(use "BorderWindow")
(use "RandCycle")
(use "StopWalk")
(use "DCIcon")
(use "Grooper")
(use "Sound")
(use "Game")
(use "InvI")
(use "User")
(use "IconI")
(use "PicView")
(use "Obj")
(script 0)


(local
    gEgo
    global1
    global2
    global3 = 6
    global4
    global5
    global6
    global7
    global8
    global9
    global10
    global11
    global12
    global13
    global14
    global15
    global16
    global17 = 7
    global18
    global19
    global20 = 999
    global21 = 20
    global22 = 1
    global23 = 4
    global24
    gTheNewDialog
    global26 = 1
    gLOOKUP_ERROR
    global28
    global29
    global30 = 10
    global31
    global32
    global33
    global34
    global35
    global36 = 65535
    global37
    gSq4Win
    global39 = 3
    global40
    global41
    global42
    global43
    global44
    global45
    global46
    global47
    global48
    global49
    global50
    global51
    global52
    global53
    global54
    global55
    global56
    global57
    global58
    global59
    global60
    global61
    global62
    global63
    global64
    global65
    global66
    global67
    global68
    global69
    global70
    global71
    global72
    global73
    global74
    global75
    global76
    global77
    global78
    global79
    global80
    global81
    global82
    global83
    gSq4FtrInit
    gSq4DoVerbCode
    global86
    global87 = 1
    global88
    gIconBar
    global90
    global91
    gSq4KeyDownHandler
    gSq4MouseDownHandler
    gSq4DirectionHandler
    global95
    global96
    gPseudoMouse
    global98
    global99
    gLongSong
    global101
    global102
    global103 = 1
    global104
    global105
    global106
    global107
    global108
    global109
    global110
    global111
    gEgoHead
    gStopGroop
    global114
    global115
    global116
    global117
    global118
    global119
    global120
    global121
    global122
    global123
    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
    gLongSong2
    global155
    global156
    global157
    global158
    global159 = 59
    global160
    global161
    global162
    global163
    global164
    global165
    global166
    global167
    global168
    global169 = 2001
    global170
    global171
    global172
    global173 = 10
    global174
    global175
    global176
    global177
    global178
    global179
    global180
    global181
    global182
    global183
    global184
    global185
    global186
    global187
    global188
    global189
    global190
    global191
    global192
    global193
    global194

)
(procedure public (proc0_1 param1 param2 param3)
    (var temp0)
    = temp0 0
    (if (> paramTotal 0)
        (send gEgo:loop(param1))
        (if (> paramTotal 1)
            (send gEgo:view(param2))
            (if (> paramTotal 2)
                = temp0 param3
            )
        )
    )
    (if (not temp0)
        = temp0 4
    )
    (send gEgo:
        normal(1)
        moveHead(1)
        setLoop(-1)
        setLoop(stopGroop)
        setPri(-1)
        setMotion(0)
        setCycle(StopWalk temp0)
        setStep(3 2)
        illegalBits(0)
        ignoreActors(0)
        moveSpeed((send global1:egoMoveSpeed))
        cycleSpeed((send global1:egoMoveSpeed))
    )
)


(procedure public (proc0_2)
    (var gIconBarCurIcon)
    (User:
        canControl(0)
        canInput(0)
    )
    (send gEgo:setMotion(0))
    = gIconBarCurIcon (send gIconBar:curIcon)
    (send gIconBar:disable(0 1 2 3 4 5 6 7))
    (send gIconBar:curIcon(gIconBarCurIcon))
    (if (not HaveMouse())
        = global192 (send ((User:curEvent)):x)
        = global193 (send ((User:curEvent)):y)
        (send global1:setCursor(global21 1 304 172))
    )(else
        (send global1:setCursor(global21 1))
    )
)


(procedure public (proc0_3)
    (User:
        canControl(1)
        canInput(1)
    )
    (send gIconBar:enable(0 1 2 3 4 5 6 7))
    (if (not HaveMouse())
        (send global1:setCursor((send ((send gIconBar:curIcon)):cursor) 1 global192 global193))
    )(else
        (send global1:setCursor((send ((send gIconBar:curIcon)):cursor)))
    )
)


(procedure public (proc0_4 param1)
    return >u MemoryInfo(1) param1
)


(procedure public (proc0_5 param1 param2)
    return 
        (if (& (send param1:onControl(1)) param2)
            return 1
        )(else
            0
        )
)


(procedure public (proc0_6 param1)
    return & global114[(/ param1 16)] (>> $8000 (% param1 16))
)


(procedure public (proc0_7 param1)
    (var temp0)
    = temp0 proc0_6(param1)
    = global114[(/ param1 16)] (| global114[(/ param1 16)] (>> $8000 (% param1 16)))
    return temp0
)


(procedure public (proc0_8 param1)
    (var temp0)
    = temp0 proc0_6(param1)
    = global114[(/ param1 16)] (& global114[(/ param1 16)] bnot (>> $8000 (% param1 16)))
    return temp0
)


(procedure public (proc0_9 param1)
    (var temp0)
    = temp0 0
    (if (paramTotal)
        = temp0 param1
    )(else
        = temp0 4
    )
    (send (= gEgoHead egoHead):
        init(gEgo)
        view(temp0)
        cycleSpeed(24)
    )
)


(procedure public (proc0_10 param1 param2)
    (if (> paramTotal 0)
        = global186 param1
        (if (proc999_5((send gEgo:view) 373 374 993))
            (if (== global186 0)
                = global186 7
            )
            (if (== global186 8)
                = global186 9
            )
        )
    )(else
        = global186 0
    )
    (if (> paramTotal 1)
        = global187 param2
    )(else
        = global187 0
    )
    (send global2:newRoom(900))
)


(procedure public (proc0_11 param1 param2)
    (if (not proc0_6(param1))
        (send global1:changeScore(param2))
        proc0_7(param1)
        (pointsSound:play())
    )
)


(procedure public (proc0_12 param1)
    (var temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8)
    return 
        (if (== paramTotal 1)
            Display(0 27 108 param1[0])
        )(else
            = temp4 (= temp5 -1)
            = temp0 0
            = temp1 68
            = temp2 69
            = temp3 320
            = temp6 global130
            = temp7 0
            = temp8 1
            (while (< temp8 paramTotal)
                (switch (param1[temp8])
                    (case 30
                        = temp0 param1[++temp8]
                    )
                    (case 33
                        = temp2 (+ (= temp1 param1[++temp8]) 1)
                    )
                    (case 70
                        = temp3 param1[++temp8]
                    )
                    (case 67
                        = temp4 param1[++temp8]
                        = temp5 param1[++temp8]
                    )
                    (case 28
                        = temp6 param1[++temp8]
                    )
                    (case 29
                        = temp7 param1[++temp8]
                    )
                )
                ++temp8
            )
            = temp8 Display(param1[0] 100 temp4 temp5 102 temp7 106 temp3 101 temp0 105 temp2 107)
            Display(param1[0] 100 temp4 temp5 102 temp6 106 temp3 101 temp0 105 temp1)
            return temp8
        )
)


(procedure public (proc0_13 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
        )
    )
    (send param1:setHeading((= temp0 GetAngle((send param1:x) (send param1:y) temp1 temp2)) 
        (if (IsObject(temp3))
            temp3
        )(else
            0
        )
))
)


(procedure public (proc0_14 param1)
    (var temp0, temp1[25], temp26[100], temp126[4], temp130, temp131[65280])
    (if (<> param1 -1)
        = global188 param1
    )
    StrCpy(@temp1 "Space Quest ")
    (switch (global188)
        (case 1
            StrCat(@temp1 " - The Sarien Encounter")
        )
        (case 3
            StrCat(@temp1 " - The Pirates of Pestulon")
        )
        (case 4
            StrCat(@temp1 " - Roger Wilco and The Time Rippers")
        )
        (case 10
            StrCat(@temp1 " - Latex Babes of Estros")
        )
        (case 12
            StrCat(@temp1 " - Vohaul's Revenge ")
            = temp0 global148
        )
    )
    TextSize(@temp126 @temp1 0 -1)
    StrCpy(@temp26 "")
    = temp130 (/ (- 326 (- temp126[3] temp126[1])) 2)
    (while (> temp130 0)
        StrCat(@temp26 "")
        --temp130
    )
    StrCat(@temp26 @temp1)
    DrawStatus(@temp26 0 proc0_18(global158 global155))
)


(procedure public (proc0_15 param1 param2)
    return 
        (if (== (send param1:onControl()) param2)
            return 1
        )(else
            0
        )
)


(procedure public (proc0_16)
    (var newList, temp1[2], temp3, UserCurEvent, temp5, temp6[5])
    = temp3 (send global1:setCursor(69 1))
    (redX:
        x((send (= UserCurEvent (User:curEvent)):x))
        y(+ 300 (send UserCurEvent:y))
        z(300)
        show()
    )
    (send (= newList (List:new())):add(redX))
    Animate((send newList:elements) 1)
    Animate((send global5:elements) 0)
    = temp5 GetTime()
    (while (not (< Abs((- temp5 GetTime())) 40) or proc999_5((send ((= UserCurEvent (Event:new()))):type) 4 1))
    )
    (if (IsObject(UserCurEvent))
        (send UserCurEvent:dispose())
    )
    (redX:
        hide()
        posn(1000 64536)
    )
    Animate((send newList:elements) 1)
    (send newList:
        delete(redX)
        dispose()
    )
    (send global1:setCursor(temp3))
)


(procedure public (proc0_17 param1 param2 param3 param4)
    (var temp0[500])
    (if (<u param2 1000)
        GetFarText(param2 param3 @temp0)
    )(else
        StrCpy(@temp0 param2)
    )
    (babbleIcon:
        view(param1)
        cycleSpeed(* (+ global101 1) 4)
    )
    (if (<u param2 1000)
        Print(@temp0 rest 82 babbleIcon 0 0)
    )(else
        Print(@temp0 param3 rest 82 babbleIcon 0 0)
    )
)


(procedure public (proc0_18 param1 param2)
    (if (< param1 0)
        = param1 0
    )
    (if (> param1 255)
        = param1 255
    )
    (if (< param2 0)
        = param2 0
    )
    (if (> param2 15)
        = param2 15
    )
    return 
        (if (proc0_6(21))
            param1
        )(else
            param2
        )
)


(instance ego of SQEgo
    (properties
        description "Roger Wilco"
        sightAngle 180
        lookStr "It's you. Roger Wilco, space guy."
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 4
                Print("You talk to yourself but are stumped for a reply.")
            )
            (case 2
                Print("Hey! Keep your hands off yourself!   This is a family game.")
            )
            (case 10
                Print("I'll bet you wish you could!")
            )
            (case 11
                Print("Ahhh!  The aroma of several adventure games emanates from your person.")
            )
            (case 3
                (switch (param2)
                    (case 12
                        Print("You slide the pre-smoked tobacco tube in your mouth and, after noticing a hint of grease and cruel breath, decide you'll save it for a special occasion.")
                    )
                    (default 
                        proc0_16()
                    )
                )
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance egoHead of Head
    (properties
        description "Roger Wilco"
        lookStr "Roger Wilco, space guy."
        view 4
    )

    (method (doVerb param1 param2)
        (send gEgo:doVerb(param1 param2))
    )

)
(instance longSong of Sound
    (properties
        number 1
    )
)
(instance longSong2 of Sound
    (properties
        number 1
    )
)
(instance pointsSound of Sound
    (properties
        number 888
        priority 15
        flags 1
    )
)
(instance stopGroop of Grooper
    (properties)

    (method (doit param1)
        (if (IsObject((send gEgo:cycler)) and (send ((send gEgo:cycler)):isKindOf(StopWalk)))
            (send gEgo:view((send ((send gEgo:cycler)):vWalking)))
        )
        (super:doit(rest param1))
    )

)
(instance babbleIcon of DCIcon
    (properties)

    (method (init)
        (send (= cycler (RandCycle:new())):init(self 20))
    )

)
(instance sq4KeyDownHandler of EventHandler
    (properties)
)
(instance sq4MouseDownHandler of EventHandler
    (properties)
)
(instance sq4DirectionHandler of EventHandler
    (properties)
)
(instance public sq4 of Game
    (properties)

    (method (init)
        (var temp0)
        = gSq4Win sq4Win
        proc802_0()
        = gStopGroop stopGroop
        = global34 1
        (super:init())
        StrCpy(@global42 "")
        = gSq4DoVerbCode sq4DoVerbCode
        = gSq4FtrInit sq4FtrInit
        (send (= gSq4KeyDownHandler sq4KeyDownHandler):add())
        (send (= gSq4MouseDownHandler sq4MouseDownHandler):add())
        (send (= gSq4DirectionHandler sq4DirectionHandler):add())
        = gPseudoMouse PseudoMouse
        (self:
            egoMoveSpeed(0)
            setCursor(global19 1 304 172)
        )
        (send (= gEgo ego):
            _head(= gEgoHead egoHead)
            moveSpeed((self:egoMoveSpeed))
            cycleSpeed((self:egoMoveSpeed))
        )
        (send ((send gEgo:_head)):client(gEgo))
        (User:
            alterEgo(gEgo)
            verbMessager(0)
            canControl(0)
            canInput(0)
        )
        (send (= gLongSong longSong):
            owner(self)
            init()
        )
        (send (= gLongSong2 longSong2):
            owner(self)
            init()
        )
        = global21 997
        = global16 315
        = global22 4
        = gLOOKUP_ERROR LOOKUP_ERROR
        = global106 DoSound(3)
        (if ((>= (= global105 Graph(2)) 2) and (<= global105 16))
            proc0_8(21)
        )(else
            proc0_7(21)
        )
        (sq4Win:
            color(0)
            back(proc0_18(global158 global155))
            topBordColor(global130)
            lftBordColor(proc0_18(global161 global130))
            rgtBordColor(proc0_18(global157 global156))
            botBordColor(global156)
        )
        (gcWin:
            color(0)
            back(proc0_18(global158 global155))
            topBordColor(global130)
            lftBordColor(proc0_18(global161 global130))
            rgtBordColor(proc0_18(global157 global156))
            botBordColor(global156)
        )
        (invWin:
            color(0)
            back(proc0_18(global156 global155))
            topBordColor(proc0_18(global158 global130))
            lftBordColor(proc0_18(global157 global130))
            rgtBordColor(proc0_18(global155 global156))
            botBordColor(proc0_18(global129 global156))
            insideColor(proc0_18(global155 global156))
            topBordColor2(global129)
            lftBordColor2(global129)
            botBordColor2(proc0_18(global158 global130))
            rgtBordColor2(proc0_18(global161 global130))
        )
        (send (= gIconBar IconBar):
            add(icon0 icon1 icon2 icon3 icon6 icon7 icon4 icon5 icon8 icon9)
            eachElementDo(102)
            eachElementDo(182 0)
            eachElementDo(183 proc0_18(global158 global155))
            curIcon(icon0)
            useIconItem(icon4)
            helpIconItem(icon9)
            disable()
        )
        (icon5:message(
            (if (HaveMouse())
                3840
            )(else
                9
            )
))
        (Inv:
            init()
            add(buckazoid rope bomb rabbit battery jar {paper with gum} {oxygen tank} hintbook pen atmCard plug cigar matches diskette {laptop computer} invLook invHand invSelect invHelp ok)
            eachElementDo(182 0)
            eachElementDo(183 global155)
            eachElementDo(102)
            window(invWin)
            helpIconItem(invHelp)
            selectIcon(invSelect)
            okButton(ok)
        )
        (GameControls:
            window(gcWin)
            add(iconOk (detailSlider:
                    theObj(self)
                    selector(340)
                    topValue(3)
                    bottomValue(0)
                    yourself()
                )
 (volumeSlider:
                    theObj(self)
                    selector(350)
                    topValue(
                        (if (> global106 1)
                            15
                        )(else
                            1
                        )
)
                    bottomValue(0)
                    yourself()
                )
 (speedSlider:
                    theObj(self)
                    selector(346)
                    topValue(1)
                    bottomValue(15)
                    yourself()
                )
 (iconSave:
                    theObj(self)
                    selector(78)
                    yourself()
                )
 (iconRestore:
                    theObj(self)
                    selector(79)
                    yourself()
                )
 (iconRestart:
                    theObj(self)
                    selector(344)
                    yourself()
                )
 (iconQuit:
                    theObj(self)
                    selector(349)
                    yourself()
                )
 (iconAbout:
                    theObj(ScriptID(811 0))
                    selector(60)
                    yourself()
                )
 iconHelp)
            eachElementDo(182 0)
            eachElementDo(183 proc0_18(global157 global156))
            helpIconItem(iconHelp)
            curIcon(iconRestore)
        )
        (buckazoid:owner(gEgo))
        = global107 
            (if (GameIsRestarting())
                60
            )(else
                1
            )
        (self:newRoom(803))
    )


    (method (doit)
        (super:doit())
        (if (not proc999_5(global11 803 1 6 9 10 15 16 17 19 20 21 59 119 120 150 321 329 330 335 340 345 350 355 371 398 500 505 510 514 515 520 525 531 541 615))
            (send (ScriptID(808 0)):doit())
        )
    )


    (method (replay)
        proc0_14(-1)
        Palette(4 0 255 100)
        (super:replay())
    )


    (method (newRoom param1)
        (if (== (send ((send global9:at(12))):state) 1)
            Print("The cigar goes, as cigars often do, out.")
            (send ((send global9:at(12))):state(0))
        )
        (super:newRoom(rest param1))
    )


    (method (startRoom param1)
        (if (gPseudoMouse)
            (send gPseudoMouse:stop())
        )
        (send (ScriptID(801)):doit(param1))
        (if (global14)
            SetDebug()
        )
        (if (proc999_5(param1 370 371 375 376 380 381 385 386 387 390 391 395 397 398 399 400 405 406 410 411))
            RegionPath
            ScriptID(700)
            = global102 700
            (if (proc999_5(param1 405 406 410 411))
                ScriptID(809)
            )
        )(else
            (if (proc999_5(param1 25 30 35 40 45 50 55 60 65))
                RegionPath
                ScriptID(701)
                = global102 701
                (if (proc999_5(param1 25 30 35 40 45 50 55 60 65))
                    ScriptID(705)
                )
            )(else
                (if (proc999_5(param1 75 80 85 90 95 100 105 110 115))
                    ScriptID(702)
                )(else
                    (if (proc999_5(param1 609 610 611 612 613 614 615 620))
                        ScriptID(706)
                    )(else
                        (if (proc999_5(param1 299 300 305 306 310 315 320 298))
                            ScriptID(703)
                        )(else
                            (if (proc999_5(param1 150 500 505 510 514 515 520 525 541 544 545))
                                RegionPath
                                ScriptID(704)
                                = global102 704
                            )(else
                                (if (proc999_5(param1 1 6 9 10 15 16 17 19 20 21))
                                    ScriptID(707)
                                )(else
                                    (if (proc999_5(param1 530 535 540))
                                        ScriptID(709)
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
        (if (not proc999_5(param1 803 1 6 9 10 15 16 17 19 20 21 59 119 120 150 321 329 330 335 340 345 350 355 371 398 500 505 510 514 515 520 525 531 541 615))
            ScriptID(808)
        )
        ScriptID(982)
        (super:startRoom(param1))
        (if ((send global5:contains(gEgo)))
            (if (((send gEgo:normal) and not proc999_5(param1 405 406 410 411)) and not (send ((send gEgo:cycler)):isKindOf(StopWalk)))
                (send gEgo:setCycle(StopWalk 4))
            )
            (if (not (send gEgo:looper))
                (send gEgo:setLoop(stopGroop))
            )
            proc0_9((egoHead:view))
        )
        (redX:
            init()
            hide()
            setPri(15)
            posn(1000 64536)
        )
    )


    (method (restart)
        (babbleIcon:
            view(946)
            cycleSpeed(* (+ global101 1) 4)
        )
        (if (Print("\"Are you sure you want to restart?\""))
            (super:restart())
        )
    )


    (method (handleEvent pEvent)
        (super:handleEvent(pEvent))
        (if ((send pEvent:claimed))
            return 1
        )
        return 
            (switch ((send pEvent:type))
                (case 4
                    (switch ((send pEvent:message))
                        (case 9
                            (if (not & (icon5:signal) $0004)
                                (Inv:showSelf(gEgo))
                            )
                        )
                        (case 3840
                            (if (not & (icon5:signal) $0004)
                                (Inv:showSelf(gEgo))
                            )
                        )
                        (case 17
                            (send global1:quitGame())
                            (send pEvent:claimed(1))
                        )
                        (case 15360
                            (if ((send global1:masterVolume()))
                                (send global1:masterVolume(0))
                            )(else
                                (if (> global106 1)
                                    (send global1:masterVolume(15))
                                )(else
                                    (send global1:masterVolume(1))
                                )
                            )
                            (send pEvent:claimed(1))
                        )
                        (case 16128
                            (send global1:save())
                            (send pEvent:claimed(1))
                        )
                        (case 16640
                            (send global1:restore())
                            (send pEvent:claimed(1))
                        )
                        (case 17152
                            (send global1:restart())
                            (send pEvent:claimed(1))
                        )
                    )
                )
            )
    )


    (method (quitGame)
        (babbleIcon:
            view(946)
            cycleSpeed(* (+ global101 1) 4)
        )
        (super:quitGame(Print("\"See ya on the chronostream, Time Jockey!\"")))
    )


    (method (pragmaFail)
        (if ((User:canInput()))
            proc0_16()
        )
    )

)
(instance ok of IconI
    (properties)

    (method (init)
        (self:
            highlightColor(0)
            lowlightColor(proc0_18(global158 global155))
        )
        (super:init())
    )

)
(instance invLook of IconI
    (properties)

    (method (init)
        (self:
            highlightColor(0)
            lowlightColor(proc0_18(global158 global155))
        )
        (super:init())
    )

)
(instance invHand of IconI
    (properties)

    (method (init)
        (self:
            highlightColor(0)
            lowlightColor(proc0_18(global158 global155))
        )
        (super:init())
    )

)
(instance invHelp of IconI
    (properties)

    (method (init)
        (self:
            highlightColor(0)
            lowlightColor(proc0_18(global158 global155))
        )
        (super:init())
    )

)
(instance invSelect of IconI
    (properties)

    (method (init)
        (self:
            highlightColor(0)
            lowlightColor(proc0_18(global158 global155))
        )
        (super:init())
    )

)
(instance buckazoid of InvI
    (properties
        view 700
        cursor 1
        signal 2
    )

    (method (doVerb param1)
        (switch (param1)
            (case 1
                proc255_4(0 8 global159 
                    (if (== global159 1)
                        "."
                    )(else
                        "s."
                    )
)
            )
        )
    )

)
(instance jar of InvI
    (properties
        view 700
        cel 1
        cursor 15
        signal 2
        description "glass jar"
        owner 70
    )

    (method (doVerb param1)
        (switch (param1)
            (case 1
                (if (== cel 2)
                    Print("You have a jar of green acid.")
                )(else
                    Print("You have an empty jar.")
                )
            )
        )
    )

)
(instance hintbook of InvI
    (properties
        view 700
        cel 4
        cursor 18
        signal 2
        description "An SQ 4 hintbook."
    )

    (method (doVerb param1)
        (switch (param1)
            (case 2
                (if ((send global2:script))
                    Print("You're far too busy for that now.")
                )(else
                    (if (proc999_5(global11 397 398) and not proc0_6(31))
                        Print("Hey! This isn't a free hint service.  You need to pay for it before you read it!")
                    )(else
                        (if (not proc0_4(6800))
                            Print("Sorry, you don't have enough memory to view the hint book.")
                        )(else
                            (Inv:
                                curIcon((send global9:at(9)))
                                hide()
                            )
                            (send global2:setScript(ScriptID(708 0)))
                        )
                    )
                )
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance pen of InvI
    (properties
        view 700
        cel 5
        cursor 8
        signal 2
        description "Yes, it's a Reveal-O-matic electric hint revealer."
    )
)
(instance atmCard of InvI
    (properties
        view 700
        cel 6
        cursor 2
        signal 2
        description "An AutoBucks Teller Machine card."
    )
)
(instance plug of InvI
    (properties
        view 700
        cel 7
        cursor 5
        signal 2
        description "A PocketPal adaptor plug."
    )
)
(instance cigar of InvI
    (properties
        view 700
        cel 8
        cursor 3
        signal 2
        description "An obviously used stogie."
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 3
                (if (<> param2 13)
                    0
                )(else
                    (if (state)
                        Print("The horrid-smelling smoke eminating from its tip would indicate that the cigar is already lit.")
                    )(else
                        Print("You slide the conveniently pre-moistened stogie between your lips, apply fire via a match, and proceed to nearly hack up a lung.")
                        = state 1
                    )
                )
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance matches of InvI
    (properties
        view 700
        cel 9
        cursor 4
        signal 2
        description "A book of matches."
    )
)
(instance diskette of InvI
    (properties
        view 700
        cel 10
        cursor 11
        signal 2
    )

    (method (doVerb param1)
        (switch (param1)
            (case 1
                Print("The label on the diskette reads:\n\n     Roger Jr.\n     Brain Tools\n     Stunt Flyer")
            )
        )
    )

)
(instance rabbit of InvI
    (properties
        view 700
        cel 11
        cursor 9
        signal 2
        description "cute bunny"
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 1
                (if (<> view 700)
                    (Inv:hide())
                    (self:
                        view(700)
                        loop(0)
                        cel(11)
                    )
                    (Inv:show(gEgo))
                )(else
                    (if (not (send ((send global9:at(4))):owner))
                        (Inv:hide())
                        (self:
                            view(701)
                            loop(0)
                            cel(0)
                        )
                        (Inv:show(gEgo))
                    )(else
                        Print("A darn cute bunny.")
                    )
                )
            )
            (case 2
                (if (== view 700)
                    0
                )(else
                    proc0_11(67 3)
                    Print("You extract the portable power pellet from the rear confines of the hare's polyplastoid torso.")
                    (Inv:hide())
                    (send gEgo:get(4))
                    (self:
                        view(700)
                        loop(0)
                        cel(11)
                    )
                    (Inv:show(gEgo))
                )
            )
            (case 3
                (switch (param2)
                    (case 4
                        Print("You clumsily insert the battery into the furry burrow inhabitant's hollow trunk.")
                        (Inv:hide())
                        (send gEgo:put(4 0))
                        (Inv:
                            curIcon(0)
                            show(gEgo)
                        )
                    )
                )
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance battery of InvI
    (properties
        view 700
        cel 12
        cursor 13
        signal 2
        description "A battery."
    )
)
(instance {oxygen tank} of InvI
    (properties
        view 700
        cel 13
        cursor 12
        signal 2
        description "An oxygen tank."
        owner 335
    )
)
(instance rope of InvI
    (properties
        view 700
        cel 14
        cursor 10
        signal 2
        description "A crummy piece of rope."
        owner 65
    )
)
(instance {laptop computer} of InvI
    (properties
        view 700
        cel 15
        cursor 17
        signal 2
        description "A handy Dandy PocketPal portable terminal."
        owner 55
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 1
                (if (<> view 700)
                    (Inv:hide())
                    (self:
                        view(700)
                        loop(0)
                        cel(15)
                    )
                    (Inv:show(gEgo))
                )(else
                    (if (== (send ((send global9:at(4))):owner) 1)
                        Print("Your PocketPal now has power. Now all you need is a place to use it.")
                    )(else
                        (Inv:hide())
                        (self:
                            view(701)
                            loop(0)
                            cel(1)
                        )
                        (Inv:show(gEgo))
                    )
                )
            )
            (case 2
                (if (== (send ((send global9:at(4))):owner) 1)
                    Print("You liberate the battery from the PocketPal.")
                    (Inv:hide())
                    (send gEgo:get(4))
                    (Inv:show(gEgo))
                )(else
                    Print("This is just a dumb terminal. It won't do anything by itself.")
                )
            )
            (case 3
                (switch (param2)
                    (case 4
                        proc0_11(72 3)
                        Print("You plug the mobile power cylinder into the laptop.")
                        (Inv:hide())
                        (self:
                            view(700)
                            loop(0)
                            cel(15)
                        )
                        (send gEgo:put(4 1))
                        (Inv:
                            curIcon(0)
                            show(gEgo)
                        )
                    )
                    (case 11
                        proc0_11(71 3)
                        Print("You attach the plug to the PocketPal.")
                        (Inv:hide())
                        (send gEgo:put(11 1))
                        (Inv:
                            curIcon(0)
                            show(gEgo)
                        )
                    )
                )
            )
        )
    )

)
(instance {paper with gum} of InvI
    (properties
        view 700
        loop 2
        cursor 21
        signal 2
        description "Paper-wrapped gum - a Pinedale dining delight."
        owner 297
    )

    (method (doVerb param1)
        (switch (param1)
            (case 1
                (if (cel)
                    Print("These symbols look vaguely familiar. Now, where have you seen them?")
                )(else
                    Print("Ummm! This lumpy paper-wrapped wad looks mighty interesting.")
                )
            )
            (case 2
                (if (not cel)
                    (Inv:hide())
                    (self:
                        view(700)
                        loop(2)
                        cel(1)
                    )
                    (Inv:show(gEgo))
                )
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance bomb of InvI
    (properties
        view 700
        cel 3
        cursor 22
        signal 2
        description "A piece of unstable ordnance."
        owner 40
    )
)
(instance redX of View
    (properties
        view 942
    )
)
(instance icon0 of IconI
    (properties)
)
(instance icon1 of IconI
    (properties)
)
(instance icon2 of IconI
    (properties)
)
(instance icon3 of IconI
    (properties)
)
(instance icon4 of IconI
    (properties)
)
(instance icon5 of IconI
    (properties)

    (method (select)
        (if ((super:select()))
            (Inv:showSelf(gEgo))
        )
    )

)
(instance icon6 of IconI
    (properties)
)
(instance icon7 of IconI
    (properties)
)
(instance icon8 of IconI
    (properties)

    (method (select)
        (if ((super:select()))
            (send gIconBar:hide())
            (GameControls:show())
        )
    )

)
(instance icon9 of IconI
    (properties)
)
(instance sq4DoVerbCode of Code
    (properties)

    (method (doit param1 param2)
        (var temp0)
        = temp0 (send param2:description)
        (switch (param1)
            (case 1
                (if ((send param2:facingMe(gEgo)))
                    (if ((send param2:lookStr))
                        Print((send param2:lookStr))
                    )(else
                        proc0_16()
                    )
                )
            )
            (default 
                proc0_16()
            )
        )
    )

)
(instance sq4FtrInit of Code
    (properties)

    (method (doit param1)
        (if (== (send param1:sightAngle) 26505)
            (send param1:sightAngle(90))
        )
        (if (== (send param1:actions) 26505)
            (send param1:actions(0))
        )
    )

)
(instance sq4Win of BorderWindow
    (properties)
)
(instance invWin of InsetWindow
    (properties)
)
(instance gcWin of BorderWindow
    (properties)

    (method (open)
        (var temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9, temp10, temp11, temp12, temp13, temp14[15], temp29[4])
        (self:
            top(/ (- 200 (+ CelHigh(947 1 1) 6)) 2)
            left(/ (- 320 (+ 151 CelWide(947 0 1))) 2)
            bottom(+ (+ CelHigh(947 1 1) 6) (/ (- 200 (+ CelHigh(947 1 1) 6)) 2))
            right(+ (+ 151 CelWide(947 0 1)) (/ (- 320 (+ 151 CelWide(947 0 1))) 2))
            priority(15)
        )
        (super:open())
        DrawCel(947 0 5 + (/ (- (- (+ 151 CelWide(947 0 1)) (+ 4 CelWide(947 1 1))) CelWide(947 0 5)) 2) (+ 4 CelWide(947 1 1)) 6 15)
        DrawCel(947 1 1 4 3 15)
        DrawCel(947 1 0 94 38 15)
        DrawCel(947 1 0 135 38 15)
        DrawCel(947 0 4 63 - 37 (+ CelHigh(947 0 4) 3) 15)
        DrawCel(947 0 3 101 - 37 (+ CelHigh(947 0 4) 3) 15)
        DrawCel(947 0 2 146 - 37 (+ CelHigh(947 0 4) 3) 15)
        = temp5 (+ (= temp2 (+ 46 CelHigh(947 0 1))) 13)
        = temp4 (+ (= temp3 (+ 10 CelWide(947 1 1))) (- (+ 151 CelWide(947 0 1)) (+ (+ 10 CelWide(947 1 1)) 6)))
        = temp12 15
        = temp6 0
        = temp8 global156
        = temp11 proc0_18(global157 global156)
        = temp10 proc0_18(global161 global130)
        = temp9 global130
        = temp1 3
        = temp7 3
        Graph(11 temp2 temp3 + temp5 1 + temp4 1 temp7 temp6 temp12)
        = temp2 (- temp2 temp1)
        = temp3 (- temp3 temp1)
        = temp4 (+ temp4 temp1)
        = temp5 (+ temp5 temp1)
        Graph(11 temp2 temp3 + temp2 temp1 temp4 temp7 temp8 temp12)
        Graph(11 - temp5 temp1 temp3 temp5 temp4 temp7 temp9 temp12)
        = temp13 0
        (while (< temp13 temp1)
            Graph(4 + temp2 temp13 + temp3 temp13 - temp5 (+ temp13 1) + temp3 temp13 temp11 temp12)
            Graph(4 + temp2 temp13 - temp4 (+ temp13 1) - temp5 (+ temp13 1) - temp4 (+ temp13 1) temp10 temp12)
            ++temp13
        )
        Graph(12 temp2 temp3 + temp5 1 + temp4 1 1)
        Format(@temp14 0 28 global15 global16)
        TextSize(@temp29 @temp14 999 0)
        Display(@temp14 105 999 102 proc0_18(global161 global130) 100 + (+ 10 CelWide(947 1 1)) (/ (- (- (+ 151 CelWide(947 0 1)) (+ (+ 10 CelWide(947 1 1)) 6)) temp29[3]) 2) + (+ 46 CelHigh(947 0 1)) 3)
    )

)
(instance detailSlider of Slider
    (properties
        view 947
        loop 0
        cel 1
        nsLeft 67
        nsTop 37
        signal 128
        helpStr "Raises and lowers the level of graphics detail."
        sliderView 947
        topValue 3
    )
)
(instance volumeSlider of Slider
    (properties
        view 947
        loop 0
        cel 1
        nsLeft 107
        nsTop 37
        signal 128
        helpStr "Adjusts sound volume."
        sliderView 947
        topValue 15
    )
)
(instance speedSlider of Slider
    (properties
        view 947
        loop 0
        cel 1
        nsLeft 147
        nsTop 37
        signal 128
        helpStr "Adjusts the speed of the game's animation (within the limits of your computer's capability)."
        sliderView 947
        bottomValue 15
    )
)
(instance iconSave of ControlIcon
    (properties
        view 947
        loop 2
        cel 0
        nsLeft 8
        nsTop 6
        message 9
        signal 387
        helpStr "Saves your current game."
    )
)
(instance iconRestore of ControlIcon
    (properties
        view 947
        loop 3
        cel 0
        nsLeft 8
        nsTop 26
        message 9
        signal 387
        helpStr "Restores a previously saved game."
    )
)
(instance iconRestart of ControlIcon
    (properties
        view 947
        loop 4
        cel 0
        nsLeft 8
        nsTop 46
        message 9
        signal 387
        helpStr "Restarts the Game."
    )
)
(instance iconQuit of ControlIcon
    (properties
        view 947
        loop 5
        cel 0
        nsLeft 8
        nsTop 66
        message 9
        signal 451
        helpStr "Exits the game."
    )
)
(instance iconAbout of ControlIcon
    (properties
        view 947
        loop 6
        cel 0
        nsLeft 8
        nsTop 86
        message 9
        signal 451
        helpStr "Information about the game."
    )
)
(instance iconHelp of IconI
    (properties)
)
(instance iconOk of IconI
    (properties)
)
