(version 2)
(include "sci.sh")
(exports
    0 proc982_0
    1 proc982_1
    2 proc982_2
)
(use "Main")
(script 982)



(procedure public (proc982_0 param1)
    return not 
        (if (((<= 0 (send param1:x)) and (<= (send param1:x) 319)) and (<= 0 (- (send param1:y) (send param1:z))))
            <= (- (send param1:y) (send param1:z)) 189
        )(else
            0
        )
)


(procedure public (proc982_1 param1 theTheGOwner param3 param4)
    (var theGOwner, temp1, temp2, temp3, temp4, theGOwnerX, theGOwnerY)
    = theGOwner theTheGOwner
    = temp1 param3
    = temp2 param4
    (if (< paramTotal 4)
        = temp2 32767
        (if (< paramTotal 3)
            (if (< paramTotal 2)
                = theGOwner gOwner
            )
            = temp1 (- 360 
                (if (== theGOwner gOwner)
                    (* 2 global35)
                )(else
                    0
                )
)
        )
    )
    = temp3 (send param1:x)
    = temp4 (send param1:y)
    = theGOwnerX (send theGOwner:x)
    = theGOwnerY (send theGOwner:y)
    return 
        (if (not (<> param1 theGOwner) or (< (/ temp1 2) Abs(proc982_2(GetAngle(theGOwnerX theGOwnerY temp3 temp4) (send theGOwner:heading)))))
        )(else
            < temp2 GetDistance(theGOwnerX theGOwnerY temp3 temp4 gPicAngle)
        )
)


(procedure public (proc982_2 param1 param2)
    (if (>= paramTotal 2)
        = param1 (- param1 param2)
    )
    return 
        (if (<= param1 -180)
            + param1 360
        )(else
            (if (> param1 180)
                - param1 360
            )(else
                param1
            )
        )
)


