(include "sci.sh")
(use "Main")
(use "SQRoom")
(use "RandCycle")
(use "Sound")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 19)


(local
    local0
    local1[6]
    local7 = 47
    local8 = 255

)
(procedure (localproc_02ec param1 param2 param3 param4)
    (var temp0, temp1, temp2)
    (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 proc0_18(global133 global143) -1 -1)
    Graph(13 temp0 - param2 1 temp1 + param4 1)
    localproc_0390()
    Wait(1)
    Wait(2)
    Graph(8 temp2)
    Graph(13 temp0 - param2 1 temp1 + param4 1)
)


(procedure (localproc_0390)
    Animate((send gCast:elements) 1)
    (egoHead:setCel(1))
    (trHead:
        setLoop(2)
        setCel(1)
    )
    (egoMouth:hide())
    (trMouth:hide())
    Animate((send gCast:elements) 1)
    (egoHead:setCel(0))
    (trHead:setCel(0))
    (egoMouth:show())
    (trMouth:show())
)


(instance public rm019 of SQRoom
    (properties
        picture 19
    )

    (method (init)
        (var temp0[50])
        Load(rsVIEW 18)
        Load(rsVIEW 28)
        Load(rsSOUND 105)
        (super:init())
        (shot1:init())
        (shot2:init())
        (egoHead:init())
        (egoMouth:init())
        (trHead:init())
        (self:
            setScript(startScript)
            setRegions(707)
        )
    )

)
(instance startScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds 2
            )
            (case 1
                (egoMouth:setCycle(RandCycle))
                = local0 proc0_12("\"Hey! I wanna know what the...\"" 67 5 132 70 300 28 global135 29 gColor 30 0)
                = seconds 2
            )
            (case 2
                (egoMouth:setCycle(0))
                = seconds 2
            )
            (case 3
                (egoMouth:setCycle(0))
                (trHead:setCycle(End self))
            )
            (case 4
                proc0_12(local0)
                (trHead:
                    setLoop(2)
                    setCel(0)
                )
                (trMouth:init())
                = cycles 10
            )
            (case 5
                (trMouth:setCycle(RandCycle))
                = local0 proc0_12("\"Listen! I can't explain it all to you now! They've got a bead on our coordinates! We've got to move fast!\"" 67 138 132 70 180 28 global135 29 gColor 30 1)
                = seconds 7
            )
            (case 6
                (trMouth:setCycle(0))
                proc0_12(local0)
                = cycles 2
            )
            (case 7
                localproc_02ec(local7 local8 51 319)
                (shotSound:play())
                (shot1:
                    posn(local8 local7)
                    setCycle(End self)
                )
                = cycles 5
            )
            (case 8
                (shot1:dispose())
                = cycles 2
            )
            (case 9
                = local8 (- local8 4)
                = local7 (- local7 3)
                localproc_02ec(local7 local8 51 319)
                (shotSound:play())
                (shot2:
                    posn(local8 local7)
                    setCycle(End self)
                )
                = cycles 5
            )
            (case 10
                (shot2:dispose())
                Animate((send gCast:elements) 0)
                (send global2:newRoom(20))
            )
        )
    )

)
(instance shotSound of Sound
    (properties
        number 105
    )
)
(instance shot1 of Prop
    (properties
        view 28
        priority 15
        signal 16400
    )
)
(instance shot2 of Prop
    (properties
        view 28
        priority 15
        signal 16400
    )
)
(instance egoHead of Prop
    (properties
        x 41
        y 97
        view 18
    )
)
(instance trHead of Prop
    (properties
        x 187
        y 109
        view 18
        loop 4
        priority 14
        signal 16
    )
)
(instance egoMouth of Prop
    (properties
        x 53
        y 77
        view 18
        loop 1
    )
)
(instance trMouth of Prop
    (properties
        x 181
        y 104
        view 18
        loop 3
        priority 14
        signal 16400
    )
)
