(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "SQRoom")
(use "PolyPath")
(use "Polygon")
(use "Class_950_0")
(use "n958")
(use "DPath")
(use "Sound")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 55)


(local
    local0[34] = (0 158 16 154 33 164 42 161 92 171 110 164 130 162 140 172 168 165 204 145 222 142 262 160 268 171 295 172 319 178 319 189 0 189 )
    local34[42] = (0 157 15 154 32 164 43 161 69 165 94 147 94 137 102 132 102 127 129 108 129 91 173 89 199 71 198 49 218 47 233 34 234 28 256 28 284 7 284 )
    local76[156] = (95 148 93 130 129 110 133 91 174 89 198 72 199 50 216 48 233 35 235 28 256 28 284 6 284 0 319 0 319 69 283 105 278 104 276 101 283 90 282 87 274 89 262 101 258 100 254 105 240 101 226 114 235 117 214 136 203 139 172 160 133 174 128 167 108 164 91 171 74 164 319 178 278 171 265 160 271 155 297 126 302 113 298 107 284 104 319 70 233 122 243 112 240 112 236 114 231 115 227 114 228 110 240 102 245 105 253 105 257 102 265 101 265 98 274 89 279 88 282 90 282 93 275 99 276 104 283 106 291 106 299 110 301 115 299 119 296 123 267 156 259 162 253 164 253 161 243 152 240 142 232 141 223 142 219 140 )

)
(procedure (localproc_0914 param1 param2 param3 param4)
    (var temp0, temp1, temp2)
    (send gLongSong2:
        number(105)
        vol(127)
        loop(1)
        play()
    )
    (if (< param1 param3)
        = temp0 (- param1 1)
        = temp1 (+ param3 1)
    )(else
        = temp0 (- param3 1)
        = temp1 (+ param1 1)
    )
    = temp2 Graph(7 temp0 (- param2 1) temp1 (+ param4 1) 1)
    Graph(4 param1 param2 param3 param4 global143 -1 -1)
    Graph(13 temp0 - param2 1 temp1 + param4 1)
    Wait(1)
    Wait(4)
    Graph(8 temp2)
    Graph(13 temp0 - param2 1 temp1 + param4 1)
)


