(include "sci.sh")
(use "Main")
(use "FloatObj")
(use "Blink")
(use "CueObj")
(use "n958")
(use "Rev")
(use "Sound")
(use "Cycle")
(use "Sounds")
(use "View")
(use "Obj")
(script 801)


(local
    local0
    local1
    local2
    local3
    local4
    local5
    local6 = 1
    local7
    local8
    local9
    local10
    local11
    local12[4]
    local27_2 = 65535
    local28_2
    local26_3
    local27_3
    local28_3
    local26
    local27_4
    local28_4[3]
    local26
    local27
    local28[50]
    local78[9] = (4 5 6 7 8 9 10 11 12 )

)
(procedure (localproc_027c)
    (send gSQ5:handsOn())
    (send gSq5IconBar:disable(0 3 4 5 6))
)


(procedure (localproc_0297)
    (send gSq5Music2:fade(0 10 5 1))
    = local26 0
    (if (local9 or local10)
        = local9 0
        = local10 0
    )(else
        return 
    )
)


(procedure (localproc_02be param1)
    (var temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7)
    (asm
        lsl     local2
        lsp     param1
        ldi     2
        mul     
        add     
        sal     local2
        push    
        ldi     0
        lt?     
        bnt     code_02d5
        ldi     3599
        sal     local2
code_02d5:lsl     local2
        ldi     3599
        gt?     
        bnt     code_02e1
        ldi     0
        sal     local2
code_02e1:ldi     0
        sat     temp0
code_02e5:lst     temp0
        pushi   #size
        pushi   0
        lag     gCast
        send    4
        lt?     
        bnt     code_05db
        pushi   #isKindOf
        pushi   1
        class   FloatObj
        push    
        pushi   #at
        pushi   1
        lst     temp0
        lag     gCast
        send    6
        sat     temp1
        send    6
        bnt     code_05d6
        lst     temp1
        lofsa   cliffy
        eq?     
        bnt     code_0316
        pushi   1
        pushi   87
        callb   proc0_1, 2
code_0316:not     
        bnt     code_05d6
        lal     local4
        sat     temp5
        lal     local5
        sat     temp6
        pushi   #d3x
        pushi   0
        lat     temp1
        send    4
        push    
        lat     temp5
        sub     
        sat     temp3
        pushi   #d3y
        pushi   0
        lat     temp1
        send    4
        push    
        lat     temp6
        sub     
        sat     temp4
        pushi   180
        pushi   4
        lst     temp5
        lst     temp6
        lst     temp3
        push    
        callk   GetAngle, 8
        sub     
        sat     temp2
        push    
        ldi     0
        lt?     
        bnt     code_035e
        lst     temp2
        ldi     360
        add     
        sat     temp2
code_035e:pushi   450
        lat     temp2
        sub     
        sat     temp2
        push    
        ldi     359
        gt?     
        bnt     code_0375
        lst     temp2
        ldi     360
        sub     
        sat     temp2
code_0375:lst     temp2
        lsl     local2
        ldi     10
        div     
        sub     
        sat     temp2
        push    
        ldi     0
        lt?     
        bnt     code_038d
        pushi   360
        lat     temp2
        add     
        sat     temp2
code_038d:lst     temp2
        ldi     359
        gt?     
        bnt     code_039d
        lst     temp2
        ldi     360
        sub     
        sat     temp2
code_039d:pushi   4
        lst     temp5
        lst     temp6
        lst     temp3
        lst     temp4
        callk   GetDistance, 8
        sat     temp7
        pushi   301
        pushi   0
        pushi   #x
        pushi   1
        pushi   160
        pushi   2
        lst     temp2
        push    
        callk   SinMult, 4
        push    
        ldi     4
        mul     
        add     
        push    
        lat     temp1
        send    10
        lst     temp1
        dup     
        lofsa   cliffy
        eq?     
        bnt     code_0442
        pushi   1
        pushi   87
        callb   proc0_1, 2
        bnt     code_03e9
        pushi   #x
        pushi   1
        pushi   158
        pushi   0
        pushi   1
        pushi   120
        lofsa   cliffyBlip
        send    12
        jmp     code_04a0
code_03e9:pushi   1
        pushi   1
        pushi   158
        pushi   2
        lst     temp2
        lst     temp7
        callk   SinMult, 4
        push    
        ldi     20
        div     
        add     
        push    
        pushi   0
        pushi   1
        pushi   120
        pushi   2
        lst     temp2
        lst     temp7
        callk   CosMult, 4
        push    
        ldi     20
        div     
        sub     
        push    
        lofsa   cliffyBlip
        send    12
        pushi   5
        pushi   136
        pushi   100
        pushi   180
        pushi   130
        lofsa   cliffyBlip
        push    
        calle   proc999_4, 10
        not     
        bnt     code_0437
        pushi   #hide
        pushi   0
        lofsa   cliffyBlip
        send    4
        jmp     code_04a0
code_0437:pushi   #show
        pushi   0
        lofsa   cliffyBlip
        send    4
        jmp     code_04a0
code_0442:dup     
        lofsa   yourShip
        eq?     
        bnt     code_04a0
        pushi   1
        pushi   1
        pushi   158
        pushi   2
        lst     temp2
        lst     temp7
        callk   SinMult, 4
        push    
        ldi     20
        div     
        add     
        push    
        pushi   0
        pushi   1
        pushi   120
        pushi   2
        lst     temp2
        lst     temp7
        callk   CosMult, 4
        push    
        ldi     20
        div     
        sub     
        push    
        lofsa   shipBlip
        send    12
        pushi   5
        pushi   136
        pushi   100
        pushi   180
        pushi   130
        lofsa   shipBlip
        push    
        calle   proc999_4, 10
        not     
        bnt     code_0497
        pushi   #hide
        pushi   0
        lofsa   shipBlip
        send    4
        jmp     code_04a0
code_0497:pushi   #show
        pushi   0
        lofsa   shipBlip
        send    4
code_04a0:toss    
        pushi   90
        lat     temp2
        lt?     
        bnt     code_04de
        pprev   
        ldi     270
        lt?     
        bnt     code_04de
        pushi   #isNotHidden
        pushi   0
        lat     temp1
        send    4
        bnt     code_0580
        pushi   #hide
        pushi   0
        lat     temp1
        send    4
        lst     temp1
        lofsa   cliffy
        eq?     
        bnt     code_0580
        lal     local21
        bnt     code_0580
        ldi     0
        sal     local21
        pushi   #dispose
        pushi   0
        lofsa   target
        send    4
        jmp     code_0580
code_04de:pushi   #isNotHidden
        pushi   0
        lat     temp1
        send    4
        not     
        bnt     code_04f1
        pushi   #show
        pushi   0
        lat     temp1
        send    4
code_04f1:lst     temp1
        dup     
        lofsa   cliffy
        eq?     
        bnt     code_0557
        pushi   4
        lst     temp5
        lst     temp6
        lst     temp3
        lst     temp4
        callk   GetDistance, 8
        push    
        ldi     60
        lt?     
        bnt     code_0541
        pushi   200
        pushi   #x
        pushi   0
        lofsa   cliffy
        send    4
        le?     
        bnt     code_0541
        pprev   
        ldi     210
        le?     
        bnt     code_0541
        ldi     1
        sal     local18
        pushi   1
        pushi   87
        callb   proc0_1, 2
        not     
        bnt     code_057f
        lal     local21
        not     
        bnt     code_057f
        ldi     1
        sal     local21
        pushi   #init
        pushi   0
        lofsa   target
        send    4
        jmp     code_057f
code_0541:ldi     0
        sal     local18
        lal     local21
        bnt     code_057f
        ldi     0
        sal     local21
        pushi   #dispose
        pushi   0
        lofsa   target
        send    4
        jmp     code_057f
code_0557:dup     
        lofsa   yourShip
        eq?     
        bnt     code_057f
        pushi   4
        lst     temp5
        lst     temp6
        lst     temp3
        lst     temp4
        callk   GetDistance, 8
        push    
        ldi     60
        lt?     
        bnt     code_0577
        ldi     1
        sal     local19
        jmp     code_057f
code_0577:ldi     0
        sal     local19
        ldi     0
        sal     local20
code_057f:toss    
code_0580:pushi   220
        pushi   4
        lst     temp5
        lst     temp6
        lst     temp3
        lst     temp4
        callk   GetDistance, 8
        sub     
        sat     temp2
        push    
        ldi     1
        lt?     
        bnt     code_059d
        ldi     1
        sat     temp2
code_059d:lst     temp2
        ldi     200
        gt?     
        bnt     code_05aa
        ldi     200
        sat     temp2
code_05aa:lst     temp1
        lofsa   cliffy
        eq?     
        bnt     code_05bf
        lst     temp2
        ldi     128
        gt?     
        bnt     code_05bf
        ldi     128
        sat     temp2
code_05bf:pushi   104
        pushi   #x
        lst     temp2
        pushi   105
        pushi   1
        lst     temp2
        pushi   63
        pushi   1
        lst     temp2
        ldi     44
        div     
        push    
        lat     temp1
        send    18
code_05d6:+at     temp0
        jmp     code_02e5
code_05db:pushi   #client
        pushi   0
        lofsa   updateThrust
        send    4
        bnt     code_05ee
        pushi   #cue
        pushi   0
        lofsa   updateThrust
        send    4
code_05ee:ret     
    )
)


