diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index c9a9c2bd67..cadcbecfa0 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -6539,6 +6539,7 @@ This is static data loaded from the DVD at boot." ) (deftype light (structure) + "extra: {?, shadow, ?, ?}" ((direction vector :inline :offset-assert 0) (color rgbaf :inline :offset-assert 16) (extra vector :inline :offset-assert 32) @@ -22430,6 +22431,11 @@ Levels store a reference to this which holds all the entities in the level." ) (deftype entity (res-lump) + "Entities are mainly used to place objects in a level. + + As a child of [[res-lump]], they store various types of metadata + in [[res-tag]]s (such as name, curve data, volume data, etc.) + that gets accessed by the accompanying process." ((trans vector :inline :offset-assert 32) (aid uint32 :offset-assert 48) ) @@ -22477,6 +22483,7 @@ Levels store a reference to this which holds all the entities in the level." (define-extern entity-actor type) (declare-type nav-poly structure) (deftype entity-actor (entity) + "Child class of [[entity]] used to spawn [[process-drawable]] actors." ((etype type :offset 56) (task game-task :offset-assert 60) (kill-mask task-mask :offset 52) diff --git a/decompiler/config/jak2/ntsc_v1/var_names.jsonc b/decompiler/config/jak2/ntsc_v1/var_names.jsonc index f98925f8b6..88c9aa9dff 100644 --- a/decompiler/config/jak2/ntsc_v1/var_names.jsonc +++ b/decompiler/config/jak2/ntsc_v1/var_names.jsonc @@ -1038,9 +1038,9 @@ }, "print-continues": { "vars": { - "s5-0": "conts", "gp-0": "levels", - "v1-2": "cont" + "s5-0": "continues", + "v1-2": "continue" } }, "(method 18 game-info)": { @@ -5325,5 +5325,117 @@ "f30-0": "elapsed-time", "f0-2": "period" } + }, + "joint-mod-debug-draw": { + "args": ["jmod"] + }, + "(method 10 joint-mod)": { + "args": ["this", "pos"] + }, + "(method 14 joint-mod)": { + "args": ["this", "trans", "quat", "scale"] + }, + "(method 13 joint-mod)": { + "args": ["this", "x", "y", "z"] + }, + "(method 10 joint-mod-ik)": { + "args": ["this", "enable"] + }, + "(method 0 joint-mod-ik)": { + "args": ["allocation", "type-to-make", "proc", "joint-id", "hand-dist"] + }, + "create-interpolated-joint-animation-frame": { + "args": ["dst", "num-joints", "jc"] + }, + "cspace<-parented-transformq-joint-flip-z!": { + "args": ["dst", "joint-transformq"] + }, + "cspace<-parented-matrix-mirror!": { + "args": ["dst", "joint-mat"] + }, + "cspace-calc-total-matrix!": { + "args": ["csp", "dst"] + }, + "cspace<-transformq+rot-offset!": { + "args": ["dst", "src", "extra-rot"] + }, + "cspace<-transformq+world-trans!": { + "args": ["dst", "src", "extra-trans"] + }, + "cspace<-transformq+trans!": { + "args": ["dst", "src", "extra-trans"] + }, + "cspace<-transformq!": { + "args": ["dst", "src"] + }, + "cspace<-transform-yxy!": { + "args": ["dst", "src"] + }, + "cspace<-rot-yxy!": { + "args": ["dst", "src"] + }, + "matrix-from-joint-anim-frame": { + "args": ["jacc", "joint-idx", "frame-idx"], + "vars": { + "v1-1": "fixed-matrix", + "v0-0": "frame-matrix" + } + }, + "joint-control-remap!": { + "args": [ + "jc", + "dst-art-group", + "parent-art-group", + "remap-list", + "seed", + "prefix" + ] + }, + "joint-control-copy!": { + "args": ["dst", "src"] + }, + "joint-control-channel-group!": {}, + "joint-control-channel-group-eval!": { + "args": ["jcc", "ja", "num-func"] + }, + "joint-control-channel-eval!": { + "args": ["jcc", "num-func"] + }, + "joint-control-channel-eval": { + "args": ["jcc"] + }, + "joint-anim-login": { + "args": ["jad"] + }, + "(method 11 game-info)": { + "args": ["this", "task"] + }, + "joint-channel-float-delete!": { + "args": ["chan"] + }, + "process-drawable-delay-player": { + "args": ["delay"] + }, + "pusher-post": { + "vars": { + "gp-0": "cshape" + } + }, + "rider-post": { + "vars": { + "gp-0": "cshape" + } + }, + "draw-root": { + "args": ["proc"] + }, + "(method 11 draw-control)": { + "args": ["this", "lods"], + "vars": { + "a1-2": "lod" + } + }, + "(method 10 draw-control)": { + "args": ["this", "lod"] } } diff --git a/decompiler/config/jak3/ntsc_v1/var_names.jsonc b/decompiler/config/jak3/ntsc_v1/var_names.jsonc index 8a332a2340..629ae3e0c5 100644 --- a/decompiler/config/jak3/ntsc_v1/var_names.jsonc +++ b/decompiler/config/jak3/ntsc_v1/var_names.jsonc @@ -1638,13 +1638,19 @@ "args": ["this", "proc"] }, "target-send-attack": { - "vars": { "t1-11": ["name", "sound-name"] } + "vars": { + "t1-11": ["name", "sound-name"] + } }, "(code target-running-attack)": { - "vars": { "t1-5": ["name", "sound-name"] } + "vars": { + "t1-5": ["name", "sound-name"] + } }, "arrive-at-continue": { - "vars": { "s5-2": ["s5-2", "handle"] } + "vars": { + "s5-2": ["s5-2", "handle"] + } }, "find-nearest-focusable": { "vars": { @@ -1653,12 +1659,79 @@ } }, "gun->eco": { - "vars": { "v0-0": ["v0-0", "pickup-type"] } + "vars": { + "v0-0": ["v0-0", "pickup-type"] + } }, "gun->ammo": { - "vars": { "v0-0": ["v0-0", "pickup-type"] } + "vars": { + "v0-0": ["v0-0", "pickup-type"] + } }, "gun-pickup-type->game-feature": { - "vars": { "v0-0": ["v0-0", "game-feature"] } + "vars": { + "v0-0": ["v0-0", "game-feature"] + } + }, + "(method 9 highscore-info)": { + "args": ["this", "score"], + "vars": { + "v0-0": "place" + } + }, + "(method 12 game-info)": { + "vars": { + "s5-0": "subtasks", + "s4-0": "i" + } + }, + "(method 10 border-plane)": { + "vars": { + "arg0": "pt" + } + }, + "merc-vu1-add-vu-function": { + "args": ["dma", "func", "flush-mode"], + "vars": { + "v1-0": "func-data", + "a3-0": "qwc", + "a1-1": "dst", + "t0-1": "qwc-this-time" + } + }, + "bsp-camera-asm": { + "vars": { + "a3-0": "cam-pos-i1", + "a3-1": "cam-pos-32", + "a3-2": "cam-pos-16", + "a3-3": "cam-pos-8", + "a3-4": "cam-pos-8m", + "v1-0": "nodes", + "a2-0": "nidx", + "t1-1": "node", + "t3-0": "front-min", + "t6-0": "front-min-compare", + "t0-2": "front-max", + "t4-0": "front-max-compare", + "t2-0": "back-min", + "t7-0": "back-min-compare", + "t0-3": "back-max", + "t5-0": "back-max-compare", + "t0-4": "front-idx", + "t6-1": "not-f-min", + "t7-1": "not-b-min", + "t3-1": "f-flag", + "t4-2": "f-in-box", + "t5-2": "b-in-box", + "t2-1": "b-flag", + "t1-2": "back-idx" + } + }, + "target-collision-low-coverage": { + "vars": { + "sv-16": "contact-normal", + "sv-56": "overhang-nrm", + "sv-52": "tangent" + } } } diff --git a/decompiler/types2/ForwardProp.cpp b/decompiler/types2/ForwardProp.cpp index 66006206e8..4fddcfde47 100644 --- a/decompiler/types2/ForwardProp.cpp +++ b/decompiler/types2/ForwardProp.cpp @@ -2576,7 +2576,7 @@ void CallOp::propagate_types2(types2::Instruction& instr, if (can_use_call_parent) { out_types[Register(Reg::GPR, Reg::V0)]->type = TP_Type::make_from_ts(call_parent_result_type); - printf("used special %s\n", call_parent_result_type.print().c_str()); + lg::print("used special {}\n", call_parent_result_type.print()); use_normal_last_arg = false; } } diff --git a/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc index 12f7012a16..b774843ee7 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc @@ -151,9 +151,9 @@ This is used to make jak look toward an enemy, for example." ;; definition (debug) for function joint-mod-debug-draw ;; WARN: Return type mismatch int vs none. -(defun-debug joint-mod-debug-draw ((arg0 joint-mod)) +(defun-debug joint-mod-debug-draw ((jmod joint-mod)) "Debug draw the bone transform for the associated bone of a joint-mod" - (add-debug-matrix #t (bucket-id debug-no-zbuf1) (-> arg0 joint bone transform) (meters 2)) + (add-debug-matrix #t (bucket-id debug-no-zbuf1) (-> jmod joint bone transform) (meters 2)) 0 (none) ) diff --git a/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc index afc87a2f5a..d1156cf0f4 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc @@ -285,10 +285,10 @@ ) ;; definition for method 0 of type joint-mod-ik -(defmethod new joint-mod-ik ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 int) (arg2 float)) +(defmethod new joint-mod-ik ((allocation symbol) (type-to-make type) (proc process-drawable) (joint-id int) (hand-dist float)) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> v0-0 process) arg0) - (set! (-> v0-0 hand-dist) arg2) + (set! (-> v0-0 process) proc) + (set! (-> v0-0 hand-dist) hand-dist) (set! (-> v0-0 elbow-pole-vector-axis) (the-as uint 0)) (logclear! (-> v0-0 flags) (joint-mod-ik-flags elbow-trans-neg)) (set! (-> v0-0 elbow-rotation-axis) (the-as uint 2)) @@ -296,10 +296,10 @@ (set! (-> v0-0 callback) #f) (set! (-> v0-0 blend) 0.0) (logclear! (-> v0-0 flags) (joint-mod-ik-flags enable)) - (let ((a0-5 (-> arg0 node-list data arg1))) + (let ((a0-5 (-> proc node-list data joint-id))) (set! (-> a0-5 param0) joint-mod-ik-callback) (set! (-> a0-5 param1) v0-0) - (set! (-> a0-5 param2) (the-as basic arg1)) + (set! (-> a0-5 param2) (the-as basic joint-id)) ) v0-0 ) @@ -316,8 +316,8 @@ ;; definition for method 10 of type joint-mod-ik ;; WARN: Return type mismatch int vs none. -(defmethod enable-set! ((this joint-mod-ik) (arg0 symbol)) - (if arg0 +(defmethod enable-set! ((this joint-mod-ik) (enable symbol)) + (if enable (logior! (-> this flags) (joint-mod-ik-flags enable)) (logclear! (-> this flags) (joint-mod-ik-flags enable)) ) @@ -700,15 +700,15 @@ ) ;; definition for method 13 of type joint-mod -(defmethod twist-set! ((this joint-mod) (arg0 float) (arg1 float) (arg2 float)) - (if arg0 - (set! (-> this twist x) arg0) +(defmethod twist-set! ((this joint-mod) (x float) (y float) (z float)) + (if x + (set! (-> this twist x) x) ) - (if arg1 - (set! (-> this twist y) arg1) + (if y + (set! (-> this twist y) y) ) - (if arg2 - (set! (-> this twist z) arg2) + (if z + (set! (-> this twist z) z) ) (-> this twist) ) @@ -716,15 +716,15 @@ ;; definition for method 14 of type joint-mod ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod trs-set! ((this joint-mod) (arg0 vector) (arg1 quaternion) (arg2 vector)) - (if arg0 - (set! (-> this trans quad) (-> arg0 quad)) +(defmethod trs-set! ((this joint-mod) (trans vector) (quat quaternion) (scale vector)) + (if trans + (set! (-> this trans quad) (-> trans quad)) ) - (if arg1 - (quaternion-copy! (-> this quat) arg1) + (if quat + (quaternion-copy! (-> this quat) quat) ) - (if arg2 - (set! (-> this scale quad) (-> arg2 quad)) + (if scale + (set! (-> this scale quad) (-> scale quad)) ) 0 (none) @@ -733,13 +733,13 @@ ;; definition for method 10 of type joint-mod ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod target-set! ((this joint-mod) (arg0 vector)) +(defmethod target-set! ((this joint-mod) (pos vector)) (if (= (-> this mode) (joint-mod-mode reset)) (mode-set! this (joint-mod-mode look-at)) ) - (let ((f0-0 (vector-vector-distance (-> this process root trans) arg0))) + (let ((f0-0 (vector-vector-distance (-> this process root trans) pos))) (set! (-> this shutting-down?) #f) - (set! (-> this target quad) (-> arg0 quad)) + (set! (-> this target quad) (-> pos quad)) (if (< f0-0 (-> this max-dist)) (set! (-> this blend) 1.0) (set! (-> this blend) 0.0) diff --git a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc index bbb5cd4872..4ac5c03ad7 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc @@ -49,13 +49,13 @@ ) ;; definition for function joint-anim-login -(defun joint-anim-login ((arg0 joint-anim-drawable)) - (dotimes (s5-0 (-> arg0 length)) - (if (-> arg0 data s5-0) - (login (-> arg0 data s5-0)) +(defun joint-anim-login ((jad joint-anim-drawable)) + (dotimes (s5-0 (-> jad length)) + (if (-> jad data s5-0) + (login (-> jad data s5-0)) ) ) - arg0 + jad ) ;; definition for function joint-anim-inspect-elt @@ -648,37 +648,37 @@ ) ;; definition for function joint-control-channel-eval -(defbehavior joint-control-channel-eval process ((arg0 joint-control-channel)) - (let ((f0-3 ((-> arg0 num-func) arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)))) - (set! (-> arg0 eval-time) (the-as uint (current-time))) +(defbehavior joint-control-channel-eval process ((jcc joint-control-channel)) + (let ((f0-3 ((-> jcc num-func) jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2)))) + (set! (-> jcc eval-time) (the-as uint (current-time))) f0-3 ) ) ;; definition for function joint-control-channel-eval! -(defbehavior joint-control-channel-eval! process ((arg0 joint-control-channel) (arg1 (function joint-control-channel float float float float))) - (set! (-> arg0 num-func) arg1) - (let ((f0-3 (arg1 arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)))) - (set! (-> arg0 eval-time) (the-as uint (current-time))) +(defbehavior joint-control-channel-eval! process ((jcc joint-control-channel) (num-func (function joint-control-channel float float float float))) + (set! (-> jcc num-func) num-func) + (let ((f0-3 (num-func jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2)))) + (set! (-> jcc eval-time) (the-as uint (current-time))) f0-3 ) ) ;; definition for function joint-control-channel-group-eval! -(defun joint-control-channel-group-eval! ((arg0 joint-control-channel) - (arg1 art-joint-anim) - (arg2 (function joint-control-channel float float float float)) +(defun joint-control-channel-group-eval! ((jcc joint-control-channel) + (ja art-joint-anim) + (num-func (function joint-control-channel float float float float)) ) - (set! (-> arg0 num-func) arg2) + (set! (-> jcc num-func) num-func) (cond - ((= (-> arg0 command) (joint-control-command stack)) + ((= (-> jcc command) (joint-control-command stack)) ) (else - (if arg1 - (set! (-> arg0 frame-group) arg1) + (if ja + (set! (-> jcc frame-group) ja) ) - (arg2 arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)) - (set! (-> arg0 eval-time) (the-as uint (current-time))) + (num-func jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2)) + (set! (-> jcc eval-time) (the-as uint (current-time))) ) ) 0 @@ -701,32 +701,38 @@ ) ;; definition for function joint-control-copy! -(defun joint-control-copy! ((arg0 joint-control) (arg1 joint-control)) - (set! (-> arg0 blend-index) (-> arg1 blend-index)) - (set! (-> arg0 active-channels) (-> arg1 active-channels)) - (set! (-> arg0 float-channels) (the-as uint 0)) - (set! (-> arg0 root-channel) +(defun joint-control-copy! ((dst joint-control) (src joint-control)) + (set! (-> dst blend-index) (-> src blend-index)) + (set! (-> dst active-channels) (-> src active-channels)) + (set! (-> dst float-channels) (the-as uint 0)) + (set! (-> dst root-channel) (the-as (inline-array joint-control-channel) - (-> arg0 + (-> dst channel - (/ (the-as int (- (the-as uint (-> arg1 root-channel)) (the-as uint (the-as uint (-> arg1 channel))))) 64) + (/ (the-as int (- (the-as uint (-> src root-channel)) (the-as uint (the-as uint (-> src channel))))) 64) ) ) ) - (let ((v1-10 (min (the-as int (-> arg0 allocated-length)) (the-as int (-> arg1 active-channels))))) - (mem-copy! (the-as pointer (-> arg0 channel)) (the-as pointer (-> arg1 channel)) (* v1-10 64)) + (let ((v1-10 (min (the-as int (-> dst allocated-length)) (the-as int (-> src active-channels))))) + (mem-copy! (the-as pointer (-> dst channel)) (the-as pointer (-> src channel)) (* v1-10 64)) ) - (dotimes (v1-12 (the-as int (-> arg0 allocated-length))) - (set! (-> arg0 channel v1-12 parent) arg0) + (dotimes (v1-12 (the-as int (-> dst allocated-length))) + (set! (-> dst channel v1-12 parent) dst) ) - arg0 + dst ) ;; definition for function joint-control-remap! ;; INFO: Used lq/sq ;; WARN: Using new Jak 2 rtype-of -(defun joint-control-remap! ((arg0 joint-control) (arg1 art-group) (arg2 art-group) (arg3 pair) (arg4 int) (arg5 string)) +(defun joint-control-remap! ((jc joint-control) + (dst-art-group art-group) + (parent-art-group art-group) + (remap-list pair) + (seed int) + (prefix string) + ) (local-vars (sv-16 int) (sv-24 symbol) @@ -739,20 +745,22 @@ (sv-64 art-joint-anim) (sv-80 string) ) - (set! sv-16 (+ (length (-> arg2 name)) 1)) + (set! sv-16 (+ (length (-> parent-art-group name)) 1)) (set! sv-24 #t) - (set! sv-32 arg4) + (set! sv-32 seed) (set! sv-40 2) - (while (and (< sv-40 (-> arg1 length)) (or (not (-> arg1 data sv-40)) (!= (-> arg1 data sv-40 type) art-joint-anim))) + (while (and (< sv-40 (-> dst-art-group length)) + (or (not (-> dst-art-group data sv-40)) (!= (-> dst-art-group data sv-40 type) art-joint-anim)) + ) (set! sv-40 (+ sv-40 1)) ) - (dotimes (s2-1 (the-as int (+ (-> arg0 active-channels) (-> arg0 float-channels)))) - (set! sv-48 (-> arg0 channel s2-1)) + (dotimes (s2-1 (the-as int (+ (-> jc active-channels) (-> jc float-channels)))) + (set! sv-48 (-> jc channel s2-1)) (set! sv-52 (the-as basic #f)) (when (-> sv-48 frame-group) - (format (clear *temp-string*) "~S~G" arg5 (&+ (-> sv-48 frame-group name data) sv-16)) - (when (not (null? arg3)) - (set! sv-56 (nassoc *temp-string* arg3)) + (format (clear *temp-string*) "~S~G" prefix (&+ (-> sv-48 frame-group name data) sv-16)) + (when (not (null? remap-list)) + (set! sv-56 (nassoc *temp-string* remap-list)) (when sv-56 (let* ((s1-1 sv-32) (a0-8 sv-56) @@ -770,7 +778,7 @@ (s0-0 (clear *temp-string*)) ) (set! sv-80 "~S") - (let ((a2-4 ((the-as (function joint-control joint-control-channel int object) sv-52) arg0 sv-48 0))) + (let ((a2-4 ((the-as (function joint-control joint-control-channel int object) sv-52) jc sv-48 0))) (s1-3 s0-0 sv-80 a2-4) ) ) @@ -778,7 +786,7 @@ ) ) ) - (set! sv-64 (get-art-by-name arg1 *temp-string* art-joint-anim)) + (set! sv-64 (get-art-by-name dst-art-group *temp-string* art-joint-anim)) (cond (sv-64 (let* ((v1-46 (-> sv-48 frame-group)) @@ -791,11 +799,11 @@ (fmax 0.0 (fmin (-> sv-48 frame-num) (the float (+ (-> sv-64 frames num-frames) -1)))) ) (if sv-52 - ((the-as (function joint-control joint-control-channel int object) sv-52) arg0 sv-48 1) + ((the-as (function joint-control joint-control-channel int object) sv-52) jc sv-48 1) ) ) (else - (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40))) + (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> dst-art-group data sv-40))) (set! (-> sv-48 frame-num) 0.0) (set! sv-24 (the-as symbol #f)) ) @@ -1028,34 +1036,34 @@ ;; definition for function matrix-from-joint-anim-frame ;; WARN: Return type mismatch object vs matrix. -(defun matrix-from-joint-anim-frame ((arg0 joint-anim-compressed-control) (arg1 int) (arg2 int)) - (let ((v1-1 (the-as object (-> arg0 fixed data))) - (v0-0 (the-as object (-> arg0 data arg2 data))) +(defun matrix-from-joint-anim-frame ((jacc joint-anim-compressed-control) (joint-idx int) (frame-idx int)) + (let ((fixed-matrix (the-as object (-> jacc fixed data))) + (frame-matrix (the-as object (-> jacc data frame-idx data))) ) (cond - ((not (logtest? (-> arg0 fixed hdr matrix-bits) 1)) - (set! v1-1 (cond - ((zero? arg1) - (return (the-as matrix v1-1)) - v1-1 - ) - (else - (-> (the-as (inline-array vector) v1-1) 4) - ) - ) + ((not (logtest? (-> jacc fixed hdr matrix-bits) 1)) + (set! fixed-matrix (cond + ((zero? joint-idx) + (return (the-as matrix fixed-matrix)) + fixed-matrix + ) + (else + (-> (the-as (inline-array vector) fixed-matrix) 4) + ) + ) ) ) - ((zero? arg1) - (return (the-as matrix v0-0)) + ((zero? joint-idx) + (return (the-as matrix frame-matrix)) ) (else - (set! v0-0 (-> (the-as (inline-array vector) v0-0) 4)) + (set! frame-matrix (-> (the-as (inline-array vector) frame-matrix) 4)) ) ) - (if (not (logtest? (-> arg0 fixed hdr matrix-bits) 2)) - (return (the-as matrix v1-1)) + (if (not (logtest? (-> jacc fixed hdr matrix-bits) 2)) + (return (the-as matrix fixed-matrix)) ) - (the-as matrix v0-0) + (the-as matrix frame-matrix) ) ) @@ -1266,50 +1274,50 @@ ) ;; definition for function cspace<-rot-yxy! -(defun cspace<-rot-yxy! ((arg0 cspace) (arg1 transform)) - (let ((s5-0 (-> arg0 bone transform))) - (matrix-rotate-yxy! s5-0 (-> arg1 rot)) - (scale-matrix! s5-0 (-> arg1 scale) s5-0) +(defun cspace<-rot-yxy! ((dst cspace) (src transform)) + (let ((s5-0 (-> dst bone transform))) + (matrix-rotate-yxy! s5-0 (-> src rot)) + (scale-matrix! s5-0 (-> src scale) s5-0) ) ) ;; definition for function cspace<-transform-yxy! -(defun cspace<-transform-yxy! ((arg0 cspace) (arg1 transform)) - (let ((s4-0 (-> arg0 bone transform)) +(defun cspace<-transform-yxy! ((dst cspace) (src transform)) + (let ((s4-0 (-> dst bone transform)) (s5-0 (new 'stack-no-clear 'matrix)) (s3-0 (new 'stack-no-clear 'matrix)) ) (matrix-identity! s4-0) - (matrix-translate! s4-0 (-> arg1 trans)) - (matrix-rotate-yxy! s5-0 (-> arg1 rot)) + (matrix-translate! s4-0 (-> src trans)) + (matrix-rotate-yxy! s5-0 (-> src rot)) (matrix*! s3-0 s5-0 s4-0) - (scale-matrix! s4-0 (-> arg1 scale) s3-0) + (scale-matrix! s4-0 (-> src scale) s3-0) ) ) ;; definition for function cspace<-transformq! -(defun cspace<-transformq! ((arg0 cspace) (arg1 transformq)) - (matrix<-transformq! (-> arg0 bone transform) arg1) +(defun cspace<-transformq! ((dst cspace) (src transformq)) + (matrix<-transformq! (-> dst bone transform) src) ) ;; definition for function cspace<-transformq+trans! -(defun cspace<-transformq+trans! ((arg0 cspace) (arg1 transformq) (arg2 vector)) - (matrix<-transformq+trans! (-> arg0 bone transform) arg1 arg2) +(defun cspace<-transformq+trans! ((dst cspace) (src transformq) (extra-trans vector)) + (matrix<-transformq+trans! (-> dst bone transform) src extra-trans) ) ;; definition for function cspace<-transformq+world-trans! -(defun cspace<-transformq+world-trans! ((arg0 cspace) (arg1 transformq) (arg2 vector)) - (matrix<-transformq+world-trans! (-> arg0 bone transform) arg1 arg2) +(defun cspace<-transformq+world-trans! ((dst cspace) (src transformq) (extra-trans vector)) + (matrix<-transformq+world-trans! (-> dst bone transform) src extra-trans) ) ;; definition for function cspace<-transformq+rot-offset! -(defun cspace<-transformq+rot-offset! ((arg0 cspace) (arg1 transformq) (arg2 vector)) - (matrix<-transformq+rot-offset! (-> arg0 bone transform) arg1 arg2) +(defun cspace<-transformq+rot-offset! ((dst cspace) (src transformq) (extra-rot vector)) + (matrix<-transformq+rot-offset! (-> dst bone transform) src extra-rot) ) ;; definition for function cspace-calc-total-matrix! -(defun cspace-calc-total-matrix! ((arg0 cspace) (arg1 matrix)) - (matrix*! arg1 (-> arg0 bone transform) (-> *math-camera* camera-temp)) +(defun cspace-calc-total-matrix! ((csp cspace) (dst matrix)) + (matrix*! dst (-> csp bone transform) (-> *math-camera* camera-temp)) ) ;; definition for function cspace<-matrix-no-push-joint! @@ -1406,16 +1414,13 @@ ) ;; definition for function cspace<-parented-matrix-mirror! -(defun cspace<-parented-matrix-mirror! ((arg0 cspace) (arg1 matrix)) - (let ((gp-0 (matrix-mirror! - (new 'stack-no-clear 'matrix) - (the-as vector (-> arg0 param1)) - (the-as vector (-> arg0 param2)) - ) - ) +(defun cspace<-parented-matrix-mirror! ((dst cspace) (joint-mat matrix)) + (let ((gp-0 + (matrix-mirror! (new 'stack-no-clear 'matrix) (the-as vector (-> dst param1)) (the-as vector (-> dst param2))) + ) ) - (cspace<-parented-matrix-joint! arg0 arg1) - (matrix*! (-> arg0 bone transform) (-> arg0 bone transform) gp-0) + (cspace<-parented-matrix-joint! dst joint-mat) + (matrix*! (-> dst bone transform) (-> dst bone transform) gp-0) ) ) @@ -1648,9 +1653,9 @@ ;; definition for function cspace<-parented-transformq-joint-flip-z! ;; WARN: Return type mismatch int vs none. -(defun cspace<-parented-transformq-joint-flip-z! ((arg0 cspace) (arg1 transformq)) - (cspace<-parented-transformq-joint! arg0 arg1) - (cspace<-matrix-joint-flip-z! arg0 (-> arg0 bone transform)) +(defun cspace<-parented-transformq-joint-flip-z! ((dst cspace) (joint-transformq transformq)) + (cspace<-parented-transformq-joint! dst joint-transformq) + (cspace<-matrix-joint-flip-z! dst (-> dst bone transform)) 0 (none) ) @@ -1968,10 +1973,10 @@ (def-mips2c calc-animation-from-spr (function joint-anim-frame int none)) ;; definition for function create-interpolated-joint-animation-frame -(defun create-interpolated-joint-animation-frame ((arg0 joint-anim-frame) (arg1 int) (arg2 joint-control)) - (flatten-joint-control-to-spr arg2) +(defun create-interpolated-joint-animation-frame ((dst joint-anim-frame) (num-joints int) (jc joint-control)) + (flatten-joint-control-to-spr jc) (make-joint-jump-tables) - (calc-animation-from-spr arg0 arg1) + (calc-animation-from-spr dst num-joints) 0 ) diff --git a/test/decompiler/reference/jak2/engine/entity/entity-h_REF.gc b/test/decompiler/reference/jak2/engine/entity/entity-h_REF.gc index 841e3243db..004b6e2683 100644 --- a/test/decompiler/reference/jak2/engine/entity/entity-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/entity/entity-h_REF.gc @@ -215,6 +215,11 @@ Levels store a reference to this which holds all the entities in the level." ;; definition of type entity (deftype entity (res-lump) + "Entities are mainly used to place objects in a level. + +As a child of [[res-lump]], they store various types of metadata +in [[res-tag]]s (such as name, curve data, volume data, etc.) +that gets accessed by the accompanying process." ((trans vector :inline) (aid uint32) ) @@ -255,6 +260,7 @@ Levels store a reference to this which holds all the entities in the level." ;; definition of type entity-actor (deftype entity-actor (entity) + "Child class of [[entity]] used to spawn [[process-drawable]] actors." ((etype type :offset 56) (task game-task) (kill-mask task-mask :offset 52) diff --git a/test/decompiler/reference/jak2/engine/game/game-info_REF.gc b/test/decompiler/reference/jak2/engine/game/game-info_REF.gc index 1c460539da..2429b5e499 100644 --- a/test/decompiler/reference/jak2/engine/game/game-info_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-info_REF.gc @@ -36,8 +36,8 @@ ) ;; definition for method 11 of type game-info -(defmethod task-complete? ((this game-info) (arg0 game-task)) - (logtest? (-> this task-perm-list data arg0 status) (entity-perm-status complete)) +(defmethod task-complete? ((this game-info) (task game-task)) + (logtest? (-> this task-perm-list data task status) (entity-perm-status complete)) ) ;; definition for method 12 of type game-info @@ -1269,14 +1269,14 @@ (defun-debug print-continues () (let ((levels *level-load-list*)) (while (not (null? levels)) - (let ((conts (-> (the-as level-load-info (-> (the-as symbol (car levels)) value)) continues))) - (while (not (null? conts)) - (let ((cont (the-as continue-point (car conts)))) - (if (not (logtest? (-> cont flags) (continue-flags change-continue))) - (format #t "~S~%" (-> cont name)) + (let ((continues (-> (the-as level-load-info (-> (the-as symbol (car levels)) value)) continues))) + (while (not (null? continues)) + (let ((continue (the-as continue-point (car continues)))) + (if (not (logtest? (-> continue flags) (continue-flags change-continue))) + (format #t "~S~%" (-> continue name)) ) ) - (set! conts (cdr conts)) + (set! continues (cdr continues)) ) ) (set! levels (cdr levels)) diff --git a/test/decompiler/reference/jak2/engine/gfx/foreground/lights-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/foreground/lights-h_REF.gc index 2d6b6c22c7..b7fa96827a 100644 --- a/test/decompiler/reference/jak2/engine/gfx/foreground/lights-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/foreground/lights-h_REF.gc @@ -27,6 +27,7 @@ ;; definition of type light (deftype light (structure) + "extra: {?, shadow, ?, ?}" ((direction vector :inline) (color rgbaf :inline) (extra vector :inline) diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable-h_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable-h_REF.gc index c4b07f23e4..0292cdc710 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable-h_REF.gc @@ -95,11 +95,11 @@ ;; definition for function joint-channel-float-delete! ;; WARN: Return type mismatch int vs none. -(defun joint-channel-float-delete! ((arg0 joint-control-channel)) - (let ((v1-0 (-> arg0 parent))) +(defun joint-channel-float-delete! ((chan joint-control-channel)) + (let ((v1-0 (-> chan parent))) (+! (-> v1-0 float-channels) -1) (when (nonzero? (-> v1-0 float-channels)) - (let ((a1-5 (/ (&- (the-as pointer arg0) (the-as uint (the-as pointer (-> v1-0 channel)))) 64))) + (let ((a1-5 (/ (&- (the-as pointer chan) (the-as uint (the-as pointer (-> v1-0 channel)))) 64))) (if (< a1-5 (the-as int (+ (-> v1-0 active-channels) (-> v1-0 float-channels)))) (qmem-copy<-! (the-as pointer (-> v1-0 channel a1-5)) diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc index 978c582dde..4cc0c0de30 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc @@ -195,8 +195,8 @@ ;; definition for method 10 of type draw-control ;; WARN: Return type mismatch int vs none. -(defmethod lod-set! ((this draw-control) (arg0 int)) - (let ((v1-1 (max 0 (min arg0 (-> this lod-set max-lod))))) +(defmethod lod-set! ((this draw-control) (lod int)) + (let ((v1-1 (max 0 (min lod (-> this lod-set max-lod))))) (set! (-> this desired-lod) v1-1) (when (!= (-> this cur-lod) v1-1) (set! (-> this mgeo) (-> this lod-set lod v1-1 geo)) @@ -212,11 +212,11 @@ ;; definition for method 11 of type draw-control ;; WARN: Return type mismatch int vs none. -(defmethod lods-assign! ((this draw-control) (arg0 lod-set)) - (mem-copy! (the-as pointer (-> this lod-set)) (the-as pointer arg0) 49) - (let ((a1-2 (min (-> this cur-lod) (-> this lod-set max-lod)))) +(defmethod lods-assign! ((this draw-control) (lods lod-set)) + (mem-copy! (the-as pointer (-> this lod-set)) (the-as pointer lods) 49) + (let ((lod (min (-> this cur-lod) (-> this lod-set max-lod)))) (set! (-> this cur-lod) -1) - (lod-set! this a1-2) + (lod-set! this lod) ) 0 (none) @@ -519,8 +519,8 @@ ) ;; definition for function draw-root -(defun draw-root ((arg0 process-drawable)) - (add-debug-quaternion #t (bucket-id debug-no-zbuf1) (-> arg0 root trans) (-> arg0 root quat)) +(defun draw-root ((proc process-drawable)) + (add-debug-quaternion #t (bucket-id debug-no-zbuf1) (-> proc root trans) (-> proc root quat)) (none) ) @@ -1785,10 +1785,10 @@ ;; WARN: Return type mismatch int vs none. (defbehavior rider-post process-drawable () (ja-post) - (let ((gp-0 (the-as collide-shape (-> self root)))) - (update-transforms gp-0) - (pull-riders! gp-0) - (do-push-aways gp-0) + (let ((cshape (the-as collide-shape (-> self root)))) + (update-transforms cshape) + (pull-riders! cshape) + (do-push-aways cshape) ) 0 (none) @@ -1797,15 +1797,15 @@ ;; definition for function pusher-post (defbehavior pusher-post process-drawable () (ja-post) - (let ((gp-0 (the-as collide-shape (-> self root)))) - (update-transforms gp-0) - (do-push-aways gp-0) + (let ((cshape (the-as collide-shape (-> self root)))) + (update-transforms cshape) + (do-push-aways cshape) ) 0 ) ;; definition for function process-drawable-delay-player -(defbehavior process-drawable-delay-player process-drawable ((arg0 time-frame)) +(defbehavior process-drawable-delay-player process-drawable ((delay time-frame)) (while (and *target* (focus-test? *target* in-air)) (suspend) ) @@ -1818,7 +1818,7 @@ ) (suspend) ) - (while (not (time-elapsed? (-> self state-time) arg0)) + (while (not (time-elapsed? (-> self state-time) delay)) (suspend) ) (process-release? *target*) diff --git a/test/decompiler/reference/jak3/engine/game/game-info_REF.gc b/test/decompiler/reference/jak3/engine/game/game-info_REF.gc index 4c2ae440d4..5c27b3c5be 100644 --- a/test/decompiler/reference/jak3/engine/game/game-info_REF.gc +++ b/test/decompiler/reference/jak3/engine/game/game-info_REF.gc @@ -42,12 +42,12 @@ ;; definition for method 12 of type game-info (defmethod subtask-index-by-name ((this game-info) (arg0 string)) - (let ((s5-0 (-> *game-info* sub-task-list))) - (dotimes (s4-0 (-> s5-0 length)) - (when (nonzero? s4-0) - (let ((v1-4 (-> s5-0 s4-0))) + (let ((subtasks (-> *game-info* sub-task-list))) + (dotimes (i (-> subtasks length)) + (when (nonzero? i) + (let ((v1-4 (-> subtasks i))) (if (string= arg0 (-> v1-4 name)) - (return s4-0) + (return i) ) ) ) @@ -1999,39 +1999,39 @@ ) ;; definition for method 9 of type highscore-info -(defmethod get-rank ((this highscore-info) (arg0 float)) - (let ((v0-0 0)) +(defmethod get-rank ((this highscore-info) (score float)) + (let ((place 0)) (cond ((logtest? (-> this flags) (highscore-flags time)) (cond - ((= arg0 0.0) + ((= score 0.0) ) - ((>= (-> this gold-score) arg0) - (set! v0-0 3) + ((>= (-> this gold-score) score) + (set! place 3) ) - ((>= (-> this silver-score) arg0) - (set! v0-0 2) + ((>= (-> this silver-score) score) + (set! place 2) ) - ((>= (-> this bronze-score) arg0) - (set! v0-0 1) + ((>= (-> this bronze-score) score) + (set! place 1) ) ) ) (else (cond - ((>= arg0 (-> this gold-score)) - (set! v0-0 3) + ((>= score (-> this gold-score)) + (set! place 3) ) - ((>= arg0 (-> this silver-score)) - (set! v0-0 2) + ((>= score (-> this silver-score)) + (set! place 2) ) - ((>= arg0 (-> this bronze-score)) - (set! v0-0 1) + ((>= score (-> this bronze-score)) + (set! place 1) ) ) ) ) - v0-0 + place ) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc_REF.gc b/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc_REF.gc index fae2193dca..12b926161b 100644 --- a/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc_REF.gc @@ -455,24 +455,26 @@ ;; definition for function merc-vu1-add-vu-function ;; WARN: Return type mismatch dma-packet vs dma-gif-packet. -(defun merc-vu1-add-vu-function ((arg0 dma-packet) (arg1 vu-function) (arg2 int)) - (let ((v1-0 (the-as object (+ (the-as uint arg1) 16))) - (a3-0 (-> arg1 qlength)) - (a1-1 (-> arg1 origin)) +(defun merc-vu1-add-vu-function ((dma dma-packet) (func vu-function) (flush-mode int)) + (let ((func-data (the-as object (+ (the-as uint func) 16))) + (qwc (-> func qlength)) + (dst (-> func origin)) ) - (while (> a3-0 0) - (let ((t0-1 (min 127 a3-0))) - (set! (-> arg0 dma) (new 'static 'dma-tag :id (dma-tag-id ref) :qwc t0-1 :addr (the-as int v1-0))) - (set! (-> arg0 vif0) (new 'static 'vif-tag :cmd (if (zero? arg2) 16 19))) - (set! (-> arg0 vif1) (new 'static 'vif-tag :cmd (vif-cmd mpg) :num (* t0-1 2) :imm a1-1)) - (&+! arg0 16) - (set! v1-0 (+ (the-as uint v1-0) (* t0-1 16))) - (set! a3-0 (- a3-0 t0-1)) - (+! a1-1 (* t0-1 2)) + (while (> qwc 0) + (let ((qwc-this-time (min 127 qwc))) + (set! (-> dma dma) + (new 'static 'dma-tag :id (dma-tag-id ref) :qwc qwc-this-time :addr (the-as int func-data)) + ) + (set! (-> dma vif0) (new 'static 'vif-tag :cmd (if (zero? flush-mode) 16 19))) + (set! (-> dma vif1) (new 'static 'vif-tag :cmd (vif-cmd mpg) :num (* qwc-this-time 2) :imm dst)) + (&+! dma 16) + (set! func-data (+ (the-as uint func-data) (* qwc-this-time 16))) + (set! qwc (- qwc qwc-this-time)) + (+! dst (* qwc-this-time 2)) ) ) ) - (the-as dma-gif-packet arg0) + (the-as dma-gif-packet dma) ) ;; definition for function merc-vu1-initialize-chain diff --git a/test/decompiler/reference/jak3/engine/level/bsp_REF.gc b/test/decompiler/reference/jak3/engine/level/bsp_REF.gc index bbc44d1d9b..daf274fcaa 100644 --- a/test/decompiler/reference/jak3/engine/level/bsp_REF.gc +++ b/test/decompiler/reference/jak3/engine/level/bsp_REF.gc @@ -366,17 +366,17 @@ The result is stored in the bsp itself." (local-vars (a2-1 object) - (a3-0 uint128) - (a3-1 uint128) - (a3-2 uint128) - (a3-3 uint128) + (cam-pos-i1 uint128) + (cam-pos-32 uint128) + (cam-pos-16 uint128) + (cam-pos-8 uint128) (t0-5 uint) - (t2-1 uint) - (t3-1 int) - (t4-0 uint128) - (t5-0 uint128) - (t6-0 uint128) - (t7-0 uint128) + (b-flag uint) + (f-flag int) + (front-max-compare uint128) + (back-max-compare uint128) + (front-min-compare uint128) + (back-min-compare uint128) ) (rlet ((Q :class vf) (vf0 :class vf) @@ -387,7 +387,7 @@ (init-vf0-vector) (nop!) (.lvf vf3 (&-> arg0 bsp-scale quad)) - (let ((v1-0 (the-as object (-> arg0 nodes)))) + (let ((nodes (the-as object (-> arg0 nodes)))) (.lvf vf1 (&-> arg1 quad)) (.lvf vf2 (&-> arg0 bsp-offset quad)) (.sub.vf vf1 vf1 vf2 :mask #b111) @@ -401,49 +401,49 @@ (.wait.vf) (.mul.vf vf1 vf1 Q :mask #b100) (let ((a1-1 #xffffff) - (a2-0 (the-as object 0)) + (nidx (the-as object 0)) ) (vftoi15.xyzw vf1 vf1) - (.mov a3-0 vf1) - (.pw.sra a3-1 a3-0 15) - (.ppach a3-2 (the-as uint128 0) a3-1) - (.ppacb a3-3 (the-as uint128 0) a3-2) - (let ((a3-4 (the-as uint128 (logand (the-as int a3-3) a1-1)))) + (.mov cam-pos-i1 vf1) + (.pw.sra cam-pos-32 cam-pos-i1 15) + (.ppach cam-pos-16 (the-as uint128 0) cam-pos-32) + (.ppacb cam-pos-8 (the-as uint128 0) cam-pos-16) + (let ((cam-pos-8m (the-as uint128 (logand (the-as int cam-pos-8) a1-1)))) (label cfg-1) - (let ((t1-1 (the-as bsp-node (&+ (the-as pointer v1-0) (+ (* a2-0 16) (* a2-0 4)))))) + (let ((node (the-as bsp-node (&+ (the-as pointer nodes) (+ (* nidx 16) (* nidx 4)))))) (nop!) - (let ((t3-0 (the-as uint128 (-> t1-1 front-box-min clr)))) - (.pcgtb t6-0 t3-0 a3-4) - (let ((t0-2 (the-as uint128 (-> t1-1 front-box-max clr)))) - (.pcgtb t4-0 t0-2 a3-4) + (let ((front-min (the-as uint128 (-> node front-box-min clr)))) + (.pcgtb front-min-compare front-min cam-pos-8m) + (let ((front-max (the-as uint128 (-> node front-box-max clr)))) + (.pcgtb front-max-compare front-max cam-pos-8m) ) - (let ((t2-0 (the-as uint128 (-> t1-1 back-box-min clr)))) - (.pcgtb t7-0 t2-0 a3-4) - (let ((t0-3 (the-as uint128 (-> t1-1 back-box-max clr)))) - (.pcgtb t5-0 t0-3 a3-4) + (let ((back-min (the-as uint128 (-> node back-box-min clr)))) + (.pcgtb back-min-compare back-min cam-pos-8m) + (let ((back-max (the-as uint128 (-> node back-box-max clr)))) + (.pcgtb back-max-compare back-max cam-pos-8m) ) - (let* ((t0-4 (-> t1-1 front)) - (t6-1 (lognot (the-as int t6-0))) - (t7-1 (lognot (the-as int t7-0))) - (t4-1 (logand t6-1 (the-as int t4-0))) - (t5-1 (logand t7-1 (the-as int t5-0))) - (t4-2 (logand t4-1 a1-1)) - (t5-2 (logand t5-1 a1-1)) + (let* ((front-idx (-> node front)) + (not-f-min (lognot (the-as int front-min-compare))) + (not-b-min (lognot (the-as int back-min-compare))) + (t4-1 (logand not-f-min (the-as int front-max-compare))) + (t5-1 (logand not-b-min (the-as int back-max-compare))) + (f-in-box (logand t4-1 a1-1)) + (b-in-box (logand t5-1 a1-1)) ) - (.srl t3-1 (the-as uint t3-0) 24) - (let ((t1-2 (the-as bsp-node (-> t1-1 back)))) - (b! (= t4-2 a1-1) cfg-4 :delay (.srl t2-1 (the-as int t2-0) 24)) - (b! (= t5-2 a1-1) cfg-7 :delay (set! t0-5 (the-as uint 1))) + (.srl f-flag (the-as uint front-min) 24) + (let ((back-idx (the-as bsp-node (-> node back)))) + (b! (= f-in-box a1-1) cfg-4 :delay (.srl b-flag (the-as int back-min) 24)) + (b! (= b-in-box a1-1) cfg-7 :delay (set! t0-5 (the-as uint 1))) (b! #t cfg-11 :delay (set! (-> arg0 cam-outside-bsp) t0-5)) (label cfg-4) - (b! (zero? t3-1) cfg-1 :likely-delay (set! a2-0 t0-4)) - (let ((v1-1 a2-0)) + (b! (zero? f-flag) cfg-1 :likely-delay (set! nidx front-idx)) + (let ((v1-1 nidx)) (set! (-> arg0 cam-using-back) (the-as uint 0)) - (b! #t cfg-10 :delay (set! a2-1 t0-4)) + (b! #t cfg-10 :delay (set! a2-1 front-idx)) (label cfg-7) - (b! (zero? t2-1) cfg-1 :likely-delay (set! a2-0 t1-2)) - (set! v1-1 a2-0) - (set! a2-1 t1-2) + (b! (zero? b-flag) cfg-1 :likely-delay (set! nidx back-idx)) + (set! v1-1 nidx) + (set! a2-1 back-idx) (set! (-> arg0 cam-using-back) (the-as uint 1)) (label cfg-10) (set! (-> arg0 current-leaf-idx) (the-as uint a2-1)) diff --git a/test/decompiler/reference/jak3/engine/target/collide-reaction-target_REF.gc b/test/decompiler/reference/jak3/engine/target/collide-reaction-target_REF.gc index c8cbb92559..d63fe4303d 100644 --- a/test/decompiler/reference/jak3/engine/target/collide-reaction-target_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/collide-reaction-target_REF.gc @@ -43,36 +43,38 @@ (arg5 (pointer symbol)) ) (local-vars - (sv-16 vector) + (contact-normal vector) (sv-20 (pointer cshape-reaction-flags)) (sv-24 (pointer collide-status)) (sv-28 (pointer symbol)) (sv-32 cshape-reaction-flags) (sv-40 collide-status) (sv-48 symbol) - (sv-52 vector) - (sv-56 vector) + (tangent vector) + (overhang-nrm vector) ) - (set! sv-16 arg2) + (set! contact-normal arg2) (set! sv-20 arg3) (set! sv-24 arg4) (set! sv-28 arg5) (set! sv-32 (-> arg3 0)) (set! sv-40 (-> arg4 0)) (set! sv-48 (-> arg5 0)) - (set! sv-52 (-> arg0 low-coverage-tangent)) - (set! sv-56 (vector-cross! (-> arg0 low-coverage-overhang-plane-normal) (-> arg0 poly-normal) sv-16)) - (vector-normalize! sv-56 1.0) - (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) + (set! tangent (-> arg0 low-coverage-tangent)) + (set! overhang-nrm + (vector-cross! (-> arg0 low-coverage-overhang-plane-normal) (-> arg0 poly-normal) contact-normal) + ) + (vector-normalize! overhang-nrm 1.0) + (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) overhang-nrm)) 0.866) (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf09))) ) - (vector-cross! sv-52 sv-16 sv-56) - (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) sv-52)) - (vector-negate! sv-52 sv-52) + (vector-cross! tangent contact-normal overhang-nrm) + (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) tangent)) + (vector-negate! tangent tangent) ) - (vector-normalize! sv-52 1.0) + (vector-normalize! tangent 1.0) (let ((s4-0 (new 'stack-no-clear 'collide-query))) - (let ((s3-0 (vector-flatten! (-> arg0 low-coverage-tangent-xz) sv-52 (-> arg0 dynam gravity-normal)))) + (let ((s3-0 (vector-flatten! (-> arg0 low-coverage-tangent-xz) tangent (-> arg0 dynam gravity-normal)))) (let ((v1-19 s4-0)) (set! (-> v1-19 radius) 409.6) (set! (-> v1-19 collide-with) (-> arg1 best-my-prim prim-core collide-with)) @@ -82,7 +84,7 @@ (set! (-> v1-19 action-mask) (collide-action solid)) ) (vector-normalize! s3-0 1.0) - (if (< (vector-dot s3-0 sv-16) 0.0) + (if (< (vector-dot s3-0 contact-normal) 0.0) (vector-negate! s3-0 s3-0) ) (set! (-> arg0 low-coverage-slope-to-next1) 4095996000.0) @@ -130,7 +132,7 @@ (set-time! (-> arg0 time-of-last-lc-touch-edge)) (set! sv-40 (logior sv-40 (collide-status touch-edge))) (set-time! (-> arg0 time-of-last-lc)) - (let ((f30-0 (vector-dot sv-52 (-> arg0 turn-to-target))) + (let ((f30-0 (vector-dot tangent (-> arg0 turn-to-target))) (f0-27 (if (logtest? sv-32 (cshape-reaction-flags csrf01)) (cos (- 16384.0 (acos (-> arg0 coverage)))) (-> arg0 coverage) @@ -149,7 +151,7 @@ (and (logtest? sv-32 (cshape-reaction-flags csrf05)) (< f0-27 0.3)) (< f1-11 (* -0.25 (-> arg1 best-my-prim local-sphere w))) ) - (>= (vector-dot sv-52 sv-16) -0.000001) + (>= (vector-dot tangent contact-normal) -0.000001) ) (set! (-> arg0 surf) *edge-surface*) (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf10)))