mirror of
https://github.com/open-goal/jak-project
synced 2026-08-21 23:00:45 -04:00
bb777e4bac
Also adds all names for `focus-status`. Closes #1859 and updates ref tests for Jak 1 for this edge case.
266 lines
9.0 KiB
Common Lisp
266 lines
9.0 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: board-util.gc
|
|
;; name in dgo: board-util
|
|
;; dgos: ENGINE, GAME
|
|
|
|
(define-extern ja-post (function none :behavior process-drawable))
|
|
(define-extern ja-channel-set! (function int int :behavior process-drawable))
|
|
(define-extern ja-channel-push! (function int time-frame int :behavior process-drawable))
|
|
(define-extern ja-done? (function int symbol :behavior process-drawable))
|
|
(define-extern sleep-code (function symbol))
|
|
(define-extern *target-shadow-control* shadow-control)
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(defmethod relocate board ((obj board) (arg0 int))
|
|
(if (nonzero? (-> obj main))
|
|
(&+! (-> obj main) arg0)
|
|
)
|
|
(the-as board ((method-of-type process-drawable relocate) obj arg0))
|
|
)
|
|
|
|
(defbehavior board-post board ()
|
|
(let* ((a0-0 (-> self parent))
|
|
(v1-0 (if a0-0
|
|
(the-as target (-> (the-as target (-> a0-0 0)) self))
|
|
)
|
|
)
|
|
)
|
|
(set! (-> self root trans quad) (-> v1-0 board board-trans quad))
|
|
(let ((a0-4 (-> v1-0 board board-quat quad)))
|
|
(set! (-> self root quat vec quad) a0-4)
|
|
)
|
|
(set! (-> self root scale quad) (-> v1-0 board board-scale quad))
|
|
(set! (-> self draw light-index) (-> v1-0 draw light-index))
|
|
(let ((a0-10 (-> v1-0 draw color-mult quad)))
|
|
(set! (-> self draw color-mult quad) a0-10)
|
|
)
|
|
(let ((a0-12 (-> v1-0 draw color-emissive quad)))
|
|
(set! (-> self draw color-emissive quad) a0-12)
|
|
)
|
|
(set! (-> self draw force-fade) (-> v1-0 draw force-fade))
|
|
(set! (-> self draw death-vertex-skip) (-> (the-as target (-> self parent 0)) draw death-vertex-skip))
|
|
(set! (-> self draw death-effect) (-> (the-as target (-> self parent 0)) draw death-effect))
|
|
(set! (-> self draw death-timer) (-> (the-as target (-> self parent 0)) draw death-timer))
|
|
(set! (-> self draw death-timer-org) (-> (the-as target (-> self parent 0)) draw death-timer-org))
|
|
(set! (-> self draw death-draw-overlap) (-> (the-as target (-> self parent 0)) draw death-draw-overlap))
|
|
(let ((a0-37 (-> v1-0 draw shadow-ctrl settings shadow-dir quad)))
|
|
(set! (-> self draw shadow-ctrl settings shadow-dir quad) a0-37)
|
|
)
|
|
(if (or (logtest? (-> v1-0 draw status) (draw-control-status no-draw no-draw-temp no-draw-bounds no-draw-bounds2))
|
|
(zero? (-> v1-0 skel active-channels))
|
|
)
|
|
(logior! (-> self draw status) (draw-control-status no-draw))
|
|
(logclear! (-> self draw status) (draw-control-status no-draw))
|
|
)
|
|
(if (logtest? (-> v1-0 draw status) (draw-control-status force-fade))
|
|
(logior! (-> self draw status) (draw-control-status force-fade))
|
|
(logclear! (-> self draw status) (draw-control-status force-fade))
|
|
)
|
|
)
|
|
(ja-post)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defstate hidden (board)
|
|
:virtual #t
|
|
:trans (behavior ()
|
|
(let ((v1-0 (-> self parent)))
|
|
(if (zero? (logand (-> (the-as target (if v1-0
|
|
(the-as target (-> v1-0 0 self))
|
|
)
|
|
)
|
|
focus-status
|
|
)
|
|
(focus-status in-head)
|
|
)
|
|
)
|
|
(go-virtual idle #f)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
:code (behavior ()
|
|
(ja-channel-set! 0)
|
|
(ja-post)
|
|
(logior! (-> self mask) (process-mask sleep-code))
|
|
(suspend)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defstate idle (board)
|
|
:virtual #t
|
|
:event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(case arg2
|
|
(('open)
|
|
(go-virtual use)
|
|
)
|
|
)
|
|
)
|
|
:trans (behavior ()
|
|
(let ((v1-0 (-> self parent)))
|
|
(if (logtest? (-> (the-as target (if v1-0
|
|
(the-as target (-> v1-0 0 self))
|
|
)
|
|
)
|
|
focus-status
|
|
)
|
|
(focus-status in-head)
|
|
)
|
|
(go-virtual hidden)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
:code (behavior ((arg0 symbol))
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(cond
|
|
(arg0
|
|
(let ((gp-1 (-> self skel root-channel 0)))
|
|
(joint-control-channel-group-eval!
|
|
gp-1
|
|
(the-as art-joint-anim (-> self draw art-group data 4))
|
|
(the-as (function joint-control-channel float float float float) num-func-identity)
|
|
)
|
|
(set! (-> gp-1 frame-num)
|
|
(the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1))
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(let ((a0-3 (-> self skel root-channel 0)))
|
|
(set! (-> a0-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 4)))
|
|
(set! (-> a0-3 param 0)
|
|
(the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1))
|
|
)
|
|
(set! (-> a0-3 param 1) 1.0)
|
|
(set! (-> a0-3 frame-num) 0.0)
|
|
(joint-control-channel-group!
|
|
a0-3
|
|
(the-as art-joint-anim (-> self draw art-group data 4))
|
|
(the-as (function joint-control-channel float float float float) num-func-seek!)
|
|
)
|
|
)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(let ((a0-4 (-> self skel root-channel 0)))
|
|
(set! (-> a0-4 param 0) (the float (+ (-> a0-4 frame-group frames num-frames) -1)))
|
|
(set! (-> a0-4 param 1) 1.0)
|
|
(joint-control-channel-group-eval!
|
|
a0-4
|
|
(the-as art-joint-anim #f)
|
|
(the-as (function joint-control-channel float float float float) num-func-seek!)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> self draw shadow) #f)
|
|
(sleep-code)
|
|
(none)
|
|
)
|
|
:post board-post
|
|
)
|
|
|
|
(defstate use (board)
|
|
:virtual #t
|
|
:event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(case arg2
|
|
(('close)
|
|
(go-virtual idle #f)
|
|
)
|
|
)
|
|
)
|
|
:trans (behavior ()
|
|
(let ((v1-0 (-> self parent)))
|
|
(if v1-0
|
|
(-> v1-0 0 self)
|
|
)
|
|
)
|
|
(let ((v1-2 (-> self parent)))
|
|
(cond
|
|
((logtest? (-> (the-as target (if v1-2
|
|
(the-as target (-> v1-2 0 self))
|
|
)
|
|
)
|
|
focus-status
|
|
)
|
|
(focus-status in-head)
|
|
)
|
|
(go-virtual hidden)
|
|
)
|
|
((let ((v1-9 #x40000)
|
|
(a0-3 (-> self parent))
|
|
)
|
|
(zero? (logand (the-as focus-status v1-9) (-> (the-as target (if a0-3
|
|
(the-as target (-> a0-3 0 self))
|
|
)
|
|
)
|
|
focus-status
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(go-virtual idle #f)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
:code (behavior ()
|
|
(set! (-> self draw shadow) (-> self shadow-backup))
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(let ((a0-2 (-> self skel root-channel 0)))
|
|
(set! (-> a0-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 3)))
|
|
(set! (-> a0-2 param 0)
|
|
(the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1))
|
|
)
|
|
(set! (-> a0-2 param 1) 1.0)
|
|
(set! (-> a0-2 frame-num) 0.0)
|
|
(joint-control-channel-group!
|
|
a0-2
|
|
(the-as art-joint-anim (-> self draw art-group data 3))
|
|
(the-as (function joint-control-channel float float float float) num-func-seek!)
|
|
)
|
|
)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(let ((a0-3 (-> self skel root-channel 0)))
|
|
(set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group frames num-frames) -1)))
|
|
(set! (-> a0-3 param 1) 1.0)
|
|
(joint-control-channel-group-eval!
|
|
a0-3
|
|
(the-as art-joint-anim #f)
|
|
(the-as (function joint-control-channel float float float float) num-func-seek!)
|
|
)
|
|
)
|
|
)
|
|
(sleep-code)
|
|
(none)
|
|
)
|
|
:post board-post
|
|
)
|
|
|
|
(defbehavior board-init board ()
|
|
(set! (-> self root) (new 'process 'trsqv))
|
|
(initialize-skeleton
|
|
self
|
|
(the-as skeleton-group (art-group-get-by-name *level* "skel-board" (the-as (pointer uint32) #f)))
|
|
(the-as pair 0)
|
|
)
|
|
(let ((v1-5 (-> *target-shadow-control* settings shadow-dir quad)))
|
|
(set! (-> *board-shadow-control* settings shadow-dir quad) v1-5)
|
|
)
|
|
(set! (-> self draw shadow-ctrl) *board-shadow-control*)
|
|
(set! (-> self shadow-backup) (-> self draw shadow))
|
|
(set! (-> self main) (new 'process 'joint-mod (joint-mod-mode flex-blend) self 3))
|
|
(ja-channel-set! 0)
|
|
(go-virtual idle #t)
|
|
(none)
|
|
)
|