Files
jak-project/test/decompiler/reference/jak2/engine/collide/los-control_REF.gc
T
Hat Kid fc43870d85 decompiler: obj -> this, set-time! and time-elapsed? macros (#3026)
This renames the method object in `defmethod`s to `this` and adds
detection for the `set-time!` and `time-elapsed?` macros.

Definitely my biggest PR yet...
2023-09-26 15:17:00 +01:00

103 lines
4.0 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition for symbol *los-time-offset*, type time-frame
(define *los-time-offset* (the-as time-frame 0))
;; definition for method 9 of type los-control
;; INFO: Used lq/sq
;; WARN: Return type mismatch time-frame vs none.
(defmethod los-control-method-9 los-control ((this los-control) (process process-focusable) (trans-vec vector) (radius float))
(when (and (time-elapsed? (-> this last-check-time) (-> this check-interval))
(-> this src-proc)
(or process (-> this dst-proc))
)
(let* ((process-source (handle->process (-> this src-proc)))
(process-focus (if (type? process-source process-focusable)
(the-as process-focusable process-source)
)
)
)
(when process-focus
(when (not process)
(let ((process-dest (handle->process (-> this dst-proc))))
(set! process (if (type? process-dest process-focusable)
(the-as process-focusable process-dest)
)
)
)
)
(when process
(let ((start-pos (new 'stack-no-clear 'vector)))
(set! (-> start-pos quad) (-> (get-trans process-focus 3) quad))
(if (not trans-vec)
(set! trans-vec (get-trans process 3))
)
(let ((distance (vector-! (new 'stack-no-clear 'vector) trans-vec start-pos))
(cquery (new 'stack-no-clear 'collide-query))
)
(set! (-> cquery start-pos quad) (-> start-pos quad))
(set! (-> cquery move-dist quad) (-> distance quad))
(let ((query cquery))
(set! (-> query radius) radius)
(set! (-> query collide-with) (-> this collide-with))
(set! (-> query ignore-process0) process-focus)
(set! (-> query ignore-process1) process)
(set! (-> query ignore-pat) (-> process-focus root pat-ignore-mask))
(set! (-> query action-mask) (collide-action solid))
)
(fill-using-line-sphere *collide-cache* cquery)
(let ((f30-0 (probe-using-line-sphere *collide-cache* cquery)))
(quad-copy! (the-as pointer (-> this last-collide-result)) (the-as pointer (-> cquery best-other-tri)) 6)
(if (>= 0.0 f30-0)
(set-time! (-> this have-no-los))
(set-time! (-> this have-los))
)
)
)
)
(set-time! (-> this last-check-time))
)
)
)
)
(none)
)
;; definition for method 10 of type los-control
(defmethod check-los? los-control ((this los-control) (arg0 time-frame))
(and (time-elapsed? (-> this have-los) (+ (-> this check-interval) arg0))
(not (time-elapsed? (-> this have-no-los) (-> this check-interval)))
)
)
;; definition for method 11 of type los-control
(defmethod skip-check-los? los-control ((this los-control) (arg0 int))
(and (time-elapsed? (-> this have-no-los) (+ (-> this check-interval) arg0))
(not (time-elapsed? (-> this have-los) (-> this check-interval)))
)
)
;; definition for method 12 of type los-control
;; WARN: Return type mismatch int vs none.
(defmethod set-dst-proc! los-control ((this los-control) (dst handle))
(set! (-> this dst-proc) dst)
0
(none)
)
;; definition for method 13 of type los-control
;; WARN: Return type mismatch int vs none.
(defmethod new-source! los-control ((this los-control) (proc process) (check-interval time-frame) (c-spec collide-spec))
(set! (-> this src-proc) (process->handle proc))
(set! (-> this dst-proc) (the-as handle #f))
(set! (-> this have-los) 0)
(set! (-> this have-no-los) 0)
(set! (-> this last-check-time) *los-time-offset*)
(set! (-> this check-interval) check-interval)
(set! (-> this collide-with) c-spec)
(set! *los-time-offset* (+ *los-time-offset* 1))
0
(none)
)