(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "ulence")
(use "SQRoom")
(use "Polygon")
(use "Class_950_0")
(use "StopWalk")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 609)



(instance public rm609 of SQRoom
    (properties
        picture 609
        horizon 92
        north 612
        east 610
    )

    (method (init)
        (ulence:roomVer(22891))
        (switch (gWest)
            (case 610
                (if (< (send gEgo:y) 147)
                    (send gEgo:y(147))
                )
                (if (== (ulence:status) 99)
                    (send gEgo:posn(84 100))
                    (self:setScript(hideEgo))
                )(else
                    (send gLongSong2:
                        number(0)
                        vol(0)
                        stop()
                    )
                )
            )
            (case 612
                (if (< (send gEgo:x) 175)
                    (send gEgo:x(151))
                )(else
                    (if (> (send gEgo:x) 263)
                        (send gEgo:x(294))
                    )(else
                        (send gEgo:x(248))
                    )
                )
            )
            (default 
                (send gEgo:
                    x(247)
                    y(110)
                )
            )
        )
        (send gEgo:
            init()
            illegalBits(0)
            ignoreActors(1)
        )
        (ship1:init())
        (hole:init())
        (super:init())
        (self:
            setFeatures(ship2 tinysHut theSign)
            setRegions(706)
            addObstacle((send ((Polygon:new())):
                    type(2)
                    init(131 87 124 98 93 98 90 103 150 103 161 110 65 131 13 132 18 163 18 189 0 189 0 0 319 0 319 85 219 85 232 101 170 100 162 87)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(166 137 185 147 185 154 175 159 156 164 122 164 93 157 94 144 122 136)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(294 151 294 161 238 161 238 151)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(319 105 287 105 287 94 319 94)
                    yourself()
                )
)
        )
        (send (ScriptID(706 8)):
            init()
            nsLeft(0)
            nsTop(0)
            nsBottom(66)
            nsRight(319)
        )
        (send (ScriptID(706 7)):
            init()
            nsLeft(0)
            nsTop(67)
            nsBottom(189)
            nsRight(318)
        )
    )


    (method (doit param1)
        (if (script)
            0
        )(else
            (if ((== (send gEgo:edgeHit) 2) and (< (send gEgo:y) 100))
                (self:setScript(exitRight))
            )
        )
        (super:doit(rest param1))
    )

)
(instance hideEgo of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                proc0_2()
                (send (ScriptID(706 6)):
                    init()
                    play()
                )
                (send (ScriptID(706 1)):
                    init()
                    posn(329 173)
                    setLoop(1)
                    setMotion(MoveTo 65516 173 self)
                )
            )
            (case 1
                (send (ScriptID(706 6)):fade())
                (send (ScriptID(706 1)):
                    hide()
                    view(633)
                    setLoop(1)
                    posn(343 83)
                )
                = seconds Random(2 4)
            )
            (case 2
                (send (ScriptID(706 6)):play())
                (send (ScriptID(706 1)):
                    show()
                    setPri(4)
                    setMotion(MoveTo 247 83 self)
                )
            )
            (case 3
                (send (ScriptID(706 1)):
                    posn(244 85)
                    setLoop(2)
                    setMotion(MoveTo 244 235 self)
                )
            )
            (case 4
                (send (ScriptID(706 6)):fade())
                (send gLongSong2:fade())
                proc0_1()
                (send gEgo:
                    view(0)
                    setLoop(-1)
                    setCycle(StopWalk)
                    setMotion(MoveTo 160 101 self)
                )
            )
            (case 5
                (send gEgo:setMotion(MoveTo 187 125 self))
            )
            (case 6
                Print("\"Boy, that was CLOSE\", you think to yourself as you come out of hiding\nfrom behind Tiny's hut.\nInteresting how their bikes can\ngo through the force field.")
                proc0_1((send gEgo:loop) 0)
                proc0_3()
                (ulence:status(1))
                (self:dispose())
            )
        )
    )

)
(instance exitRight of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:setMotion(MoveTo (+ (send gEgo:x) 10) (send gEgo:y) self))
            )
            (case 1
                (send global2:newRoom(613))
            )
        )
    )

)
(instance ship1 of View
    (properties
        x 136
        y 155
        description "space ship"
        sightAngle 45
        lookStr "This must be the Volkswagen of space ships. You wonder why anyone would bother to lock it!"
        view 609
        priority 11
        signal 24592
    )

    (method (doVerb param1 param2 param3)
        (switch (param1)
            (case 2
                Print("This ship is not for sale.")
            )
            (default 
                (super:doVerb(param1 rest param3))
            )
        )
    )

)
(instance hole of View
    (properties
        x 268
        y 158
        nsTop 150
        nsLeft 243
        nsBottom 166
        nsRight 294
        description "hole"
        sightAngle 45
        lookStr "At the bottom of this excavation is a small craft almost totally buried in dirt. You remember barely making it back out when the engine died."
        view 609
        loop 1
        signal 24592
    )

    (method (doVerb param1 param2 param3)
        (switch (param1)
            (case 2
                Print("There it is - good old dirt!")
            )
            (case 10
                Print("Tastes like dirt.")
            )
            (case 11
                Print("Smells like dirt.")
            )
            (default 
                (super:doVerb(param1 rest param3))
            )
        )
    )

)
(instance theSign of Feature
    (properties
        y 44
        nsLeft 100
        nsBottom 44
        nsRight 191
        description "sign"
        sightAngle 45
        onMeCheck 4
        lookStr "This announces that you've found the location of Tiny's Used Space Ships. Lucky you."
    )
)
(instance ship2 of Feature
    (properties
        y 101
        nsTop 72
        nsLeft 292
        nsBottom 101
        nsRight 319
        description "space ship"
        sightAngle 45
        onMeCheck 16
        lookStr "This is the tail of a ship parked for business at the Ulence Flats Bar."
    )

    (method (doVerb param1 param2 param3)
        (switch (param1)
            (case 2
                Print("This ship is not for sale.")
            )
            (default 
                (super:doVerb(param1 rest param3))
            )
        )
    )

)
(instance tinysHut of Feature
    (properties
        y 128
        nsTop 32
        nsLeft 3
        nsBottom 128
        nsRight 136
        description "Tiny's Hut"
        sightAngle 45
        onMeCheck 2
        lookStr "This building is quite small. Maybe THIS is why it's called Tiny's."
    )
)
