(include "sci.sh")
(use "Main")
(use "Scaler")
(use "Osc")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "Sound")
(use "Jump")
(use "Cycle")
(use "Sounds")
(use "View")
(use "Obj")
(script 315)


(local
    local0
    local1
    local2[16] = (224 221 221 221 221 221 225 225 234 240 242 243 239 238 239 238 )
    local18[16] = (66 67 67 67 67 67 67 67 73 77 86 90 88 89 91 91 )
    local34
    local35[18] = (253 255 255 254 254 255 251 250 248 244 238 233 233 234 240 241 241 240 )
    local53[18] = (70 71 71 71 71 71 71 71 70 69 73 85 87 87 84 86 87 87 )
    local71[9] = (256 253 252 241 228 218 213 201 192 )
    local80[9] = (38 39 39 40 46 59 56 54 54 )
    local89[9] = (0 1 2 3 4 5 6 4 )
    local98
    local99[6] = (159 148 138 126 116 102 )
    local105[6] = (145 147 144 146 144 145 )

)
(instance public rm315 of Rm
    (properties
        noun 9
        picture 64
    )

    (method (init)
        (self:setRegions(350))
        proc958_0(128 422 423 411 425 402 401 424 400 426)
        proc0_6(0)
        (send gEgo:actions(ScriptID(350 1)))
        (switch (gGModNum)
            (case 305
                (
                (if (proc0_1(21))
                    (send gRoom:setScript(sWD40Explodes))
                    (send gRoom:style(14))
                )(else
                    (send gRoom:setScript(sEnterViaTunnelE))
                )
 )
            )
            (default 
                ((send gRoom:setScript(sEnterViaTunnelB)) )
            )
        )
        (if (not proc0_1(21))
            (send gEgo:
                setScale(Scaler 38 36 143 69)
                init()
            )
        )
        (super:init())
        (theMusic3:
            number(403)
            owner(self)
            flags(1)
            init()
            setLoop(-1)
            play(50)
        )
        (if (not proc0_1(13))
            (rock:init())
            (send gWalkHandler:addToFront(rock))
        )
        (bubbles:
            init()
            setCycle(Fwd)
        )
        (fall1:
            init()
            setCycle(Fwd)
        )
        (fall2:
            init()
            setCycle(Fwd)
        )
        (if (not proc0_1(21))
            (wd40:
                view(424)
                loop(2)
                cel(0)
                x(50)
                y(50)
                init()
            )
        )
        (bottomCave:
            init()
            setOnMeCheck(1 8192)
        )
        (bottomFalls:
            init()
            setOnMeCheck(1 2)
        )
        (cave305:
            init()
            setOnMeCheck(1 256)
        )
        (cave310:
            init()
            setOnMeCheck(1 4096)
        )
        (pond:
            init()
            setOnMeCheck(1 4)
        )
        (topCave:
            init()
            setOnMeCheck(1 16384)
        )
        (topFalls:
            init()
            setOnMeCheck(1 8)
        )
        (tree:
            init()
            setOnMeCheck(1 16)
        )
        (send gRoom:addObstacle((send ((Polygon:new())):
                type(3)
                init(47 144 63 143 100 143 128 139 128 138 100 138 100 140 63 140 62 139 47 138)
                yourself()
            )
 (send ((Polygon:new())):
                type(3)
                init(225 65 225 63 190 63 189 66 197 66 224 66)
                yourself()
            )
 (send ((Polygon:new())):
                type(3)
                init(254 70 285 71 285 70 285 68 254 68)
                yourself()
            )
 (send ((Polygon:new())):
                type(3)
                init(273 43 262 43 262 45 273 45)
                yourself()
            )
))
    )


    (method (doit)
        (asm
            pushi   #doit
            pushi   0
            super   Rm, 4
            pushi   7
            pushi   6
            pushi   240
            pushi   248
            pushi   5
            pushi   249
            pushi   255
            pushi   65528
            callk   Palette, 14
            pushi   5
            pushi   34
            pushi   140
            pushi   73
            pushi   150
            lsg     gEgo
            calle   proc999_4, 10
            bnt     code_03c9
            pushi   #script
            pushi   0
            lofsa   wd40
            send    4
            not     
            bnt     code_03c9
            pushi   1
            pushi   14
            callb   proc0_1, 2
            not     
            bt      code_03b9
            pushi   1
            pushi   15
            callb   proc0_1, 2
            bnt     code_03c9
code_03b9:  pushi   #setScript
            pushi   1
            lofsa   sWD40Appears
            push    
            lofsa   wd40
            send    6
            jmp     code_0589
code_03c9:  pushi   5
            pushi   100
            pushi   137
            pushi   129
            pushi   139
            lsg     gEgo
            calle   proc999_4, 10
            bnt     code_040e
            pushi   270
            pushi   #heading
            pushi   0
            lag     gEgo
            send    4
            gt?     
            bnt     code_03f1
            pprev   
            ldi     90
            gt?     
code_03f1:  not     
            bnt     code_040e
            pushi   #script
            pushi   0
            lag     gRoom
            send    4
            not     
            bnt     code_040e
            pushi   #setScript
            pushi   1
            lofsa   sExitViaTunnelB
            push    
            lag     gRoom
            send    6
            jmp     code_0589
code_040e:  pushi   5
            pushi   275
            pushi   67
            pushi   287
            pushi   71
            lsg     gEgo
            calle   proc999_4, 10
            bnt     code_044c
            pushi   #heading
            pushi   0
            lag     gEgo
            send    4
            push    
            ldi     180
            lt?     
            bnt     code_044c
            pushi   #script
            pushi   0
            lag     gRoom
            send    4
            not     
            bnt     code_044c
            pushi   #setScript
            pushi   1
            lofsa   sExitViaTunnelE
            push    
            lag     gRoom
            send    6
            jmp     code_0589
code_044c:  pushi   5
            pushi   34
            pushi   130
            pushi   73
            pushi   139
            lsg     gEgo
            calle   proc999_4, 10
            bnt     code_0493
            pushi   270
            pushi   #heading
            pushi   0
            lag     gEgo
            send    4
            gt?     
            bnt     code_0473
            pprev   
            ldi     90
            gt?     
code_0473:  not     
            bnt     code_0493
            pushi   #script
            pushi   0
            lag     gRoom
            send    4
            not     
            bnt     code_0493
            pushi   #setScript
            pushi   3
            lofsa   sThruTunnelC
            push    
            pushi   0
            pushi   1
            lag     gRoom
            send    10
            jmp     code_0589
code_0493:  pushi   5
            pushi   191
            pushi   63
            pushi   200
            pushi   66
            lsg     gEgo
            calle   proc999_4, 10
            bnt     code_04d4
            pushi   #heading
            pushi   0
            lag     gEgo
            send    4
            push    
            ldi     180
            gt?     
            bnt     code_04d4
            pushi   #script
            pushi   0
            lag     gRoom
            send    4
            not     
            bnt     code_04d4
            pushi   #setScript
            pushi   3
            lofsa   sThruTunnelC
            push    
            pushi   0
            pushi   0
            lag     gRoom
            send    10
            jmp     code_0589
code_04d4:  pushi   5
            pushi   221
            pushi   62
            pushi   227
            pushi   67
            lsg     gEgo
            calle   proc999_4, 10
            bnt     code_0516
            pushi   0
            pushi   #heading
            pushi   0
            lag     gEgo
            send    4
            lt?     
            bnt     code_0516
            pprev   
            ldi     180
            lt?     
            bnt     code_0516
            pushi   #script
            pushi   0
            lag     gRoom
            send    4
            not     
            bnt     code_0516
            pushi   #setScript
            pushi   1
            lofsa   sJumpLeftToRight
            push    
            lag     gRoom
            send    6
            jmp     code_0589
code_0516:  pushi   5
            pushi   254
            pushi   67
            pushi   258
            pushi   71
            lsg     gEgo
            calle   proc999_4, 10
            bnt     code_0553
            pushi   #heading
            pushi   0
            lag     gEgo
            send    4
            push    
            ldi     180
            gt?     
            bnt     code_0553
            pushi   #script
            pushi   0
            lag     gRoom
            send    4
            not     
            bnt     code_0553
            pushi   #setScript
            pushi   1
            lofsa   sJumpRightToLeft
            push    
            lag     gRoom
            send    6
            jmp     code_0589
code_0553:  pushi   #y
            pushi   0
            lag     gEgo
            send    4
            push    
            ldi     45
            eq?     
            bnt     code_0589
            pushi   270
            pushi   #heading
            pushi   0
            lag     gEgo
            send    4
            ge?     
            bnt     code_0589
            pprev   
            ldi     90
            ge?     
            bnt     code_0589
            pushi   #script
            pushi   0
            lag     gRoom
            send    4
            not     
            bnt     code_0589
            pushi   #setScript
            pushi   1
            lofsa   sClimbDownFromRock
            push    
            lag     gRoom
            send    6
code_0589:  ret     
        )
    )


    (method (dispose)
        (send gSq5Music2:stop())
        (theMusic3:dispose())
        (if ((send gWalkHandler:contains(rock)))
            (send gWalkHandler:delete(rock))
        )
        DisposeScript(991)
        (super:dispose())
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 1
                (
                (if (proc0_1(16))
                    (send gTestMessager:say(noun param1 2 0))
                )(else
                    (send gTestMessager:say(noun param1 1 0))
                )
 )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance sBounceRock of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (sWD40EntersCave:dispose()) = local0 0 proc0_2(13) = local34 0 = cycles 1  )
            )
            (case 1
                ((send gEgo:setMotion(MoveTo 281 41 self))  )
            )
            (case 2
                ((send gEgo:setHeading(270 self))  )
            )
            (case 3
                ((send gSq5Music2:
                    number(405)
                    setLoop(1)
                    play()
                )
 (send gEgo:
                    view(422)
                    setLoop(6)
                    cel(0)
                    x(279)
                    y(44)
                    setScale(0)
                    setCycle(End self)
                )
  )
            )
            (case 4
                ((send gEgo:setCycle(Beg self))  )
            )
            (case 5
                ((send gEgo:setCycle(End self)) (send gSq5Music2:
                    number(405)
                    setLoop(1)
                    play()
                )
  )
            )
            (case 6
                ((send gSq5Music2:stop()) = cycles 1  )
            )
            (case 7
                (proc0_6(0) (send gEgo:
                    x(281)
                    y(41)
                    setScale(Scaler 38 36 143 69)
                    setMotion(MoveTo 263 43)
                )
 = cycles 1  )
            )
            (case 8
                ((rock:
                    cel(local89[local34])
                    x(local71[local34])
                    y(local80[local34])
                )
 
                (if (== local34 3)
                    (ext1:
                        view(422)
                        cel(0)
                        x(269)
                        y(57)
                        setStep(2 10)
                        signal(| (ext1:signal) $2000)
                        ignoreActors()
                        init()
                        setCycle(0)
                        setLoop(-1)
                        setLoop(8)
                        setMotion(MoveTo 287 189)
                    )
                    (ext2:
                        view(422)
                        cel(1)
                        x(270)
                        y(48)
                        setStep(2 10)
                        signal(| (ext2:signal) $2000)
                        ignoreActors()
                        init()
                        setCycle(0)
                        setLoop(-1)
                        setLoop(8)
                        setMotion(MoveTo 272 189)
                    )
                    (ext3:
                        view(422)
                        cel(2)
                        x(268)
                        y(47)
                        setStep(2 10)
                        signal(| (ext3:signal) $2000)
                        ignoreActors()
                        init()
                        setCycle(0)
                        setLoop(-1)
                        setLoop(8)
                        setMotion(MoveTo 270 189)
                    )
                    (ext4:
                        view(422)
                        cel(3)
                        x(271)
                        y(50)
                        setStep(2 10)
                        signal(| (ext4:signal) $2000)
                        ignoreActors()
                        init()
                        setCycle(0)
                        setLoop(-1)
                        setLoop(8)
                        setMotion(MoveTo 277 189)
                    )
                )
 
                (if (== local34 5)
                    (send gSq5Music2:
                        number(407)
                        setLoop(1)
                        play()
                    )
                )
 
                (if (< ++local34 9)
                    --state
                )
 = ticks 5  )
            )
            (case 9
                ((send gSq5Music2:
                    number(408)
                    setLoop(-1)
                    play()
                )
 (rock:hide()) = ticks 180  )
            )
            (case 10
                ((send gSq5Music2:
                    number(409)
                    setLoop(1)
                    play()
                )
 (rock:
                    loop(9)
                    cel(0)
                    x(45)
                    y(128)
                    setPri(13)
                    show()
                )
 = ticks 4  )
            )
            (case 11
                ((rock:
                    loop(9)
                    cel(1)
                    x(45)
                    y(128)
                )
 (wd40:
                    view(423)
                    loop(0)
                    cel(0)
                    x(92)
                    y(142)
                    show()
                    setCycle(End)
                )
 = ticks 5  )
            )
            (case 12
                ((wd40:
                    loop(1)
                    cel(0)
                    setCycle(0)
                    scaleSignal(1)
                    scaleX(64)
                    scaleY(64)
                    setMotion(JumpTo 240 240)
                )
 (rock:dispose()) (ext1:
                    view(422)
                    cel(2)
                    x(43)
                    y(159)
                    setStep(5 10)
                    setLoop(-1)
                    setLoop(9)
                    setMotion(MoveTo 26 189)
                )
 (ext2:
                    view(422)
                    cel(3)
                    x(93)
                    y(145)
                    setStep(5 10)
                    setLoop(-1)
                    setLoop(9)
                    setMotion(MoveTo 129 159)
                )
 (ext3:
                    view(422)
                    cel(4)
                    x(69)
                    y(162)
                    setStep(5 10)
                    setLoop(-1)
                    setLoop(9)
                    setMotion(MoveTo 76 189)
                )
 (ext4:
                    view(422)
                    cel(5)
                    x(31)
                    y(133)
                    setStep(5 10)
                    setLoop(-1)
                    setLoop(9)
                    setMotion(MoveTo 0 127)
                )
 (ext5:
                    view(422)
                    cel(6)
                    x(39)
                    y(118)
                    setStep(5 10)
                    ignoreActors()
                    init()
                    setCycle(0)
                    setLoop(-1)
                    setLoop(9)
                    setMotion(MoveTo 1 111)
                )
 (ext6:
                    view(422)
                    cel(8)
                    x(43)
                    y(130)
                    ignoreActors()
                    setStep(5 10)
                    init()
                    setCycle(0)
                    setLoop(-1)
                    setLoop(9)
                    setMotion(MoveTo 20 144)
                )
 (ext7:
                    view(422)
                    cel(14)
                    x(91)
                    y(128)
                    ignoreActors()
                    setStep(5 10)
                    init()
                    setCycle(0)
                    setLoop(-1)
                    setLoop(9)
                    setMotion(MoveTo 117 128)
                )
 (ext8:
                    view(422)
                    cel(15)
                    x(62)
                    y(155)
                    setStep(5 10)
                    ignoreActors()
                    xStep(10)
                    yStep(10)
                    init()
                    setCycle(0)
                    setLoop(-1)
                    setLoop(9)
                    setMotion(MoveTo 62 189)
                )
 = ticks 60  )
            )
            (case 13
                ((send gSq5Music2:
                    number(410)
                    setLoop(1)
                    play()
                )
 (ext1:dispose()) (ext2:setMotion(MoveTo 157 189)) (ext3:dispose()) (ext4:dispose()) (ext5:dispose()) (ext6:setMotion(MoveTo 7 180)) (ext7:setMotion(MoveTo 150 134 self)) (ext8:dispose())  )
            )
            (case 14
                ((send gSq5Music2:fade()) (ext2:dispose()) (ext6:dispose()) (ext7:setMotion(MoveTo 190 145 self))  )
            )
            (case 15
                ((ext7:setMotion(MoveTo 222 185 self))  )
            )
            (case 16
                ((ext7:dispose()) proc0_2(14) proc0_10(208 100) (send gSq5Music2:
                    number(411)
                    setLoop(1)
                    play(self)
                )
  )
            )
            (case 17
                ((send gSq5Music1:fade(0 5 10 1)) (send gTestMessager:say(7 0 0 0 self))  )
            )
            (case 18
                ((send gSq5Music1:
                    number(15)
                    loop(-1)
                    play(0)
                    fade(127 10 5 0)
                )
 (send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance sClimbUptoRock of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gEgo:setMotion(PolyPath 265 69 self))  )
            )
            (case 1
                ((send gEgo:
                    view(422)
                    setLoop(5)
                    cel(0)
                    x(268)
                    y(48)
                    setPri(2)
                    setScale(0)
                    setCycle(End self)
                )
  )
            )
            (case 2
                ((send gEgo:
                    cel(0)
                    x(268)
                    y(38)
                    setCycle(CT 9 1 self)
                )
  )
            )
            (case 3
                (proc0_6(0) (send gEgo:
                    x(269)
                    y(44)
                    setScale(Scaler 38 36 143 69)
                )
 (send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance sClimbDownFromRock of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gEgo:setMotion(PolyPath 271 43 self))  )
            )
            (case 1
                ((send gEgo:
                    view(422)
                    setLoop(5)
                    cel(9)
                    x(268)
                    y(38)
                    setPri(2)
                    setScale(0)
                    setCycle(Beg self)
                )
  )
            )
            (case 2
                ((send gEgo:
                    cel(10)
                    x(268)
                    y(48)
                    setCycle(Beg self)
                )
  )
            )
            (case 3
                (proc0_6(0) (send gEgo:
                    x(265)
                    y(69)
                    setPri(-1)
                    setScale(Scaler 38 36 143 69)
                )
 (send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance sEnterViaTunnelE of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gEgo:
                    x(287)
                    y(69)
                    init()
                    setPri(-1)
                    setMotion(MoveTo 270 69 self)
                )
  )
            )
            (case 1
                ((send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance sEnterViaTunnelB of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gEgo:
                    x(107)
                    y(135)
                    init()
                    setMotion(MoveTo 107 140 self)
                )
  )
            )
            (case 1
                ((send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance sExitViaTunnelE of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gEgo:
                    view(411)
                    loop(5)
                    cel(0)
                    x(273)
                    y(66)
                    setCycle(End self)
                )
  )
            )
            (case 1
                ((send gRoom:newRoom(305)) (send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance sExitViaTunnelB of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gEgo:setMotion(MoveTo 107 135 self))  )
            )
            (case 1
                ((send gRoom:newRoom(310)) (send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance sThruTunnelC of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) 
                (if (register)
                    (send gEgo:setMotion(MoveTo 80 135 self))
                )(else
                    (send gEgo:setMotion(MoveTo 185 66 self))
                    (if (== local0 5)
                        (send gRoom:setScript(sRogDiesInTunnel))
                    )
                )
 )
            )
            (case 1
                (
                (if (not register)
                    = seconds 5
                )(else
                    (if (not (wd40:script))
                        = seconds 5
                    )
                )
 )
            )
            (case 2
                (
                (if (register)
                    (send gEgo:
                        x(185)
                        y(66)
                        setMotion(MoveTo 208 65 self)
                    )
                )(else
                    (send gEgo:
                        x(80)
                        y(135)
                        setMotion(MoveTo 61 141 self)
                    )
                )
 )
            )
            (case 3
                ((send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance sJumpLeftToRight of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) = local34 0 = cycles 1  )
            )
            (case 1
                ((send gEgo:
                    view(422)
                    loop(0)
                    cel(local34)
                    setScale(0)
                    setCycle(0)
                    x(local2[local34])
                    y(local18[local34])
                )
 
                (if (== local34 12)
                    (send gSq5Music2:
                        number(5041)
                        setLoop(1)
                        play()
                    )
                )
 
                (if (< ++local34 16)
                    --state
                )
 = ticks 6  )
            )
            (case 2
                ((send gEgo:
                    view(422)
                    loop(2)
                    cel(0)
                    x(258)
                    y(72)
                    setCycle(End self)
                )
  )
            )
            (case 3
                (proc0_6(0) (send gEgo:
                    x(259)
                    y(70)
                    setScale(Scaler 38 36 143 69)
                )
 (send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance sJumpRightToLeft of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) = local34 0 = cycles 1  )
            )
            (case 1
                ((send gEgo:
                    view(422)
                    loop(1)
                    setScale(0)
                    x(local35[local34])
                    y(local53[local34])
                    setCycle(0)
                )
 
                (if (< local34 10)
                    (send gEgo:cel(local34))
                )(else
                    (if (> local34 11)
                        (send gEgo:cel((- local34 2)))
                    )(else
                        (send gEgo:cel(9))
                    )
                )
 
                (if (== local34 12)
                    (send gSq5Music2:
                        number(5041)
                        setLoop(1)
                        play()
                    )
                )
 
                (if (< ++local34 17)
                    --state
                )
 = ticks 6  )
            )
            (case 2
                ((send gEgo:
                    view(422)
                    loop(3)
                    cel(0)
                    x(222)
                    y(70)
                    setCycle(0)
                )
 = cycles 1  )
            )
            (case 3
                ((send gEgo:setCycle(End self))  )
            )
            (case 4
                (proc0_6(0) (send gEgo:
                    loop(1)
                    y(65)
                    setScale(Scaler 38 36 143 69)
                )
 (send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance sWD40Appears of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (= local0 0 
                (if (proc0_1(15))
                    = state (+ state 3)
                )
 = cycles 1  )
            )
            (case 1
                ((send gSq5Music2:
                    number(401)
                    setLoop(-1)
                    play(0)
                    fade(127 10 10 0)
                )
 (ext1:
                    view(420)
                    loop(0)
                    cel(0)
                    x(132)
                    y(12)
                    init()
                    setCycle(Osc 1 self)
                )
 (ext2:
                    view(420)
                    loop(1)
                    cel(0)
                    x(139)
                    y(28)
                    init()
                    setCycle(Osc 1)
                )
  )
            )
            (case 2
                ((ext1:
                    view(420)
                    loop(2)
                    cel(0)
                    x(226)
                    y(136)
                    setCycle(Osc 1 self)
                )
 (ext2:
                    view(420)
                    loop(3)
                    cel(0)
                    x(243)
                    y(145)
                    setCycle(Osc 1)
                )
  )
            )
            (case 3
                ((ext1:
                    view(420)
                    loop(4)
                    cel(0)
                    x(199)
                    y(186)
                    setCycle(Osc 1 self)
                )
  )
            )
            (case 4
                ((ext1:dispose()) (ext2:dispose()) = local0 4 (send gSq5Music1:
                    number(35)
                    loop(-1)
                    play()
                )
 
                (if (proc0_1(15))
                    (wd40:
                        view(425)
                        setLoop(-1)
                        setLoop(0)
                        cel(0)
                        x(263)
                        y(190)
                        ignoreActors()
                        show()
                        setMotion(MoveTo 263 170 self)
                    )
                )(else
                    = local0 2
                    (wd40:
                        view(425)
                        loop(2)
                        cel(0)
                        x(263)
                        y(170)
                        ignoreActors()
                        show()
                        setCycle(End self)
                    )
                )
 )
            )
            (case 5
                ((jetpack:init()) (wd40:
                    cel(0)
                    xStep(10)
                    yStep(12)
                    setCycle(0)
                    setLoop(-1)
                    setLoop(0)
                    setMotion(MoveTo 242 89 self)
                )
  )
            )
            (case 6
                (
                (if (proc999_4(76 131 84 139 gEgo))
                    (if (proc0_1(15))
                        = next sWD40BackDown
                    )(else
                        = next sWD40EntersCave
                    )
                )(else
                    (wd40:stopUpd())
                    = next sWD40Fires
                )
 (self:dispose()) )
            )
        )
    )

)
(instance sWD40BackDown of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((wd40:setMotion(MoveTo 263 190 self))  )
            )
            (case 1
                ((jetpack:dispose()) (wd40:hide()) (sThruTunnelC:cue()) = local0 0 (self:dispose()) )
            )
        )
    )

)
(instance sWD40Fires of Script
    (properties)

    (method (doit param1)
        (if (proc999_4(76 131 84 139 gEgo))
            (if (proc0_1(15))
                = next sWD40BackDown
            )(else
                = next sWD40EntersCave
            )
            (self:dispose())
        )
        (super:doit(rest param1))
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (
                (if ((< (send gEgo:y) 139) and not (send gRoom:script))
                    (wd40:hide())
                    (self:dispose())
                )(else
                    proc0_2(66)
                    (send gSq5Music2:
                        number(402)
                        setLoop(1)
                        play()
                    )
                    (fireBall:
                        view(402)
                        loop(0)
                        cel(0)
                        x(236)
                        y(89)
                        setStep(15 5)
                        moveSpeed(0)
                        init()
                        setScript(sFireBall self 0)
                    )
                )
 )
            )
            (case 1
                (= seconds 4  )
            )
            (case 2
                (
                (if ((< (send gEgo:y) 139) and not (send gRoom:script))
                    (wd40:hide())
                    (self:dispose())
                )(else
                    (send gSq5Music2:
                        number(402)
                        setLoop(1)
                        play()
                    )
                    (fireBall:
                        view(402)
                        loop(0)
                        cel(0)
                        x(236)
                        y(89)
                        setScript(sFireBall self 0)
                    )
                )
 )
            )
            (case 3
                (= seconds 4  )
            )
            (case 4
                (
                (if ((< (send gEgo:y) 139) and not (send gRoom:script))
                    (wd40:hide())
                    (self:dispose())
                )(else
                    (send gEgo:setMotion(0))
                    (send gSq5Music2:
                        number(402)
                        setLoop(1)
                        play()
                    )
                    (fireBall:
                        view(402)
                        loop(0)
                        cel(0)
                        x(236)
                        y(89)
                        setScript(sFireBall self 1)
                    )
                )
 )
            )
            (case 5
                ((fireBall:dispose()) 
                (if ((<= 45 (send gEgo:heading)) and (<= (send gEgo:heading) 135))
                    (send gEgo:loop(3))
                )(else
                    (if ((<= 136 (send gEgo:heading)) and (<= (send gEgo:heading) 225))
                        (send gEgo:loop(0))
                    )(else
                        (if ((<= 226 (send gEgo:heading)) and (<= (send gEgo:heading) 315))
                            (send gEgo:loop(2))
                        )(else
                            (send gEgo:loop(1))
                        )
                    )
                )
 (send gEgo:
                    view(401)
                    cel(0)
                    setScale(Scaler 38 36 143 69)
                    setCycle(End self)
                )
  )
            )
            (case 6
                (proc0_9(17) (self:dispose()) )
            )
        )
    )

)
(instance sFireBall of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (
                (if (not register)
                    (fireBall:setMotion(MoveTo (+ (send gEgo:x) 7) (- (send gEgo:y) 10) self))
                )(else
                    (fireBall:setMotion(MoveTo (+ (send gEgo:x) 2) (- (send gEgo:y) 18) self))
                )
 )
            )
            (case 1
                (
                (if (not register)
                    (send gSq5Music2:
                        number(4021)
                        setLoop(1)
                        play()
                    )
                    (fireBall:
                        view(401)
                        loop(4)
                        cel(0)
                        setCycle(End self)
                    )
                )(else
                    = cycles 1
                )
 )
            )
            (case 2
                ((self:dispose()) )
            )
        )
    )

)
(instance sWD40EntersCave of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((ext10:
                    view((wd40:view))
                    loop((wd40:loop))
                    cel((wd40:cel))
                    x((wd40:x))
                    y((wd40:y))
                    init()
                    addToPic()
                )
 (wd40:hide()) (ext9:
                    view((jetpack:view))
                    loop((jetpack:loop))
                    cel((jetpack:cel))
                    x((jetpack:x))
                    y((jetpack:y))
                    init()
                    addToPic()
                )
 (jetpack:dispose()) = cycles 2  )
            )
            (case 1
                ((ext9:dispose()) (ext10:dispose()) (send gAddToPics:delete(ext9 ext10)) DrawPic(64 9) = cycles 2  )
            )
            (case 2
                ((theMusic3:play(50)) = ticks 240  )
            )
            (case 3
                ((wd40:
                    view(424)
                    setLoop(0)
                    cel(0)
                    setPri(15)
                    x(local99[= local98 0])
                    y(local105[= local98 0])
                    ignoreActors()
                    setCycle(End)
                    setMotion(0)
                    show()
                )
 = ticks 30  )
            )
            (case 4
                ((wd40:
                    x(local99[local98])
                    y(local105[local98])
                    cel(0)
                    setCycle(End self)
                )
 
                (if (< ++local98 6)
                    --state
                )
 )
            )
            (case 5
                ((send gSq5Music2:
                    number(222)
                    setLoop(1)
                    play()
                )
 (wd40:
                    view(424)
                    loop(1)
                    cel(0)
                    x(102)
                    y(147)
                    ignoreActors()
                    setCycle(End self)
                )
  )
            )
            (case 6
                ((send gSq5Music2:fade()) (wd40:hide()) = local0 5 (sThruTunnelC:cue()) = cycles 1  )
            )
            (case 7
                (= seconds 26  )
            )
            (case 8
                (
                (if (proc999_4(200 50 225 80 gEgo) and (== local0 5))
                    (send gRoom:setScript(sRogDies))
                    (self:dispose())
                )
 = local0 0 = cycles 1  )
            )
            (case 9
                ((wd40:
                    view(424)
                    loop(3)
                    cel(0)
                    x(89)
                    y(144)
                    show()
                    ignoreActors()
                    setCycle(End self)
                )
  )
            )
            (case 10
                ((wd40:
                    view(424)
                    setLoop(0)
                    cel(0)
                    x(local99[= local98 5])
                    y(local105[= local98 5])
                    setCycle(End self)
                )
  )
            )
            (case 11
                ((wd40:
                    x(local99[local98])
                    y(local105[local98])
                    setCycle(End self)
                )
 
                (if (>= --local98 0)
                    --state
                )
 )
            )
            (case 12
                ((wd40:hide()) (self:dispose()) )
            )
        )
    )

)
(instance sRogDies of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gEgo:setMotion(0)) (send gSq5Music2:
                    number(402)
                    setLoop(1)
                    play()
                )
 (fireBall:
                    view(402)
                    loop(0)
                    cel(0)
                    x(200)
                    y(50)
                    init()
                    setMotion(MoveTo + (send gEgo:x) 2 - (send gEgo:y) 8 self)
                )
  )
            )
            (case 1
                ((fireBall:dispose()) 
                (if ((<= 45 (send gEgo:heading)) and (<= (send gEgo:heading) 135))
                    (send gEgo:loop(3))
                )(else
                    (if ((<= 136 (send gEgo:heading)) and (<= (send gEgo:heading) 225))
                        (send gEgo:loop(0))
                    )(else
                        (if ((<= 226 (send gEgo:heading)) and (<= (send gEgo:heading) 315))
                            (send gEgo:loop(2))
                        )(else
                            (send gEgo:loop(1))
                        )
                    )
                )
 (send gEgo:
                    view(401)
                    cel(0)
                    setScale(Scaler 38 36 143 69)
                    setCycle(End self)
                )
  )
            )
            (case 2
                (proc0_9(17) (self:dispose()) )
            )
        )
    )

)
(instance sRogDiesInTunnel of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gEgo:setMotion(0)) (send gSq5Music2:
                    number(402)
                    setLoop(1)
                    play()
                )
 (ext1:
                    view(422)
                    loop(11)
                    cel(0)
                    x(195)
                    y(47)
                    init()
                    setCycle(End)
                )
 (ext2:
                    view(422)
                    loop(12)
                    cel(0)
                    x(207)
                    y(63)
                    init()
                    setPri(15)
                    setCycle(End self)
                )
  )
            )
            (case 1
                ((ext1:hide()) (ext2:hide()) (send gEgo:
                    view(401)
                    cel(0)
                    setScale(Scaler 38 36 143 69)
                    setLoop(-1)
                    setLoop(1)
                    setCycle(End self)
                )
  )
            )
            (case 2
                (proc0_9(18) (self:dispose()) )
            )
        )
    )

)
(instance sWD40Explodes of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (wd40:
                    view(400)
                    cel(0)
                    x(250)
                    y(180)
                    setStep(5 15)
                    scaleX(106)
                    scaleY(106)
                    scaleSignal(1)
                    setCycle(0)
                    setLoop(-1)
                    setLoop(7)
                    moveSpeed(0)
                    init()
                    setMotion(MoveTo 148 107 self)
                )
  )
            )
            (case 1
                ((send gSq5Music2:
                    number(222)
                    setLoop(-1)
                    play()
                )
 (wd40:
                    view(426)
                    loop(0)
                    cel(0)
                    x(142)
                    y(80)
                    setCycle(End self)
                )
  )
            )
            (case 2
                ((send gSq5Music2:
                    number(203)
                    setLoop(1)
                    play()
                )
 (wd40:
                    loop(1)
                    cel(0)
                    setCycle(End self)
                )
  )
            )
            (case 3
                ((send gSq5Music2:fade()) (wd40:dispose()) (ext1:
                    view(426)
                    loop(2)
                    cel(0)
                    x(142)
                    y(80)
                    setStep(3 8)
                    moveSpeed(0)
                    init()
                    setPri(15)
                    ignoreActors()
                    setMotion(MoveTo 100 200)
                )
 (ext2:
                    view(426)
                    loop(2)
                    cel(1)
                    x(138)
                    y(83)
                    setStep(3 7)
                    moveSpeed(0)
                    init()
                    setPri(15)
                    ignoreActors()
                    setMotion(MoveTo 111 200)
                )
 (ext3:
                    view(426)
                    loop(2)
                    cel(2)
                    x(129)
                    y(78)
                    setStep(3 9)
                    moveSpeed(0)
                    init()
                    setPri(15)
                    ignoreActors()
                    setMotion(MoveTo 120 200)
                )
 (ext4:
                    view(426)
                    loop(2)
                    cel(3)
                    x(142)
                    y(80)
                    setStep(3 7)
                    moveSpeed(0)
                    init()
                    setPri(15)
                    ignoreActors()
                    setMotion(MoveTo 130 200)
                )
 (ext5:
                    view(426)
                    loop(2)
                    cel(4)
                    x(142)
                    y(80)
                    setStep(3 8)
                    moveSpeed(0)
                    init()
                    setPri(15)
                    ignoreActors()
                    setMotion(MoveTo 150 200)
                )
 (ext6:
                    view(426)
                    loop(2)
                    cel(5)
                    x(142)
                    y(87)
                    setStep(3 9)
                    moveSpeed(0)
                    init()
                    setPri(15)
                    ignoreActors()
                    setMotion(MoveTo 160 200)
                )
 (ext7:
                    view(426)
                    loop(2)
                    cel(6)
                    x(148)
                    y(80)
                    setStep(3 6)
                    moveSpeed(0)
                    init()
                    setPri(15)
                    ignoreActors()
                    setMotion(MoveTo 170 200)
                )
 (ext8:
                    view(426)
                    loop(2)
                    cel(7)
                    x(122)
                    y(76)
                    setStep(3 7)
                    moveSpeed(0)
                    init()
                    setPri(15)
                    ignoreActors()
                    setMotion(MoveTo 180 200)
                )
 (ext9:
                    view(426)
                    loop(2)
                    cel(8)
                    x(142)
                    y(80)
                    setStep(3 8)
                    moveSpeed(0)
                    init()
                    setPri(15)
                    ignoreActors()
                    setMotion(MoveTo 190 200)
                )
 (ext10:
                    view(426)
                    loop(3)
                    cel(0)
                    x(112)
                    y(70)
                    setStep(3 7)
                    moveSpeed(0)
                    init()
                    setPri(15)
                    ignoreActors()
                    setCycle(Fwd)
                    setMotion(MoveTo 200 200 self)
                )
  )
            )
            (case 4
                ((send gSq5Music2:fade()) (send gSq5Music1:
                    number(17)
                    setLoop(-1)
                    play()
                )
 proc0_2(16) proc0_3(15) (send gSQ5:handsOn()) (send gRoom:newRoom(305)) (self:dispose()) )
            )
        )
    )

)
(instance wd40 of Actor
    (properties
        x 50
        y 50
        noun 4
        modNum 301
        view 424
        priority 14
        signal 16400
    )
)
(instance ext1 of Actor
    (properties
        signal 16384
    )
)
(instance ext2 of Actor
    (properties
        signal 16384
    )
)
(instance ext3 of Actor
    (properties
        signal 16384
    )
)
(instance ext4 of Actor
    (properties
        signal 16384
    )
)
(instance ext5 of Actor
    (properties
        signal 16384
    )
)
(instance ext6 of Actor
    (properties
        signal 16384
    )
)
(instance ext7 of Actor
    (properties
        signal 16384
    )
)
(instance ext8 of Actor
    (properties
        signal 16384
    )
)
(instance ext9 of Actor
    (properties
        signal 16384
    )
)
(instance ext10 of Actor
    (properties
        signal 16384
    )
)
(instance rock of Actor
    (properties
        x 256
        y 38
        noun 3
        view 422
        loop 7
        priority 1
        signal 16400
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 4
                (
                (if (((< (send gEgo:distanceTo(self)) 40) and (> (send gEgo:y) 55)) and not (send gRoom:script))
                    (send gRoom:setScript(sClimbUptoRock))
                )
 )
            )
            (case 3
                (
                (if (((< (send gEgo:distanceTo(self)) 40) and (> (send gEgo:y) 55)) and not (send gRoom:script))
                    (send gRoom:setScript(sClimbUptoRock))
                )
 )
            )
            (case 21
                (
                (if (< (send gEgo:distanceTo(self)) 26)
                    (if (== local0 5)
                        (send gRoom:setScript(sBounceRock))
                    )(else
                        (send gTestMessager:say(10 0 0 0))
                    )
                )(else
                    (send gTestMessager:say(6 0 0 0))
                )
 )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance fireBall of Actor
    (properties
        x 236
        y 89
        view 402
        priority 15
        signal 16400
    )
)
(instance bubbles of Prop
    (properties
        x 100
        y 145
        view 421
    )
)
(instance fall1 of Prop
    (properties
        x 84
        y 68
        view 421
        loop 1
    )
)
(instance fall2 of Prop
    (properties
        x 149
        y 153
        view 421
        loop 2
        signal 4096
    )
)
(instance jetpack of Prop
    (properties
        view 425
        loop 4
        priority 15
        signal 16400
        cycleSpeed 3
    )

    (method (init)
        (self:
            x(272)
            y(226)
        )
        (super:init())
        (self:setCycle(Fwd))
    )


    (method (doit)
        (self:
            x(+ (wd40:x) 9)
            y(+ (wd40:y) 56)
        )
        (super:doit())
    )

)
(instance bottomCave of Feature
    (properties
        x 62
        y 133
        noun 1
        onMeCheck 8192
    )
)
(instance bottomFalls of Feature
    (properties
        x 156
        y 176
        noun 2
        onMeCheck 2
    )
)
(instance cave305 of Feature
    (properties
        x 275
        y 60
        noun 4
        onMeCheck 256
    )
)
(instance cave310 of Feature
    (properties
        x 107
        y 131
        noun 5
        onMeCheck 4096
    )
)
(instance pond of Feature
    (properties
        x 122
        y 146
        noun 8
        onMeCheck 4
    )
)
(instance topCave of Feature
    (properties
        x 199
        y 55
        noun 11
        onMeCheck 16384
    )
)
(instance topFalls of Feature
    (properties
        x 94
        y 111
        noun 12
        onMeCheck 8
    )
)
(instance tree of Feature
    (properties
        x 4
        y 116
        noun 13
        onMeCheck 16
    )
)
(instance theMusic3 of Sound
    (properties
        flags 1
    )
)
