(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "SQRoom")
(use "MCyc")
(use "PolyPath")
(use "Polygon")
(use "Class_950_0")
(use "n958")
(use "StopWalk")
(use "Sound")
(use "Cycle")
(use "User")
(use "PicView")
(use "Obj")
(script 297)


(local
    AChangeIMade[41] = (0 2 202 19 0 2 198 28 0 3 194 35 0 2 191 55 0 3 188 69 0 2 185 90 0 3 182 104 0 2 178 125 0 3 175 141 0 6 169 106 32768 )
    local41[21] = (0 6 166 88 0 5 159 99 0 4 158 132 0 5 156 124 0 6 157 127 32768 )
    local62[29] = (0 0 75 9 0 0 77 32 0 0 78 56 0 0 78 77 0 1 84 79 0 2 89 103 0 3 89 98 32768 )
    local91

)
(instance public rm297 of SQRoom
    (properties
        picture 297
    )

    (method (init)
        (var temp0[50])
        proc958_0(132 129 130 131 134)
        proc0_2()
        proc958_0(128 392 304)
        (self:
            setFeatures(hole theSkulls theNest theRoom)
            addObstacle((send ((Polygon:new())):
                    type(2)
                    init(0 189 0 0 319 0 319 189 233 189 220 154 227 133 191 124 152 118 112 121 92 128 79 129 85 146 206 154 218 189)
                    yourself()
                )
)
        )
        (send gEgo:
            init()
            view(392)
            normal(0)
            setLoop(1)
            x(202)
            y(65516)
            setPri(6)
        )
        (if (Btest(37))
            (sp:
                init()
                loop(4)
                cel(0)
                posn(89 98)
                stopUpd()
            )
        )
        (super:init())
        (self:setScript(fallScript))
    )


    (method (doit)
        (super:doit())
        (if (script)
            (send script:doit())
        )(else
            (if (((not local91 and not (send gEgo:mover)) and Btest(37)) and (== Random(1 3000) 50))
                = local91 1
                (maharg:init())
            )(else
                (if (proc0_5(gEgo 1024))
                    proc0_2()
                    (send global2:setScript(exitNest))
                )
            )
        )
    )


    (method (newRoom param1)
        (if (((== script exitNest) and (< (exitNest:state) 3)) and (== (send gEgo:edgeHit) 3))
            = param1 0
        )(else
            (super:newRoom(param1))
        )
    )

)
(instance maharg of Prop
    (properties
        y 50
        description "helpless stranger"
        lookStr "It looks as though another unfortunate adventurer is suffering a similiar fate!"
        view 304
        loop 3
        signal 2048
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            setCycle(Fwd)
            doit()
        )
    )


    (method (doit)
        (super:doit())
        (if (<= x 320)
            (self:
                x(+ x 3)
                y(- y 1)
            )
        )(else
            (self:dispose())
        )
    )

)
(instance fallScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gLongSong:stop())
                (aSound:
                    number(131)
                    loop(1)
                    play()
                )
                (send gEgo:setCycle(MCyc @local0 self))
            )
            (case 1
                (aSound:
                    number(129)
                    play()
                )
                (send gEgo:setCycle(MCyc @local41 self))
            )
            (case 2
                (aSound:
                    number(130)
                    play()
                )
                = cycles 10
            )
            (case 3
                (send gEgo:
                    view(0)
                    normal(1)
                    setLoop(-1)
                    loop(2)
                    x(157)
                    y(127)
                    setCycle(StopWalk 4)
                    setPri(-1)
                    setStep(3 2)
                )
                (send gLongSong:
                    number(53)
                    loop(-1)
                    vol(127)
                    playBed()
                )
                Animate((send gCast:elements) 0)
                (if (not Btest(32))
                    Print("Hey! Those talon things hurt! You didn't much care for the landing either.")
                )
                = cycles 1
            )
            (case 4
                (if (not Btest(37))
                    (sp:
                        init()
                        setScript(spFallScript)
                    )
                )
                = cycles 1
            )
            (case 5
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance spFallScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (Btest(32))
                    (self:cue())
                )(else
                    = cycles 75
                )
            )
            (case 1
                Bset(37)
                (spSound:play())
                = cycles 3
            )
            (case 2
                (sp:setCycle(MCyc @local62 self))
            )
            (case 3
                (spSound:
                    number(134)
                    vol(127)
                    play()
                )
                (sp:stopUpd())
                (send client:setScript(0))
            )
        )
    )

)
(instance searchBody of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    illegalBits(0)
                    setMotion(PolyPath 105 130 self)
                )
            )
            (case 1
                (send gEgo:
                    normal(0)
                    view(304)
                    loop(1)
                    cel(0)
                    x(- (send gEgo:x) 5)
                    cycleSpeed(2)
                    setCycle(End)
                )
                = cycles 20
            )
            (case 2
                (send gEgo:setCycle(Beg))
                = cycles 20
            )
            (case 3
                Print("Your frisking of the skewered Sequel Policeman turns up a paper-wrapped wad of used chewing gum.")
                proc0_11(55 5)
                (send gEgo:
                    normal(1)
                    view(0)
                    cycleSpeed(0)
                    setCycle(StopWalk 4)
                    setMotion(MoveTo (send gEgo:x) + (send gEgo:y) 2 self)
                )
            )
            (case 4
                proc0_3()
                (send gEgo:illegalBits(32768))
                (send client:setScript(0))
            )
        )
    )

)
(instance exitNest of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    illegalBits(0)
                    setMotion(PolyPath 212 158 self)
                )
            )
            (case 1
                (send gEgo:
                    normal(0)
                    view(304)
                    setLoop(2)
                    cel(0)
                    cycleSpeed(1)
                    setCycle(CT 10 1 self)
                )
            )
            (case 2
                (send gEgo:
                    setPri(14)
                    setCycle(End self)
                )
            )
            (case 3
                (send gLongSong2:
                    number(131)
                    vol(127)
                    loop(1)
                    play()
                )
                (send gEgo:
                    yStep(20)
                    setMotion(MoveTo (send gEgo:x) 240 self)
                )
            )
            (case 4
                = seconds 3
            )
            (case 5
                (send gLongSong2:
                    number(143)
                    loop(0)
                    play(self)
                )
            )
            (case 6
                (send gEgo:illegalBits(32768))
                (send gLongSong:fade())
                (send global2:newRoom(320))
            )
        )
    )

)
(instance sp of Prop
    (properties
        x 75
        y 65516
        description "dead Sequel Policeman"
        sightAngle 45
        lookStr "My, my! Rather than the Sequel Policeman penetrating the inner sanctum of the nest, the reverse obviously occurred."
        view 304
        priority 6
        signal 16400
    )

    (method (doVerb param1)
        (switch (param1)
            (case 2
                (if (== (send ((send gInv:at(6))):owner) 297)
                    (send gEgo:get(6))
                    proc0_2()
                    (send global2:setScript(searchBody))
                )(else
                    Print("What else do you want? A bone marrow sample? You've already cleaned the guy's pockets.")
                )
            )
            (case 4
                Print("\"Help! A giant branch has penetrated my vital organs and I can't get up!\"")
                Print("But, seriously. Did you actually think this guy has time to talk to you? He's busy being dead.")
            )
            (case 11
                Print("At this moment the Sequel policeman has no distinct smell other than that of someone with less than exemplary personal hygiene habits. Give him a few days or so and he'll be quite aromatic, not to mention pumped up like a ball park frank!")
            )
            (case 10
                Print("Take it from someone who knows sick. Licking corpses is going way beyond just pushing the envelope of dementia. Grab the reins, pal.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance hole of Feature
    (properties
        x 211
        y 152
        nsTop 146
        nsLeft 200
        nsBottom 158
        nsRight 223
        description "hole"
        sightAngle 45
        lookStr "You notice a small breach in the side of the nest."
    )

    (method (doVerb param1)
        (switch (param1)
            (case 2
                proc0_2()
                (send global2:setScript(exitNest))
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance theRoom of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "buttes"
        sightAngle 45
        lookStr "You find yourself in a nest perched high above the irregular surface of this butte-laden planet."
    )

    (method (doVerb param1)
        (self:
            x((send ((User:curEvent)):x))
            y((send ((User:curEvent)):y))
        )
        (switch (param1)
            (case 4
                (aSound:
                    number(161)
                    loop(1)
                    play()
                )
                Print("HELLO! hello. . hello. .")
            )
            (default 
                (super:doVerb(param1))
            )
        )
        (self:
            x(0)
            y(0)
        )
    )

)
(instance theSkulls of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "skulls"
        sightAngle 45
        onMeCheck 16384
        lookStr "The inedible portions of the pterodactyl's previous meals lie scattered about in the nest."
    )

    (method (doVerb param1)
        (self:
            x((send ((User:curEvent)):x))
            y((send ((User:curEvent)):y))
        )
        (switch (param1)
            (case 4
                Print("I'm sure the skull would love to converse with you if it still bore the softer matter which once made it a complete and functional head.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
        (self:
            x(0)
            y(0)
        )
    )

)
(instance theNest of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "nest"
        sightAngle 45
        onMeCheck 32
        lookStr "The huge nest is constructed of sticks (and assorted being parts) gathered from who knows where on this bleak, but pleasant, planet. It is then woven and cemented in place by a generous helping of pterodactyl saliva."
    )

    (method (doVerb param1)
        (self:
            x((send ((User:curEvent)):x))
            y((send ((User:curEvent)):y))
        )
        (super:doVerb(param1))
        (self:
            x(0)
            y(0)
        )
    )

)
(instance aSound of Sound
    (properties)
)
(instance spSound of Sound
    (properties
        number 131
        vol 85
    )
)
