(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "rssScript")
(use "rmnScript")
(use "SQRoom")
(use "RandCycle")
(use "MCyc")
(use "PolyPath")
(use "Polygon")
(use "Class_950_0")
(use "n958")
(use "Sound")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 320)


(local
    gLongSongPrevSignal
    local1
    local2
    local3[4]
    local7[25] = (5 0 124 82 5 1 116 90 5 2 110 93 5 3 112 95 5 4 112 95 5 5 113 95 32768 )
    local32[37] = (6 0 295 110 6 1 277 113 6 2 265 118 6 3 258 132 6 4 259 132 6 5 259 132 6 6 259 132 6 7 259 132 6 8 259 132 32768 )
    local69[17] = (1 0 131 152 1 1 131 150 1 2 131 148 1 0 131 146 32768 )
    local86[17] = (3 1 135 152 3 2 135 150 3 3 135 148 3 4 135 146 32768 )

)
(procedure (localproc_1938)
    Display(320 13 108 local2)
)


(instance public rm320 of SQRoom
    (properties
        picture 320
        horizon 15
        north 310
    )

    (method (init)
        proc958_0(128 0 300)
        proc958_0(132 143 51 57 132 133 115 883 884 887 889)
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(319 189 0 189 0 0 165 0 245 126 218 147 174 145 171 133 142 144 191 158 193 170 297 146 315 132 310 116 294 115 295 110 304 106 298 94 310 90 299 59 303 52 298 49 303 47 308 38 319 29)
                yourself()
            )
 (send ((Polygon:new())):
                type(1)
                init(319 26 307 33 270 5 272 0 319 0)
                yourself()
            )
 (send ((Polygon:new())):
                type(1)
                init(200 0 226 29 252 46 271 83 247 123 176 0)
                yourself()
            )
))
        (send gLongSong2:
            number(133)
            loop(1)
        )
        (send gLongSong:
            number(57)
            flags(1)
            loop(-1)
        )
        (if (> (butte:policeLanded) 0)
            Load(rsVIEW 305)
            Load(rsPIC 300)
        )(else
            proc958_0(128 7 5)
        )
        (if ((== gWest 297) and not Btest(32))
            (babe2:
                init()
                z(1000)
            )
            (babe3:
                init()
                z(1000)
            )
            (landSFX:init())
            Load(rsSCRIPT 810)
        )
        (self:
            setRegions(703)
            setFeatures(theSea theRoom)
        )
        (if (((== gWest north) and (butte:egoSwims)) or (== gWest 297))
            proc0_2()
            Load(rsVIEW 323)
            (butte:egoSwims(0))
            (send gEgo:
                view(323)
                normal(0)
                loop(1)
                posn(
                    (if (< (send gEgo:x) 51)
                        45
                    )(else
                        (if (> (send gEgo:x) 128)
                            128
                        )(else
                            (send gEgo:x)
                        )
                    )
 150)
            )
            (if (== gWest north)
                (self:style(42))
            )
            (self:setScript(swimScript))
        )(else
            proc0_2()
            (send gEgo:illegalBits(32784))
            (self:
                style(42)
                setScript(enterScript)
            )
        )
        (send gEgo:
            setPri(8)
            init()
        )
        (super:init())
        (if ((== (butte:curPolice1Room) 320) or (== (butte:curPolice2Room) 320))
            (butte:junctioned(1))
            (send (ScriptID(703 4)):
                posn(255 153)
                init()
                setScript(copEnters)
            )
        )(else
            (butte:junctioned(0))
        )
    )


    (method (doit)
        (var temp0)
        (if (script)
        )(else
            (if ((== script fallScript) and (== (send gEgo:edgeHit) 3))
                0
            )(else
                (if (not script and (== (send gEgo:edgeHit) 1))
                    proc0_2()
                    (send gEgo:illegalBits(32768))
                    (self:setScript(exitScript))
                )
            )
        )
        (super:doit())
        = temp0 (send gEgo:onControl(1))
        (if (script)
        )(else
            (if ((butte:junctioned) and not (send (ScriptID(703 4)):script))
                (if (== (butte:oldPoliceRoom) 310)
                    (send (ScriptID(703 4)):
                        posn(270 65531)
                        init()
                    )
                )
                (send (ScriptID(703 4)):setScript(copEnters))
            )(else
                (if ((& temp0 $0004) or (& temp0 $0040))
                    proc0_2()
                    (self:setScript(fallScript 0 temp0))
                )
            )
        )
    )

)
(instance fallScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (& register $0004)
                    (send gEgo:setPri(3))
                )(else
                    (if (& register $0040)
                        (send gEgo:setPri(3))
                    )
                )
                (send global2:setScript(ScriptID(703 1)))
                (self:dispose())
            )
        )
    )

)
(instance exitScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:setMotion(MoveTo (send gEgo:x) 65534 self))
            )
            (case 1
                (send global2:newRoom((send global2:north)))
            )
        )
    )

)
(instance enterScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    x(
                        (if (< (send gEgo:x) 250)
                            250
                        )(else
                            (if (> (send gEgo:x) 291)
                                291
                            )(else
                                (send gEgo:x)
                            )
                        )
)
                    y(50)
                )
                = cycles 1
            )
            (case 1
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance copEnters of Script
    (properties)

    (method (doit)
        (if (not (send global2:script) and (== state 0))
            (self:cue())
        )
        (if (not (send global2:script) and (< (send (ScriptID(703 4)):distanceTo(gEgo)) 80))
            (send (ScriptID(703 4)):setScript(ScriptID(703 5)))
            (self:dispose())
        )
        (super:doit())
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                0
            )
            (case 1
                (send (ScriptID(703 4)):
                    setCycle(Walk)
                    setMotion(MoveTo 300 100 self)
                )
            )
            (case 2
                (send (ScriptID(703 4)):setMotion(PolyPath (send gEgo:x) (send gEgo:y) self))
            )
        )
    )

)
(instance swimScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 1
            )
            (case 1
                (send gLongSong2:
                    number(883)
                    loop(-1)
                    vol(127)
                    flags(0)
                    play()
                )
                (send gEgo:
                    illegalBits(0)
                    setCycle(Walk)
                    setLoop(-1)
                    setMotion(MoveTo 160 154 self)
                )
            )
            (case 2
                (send gLongSong2:
                    number(0)
                    stop()
                )
                (send gEgo:
                    setLoop(1)
                    cel(0)
                    setCycle(End self)
                    xStep(2)
                    setMotion(MoveTo 185 (send gEgo:y))
                )
            )
            (case 3
                proc0_1(0 0)
                (send gEgo:
                    illegalBits(32784)
                    setPri(8)
                )
                (send gEgo:
                    xStep(3)
                    yStep(2)
                    setMotion(MoveTo 205 (send gEgo:y) self)
                )
            )
            (case 4
                (if (<> gWest 297)
                    proc0_3()
                    (send client:setScript(0))
                )(else
                    (if (not Btest(32))
                        Bset(32)
                        (send gLongSong:playBed())
                        = gLongSongPrevSignal (send gLongSong:prevSignal)
                        (while ((<> (send gLongSong:prevSignal) 10) and (== (send gLongSong:prevSignal) gLongSongPrevSignal))
                            (send gLongSong:check())
                        )
                        (send global2:setScript(subRiseScript))
                    )(else
                        proc0_3()
                        (send client:setScript(0))
                    )
                )
            )
        )
    )

)
(instance subRiseScript of rmnScript
    (properties)

    (method (doit param1)
        (super:doit(rest param1))
        (if (> state 2)
            (if (> (send gEgo:x) 206)
                proc0_2()
                (send global2:setScript(shootScript))
            )
            (if (< (send gEgo:x) 204)
                proc0_2()
                (send global2:setScript(enterSubScript))
            )
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    setLoop(1)
                    moveHead(0)
                    setHeading(270)
                )
                (babe2:
                    z(0)
                    setCycle(MCyc @local7)
                )
                (babe3:
                    z(0)
                    setCycle(MCyc @local32 self)
                )
            )
            (case 1
                = cycles 10
            )
            (case 2
                (sub:
                    init()
                    setLoop(1)
                    setCycle(Fwd)
                    setMotion(MoveTo 131 154 self)
                )
            )
            (case 3
                (send gLongSong2:
                    number(884)
                    loop(1)
                    vol(127)
                    play()
                )
                (sub:setCycle(MCyc @local69))
                (subTop:
                    init()
                    setCycle(MCyc @local86 self)
                )
            )
            (case 4
                (sub:setCycle(Fwd))
                = cycles 10
            )
            (case 5
                (hatch:
                    init()
                    x((subTop:x))
                    y((subTop:y))
                    setPri(+ (subTop:priority) 1)
                    setCycle(End self)
                )
                (hatchSnd:
                    number(133)
                    loop(1)
                    init()
                    play()
                )
            )
            (case 6
                (babeLeader:
                    init()
                    cycleSpeed(1)
                    setCycle(CT 5 1 self)
                )
            )
            (case 7
                (babeLeader:setCycle(CT 8 1))
                = cycles 9
            )
            (case 8
                (send gIconBar:disable())
                = cycles 1
            )
            (case 9
                (send gCast:eachElementDo(156))
                (bubble:z(2000))
                (arm:init())
                (mouth:init())
                (eyes:init())
                (send global2:drawPic(325 30))
                = cycles 1
            )
            (case 10
                (send gIconBar:enable())
                = seconds 2
            )
            (case 11
                (arm:setCel(1))
                = seconds 2
            )
            (case 12
                (eyes:setCel(1))
                (mouth:
                    loop(2)
                    setCycle(RandCycle 22)
                )
                (self:save1(proc0_12("\"You've got a lot of nerve coming back here, Roger Wilco.\"" 67 2 2 28 proc0_18(global153 global152) 29 gColor 30 1 70 315)))
                = seconds 10
            )
            (case 14
                (mouth:
                    loop(2)
                    setCycle(RandCycle 22)
                )
                (eyes:setCel(2))
                (self:save1(proc0_12("\"After leaving me the way you did, you male Scum!\"" 67 2 2 28 proc0_18(global153 global152) 29 gColor 30 1 70 315)))
                = seconds 10
            )
            (case 16
                (mouth:
                    loop(2)
                    setCycle(RandCycle 22)
                )
                (eyes:setCel(2))
                (self:save1(proc0_12("\"This is the last woman you'll ever dump on! Right girls?!\"" 67 2 2 28 proc0_18(global153 global152) 29 gColor 30 1 70 315)))
                = seconds 10
            )
            (case 18
                (self:save1(proc0_12("\"RIGHT!\"" 67 3 160 28 global150 29 gColor 30 0 70 315)))
                = local2 proc0_12("\"RIGHT!\"" 67 270 125 28 gBack 29 gColor 30 0 70 100)
                = seconds 10
            )
            (case 20
                (mouth:
                    loop(2)
                    setCycle(RandCycle 22)
                )
                (eyes:setCel(1))
                (self:save1(proc0_12("\"Said ya couldn't be tied down...\"" 67 2 2 28 proc0_18(global153 global152) 29 gColor 30 1 70 315)))
                = seconds 10
            )
            (case 22
                (self:save1(proc0_12("\"I said that?\"" 67 48 155 28 global140 29 gColor 30 0 70 315)))
                = seconds 10
            )
            (case 24
                (mouth:
                    loop(2)
                    setCycle(RandCycle 22)
                )
                (eyes:setCel(2))
                (self:save1(proc0_12("\"You said ya had to be free to roam the galaxy.\"" 67 2 2 28 proc0_18(global153 global152) 29 gColor 30 1 70 315)))
                = seconds 10
            )
            (case 26
                (self:save1(proc0_12("\"Was that me?\"" 67 48 155 28 global140 29 gColor 30 0 70 315)))
                = seconds 10
            )
            (case 28
                (mouth:
                    loop(2)
                    setCycle(RandCycle 22)
                )
                (eyes:setCel(1))
                (self:save1(proc0_12("\"You'll be sorrier than you look. We'll see to that!\"" 67 2 2 28 proc0_18(global153 global152) 29 gColor 30 1 70 315)))
                = seconds 10
            )
            (case 30
                (self:save1(proc0_12("\"YEAH!\"" 67 3 160 28 global150 29 gColor 30 0 70 315)))
                = local2 proc0_12("\"YEAH!\"" 67 270 125 28 gBack 29 gColor 30 0 70 100)
                = seconds 10
            )
            (case 32
                (mouth:
                    loop(2)
                    setCycle(RandCycle 22)
                )
                (eyes:setCel(1))
                (self:save1(proc0_12("\"Into the sub, fly boy.\"" 67 2 2 28 proc0_18(global153 global152) 29 gColor 30 1 70 315)))
                = seconds 10
            )
            (case 34
                (send gIconBar:disable())
                = cycles 1
            )
            (case 35
                (send gCast:eachElementDo(184))
                (send global2:drawPic(320 30))
                (babeLeader:
                    loop(0)
                    cel(0)
                    setPri(14)
                    posn(117 144)
                )
                (mouth:dispose())
                (arm:dispose())
                (eyes:dispose())
                = cycles 1
            )
            (case 36
                (send gIconBar:enable())
                proc0_3()
            )
            (default 
                (mouth:
                    setLoop(1)
                    setCycle(0)
                )
                (eyes:setCel(0))
                (self:restore())
                localproc_1938()
                = cycles 1
            )
        )
    )

)
(instance shootScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gLongSong2:
                    number(887)
                    vol(127)
                    loop(1)
                    play()
                )
                (babeLeader:
                    loop(0)
                    cel(0)
                    x(117)
                    y(144)
                    setCycle(End self)
                )
            )
            (case 1
                (send gLongSong2:
                    number(889)
                    vol(127)
                    loop(1)
                    play()
                )
                (send gEgo:
                    normal(0)
                    view(321)
                    loop(1)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 2
                Animate((send gCast:elements) 0)
                proc0_10(2 21)
            )
        )
    )

)
(instance enterSubScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    illegalBits(0)
                    setCycle(Walk)
                    setMotion(PolyPath 179 145)
                )
                = cycles 1
            )
            (case 1
                (send gEgo:
                    normal(0)
                    view(321)
                    loop(2)
                    cel(0)
                    posn(179 144)
                    setPri(15)
                    setCycle(End)
                )
                = cycles 7
            )
            (case 2
                (landSFX:play())
                (send gEgo:
                    illegalBits(0)
                    loop(3)
                    cel(0)
                    posn(143 144)
                    cycleSpeed(1)
                    setCycle(End self)
                )
            )
            (case 3
                (send gEgo:
                    normal(1)
                    dispose()
                )
                (babeLeader:
                    loop(4)
                    cel(0)
                    posn(130 144)
                    setPri(15)
                    setCycle(End self)
                )
            )
            (case 4
                (babeLeader:dispose())
                (hatch:setCycle(Beg self))
            )
            (case 5
                (hatchSnd:
                    number(132)
                    play()
                )
                (hatch:dispose())
                = cycles 1
            )
            (case 6
                (send gLongSong:
                    number(51)
                    loop(-1)
                    flags(1)
                    play()
                )
                (subTop:setCycle(Beg))
                (subTop:dispose())
                (sub:setMotion(MoveTo 131 200))
                = seconds 3
            )
            (case 7
                (sub:dispose())
                = cycles 1
            )
            (case 8
                (send global2:newRoom(321))
                (self:dispose())
            )
        )
    )

)
(instance babeLeader of Actor
    (properties
        x 142
        y 122
        description "latex babe leader"
        sightAngle 90
        lookStr "She looks like she might be familiar to you someday. The gun in her hand looks like it could limit the chance of any lasting relationship in the future however."
        view 321
        loop 7
        priority 15
        signal 16
    )

    (method (doVerb param1)
        (switch (param1)
            (case 2
                Print("Hey! Would you like your chest cavity to host her spear?")
            )
            (case 4
                Print("The time for talk on your part appears to have passed. Speak now and forever hold your pieces.")
            )
            (case 11
                Print("You can bet she smells better than you. Better just speculate on this one or you'll be snorting spear.")
            )
            (case 10
                Print("Best just keep your buds packed, Buckwheat. Besides, you should be worried about dying now - not thinking about stuff like that.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance landSFX of Sound
    (properties
        number 115
        priority 15
    )
)
(instance babe2 of Prop
    (properties
        x 126
        y 92
        description "latex babe"
        lookStr "This one looks committed to helping you find out just how good you'd look on a spit."
        view 321
        loop 5
    )

    (method (doVerb param1)
        (switch (param1)
            (case 2
                Print("Hey! You must want to know how you look with convenient handles protruding from each side of your less-than-studly self.")
            )
            (case 4
                Print("The time for talk on your part appears to have passed. Speak now and forever hold your pieces.")
            )
            (case 11
                Print("This would be an excellent time to keep your nostrils to yourself.")
            )
            (case 10
                Print("Gee! Maybe you should walk right on up to her and give it a try.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance babe3 of Prop
    (properties
        x 298
        y 121
        description "latex babe"
        lookStr "Her speargun is pointed in a direction that eliminates any need for the time consuming act of second thought."
        view 321
        loop 6
        priority 14
        signal 16
    )

    (method (doVerb param1)
        (switch (param1)
            (case 2
                Print("Do it and die.")
            )
            (case 4
                Print("She looks completely uninterested in conversing with the likes of you.")
            )
            (case 11
                Print("This would be an excellent time to keep your nostrils to yourself.")
            )
            (case 10
                Print("Yeah! Right!")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance sub of Actor
    (properties
        x 120
        y 200
        description "submarine"
        sightAngle 90
        lookStr "The submarine has a fairly sporty look to it. The hydrodynamic surfaces give it a distinct appearance different from those fine vessels you've travelled aboard recently."
        yStep 3
        view 320
        loop 1
        priority 12
        signal 16384
        cycleSpeed 1
    )

    (method (doVerb param1)
        (switch (param1)
            (case 3
                (super:doVerb(param1))
            )
            (case 2
                (send global2:setScript(enterSubScript))
            )
            (case 11
                Print("This isn't a good time for your interesting vessel-sniffing hobby.")
            )
            (case 10
                Print("Nah, it's not a good time to slap the old buds on barnacles.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance subTop of Actor
    (properties
        x 135
        y 154
        description "submarine"
        sightAngle 90
        lookStr "The submarine has a fairly sporty look to it. The hydrodynamic surfaces give it a distinct appearance different from those fine vessels you've travelled aboard recently."
        view 320
        loop 3
        priority 13
        signal 16400
        cycleSpeed 1
    )

    (method (doVerb param1)
        (switch (param1)
            (case 3
                (super:doVerb(param1))
            )
            (case 2
                (send global2:setScript(enterSubScript))
            )
            (case 4
            )
            (case 11
                Print("This isn't a good time for your interesting vessel-sniffing hobby.")
            )
            (case 10
                Print("Nah, it's not a good time to slap the old buds on barnacles.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance hatch of Prop
    (properties
        description "hatch"
        sightAngle 90
        lookStr "That hatch looks like the perfect place to have an entry/exit device."
        view 320
        loop 2
        signal 16384
        cycleSpeed 1
    )

    (method (doVerb param1)
        (switch (param1)
            (case 3
                (super:doVerb(param1))
            )
            (case 2
                (send global2:setScript(enterSubScript))
            )
            (case 4
            )
            (case 11
                Print("This isn't a good time for your interesting vessel-sniffing hobby.")
            )
            (case 10
                Print("Hmm...freshly lubricated.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance bubble of Prop
    (properties
        x 130
        y 184
        description "bubbles"
        sightAngle 90
        lookStr "Bubbles are churned out by the currently slow moving, nearly surfaced props."
        view 320
        priority 15
        signal 16
    )
)
(instance arm of Prop
    (properties
        x 171
        y 104
        view 325
    )
)
(instance mouth of Prop
    (properties
        x 171
        y 60
        view 325
        loop 2
    )
)
(instance eyes of Prop
    (properties
        x 172
        y 39
        view 325
        loop 3
    )
)
(instance zCode of Code
    (properties)

    (method (doit param1)
        (send param1:z((- (send param1:z) 1000)))
    )

)
(instance theRoom of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "buttes"
        lookStr "Here at the base of the buttes lies the legendary Sea of Estros.  The shimmering crystal-clear water is calm and inviting, giving no hint of the currents that could suck you under fast enough to pull your skin off and leave your insides standing on the shore.  We could show you that, but it would be in bad taste."
    )

    (method (doVerb param1)
        (switch (param1)
            (case 4
                (send (ScriptID(703 6)):doVerb(param1))
            )
            (case 1
                Print("Here at the base of the buttes lies the legendary Sea of Estros.  The shimmering crystal-clear water is calm and inviting, giving no hint of the currents that could suck you under fast enough to pull your skin off and leave your insides standing on the shore.  We could show you that, but it would be in bad taste.")
            )
            (default 
                (super:doVerb())
            )
        )
    )

)
(instance theSea of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "sea"
        onMeCheck 16
        lookStr "The water here is quite deep."
    )
)
(instance hatchSnd of Sound
    (properties)
)
