(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "rssScript")
(use "Class_950_0")
(use "StopWalk")
(use "Cycle")
(use "Game")
(use "User")
(use "PicView")
(use "Obj")
(script 703)


(local
    theOldPoliceRoom[13] = (300 305 315 310 315 305 300 299 306 299 300 310 320 )
    theOldPoliceRoom_2[13] = (300 300 310 320 310 300 299 306 299 300 305 315 310 )
    local26 = 1
    local27 = 1
    local28
    local29
    local30
    local31
    local32

)
(procedure (localproc_0afa)
    (var copLoop)
    = copLoop (cop:loop)
    DirLoop(cop GetAngle((cop:x) (cop:y) (send gEgo:x) (send gEgo:y)))
    (if (<> copLoop (cop:loop))
        (cop:forceUpd())
    )
    (cop:setMotion(0))
)


(procedure (localproc_0bd0)
    return 
        (if (((< (send gEgo:x) 260) and (> (send gEgo:x) 60)) and (< (send gEgo:y) 160))
            > (send gEgo:y) 80
        )(else
            0
        )
)


(procedure (localproc_0f8c 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 1)
)


(class rssScript of Script
    (properties
        client 0
        state -1
        start 0
        timer 0
        cycles 0
        seconds 0
        lastSeconds 0
        register 0
        script 0
        caller 0
        next 0
    )

    (method (doit)
        (var temp0, temp1)
        (super:doit())
        (if (local30)
            (if ((== (= temp0 (send ((User:curEvent)):type)) 1) or (== temp0 4))
                Display(703 0 108 local30)
                = local30 0
                = seconds 0
                = cycles 1
            )
            = temp0 0
        )
    )

)
(class butte of Rgn
    (properties
        script 0
        number 0
        timer 0
        keep 0
        initialized 0
        lookStr 0
        sawShadow 0
        beenCaptured 0
        policeLanded 4000
        junctioned 0
        roomCount 120
        oldPoliceRoom 0
        curPolice1Room 300
        curPolice2Room 305
        egoSwims 0
        onLedgeFlag 0
        sawGirlShadow 0
        entered315 0
    )

    (method (init param1)
        (super:init(rest param1))
    )


    (method (doit)
        (super:doit())
        (if (((((== global11 curPolice1Room) or (== global11 curPolice2Room)) and (((> (cop:y) 50) and (< (cop:y) 150)) or ((> (cop:y) 50) and (< (cop:y) 150)))) and (<> (send gEgo:view) 378)) and (<> local32 1))
            (send global2:setScript(warnScript))
        )
        (if (((< policeLanded 0) and (<> junctioned 1)) and ((== theOldPoliceRoom[local26] global11) or (== theOldPoliceRoom_2[local27] global11)))
            = junctioned 1
            (if (== theOldPoliceRoom[local26] global11)
                = oldPoliceRoom theOldPoliceRoom[(- local26 1)]
            )(else
                = oldPoliceRoom theOldPoliceRoom_2[(- local27 1)]
            )
        )(else
            (if (((== junctioned 1) and (<> theOldPoliceRoom[local26] global11)) and (<> theOldPoliceRoom_2[local27] global11))
                = junctioned 0
            )(else
                (if (< policeLanded 0)
                    (if (((localproc_0bd0() and (< --roomCount 0)) and not (cop:script)) and (<> local26 12))
                        = roomCount 120
                        (if (== theOldPoliceRoom[local26] global11)
                            = oldPoliceRoom theOldPoliceRoom[local26]
                        )(else
                            = oldPoliceRoom theOldPoliceRoom_2[local27]
                        )
                        = curPolice1Room theOldPoliceRoom[++local26]
                        = curPolice2Room theOldPoliceRoom_2[++local27]
                    )
                )(else
                    (if ((((not (send global2:script) and not (send gEgo:edgeHit)) and (<> global11 300)) and (<> global11 298)) and not --policeLanded)
                        proc0_2()
                        (send global2:setScript(policeLand))
                    )
                )
            )
        )
    )


    (method (newRoom param1 param2)
        = keep proc999_5(param1 299 300 305 306 310 315 320 298)
        = junctioned (= initialized 0)
        (super:newRoom(param1 rest param2))
    )

)
(instance warnScript of rssScript
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (cop:
                    setStep(0 0)
                    stopUpd()
                )
                (send gEgo:
                    setStep(0 0)
                    stopUpd()
                )
                proc0_2()
                Animate((send global5:elements) 0)
                = local32 1
                (if (== Random(1 2) 1)
                    = local30 proc0_12("\"This is Buford! You there Delphoid? I found Wilco... repeat I found Wilco!\"" 67 2 150 30 1 28 global135 29 global129)
                )(else
                    = local30 proc0_12("\"This is Delphoid! You there Buford? I found Wilco... repeat I found Wilco!\"" 67 2 150 30 1 28 global135 29 global129)
                )
                = seconds 7
            )
            (case 1
                Display(703 0 108 local30)
                proc0_3()
                (cop:
                    setStep(3 2)
                    startUpd()
                )
                (send gEgo:
                    setStep(3 2)
                    startUpd()
                )
                (if ((== gWest 531) and (== global11 305))
                    (send client:setScript(shootEgoScript))
                )
                (self:dispose())
            )
        )
    )

)
(instance public butteFallScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if ((send global5:contains(cop)))
                    (cop:setMotion(0))
                )
                (send gLongSong:
                    number(131)
                    vol(127)
                    loop(1)
                    play()
                )
                (send gEgo:)
            )
            (case 1
                = seconds 3
            )
            (case 2
                (send gLongSong:fade(0 1 2 1))
                = seconds 1
            )
            (case 3
                proc0_10()
            )
        )
    )

)
(instance policePod of View
    (properties
        x 138
        y 79
        lookStr "You give the Time Pod a long glance. It's not the most attractive vehicle you've ever seen. It resembles an overgrown titanium tennis shoe. A gold-tinted glass shield seals the top."
        view 305
        loop 1
        cel 10
        priority 5
        signal 16
    )
)
(instance door of Prop
    (properties
        x 79
        y 55
        view 305
        loop 2
        priority 6
        signal 16
    )
)
(instance police1 of Actor
    (properties
        x 102
        y 90
        lookStr "A Sequel Policeman! Better keep a low profile."
        view 378
        loop 2
        signal 16384
    )
)
(instance police2 of Actor
    (properties
        x 114
        y 91
        lookStr "A Sequel Policeman! Better keep a low profile."
        view 378
        loop 2
        signal 16384
    )
)
(instance public policeLand of rssScript
    (properties)

    (method (doit param1)
        (super:doit(rest param1))
        (if ((== state 5) and (== (send gLongSong2:prevSignal) -1))
            (self:cue())
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    setMotion(0)
                    stopUpd()
                )
                (send gIconBar:disable())
                = cycles 1
            )
            (case 1
                Print("Meanwhile, on another part of the planet....")
                = seconds 5
            )
            (case 2
                (send gIconBar:disable())
                = cycles 1
            )
            (case 3
                (if (gTheNewDialog)
                    (send gTheNewDialog:dispose())
                )
                (send global5:eachElementDo(156))
                DrawPic(300 30)
                (self:cue())
            )
            (case 4
                (send gEgo:setMotion(0))
                (policePod:
                    init()
                    stopUpd()
                )
                (door:
                    init()
                    cel(0)
                    setPri(7)
                )
                = cycles 3
            )
            (case 5
                (send gEgo:setMotion(0))
                (send gLongSong2:
                    number(124)
                    loop(1)
                    vol(127)
                    play()
                )
            )
            (case 6
                (send gLongSong2:
                    number(142)
                    play()
                )
                (door:setCycle(End self))
                (police1:
                    illegalBits(0)
                    setPri(6)
                    init()
                )
                (police2:
                    illegalBits(0)
                    setPri(6)
                    init()
                )
            )
            (case 7
                (send gLongSong2:stop())
                (send gEgo:setMotion(0))
                Print("Oh No!! The Sequel Police!!")
                = seconds 4
            )
            (case 8
                (send gEgo:setMotion(0))
                (door:dispose())
                (police2:setCycle(End self))
            )
            (case 9
                (police2:
                    view(7)
                    cycleSpeed(0)
                    setLoop(-1)
                    setCycle(Walk)
                    setMotion(MoveTo + (police2:x) 30 (police2:y) self)
                )
            )
            (case 10
                (police1:setCycle(End self))
            )
            (case 11
                proc0_13(police2 police1)
                (police1:
                    view(7)
                    cycleSpeed(0)
                    setLoop(-1)
                    setPri(12)
                )
                = cycles 1
            )
            (case 12
                (police1:
                    setCycle(Walk)
                    setMotion(MoveTo + (police1:x) 2 (police1:y) self)
                )
            )
            (case 13
                (if (gTheNewDialog)
                    (send gTheNewDialog:dispose())
                )
                (if (== global11 305)
                    = local30 proc0_12("\"Let's split up, I'll check out Wilco's time pod. Our sensors picked up some movement near there.\"" 67 2 10 30 1 28 global135 29 global129)
                    = seconds 7
                )(else
                    = local30 proc0_12("\"Let's split up, I'll check out Wilco's time pod.\"" 67 2 10 30 1 28 global135 29 global129)
                    = seconds 5
                )
            )
            (case 14
                Display(703 0 108 local30)
                = local30 proc0_12("\"Yeah, Wilco is around here somewhere. I'll search the vicinity.\"" 67 2 150 30 1 28 global135 29 global129)
                = seconds 5
            )
            (case 15
                (police2:setMotion(MoveTo 300 80))
                (if (gTheNewDialog)
                    (send gTheNewDialog:dispose())
                )
                = seconds 3
            )
            (case 16
                (send gIconBar:disable())
                = cycles 1
            )
            (case 17
                (send gEgo:setMotion(0))
                (policePod:
                    dispose()
                    delete()
                )
                (if (gTheNewDialog)
                    (send gTheNewDialog:dispose())
                )
                DrawPic(global11 30)
                (police1:
                    dispose()
                    delete()
                )
                (police2:
                    dispose()
                    delete()
                )
                (send gEgo:
                    show()
                    setCycle(StopWalk 4)
                )
                (if (== global11 305)
                    (send (ScriptID(305 1)):show())
                )
                (send global5:eachElementDo(184))
                (send ((send gEgo:_head)):show())
                = cycles 1
            )
            (case 18
                (send gIconBar:enable())
                proc0_3()
                (send global2:setScript(0))
            )
        )
    )

)
(instance public cop of Actor
    (properties
        lookStr "A Sequel Policeman! Better keep a low profile."
        view 7
        priority 8
        signal 8208
    )
)
(instance public shootEgoScript of Script
    (properties)

    (method (changeState newState)
        (asm
            lap     newState
            aTop    state
            push    
            dup     
            ldi     0
            eq?     
            bnt     code_0c7d
            pushi   0
            callb   proc0_2, 0
            pushi   #setMotion
            pushi   1
            pushi   0
            lag     gEgo
            send    6
            pushi   0
            call    localproc_0afa, 0
            pushi   4
            dup     
            pushi   0
            lofsa   cop
            send    4
            push    
            pushi   #y
            pushi   0
            lofsa   cop
            send    4
            push    
            pushi   #x
            pushi   0
            lag     gEgo
            send    4
            push    
            pushi   #y
            pushi   0
            lag     gEgo
            send    4
            push    
            callk   GetAngle, 8
            sal     local31
            push    
            ldi     110
            gt?     
            bnt     code_0c76
            lsl     local31
            ldi     235
            lt?     
            bnt     code_0c76
            pushi   #loop
            pushi   0
            lofsa   cop
            send    4
            push    
            ldi     2
            ne?     
            bnt     code_0c76
            pushi   #loop
            pushi   1
            pushi   2
            lofsa   cop
            send    6
code_0c76:  ldi     2
            aTop    cycles
            jmp     code_0f54
code_0c7d:  dup     
            ldi     1
            eq?     
            bnt     code_0ca9
            pushi   #setMotion
            pushi   1
            pushi   0
            lag     gEgo
            send    6
            pushi   #view
            pushi   1
            pushi   13
            pushi   7
            pushi   1
            pushi   0
            pushi   142
            pushi   4
            class   CT
            push    
            pushi   1
            pushi   1
            pushSelf
            lofsa   cop
            send    24
            jmp     code_0f54
code_0ca9:  dup     
            ldi     2
            eq?     
            bnt     code_0e41
            pushi   #setMotion
            pushi   1
            pushi   0
            lag     gEgo
            send    6
            pushi   #setCycle
            pushi   1
            class   End
            push    
            lofsa   cop
            send    6
            pushi   #distanceTo
            pushi   1
            lofsa   cop
            push    
            lag     gEgo
            send    6
            push    
            ldi     40
            gt?     
            bnt     code_0e38
            lsg     global11
            ldi     310
            eq?     
            bnt     code_0cfb
            pushi   #y
            pushi   0
            lag     gEgo
            send    4
            push    
            ldi     133
            gt?     
            bnt     code_0cfb
            pushi   #priority
            pushi   0
            lag     gEgo
            send    4
            push    
            ldi     13
            lt?     
code_0cfb:  not     
            bnt     code_0e38
            pushi   #loop
            pushi   0
            lofsa   cop
            send    4
            push    
            dup     
            ldi     0
            eq?     
            bnt     code_0d2e
            pushi   #x
            pushi   0
            lofsa   cop
            send    4
            push    
            ldi     30
            add     
            sal     local28
            pushi   #y
            pushi   0
            lofsa   cop
            send    4
            push    
            ldi     29
            sub     
            sal     local29
            jmp     code_0de1
code_0d2e:  dup     
            ldi     1
            eq?     
            bnt     code_0d54
            pushi   #x
            pushi   0
            lofsa   cop
            send    4
            push    
            ldi     35
            sub     
            sal     local28
            pushi   #y
            pushi   0
            lofsa   cop
            send    4
            push    
            ldi     27
            sub     
            sal     local29
            jmp     code_0de1
code_0d54:  dup     
            ldi     2
            eq?     
            bnt     code_0d76
            pushi   #x
            pushi   0
            lofsa   cop
            send    4
            sal     local28
            pushi   #y
            pushi   0
            lofsa   cop
            send    4
            push    
            ldi     27
            sub     
            sal     local29
            jmp     code_0de1
code_0d76:  dup     
            ldi     3
            eq?     
            bnt     code_0d98
            pushi   #x
            pushi   0
            lofsa   cop
            send    4
            sal     local28
            pushi   #y
            pushi   0
            lofsa   cop
            send    4
            push    
            ldi     40
            sub     
            sal     local29
            jmp     code_0de1
code_0d98:  dup     
            ldi     4
            eq?     
            bnt     code_0dbe
            pushi   #x
            pushi   0
            lofsa   cop
            send    4
            push    
            ldi     20
            add     
            sal     local28
            pushi   #y
            pushi   0
            lofsa   cop
            send    4
            push    
            ldi     27
            sub     
            sal     local29
            jmp     code_0de1
code_0dbe:  dup     
            ldi     5
            eq?     
            bnt     code_0de1
            pushi   #x
            pushi   0
            lofsa   cop
            send    4
            push    
            ldi     20
            sub     
            sal     local28
            pushi   #y
            pushi   0
            lofsa   cop
            send    4
            push    
            ldi     27
            sub     
            sal     local29
code_0de1:  toss    
            pushi   #x
            pushi   0
            lofsa   cop
            send    4
            push    
            pushi   #x
            pushi   0
            lag     gEgo
            send    4
            lt?     
            bnt     code_0e17
            pushi   4
            lsl     local29
            lsl     local28
            pushi   #y
            pushi   0
            lag     gEgo
            send    4
            push    
            ldi     32
            sub     
            push    
            pushi   #x
            pushi   0
            lag     gEgo
            send    4
            push    
            call    localproc_0f8c, 8
            jmp     code_0e3a
code_0e17:  pushi   4
            pushi   #y
            pushi   0
            lag     gEgo
            send    4
            push    
            ldi     32
            sub     
            push    
            pushi   #x
            pushi   0
            lag     gEgo
            send    4
            push    
            lsl     local29
            lsl     local28
            call    localproc_0f8c, 8
            jmp     code_0e3a
code_0e38:  ldi     0
code_0e3a:  ldi     2
            aTop    cycles
            jmp     code_0f54
code_0e41:  dup     
            ldi     3
            eq?     
            bnt     code_0eb5
            pushi   #setMotion
            pushi   1
            pushi   0
            lag     gEgo
            send    6
            pushi   5
            pushi   1
            pushi   26
            pushi   6
            pushi   1
            pushi   #loop
            pushi   0
            lag     gEgo
            send    4
            push    
            dup     
            ldi     4
            eq?     
            bnt     code_0e6d
            ldi     0
            jmp     code_0e98
code_0e6d:  dup     
            ldi     5
            eq?     
            bnt     code_0e79
            ldi     1
            jmp     code_0e98
code_0e79:  dup     
            ldi     6
            eq?     
            bnt     code_0e85
            ldi     0
            jmp     code_0e98
code_0e85:  dup     
            ldi     7
            eq?     
            bnt     code_0e91
            ldi     1
            jmp     code_0e98
code_0e91:  pushi   #loop
            pushi   0
            lag     gEgo
            send    4
code_0e98:  toss    
            push    
            pushi   7
            pushi   1
            pushi   0
            pushi   208
            pushi   1
            pushi   0
            pushi   142
            pushi   4
            class   CT
            push    
            pushi   2
            pushi   1
            pushSelf
            lag     gEgo
            send    36
            jmp     code_0f54
code_0eb5:  dup     
            ldi     4
            eq?     
            bnt     code_0ee2
            pushi   #setMotion
            pushi   1
            pushi   0
            lag     gEgo
            send    6
            pushi   #view
            pushi   1
            pushi   7
            lofsa   cop
            send    6
            pushi   #setCycle
            pushi   4
            class   CT
            push    
            pushi   1
            pushi   65535
            pushSelf
            lag     gEgo
            send    12
            jmp     code_0f54
code_0ee2:  dup     
            ldi     5
            eq?     
            bnt     code_0f01
            pushi   #setMotion
            pushi   1
            pushi   0
            lag     gEgo
            send    6
            pushi   #setCycle
            pushi   2
            class   End
            push    
            pushSelf
            lag     gEgo
            send    8
            jmp     code_0f54
code_0f01:  dup     
            ldi     6
            eq?     
            bnt     code_0f18
            pushi   #setMotion
            pushi   1
            pushi   0
            lag     gEgo
            send    6
            ldi     3
            aTop    seconds
            jmp     code_0f54
code_0f18:  dup     
            ldi     7
            eq?     
            bnt     code_0f28
            pushi   1
            pushi   8
            callb   proc0_10, 2
            jmp     code_0f54
code_0f28:  dup     
            ldi     8
            eq?     
            bnt     code_0f54
            pushi   #script
            pushi   0
            lag     global2
            send    4
            not     
            bnt     code_0f4b
            pushi   1
            pushi   8
            callb   proc0_10, 2
            pushi   #view
            pushi   1
            pushi   7
            lofsa   cop
            send    6
code_0f4b:  pushi   0
            callb   proc0_3, 0
            pushi   #dispose
            pushi   0
            self    4
code_0f54:  toss    
            ret     
        )
    )

)
(instance public theRoom of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "area"
    )

    (method (doVerb param1)
        (switch (param1)
            (case 4
                (send gLongSong2:
                    number(161)
                    loop(1)
                    vol(127)
                    flags(1)
                    play()
                )
                Print("HELLO! hello. . hello. .")
            )
            (default 
                0
            )
        )
    )

)
