2022-06-30 01:22:51 -04:00
|
|
|
;;-*-Lisp-*-
|
|
|
|
(in-package goal)
|
|
|
|
|
|
|
|
;; name: simple-nav-sphere.gc
|
|
|
|
;; name in dgo: simple-nav-sphere
|
|
|
|
;; dgos: GAME, COMMON
|
|
|
|
|
2022-08-05 16:12:54 -04:00
|
|
|
;; DECOMP BEGINS
|
|
|
|
|
2022-10-08 12:42:52 -04:00
|
|
|
(deftype simple-nav-sphere (process-drawable)
|
|
|
|
((root-override collide-shape :offset 128)
|
|
|
|
(first-time? symbol :offset-assert 200)
|
|
|
|
(track-joint int32 :offset-assert 204)
|
|
|
|
)
|
|
|
|
:heap-base #x50
|
|
|
|
:method-count-assert 22
|
|
|
|
:size-assert #xd0
|
|
|
|
:flag-assert #x16005000d0
|
|
|
|
(:methods
|
|
|
|
(idle () _type_ :state 20)
|
|
|
|
(active () _type_ :state 21)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
;; WARN: Return type mismatch object vs none.
|
|
|
|
(defbehavior simple-nav-sphere-event-handler simple-nav-sphere ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
|
|
|
(case event-type
|
|
|
|
(('die-fast)
|
|
|
|
(go empty-state)
|
|
|
|
)
|
|
|
|
(('move-trans)
|
|
|
|
(collide-shape-method-29 (-> self root-override) (the-as vector (-> event param 0)))
|
|
|
|
#t
|
|
|
|
)
|
|
|
|
(('set-radius)
|
|
|
|
(let ((radius (the-as float (-> event param 0)))
|
|
|
|
(collide-shape (-> self root-override))
|
|
|
|
)
|
|
|
|
(set! (-> collide-shape nav-radius) radius)
|
|
|
|
(set! (-> collide-shape root-prim local-sphere w) radius)
|
|
|
|
(collide-shape-method-46 collide-shape)
|
|
|
|
)
|
|
|
|
#t
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod run-logic? simple-nav-sphere ((obj simple-nav-sphere))
|
|
|
|
(cond
|
|
|
|
(*display-nav-marks*
|
|
|
|
#t
|
|
|
|
)
|
|
|
|
((>= (-> obj track-joint) 0)
|
|
|
|
#t
|
|
|
|
)
|
|
|
|
((-> obj first-time?)
|
|
|
|
(set! (-> obj first-time?) #f)
|
|
|
|
#t
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate idle (simple-nav-sphere)
|
|
|
|
:virtual #t
|
|
|
|
:event (the-as
|
|
|
|
(function process int symbol event-message-block object :behavior simple-nav-sphere)
|
|
|
|
simple-nav-sphere-event-handler
|
|
|
|
)
|
|
|
|
:trans (behavior ()
|
|
|
|
(if *display-nav-marks*
|
|
|
|
(add-debug-sphere
|
|
|
|
#t
|
|
|
|
(bucket-id debug2)
|
|
|
|
(-> self root-override trans)
|
|
|
|
(-> self root-override nav-radius)
|
|
|
|
(new 'static 'rgba :r #x80 :g #x40 :a #x80)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
:code (the-as (function none :behavior simple-nav-sphere) sleep-code)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate active (simple-nav-sphere)
|
|
|
|
:virtual #t
|
|
|
|
:event (the-as
|
|
|
|
(function process int symbol event-message-block object :behavior simple-nav-sphere)
|
|
|
|
simple-nav-sphere-event-handler
|
|
|
|
)
|
|
|
|
:trans (behavior ()
|
|
|
|
(let ((v1-0 (ppointer->process (-> self parent)))
|
|
|
|
(gp-0 (new 'stack-no-clear 'vector))
|
|
|
|
)
|
|
|
|
(vector<-cspace! gp-0 (-> (the-as process-drawable v1-0) node-list data (-> self track-joint)))
|
|
|
|
(collide-shape-method-29 (-> self root-override) gp-0)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
:code (the-as (function none :behavior simple-nav-sphere) sleep-code)
|
|
|
|
)
|
|
|
|
|
|
|
|
;; WARN: Return type mismatch object vs none.
|
|
|
|
(defbehavior simple-nav-sphere-init-by-other simple-nav-sphere ((arg0 float) (arg1 vector) (arg2 nav-mesh) (arg3 int))
|
|
|
|
(set! (-> self track-joint) arg3)
|
|
|
|
(set! (-> self first-time?) #t)
|
|
|
|
(let ((s5-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player))))
|
|
|
|
(let ((v1-3 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
|
|
(set! (-> v1-3 prim-core collide-as) (collide-spec obstacle))
|
|
|
|
(set-vector! (-> v1-3 local-sphere) 0.0 0.0 0.0 4096.0)
|
|
|
|
(set! (-> s5-0 total-prims) (the-as uint 1))
|
|
|
|
(set! (-> s5-0 root-prim) v1-3)
|
|
|
|
)
|
|
|
|
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
|
|
|
(let ((v1-6 (-> s5-0 root-prim)))
|
|
|
|
(set! (-> s5-0 backup-collide-as) (-> v1-6 prim-core collide-as))
|
|
|
|
(set! (-> s5-0 backup-collide-with) (-> v1-6 prim-core collide-with))
|
|
|
|
)
|
|
|
|
(set! (-> s5-0 nav-radius) arg0)
|
|
|
|
(set! (-> s5-0 root-prim local-sphere w) arg0)
|
|
|
|
(if arg1
|
|
|
|
(set! (-> s5-0 trans quad) (-> arg1 quad))
|
|
|
|
)
|
|
|
|
(vector-identity! (-> s5-0 scale))
|
|
|
|
(quaternion-identity! (-> s5-0 quat))
|
|
|
|
(let ((v1-11 (-> s5-0 root-prim)))
|
|
|
|
(set! (-> v1-11 prim-core collide-as) (collide-spec))
|
|
|
|
(set! (-> v1-11 prim-core collide-with) (collide-spec))
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(collide-shape-method-46 s5-0)
|
|
|
|
(set! (-> self root-override) s5-0)
|
|
|
|
)
|
|
|
|
(logclear! (-> self mask) (process-mask actor-pause enemy))
|
|
|
|
(set! (-> self event-hook)
|
|
|
|
(the-as (function process int symbol event-message-block object) simple-nav-sphere-event-handler)
|
|
|
|
)
|
|
|
|
(if arg2
|
|
|
|
(nav-mesh-method-29 arg2 self #f)
|
|
|
|
(nav-mesh-connect-from-ent (the-as entity-nav-mesh self))
|
|
|
|
)
|
|
|
|
(if (>= (-> self track-joint) 0)
|
|
|
|
(go-virtual active)
|
|
|
|
(go-virtual idle)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|