(version 2)
(include "sci.sh")
(exports
    0 ortega
)
(use "Main")
(use "Class_255_0")
(use "Sound")
(use "Cycle")
(use "Game")
(use "Feature")
(use "Obj")
(script 600)


(local
    local0

)
(instance public ortega of Rgn
    (properties)

    (method (init)
        (self:keep(0))
        (super:init())
        Load(128 94)
        Load(128 89)
        Load(132 45)
        Load(132 78)
    )


    (method (doit)
        (super:doit())
        (if (global180)
            = global180 0
            (send global2:setScript(FallDown))
        )
        (if (global219 and (> global171 1))
            --global171
        )
        (if ((((== global171 1) and (<> global11 62)) and (== proc0_15(gEgo 15) 1)) and (== (send global2:script) 0))
            (send global2:setScript(FryToDeath))
        )
        (if (global256 and not --global257)
            (boom:play())
            ShakeScreen(20 3)
            = global257 Random(10 600)
            (if (not global184)
                proc255_0(600 0)
                = global184 1
            )
        )
    )


    (method (handleEvent pEvent)
        (super:handleEvent(pEvent))
        (if ((send pEvent:claimed) or (<> (send pEvent:type) 128))
            return 
        )
        (if (Said('look>'))
            (if (Said('[/area,around,moon,dirt,ortega]'))
                (if (== global11 70)
                    (if (global253)
                        proc255_0(600 1)
                    )(else
                        proc255_0(600 2)
                    )
                )(else
                    proc255_0(600 3)
                )
            )(else
                (if (Said('/volcano'))
                    proc255_0(600 4)
                )(else
                    (if (Said('/lava'))
                        proc255_0(600 5)
                    )(else
                        (if (Said('/rock,boulder'))
                            proc255_0(600 6)
                        )(else
                            (if (Said('/lake'))
                                proc255_0(600 7)
                            )(else
                                (if (Said('/air'))
                                    proc255_0(600 8)
                                )(else
                                    (if (Said('/ledge,cliff,edge'))
                                        proc255_0(600 9)
                                    )(else
                                        (if (Said('/crack'))
                                            proc255_0(600 10)
                                        )(else
                                            (if (Said('/cavity,canyon'))
                                                proc255_0(600 11)
                                            )(else
                                                (if (Said('/partition'))
                                                    (if (((== global11 73) or (== global11 74)) or (== global11 75))
                                                        proc255_0(600 12)
                                                    )(else
                                                        proc255_0(600 13)
                                                    )
                                                )(else
                                                    (if (Said('/craft'))
                                                        (switch (global11)
                                                            (case 62
                                                                proc255_0(600 14)
                                                            )
                                                            (case 67
                                                                proc255_0(600 15)
                                                            )
                                                            (case 70
                                                                (if (global253)
                                                                    proc255_0(600 16)
                                                                )(else
                                                                    proc255_0(600 17)
                                                                )
                                                            )
                                                            (default 
                                                                proc255_0(600 16)
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )(else
            (if (Said('open/door'))
                proc255_0(600 18)
            )(else
                (if (Said('jump<off/cliff'))
                    proc255_0(600 19)
                )(else
                    (if (Said('get/ladder'))
                        (if ((== global11 74) or (== global11 75))
                            proc255_0(600 20)
                        )(else
                            proc255_0(600 21)
                        )
                    )(else
                        (if (Said('get/rock'))
                            proc255_0(600 22)
                        )(else
                            (if (Said('get/dirt'))
                                proc255_0(600 23)
                            )(else
                                (if (Said('use/pole'))
                                    (if (<> global11 66)
                                        proc0_8()
                                    )
                                )(else
                                    (if (Said('(turn<on),press,use/detonator'))
                                        (if ((send gEgo:has(10)))
                                            proc255_0(600 24)
                                        )(else
                                            proc0_9()
                                        )
                                    )(else
                                        (if (Said('wear/panties'))
                                            (if ((send gEgo:has(5)))
                                                (if (global182)
                                                    proc255_0(600 25)
                                                )(else
                                                    proc255_0(600 26)
                                                )
                                            )(else
                                                proc255_0(600 27)
                                            )
                                        )(else
                                            (if (Said('remove/panties'))
                                                (if (global182)
                                                    proc255_0(600 28)
                                                )(else
                                                    proc255_0(600 29)
                                                )
                                            )(else
                                                (if (Said('climb') and (< global11 73))
                                                    proc255_0(600 30)
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )

)
(instance FryToDeath of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                = global159 1
                = global171 0
                proc255_0(600 31)
                (send gEgo:
                    view(89)
                    setLoop(0)
                    setCel(0)
                    setMotion(0)
                    setCycle(End self)
                )
            )
            (case 1
                (send gEgo:
                    setLoop(1)
                    setCel(0)
                    setCycle(End self)
                )
            )
            (case 2
                (send gEgo:
                    setLoop(2)
                    setCel(0)
                    setCycle(End self)
                )
            )
            (case 3
                = cycles 10
            )
            (case 4
                proc255_0(600 32)
                proc0_17(0 0 8 11)
                = global159 0
                proc0_3()
            )
        )
    )

)
(instance FallDown of Script
    (properties)

    (method (doit)
        (super:doit())
        (if (== (fallSound:prevSignal) -1)
            = local0 1
        )
        (if (local0 or (== (fallSound:state) 0))
            = local0 0
            (self:changeState(1))
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (fallSound:play())
                (send gEgo:
                    setLoop()
                    setCel(0)
                    setStep(6 12)
                    setCycle(0)
                )
                proc0_10()
                (send gEgo:setMotion(MoveTo (send gEgo:x) 229))
                (ohnoScript:changeState(0))
            )
            (case 1
                proc0_17(0 0 1 2)
            )
        )
    )

)
(instance ohnoScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (ohno:
                    init()
                    setCycle(End self)
                )
            )
            (case 1
                (ohno:dispose())
            )
        )
    )

)
(instance ohno of Prop
    (properties)

    (method (init)
        (super:init())
        (self:
            view(94)
            setLoop(0)
            setCel(0)
            cycleSpeed(1)
            setPri((send gEgo:priority))
            posn((send gEgo:x) - (send gEgo:y) 40)
            ignoreActors(1)
        )
    )

)
(instance fallSound of Sound
    (properties
        number 45
        priority 3
    )
)
(instance boom of Sound
    (properties
        number 78
        priority 1
    )
)