(procedure (localproc_05ef param1)
    (var temp0[3])
    = local4 (+ local4 CosMult((/ local2 10) (/ param1 4)))
    = local5 (+ local5 SinMult((/ local2 10) (/ param1 4)))
    (if ((<> local27_2 (/ local4 300)) or (<> local28_2 (/ local5 300)))
        = local27_2 (/ local4 300)
        = local28_2 (/ local5 300)
        (ast0:init(0))
        (ast1:init(1))
        (ast2:init(2))
        (ast3:init(3))
        (if (>= (send gSQ5:_detailLevel) 2)
            (ast4:init(4))
            (ast5:init(5))
            (ast6:init(6))
        )
        (if (>= (send gSQ5:_detailLevel) 3)
            (ast7:init(7))
            (ast8:init(8))
        )
    )
)


(procedure (localproc_06b6)
    (if ((<> local8 0) and not local26)
        = local26 1
        (send gSq5Music2:
            number(156)
            loop(-1)
            vol(64)
            play()
        )
    )
    (switch (local8)
        (case 1
            (
            (if (> local10 -6)
                = local10 (- local10 1)
            )
 
            (if (local10)
                = local11 (- local11 1)
            )
 )
        )
        (case 2
            (
            (if (< local10 6)
                = local10 (+ local10 1)
            )
 
            (if (local10)
                = local11 (- local11 1)
            )
 )
        )
        (case 3
            (
            (if (< local9 10)
                = local9 (+ local9 1)
            )
 
            (if (10)
                = local11 (- local11 2)
            )
 )
        )
        (case 4
            (
            (if (> local9 -10)
                = local9 (- local9 1)
            )
 
            (if (10)
                = local11 (- local11 2)
            )
 )
        )
        (case 0
            (localproc_0297() )
        )
    )
    (fuel:setCel((- (fuel:lastCel()) (/ local11 100))))
    (if ((== (fuel:cel) (fuel:lastCel())) and not (send gRoom:script))
        = local10 0
        = local9 0
        (send gRoom:setScript(outOfFuel))
    )(else
        (if ((local27_3 and not (send gRoom:script)) and not local28_3)
            (if (not proc0_1(87))
                (send gRoom:setScript(warning))
            )(else
                (send gRoom:setScript(returnToEureka))
            )
        )(else
            (if (not (send gRoom:script))
                localproc_05ef(local9)
                localproc_02be(local10)
            )
        )
    )
)