(instance public rm055 of SQRoom
    (properties
        picture 55
        style 30
        horizon 29
        north 40
        east 60
        vanishingX 320
        vanishingY 65466
    )

    (method (init)
        Load(rsVIEW 106)
        (switch (global12)
            (case north
                proc0_2()
                (self:setScript(enterScript))
            )
            (case east
                (if (> (send gEgo:y) 172)
                    (send gEgo:y(172))
                )(else
                    (if ((< 110 (send gEgo:y)) and (< (send gEgo:y) 135))
                        (send gEgo:y(108))
                    )
                )
            )
            (default 
                (send gEgo:
                    x(160)
                    y(160)
                )
            )
        )
        (if (proc0_6(0))
            proc0_2()
            proc958_0(128 7 13)
            (cop1:init())
            (cop2:init())
        )
        (send gEgo:init())
        (aircar:init())
        (theRubble:init())
        (theLeftBldg:init())
        (theStreet:init())
        (theSidewalk:init())
        (theArea:init())
        (self:setRegions(701))
        (super:init())
        (self:setRegions(705))
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(288 0 288 10 257 33 221 33 170 66 213 66 180 93 127 93 69 138 120 138 86 163 161 163 211 136 223 124 212 121 223 107 307 107 307 126 304 130 301 133 279 158 262 167 274 173 285 170 319 172 319 189 0 189 0 0)
                yourself()
            )
))
        (rubblePoly:
            points(@local0)
            size(17)
        )
        (buildingPoly:
            points(@local34)
            size(21)
        )
        (streetPoly:
            points(@local65426)
            size(9)
        )
        (sidewalkPoly:
            points(@local76)
            size(35)
        )
        (aircarPoly:
            points(@local65444)
            size(34)
        )
    )


    (method (newRoom param1)
        (if ((((== (send gEgo:edgeHit) 1) and (<> script exitScript)) and (<> script ScriptID(701 3))) and (<> (send (ScriptID(701 1)):script) ScriptID(701 4)))
            proc0_2()
            (self:setScript(exitScript 0 1))
        )(else
            (if ((== (send gEgo:edgeHit) 1) and not (send script:register))
                (super:newRoom(param1))
            )(else
                (super:newRoom(param1))
            )
        )
    )

)
(instance enterScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    posn(315 -1)
                    setMotion(MoveTo 280 47 self)
                )
            )
            (case 1
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance exitScript of Script
    (properties)

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

)
(instance cop1 of Actor
    (properties
        x 204
        y 125
        view 7
        loop 2
    )

    (method (doit param1)
        (super:doit(rest param1))
        (if (not (self:script))
            proc0_2()
            (self:setScript(shootEgo))
        )
    )

)
(instance cop2 of Actor
    (properties
        x 88
        y 135
        view 7
    )
)
(instance shootEgo of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:setMotion(MoveTo (- (send gEgo:x) 15) (+ (send gEgo:y) 50)))
                = cycles 1
            )
            (case 1
                (cop1:
                    setCycle(Walk)
                    setMotion(MoveTo 237 80 self)
                )
                (cop2:
                    setCycle(Walk)
                    setMotion(DPath 138 143 236 65)
                )
            )
            (case 2
                (cop1:
                    view(13)
                    cel(0)
                    setMotion(0)
                    setCycle(CT 4 1 self)
                )
            )
            (case 3
                proc0_2()
                (cop1:setCycle(End self))
                (if (< (cop1:x) (send gEgo:x))
                    localproc_0914(- (cop1:y) 27 (cop1:x) - (send gEgo:y) 32 (send gEgo:x))
                )(else
                    localproc_0914(- (send gEgo:y) 32 (send gEgo:x) - (cop1:y) 27 (cop1:x))
                )
            )
            (case 4
                5
                (send gEgo:)
            )
            (case 5
                (send gEgo:setCycle(CT 1 -1 self))
            )
            (case 6
                (send gEgo:setCycle(End self))
            )
            (case 7
                = seconds 4
            )
            (case 8
                proc0_10(8)
            )
        )
    )

)
(instance closeup of View
    (properties
        x 233
        y 188
        z 13
        description "aircar interior"
        sightAngle 45
        lookStr "The interior of the aircar sports many broken gauges and instruments as well as a glove box."
        view 106
        priority 13
        signal 16400
    )

    (method (doit)
        (super:doit())
        (if ((send gEgo:mover))
            (self:
                hide()
                dispose()
            )
        )
        (if (> (send (ScriptID(701 1)):y) 165)
            (send (ScriptID(701 1)):setPri(13))
        )
        (if (== (send global2:curPic) 31)
            (self:z(1000))
        )(else
            (self:z(13))
        )
    )

)
(instance glovebox of View
    (properties
        x 249
        y 189
        z 30
        description "glovebox"
        sightAngle 45
        view 106
        loop 1
        priority 14
        signal 16400
    )

    (method (doit)
        (super:doit())
        (if ((send gEgo:mover))
            (self:
                hide()
                dispose()
            )
        )
        (if (== (send global2:curPic) 31)
            (self:z(1000))
        )(else
            (self:z(30))
        )
    )


    (method (doVerb param1)
        (switch (param1)
            (case 2
                (switch (cel)
                    (case 0
                        (if (== (send ((send global9:at(15))):owner) 55)
                            = cel 2
                        )(else
                            = cel 1
                        )
                        (latchClick:play())
                    )
                    (case 1
                        = cel 0
                        (latchClick:play())
                    )
                    (case 2
                        (send gEgo:get(15))
                        = cel 1
                        proc0_11(40 5)
                        Print("After taking a quick look around to reassure yourself that the place is as dead as it looks, you achieve personal acquisition of the PocketPal(tm) laptop.")
                    )
                )
            )
            (case 1
                (switch (cel)
                    (case 0
                        Print("It is a closed glove box.")
                    )
                    (case 1
                        Print("The glove box is empty.")
                    )
                    (case 2
                        Print("It looks like a genuine PocketPal(tm) portable terminal.")
                    )
                )
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance aircar of Feature
    (properties
        x 257
        y 127
        nsTop 87
        nsLeft 216
        nsBottom 167
        nsRight 299
        description "aircar"
        sightAngle 45
        lookStr "A quick inspection of the disabled surface transport reveals nothing of interest other than a glove box."
    )

    (method (init)
        (super:init())
        (self:onMeCheck(aircarPoly))
    )


    (method (doVerb param1)
        (switch (param1)
            (case 2
                (if ((send global2:script))
                    0
                )(else
                    proc0_2()
                    (if (> (send gEgo:x) 260)
                        (carScript:register(1))
                    )
                    (send global2:setScript(carScript))
                )
            )
            (case 11
                Print("The zesty tang of nitroglycerin fills the air around the ship.")
            )
            (case 10
                Print("It tastes like ship.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance aircarPoly of Polygon
    (properties)
)
(instance carScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (register)
                    (send gEgo:setMotion(PolyPath 279 158 self))
                )(else
                    (send gEgo:setMotion(PolyPath 219 131 self))
                )
            )
            (case 1
                (if (register)
                    (send gEgo:setHeading(225 self))
                )(else
                    (send gEgo:setHeading(135 self))
                )
            )
            (case 2
                (glovebox:init())
                (closeup:
                    init()
                    stopUpd()
                )
                = cycles 1
            )
            (case 3
                (self:register(0))
                proc0_3()
                (send client:setScript(0))
            )
        )
    )

)
(instance theRubble of Feature
    (properties
        x 160
        y 187
        description "rubble"
        sightAngle 45
        lookStr "Boy, this place is a mess. No travel to the south is possible due to the dangerous terrain."
    )

    (method (init)
        (super:init())
        (self:onMeCheck(rubblePoly))
    )


    (method (doVerb param1)
        (switch (param1)
            (case 2
                Print("The rubble is too hazardous to attempt passage over.")
            )
            (case 11
                Print("It smells a little like pebbles and a little like the rubbles.")
            )
            (case 10
                Print("It tastes like a cement milkshake, only crunchy.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance rubblePoly of Polygon
    (properties)
)
(instance theSidewalk of Feature
    (properties
        description "building"
        lookStr "A sidewalk anyone would be proud to own."
    )

    (method (init)
        (super:init())
        (self:onMeCheck(sidewalkPoly))
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 11
                Print("This section of the sidewalk still smells fresh after hundreds of years. Guess those cement deodorizer ads really were right after all.")
            )
            (case 10
                Print("There's nothing like fresh air and sunshine to make a sidewalk taste great.")
            )
            (case 3
                (send (ScriptID(705 4)):doVerb(param1 param2))
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance sidewalkPoly of Polygon
    (properties)
)
(instance theStreet of Feature
    (properties
        description "street"
        lookStr "More high-speed travel surface lies useless."
    )

    (method (init)
        (super:init())
        (self:onMeCheck(streetPoly))
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 11
                Print("It smells like something that wasn't designed for noses.")
            )
            (case 10
                Print("Yoww! That was a bitter section! I don't think I want to lick road around here anymore.")
            )
            (case 3
                (send (ScriptID(705 4)):doVerb(param1 param2))
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance streetPoly of Polygon
    (properties)
)
(instance theLeftBldg of Feature
    (properties
        x 101
        y 140
        z 113
        description "building"
        sightAngle 25
        lookStr "This sealed, battered building is the last one standing in the southwestern area."
    )

    (method (init)
        (super:init())
        (self:onMeCheck(buildingPoly))
    )


    (method (doVerb param1)
        (switch (param1)
            (case 2
                Print("The building is closed-up with welded metal panels enhancing a non-access re-design scheme.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance buildingPoly of Polygon
    (properties)
)
(instance theArea of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "area"
        lookStr "You are at the southwestern boundary of this chunk of city."
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 3
                (send (ScriptID(705 4)):doVerb(param1 param2))
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance latchClick of Sound
    (properties
        number 812
    )
)
