mirror of
https://github.com/open-goal/jak-project
synced 2026-09-10 04:22:13 -04:00
[decomp] better handling of animation code and art files (#1352)
* update refs * [decompiler] read and process art groups * finish decompiler art group selection & detect in `ja-group?` * make art stuff work on offline tests! * [decompiler] detect `ja-group!` (primitive) * corrections. * more * use new feature on skel groups! * find `loop!` as well * fully fledged `ja` macro & decomp + `loop` detect * fancy fixed point printing! * update source * `:num! max` (i knew i should've done this) * Update jak1_ntsc_black_label.jsonc * hi imports * make compiling the game work * fix `defskelgroup` * clang * update refs * fix chan * fix seek and finalboss * fix tests * delete unused function * track let rewrite stats * reorder `rewrite_let` * Update .gitattributes * fix bug with `:num! max` * Update robotboss-part.gc * Update goal-lib.gc * document `ja` * get rid of pc fixes thing * use std::abs
This commit is contained in:
@@ -235,7 +235,7 @@
|
||||
(let ((v1-88 (-> arg0 the-node)))
|
||||
"is this node the start of the list. #t = start"
|
||||
(when (not (not (-> v1-88 prev)))
|
||||
(while #t
|
||||
(loop
|
||||
(let ((v1-92 (-> arg0 the-node)))
|
||||
"return the previous node in the list"
|
||||
(let ((v1-93 (-> v1-92 prev)))
|
||||
@@ -272,7 +272,7 @@
|
||||
(let ((v1-107 (-> arg0 the-node)))
|
||||
"is this node the end of the list. #t = end"
|
||||
(when (not (not (-> v1-107 next)))
|
||||
(while #t
|
||||
(loop
|
||||
(let ((v1-111 (-> arg0 the-node)))
|
||||
"return the next node in the list"
|
||||
(let ((v1-112 (-> v1-111 next)))
|
||||
@@ -429,10 +429,10 @@
|
||||
|
||||
(defun anim-tester-num-print ((arg0 basic) (arg1 float))
|
||||
(cond
|
||||
((= arg1 (-> (new 'static 'array float 1 -2.0) 0))
|
||||
((= arg1 -2.0)
|
||||
(format arg0 "max")
|
||||
)
|
||||
((= arg1 (-> (new 'static 'array float 1 -1.0) 0))
|
||||
((= arg1 -1.0)
|
||||
(format arg0 "min")
|
||||
)
|
||||
(else
|
||||
@@ -565,8 +565,8 @@
|
||||
(set! (-> (the-as anim-test-seq-item v0-0) privname) arg1)
|
||||
(set! (-> (the-as anim-test-seq-item v0-0) speed) 100)
|
||||
(set! (-> (the-as anim-test-seq-item v0-0) blend) 0)
|
||||
(set! (-> (the-as anim-test-seq-item v0-0) first-frame) (-> (new 'static 'array float 1 -1.0) 0))
|
||||
(set! (-> (the-as anim-test-seq-item v0-0) last-frame) (-> (new 'static 'array float 1 -2.0) 0))
|
||||
(set! (-> (the-as anim-test-seq-item v0-0) first-frame) -1.0)
|
||||
(set! (-> (the-as anim-test-seq-item v0-0) last-frame) -2.0)
|
||||
(the-as anim-test-seq-item v0-0)
|
||||
)
|
||||
)
|
||||
@@ -722,10 +722,8 @@
|
||||
(defbehavior anim-tester-update-anim-info anim-tester ((arg0 anim-test-seq-item))
|
||||
(set! (-> self anim-first) (-> arg0 first-frame))
|
||||
(set! (-> self anim-last) (-> arg0 last-frame))
|
||||
(set! (-> self anim-gspeed) (* (-> (new 'static 'array float 1 0.01) 0) (the float (-> self speed))))
|
||||
(set! (-> self anim-speed)
|
||||
(* (-> (new 'static 'array float 1 0.01) 0) (-> self anim-gspeed) (the float (-> arg0 speed)))
|
||||
)
|
||||
(set! (-> self anim-gspeed) (* 0.01 (the float (-> self speed))))
|
||||
(set! (-> self anim-speed) (* 0.01 (-> self anim-gspeed) (the float (-> arg0 speed))))
|
||||
(when (< (-> self anim-speed) 0.0)
|
||||
(set! (-> self anim-first) (-> arg0 last-frame))
|
||||
(set! (-> self anim-last) (-> arg0 first-frame))
|
||||
@@ -774,8 +772,8 @@
|
||||
(set! (-> self draw sink-group) (-> *level* level-default foreground-sink-group 1))
|
||||
(set! (-> self draw lod-set lod 0 geo) a1-4)
|
||||
)
|
||||
(set! (-> self draw lod-set lod 0 dist) (-> (new 'static 'array float 1 4095996000.0) 0))
|
||||
(set! (-> self draw bounds w) (-> (new 'static 'array float 1 40960.0) 0))
|
||||
(set! (-> self draw lod-set lod 0 dist) 4095996000.0)
|
||||
(set! (-> self draw bounds w) 40960.0)
|
||||
(set! (-> self draw data-format) (the-as uint 1))
|
||||
(let ((v1-16 (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)))
|
||||
(set! (-> self draw color-mult quad) v1-16)
|
||||
@@ -812,13 +810,13 @@
|
||||
(gp-0 (-> s3-0 base))
|
||||
)
|
||||
(cond
|
||||
((= arg1 (-> (new 'static 'array float 1 -1.0) 0))
|
||||
((= arg1 -1.0)
|
||||
(let ((s2-1 draw-string-adv))
|
||||
(format (clear *temp-string*) "~Smin" arg0)
|
||||
(s2-1 *temp-string* s3-0 arg3)
|
||||
)
|
||||
)
|
||||
((= arg1 (-> (new 'static 'array float 1 -2.0) 0))
|
||||
((= arg1 -2.0)
|
||||
(let ((s2-2 draw-string-adv))
|
||||
(format (clear *temp-string*) "~Smax" arg0)
|
||||
(s2-2 *temp-string* s3-0 arg3)
|
||||
@@ -1087,7 +1085,7 @@
|
||||
"is the list empty, #t = empty"
|
||||
(when (not (= (-> v1-15 tailpred) v1-15))
|
||||
(let ((v1-17 (glst-get-node-by-index (-> arg1 list) (-> arg1 highlight-index))))
|
||||
(while #t
|
||||
(loop
|
||||
"return the previous node in the list"
|
||||
(set! v1-17 (-> (the-as anim-test-obj v1-17) prev))
|
||||
(let ((a0-23 (the-as anim-test-obj v1-17)))
|
||||
@@ -1111,7 +1109,7 @@
|
||||
"is the list empty, #t = empty"
|
||||
(when (not (= (-> v1-21 tailpred) v1-21))
|
||||
(let ((v1-23 (glst-get-node-by-index (-> arg1 list) (-> arg1 highlight-index))))
|
||||
(while #t
|
||||
(loop
|
||||
"return the next node in the list"
|
||||
(set! v1-23 (-> (the-as anim-test-obj v1-23) next))
|
||||
(let ((a0-40 (the-as anim-test-obj v1-23)))
|
||||
@@ -1263,7 +1261,7 @@
|
||||
"is the list empty, #t = empty"
|
||||
(when (not (= (-> v1-17 tailpred) v1-17))
|
||||
(let ((v1-19 (glst-get-node-by-index (-> arg1 list) (-> arg1 highlight-index))))
|
||||
(while #t
|
||||
(loop
|
||||
"return the previous node in the list"
|
||||
(set! v1-19 (-> (the-as anim-test-sequence v1-19) prev))
|
||||
(let ((a0-24 (the-as anim-test-sequence v1-19)))
|
||||
@@ -1287,7 +1285,7 @@
|
||||
"is the list empty, #t = empty"
|
||||
(when (not (= (-> v1-23 tailpred) v1-23))
|
||||
(let ((v1-25 (glst-get-node-by-index (-> arg1 list) (-> arg1 highlight-index))))
|
||||
(while #t
|
||||
(loop
|
||||
"return the next node in the list"
|
||||
(set! v1-25 (-> (the-as anim-test-sequence v1-25) next))
|
||||
(let ((a0-42 (the-as anim-test-sequence v1-25)))
|
||||
@@ -1392,32 +1390,32 @@
|
||||
(cond
|
||||
((cpad-hold? 0 down)
|
||||
(cond
|
||||
((= arg0 (-> (new 'static 'array float 1 -2.0) 0))
|
||||
(set! arg0 (+ (-> (new 'static 'array float 1 -1.0) 0) arg1))
|
||||
((= arg0 -2.0)
|
||||
(set! arg0 (+ -1.0 arg1))
|
||||
)
|
||||
((!= arg0 (-> (new 'static 'array float 1 -1.0) 0))
|
||||
(set! arg0 (+ (-> (new 'static 'array float 1 -1.0) 0) arg0))
|
||||
((!= arg0 -1.0)
|
||||
(set! arg0 (+ -1.0 arg0))
|
||||
(if (< arg0 0.0)
|
||||
(set! arg0 (-> (new 'static 'array float 1 -1.0) 0))
|
||||
(set! arg0 (the-as float -1.0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((cpad-hold? 0 up)
|
||||
(cond
|
||||
((= arg0 (-> (new 'static 'array float 1 -1.0) 0))
|
||||
(set! arg0 (-> (new 'static 'array float 1 0.0) 0))
|
||||
((= arg0 -1.0)
|
||||
(set! arg0 (the-as float 0.0))
|
||||
)
|
||||
((!= arg0 (-> (new 'static 'array float 1 -2.0) 0))
|
||||
(set! arg0 (+ (-> (new 'static 'array float 1 1.0) 0) arg0))
|
||||
((!= arg0 -2.0)
|
||||
(set! arg0 (+ 1.0 arg0))
|
||||
(if (>= arg0 arg1)
|
||||
(set! arg0 (-> (new 'static 'array float 1 -2.0) 0))
|
||||
(set! arg0 (the-as float -2.0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
arg0
|
||||
(the-as float arg0)
|
||||
)
|
||||
|
||||
(defun anim-tester-pick-item-setup ((arg0 anim-test-seq-item) (arg1 anim-test-sequence))
|
||||
@@ -1501,7 +1499,7 @@
|
||||
*font-default-matrix*
|
||||
(-> arg1 xpos)
|
||||
(-> arg1 ypos)
|
||||
(-> (new 'static 'array float 1 0.0) 0)
|
||||
(the-as float 0.0)
|
||||
(the-as font-color (if (= (-> arg1 the-index) (-> arg1 current-index))
|
||||
15
|
||||
12
|
||||
@@ -2209,7 +2207,7 @@
|
||||
(s4-0 (-> arg0 playing-item))
|
||||
)
|
||||
(when (logtest? (-> v0-0 flags) 5)
|
||||
(while #t
|
||||
(loop
|
||||
(+! s4-0 1)
|
||||
(if (>= s4-0 (glst-num-elements (-> arg0 item-list)))
|
||||
(set! s4-0 0)
|
||||
@@ -2256,7 +2254,7 @@
|
||||
:code
|
||||
(behavior ()
|
||||
(local-vars (s4-0 glst-node) (s5-1 anim-test-seq-item) (gp-2 anim-test-sequence))
|
||||
(while #t
|
||||
(loop
|
||||
(logclear! (-> self flags) (anim-tester-flags fanimt0))
|
||||
(let ((v1-2 (-> self obj-list)))
|
||||
"is the list empty, #t = empty"
|
||||
@@ -2334,40 +2332,25 @@
|
||||
(s4-1
|
||||
(logior! (-> self flags) (anim-tester-flags fanimt0))
|
||||
(if (nonzero? (-> s5-1 blend))
|
||||
(ja-channel-push! 1 (the int (* (the float (-> s5-1 blend)) (-> self anim-gspeed))))
|
||||
(ja-channel-push! 1 (the-as time-frame (the int (* (the float (-> s5-1 blend)) (-> self anim-gspeed)))))
|
||||
(ja-channel-set! 1)
|
||||
)
|
||||
(cond
|
||||
((= (-> self anim-first) (-> (new 'static 'array float 1 -1.0) 0))
|
||||
(let ((s3-0 (-> self skel root-channel 0)))
|
||||
(joint-control-channel-group-eval! s3-0 s4-1 num-func-identity)
|
||||
(set! (-> s3-0 frame-num) 0.0)
|
||||
)
|
||||
((= (-> self anim-first) -1.0)
|
||||
(ja :group! s4-1 :num! min)
|
||||
)
|
||||
((= (-> self anim-first) (-> (new 'static 'array float 1 -2.0) 0))
|
||||
(let ((s3-1 (-> self skel root-channel 0)))
|
||||
(joint-control-channel-group-eval! s3-1 s4-1 num-func-identity)
|
||||
(set! (-> s3-1 frame-num) (the float (+ (-> s4-1 data 0 length) -1)))
|
||||
)
|
||||
((= (-> self anim-first) -2.0)
|
||||
(ja :group! s4-1 :num! max)
|
||||
)
|
||||
(else
|
||||
(let ((s3-2 (-> self skel root-channel 0)))
|
||||
(joint-control-channel-group-eval! s3-2 s4-1 num-func-identity)
|
||||
(set! (-> s3-2 frame-num) (-> self anim-first))
|
||||
)
|
||||
(ja :group! s4-1 :num! (identity (-> self anim-first)))
|
||||
)
|
||||
)
|
||||
(when (nonzero? (-> s5-1 blend))
|
||||
(while (and (!= (-> self skel root-channel 0) (-> self skel channel)) (logtest? (-> s5-1 flags) 2))
|
||||
(when (logtest? (-> self flags) (anim-tester-flags fanimt5))
|
||||
(TODO-RENAME-9 (-> self align))
|
||||
(TODO-RENAME-10
|
||||
(-> self align)
|
||||
31
|
||||
(-> (new 'static 'array float 1 1.0) 0)
|
||||
(-> (new 'static 'array float 1 1.0) 0)
|
||||
(-> (new 'static 'array float 1 1.0) 0)
|
||||
)
|
||||
(TODO-RENAME-10 (-> self align) 31 (the-as float 1.0) (the-as float 1.0) (the-as float 1.0))
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
@@ -2375,49 +2358,23 @@
|
||||
(until (ja-done? 0)
|
||||
(when (logtest? (-> self flags) (anim-tester-flags fanimt5))
|
||||
(TODO-RENAME-9 (-> self align))
|
||||
(TODO-RENAME-10
|
||||
(-> self align)
|
||||
31
|
||||
(-> (new 'static 'array float 1 1.0) 0)
|
||||
(-> (new 'static 'array float 1 1.0) 0)
|
||||
(-> (new 'static 'array float 1 1.0) 0)
|
||||
)
|
||||
(TODO-RENAME-10 (-> self align) 31 (the-as float 1.0) (the-as float 1.0) (the-as float 1.0))
|
||||
)
|
||||
(suspend)
|
||||
(anim-tester-update-anim-info s5-1)
|
||||
(let ((v1-73 (= (-> self anim-last) (-> (new 'static 'array float 1 -2.0) 0))))
|
||||
(let ((v1-73 (= (-> self anim-last) -2.0)))
|
||||
(cond
|
||||
((or v1-73 (>= (-> self anim-last) (-> self anim-first)))
|
||||
(cond
|
||||
((= (-> self anim-last) (-> (new 'static 'array float 1 -2.0) 0))
|
||||
(let ((a0-42 (-> self skel root-channel 0)))
|
||||
(set! (-> a0-42 param 0) (the float (+ (-> a0-42 frame-group data 0 length) -1)))
|
||||
(set! (-> a0-42 param 1) (-> self anim-speed))
|
||||
(joint-control-channel-group-eval! a0-42 (the-as art-joint-anim #f) num-func-seek!)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(let ((a0-43 (-> self skel root-channel 0)))
|
||||
(set! (-> a0-43 param 0) (-> self anim-last))
|
||||
(set! (-> a0-43 param 1) (-> self anim-speed))
|
||||
(joint-control-channel-group-eval! a0-43 (the-as art-joint-anim #f) num-func-seek!)
|
||||
)
|
||||
(if (= (-> self anim-last) -2.0)
|
||||
(ja :num! (seek! max (-> self anim-speed)))
|
||||
(ja :num! (seek! (-> self anim-last) (-> self anim-speed)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= (-> self anim-last) (-> (new 'static 'array float 1 -1.0) 0))
|
||||
(let ((a0-44 (-> self skel root-channel 0)))
|
||||
(set! (-> a0-44 param 0) 0.0)
|
||||
(set! (-> a0-44 param 1) (-> self anim-speed))
|
||||
(joint-control-channel-group-eval! a0-44 (the-as art-joint-anim #f) num-func-seek!)
|
||||
)
|
||||
((= (-> self anim-last) -1.0)
|
||||
(ja :num! (seek! 0.0 (-> self anim-speed)))
|
||||
)
|
||||
(else
|
||||
(let ((a0-45 (-> self skel root-channel 0)))
|
||||
(set! (-> a0-45 param 0) (-> self anim-last))
|
||||
(set! (-> a0-45 param 1) (-> self anim-speed))
|
||||
(joint-control-channel-group-eval! a0-45 (the-as art-joint-anim #f) num-func-seek!)
|
||||
)
|
||||
(ja :num! (seek! (-> self anim-last) (-> self anim-speed)))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -2463,11 +2420,7 @@
|
||||
(set! (-> self list-con list-owner) (the-as uint self))
|
||||
(quaternion-identity! (-> self root quat))
|
||||
(vector-identity! (-> self root scale))
|
||||
(position-in-front-of-camera!
|
||||
(-> self root trans)
|
||||
(-> (new 'static 'array float 1 40960.0) 0)
|
||||
(-> (new 'static 'array float 1 4096.0) 0)
|
||||
)
|
||||
(position-in-front-of-camera! (-> self root trans) (the-as float 40960.0) (the-as float 4096.0))
|
||||
(set! (-> self event-hook) anim-tester-standard-event-handler)
|
||||
(anim-tester-reset)
|
||||
(go anim-tester-process)
|
||||
|
||||
@@ -4055,7 +4055,7 @@
|
||||
(new-dm-func (symbol->string (the-as symbol (car iter)))
|
||||
(-> (the-as symbol (car iter)) value)
|
||||
(lambda ((info level-load-info))
|
||||
(let ((tf (new 'stack 'transformq)))
|
||||
(let ((tf (new 'stack-no-clear 'transformq)))
|
||||
(set! (-> tf trans x) (-> info bsphere x))
|
||||
(set! (-> tf trans y) (-> info bsphere y))
|
||||
(set! (-> tf trans z) (-> info bsphere z))
|
||||
@@ -4492,16 +4492,6 @@
|
||||
(flag "uk-english" 6 dm-subtitle-language)
|
||||
)
|
||||
(flag "Discord RPC" #t ,(dm-lambda-boolean-flag (-> *pc-settings* discord-rpc?)))
|
||||
(menu "Game fixes"
|
||||
(flag "sagecage crash" #f ,(dm-lambda-boolean-flag (-> *pc-settings* fixes crash-sagecage)))
|
||||
;(flag "memory crash" #f ,(dm-lambda-boolean-flag (-> *pc-settings* fixes crash-dma)))
|
||||
;(flag "light eco crash" #f ,(dm-lambda-boolean-flag (-> *pc-settings* fixes crash-light-eco)))
|
||||
;(flag "softlock pelican" #f ,(dm-lambda-boolean-flag (-> *pc-settings* fixes lockout-pelican)))
|
||||
;(flag "softlock pipegame" #f ,(dm-lambda-boolean-flag (-> *pc-settings* fixes lockout-pipegame)))
|
||||
;(flag "softlock gambler" #f ,(dm-lambda-boolean-flag (-> *pc-settings* fixes lockout-gambler)))
|
||||
;(flag "fix movies" #f ,(dm-lambda-boolean-flag (-> *pc-settings* fixes fix-movies)))
|
||||
;(flag "fix credits" #f ,(dm-lambda-boolean-flag (-> *pc-settings* fixes fix-credits)))
|
||||
)
|
||||
(menu "PS2 settings"
|
||||
;(flag "PS2 Load speed" #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-read-speed?)))
|
||||
(flag "PS2 Particles" #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-parts?)))
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
(defstate part-tester-idle (part-tester)
|
||||
:code
|
||||
(behavior ()
|
||||
(while #t
|
||||
(loop
|
||||
(let ((gp-0 (entity-by-name *part-tester-name*)))
|
||||
(when gp-0
|
||||
(let ((s5-0 (-> gp-0 extra process)))
|
||||
|
||||
@@ -31,23 +31,17 @@
|
||||
(defstate viewer-process (viewer)
|
||||
:code
|
||||
(behavior ()
|
||||
(while #t
|
||||
(let ((a0-0 (-> self skel root-channel 0)))
|
||||
(set! (-> a0-0 frame-group) (-> self janim))
|
||||
(set! (-> a0-0 param 0) (the float (+ (-> self janim data 0 length) -1)))
|
||||
(set! (-> a0-0 param 1) 1.0)
|
||||
(set! (-> a0-0 frame-num) 0.0)
|
||||
(joint-control-channel-group! a0-0 (-> self janim) num-func-seek!)
|
||||
)
|
||||
(loop
|
||||
(ja-no-eval :group! (-> self janim)
|
||||
:num!
|
||||
(seek! (the float (+ (-> self janim data 0 length) -1)))
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(TODO-RENAME-9 (-> self align))
|
||||
(TODO-RENAME-10 (-> self align) 31 1.0 1.0 1.0)
|
||||
(suspend)
|
||||
(let ((a0-3 (-> self skel root-channel 0)))
|
||||
(set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group data 0 length) -1)))
|
||||
(set! (-> a0-3 param 1) 1.0)
|
||||
(joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!)
|
||||
)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
)
|
||||
(none)
|
||||
|
||||
Reference in New Issue
Block a user