(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Sound")
(use "Cycle")
(use "PV")
(use "Obj")
(script 307)


(local
    local0

)
(instance public openPbox of Script
    (properties)

    (method (init param1)
        Load(rsVIEW 40)
        Load(rsVIEW 21)
        Load(rsVIEW 519)
        Load(rsVIEW 43)
        Load(rsVIEW 685)
        Load(rsVIEW 684)
        (super:init(param1))
        proc0_10()
    )


    (method (dispose)
        (send gSounds:eachElementDo(172))
        (super:dispose())
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (Print(307 0 134 -1 20 50 6) (send gEgo:viewer(0)) 
                (if (global101)
                    (send gEgo:view(40))
                )(else
                    (send gEgo:view(21))
                )
 (send gEgo:
                    cel(0)
                    loop(0)
                    setCycle(End self)
                )
  )
            )
            (case 1
                ((send ((Sound:new())):
                    number(58)
                    loop(1)
                    play()
                )
 (send gEgo:
                    view(43)
                    loop(
                        (if (global101)
                            0
                        )(else
                            2
                        )
)
                    cel(0)
                    setCycle(End)
                )
 (aBox:
                    loop(
                        (if (global101)
                            1
                        )(else
                            3
                        )
)
                    cel(0)
                    x(
                        (if (global101)
                            + (send gEgo:x()) 30
                        )(else
                            + (send gEgo:x()) 24
                        )
)
                    y((send gEgo:y()))
                    init()
                    setCycle(End self)
                )
 (ills:
                    posn((aBox:x()) - (aBox:y()) 5)
                    ignoreHorizon(1)
                    ignoreActors(1)
                    setPri((aBox:priority()))
                    init()
                    setLoop(6)
                    setCycle(End)
                )
 Print(307 1 66 global23 134 5 20 140 120 172)  )
            )
            (case 2
                ((smokeFirst:
                    posn((aBox:x()) - (aBox:y()) 5)
                    ignoreHorizon(1)
                    ignoreActors(1)
                    setPri((aBox:priority()))
                    init()
                    setLoop(0)
                    moveSpeed(1)
                    setCycle(End self)
                )
  )
            )
            (case 3
                ((ills:hide()) (send ((ills:new())):
                    posn((aBox:x()) - (aBox:y()) 5)
                    ignoreHorizon(1)
                    ignoreActors(1)
                    setPri((aBox:priority()))
                    init()
                    setLoop(0)
                    setCycle(Fwd)
                    setMotion(MoveTo * 10 Random(0 32) 65526)
                )
 (send ((ills:new())):
                    posn((aBox:x()) - (aBox:y()) 5)
                    ignoreHorizon(1)
                    ignoreActors(1)
                    setPri((aBox:priority()))
                    init()
                    setLoop(1)
                    setCycle(Fwd)
                    setMotion(MoveTo Random(0 320) 65526)
                )
 (send ((ills:new())):
                    posn((aBox:x()) - (aBox:y()) 5)
                    ignoreHorizon(1)
                    ignoreActors(1)
                    setPri((aBox:priority()))
                    init()
                    setLoop(2)
                    setCycle(Fwd)
                    setMotion(MoveTo Random(0 320) 65526)
                )
 (send ((ills:new())):
                    posn((aBox:x()) - (aBox:y()) 5)
                    ignoreHorizon(1)
                    ignoreActors(1)
                    setPri((aBox:priority()))
                    init()
                    setLoop(3)
                    setCycle(Fwd)
                    setMotion(MoveTo Random(0 320) 65526)
                )
 (send ((ills:new())):
                    posn((aBox:x()) - (aBox:y()) 5)
                    ignoreHorizon(1)
                    ignoreActors(1)
                    setPri((aBox:priority()))
                    init()
                    setLoop(4)
                    setCycle(Fwd)
                    setMotion(MoveTo Random(0 320) 65526)
                )
 (send ((ills:new())):
                    posn((aBox:x()) - (aBox:y()) 5)
                    ignoreHorizon(1)
                    ignoreActors(1)
                    setPri((aBox:priority()))
                    init()
                    setLoop(5)
                    setCycle(Fwd)
                    setMotion(MoveTo Random(0 320) 65526)
                )
 (smokeFirst:
                    setLoop(1)
                    setCycle(Fwd)
                    setMotion(MoveTo (aBox:x()) - (aBox:y()) 20 self)
                )
  )
            )
            (case 4
                ((send ((smokes:new())):
                    posn((smokeFirst:x()) (smokeFirst:y()))
                    setPri((aBox:priority()))
                    init()
                    setLoop(2)
                    setMotion(MoveTo * 10 Random(10 20) 65526)
                )
 (send ((smokes:new())):
                    posn((smokeFirst:x()) (smokeFirst:y()))
                    setPri((aBox:priority()))
                    init()
                    setLoop(3)
                    moveSpeed(1)
                    setMotion(MoveTo * 10 Random(10 20) 65526)
                )
 (send ((smokes:new())):
                    posn((smokeFirst:x()) (smokeFirst:y()))
                    setPri((aBox:priority()))
                    init()
                    setLoop(4)
                    setMotion(MoveTo * 10 Random(10 20) 65526)
                )
 (send ((smokes:new())):
                    posn((smokeFirst:x()) (smokeFirst:y()))
                    setPri((aBox:priority()))
                    init()
                    setLoop(5)
                    setMotion(MoveTo * 10 Random(10 20) 65526)
                )
 (smokeFirst:hide()) (send (ScriptID(0 8)):setReal(self 10))  )
            )
            (case 5
                ((send gEgo:
                    loop(
                        (if (global101)
                            1
                        )(else
                            3
                        )
)
                    cycleSpeed(2)
                    setCycle(End)
                )
 proc0_23() (send (ScriptID(0 8)):setReal(self 10))  )
            )
            (case 6
                (= global127 1 )
            )
        )
    )

)
(instance aBox of Prop
    (properties)
)
(instance smokeFirst of Act
    (properties
        view 685
        illegalBits 0
    )

    (method (init param1)
        (super:init(param1))
        (self:
            ignoreHorizon(1)
            ignoreActors(1)
            moveSpeed(1)
            setCycle(Fwd)
        )
    )

)
(instance smokes of Act
    (properties
        view 685
        illegalBits 0
    )

    (method (init param1)
        (super:init(param1))
        (self:
            ignoreHorizon(1)
            ignoreActors(1)
            moveSpeed(1)
            setCycle(Fwd)
        )
    )

)
(instance ills of Act
    (properties
        view 684
        illegalBits 0
    )
)
