Skip to content

Commit

Permalink
rename joint node and art element macros (#3111)
Browse files Browse the repository at this point in the history
  • Loading branch information
ManDude authored Nov 1, 2023
1 parent 5587593 commit a949dad
Show file tree
Hide file tree
Showing 139 changed files with 447 additions and 494 deletions.
3 changes: 1 addition & 2 deletions decompiler/IR2/FormExpressionAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3993,8 +3993,7 @@ GenericElement* DerefElement::try_as_joint_node_index(const Env& env, FormPool&
if (joint_name) {
args.push_back(pool.form<ConstantTokenElement>(joint_name.value()));
return pool.alloc_element<GenericElement>(
GenericOperator::make_function(pool.form<ConstantTokenElement>("joint-node-index")),
args);
GenericOperator::make_function(pool.form<ConstantTokenElement>("joint-node")), args);
} else {
lg::error("function `{}`: did not find joint node {} in {}", env.func->name(),
mr.maps.ints.at(0), env.joint_geo());
Expand Down
16 changes: 8 additions & 8 deletions goal_src/jak1/engine/data/art-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
)

;; look up the index of an art element in an art group.
(desfun art-elt->index (ag-name elt-name)
(desfun art-elt-index (ag-name elt-name)
(if (number? elt-name)
elt-name
(let ((ag-info (hash-table-try-ref *art-info* (symbol->string ag-name))))
Expand All @@ -334,7 +334,7 @@
)
)

(defmacro joint-name->index (jg-name name)
(defmacro joint-node-index (jg-name name)
(let ((jg-info (hash-table-try-ref *jg-info* (symbol->string jg-name))))
(if (not (car jg-info))
-1
Expand All @@ -347,8 +347,8 @@
)
)

(defmacro joint-node-index (jg name)
`(-> self node-list data (joint-name->index ,jg ,name))
(defmacro joint-node (jg name)
`(-> self node-list data (joint-node-index ,jg ,name))
)

(defmacro defskelgroup (name art-name joint-geom joint-anim lods
Expand All @@ -368,18 +368,18 @@
:longest-edge ,longest-edge
:version ,version
:max-lod ,(- (length lods) 1)
:shadow ,(art-elt->index (string->symbol-format "{}-ag" art-name) shadow)
:shadow ,(art-elt-index (string->symbol-format "{}-ag" art-name) shadow)
:texture-level ,texture-level
:sort ,sort
)))
;; set joint geometry and joint bones
(set! (-> skel jgeo) ,(art-elt->index (string->symbol-format "{}-ag" art-name) joint-geom))
(set! (-> skel janim) ,(art-elt->index (string->symbol-format "{}-ag" art-name) joint-anim))
(set! (-> skel jgeo) ,(art-elt-index (string->symbol-format "{}-ag" art-name) joint-geom))
(set! (-> skel janim) ,(art-elt-index (string->symbol-format "{}-ag" art-name) joint-anim))

;; set lods
,@(apply-i (lambda (x i)
`(begin
(set! (-> skel mgeo ,i) ,(art-elt->index (string->symbol-format "{}-ag" art-name) (car x)))
(set! (-> skel mgeo ,i) ,(art-elt-index (string->symbol-format "{}-ag" art-name) (car x)))
(set! (-> skel lod-dist ,i) ,(cadr x))
)
) lods)
Expand Down
4 changes: 2 additions & 2 deletions goal_src/jak1/engine/game/powerups.gc
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@
(not (time-elapsed? (-> self control unknown-dword11) (seconds 0.05)))
)
)
(let ((gp-0 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index eichar-lod0-jg RbigToe))))
(let ((gp-0 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node eichar-lod0-jg RbigToe))))
(if (and (< (fabs (vector-dot
(-> self control dynam gravity-normal)
(vector-! (new 'stack-no-clear 'vector) gp-0 (-> self control trans))
Expand All @@ -533,7 +533,7 @@
(launch-particles :system *sp-particle-system-3d* (-> *part-id-table* 2391) gp-0)
)
)
(let ((gp-1 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index eichar-lod0-jg LbigToe))))
(let ((gp-1 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node eichar-lod0-jg LbigToe))))
(if (and (< (fabs (vector-dot
(-> self control dynam gravity-normal)
(vector-! (new 'stack-no-clear 'vector) gp-1 (-> self control trans))
Expand Down
10 changes: 5 additions & 5 deletions goal_src/jak1/engine/target/logic-target.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@
((and (= (-> self next-state name) 'target-clone-anim)
(not (logtest? (-> self draw status) (draw-status hidden)))
(begin
(vector<-cspace! gp-0 (joint-node-index eichar-lod0-jg main))
(vector<-cspace! gp-0 (joint-node eichar-lod0-jg main))
(+! (-> gp-0 y) -5896.192)
(< (fabs (- (-> gp-0 y) (-> self control trans y))) 8192.0)
)
Expand Down Expand Up @@ -2005,10 +2005,10 @@
(set! (-> self draw lod-set max-lod) 0)
(logior! (-> self skel status) (janim-status inited eye))
(set! (-> self draw shadow-ctrl) *target-shadow-control*)
(set! (-> self control unknown-cspace00 parent) (joint-node-index eichar-lod0-jg lindA))
(set! (-> self control unknown-cspace00 joint) (the-as joint (joint-node-index eichar-lod0-jg rindA)))
(set! (-> self control unknown-cspace00 joint) (the-as joint (joint-node-index eichar-lod0-jg rindA)))
(set! (-> self control unknown-cspace10 parent) (joint-node-index eichar-lod0-jg LshoulderPad))
(set! (-> self control unknown-cspace00 parent) (joint-node eichar-lod0-jg lindA))
(set! (-> self control unknown-cspace00 joint) (the-as joint (joint-node eichar-lod0-jg rindA)))
(set! (-> self control unknown-cspace00 joint) (the-as joint (joint-node eichar-lod0-jg rindA)))
(set! (-> self control unknown-cspace10 parent) (joint-node eichar-lod0-jg LshoulderPad))
(set! (-> self neck) (new 'process 'joint-mod (joint-mod-handler-mode look-at) self 7))
(set! (-> self fact)
(new 'process 'fact-info-target self (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc))
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak1/engine/target/target.gc
Original file line number Diff line number Diff line change
Expand Up @@ -2135,7 +2135,7 @@
(create-splash
(-> self water)
(the-as float 0.6)
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index eichar-lod0-jg mouth))
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node eichar-lod0-jg mouth))
0
(-> self control transv)
)
Expand Down
8 changes: 4 additions & 4 deletions goal_src/jak1/engine/target/target2.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@
gp-1
projectile-init-by-other
(-> self entity)
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index eichar-lod0-jg sk_rhand))
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node eichar-lod0-jg sk_rhand))
s5-2
(if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max))
25
Expand Down Expand Up @@ -1828,7 +1828,7 @@
(create-splash
(-> self water)
(the-as float 0.2)
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index eichar-lod0-jg Rtoes))
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node eichar-lod0-jg Rtoes))
0
(vector-float*! (new 'stack-no-clear 'vector) (-> self control transv) 2.5)
)
Expand All @@ -1838,7 +1838,7 @@
(create-splash
(-> self water)
(the-as float 0.2)
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index eichar-lod0-jg Ltoes))
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node eichar-lod0-jg Ltoes))
0
(vector-float*! (new 'stack-no-clear 'vector) (-> self control transv) 2.5)
)
Expand Down Expand Up @@ -2700,7 +2700,7 @@
:exit (behavior ()
(send-event (ppointer->process (-> self sidekick)) 'matrix 'normal)
(send-event (ppointer->process (-> self sidekick)) 'shadow #t)
(let ((gp-0 (joint-node-index eichar-lod0-jg main))
(let ((gp-0 (joint-node eichar-lod0-jg main))
(a1-2 (&-> (-> self control) unknown-qword00))
)
(cond
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak1/levels/beach/beach-obs.gc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
)
:trans (behavior ()
(rider-trans)
(let ((t2-0 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index windmill-one-lod0-jg big))))
(let ((t2-0 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node windmill-one-lod0-jg big))))
(if (!= (+ (-> t2-0 x) (-> t2-0 y) (-> t2-0 z)) 0.0)
(sound-play "gears-rumble" :id (-> self sound-id) :position (the-as symbol t2-0))
)
Expand Down
10 changes: 5 additions & 5 deletions goal_src/jak1/levels/beach/beach-rocks.gc
Original file line number Diff line number Diff line change
Expand Up @@ -319,31 +319,31 @@
(if (and (< 200.0 f30-0) (< f30-0 275.0))
(spawn
(-> self part-falling)
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index lrocklrg-lod0-jg Lrocklrg))
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node lrocklrg-lod0-jg Lrocklrg))
)
)
(if (and (< 270.0 f30-0) (< f30-0 333.0))
(spawn
(-> self part-falling)
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index lrocklrg-lod0-jg platformrock))
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node lrocklrg-lod0-jg platformrock))
)
)
(if (and (< (-> self prev-frame) 333.0) (>= f30-0 333.0))
(spawn
(-> self part-landing)
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index lrocklrg-lod0-jg platformrock))
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node lrocklrg-lod0-jg platformrock))
)
)
(if (and (< 169.0 f30-0) (< f30-0 202.0))
(spawn
(-> self part-falling)
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index lrocklrg-lod0-jg Rrocklrg))
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node lrocklrg-lod0-jg Rrocklrg))
)
)
(if (and (< 240.0 f30-0) (< f30-0 270.0))
(spawn
(-> self part-falling)
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index lrocklrg-lod0-jg smlrock))
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node lrocklrg-lod0-jg smlrock))
)
)
(set! (-> self prev-frame) f30-0)
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak1/levels/finalboss/final-door.gc
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
(ja :num! (seek! (ja-aframe 18.0 0)))
)
(let ((s4-3 (-> (handle->process (the-as handle arg0)) entity))
(s3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index eichar-lod0-jg neckB)))
(s3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node eichar-lod0-jg neckB)))
)
(dotimes (s2-0 50)
(when (handle->process (the-as handle arg0))
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak1/levels/finalboss/robotboss-misc.gc
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@

(defbehavior robotboss-manipy-trans-hook robotboss ()
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-0 (joint-node-index robotboss-basic-lod0-jg blue_eco_piece))
(vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg blue_eco_piece))
(spawn (-> self part) gp-0)
)
0
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak1/levels/finalboss/robotboss-weapon.gc
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
)
(when (ja-group? darkecobomb-spin-cycle-ja)
(let ((gp-2 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-2 (joint-node-index darkecobomb-lod0-jg particles))
(vector<-cspace! gp-2 (joint-node darkecobomb-lod0-jg particles))
(spawn (-> self part) gp-2)
)
)
Expand Down
30 changes: 15 additions & 15 deletions goal_src/jak1/levels/finalboss/robotboss.gc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
(gp-1 (-> self node-list data 88 bone scale))
)
(let ((s4-1 (new 'stack-no-clear 'vector)))
(vector<-cspace! s4-1 (joint-node-index robotboss-basic-lod0-jg camera))
(vector<-cspace! s4-1 (joint-node robotboss-basic-lod0-jg camera))
(set! (-> *camera-other-trans* quad) (-> s4-1 quad))
)
(vector-normalize-copy!
Expand Down Expand Up @@ -88,21 +88,21 @@
(defbehavior robotboss-always-trans robotboss ((arg0 (state robotboss)))
(when (-> self blue-smoke)
(let ((s5-0 (new 'stack-no-clear 'vector)))
(vector<-cspace! s5-0 (joint-node-index robotboss-basic-lod0-jg blue_eco_piece))
(vector<-cspace! s5-0 (joint-node robotboss-basic-lod0-jg blue_eco_piece))
(spawn (-> self particle 2) s5-0)
)
)
(when (-> self red-smoke)
(let ((s5-1 (new 'stack-no-clear 'vector)))
(vector<-cspace! s5-1 (joint-node-index robotboss-basic-lod0-jg rArmTopWireC))
(vector<-cspace! s5-1 (joint-node robotboss-basic-lod0-jg rArmTopWireC))
(spawn (-> self particle 3) s5-1)
(vector<-cspace! s5-1 (joint-node-index robotboss-basic-lod0-jg rArmBotWireC))
(vector<-cspace! s5-1 (joint-node robotboss-basic-lod0-jg rArmBotWireC))
(spawn (-> self particle 3) s5-1)
)
)
(when (-> self yellow-smoke)
(let ((s5-2 (new 'stack-no-clear 'vector)))
(vector<-cspace! s5-2 (joint-node-index robotboss-basic-lod0-jg Lyellow_ecoTubeA))
(vector<-cspace! s5-2 (joint-node robotboss-basic-lod0-jg Lyellow_ecoTubeA))
(spawn (-> self particle 4) s5-2)
)
)
Expand Down Expand Up @@ -200,7 +200,7 @@
)
((-> self use-interesting)
(let ((s5-10 (new 'stack-no-clear 'vector)))
(vector<-cspace! s5-10 (joint-node-index robotboss-basic-lod0-jg interesting))
(vector<-cspace! s5-10 (joint-node robotboss-basic-lod0-jg interesting))
(send-event *camera* 'point-of-interest s5-10)
)
)
Expand Down Expand Up @@ -325,7 +325,7 @@
(+! (-> self children-spawned) 1)
(let ((gp-0 (new 'stack-no-clear 'vector)))
(let ((s4-0 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-0 (joint-node-index robotboss-basic-lod0-jg darkbombD))
(vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg darkbombD))
(set! (-> s4-0 quad) (-> self entity extra trans quad))
(vector+! s4-0 s4-0 arg0)
(process-spawn darkecobomb gp-0 s4-0 61440.0 300 arg1 :to self)
Expand Down Expand Up @@ -838,7 +838,7 @@
(+! (-> self children-spawned) 1)
(let ((gp-0 (new 'stack-no-clear 'vector)))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-0 (joint-node-index robotboss-basic-lod0-jg Lyellow_ecoBarrell))
(vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg Lyellow_ecoBarrell))
(set! (-> gp-0 y) 1972633.6)
(if *target*
(set! (-> s5-0 quad) (-> (target-pos 0) quad))
Expand Down Expand Up @@ -981,7 +981,7 @@
(ja :group! robotboss-yellow-last-hit-ja)
(set! (-> self yellow-smoke) #t)
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-0 (joint-node-index robotboss-basic-lod0-jg Lyellow_ecoTubeA))
(vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg Lyellow_ecoTubeA))
(process-spawn
part-tracker
:init part-tracker-init
Expand Down Expand Up @@ -1018,7 +1018,7 @@
)
(let ((gp-2 (new 'stack-no-clear 'vector)))
(update! (-> self looping-sound 3))
(vector<-cspace! gp-2 (joint-node-index robotboss-basic-lod0-jg Lyellow_ecoBarrell))
(vector<-cspace! gp-2 (joint-node robotboss-basic-lod0-jg Lyellow_ecoBarrell))
(spawn (-> self particle 6) gp-2)
)
)
Expand Down Expand Up @@ -1366,7 +1366,7 @@
(let ((s5-0 arg1))
(+! (-> self children-spawned) 1)
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-0 (joint-node-index robotboss-basic-lod0-jg red_ecoTip))
(vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg red_ecoTip))
(let ((s4-0 (get-process *default-dead-pool* redshot #x4000)))
(when s4-0
(let ((t9-2 (method-of-type redshot activate)))
Expand Down Expand Up @@ -1557,7 +1557,7 @@
(ja :group! robotboss-red-last-hit-ja)
(set! (-> self red-smoke) #t)
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-0 (joint-node-index robotboss-basic-lod0-jg rArmBotWireC))
(vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg rArmBotWireC))
(process-spawn
part-tracker
:init part-tracker-init
Expand Down Expand Up @@ -1625,7 +1625,7 @@
(until (ja-done? 0)
(update! (-> self looping-sound 2))
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-0 (joint-node-index robotboss-basic-lod0-jg red_ecoTip))
(vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg red_ecoTip))
(spawn (-> self particle 5) gp-0)
)
(if (robotboss-is-red-hit)
Expand Down Expand Up @@ -1839,7 +1839,7 @@
(+! (-> self children-spawned) 1)
(let ((gp-0 (new 'stack-no-clear 'vector)))
(let ((s2-0 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-0 (joint-node-index robotboss-basic-lod0-jg green_eco))
(vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg green_eco))
(set! (-> s2-0 quad) (-> self entity extra trans quad))
(+! (-> s2-0 y) -40960.0)
(vector+! s2-0 s2-0 arg0)
Expand Down Expand Up @@ -2499,7 +2499,7 @@
(sound-play "explod-eye")
(set! (-> self blue-smoke) #t)
(let ((gp-1 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-1 (joint-node-index robotboss-basic-lod0-jg blue_eco_piece))
(vector<-cspace! gp-1 (joint-node robotboss-basic-lod0-jg blue_eco_piece))
(process-spawn
part-tracker
:init part-tracker-init
Expand Down
4 changes: 2 additions & 2 deletions goal_src/jak1/levels/flut_common/target-flut.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@
(create-splash
(-> self water)
(the-as float 0.6)
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node-index eichar-lod0-jg mouth))
(vector<-cspace! (new 'stack-no-clear 'vector) (joint-node eichar-lod0-jg mouth))
0
(-> self control transv)
)
Expand Down Expand Up @@ -1936,7 +1936,7 @@
)
(rot->dir-targ! (-> self control))
(ja-post)
(vector<-cspace! gp-0 (joint-node-index eichar-lod0-jg main))
(vector<-cspace! gp-0 (joint-node eichar-lod0-jg main))
(+! (-> gp-0 y) -5896.192)
(move-to-point! (-> self control) gp-0)
)
Expand Down
8 changes: 4 additions & 4 deletions goal_src/jak1/levels/jungle/fisher.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1727,13 +1727,13 @@
:trans (behavior ()
(when (-> self training)
(let ((gp-0 (new-stack-vector0)))
(vector<-cspace! gp-0 (joint-node-index fisher-lod0-jg mainA))
(vector<-cspace! gp-0 (joint-node fisher-lod0-jg mainA))
(launch-particles (-> *part-id-table* 2001) gp-0)
(fisher-fish-water gp-0 (+ 32768.0 (vector-y-angle (-> self node-list data 75 bone transform vector 1))))
(vector<-cspace! gp-0 (joint-node-index fisher-lod0-jg mainB))
(vector<-cspace! gp-0 (joint-node fisher-lod0-jg mainB))
(launch-particles (-> *part-id-table* 2001) gp-0)
(fisher-fish-water gp-0 (+ 32768.0 (vector-y-angle (-> self node-list data 78 bone transform vector 1))))
(vector<-cspace! gp-0 (joint-node-index fisher-lod0-jg top))
(vector<-cspace! gp-0 (joint-node fisher-lod0-jg top))
(launch-particles (-> *part-id-table* 828) gp-0)
(launch-particles (-> *part-id-table* 2013) gp-0)
(fisher-fish-water gp-0 (+ 32768.0 (vector-y-angle (-> self node-list data 80 bone transform vector 1))))
Expand Down Expand Up @@ -2045,7 +2045,7 @@
)
(let ((v1-35 (-> self manipy 0 node-list data)))
(set! (-> v1-35 0 param0) cspace<-cspace+quaternion!)
(set! (-> v1-35 0 param1) (the-as basic (joint-node-index eichar-lod0-jg sk_rhand)))
(set! (-> v1-35 0 param1) (the-as basic (joint-node eichar-lod0-jg sk_rhand)))
(set! (-> v1-35 0 param2) (the-as basic (-> self control quat)))
)
)
Expand Down
Loading

0 comments on commit a949dad

Please sign in to comment.