(version 2)
(include "sci.sh")
(exports
    0 proc984_0
)
(use "Main")
(use "n982")
(use "Obj")
(script 984)



(procedure public (proc984_0 param1 param2)
    (var temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9, newEventHandler, temp11, temp12, newEventHandler_2, temp14, temp15, newEventHandler_3)
    = newEventHandler (EventHandler:new())
    (send newEventHandler:
        add()
        name("fl")
    )
    = newEventHandler_2 (EventHandler:new())
    (send newEventHandler_2:
        add()
        name("ol")
    )
    = newEventHandler_3 (EventHandler:new())
    (send newEventHandler_3:
        add()
        name("bl")
    )
    = temp1 param2[0]
    (send temp1:add(newEventHandler newEventHandler_2 global6 global29 newEventHandler_3))
    --paramTotal
    (while (TRUE)
        = temp14 0
        = temp11 temp14
        = temp8 temp11
        = temp15 32767
        = temp12 temp15
        = temp9 temp12
        = temp0 1
        (while (< temp0 paramTotal)
            = temp2 param2[temp0]
            = temp3 FirstNode((send temp2:elements))
            (while (temp3 and IsObject((= temp5 NodeValue(temp3))))
                (if ((send temp1:firstTrue(104 temp5)))
                )(else
                    = temp4 (send param1:distanceTo(temp5))
                    = temp6 proc982_2((send param1:heading) GetAngle((send param1:x) (send param1:y) (send temp5:x) (send temp5:y)))
                    (if (== proc999_1(temp6 90) 0)
                        --temp6
                    )
                    = temp7 proc982_1(temp5 param1)
                    (if (temp7)
                        = temp4 SinDiv(temp6 temp4)
                    )(else
                        (if (> Abs(temp6) 90)
                            = temp6 89
                            = temp4 (* temp4 10)
                        )
                        = temp4 Abs(CosDiv(temp6 temp4))
                    )
                    (if (< temp4 0)
                        = temp4 32767
                    )
                    (if (temp7)
                        (if (<= temp4 temp15)
                            = temp15 temp4
                            = temp14 temp5
                        )
                    )(else
                        (if (proc982_0(temp5))
                            (if (<= temp4 temp12)
                                = temp12 temp4
                                = temp11 temp5
                            )
                        )(else
                            (if (<= temp4 temp9)
                                = temp9 temp4
                                = temp8 temp5
                            )
                        )
                    )
                )
                = temp3 NextNode(temp3)
            )
            ++temp0
        )
        (if (temp8)
            (send newEventHandler:addToEnd(temp8))
        )
        (if (temp11)
            (send newEventHandler_2:addToEnd(temp11))
        )
        (if (temp14)
            (send newEventHandler_3:addToEnd(temp14))
        )
        (if (temp8 or temp11)
        )(else
            (if (temp14)
            )(else
                break
            )
        )
    )
)


