(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "ulence")
(use "SQRoom")
(use "PolyPath")
(use "Polygon")
(use "Class_950_0")
(use "Sound")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 610)



(instance public rm610 of SQRoom
    (properties
        picture 610
        horizon 110
        north 613
        east 611
        west 609
    )

    (method (init)
        (ulence:roomVer(22891))
        (switch (gWest)
            (case 615
                (send gEgo:posn(206 135))
                (self:setScript(exitBar))
            )
            (case 620
                (send gEgo:
                    posn(192 113)
                    view(615)
                    setLoop(0)
                    cel(0)
                    setPri(9)
                    looper(0)
                    normal(0)
                    setStep(14 14)
                    cycleSpeed(0)
                )
                (self:setScript(flyOut))
            )
            (case 613
                (send gEgo:
                    x(87)
                    y(124)
                )
            )
            (default 
                (send gEgo:
                    x(24)
                    y(165)
                )
            )
        )
        (if (not proc999_5(gWest 615 620))
            (send gLongSong2:
                vol(70)
                number(804)
                loop(-1)
                playBed()
            )
        )
        (if (not proc0_6(75))
            (bike1:init())
            (bike2:init())
            (bike3:init())
            (send (ScriptID(706 1)):init())
            (biker2:init())
            (biker3:init())
        )
        (theSign:
            init()
            setCycle(Fwd)
        )
        (send gEgo:
            init()
            ignoreActors(1)
            illegalBits(0)
        )
        (super:init())
        (self:
            setFeatures(ship1 ship3 building door)
            setRegions(706)
            addObstacle((send ((Polygon:new())):
                    type(2)
                    init(0 0 319 0 319 158 295 158 295 162 283 162 253 162 253 158 225 158 225 148 207 148 207 142 176 142 176 135 214 135 214 132 149 132 131 126 123 121 94 103 68 103 73 123 63 131 44 136 0 136)
                    yourself()
                )
)
        )
        (if (not proc0_6(75))
            (self:addObstacle((send ((Polygon:new())):
                    type(2)
                    init(129 153 177 151 210 165 249 185 191 187 170 180 153 170 136 171 124 160)
                    yourself()
                )
))
        )
        Load(rsSOUND 804)
        Load(rsVIEW 615)
        Load(rsVIEW 610)
        Load(rsSOUND 147)
        Load(rsSOUND 836)
        (if (== (ulence:status) 1)
            (ulence:
                status(2)
                bikerComing(1)
            )
            Load(rsVIEW 632)
            Load(rsVIEW 634)
            Load(rsVIEW 633)
            Load(rsVIEW 635)
            Load(rsSOUND 50)
            Load(rsSOUND 837)
            Load(rsSOUND 841)
            (ulence:status(2))
        )(else
            (ulence:bikerComing(0))
        )
        (send (ScriptID(706 8)):
            init()
            nsLeft(0)
            nsTop(-1)
            nsBottom(86)
            nsRight(319)
        )
        (send (ScriptID(706 7)):
            init()
            nsLeft(0)
            nsTop(88)
            nsBottom(189)
            nsRight(319)
        )
    )


    (method (doit param1)
        (if ((== (ulence:status) 4) and (< (send (ScriptID(706 1)):distanceTo(gEgo)) 20))
            proc0_2()
            (ulence:status(6))
            (send gEgo:setScript(0))
            (ulence:deathLoop(1))
            (self:setScript(ScriptID(706 3)))
        )
        (if (script)
            0
        )(else
            (if (== (send gEgo:edgeHit) 1)
                (send gLongSong2:fade(0 30 5 0))
            )(else
                (if (== (send gEgo:edgeHit) 2)
                    (send gLongSong2:fade(0 30 5 0))
                )(else
                    (if (== (send gEgo:edgeHit) 4)
                        (send gLongSong2:fade(0 30 5 0))
                    )(else
                        (if ((send gEgo:inRect(192 122 221 137)))
                            (self:setScript(enterBar))
                        )(else
                            (if (((> Random(0 100) 85) and (== (ulence:status) 2)) and (send gEgo:inRect(116 154 146 164)))
                                proc0_2()
                                (ulence:status(3))
                                (send (ScriptID(706 1)):
                                    view(633)
                                    init()
                                    hide()
                                    posn(65506 127)
                                    setLoop(0)
                                    setScript(runOverScript1)
                                )
                                (send gEgo:setScript(ScriptID(706 5)))
                            )(else
                                (if (((> Random(0 100) 85) and (== (ulence:status) 2)) and (send gEgo:inRect(196 175 222 185)))
                                    proc0_2()
                                    (ulence:status(3))
                                    (send (ScriptID(706 1)):
                                        view(632)
                                        init()
                                        hide()
                                        posn(65508 - (send gEgo:y) 5)
                                        setLoop(0)
                                        setStep(15 15)
                                        setScript(runOverScript2)
                                    )
                                    (send gEgo:setScript(ScriptID(706 5)))
                                )(else
                                    (if (((> Random(0 100) 85) and (== (ulence:status) 2)) and (send gEgo:inRect(90 143 120 152)))
                                        proc0_2()
                                        (ulence:status(3))
                                        (send (ScriptID(706 1)):
                                            view(634)
                                            init()
                                            hide()
                                            posn(347 176)
                                            setLoop(1)
                                            setScript(runOverScript3)
                                        )
                                        (send gEgo:setScript(ScriptID(706 4)))
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
        (super:doit(rest param1))
    )

)
(instance flyOut of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gLongSong:
                    stop()
                    number(127)
                    vol(127)
                )
                = cycles 2
            )
            (case 1
                (thumpSound:
                    vol(127)
                    loop(1)
                    number(836)
                    play()
                )
                = cycles 1
            )
            (case 2
                (send gEgo:
                    setLoop(0)
                    cel(0)
                    setCycle(CT 3 1)
                    setMotion(MoveTo 130 127 self)
                )
            )
            (case 3
                = cycles 2
            )
            (case 4
                (thumpSound:
                    number(147)
                    play()
                )
                = seconds 4
            )
            (case 5
                (send gEgo:setCycle(End self))
            )
            (case 6
                (send gEgo:
                    view(0)
                    setLoop(1)
                    heading(270)
                    posn(- (send gEgo:x) 25 + (send gEgo:y) 25)
                )
                = cycles 1
            )
            (case 7
                proc0_1((send gEgo:loop) 0)
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance bikesFall of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (send gLongSong:
                    loop(1)
                    number(140)
                    play()
                )
                (bike1:setCycle(End self))
            )
            (case 1
                (bike2:setCycle(End self))
            )
            (case 2
                (bike3:setCycle(End self))
            )
            (case 3
                (self:dispose())
            )
        )
    )

)
(instance exitBar of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:setMotion(PolyPath 150 135 self))
            )
            (case 1
                proc0_1((send gEgo:loop) 0)
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance bikerScript of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (send (ScriptID(706 1)):
                    setLoop(0)
                    setCycle(Fwd)
                    setStep(4 4)
                    setMotion(MoveTo 159 134 self)
                )
            )
            (case 1
                (send (ScriptID(706 1)):setMotion(MoveTo 133 146 self))
            )
            (case 2
                (send (ScriptID(706 1)):
                    setLoop(1)
                    cel(0)
                    cycleSpeed(1)
                    setCycle(End self)
                )
            )
            (case 3
                = seconds 2
            )
            (case 4
                (biker2:setScript(biker2Script))
                (send (ScriptID(706 1)):
                    setPri(12)
                    setLoop(2)
                    cel(0)
                    posn(121 147)
                    cycleSpeed(0)
                    setCycle(End self)
                    setMotion(MoveTo 133 156)
                )
                = cycles 3
            )
            (case 5
                (bike1Sound:
                    init()
                    play()
                )
                (bike2Sound:init())
                (bike3Sound:init())
                (bike1:setCel(0))
            )
            (case 6
                (bike1:dispose())
                (send (ScriptID(706 1)):
                    view(634)
                    setLoop(1)
                    setStep(10 10)
                    setMotion(MoveTo 65486 - (send gEgo:y) 40 self)
                )
            )
            (case 7
                (self:dispose())
            )
        )
    )

)
(instance biker2Script of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (biker2:
                    view(630)
                    cycleSpeed(0)
                    setLoop(0)
                    posn(213 133)
                    setCycle(Fwd)
                    setStep(4 4)
                    setPri(9)
                    setMotion(MoveTo 167 133 self)
                )
            )
            (case 1
                (biker2:setMotion(MoveTo 134 162 self))
            )
            (case 2
                (biker2:
                    setLoop(1)
                    cycleSpeed(1)
                    cel(0)
                    posn(138 163)
                    setCycle(End self)
                )
            )
            (case 3
                (biker2:setPri(12))
                = seconds 2
            )
            (case 4
                (biker3:setScript(biker3Script))
                (biker2:
                    setLoop(2)
                    setCel(0)
                    posn(146 162)
                )
                = cycles 1
            )
            (case 5
                (biker2:
                    setCel(1)
                    posn(149 162)
                )
                = cycles 1
            )
            (case 6
                (biker2:
                    setCel(2)
                    posn(155 162)
                )
                = cycles 1
            )
            (case 7
                (biker2:
                    setCel(3)
                    posn(164 172)
                )
                = cycles 1
            )
            (case 8
                (biker2:
                    setCel(4)
                    posn(176 172)
                )
                = cycles 1
            )
            (case 9
                (biker2:
                    setCel(5)
                    posn(176 178)
                )
                (bike2:setCel(0))
                = cycles 1
            )
            (case 10
                (bike2Sound:play())
                (bike2:dispose())
                (biker2:
                    view(633)
                    setLoop(7)
                    setStep(10 10)
                    setPri(-1)
                    setMotion(MoveTo 44 83 self)
                )
            )
            (case 11
                (biker2:hide())
                (self:dispose())
            )
        )
    )

)
(instance biker3Script of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (biker3:
                    view(631)
                    posn(217 133)
                    setLoop(0)
                    setCycle(Fwd)
                    setPri(9)
                    setMotion(MoveTo 161 133 self)
                )
            )
            (case 1
                (biker3:setMotion(MoveTo 133 161 self))
            )
            (case 2
                (biker3:
                    setLoop(1)
                    posn(132 163)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 3
                (biker3:setPri(12))
                = seconds 2
            )
            (case 4
                (biker3:
                    setLoop(2)
                    setCel(0)
                    posn(145 167)
                )
                = cycles 1
            )
            (case 5
                (biker3:
                    setCel(1)
                    posn(168 168)
                )
                = cycles 1
            )
            (case 6
                (biker3:
                    setCel(2)
                    posn(176 170)
                )
                = cycles 1
            )
            (case 7
                (biker3:
                    setCel(3)
                    posn(194 170)
                )
                = cycles 1
            )
            (case 8
                (bike3Sound:play())
                (biker3:
                    view(632)
                    setLoop(5)
                    posn(205 173)
                    setStep(10 10)
                    setMotion(MoveTo 126 225 self)
                )
                (bike3:dispose())
            )
            (case 9
                = seconds 2
            )
            (case 10
                (send global2:newRoom(609))
            )
        )
    )

)
(instance enterBar of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:setMotion(PolyPath 214 135 self))
            )
            (case 1
                (if (proc0_6(75) or not proc0_6(15))
                    (send gLongSong2:fade(85 10 10 0))
                    (send global2:newRoom(615))
                )(else
                    (send gEgo:
                        view(615)
                        setLoop(0)
                        setCel(3)
                        setPri(9)
                        posn(227 114)
                    )
                    = seconds 2
                )
            )
            (case 2
                (thumpSound:
                    vol(127)
                    loop(1)
                    number(836)
                    play()
                )
                (send gEgo:posn(205 104))
                = cycles 1
            )
            (case 3
                (send gEgo:posn(188 95))
                = cycles 1
            )
            (case 4
                (send gEgo:posn(160 87))
                = cycles 1
            )
            (case 5
                (send gEgo:posn(146 88))
                = cycles 1
            )
            (case 6
                (send gEgo:posn(128 99))
                = cycles 1
            )
            (case 7
                (send gEgo:posn(116 112))
                = cycles 1
            )
            (case 8
                (send gEgo:posn(88 123))
                (thumpSound:
                    number(147)
                    play()
                )
                = seconds 2
            )
            (case 9
                (send gEgo:setCycle(End self))
            )
            (case 10
                (send gEgo:
                    view(0)
                    setLoop(1)
                    setHeading(270)
                    posn(- (send gEgo:x) 25 + (send gEgo:y) 25)
                )
                = cycles 1
            )
            (case 11
                proc0_1((send gEgo:loop) 0)
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance runOverScript1 of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (ulence:egoBusy(1))
                (send gLongSong2:
                    vol(25)
                    number(50)
                    loop(-1)
                    playBed()
                    fade(127 10 10 0)
                )
                = seconds 2
            )
            (case 1
                (send (ScriptID(706 6)):
                    init()
                    play()
                )
                (send (ScriptID(706 1)):
                    show()
                    setMotion(MoveTo 40 127 self)
                )
            )
            (case 2
                (ulence:status(4))
                proc0_3()
                (send (ScriptID(706 1)):
                    setLoop(4)
                    posn(57 129)
                    setPri(+ (send gEgo:priority) 1)
                    setMotion(MoveTo 192 174 self)
                )
            )
            (case 3
                (send (ScriptID(706 1)):
                    setLoop(0)
                    posn(209 177)
                    setMotion(MoveTo 369 177 self)
                )
            )
            (case 4
                (send gLongSong2:fade(0 10 10 0))
                (send (ScriptID(706 6)):fade())
                = seconds 3
            )
            (case 5
                (send gLongSong2:
                    vol(70)
                    number(804)
                    loop(-1)
                    playBed()
                )
                (send (ScriptID(706 1)):hide())
                = seconds 3
            )
            (case 6
                (if (<> (ulence:status) 6)
                    (ulence:
                        status(1)
                        fieldOff(0)
                        bikerComing(0)
                        egoBusy(0)
                    )
                    (send gEgo:setScript(0))
                    proc0_3()
                    Print("Boy, that was close!")
                )
                (self:dispose())
            )
        )
    )

)
(instance runOverScript2 of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (ulence:egoBusy(1))
                (send gLongSong2:
                    vol(25)
                    number(50)
                    loop(-1)
                    playBed()
                    fade(127 10 10 0)
                )
                = seconds 2
            )
            (case 1
                (send (ScriptID(706 6)):
                    init()
                    play()
                )
                (send (ScriptID(706 1)):
                    show()
                    setMotion(MoveTo 132 - (send gEgo:y) 7 self)
                )
            )
            (case 2
                (ulence:status(4))
                proc0_3()
                (send (ScriptID(706 1)):
                    setPri(+ (send gEgo:priority) 1)
                    setMotion(MoveTo 372 - (send gEgo:y) 7 self)
                )
            )
            (case 3
                (send gLongSong2:fade(0 10 10 0))
                (send (ScriptID(706 6)):fade())
                = seconds 3
            )
            (case 4
                (send gLongSong2:
                    vol(70)
                    number(804)
                    loop(-1)
                    playBed()
                )
                (send (ScriptID(706 1)):hide())
                = seconds 3
            )
            (case 5
                (if (<> (ulence:status) 6)
                    (ulence:
                        status(1)
                        fieldOff(0)
                        bikerComing(0)
                        egoBusy(0)
                    )
                    (send gEgo:setScript(0))
                    proc0_3()
                    Print("Boy, that was close!")
                )
                (self:dispose())
            )
        )
    )

)
(instance runOverScript3 of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (ulence:egoBusy(1))
                (send gLongSong2:
                    vol(25)
                    number(50)
                    loop(-1)
                    playBed()
                    fade(127 10 10 0)
                )
                = seconds 2
            )
            (case 1
                (send (ScriptID(706 6)):
                    init()
                    play()
                )
                (send (ScriptID(706 1)):
                    show()
                    setPri(15)
                    setMotion(MoveTo 182 176 self)
                )
            )
            (case 2
                (ulence:status(4))
                proc0_3()
                (send (ScriptID(706 1)):
                    setPri(+ (send gEgo:priority) 1)
                    posn(165 167)
                    setLoop(7)
                    setMotion(MoveTo 75 106 self)
                )
            )
            (case 3
                (send (ScriptID(706 1)):
                    setPri(-1)
                    setMotion(MoveTo 53 91 self)
                )
            )
            (case 4
                (send (ScriptID(706 1)):hide())
                (send gLongSong2:fade(0 10 10 0))
                (send (ScriptID(706 6)):
                    init()
                    play()
                )
                = seconds 3
            )
            (case 5
                (send gLongSong2:
                    vol(70)
                    number(804)
                    loop(-1)
                    playBed()
                )
                (if (<> (ulence:status) 6)
                    (ulence:
                        status(1)
                        fieldOff(0)
                        bikerComing(0)
                        egoBusy(0)
                    )
                    (send gEgo:setScript(0))
                    proc0_3()
                    Print("Boy, that was close!")
                )
                (self:dispose())
            )
        )
    )

)
(instance kickScript of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                proc0_2()
                (ulence:status(99))
                Load(rsVIEW 615)
                Load(rsVIEW 616)
                Load(rsVIEW 632)
                Load(rsVIEW 633)
                Load(rsVIEW 634)
                Load(rsSOUND 50)
                Load(rsSOUND 140)
                proc0_11(75 5)
                (send gEgo:setMotion(PolyPath 130 169 self))
            )
            (case 1
                (send gEgo:setHeading(90 self))
            )
            (case 2
                (send gEgo:
                    view(615)
                    setLoop(1)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 3
                (self:setScript(bikesFall self))
            )
            (case 4
                (send gEgo:setCycle(Beg self))
            )
            (case 5
                proc0_1((send gEgo:loop) 0)
                (send gEgo:
                    posn(- (send gEgo:x) 2 (send gEgo:y))
                    setLoop(0)
                )
                = cycles 1
            )
            (case 6
                (send gEgo:
                    setLoop(-1)
                    setHeading(270 self)
                )
            )
            (case 7
                (ulence:fieldOff(1))
                (send gEgo:
                    view(615)
                    setLoop(5)
                    setCycle(Walk)
                    setStep(6 4)
                    setMotion(MoveTo 25 + (send gEgo:y) 20 self)
                )
            )
            (case 8
                (send gLongSong:
                    number(0)
                    vol(0)
                    stop()
                )
                (send gLongSong2:
                    vol(127)
                    number(50)
                    loop(-1)
                    playBed()
                )
                = seconds 1
            )
            (case 9
                (send (ScriptID(706 1)):
                    init()
                    view(616)
                    posn(210 134)
                    setScript(bikerScript)
                )
                (send gEgo:setMotion(MoveTo 65506 (+ (send gEgo:y) 20) self))
            )
            (case 10
                (ulence:fieldOff(0))
                (send gEgo:dispose())
            )
        )
    )

)
(instance biker2 of Actor
    (properties
        x 223
        y 134
        yStep 4
        view 630
        priority 9
        signal 24593
        illegalBits 0
        xStep 4
    )
)
(instance biker3 of Actor
    (properties
        x 223
        y 134
        yStep 4
        view 631
        priority 9
        signal 24593
        illegalBits 0
        xStep 4
    )
)
(instance theSign of Prop
    (properties
        x 209
        y 75
        description "sign"
        sightAngle 45
        lookStr "The sign suggests that this place might be a bar."
        view 610
        priority 12
        signal 24592
    )
)
(instance bike1 of Prop
    (properties
        x 159
        y 150
        description "bike"
        lookStr "As you check these sand bikes out, you wonder what kind of cheeseball would own one."
        view 615
        loop 4
        priority 12
        signal 16401
    )

    (method (doVerb param1 param2 param3)
        (switch (param1)
            (case 2
                (if (not proc0_6(15))
                    Print("Why would you want to wreck the nice bike?")
                )(else
                    (if (not proc0_6(75))
                        (send global2:setScript(kickScript))
                    )
                )
            )
            (default 
                (super:doVerb(param1 rest param3))
            )
        )
    )

)
(instance bike2 of Prop
    (properties
        x 187
        y 160
        description "bike"
        lookStr "As you check these sand bikes out, you wonder what kind of cheeseball would own one."
        view 615
        loop 3
        priority 13
        signal 16401
    )

    (method (doVerb param1 param2 param3)
        (switch (param1)
            (case 2
                (if (not proc0_6(15))
                    Print("Why would you want to wreck the nice bike?")
                )(else
                    (if (not proc0_6(75))
                        (send global2:setScript(kickScript))
                    )
                )
            )
            (default 
                (super:doVerb(param1 rest param3))
            )
        )
    )

)
(instance bike3 of Prop
    (properties
        x 211
        y 168
        description "bike"
        lookStr "As you check these sand bikes out, you wonder what kind of cheeseball would own one."
        view 615
        loop 2
        priority 14
        signal 16401
    )

    (method (doVerb param1 param2 param3)
        (switch (param1)
            (case 2
                (if (not proc0_6(15))
                    Print("Why would you want to wreck the nice bike?")
                )(else
                    (if (not proc0_6(75))
                        (send global2:setScript(kickScript))
                    )
                )
            )
            (default 
                (super:doVerb(param1 rest param3))
            )
        )
    )

)
(instance ship1 of Feature
    (properties
        x 34
        y 88
        nsTop 49
        nsBottom 128
        nsRight 69
        description "space ship"
        sightAngle 45
        onMeCheck 16
        lookStr "This long-legged beauty stands silently waiting for its jet-faced owner to return."
    )
)
(instance ship3 of Feature
    (properties
        x 150
        y 85
        nsTop 52
        nsLeft 105
        nsBottom 118
        nsRight 196
        description "space ship"
        sightAngle 45
        onMeCheck 8
        lookStr "It looks like it came from the Planet of the Warts! This ship must be the Plantars Deluxe model with authentic Mosaic upholstery."
    )
)
(instance door of Feature
    (properties
        x 178
        y 111
        nsTop 85
        nsLeft 162
        nsBottom 138
        nsRight 194
        description "door"
        sightAngle 45
        onMeCheck 4
        lookStr "This must be the entrance to this building."
    )

    (method (doVerb param1 param2 param3)
        (switch (param1)
            (case 2
                (send global2:setScript(enterBar))
            )
            (default 
                (super:doVerb(param1 rest param3))
            )
        )
    )

)
(instance building of Feature
    (properties
        x 225
        y 93
        nsTop 23
        nsLeft 132
        nsBottom 164
        nsRight 319
        description "building"
        sightAngle 45
        onMeCheck 2
        lookStr "The Ulence Flats Bar. My, this place brings back some memories - most of them painful."
    )
)
(instance thumpSound of Sound
    (properties
        number 147
        flags 1
    )
)
(instance bike1Sound of Sound
    (properties
        number 837
        flags 1
    )
)
(instance bike2Sound of Sound
    (properties
        number 837
        flags 1
    )
)
(instance bike3Sound of Sound
    (properties
        number 837
        flags 1
    )
)