(class FloatObj of Prop
    (properties
        x 0
        y 0
        z 0
        heading 0
        noun 0
        modNum -1
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        sightAngle 26505
        actions 0
        onMeCheck 26505
        state 0
        approachX 0
        approachY 0
        approachDist 0
        _approachVerbs 0
        yStep 2
        view -1
        loop 0
        cel 0
        priority 2
        underBits 0
        signal 30736
        lsTop 0
        lsLeft 0
        lsBottom 0
        lsRight 0
        brTop 0
        brLeft 0
        brBottom 0
        brRight 0
        scaleSignal 1
        scaleX 128
        scaleY 128
        maxScale 128
        cycleSpeed 6
        script 0
        cycler 0
        timer 0
        detailLevel 0
        scaler 0
        d3x 0
        d3y 0
    )
)
(class Asteroid of FloatObj
    (properties
        x 0
        y 70
        z 0
        heading 0
        noun 0
        modNum -1
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        sightAngle 26505
        actions 0
        onMeCheck 26505
        state 0
        approachX 0
        approachY 0
        approachDist 0
        _approachVerbs 0
        yStep 2
        view 272
        loop 0
        cel 0
        priority 2
        underBits 0
        signal 30736
        lsTop 0
        lsLeft 0
        lsBottom 0
        lsRight 0
        brTop 0
        brLeft 0
        brBottom 0
        brRight 0
        scaleSignal 1
        scaleX 128
        scaleY 128
        maxScale 128
        cycleSpeed 6
        script 0
        cycler 0
        timer 0
        detailLevel 3
        scaler 0
        d3x 0
        d3y 0
        oldD3x 0
        oldD3y 0
    )

    (method (init param1 param2)
        = d3y (+ (* local28_2 200) oldD3x)
        = d3x (+ (* local27_2 200) oldD3y)
        Random(/ (+ d3x (* 2 d3y)) 10)
        (if (not (send gCast:contains(self)))
            (self:setCycle(
                (if (Random(0 1))
                    Fwd
                )(else
                    Rev
                )
))
            (super:init(rest param2))
        )
        (if (>= (send gSQ5:_detailLevel) detailLevel)
            (self:startUpd())
        )
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 1
                ((send gTestMessager:say(local78[(= local27 (% ++local27 9))] 1 0 0))  )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance updateThrust of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (localproc_06b6()  )
            )
            (case 1
                (= cycles 2  )
            )
            (case 2
                ((hand1:stopUpd()) (lever1:stopUpd()) (self:dispose()) )
            )
        )
    )

)
(instance handCursor of Cursor
    (properties
        view 3270
        cel 6
    )

    (method (init param1)
        (if ((arm:cel) and proc999_4(203 124 226 149 gPEventX gPEventY))
            = cel 5
        )(else
            (if ((hand2:onMe(gPEventX gPEventY)))
                = cel 
                    (if ((arm:cel))
                        3
                    )(else
                        1
                    )
            )(else
                (if (proc999_4(62 134 104 160 gPEventX gPEventY))
                    = cel 4
                )(else
                    (if (proc999_4(29 134 61 160 gPEventX gPEventY))
                        = cel 0
                    )(else
                        (if (proc999_4(105 134 139 160 gPEventX gPEventY))
                            = cel 2
                        )(else
                            (if (proc999_4(62 104 104 133 gPEventX gPEventY))
                                = cel 1
                            )(else
                                (if (proc999_4(62 161 104 189 gPEventX gPEventY))
                                    = cel 3
                                )(else
                                    = cel 6
                                )
                            )
                        )
                    )
                )
            )
        )
        (super:init(rest param1))
    )

)
(instance public rm801 of Rm
    (properties
        picture 48
    )

    (method (init param1)
        (super:init(rest param1))
        proc958_0(128 273 272 269 270 271 570 3270 3271 3272 3273)
        (send gSq5Music1:
            number(37)
            loop(-1)
            play()
        )
        (if (GetMessage(2 801 32 0 0 1))
            GetMessage(0 801 32 0 0 1 @local28)
        )(else
            Format(@local28 "%s" "Need Message")
        )
        (if (== gGModNum 100)
            (send gEgo:get(9))
        )
        (send ((send gSq5IconBar:at(2))):cursor(handCursor))
        (radar:
            init()
            setOnMeCheck(1 8)
        )
        (headsUp:
            init()
            setOnMeCheck(1 32)
        )
        (directions:
            init()
            setOnMeCheck(1 2)
        )
        (fuelF:
            init()
            setOnMeCheck(1 16)
        )
        (oxygenF:
            init()
            setOnMeCheck(1 4)
        )
        = local27_4 
            (if (== global137 2)
                1
            )(else
                (if (not (send gEgo:has(9)))
                    2
                )(else
                    0
                )
            )
        (arm:
            init()
            stopUpd()
        )
        (lever1:
            init()
            stopUpd()
        )
        (lever2:
            init()
            stopUpd()
        )
        (hand1:
            init()
            stopUpd()
        )
        (hand2:
            init()
            stopUpd()
        )
        (lthrust:init())
        (rthrust:init())
        (fthrust:init())
        (bthrust:init())
        (if ((send gEgo:has(9)))
            (send gEgo:put(9))
        )
        (oxygen:
            init()
            setScript(losingAir)
        )
        (fuel:init())
        (clawButton:
            init()
            setOnMeCheck(26505)
        )
        (cliffy:
            init()
            setScript(breathing)
        )
        (yourShip:
            init()
            stopUpd()
        )
        (cliffyBlip:
            init()
            setCycle(Fwd)
        )
        (shipBlip:
            init()
            setCycle(Fwd)
        )
        localproc_05ef(0)
        localproc_02be(0)
        (send gDirectionHandler:addToFront(lever1))
        (self:setScript(startItAll))
    )


    (method (doit param1)
        (if (== (send gSq5IconBar:curIcon) (send gSq5IconBar:at(2)))
            (handCursor:init())
        )
        (super:doit(rest param1))
    )


    (method (dispose param1)
        Joystick(3)
        Palette(1 999 2)
        (send gDirectionHandler:delete(lever1))
        (send ((send gSq5IconBar:at(2))):cursor(982))
        (super:dispose(rest param1))
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 4
                (
                (if (local7)
                    (send local7:doVerb(4))
                )(else
                    (if (proc999_4(62 134 104 160 gPEventX gPEventY))
                        (lever1:handleEvent(0))
                    )(else
                        (if (proc999_4(29 134 61 160 gPEventX gPEventY))
                            (lever1:handleEvent(7))
                        )(else
                            (if (proc999_4(105 134 139 160 gPEventX gPEventY))
                                (lever1:handleEvent(3))
                            )(else
                                (if (proc999_4(62 104 104 133 gPEventX gPEventY))
                                    (lever1:handleEvent(1))
                                )(else
                                    (if (proc999_4(62 161 104 189 gPEventX gPEventY))
                                        (lever1:handleEvent(5))
                                    )(else
                                        (super:doVerb(param1 rest param2))
                                    )
                                )
                            )
                        )
                    )
                )
 )
            )
        )
    )

)
(instance ast0 of Asteroid
    (properties
        y 52
        noun 4
        d3x 100
        d3y 100
        oldD3x 100
        oldD3y 100
    )
)
(instance ast1 of Asteroid
    (properties
        y 59
        noun 5
        loop 2
        d3x 100
        d3y 65436
        oldD3x 100
        oldD3y 65436
    )
)
(instance ast2 of Asteroid
    (properties
        y 38
        noun 6
        loop 6
        d3y 300
        oldD3y 300
    )
)
(instance ast3 of Asteroid
    (properties
        y 43
        noun 7
        d3x 65436
        d3y 65436
        oldD3x 65436
        oldD3y 65436
    )
)
(instance ast4 of Asteroid
    (properties
        y 34
        noun 8
        loop 2
        d3x 65386
        d3y 75
        oldD3x 65386
        oldD3y 75
    )
)
(instance ast5 of Asteroid
    (properties
        y 50
        noun 9
        loop 6
        d3x 300
        d3y 200
        oldD3x 300
        oldD3y 200
    )
)
(instance ast6 of Asteroid
    (properties
        y 36
        noun 10
        d3x 200
        oldD3x 200
    )
)
(instance ast7 of Asteroid
    (properties
        y 22
        noun 11
        loop 2
        d3y 65336
        oldD3y 65336
    )
)
(instance ast8 of Asteroid
    (properties
        y 28
        noun 12
        loop 6
        d3x 65336
        oldD3x 65336
    )
)
(instance yourShip of FloatObj
    (properties
        y 60
        noun 20
        view 272
        loop 5
        d3y 65336
    )
)
(instance cliffy of FloatObj
    (properties
        y 90
        noun 17
        view 272
        loop 1
        d3x 200
    )
)
(instance arm of Prop
    (properties
        x 319
        y 27
        noun 3
        view 269
        priority 6
        signal 20496
        cycleSpeed 12
    )
)
(instance claw of Prop
    (properties
        x 216
        y 81
        noun 15
        view 269
        loop 1
        priority 6
        signal 20496
        cycleSpeed 12
    )
)
(instance lever1 of Prop
    (properties
        x 54
        y 135
        noun 31
        view 270
        cel 1
        signal 16384
    )

    (method (doit param1)
        (var temp0[3])
        (if (<> local8 0)
            localproc_06b6()
        )
        (super:doit(rest param1))
    )


    (method (handleEvent pEvent param2)
        (var thePEvent, temp1)
        return 
            (if ((((not script and (send gUser:canControl())) and (== (send gSq5IconBar:curIcon) (send gSq5IconBar:at(2)))) and proc999_4(29 104 139 189 gPEventX gPEventY)) and not IsObject(pEvent))
                = thePEvent pEvent
                (self:startUpd())
                (hand1:startUpd())
                (switch (thePEvent)
                    (case 7
                        (self:
                            x(50)
                            y(135)
                        )
                        = temp1 1
                    )
                    (case 3
                        (self:
                            x(59)
                            y(135)
                        )
                        = temp1 2
                    )
                    (case 1
                        (self:
                            x(54)
                            y(130)
                        )
                        = temp1 3
                    )
                    (case 5
                        (self:
                            x(54)
                            y(140)
                        )
                        = temp1 4
                    )
                    (case 0
                        (self:
                            x(54)
                            y(135)
                        )
                        = temp1 0
                    )
                )
                (if (<> temp1 local8)
                    (if (<> local8 0)
                        (self:
                            x(54)
                            y(135)
                        )
                        = local8 0
                    )(else
                        = local8 temp1
                    )
                )
                (self:
                    forceUpd()
                    setScript(updateThrust)
                )
                return 1
            )(else
                (if (IsObject(pEvent))
                    (super:handleEvent(pEvent rest param2))
                )
            )
    )


    (method (doVerb param1 param2)
        (if (== param1 4)
            (send gRoom:doVerb(4))
        )(else
            (super:doVerb(param1 rest param2))
        )
    )

)
(instance lever2 of View
    (properties
        x 270
        y 135
        noun 2
        view 270
        loop 1
        cel 1
        signal 16384
    )

    (method (doVerb param1)
        (switch (param1)
            (case 4
                (
                (if (proc0_1(87))
                    (send gTestMessager:say(noun 4 2 0))
                )(else
                    (send gRoom:setScript(operateArm))
                )
 )
            )
        )
    )

)
(instance hand1 of View
    (properties
        y 125
        noun 24
        view 270
        priority 15
        signal 16400
    )

    (method (doit param1)
        (self:
            x(- (lever1:x) 54)
            y(- (lever1:y) 10)
        )
        (super:doit(rest param1))
    )


    (method (doVerb param1 param2)
        (if (== param1 4)
            (send gRoom:doVerb(4))
        )(else
            (super:doVerb(param1 rest param2))
        )
    )

)
(instance hand2 of View
    (properties
        x 322
        y 124
        noun 28
        view 270
        loop 1
        priority 15
        signal 16400
    )

    (method (doVerb param1 param2)
        (if (== param1 4)
            (lever2:doVerb(param1 rest param2))
        )(else
            (super:doVerb(param1))
        )
    )

)
(instance lthrust of Prop
    (properties
        x 144
        y 169
        noun 25
        view 271
        loop 8
        signal 16384
    )

    (method (doit param1)
        (if (== local8 1)
            (if ((<> cel (self:lastCel())) and not cycler)
                (self:setCycle(End))
            )
        )(else
            (if (cel and not cycler)
                (self:setCycle(Beg))
            )
        )
        (super:doit(rest param1))
    )

)
(instance rthrust of Prop
    (properties
        x 176
        y 169
        noun 30
        view 271
        loop 9
        signal 16384
    )

    (method (doit param1)
        (if (== local8 2)
            (if ((<> cel (self:lastCel())) and not cycler)
                (self:setCycle(End))
            )
        )(else
            (if (cel and not cycler)
                (self:setCycle(Beg))
            )
        )
        (super:doit(rest param1))
    )

)
(instance fthrust of Prop
    (properties
        x 156
        y 159
        noun 21
        view 271
        loop 10
        signal 16384
    )

    (method (doit param1)
        (if (== local8 3)
            (if ((<> cel (self:lastCel())) and not cycler)
                (self:setCycle(End))
            )
        )(else
            (if (cel and not cycler)
                (self:setCycle(Beg))
            )
        )
        (super:doit(rest param1))
    )

)
(instance bthrust of Prop
    (properties
        x 155
        y 175
        noun 13
        view 271
        loop 11
        signal 16384
    )

    (method (doit param1)
        (if (== local8 4)
            (if ((<> cel (self:lastCel())) and not cycler)
                (self:setCycle(End))
            )
        )(else
            (if (cel and not cycler)
                (self:setCycle(Beg))
            )
        )
        (super:doit(rest param1))
    )

)
(instance oxygen of Prop
    (properties
        x 125
        y 112
        noun 26
        view 271
        loop 1
        priority 15
        signal 16400
    )

    (method (init param1)
        (super:init(rest param1))
        (self:setCel(
            (if (local27_4)
                (- (self:lastCel()) 1)
            )(else
                0
            )
))
    )

)
(instance fuel of Prop
    (properties
        x 186
        y 112
        noun 22
        view 271
        priority 15
        signal 16400
    )
)
(instance cliffyBlip of Prop
    (properties
        noun 16
        view 272
        loop 3
        priority 7
        signal 16400
    )
)
(instance shipBlip of Prop
    (properties
        noun 19
        view 272
        loop 4
        priority 7
        signal 16400
    )
)
(instance target of Prop
    (properties
        view 272
        loop 7
        priority 14
        signal 16400
        detailLevel 3
    )

    (method (init param1)
        (super:init(rest param1))
        (self:setCycle(Fwd))
        Display(@local28 105 gFont 100 65 25 102 global153)
    )


    (method (doit param1)
        (self:
            x(- (cliffy:x) 20)
            y(- (cliffy:y) 34)
        )
        (if (local26)
            Display(@local28 105 gFont 100 65 25 102 
                (if (= local1 not local1)
                    global154
                )(else
                    global153
                )
)
        )
        (super:doit(rest param1))
    )


    (method (dispose param1)
        Display(@local28 105 gFont 100 65 25 102 global151)
        (super:dispose(rest param1))
    )

)
(instance radar of Feature
    (properties
        y 10
        noun 27
        onMeCheck 8
    )
)
(instance headsUp of Feature
    (properties
        y 5
        noun 23
        onMeCheck 32
    )
)
(instance directions of Feature
    (properties
        y 200
        noun 18
        onMeCheck 2
    )
)
(instance fuelF of Feature
    (properties
        y 100
        noun 22
        onMeCheck 16
    )
)
(instance oxygenF of Feature
    (properties
        y 100
        noun 26
        onMeCheck 4
    )
)
(instance clawButton of Feature
    (properties
        y 200
        noun 14
        nsTop 124
        nsLeft 203
        nsBottom 149
        nsRight 226
    )

    (method (doVerb param1)
        (switch (param1)
            (case 4
                (
                (if (proc0_1(87))
                    (send gTestMessager:say(noun 4 2 0))
                )(else
                    (if ((arm:cel))
                        (arm:setScript(operateClaw))
                    )(else
                        (arm:setScript(operateArm))
                    )
                )
 )
            )
        )
    )

)
(instance operateArm of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (lever2:startUpd()) (hand2:startUpd()) = cycles 3  )
            )
            (case 1
                (
                (if (== (lever2:y) 135)
                    (lever2:y(130))
                    (hand2:y(119))
                )(else
                    (hand2:y(124))
                    (lever2:y(135))
                )
 = cycles 2  )
            )
            (case 2
                ((send gSq5Music2:
                    number(106)
                    loop(1)
                    play()
                )
 
                (if (== (lever2:y) 130)
                    (arm:setCycle(CT 6 1 self))
                    (lever2:y(130))
                    (hand2:y(119))
                )(else
                    (if ((claw:cel))
                        (claw:setCycle(Beg self))
                    )(else
                        = cycles 2
                    )
                    (hand2:y(124))
                    (lever2:y(135))
                )
 )
            )
            (case 3
                (
                (if (== (lever2:y) 135)
                    (claw:dispose())
                    (arm:
                        setCel(6)
                        setCycle(Beg self)
                    )
                )(else
                    = cycles 1
                )
 )
            )
            (case 4
                ((lever2:stopUpd()) (hand2:stopUpd()) 
                (if (== (lever2:y) 130)
                    (claw:
                        init()
                        stopUpd()
                    )
                    (arm:setCel(7))
                )
 (arm:stopUpd()) localproc_027c() (self:dispose()) )
            )
        )
    )

)
(instance operateClaw of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (claw:startUpd()) = cycles 2  )
            )
            (case 1
                ((send gSq5Music2:
                    number(108)
                    loop(1)
                    play()
                )
 
                (if ((claw:cel))
                    (if ((local26_3 and (<= 200 (cliffy:x))) and (<= (cliffy:x) 210))
                        proc0_2(87)
                        = local26 0
                        (target:dispose())
                        (claw:setCel((- (claw:lastCel()) 1)))
                        = cycles 2
                    )(else
                        (claw:setCycle(Beg self))
                    )
                )(else
                    (claw:setCycle(End self))
                )
 )
            )
            (case 2
                (
                (if (proc0_1(87))
                    (self:setScript(getCliffy self))
                )(else
                    = cycles 1
                )
 )
            )
            (case 3
                ((claw:stopUpd()) localproc_027c() (self:dispose()) )
            )
        )
    )

)
(instance getCliffy of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((claw:setCel((- (claw:lastCel()) 1))) = cycles 2  )
            )
            (case 1
                (proc0_10(192 100) UnLoad(128 273) (cliffy:
                    view(272)
                    loop(1)
                    cel(0)
                    setPri(- (claw:priority) 1)
                    stopUpd()
                )
 (send gTestMessager:say(2 0 2 0 self))  )
            )
            (case 2
                ((cliffy:addToPic()) (claw:addToPic()) (arm:addToPic()) (hand2:addToPic()) (lever2:addToPic()) (self:dispose()) )
            )
        )
    )

)
(instance losingAir of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (= seconds 20  )
            )
            (case 1
                (
                (if (<> (oxygen:cel) (oxygen:lastCel()))
                    (oxygen:setCel((+ (oxygen:cel) 1)))
                    (if ((> (oxygen:cel) 9) and (<> (theMusic3:number) 282))
                        (theMusic3:
                            number(282)
                            loop(-1)
                            play()
                        )
                    )
                    = state -1
                )
 
                (if (not (breathing:state))
                    (breathing:seconds(1))
                )
 = cycles 1  )
            )
            (case 2
                ((send gSQ5:handsOff()) (send gSq5Music1:fade(0 10 5 1)) (send gSq5Music2:stop()) 
                (switch (local27_4)
                    (case 0
                        ((send gTestMessager:say(26 0 3 0 self))  )
                    )
                    (case 1
                        ((send gTestMessager:say(26 0 5 0 self))  )
                    )
                    (case 2
                        ((send gTestMessager:say(26 0 4 0 self)) )
                    )
                )
  )
            )
            (case 3
                ((send ((send gSq5IconBar:at(2))):cursor(982)) Joystick(3) (aliens:register(
                    (if (== local27_4 2)
                        13
                    )(else
                        14
                    )
)) (send gRoom:setScript(aliens)) (self:dispose()) )
            )
        )
    )

)
(instance breathing of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (= seconds (* (- 14 (oxygen:cel)) 2)  )
            )
            (case 1
                ((theMusic4:
                    number(550)
                    loop(1)
                    play()
                )
 = state (- state 2) = seconds 1 )
            )
        )
    )

)
(instance outOfFuel of Script
    (properties)

    (method (changeState newState)
        (var temp0, temp1)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send ((send gSq5IconBar:at(2))):cursor(982)) (send gSq5Music1:fade(0 10 5 1)) (send gSq5Music2:stop()) Joystick(0 48 5) = register 30 = cycles 1  )
            )
            (case 1
                (= temp1 0 (while (< temp1 (send gCast:size))
                    (if ((send (= temp0 (send gCast:at(temp1))):isKindOf(FloatObj)))
                        (if (not 
                        (if (== temp0 cliffy)
                            proc0_1(87)
                        )
)
                            (send temp0:
                                startUpd()
                                y(- (send temp0:y) 2)
                            )
                        )
                    )
 ++temp1  ) 
                (if (--register)
                    --state
                )
 = cycles 2  )
            )
            (case 2
                ((send gTestMessager:say(22 0 3 0 self))  )
            )
            (case 3
                ((send ((send gSq5IconBar:at(2))):cursor(982)) (aliens:register(16)) Joystick(3) (send gRoom:setScript(aliens)) (self:dispose()) )
            )
        )
    )

)
(instance startItAll of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) = seconds 3  )
            )
            (case 1
                ((hand1:setCel(2)) (hand2:setCel(2)) = cycles 3  )
            )
            (case 2
                (localproc_027c() (self:dispose()) )
            )
        )
    )

)
(instance warning of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gTestMessager:say(29 0 7 0 self)) = local28_3 1  )
            )
            (case 1
                ((self:dispose()) )
            )
        )
    )

)
(instance returnToEureka of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) proc0_10(193 50) (send gTestMessager:say(29 0 6 0 self)) (send gSq5Music1:fade(0 10 5 1))  )
            )
            (case 1
                ((send ((send gSq5IconBar:at(2))):cursor(982)) = global137 2 (send gSq5Music1:stop()) (send gSq5Music2:stop()) (theMusic3:stop()) (send gRoom:newRoom(250)) )
            )
        )
    )

)
(instance shootingStar of Actor
    (properties
        x 233
        y 42
        view 570
        priority 1
        signal 24592
        moveSpeed 1
    )
)
(instance aliens of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gSq5Music2:stop()) (theMusic3:stop()) (theMusic4:stop()) (send gCast:eachElementDo(102)) Joystick(3) = cycles 3  )
            )
            (case 1
                ((send gCast:eachElementDo(111)) (send gRoom:drawPic(56 32778)) = seconds 3  )
            )
            (case 2
                ((shootingStar:
                    init()
                    setCycle(Fwd)
                    setMotion(MoveTo 153 167 self)
                )
  )
            )
            (case 3
                ((send gTestMessager:say(1 2 1 0 self))  )
            )
            (case 4
                (proc0_9(register) )
            )
        )
    )

)
(instance public alien1Tkr of Narrator
    (properties
        talkWidth 100
    )

    (method (init param1)
        = gSq5Win gNewSpeakWindow
        = font gFont
        (send gSq5Win:
            tailX(80)
            xOffset(65516)
            tailY(80)
            isBottom(1)
        )
        (super:init(rest param1))
    )


    (method (dispose param1)
        = gSq5Win gSq5Win_2
        (super:dispose(rest param1))
    )

)
(instance public alien2Tkr of Narrator
    (properties
        talkWidth 100
    )

    (method (init param1)
        = gSq5Win gNewSpeakWindow
        = font gFont
        (send gSq5Win:
            tailX(180)
            xOffset(20)
            isBottom(1)
            tailY(80)
        )
        (super:init(rest param1))
    )


    (method (dispose param1)
        = gSq5Win gSq5Win_2
        (super:dispose(rest param1))
    )

)
(instance theMusic3 of Sound
    (properties)
)
(instance theMusic4 of Sound
    (properties)
)
