diff --git a/test/decompiler/reference/jak1/engine/anim/joint-exploder_REF.gc b/test/decompiler/reference/jak1/engine/anim/joint-exploder_REF.gc index 730ff6e588..5ff5a467a2 100644 --- a/test/decompiler/reference/jak1/engine/anim/joint-exploder_REF.gc +++ b/test/decompiler/reference/jak1/engine/anim/joint-exploder_REF.gc @@ -301,7 +301,6 @@ ;; definition for method 27 of type joint-exploder ;; INFO: Used lq/sq (defmethod joint-exploder-method-27 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) - (local-vars (sv-16 int) (sv-32 int) (sv-48 int)) (let ((s4-0 (the-as joint-exploder-list #f))) (let ((v1-0 1)) (until (= v1-0 5) @@ -336,9 +335,10 @@ (let ((s0-0 (-> s2-0 joint s1-0))) (cond ((>= (-> s0-0 mat vector 3 x) f30-0) - (set! sv-16 (joint-exploder-method-26 this arg0 s1-0)) - (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) - (set! s1-0 sv-16) + (let ((sv-16 (joint-exploder-method-26 this arg0 s1-0))) + (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) + (set! s1-0 sv-16) + ) (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-0) ) (else @@ -356,9 +356,10 @@ (let ((s0-1 (-> s2-0 joint s1-0))) (cond ((>= (-> s0-1 mat vector 3 y) f30-1) - (set! sv-32 (joint-exploder-method-26 this arg0 s1-0)) - (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) - (set! s1-0 sv-32) + (let ((sv-32 (joint-exploder-method-26 this arg0 s1-0))) + (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) + (set! s1-0 sv-32) + ) (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-1) ) (else @@ -376,9 +377,10 @@ (let ((s0-2 (-> s2-0 joint s1-0))) (cond ((>= (-> s0-2 mat vector 3 z) f30-2) - (set! sv-48 (joint-exploder-method-26 this arg0 s1-0)) - (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) - (set! s1-0 sv-48) + (let ((sv-48 (joint-exploder-method-26 this arg0 s1-0))) + (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) + (set! s1-0 sv-48) + ) (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-2) ) (else diff --git a/test/decompiler/reference/jak1/engine/anim/joint-mod-h_REF.gc b/test/decompiler/reference/jak1/engine/anim/joint-mod-h_REF.gc index dfead6c5ab..df1486c36b 100644 --- a/test/decompiler/reference/jak1/engine/anim/joint-mod-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/anim/joint-mod-h_REF.gc @@ -291,71 +291,72 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun joint-mod-look-at-handler ((csp cspace) (xform transformq)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 vector)) (let ((gp-0 (the-as joint-mod (-> csp param1)))) (cspace<-parented-transformq-joint! csp xform) - (set! sv-48 (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (-> gp-0 process node-list data 0 bone transform vector 1) - 1.0 - ) - ) - (set! sv-52 (vector-normalize! (-> csp bone transform vector (-> gp-0 nose)) 1.0)) - (set! sv-56 (vector-normalize! - (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> csp bone transform vector 3)) - 1.0 - ) - ) - (let* ((f30-0 (vector-y-angle sv-52)) - (a0-9 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) - (f0-0 (vector-y-angle a0-9)) - (f0-1 (deg-diff f30-0 f0-0)) - ) - (if (< (-> gp-0 ignore-angle) (fabs f0-1)) - (set! f0-1 0.0) - ) - (let ((f30-1 - (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) - ) - ) - (if (and (-> gp-0 shutting-down?) (= (-> gp-0 twist y) f30-1)) - (set-mode! gp-0 (joint-mod-handler-mode reset)) - ) - (set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f30-1 (* 0.1 (fabs (deg-diff f30-1 (-> gp-0 twist y)))))) - ) - ) - (let ((v1-15 (-> gp-0 up))) - (cond - ((zero? v1-15) - (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) - ) - ((= v1-15 1) - (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) - ) - (else - (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) - ) - ) - ) - (let* ((s3-1 (vector-normalize-copy! + (let ((sv-48 (vector-normalize-copy! (new 'stack-no-clear 'vector) - (the-as vector (-> gp-0 process node-list data 0 bone transform)) + (-> gp-0 process node-list data 0 bone transform vector 1) + 1.0 + ) + ) + (sv-52 (vector-normalize! (-> csp bone transform vector (-> gp-0 nose)) 1.0)) + (sv-56 (vector-normalize! + (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> csp bone transform vector 3)) 1.0 ) ) - (f30-2 (vector-x-angle sv-52)) - (s3-2 (vector-flatten! (new-stack-vector0) sv-56 s3-1)) - (f0-15 (vector-x-angle s3-2)) - (f0-21 (fmax - (fmin (* (- (deg-diff f30-2 f0-15)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) - (- (-> gp-0 twist-max x)) - ) - ) - ) - (if (< (vector-dot s3-2 sv-52) 0.1) - (set! f0-21 0.0) ) - (set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-21 (* 0.1 (fabs (deg-diff f0-21 (-> gp-0 twist x)))))) + (let* ((f30-0 (vector-y-angle sv-52)) + (a0-9 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) + (f0-0 (vector-y-angle a0-9)) + (f0-1 (deg-diff f30-0 f0-0)) + ) + (if (< (-> gp-0 ignore-angle) (fabs f0-1)) + (set! f0-1 0.0) + ) + (let ((f30-1 + (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) + ) + ) + (if (and (-> gp-0 shutting-down?) (= (-> gp-0 twist y) f30-1)) + (set-mode! gp-0 (joint-mod-handler-mode reset)) + ) + (set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f30-1 (* 0.1 (fabs (deg-diff f30-1 (-> gp-0 twist y)))))) + ) + ) + (let ((v1-15 (-> gp-0 up))) + (cond + ((zero? v1-15) + (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) + ) + ((= v1-15 1) + (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) + ) + (else + (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) + ) + ) + ) + (let* ((s3-1 (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (the-as vector (-> gp-0 process node-list data 0 bone transform)) + 1.0 + ) + ) + (f30-2 (vector-x-angle sv-52)) + (s3-2 (vector-flatten! (new-stack-vector0) sv-56 s3-1)) + (f0-15 (vector-x-angle s3-2)) + (f0-21 (fmax + (fmin (* (- (deg-diff f30-2 f0-15)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) + (- (-> gp-0 twist-max x)) + ) + ) + ) + (if (< (vector-dot s3-2 sv-52) 0.1) + (set! f0-21 0.0) + ) + (set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-21 (* 0.1 (fabs (deg-diff f0-21 (-> gp-0 twist x)))))) + ) ) (let ((v1-27 (-> gp-0 ear))) (cond @@ -390,69 +391,67 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun joint-mod-world-look-at-handler ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 vector)) (let ((gp-0 (the-as joint-mod (-> arg0 param1)))) (let ((s5-0 (-> arg0 bone transform))) (cspace<-parented-transformq-joint! arg0 arg1) - (set! sv-48 - (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (-> gp-0 process node-list data 0 bone transform vector 1) - 1.0 + (let ((sv-48 (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (-> gp-0 process node-list data 0 bone transform vector 1) + 1.0 + ) + ) + (sv-52 (vector-normalize! (-> s5-0 vector (-> gp-0 nose)) 1.0)) + (sv-56 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> s5-0 vector 3)) 1.0)) + ) + (let* ((f30-0 (vector-y-angle sv-52)) + (a0-7 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) + (f0-0 (vector-y-angle a0-7)) + (f0-1 (deg-diff f30-0 f0-0)) + ) + (if (< (-> gp-0 ignore-angle) (fabs f0-1)) + (set! f0-1 0.0) ) - ) - (set! sv-52 (vector-normalize! (-> s5-0 vector (-> gp-0 nose)) 1.0)) - (set! sv-56 - (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> s5-0 vector 3)) 1.0) - ) - (let* ((f30-0 (vector-y-angle sv-52)) - (a0-7 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) - (f0-0 (vector-y-angle a0-7)) - (f0-1 (deg-diff f30-0 f0-0)) - ) - (if (< (-> gp-0 ignore-angle) (fabs f0-1)) - (set! f0-1 0.0) - ) - (let ((f0-5 - (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) + (let ((f0-5 + (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) + ) ) - ) - (set! (-> gp-0 twist y) - (deg-seek (-> gp-0 twist y) f0-5 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-5 (-> gp-0 twist y)))))) + (set! (-> gp-0 twist y) + (deg-seek (-> gp-0 twist y) f0-5 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-5 (-> gp-0 twist y)))))) + ) + ) + ) + (when (!= (-> gp-0 twist y) 0.0) + (let ((a2-3 (matrix-rotate-y! (new 'stack-no-clear 'matrix) (-> gp-0 twist y))) + (s4-2 (-> s5-0 vector 3 quad)) ) + (matrix*! s5-0 s5-0 a2-3) + (set! (-> s5-0 vector 3 quad) s4-2) + ) ) - ) - (when (!= (-> gp-0 twist y) 0.0) - (let ((a2-3 (matrix-rotate-y! (new 'stack-no-clear 'matrix) (-> gp-0 twist y))) - (s4-2 (-> s5-0 vector 3 quad)) - ) - (matrix*! s5-0 s5-0 a2-3) - (set! (-> s5-0 vector 3 quad) s4-2) - ) - ) - (let* ((s4-3 - (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (the-as vector (-> gp-0 process node-list data 0 bone transform)) - 1.0 + (let* ((s4-3 + (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (the-as vector (-> gp-0 process node-list data 0 bone transform)) + 1.0 + ) + ) + (f30-2 (vector-x-angle sv-52)) + (s4-4 (vector-flatten! (new-stack-vector0) sv-56 s4-3)) + (f0-14 (vector-x-angle s4-4)) + (f0-20 + (fmax + (fmin (* (- (deg-diff f30-2 f0-14)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) + (- (-> gp-0 twist-max x)) + ) ) ) - (f30-2 (vector-x-angle sv-52)) - (s4-4 (vector-flatten! (new-stack-vector0) sv-56 s4-3)) - (f0-14 (vector-x-angle s4-4)) - (f0-20 - (fmax - (fmin (* (- (deg-diff f30-2 f0-14)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) - (- (-> gp-0 twist-max x)) - ) - ) - ) - (if (< (vector-dot s4-4 sv-52) 0.1) - (set! f0-20 0.0) - ) - (set! (-> gp-0 twist x) - (deg-seek (-> gp-0 twist x) f0-20 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x)))))) + (if (< (vector-dot s4-4 sv-52) 0.1) + (set! f0-20 0.0) ) + (set! (-> gp-0 twist x) + (deg-seek (-> gp-0 twist x) f0-20 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x)))))) + ) + ) ) (when (!= (-> gp-0 twist x) 0.0) (let* ((v1-20 (-> gp-0 ear)) diff --git a/test/decompiler/reference/jak1/engine/anim/joint_REF.gc b/test/decompiler/reference/jak1/engine/anim/joint_REF.gc index 55be394eac..43976582d7 100644 --- a/test/decompiler/reference/jak1/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak1/engine/anim/joint_REF.gc @@ -742,60 +742,48 @@ ;; INFO: Used lq/sq ;; ERROR: Failed load: (set! v1-29 (l.wu (+ a0-9 -4))) at op 75 (defun joint-control-remap! ((arg0 joint-control) (arg1 art-group) (arg2 art-group) (arg3 pair) (arg4 int) (arg5 string)) - (local-vars - (sv-16 int) - (sv-24 symbol) - (sv-32 int) - (sv-40 int) - (sv-48 joint-control-channel) - (sv-52 object) - (sv-56 int) - (sv-64 joint) - (sv-80 string) - ) - (set! sv-16 (+ (length (-> arg2 name)) 1)) - (set! sv-24 #t) - (set! sv-32 arg4) - (set! sv-40 2) - (while (and (< sv-40 (-> arg1 length)) (!= (-> arg1 data sv-40 type) art-joint-anim)) - (set! sv-40 (+ sv-40 1)) - ) - (dotimes (s2-1 (-> arg0 active-channels)) - (set! sv-48 (-> arg0 channel s2-1)) - (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-52 (nassoc *temp-string* arg3)) - (when sv-52 - (let ((s1-1 sv-32) - (a0-9 sv-52) + (let ((sv-16 (+ (length (-> arg2 name)) 1)) + (sv-24 #t) + ) + (let ((sv-32 arg4) + (sv-40 2) + ) + (while (and (< sv-40 (-> arg1 length)) (!= (-> arg1 data sv-40 type) art-joint-anim)) + (+! sv-40 1) + ) + (dotimes (s2-1 (-> arg0 active-channels)) + (let ((sv-48 (-> arg0 channel s2-1))) + (when (-> sv-48 frame-group) + (format (clear *temp-string*) "~S~G" arg5 (&+ (-> sv-48 frame-group name data) sv-16)) + (when (not (null? arg3)) + (let ((sv-52 (nassoc *temp-string* arg3))) + (when sv-52 + (let* ((a0-9 sv-52) + (sv-56 (mod sv-32 (+ ((method-of-type (rtype-of a0-9) length) a0-9) -1))) + ) + (format (clear *temp-string*) "~S" (ref sv-52 (+ sv-56 1))) + ) + ) ) - (set! sv-56 (mod s1-1 (+ ((method-of-type (rtype-of a0-9) length) a0-9) -1))) - ) - (let ((s1-2 format) - (s0-0 (clear *temp-string*)) + ) + (let ((sv-64 (lookup-art arg1 *temp-string* art-joint-anim))) + (cond + (sv-64 + (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64)) + ) + (else + (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40))) + (set! (-> sv-48 frame-num) 0.0) + (set! sv-24 (the-as symbol #f)) + ) ) - (set! sv-80 "~S") - (let ((a2-2 (ref sv-52 (+ sv-56 1)))) - (s1-2 s0-0 sv-80 a2-2) ) ) ) ) - (set! sv-64 (lookup-art arg1 *temp-string* art-joint-anim)) - (cond - (sv-64 - (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64)) - ) - (else - (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40))) - (set! (-> sv-48 frame-num) 0.0) - (set! sv-24 (the-as symbol #f)) - ) - ) ) + sv-24 ) - sv-24 ) ;; definition for function flatten-joint-control-to-spr diff --git a/test/decompiler/reference/jak1/engine/camera/cam-combiner_REF.gc b/test/decompiler/reference/jak1/engine/camera/cam-combiner_REF.gc index d71302ad50..22b28c844c 100644 --- a/test/decompiler/reference/jak1/engine/camera/cam-combiner_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/cam-combiner_REF.gc @@ -156,7 +156,6 @@ ) ) :code (behavior () - (local-vars (sv-160 cam-rotation-tracker)) (loop (when (and (not (logtest? (-> *camera* master-options) 2)) (!= (-> self tracking-status) 0)) (set! (-> self tracking-status) (the-as uint 0)) @@ -200,8 +199,8 @@ ) ) (else - (set! sv-160 (-> s5-0 0 tracking)) - (let ((s2-0 (-> s5-0 0 trans)) + (let ((sv-160 (-> s5-0 0 tracking)) + (s2-0 (-> s5-0 0 trans)) (s5-1 (-> s4-0 0 tracking)) (s0-0 (-> s4-0 0 trans)) ) diff --git a/test/decompiler/reference/jak1/engine/camera/cam-layout_REF.gc b/test/decompiler/reference/jak1/engine/camera/cam-layout_REF.gc index a3e06fb202..c4608f01fa 100644 --- a/test/decompiler/reference/jak1/engine/camera/cam-layout_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/cam-layout_REF.gc @@ -272,35 +272,21 @@ ;; WARN: Stack slot offset 164 signed mismatch ;; WARN: Stack slot offset 164 signed mismatch (defbehavior cam-layout-entity-volume-info-create cam-layout ((arg0 entity-camera) (arg1 symbol)) - (local-vars - (sv-16 res-tag) - (sv-160 vector) - (sv-164 float) - (sv-168 int) - (sv-176 vector) - (sv-192 vector) - (sv-208 vector) - (sv-224 vector) - (sv-240 vector) - (sv-256 int) - (sv-272 int) - (sv-288 int) - ) (let ((s4-0 0)) (loop - (set! sv-16 (new 'static 'res-tag)) - (let ((s3-0 (the-as (inline-array vector) ((method-of-type res-lump get-property-data) - arg0 - arg1 - 'exact - (the float s4-0) - (the-as pointer #f) - (& sv-16) - *res-static-buf* - ) - ) - ) - ) + (let* ((sv-16 (new 'static 'res-tag)) + (s3-0 (the-as (inline-array vector) ((method-of-type res-lump get-property-data) + arg0 + arg1 + 'exact + (the float s4-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) (cond (s3-0 (when (>= *volume-descriptor-current* 100) @@ -316,121 +302,137 @@ (set! *volume-descriptor-current* (+ *volume-descriptor-current* 1)) (+! (-> self num-volumes) 1) (dotimes (s1-0 (the-as int (-> sv-16 elt-count))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! (-> sv-192 quad) (the-as uint128 0)) - (set! sv-208 (new 'stack-no-clear 'vector)) - (set! (-> sv-208 quad) (the-as uint128 0)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (set! (-> sv-224 quad) (the-as uint128 0)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (set! (-> sv-240 quad) (the-as uint128 0)) - 0.0 - 0.0 - 0.0 - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (let ((s0-0 (new-stack-vector0))) - (set! sv-256 0) - (set! sv-272 0) - (while (< sv-272 (the-as int (-> sv-16 elt-count))) - (when (!= s1-0 sv-272) - (vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w)) - (vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0)) - (vector-normalize! sv-208 (the-as float 1.0)) - (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) - (vector-normalize! sv-224 (the-as float 1.0)) - (let ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224))) - (when (!= f0-6 409600000.0) - (vector+float*! sv-240 sv-192 sv-224 f0-6) - (set! sv-160 (new-stack-vector0)) - (set! sv-164 0.0) - (set! sv-168 0) - (set! sv-176 (new-stack-vector0)) - (set! (-> sv-160 quad) (-> sv-240 quad)) - (set! sv-288 0) - (while (< sv-288 (the-as int (-> sv-16 elt-count))) - (when (and (!= sv-288 s1-0) (!= sv-288 sv-272)) - (let ((f30-0 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) - (cond - ((= f30-0 409600000.0) - ) - ((zero? sv-168) - (vector+float*! sv-160 sv-160 sv-208 f30-0) - (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) - (set! sv-164 8192000.0) - (set! sv-168 1) - ) - ((begin (vector-float*! sv-240 sv-208 f30-0) (>= (vector-dot sv-240 sv-176) 0.0)) - ) - ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) - (when (< (fabs f30-0) (fabs sv-164)) - (set! sv-164 f30-0) - (set! sv-168 (+ sv-168 1)) - ) - ) - (else - (vector+float*! sv-160 sv-160 sv-208 f30-0) - (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) - (set! sv-168 (+ sv-168 1)) - (if (< (fabs f30-0) (fabs sv-164)) - (set! sv-164 (- sv-164 f30-0)) - (set! sv-164 0.0) + (let ((sv-192 (new 'stack-no-clear 'vector))) + (set! (-> sv-192 quad) (the-as uint128 0)) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (set! (-> sv-208 quad) (the-as uint128 0)) + (let ((sv-224 (new 'stack-no-clear 'vector))) + (set! (-> sv-224 quad) (the-as uint128 0)) + (let ((sv-240 (new 'stack-no-clear 'vector))) + (set! (-> sv-240 quad) (the-as uint128 0)) + 0.0 + 0.0 + 0.0 + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (let ((s0-0 (new-stack-vector0)) + (sv-256 0) + ) + (let ((sv-272 0)) + (while (< sv-272 (the-as int (-> sv-16 elt-count))) + (when (!= s1-0 sv-272) + (vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w)) + (vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0)) + (vector-normalize! sv-208 (the-as float 1.0)) + (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) + (vector-normalize! sv-224 (the-as float 1.0)) + (let ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224))) + (when (!= f0-6 409600000.0) + (vector+float*! sv-240 sv-192 sv-224 f0-6) + (let ((sv-160 (new-stack-vector0)) + (sv-164 0.0) + (sv-168 0) + ) + (let ((sv-176 (new-stack-vector0))) + (set! (-> sv-160 quad) (-> sv-240 quad)) + (let ((sv-288 0)) + (while (< sv-288 (the-as int (-> sv-16 elt-count))) + (when (and (!= sv-288 s1-0) (!= sv-288 sv-272)) + (let ((f30-0 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) + (cond + ((= f30-0 409600000.0) + ) + ((zero? sv-168) + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (set! sv-164 8192000.0) + (set! sv-168 1) + ) + ((begin (vector-float*! sv-240 sv-208 f30-0) (>= (vector-dot sv-240 sv-176) 0.0)) + ) + ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) + (when (< (fabs f30-0) (fabs sv-164)) + (set! sv-164 f30-0) + (+! sv-168 1) + ) + ) + (else + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (+! sv-168 1) + (set! sv-164 (cond + ((< (fabs f30-0) (fabs sv-164)) + (set! sv-164 (- sv-164 f30-0)) + sv-164 + ) + (else + 0.0 + ) + ) + ) + ) + ) + ) + ) + (+! sv-288 1) + ) + ) ) + (cond + ((zero? sv-168) + ) + ((= sv-164 0.0) + ) + (else + (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) + (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) + (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w))) + (goto cfg-47) + ) + ) + ) + (vector+float*! sv-240 sv-160 sv-208 sv-164) + (cond + ((>= *volume-point-current* 999) + (format 0 "ERROR : camera editing out of volume points~%") + ) + (else + (set! (-> *volume-point* data *volume-point-current* quad) (-> sv-160 quad)) + (set! (-> *volume-point* data (+ *volume-point-current* 1) quad) (-> sv-240 quad)) + (set! *volume-point-current* (+ *volume-point-current* 2)) + (+! (-> s2-0 point-count) 2) + ) + ) + (vector+! s0-0 s0-0 sv-160) + (vector+! s0-0 s0-0 sv-240) + (+! sv-256 2) + sv-256 + ) + ) + ) ) ) ) + (label cfg-47) + (+! sv-272 1) ) - (set! sv-288 (+ sv-288 1)) ) - (cond - ((zero? sv-168) - ) - ((= sv-164 0.0) - ) - (else - (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) - (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) - (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w))) - (goto cfg-47) - ) - ) + (when (nonzero? sv-256) + (vector-float*! s0-0 s0-0 (/ 1.0 (the float sv-256))) + (cond + ((>= *volume-normal-current* 599) + (format 0 "ERROR : camera editing out of volume normals~%") + ) + (else + (set! (-> *volume-normal* data *volume-normal-current* quad) (-> s0-0 quad)) + (set! (-> *volume-normal* data (+ *volume-normal-current* 1) quad) (-> s3-0 s1-0 quad)) + (set! *volume-normal-current* (+ *volume-normal-current* 2)) + (set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2)) ) - (vector+float*! sv-240 sv-160 sv-208 sv-164) - (cond - ((>= *volume-point-current* 999) - (format 0 "ERROR : camera editing out of volume points~%") - ) - (else - (set! (-> *volume-point* data *volume-point-current* quad) (-> sv-160 quad)) - (set! (-> *volume-point* data (+ *volume-point-current* 1) quad) (-> sv-240 quad)) - (set! *volume-point-current* (+ *volume-point-current* 2)) - (+! (-> s2-0 point-count) 2) - ) - ) - (vector+! s0-0 s0-0 sv-160) - (vector+! s0-0 s0-0 sv-240) - (set! sv-256 (+ sv-256 2)) - sv-256 ) ) ) ) ) - (label cfg-47) - (set! sv-272 (+ sv-272 1)) - ) - (when (nonzero? sv-256) - (vector-float*! s0-0 s0-0 (/ 1.0 (the float sv-256))) - (cond - ((>= *volume-normal-current* 599) - (format 0 "ERROR : camera editing out of volume normals~%") - ) - (else - (set! (-> *volume-normal* data *volume-normal-current* quad) (-> s0-0 quad)) - (set! (-> *volume-normal* data (+ *volume-normal-current* 1) quad) (-> s3-0 s1-0 quad)) - (set! *volume-normal-current* (+ *volume-normal-current* 2)) - (set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2)) - ) - ) ) ) ) @@ -974,7 +976,7 @@ ;; definition for function clmf-pos-rot ;; INFO: Used lq/sq (defbehavior clmf-pos-rot cam-layout ((arg0 symbol) (arg1 symbol)) - (local-vars (s2-0 structure) (s3-1 structure) (sv-192 matrix)) + (local-vars (s2-0 structure) (s3-1 structure)) (cam-layout-print 16 *camera-layout-message-ypos* "x/z pos: left stick, down: l1, up: r1") (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) (when (and arg1 (nonzero? arg1)) @@ -1032,35 +1034,35 @@ ) ) ) - (let ((s1-1 (new 'stack-no-clear 'matrix))) - (set! sv-192 (new 'stack-no-clear 'matrix)) - (let ((s0-1 (new 'stack-no-clear 'vector))) - (if (not s3-1) - (return #f) - ) - (clmf-input s5-0 s4-0 0) - (vector+float*! (the-as vector s3-1) (the-as vector s3-1) s4-0 (the-as float 409.6)) - (cond - ((not arg1) - (the-as quaternion #f) - ) - ((zero? arg1) - (the-as quaternion #f) - ) - (else - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192) - (vector-float*! s5-0 s5-0 100.0) - (matrix-rotate-x! s1-1 (- (-> s5-0 x))) - (matrix*! sv-192 s1-1 sv-192) - (matrix-rotate-y! s1-1 (-> s5-0 y)) - (matrix*! sv-192 sv-192 s1-1) - (matrix-rotate-z! s1-1 (- (-> s5-0 z))) - (matrix*! sv-192 s1-1 sv-192) - (matrix->quaternion (the-as quaternion s0-1) sv-192) - (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) - (quaternion*! (the-as quaternion s2-0) (the-as quaternion s0-1) (the-as quaternion s2-0)) - (quaternion-normalize! (the-as quaternion s2-0)) - ) + (let ((s1-1 (new 'stack-no-clear 'matrix)) + (sv-192 (new 'stack-no-clear 'matrix)) + (s0-1 (new 'stack-no-clear 'vector)) + ) + (if (not s3-1) + (return #f) + ) + (clmf-input s5-0 s4-0 0) + (vector+float*! (the-as vector s3-1) (the-as vector s3-1) s4-0 (the-as float 409.6)) + (cond + ((not arg1) + (the-as quaternion #f) + ) + ((zero? arg1) + (the-as quaternion #f) + ) + (else + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192) + (vector-float*! s5-0 s5-0 100.0) + (matrix-rotate-x! s1-1 (- (-> s5-0 x))) + (matrix*! sv-192 s1-1 sv-192) + (matrix-rotate-y! s1-1 (-> s5-0 y)) + (matrix*! sv-192 sv-192 s1-1) + (matrix-rotate-z! s1-1 (- (-> s5-0 z))) + (matrix*! sv-192 s1-1 sv-192) + (matrix->quaternion (the-as quaternion s0-1) sv-192) + (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) + (quaternion*! (the-as quaternion s2-0) (the-as quaternion s0-1) (the-as quaternion s2-0)) + (quaternion-normalize! (the-as quaternion s2-0)) ) ) ) @@ -2685,11 +2687,10 @@ ;; definition for function clmf-cam-string ;; INFO: Used lq/sq (defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol)) - (local-vars (sv-16 res-tag)) (format arg0 ":") - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16) :time (the-as float -1000000000.0))) - ) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16) :time (the-as float -1000000000.0))) + ) (when s5-1 (dotimes (s4-0 (the-as int (-> sv-16 elt-count))) (format arg0 " ~S" (-> (the-as (pointer uint32) (&+ s5-1 (* s4-0 4))))) diff --git a/test/decompiler/reference/jak1/engine/camera/cam-master_REF.gc b/test/decompiler/reference/jak1/engine/camera/cam-master_REF.gc index 1d3d7a771d..0325ffa18c 100644 --- a/test/decompiler/reference/jak1/engine/camera/cam-master_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/cam-master_REF.gc @@ -534,22 +534,21 @@ ;; definition for function in-cam-entity-volume? ;; INFO: Used lq/sq (defun in-cam-entity-volume? ((arg0 vector) (arg1 entity) (arg2 float) (arg3 symbol)) - (local-vars (sv-16 res-tag)) (let ((s2-0 0)) (loop - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (the-as object ((method-of-type res-lump get-property-data) - arg1 - arg3 - 'exact - (the float s2-0) - (the-as pointer #f) - (& sv-16) - *res-static-buf* - ) - ) - ) - ) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (the-as object ((method-of-type res-lump get-property-data) + arg1 + arg3 + 'exact + (the float s2-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) (cond ((not (the-as pointer v1-1)) (return #f) @@ -651,14 +650,7 @@ ;; definition for function master-switch-to-entity ;; INFO: Used lq/sq (defbehavior master-switch-to-entity camera-master ((arg0 entity)) - (local-vars - (v0-21 object) - (gp-0 (pointer process)) - (sv-16 res-tag) - (sv-112 process) - (sv-128 string) - (sv-144 string) - ) + (local-vars (v0-21 object) (gp-0 (pointer process))) (set! (-> self cam-entity) arg0) 10 (let ((s4-0 (cam-state-from-entity arg0))) @@ -690,81 +682,78 @@ ) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((s4-2 (res-lump-data arg0 'alternates (pointer string) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s4-2 (res-lump-data arg0 'alternates (pointer string) :tag-ptr (& sv-16))) + ) (when s4-2 (dotimes (s3-2 (the-as int (-> sv-16 elt-count))) (let ((s2-0 (entity-by-name (-> s4-2 s3-2)))) - (set! v0-21 - (cond - (s2-0 - (let ((s0-0 (cam-state-from-entity s2-0))) - (cond - ((= s0-0 *camera-base-mode*) - (deactivate (-> gp-0 0)) - (master-base-region s2-0) - (return #t) - v0-21 - ) - (s0-0 - (set! sv-112 (get-process *camera-dead-pool* camera-slave #x4000)) - (let ((s1-0 (when sv-112 - (let ((t9-15 (method-of-type camera-slave activate))) - (t9-15 (the-as camera-slave sv-112) self 'camera-slave (the-as pointer #x70004000)) + (set! v0-21 (cond + (s2-0 + (let ((s0-0 (cam-state-from-entity s2-0))) + (cond + ((= s0-0 *camera-base-mode*) + (deactivate (-> gp-0 0)) + (master-base-region s2-0) + (return #t) + v0-21 + ) + (s0-0 + (let* ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000)) + (s1-0 (when sv-112 + ((method-of-type camera-slave activate) + (the-as camera-slave sv-112) + self + 'camera-slave + (the-as pointer #x70004000) + ) + (run-now-in-process sv-112 cam-slave-init s0-0 s2-0) + (-> sv-112 ppointer) + ) + ) + ) + (cond + (s1-0 + (setup-slave-for-hopefull (the-as camera-slave (ppointer->process s1-0))) + (cond + ((master-is-hopeful-better? + (the-as camera-slave (ppointer->process gp-0)) + (the-as camera-slave (ppointer->process s1-0)) + ) + (deactivate (-> gp-0 0)) + (set! gp-0 s1-0) + gp-0 + ) + (else + (deactivate (-> s1-0 0)) ) - (run-now-in-process sv-112 cam-slave-init s0-0 s2-0) - (-> sv-112 ppointer) ) ) - ) - (cond - (s1-0 - (setup-slave-for-hopefull (the-as camera-slave (ppointer->process s1-0))) - (cond - ((master-is-hopeful-better? - (the-as camera-slave (ppointer->process gp-0)) - (the-as camera-slave (ppointer->process s1-0)) - ) - (deactivate (-> gp-0 0)) - (set! gp-0 s1-0) - gp-0 - ) - (else - (deactivate (-> s1-0 0)) + (else + (format 0 "ERROR : alternate region activate failed~%") + ) ) ) ) (else - (format 0 "ERROR : alternate region activate failed~%") + (format + 0 + "ERROR : alternate camera region '~S' didn't produce a state~%" + (res-lump-struct s2-0 'name structure) + ) ) ) ) ) (else - (let ((s1-1 format) - (s0-1 0) - ) - (set! sv-128 "ERROR : alternate camera region '~S' didn't produce a state~%") - (let ((a2-10 (res-lump-struct s2-0 'name structure))) - (s1-1 s0-1 sv-128 a2-10) - ) + (format + 0 + "ERROR : alternate '~S' not found for '~S'~%" + (-> s4-2 s3-2) + (res-lump-struct arg0 'name structure) ) ) ) - ) - ) - (else - (let ((s2-1 format) - (s1-2 0) - (s0-2 "ERROR : alternate '~S' not found for '~S'~%") - ) - (set! sv-144 (-> s4-2 s3-2)) - (let ((a3-8 (res-lump-struct arg0 'name structure))) - (s2-1 s1-2 s0-2 sv-144 a3-8) - ) - ) - ) - ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/camera/cam-states_REF.gc b/test/decompiler/reference/jak1/engine/camera/cam-states_REF.gc index 90e51ef512..db922051c5 100644 --- a/test/decompiler/reference/jak1/engine/camera/cam-states_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/cam-states_REF.gc @@ -1490,96 +1490,93 @@ (arg5 vector) (arg6 float) ) - (local-vars (sv-128 float) (sv-144 vector) (sv-160 vector) (sv-176 vector) (sv-192 vector) (sv-208 int)) (with-pp - (set! sv-128 arg3) - (let ((gp-0 arg4)) - (set! sv-144 arg5) - (let ((s4-0 arg6)) - (set! sv-160 (new 'stack-no-clear 'vector)) - (set! sv-176 (new 'stack-no-clear 'vector)) - (let ((s5-0 (new 'stack-no-clear 'matrix))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((f30-0 0.0) - (s0-0 #f) - ) - (set! sv-208 0) - (while (< sv-208 4) - (cond - ((= sv-208 3) - (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 368))) - (set! (-> s5-0 vector sv-208 z) 0.0) - ) - (else - (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) - (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) - (vector-! sv-160 (-> arg0 0 vertex sv-208) (the-as vector (&-> pp stack 368))) - ) - ) - (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) - (vector-cross! sv-176 sv-160 arg2) - (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) - (cond - ((< (* f28-0 f30-0) 0.0) - (set! s0-0 #t) - ) - ((!= f28-0 0.0) - (set! f30-0 f28-0) - ) - ) - (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) - (cond - ((= sv-208 3) - (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 368))) - (vector-flatten! sv-192 sv-192 arg1) - ) - (else - (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) - ) - ) - (if (< f28-0 0.0) - (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) - (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) - ) - ) - (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) - (set! sv-208 (+ sv-208 1)) - ) - (cond - ((and s0-0 (!= s4-0 -100000000.0)) - (dotimes (s4-1 4) - (dist-info-append - (the-as collide-los-dist-info (-> gp-0 vert-0)) - (the-as vector (+ (the-as uint s5-0) (* s4-1 16))) - ) - ) - #f - ) - ((< (-> s5-0 vector 3 y) 0.0) - (dotimes (s4-2 4) - (when (>= (-> s5-0 vector 3 y) (-> s5-0 vector s4-2 y)) - (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) - (dist-info-append - (the-as collide-los-dist-info (-> gp-0 next-normal)) - (the-as vector (+ (the-as uint s5-0) (* s4-2 16))) - ) - ) - ) - #f - ) - (else - (dotimes (s4-3 4) - (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 vector 3 y)) - (dist-info-append - (the-as collide-los-dist-info (-> gp-0 intersection)) - (the-as vector (+ (the-as uint s5-0) (* s4-3 16))) - ) - ) - ) - #f - ) + (let ((sv-128 arg3) + (gp-0 arg4) + (sv-144 arg5) + (s4-0 arg6) + (sv-160 (new 'stack-no-clear 'vector)) + (sv-176 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'matrix)) + (sv-192 (new 'stack-no-clear 'vector)) + (f30-0 0.0) + (s0-0 #f) + ) + (let ((sv-208 0)) + (while (< sv-208 4) + (cond + ((= sv-208 3) + (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 368))) + (set! (-> s5-0 vector sv-208 z) 0.0) + ) + (else + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) + (vector-! sv-160 (-> arg0 0 vertex sv-208) (the-as vector (&-> pp stack 368))) ) ) + (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) + (vector-cross! sv-176 sv-160 arg2) + (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) + (cond + ((< (* f28-0 f30-0) 0.0) + (set! s0-0 #t) + ) + ((!= f28-0 0.0) + (set! f30-0 f28-0) + ) + ) + (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) + (cond + ((= sv-208 3) + (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 368))) + (vector-flatten! sv-192 sv-192 arg1) + ) + (else + (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) + ) + ) + (if (< f28-0 0.0) + (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) + ) + ) + (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) + (+! sv-208 1) + ) + ) + (cond + ((and s0-0 (!= s4-0 -100000000.0)) + (dotimes (s4-1 4) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 vert-0)) + (the-as vector (+ (the-as uint s5-0) (* s4-1 16))) + ) + ) + #f + ) + ((< (-> s5-0 vector 3 y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 vector 3 y) (-> s5-0 vector s4-2 y)) + (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 next-normal)) + (the-as vector (+ (the-as uint s5-0) (* s4-2 16))) + ) + ) + ) + #f + ) + (else + (dotimes (s4-3 4) + (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 vector 3 y)) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 intersection)) + (the-as vector (+ (the-as uint s5-0) (* s4-3 16))) + ) + ) + ) + #f ) ) ) @@ -1808,7 +1805,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f3, f6] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f2, f4, f7] (defbehavior cam-los-collide camera-slave ((arg0 vector) (arg1 vector) (arg2 clip-travel-vector-to-mesh-return-info) (arg3 pat-surface)) - (local-vars (s1-3 int) (s2-2 int) (f2-1 float) (sv-224 vector) (sv-240 vector)) + (local-vars (s1-3 int) (s2-2 int) (f2-1 float)) (dist-info-init (the-as collide-los-dist-info (-> arg2 intersection))) (dist-info-init (the-as collide-los-dist-info (-> arg2 next-normal))) (dist-info-init (the-as collide-los-dist-info (-> arg2 vert-0))) @@ -1841,27 +1838,18 @@ (set! f28-0 1.0) ) (countdown (s0-1 (-> s0-0 num-tris)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (let ((f0-7 - (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) (-> s1-1 0) sv-240 sv-224) - ) - ) + (let* ((sv-240 (new 'stack-no-clear 'vector)) + (sv-224 (new 'stack-no-clear 'vector)) + (f0-7 + (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) (-> s1-1 0) sv-240 sv-224) + ) + ) (cond ((or (< f0-7 0.0) (< 1.0 f0-7)) ) ((let ((f1-2 0.0)) - (let* ((v1-21 arg1) - (f2-0 (-> v1-21 x)) - (f3-0 (-> v1-21 y)) - (f4-0 (-> v1-21 z)) - (f5-0 (-> sv-224 x)) - (f6-0 (-> sv-224 y)) - (f7-0 (-> sv-224 z)) - ) - (.mula.s f2-0 f5-0) - (.madda.s f3-0 f6-0) - (.madd.s f2-1 f4-0 f7-0) + (let* ((v1-21 arg1)) + (set! f2-1 (vector-dot v1-21 sv-224)) ) (< f1-2 f2-1) ) @@ -1874,23 +1862,14 @@ ) (los-cw-ccw s1-1 s2-0 s4-0 f30-0 arg2 sv-240 f24-0) (when *debug-segment* - (cond - ((= f24-0 -100000000.0) - (let ((t9-11 cam-debug-add-los-tri) - (a0-13 s1-1) - (a2-7 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80))) - ) - (t9-11 a0-13 sv-240 a2-7) - ) - ) - (else + (if (= f24-0 -100000000.0) + (cam-debug-add-los-tri s1-1 sv-240 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80))) (cam-debug-add-los-tri s1-1 sv-240 (new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80)) ) ) - ) ) ) ) @@ -2527,7 +2506,6 @@ ;; WARN: Stack slot load at 240 mismatch: defined as size 4, got size 16 ;; WARN: Stack slot load at 256 mismatch: defined as size 4, got size 16 (defbehavior cam-string-move camera-slave () - (local-vars (sv-240 float) (sv-256 float)) (vector-! (-> self velocity) (-> self desired-pos) (-> self string-trans)) (if *display-cam-los-debug* (format *stdcon* "vel ~M~%" (vector-length (-> self velocity))) @@ -2604,20 +2582,9 @@ ) ) ) - (when *display-cam-los-debug* - (let ((s2-0 format) - (s1-0 *stdcon*) - (s0-0 "vp ~f vr ~f r ~f ta ~f~%") - ) - (set! sv-240 (vector-length s5-2)) - (set! sv-256 f30-2) - (let ((t0-3 (/ (vector-length s5-2) f30-2)) - (t1-1 f28-1) - ) - (s2-0 s1-0 s0-0 sv-240 sv-256 t0-3 t1-1) - ) + (if *display-cam-los-debug* + (format *stdcon* "vp ~f vr ~f r ~f ta ~f~%" (vector-length s5-2) f30-2 (/ (vector-length s5-2) f30-2) f28-1) ) - ) (cond ((>= f28-1 0.0) (let* ((f1-7 (fmax 0.01 (/ 40.96 (vector-length s5-2)))) diff --git a/test/decompiler/reference/jak1/engine/camera/cam-update_REF.gc b/test/decompiler/reference/jak1/engine/camera/cam-update_REF.gc index 35291b5126..92ce5df40c 100644 --- a/test/decompiler/reference/jak1/engine/camera/cam-update_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/cam-update_REF.gc @@ -29,7 +29,6 @@ ;; definition for function update-view-planes ;; INFO: Used lq/sq (defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float)) - (local-vars (sv-240 vector)) (when (not *artist-fix-frustum*) (let ((s5-0 (new 'stack 'view-frustum))) (let ((f30-0 (* arg2 (-> arg0 x-ratio) (-> arg0 d))) @@ -60,22 +59,17 @@ (s0-0 (new-stack-vector0)) ) (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (set! (-> sv-240 quad) (the-as uint128 0)) - (let ((v1-5 (-> arg0 inv-camera-rot vector 3 quad))) - (set! (-> sv-240 quad) v1-5) - ) - (vector-! s2-0 (-> s5-0 yon-top-left) sv-240) - (vector-! s3-1 (-> s5-0 yon-top-right) sv-240) - (vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240) - (vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240) - (plane-from-points arg1 s2-0 s1-0 sv-240 0) - (plane-from-points arg1 s0-0 s3-1 sv-240 1) - (plane-from-points arg1 s3-1 s2-0 sv-240 2) - (let ((t9-20 plane-from-points) - (t0-3 3) - ) - (t9-20 arg1 s1-0 s0-0 sv-240 t0-3) + (let ((sv-240 (new 'stack-no-clear 'vector))) + (set! (-> sv-240 quad) (the-as uint128 0)) + (set! (-> sv-240 quad) (-> arg0 inv-camera-rot vector 3 quad)) + (vector-! s2-0 (-> s5-0 yon-top-left) sv-240) + (vector-! s3-1 (-> s5-0 yon-top-right) sv-240) + (vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240) + (vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240) + (plane-from-points arg1 s2-0 s1-0 sv-240 0) + (plane-from-points arg1 s0-0 s3-1 sv-240 1) + (plane-from-points arg1 s3-1 s2-0 sv-240 2) + (plane-from-points arg1 s1-0 s0-0 sv-240 3) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/camera/camera_REF.gc b/test/decompiler/reference/jak1/engine/camera/camera_REF.gc index 82e3632d4e..f6e936be45 100644 --- a/test/decompiler/reference/jak1/engine/camera/camera_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/camera_REF.gc @@ -303,9 +303,7 @@ ;; definition for function fourth-power (defun fourth-power ((arg0 float)) - (let ((f0-2 (* arg0 arg0))) - (* f0-2 f0-2) - ) + (square (square arg0)) ) ;; definition for function third-power @@ -323,19 +321,10 @@ 0.0 ) ((>= 0.5 arg0) - (let ((f0-3 0.5) - (f1-4 (* 2.0 arg0)) - ) - (* f0-3 (* f1-4 f1-4)) - ) + (* 0.5 (square (* 2.0 arg0))) ) (else - (let ((f0-5 1.0) - (f1-7 0.5) - (f2-2 (* 2.0 (- 1.0 arg0))) - ) - (- f0-5 (* f1-7 (* f2-2 f2-2))) - ) + (- 1.0 (* 0.5 (square (* 2.0 (- 1.0 arg0))))) ) ) ) @@ -358,19 +347,12 @@ ;; definition for method 9 of type cam-index ;; INFO: Used lq/sq (defmethod cam-index-method-9 ((this cam-index) (arg0 symbol) (arg1 entity) (arg2 vector) (arg3 curve)) - (local-vars (sv-32 (function _varargs_ object))) (format (clear *cam-res-string*) "~S-flags" arg0) (set! (-> this flags) (the-as cam-index-options (cam-slave-get-flags arg1 (string->symbol *res-key-string*)))) (let ((s3-2 (res-lump-data arg1 arg0 pointer)) (s0-1 (method-of-type res-lump get-property-struct)) ) - (set! sv-32 format) - (let ((a0-7 (clear *res-key-string*)) - (a1-4 "~S~S") - (a3-2 '-offset) - ) - (sv-32 a0-7 a1-4 arg0 a3-2) - ) + (format (clear *res-key-string*) "~S~S" arg0 '-offset) (let ((v0-8 (s0-1 arg1 (string->symbol *res-key-string*) @@ -1275,10 +1257,7 @@ ((< (-> *camera* ease-t) 1.0) ) ((< (-> arg0 follow-blend) 1.0) - (let* ((f0-18 (-> arg0 follow-blend)) - (f0-19 (* f0-18 f0-18)) - (f0-20 (* f0-19 f0-19)) - ) + (let ((f0-20 (square (square (-> arg0 follow-blend))))) (vector-! s5-1 s5-1 (-> arg0 follow-off)) (vector-float*! s5-1 s5-1 f0-20) ) @@ -1315,10 +1294,10 @@ 1.0 ) (else - (let* ((f0-29 (* f0-28 f0-28)) + (let* ((f0-29 (square f0-28)) (f0-30 (- 1.0 f0-29)) ) - (* f0-30 (* f0-30 f0-30)) + (* f0-30 (square f0-30)) ) ) ) @@ -1439,7 +1418,6 @@ ;; definition for function vector-into-frustum-nosmooth! ;; INFO: Used lq/sq (defun vector-into-frustum-nosmooth! ((arg0 matrix) (arg1 vector) (arg2 float)) - (local-vars (sv-112 (inline-array vector)) (sv-128 vector) (sv-144 vector) (sv-160 vector) (sv-176 vector)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -1458,17 +1436,19 @@ (vector-flatten! s3-0 s3-0 (-> arg0 vector 1)) (vector-normalize! s3-0 1.0) (let ((f28-0 (vector-dot s3-0 (-> arg0 vector 0)))) - (set! sv-128 s2-0) - (set! sv-112 (-> arg0 vector)) - (let ((f0-6 (* 0.8 (tan (/ arg2 2))))) - (.lvf vf1 (&-> sv-112 0 quad)) - (let ((v1-6 f0-6)) - (.mov vf2 v1-6) + (let ((sv-128 s2-0)) + (let ((sv-112 (-> arg0 vector)) + (f0-6 (* 0.8 (tan (/ arg2 2)))) + ) + (.lvf vf1 (&-> sv-112 0 quad)) + (let ((v1-6 f0-6)) + (.mov vf2 v1-6) + ) ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-128 quad) vf1) ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-128 quad) vf1) (vector+! s2-0 s2-0 (-> arg0 vector 2)) (vector-normalize! s2-0 1.0) (let ((f0-8 (vector-dot s2-0 (-> arg0 vector 0)))) @@ -1488,17 +1468,19 @@ (vector-flatten! s3-0 s3-0 (-> arg0 vector 0)) (vector-normalize! s3-0 1.0) (let ((f28-1 (vector-dot s3-0 (-> arg0 vector 1)))) - (set! sv-160 s2-0) - (set! sv-144 (-> arg0 vector 1)) - (let ((f0-15 (* 0.525 (tan (/ arg2 2))))) - (.lvf vf1 (&-> sv-144 quad)) - (let ((v1-23 f0-15)) - (.mov vf2 v1-23) + (let ((sv-160 s2-0)) + (let ((sv-144 (-> arg0 vector 1)) + (f0-15 (* 0.525 (tan (/ arg2 2)))) + ) + (.lvf vf1 (&-> sv-144 quad)) + (let ((v1-23 f0-15)) + (.mov vf2 v1-23) + ) ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-160 quad) vf1) ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-160 quad) vf1) (vector+! s2-0 s2-0 (-> arg0 vector 2)) (vector-normalize! s2-0 1.0) (let ((f0-17 (vector-dot s2-0 (-> arg0 vector 1)))) @@ -1514,12 +1496,7 @@ (vector-flatten! s3-0 s3-0 (-> arg0 vector 0)) (vector-normalize! s3-0 1.0) (let ((f28-2 (vector-dot s3-0 (-> arg0 vector 1)))) - (let ((s0-1 s2-0)) - (set! sv-176 (-> arg0 vector 1)) - (let ((f0-25 (* 0.525 (tan (/ arg2 2))))) - (vector-float*! s0-1 sv-176 f0-25) - ) - ) + (vector-float*! s2-0 (-> arg0 vector 1) (* 0.525 (tan (/ arg2 2)))) (vector+! s2-0 s2-0 (-> arg0 vector 2)) (vector-normalize! s2-0 1.0) (let ((f0-27 (vector-dot s2-0 (-> arg0 vector 1)))) @@ -1561,14 +1538,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun slave-set-rotation! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 float) (arg3 float) (arg4 symbol)) - (local-vars - (f0-8 float) - (sv-192 vector) - (sv-208 vector) - (sv-224 matrix) - (sv-240 (function matrix vector float vector)) - (sv-256 matrix) - ) + (local-vars (f0-8 float)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1581,22 +1551,23 @@ (let ((f30-0 (-> arg0 tilt-adjust value))) (cond ((< 0.0001 (-> arg0 point-of-interest-blend value)) - (set! sv-192 (new 'stack-no-clear 'vector)) - 0.0 - (vector-! s1-0 (-> arg0 follow-pt) arg1) - (let ((f28-0 (vector-length s1-0))) - (vector-! sv-192 (-> arg0 point-of-interest) arg1) - (vector-normalize! sv-192 (* f28-0 (-> arg0 point-of-interest-blend value))) - (let ((v1-3 s1-0)) - (let ((a0-5 s1-0)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-5 quad)) + (let ((sv-192 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! s1-0 (-> arg0 follow-pt) arg1) + (let ((f28-0 (vector-length s1-0))) + (vector-! sv-192 (-> arg0 point-of-interest) arg1) + (vector-normalize! sv-192 (* f28-0 (-> arg0 point-of-interest-blend value))) + (let ((v1-3 s1-0)) + (let ((a0-5 s1-0)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-5 quad)) + ) + (.lvf vf5 (&-> sv-192 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-3 quad) vf6) ) - (.lvf vf5 (&-> sv-192 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-3 quad) vf6) + (vector-normalize! s1-0 f28-0) ) - (vector-normalize! s1-0 f28-0) ) ) (else @@ -1607,47 +1578,35 @@ (when (!= f30-0 0.0) 0.0 0.0 - (set! sv-224 (new 'stack-no-clear 'matrix)) - (set! sv-208 (new 'stack-no-clear 'vector)) - (vector-normalize-copy! sv-208 s1-0 1.0) - (let* ((v1-11 (-> *camera* local-down)) - (f0-7 (-> sv-208 x)) - (f1-1 (-> sv-208 y)) - (f2-0 (-> sv-208 z)) - (f3-0 (-> v1-11 x)) - (f4-0 (-> v1-11 y)) - (f5-0 (-> v1-11 z)) - ) - (.mula.s f0-7 f3-0) - (.madda.s f1-1 f4-0) - (.madd.s f0-8 f2-0 f5-0) - ) - (let* ((f28-1 f0-8) - (f0-10 (acos (fabs f28-1))) - ) - (cond - ((< 0.0 f30-0) - (set! f30-0 (if (< 0.0 f28-1) - (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-10))) - (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))) - ) - ) - ) - ((< f30-0 0.0) - (set! f30-0 (if (< 0.0 f28-1) - (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10))))) - (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10)))) - ) - ) - ) - ) - ) - (matrix-rotate-x! sv-224 f30-0) - (let ((t9-7 matrix*!) - (a0-16 s5-0) - (a2-3 s5-0) + (let ((sv-224 (new 'stack-no-clear 'matrix))) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (vector-normalize-copy! sv-208 s1-0 1.0) + (let* ((v1-11 (-> *camera* local-down))) + (set! f0-8 (vector-dot sv-208 v1-11)) ) - (t9-7 a0-16 sv-224 a2-3) + ) + (let* ((f28-1 f0-8) + (f0-10 (acos (fabs f28-1))) + ) + (cond + ((< 0.0 f30-0) + (set! f30-0 (if (< 0.0 f28-1) + (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-10))) + (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))) + ) + ) + ) + ((< f30-0 0.0) + (set! f30-0 (if (< 0.0 f28-1) + (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10))))) + (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10)))) + ) + ) + ) + ) + ) + (matrix-rotate-x! sv-224 f30-0) + (matrix*! s5-0 sv-224 s5-0) ) ) ) @@ -1655,11 +1614,7 @@ (set! (-> arg0 underwater-blend target) 1.0) (set! (-> arg0 underwater-blend target) 0.0) ) - (set! sv-240 vector-into-frustum-nosmooth!) - (set! sv-256 s5-0) - (let ((a2-5 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value)))) - (sv-240 sv-256 arg1 a2-5) - ) + (vector-into-frustum-nosmooth! s5-0 arg1 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value))) (cond (arg4 (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s1-0 s5-0) @@ -1694,97 +1649,71 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun v-slrp2! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector) (arg5 float)) - (local-vars - (f0-10 float) - (f28-0 float) - (f30-0 float) - (sv-144 float) - (sv-160 vector) - (sv-176 matrix) - (sv-192 vector) - ) - (set! sv-144 arg5) - (let ((s0-0 (new-stack-vector0))) - (set! sv-160 (new 'stack-no-clear 'vector)) + (local-vars (f0-10 float) (f28-0 float) (f30-0 float)) + (let ((sv-144 arg5) + (s0-0 (new-stack-vector0)) + (sv-160 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-160 quad) (the-as uint128 0)) 1.0 1.0 (let ((s3-0 (new-stack-vector0))) 0.0 1.0 - (set! sv-176 (new 'stack-no-clear 'matrix)) - (set! (-> sv-176 vector 0 quad) (the-as uint128 0)) - (set! (-> sv-176 vector 1 quad) (the-as uint128 0)) - (set! (-> sv-176 vector 2 quad) (the-as uint128 0)) - (set! (-> sv-176 vector 3 quad) (the-as uint128 0)) - (cond - ((< 1.0 arg3) - (set! arg3 1.0) - ) - ((< arg3 0.0) - (set! arg3 0.0) - ) - ) - (cond - (arg4 - (vector-flatten! s0-0 arg1 arg4) - (vector-flatten! sv-160 arg2 arg4) - (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) - (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) - (vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0) - (let ((f26-0 (vector-dot arg4 s3-0))) - (vector-normalize-copy! s3-0 arg4 1.0) - (if (< f26-0 0.0) - (vector-negate! s3-0 s3-0) - ) + (let ((sv-176 (new 'stack-no-clear 'matrix))) + (set! (-> sv-176 vector 0 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 1 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 2 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 3 quad) (the-as uint128 0)) + (cond + ((< 1.0 arg3) + (set! arg3 1.0) + ) + ((< arg3 0.0) + (set! arg3 0.0) + ) + ) + (cond + (arg4 + (vector-flatten! s0-0 arg1 arg4) + (vector-flatten! sv-160 arg2 arg4) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0) + (let ((f26-0 (vector-dot arg4 s3-0))) + (vector-normalize-copy! s3-0 arg4 1.0) + (if (< f26-0 0.0) + (vector-negate! s3-0 s3-0) + ) + ) + ) + (else + (set! (-> s0-0 quad) (-> arg1 quad)) + (set! (-> sv-160 quad) (-> arg2 quad)) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) ) ) - (else - (set! (-> s0-0 quad) (-> arg1 quad)) - (set! (-> sv-160 quad) (-> arg2 quad)) - (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) - (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) - (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) - ) - ) - (let ((t9-10 acos)) - (let* ((v1-18 s0-0) - (f0-9 (-> v1-18 x)) - (f1-2 (-> v1-18 y)) - (f2-0 (-> v1-18 z)) - (f3-0 (-> sv-160 x)) - (f4-0 (-> sv-160 y)) - (f5-0 (-> sv-160 z)) - ) - (.mula.s f0-9 f3-0) - (.madda.s f1-2 f4-0) - (.madd.s f0-10 f2-0 f5-0) - ) - (let* ((f1-3 (t9-10 f0-10)) - (f0-12 (* arg3 f1-3)) - ) - (when (< sv-144 f0-12) - (set! f0-12 sv-144) - (set! arg3 (/ sv-144 f1-3)) + (let ((t9-10 acos)) + (let* ((v1-18 s0-0)) + (set! f0-10 (vector-dot v1-18 sv-160)) ) - (let* ((f0-13 (cos f0-12)) - (t9-12 matrix-axis-sin-cos!) - (a0-20 sv-176) - (a1-13 s3-0) - (f1-5 1.0) - (f2-3 f0-13) + (let* ((f1-3 (t9-10 f0-10)) + (f0-12 (* arg3 f1-3)) ) - (t9-12 a0-20 a1-13 (sqrtf (- f1-5 (* f2-3 f2-3))) f0-13) + (when (< sv-144 f0-12) + (set! f0-12 sv-144) + (set! arg3 (/ sv-144 f1-3)) + ) + (let ((f0-13 (cos f0-12))) + (matrix-axis-sin-cos! sv-176 s3-0 (sqrtf (- 1.0 (square f0-13))) f0-13) + ) ) ) + (vector-matrix*! arg0 s0-0 sv-176) ) - (vector-matrix*! arg0 s0-0 sv-176) - (let ((s0-1 vector-normalize!)) - (set! sv-192 arg0) - (let ((a1-16 (lerp f30-0 f28-0 arg3))) - (s0-1 sv-192 a1-16) - ) - ) + (vector-normalize! arg0 (lerp f30-0 f28-0 arg3)) (when arg4 (vector+float*! arg0 arg0 s3-0 (vector-dot arg1 s3-0)) (vector+float*! arg0 arg0 s3-0 (* arg3 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0))) @@ -1802,10 +1731,11 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun v-slrp3! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float)) - (local-vars (f0-7 float) (f26-0 float) (f28-0 float) (sv-144 float) (sv-160 vector)) - (set! sv-144 arg4) - (let ((s1-0 (new-stack-vector0))) - (set! sv-160 (new 'stack-no-clear 'vector)) + (local-vars (f0-7 float) (f26-0 float) (f28-0 float)) + (let ((sv-144 arg4) + (s1-0 (new-stack-vector0)) + (sv-160 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-160 quad) (the-as uint128 0)) 0.0 0.0 @@ -1837,31 +1767,16 @@ ) ) (let ((t9-10 acos)) - (let* ((v1-9 s1-0) - (f0-6 (-> v1-9 x)) - (f1-0 (-> v1-9 y)) - (f2-0 (-> v1-9 z)) - (f3-0 (-> sv-160 x)) - (f4-0 (-> sv-160 y)) - (f5-0 (-> sv-160 z)) - ) - (.mula.s f0-6 f3-0) - (.madda.s f1-0 f4-0) - (.madd.s f0-7 f2-0 f5-0) + (let* ((v1-9 s1-0)) + (set! f0-7 (vector-dot v1-9 sv-160)) ) (let ((f0-8 (t9-10 f0-7))) (when (< sv-144 f0-8) (set! f30-0 (/ sv-144 f0-8)) (set! f0-8 sv-144) ) - (let* ((f0-9 (cos f0-8)) - (t9-12 matrix-axis-sin-cos!) - (a0-20 s0-0) - (a1-13 s3-0) - (f1-3 1.0) - (f2-1 f0-9) - ) - (t9-12 a0-20 a1-13 (sqrtf (- f1-3 (* f2-1 f2-1))) f0-9) + (let ((f0-9 (cos f0-8))) + (matrix-axis-sin-cos! s0-0 s3-0 (sqrtf (- 1.0 (square f0-9))) f0-9) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/collide/collide-edge-grab_REF.gc b/test/decompiler/reference/jak1/engine/collide/collide-edge-grab_REF.gc index 54de669039..d004f8b000 100644 --- a/test/decompiler/reference/jak1/engine/collide/collide-edge-grab_REF.gc +++ b/test/decompiler/reference/jak1/engine/collide/collide-edge-grab_REF.gc @@ -128,7 +128,6 @@ ;; definition for method 19 of type collide-edge-work ;; INFO: Used lq/sq (defmethod check-grab-for-collisions ((this collide-edge-work) (arg0 collide-edge-hold-item) (arg1 edge-grab-info)) - (local-vars (sv-144 (function vector vector vector float vector)) (sv-160 vector) (sv-176 vector)) (let* ((s3-0 (-> arg0 edge)) (s1-0 (-> s3-0 etri ctri)) (s4-0 (-> s1-0 prim-index)) @@ -140,13 +139,11 @@ (return #f) ) ) - (set! sv-144 vector+*!) - (set! sv-160 s0-0) - (set! sv-176 (-> arg0 center-pt)) - (let ((a2-3 (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm))) - (a3-2 1105.92) - ) - (sv-144 sv-160 sv-176 a2-3 a3-2) + (vector+*! + s0-0 + (-> arg0 center-pt) + (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm)) + 1105.92 ) (let ((f0-1 (collide-edge-work-method-14 this (-> arg1 left-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-1) diff --git a/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc b/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc index c1eec9ce98..ce30210169 100644 --- a/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc +++ b/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc @@ -299,12 +299,7 @@ ;; definition for function distc (defun distc ((arg0 vector) (arg1 vector)) - (let* ((f0-1 (- (-> arg0 x) (-> arg1 x))) - (f0-3 (* f0-1 f0-1)) - (f1-2 (- (-> arg0 z) (-> arg1 z))) - ) - (sqrtf (+ f0-3 (* f1-2 f1-2))) - ) + (sqrtf (+ (square (- (-> arg0 x) (-> arg1 x))) (square (- (-> arg0 z) (-> arg1 z))))) ) ;; definition for function interpolate diff --git a/test/decompiler/reference/jak1/engine/collide/collide-shape-rider_REF.gc b/test/decompiler/reference/jak1/engine/collide/collide-shape-rider_REF.gc index cccbe39f44..37bd0c43b9 100644 --- a/test/decompiler/reference/jak1/engine/collide/collide-shape-rider_REF.gc +++ b/test/decompiler/reference/jak1/engine/collide/collide-shape-rider_REF.gc @@ -406,7 +406,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod pull-rider! ((this collide-shape) (arg0 pull-rider-info)) - (local-vars (at-0 int) (sv-160 (function collide-shape-moving float collide-kind none))) + (local-vars (at-0 int)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -422,14 +422,7 @@ ((logtest? (-> this root-prim prim-core action) (collide-action rider-plat)) (let ((s1-0 (-> this root-prim prim-core collide-as))) (set! (-> this root-prim prim-core collide-as) (collide-kind)) - (let ((s0-0 gp-0)) - (set! sv-160 (method-of-object s0-0 fill-cache-for-shape!)) - (let ((a1-3 (+ 8192.0 (vector-length s3-0))) - (a2-0 (-> gp-0 root-prim collide-with)) - ) - (sv-160 s0-0 a1-3 a2-0) - ) - ) + (fill-cache-for-shape! gp-0 (+ 8192.0 (vector-length s3-0)) (-> gp-0 root-prim collide-with)) (set! (-> this root-prim prim-core collide-as) s1-0) ) (let ((s2-1 (new 'stack-no-clear 'vector))) diff --git a/test/decompiler/reference/jak1/engine/collide/surface-h_REF.gc b/test/decompiler/reference/jak1/engine/collide/surface-h_REF.gc index bc57ab23e2..621987ba67 100644 --- a/test/decompiler/reference/jak1/engine/collide/surface-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/collide/surface-h_REF.gc @@ -84,14 +84,14 @@ ;; definition for function calc-terminal2-vel (defun calc-terminal2-vel ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) (let ((f0-4 (sqrtf (/ (- (/ arg0 60) arg1) arg2)))) - (- f0-4 (+ arg1 (* arg2 (* f0-4 f0-4)))) + (- f0-4 (+ arg1 (* arg2 (square f0-4)))) ) ) ;; definition for function calc-terminal4-vel (defun calc-terminal4-vel ((arg0 float) (arg1 float) (arg2 float)) (let ((f0-5 (sqrtf (sqrtf (/ (- (/ arg0 60) arg1) arg2))))) - (- f0-5 (+ arg1 (* arg2 (* f0-5 f0-5 f0-5 f0-5)))) + (- f0-5 (+ arg1 (* arg2 (* (square f0-5) f0-5 f0-5)))) ) ) diff --git a/test/decompiler/reference/jak1/engine/common-obs/collectables_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/collectables_REF.gc index 64114798fe..9e1ef5b0ac 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/collectables_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/collectables_REF.gc @@ -1638,7 +1638,6 @@ ) ) :code (behavior ((arg0 object) (arg1 handle)) - (local-vars (sv-96 res-tag)) (sound-play "pu-powercell") (clear-collide-with-as (-> self root)) (logclear! (-> self mask) (process-mask actor-pause)) @@ -1661,8 +1660,8 @@ (format #t "WARNING: fuel-cell stall on not cloning.~%") (suspend) ) - (set! sv-96 (new 'static 'res-tag)) - (let* ((v1-34 + (let* ((sv-96 (new 'static 'res-tag)) + (v1-34 (res-lump-data (-> self entity) 'movie-pos @@ -2441,20 +2440,9 @@ (v1-58 symbol) (v1-64 symbol) (v1-71 symbol) - (sv-32 fact-info) - (sv-48 int) - (sv-64 process) - (sv-80 process) - (sv-96 process) - (sv-112 process) - (sv-128 process) - (sv-144 process) - (sv-160 process) - (sv-176 process) - (sv-192 (pointer process)) ) - (set! sv-32 arg5) - (let ((s1-0 (new-stack-vector0)) + (let ((sv-32 arg5) + (s1-0 (new-stack-vector0)) (t9-0 (method-of-type res-lump get-property-value-float)) ) (let ((v1-1 sv-32)) @@ -2485,10 +2473,11 @@ *res-static-buf* ) ) + (sv-192 (the-as (pointer process) #f)) ) - (set! sv-192 (the-as (pointer process) #f)) - (set! sv-48 (the int arg2)) - (let ((s0-0 (new 'static 'fact-info))) + (let ((sv-48 (the int arg2)) + (s0-0 (new 'static 'fact-info)) + ) (set! (-> s0-0 options) (fact-options)) (if sv-32 (mem-copy! (&-> s0-0 type) (&-> sv-32 type) 40) @@ -2496,7 +2485,7 @@ (set! (-> s0-0 pickup-type) arg1) (set! (-> s0-0 pickup-spawn-amount) 1.0) (while (> sv-48 0) - (set! sv-48 (+ sv-48 -1)) + (+! sv-48 -1) (when arg3 (set-vector! s1-0 0.0 57001.605 f30-0 1.0) (vector-rotate-around-y! s1-0 s1-0 (/ (* 65536.0 (the float sv-48)) arg2)) @@ -2504,118 +2493,117 @@ (let ((v1-25 arg1)) (cond ((= v1-25 (pickup-type eco-yellow)) - (set! sv-64 (get-process *pickup-dead-pool* eco-yellow #x4000)) - (set! v1-28 (when sv-64 - (set! sv-192 (the-as (pointer process) v1-28)) - (let ((t9-4 (method-of-type eco-yellow activate))) - (t9-4 (the-as eco-yellow sv-64) arg4 'eco-yellow (the-as pointer #x70004000)) - ) - (run-now-in-process sv-64 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-64 ppointer)) - v1-28 - ) - ) + (let ((sv-64 (get-process *pickup-dead-pool* eco-yellow #x4000))) + (set! v1-28 + (when sv-64 + (set! sv-192 (the-as (pointer process) v1-28)) + ((method-of-type eco-yellow activate) (the-as eco-yellow sv-64) arg4 'eco-yellow (the-as pointer #x70004000)) + (run-now-in-process sv-64 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-64 ppointer)) + v1-28 + ) + ) + ) sv-192 ) ((= v1-25 (pickup-type eco-red)) - (set! sv-80 (get-process *pickup-dead-pool* eco-red #x4000)) - (set! v1-34 (when sv-80 - (set! sv-192 (the-as (pointer process) v1-34)) - (let ((t9-7 (method-of-type eco-red activate))) - (t9-7 (the-as eco-red sv-80) arg4 'eco-red (the-as pointer #x70004000)) - ) - (run-now-in-process sv-80 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-80 ppointer)) - v1-34 - ) - ) + (let ((sv-80 (get-process *pickup-dead-pool* eco-red #x4000))) + (set! v1-34 + (when sv-80 + (set! sv-192 (the-as (pointer process) v1-34)) + ((method-of-type eco-red activate) (the-as eco-red sv-80) arg4 'eco-red (the-as pointer #x70004000)) + (run-now-in-process sv-80 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-80 ppointer)) + v1-34 + ) + ) + ) (level-hint-spawn (text-id misty-eco-red-hint) "sksp0071" (the-as entity #f) *entity-pool* (game-task none)) ) ((= v1-25 (pickup-type eco-blue)) - (set! sv-96 (get-process *pickup-dead-pool* eco-blue #x4000)) - (set! v1-40 (when sv-96 - (set! sv-192 (the-as (pointer process) v1-40)) - (let ((t9-11 (method-of-type eco-blue activate))) - (t9-11 (the-as eco-blue sv-96) arg4 'eco-blue (the-as pointer #x70004000)) - ) - (run-now-in-process sv-96 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-96 ppointer)) - v1-40 - ) - ) + (let ((sv-96 (get-process *pickup-dead-pool* eco-blue #x4000))) + (set! v1-40 + (when sv-96 + (set! sv-192 (the-as (pointer process) v1-40)) + ((method-of-type eco-blue activate) (the-as eco-blue sv-96) arg4 'eco-blue (the-as pointer #x70004000)) + (run-now-in-process sv-96 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-96 ppointer)) + v1-40 + ) + ) + ) sv-192 ) ((= v1-25 (pickup-type eco-green)) - (set! sv-112 (get-process *pickup-dead-pool* health #x4000)) - (set! v1-46 (when sv-112 - (set! sv-192 (the-as (pointer process) v1-46)) - (let ((t9-14 (method-of-type health activate))) - (t9-14 (the-as health sv-112) arg4 'health (the-as pointer #x70004000)) - ) - (run-now-in-process sv-112 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-112 ppointer)) - v1-46 - ) - ) + (let ((sv-112 (get-process *pickup-dead-pool* health #x4000))) + (set! v1-46 + (when sv-112 + (set! sv-192 (the-as (pointer process) v1-46)) + ((method-of-type health activate) (the-as health sv-112) arg4 'health (the-as pointer #x70004000)) + (run-now-in-process sv-112 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-112 ppointer)) + v1-46 + ) + ) + ) sv-192 ) ((= v1-25 (pickup-type eco-pill)) - (set! sv-128 (get-process *pickup-dead-pool* eco-pill #x4000)) - (set! v1-52 (when sv-128 - (set! sv-192 (the-as (pointer process) v1-52)) - (let ((t9-17 (method-of-type eco-pill activate))) - (t9-17 (the-as eco-pill sv-128) arg4 'eco-pill (the-as pointer #x70004000)) - ) - (run-now-in-process sv-128 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-128 ppointer)) - v1-52 - ) - ) + (let ((sv-128 (get-process *pickup-dead-pool* eco-pill #x4000))) + (set! v1-52 + (when sv-128 + (set! sv-192 (the-as (pointer process) v1-52)) + ((method-of-type eco-pill activate) (the-as eco-pill sv-128) arg4 'eco-pill (the-as pointer #x70004000)) + (run-now-in-process sv-128 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-128 ppointer)) + v1-52 + ) + ) + ) sv-192 ) ((= v1-25 (pickup-type money)) - (set! sv-144 (get-process *pickup-dead-pool* money #x4000)) - (set! v1-58 (when sv-144 - (set! sv-192 (the-as (pointer process) v1-58)) - (let ((t9-20 (method-of-type money activate))) - (t9-20 (the-as money sv-144) arg4 'money (the-as pointer #x70004000)) + (let ((sv-144 (get-process *pickup-dead-pool* money #x4000))) + (set! v1-58 (when sv-144 + (set! sv-192 (the-as (pointer process) v1-58)) + ((method-of-type money activate) (the-as money sv-144) arg4 'money (the-as pointer #x70004000)) + (run-now-in-process sv-144 money-init-by-other arg0 s1-0 s0-0 (-> self entity)) + (set! sv-192 (-> sv-144 ppointer)) + v1-58 ) - (run-now-in-process sv-144 money-init-by-other arg0 s1-0 s0-0 (-> self entity)) - (set! sv-192 (-> sv-144 ppointer)) - v1-58 - ) - ) + ) + ) sv-192 ) ((= v1-25 (pickup-type fuel-cell)) (set! (-> s0-0 pickup-spawn-amount) arg2) - (set! sv-160 (get-process *pickup-dead-pool* fuel-cell #x4000)) - (set! v1-64 (when sv-160 - (set! sv-192 (the-as (pointer process) v1-64)) - (let ((t9-23 (method-of-type fuel-cell activate))) - (t9-23 (the-as fuel-cell sv-160) arg4 'fuel-cell (the-as pointer #x70004000)) - ) - (run-now-in-process sv-160 fuel-cell-init-by-other arg0 s1-0 s0-0 (-> self entity)) - (set! sv-192 (-> sv-160 ppointer)) - v1-64 - ) - ) + (let ((sv-160 (get-process *pickup-dead-pool* fuel-cell #x4000))) + (set! v1-64 + (when sv-160 + (set! sv-192 (the-as (pointer process) v1-64)) + ((method-of-type fuel-cell activate) (the-as fuel-cell sv-160) arg4 'fuel-cell (the-as pointer #x70004000)) + (run-now-in-process sv-160 fuel-cell-init-by-other arg0 s1-0 s0-0 (-> self entity)) + (set! sv-192 (-> sv-160 ppointer)) + v1-64 + ) + ) + ) (set! sv-48 0) sv-48 ) ((= v1-25 (pickup-type buzzer)) (set! (-> s0-0 pickup-spawn-amount) arg2) - (set! sv-176 (get-process *pickup-dead-pool* buzzer #x4000)) - (set! v1-71 (when sv-176 - (set! sv-192 (the-as (pointer process) v1-71)) - (let ((t9-26 (method-of-type buzzer activate))) - (t9-26 (the-as buzzer sv-176) arg4 'buzzer (the-as pointer #x70004000)) - ) - (run-now-in-process sv-176 buzzer-init-by-other arg0 s1-0 s0-0 (-> self entity)) - (set! sv-192 (-> sv-176 ppointer)) - v1-71 - ) - ) + (let ((sv-176 (get-process *pickup-dead-pool* buzzer #x4000))) + (set! v1-71 + (when sv-176 + (set! sv-192 (the-as (pointer process) v1-71)) + ((method-of-type buzzer activate) (the-as buzzer sv-176) arg4 'buzzer (the-as pointer #x70004000)) + (run-now-in-process sv-176 buzzer-init-by-other arg0 s1-0 s0-0 (-> self entity)) + (set! sv-192 (-> sv-176 ppointer)) + v1-71 + ) + ) + ) (set! sv-48 0) sv-48 ) @@ -2627,9 +2615,9 @@ ) ) ) + sv-192 ) ) - sv-192 ) ;; definition for method 9 of type fact-info diff --git a/test/decompiler/reference/jak1/engine/common-obs/dark-eco-pool_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/dark-eco-pool_REF.gc index 80e192a126..7df0f99471 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/dark-eco-pool_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/dark-eco-pool_REF.gc @@ -363,8 +363,7 @@ ) (let* ((gp-0 (-> self draw ripple)) (f0-1 (the float (logand (current-time) #xffff))) - (f0-3 (cos (* 5.0 f0-1))) - (f30-0 (* f0-3 f0-3)) + (f30-0 (square (cos (* 5.0 f0-1)))) ) (let ((s5-0 (-> self draw ripple query))) (set! (-> self draw ripple send-query) #t) diff --git a/test/decompiler/reference/jak1/engine/common-obs/generic-obs_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/generic-obs_REF.gc index 9891b3a92c..acb4805e44 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/generic-obs_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/generic-obs_REF.gc @@ -1321,12 +1321,11 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this med-res-level) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 128) "#f" (let ((s4-0 (the-as (pointer sparticle-launch-group) #f))) - (set! sv-16 (new 'static 'res-tag)) - (let* ((s3-0 (res-lump-data arg0 'art-name (pointer symbol) :tag-ptr (& sv-16))) + (let* ((sv-16 (new 'static 'res-tag)) + (s3-0 (res-lump-data arg0 'art-name (pointer symbol) :tag-ptr (& sv-16))) (s2-0 (-> s3-0 0)) ) (cond @@ -1429,7 +1428,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this part-spawner) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 128) (logior! (-> this mask) (process-mask ambient)) (set! (-> this root) (new 'process 'trsqv)) @@ -1442,8 +1440,8 @@ (set! (-> this sound) (new 'process 'ambient-sound (-> this entity) (-> this root trans))) (let ((s4-0 (the-as object "#f"))) (let ((s3-0 (the-as (pointer sparticle-launch-group) #f))) - (set! sv-16 (new 'static 'res-tag)) - (let* ((s5-1 (res-lump-data arg0 'art-name (pointer (pointer sparticle-launch-group)) :tag-ptr (& sv-16))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-1 (res-lump-data arg0 'art-name (pointer (pointer sparticle-launch-group)) :tag-ptr (& sv-16))) (s2-0 (-> s5-1 0)) ) (cond diff --git a/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc index f914643330..dea55ff6ae 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc @@ -1876,9 +1876,8 @@ nav-enemy-default-event-handler (let* ((a0-10 (-> gp-0 sphere v1-9)) (f2-2 (- (-> a0-10 x) f0-1)) (f3-1 (- (-> a0-10 z) f1-2)) - (f4-0 (-> a0-10 w)) ) - (if (>= (* f4-0 f4-0) (+ (* f2-2 f2-2) (* f3-1 f3-1))) + (if (>= (square (-> a0-10 w)) (+ (square f2-2) (square f3-1))) (return #t) ) ) diff --git a/test/decompiler/reference/jak1/engine/common-obs/rigid-body_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/rigid-body_REF.gc index f2797a3cd5..8250d8488b 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/rigid-body_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/rigid-body_REF.gc @@ -67,24 +67,9 @@ (f1-1 12.0) (f0-5 (* f0-4 (/ 1.0 f1-1))) ) - (let* ((f1-4 arg2) - (f1-6 (* f1-4 f1-4)) - (f2-1 arg3) - ) - (set! (-> this inertial-tensor vector 0 x) (* f0-5 (+ f1-6 (* f2-1 f2-1)))) - ) - (let* ((f1-9 arg1) - (f1-11 (* f1-9 f1-9)) - (f2-4 arg3) - ) - (set! (-> this inertial-tensor vector 1 y) (* f0-5 (+ f1-11 (* f2-4 f2-4)))) - ) - (let* ((f1-14 arg1) - (f1-16 (* f1-14 f1-14)) - (f2-7 arg2) - ) - (set! (-> this inertial-tensor vector 2 z) (* f0-5 (+ f1-16 (* f2-7 f2-7)))) - ) + (set! (-> this inertial-tensor vector 0 x) (* f0-5 (+ (square arg2) (square arg3)))) + (set! (-> this inertial-tensor vector 1 y) (* f0-5 (+ (square arg1) (square arg3)))) + (set! (-> this inertial-tensor vector 2 z) (* f0-5 (+ (square arg1) (square arg2)))) ) (let ((f0-7 (-> this inertial-tensor vector 0 x))) (set! (-> this inv-inertial-tensor vector 0 x) (/ 1.0 f0-7)) diff --git a/test/decompiler/reference/jak1/engine/common-obs/water-anim_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/water-anim_REF.gc index a0774effcd..e2e2ac3940 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/water-anim_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/water-anim_REF.gc @@ -582,11 +582,11 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch quaternion vs none. (defmethod water-vol-method-25 ((this water-anim)) - (local-vars (sv-16 res-tag)) (set! (-> this play-ambient-sound?) #t) (set! (-> this look) (res-lump-value (-> this entity) 'look int :default (the-as uint128 -1))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-3 (+! (-> this root trans x) (-> v1-3 0)) (+! (-> this root trans y) (-> v1-3 1)) diff --git a/test/decompiler/reference/jak1/engine/common-obs/water_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/water_REF.gc index e7a5e78629..dc53f380d2 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/water_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/water_REF.gc @@ -1335,7 +1335,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch water-flags vs none. (defmethod init! ((this water-vol)) - (local-vars (sv-16 res-tag)) (set! (-> this attack-event) (the-as symbol ((method-of-type res-lump get-property-struct) (-> this entity) 'attack-event @@ -1353,19 +1352,19 @@ (logior! (-> this vol flags) 3) (set! (-> this bottom-height) 32768.0) (set! (-> this target) (the-as handle #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-8 (the-as (pointer float) ((method-of-type res-lump get-property-data) - (-> this entity) - 'water-height - 'exact - -1000000000.0 - (the-as pointer #f) - (& sv-16) - *res-static-buf* - ) - ) - ) - ) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-8 (the-as (pointer float) ((method-of-type res-lump get-property-data) + (-> this entity) + 'water-height + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) (when v1-8 (set! (-> this water-height) (-> v1-8 0)) (set! (-> this wade-height) (-> v1-8 1)) diff --git a/test/decompiler/reference/jak1/engine/debug/anim-tester_REF.gc b/test/decompiler/reference/jak1/engine/debug/anim-tester_REF.gc index a2b60df8da..79498a4d88 100644 --- a/test/decompiler/reference/jak1/engine/debug/anim-tester_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/anim-tester_REF.gc @@ -1016,7 +1016,6 @@ ;; definition for function anim-tester-disp-frame-num ;; INFO: Used lq/sq (defun anim-tester-disp-frame-num ((arg0 string) (arg1 float) (arg2 float) (arg3 font-context)) - (local-vars (sv-16 (function _varargs_ object))) (let* ((s3-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) (gp-0 (-> s3-0 base)) ) @@ -1035,14 +1034,7 @@ ) (else (let ((s0-0 draw-string-adv)) - (set! sv-16 format) - (let ((a0-11 (clear *temp-string*)) - (a1-5 "~S~3,,0f") - (a2-5 arg0) - (a3-1 (+ arg1 arg2)) - ) - (sv-16 a0-11 a1-5 a2-5 a3-1) - ) + (format (clear *temp-string*) "~S~3,,0f" arg0 (+ arg1 arg2)) (s0-0 *temp-string* s3-0 arg3) ) ) @@ -1700,10 +1692,6 @@ ;; definition for function anim-test-edit-sequence-list-handler ;; INFO: Used lq/sq (defun anim-test-edit-sequence-list-handler ((arg0 int) (arg1 list-control)) - (local-vars - (sv-192 (function string dma-buffer int int font-color font-flags float)) - (sv-208 (function _varargs_ object)) - ) (let ((gp-0 (-> arg1 the-node)) (s4-0 (the-as object (-> arg1 list-owner))) (s2-0 (and (logtest? (-> *anim-tester* 0 flags) (anim-tester-flags fanimt3)) @@ -1763,36 +1751,33 @@ (let* ((s0-1 (-> *display* frames (-> *display* on-screen) frame debug-buf)) (s1-1 (-> s0-1 base)) ) - (set! sv-192 draw-string-xy) - (set! sv-208 format) - (let ((a0-18 (clear *temp-string*)) - (a1-7 "~S~S~-27S") - (a2-11 (if (= (-> arg1 the-index) (-> arg1 highlight-index)) - ">" - " " - ) - ) - (a3-6 (if (= (-> arg1 the-index) (-> (the-as anim-test-sequence s4-0) playing-item)) - "*" - " " - ) - ) - (t0-2 (-> (the-as anim-test-seq-item gp-0) privname)) + (let ((sv-192 draw-string-xy)) + (let ((sv-208 format)) + (sv-208 + (clear *temp-string*) + "~S~S~-27S" + (if (= (-> arg1 the-index) (-> arg1 highlight-index)) + ">" + " " + ) + (if (= (-> arg1 the-index) (-> (the-as anim-test-sequence s4-0) playing-item)) + "*" + " " + ) + (-> (the-as anim-test-seq-item gp-0) privname) ) - (sv-208 a0-18 a1-7 a2-11 a3-6 t0-2) - ) - (let ((a0-19 *temp-string*) - (a1-8 s0-1) - (a2-12 (-> arg1 xpos)) - (a3-7 (-> arg1 ypos)) - (t0-4 (if (= (-> arg1 the-index) (-> arg1 current-index)) - 15 - 12 - ) - ) - (t1-2 3) - ) - (sv-192 a0-19 a1-8 a2-12 a3-7 (the-as font-color t0-4) (the-as font-flags t1-2)) + ) + (sv-192 + *temp-string* + s0-1 + (-> arg1 xpos) + (-> arg1 ypos) + (if (= (-> arg1 the-index) (-> arg1 current-index)) + (font-color menu-flag-on) + (font-color menu) + ) + (font-flags shadow kerning) + ) ) (let ((a3-8 (-> s0-1 base))) (let ((v1-44 (the-as object (-> s0-1 base)))) @@ -2782,7 +2767,6 @@ ;; definition for function anim-tester-add-newobj ;; INFO: Used lq/sq (defun anim-tester-add-newobj ((arg0 anim-tester) (arg1 string) (arg2 art-group)) - (local-vars (sv-96 art-element) (sv-112 art-element) (sv-128 anim-test-obj)) (let ((s2-0 (the-as anim-test-obj #f)) (s5-0 (the-as anim-test-obj #f)) ) @@ -2792,29 +2776,30 @@ (dotimes (s3-0 (-> arg2 length)) (cond ((and (= (-> arg2 data s3-0 type) merc-ctrl) (not s2-0)) - (set! sv-96 (-> arg2 data s3-0)) - (set! s0-0 (and s2-0 s0-0)) - (if s0-0 - (anim-test-obj-remove-invalid s2-0) - ) - (anim-tester-load-object-seqs arg0 (-> sv-96 name)) - (set! s2-0 (the-as anim-test-obj (glst-find-node-by-name (-> arg0 obj-list) (-> sv-96 name)))) - (set! s0-0 (if s2-0 - #t - #f - ) + (let ((sv-96 (-> arg2 data s3-0))) + (set! s0-0 (and s2-0 s0-0)) + (if s0-0 + (anim-test-obj-remove-invalid s2-0) + ) + (anim-tester-load-object-seqs arg0 (-> sv-96 name)) + (set! s2-0 (the-as anim-test-obj (glst-find-node-by-name (-> arg0 obj-list) (-> sv-96 name)))) + (set! s0-0 (if s2-0 + #t + #f + ) + ) + (cond + ((the-as symbol s0-0) + ) + (else + (set! s2-0 (new 'global 'anim-test-obj 1 (-> sv-96 name) arg2)) + (glst-add-tail (-> arg0 obj-list) s2-0) ) - (cond - ((the-as symbol s0-0) - ) - (else - (set! s2-0 (new 'global 'anim-test-obj 1 (-> sv-96 name) arg2)) - (glst-add-tail (-> arg0 obj-list) s2-0) ) + (anim-test-obj-init s2-0 (the-as list-control arg0)) + (set! (-> s2-0 obj-art-group) arg2) + (set! (-> s2-0 mesh-geo) (the-as merc-ctrl sv-96)) ) - (anim-test-obj-init s2-0 (the-as list-control arg0)) - (set! (-> s2-0 obj-art-group) arg2) - (set! (-> s2-0 mesh-geo) (the-as merc-ctrl sv-96)) (set! (-> s2-0 joint-geo) (the-as art-joint-geo s1-0)) (if (not s5-0) (set! s5-0 s2-0) @@ -2830,32 +2815,34 @@ ) ((= (-> arg2 data s3-0 type) art-joint-anim) (when s2-0 - (set! sv-112 (-> arg2 data s3-0)) - (set! sv-128 (the-as anim-test-obj (glst-find-node-by-name (-> s2-0 seq-list) (-> sv-112 name)))) - (when (not sv-128) - (set! sv-128 (the-as anim-test-obj (new 'debug 'anim-test-sequence 1 (-> sv-112 name)))) - (glst-add-tail (-> s2-0 seq-list) sv-128) - (anim-test-sequence-init (the-as anim-test-sequence sv-128) s2-0) - (let ((a1-11 (new 'debug 'anim-test-seq-item 1 (-> sv-112 name)))) - (glst-add-tail (the-as glst-list (&-> sv-128 obj-art-group)) a1-11) - ) - ) - (set! (-> sv-128 list-con user-info) (the-as int s2-0)) - (set! (-> sv-128 flags) (logior (-> (the-as anim-test-sequence sv-128) flags) 2)) - (let ((v1-48 (-> (the-as anim-test-sequence sv-128) item-list))) - "is the list empty, #t = empty" - (when (not (= (-> v1-48 tailpred) v1-48)) - (let ((v1-51 (-> (the-as anim-test-sequence sv-128) item-list))) - "return the start of the list" - (let ((v1-52 (-> v1-51 head))) - (set! (-> (the-as anim-test-seq-item v1-52) num-frames) - (the float (-> (the-as art-joint-anim sv-112) data 0 length)) - ) - (set! (-> (the-as anim-test-seq-item v1-52) artist-base) (-> (the-as art-joint-anim sv-112) artist-base)) - (set! (-> (the-as anim-test-seq-item v1-52) parent) (the-as anim-test-sequence sv-128)) - ) + (let* ((sv-112 (-> arg2 data s3-0)) + (sv-128 (the-as anim-test-obj (glst-find-node-by-name (-> s2-0 seq-list) (-> sv-112 name)))) + ) + (when (not sv-128) + (set! sv-128 (the-as anim-test-obj (new 'debug 'anim-test-sequence 1 (-> sv-112 name)))) + (glst-add-tail (-> s2-0 seq-list) sv-128) + (anim-test-sequence-init (the-as anim-test-sequence sv-128) s2-0) + (let ((a1-11 (new 'debug 'anim-test-seq-item 1 (-> sv-112 name)))) + (glst-add-tail (the-as glst-list (&-> sv-128 obj-art-group)) a1-11) + ) + ) + (set! (-> sv-128 list-con user-info) (the-as int s2-0)) + (set! (-> sv-128 flags) (logior (-> (the-as anim-test-sequence sv-128) flags) 2)) + (let ((v1-48 (-> (the-as anim-test-sequence sv-128) item-list))) + "is the list empty, #t = empty" + (when (not (= (-> v1-48 tailpred) v1-48)) + (let ((v1-51 (-> (the-as anim-test-sequence sv-128) item-list))) + "return the start of the list" + (let ((v1-52 (-> v1-51 head))) + (set! (-> (the-as anim-test-seq-item v1-52) num-frames) + (the float (-> (the-as art-joint-anim sv-112) data 0 length)) + ) + (set! (-> (the-as anim-test-seq-item v1-52) artist-base) (-> (the-as art-joint-anim sv-112) artist-base)) + (set! (-> (the-as anim-test-seq-item v1-52) parent) (the-as anim-test-sequence sv-128)) + ) + ) + sv-128 ) - sv-128 ) ) ) diff --git a/test/decompiler/reference/jak1/engine/debug/debug-sphere_REF.gc b/test/decompiler/reference/jak1/engine/debug/debug-sphere_REF.gc index 9486e8bca9..283758ad07 100644 --- a/test/decompiler/reference/jak1/engine/debug/debug-sphere_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/debug-sphere_REF.gc @@ -18,7 +18,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun make-debug-sphere-table ((arg0 debug-sphere-table)) - (local-vars (sv-80 int)) (let ((s5-0 (new-stack-vector0)) (f30-0 1.0) (s4-0 0) @@ -34,19 +33,20 @@ (set! (-> s2-0 y) (+ (-> s5-0 y) (* (cos (* 3276.8 (the float s3-0))) f30-0))) (set! (-> s1-0 y) (-> s2-0 y)) (set! (-> s0-0 y) (+ (-> s5-0 y) (* (cos (* 3276.8 (the float (+ s3-0 1)))) f30-0))) - (set! sv-80 0) - (while (< sv-80 10) - (set! (-> s2-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float sv-80))) f28-0))) - (set! (-> s2-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float sv-80))) f28-0))) - (set! (-> s1-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float (+ sv-80 1)))) f28-0))) - (set! (-> s1-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float (+ sv-80 1)))) f28-0))) - (set! (-> s0-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float sv-80))) f26-0))) - (set! (-> s0-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float sv-80))) f26-0))) - (set! (-> arg0 point s4-0 quad) (-> s2-0 quad)) - (set! (-> arg0 point (+ s4-0 1) quad) (-> s1-0 quad)) - (set! (-> arg0 point (+ s4-0 2) quad) (-> s0-0 quad)) - (+! s4-0 3) - (set! sv-80 (+ sv-80 1)) + (let ((sv-80 0)) + (while (< sv-80 10) + (set! (-> s2-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float sv-80))) f28-0))) + (set! (-> s2-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float sv-80))) f28-0))) + (set! (-> s1-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float (+ sv-80 1)))) f28-0))) + (set! (-> s1-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float (+ sv-80 1)))) f28-0))) + (set! (-> s0-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float sv-80))) f26-0))) + (set! (-> s0-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float sv-80))) f26-0))) + (set! (-> arg0 point s4-0 quad) (-> s2-0 quad)) + (set! (-> arg0 point (+ s4-0 1) quad) (-> s1-0 quad)) + (set! (-> arg0 point (+ s4-0 2) quad) (-> s0-0 quad)) + (+! s4-0 3) + (+! sv-80 1) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/debug/debug_REF.gc b/test/decompiler/reference/jak1/engine/debug/debug_REF.gc index bc4a474aac..c9afb148cb 100644 --- a/test/decompiler/reference/jak1/engine/debug/debug_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/debug_REF.gc @@ -164,9 +164,8 @@ ;; definition (debug) for function internal-draw-debug-line ;; INFO: Used lq/sq (defun-debug internal-draw-debug-line ((arg0 bucket-id) (arg1 vector) (arg2 vector) (arg3 rgba) (arg4 symbol) (arg5 rgba)) - (local-vars (sv-80 vector)) - (set! sv-80 arg2) - (let ((s2-0 arg3) + (let ((sv-80 arg2) + (s2-0 arg3) (s3-0 arg4) (s5-0 arg5) ) @@ -358,17 +357,11 @@ ;; definition (debug) for function add-debug-triangle-normal ;; INFO: Used lq/sq (defun-debug add-debug-triangle-normal ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 rgba)) - (local-vars (sv-48 (function vector vector float vector)) (sv-64 vector) (sv-80 vector)) (when arg0 (let ((s4-0 (new 'stack-no-clear 'vector)) (s3-0 (vector-3pt-cross! (new 'stack-no-clear 'vector) arg2 arg3 arg4)) ) - (set! sv-48 vector-float/!) - (set! sv-64 s3-0) - (set! sv-80 s3-0) - (let ((a2-2 (* 0.00024414062 (vector-length s3-0)))) - (sv-48 sv-64 sv-80 a2-2) - ) + (vector-float/! s3-0 s3-0 (* 0.00024414062 (vector-length s3-0))) (vector+! s4-0 arg2 arg3) (vector+! s4-0 s4-0 arg4) (vector-float/! s4-0 s4-0 3.0) @@ -930,27 +923,28 @@ ;; INFO: Used lq/sq (defun-debug add-debug-circle ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 float) (arg4 rgba) (arg5 matrix)) "note: you may pass #f for orientation" - (local-vars (sv-48 int) (sv-64 vector) (sv-80 vector)) (if (not arg0) (return #f) ) (let ((f30-0 0.0) (s1-0 (new-stack-vector0)) (s0-0 (new-stack-vector0)) + (sv-48 0) ) - (set! sv-48 0) (while (< sv-48 12) - (set! sv-64 s1-0) - (set! (-> sv-64 x) (* arg3 (cos f30-0))) - (set! (-> sv-64 y) 0.0) - (set! (-> sv-64 z) (* arg3 (sin f30-0))) - (set! (-> sv-64 w) 1.0) + (let ((sv-64 s1-0)) + (set! (-> sv-64 x) (* arg3 (cos f30-0))) + (set! (-> sv-64 y) 0.0) + (set! (-> sv-64 z) (* arg3 (sin f30-0))) + (set! (-> sv-64 w) 1.0) + ) (set! f30-0 (+ 5461.3335 f30-0)) - (set! sv-80 s0-0) - (set! (-> sv-80 x) (* arg3 (cos f30-0))) - (set! (-> sv-80 y) 0.0) - (set! (-> sv-80 z) (* arg3 (sin f30-0))) - (set! (-> sv-80 w) 1.0) + (let ((sv-80 s0-0)) + (set! (-> sv-80 x) (* arg3 (cos f30-0))) + (set! (-> sv-80 y) 0.0) + (set! (-> sv-80 z) (* arg3 (sin f30-0))) + (set! (-> sv-80 w) 1.0) + ) (when arg5 (vector-matrix*! s1-0 s1-0 arg5) (vector-matrix*! s0-0 s0-0 arg5) @@ -958,7 +952,7 @@ (vector+! s1-0 s1-0 arg2) (vector+! s0-0 s0-0 arg2) (add-debug-line #t arg1 s1-0 s0-0 arg4 #f (the-as rgba -1)) - (set! sv-48 (+ sv-48 1)) + (+! sv-48 1) ) ) #f @@ -1021,9 +1015,8 @@ ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot load at 32 mismatch: defined as size 4, got size 16 (defun-debug add-debug-yrot-vector ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 float) (arg4 float) (arg5 rgba)) - (local-vars (sv-32 float)) - (set! sv-32 arg3) - (let ((s0-0 arg4) + (let ((sv-32 arg3) + (s0-0 arg4) (s3-0 arg5) ) (if (not arg0) @@ -1049,44 +1042,48 @@ (arg7 matrix) ) "note: you may pass #f for orientation" - (local-vars (sv-48 vector) (sv-64 vector) (sv-80 int) (sv-96 vector) (sv-112 vector)) (if (not arg0) (return #f) ) - (let ((f30-0 arg3)) - (set! sv-48 (new 'stack-no-clear 'vector)) + (let ((f30-0 arg3) + (sv-48 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-48 quad) (the-as uint128 0)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! (-> sv-64 quad) (the-as uint128 0)) - (set! sv-80 0) - (while (< sv-80 12) - (set! sv-96 sv-48) - (set! (-> sv-96 x) (* arg5 (sin f30-0))) - (set! (-> sv-96 y) 0.0) - (set! (-> sv-96 z) (* arg5 (cos f30-0))) - (set! (-> sv-96 w) 1.0) - (+! f30-0 (the float (/ (the int (- arg4 arg3)) 12))) - (set! sv-112 sv-64) - (set! (-> sv-112 x) (* arg5 (sin f30-0))) - (set! (-> sv-112 y) 0.0) - (set! (-> sv-112 z) (* arg5 (cos f30-0))) - (set! (-> sv-112 w) 1.0) - (when arg7 - (vector-matrix*! sv-48 sv-48 arg7) - (vector-matrix*! sv-64 sv-64 arg7) + (let ((sv-64 (new 'stack-no-clear 'vector))) + (set! (-> sv-64 quad) (the-as uint128 0)) + (let ((sv-80 0)) + (while (< sv-80 12) + (let ((sv-96 sv-48)) + (set! (-> sv-96 x) (* arg5 (sin f30-0))) + (set! (-> sv-96 y) 0.0) + (set! (-> sv-96 z) (* arg5 (cos f30-0))) + (set! (-> sv-96 w) 1.0) + ) + (+! f30-0 (the float (/ (the int (- arg4 arg3)) 12))) + (let ((sv-112 sv-64)) + (set! (-> sv-112 x) (* arg5 (sin f30-0))) + (set! (-> sv-112 y) 0.0) + (set! (-> sv-112 z) (* arg5 (cos f30-0))) + (set! (-> sv-112 w) 1.0) + ) + (when arg7 + (vector-matrix*! sv-48 sv-48 arg7) + (vector-matrix*! sv-64 sv-64 arg7) + ) + (vector+! sv-48 sv-48 arg2) + (vector+! sv-64 sv-64 arg2) + (add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1)) + (cond + ((zero? sv-80) + (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1)) + ) + ((= sv-80 11) + (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1)) + ) + ) + (+! sv-80 1) + ) ) - (vector+! sv-48 sv-48 arg2) - (vector+! sv-64 sv-64 arg2) - (add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1)) - (cond - ((zero? sv-80) - (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1)) - ) - ((= sv-80 11) - (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1)) - ) - ) - (set! sv-80 (+ sv-80 1)) ) ) #f @@ -1102,21 +1099,23 @@ (arg5 int) (arg6 rgba) ) - (local-vars (sv-48 vector) (sv-64 int) (sv-80 int)) (if (not arg0) (return #f) ) - (let ((s0-0 (new-stack-vector0))) - (set! sv-48 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new-stack-vector0)) + (sv-48 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-48 quad) (the-as uint128 0)) - (set! sv-64 (* arg3 4)) - (curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5) - (set! sv-80 0) - (while (< sv-80 sv-64) - (set! (-> s0-0 quad) (-> sv-48 quad)) - (curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5) - (add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1)) - (set! sv-80 (+ sv-80 1)) + (let ((sv-64 (* arg3 4))) + (curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5) + (let ((sv-80 0)) + (while (< sv-80 sv-64) + (set! (-> s0-0 quad) (-> sv-48 quad)) + (curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5) + (add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1)) + (+! sv-80 1) + ) + ) ) ) #f @@ -1133,48 +1132,26 @@ ;; definition (debug) for function add-debug-points ;; INFO: Used lq/sq (defun-debug add-debug-points ((arg0 symbol) (arg1 bucket-id) (arg2 (inline-array vector)) (arg3 int) (arg4 rgba) (arg5 float) (arg6 int)) - (local-vars - (sv-32 (function symbol bucket-id string vector font-color vector2h symbol)) - (sv-48 symbol) - (sv-64 bucket-id) - (sv-80 (function _varargs_ object)) - (sv-96 vector) - ) (when arg0 (dotimes (s0-0 arg3) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! (-> sv-96 quad) (the-as uint128 0)) - (set! (-> sv-96 quad) (-> arg2 s0-0 quad)) - (if (!= arg5 0.0) - (set! (-> sv-96 y) arg5) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (set! (-> sv-96 quad) (the-as uint128 0)) + (set! (-> sv-96 quad) (-> arg2 s0-0 quad)) + (if (!= arg5 0.0) + (set! (-> sv-96 y) arg5) + ) + (let ((sv-32 add-debug-text-3d) + (sv-48 #t) + (sv-64 arg1) + ) + (format (clear *temp-string*) "~d" s0-0) + (sv-32 sv-48 sv-64 *temp-string* sv-96 (font-color white) (the-as vector2h #f)) ) - (set! sv-32 add-debug-text-3d) - (set! sv-48 #t) - (set! sv-64 arg1) - (set! sv-80 format) - (let ((a0-5 (clear *temp-string*)) - (a1-1 "~d") - (a2-1 s0-0) - ) - (sv-80 a0-5 a1-1 a2-1) - ) - (let ((a2-2 *temp-string*) - (a3-1 sv-96) - (t0-1 1) - (t1-1 #f) - ) - (sv-32 sv-48 sv-64 a2-2 a3-1 (the-as font-color t0-1) (the-as vector2h t1-1)) - ) - (let ((t9-3 add-debug-x) - (a0-7 #t) - (a1-3 arg1) - (a3-2 (if (= s0-0 arg6) - (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - arg4 - ) - ) - ) - (t9-3 a0-7 a1-3 sv-96 a3-2) + (add-debug-x #t arg1 sv-96 (if (= s0-0 arg6) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + arg4 + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/debug/memory-usage_REF.gc b/test/decompiler/reference/jak1/engine/debug/memory-usage_REF.gc index 09822132ef..c229e6e475 100644 --- a/test/decompiler/reference/jak1/engine/debug/memory-usage_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/memory-usage_REF.gc @@ -305,7 +305,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch memory-usage-block vs none. (defmethod print-mem-usage ((this memory-usage-block) (arg0 level) (arg1 object)) - (local-vars (sv-16 object) (sv-32 string) (sv-48 symbol) (sv-64 int) (sv-80 int)) (let ((s3-0 (&- (-> arg0 heap current) (the-as uint (-> arg0 heap base))))) (let ((v1-2 (+ (-> this data 59 total) (-> this data 60 total)))) (< #x10000 v1-2) @@ -317,18 +316,14 @@ (if (< s2-0 (-> arg0 mem-usage)) (format arg1 "~3L") ) - (let ((s0-0 format)) - (set! sv-16 arg1) - (set! sv-32 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--") - (set! sv-48 (-> arg0 name)) - (let ((s3-1 (sar s3-0 10)) - (s2-1 (sar s2-0 10)) - ) - (set! sv-64 (sar (memory-used *nk-dead-pool*) 10)) - (let ((t2-0 (sar (memory-total *nk-dead-pool*) 10))) - (s0-0 sv-16 sv-32 sv-48 s3-1 s2-1 sv-64 t2-0) - ) - ) + (format + arg1 + "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--" + (-> arg0 name) + (sar s3-0 10) + (sar s2-0 10) + (sar (memory-used *nk-dead-pool*) 10) + (sar (memory-total *nk-dead-pool*) 10) ) (format arg1 "~5,'-DK/~5,'-DK--~%" (shr s1-0 10) (sar *max-dma* 10)) ) @@ -339,16 +334,15 @@ arg1 ) ) - (s3-2 format) - (s1-1 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%") - (s0-1 (sar (memory-used *nk-dead-pool*) 10)) ) - (set! sv-80 (sar (memory-total *nk-dead-pool*) 10)) - (let ((t0-1 (compact-time *nk-dead-pool*)) - (t1-1 (-> *nk-dead-pool* compact-count)) - (t2-1 (-> *nk-dead-pool* compact-count-targ)) - ) - (s3-2 s2-2 s1-1 s0-1 sv-80 t0-1 t1-1 t2-1) + (format + s2-2 + "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%" + (sar (memory-used *nk-dead-pool*) 10) + (sar (memory-total *nk-dead-pool*) 10) + (compact-time *nk-dead-pool*) + (-> *nk-dead-pool* compact-count) + (-> *nk-dead-pool* compact-count-targ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/debug/menu_REF.gc b/test/decompiler/reference/jak1/engine/debug/menu_REF.gc index f8500a4871..561a80b3ef 100644 --- a/test/decompiler/reference/jak1/engine/debug/menu_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/menu_REF.gc @@ -626,7 +626,7 @@ ;; WARN: Stack slot load at 80 mismatch: defined as size 4, got size 16 ;; WARN: Stack slot load at 96 mismatch: defined as size 4, got size 16 (defun debug-menu-make-from-template ((arg0 debug-menu-context) (arg1 pair)) - (local-vars (s5-0 basic) (sv-16 object) (sv-32 int) (sv-48 float) (sv-64 float) (sv-80 float) (sv-96 float)) + (local-vars (s5-0 basic)) (when (or (not arg1) (null? arg1)) (set! s5-0 #f) (goto cfg-41) @@ -704,18 +704,14 @@ (set! s5-0 (new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4))) ) - (let ((s3-4 debug-menu-item-var-make-int) - (s2-3 (the-as debug-menu-item-var s5-0)) - (s1-3 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s0-1 (/ (the-as int (ref arg1 5)) 8)) - ) - (set! sv-16 (ref arg1 6)) - (set! sv-32 (/ (the-as int (ref arg1 7)) 8)) - (let ((t1-0 (/ (the-as int (ref arg1 8)) 8)) - (t2-0 (= s4-0 'hex-var)) - ) - (s3-4 s2-3 (the-as (function int debug-menu-msg int int int) s1-3) s0-1 (the-as symbol sv-16) sv-32 t1-0 t2-0) - ) + (debug-menu-item-var-make-int + (the-as debug-menu-item-var s5-0) + (the-as (function int debug-menu-msg int int int) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (/ (the-as int (ref arg1 5)) 8) + (the-as symbol (ref arg1 6)) + (/ (the-as int (ref arg1 7)) 8) + (/ (the-as int (ref arg1 8)) 8) + (= s4-0 'hex-var) ) (set! (-> (the-as debug-menu-item-var s5-0) ifloat-p) #t) s5-0 @@ -724,25 +720,14 @@ (set! s5-0 (new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4))) ) - (let ((s4-5 debug-menu-item-var-make-float) - (s3-6 (the-as debug-menu-item-var s5-0)) - (s2-5 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s1-5 (the float (/ (the-as int (ref arg1 5)) 8))) - (s0-2 (ref arg1 6)) - ) - (set! sv-48 (the float (/ (the-as int (ref arg1 7)) 8))) - (set! sv-64 (the float (/ (the-as int (ref arg1 8)) 8))) - (let ((t2-1 (/ (the-as int (ref arg1 9)) 8))) - (s4-5 - s3-6 - (the-as (function int debug-menu-msg float float float) s2-5) - s1-5 - (the-as symbol s0-2) - sv-48 - sv-64 - t2-1 - ) - ) + (debug-menu-item-var-make-float + (the-as debug-menu-item-var s5-0) + (the-as (function int debug-menu-msg float float float) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (the float (/ (the-as int (ref arg1 5)) 8)) + (the-as symbol (ref arg1 6)) + (the float (/ (the-as int (ref arg1 7)) 8)) + (the float (/ (the-as int (ref arg1 8)) 8)) + (/ (the-as int (ref arg1 9)) 8) ) s5-0 ) @@ -750,25 +735,14 @@ (set! s5-0 (new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4))) ) - (let ((s4-7 debug-menu-item-var-make-float) - (s3-8 (the-as debug-menu-item-var s5-0)) - (s2-7 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s1-7 (* 0.001 (the float (/ (the-as int (ref arg1 5)) 8)))) - (s0-3 (ref arg1 6)) - ) - (set! sv-80 (* 0.001 (the float (/ (the-as int (ref arg1 7)) 8)))) - (set! sv-96 (* 0.001 (the float (/ (the-as int (ref arg1 8)) 8)))) - (let ((t2-2 (/ (the-as int (ref arg1 9)) 8))) - (s4-7 - s3-8 - (the-as (function int debug-menu-msg float float float) s2-7) - s1-7 - (the-as symbol s0-3) - sv-80 - sv-96 - t2-2 - ) - ) + (debug-menu-item-var-make-float + (the-as debug-menu-item-var s5-0) + (the-as (function int debug-menu-msg float float float) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (* 0.001 (the float (/ (the-as int (ref arg1 5)) 8))) + (the-as symbol (ref arg1 6)) + (* 0.001 (the float (/ (the-as int (ref arg1 7)) 8))) + (* 0.001 (the float (/ (the-as int (ref arg1 8)) 8))) + (/ (the-as int (ref arg1 9)) 8) ) s5-0 ) @@ -1059,7 +1033,6 @@ ;; definition for function debug-menu-render ;; INFO: Used lq/sq (defun debug-menu-render ((arg0 debug-menu) (arg1 int) (arg2 int) (arg3 debug-menu-node) (arg4 int)) - (local-vars (sv-16 dma-buffer) (sv-32 pointer)) (let ((v1-0 0)) (let* ((a0-1 (-> arg0 items)) (a1-1 (car a0-1)) @@ -1110,21 +1083,23 @@ ) ) (set-origin! (-> arg0 context font) s3-1 s2-1) - (set! sv-16 (-> *display* frames (-> *display* on-screen) frame debug-buf)) - (set! sv-32 (-> sv-16 base)) - (draw-string ">" sv-16 (-> arg0 context font)) - (let ((a3-3 (-> sv-16 base))) - (let ((v1-26 (the-as object (-> sv-16 base)))) - (set! (-> (the-as dma-packet v1-26) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-26) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-26) vif1) (new 'static 'vif-tag)) - (set! (-> sv-16 base) (&+ (the-as pointer v1-26) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id debug-no-zbuf) - sv-32 - (the-as (pointer dma-tag) a3-3) + (let* ((sv-16 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (sv-32 (-> sv-16 base)) + ) + (draw-string ">" sv-16 (-> arg0 context font)) + (let ((a3-3 (-> sv-16 base))) + (let ((v1-26 (the-as object (-> sv-16 base)))) + (set! (-> (the-as dma-packet v1-26) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-26) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-26) vif1) (new 'static 'vif-tag)) + (set! (-> sv-16 base) (&+ (the-as pointer v1-26) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug-no-zbuf) + sv-32 + (the-as (pointer dma-tag) a3-3) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/debug/viewer_REF.gc b/test/decompiler/reference/jak1/engine/debug/viewer_REF.gc index 6b2f84528d..c3fe821378 100644 --- a/test/decompiler/reference/jak1/engine/debug/viewer_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/viewer_REF.gc @@ -213,20 +213,18 @@ ;; definition for function add-a-bunch ;; INFO: Used lq/sq (defun add-a-bunch ((arg0 string) (arg1 int) (arg2 int) (arg3 float)) - (local-vars (sv-32 process)) (dotimes (s2-0 arg1) (dotimes (s1-0 arg2) (let ((s0-0 (new-stack-vector0))) (position-in-front-of-camera! s0-0 40960.0 4096.0) (+! (-> s0-0 x) (the float (* (- s2-0 (/ arg1 2)) (the int arg3)))) (+! (-> s0-0 z) (the float (* (- s1-0 (/ arg2 2)) (the int arg3)))) - (set! sv-32 (get-process *default-dead-pool* viewer #x4000)) - (when sv-32 - (let ((t9-2 (method-of-type viewer activate))) - (t9-2 (the-as viewer sv-32) *entity-pool* 'viewer (the-as pointer #x70004000)) + (let ((sv-32 (get-process *default-dead-pool* viewer #x4000))) + (when sv-32 + ((method-of-type viewer activate) (the-as viewer sv-32) *entity-pool* 'viewer (the-as pointer #x70004000)) + (run-now-in-process sv-32 init-viewer-for-other arg0 s0-0) + (-> sv-32 ppointer) ) - (run-now-in-process sv-32 init-viewer-for-other arg0 s0-0) - (-> sv-32 ppointer) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/dma/dma-disasm_REF.gc b/test/decompiler/reference/jak1/engine/dma/dma-disasm_REF.gc index 5c0f788ca5..96112133ed 100644 --- a/test/decompiler/reference/jak1/engine/dma/dma-disasm_REF.gc +++ b/test/decompiler/reference/jak1/engine/dma/dma-disasm_REF.gc @@ -303,138 +303,141 @@ ;; definition for function disasm-vif-tag ;; INFO: Used lq/sq (defun disasm-vif-tag ((data (pointer vif-tag)) (words int) (stream symbol) (details symbol)) - (local-vars (cmd vif-cmd) (data-ptr (pointer vif-tag)) (data-idx int) (unpack-imm vif-unpack-imm)) (let ((byte-idx 0)) (while (< byte-idx (* words 4)) (let ((packet-size 4)) (let ((first-tag (-> data 0))) (format stream " #x~X:" data) (dotimes (cmd-template-idx (-> *vif-disasm-table* length)) - (set! cmd (-> first-tag cmd)) - (when (= (logand cmd (-> *vif-disasm-table* cmd-template-idx mask)) (-> *vif-disasm-table* cmd-template-idx tag)) - (let ((print-kind (-> *vif-disasm-table* cmd-template-idx print))) - (cond - ((zero? print-kind) - (format stream " (~s :irq ~D)~%" (-> *vif-disasm-table* cmd-template-idx string1) (-> first-tag irq)) - ) - ((= print-kind 1) - (format - stream - " (~s :irq ~D :~s #x~X)~%" - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> *vif-disasm-table* cmd-template-idx string2) - (-> first-tag imm) + (let ((cmd (-> first-tag cmd))) + (when (= (logand cmd (-> *vif-disasm-table* cmd-template-idx mask)) (-> *vif-disasm-table* cmd-template-idx tag)) + (let ((print-kind (-> *vif-disasm-table* cmd-template-idx print))) + (cond + ((zero? print-kind) + (format stream " (~s :irq ~D)~%" (-> *vif-disasm-table* cmd-template-idx string1) (-> first-tag irq)) ) - ) - ((= print-kind 2) - (let ((stcycl-imm (the-as vif-stcycl-imm (-> first-tag imm)))) + ((= print-kind 1) (format stream - " (~s :irq ~D :wl ~D :cl ~D)~%" + " (~s :irq ~D :~s #x~X)~%" (-> *vif-disasm-table* cmd-template-idx string1) (-> first-tag irq) - (-> stcycl-imm wl) - (-> stcycl-imm cl) + (-> *vif-disasm-table* cmd-template-idx string2) + (-> first-tag imm) ) ) - ) - ((= print-kind 3) - (set! packet-size 8) - (format - stream - " (~s :irq ~D :~s #x~X)~%" - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> *vif-disasm-table* cmd-template-idx string2) - (-> data 1) - ) - ) - ((= print-kind 4) - (set! packet-size 20) - (format - stream - " (~s :irq ~D :~s " - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> *vif-disasm-table* cmd-template-idx string2) - ) - (format stream "#x~X #x~X #x~X #x~X)~%" (-> data 1) (-> data 2) (-> data 3) (-> data 4)) - ) - ((= print-kind 5) - (format - stream - " (~s :irq ~D :instructions #x~D :addr #x~X)~%" - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> first-tag num) - (-> first-tag imm) - ) - ) - ((= print-kind 6) - (if (-> first-tag imm) - (set! packet-size #x100000) - (set! packet-size (the-as int (* (-> first-tag imm) 16))) + ((= print-kind 2) + (let ((stcycl-imm (the-as vif-stcycl-imm (-> first-tag imm)))) + (format + stream + " (~s :irq ~D :wl ~D :cl ~D)~%" + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> stcycl-imm wl) + (-> stcycl-imm cl) + ) ) - (format - stream - " (~s :irq ~D :qwc #x~D)~%" - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> first-tag imm) ) - (set! data-ptr (&-> data 1)) - (set! data-idx 0) - (while (< data-idx (the-as int (-> first-tag imm))) + ((= print-kind 3) + (set! packet-size 8) (format stream - " #x~X: #x~8x #x~8x #x~8x #x~8x~%" - (+ (+ (* data-idx 16) 4) (the-as int data)) - (-> data-ptr (* data-idx 4)) - (-> data-ptr (+ (* data-idx 4) 1)) - (-> data-ptr (+ (* data-idx 4) 2)) - (-> data-ptr (+ (* data-idx 4) 3)) + " (~s :irq ~D :~s #x~X)~%" + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> *vif-disasm-table* cmd-template-idx string2) + (-> data 1) ) - (set! data-idx (+ data-idx 1)) ) - #f - ) - ((= print-kind 7) - (set! packet-size - (the-as int (+ (logand -4 (+ (* (-> *vif-disasm-table* cmd-template-idx val) (-> first-tag num)) 3)) 4)) + ((= print-kind 4) + (set! packet-size 20) + (format + stream + " (~s :irq ~D :~s " + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> *vif-disasm-table* cmd-template-idx string2) + ) + (format stream "#x~X #x~X #x~X #x~X)~%" (-> data 1) (-> data 2) (-> data 3) (-> data 4)) + ) + ((= print-kind 5) + (format + stream + " (~s :irq ~D :instructions #x~D :addr #x~X)~%" + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> first-tag num) + (-> first-tag imm) + ) + ) + ((= print-kind 6) + (if (-> first-tag imm) + (set! packet-size #x100000) + (set! packet-size (the-as int (* (-> first-tag imm) 16))) ) - (set! unpack-imm (the-as vif-unpack-imm (-> first-tag imm))) - (format - stream - " (~s :irq ~D :num ~D :addr #x~X " - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> first-tag num) - (-> unpack-imm addr) + (format + stream + " (~s :irq ~D :qwc #x~D)~%" + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> first-tag imm) + ) + (let ((data-ptr (&-> data 1)) + (data-idx 0) + ) + (while (< data-idx (the-as int (-> first-tag imm))) + (format + stream + " #x~X: #x~8x #x~8x #x~8x #x~8x~%" + (+ (+ (* data-idx 16) 4) (the-as int data)) + (-> data-ptr (* data-idx 4)) + (-> data-ptr (+ (* data-idx 4) 1)) + (-> data-ptr (+ (* data-idx 4) 2)) + (-> data-ptr (+ (* data-idx 4) 3)) + ) + (+! data-idx 1) + ) + ) + #f ) - (format - stream - ":msk ~D :flg ~D :usn ~D [skip ~d])~%" - (-> first-tag msk) - (-> unpack-imm flg) - (-> unpack-imm usn) - (the-as uint packet-size) - ) - (if details - (disasm-vif-details + ((= print-kind 7) + (set! packet-size + (the-as int (+ (logand -4 (+ (* (-> *vif-disasm-table* cmd-template-idx val) (-> first-tag num)) 3)) 4)) + ) + (let ((unpack-imm (the-as vif-unpack-imm (-> first-tag imm)))) + (format stream - (the-as (pointer uint8) data) - (logand cmd (vif-cmd cmd-mask)) - (the-as int (-> first-tag num)) + " (~s :irq ~D :num ~D :addr #x~X " + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> first-tag num) + (-> unpack-imm addr) + ) + (format + stream + ":msk ~D :flg ~D :usn ~D [skip ~d])~%" + (-> first-tag msk) + (-> unpack-imm flg) + (-> unpack-imm usn) + (the-as uint packet-size) ) ) - ) - ((= print-kind 8) - (format stream " (*unknown* vif-tag #x~X)~%" (-> first-tag cmd)) - ) + (if details + (disasm-vif-details + stream + (the-as (pointer uint8) data) + (logand cmd (vif-cmd cmd-mask)) + (the-as int (-> first-tag num)) + ) + ) + ) + ((= print-kind 8) + (format stream " (*unknown* vif-tag #x~X)~%" (-> first-tag cmd)) + ) + ) ) + (set! cmd-template-idx (-> *vif-disasm-table* length)) ) - (set! cmd-template-idx (-> *vif-disasm-table* length)) ) ) ) @@ -512,17 +515,8 @@ ;; WARN: Check prologue - tricky store of a0 ;; INFO: Used lq/sq (defun disasm-dma-list ((data dma-packet) (mode symbol) (verbose symbol) (stream symbol) (expected-size int)) - (local-vars - (addr object) - (data-2 dma-packet) - (qwc int) - (ra-1 object) - (ra-2 object) - (call-depth int) - (current-tag dma-tag) - ) - (set! data-2 data) - (let ((mode-2 mode) + (let ((data-2 data) + (mode-2 mode) (verbose-2 verbose) (stream-2 stream) (expected-size-2 expected-size) @@ -534,174 +528,176 @@ (let ((total-qwc 0) (total-tags 0) ) - (set! addr 0) - (set! qwc 0) - (set! ra-1 0) - (set! ra-2 1) - (set! call-depth -1) - (set! current-tag (new 'static 'dma-tag)) - (while (not end-condition) - (cond - ((not (valid? data-2 (the-as type #f) "dma-list tag pointer" #t stream-2)) - (format stream-2 "ERROR: dma-list tag pointer invalid~%") - (set! end-condition 'error) - ) - (else - (set! current-tag (-> data-2 dma)) - (when (not (or (zero? total-tags) (valid? addr (the-as type #f) "dma-list data pointer" #t stream-2))) - (format stream-2 "ERROR: dma-list data pointer invalid~%") - (set! end-condition 'error) - ) - (when (logtest? (the-as dma-tag #x3ff0000) current-tag) - (format stream-2 "ERROR: dma tag has data in reserved bits ~X~%") - (set! end-condition 'error) - ) + (let ((addr 0) + (qwc 0) + (ra-1 0) + (ra-2 1) + (call-depth -1) + (current-tag (new 'static 'dma-tag)) ) - ) - (when (or verbose-2 (= end-condition 'error)) - (format stream-2 "#x~8x: " data-2) + (while (not end-condition) (cond - ((zero? call-depth) - (format stream-2 " ") - ) - ((= call-depth 1) - (format stream-2 " ") - ) - ) - (disasm-dma-tag current-tag stream-2) - ) - (cond - (end-condition - ) - ((or (= (-> current-tag id) (dma-tag-id ref)) - (= (-> current-tag id) (dma-tag-id refs)) - (zero? (-> current-tag id)) - ) - (set! addr (-> current-tag addr)) - (set! qwc (the-as int (-> current-tag qwc))) - (when mode-2 - (let ((v0-10 (disasm-vif-tag (&-> data-2 vif0) 2 stream-2 (= mode-2 'details)))) - (disasm-vif-tag - (the-as (pointer vif-tag) (+ addr v0-10)) - (the-as int (- (* qwc 4) (the-as uint (/ v0-10 4)))) - stream-2 - (= mode-2 'details) - ) - ) - ) - (set! data-2 (the-as dma-packet (&-> (the-as (pointer uint64) data-2) 2))) - (if (= (-> current-tag id) (dma-tag-id refe)) - (set! end-condition #t) - ) - ) - ((= (-> current-tag id) (dma-tag-id cnt)) - (set! addr (&-> (the-as (pointer uint64) data-2) 2)) - (set! qwc (the-as int (-> current-tag qwc))) - (if mode-2 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) - (the-as int (+ (* qwc 4) 2)) - stream-2 - (= mode-2 'details) - ) - ) - (set! data-2 (the-as dma-packet (+ (the-as uint data-2) (* (+ qwc 1) 16)))) - data-2 - ) - ((= (-> current-tag id) (dma-tag-id next)) - (set! addr (&-> (the-as (pointer uint64) data-2) 2)) - (set! qwc (the-as int (-> current-tag qwc))) - (if mode-2 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) - (the-as int (+ (* qwc 4) 2)) - stream-2 - (= mode-2 'details) - ) - ) - (when (= data-2 (-> current-tag addr)) - (format stream-2 "ERROR: next tag creates infinite loop.~%") + ((not (valid? data-2 (the-as type #f) "dma-list tag pointer" #t stream-2)) + (format stream-2 "ERROR: dma-list tag pointer invalid~%") (set! end-condition 'error) ) - (set! data-2 (the-as dma-packet (-> current-tag addr))) - data-2 - ) - ((= (-> current-tag id) (dma-tag-id call)) - (set! addr (&-> (the-as (pointer uint64) data-2) 2)) - (set! qwc (the-as int (-> current-tag qwc))) - (if mode-2 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) - (the-as int (+ (* qwc 4) 2)) - stream-2 - (= mode-2 'details) - ) - ) - (set! data-2 (the-as dma-packet (-> current-tag addr))) - (set! call-depth (+ call-depth 1)) - (cond - ((zero? call-depth) - (set! ra-1 (&+ addr qwc)) - (the-as (pointer uint64) ra-1) + (else + (set! current-tag (-> data-2 dma)) + (when (not (or (zero? total-tags) (valid? addr (the-as type #f) "dma-list data pointer" #t stream-2))) + (format stream-2 "ERROR: dma-list data pointer invalid~%") + (set! end-condition 'error) + ) + (when (logtest? (the-as dma-tag #x3ff0000) current-tag) + (format stream-2 "ERROR: dma tag has data in reserved bits ~X~%") + (set! end-condition 'error) + ) ) - (else - (set! ra-2 (&+ addr qwc)) - (the-as (pointer uint64) ra-2) + ) + (when (or verbose-2 (= end-condition 'error)) + (format stream-2 "#x~8x: " data-2) + (cond + ((zero? call-depth) + (format stream-2 " ") ) - ) - ) - ((= (-> current-tag id) (dma-tag-id ret)) - (set! addr (&-> (the-as (pointer uint64) data-2) 2)) - (set! qwc (the-as int (-> current-tag qwc))) - (if mode-2 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) - (the-as int (+ (* qwc 4) 2)) - stream-2 - (= mode-2 'details) + ((= call-depth 1) + (format stream-2 " ") + ) + ) + (disasm-dma-tag current-tag stream-2) + ) + (cond + (end-condition + ) + ((or (= (-> current-tag id) (dma-tag-id ref)) + (= (-> current-tag id) (dma-tag-id refs)) + (zero? (-> current-tag id)) + ) + (set! addr (-> current-tag addr)) + (set! qwc (the-as int (-> current-tag qwc))) + (when mode-2 + (let ((v0-10 (disasm-vif-tag (&-> data-2 vif0) 2 stream-2 (= mode-2 'details)))) + (disasm-vif-tag + (the-as (pointer vif-tag) (+ (the-as uint addr) v0-10)) + (the-as int (- (* (the-as uint qwc) 4) (the-as uint (/ v0-10 4)))) + stream-2 + (= mode-2 'details) + ) ) ) - (let ((v1-123 call-depth)) - (cond - ((zero? v1-123) - (set! data-2 (the-as dma-packet ra-1)) - data-2 - ) - ((= v1-123 1) - (set! data-2 (the-as dma-packet ra-2)) - data-2 - ) - (else + (set! data-2 (the-as dma-packet (&-> (the-as (pointer uint64) data-2) 2))) + (if (= (-> current-tag id) (dma-tag-id refe)) (set! end-condition #t) ) - ) ) - (set! call-depth (+ call-depth -1)) - call-depth - ) - ((= (-> current-tag id) (dma-tag-id end)) - (set! addr (&-> (the-as (pointer uint64) data-2) 2)) - (set! qwc (the-as int (-> current-tag qwc))) - (set! end-condition #t) - (if mode-2 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) - (the-as int (+ (* qwc 4) 2)) - stream-2 - (= mode-2 'details) + ((= (-> current-tag id) (dma-tag-id cnt)) + (set! addr (&-> (the-as (pointer uint64) data-2) 2)) + (set! qwc (the-as int (-> current-tag qwc))) + (if mode-2 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) + (the-as int (+ (* (the-as uint qwc) 4) 2)) + stream-2 + (= mode-2 'details) + ) + ) + (set! data-2 (the-as dma-packet (+ (the-as uint data-2) (* (+ (the-as uint qwc) 1) 16)))) + data-2 + ) + ((= (-> current-tag id) (dma-tag-id next)) + (set! addr (&-> (the-as (pointer uint64) data-2) 2)) + (set! qwc (the-as int (-> current-tag qwc))) + (if mode-2 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) + (the-as int (+ (* (the-as uint qwc) 4) 2)) + stream-2 + (= mode-2 'details) + ) + ) + (when (= data-2 (-> current-tag addr)) + (format stream-2 "ERROR: next tag creates infinite loop.~%") + (set! end-condition 'error) + ) + (set! data-2 (the-as dma-packet (-> current-tag addr))) + data-2 + ) + ((= (-> current-tag id) (dma-tag-id call)) + (set! addr (&-> (the-as (pointer uint64) data-2) 2)) + (set! qwc (the-as int (-> current-tag qwc))) + (if mode-2 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) + (the-as int (+ (* (the-as uint qwc) 4) 2)) + stream-2 + (= mode-2 'details) + ) + ) + (set! data-2 (the-as dma-packet (-> current-tag addr))) + (+! call-depth 1) + (cond + ((zero? call-depth) + (set! ra-1 (&+ (the-as (pointer uint64) addr) (the-as uint qwc))) + (the-as (pointer uint64) (the-as (pointer uint64) ra-1)) + ) + (else + (set! ra-2 (&+ (the-as (pointer uint64) addr) (the-as uint qwc))) + (the-as (pointer uint64) (the-as (pointer uint64) ra-2)) ) ) - ) - (else - (format stream-2 "ERROR: Unknown DMA TAG command.~%") - (set! end-condition 'error) + ) + ((= (-> current-tag id) (dma-tag-id ret)) + (set! addr (&-> (the-as (pointer uint64) data-2) 2)) + (set! qwc (the-as int (-> current-tag qwc))) + (if mode-2 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) + (the-as int (+ (* (the-as uint qwc) 4) 2)) + stream-2 + (= mode-2 'details) + ) + ) + (let ((v1-123 call-depth)) + (cond + ((zero? v1-123) + (set! data-2 (the-as dma-packet ra-1)) + data-2 + ) + ((= v1-123 1) + (set! data-2 (the-as dma-packet ra-2)) + data-2 + ) + (else + (set! end-condition #t) + ) + ) + ) + (+! call-depth -1) + call-depth + ) + ((= (-> current-tag id) (dma-tag-id end)) + (set! addr (&-> (the-as (pointer uint64) data-2) 2)) + (set! qwc (the-as int (-> current-tag qwc))) + (set! end-condition #t) + (if mode-2 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) + (the-as int (+ (* (the-as uint qwc) 4) 2)) + stream-2 + (= mode-2 'details) + ) + ) + ) + (else + (format stream-2 "ERROR: Unknown DMA TAG command.~%") + (set! end-condition 'error) + ) ) + (+! total-qwc qwc) + (+! total-tags 1) + (if (and (>= expected-size-2 0) (>= total-tags expected-size-2)) + (set! end-condition #t) + ) ) - (+! total-qwc qwc) - (+! total-tags 1) - (if (and (>= expected-size-2 0) (>= total-tags expected-size-2)) - (set! end-condition #t) - ) ) (when (or verbose-2 (= end-condition 'error)) (format stream-2 "NOTICE: Total tags: ~d~%" total-tags) diff --git a/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc b/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc index 54356c53c8..57dfa0757a 100644 --- a/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc +++ b/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc @@ -360,17 +360,6 @@ ;; INFO: Return type mismatch object vs none. ;; ERROR: Failed load: (set! a2-12 (l.hu (+ a2-11 68))) at op 283 (defun-debug draw-instance-info ((arg0 string)) - (local-vars - (sv-16 uint) - (sv-32 uint) - (sv-48 uint) - (sv-64 int) - (sv-80 int) - (sv-96 int) - (sv-112 int) - (sv-128 int) - (sv-144 int) - ) (when (and *display-instance-info* *edit-instance*) (let ((s5-0 (find-instance-by-name *edit-instance*))) (when s5-0 @@ -447,30 +436,32 @@ (s2-1 (+ (-> s5-0 count 1) (-> s5-0 count 2))) ) (dotimes (s0-0 (-> (the-as drawable-group s1-1) length)) - (set! sv-16 (shrub-num-tris (the-as shrubbery (+ (+ (* s0-0 32) 32) (the-as int s1-1))))) - (set! sv-32 (-> (the-as prototype-shrubbery (+ (the-as uint s1-1) (* s0-0 32))) data 0 header data 2)) - (set! sv-48 (-> (the-as prototype-shrubbery (+ (the-as uint s1-1) (* s0-0 32))) data 0 header data 0)) - (format - arg0 - "~5D ~4D ~5D ~6f ~D~%" - s0-0 - sv-16 - sv-32 - (/ (* 2.0 (the float sv-16)) (the float (- sv-32 sv-16))) - sv-48 - ) - (+! s3-1 sv-16) - (+! s4-2 sv-32) - (set! f30-0 - (+ 29.0 - (* 5.5 (the float (- sv-32 sv-16))) - (* 22.0 (the float sv-48)) - (* 8.0 (the float sv-32)) - (* 53.0 (the float (/ (+ s2-1 9) (the-as uint 10)))) - (* (the float s2-1) (+ 15.0 (* 5.0 (the float sv-48)) (* 13.5 (the float sv-32)))) - f30-0 - ) + (let ((sv-16 (shrub-num-tris (the-as shrubbery (+ (+ (* s0-0 32) 32) (the-as int s1-1))))) + (sv-32 (-> (the-as prototype-shrubbery (+ (the-as uint s1-1) (* s0-0 32))) data 0 header data 2)) + (sv-48 (-> (the-as prototype-shrubbery (+ (the-as uint s1-1) (* s0-0 32))) data 0 header data 0)) ) + (format + arg0 + "~5D ~4D ~5D ~6f ~D~%" + s0-0 + sv-16 + sv-32 + (/ (* 2.0 (the float sv-16)) (the float (- sv-32 sv-16))) + sv-48 + ) + (+! s3-1 sv-16) + (+! s4-2 sv-32) + (set! f30-0 + (+ 29.0 + (* 5.5 (the float (- sv-32 sv-16))) + (* 22.0 (the float sv-48)) + (* 8.0 (the float sv-32)) + (* 53.0 (the float (/ (+ s2-1 9) (the-as uint 10)))) + (* (the float s2-1) (+ 15.0 (* 5.0 (the float sv-48)) (* 13.5 (the float sv-32)))) + f30-0 + ) + ) + ) ) (format arg0 @@ -485,49 +476,46 @@ ) ) ((= s2-0 instance-tie) - (set! sv-144 0) - (let ((s1-2 0) + (let ((sv-144 0) + (s1-2 0) (s0-1 0) (s2-2 0) ) (format arg0 "~%level visible frags tris dverts strlen tex ttris~%") - (set! sv-64 1) - (set! sv-80 3) - (while (>= sv-80 sv-64) - (let ((v1-65 (-> s5-0 geometry sv-64))) - (set! sv-96 0) - (set! sv-112 0) - (set! sv-128 0) - (dotimes (a0-23 (-> (the-as prototype-tie v1-65) length)) - (set! sv-96 (+ sv-96 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 68)))) - (set! sv-112 (+ sv-112 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 70)))) - (set! sv-128 (+ sv-128 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 60)))) + (let ((sv-64 1) + (sv-80 3) ) - (set! sv-144 (+ sv-144 (-> s5-0 count sv-64))) - (format arg0 "~5D ~7D ~5D ~5D" sv-64 (-> s5-0 count sv-64) (-> (the-as prototype-tie v1-65) length) sv-96) - ) - (format - arg0 - " ~5D ~6f ~3D ~5D~%" - sv-112 - (/ (* 2.0 (the float sv-96)) (the float (- sv-112 sv-96))) - sv-128 - (* (the-as uint sv-96) (-> s5-0 count sv-64)) - ) - (+! s1-2 (* (the-as uint sv-96) (-> s5-0 count sv-64))) - (+! s0-1 (* (the-as uint sv-112) (-> s5-0 count sv-64))) - (+! s3-1 sv-96) - (+! s4-2 sv-112) - (+! s2-2 sv-128) - (set! sv-64 (+ sv-64 1)) - ) - (let ((t9-18 format) - (a0-39 arg0) - (a1-22 "total ~7D/~3D ~5D") - (a3-11 (-> s5-0 in-level)) + (while (>= sv-80 sv-64) + (let ((v1-65 (-> s5-0 geometry sv-64)) + (sv-96 0) + (sv-112 0) + (sv-128 0) + ) + (dotimes (a0-23 (-> (the-as prototype-tie v1-65) length)) + (+! sv-96 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 68))) + (+! sv-112 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 70))) + (+! sv-128 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 60))) + ) + (+! sv-144 (-> s5-0 count sv-64)) + (format arg0 "~5D ~7D ~5D ~5D" sv-64 (-> s5-0 count sv-64) (-> (the-as prototype-tie v1-65) length) sv-96) + (format + arg0 + " ~5D ~6f ~3D ~5D~%" + sv-112 + (/ (* 2.0 (the float sv-96)) (the float (- sv-112 sv-96))) + sv-128 + (* (the-as uint sv-96) (-> s5-0 count sv-64)) + ) + (+! s1-2 (* (the-as uint sv-96) (-> s5-0 count sv-64))) + (+! s0-1 (* (the-as uint sv-112) (-> s5-0 count sv-64))) + (+! s3-1 sv-96) + (+! s4-2 sv-112) + (+! s2-2 sv-128) ) - (t9-18 a0-39 a1-22 sv-144 a3-11 s3-1) + (+! sv-64 1) + ) ) + (format arg0 "total ~7D/~3D ~5D" sv-144 (-> s5-0 in-level) s3-1) (format arg0 " ~5D ~6f ~3D ~5D~%" @@ -551,7 +539,7 @@ ;; INFO: Return type mismatch int vs none. ;; WARN: Function dma-add-process-drawable has a return type of none, but the expression builder found a return statement. (defun dma-add-process-drawable ((arg0 process-drawable) (arg1 draw-control) (arg2 symbol) (arg3 dma-buffer)) - (local-vars (v1-37 float) (sv-16 process-drawable)) + (local-vars (v1-37 float)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -576,243 +564,244 @@ (vf5 :class vf) ) (init-vf0-vector) - (set! sv-16 arg0) - (logclear! (-> arg1 status) (draw-status was-drawn)) - (when (not (logtest? (-> arg1 status) (draw-status hidden no-anim no-skeleton-update))) - (let ((s4-0 (-> (the-as terrain-context #x70000000) work foreground joint-work temp-mtx vector 2)) - (vu-lgt - (the-as vu-lights (-> (the-as terrain-context #x70000000) work foreground joint-work temp-mtx vector 3)) - ) - (tod *time-of-day-context*) - ) - (.lvf vf16 (&-> arg1 origin quad)) - (.lvf vf17 (&-> arg1 bounds quad)) - (.mul.x.vf.w vf16 vf16 vf0) - (.add.vf vf16 vf16 vf17) - (.svf (&-> s4-0 quad) vf16) - (.lvf vf28 (&-> arg1 color-mult quad)) - (.lvf vf29 (&-> arg1 color-emissive quad)) - (when (sphere-in-view-frustum? (the-as sphere s4-0)) - (case (-> arg1 global-effect) - (((draw-effect title)) - (when (not (-> tod title-updated)) - (set! (-> tod title-updated) #t) - (let ((s0-0 (-> *math-camera* inv-camera-rot)) - (a1-1 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (set-vector! a1-1 0.612 0.5 -0.612 0.0) - (set-vector! s1-0 -0.696 0.174 0.696 0.0) - (vector-matrix*! (the-as vector (-> tod title-light-group)) a1-1 s0-0) - (vector-matrix*! (-> tod title-light-group dir1 direction) s1-0 s0-0) - ) - (set-vector! (-> *time-of-day-context* current-shadow) 0.612 -0.5 -0.612 1.0) - ) - (vu-lights<-light-group! vu-lgt (-> tod title-light-group)) - ) - (else - (let ((interp (-> arg1 secondary-interp)) - (cur-interp (-> arg1 current-secondary-interp)) - (shadow-msk (-> arg1 shadow-mask)) - (lev-idx (-> arg1 level-index)) - (lgt (-> tod light-group (-> *target* draw light-index))) - (cur-lgt (new 'stack-no-clear 'light-group)) - ) - (cond - ((= (-> arg1 light-index) 255) - ) - ((= lev-idx 2) - (set! lgt (-> tod light-group (-> arg1 light-index))) - ) - (else - (set! lgt (-> tod moods lev-idx light-group (-> arg1 light-index))) - ) - ) - (when (not (or (= lev-idx 2) (zero? shadow-msk))) - (let* ((lgt-msk-0 (-> tod light-masks-0 lev-idx)) - (lgt-msk-1 (-> tod light-masks-1 lev-idx)) - (lgt-interp (-> tod light-interp lev-idx)) - (a0-13 (logand lgt-msk-0 shadow-msk)) - (v1-18 (logand lgt-msk-1 shadow-msk)) - ) - (cond - ((and (zero? a0-13) (zero? v1-18)) - ) - (else - (set! interp (cond - ((and (nonzero? a0-13) (nonzero? v1-18)) - 1.0 - ) - ((zero? a0-13) - (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) - (set! lgt cur-lgt) - (set! (-> lgt dir1 levels x) 0.0) - lgt-interp - ) - (else - (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) - (set! lgt cur-lgt) - (set! (-> lgt dir0 levels x) 0.0) - (- 1.0 lgt-interp) - ) - ) - ) - ) - ) - ) - ) - (if *teleport* - (set! cur-interp interp) - ) - (when (not (or (paused?) (= interp cur-interp))) - (let ((f0-15 (- cur-interp interp))) - (set! cur-interp (cond - ((< (fabs f0-15) 0.2) - interp - ) - ((< f0-15 0.0) - (+ 0.2 cur-interp) - ) - (else - (+ -0.2 cur-interp) - ) - ) - ) - ) - (set! (-> arg1 current-secondary-interp) cur-interp) - ) - (cond - ((= cur-interp 0.0) - (vu-lights<-light-group! vu-lgt lgt) - ) - (else - (if (!= lgt cur-lgt) - (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) - ) - (let ((f0-20 (- 1.0 cur-interp))) - (set! (-> cur-lgt dir0 levels x) (* (-> cur-lgt dir0 levels x) f0-20)) - (set! (-> cur-lgt dir0 levels y) (* (-> cur-lgt dir0 levels y) f0-20)) - (set! (-> cur-lgt dir1 levels x) (* (-> cur-lgt dir1 levels x) f0-20)) - (set! (-> cur-lgt dir1 levels y) (* (-> cur-lgt dir1 levels y) f0-20)) - (set! (-> cur-lgt dir2 levels x) (* (-> cur-lgt dir2 levels x) f0-20)) - (set! (-> cur-lgt dir2 levels y) (* (-> cur-lgt dir2 levels y) f0-20)) - ) - (vu-lights<-light-group! vu-lgt cur-lgt) - ) - ) + (let ((sv-16 arg0)) + (logclear! (-> arg1 status) (draw-status was-drawn)) + (when (not (logtest? (-> arg1 status) (draw-status hidden no-anim no-skeleton-update))) + (let ((s4-0 (-> (the-as terrain-context #x70000000) work foreground joint-work temp-mtx vector 2)) + (vu-lgt + (the-as vu-lights (-> (the-as terrain-context #x70000000) work foreground joint-work temp-mtx vector 3)) ) - (.lvf vf2 (&-> vu-lgt color 0 quad)) - (.lvf vf3 (&-> vu-lgt color 1 quad)) - (.lvf vf4 (&-> vu-lgt color 2 quad)) - (.lvf vf5 (&-> vu-lgt ambient quad)) - (.mul.vf vf5 vf5 vf28) - (.mul.vf vf2 vf2 vf28) - (.mul.vf vf3 vf3 vf28) - (.mul.vf vf4 vf4 vf28) - (.add.vf vf5 vf5 vf29) - (.svf (&-> vu-lgt color 0 quad) vf2) - (.svf (&-> vu-lgt color 1 quad) vf3) - (.svf (&-> vu-lgt color 2 quad) vf4) - (.svf (&-> vu-lgt ambient quad) vf5) - (.mov v1-37 vf5) + (tod *time-of-day-context*) ) - ) - (if *display-lights* - (add-debug-lights #t (bucket-id debug) (-> tod light-group 0 lights) (-> arg1 origin)) - ) - (let ((at-0 *math-camera*)) - (.lvf vf16 (&-> at-0 plane 0 quad)) - (.lvf vf17 (&-> at-0 plane 1 quad)) - (.lvf vf18 (&-> at-0 plane 2 quad)) - (.lvf vf19 (&-> at-0 plane 3 quad)) - (.lvf vf20 (&-> at-0 guard-plane 0 quad)) - (.lvf vf21 (&-> at-0 guard-plane 1 quad)) - (.lvf vf22 (&-> at-0 guard-plane 2 quad)) - (.lvf vf23 (&-> at-0 guard-plane 3 quad)) - (.lvf vf24 (&-> at-0 camera-rot vector 0 quad)) - (.lvf vf25 (&-> at-0 camera-rot vector 1 quad)) - (.lvf vf26 (&-> at-0 camera-rot vector 2 quad)) - (.lvf vf27 (&-> at-0 camera-rot vector 3 quad)) - ) - (let ((v1-42 (-> (the-as terrain-context #x70000000) work foreground joint-work joint-stack data 1 vector 1))) - (.lvf vf15 (&-> s4-0 quad)) - (.mul.w.vf acc vf27 vf0) - (.add.mul.x.vf acc vf24 vf15 acc) - (.add.mul.y.vf acc vf25 vf15 acc) - (.add.mul.z.vf.xyz vf15 vf26 vf15 acc) - (.mul.vf vf28 vf15 vf15) - (.max.w.vf vf29 vf0 vf0) - (.add.y.vf acc vf28 vf28) - (.add.mul.z.vf.x vf28 vf29 vf28 acc) - (.sqrt.vf Q vf28 :ftf #b0) - (.sub.w.vf.w vf28 vf0 vf15) - (.wait.vf) - (.add.vf.w vf15 vf28 Q) - (.svf (&-> v1-42 quad) vf15) - (when (< 0.0 (+ (-> v1-42 z) (-> arg1 bounds w))) - (let ((lod-to-use 0)) - (let ((cam-dist (-> v1-42 w))) - (when (nonzero? (-> arg1 lod-set max-lod)) - (cond - ((>= (-> arg1 force-lod) 0) - (set! lod-to-use (-> arg1 force-lod)) - (if (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist) - (return #f) - ) + (.lvf vf16 (&-> arg1 origin quad)) + (.lvf vf17 (&-> arg1 bounds quad)) + (.mul.x.vf.w vf16 vf16 vf0) + (.add.vf vf16 vf16 vf17) + (.svf (&-> s4-0 quad) vf16) + (.lvf vf28 (&-> arg1 color-mult quad)) + (.lvf vf29 (&-> arg1 color-emissive quad)) + (when (sphere-in-view-frustum? (the-as sphere s4-0)) + (case (-> arg1 global-effect) + (((draw-effect title)) + (when (not (-> tod title-updated)) + (set! (-> tod title-updated) #t) + (let ((s0-0 (-> *math-camera* inv-camera-rot)) + (a1-1 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) ) - (else - (while (and (< lod-to-use (-> arg1 lod-set max-lod)) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist)) - (+! lod-to-use 1) + (set-vector! a1-1 0.612 0.5 -0.612 0.0) + (set-vector! s1-0 -0.696 0.174 0.696 0.0) + (vector-matrix*! (the-as vector (-> tod title-light-group)) a1-1 s0-0) + (vector-matrix*! (-> tod title-light-group dir1 direction) s1-0 s0-0) + ) + (set-vector! (-> *time-of-day-context* current-shadow) 0.612 -0.5 -0.612 1.0) + ) + (vu-lights<-light-group! vu-lgt (-> tod title-light-group)) + ) + (else + (let ((interp (-> arg1 secondary-interp)) + (cur-interp (-> arg1 current-secondary-interp)) + (shadow-msk (-> arg1 shadow-mask)) + (lev-idx (-> arg1 level-index)) + (lgt (-> tod light-group (-> *target* draw light-index))) + (cur-lgt (new 'stack-no-clear 'light-group)) + ) + (cond + ((= (-> arg1 light-index) 255) + ) + ((= lev-idx 2) + (set! lgt (-> tod light-group (-> arg1 light-index))) + ) + (else + (set! lgt (-> tod moods lev-idx light-group (-> arg1 light-index))) + ) + ) + (when (not (or (= lev-idx 2) (zero? shadow-msk))) + (let* ((lgt-msk-0 (-> tod light-masks-0 lev-idx)) + (lgt-msk-1 (-> tod light-masks-1 lev-idx)) + (lgt-interp (-> tod light-interp lev-idx)) + (a0-13 (logand lgt-msk-0 shadow-msk)) + (v1-18 (logand lgt-msk-1 shadow-msk)) + ) + (cond + ((and (zero? a0-13) (zero? v1-18)) + ) + (else + (set! interp (cond + ((and (nonzero? a0-13) (nonzero? v1-18)) + 1.0 + ) + ((zero? a0-13) + (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) + (set! lgt cur-lgt) + (set! (-> lgt dir1 levels x) 0.0) + lgt-interp + ) + (else + (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) + (set! lgt cur-lgt) + (set! (-> lgt dir0 levels x) 0.0) + (- 1.0 lgt-interp) + ) + ) + ) ) ) ) ) - (if (and (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0)) - (return #f) + (if *teleport* + (set! cur-interp interp) ) - (let ((v1-64 (-> arg1 sink-group level)) - (a0-26 (+ (-> arg1 sink-group merc-sink foreground-texture-page) 6)) - ) - (when (not (logtest? (-> arg1 status) (draw-status do-not-check-distance))) - (if (< cam-dist (-> v1-64 closest-object a0-26)) - (set! (-> v1-64 closest-object a0-26) cam-dist) + (when (not (or (paused?) (= interp cur-interp))) + (let ((f0-15 (- cur-interp interp))) + (set! cur-interp (cond + ((< (fabs f0-15) 0.2) + interp + ) + ((< f0-15 0.0) + (+ 0.2 cur-interp) + ) + (else + (+ -0.2 cur-interp) + ) + ) + ) + ) + (set! (-> arg1 current-secondary-interp) cur-interp) + ) + (cond + ((= cur-interp 0.0) + (vu-lights<-light-group! vu-lgt lgt) + ) + (else + (if (!= lgt cur-lgt) + (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) ) - (when (and (!= a0-26 6) (!= (-> arg1 level-index) 2)) - (let ((a1-45 (cond - ((< 102400.0 cam-dist) - (-> arg1 mgeo header masks 0) - ) - ((< 81920.0 cam-dist) - (-> arg1 mgeo header masks 1) - ) - (else - (-> arg1 mgeo header masks 2) + (let ((f0-20 (- 1.0 cur-interp))) + (set! (-> cur-lgt dir0 levels x) (* (-> cur-lgt dir0 levels x) f0-20)) + (set! (-> cur-lgt dir0 levels y) (* (-> cur-lgt dir0 levels y) f0-20)) + (set! (-> cur-lgt dir1 levels x) (* (-> cur-lgt dir1 levels x) f0-20)) + (set! (-> cur-lgt dir1 levels y) (* (-> cur-lgt dir1 levels y) f0-20)) + (set! (-> cur-lgt dir2 levels x) (* (-> cur-lgt dir2 levels x) f0-20)) + (set! (-> cur-lgt dir2 levels y) (* (-> cur-lgt dir2 levels y) f0-20)) + ) + (vu-lights<-light-group! vu-lgt cur-lgt) + ) + ) + ) + (.lvf vf2 (&-> vu-lgt color 0 quad)) + (.lvf vf3 (&-> vu-lgt color 1 quad)) + (.lvf vf4 (&-> vu-lgt color 2 quad)) + (.lvf vf5 (&-> vu-lgt ambient quad)) + (.mul.vf vf5 vf5 vf28) + (.mul.vf vf2 vf2 vf28) + (.mul.vf vf3 vf3 vf28) + (.mul.vf vf4 vf4 vf28) + (.add.vf vf5 vf5 vf29) + (.svf (&-> vu-lgt color 0 quad) vf2) + (.svf (&-> vu-lgt color 1 quad) vf3) + (.svf (&-> vu-lgt color 2 quad) vf4) + (.svf (&-> vu-lgt ambient quad) vf5) + (.mov v1-37 vf5) + ) + ) + (if *display-lights* + (add-debug-lights #t (bucket-id debug) (-> tod light-group 0 lights) (-> arg1 origin)) + ) + (let ((at-0 *math-camera*)) + (.lvf vf16 (&-> at-0 plane 0 quad)) + (.lvf vf17 (&-> at-0 plane 1 quad)) + (.lvf vf18 (&-> at-0 plane 2 quad)) + (.lvf vf19 (&-> at-0 plane 3 quad)) + (.lvf vf20 (&-> at-0 guard-plane 0 quad)) + (.lvf vf21 (&-> at-0 guard-plane 1 quad)) + (.lvf vf22 (&-> at-0 guard-plane 2 quad)) + (.lvf vf23 (&-> at-0 guard-plane 3 quad)) + (.lvf vf24 (&-> at-0 camera-rot vector 0 quad)) + (.lvf vf25 (&-> at-0 camera-rot vector 1 quad)) + (.lvf vf26 (&-> at-0 camera-rot vector 2 quad)) + (.lvf vf27 (&-> at-0 camera-rot vector 3 quad)) + ) + (let ((v1-42 (-> (the-as terrain-context #x70000000) work foreground joint-work joint-stack data 1 vector 1))) + (.lvf vf15 (&-> s4-0 quad)) + (.mul.w.vf acc vf27 vf0) + (.add.mul.x.vf acc vf24 vf15 acc) + (.add.mul.y.vf acc vf25 vf15 acc) + (.add.mul.z.vf.xyz vf15 vf26 vf15 acc) + (.mul.vf vf28 vf15 vf15) + (.max.w.vf vf29 vf0 vf0) + (.add.y.vf acc vf28 vf28) + (.add.mul.z.vf.x vf28 vf29 vf28 acc) + (.sqrt.vf Q vf28 :ftf #b0) + (.sub.w.vf.w vf28 vf0 vf15) + (.wait.vf) + (.add.vf.w vf15 vf28 Q) + (.svf (&-> v1-42 quad) vf15) + (when (< 0.0 (+ (-> v1-42 z) (-> arg1 bounds w))) + (let ((lod-to-use 0)) + (let ((cam-dist (-> v1-42 w))) + (when (nonzero? (-> arg1 lod-set max-lod)) + (cond + ((>= (-> arg1 force-lod) 0) + (set! lod-to-use (-> arg1 force-lod)) + (if (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist) + (return #f) + ) + ) + (else + (while (and (< lod-to-use (-> arg1 lod-set max-lod)) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist)) + (+! lod-to-use 1) + ) + ) + ) + ) + (if (and (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0)) + (return #f) + ) + (let ((v1-64 (-> arg1 sink-group level)) + (a0-26 (+ (-> arg1 sink-group merc-sink foreground-texture-page) 6)) + ) + (when (not (logtest? (-> arg1 status) (draw-status do-not-check-distance))) + (if (< cam-dist (-> v1-64 closest-object a0-26)) + (set! (-> v1-64 closest-object a0-26) cam-dist) + ) + (when (and (!= a0-26 6) (!= (-> arg1 level-index) 2)) + (let ((a1-45 (cond + ((< 102400.0 cam-dist) + (-> arg1 mgeo header masks 0) + ) + ((< 81920.0 cam-dist) + (-> arg1 mgeo header masks 1) + ) + (else + (-> arg1 mgeo header masks 2) + ) ) ) - ) - ) - (logior! (-> v1-64 texture-mask a0-26) a1-45) + ) + (logior! (-> v1-64 texture-mask a0-26) a1-45) + ) ) ) ) + (if (or (guard-band-cull s4-0) (< cam-dist (* 1.2 (-> *math-camera* d)))) + (logior! (-> arg1 status) (draw-status needs-clip)) + (logclear! (-> arg1 status) (draw-status needs-clip)) + ) + (logior! (-> arg1 status) (draw-status was-drawn)) + (if (logtest? (-> arg1 status) (draw-status skip-bones)) + (return #f) + ) + (draw-bones arg1 arg3 cam-dist) ) - (if (or (guard-band-cull s4-0) (< cam-dist (* 1.2 (-> *math-camera* d)))) - (logior! (-> arg1 status) (draw-status needs-clip)) - (logclear! (-> arg1 status) (draw-status needs-clip)) + (when (and (< lod-to-use (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-status has-joint-channels))) + (let ((v1-82 *matrix-engine*)) + (set! (-> v1-82 (-> v1-82 length)) (process->handle sv-16)) + (+! (-> v1-82 length) 1) ) - (logior! (-> arg1 status) (draw-status was-drawn)) - (if (logtest? (-> arg1 status) (draw-status skip-bones)) - (return #f) - ) - (draw-bones arg1 arg3 cam-dist) - ) - (when (and (< lod-to-use (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-status has-joint-channels))) - (let ((v1-82 *matrix-engine*)) - (set! (-> v1-82 (-> v1-82 length)) (process->handle sv-16)) - (+! (-> v1-82 length) 1) ) + (lod-set! arg1 lod-to-use) ) - (lod-set! arg1 lod-to-use) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/entity/actor-link-h_REF.gc b/test/decompiler/reference/jak1/engine/entity/actor-link-h_REF.gc index 812d4621fb..f8ac7838fa 100644 --- a/test/decompiler/reference/jak1/engine/entity/actor-link-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/entity/actor-link-h_REF.gc @@ -5,9 +5,9 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch entity vs entity-actor. (defun entity-actor-lookup ((lump res-lump) (name symbol) (idx int)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data lump name (pointer uint32) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data lump name (pointer uint32) :tag-ptr (& sv-16))) + ) (the-as entity-actor (when (and v1-1 (< idx (the-as int (-> sv-16 elt-count)))) @@ -24,12 +24,12 @@ ;; WARN: Check prologue - tricky store of r0 ;; INFO: Used lq/sq (defun entity-actor-count ((res res-lump) (name symbol)) - (local-vars (tag res-tag)) - (set! tag (new 'static 'res-tag)) - (if (res-lump-data res name pointer :tag-ptr (& tag)) - (the-as int (-> tag elt-count)) - 0 - ) + (let ((tag (new 'static 'res-tag))) + (if (res-lump-data res name pointer :tag-ptr (& tag)) + (the-as int (-> tag elt-count)) + 0 + ) + ) ) ;; definition of type actor-link-info diff --git a/test/decompiler/reference/jak1/engine/entity/ambient_REF.gc b/test/decompiler/reference/jak1/engine/entity/ambient_REF.gc index 64a6491388..8bba78d051 100644 --- a/test/decompiler/reference/jak1/engine/entity/ambient_REF.gc +++ b/test/decompiler/reference/jak1/engine/entity/ambient_REF.gc @@ -169,24 +169,23 @@ ;; definition for function level-hint-task-process ;; INFO: Used lq/sq (defun level-hint-task-process ((arg0 entity) (arg1 uint128) (arg2 string)) - (local-vars (sv-16 res-tag)) (let ((gp-0 (res-lump-value arg0 'text-id int :default arg1)) (s5-0 0) ) (cond ((can-hint-be-played? (the-as text-id gp-0) arg0 arg2) - (set! sv-16 (new 'static 'res-tag)) - (let ((s4-1 ((method-of-type res-lump get-property-data) - arg0 - 'cmds - 'exact - -1000000000.0 - (the-as pointer #f) - (& sv-16) - *res-static-buf* + (let* ((sv-16 (new 'static 'res-tag)) + (s4-1 ((method-of-type res-lump get-property-data) + arg0 + 'cmds + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) ) - ) - ) + ) (when s4-1 (while (and (>= s5-0 0) (< s5-0 (the-as int (-> sv-16 elt-count)))) (set! s5-0 (level-hint-process-cmd (the-as (pointer int32) s4-1) s5-0 (the-as int (-> sv-16 elt-count)))) @@ -689,7 +688,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun ambient-type-sound ((arg0 drawable-ambient) (arg1 vector)) - (local-vars (sv-16 string) (sv-112 res-tag)) (let* ((s5-0 (-> arg0 ambient)) (s4-0 (-> s5-0 ambient-data user-uint64 0)) ) @@ -704,41 +702,41 @@ ) ) (when (< (the-as uint (- (current-time) (the-as int s4-0))) (the-as uint 300)) - (let ((f30-0 (the float (rand-vu-int-count (the-as int (-> s5-0 ambient-data user-float 2)))))) - (set! sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0))) - (let ((s4-2 (new 'stack 'sound-spec))) - (set! (-> s4-2 sound-name) (string->sound-name sv-16)) - (logior! (-> s4-2 mask) (sound-mask volume)) - (set! (-> s4-2 volume) 1024) - (logior! (-> s4-2 mask) (sound-mask bend)) - (set! (-> s4-2 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) - (set! sv-112 (new 'static 'res-tag)) - (let ((a1-7 ((method-of-type res-lump get-property-data) - s5-0 - 'effect-param - 'exact - f30-0 - (the-as pointer #f) - (& sv-112) - *res-static-buf* - ) + (let* ((f30-0 (the float (rand-vu-int-count (the-as int (-> s5-0 ambient-data user-float 2))))) + (sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0))) + (s4-2 (new 'stack 'sound-spec)) + ) + (set! (-> s4-2 sound-name) (string->sound-name sv-16)) + (logior! (-> s4-2 mask) (sound-mask volume)) + (set! (-> s4-2 volume) 1024) + (logior! (-> s4-2 mask) (sound-mask bend)) + (set! (-> s4-2 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) + (let* ((sv-112 (new 'static 'res-tag)) + (a1-7 ((method-of-type res-lump get-property-data) + s5-0 + 'effect-param + 'exact + f30-0 + (the-as pointer #f) + (& sv-112) + *res-static-buf* ) - ) - (if a1-7 - (effect-param->sound-spec s4-2 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count))) - ) - ) - (when *debug-effect-control* - (format #t "(~5D) effect sound ~A ~S " (current-time) (res-lump-struct s5-0 'name structure) sv-16) - (format - #t - "volume: ~f pitch-mod: ~f~%" - (* 0.09765625 (the float (-> s4-2 volume))) - (* 0.000656168 (the float (-> s4-2 pitch-mod))) + ) + ) + (if a1-7 + (effect-param->sound-spec s4-2 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count))) ) - ) - (sound-play-by-spec s4-2 (new-sound-id) (-> arg0 bsphere)) ) + (when *debug-effect-control* + (format #t "(~5D) effect sound ~A ~S " (current-time) (res-lump-struct s5-0 'name structure) sv-16) + (format + #t + "volume: ~f pitch-mod: ~f~%" + (* 0.09765625 (the float (-> s4-2 volume))) + (* 0.000656168 (the float (-> s4-2 pitch-mod))) + ) + ) + (sound-play-by-spec s4-2 (new-sound-id) (-> arg0 bsphere)) ) ) ) @@ -1099,7 +1097,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod draw-debug ((this entity-ambient)) - (local-vars (sv-16 uint128)) (let ((gp-0 (-> this trans)) (s5-0 (res-lump-struct this 'type symbol)) (s3-0 #f) @@ -1120,8 +1117,8 @@ ) ((= s5-0 'hint) (when *display-ambient-hint-marks* - (set! sv-16 (res-lump-value this 'text-id uint128)) - (let ((s3-2 add-debug-text-3d) + (let ((sv-16 (res-lump-value this 'text-id uint128)) + (s3-2 add-debug-text-3d) (s2-1 #t) (s1-1 68) ) diff --git a/test/decompiler/reference/jak1/engine/entity/entity_REF.gc b/test/decompiler/reference/jak1/engine/entity/entity_REF.gc index 1de851b463..ddd8292273 100644 --- a/test/decompiler/reference/jak1/engine/entity/entity_REF.gc +++ b/test/decompiler/reference/jak1/engine/entity/entity_REF.gc @@ -611,12 +611,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod update-vis-volumes ((this level-group)) - (local-vars - (v1-10 symbol) - (sv-16 process) - (sv-32 (function process-drawable vector vector none)) - (sv-48 process-tree) - ) + (local-vars (v1-10 symbol) (sv-16 process)) (dotimes (s5-0 (-> this length)) (let ((v1-3 (-> this level s5-0))) (when (= (-> v1-3 status) 'active) @@ -639,16 +634,17 @@ (update-actor-vis-box (the-as process-drawable sv-16) s2-0 s1-0) (let ((s0-2 (-> sv-16 child))) (while s0-2 - (set! sv-32 update-actor-vis-box) - (set! sv-48 (-> s0-2 0)) - (let ((a0-7 (if (and (nonzero? sv-48) (type-type? (-> sv-48 type) process-drawable)) - sv-48 - ) - ) - (a1-5 s2-0) - (a2-2 s1-0) + (let ((sv-32 update-actor-vis-box) + (sv-48 (-> s0-2 0)) ) - (sv-32 (the-as process-drawable a0-7) a1-5 a2-2) + (sv-32 + (the-as process-drawable (if (and (nonzero? sv-48) (type-type? (-> sv-48 type) process-drawable)) + sv-48 + ) + ) + s2-0 + s1-0 + ) ) (set! s0-2 (-> s0-2 0 brother)) ) @@ -668,27 +664,23 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod update-vis-volumes-from-nav-mesh ((this level-group)) - (local-vars (sv-16 entity) (sv-32 entity)) (dotimes (s5-0 (-> this length)) (let ((v1-3 (-> this level s5-0))) (when (= (-> v1-3 status) 'active) (let ((s4-0 (-> v1-3 bsp level entity))) (dotimes (s3-0 (-> s4-0 length)) - (set! sv-32 (-> s4-0 data s3-0 entity)) - (let* ((v0-0 (res-lump-data sv-32 'visvol (inline-array vector))) + (let* ((sv-32 (-> s4-0 data s3-0 entity)) + (v0-0 (res-lump-data sv-32 'visvol (inline-array vector))) (s1-0 (-> v0-0 0)) (s2-0 (-> v0-0 1)) ) - (let ((s0-0 (-> sv-32 extra trans))) - (set! sv-16 sv-32) - (let* ((t9-1 entity-actor-lookup) - (a1-2 'nav-mesh-actor) - (a2-1 0) - (v0-1 (t9-1 sv-32 a1-2 a2-1)) - ) + (let ((s0-0 (-> sv-32 extra trans)) + (sv-16 sv-32) + ) + (let ((v0-1 (entity-actor-lookup sv-32 'nav-mesh-actor 0))) (when v0-1 (set! sv-16 v0-1) - (the-as entity-actor sv-16) + (the-as entity-actor (the-as entity-actor sv-16)) ) ) (cond @@ -725,47 +717,32 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod print-volume-sizes ((this level-group)) - (local-vars (sv-16 type) (sv-32 (function _varargs_ object)) (sv-48 symbol) (sv-64 string) (sv-80 entity)) + (local-vars (sv-16 type)) (dotimes (s5-0 (-> this length)) (let ((v1-3 (-> this level s5-0))) (when (= (-> v1-3 status) 'active) (let ((s4-0 (-> v1-3 bsp level entity))) (dotimes (s3-0 (-> s4-0 length)) - (set! sv-80 (-> s4-0 data s3-0 entity)) - (let ((s1-0 (the-as object (res-lump-data sv-80 'visvol pointer))) - (f30-0 (res-lump-float sv-80 'vis-dist :default 409600.0)) - (s2-0 (-> sv-80 extra trans)) - ) - (if (type-type? (-> sv-80 type) entity-actor) - (set! sv-16 (-> (the-as entity-actor sv-80) etype)) - (set! sv-16 (the-as type #f)) - ) + (let* ((sv-80 (-> s4-0 data s3-0 entity)) + (s1-0 (the-as object (res-lump-data sv-80 'visvol pointer))) + (f30-0 (res-lump-float sv-80 'vis-dist :default 409600.0)) + (s2-0 (-> sv-80 extra trans)) + ) + (set! sv-16 (cond + ((type-type? (-> sv-80 type) entity-actor) + (set! sv-16 (-> (the-as entity-actor sv-80) etype)) + sv-16 + ) + (else + (the-as type #f) + ) + ) + ) (let ((s0-0 (-> (the-as (inline-array vector) s1-0) 0)) (s1-1 (-> (the-as (inline-array vector) s1-0) 1)) ) - (when (not (or (name= sv-16 money) (or (name= sv-16 crate) (name= sv-16 fuel-cell) (let ((t9-6 name=) - (a1-7 springbox) - ) - (t9-6 sv-16 a1-7) - ) - ) - ) - ) - (set! sv-32 format) - (set! sv-48 #t) - (set! sv-64 "actor-vis ~S ~6,,1M ") - (let* ((t9-7 (method-of-type res-lump get-property-struct)) - (a1-8 'name) - (a2-2 'interp) - (a3-2 -1000000000.0) - (t0-2 #f) - (t1-2 #f) - (t2-2 *res-static-buf*) - (a2-3 (t9-7 sv-80 a1-8 a2-2 a3-2 t0-2 (the-as (pointer res-tag) t1-2) t2-2)) - (a3-3 f30-0) - ) - (sv-32 sv-48 sv-64 a2-3 a3-3) - ) + (when (not (or (name= sv-16 money) (or (name= sv-16 crate) (name= sv-16 fuel-cell) (name= sv-16 springbox)))) + (format #t "actor-vis ~S ~6,,1M " (res-lump-struct sv-80 'name structure) f30-0) (format #t "~6,,1M ~6,,1M ~6,,1M ~6,,1M ~6,,1M ~6,,1M~%" @@ -813,25 +790,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod debug-draw-actors ((this level-group) (arg0 symbol)) - (local-vars - (sv-48 (function symbol bucket-id string vector font-color vector2h symbol)) - (sv-64 symbol) - (sv-80 int) - (sv-96 (function symbol bucket-id string vector font-color vector2h symbol)) - (sv-112 symbol) - (sv-128 int) - (sv-144 (function _varargs_ object)) - (sv-160 string) - (sv-176 string) - (sv-192 (function symbol bucket-id string vector font-color vector2h symbol)) - (sv-208 symbol) - (sv-224 int) - (sv-240 (function symbol bucket-id vector vector rgba symbol)) - (sv-256 symbol) - (sv-272 int) - (sv-288 pointer) - (sv-304 pointer) - ) (when (and arg0 (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) (dotimes (s4-0 (-> this length)) (let ((v1-8 (-> this level s4-0))) @@ -850,15 +808,13 @@ (-> s1-1 root trans) (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) ) - (set! sv-48 add-debug-text-3d) - (set! sv-64 #t) - (set! sv-80 68) - (let ((a2-2 (res-lump-struct s0-0 'name structure)) - (a3-2 (-> s1-1 root trans)) - (t0-1 1) - (t1-1 (new 'static 'vector2h :y 8)) - ) - (sv-48 sv-64 (the-as bucket-id sv-80) (the-as string a2-2) a3-2 (the-as font-color t0-1) t1-1) + (add-debug-text-3d + #t + (bucket-id debug-no-zbuf) + (res-lump-struct s0-0 'name string) + (-> s1-1 root trans) + (font-color white) + (new 'static 'vector2h :y 8) ) (add-debug-text-3d #t @@ -870,23 +826,19 @@ ) (let ((s0-1 (res-lump-data (-> s1-1 entity) 'eco-info (pointer int32) :time 0.0))) (when s0-1 - (set! sv-96 add-debug-text-3d) - (set! sv-112 #t) - (set! sv-128 68) - (set! sv-144 format) - (set! sv-160 (clear *temp-string*)) - (set! sv-176 "~S ~D~%") - (let ((a2-7 (pickup-type->string (the-as pickup-type (-> s0-1 0)))) - (a3-5 (-> s0-1 1)) + (let ((sv-96 add-debug-text-3d) + (sv-112 #t) + (sv-128 68) ) - (sv-144 sv-160 sv-176 a2-7 a3-5) - ) - (let ((a2-8 *temp-string*) - (a3-6 (-> s1-1 root trans)) - (t0-4 1) - (t1-4 (new 'static 'vector2h :y 24)) - ) - (sv-96 sv-112 (the-as bucket-id sv-128) a2-8 a3-6 (the-as font-color t0-4) t1-4) + (format (clear *temp-string*) "~S ~D~%" (pickup-type->string (the-as pickup-type (-> s0-1 0))) (-> s0-1 1)) + (sv-96 + sv-112 + (the-as bucket-id sv-128) + *temp-string* + (-> s1-1 root trans) + (font-color white) + (new 'static 'vector2h :y 24) + ) ) ) ) @@ -910,18 +862,21 @@ (new 'static 'rgba :r #xff :a #x80) ) ) - (set! sv-192 add-debug-text-3d) - (set! sv-208 #t) - (set! sv-224 68) - (let ((a2-13 (res-lump-struct s0-0 'name structure)) - (t0-8 (if (logtest? (-> s0-0 extra perm status) (entity-perm-status bit-0 bit-1)) - 1 - 5 - ) - ) - (t1-8 (new 'static 'vector2h :y 8)) + (let ((sv-192 add-debug-text-3d) + (sv-208 #t) + (sv-224 68) ) - (sv-192 sv-208 (the-as bucket-id sv-224) (the-as string a2-13) s1-0 (the-as font-color t0-8) t1-8) + (sv-192 + sv-208 + (the-as bucket-id sv-224) + (res-lump-struct s0-0 'name string) + s1-0 + (if (logtest? (-> s0-0 extra perm status) (entity-perm-status bit-0 bit-1)) + (font-color white) + (font-color yellow) + ) + (new 'static 'vector2h :y 8) + ) ) ) ) @@ -944,18 +899,22 @@ (a1-16 (-> s0-2 extra vis-id)) ) (when (and v0-15 (or (= s5-1 #t) (= s5-1 'box))) - (set! sv-240 add-debug-box) - (set! sv-256 #t) - (set! sv-272 68) - (set! sv-288 (&+ v0-15 0)) - (set! sv-304 (&+ v0-15 16)) - (let ((t0-10 (if (is-object-visible? s3-1 a1-16) - (the-as uint #x80808000) - (the-as uint #x80800080) - ) - ) + (let ((sv-240 add-debug-box) + (sv-256 #t) + (sv-272 68) + (sv-288 (&+ v0-15 0)) + (sv-304 (&+ v0-15 16)) ) - (sv-240 sv-256 (the-as bucket-id sv-272) (the-as vector sv-288) (the-as vector sv-304) (the-as rgba t0-10)) + (sv-240 + sv-256 + (the-as bucket-id sv-272) + (the-as vector sv-288) + (the-as vector sv-304) + (if (is-object-visible? s3-1 a1-16) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :b #x80 :a #x80) + ) + ) ) ) ) @@ -1614,7 +1573,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs object. (defmethod actors-update ((this level-group)) - (local-vars (sv-16 vector) (sv-24 int) (sv-32 entity-links) (sv-48 int) (sv-64 string) (sv-80 int)) (when *compact-actors* (if (and (= *compact-actors* 'debug) (= (-> *nk-dead-pool* alive-list prev) (-> *nk-dead-pool* first-gap))) (churn *nk-dead-pool* 1) @@ -1641,157 +1599,158 @@ ) ) (when *spawn-actors* - (set! sv-16 (camera-pos)) - (set! sv-24 0) - (dotimes (s5-2 (-> this length)) - (let ((s4-2 (-> this level s5-2))) - (when (= (-> s4-2 status) 'active) - (cond - ((= (-> s4-2 display?) 'special) - (let* ((s4-3 (-> s4-2 entity)) - (s3-1 (-> s4-3 length)) - ) - (dotimes (s2-0 s3-1) - (let ((v1-44 (-> s4-3 data s2-0))) - (cond - ((logtest? (-> v1-44 perm status) (entity-perm-status bit-7)) - (when (not (or (-> v1-44 process) (logtest? (-> v1-44 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-44 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return (the-as object #f)) - ) - ) + (let ((sv-16 (camera-pos)) + (sv-24 0) + ) + (dotimes (s5-2 (-> this length)) + (let ((s4-2 (-> this level s5-2))) + (when (= (-> s4-2 status) 'active) + (cond + ((= (-> s4-2 display?) 'special) + (let* ((s4-3 (-> s4-2 entity)) + (s3-1 (-> s4-3 length)) ) - (else - (if (and (-> v1-44 process) (not (logtest? (-> v1-44 perm status) (entity-perm-status bit-3)))) - (kill! (-> v1-44 entity)) - ) - ) - ) - ) - ) - ) - ) - ((= (-> s4-2 display?) 'special-vis) - (let* ((s3-2 (-> s4-2 entity)) - (s2-1 (-> s3-2 length)) - ) - (dotimes (s1-0 s2-1) - (let ((s0-0 (-> s3-2 data s1-0))) - (cond - ((and (logtest? (-> s0-0 perm status) (entity-perm-status bit-7)) (is-object-visible? s4-2 (-> s0-0 vis-id))) - (when (not (or (-> s0-0 process) (logtest? (-> s0-0 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> s0-0 entity)) - (set! sv-24 (+ sv-24 1)) - ) - ) - (else - (when (and (-> s0-0 process) (not (logtest? (-> s0-0 perm status) (entity-perm-status bit-3)))) - (kill! (-> s0-0 entity)) - (set! sv-24 (+ sv-24 1)) - ) - ) - ) - ) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return (the-as object #f)) - ) - ) - ) - ) - ((= (-> s4-2 display?) 'actor) - (let* ((s4-4 (-> s4-2 entity)) - (s3-3 (-> s4-4 length)) - ) - (dotimes (s2-2 s3-3) - (let ((v1-84 (-> s4-4 data s2-2))) - (cond - (#t - (when (not (or (-> v1-84 process) (logtest? (-> v1-84 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-84 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return (the-as object #f)) - ) - ) - ) - (else - (if (and (-> v1-84 process) (not (logtest? (-> v1-84 perm status) (entity-perm-status bit-3)))) - (kill! (-> v1-84 entity)) - ) - ) - ) - ) - ) - ) - ) - ((not *vis-actors*) - (let* ((s4-5 (-> s4-2 entity)) - (s3-4 (-> s4-5 length)) - ) - (dotimes (s2-3 s3-4) - (let ((s1-1 (-> s4-5 data s2-3))) - (cond - ((and (< (vector-vector-distance (-> s1-1 trans) sv-16) (-> *ACTOR-bank* birth-dist)) - (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-9 bit-10))) - ) - (when (not (or (-> s1-1 process) (logtest? (-> s1-1 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> s1-1 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return (the-as object #f)) - ) - ) - ) - (else - (if (and (-> s1-1 process) (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-3)))) - (kill! (-> s1-1 entity)) - ) - ) - ) - ) - ) - ) - ) - (*vis-actors* - (when (not (and (-> s4-2 vis-info 0) (-> s4-2 all-visible?))) - (let* ((s3-5 (-> s4-2 entity)) - (s2-4 (-> s3-5 length)) - (s0-1 #f) - ) - (dotimes (s1-2 s2-4) - (set! sv-32 (-> s3-5 data s1-2)) - (cond - ((and (is-object-visible? s4-2 (-> sv-32 vis-id)) - (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-9 bit-10))) - ) - (when (not (or (-> sv-32 process) (logtest? (-> sv-32 perm status) (entity-perm-status bit-0 dead)) s0-1)) - (birth! (-> sv-32 entity)) - (set! sv-24 (+ sv-24 1)) - (when (< (/ (the float (memory-free *nk-dead-pool*)) (the float (memory-total *nk-dead-pool*))) 0.1) - (let ((s0-2 format)) - (set! sv-48 0) - (set! sv-64 "WARNING: low actor memory, no birth triggered!!! ~D/~D~%") - (set! sv-80 (memory-free *nk-dead-pool*)) - (let ((a3-2 (memory-total *nk-dead-pool*))) - (s0-2 sv-48 sv-64 sv-80 a3-2) - ) - ) - (set! s0-1 #t) - ) - ) - ) - (else - (when (and (-> sv-32 process) (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-3)))) - (kill! (-> sv-32 entity)) - (set! sv-24 (+ sv-24 1)) + (dotimes (s2-0 s3-1) + (let ((v1-44 (-> s4-3 data s2-0))) + (cond + ((logtest? (-> v1-44 perm status) (entity-perm-status bit-7)) + (when (not (or (-> v1-44 process) (logtest? (-> v1-44 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-44 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return (the-as object #f)) + ) ) ) + (else + (if (and (-> v1-44 process) (not (logtest? (-> v1-44 perm status) (entity-perm-status bit-3)))) + (kill! (-> v1-44 entity)) + ) + ) + ) + ) + ) + ) + ) + ((= (-> s4-2 display?) 'special-vis) + (let* ((s3-2 (-> s4-2 entity)) + (s2-1 (-> s3-2 length)) ) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return (the-as object #f)) + (dotimes (s1-0 s2-1) + (let ((s0-0 (-> s3-2 data s1-0))) + (cond + ((and (logtest? (-> s0-0 perm status) (entity-perm-status bit-7)) (is-object-visible? s4-2 (-> s0-0 vis-id))) + (when (not (or (-> s0-0 process) (logtest? (-> s0-0 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> s0-0 entity)) + (+! sv-24 1) + ) ) + (else + (when (and (-> s0-0 process) (not (logtest? (-> s0-0 perm status) (entity-perm-status bit-3)))) + (kill! (-> s0-0 entity)) + (+! sv-24 1) + ) + ) + ) + ) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return (the-as object #f)) + ) + ) + ) + ) + ((= (-> s4-2 display?) 'actor) + (let* ((s4-4 (-> s4-2 entity)) + (s3-3 (-> s4-4 length)) + ) + (dotimes (s2-2 s3-3) + (let ((v1-84 (-> s4-4 data s2-2))) + (cond + (#t + (when (not (or (-> v1-84 process) (logtest? (-> v1-84 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-84 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return (the-as object #f)) + ) + ) + ) + (else + (if (and (-> v1-84 process) (not (logtest? (-> v1-84 perm status) (entity-perm-status bit-3)))) + (kill! (-> v1-84 entity)) + ) + ) + ) + ) + ) + ) + ) + ((not *vis-actors*) + (let* ((s4-5 (-> s4-2 entity)) + (s3-4 (-> s4-5 length)) + ) + (dotimes (s2-3 s3-4) + (let ((s1-1 (-> s4-5 data s2-3))) + (cond + ((and (< (vector-vector-distance (-> s1-1 trans) sv-16) (-> *ACTOR-bank* birth-dist)) + (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-9 bit-10))) + ) + (when (not (or (-> s1-1 process) (logtest? (-> s1-1 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> s1-1 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return (the-as object #f)) + ) + ) + ) + (else + (if (and (-> s1-1 process) (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-3)))) + (kill! (-> s1-1 entity)) + ) + ) + ) + ) + ) + ) + ) + (*vis-actors* + (when (not (and (-> s4-2 vis-info 0) (-> s4-2 all-visible?))) + (let* ((s3-5 (-> s4-2 entity)) + (s2-4 (-> s3-5 length)) + (s0-1 #f) + ) + (dotimes (s1-2 s2-4) + (let ((sv-32 (-> s3-5 data s1-2))) + (cond + ((and (is-object-visible? s4-2 (-> sv-32 vis-id)) + (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-9 bit-10))) + ) + (when (not (or (-> sv-32 process) (logtest? (-> sv-32 perm status) (entity-perm-status bit-0 dead)) s0-1)) + (birth! (-> sv-32 entity)) + (+! sv-24 1) + (when (< (/ (the float (memory-free *nk-dead-pool*)) (the float (memory-total *nk-dead-pool*))) 0.1) + (format + 0 + "WARNING: low actor memory, no birth triggered!!! ~D/~D~%" + (memory-free *nk-dead-pool*) + (memory-total *nk-dead-pool*) + ) + (set! s0-1 #t) + ) + ) + ) + (else + (when (and (-> sv-32 process) (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-3)))) + (kill! (-> sv-32 entity)) + (+! sv-24 1) + ) + ) + ) + ) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return (the-as object #f)) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/entity/res_REF.gc b/test/decompiler/reference/jak1/engine/entity/res_REF.gc index b04e71717c..59b39fee3c 100644 --- a/test/decompiler/reference/jak1/engine/entity/res_REF.gc +++ b/test/decompiler/reference/jak1/engine/entity/res_REF.gc @@ -736,9 +736,8 @@ ;; definition for method 18 of type res-lump (defmethod add-32bit-data! ((this res-lump) (arg0 res-tag) (arg1 object)) - (local-vars (sv-16 object)) - (set! sv-16 arg1) - (let* ((v1-0 arg0) + (let* ((sv-16 arg1) + (v1-0 arg0) (a1-4 (copy-and-set-field v1-0 inlined? 1)) ) (add-data! this a1-4 (& sv-16)) @@ -748,20 +747,19 @@ ;; definition for method 21 of type res-lump ;; INFO: Used lq/sq (defmethod get-curve-data! ((this res-lump) (arg0 curve) (arg1 symbol) (arg2 symbol) (arg3 float)) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s5-0 #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((a0-2 ((method-of-object this get-property-data) - this - arg1 - 'exact - arg3 - (the-as pointer #f) - (& sv-16) - *res-static-buf* + (let* ((sv-16 (new 'static 'res-tag)) + (a0-2 ((method-of-object this get-property-data) + this + arg1 + 'exact + arg3 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) ) - ) - ) + ) (when a0-2 (set! (-> arg0 cverts) (the-as (inline-array vector) a0-2)) (set! (-> arg0 num-cverts) (the-as int (-> sv-16 elt-count))) @@ -774,18 +772,18 @@ ) (set! (-> arg0 num-cverts) 256) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((a0-6 ((method-of-object this get-property-data) - this - arg2 - 'exact - arg3 - (the-as pointer #f) - (& sv-32) - *res-static-buf* + (let* ((sv-32 (new 'static 'res-tag)) + (a0-6 ((method-of-object this get-property-data) + this + arg2 + 'exact + arg3 + (the-as pointer #f) + (& sv-32) + *res-static-buf* + ) ) - ) - ) + ) (when a0-6 (set! (-> arg0 knots) (the-as (pointer float) a0-6)) (set! (-> arg0 num-knots) (the-as int (-> sv-32 elt-count))) @@ -803,7 +801,6 @@ ;; INFO: Return type mismatch int vs res-lump. ;; ERROR: Failed load: (set! v1-72 (l.wu (+ a0-58 -4))) at op 206 (defmethod mem-usage ((this res-lump) (block memory-usage-block) (flags int)) - (local-vars (sv-16 int)) (let ((mem-use-id 48) (mem-use-name "res") ) @@ -864,12 +861,13 @@ (+! (-> block data mem-use-id used) v1-63) (+! (-> block data mem-use-id total) (logand -16 (+ v1-63 15))) ) - (set! sv-16 0) - (while (< sv-16 (-> (the-as array tag-data) length)) - (let ((a0-58 (-> (the-as (array object) tag-data) sv-16))) - ((method-of-type (rtype-of a0-58) mem-usage) a0-58 block flags) + (let ((sv-16 0)) + (while (< sv-16 (-> (the-as array tag-data) length)) + (let ((a0-58 (-> (the-as (array object) tag-data) sv-16))) + ((method-of-type (rtype-of a0-58) mem-usage) a0-58 block flags) + ) + (+! sv-16 1) ) - (set! sv-16 (+ sv-16 1)) ) ) (else diff --git a/test/decompiler/reference/jak1/engine/game/effect-control_REF.gc b/test/decompiler/reference/jak1/engine/game/effect-control_REF.gc index 881fdb6213..0091db597d 100644 --- a/test/decompiler/reference/jak1/engine/game/effect-control_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/effect-control_REF.gc @@ -264,17 +264,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs object. (defmethod effect-control-method-10 ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int)) - (local-vars - (sv-160 int) - (sv-176 symbol) - (sv-192 symbol) - (sv-208 symbol) - (sv-224 int) - (sv-240 symbol) - (sv-256 symbol) - (sv-272 symbol) - (sv-288 res-lump) - ) (let ((s3-0 (-> arg0 value)) (s5-0 (cond ((< arg2 0) @@ -367,34 +356,16 @@ s5-0 ) ) - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-7 (method-of-type part-tracker activate))) - (t9-7 (the-as part-tracker s4-1) (-> this process) 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s2-1 run-function-in-process) - (s1-0 s4-1) - (s0-0 part-tracker-init) - ) - (set! sv-160 -1) - (set! sv-176 (the-as symbol #f)) - (set! sv-192 (the-as symbol #f)) - (set! sv-208 (the-as symbol #f)) - (let ((t3-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)))) - ((the-as (function object object object object object object object object none) s2-1) - s1-0 - s0-0 - (the-as sparticle-launch-group s3-0) - sv-160 - sv-176 - sv-192 - sv-208 - t3-0 - ) - ) - ) - (-> s4-1 ppointer) - ) + (process-spawn + part-tracker + :init part-tracker-init + (the-as sparticle-launch-group s3-0) + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) + :to (-> this process) ) ) ) @@ -442,34 +413,16 @@ s5-0 ) ) - (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-3 - (let ((t9-19 (method-of-type part-tracker activate))) - (t9-19 (the-as part-tracker s4-3) (-> this process) 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s2-3 run-function-in-process) - (s1-2 s4-3) - (s0-2 part-tracker-init) - ) - (set! sv-224 -1) - (set! sv-240 (the-as symbol #f)) - (set! sv-256 (the-as symbol #f)) - (set! sv-272 (the-as symbol #f)) - (let ((t3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)))) - ((the-as (function object object object object object object object object none) s2-3) - s1-2 - s0-2 - s3-0 - sv-224 - sv-240 - sv-256 - sv-272 - t3-1 - ) - ) - ) - (-> s4-3 ppointer) - ) + (process-spawn + part-tracker + :init part-tracker-init + s3-0 + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) + :to (-> this process) ) ) ((= (-> (the-as basic s3-0) type) sound-spec) @@ -511,17 +464,16 @@ (set! (-> v1-67 death-timer-org) (-> v1-67 death-timer)) (set! (-> v1-67 death-draw-overlap) (-> (the-as death-info s3-0) overlap)) ) - (when (-> (the-as death-info s3-0) sound) - (let* ((s2-5 this) - (s1-3 (method-of-object s2-5 effect-control-method-12)) - (s0-3 (-> (the-as death-info s3-0) sound)) - ) - (set! sv-288 (-> this res)) - (let ((t1-11 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))))) - (s1-3 s2-5 s0-3 arg1 s5-0 sv-288 t1-11) + (if (-> (the-as death-info s3-0) sound) + (effect-control-method-12 + this + (-> (the-as death-info s3-0) sound) + arg1 + s5-0 + (-> this res) + (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))) ) ) - ) (send-event (-> this process) 'death-start (the-as death-info s3-0)) ) (else @@ -537,16 +489,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod effect-control-method-11 ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 pat-surface)) - (local-vars - (sv-48 - (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none) - ) - (sv-64 sparticle-system) - (sv-80 - (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none) - ) - (sv-96 sparticle-system) - ) (let ((s1-0 (the-as sound-name #f))) (let ((a0-4 (-> *display* frames (-> *display* last-screen) frame run-time))) (case arg0 @@ -962,17 +904,9 @@ ) ) ) - (when (nonzero? s0-0) - (set! sv-48 sp-launch-particles-var) - (set! sv-64 *sp-particle-system-2d*) - (let ((a2-36 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))) - (a3-6 #f) - (t0-1 #f) - (t1-1 1.0) - ) - (sv-48 sv-64 s0-0 a2-36 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1) + (if (nonzero? s0-0) + (launch-particles s0-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))) ) - ) ) ) (('effect-jump-droppings) @@ -1032,17 +966,9 @@ ) ) ) - (when (nonzero? s0-1) - (set! sv-80 sp-launch-particles-var) - (set! sv-96 *sp-particle-system-2d*) - (let ((a2-37 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))) - (a3-7 #f) - (t0-2 #f) - (t1-2 1.0) - ) - (sv-80 sv-96 s0-1 a2-37 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2) + (if (nonzero? s0-1) + (launch-particles s0-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))) ) - ) ) ) ) @@ -1058,9 +984,8 @@ ;; definition for method 12 of type effect-control ;; INFO: Used lq/sq (defmethod effect-control-method-12 ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 sound-name)) - (local-vars (sv-112 res-tag) (sv-128 sound-name) (sv-144 basic) (sv-160 (function vector vector float))) - (set! sv-144 arg3) - (let ((s0-0 arg4) + (let ((sv-144 arg3) + (s0-0 arg4) (gp-0 (new 'stack 'sound-spec)) (s5-0 (if (< arg2 0) (the-as vector #f) @@ -1073,34 +998,31 @@ (set! (-> gp-0 volume) 1024) (logior! (-> gp-0 mask) (sound-mask bend)) (set! (-> gp-0 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) - (set! sv-112 (new 'static 'res-tag)) - (let* ((t9-3 (method-of-type res-lump get-property-data)) - (a1-6 'effect-param) - (a2-1 'exact) - (a3-1 arg1) - (t0-1 #f) - (t1-1 (the-as (pointer res-tag) (& sv-112))) - (t2-0 *res-static-buf*) - (a1-7 (t9-3 (the-as res-lump sv-144) a1-6 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)) + (let* ((sv-112 (new 'static 'res-tag)) + (a1-7 ((method-of-type res-lump get-property-data) + (the-as res-lump sv-144) + 'effect-param + 'exact + arg1 + (the-as pointer #f) + (& sv-112) + *res-static-buf* + ) + ) ) (if a1-7 (effect-param->sound-spec gp-0 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count))) ) ) - (if (and (nonzero? (-> gp-0 fo-max)) (let ((f30-1 (* 4096.0 (the float (-> gp-0 fo-max))))) - (set! sv-160 vector-vector-distance) - (let ((a0-6 (ear-trans)) - (a1-8 s5-0) - ) - (< f30-1 (sv-160 a0-6 a1-8)) - ) - ) + (if (and (nonzero? (-> gp-0 fo-max)) + (< (* 4096.0 (the float (-> gp-0 fo-max))) (vector-vector-distance (ear-trans) s5-0)) ) (return 0) ) (when *debug-effect-control* - (set! sv-128 s0-0) - (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + (let ((sv-128 s0-0)) + (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + ) (format #t "(~5D) effect sound ~A ~A (~S) frame ~F joint ~D " diff --git a/test/decompiler/reference/jak1/engine/game/fact-h_REF.gc b/test/decompiler/reference/jak1/engine/game/fact-h_REF.gc index d3f669d87d..7d05bbf179 100644 --- a/test/decompiler/reference/jak1/engine/game/fact-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/fact-h_REF.gc @@ -220,7 +220,6 @@ ;; definition for method 0 of type fact-info ;; INFO: Used lq/sq (defmethod new fact-info ((allocation symbol) (type-to-make type) (proc process-drawable) (pkup-type pickup-type) (pkup-amount float)) - (local-vars (tag res-tag)) (let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (let ((ent (-> proc entity))) (when (zero? this) @@ -229,8 +228,9 @@ (goto cfg-10) ) (set! (-> this process) proc) - (set! tag (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag) :time 0.0))) + (let* ((tag (new 'static 'res-tag)) + (v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag) :time 0.0)) + ) (cond (v1-6 (let ((a0-6 (-> tag elt-count))) diff --git a/test/decompiler/reference/jak1/engine/game/game-info_REF.gc b/test/decompiler/reference/jak1/engine/game/game-info_REF.gc index f2883a572f..270a5c90f5 100644 --- a/test/decompiler/reference/jak1/engine/game/game-info_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/game-info_REF.gc @@ -139,7 +139,7 @@ ;; definition for method 9 of type game-info ;; INFO: Used lq/sq (defmethod initialize! ((this game-info) (cause symbol) (save-to-load game-save) (continue-point-override string)) - (local-vars (v0-0 int) (sv-96 symbol)) + (local-vars (v0-0 int)) (case cause (('dead) (+! (-> this total-deaths) 1) @@ -261,29 +261,25 @@ (let ((t9-15 (method-of-type process activate))) (t9-15 s3-1 *default-pool* 'process (the-as pointer #x70004000)) ) - (let ((s2-0 (the-as (function cpu-thread function object object object object pointer) set-to-run)) - (s1-0 (-> s3-1 main-thread)) - (s0-0 (lambda ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save)) - (stop arg0) - (reset-actors arg1) - (set-continue! *game-info* arg2) - (when arg3 - (load-game! *game-info* arg3) - (set! arg2 (get-or-create-continue! *game-info*)) - ) - (suspend) - (start arg0 arg2) - (none) - ) - ) - ) - (set! sv-96 (-> this mode)) - (let ((t0-2 (get-or-create-continue! this)) - (t1-2 save-to-load) - ) - (s2-0 s1-0 s0-0 sv-96 cause t0-2 t1-2) - ) - ) + ((the-as (function cpu-thread function object object object object pointer) set-to-run) + (-> s3-1 main-thread) + (lambda ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save)) + (stop arg0) + (reset-actors arg1) + (set-continue! *game-info* arg2) + (when arg3 + (load-game! *game-info* arg3) + (set! arg2 (get-or-create-continue! *game-info*)) + ) + (suspend) + (start arg0 arg2) + (none) + ) + (-> this mode) + cause + (get-or-create-continue! this) + save-to-load + ) (-> s3-1 ppointer) ) ) diff --git a/test/decompiler/reference/jak1/engine/game/game-save_REF.gc b/test/decompiler/reference/jak1/engine/game/game-save_REF.gc index 31884c80a5..ef2fdbed00 100644 --- a/test/decompiler/reference/jak1/engine/game/game-save_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/game-save_REF.gc @@ -260,7 +260,6 @@ ;; definition for method 11 of type game-save ;; INFO: Used lq/sq (defmethod debug-print ((this game-save) (detail symbol)) - (local-vars (sv-16 int)) (format #t "[~8x] ~A~%" this (-> this type)) (format #t "~Tversion: ~D~%" (-> this version)) (format #t "~Tallocated-length: ~D~%" (-> this allocated-length)) @@ -284,19 +283,15 @@ (tag-idx 0) ) (while (< (the-as int tag) (the-as int (&-> this tag 0 user-int8 (-> this length)))) - (let ((s2-0 format) - (s1-0 #t) - (s0-0 "~T [~3D] ~-32S [~3D/~3D] ~12D ~8f ") - ) - (set! sv-16 tag-idx) - (let ((a3-2 (game-save-elt->string (-> tag elt-type))) - (t0-1 (-> tag elt-count)) - (t1-1 (-> tag elt-size)) - (t2-1 (-> tag user-uint64)) - (t3-0 (-> tag user-float0)) - ) - (s2-0 s1-0 s0-0 sv-16 a3-2 t0-1 t1-1 t2-1 t3-0) - ) + (format + #t + "~T [~3D] ~-32S [~3D/~3D] ~12D ~8f " + tag-idx + (game-save-elt->string (-> tag elt-type)) + (-> tag elt-count) + (-> tag elt-size) + (-> tag user-uint64) + (-> tag user-float0) ) (let ((v1-0 (-> tag elt-type))) (if (or (= v1-0 (game-save-elt name)) (= v1-0 (game-save-elt continue))) diff --git a/test/decompiler/reference/jak1/engine/game/projectiles_REF.gc b/test/decompiler/reference/jak1/engine/game/projectiles_REF.gc index 223333c74a..6d46d0bf14 100644 --- a/test/decompiler/reference/jak1/engine/game/projectiles_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/projectiles_REF.gc @@ -117,74 +117,74 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs cshape-moving-flags. (defun projectile-collision-reaction ((arg0 collide-shape-moving) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) - (local-vars (sv-64 vector) (sv-68 vector) (sv-72 matrix) (sv-80 int) (sv-224 symbol)) - (set! sv-64 (new-stack-vector0)) - (set! sv-68 (new-stack-vector0)) - (set! sv-72 (new 'stack-no-clear 'matrix)) - (set! sv-80 0) - (set! (-> sv-72 vector 0 quad) (-> arg3 quad)) - (let ((a1-1 (new 'stack-no-clear 'vector))) - (vector-float*! a1-1 (-> arg1 move-vec) (-> arg1 best-u)) - (move-by-vector! arg0 a1-1) - ) - (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) - (case (-> arg1 best-tri pat material) - (((pat-material stopproj)) - (send-event (-> arg0 process) 'die) - ) - ) - (vector-! sv-64 (-> arg1 best-from-prim prim-core world-sphere) (-> arg1 best-tri intersect)) - (set! (-> sv-64 w) 1.0) - (vector-normalize! sv-64 1.0) - (set! (-> arg0 coverage) (vector-dot sv-64 (-> arg1 best-tri normal))) - (let ((v1-22 (-> sv-64 quad))) - (set! (-> sv-68 quad) v1-22) - ) - (when (= (-> arg1 best-u) 0.0) - (let ((a1-7 (vector-float*! (new 'stack-no-clear 'vector) sv-68 32.0))) - (move-by-vector! arg0 a1-7) - ) - ) - (set! (-> arg0 surface-normal quad) (-> sv-68 quad)) - (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) - (set! (-> arg0 surface-angle) (vector-dot sv-68 (-> arg0 dynam gravity-normal))) - (set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal))) - (set! (-> arg0 touch-angle) - (vector-dot sv-68 (vector-normalize! (vector-negate! (new-stack-vector0) (the-as vector sv-72)) 1.0)) + (let ((sv-64 (new-stack-vector0)) + (sv-68 (new-stack-vector0)) + (sv-72 (new 'stack-no-clear 'matrix)) + (sv-80 0) ) - (if (< (-> arg0 poly-angle) -0.2) - (set! sv-80 (logior sv-80 16)) + (set! (-> sv-72 vector 0 quad) (-> arg3 quad)) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (-> arg1 move-vec) (-> arg1 best-u)) + (move-by-vector! arg0 a1-1) ) - (set! sv-224 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - (if (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) + (case (-> arg1 best-tri pat material) + (((pat-material stopproj)) + (send-event (-> arg0 process) 'die) + ) ) - (set! sv-80 (logior sv-80 4)) - (if (-> arg1 best-to-prim) - (set! sv-80 (logior sv-80 32)) + (vector-! sv-64 (-> arg1 best-from-prim prim-core world-sphere) (-> arg1 best-tri intersect)) + (set! (-> sv-64 w) 1.0) + (vector-normalize! sv-64 1.0) + (set! (-> arg0 coverage) (vector-dot sv-64 (-> arg1 best-tri normal))) + (set! (-> sv-68 quad) (-> sv-64 quad)) + (when (= (-> arg1 best-u) 0.0) + (let ((a1-7 (vector-float*! (new 'stack-no-clear 'vector) sv-68 32.0))) + (move-by-vector! arg0 a1-7) + ) ) - (cond - (sv-224 - (set! sv-80 (logior sv-80 8)) - (set! (-> arg0 cur-pat mode) 1) - (set! (-> arg0 local-normal quad) (-> sv-68 quad)) - ) - (else - (set! sv-80 (logior sv-80 1)) - (set! (-> arg0 local-normal quad) (-> sv-68 quad)) + (set! (-> arg0 surface-normal quad) (-> sv-68 quad)) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (set! (-> arg0 surface-angle) (vector-dot sv-68 (-> arg0 dynam gravity-normal))) + (set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal))) + (set! (-> arg0 touch-angle) + (vector-dot sv-68 (vector-normalize! (vector-negate! (new-stack-vector0) (the-as vector sv-72)) 1.0)) + ) + (if (< (-> arg0 poly-angle) -0.2) + (logior! sv-80 16) + ) + (let ((sv-224 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (if (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + ) + (logior! sv-80 4) + (if (-> arg1 best-to-prim) + (logior! sv-80 32) + ) + (cond + (sv-224 + (logior! sv-80 8) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 local-normal quad) (-> sv-68 quad)) + ) + (else + (logior! sv-80 1) + (set! (-> arg0 local-normal quad) (-> sv-68 quad)) + ) + ) + (vector-reflect-flat-above! arg2 (the-as vector sv-72) sv-68) + (when (and (not sv-224) (>= (-> arg0 coverage) 0.9)) + (logior! sv-80 2) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + ) + ) ) + (logior! (-> arg0 status) sv-80) + (the-as cshape-moving-flags sv-80) ) - (vector-reflect-flat-above! arg2 (the-as vector sv-72) sv-68) - (when (and (not sv-224) (>= (-> arg0 coverage) 0.9)) - (set! sv-80 (logior sv-80 2)) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) - ) - ) - (logior! (-> arg0 status) sv-80) - (the-as cshape-moving-flags sv-80) ) ;; failed to figure out what this is: @@ -1219,7 +1219,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun spawn-projectile-blue ((arg0 target)) - (local-vars (sv-48 entity-actor)) (with-pp (when arg0 (let ((s3-0 (rand-vu-int-range 3 (+ (-> arg0 node-list length) -1))) @@ -1240,22 +1239,17 @@ (let ((s2-0 run-function-in-process) (s1-0 s4-1) (s0-0 projectile-init-by-other) + (sv-48 (-> pp entity)) ) - (set! sv-48 (-> pp entity)) - (let ((a3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s3-0))) - (t1-0 8) - (t2-0 (process->handle pp)) - ) - ((the-as (function process function object object object object object object) s2-0) - s1-0 - s0-0 - sv-48 - a3-1 - gp-0 - t1-0 - t2-0 - ) - ) + ((the-as (function process function object object object object object object) s2-0) + s1-0 + s0-0 + sv-48 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s3-0)) + gp-0 + 8 + (process->handle pp) + ) ) (-> s4-1 ppointer) ) diff --git a/test/decompiler/reference/jak1/engine/geometry/cylinder_REF.gc b/test/decompiler/reference/jak1/engine/geometry/cylinder_REF.gc index 69ecc48a38..2827400da4 100644 --- a/test/decompiler/reference/jak1/engine/geometry/cylinder_REF.gc +++ b/test/decompiler/reference/jak1/engine/geometry/cylinder_REF.gc @@ -52,26 +52,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod debug-draw ((this cylinder) (arg0 vector4w)) - (local-vars - (sv-896 matrix) - (sv-912 int) - (sv-928 (function vector vector vector float vector)) - (sv-944 vector) - (sv-960 vector) - (sv-976 vector) - (sv-992 (function vector vector vector float vector)) - (sv-1008 vector) - (sv-1024 vector) - (sv-1040 vector) - (sv-1056 (function vector vector vector float vector)) - (sv-1072 vector) - (sv-1088 vector) - (sv-1104 vector) - (sv-1120 (function vector vector vector float vector)) - (sv-1136 vector) - (sv-1152 vector) - (sv-1168 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -92,49 +72,37 @@ (s3-0 (new 'stack-no-clear 'matrix)) ) (matrix-axis-angle! s3-0 (-> this axis) 4096.0) - (set! sv-896 (new 'stack-no-clear 'matrix)) - (vector-matrix*! (the-as vector sv-896) (-> this origin) s3-0) - (let ((v1-5 (-> s3-0 vector 3))) - (.lvf vf4 (&-> (-> this origin) quad)) - (.lvf vf5 (&-> sv-896 vector 0 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-5 quad) vf6) + (let ((sv-896 (new 'stack-no-clear 'matrix))) + (vector-matrix*! (the-as vector sv-896) (-> this origin) s3-0) + (let ((v1-5 (-> s3-0 vector 3))) + (.lvf vf4 (&-> (-> this origin) quad)) + (.lvf vf5 (&-> sv-896 vector 0 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-5 quad) vf6) + ) ) - (set! sv-912 0) - (while (< sv-912 8) - (vector+! (-> s5-0 vert (+ sv-912 8)) (-> this origin) s1-0) - (vector+float*! (-> s5-0 vert (+ sv-912 8)) (-> s5-0 vert (+ sv-912 8)) s0-0 (the float sv-912)) - (set! sv-912 (+ sv-912 1)) + (let ((sv-912 0)) + (while (< sv-912 8) + (vector+! (-> s5-0 vert (+ sv-912 8)) (-> this origin) s1-0) + (vector+float*! (-> s5-0 vert (+ sv-912 8)) (-> s5-0 vert (+ sv-912 8)) s0-0 (the float sv-912)) + (+! sv-912 1) + ) ) (dotimes (s0-1 8) - (set! sv-928 vector+float*!) - (set! sv-944 (-> s5-0 vert s0-1)) - (set! sv-960 (-> this origin)) - (set! sv-976 s1-0) - (let ((a3-1 (cos (* 2048.0 (the float (- 7 s0-1)))))) - (sv-928 sv-944 sv-960 sv-976 a3-1) + (vector+float*! (-> s5-0 vert s0-1) (-> this origin) s1-0 (cos (* 2048.0 (the float (- 7 s0-1))))) + (vector+float*! + (-> s5-0 vert s0-1) + (-> s5-0 vert s0-1) + (-> this axis) + (* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1))))) ) - (set! sv-992 vector+float*!) - (set! sv-1008 (-> s5-0 vert s0-1)) - (set! sv-1024 (-> s5-0 vert s0-1)) - (set! sv-1040 (-> this axis)) - (let ((a3-2 (* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1))))))) - (sv-992 sv-1008 sv-1024 sv-1040 a3-2) - ) - (set! sv-1056 vector+float*!) - (set! sv-1072 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1088 (-> this origin)) - (set! sv-1104 s1-0) - (let ((a3-3 (cos (* 2048.0 (the float s0-1))))) - (sv-1056 sv-1072 sv-1088 sv-1104 a3-3) - ) - (set! sv-1120 vector+float*!) - (set! sv-1136 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1152 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1168 (-> this axis)) - (let ((a3-4 (+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1))))))) - (sv-1120 sv-1136 sv-1152 sv-1168 a3-4) + (vector+float*! (-> s5-0 vert (+ s0-1 16)) (-> this origin) s1-0 (cos (* 2048.0 (the float s0-1)))) + (vector+float*! + (-> s5-0 vert (+ s0-1 16)) + (-> s5-0 vert (+ s0-1 16)) + (-> this axis) + (+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1))))) ) ) (dotimes (s2-1 16) @@ -238,7 +206,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod debug-draw ((this cylinder-flat) (arg0 vector4w)) - (local-vars (sv-448 vector) (sv-464 int)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -259,20 +226,22 @@ (s3-0 (new 'stack-no-clear 'matrix)) ) (matrix-axis-angle! s3-0 (-> this axis) 4096.0) - (set! sv-448 (new 'stack-no-clear 'vector)) - (vector-matrix*! sv-448 (-> this origin) s3-0) - (let ((v1-5 (-> s3-0 vector 3))) - (.lvf vf4 (&-> (-> this origin) quad)) - (.lvf vf5 (&-> sv-448 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-5 quad) vf6) + (let ((sv-448 (new 'stack-no-clear 'vector))) + (vector-matrix*! sv-448 (-> this origin) s3-0) + (let ((v1-5 (-> s3-0 vector 3))) + (.lvf vf4 (&-> (-> this origin) quad)) + (.lvf vf5 (&-> sv-448 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-5 quad) vf6) + ) ) - (set! sv-464 0) - (while (< sv-464 8) - (vector+! (-> s5-0 vert (+ sv-464 1)) (-> this origin) s1-0) - (vector+float*! (-> s5-0 vert (+ sv-464 1)) (-> s5-0 vert (+ sv-464 1)) s0-0 (the float sv-464)) - (set! sv-464 (+ sv-464 1)) + (let ((sv-464 0)) + (while (< sv-464 8) + (vector+! (-> s5-0 vert (+ sv-464 1)) (-> this origin) s1-0) + (vector+float*! (-> s5-0 vert (+ sv-464 1)) (-> s5-0 vert (+ sv-464 1)) s0-0 (the float sv-464)) + (+! sv-464 1) + ) ) (set! (-> s5-0 vert 0 quad) (-> this origin quad)) (vector+float*! (-> s5-0 vert 9) (-> this origin) (-> this axis) (-> this length)) diff --git a/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc b/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc index bc665d8c5f..97029da3a9 100644 --- a/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc +++ b/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc @@ -360,9 +360,7 @@ (defun matrix-from-two-vectors! ((arg0 matrix) (arg1 vector) (arg2 vector)) (let* ((a1-3 (vector-normalize! (vector-cross! (new-stack-vector0) arg2 arg1) 1.0)) (f0-1 (vector-dot arg1 arg2)) - (f1-0 1.0) - (f2-0 f0-1) - (f1-2 (sqrtf (- f1-0 (* f2-0 f2-0)))) + (f1-2 (sqrtf (- 1.0 (square f0-1)))) ) (matrix-axis-sin-cos! arg0 a1-3 f1-2 f0-1) ) @@ -375,21 +373,10 @@ (f30-0 (vector-dot arg1 arg2)) (f28-0 (cos arg3)) ) - (cond - ((< f30-0 f28-0) - (matrix-axis-sin-cos! arg0 s4-1 (sin arg3) f28-0) - ) - (else - (let ((t9-5 matrix-axis-sin-cos!) - (a0-6 arg0) - (a1-4 s4-1) - (f0-1 1.0) - (f1-0 f30-0) - ) - (t9-5 a0-6 a1-4 (sqrtf (- f0-1 (* f1-0 f1-0))) f30-0) - ) + (if (< f30-0 f28-0) + (matrix-axis-sin-cos! arg0 s4-1 (sin arg3) f28-0) + (matrix-axis-sin-cos! arg0 s4-1 (sqrtf (- 1.0 (square f30-0))) f30-0) ) - ) ) ) @@ -401,21 +388,10 @@ (f30-0 (cos arg3)) (f0-2 (+ 1.0 (* (+ -1.0 f28-0) arg4))) ) - (cond - ((< f0-2 f30-0) - (matrix-axis-sin-cos! arg0 s4-1 (sin arg3) f30-0) - ) - (else - (let ((t9-5 matrix-axis-sin-cos!) - (a0-6 arg0) - (a1-4 s4-1) - (f1-3 1.0) - (f2-1 f0-2) - ) - (t9-5 a0-6 a1-4 (sqrtf (- f1-3 (* f2-1 f2-1))) f0-2) - ) + (if (< f0-2 f30-0) + (matrix-axis-sin-cos! arg0 s4-1 (sin arg3) f30-0) + (matrix-axis-sin-cos! arg0 s4-1 (sqrtf (- 1.0 (square f0-2))) f0-2) ) - ) ) ) @@ -430,13 +406,8 @@ (matrix-identity! arg0) ) (else - (let* ((f0-4 (cos (* arg3 (acos f0-1)))) - (t9-5 matrix-axis-sin-cos!) - (a0-6 arg0) - (f1-1 1.0) - (f2-1 f0-4) - ) - (t9-5 a0-6 gp-1 (sqrtf (- f1-1 (* f2-1 f2-1))) f0-4) + (let ((f0-4 (cos (* arg3 (acos f0-1))))) + (matrix-axis-sin-cos! arg0 gp-1 (sqrtf (- 1.0 (square f0-4))) f0-4) ) ) ) @@ -549,7 +520,6 @@ ;; definition for function vector-vector-deg-slerp! ;; INFO: Used lq/sq (defun vector-vector-deg-slerp! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector)) - (local-vars (sv-112 (function float float float float))) (cond ((>= 0.0 arg3) (set! (-> arg0 quad) (-> arg1 quad)) @@ -563,15 +533,11 @@ (s0-1 (forward-up->quaternion (new 'stack-no-clear 'quaternion) s0-0 arg4)) (a2-5 (forward-up->quaternion (new 'stack-no-clear 'quaternion) s1-0 arg4)) (a1-6 (quaternion-slerp! (new 'stack-no-clear 'quaternion) s0-1 a2-5 arg3)) - (s2-1 vector-normalize-copy!) - (s1-1 arg0) - (s0-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) a1-6)) ) - (set! sv-112 lerp) - (let ((s3-1 (vector-length arg1)) - (a1-7 (vector-length arg2)) - ) - (s2-1 s1-1 s0-2 (sv-112 s3-1 a1-7 arg3)) + (vector-normalize-copy! + arg0 + (vector-z-quaternion! (new 'stack-no-clear 'vector) a1-6) + (lerp (vector-length arg1) (vector-length arg2) arg3) ) ) ) @@ -1197,9 +1163,8 @@ ;; WARN: Stack slot offset 48 signed mismatch ;; WARN: Stack slot offset 48 signed mismatch (defun curve-closest-point ((arg0 curve) (arg1 vector) (arg2 float) (arg3 float) (arg4 int) (arg5 float)) - (local-vars (sv-48 float)) - (set! sv-48 arg3) - (let ((s3-0 arg4) + (let ((sv-48 arg3) + (s3-0 arg4) (gp-0 arg5) (f30-0 (curve-length arg0)) (s2-0 (new 'stack-no-clear 'vector)) diff --git a/test/decompiler/reference/jak1/engine/geometry/path-h_REF.gc b/test/decompiler/reference/jak1/engine/geometry/path-h_REF.gc index 0b3e8972e5..65633b2144 100644 --- a/test/decompiler/reference/jak1/engine/geometry/path-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/geometry/path-h_REF.gc @@ -63,7 +63,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs path-control. (defmethod new path-control ((allocation symbol) (type-to-make type) (proc process) (name symbol) (time float)) - (local-vars (tag res-tag)) (let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (when (zero? this) (go process-drawable-art-error "memory") @@ -80,8 +79,9 @@ ) ) ) - (set! tag (new 'static 'res-tag)) - (let ((data (res-lump-data ent name pointer :tag-ptr (& tag) :time time))) + (let* ((tag (new 'static 'res-tag)) + (data (res-lump-data ent name pointer :tag-ptr (& tag) :time time)) + ) (cond (data (set! (-> this cverts) (the-as (inline-array vector) data)) diff --git a/test/decompiler/reference/jak1/engine/geometry/vol_REF.gc b/test/decompiler/reference/jak1/engine/geometry/vol_REF.gc index fa974003f3..1b27af1d7a 100644 --- a/test/decompiler/reference/jak1/engine/geometry/vol_REF.gc +++ b/test/decompiler/reference/jak1/engine/geometry/vol_REF.gc @@ -27,140 +27,143 @@ ;; WARN: Stack slot offset 148 signed mismatch ;; WARN: Stack slot offset 148 signed mismatch (defmethod init-vol! ((this plane-volume) (arg0 symbol) (arg1 vector-array) (arg2 vector-array)) - (local-vars - (sv-144 vector) - (sv-148 float) - (sv-152 int) - (sv-160 vector) - (sv-176 vector) - (sv-192 vector) - (sv-208 vector) - (sv-224 vector) - (sv-240 int) - (sv-256 int) - ) (set! (-> this volume-type) arg0) (set! (-> this point-count) 0) (set! (-> this first-point) (the-as (pointer vector) (-> arg1 data (-> arg1 length)))) (set! (-> this normal-count) 0) (set! (-> this first-normal) (the-as (pointer vector) (-> arg2 data (-> arg2 length)))) (dotimes (s3-0 (-> this num-planes)) - (set! sv-176 (new 'stack-no-clear 'vector)) - (set! (-> sv-176 quad) (the-as uint128 0)) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! (-> sv-192 quad) (the-as uint128 0)) - (set! sv-208 (new 'stack-no-clear 'vector)) - (set! (-> sv-208 quad) (the-as uint128 0)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (set! (-> sv-224 quad) (the-as uint128 0)) - 0.0 - 0.0 - 0.0 - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (let ((s1-0 (new-stack-vector0)) - (s0-0 0) - (s2-0 (-> this plane)) - ) - (set! sv-240 0) - (while (< sv-240 (-> this num-planes)) - (when (!= s3-0 sv-240) - (vector-float*! sv-176 (the-as vector (-> s2-0 sv-240)) (-> s2-0 sv-240 w)) - (vector-cross! sv-192 (the-as vector (-> s2-0 sv-240)) (the-as vector (-> s2-0 s3-0))) - (vector-normalize! sv-192 1.0) - (vector-cross! sv-208 sv-192 (the-as vector (-> s2-0 sv-240))) - (vector-normalize! sv-208 1.0) - (let ((f0-4 (plane-volume-intersect-dist (-> s2-0 s3-0) sv-176 sv-208))) - (when (!= f0-4 409600000.0) - (vector+float*! sv-224 sv-176 sv-208 f0-4) - (set! sv-144 (new-stack-vector0)) - (set! sv-148 0.0) - (set! sv-152 0) - (set! sv-160 (new-stack-vector0)) - (set! (-> sv-144 quad) (-> sv-224 quad)) - (set! sv-256 0) - (while (< sv-256 (-> this num-planes)) - (when (and (!= sv-256 s3-0) (!= sv-256 sv-240)) - (let ((f30-0 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192))) - (cond - ((= f30-0 409600000.0) - ) - ((zero? sv-152) - (vector+float*! sv-144 sv-144 sv-192 f30-0) - (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) - (set! sv-148 8192000.0) - (set! sv-152 1) - ) - ((begin (vector-float*! sv-224 sv-192 f30-0) (>= (vector-dot sv-224 sv-160) 0.0)) - ) - ((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0) - (when (< (fabs f30-0) (fabs sv-148)) - (set! sv-148 f30-0) - (set! sv-152 (+ sv-152 1)) - ) - ) - (else - (vector+float*! sv-144 sv-144 sv-192 f30-0) - (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) - (set! sv-152 (+ sv-152 1)) - (if (< (fabs f30-0) (fabs sv-148)) - (set! sv-148 (- sv-148 f30-0)) - (set! sv-148 0.0) + (let ((sv-176 (new 'stack-no-clear 'vector))) + (set! (-> sv-176 quad) (the-as uint128 0)) + (let ((sv-192 (new 'stack-no-clear 'vector))) + (set! (-> sv-192 quad) (the-as uint128 0)) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (set! (-> sv-208 quad) (the-as uint128 0)) + (let ((sv-224 (new 'stack-no-clear 'vector))) + (set! (-> sv-224 quad) (the-as uint128 0)) + 0.0 + 0.0 + 0.0 + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (let ((s1-0 (new-stack-vector0)) + (s0-0 0) + (s2-0 (-> this plane)) + ) + (let ((sv-240 0)) + (while (< sv-240 (-> this num-planes)) + (when (!= s3-0 sv-240) + (vector-float*! sv-176 (the-as vector (-> s2-0 sv-240)) (-> s2-0 sv-240 w)) + (vector-cross! sv-192 (the-as vector (-> s2-0 sv-240)) (the-as vector (-> s2-0 s3-0))) + (vector-normalize! sv-192 1.0) + (vector-cross! sv-208 sv-192 (the-as vector (-> s2-0 sv-240))) + (vector-normalize! sv-208 1.0) + (let ((f0-4 (plane-volume-intersect-dist (-> s2-0 s3-0) sv-176 sv-208))) + (when (!= f0-4 409600000.0) + (vector+float*! sv-224 sv-176 sv-208 f0-4) + (let ((sv-144 (new-stack-vector0)) + (sv-148 0.0) + (sv-152 0) + ) + (let ((sv-160 (new-stack-vector0))) + (set! (-> sv-144 quad) (-> sv-224 quad)) + (let ((sv-256 0)) + (while (< sv-256 (-> this num-planes)) + (when (and (!= sv-256 s3-0) (!= sv-256 sv-240)) + (let ((f30-0 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192))) + (cond + ((= f30-0 409600000.0) + ) + ((zero? sv-152) + (vector+float*! sv-144 sv-144 sv-192 f30-0) + (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) + (set! sv-148 8192000.0) + (set! sv-152 1) + ) + ((begin (vector-float*! sv-224 sv-192 f30-0) (>= (vector-dot sv-224 sv-160) 0.0)) + ) + ((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0) + (when (< (fabs f30-0) (fabs sv-148)) + (set! sv-148 f30-0) + (+! sv-152 1) + ) + ) + (else + (vector+float*! sv-144 sv-144 sv-192 f30-0) + (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) + (+! sv-152 1) + (set! sv-148 (cond + ((< (fabs f30-0) (fabs sv-148)) + (set! sv-148 (- sv-148 f30-0)) + sv-148 + ) + (else + 0.0 + ) + ) + ) + ) + ) + ) + ) + (+! sv-256 1) + ) + ) ) + (cond + ((zero? sv-152) + ) + ((= sv-148 0.0) + ) + (else + (dotimes (v1-70 (-> this num-planes)) + (when (and (!= v1-70 s3-0) (!= v1-70 sv-240)) + (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-70))) (the-as float (-> s2-0 v1-70 w)))) + (goto cfg-42) + ) + ) + ) + (vector+float*! sv-224 sv-144 sv-192 sv-148) + (cond + ((< (-> arg1 allocated-length) (+ (-> arg1 length) 2)) + (format 0 "ERROR : vol-control #x~X out of volume points~%" this) + ) + (else + (set! (-> arg1 data (-> arg1 length) quad) (-> sv-144 quad)) + (set! (-> arg1 data (+ (-> arg1 length) 1) quad) (-> sv-224 quad)) + (+! (-> arg1 length) 2) + (+! (-> this point-count) 2) + ) + ) + (vector+! s1-0 s1-0 sv-144) + (vector+! s1-0 s1-0 sv-224) + (+! s0-0 2) + ) + ) + ) ) ) ) + (label cfg-42) + (+! sv-240 1) ) - (set! sv-256 (+ sv-256 1)) ) - (cond - ((zero? sv-152) - ) - ((= sv-148 0.0) - ) - (else - (dotimes (v1-70 (-> this num-planes)) - (when (and (!= v1-70 s3-0) (!= v1-70 sv-240)) - (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-70))) (the-as float (-> s2-0 v1-70 w)))) - (goto cfg-42) - ) - ) + (when (nonzero? s0-0) + (vector-float*! s1-0 s1-0 (/ 1.0 (the float s0-0))) + (cond + ((< (-> arg2 allocated-length) (+ (-> arg2 length) 2)) + (format 0 "ERROR : vol-control #x~X out of volume normals~%" this) + ) + (else + (set! (-> arg2 data (-> arg2 length) quad) (-> s1-0 quad)) + (set! (-> arg2 data (+ (-> arg2 length) 1) quad) (-> s2-0 s3-0 quad)) + (+! (-> arg2 length) 2) + (set! (-> this normal-count) (+ (-> this normal-count) 2)) ) - (vector+float*! sv-224 sv-144 sv-192 sv-148) - (cond - ((< (-> arg1 allocated-length) (+ (-> arg1 length) 2)) - (format 0 "ERROR : vol-control #x~X out of volume points~%" this) - ) - (else - (set! (-> arg1 data (-> arg1 length) quad) (-> sv-144 quad)) - (set! (-> arg1 data (+ (-> arg1 length) 1) quad) (-> sv-224 quad)) - (+! (-> arg1 length) 2) - (+! (-> this point-count) 2) - ) - ) - (vector+! s1-0 s1-0 sv-144) - (vector+! s1-0 s1-0 sv-224) - (+! s0-0 2) ) ) ) ) ) - (label cfg-42) - (set! sv-240 (+ sv-240 1)) - ) - (when (nonzero? s0-0) - (vector-float*! s1-0 s1-0 (/ 1.0 (the float s0-0))) - (cond - ((< (-> arg2 allocated-length) (+ (-> arg2 length) 2)) - (format 0 "ERROR : vol-control #x~X out of volume normals~%" this) - ) - (else - (set! (-> arg2 data (-> arg2 length) quad) (-> s1-0 quad)) - (set! (-> arg2 data (+ (-> arg2 length) 1) quad) (-> s2-0 s3-0 quad)) - (+! (-> arg2 length) 2) - (set! (-> this normal-count) (+ (-> this normal-count) 2)) - ) - ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/gfx/foreground/ripple_REF.gc b/test/decompiler/reference/jak1/engine/gfx/foreground/ripple_REF.gc index ec68dde16f..0b55190489 100644 --- a/test/decompiler/reference/jak1/engine/gfx/foreground/ripple_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/foreground/ripple_REF.gc @@ -163,7 +163,6 @@ ;; definition for function ripple-find-height (defun ripple-find-height ((arg0 process-drawable) (arg1 int) (arg2 vector)) - (local-vars (sv-16 float) (sv-32 float)) (let* ((f30-0 (-> arg0 root trans y)) (v1-1 (-> arg0 draw)) (a1-5 (-> v1-1 lod-set lod (-> v1-1 cur-lod) geo effect)) @@ -197,20 +196,18 @@ (let* ((f22-1 (the float (the int f28-1))) (f24-1 (the float (the int f26-1))) (f20-0 (ripple-slow-add-sine-waves s5-0 f22-1 f24-1)) + (sv-16 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) + (sv-32 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1))) + (f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1))) + (f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-16 f20-0)))) + (f1-9 (+ sv-32 (* (- f28-1 f22-1) (- f1-6 sv-32)))) + (f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22)))) + (f0-23 (-> gp-0 faded-scale)) ) - (set! sv-16 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) - (set! sv-32 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1))) - (let* ((f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1))) - (f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-16 f20-0)))) - (f1-9 (+ sv-32 (* (- f28-1 f22-1) (- f1-6 sv-32)))) - (f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22)))) - (f0-23 (-> gp-0 faded-scale)) - ) - (if (< f0-23 0.0) - (set! f0-23 (-> gp-0 global-scale)) - ) - (+ f30-0 (* (/ f1-12 128) f0-23)) - ) + (if (< f0-23 0.0) + (set! f0-23 (-> gp-0 global-scale)) + ) + (+ f30-0 (* (/ f1-12 128) f0-23)) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/gfx/math-camera_REF.gc b/test/decompiler/reference/jak1/engine/gfx/math-camera_REF.gc index c6e8d57f9d..6eb17916b1 100644 --- a/test/decompiler/reference/jak1/engine/gfx/math-camera_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/math-camera_REF.gc @@ -39,28 +39,26 @@ (y-rat (-> math-cam y-ratio)) (cull-info (-> math-cam cull-info)) ) - (/ (+ 1.0 (* 4.0 x-rat x-rat)) (+ 1.0 (* x-rat x-rat))) - (let ((y-thing (/ (+ 1.0 (* 4.0 y-rat y-rat)) (+ 1.0 (* y-rat y-rat))))) + (/ (+ 1.0 (* 4.0 x-rat x-rat)) (+ 1.0 (square x-rat))) + (let ((y-thing (/ (+ 1.0 (* 4.0 y-rat y-rat)) (+ 1.0 (square y-rat))))) (set! (-> cull-info x-fact) (/ (+ 1.0 (* 4.0 x-rat x-rat)) (* x-rat (sqrtf (+ 1.0 (* 16.0 x-rat x-rat)))))) (set! (-> cull-info y-fact) (/ (+ 1.0 (* 4.0 y-rat y-rat)) (* y-rat (sqrtf (+ 1.0 (* 16.0 y-rat y-rat)))))) (set! (-> cull-info z-fact) (sqrtf (+ (* (+ -4.0 y-thing) (+ -4.0 y-thing) y-rat y-rat) (* (+ -1.0 y-thing) (+ -1.0 y-thing)))) ) ) - (let* ((near-x (* x-rat (-> math-cam d))) - (near-y (* y-rat (-> math-cam d))) - (near-corner-dist-sqr (+ (* near-x near-x) (* near-y near-y))) - (near-z (-> math-cam d)) - ) - (set! (-> cull-info cam-radius) (sqrtf (+ near-corner-dist-sqr (* near-z near-z)))) + (let ((near-x (* x-rat (-> math-cam d))) + (near-y (* y-rat (-> math-cam d))) + ) + (set! (-> cull-info cam-radius) (sqrtf (+ (square near-x) (square near-y) (square (-> math-cam d))))) ) (let* ((dx-rat-2 (* (-> math-cam d) (-> math-cam x-ratio))) (d-temp-2 (-> math-cam d)) (dx-rat-times-4 (* 4.0 dx-rat-2)) (d-temp-3 (-> math-cam d)) ) - (let ((inverse-x-len (/ 1.0 (sqrtf (+ (* dx-rat-2 dx-rat-2) (* d-temp-2 d-temp-2))))) - (inverse-x-len-2 (/ 1.0 (sqrtf (+ (* dx-rat-times-4 dx-rat-times-4) (* d-temp-3 d-temp-3))))) + (let ((inverse-x-len (/ 1.0 (sqrtf (+ (square dx-rat-2) (square d-temp-2))))) + (inverse-x-len-2 (/ 1.0 (sqrtf (+ (square dx-rat-times-4) (square d-temp-3))))) ) (set! (-> cull-info xz-dir-ax) (* dx-rat-2 inverse-x-len)) (set! (-> cull-info xz-dir-az) (* d-temp-2 inverse-x-len)) @@ -74,8 +72,8 @@ (dy-rat-times-4 (* 4.0 dy-rat)) (d-temp-5 (-> math-cam d)) ) - (let ((inverse-y-len (/ 1.0 (sqrtf (+ (* dy-rat dy-rat) (* d-temp-4 d-temp-4))))) - (inverse-y-len-2 (/ 1.0 (sqrtf (+ (* dy-rat-times-4 dy-rat-times-4) (* d-temp-5 d-temp-5))))) + (let ((inverse-y-len (/ 1.0 (sqrtf (+ (square dy-rat) (square d-temp-4))))) + (inverse-y-len-2 (/ 1.0 (sqrtf (+ (square dy-rat-times-4) (square d-temp-5))))) ) (set! (-> cull-info yz-dir-ay) (* dy-rat inverse-y-len)) (set! (-> cull-info yz-dir-az) (* d-temp-4 inverse-y-len)) diff --git a/test/decompiler/reference/jak1/engine/gfx/mood/mood-tables_REF.gc b/test/decompiler/reference/jak1/engine/gfx/mood/mood-tables_REF.gc index 7738fd4545..b8af250797 100644 --- a/test/decompiler/reference/jak1/engine/gfx/mood/mood-tables_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/mood/mood-tables_REF.gc @@ -257,12 +257,7 @@ (set! (-> v1-0 y) (- (-> arg0 direction y))) (set! (-> v1-0 z) (- (-> arg0 direction z))) (when (< (-> arg0 direction y) 0.9063) - (let* ((f0-7 0.4226) - (f1-1 (-> v1-0 x)) - (f1-3 (* f1-1 f1-1)) - (f2-0 (-> v1-0 z)) - (f0-8 (/ f0-7 (sqrtf (+ f1-3 (* f2-0 f2-0))))) - ) + (let ((f0-8 (/ 0.4226 (sqrtf (+ (square (-> v1-0 x)) (square (-> v1-0 z))))))) (set! (-> v1-0 x) (* (-> v1-0 x) f0-8)) (set! (-> v1-0 y) -0.9063) (set! (-> v1-0 z) (* (-> v1-0 z) f0-8)) diff --git a/test/decompiler/reference/jak1/engine/gfx/mood/mood_REF.gc b/test/decompiler/reference/jak1/engine/gfx/mood/mood_REF.gc index d18ed04f42..100a0dc4e0 100644 --- a/test/decompiler/reference/jak1/engine/gfx/mood/mood_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/mood/mood_REF.gc @@ -358,7 +358,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defun update-mood-interp ((arg0 mood-context) (arg1 mood-context) (arg2 mood-context) (arg3 float)) - (local-vars (sv-16 light)) (cond ((= arg3 0.0) (set! (-> arg0 current-fog fog-color quad) (-> arg1 current-fog fog-color quad)) @@ -423,8 +422,9 @@ ) (dotimes (s2-0 3) (let ((s1-0 (-> arg0 light-group 0 lights s2-0))) - (let ((s0-0 (-> arg1 light-group 0 lights s2-0))) - (set! sv-16 (-> arg2 light-group 0 lights s2-0)) + (let ((s0-0 (-> arg1 light-group 0 lights s2-0)) + (sv-16 (-> arg2 light-group 0 lights s2-0)) + ) (vector4-lerp! (-> s1-0 direction) (-> s0-0 direction) (-> sv-16 direction) arg3) (vector4-lerp! (-> s1-0 color) (-> s0-0 color) (-> sv-16 color) arg3) (vector4-lerp! (-> s1-0 levels) (-> s0-0 levels) (-> sv-16 levels) arg3) @@ -1586,7 +1586,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun update-mood-sunken ((arg0 mood-context) (arg1 float) (arg2 int)) - (local-vars (sv-80 vector)) (when (not (paused?)) (update-mood-fog arg0 arg1) (update-mood-sky-texture arg0 arg1) @@ -1635,33 +1634,26 @@ (let ((s2-1 (new 'static 'vector :x 0.193 :y 0.432 :z 0.721)) (s1-1 (new 'static 'vector :x 0.193 :y 0.338 :z 0.603)) (s0-0 (new 'static 'vector :x 0.193 :y 0.336 :z 0.721)) + (sv-80 (new 'static 'vector :x 0.215 :y 0.309 :z 0.674)) + (s3-2 (new 'stack-no-clear 'vector)) + (s4-3 (new 'stack-no-clear 'vector)) + (f26-3 (+ 0.75 + (* 0.0625 (cos (the float (* 4000 (-> *display* integral-frame-counter))))) + (* 0.0625 (cos (the float (shl (-> *display* integral-frame-counter) 11)))) + (* 0.125 (cos (the float (* 1500 (-> *display* integral-frame-counter))))) + ) + ) ) - (set! sv-80 (new 'static 'vector :x 0.215 :y 0.309 :z 0.674)) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (s4-3 (new 'stack-no-clear 'vector)) - (f26-3 (+ 0.75 - (* 0.0625 (cos (the float (* 4000 (-> *display* integral-frame-counter))))) - (* 0.0625 (cos (the float (shl (-> *display* integral-frame-counter) 11)))) - (* 0.125 (cos (the float (* 1500 (-> *display* integral-frame-counter))))) - ) - ) - ) - (vector4-lerp! s3-2 s2-1 s1-1 f28-0) - (let ((t9-16 vector4-lerp!) - (a0-19 s4-3) - (a3-7 f28-0) - ) - (t9-16 a0-19 s0-0 sv-80 a3-7) - ) - (let ((v1-18 (-> s5-1 0 dir2))) - (set! (-> v1-18 direction x) 0.0) - (set! (-> v1-18 direction y) 0.999) - (set! (-> v1-18 direction z) 0.011) - (set! (-> v1-18 direction w) 1.0) - ) - (vector4-lerp! (-> s5-1 0 dir2 color) s4-3 s3-2 f30-0) - (set! (-> s5-1 0 dir2 levels x) f26-3) + (vector4-lerp! s3-2 s2-1 s1-1 f28-0) + (vector4-lerp! s4-3 s0-0 sv-80 f28-0) + (let ((v1-18 (-> s5-1 0 dir2))) + (set! (-> v1-18 direction x) 0.0) + (set! (-> v1-18 direction y) 0.999) + (set! (-> v1-18 direction z) 0.011) + (set! (-> v1-18 direction w) 1.0) ) + (vector4-lerp! (-> s5-1 0 dir2 color) s4-3 s3-2 f30-0) + (set! (-> s5-1 0 dir2 levels x) f26-3) ) ) ) @@ -2002,12 +1994,7 @@ (set! (-> v1-21 y) (- (-> s4-0 y))) (set! (-> v1-21 z) (- (-> s4-0 z))) (when (< (-> s4-0 y) 0.9063) - (let* ((f0-22 0.4226) - (f1-3 (-> v1-21 x)) - (f1-5 (* f1-3 f1-3)) - (f2-2 (-> v1-21 z)) - (f0-23 (/ f0-22 (sqrtf (+ f1-5 (* f2-2 f2-2))))) - ) + (let ((f0-23 (/ 0.4226 (sqrtf (+ (square (-> v1-21 x)) (square (-> v1-21 z))))))) (set! (-> v1-21 x) (* (-> v1-21 x) f0-23)) (set! (-> v1-21 y) -0.9063) (set! (-> v1-21 z) (* (-> v1-21 z) f0-23)) @@ -2664,12 +2651,7 @@ (set! (-> v1-45 y) (- (-> a0-22 direction y))) (set! (-> v1-45 z) (- (-> a0-22 direction z))) (when (< (-> a0-22 direction y) 0.9063) - (let* ((f0-23 0.4226) - (f1-25 (-> v1-45 x)) - (f1-27 (* f1-25 f1-25)) - (f2-4 (-> v1-45 z)) - (f0-24 (/ f0-23 (sqrtf (+ f1-27 (* f2-4 f2-4))))) - ) + (let ((f0-24 (/ 0.4226 (sqrtf (+ (square (-> v1-45 x)) (square (-> v1-45 z))))))) (set! (-> v1-45 x) (* (-> v1-45 x) f0-24)) (set! (-> v1-45 y) -0.9063) (set! (-> v1-45 z) (* (-> v1-45 z) f0-24)) diff --git a/test/decompiler/reference/jak1/engine/gfx/mood/time-of-day_REF.gc b/test/decompiler/reference/jak1/engine/gfx/mood/time-of-day_REF.gc index 4f0426c74f..1c1452b528 100644 --- a/test/decompiler/reference/jak1/engine/gfx/mood/time-of-day_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/mood/time-of-day_REF.gc @@ -539,12 +539,7 @@ (set! (-> a2-30 y) (- (-> s5-2 dir0 direction y))) (set! (-> a2-30 z) (- (-> s5-2 dir0 direction z))) (when (< (-> s5-2 dir0 direction y) 0.9063) - (let* ((f0-56 0.4226) - (f1-17 (-> a2-30 x)) - (f1-19 (* f1-17 f1-17)) - (f2-7 (-> a2-30 z)) - (f0-57 (/ f0-56 (sqrtf (+ f1-19 (* f2-7 f2-7))))) - ) + (let ((f0-57 (/ 0.4226 (sqrtf (+ (square (-> a2-30 x)) (square (-> a2-30 z))))))) (set! (-> a2-30 x) (* (-> a2-30 x) f0-57)) (set! (-> a2-30 y) -0.9063) (set! (-> a2-30 z) (* (-> a2-30 z) f0-57)) diff --git a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-mid_REF.gc b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-mid_REF.gc index ec621a18ba..e672a68c7c 100644 --- a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-mid_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-mid_REF.gc @@ -977,42 +977,43 @@ ;; definition for function draw-ocean-mid-seams ;; INFO: Return type mismatch symbol vs none. (defun draw-ocean-mid-seams ((arg0 dma-buffer)) - (local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere)) (ocean-seams-add-constants arg0) - (set! sv-32 (-> *ocean-work* mid-minx)) - (set! sv-33 (-> *ocean-work* mid-maxx)) - (set! sv-34 (-> *ocean-work* mid-minz)) - (set! sv-35 (-> *ocean-work* mid-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-36 w) 278045.7) - (let ((s5-0 sv-34) - (s4-0 sv-35) + (let ((sv-32 (-> *ocean-work* mid-minx)) + (sv-33 (-> *ocean-work* mid-maxx)) + (sv-34 (-> *ocean-work* mid-minz)) + (sv-35 (-> *ocean-work* mid-maxz)) + (sv-36 (new 'stack 'sphere)) ) - (while (>= s4-0 s5-0) - (let ((s3-0 sv-32) - (s2-0 sv-33) - ) - (while (>= s2-0 s3-0) - (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) - (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) - (when (sphere-cull sv-36) - (cond - ((= s5-0 sv-34) - (ocean-mid-add-upload-top arg0 s5-0 s3-0) - ) - ((= s5-0 sv-35) - (ocean-mid-add-upload-bottom arg0 s5-0 s3-0) - ) - (else - (ocean-mid-add-upload-middle arg0 s5-0 s3-0) + (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-36 w) 278045.7) + (let ((s5-0 sv-34) + (s4-0 sv-35) + ) + (while (>= s4-0 s5-0) + (let ((s3-0 sv-32) + (s2-0 sv-33) + ) + (while (>= s2-0 s3-0) + (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) + (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) + (when (sphere-cull sv-36) + (cond + ((= s5-0 sv-34) + (ocean-mid-add-upload-top arg0 s5-0 s3-0) + ) + ((= s5-0 sv-35) + (ocean-mid-add-upload-bottom arg0 s5-0 s3-0) + ) + (else + (ocean-mid-add-upload-middle arg0 s5-0 s3-0) + ) ) ) + (+! s3-0 1) ) - (+! s3-0 1) ) + (+! s5-0 1) ) - (+! s5-0 1) ) ) (dotimes (v1-26 36) diff --git a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-texture_REF.gc b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-texture_REF.gc index da15e9040d..56003de1d0 100644 --- a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-texture_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-texture_REF.gc @@ -215,9 +215,8 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun draw-ocean-texture ((arg0 dma-buffer) (arg1 (inline-array vector)) (arg2 symbol)) - (local-vars (sv-16 (inline-array vector)) (sv-32 int) (sv-48 vector) (sv-64 (inline-array vector))) - (set! sv-64 arg1) - (let* ((s0-0 arg2) + (let* ((sv-64 arg1) + (s0-0 arg2) (a1-1 *ocean-base-page*) (s2-0 *ocean-base-block*) (s1-0 (+ a1-1 8)) @@ -237,18 +236,21 @@ ) (ocean-texture-add-constants arg0) (ocean-texture-add-envmap arg0) - (set! sv-16 sv-64) - (ocean-texture-add-verts arg0 sv-16) - (set! sv-48 (-> sv-16 192)) - (ocean-texture-add-call-start arg0) - (set! sv-32 0) - (while (< sv-32 9) - (ocean-texture-add-verts arg0 (the-as (inline-array vector) sv-48)) - (set! sv-48 (-> (the-as (inline-array vector) sv-48) 192)) - (ocean-texture-add-call-rest arg0) - (set! sv-32 (+ sv-32 1)) + (let ((sv-16 sv-64)) + (ocean-texture-add-verts arg0 sv-16) + (let ((sv-48 (-> sv-16 192))) + (ocean-texture-add-call-start arg0) + (let ((sv-32 0)) + (while (< sv-32 9) + (ocean-texture-add-verts arg0 (the-as (inline-array vector) sv-48)) + (set! sv-48 (-> (the-as (inline-array vector) sv-48) 192)) + (ocean-texture-add-call-rest arg0) + (+! sv-32 1) + ) + ) + (ocean-texture-add-verts-last arg0 (the-as (inline-array vector) sv-48) sv-64) + ) ) - (ocean-texture-add-verts-last arg0 (the-as (inline-array vector) sv-48) sv-64) (ocean-texture-add-call-rest arg0) (ocean-texture-add-call-done arg0) (when s0-0 diff --git a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-transition_REF.gc b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-transition_REF.gc index 0912bf92b1..1f324d3585 100644 --- a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-transition_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-transition_REF.gc @@ -492,21 +492,22 @@ ;; definition for function ocean-make-trans-camera-masks ;; INFO: Used lq/sq (defun ocean-make-trans-camera-masks ((arg0 uint) (arg1 uint) (arg2 uint) (arg3 uint)) - (local-vars (sv-48 ocean-trans-mask) (sv-52 vector) (sv-56 vector) (sv-60 vector)) - (set! sv-48 (-> *ocean-work* trans-camera-masks (+ (* arg2 4) arg3))) - (set! sv-52 (-> *math-camera* trans)) - (set! sv-56 (new-stack-vector0)) - (set! sv-60 (new-stack-vector0)) - (set! (-> sv-56 x) (+ (-> *ocean-map* start-corner x) (* 393216.0 (the float arg1)))) - (set! (-> sv-56 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-56 z) (+ (-> *ocean-map* start-corner z) (* 393216.0 (the float arg0)))) - (set! (-> sv-56 w) 1.0) - (dotimes (gp-0 4) - (dotimes (s5-0 4) - (set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s5-0))) (-> sv-52 x))) - (set! (-> sv-60 y) (- (-> sv-56 y) (-> sv-52 y))) - (set! (-> sv-60 z) (- (+ (-> sv-56 z) (* 98304.0 (the float gp-0))) (-> sv-52 z))) - (ocean-transition-check sv-48 s5-0 gp-0 sv-56) + (let ((sv-48 (-> *ocean-work* trans-camera-masks (+ (* arg2 4) arg3))) + (sv-52 (-> *math-camera* trans)) + (sv-56 (new-stack-vector0)) + (sv-60 (new-stack-vector0)) + ) + (set! (-> sv-56 x) (+ (-> *ocean-map* start-corner x) (* 393216.0 (the float arg1)))) + (set! (-> sv-56 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-56 z) (+ (-> *ocean-map* start-corner z) (* 393216.0 (the float arg0)))) + (set! (-> sv-56 w) 1.0) + (dotimes (gp-0 4) + (dotimes (s5-0 4) + (set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s5-0))) (-> sv-52 x))) + (set! (-> sv-60 y) (- (-> sv-56 y) (-> sv-52 y))) + (set! (-> sv-60 z) (- (+ (-> sv-56 z) (* 98304.0 (the float gp-0))) (-> sv-52 z))) + (ocean-transition-check sv-48 s5-0 gp-0 sv-56) + ) ) ) #f @@ -638,34 +639,35 @@ ;; definition for function draw-ocean-transition-seams (defun draw-ocean-transition-seams ((arg0 dma-buffer)) - (local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere)) - (set! sv-32 (-> *ocean-work* near-minx)) - (set! sv-33 (-> *ocean-work* near-maxx)) - (set! sv-34 (-> *ocean-work* near-minz)) - (set! sv-35 (-> *ocean-work* near-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-36 w) 69511.42) - (when (and (< sv-32 sv-33) (< sv-34 sv-35)) - (let ((s5-0 sv-34) - (s4-0 sv-35) - ) - (while (>= s4-0 s5-0) - (let ((s3-0 sv-32) - (s2-0 sv-33) - ) - (while (>= s2-0 s3-0) - (set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s3-0)) (-> *ocean-map* start-corner x))) - (set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s5-0)) (-> *ocean-map* start-corner z))) - (when (sphere-cull sv-36) - (if (not (ocean-trans-camera-masks-bit? s5-0 s3-0)) - (ocean-trans-add-upload arg0 (the-as int s5-0) (the-as int s3-0)) - ) - ) - (+! s3-0 1) + (let ((sv-32 (-> *ocean-work* near-minx)) + (sv-33 (-> *ocean-work* near-maxx)) + (sv-34 (-> *ocean-work* near-minz)) + (sv-35 (-> *ocean-work* near-maxz)) + (sv-36 (new 'stack 'sphere)) + ) + (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-36 w) 69511.42) + (when (and (< sv-32 sv-33) (< sv-34 sv-35)) + (let ((s5-0 sv-34) + (s4-0 sv-35) ) + (while (>= s4-0 s5-0) + (let ((s3-0 sv-32) + (s2-0 sv-33) + ) + (while (>= s2-0 s3-0) + (set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s3-0)) (-> *ocean-map* start-corner x))) + (set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s5-0)) (-> *ocean-map* start-corner z))) + (when (sphere-cull sv-36) + (if (not (ocean-trans-camera-masks-bit? s5-0 s3-0)) + (ocean-trans-add-upload arg0 (the-as int s5-0) (the-as int s3-0)) + ) + ) + (+! s3-0 1) + ) + ) + (+! s5-0 1) ) - (+! s5-0 1) ) ) ) @@ -711,15 +713,6 @@ ;; definition for function draw-ocean-transition ;; INFO: Return type mismatch int vs none. (defun draw-ocean-transition ((arg0 dma-buffer)) - (local-vars - (sv-32 uint) - (sv-33 uint) - (sv-34 uint) - (sv-35 uint) - (sv-36 sphere) - (sv-40 ocean-trans-mask) - (sv-44 uint) - ) (dotimes (v1-0 16) (set! (-> *ocean-work* trans-camera-masks v1-0 word) (the-as uint 0)) (set! (-> *ocean-work* near-mask-indices v1-0) (the-as uint -1)) @@ -727,123 +720,128 @@ (dotimes (v1-3 64) (set! (-> *ocean-work* trans-mask-ptrs v1-3) (the-as (pointer int32) #f)) ) - (set! sv-32 (-> *ocean-work* mid-minx)) - (set! sv-33 (-> *ocean-work* mid-maxx)) - (set! sv-34 (-> *ocean-work* mid-minz)) - (set! sv-35 (-> *ocean-work* mid-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-36 w) 278045.7) - (let ((s5-0 sv-34) - (s4-0 sv-35) + (let ((sv-32 (-> *ocean-work* mid-minx)) + (sv-33 (-> *ocean-work* mid-maxx)) + (sv-34 (-> *ocean-work* mid-minz)) + (sv-35 (-> *ocean-work* mid-maxz)) ) - (while (>= s4-0 s5-0) - (let ((s3-0 sv-32) - (s2-0 sv-33) + (let ((sv-36 (new 'stack 'sphere))) + (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-36 w) 278045.7) + (let ((s5-0 sv-34) + (s4-0 sv-35) ) - (while (>= s2-0 s3-0) - (when (not (ocean-mid-mask-ptrs-bit? s5-0 s3-0)) - (when (ocean-mid-camera-masks-bit? s5-0 s3-0) - (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) - (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) - (if (sphere-cull sv-36) - (ocean-make-trans-camera-masks s5-0 s3-0 (- s5-0 sv-34) (- s3-0 sv-32)) - ) - ) - ) - (+! s3-0 1) - ) - ) - (+! s5-0 1) - ) - ) - (let ((a2-2 192) - (a1-8 0) - (a0-11 192) - (v1-32 0) - ) - (let ((a3-1 sv-34) - (t0-0 sv-35) - ) - (while (>= t0-0 a3-1) - (let ((t1-0 sv-32) - (t2-0 sv-33) - ) - (while (>= t2-0 t1-0) - (set! sv-40 (-> *ocean-work* trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32)))) - (when (nonzero? (-> sv-40 word)) - (dotimes (t3-10 4) - (let ((t4-5 (-> sv-40 mask t3-10))) - (when (nonzero? t4-5) - (let ((t5-2 (+ (* a3-1 4) t3-10))) - (if (< t5-2 (the-as uint a0-11)) - (set! a0-11 (the-as int t5-2)) - ) - (if (< (the-as uint v1-32) t5-2) - (set! v1-32 (the-as int t5-2)) - ) + (while (>= s4-0 s5-0) + (let ((s3-0 sv-32) + (s2-0 sv-33) + ) + (while (>= s2-0 s3-0) + (when (not (ocean-mid-mask-ptrs-bit? s5-0 s3-0)) + (when (ocean-mid-camera-masks-bit? s5-0 s3-0) + (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) + (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) + (if (sphere-cull sv-36) + (ocean-make-trans-camera-masks s5-0 s3-0 (- s5-0 sv-34) (- s3-0 sv-32)) ) - (dotimes (t5-3 4) - (when (logtest? t4-5 (ash 1 t5-3)) - (let ((t6-9 (+ (* t1-0 4) t5-3))) - (if (< t6-9 (the-as uint a2-2)) - (set! a2-2 (the-as int t6-9)) - ) - (if (< (the-as uint a1-8) t6-9) - (set! a1-8 (the-as int t6-9)) - ) - ) - ) - ) - ) ) ) + (+! s3-0 1) ) - (+! t1-0 1) ) + (+! s5-0 1) ) - (+! a3-1 1) ) ) - (set! (-> *ocean-work* near-minx) (the-as uint (+ a2-2 -1))) - (set! (-> *ocean-work* near-maxx) (the-as uint (+ a1-8 1))) - (set! (-> *ocean-work* near-minz) (the-as uint (+ a0-11 -1))) - (set! (-> *ocean-work* near-maxz) (the-as uint (+ v1-32 1))) - ) - (dotimes (v1-34 16) - (set! (-> *ocean-work* trans-temp-masks v1-34 word) (-> *ocean-work* trans-camera-masks v1-34 word)) - ) - (let ((s5-1 sv-34) - (s4-1 sv-35) - ) - (while (>= s4-1 s5-1) - (let ((s3-1 sv-32) - (s2-1 sv-33) + (let ((a2-2 192) + (a1-8 0) + (a0-11 192) + (v1-32 0) + ) + (let ((a3-1 sv-34) + (t0-0 sv-35) ) - (while (>= s2-1 s3-1) - (when (not (ocean-mid-mask-ptrs-bit? s5-1 s3-1)) - (when (ocean-mid-camera-masks-bit? s5-1 s3-1) - (let ((v1-43 (-> *ocean-map* ocean-trans-indices data (+ (* (the-as uint 48) s5-1) s3-1)))) - (when (>= (-> v1-43 parent) 0) - (set! sv-44 (+ (* (- s5-1 sv-34) 4) (- s3-1 sv-32))) - (set! (-> *ocean-work* near-mask-indices sv-44) (the-as uint (-> v1-43 child))) - (let ((s1-0 (-> *ocean-map* ocean-mid-masks data (-> v1-43 parent)))) - (dotimes (s0-0 4) - (let ((a3-5 (-> (the-as ocean-mid-mask (+ s0-0 (the-as int s1-0))) mask 0))) - (if (!= a3-5 255) - (ocean-trans-add-upload-strip arg0 s5-1 s3-1 a3-5 sv-44 (the-as uint s0-0)) + (while (>= t0-0 a3-1) + (let ((t1-0 sv-32) + (t2-0 sv-33) + ) + (while (>= t2-0 t1-0) + (let ((sv-40 (-> *ocean-work* trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32))))) + (when (nonzero? (-> sv-40 word)) + (dotimes (t3-10 4) + (let ((t4-5 (-> sv-40 mask t3-10))) + (when (nonzero? t4-5) + (let ((t5-2 (+ (* a3-1 4) t3-10))) + (if (< t5-2 (the-as uint a0-11)) + (set! a0-11 (the-as int t5-2)) + ) + (if (< (the-as uint v1-32) t5-2) + (set! v1-32 (the-as int t5-2)) + ) + ) + (dotimes (t5-3 4) + (when (logtest? t4-5 (ash 1 t5-3)) + (let ((t6-9 (+ (* t1-0 4) t5-3))) + (if (< t6-9 (the-as uint a2-2)) + (set! a2-2 (the-as int t6-9)) + ) + (if (< (the-as uint a1-8) t6-9) + (set! a1-8 (the-as int t6-9)) + ) + ) ) + ) + ) + ) + ) + ) + ) + (+! t1-0 1) + ) + ) + (+! a3-1 1) + ) + ) + (set! (-> *ocean-work* near-minx) (the-as uint (+ a2-2 -1))) + (set! (-> *ocean-work* near-maxx) (the-as uint (+ a1-8 1))) + (set! (-> *ocean-work* near-minz) (the-as uint (+ a0-11 -1))) + (set! (-> *ocean-work* near-maxz) (the-as uint (+ v1-32 1))) + ) + (dotimes (v1-34 16) + (set! (-> *ocean-work* trans-temp-masks v1-34 word) (-> *ocean-work* trans-camera-masks v1-34 word)) + ) + (let ((s5-1 sv-34) + (s4-1 sv-35) + ) + (while (>= s4-1 s5-1) + (let ((s3-1 sv-32) + (s2-1 sv-33) + ) + (while (>= s2-1 s3-1) + (when (not (ocean-mid-mask-ptrs-bit? s5-1 s3-1)) + (when (ocean-mid-camera-masks-bit? s5-1 s3-1) + (let ((v1-43 (-> *ocean-map* ocean-trans-indices data (+ (* (the-as uint 48) s5-1) s3-1)))) + (when (>= (-> v1-43 parent) 0) + (let ((sv-44 (+ (* (- s5-1 sv-34) 4) (- s3-1 sv-32)))) + (set! (-> *ocean-work* near-mask-indices sv-44) (the-as uint (-> v1-43 child))) + (let ((s1-0 (-> *ocean-map* ocean-mid-masks data (-> v1-43 parent)))) + (dotimes (s0-0 4) + (let ((a3-5 (-> (the-as ocean-mid-mask (+ s0-0 (the-as int s1-0))) mask 0))) + (if (!= a3-5 255) + (ocean-trans-add-upload-strip arg0 s5-1 s3-1 a3-5 sv-44 (the-as uint s0-0)) + ) + ) + ) ) ) ) ) ) ) + (+! s3-1 1) ) - (+! s3-1 1) ) + (+! s5-1 1) ) - (+! s5-1 1) ) ) (ocean-mid-add-call-flush arg0 (the-as uint 41)) diff --git a/test/decompiler/reference/jak1/engine/gfx/shadow/shadow_REF.gc b/test/decompiler/reference/jak1/engine/gfx/shadow/shadow_REF.gc index 89538dd713..309557159f 100644 --- a/test/decompiler/reference/jak1/engine/gfx/shadow/shadow_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/shadow/shadow_REF.gc @@ -52,27 +52,20 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun compute-and-draw-shadow ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float) (arg5 float)) - (local-vars - (v1-10 float) - (v1-11 float) - (sv-96 vector) - (sv-112 (function quaternion vector float quaternion)) - (sv-128 vector) - (sv-144 vector) - ) + (local-vars (v1-10 float) (v1-11 float)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) ) (init-vf0-vector) - (set! sv-96 arg2) - (let ((s4-0 arg3) + (let ((sv-96 arg2) + (s4-0 arg3) (s3-0 arg4) (s2-0 arg5) ) (when (< (- (-> arg0 y) (-> arg1 y)) s3-0) - (set! sv-144 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) + (let ((sv-144 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'sparticle-cpuinfo)) ) (+! (-> arg1 y) 40.96) @@ -80,11 +73,7 @@ (set! (-> sv-144 y) 0.0) (set! (-> sv-144 z) (- (-> sv-96 x))) (vector-normalize! sv-144 1.0) - (set! sv-112 quaternion-vector-angle!) - (set! sv-128 s0-0) - (let ((a2-1 (acos (-> sv-96 y)))) - (sv-112 (the-as quaternion sv-128) sv-144 a2-1) - ) + (quaternion-vector-angle! (the-as quaternion s0-0) sv-144 (acos (-> sv-96 y))) (let ((v1-9 s1-0)) (cond ((< (-> s0-0 w) 0.0) diff --git a/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle-launcher_REF.gc b/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle-launcher_REF.gc index ff3fda8d7f..0b2dea425a 100644 --- a/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle-launcher_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle-launcher_REF.gc @@ -559,7 +559,7 @@ (set! (-> v1-0 x) f0-0) (set! (-> v1-0 y) f1-0) (set! (-> v1-0 z) f3-0) - (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))) ) (quaternion->matrix s5-0 a1-1) ) @@ -814,7 +814,7 @@ (set! (-> v1-0 x) f0-0) (set! (-> v1-0 y) f1-0) (set! (-> v1-0 z) f3-0) - (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))) ) (set! (-> arg3 qx-qy-qz-sy x) 0.0) (set! (-> arg3 qx-qy-qz-sy y) 0.0) @@ -1181,7 +1181,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f3-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))) ) (quaternion-rotate-y! (the-as quaternion s4-0) (the-as quaternion s4-0) (-> s5-0 sprite rot)) (let ((v1-3 arg2)) @@ -1240,7 +1240,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f3-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))) ) (let ((a1-1 (new-stack-vector0))) (set! (-> a1-1 y) (-> s5-0 sprite rot)) diff --git a/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle_REF.gc b/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle_REF.gc index 7f0314b9e8..1af5106da7 100644 --- a/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle_REF.gc @@ -358,59 +358,27 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun sp-process-block ((arg0 sparticle-system) (arg1 int) (arg2 sprite-array-2d) (arg3 int)) - (local-vars - (sv-16 int) - (sv-32 int) - (sv-48 (function sparticle-system int int int int symbol none)) - (sv-64 sparticle-system) - (sv-80 int) - (sv-96 int) - (sv-112 int) - (sv-128 (function sparticle-system int int int int symbol none)) - (sv-144 sparticle-system) - (sv-160 int) - (sv-176 int) - (sv-192 int) - ) - (let ((s3-0 16) - (s2-0 (* 144 arg3)) - (s5-0 (* 48 arg3)) - ) - (set! sv-32 (* 80 arg3)) - (let ((s1-0 (+ s3-0 s2-0))) - (set! sv-16 (+ s1-0 s5-0)) + (let* ((s3-0 16) + (s2-0 (* 144 arg3)) + (s5-0 (* 48 arg3)) + (sv-32 (* 80 arg3)) + (s1-0 (+ s3-0 s2-0)) + ) + (let ((sv-16 (+ s1-0 s5-0))) (sp-copy-to-spr s3-0 (the-as pointer (-> arg0 cpuinfo-table arg1)) s2-0) (sp-copy-to-spr s1-0 (&+ (-> arg0 vecdata-table) (* 48 arg1)) s5-0) - (let ((t9-2 sp-copy-to-spr) - (a1-7 (-> arg0 adgifdata-table arg1)) - ) - (t9-2 sv-16 (the-as pointer a1-7) sv-32) - ) - (set! sv-80 (+ #x70000000 s3-0)) - (set! sv-96 (+ #x70000000 s1-0)) - (cond - ((-> arg0 is-3d) - (set! sv-48 sp-process-block-3d) - (set! sv-64 arg0) - (set! sv-112 arg1) - (let ((t1-0 (paused?))) - (sv-48 sv-64 sv-80 sv-96 sv-112 arg3 t1-0) - ) - ) - (else - (set! sv-128 sp-process-block-2d) - (set! sv-144 arg0) - (set! sv-160 sv-80) - (set! sv-176 sv-96) - (set! sv-192 arg1) - (let ((t1-1 (paused?))) - (sv-128 sv-144 sv-160 sv-176 sv-192 arg3 t1-1) - ) - ) - ) - (sp-copy-from-spr s3-0 (the-as pointer (-> arg0 cpuinfo-table arg1)) s2-0) - (sp-copy-from-spr s1-0 (&+ (-> arg0 vecdata-table) (* 48 arg1)) s5-0) + (sp-copy-to-spr sv-16 (the-as pointer (-> arg0 adgifdata-table arg1)) sv-32) ) + (let ((sv-80 (+ #x70000000 s3-0)) + (sv-96 (+ #x70000000 s1-0)) + ) + (if (-> arg0 is-3d) + (sp-process-block-3d arg0 sv-80 sv-96 arg1 arg3 (paused?)) + (sp-process-block-2d arg0 sv-80 sv-96 arg1 arg3 (paused?)) + ) + ) + (sp-copy-from-spr s3-0 (the-as pointer (-> arg0 cpuinfo-table arg1)) s2-0) + (sp-copy-from-spr s1-0 (&+ (-> arg0 vecdata-table) (* 48 arg1)) s5-0) ) 0 (none) @@ -452,7 +420,6 @@ (arg1 (function sparticle-system sparticle-cpuinfo none)) (arg2 sparticle-system) ) - (local-vars (sv-16 int)) (let ((s3-0 (the-as object (-> arg2 cpuinfo-table 0))) (s2-0 (&+ (-> arg2 vecdata-table) 0)) (s1-0 (+ (-> arg2 blocks 0) (-> arg2 blocks 1))) @@ -460,14 +427,15 @@ (dotimes (s0-0 s1-0) (cond ((!= (-> arg2 alloc-table s0-0) -1) - (set! sv-16 0) - (while (< sv-16 64) - (if (and (-> (the-as sparticle-cpuinfo s3-0) valid) (= (-> (the-as sparticle-cpuinfo s3-0) key) arg0)) - (arg1 arg2 (the-as sparticle-cpuinfo s3-0)) - ) - (set! s3-0 (-> (the-as (inline-array sparticle-cpuinfo) s3-0) 1)) - (&+! s2-0 48) - (set! sv-16 (+ sv-16 1)) + (let ((sv-16 0)) + (while (< sv-16 64) + (if (and (-> (the-as sparticle-cpuinfo s3-0) valid) (= (-> (the-as sparticle-cpuinfo s3-0) key) arg0)) + (arg1 arg2 (the-as sparticle-cpuinfo s3-0)) + ) + (set! s3-0 (-> (the-as (inline-array sparticle-cpuinfo) s3-0) 1)) + (&+! s2-0 48) + (+! sv-16 1) + ) ) ) (else diff --git a/test/decompiler/reference/jak1/engine/gfx/sprite/sprite-distort_REF.gc b/test/decompiler/reference/jak1/engine/gfx/sprite/sprite-distort_REF.gc index ca59e5843d..f31cacf4ee 100644 --- a/test/decompiler/reference/jak1/engine/gfx/sprite/sprite-distort_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/sprite/sprite-distort_REF.gc @@ -169,15 +169,7 @@ ;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP] ;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping] (defun sprite-draw-distorters ((arg0 dma-buffer)) - (local-vars - (v1-14 float) - (v1-20 float) - (v1-25 int) - (v1-57 float) - (sv-16 sprite-vec-data-2d) - (sv-32 pointer) - (sv-48 pointer) - ) + (local-vars (v1-14 float) (v1-20 float) (v1-25 int) (v1-57 float)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -202,10 +194,11 @@ (s2-0 (-> s3-0 entry)) ) (dotimes (s1-0 s2-0) - (set! sv-16 (-> s3-0 data s1-0)) - (let ((a0-1 (the-as object (-> arg0 base)))) - (set! sv-32 (&+ (the-as pointer a0-1) 16)) - (set! sv-48 (&+ (the-as pointer a0-1) 32)) + (let* ((sv-16 (-> s3-0 data s1-0)) + (a0-1 (the-as object (-> arg0 base))) + (sv-32 (&+ (the-as pointer a0-1) 16)) + (sv-48 (&+ (the-as pointer a0-1) 32)) + ) (cond ((= (-> sv-16 matrix) 1) (.lvf vf3 (&-> *math-camera* sprite-2d vector 0 quad)) @@ -247,32 +240,32 @@ (set! (-> (the-as vector sv-32) y) (* 0.00390625 (+ -2048.0 (the float (-> *video-parms* screen-hy)) (-> (the-as vector a0-1) y))) ) - ) - (set! (-> (the-as vector sv-32) z) 1.0) - (when (or (< (-> sv-16 flag) 3) (< 11 (-> sv-16 flag))) - (format 0 "Turns = ~D!!!~%" (-> sv-16 flag)) - (set! (-> (the-as (pointer int32) sv-16) 4) 11) - ) - (set! (-> (the-as (pointer int32) sv-32) 3) (-> sv-16 flag)) - (let* ((f0-7 (- (-> *math-camera* perspective vector 1 y))) - (f2-4 (-> (the-as vector sv-32) y)) - (f4-0 (+ f2-4 (* (-> (the-as (pointer float) sv-48)) f0-7))) - (f3-0 256.0) - (f1-7 (-> (the-as (pointer float) sv-48))) - ) - (if (< (the float (-> *video-parms* screen-sy)) f4-0) - (set! f3-0 (/ (- (the float (-> *video-parms* screen-sy)) f2-4) f0-7)) + (set! (-> (the-as vector sv-32) z) 1.0) + (when (or (< (-> sv-16 flag) 3) (< 11 (-> sv-16 flag))) + (format 0 "Turns = ~D!!!~%" (-> sv-16 flag)) + (set! (-> (the-as (pointer int32) sv-16) 4) 11) + ) + (set! (-> (the-as (pointer int32) sv-32) 3) (-> sv-16 flag)) + (let* ((f0-7 (- (-> *math-camera* perspective vector 1 y))) + (f2-4 (-> (the-as vector sv-32) y)) + (f4-0 (+ f2-4 (* (-> (the-as (pointer float) sv-48)) f0-7))) + (f3-0 256.0) + (f1-7 (-> (the-as (pointer float) sv-48))) + ) + (if (< (the float (-> *video-parms* screen-sy)) f4-0) + (set! f3-0 (/ (- (the float (-> *video-parms* screen-sy)) f2-4) f0-7)) + ) + (if (< 128.0 f3-0) + (set! f3-0 128.0) + ) + (when (< f3-0 f1-7) + (let ((v1-55 (/ f3-0 f1-7))) + (.mov vf1 v1-55) + ) + (.mul.x.vf vf2 vf2 vf1) + (.svf (&-> (the-as vector sv-48) quad) vf2) + (.mov v1-57 vf2) ) - (if (< 128.0 f3-0) - (set! f3-0 128.0) - ) - (when (< f3-0 f1-7) - (let ((v1-55 (/ f3-0 f1-7))) - (.mov vf1 v1-55) - ) - (.mul.x.vf vf2 vf2 vf1) - (.svf (&-> (the-as vector sv-48) quad) vf2) - (.mov v1-57 vf2) ) ) (&+! (-> arg0 base) 48) diff --git a/test/decompiler/reference/jak1/engine/gfx/sprite/sprite_REF.gc b/test/decompiler/reference/jak1/engine/gfx/sprite/sprite_REF.gc index 90881381a6..4583682785 100644 --- a/test/decompiler/reference/jak1/engine/gfx/sprite/sprite_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/sprite/sprite_REF.gc @@ -474,7 +474,7 @@ (set! (-> arg0 x) f0-0) (set! (-> arg0 y) f1-0) (set! (-> arg0 z) f3-0) - (set! (-> arg0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> arg0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))) ) arg0 ) diff --git a/test/decompiler/reference/jak1/engine/gfx/texture/texture_REF.gc b/test/decompiler/reference/jak1/engine/gfx/texture/texture_REF.gc index 08bb01eb55..8e8416b5cf 100644 --- a/test/decompiler/reference/jak1/engine/gfx/texture/texture_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/texture/texture_REF.gc @@ -830,81 +830,78 @@ ;; definition for function upload-vram-pages (defun upload-vram-pages ((pool texture-pool) (segment texture-pool-segment) (page texture-page) (mode int) (bucket-idx bucket-id)) - (local-vars - (tex-data pointer) - (tex-dest-base-chunk uint) - (chunk-count int) - (chunks-to-upload-count int) - (first-chunk-idx-to-upload int) - (tex-id uint) - ) (let ((total-upload-size 0)) (let* ((dma-buf (-> *display* frames (-> *display* on-screen) frame global-buf)) (dma-start (-> dma-buf base)) ) - (set! tex-data (-> page segment 0 block-data)) - (set! tex-dest-base-chunk (shr (-> page segment 0 dest) 12)) - (set! chunk-count (the-as int (-> page segment 0 size))) - (set! chunks-to-upload-count 0) - (set! first-chunk-idx-to-upload 0) - (set! tex-id (-> page id)) - (let ((v1-8 mode)) - (cond - ((= v1-8 -3) - (return 0) - ) - ((zero? v1-8) - ) - ((= v1-8 -2) - (set! chunk-count (the-as int (+ chunk-count (-> page segment 1 size)))) - ) - ((= v1-8 -1) - (set! chunk-count (the-as int (-> page size))) - ) - ((= v1-8 2) - (set! tex-data (-> page segment 2 block-data)) - (set! tex-dest-base-chunk (shr (-> page segment 2 dest) 12)) - (set! chunk-count (the-as int (-> page segment 2 size))) - ) - ) - ) - (set! chunk-count (shr (min (the-as int (-> segment size)) (the-as int (+ chunk-count 4095))) 12)) - (dotimes (upload-chunk-idx chunk-count) - (let ((current-dest-chunk (+ tex-dest-base-chunk upload-chunk-idx))) - (cond - ((zero? chunks-to-upload-count) - (when (!= (-> pool ids current-dest-chunk) tex-id) - (set! first-chunk-idx-to-upload upload-chunk-idx) - (set! (-> pool ids current-dest-chunk) tex-id) - (set! chunks-to-upload-count (+ chunks-to-upload-count 1)) + (let ((tex-data (-> page segment 0 block-data)) + (tex-dest-base-chunk (shr (-> page segment 0 dest) 12)) + (chunk-count (the-as int (-> page segment 0 size))) + (chunks-to-upload-count 0) + (first-chunk-idx-to-upload 0) + ) + (let ((tex-id (-> page id))) + (let ((v1-8 mode)) + (cond + ((= v1-8 -3) + (return 0) ) - ) - ((= (-> pool ids current-dest-chunk) tex-id) - (upload-vram-data - dma-buf - (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) - (&+ tex-data (shl first-chunk-idx-to-upload 14)) - (* chunks-to-upload-count 32) + ((zero? v1-8) ) - (+! total-upload-size chunks-to-upload-count) - (set! chunks-to-upload-count 0) - 0 - ) - (else - (set! (-> pool ids current-dest-chunk) tex-id) - (set! chunks-to-upload-count (+ chunks-to-upload-count 1)) + ((= v1-8 -2) + (set! chunk-count (the-as int (+ (the-as uint chunk-count) (-> page segment 1 size)))) + ) + ((= v1-8 -1) + (set! chunk-count (the-as int (-> page size))) + ) + ((= v1-8 2) + (set! tex-data (-> page segment 2 block-data)) + (set! tex-dest-base-chunk (shr (-> page segment 2 dest) 12)) + (set! chunk-count (the-as int (-> page segment 2 size))) + ) + ) + ) + (set! chunk-count + (shr (min (the-as int (-> segment size)) (the-as int (+ (the-as uint chunk-count) 4095))) 12) + ) + (dotimes (upload-chunk-idx chunk-count) + (let ((current-dest-chunk (+ tex-dest-base-chunk upload-chunk-idx))) + (cond + ((zero? chunks-to-upload-count) + (when (!= (-> pool ids current-dest-chunk) tex-id) + (set! first-chunk-idx-to-upload upload-chunk-idx) + (set! (-> pool ids current-dest-chunk) tex-id) + (+! chunks-to-upload-count 1) + ) + ) + ((= (-> pool ids current-dest-chunk) tex-id) + (upload-vram-data + dma-buf + (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) + (&+ tex-data (shl first-chunk-idx-to-upload 14)) + (* chunks-to-upload-count 32) + ) + (+! total-upload-size chunks-to-upload-count) + (set! chunks-to-upload-count 0) + 0 + ) + (else + (set! (-> pool ids current-dest-chunk) tex-id) + (+! chunks-to-upload-count 1) + ) + ) ) ) ) - ) - (when (nonzero? chunks-to-upload-count) - (upload-vram-data - dma-buf - (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) - (&+ tex-data (shl first-chunk-idx-to-upload 14)) - (* chunks-to-upload-count 32) + (when (nonzero? chunks-to-upload-count) + (upload-vram-data + dma-buf + (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) + (&+ tex-data (shl first-chunk-idx-to-upload 14)) + (* chunks-to-upload-count 32) + ) + (+! total-upload-size chunks-to-upload-count) ) - (+! total-upload-size chunks-to-upload-count) ) (let* ((v1-47 dma-buf) (dma (the-as dma-packet (-> v1-47 base))) @@ -1007,63 +1004,60 @@ (bucket-idx bucket-id) (allow-cache-mask int) ) - (local-vars - (tex-data pointer) - (tex-dest-base-chunk uint) - (chunk-count int) - (chunks-to-upload-count int) - (first-chunk-idx-to-upload int) - (page-id uint) - (current-dest-chunk uint) - (need-tex symbol) - ) (let ((total-upload-size 0)) (let* ((dma-buf (-> *display* frames (-> *display* on-screen) frame global-buf)) (s4-0 (-> dma-buf base)) ) - (set! tex-data (-> page segment 0 block-data)) - (set! tex-dest-base-chunk (shr (-> page segment 0 dest) 12)) - (set! chunk-count (the-as int (-> page size))) - (set! chunks-to-upload-count 0) - (set! first-chunk-idx-to-upload 0) - (set! page-id (-> page id)) - (set! chunk-count (shr (min (the-as int (-> segment size)) (the-as int (+ chunk-count 4095))) 12)) - (dotimes (upload-chunk-idx chunk-count) - (set! current-dest-chunk (+ tex-dest-base-chunk upload-chunk-idx)) - (set! need-tex (logtest? allow-cache-mask (ash 1 upload-chunk-idx))) - (cond - ((zero? chunks-to-upload-count) - (when (and (!= (-> pool ids current-dest-chunk) page-id) need-tex) - (set! first-chunk-idx-to-upload upload-chunk-idx) - (set! (-> pool ids current-dest-chunk) page-id) - (set! chunks-to-upload-count (+ chunks-to-upload-count 1)) - ) - ) - ((or (= (-> pool ids current-dest-chunk) page-id) (not need-tex)) - (upload-vram-data - dma-buf - (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) - (&+ tex-data (shl first-chunk-idx-to-upload 14)) - (* chunks-to-upload-count 32) - ) - (+! total-upload-size chunks-to-upload-count) - (set! chunks-to-upload-count 0) - 0 - ) - (else - (set! (-> pool ids current-dest-chunk) page-id) - (set! chunks-to-upload-count (+ chunks-to-upload-count 1)) + (let ((tex-data (-> page segment 0 block-data)) + (tex-dest-base-chunk (shr (-> page segment 0 dest) 12)) + (chunk-count (the-as int (-> page size))) + (chunks-to-upload-count 0) + (first-chunk-idx-to-upload 0) + ) + (let ((page-id (-> page id))) + (set! chunk-count + (shr (min (the-as int (-> segment size)) (the-as int (+ (the-as uint chunk-count) 4095))) 12) + ) + (dotimes (upload-chunk-idx chunk-count) + (let ((current-dest-chunk (+ tex-dest-base-chunk upload-chunk-idx)) + (need-tex (logtest? allow-cache-mask (ash 1 upload-chunk-idx))) + ) + (cond + ((zero? chunks-to-upload-count) + (when (and (!= (-> pool ids current-dest-chunk) page-id) need-tex) + (set! first-chunk-idx-to-upload upload-chunk-idx) + (set! (-> pool ids current-dest-chunk) page-id) + (+! chunks-to-upload-count 1) + ) + ) + ((or (= (-> pool ids current-dest-chunk) page-id) (not need-tex)) + (upload-vram-data + dma-buf + (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) + (&+ tex-data (shl first-chunk-idx-to-upload 14)) + (* chunks-to-upload-count 32) + ) + (+! total-upload-size chunks-to-upload-count) + (set! chunks-to-upload-count 0) + 0 + ) + (else + (set! (-> pool ids current-dest-chunk) page-id) + (+! chunks-to-upload-count 1) + ) + ) + ) ) ) - ) - (when (nonzero? chunks-to-upload-count) - (upload-vram-data - dma-buf - (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) - (&+ tex-data (shl first-chunk-idx-to-upload 14)) - (* chunks-to-upload-count 32) + (when (nonzero? chunks-to-upload-count) + (upload-vram-data + dma-buf + (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) + (&+ tex-data (shl first-chunk-idx-to-upload 14)) + (* chunks-to-upload-count 32) + ) + (+! total-upload-size chunks-to-upload-count) ) - (+! total-upload-size chunks-to-upload-count) ) (let* ((v1-52 dma-buf) (dma (the-as dma-packet (-> v1-52 base))) @@ -1811,9 +1805,8 @@ ;; definition for method 13 of type texture-page (defmethod add-to-dma-buffer ((this texture-page) (dma-buff dma-buffer) (mode int)) - (local-vars (total-size int)) - (let ((v1-0 mode)) - (set! total-size (cond + (let* ((v1-0 mode) + (total-size (cond ((= v1-0 -3) 0 ) @@ -1827,53 +1820,54 @@ (the-as int (-> this segment mode size)) ) ) - ) - ) - (let* ((start-segment (max 0 mode)) - (chunk-count (* (/ (+ (/ total-size 64) 63) 64) 32)) - (current-dest (shr (-> this segment start-segment dest) 6)) - (current-data (-> this segment start-segment block-data)) + ) ) - (while (> chunk-count 0) - (let ((chunks-now (min 2048 chunk-count))) - (let* ((v1-11 dma-buff) - (pkt (the-as dma-packet (-> v1-11 base))) - ) - (set! (-> pkt dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt))) - (set! (-> pkt vif0) (new 'static 'vif-tag)) - (set! (-> pkt vif1) (new 'static 'vif-tag :imm #x5 :cmd (vif-cmd direct) :msk #x1)) - (set! (-> v1-11 base) (&+ (the-as pointer pkt) 16)) + (let* ((start-segment (max 0 mode)) + (chunk-count (* (/ (+ (/ total-size 64) 63) 64) 32)) + (current-dest (shr (-> this segment start-segment dest) 6)) + (current-data (-> this segment start-segment block-data)) + ) + (while (> chunk-count 0) + (let ((chunks-now (min 2048 chunk-count))) + (let* ((v1-11 dma-buff) + (pkt (the-as dma-packet (-> v1-11 base))) + ) + (set! (-> pkt dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt))) + (set! (-> pkt vif0) (new 'static 'vif-tag)) + (set! (-> pkt vif1) (new 'static 'vif-tag :imm #x5 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-11 base) (&+ (the-as pointer pkt) 16)) + ) + (let* ((v1-12 dma-buff) + (gs-tag (the-as gs-gif-tag (-> v1-12 base))) + ) + (set! (-> gs-tag tag) (new 'static 'gif-tag64 :nloop #x4 :nreg #x1)) + (set! (-> gs-tag regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))) + (set! (-> v1-12 base) (&+ (the-as pointer gs-tag) 16)) + ) + (let* ((v1-13 dma-buff) + (gs-reg-data (-> v1-13 base)) + ) + (set! (-> (the-as (pointer gs-bitbltbuf) gs-reg-data) 0) + (new 'static 'gs-bitbltbuf :dbw #x2 :dbp current-dest) + ) + (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 1) (gs-reg64 bitbltbuf)) + (set! (-> (the-as (pointer gs-trxpos) gs-reg-data) 2) (new 'static 'gs-trxpos)) + (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 3) (gs-reg64 trxpos)) + (set! (-> (the-as (pointer gs-trxreg) gs-reg-data) 4) (new 'static 'gs-trxreg :rrw #x80 :rrh chunks-now)) + (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 5) (gs-reg64 trxreg)) + (set! (-> (the-as (pointer gs-trxdir) gs-reg-data) 6) (new 'static 'gs-trxdir)) + (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 7) (gs-reg64 trxdir)) + (set! (-> v1-13 base) (&+ gs-reg-data 64)) + ) + (dma-buffer-add-ref-texture dma-buff current-data 128 chunks-now (gs-psm ct32)) ) - (let* ((v1-12 dma-buff) - (gs-tag (the-as gs-gif-tag (-> v1-12 base))) - ) - (set! (-> gs-tag tag) (new 'static 'gif-tag64 :nloop #x4 :nreg #x1)) - (set! (-> gs-tag regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))) - (set! (-> v1-12 base) (&+ (the-as pointer gs-tag) 16)) - ) - (let* ((v1-13 dma-buff) - (gs-reg-data (-> v1-13 base)) - ) - (set! (-> (the-as (pointer gs-bitbltbuf) gs-reg-data) 0) - (new 'static 'gs-bitbltbuf :dbw #x2 :dbp current-dest) - ) - (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 1) (gs-reg64 bitbltbuf)) - (set! (-> (the-as (pointer gs-trxpos) gs-reg-data) 2) (new 'static 'gs-trxpos)) - (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 3) (gs-reg64 trxpos)) - (set! (-> (the-as (pointer gs-trxreg) gs-reg-data) 4) (new 'static 'gs-trxreg :rrw #x80 :rrh chunks-now)) - (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 5) (gs-reg64 trxreg)) - (set! (-> (the-as (pointer gs-trxdir) gs-reg-data) 6) (new 'static 'gs-trxdir)) - (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 7) (gs-reg64 trxdir)) - (set! (-> v1-13 base) (&+ gs-reg-data 64)) - ) - (dma-buffer-add-ref-texture dma-buff current-data 128 chunks-now (gs-psm ct32)) + (+! current-dest 4096) + (&+! current-data #x100000) + (+! chunk-count -2048) ) - (+! current-dest 4096) - (&+! current-data #x100000) - (+! chunk-count -2048) ) + total-size ) - total-size ) ;; definition for function texture-relocate @@ -2020,10 +2014,10 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; INFO: Return type mismatch int vs none. (defmethod setup-font-texture! ((this texture-pool)) - (local-vars (heap-before-font-tex int) (clut-dest-addr int)) - (let ((font-clut (-> this font-palette))) - (set! heap-before-font-tex (-> this cur)) - (set! clut-dest-addr (/ font-clut 64)) + (let* ((font-clut (-> this font-palette)) + (heap-before-font-tex (-> this cur)) + (clut-dest-addr (/ font-clut 64)) + ) (set! *font-texture* (get-texture ascii.12lo gamefontnew)) (let ((main-font-tx (texture-page-login (new 'static 'texture-id :index #x1 :page #x4fe) texture-page-default-allocate global) diff --git a/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc b/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc index bc7ea3b016..9a56b1f8a6 100644 --- a/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc @@ -29,7 +29,7 @@ ;; definition for function draw-drawable-tree-tfrag ;; INFO: Return type mismatch drawable-tree-tfrag vs none. (defun draw-drawable-tree-tfrag ((arg0 drawable-tree-tfrag)) - (local-vars (a0-20 int) (a0-22 int) (a0-38 int) (a0-40 int) (sv-16 (pointer uint8))) + (local-vars (a0-20 int) (a0-22 int) (a0-38 int) (a0-40 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask tfrag)) (let ((s5-0 (+ (-> arg0 length) -1))) (when (nonzero? s5-0) @@ -53,165 +53,164 @@ (let* ((v1-13 (the-as drawable-inline-array-tfrag (-> arg0 arrays s5-0))) (s4-1 (-> v1-13 data)) (s3-0 (-> v1-13 length)) + (sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s4-1 0 id) 8))) + (s5-1 (-> *display* frames (-> *display* on-screen) frame global-buf base)) ) - (set! sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s4-1 0 id) 8))) - (let ((s5-1 (-> *display* frames (-> *display* on-screen) frame global-buf base))) - (let* ((s1-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) - (s2-0 (-> s1-0 base)) + (let* ((s1-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (s2-0 (-> s1-0 base)) + ) + (set! (-> *tfrag-work* wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* wait-from-spr) (the-as uint 0)) + (tfrag-init-buffer + s1-0 + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + 0 + ) + (let* ((v1-28 (-> *perf-stats* data 5)) + (a0-17 (-> v1-28 ctrl)) ) - (set! (-> *tfrag-work* wait-to-spr) (the-as uint 0)) - (set! (-> *tfrag-work* wait-from-spr) (the-as uint 0)) - (tfrag-init-buffer - s1-0 - (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x26 - :zte #x1 - :ztst (gs-ztest greater-equal) - ) - 0 - ) - (let* ((v1-28 (-> *perf-stats* data 5)) - (a0-17 (-> v1-28 ctrl)) - ) - (+! (-> v1-28 count) 1) - (b! (zero? a0-17) cfg-8 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mtpc pcr0 0) - (.mtpc pcr1 0) - (.sync.l) - (.sync.p) - (.mtc0 Perf a0-17) - ) + (+! (-> v1-28 count) 1) + (b! (zero? a0-17) cfg-8 :delay (nop!)) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (label cfg-8) - 0 - (draw-inline-array-tfrag sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-0) - (let ((v1-31 (-> *perf-stats* data 5))) - (b! (zero? (-> v1-31 ctrl)) cfg-10 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mfpc a0-20 pcr0) - (+! (-> v1-31 accum0) a0-20) - (.mfpc a0-22 pcr1) - (+! (-> v1-31 accum1) a0-22) - ) - (label cfg-10) - 0 - (update-wait-stats - (-> *perf-stats* data 5) - (the-as uint 0) - (-> *tfrag-work* wait-to-spr) - (-> *tfrag-work* wait-from-spr) - ) - (tfrag-end-buffer s1-0) - (let ((a3-3 (-> s1-0 base))) - (let ((v1-38 (the-as object (-> s1-0 base)))) - (set! (-> (the-as dma-packet v1-38) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-38) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-38) vif1) (new 'static 'vif-tag)) - (set! (-> s1-0 base) (&+ (the-as pointer v1-38) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) - (if (zero? (-> (the-as terrain-context #x70000000) bsp lev-index)) - (bucket-id tfrag-0) - (bucket-id tfrag-1) - ) - s2-0 - (the-as (pointer dma-tag) a3-3) - ) - ) - ) - (let* ((s1-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) - (s2-1 (-> s1-1 base)) - ) - (set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0)) - (set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0)) - (tfrag-near-init-buffer - s1-1 - (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x26 - :zte #x1 - :ztst (gs-ztest greater-equal) - ) - 0 - ) - (let* ((v1-52 (-> *perf-stats* data 6)) - (a0-35 (-> v1-52 ctrl)) - ) - (+! (-> v1-52 count) 1) - (b! (zero? a0-35) cfg-15 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mtpc pcr0 0) - (.mtpc pcr1 0) - (.sync.l) - (.sync.p) - (.mtc0 Perf a0-35) - ) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) - (label cfg-15) - 0 - (draw-inline-array-tfrag-near sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-1) - (let ((v1-55 (-> *perf-stats* data 6))) - (b! (zero? (-> v1-55 ctrl)) cfg-17 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mfpc a0-38 pcr0) - (+! (-> v1-55 accum0) a0-38) - (.mfpc a0-40 pcr1) - (+! (-> v1-55 accum1) a0-40) - ) - (label cfg-17) - 0 - (update-wait-stats - (-> *perf-stats* data 6) - (the-as uint 0) - (-> *tfrag-work* near-wait-to-spr) - (-> *tfrag-work* near-wait-from-spr) - ) - (tfrag-near-end-buffer s1-1) - (let ((a3-6 (-> s1-1 base))) - (let ((v1-62 (the-as object (-> s1-1 base)))) - (set! (-> (the-as dma-packet v1-62) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-62) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-62) vif1) (new 'static 'vif-tag)) - (set! (-> s1-1 base) (&+ (the-as pointer v1-62) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) - (if (zero? (-> (the-as terrain-context #x70000000) bsp lev-index)) - (bucket-id tfrag-near-0) - (bucket-id tfrag-near-1) - ) - s2-1 - (the-as (pointer dma-tag) a3-6) - ) - ) + (.mtc0 Perf a0-17) ) - (let ((v1-69 *dma-mem-usage*)) - (when (nonzero? v1-69) - (set! (-> v1-69 length) (max 2 (-> v1-69 length))) - (set! (-> v1-69 data 1 name) "tfragment") - (+! (-> v1-69 data 1 count) 1) - (+! (-> v1-69 data 1 used) - (&- (-> *display* frames (-> *display* on-screen) frame global-buf base) (the-as uint s5-1)) + (.sync.l) + (.sync.p) + (label cfg-8) + 0 + (draw-inline-array-tfrag sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-0) + (let ((v1-31 (-> *perf-stats* data 5))) + (b! (zero? (-> v1-31 ctrl)) cfg-10 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-20 pcr0) + (+! (-> v1-31 accum0) a0-20) + (.mfpc a0-22 pcr1) + (+! (-> v1-31 accum1) a0-22) + ) + (label cfg-10) + 0 + (update-wait-stats + (-> *perf-stats* data 5) + (the-as uint 0) + (-> *tfrag-work* wait-to-spr) + (-> *tfrag-work* wait-from-spr) + ) + (tfrag-end-buffer s1-0) + (let ((a3-3 (-> s1-0 base))) + (let ((v1-38 (the-as object (-> s1-0 base)))) + (set! (-> (the-as dma-packet v1-38) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-38) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-38) vif1) (new 'static 'vif-tag)) + (set! (-> s1-0 base) (&+ (the-as pointer v1-38) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (if (zero? (-> (the-as terrain-context #x70000000) bsp lev-index)) + (bucket-id tfrag-0) + (bucket-id tfrag-1) ) - (set! (-> v1-69 data 1 total) (-> v1-69 data 1 used)) + s2-0 + (the-as (pointer dma-tag) a3-3) ) ) ) + (let* ((s1-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (s2-1 (-> s1-1 base)) + ) + (set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0)) + (tfrag-near-init-buffer + s1-1 + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + 0 + ) + (let* ((v1-52 (-> *perf-stats* data 6)) + (a0-35 (-> v1-52 ctrl)) + ) + (+! (-> v1-52 count) 1) + (b! (zero? a0-35) cfg-15 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-35) + ) + (.sync.l) + (.sync.p) + (label cfg-15) + 0 + (draw-inline-array-tfrag-near sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-1) + (let ((v1-55 (-> *perf-stats* data 6))) + (b! (zero? (-> v1-55 ctrl)) cfg-17 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-38 pcr0) + (+! (-> v1-55 accum0) a0-38) + (.mfpc a0-40 pcr1) + (+! (-> v1-55 accum1) a0-40) + ) + (label cfg-17) + 0 + (update-wait-stats + (-> *perf-stats* data 6) + (the-as uint 0) + (-> *tfrag-work* near-wait-to-spr) + (-> *tfrag-work* near-wait-from-spr) + ) + (tfrag-near-end-buffer s1-1) + (let ((a3-6 (-> s1-1 base))) + (let ((v1-62 (the-as object (-> s1-1 base)))) + (set! (-> (the-as dma-packet v1-62) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-62) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-62) vif1) (new 'static 'vif-tag)) + (set! (-> s1-1 base) (&+ (the-as pointer v1-62) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (if (zero? (-> (the-as terrain-context #x70000000) bsp lev-index)) + (bucket-id tfrag-near-0) + (bucket-id tfrag-near-1) + ) + s2-1 + (the-as (pointer dma-tag) a3-6) + ) + ) + ) + (let ((v1-69 *dma-mem-usage*)) + (when (nonzero? v1-69) + (set! (-> v1-69 length) (max 2 (-> v1-69 length))) + (set! (-> v1-69 data 1 name) "tfragment") + (+! (-> v1-69 data 1 count) 1) + (+! (-> v1-69 data 1 used) + (&- (-> *display* frames (-> *display* on-screen) frame global-buf base) (the-as uint s5-1)) + ) + (set! (-> v1-69 data 1 total) (-> v1-69 data 1 used)) + ) + ) ) ) ) @@ -221,7 +220,7 @@ ;; definition for function draw-drawable-tree-trans-tfrag ;; INFO: Return type mismatch drawable-tree-trans-tfrag vs none. (defun draw-drawable-tree-trans-tfrag ((arg0 drawable-tree-trans-tfrag)) - (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int) (sv-16 (pointer uint8))) + (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask trans-tfrag)) (let ((s5-0 (+ (-> arg0 length) -1))) (when (nonzero? s5-0) @@ -245,8 +244,8 @@ (let* ((v1-13 (-> arg0 arrays s5-0)) (s5-1 (&+ v1-13 32)) (s4-1 (-> v1-13 length)) + (sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) ) - (set! sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) (let* ((s2-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) (s3-0 (-> s2-0 base)) ) @@ -402,7 +401,7 @@ ;; definition for function draw-drawable-tree-dirt-tfrag ;; INFO: Return type mismatch drawable-tree-dirt-tfrag vs none. (defun draw-drawable-tree-dirt-tfrag ((arg0 drawable-tree-dirt-tfrag)) - (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int) (sv-16 (pointer uint8))) + (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask trans-tfrag)) (let ((s5-0 (+ (-> arg0 length) -1))) (when (nonzero? s5-0) @@ -426,8 +425,8 @@ (let* ((v1-13 (-> arg0 arrays s5-0)) (s5-1 (&+ v1-13 32)) (s4-1 (-> v1-13 length)) + (sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) ) - (set! sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) (let* ((s2-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) (s3-0 (-> s2-0 base)) ) @@ -565,7 +564,7 @@ ;; definition for function draw-drawable-tree-ice-tfrag ;; INFO: Return type mismatch drawable-tree-ice-tfrag vs none. (defun draw-drawable-tree-ice-tfrag ((arg0 drawable-tree-ice-tfrag)) - (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int) (sv-16 (pointer uint8))) + (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask trans-tfrag)) (let ((s5-0 (+ (-> arg0 length) -1))) (when (nonzero? s5-0) @@ -589,8 +588,8 @@ (let* ((v1-13 (-> arg0 arrays s5-0)) (s5-1 (&+ v1-13 32)) (s4-1 (-> v1-13 length)) + (sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) ) - (set! sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) (let* ((s2-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) (s3-0 (-> s2-0 base)) ) diff --git a/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc b/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc index 88e8ffa555..5222f76cfe 100644 --- a/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc @@ -246,17 +246,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun draw-drawable-tree-instance-tie ((arg0 drawable-tree-instance-tie) (arg1 level)) - (local-vars - (a0-31 int) - (a0-33 int) - (a0-46 int) - (a0-48 int) - (a0-62 int) - (a0-64 int) - (a0-82 int) - (a0-84 int) - (sv-16 int) - ) + (local-vars (a0-31 int) (a0-33 int) (a0-46 int) (a0-48 int) (a0-62 int) (a0-64 int) (a0-82 int) (a0-84 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask tie-near tie generic)) (set! (-> *instance-tie-work* first-generic-prototype) (the-as uint 0)) (set! (-> *instance-tie-work* wind-vectors) (-> arg0 prototypes wind-vectors)) @@ -294,8 +284,8 @@ (let* ((s1-0 (-> (the-as drawable-inline-array-instance-tie v1-16) data)) (s0-0 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s1-0 0 id) 8))) (s3-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (sv-16 (-> (the-as drawable-inline-array-node v1-16) length)) ) - (set! sv-16 (-> (the-as drawable-inline-array-node v1-16) length)) (when (nonzero? sv-16) (let* ((v1-21 (logand (the-as int *gsf-buffer*) 8191)) (v1-23 (logand (the-as int (&- (logand (the-as int (&-> s4-1 data -512)) 8191) (the-as uint v1-21))) 8191)) @@ -324,11 +314,7 @@ (.sync.p) (label cfg-12) 0 - (let ((t9-2 draw-inline-array-instance-tie) - (a3-1 s3-1) - ) - (t9-2 s0-0 s1-0 sv-16 a3-1) - ) + (draw-inline-array-instance-tie s0-0 s1-0 sv-16 s3-1) (let ((v1-35 (-> *perf-stats* data 9))) (b! (zero? (-> v1-35 ctrl)) cfg-14 :delay (nop!)) (.mtc0 Perf 0) diff --git a/test/decompiler/reference/jak1/engine/gfx/tie/tie_REF.gc b/test/decompiler/reference/jak1/engine/gfx/tie/tie_REF.gc index 6c95420cb2..816b099393 100644 --- a/test/decompiler/reference/jak1/engine/gfx/tie/tie_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/tie/tie_REF.gc @@ -648,23 +648,12 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch symbol vs none. (defun-debug tie-ints () - (local-vars (sv-16 uint)) (let ((gp-0 (the-as (pointer uint32) (+ #x3fa0 #x1100c000)))) (dotimes (s5-0 16) (if (< s5-0 10) (format 0 " ") ) - (let ((s4-0 format) - (s3-0 0) - (s2-0 "vi~d: ~6d #x~4,'0X ~s~%") - (s1-0 s5-0) - (s0-0 (-> gp-0 (* s5-0 4))) - ) - (set! sv-16 (-> gp-0 (* s5-0 4))) - (let ((t1-0 (tie-int-reg s5-0))) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 t1-0) - ) - ) + (format 0 "vi~d: ~6d #x~4,'0X ~s~%" s5-0 (-> gp-0 (* s5-0 4)) (-> gp-0 (* s5-0 4)) (tie-int-reg s5-0)) ) ) (none) @@ -674,7 +663,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch symbol vs none. (defun-debug tie-floats () - (local-vars (sv-16 uint) (sv-32 uint)) (let ((gp-0 (the-as (pointer uint32) (+ #x3da0 #x1100c000)))) (dotimes (s5-0 32) (if (< s5-0 10) @@ -689,17 +677,14 @@ (-> gp-0 (+ (* s5-0 4) 2)) (-> gp-0 (+ (* s5-0 4) 3)) ) - (let ((s4-0 format) - (s3-0 0) - (s2-0 "~F ~F ~F ~F ~s~%") - (s1-0 (-> gp-0 (* s5-0 4))) - (s0-0 (-> gp-0 (+ (* s5-0 4) 1))) - ) - (set! sv-16 (-> gp-0 (+ (* s5-0 4) 2))) - (set! sv-32 (-> gp-0 (+ (* s5-0 4) 3))) - (let ((t2-1 (tie-float-reg s5-0))) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 sv-32 t2-1) - ) + (format + 0 + "~F ~F ~F ~F ~s~%" + (-> gp-0 (* s5-0 4)) + (-> gp-0 (+ (* s5-0 4) 1)) + (-> gp-0 (+ (* s5-0 4) 2)) + (-> gp-0 (+ (* s5-0 4) 3)) + (tie-float-reg s5-0) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/level/level_REF.gc b/test/decompiler/reference/jak1/engine/level/level_REF.gc index 0e9b8d9edd..b35985b847 100644 --- a/test/decompiler/reference/jak1/engine/level/level_REF.gc +++ b/test/decompiler/reference/jak1/engine/level/level_REF.gc @@ -349,7 +349,6 @@ ;; definition for method 17 of type level (defmethod load-continue ((this level)) - (local-vars (sv-16 symbol)) (when (-> this linking) (when (nonzero? (link-resume)) (set! (-> this linking) #f) @@ -376,8 +375,9 @@ ) (case (-> this status) (('loading) - (set! sv-16 (the-as symbol #f)) - (let ((a0-15 (dgo-load-get-next (& sv-16)))) + (let* ((sv-16 (the-as symbol #f)) + (a0-15 (dgo-load-get-next (& sv-16))) + ) (when a0-15 (cond ((not sv-16) @@ -488,7 +488,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] (defun level-update-after-load ((loaded-level level) (level-login-state login-state)) - (local-vars (current-timer int) (v1-154 int) (initial-timer int) (sv-16 prototype-bucket-tie) (sv-32 int)) + (local-vars (current-timer int) (v1-154 int) (initial-timer int)) 0 (let ((level-drawable-trees (-> loaded-level bsp drawable-trees))) 0 @@ -574,15 +574,17 @@ (when (< current-login-pos (-> s1-2 length)) (dotimes (s0-1 10) (when (< current-login-pos (-> s1-2 length)) - (set! sv-16 (-> s1-2 array-data (the-as uint current-login-pos))) - (set! sv-32 0) - (while (< sv-32 4) - (let ((a0-28 (-> sv-16 geometry-override sv-32))) - (if (nonzero? a0-28) - (login a0-28) - ) + (let ((sv-16 (-> s1-2 array-data (the-as uint current-login-pos))) + (sv-32 0) + ) + (while (< sv-32 4) + (let ((a0-28 (-> sv-16 geometry-override sv-32))) + (if (nonzero? a0-28) + (login a0-28) + ) + ) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) (set! current-login-pos (the-as int (+ (the-as uint current-login-pos) 1))) ) diff --git a/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc b/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc index d3c6e5634b..0d7074c0e9 100644 --- a/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc +++ b/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc @@ -1085,7 +1085,7 @@ (f2-2 (* 0.5 (+ f0-0 f2-0))) (f1-1 (- f3-2 f1-0)) (f0-1 (- f2-2 f0-0)) - (f0-4 (sqrtf (+ (* f1-1 f1-1) (* f0-1 f0-1)))) + (f0-4 (sqrtf (+ (square f1-1) (square f0-1)))) ) (set-vector! (-> arg0 rejector) f3-2 0.0 f2-2 f0-4) ) @@ -2124,7 +2124,7 @@ (f1-2 (- (-> a1-0 z) (-> arg0 rejector z))) ) (cond - ((< (+ (* f0-1 f0-1) (* f1-2 f1-2)) (* (-> arg0 rejector w) (-> arg0 rejector w))) + ((< (+ (square f0-1) (square f1-2)) (* (-> arg0 rejector w) (-> arg0 rejector w))) (if (logtest? (-> arg0 flags) (load-boundary-flags closed)) (set! s5-0 (check-closed-boundary arg0 a1-0 a2-0)) (set! s5-0 (check-open-boundary arg0 a1-0 a2-0)) diff --git a/test/decompiler/reference/jak1/engine/load/loader_REF.gc b/test/decompiler/reference/jak1/engine/load/loader_REF.gc index 970f3a8193..c20c18f407 100644 --- a/test/decompiler/reference/jak1/engine/load/loader_REF.gc +++ b/test/decompiler/reference/jak1/engine/load/loader_REF.gc @@ -4,22 +4,18 @@ ;; definition for method 3 of type load-dir ;; INFO: Used lq/sq (defmethod inspect ((this load-dir)) - (local-vars (sv-16 basic)) (format #t "[~8x] ~A~%" this (-> this type)) (format #t "~Tlevel: ~A~%" (-> this lev)) (format #t "~Tallocated-length: ~D~%" (-> this string-array allocated-length)) (format #t "~Tlength: ~D~%" (-> this string-array length)) (dotimes (s5-0 (-> this string-array length)) - (let ((s4-0 format) - (s3-0 #t) - (s2-0 "~T [~D] ~S ~A (~D bytes)~%") - (s1-0 s5-0) - (s0-0 (-> this string-array s5-0)) - ) - (set! sv-16 (-> this data-array s5-0)) - (let ((t1-0 (mem-size (-> this data-array s5-0) #f 0))) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 t1-0) - ) + (format + #t + "~T [~D] ~S ~A (~D bytes)~%" + s5-0 + (-> this string-array s5-0) + (-> this data-array s5-0) + (mem-size (-> this data-array s5-0) #f 0) ) ) this @@ -797,147 +793,145 @@ ;; WARN: Stack slot offset 24 signed mismatch ;; WARN: Stack slot offset 24 signed mismatch (defbehavior ja-play-spooled-anim process-drawable ((arg0 spool-anim) (arg1 art-joint-anim) (arg2 art-joint-anim) (arg3 (function process-drawable symbol))) - (local-vars - (v0-39 int) - (spool-part int) - (sv-24 float) - (old-skel-status janim-status) - (sv-32 int) - (sv-40 int) - (sv-48 int) - (sv-56 int) - (spool-sound sound-id) - (sv-72 int) - ) - (set! spool-part 0) - (set! sv-24 -17.0) - (set! old-skel-status (-> self skel status)) - (set! sv-32 -2) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 0) - (set! spool-sound (new-sound-id)) - (backup-load-state-and-set-cmds *load-state* (-> arg0 command-list)) - (set-setting! 'spooling (process->ppointer self) 0.0 0) - (logior! (-> self skel status) (janim-status inited drawn done)) - (kill-current-level-hint '() '() 'die) - (level-hint-surpress!) - (apply-settings *setting-control*) - (when (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) - (cond - (arg1 - (when (!= (ja-group) arg1) - (ja-channel-push! 1 (seconds 0.05)) - (ja :group! arg1 :num! min) - ) + (local-vars (v0-39 int)) + (let ((spool-part 0)) + (let ((sv-24 -17.0)) + (let ((old-skel-status (-> self skel status))) ) - (else - (ja-channel-set! 0) - ) - ) - (while (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) - (format #t "WARNING: ---------------------> loader stall on lock~%") - (if (arg3 self) - (goto cfg-88) - ) - (spool-push *art-control* (-> arg0 name) spool-part self -9.0) - (suspend) - (if arg1 - (ja :num! (loop!)) - ) - ) - ) - (set! (-> *art-control* spool-lock) (process->handle self)) - (set! sv-48 (the-as int (current-time))) - (while (< spool-part (-> arg0 parts)) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (update *art-control* #f) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (when (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) - (cond - (arg1 - (when (!= (ja-group) arg1) - (ja-channel-set! 1) - (ja :group! arg1 :num! min) + (let ((sv-32 -2) + (sv-40 0) + (sv-48 0) + (sv-56 0) + (spool-sound (new-sound-id)) + ) + (backup-load-state-and-set-cmds *load-state* (-> arg0 command-list)) + (set-setting! 'spooling (process->ppointer self) 0.0 0) + (logior! (-> self skel status) (janim-status inited drawn done)) + (kill-current-level-hint '() '() 'die) + (level-hint-surpress!) + (apply-settings *setting-control*) + (when (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) + (cond + (arg1 + (when (!= (ja-group) arg1) + (ja-channel-push! 1 (seconds 0.05)) + (ja :group! arg1 :num! min) + ) + ) + (else + (ja-channel-set! 0) + ) + ) + (while (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) + (format #t "WARNING: ---------------------> loader stall on lock~%") + (if (arg3 self) + (goto cfg-88) + ) + (spool-push *art-control* (-> arg0 name) spool-part self -9.0) + (suspend) + (if arg1 + (ja :num! (loop!)) + ) ) ) - (else - (ja-channel-set! 0) - ) - ) - (while (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) - (if (arg3 self) - (goto cfg-88) - ) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (format #t "WARNING: ---------------------> loader stall on art ~S ~D~%" (-> arg0 name) spool-part) - (suspend) - (if arg1 - (ja :num! (loop!)) - ) - ) - ) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (let ((s2-4 (the-as art-joint-anim (lookup-art (-> self draw art-group) (-> arg0 name) art-joint-anim)))) - (cond - (s2-4 - (ja-channel-set! 1) - (ja-no-eval :group! s2-4 :num! (seek!) :frame-num 0.0) - (when (zero? spool-part) - (str-play-async (-> arg0 name) spool-sound) - (set! (-> *art-control* active-stream) (-> arg0 name)) - ) - (let* ((f30-0 (* 0.05859375 (-> s2-4 speed))) - (f28-0 (+ sv-24 (/ (the float (+ (-> s2-4 data 0 length) -1)) f30-0))) - ) - (set! sv-72 (current-str-pos spool-sound)) - (set! sv-40 (the-as int (current-time))) - (until (>= (the float v0-39) f28-0) - (if (= (-> self skel root-channel 0) (-> self skel channel)) - (logior! (-> self skel status) (janim-status spool)) + (set! (-> *art-control* spool-lock) (process->handle self)) + (set! sv-48 (the-as int (current-time))) + (while (< spool-part (-> arg0 parts)) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (update *art-control* #f) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (when (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) + (cond + (arg1 + (when (!= (ja-group) arg1) + (ja-channel-set! 1) + (ja :group! arg1 :num! min) ) - (if (or (arg3 self) (and (<= sv-72 0) (time-elapsed? sv-40 (seconds 4))) (and (< 300 sv-56) (<= sv-72 0))) + ) + (else + (ja-channel-set! 0) + ) + ) + (while (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) + (if (arg3 self) (goto cfg-88) ) (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (if (< (+ spool-part 1) (-> arg0 parts)) - (spool-push *art-control* (-> arg0 name) (+ spool-part 1) self -10.0) - (logclear! (-> self skel status) (janim-status done)) - ) - (execute-commands-up-to *load-state* (ja-aframe-num 0)) - (cond - ((and (< sv-32 sv-72) (= (current-str-id) spool-sound)) - (set! sv-56 (+ sv-56 (- (current-time) (-> *display* old-base-frame-counter)))) - (set! sv-40 (the-as int (current-time))) - ) - (else - 0 - ) - ) - (set! sv-32 sv-72) - (set! sv-48 (the-as int (current-time))) + (format #t "WARNING: ---------------------> loader stall on art ~S ~D~%" (-> arg0 name) spool-part) (suspend) - (let ((f0-14 (* (- (the float (current-str-pos spool-sound)) sv-24) f30-0))) - (ja-no-eval :num! (seek!) :frame-num f0-14) - ) - (set! v0-39 (current-str-pos spool-sound)) - (set! sv-72 v0-39) + (if arg1 + (ja :num! (loop!)) + ) ) - (set! sv-24 f28-0) ) - (logclear! (-> self skel status) (janim-status spool)) - ) - (else - (format 0 "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~" self (-> arg0 name) spool-part) - (goto cfg-88) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (let ((s2-4 (the-as art-joint-anim (lookup-art (-> self draw art-group) (-> arg0 name) art-joint-anim)))) + (cond + (s2-4 + (ja-channel-set! 1) + (ja-no-eval :group! s2-4 :num! (seek!) :frame-num 0.0) + (when (zero? spool-part) + (str-play-async (-> arg0 name) spool-sound) + (set! (-> *art-control* active-stream) (-> arg0 name)) + ) + (let* ((f30-0 (* 0.05859375 (-> s2-4 speed))) + (f28-0 (+ sv-24 (/ (the float (+ (-> s2-4 data 0 length) -1)) f30-0))) + ) + (let ((sv-72 (current-str-pos spool-sound))) + (set! sv-40 (the-as int (current-time))) + (until (>= (the float v0-39) f28-0) + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (logior! (-> self skel status) (janim-status spool)) + ) + (if (or (arg3 self) + (and (<= sv-72 0) (time-elapsed? (the-as time-frame sv-40) (seconds 4))) + (and (< 300 sv-56) (<= sv-72 0)) + ) + (goto cfg-88) + ) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (if (< (+ spool-part 1) (-> arg0 parts)) + (spool-push *art-control* (-> arg0 name) (+ spool-part 1) self -10.0) + (logclear! (-> self skel status) (janim-status done)) + ) + (execute-commands-up-to *load-state* (ja-aframe-num 0)) + (cond + ((and (< sv-32 sv-72) (= (current-str-id) spool-sound)) + (+! sv-56 (- (current-time) (-> *display* old-base-frame-counter))) + (set! sv-40 (the-as int (current-time))) + ) + (else + 0 + ) + ) + (set! sv-32 sv-72) + (set! sv-48 (the-as int (current-time))) + (suspend) + (let ((f0-14 (* (- (the float (current-str-pos spool-sound)) sv-24) f30-0))) + (ja-no-eval :num! (seek!) :frame-num f0-14) + ) + (set! v0-39 (current-str-pos spool-sound)) + (set! sv-72 v0-39) + ) + ) + (set! sv-24 f28-0) + ) + (logclear! (-> self skel status) (janim-status spool)) + ) + (else + (format 0 "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~" self (-> arg0 name) spool-part) + (goto cfg-88) + ) + ) + ) + (+! spool-part 1) ) ) ) - (set! spool-part (+ spool-part 1)) + (+! spool-part -1) + (label cfg-88) + (ja-abort-spooled-anim arg0 arg2 spool-part) ) - (set! spool-part (+ spool-part -1)) - (label cfg-88) - (ja-abort-spooled-anim arg0 arg2 spool-part) 0 ) diff --git a/test/decompiler/reference/jak1/engine/math/euler_REF.gc b/test/decompiler/reference/jak1/engine/math/euler_REF.gc index 874adbb17b..dc1e0069d2 100644 --- a/test/decompiler/reference/jak1/engine/math/euler_REF.gc +++ b/test/decompiler/reference/jak1/engine/math/euler_REF.gc @@ -104,11 +104,12 @@ ) (cond ((= (logand (/ arg2 2) 1) 1) - (let* ((f0-0 (-> (the-as (pointer float) (+ (+ (* s2-0 4) (* s3-0 16)) (the-as int arg1))))) - (f0-2 (* f0-0 f0-0)) - (f1-0 (-> (the-as (pointer float) (+ (+ (* s1-0 4) (* s3-0 16)) (the-as int arg1))))) - (f30-0 (sqrtf (+ f0-2 (* f1-0 f1-0)))) - ) + (let ((f30-0 (sqrtf (+ (square (-> (the-as (pointer float) (+ (+ (* s2-0 4) (* s3-0 16)) (the-as int arg1))))) + (square (-> (the-as (pointer float) (+ (+ (* s1-0 4) (* s3-0 16)) (the-as int arg1))))) + ) + ) + ) + ) (cond ((< 0.00001 f30-0) (set! (-> arg0 x) (atan @@ -136,11 +137,12 @@ ) ) (else - (let* ((f0-21 (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1))))) - (f0-23 (* f0-21 f0-21)) - (f1-3 (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s2-0 16)) (the-as int arg1))))) - (f30-1 (sqrtf (+ f0-23 (* f1-3 f1-3)))) - ) + (let ((f30-1 (sqrtf (+ (square (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1))))) + (square (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s2-0 16)) (the-as int arg1))))) + ) + ) + ) + ) (cond ((< 0.00001 f30-1) (set! (-> arg0 x) diff --git a/test/decompiler/reference/jak1/engine/math/quaternion_REF.gc b/test/decompiler/reference/jak1/engine/math/quaternion_REF.gc index 44f60eb57a..cbf7e68352 100644 --- a/test/decompiler/reference/jak1/engine/math/quaternion_REF.gc +++ b/test/decompiler/reference/jak1/engine/math/quaternion_REF.gc @@ -45,12 +45,9 @@ ;; definition for function vector-angle<-quaternion! (defun vector-angle<-quaternion! ((arg0 vector) (arg1 quaternion)) - (let* ((f0-0 1.0) - (f1-0 1.0) - (f2-0 (-> arg1 w)) - (f30-0 (/ f0-0 (sqrtf (- f1-0 (* f2-0 f2-0))))) - (f0-3 (* 2.0 (acos-rad (-> arg1 w)))) - ) + (let ((f30-0 (/ 1.0 (sqrtf (- 1.0 (square (-> arg1 w)))))) + (f0-3 (* 2.0 (acos-rad (-> arg1 w)))) + ) (set! (-> arg0 x) (* (-> arg1 x) f30-0)) (set! (-> arg0 y) (* (-> arg1 y) f30-0)) (set! (-> arg0 z) (* (-> arg1 z) f30-0)) @@ -550,11 +547,7 @@ ;; definition for function quaternion-vector-len (defun quaternion-vector-len ((arg0 quaternion)) - (let ((f0-0 1.0) - (f1-0 (-> arg0 w)) - ) - (sqrtf (- f0-0 (* f1-0 f1-0))) - ) + (sqrtf (- 1.0 (square (-> arg0 w)))) ) ;; definition for function quaternion-log! @@ -636,9 +629,7 @@ (quaternion-normalize! arg0) ) (else - (let* ((f1-4 1.0) - (f2-1 f0-0) - (f1-6 (sqrtf (- f1-4 (* f2-1 f2-1)))) + (let* ((f1-6 (sqrtf (- 1.0 (square f0-0)))) (f0-6 (/ (- f1-6 f0-0) (+ f1-6 f0-0))) (f28-0 (/ 1.0 f1-6)) ) diff --git a/test/decompiler/reference/jak1/engine/math/transformq_REF.gc b/test/decompiler/reference/jak1/engine/math/transformq_REF.gc index c57365a76d..84c3016075 100644 --- a/test/decompiler/reference/jak1/engine/math/transformq_REF.gc +++ b/test/decompiler/reference/jak1/engine/math/transformq_REF.gc @@ -153,19 +153,14 @@ ;; definition for method 17 of type trsqv ;; INFO: Used lq/sq (defmethod rotate-toward-orientation! ((this trsqv) (target quaternion) (y-rate float) (z-rate float)) - (local-vars (sv-96 vector)) (let ((quat (get-quaternion this))) (let ((temp-quat (new 'stack-no-clear 'quaternion))) (when (< 0.0 z-rate) - (let ((s1-0 quaternion-from-two-vectors-max-angle!) - (s0-0 temp-quat) - ) - (set! sv-96 (vector-y-quaternion! (new 'stack-no-clear 'vector) quat)) - (let ((a2-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) target)) - (a3-1 (* z-rate (seconds-per-frame))) - ) - (s1-0 s0-0 sv-96 a2-1 a3-1) - ) + (quaternion-from-two-vectors-max-angle! + temp-quat + (vector-y-quaternion! (new 'stack-no-clear 'vector) quat) + (vector-y-quaternion! (new 'stack-no-clear 'vector) target) + (* z-rate (seconds-per-frame)) ) (quaternion-normalize! (quaternion*! quat temp-quat quat)) ) diff --git a/test/decompiler/reference/jak1/engine/math/trigonometry_REF.gc b/test/decompiler/reference/jak1/engine/math/trigonometry_REF.gc index 954cb2bc2a..fefc1da8ba 100644 --- a/test/decompiler/reference/jak1/engine/math/trigonometry_REF.gc +++ b/test/decompiler/reference/jak1/engine/math/trigonometry_REF.gc @@ -159,7 +159,7 @@ (let ((f2-0 (* 0.000095873795 (the float (sar (shl (the int arg0) 48) 48))))) f2-0 (let* ((f1-4 (* 0.999998 f2-0)) - (f0-3 (* f2-0 f2-0)) + (f0-3 (square f2-0)) (f2-1 (* f2-0 f0-3)) (f1-5 (+ f1-4 (* -0.16666014 f2-1))) (f2-2 (* f2-1 f0-3)) @@ -181,11 +181,11 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f12, f6, f11] (defun sin-rad ((arg0 float)) (local-vars (f12-0 float)) - (let* ((f1-0 (* arg0 arg0)) + (let* ((f1-0 (square arg0)) (f7-0 0.999998) (f8-0 -0.16666014) (f2-0 (* arg0 f1-0)) - (f3-0 (* f1-0 f1-0)) + (f3-0 (square f1-0)) (f9-0 0.008326521) (f4-0 (* f2-0 f1-0)) (f5-0 (* f3-0 f2-0)) @@ -251,14 +251,14 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f12, f11, f5] (defun cos-rad ((arg0 float)) (local-vars (f12-0 float)) - (let* ((f1-0 (* arg0 arg0)) + (let* ((f1-0 (square arg0)) (f7-0 1.0) (f8-0 -0.49998003) - (f3-0 (* f1-0 f1-0)) + (f3-0 (square f1-0)) (f9-0 0.041620404) (f10-0 -0.0013636408) (f4-0 (* f3-0 f1-0)) - (f5-0 (* f3-0 f3-0)) + (f5-0 (square f3-0)) (f11-0 0.000020170546) ) (.mula.s f7-0 f7-0) @@ -449,11 +449,11 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f18, f9, f17] (defun atan-series-rad ((arg0 float)) (local-vars (f18-1 float)) - (let* ((f1-0 (* arg0 arg0)) + (let* ((f1-0 (square arg0)) (f10-0 0.99999934) (f11-0 -0.33329856) (f2-0 (* arg0 f1-0)) - (f3-0 (* f1-0 f1-0)) + (f3-0 (square f1-0)) (f12-0 0.19946536) (f4-0 (* f2-0 f1-0)) (f5-0 (* f3-0 f2-0)) @@ -650,10 +650,7 @@ 16383.996 ) (else - (let* ((f0-6 1.0) - (f1-2 arg0) - (f0-8 (sqrtf (- f0-6 (* f1-2 f1-2)))) - ) + (let ((f0-8 (sqrtf (- 1.0 (square arg0))))) (atan0 arg0 f0-8) ) ) @@ -677,18 +674,14 @@ (defun acos-rad ((arg0 float)) (cond ((>= arg0 0.0) - (let* ((f0-1 1.0) - (f1-1 arg0) - (f0-3 (sqrtf (- f0-1 (* f1-1 f1-1)))) + (let* ((f0-3 (sqrtf (- 1.0 (square arg0)))) (f0-5 (/ (- f0-3 arg0) (+ f0-3 arg0))) ) (atan-series-rad f0-5) ) ) (else - (let* ((f0-6 1.0) - (f1-6 arg0) - (f0-8 (sqrtf (- f0-6 (* f1-6 f1-6)))) + (let* ((f0-8 (sqrtf (- 1.0 (square arg0)))) (f0-10 (/ (+ f0-8 arg0) (- f0-8 arg0))) ) (- PI (atan-series-rad f0-10)) diff --git a/test/decompiler/reference/jak1/engine/math/vector_REF.gc b/test/decompiler/reference/jak1/engine/math/vector_REF.gc index d2ce210976..c0e0edfa9c 100644 --- a/test/decompiler/reference/jak1/engine/math/vector_REF.gc +++ b/test/decompiler/reference/jak1/engine/math/vector_REF.gc @@ -291,7 +291,7 @@ (when (or (!= x-diff 0.0) (!= z-diff 0.0)) (let* ((x-step (* x-diff alpha)) (z-step (* z-diff alpha)) - (step-len (sqrtf (+ (* x-step x-step) (* z-step z-step)))) + (step-len (sqrtf (+ (square x-step) (square z-step)))) ) (cond ((>= max-step step-len) @@ -319,7 +319,7 @@ (when (or (!= y-diff 0.0) (!= z-diff 0.0)) (let* ((y-step (* y-diff alpha)) (z-step (* z-diff alpha)) - (step-len (sqrtf (+ (* y-step y-step) (* z-step z-step)))) + (step-len (sqrtf (+ (square y-step) (square z-step)))) ) (cond ((>= max-step step-len) @@ -349,7 +349,7 @@ (let* ((x-step (* x-diff alpha)) (y-step (* y-diff alpha)) (z-step (* z-diff alpha)) - (step-len (sqrtf (+ (* x-step x-step) (* y-step y-step) (* z-step z-step)))) + (step-len (sqrtf (+ (square x-step) (square y-step) (square z-step)))) ) (cond ((>= max-step step-len) diff --git a/test/decompiler/reference/jak1/engine/nav/navigate-h_REF.gc b/test/decompiler/reference/jak1/engine/nav/navigate-h_REF.gc index e4ffcebf1e..211ece199f 100644 --- a/test/decompiler/reference/jak1/engine/nav/navigate-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/nav/navigate-h_REF.gc @@ -403,7 +403,6 @@ ;; definition for function nav-mesh-connect ;; INFO: Used lq/sq (defbehavior nav-mesh-connect process ((proc process) (trans trsqv) (nav-cont nav-control)) - (local-vars (sv-16 type) (sv-32 symbol)) (let ((ent (-> proc entity))) (when (zero? (-> ent nav-mesh)) (let ((lookup-entity (entity-actor-lookup ent 'nav-mesh-actor 0))) @@ -417,15 +416,13 @@ ((nonzero? entity-nav-mesh) (when (zero? (-> entity-nav-mesh user-list)) (set! process-level-heap (-> self entity extra level heap)) - (let ((s1-0 (method-of-type engine new)) - (s0-0 'process-level-heap) + (set! (-> entity-nav-mesh user-list) (new + 'process-level-heap + 'engine + 'nav-engine + (res-lump-value ent 'nav-max-users int :default (the-as uint128 32)) + ) ) - (set! sv-16 engine) - (set! sv-32 'nav-engine) - (let ((a3-1 (res-lump-value ent 'nav-max-users uint128 :default (the-as uint128 32)))) - (set! (-> entity-nav-mesh user-list) (s1-0 s0-0 sv-16 sv-32 (the-as int a3-1))) - ) - ) (initialize-mesh! entity-nav-mesh) (update-route-table entity-nav-mesh) ) diff --git a/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc b/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc index e9f0d12a2d..bfd203480b 100644 --- a/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc +++ b/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc @@ -133,7 +133,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun entity-nav-login ((arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (let ((gp-0 (if (nonzero? (-> arg0 nav-mesh)) (-> arg0 nav-mesh) ) @@ -148,8 +147,9 @@ (update-route-table gp-0) ) (when (zero? (-> gp-0 static-sphere)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-11 (res-lump-data arg0 'nav-mesh-sphere pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-11 (res-lump-data arg0 'nav-mesh-sphere pointer :tag-ptr (& sv-16))) + ) (when v1-11 (set! (-> gp-0 static-sphere-count) (-> sv-16 elt-count)) (set! (-> gp-0 static-sphere) (the-as (inline-array nav-sphere) v1-11)) @@ -549,9 +549,8 @@ -1 (let ((s2-0 -1) (s3-0 (current-time)) - (f0-0 (-> this bounds w)) ) - (when (>= (* f0-0 f0-0) (vector-length-squared arg0)) + (when (>= (square (-> this bounds w)) (vector-length-squared arg0)) (dotimes (v1-3 4) (set! a0-6 (and (= (-> this cache v1-3 time) s3-0) (= (-> this cache v1-3 vec w) arg1) @@ -613,10 +612,7 @@ (f1-2 (- (-> t1-4 x) (-> t0-4 x))) (f2-2 (- (-> arg0 x) (-> t0-4 x))) (f3-2 (- (-> arg0 z) (-> t0-4 z))) - (f4-1 f0-1) - (f4-3 (* f4-1 f4-1)) - (f5-0 f1-2) - (f4-5 (sqrtf (+ f4-3 (* f5-0 f5-0)))) + (f4-5 (sqrtf (+ (square f0-1) (square f1-2)))) (f4-7 (/ 1.0 f4-5)) (f0-2 (* f0-1 f4-7)) (f1-3 (* f1-2 f4-7)) @@ -686,13 +682,9 @@ ) (when t0-15 (let* ((v1-28 (-> arg2 a3-5)) - (f0-11 (- (-> v1-28 x) (-> arg0 x))) - (f0-13 (* f0-11 f0-11)) - (f1-14 (- (-> v1-28 z) (-> arg0 z))) - (f0-14 (+ f0-13 (* f1-14 f1-14))) - (f1-17 arg1) + (f0-14 (+ (square (- (-> v1-28 x) (-> arg0 x))) (square (- (-> v1-28 z) (-> arg0 z))))) ) - (if (>= (* f1-17 f1-17) f0-14) + (if (>= (square arg1) f0-14) #t ) ) @@ -715,10 +707,7 @@ (f2-2 (- (-> t0-4 x) (-> a3-4 x))) (f3-2 (- (-> v1-0 x) (-> a3-4 x))) (f4-2 (- (-> v1-0 z) (-> a3-4 z))) - (f5-1 f1-1) - (f5-3 (* f5-1 f5-1)) - (f6-0 f2-2) - (f5-5 (sqrtf (+ f5-3 (* f6-0 f6-0)))) + (f5-5 (sqrtf (+ (square f1-1) (square f2-2)))) (f5-7 (/ 1.0 f5-5)) (f1-2 (* f1-1 f5-7)) (f2-3 (* f2-2 f5-7)) @@ -788,12 +777,9 @@ ) (when a3-15 (let* ((a0-2 (-> a0-1 a2-6)) - (f1-11 (- (-> a0-2 x) (-> v1-0 x))) - (f1-13 (* f1-11 f1-11)) - (f2-13 (- (-> a0-2 z) (-> v1-0 z))) - (f1-14 (+ f1-13 (* f2-13 f2-13))) + (f1-14 (+ (square (- (-> a0-2 x) (-> v1-0 x))) (square (- (-> a0-2 z) (-> v1-0 z))))) ) - (if (>= (* f0-0 f0-0) f1-14) + (if (>= (square f0-0) f1-14) #t ) ) @@ -814,64 +800,62 @@ (vf6 :class vf) (vf7 :class vf) ) - (let ((f0-1 (+ arg1 (-> this bounds w)))) - (when (>= (* f0-1 f0-1) (vector-length-squared arg0)) - (let ((s2-0 (new 'stack-no-clear 'inline-array 'nav-vertex 6)) - (f30-1 0.33333334) - ) - (countdown (s1-0 (-> this poly-count)) - (set! *debug-traverse* (+ *debug-traverse* 1)) - (let ((a0-3 (-> this poly s1-0))) - (when (not (logtest? (-> a0-3 pat) 1)) + (when (>= (square (+ arg1 (-> this bounds w))) (vector-length-squared arg0)) + (let ((s2-0 (new 'stack-no-clear 'inline-array 'nav-vertex 6)) + (f30-1 0.33333334) + ) + (countdown (s1-0 (-> this poly-count)) + (set! *debug-traverse* (+ *debug-traverse* 1)) + (let ((a0-3 (-> this poly s1-0))) + (when (not (logtest? (-> a0-3 pat) 1)) + (nop!) + (let ((v1-8 (the-as object (-> this vertex)))) (nop!) - (let ((v1-8 (the-as object (-> this vertex)))) + (let ((a2-1 (-> a0-3 vertex 0))) (nop!) - (let ((a2-1 (-> a0-3 vertex 0))) - (nop!) - (let* ((a1-1 (-> a0-3 vertex 1)) - (a2-2 (* a2-1 16)) - (a3-1 (-> a0-3 vertex 2)) - (a1-2 (* a1-1 16)) - (a0-4 (+ a2-2 (the-as int v1-8))) - (a2-3 (* a3-1 16)) - (a1-3 (+ a1-2 (the-as int v1-8))) - (v1-9 (+ a2-3 (the-as int v1-8))) - ) - (.lvf vf3 a0-4) - (let ((a0-5 f30-1)) - (.mov vf7 a0-5) - ) - (.lvf vf4 a1-3) - (.lvf vf5 v1-9) + (let* ((a1-1 (-> a0-3 vertex 1)) + (a2-2 (* a2-1 16)) + (a3-1 (-> a0-3 vertex 2)) + (a1-2 (* a1-1 16)) + (a0-4 (+ a2-2 (the-as int v1-8))) + (a2-3 (* a3-1 16)) + (a1-3 (+ a1-2 (the-as int v1-8))) + (v1-9 (+ a2-3 (the-as int v1-8))) + ) + (.lvf vf3 a0-4) + (let ((a0-5 f30-1)) + (.mov vf7 a0-5) ) + (.lvf vf4 a1-3) + (.lvf vf5 v1-9) ) ) - (.min.vf.xyz vf1 vf3 vf4) - (.lvf vf6 (&-> arg0 quad)) - (.add.y.vf.y vf7 vf3 vf4) - (.svf (&-> s2-0 0 quad) vf3) - (.max.vf.xyz vf2 vf3 vf4) - (.svf (&-> s2-0 1 quad) vf4) - (.min.vf.xyz vf1 vf1 vf5) - (.svf (&-> s2-0 2 quad) vf5) - (.max.vf.xyz vf2 vf2 vf5) - (.mul.x.vf.y vf7 vf7 vf7) - (.svf (&-> s2-0 3 quad) vf1) - (.svf (&-> s2-0 4 quad) vf2) - (.sub.y.vf.y vf7 vf6 vf7) - (.mov v1-10 vf7) - (let ((v1-11 (the-as number (sar (the-as int v1-10) 32)))) - (when (and (>= arg2 (fabs (the-as float v1-11))) - (>= (+ (-> arg0 x) arg1) (-> s2-0 3 x)) - (>= (-> s2-0 4 x) (- (-> arg0 x) arg1)) - (>= (+ (-> arg0 z) arg1) (-> s2-0 3 z)) - (>= (-> s2-0 4 z) (- (-> arg0 z) arg1)) - ) - (set! *debug-tests* (+ *debug-tests* 1)) - (if (circle-triangle-intersection? arg0 arg1 s2-0) - (return #t) - ) - ) + ) + (.min.vf.xyz vf1 vf3 vf4) + (.lvf vf6 (&-> arg0 quad)) + (.add.y.vf.y vf7 vf3 vf4) + (.svf (&-> s2-0 0 quad) vf3) + (.max.vf.xyz vf2 vf3 vf4) + (.svf (&-> s2-0 1 quad) vf4) + (.min.vf.xyz vf1 vf1 vf5) + (.svf (&-> s2-0 2 quad) vf5) + (.max.vf.xyz vf2 vf2 vf5) + (.mul.x.vf.y vf7 vf7 vf7) + (.svf (&-> s2-0 3 quad) vf1) + (.svf (&-> s2-0 4 quad) vf2) + (.sub.y.vf.y vf7 vf6 vf7) + (.mov v1-10 vf7) + (let ((v1-11 (the-as number (sar (the-as int v1-10) 32)))) + (when (and (>= arg2 (fabs (the-as float v1-11))) + (>= (+ (-> arg0 x) arg1) (-> s2-0 3 x)) + (>= (-> s2-0 4 x) (- (-> arg0 x) arg1)) + (>= (+ (-> arg0 z) arg1) (-> s2-0 3 z)) + (>= (-> s2-0 4 z) (- (-> arg0 z) arg1)) + ) + (set! *debug-tests* (+ *debug-tests* 1)) + (if (circle-triangle-intersection? arg0 arg1 s2-0) + (return #t) + ) ) ) ) @@ -1067,7 +1051,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod nav-mesh-method-18 ((this nav-mesh) (arg0 int) (arg1 vector) (arg2 int) (arg3 (pointer int8)) (arg4 int)) - (local-vars (sv-32 int) (sv-48 uint)) (set! (-> arg3 arg2) 1) (nav-mesh-update-route-table this arg0 arg2 (the-as uint 3)) (nav-mesh-update-route-table this arg2 arg0 (the-as uint 3)) @@ -1075,34 +1058,27 @@ (when (> arg4 0) (let ((s1-1 (-> this poly arg2)) (s0-0 (new 'stack-no-clear 'vector)) + (sv-32 0) ) - (set! sv-32 0) (while (< sv-32 3) - (set! sv-48 (-> (the-as nav-poly (+ sv-32 (the-as int s1-1))) adj-poly 0)) - (when (and (!= sv-48 255) (!= 1 (-> (the-as (pointer uint8) (&+ arg3 sv-48))))) - (set! (-> arg3 sv-48) 1) - (when (not (logtest? (-> this poly sv-48 pat) 1)) - (let ((v0-3 (= (nav-mesh-lookup-route this arg0 (the-as int sv-48)) 3))) - (when (not v0-3) - (tri-centroid-local this s1-1 s0-0) - (set! *nav-update-route-table-ray-count* (+ *nav-update-route-table-ray-count* 1)) - (set! v0-3 (nav-ray-test-local? this (-> this poly arg0) arg1 s0-0)) - ) - (when v0-3 - (let* ((a0-16 this) - (t9-5 (method-of-object a0-16 nav-mesh-method-18)) - (a1-7 arg0) - (a2-6 arg1) - (t0-1 arg3) - (t1-1 (+ arg4 -1)) - ) - (t9-5 a0-16 a1-7 a2-6 (the-as int sv-48) t0-1 t1-1) + (let ((sv-48 (-> (the-as nav-poly (+ sv-32 (the-as int s1-1))) adj-poly 0))) + (when (and (!= sv-48 255) (!= 1 (-> (the-as (pointer uint8) (&+ arg3 sv-48))))) + (set! (-> arg3 sv-48) 1) + (when (not (logtest? (-> this poly sv-48 pat) 1)) + (let ((v0-3 (= (nav-mesh-lookup-route this arg0 (the-as int sv-48)) 3))) + (when (not v0-3) + (tri-centroid-local this s1-1 s0-0) + (set! *nav-update-route-table-ray-count* (+ *nav-update-route-table-ray-count* 1)) + (set! v0-3 (nav-ray-test-local? this (-> this poly arg0) arg1 s0-0)) ) + (if v0-3 + (nav-mesh-method-18 this arg0 arg1 (the-as int sv-48) arg3 (+ arg4 -1)) + ) ) ) ) ) - (set! sv-32 (+ sv-32 1)) + (+! sv-32 1) ) ) ) @@ -1159,10 +1135,7 @@ (f2-2 (- (-> t1-4 x) (-> t0-4 x))) (f3-2 (- (-> arg0 x) (-> t0-4 x))) (f4-2 (- (-> arg0 z) (-> t0-4 z))) - (f5-1 f1-1) - (f5-3 (* f5-1 f5-1)) - (f6-0 f2-2) - (f5-5 (sqrtf (+ f5-3 (* f6-0 f6-0)))) + (f5-5 (sqrtf (+ (square f1-1) (square f2-2)))) (f5-7 (/ 1.0 f5-5)) (f1-2 (* f1-1 f5-7)) (f2-3 (* f2-2 f5-7)) @@ -1234,12 +1207,10 @@ ) ) (when t0-14 - (let* ((v1-27 (-> arg2 a3-5)) - (f0-2 (- (-> v1-27 x) (-> arg0 x))) - (f0-4 (* f0-2 f0-2)) - (f1-12 (- (-> v1-27 z) (-> arg0 z))) - ) - (set! f0-0 (fmin (sqrtf (+ f0-4 (* f1-12 f1-12))) arg1)) + (let ((v1-27 (-> arg2 a3-5))) + (set! f0-0 + (fmin (sqrtf (+ (square (- (-> v1-27 x) (-> arg0 x))) (square (- (-> v1-27 z) (-> arg0 z))))) arg1) + ) ) ) ) @@ -1408,39 +1379,39 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod initialize-mesh! ((this nav-mesh)) - (local-vars (sv-32 vector) (sv-48 int)) (with-pp - (set! sv-32 (new 'stack-no-clear 'vector)) - (let ((s5-0 (-> this poly-count)) + (let ((sv-32 (new 'stack-no-clear 'vector)) + (s5-0 (-> this poly-count)) (s3-0 (-> this vertex-count)) (s1-0 0) (s2-0 0) (s4-0 0) (gp-0 #f) ) - (set! sv-48 s5-0) - (while (nonzero? sv-48) - (set! sv-48 (+ sv-48 -1)) - (let ((v1-4 (-> this poly sv-48))) - (if (logtest? (-> v1-4 pat) 1) - (+! s4-0 1) + (let ((sv-48 s5-0)) + (while (nonzero? sv-48) + (+! sv-48 -1) + (let ((v1-4 (-> this poly sv-48))) + (if (logtest? (-> v1-4 pat) 1) + (+! s4-0 1) + ) + (let ((a1-2 (-> this vertex (-> v1-4 vertex 0))) + (a2-2 (-> this vertex (-> v1-4 vertex 1))) + (a3-0 (-> this vertex (-> v1-4 vertex 2))) + ) + (vector-3pt-cross! sv-32 a1-2 a2-2 a3-0) ) - (let ((a1-2 (-> this vertex (-> v1-4 vertex 0))) - (a2-2 (-> this vertex (-> v1-4 vertex 1))) - (a3-0 (-> this vertex (-> v1-4 vertex 2))) - ) - (vector-3pt-cross! sv-32 a1-2 a2-2 a3-0) ) - ) - (cond - ((= (vector-length sv-32) 0.0) - (+! s1-0 1) - ) - (else - (vector-normalize! sv-32 1.0) - (if (>= 0.0 (-> sv-32 y)) - (+! s2-0 1) - ) + (cond + ((= (vector-length sv-32) 0.0) + (+! s1-0 1) + ) + (else + (vector-normalize! sv-32 1.0) + (if (>= 0.0 (-> sv-32 y)) + (+! s2-0 1) + ) + ) ) ) ) @@ -1657,20 +1628,18 @@ ;; definition for method 17 of type nav-control ;; INFO: Used lq/sq (defmethod project-onto-nav-mesh ((this nav-control) (arg0 vector) (arg1 vector)) - (local-vars (sv-32 int)) - (let ((s5-0 (-> this mesh)) - (s3-1 (vector-! (new 'stack-no-clear 'vector) arg1 (-> this mesh origin))) - ) - (set! sv-32 0) - (let ((a1-5 (find-poly s5-0 s3-1 (-> this nearest-y-threshold) (the-as (pointer nav-control-flags) (& sv-32))))) - (cond - ((logtest? #x100000 sv-32) - (set! (-> arg0 quad) (-> arg1 quad)) + (let* ((s5-0 (-> this mesh)) + (s3-1 (vector-! (new 'stack-no-clear 'vector) arg1 (-> this mesh origin))) + (sv-32 0) + (a1-5 (find-poly s5-0 s3-1 (-> this nearest-y-threshold) (the-as (pointer nav-control-flags) (& sv-32)))) ) - (else - (closest-point-on-boundary s5-0 a1-5 arg0 s3-1) - (vector+! arg0 arg0 (-> s5-0 origin)) - ) + (cond + ((logtest? #x100000 sv-32) + (set! (-> arg0 quad) (-> arg1 quad)) + ) + (else + (closest-point-on-boundary s5-0 a1-5 arg0 s3-1) + (vector+! arg0 arg0 (-> s5-0 origin)) ) ) ) @@ -1712,15 +1681,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod debug-draw ((this nav-control)) - (local-vars - (sv-192 vector) - (sv-208 uint) - (sv-224 int) - (sv-240 (function _varargs_ object)) - (sv-256 string) - (sv-272 int) - (sv-288 (function _varargs_ object)) - ) (let ((a0-1 this)) (when (and *display-nav-marks* (logtest? (-> a0-1 flags) (nav-control-flags display-marks))) (let ((s5-0 (-> this mesh)) @@ -1753,43 +1713,34 @@ (let ((a1-4 (-> s5-0 nodes s3-1)) (a0-15 (new 'stack-no-clear 'vector)) (v1-20 (new 'stack-no-clear 'vector)) + (sv-192 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) + (sv-208 (the-as uint #x80808080)) ) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - (s0-0 (new 'stack-no-clear 'vector)) - ) - (set! sv-208 (the-as uint #x80808080)) - (set! (-> a0-15 quad) (-> a1-4 center quad)) - (set! (-> v1-20 quad) (-> a1-4 radius quad)) - (set! (-> sv-192 w) 1.0) - (set! (-> s2-0 w) 1.0) - (set! (-> s1-0 w) 1.0) - (set! (-> s0-0 w) 1.0) - (set! (-> sv-192 x) (+ (-> a0-15 x) (-> v1-20 x))) - (set! (-> sv-192 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> sv-192 z) (+ (-> a0-15 z) (-> v1-20 z))) - (set! (-> s2-0 x) (+ (-> a0-15 x) (-> v1-20 x))) - (set! (-> s2-0 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> s2-0 z) (- (-> a0-15 z) (-> v1-20 z))) - (set! (-> s1-0 x) (- (-> a0-15 x) (-> v1-20 x))) - (set! (-> s1-0 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> s1-0 z) (- (-> a0-15 z) (-> v1-20 z))) - (set! (-> s0-0 x) (- (-> a0-15 x) (-> v1-20 x))) - (set! (-> s0-0 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> s0-0 z) (+ (-> a0-15 z) (-> v1-20 z))) - (add-debug-line #t (bucket-id debug-no-zbuf) sv-192 s2-0 (the-as rgba sv-208) #f (the-as rgba -1)) - (add-debug-line #t (bucket-id debug-no-zbuf) s2-0 s1-0 (the-as rgba sv-208) #f (the-as rgba -1)) - (add-debug-line #t (bucket-id debug-no-zbuf) s1-0 s0-0 (the-as rgba sv-208) #f (the-as rgba -1)) - (let ((t9-7 add-debug-line) - (a0-19 #t) - (a1-13 68) - (t1-5 #f) - (t2-3 -1) - ) - (t9-7 a0-19 (the-as bucket-id a1-13) s0-0 sv-192 (the-as rgba sv-208) t1-5 (the-as rgba t2-3)) - ) - ) + (set! (-> a0-15 quad) (-> a1-4 center quad)) + (set! (-> v1-20 quad) (-> a1-4 radius quad)) + (set! (-> sv-192 w) 1.0) + (set! (-> s2-0 w) 1.0) + (set! (-> s1-0 w) 1.0) + (set! (-> s0-0 w) 1.0) + (set! (-> sv-192 x) (+ (-> a0-15 x) (-> v1-20 x))) + (set! (-> sv-192 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> sv-192 z) (+ (-> a0-15 z) (-> v1-20 z))) + (set! (-> s2-0 x) (+ (-> a0-15 x) (-> v1-20 x))) + (set! (-> s2-0 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> s2-0 z) (- (-> a0-15 z) (-> v1-20 z))) + (set! (-> s1-0 x) (- (-> a0-15 x) (-> v1-20 x))) + (set! (-> s1-0 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> s1-0 z) (- (-> a0-15 z) (-> v1-20 z))) + (set! (-> s0-0 x) (- (-> a0-15 x) (-> v1-20 x))) + (set! (-> s0-0 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> s0-0 z) (+ (-> a0-15 z) (-> v1-20 z))) + (add-debug-line #t (bucket-id debug-no-zbuf) sv-192 s2-0 (the-as rgba sv-208) #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug-no-zbuf) s2-0 s1-0 (the-as rgba sv-208) #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug-no-zbuf) s1-0 s0-0 (the-as rgba sv-208) #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug-no-zbuf) s0-0 sv-192 (the-as rgba sv-208) #f (the-as rgba -1)) ) ) ) @@ -1820,21 +1771,16 @@ (when (logtest? (-> this flags) (nav-control-flags navcf4)) (let ((s1-1 add-debug-text-3d) (s0-1 #t) + (sv-224 68) ) - (set! sv-224 68) - (set! sv-240 format) - (let ((a0-23 (clear *temp-string*)) - (a1-15 "~D") - (a2-13 (-> s2-1 id)) - ) - (sv-240 a0-23 a1-15 a2-13) - ) - (set! sv-256 *temp-string*) - (let ((a3-10 (tri-centroid-world s5-0 s2-1 s4-0)) - (t0-8 8) - (t1-6 #f) - ) - (s1-1 s0-1 (the-as bucket-id sv-224) sv-256 a3-10 (the-as font-color t0-8) (the-as vector2h t1-6)) + (format (clear *temp-string*) "~D" (-> s2-1 id)) + (s1-1 + s0-1 + (the-as bucket-id sv-224) + *temp-string* + (tri-centroid-world s5-0 s2-1 s4-0) + (font-color cyan) + (the-as vector2h #f) ) ) ) @@ -1858,27 +1804,16 @@ (add-debug-sphere #t (bucket-id debug) (the-as vector s2-2) (-> s2-2 trans w) *color-blue*) (let ((s1-2 add-debug-text-3d) (s0-2 #t) + (sv-272 68) ) - (set! sv-272 68) - (set! sv-288 format) - (let ((a0-32 (clear *temp-string*)) - (a1-22 "~D") - (a2-20 s3-3) - ) - (sv-288 a0-32 a1-22 a2-20) - ) - (let ((a2-21 *temp-string*) - (t0-10 8) - (t1-7 #f) - ) - (s1-2 - s0-2 - (the-as bucket-id sv-272) - a2-21 - (the-as vector s2-2) - (the-as font-color t0-10) - (the-as vector2h t1-7) - ) + (format (clear *temp-string*) "~D" s3-3) + (s1-2 + s0-2 + (the-as bucket-id sv-272) + *temp-string* + (the-as vector s2-2) + (font-color cyan) + (the-as vector2h #f) ) ) ) @@ -2025,12 +1960,11 @@ ;; INFO: Return type mismatch int vs none. (defun add-nav-sphere ((arg0 nav-control) (arg1 vector)) (when (< (-> arg0 num-spheres) (-> arg0 max-spheres)) - (let* ((s4-0 (-> arg0 sphere (-> arg0 num-spheres))) - (f1-0 (vector-vector-xz-distance-squared arg1 (-> arg0 shape trans))) - (f0-1 (+ (-> arg1 w) (-> arg0 shape nav-radius))) - (f2-2 (+ 40960.0 f0-1)) - ) - (when (< f1-0 (* f2-2 f2-2)) + (let ((s4-0 (-> arg0 sphere (-> arg0 num-spheres))) + (f1-0 (vector-vector-xz-distance-squared arg1 (-> arg0 shape trans))) + (f0-1 (+ (-> arg1 w) (-> arg0 shape nav-radius))) + ) + (when (< f1-0 (square (+ 40960.0 f0-1))) (vector-! (the-as vector s4-0) arg1 (-> arg0 mesh origin)) (set! (-> s4-0 w) f0-1) (+! (-> arg0 num-spheres) 1) @@ -2052,12 +1986,11 @@ (s3-0 arg2) ) (when (< (-> s4-0 num-spheres) (-> s4-0 max-spheres)) - (let* ((s2-0 (-> s4-0 sphere (-> s4-0 num-spheres))) - (f1-0 (vector-vector-xz-distance-squared s3-0 (-> s4-0 shape trans))) - (f0-2 (+ (-> s3-0 w) (-> s4-0 shape nav-radius))) - (f2-2 (+ 40960.0 f0-2)) - ) - (when (< f1-0 (* f2-2 f2-2)) + (let ((s2-0 (-> s4-0 sphere (-> s4-0 num-spheres))) + (f1-0 (vector-vector-xz-distance-squared s3-0 (-> s4-0 shape trans))) + (f0-2 (+ (-> s3-0 w) (-> s4-0 shape nav-radius))) + ) + (when (< f1-0 (square (+ 40960.0 f0-2))) (vector-! (the-as vector s2-0) s3-0 (-> s4-0 mesh origin)) (set! (-> s2-0 w) f0-2) (+! (-> s4-0 num-spheres) 1) @@ -2070,12 +2003,11 @@ (when (logtest? (-> arg1 nav-flags) (nav-flags navf1)) (let ((s5-1 (-> arg1 process nav extra-nav-sphere))) (when (< (-> arg0 num-spheres) (-> arg0 max-spheres)) - (let* ((s4-1 (-> arg0 sphere (-> arg0 num-spheres))) - (f1-1 (vector-vector-xz-distance-squared s5-1 (-> arg0 shape trans))) - (f0-4 (+ (-> s5-1 w) (-> arg0 shape nav-radius))) - (f2-7 (+ 40960.0 f0-4)) - ) - (when (< f1-1 (* f2-7 f2-7)) + (let ((s4-1 (-> arg0 sphere (-> arg0 num-spheres))) + (f1-1 (vector-vector-xz-distance-squared s5-1 (-> arg0 shape trans))) + (f0-4 (+ (-> s5-1 w) (-> arg0 shape nav-radius))) + ) + (when (< f1-1 (square (+ 40960.0 f0-4))) (vector-! (the-as vector s4-1) s5-1 (-> arg0 mesh origin)) (set! (-> s4-1 w) f0-4) (+! (-> arg0 num-spheres) 1) @@ -2092,15 +2024,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod nav-control-method-28 ((this nav-control) (arg0 collide-kind)) - (local-vars - (sv-32 nav-control) - (sv-48 sphere) - (sv-64 sphere) - (sv-80 nav-control) - (sv-96 sphere) - (sv-112 vector) - (sv-128 sphere) - ) (set! (-> this num-spheres) 0) (let ((s4-0 (-> this mesh user-list)) (s3-0 (new 'stack-no-clear 'vector)) @@ -2119,17 +2042,17 @@ (when (logtest? (-> s1-0 nav-flags) (nav-flags navf0)) (set! (-> s0-0 quad) (-> s1-0 root-prim prim-core world-sphere quad)) (set! (-> s0-0 w) (-> s1-0 nav-radius)) - (set! sv-32 s2-0) - (when (< (-> sv-32 num-spheres) (-> sv-32 max-spheres)) - (set! sv-48 (-> sv-32 sphere (-> sv-32 num-spheres))) - (let* ((f1-0 (vector-vector-xz-distance-squared s0-0 (-> sv-32 shape trans))) - (f0-2 (+ (-> s0-0 w) (-> sv-32 shape nav-radius))) - (f2-2 (+ 40960.0 f0-2)) - ) - (when (< f1-0 (* f2-2 f2-2)) - (vector-! (the-as vector sv-48) s0-0 (-> sv-32 mesh origin)) - (set! (-> sv-48 w) f0-2) - (+! (-> sv-32 num-spheres) 1) + (let ((sv-32 s2-0)) + (when (< (-> sv-32 num-spheres) (-> sv-32 max-spheres)) + (let ((sv-48 (-> sv-32 sphere (-> sv-32 num-spheres))) + (f1-0 (vector-vector-xz-distance-squared s0-0 (-> sv-32 shape trans))) + (f0-2 (+ (-> s0-0 w) (-> sv-32 shape nav-radius))) + ) + (when (< f1-0 (square (+ 40960.0 f0-2))) + (vector-! (the-as vector sv-48) s0-0 (-> sv-32 mesh origin)) + (set! (-> sv-48 w) f0-2) + (+! (-> sv-32 num-spheres) 1) + ) ) ) ) @@ -2139,12 +2062,11 @@ (when (logtest? (-> s1-0 nav-flags) (nav-flags navf1)) (let ((s1-1 (-> s1-0 process nav extra-nav-sphere))) (when (< (-> s2-0 num-spheres) (-> s2-0 max-spheres)) - (let* ((s0-1 (-> s2-0 sphere (-> s2-0 num-spheres))) - (f1-1 (vector-vector-xz-distance-squared s1-1 (-> s2-0 shape trans))) - (f0-4 (+ (-> s1-1 w) (-> s2-0 shape nav-radius))) - (f2-7 (+ 40960.0 f0-4)) - ) - (when (< f1-1 (* f2-7 f2-7)) + (let ((s0-1 (-> s2-0 sphere (-> s2-0 num-spheres))) + (f1-1 (vector-vector-xz-distance-squared s1-1 (-> s2-0 shape trans))) + (f0-4 (+ (-> s1-1 w) (-> s2-0 shape nav-radius))) + ) + (when (< f1-1 (square (+ 40960.0 f0-4))) (vector-! (the-as vector s0-1) s1-1 (-> s2-0 mesh origin)) (set! (-> s0-1 w) f0-4) (+! (-> s2-0 num-spheres) 1) @@ -2162,12 +2084,11 @@ (s0-2 (-> this mesh static-sphere s2-1)) ) (when (< (-> s1-2 num-spheres) (-> s1-2 max-spheres)) - (set! sv-64 (-> s1-2 sphere (-> s1-2 num-spheres))) - (let* ((f1-2 (vector-vector-xz-distance-squared (the-as vector s0-2) (-> s1-2 shape trans))) - (f0-6 (+ (-> s0-2 trans w) (-> s1-2 shape nav-radius))) - (f2-12 (+ 40960.0 f0-6)) - ) - (when (< f1-2 (* f2-12 f2-12)) + (let ((sv-64 (-> s1-2 sphere (-> s1-2 num-spheres))) + (f1-2 (vector-vector-xz-distance-squared (the-as vector s0-2) (-> s1-2 shape trans))) + (f0-6 (+ (-> s0-2 trans w) (-> s1-2 shape nav-radius))) + ) + (when (< f1-2 (square (+ 40960.0 f0-6))) (vector-! (the-as vector sv-64) (the-as vector s0-2) (-> s1-2 mesh origin)) (set! (-> sv-64 w) f0-6) (+! (-> s1-2 num-spheres) 1) @@ -2185,39 +2106,35 @@ (let ((s0-3 (the-as collide-shape (-> (the-as connection v1-71) param3)))) (when (not (or (= s0-3 (-> this shape)) (not (logtest? arg0 (-> s0-3 root-prim prim-core collide-as))))) (let ((s1-3 this)) - (set! sv-112 s3-0) - (when (logtest? (-> s0-3 nav-flags) (nav-flags navf0)) - (set! (-> sv-112 quad) (-> s0-3 root-prim prim-core world-sphere quad)) - (set! (-> sv-112 w) (-> s0-3 nav-radius)) - (set! sv-80 s1-3) - (when (< (-> sv-80 num-spheres) (-> sv-80 max-spheres)) - (set! sv-96 (-> sv-80 sphere (-> sv-80 num-spheres))) - (let* ((f1-3 (vector-vector-xz-distance-squared sv-112 (-> sv-80 shape trans))) - (f0-9 (+ (-> sv-112 w) (-> sv-80 shape nav-radius))) - (f2-17 (+ 40960.0 f0-9)) - ) - (when (< f1-3 (* f2-17 f2-17)) - (let ((v1-94 sv-96) - (a0-47 (-> sv-80 mesh origin)) + (let ((sv-112 s3-0)) + (when (logtest? (-> s0-3 nav-flags) (nav-flags navf0)) + (set! (-> sv-112 quad) (-> s0-3 root-prim prim-core world-sphere quad)) + (set! (-> sv-112 w) (-> s0-3 nav-radius)) + (let ((sv-80 s1-3)) + (when (< (-> sv-80 num-spheres) (-> sv-80 max-spheres)) + (let ((sv-96 (-> sv-80 sphere (-> sv-80 num-spheres))) + (f1-3 (vector-vector-xz-distance-squared sv-112 (-> sv-80 shape trans))) + (f0-9 (+ (-> sv-112 w) (-> sv-80 shape nav-radius))) ) - (vector-! (the-as vector v1-94) sv-112 a0-47) + (when (< f1-3 (square (+ 40960.0 f0-9))) + (vector-! (the-as vector sv-96) sv-112 (-> sv-80 mesh origin)) + (set! (-> sv-96 w) f0-9) + (+! (-> sv-80 num-spheres) 1) + ) ) - (set! (-> sv-96 w) f0-9) - (+! (-> sv-80 num-spheres) 1) ) ) + 0 ) - 0 ) (when (logtest? (-> s0-3 nav-flags) (nav-flags navf1)) (let ((s0-4 (-> s0-3 process nav extra-nav-sphere))) (when (< (-> s1-3 num-spheres) (-> s1-3 max-spheres)) - (set! sv-128 (-> s1-3 sphere (-> s1-3 num-spheres))) - (let* ((f1-4 (vector-vector-xz-distance-squared s0-4 (-> s1-3 shape trans))) - (f0-11 (+ (-> s0-4 w) (-> s1-3 shape nav-radius))) - (f2-22 (+ 40960.0 f0-11)) - ) - (when (< f1-4 (* f2-22 f2-22)) + (let ((sv-128 (-> s1-3 sphere (-> s1-3 num-spheres))) + (f1-4 (vector-vector-xz-distance-squared s0-4 (-> s1-3 shape trans))) + (f0-11 (+ (-> s0-4 w) (-> s1-3 shape nav-radius))) + ) + (when (< f1-4 (square (+ 40960.0 f0-11))) (vector-! (the-as vector sv-128) s0-4 (-> s1-3 mesh origin)) (set! (-> sv-128 w) f0-11) (+! (-> s1-3 num-spheres) 1) @@ -2369,10 +2286,7 @@ (if (< f1-1 f0-4) (set! f0-4 f1-1) ) - (let* ((f2-0 f1-1) - (f2-2 (* f2-0 f2-0)) - (f3-0 f0-4) - (f2-4 (sqrtf (- f2-2 (* f3-0 f3-0)))) + (let* ((f2-4 (sqrtf (- (square f1-1) (square f0-4)))) (f3-4 (/ 1.0 f1-1)) (f1-3 (* f2-4 f3-4)) (f30-0 (* f0-4 f3-4)) @@ -2433,7 +2347,7 @@ ;; definition for method 32 of type nav-control ;; INFO: Used lq/sq (defmethod nav-control-method-32 ((this nav-control) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float)) - (local-vars (v0-3 symbol) (v1-38 int) (a0-29 int) (a3-7 int) (sv-208 sphere)) + (local-vars (v0-3 symbol) (v1-38 int) (a0-29 int) (a3-7 int)) (let ((gp-0 (new 'stack-no-clear 'nav-control-cfs-work))) (set! (-> gp-0 in-dir quad) (-> arg2 quad)) (set! (-> gp-0 in-dir y) 0.0) @@ -2450,12 +2364,9 @@ (set! (-> gp-0 i-inside-sphere) -1) (set! (-> gp-0 inside-sphere-dist) 0.0) (dotimes (s0-0 (-> this num-spheres)) - (set! sv-208 (-> this sphere s0-0)) - (set! (-> gp-0 dist2) (vector-vector-xz-distance-squared arg1 sv-208)) - (let ((f0-10 (-> gp-0 dist2)) - (f1-0 (-> sv-208 w)) - ) - (when (< f0-10 (* f1-0 f1-0)) + (let ((sv-208 (-> this sphere s0-0))) + (set! (-> gp-0 dist2) (vector-vector-xz-distance-squared arg1 sv-208)) + (when (< (-> gp-0 dist2) (square (-> sv-208 w))) (vector-! (-> gp-0 temp-dir 0) arg1 (the-as vector sv-208)) (set! (-> gp-0 temp-dir 0 y) 0.0) (if (< 0.0 (vector-dot (-> gp-0 temp-dir 0) (-> gp-0 in-dir))) @@ -2671,36 +2582,32 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch vector vs none. (defmethod nav-control-method-19 ((this nav-control) (arg0 vector) (arg1 collide-shape-moving) (arg2 vector) (arg3 float)) - (local-vars (sv-48 float)) - (let ((f30-0 (* arg3 (seconds-per-frame))) - (s0-0 arg1) - (s1-0 arg2) - (s2-0 deg-diff) - ) - (set! sv-48 (y-angle s0-0)) - (let* ((a1-1 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s0-0 trans)))) - (f28-0 (s2-0 sv-48 a1-1)) + (let* ((f30-0 (* arg3 (seconds-per-frame))) + (s0-0 arg1) + (s1-0 arg2) + (f28-0 + (deg-diff (y-angle s0-0) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s0-0 trans)))) ) - (cond - ((or (vector= arg2 (-> this target-pos)) (< (fabs f28-0) 364.0889)) - (logior! (-> this flags) (nav-control-flags navcf21)) - (set! (-> arg0 quad) (-> arg2 quad)) ) - (else - (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> arg1 quat)))) - (vector-rotate-y! s2-1 s2-1 (fmax (fmin f28-0 f30-0) (- f30-0))) - (vector-normalize! s2-1 819.2) - (logclear! (-> this flags) (nav-control-flags navcf21)) - (vector+! arg0 (-> arg1 trans) s2-1) - ) - (when (or (not (nav-control-method-16 this arg0)) - (logtest? (nav-control-flags navcf17) (-> this flags)) - (not (logtest? (-> this flags) (nav-control-flags navcf10))) - ) - (logior! (-> this flags) (nav-control-flags navcf21)) - (vector-! (-> this travel) arg2 (-> arg1 trans)) - (set! (-> arg0 quad) (-> arg2 quad)) - ) + (cond + ((or (vector= arg2 (-> this target-pos)) (< (fabs f28-0) 364.0889)) + (logior! (-> this flags) (nav-control-flags navcf21)) + (set! (-> arg0 quad) (-> arg2 quad)) + ) + (else + (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> arg1 quat)))) + (vector-rotate-y! s2-1 s2-1 (fmax (fmin f28-0 f30-0) (- f30-0))) + (vector-normalize! s2-1 819.2) + (logclear! (-> this flags) (nav-control-flags navcf21)) + (vector+! arg0 (-> arg1 trans) s2-1) + ) + (when (or (not (nav-control-method-16 this arg0)) + (logtest? (nav-control-flags navcf17) (-> this flags)) + (not (logtest? (-> this flags) (nav-control-flags navcf10))) + ) + (logior! (-> this flags) (nav-control-flags navcf21)) + (vector-! (-> this travel) arg2 (-> arg1 trans)) + (set! (-> arg0 quad) (-> arg2 quad)) ) ) ) @@ -2817,81 +2724,81 @@ (arg4 float) (arg5 clip-travel-vector-to-mesh-return-info) ) - (local-vars (v1-10 symbol) (sv-96 symbol) (sv-112 int) (sv-128 int)) + (local-vars (v1-10 symbol)) (when arg5 (set! (-> arg5 found-boundary) #f) (set! (-> arg5 gap-poly) #f) ) (let ((s0-0 (new 'stack-no-clear 'nav-ray))) - (set! sv-96 (the-as symbol #f)) - (set! sv-112 0) - (set! (-> s0-0 current-poly) arg1) - (set! (-> s0-0 current-pos quad) (-> arg0 quad)) - (vector+! (-> s0-0 dest-pos) arg0 arg2) - (until sv-96 - (set! sv-128 0) - (init-ray s0-0) - (until v1-10 - (set! sv-128 (+ sv-128 1)) - (move-along-nav-ray! this s0-0) - (set! v1-10 (or (>= sv-128 15) (or (>= (-> s0-0 len) (fmax 20480.0 arg4)) (-> s0-0 terminated)))) - ) - (cond - ((and (-> s0-0 hit-boundary) (and (< (-> s0-0 len) arg4) (!= (-> s0-0 last-edge) -1) (< sv-112 1))) - (set! sv-112 (+ sv-112 1)) - (let* ((v1-22 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert0-table* (-> s0-0 last-edge))))) - (a0-15 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert1-table* (-> s0-0 last-edge))))) - (f2-1 (- (-> v1-22 z) (-> a0-15 z))) - (f3-0 (- (-> a0-15 x) (-> v1-22 x))) - (f1-5 (-> arg2 x)) - (f0-4 (-> arg2 z)) - (f4-0 f2-1) - (f4-2 (* f4-0 f4-0)) - (f5-0 f3-0) - (f4-4 (sqrtf (+ f4-2 (* f5-0 f5-0)))) - (f4-6 (/ 1.0 f4-4)) - (f2-2 (* f2-1 f4-6)) - (f3-1 (* f3-0 f4-6)) - ) - (when arg5 - (set! (-> arg5 found-boundary) #t) - (vector+! (-> arg5 intersection) (-> s0-0 current-pos) (-> this origin)) - (set! (-> arg5 boundary-normal x) f2-2) - (set! (-> arg5 boundary-normal y) 0.0) - (set! (-> arg5 boundary-normal z) f3-1) - (set! (-> arg5 poly) (-> s0-0 current-poly)) - (set! (-> arg5 edge) (-> s0-0 last-edge)) - (vector+! (-> arg5 vert-0) (the-as vector v1-22) (-> this origin)) - (vector+! (-> arg5 vert-1) (the-as vector a0-15) (-> this origin)) - ) - (set! (-> s0-0 dest-pos quad) (-> s0-0 current-pos quad)) - (cond - (arg3 - (let* ((f4-9 (* 1.01 (+ (* f2-2 f1-5) (* f3-1 f0-4)))) - (f1-6 (- f1-5 (* f2-2 f4-9))) - (f0-5 (- f0-4 (* f3-1 f4-9))) - ) - (+! (-> s0-0 dest-pos x) f1-6) - (+! (-> s0-0 dest-pos z) f0-5) - ) + (let ((sv-96 (the-as symbol #f)) + (sv-112 0) + ) + (set! (-> s0-0 current-poly) arg1) + (set! (-> s0-0 current-pos quad) (-> arg0 quad)) + (vector+! (-> s0-0 dest-pos) arg0 arg2) + (until sv-96 + (let ((sv-128 0)) + (init-ray s0-0) + (until v1-10 + (+! sv-128 1) + (move-along-nav-ray! this s0-0) + (set! v1-10 (or (>= sv-128 15) (or (>= (-> s0-0 len) (fmax 20480.0 arg4)) (-> s0-0 terminated)))) + ) + ) + (cond + ((and (-> s0-0 hit-boundary) (and (< (-> s0-0 len) arg4) (!= (-> s0-0 last-edge) -1) (< sv-112 1))) + (+! sv-112 1) + (let* ((v1-22 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert0-table* (-> s0-0 last-edge))))) + (a0-15 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert1-table* (-> s0-0 last-edge))))) + (f2-1 (- (-> v1-22 z) (-> a0-15 z))) + (f3-0 (- (-> a0-15 x) (-> v1-22 x))) + (f1-5 (-> arg2 x)) + (f0-4 (-> arg2 z)) + (f4-4 (sqrtf (+ (square f2-1) (square f3-0)))) + (f4-6 (/ 1.0 f4-4)) + (f2-2 (* f2-1 f4-6)) + (f3-1 (* f3-0 f4-6)) + ) + (when arg5 + (set! (-> arg5 found-boundary) #t) + (vector+! (-> arg5 intersection) (-> s0-0 current-pos) (-> this origin)) + (set! (-> arg5 boundary-normal x) f2-2) + (set! (-> arg5 boundary-normal y) 0.0) + (set! (-> arg5 boundary-normal z) f3-1) + (set! (-> arg5 poly) (-> s0-0 current-poly)) + (set! (-> arg5 edge) (-> s0-0 last-edge)) + (vector+! (-> arg5 vert-0) (the-as vector v1-22) (-> this origin)) + (vector+! (-> arg5 vert-1) (the-as vector a0-15) (-> this origin)) ) - (else - (set! sv-96 #t) - sv-96 + (set! (-> s0-0 dest-pos quad) (-> s0-0 current-pos quad)) + (cond + (arg3 + (let* ((f4-9 (* 1.01 (+ (* f2-2 f1-5) (* f3-1 f0-4)))) + (f1-6 (- f1-5 (* f2-2 f4-9))) + (f0-5 (- f0-4 (* f3-1 f4-9))) + ) + (+! (-> s0-0 dest-pos x) f1-6) + (+! (-> s0-0 dest-pos z) f0-5) + ) + ) + (else + (set! sv-96 #t) + sv-96 + ) ) ) ) - ) - ((-> s0-0 hit-gap) - (if arg5 - (set! (-> arg5 gap-poly) (-> s0-0 next-poly)) - ) - (set! sv-96 #t) - sv-96 - ) - (else - (set! sv-96 #t) - sv-96 + ((-> s0-0 hit-gap) + (if arg5 + (set! (-> arg5 gap-poly) (-> s0-0 next-poly)) + ) + (set! sv-96 #t) + sv-96 + ) + (else + (set! sv-96 #t) + sv-96 + ) ) ) ) @@ -2932,10 +2839,7 @@ (when (not v0-2) (let* ((f0-3 (- (-> arg2 x) (-> arg1 x))) (f1-2 (- (-> arg2 z) (-> arg1 z))) - (f2-1 f0-3) - (f2-3 (* f2-1 f2-1)) - (f3-0 f1-2) - (f2-5 (sqrtf (+ f2-3 (* f3-0 f3-0)))) + (f2-5 (sqrtf (+ (square f0-3) (square f1-2)))) (f3-3 f2-5) (f3-5 (/ 1.0 f3-3)) (f4-2 (* f3-5 (- f1-2))) @@ -2945,7 +2849,7 @@ ) (when (>= arg3 (fabs (+ (* f3-7 f4-2) (* f6-2 f5-0)))) (let ((f0-5 (+ (* f3-7 f0-3) (* f6-2 f1-2)))) - (set! v0-2 (and (>= f0-5 0.0) (>= (* f2-5 f2-5) f0-5))) + (set! v0-2 (and (>= f0-5 0.0) (>= (square f2-5) f0-5))) ) ) ) @@ -2964,10 +2868,7 @@ (s1-0 0) ) (let* ((s0-0 #f) - (f2-2 f0-1) - (f2-4 (* f2-2 f2-2)) - (f3-0 f1-2) - (f2-6 (sqrtf (+ f2-4 (* f3-0 f3-0)))) + (f2-6 (sqrtf (+ (square f0-1) (square f1-2)))) (f2-8 (/ 1.0 f2-6)) (f30-0 (* f0-1 f2-8)) (f28-0 (* f1-2 f2-8)) @@ -3030,110 +2931,107 @@ ;; definition for method 13 of type nav-control ;; INFO: Used lq/sq (defmethod nav-control-method-13 ((this nav-control) (arg0 vector) (arg1 vector)) - (local-vars - (sv-80 vector) - (sv-84 vector) - (sv-88 nav-poly) - (sv-92 vector) - (sv-96 nav-route-portal) - (sv-100 symbol) - ) - (set! sv-80 (new 'stack-no-clear 'vector)) - (set! sv-84 (new 'stack-no-clear 'vector)) - (set! sv-88 (-> this current-poly)) - (set! sv-92 (new 'stack-no-clear 'vector)) - (set! sv-96 (new 'stack-no-clear 'nav-route-portal)) - (set! sv-100 (the-as symbol #f)) - (vector-! sv-80 (-> this shape trans) (-> this mesh origin)) - (set! (-> sv-84 quad) (-> sv-80 quad)) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (vector-! s4-0 arg0 (-> this mesh origin)) - (set! (-> this target-poly) (find-poly (-> this mesh) s4-0 (-> this nearest-y-threshold) (&-> this flags))) - (if (not (-> this target-poly)) - (set! (-> this target-poly) (-> this current-poly)) + (let ((sv-80 (new 'stack-no-clear 'vector)) + (sv-84 (new 'stack-no-clear 'vector)) ) - (project-point-into-tri-2d (-> this mesh) (-> this target-poly) sv-92 s4-0) - ) - (vector-! (-> this travel) sv-92 sv-80) - (setup-portal (-> this mesh) (-> this current-poly) (-> this target-poly) sv-96) - (cond - ((not (-> sv-96 next-poly)) - (set! (-> this next-poly) #f) - (set! (-> this portal 0) #f) - (set! (-> this portal 1) #f) - ) - (else - (set! (-> this next-poly) (-> sv-96 next-poly)) - (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) - (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) - (set! sv-100 #t) - (while (and sv-100 - (-> sv-96 next-poly) - (test-xz-point-on-line-segment? sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) 409.59998) - ) - (when #t - #t - (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-84) - (vector-! (-> this travel) sv-92 sv-84) - 0 + (let ((sv-88 (-> this current-poly))) + (let ((sv-92 (new 'stack-no-clear 'vector)) + (sv-96 (new 'stack-no-clear 'nav-route-portal)) + (sv-100 (the-as symbol #f)) + ) + (vector-! sv-80 (-> this shape trans) (-> this mesh origin)) + (set! (-> sv-84 quad) (-> sv-80 quad)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 arg0 (-> this mesh origin)) + (set! (-> this target-poly) (find-poly (-> this mesh) s4-0 (-> this nearest-y-threshold) (&-> this flags))) + (if (not (-> this target-poly)) + (set! (-> this target-poly) (-> this current-poly)) + ) + (project-point-into-tri-2d (-> this mesh) (-> this target-poly) sv-92 s4-0) ) + (vector-! (-> this travel) sv-92 sv-80) + (setup-portal (-> this mesh) (-> this current-poly) (-> this target-poly) sv-96) (cond - ((logtest? (-> sv-96 next-poly pat) 1) - (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-92) - (vector-! (-> this travel) sv-92 sv-84) - (set! (-> this next-poly) (-> sv-96 next-poly)) - (set! sv-100 (the-as symbol #f)) - ) - ((begin - (set! sv-88 (-> sv-96 next-poly)) - (setup-portal (-> this mesh) (-> sv-96 next-poly) (-> this target-poly) sv-96) - ) - (set! (-> this next-poly) (-> sv-96 next-poly)) - (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) - (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) - 0 + ((not (-> sv-96 next-poly)) + (set! (-> this next-poly) #f) + (set! (-> this portal 0) #f) + (set! (-> this portal 1) #f) ) (else - (set! (-> this next-poly) #f) - (set! (-> this portal 0) #f) - (set! (-> this portal 1) #f) - (set! sv-100 (the-as symbol #f)) + (set! (-> this next-poly) (-> sv-96 next-poly)) + (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) + (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) + (set! sv-100 #t) + (while (and sv-100 + (-> sv-96 next-poly) + (test-xz-point-on-line-segment? sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) 409.59998) + ) + (when #t + #t + (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-84) + (vector-! (-> this travel) sv-92 sv-84) + 0 + ) + (cond + ((logtest? (-> sv-96 next-poly pat) 1) + (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-92) + (vector-! (-> this travel) sv-92 sv-84) + (set! (-> this next-poly) (-> sv-96 next-poly)) + (set! sv-100 (the-as symbol #f)) + ) + ((begin + (set! sv-88 (-> sv-96 next-poly)) + (setup-portal (-> this mesh) (-> sv-96 next-poly) (-> this target-poly) sv-96) + ) + (set! (-> this next-poly) (-> sv-96 next-poly)) + (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) + (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) + 0 + ) + (else + (set! (-> this next-poly) #f) + (set! (-> this portal 0) #f) + (set! (-> this portal 1) #f) + (set! sv-100 (the-as symbol #f)) + ) + ) + ) + ) + ) + (when sv-100 + (when (not (ray-ccw-line-segment-intersection? + sv-84 + (-> this travel) + (the-as vector (-> this portal 0)) + (the-as vector (-> this portal 1)) + ) + ) + (let ((a0-18 (choose-travel-portal-vertex (-> this mesh) sv-96 (-> this target-poly) sv-92))) + (vector-! (-> this travel) (the-as vector (-> sv-96 vertex a0-18)) sv-84) + ) ) ) ) - ) - ) - (when sv-100 - (when (not (ray-ccw-line-segment-intersection? - sv-84 - (-> this travel) - (the-as vector (-> this portal 0)) - (the-as vector (-> this portal 1)) - ) - ) - (let ((a0-18 (choose-travel-portal-vertex (-> this mesh) sv-96 (-> this target-poly) sv-92))) - (vector-! (-> this travel) (the-as vector (-> sv-96 vertex a0-18)) sv-84) + (nav-control-method-33 this (-> this travel) sv-84 (-> this travel) arg1 40960.0) + (let ((s5-1 (new 'stack-no-clear 'clip-travel-vector-to-mesh-return-info))) + (nav-mesh-method-16 + (-> this mesh) + sv-84 + sv-88 + (-> this travel) + (not (logtest? (-> this flags) (nav-control-flags navcf12))) + 204.8 + s5-1 + ) + (if (-> s5-1 gap-poly) + (set! (-> this next-poly) (-> s5-1 gap-poly)) + ) ) ) - ) - (nav-control-method-33 this (-> this travel) sv-84 (-> this travel) arg1 40960.0) - (let ((s5-1 (new 'stack-no-clear 'clip-travel-vector-to-mesh-return-info))) - (nav-mesh-method-16 - (-> this mesh) - sv-84 - sv-88 - (-> this travel) - (not (logtest? (-> this flags) (nav-control-flags navcf12))) - 204.8 - s5-1 + (let ((v1-82 (new 'stack-no-clear 'vector))) + (vector-! v1-82 sv-84 sv-80) + (vector+! (-> this travel) (-> this travel) v1-82) ) - (if (-> s5-1 gap-poly) - (set! (-> this next-poly) (-> s5-1 gap-poly)) - ) - ) - (let ((v1-82 (new 'stack-no-clear 'vector))) - (vector-! v1-82 sv-84 sv-80) - (vector+! (-> this travel) (-> this travel) v1-82) ) (set! (-> this travel y) 0.0) (-> this travel) diff --git a/test/decompiler/reference/jak1/engine/physics/trajectory_REF.gc b/test/decompiler/reference/jak1/engine/physics/trajectory_REF.gc index d583729294..62c5e9bb4d 100644 --- a/test/decompiler/reference/jak1/engine/physics/trajectory_REF.gc +++ b/test/decompiler/reference/jak1/engine/physics/trajectory_REF.gc @@ -51,10 +51,9 @@ ;; definition for method 13 of type trajectory ;; INFO: Return type mismatch int vs none. (defmethod setup-from-to-y-vel! ((this trajectory) (from vector) (to vector) (y-vel float) (grav float)) - (let* ((f0-0 y-vel) - (f1-3 (- (* f0-0 f0-0) (* 2.0 (- (-> from y) (-> to y)) grav))) - (f0-3 900.0) - ) + (let ((f1-3 (- (square y-vel) (* 2.0 (- (-> from y) (-> to y)) grav))) + (f0-3 900.0) + ) (when (>= f1-3 0.0) (let ((f0-4 (sqrtf f1-3))) (set! f0-3 (fmax (/ (- (- y-vel) f0-4) grav) (/ (+ (- y-vel) f0-4) grav))) diff --git a/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc b/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc index e005fb1f2d..455f7b5792 100644 --- a/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc +++ b/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc @@ -259,7 +259,7 @@ (f28-0 (* 0.0078125 (the float (- 127 (the-as int (-> pad lefty)))))) ) (set! (-> pad stick0-dir) (atan (- f30-0) f28-0)) - (set! (-> pad stick0-speed) (fmin 1.0 (sqrtf (+ (* f30-0 f30-0) (* f28-0 f28-0))))) + (set! (-> pad stick0-speed) (fmin 1.0 (sqrtf (+ (square f30-0) (square f28-0))))) ) (if (< (-> pad stick0-speed) 0.3) (set! (-> pad stick0-speed) 0.0) diff --git a/test/decompiler/reference/jak1/engine/sound/gsound_REF.gc b/test/decompiler/reference/jak1/engine/sound/gsound_REF.gc index aab6a84ac1..39d978d7ae 100644 --- a/test/decompiler/reference/jak1/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/jak1/engine/sound/gsound_REF.gc @@ -438,10 +438,10 @@ ;; definition for function sound-play-by-name ;; INFO: Used lq/sq (defun sound-play-by-name ((name sound-name) (id sound-id) (vol int) (pitch int) (bend int) (group sound-group) (trans symbol)) - (local-vars (sv-16 sound-group)) (with-pp - (set! sv-16 group) - (let ((sound-trans (the-as structure trans))) + (let ((sv-16 group) + (sound-trans (the-as structure trans)) + ) (when *sound-player-enable* (let ((cmd (the-as sound-rpc-play (get-sound-buffer-entry)))) (set! (-> cmd command) (sound-command play)) @@ -603,108 +603,102 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs ambient-sound. (defmethod new ambient-sound ((allocation symbol) (type-to-make type) (arg0 basic) (arg1 vector)) - (local-vars - (sv-16 sound-spec) - (sv-32 sound-name) - (sv-48 (pointer float)) - (sv-52 sound-play-parms) - (sv-56 int) - (sv-64 res-tag) - ) - (set! sv-16 (the-as sound-spec #f)) - (set! sv-32 (the-as sound-name 0)) - (set! sv-48 (the-as (pointer float) #f)) - (set! sv-52 (the-as sound-play-parms #f)) - (set! sv-56 0) - (case (-> arg0 type) - ((entity-actor entity-ambient) - (let ((bc - ((method-of-type res-lump get-property-struct) - (the-as res-lump arg0) - 'effect-name - 'exact - 0.0 - #f - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (when bc - (set! sv-32 (string->sound-name (symbol->string bc))) - (set! sv-48 (res-lump-data (the-as res-lump arg0) 'cycle-speed (pointer float))) - (set! sv-16 *ambient-spec*) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-7 - ((method-of-type res-lump get-property-data) - (the-as res-lump arg0) - 'effect-param - 'exact - 0.0 - (the-as pointer #f) - (& sv-64) - *res-static-buf* - ) - ) + (let ((sv-16 (the-as sound-spec #f)) + (sv-32 (the-as sound-name 0)) + (sv-48 (the-as (pointer float) #f)) + (sv-52 (the-as sound-play-parms #f)) + (sv-56 0) + ) + (case (-> arg0 type) + ((entity-actor entity-ambient) + (let ((bc + ((method-of-type res-lump get-property-struct) + (the-as res-lump arg0) + 'effect-name + 'exact + 0.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when bc + (set! sv-32 (string->sound-name (symbol->string bc))) + (set! sv-48 (res-lump-data (the-as res-lump arg0) 'cycle-speed (pointer float))) + (set! sv-16 *ambient-spec*) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-7 + ((method-of-type res-lump get-property-data) + (the-as res-lump arg0) + 'effect-param + 'exact + 0.0 + (the-as pointer #f) + (& sv-64) + *res-static-buf* + ) + ) + ) + (when v1-7 + (set! sv-52 (the-as sound-play-parms v1-7)) + (set! sv-56 (the-as int (-> sv-64 elt-count))) ) - (when v1-7 - (set! sv-52 (the-as sound-play-parms v1-7)) - (set! sv-56 (the-as int (-> sv-64 elt-count))) ) ) ) ) - ) - ((sound-spec) - (set! sv-16 (the-as sound-spec arg0)) - ) - ((symbol) - (set! sv-32 (string->sound-name (symbol->string arg0))) - ) - ((string) - (set! sv-32 (string->sound-name (the-as string arg0))) - ) - (else - (format 0 "ERROR: ambient sound was told to play an unknown ~A.~%" arg0) - ) - ) - (the-as - ambient-sound - (cond - ((or sv-16 (nonzero? sv-32)) - (let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> this spec) sv-16) - (set! (-> this name) sv-32) - (set! (-> this playing-id) (new-sound-id)) - (set! (-> this params) (the-as (pointer float) sv-52)) - (set! (-> this param-count) sv-56) - (set! (-> this entity) #f) - (set! (-> this sound-count) 1) - (set! (-> this volume) 1024) - (set! (-> this pitch) 0) - (when (and sv-16 (!= sv-16 *ambient-spec*)) - (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask volume)) - (set! (-> this volume) (-> (the-as sound-spec sv-16) volume)) - ) - (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) - (set! (-> this pitch) (-> (the-as sound-spec sv-16) pitch-mod)) - ) - ) - (cond - (sv-48 - (set! (-> this time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) - (set! (-> this time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) - ) - (else - (set! (-> this time-base) -1) - ) - ) - (set! (-> this trans quad) (-> arg1 quad)) - this - ) + ((sound-spec) + (set! sv-16 (the-as sound-spec arg0)) + ) + ((symbol) + (set! sv-32 (string->sound-name (symbol->string arg0))) + ) + ((string) + (set! sv-32 (string->sound-name (the-as string arg0))) ) (else - (the-as ambient-sound 0) + (format 0 "ERROR: ambient sound was told to play an unknown ~A.~%" arg0) + ) + ) + (the-as + ambient-sound + (cond + ((or sv-16 (nonzero? sv-32)) + (let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> this spec) sv-16) + (set! (-> this name) sv-32) + (set! (-> this playing-id) (new-sound-id)) + (set! (-> this params) (the-as (pointer float) sv-52)) + (set! (-> this param-count) sv-56) + (set! (-> this entity) #f) + (set! (-> this sound-count) 1) + (set! (-> this volume) 1024) + (set! (-> this pitch) 0) + (when (and sv-16 (!= sv-16 *ambient-spec*)) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask volume)) + (set! (-> this volume) (-> (the-as sound-spec sv-16) volume)) + ) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) + (set! (-> this pitch) (-> (the-as sound-spec sv-16) pitch-mod)) + ) + ) + (cond + (sv-48 + (set! (-> this time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) + (set! (-> this time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) + ) + (else + (set! (-> this time-base) -1) + ) + ) + (set! (-> this trans quad) (-> arg1 quad)) + this + ) + ) + (else + (the-as ambient-sound 0) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/target/collide-reaction-target_REF.gc b/test/decompiler/reference/jak1/engine/target/collide-reaction-target_REF.gc index 769906c856..9f210170fc 100644 --- a/test/decompiler/reference/jak1/engine/target/collide-reaction-target_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/collide-reaction-target_REF.gc @@ -28,35 +28,36 @@ ;; WARN: Stack slot offset 48 signed mismatch ;; ERROR: Failed store: (s.q! v1-20 a0-7) at op 72 (defun poly-find-nearest-edge ((arg0 vector) (arg1 (inline-array vector)) (arg2 vector) (arg3 vector)) - (local-vars (sv-32 vector) (sv-36 float) (sv-40 int) (sv-48 float) (sv-80 vector)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (set! sv-36 4095996000.0) - (set! sv-40 -1) - (set! sv-48 0.0) - (dotimes (s2-0 3) - (let ((s0-0 (-> arg1 s2-0))) - (set! sv-80 (-> arg1 (mod (+ s2-0 1) 3))) - (let ((f30-0 (vector-line-distance-point! arg2 s0-0 sv-80 sv-32)) - (s1-1 (vector-! (new 'stack-no-clear 'vector) sv-80 s0-0)) - ) - 0.0 - (vector-normalize! s1-1 1.0) - (let ((f0-5 (fabs (vector-dot arg3 s1-1)))) - (when (or (< f30-0 sv-36) (and (= f30-0 sv-36) (< sv-48 f0-5))) - (set! sv-36 f30-0) - (set! sv-40 s2-0) - (set! sv-48 f0-5) + (let ((sv-32 (new 'stack-no-clear 'vector)) + (sv-36 4095996000.0) + (sv-40 -1) + ) + (let ((sv-48 0.0)) + (dotimes (s2-0 3) + (let* ((s0-0 (-> arg1 s2-0)) + (sv-80 (-> arg1 (mod (+ s2-0 1) 3))) + (f30-0 (vector-line-distance-point! arg2 s0-0 sv-80 sv-32)) + (s1-1 (vector-! (new 'stack-no-clear 'vector) sv-80 s0-0)) + ) + 0.0 + (vector-normalize! s1-1 1.0) + (let ((f0-5 (fabs (vector-dot arg3 s1-1)))) + (when (or (< f30-0 sv-36) (and (= f30-0 sv-36) (< sv-48 f0-5))) + (set! sv-36 f30-0) + (set! sv-40 s2-0) + (set! sv-48 f0-5) + ) ) ) ) ) + (let ((v1-20 (&-> arg0 x)) + (a0-7 (-> arg1 sv-40 quad)) + ) + (s.q! v1-20 a0-7) + ) + (set! (-> (&+ arg0 16) quad) (-> arg1 (mod (+ sv-40 1) 3) quad)) ) - (let ((v1-20 (&-> arg0 x)) - (a0-7 (-> arg1 sv-40 quad)) - ) - (s.q! v1-20 a0-7) - ) - (set! (-> (&+ arg0 16) quad) (-> arg1 (mod (+ sv-40 1) 3) quad)) arg0 ) @@ -70,172 +71,165 @@ (arg4 (pointer uint64)) (arg5 (pointer symbol)) ) - (local-vars - (sv-16 vector) - (sv-20 (pointer uint32)) - (sv-24 (pointer uint64)) - (sv-28 (pointer symbol)) - (sv-32 uint) - (sv-40 uint) - (sv-48 symbol) - (sv-52 vector) - (sv-56 vector) - (sv-160 vector) - (sv-164 collide-tri-result) - (sv-208 vector) - (sv-212 vector) - (sv-272 vector) - (sv-276 vector) - ) - (set! sv-16 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 unknown-vector60)) - (set! sv-56 (vector-cross! (-> arg0 unknown-vector-coverage-2) (-> arg0 poly-normal) sv-16)) - (vector-normalize! sv-56 1.0) - (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) - (set! sv-32 (logior sv-32 512)) - ) - (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-normalize! sv-52 1.0) - (set! sv-160 (vector-flatten! (-> arg0 unknown-vector-coverage-3) sv-52 (-> arg0 dynam gravity-normal))) - (set! sv-164 (new 'stack 'collide-tri-result)) - (vector-normalize! sv-160 1.0) - (if (< (vector-dot sv-160 sv-16) 0.0) - (vector-negate! sv-160 sv-160) - ) - (set! (-> arg0 unknown-float-coverage-0) 4095996000.0) - (set! (-> arg0 unknown-float-coverage-2) 4095996000.0) - (set! sv-208 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) sv-160 2867.2)) - (set! sv-212 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) - (vector+float*! sv-212 sv-212 sv-160 4096.0) - (when (>= (probe-using-line-sphere - *collide-cache* - sv-208 - sv-212 - 409.6 - (-> arg1 best-from-prim collide-with) - sv-164 - (new 'static 'pat-surface :noentity #x1) - ) - 0.0 + (let ((sv-16 arg2) + (sv-20 arg3) + (sv-24 arg4) + (sv-28 arg5) + (sv-32 (-> arg3 0)) + (sv-40 (-> arg4 0)) + (sv-48 (-> arg5 0)) + ) + (let ((sv-52 (-> arg0 unknown-vector60))) + (let ((sv-56 (vector-cross! (-> arg0 unknown-vector-coverage-2) (-> arg0 poly-normal) sv-16))) + (vector-normalize! sv-56 1.0) + (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) + (logior! sv-32 512) ) - (set! (-> arg0 unknown-float-coverage-0) - (vector-dot - (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> sv-164 intersect)) + (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-normalize! sv-52 1.0) + (let ((sv-160 (vector-flatten! (-> arg0 unknown-vector-coverage-3) sv-52 (-> arg0 dynam gravity-normal))) + (sv-164 (new 'stack 'collide-tri-result)) + ) + (vector-normalize! sv-160 1.0) + (if (< (vector-dot sv-160 sv-16) 0.0) + (vector-negate! sv-160 sv-160) + ) + (set! (-> arg0 unknown-float-coverage-0) 4095996000.0) + (set! (-> arg0 unknown-float-coverage-2) 4095996000.0) + (let ((sv-208 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) sv-160 2867.2)) + (sv-212 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) + ) + (vector+float*! sv-212 sv-212 sv-160 4096.0) + (when (>= (probe-using-line-sphere + *collide-cache* + sv-208 + sv-212 + 409.6 + (-> arg1 best-from-prim collide-with) + sv-164 + (new 'static 'pat-surface :noentity #x1) + ) + 0.0 + ) + (set! (-> arg0 unknown-float-coverage-0) + (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> sv-164 intersect)) + ) + ) + (set! (-> arg0 unknown-float-coverage-1) (the-as float (-> sv-164 pat))) + (set! (-> arg0 unknown-vector-coverage-0 quad) (-> sv-164 normal quad)) + 0 ) ) - (set! (-> arg0 unknown-float-coverage-1) (the-as float (-> sv-164 pat))) - (set! (-> arg0 unknown-vector-coverage-0 quad) (-> sv-164 normal quad)) - 0 - ) - (set! sv-272 (vector+float*! - (new 'stack-no-clear 'vector) - (-> arg1 best-tri intersect) - (-> arg0 dynam gravity-normal) - 819.2 - ) - ) - (set! sv-276 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) - (vector+float*! sv-272 sv-272 sv-160 -819.2) - (vector+float*! sv-276 sv-276 sv-160 -4096.0) - (when (>= (probe-using-line-sphere - *collide-cache* - sv-272 - sv-276 - 409.6 - (-> arg1 best-from-prim collide-with) - sv-164 - (new 'static 'pat-surface :noentity #x1) - ) - 0.0 - ) - (set! (-> arg0 unknown-float-coverage-2) (vector-vector-distance sv-272 (-> sv-164 intersect))) - (set! (-> arg0 unknown-u32-coverage-0) (the-as uint (-> sv-164 pat))) - (set! (-> arg0 unknown-vector-coverage-1 quad) (-> sv-164 normal quad)) - 0 - ) - (when (and (not (logtest? sv-32 512)) - (and (or (< (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) - (= (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61) 1) + (let ((sv-272 (vector+float*! + (new 'stack-no-clear 'vector) + (-> arg1 best-tri intersect) + (-> arg0 dynam gravity-normal) + 819.2 + ) ) - (and (< (-> arg0 unknown-float-coverage-2) (* 2.0 (-> arg1 best-from-prim local-sphere w))) - (zero? (shr (shl (-> arg0 unknown-u32-coverage-0) 58) 61)) + (sv-276 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) + ) + (vector+float*! sv-272 sv-272 sv-160 -819.2) + (vector+float*! sv-276 sv-276 sv-160 -4096.0) + (when (>= (probe-using-line-sphere + *collide-cache* + sv-272 + sv-276 + 409.6 + (-> arg1 best-from-prim collide-with) + sv-164 + (new 'static 'pat-surface :noentity #x1) + ) + 0.0 + ) + (set! (-> arg0 unknown-float-coverage-2) (vector-vector-distance sv-272 (-> sv-164 intersect))) + (set! (-> arg0 unknown-u32-coverage-0) (the-as uint (-> sv-164 pat))) + (set! (-> arg0 unknown-vector-coverage-1 quad) (-> sv-164 normal quad)) + 0 + ) + ) + ) + (when (and (not (logtest? sv-32 512)) + (and (or (< (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) + (= (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61) 1) + ) + (and (< (-> arg0 unknown-float-coverage-2) (* 2.0 (-> arg1 best-from-prim local-sphere w))) + (zero? (shr (shl (-> arg0 unknown-u32-coverage-0) 58) 61)) + ) + ) + ) + (logior! sv-32 128) + (set! (-> arg0 unknown-dword-coverage) (the-as int (current-time))) + (logior! sv-40 128) + (set-time! (-> arg0 unknown-dword21)) + (let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector22))) + (f0-21 (if (logtest? sv-32 2) + (cos (- 16384.0 (acos (-> arg0 coverage)))) + (-> arg0 coverage) + ) + ) + (f1-11 (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-tri intersect)) + ) + ) + ) + (if (or (not (logtest? sv-32 32)) (< 0.5 f0-21)) + (set! sv-48 (the-as symbol #f)) + ) + (when (and (or (and (< f0-21 0.95) (>= f30-0 0.0)) + (and (logtest? sv-32 32) (< f0-21 0.3)) + (< f1-11 (/ (-> arg1 best-from-prim local-sphere w) -4)) + ) + (>= (vector-dot sv-52 sv-16) -0.000001) + ) + (set! (-> arg0 surf) *edge-surface*) + (logior! sv-32 1024) + (set! sv-48 (the-as symbol #f)) + (when (logtest? sv-32 32) + (set! sv-48 #t) + (logior! sv-32 4096) + ) + ) + ) + ) + ) + (if (< (-> arg0 surface-angle) 0.0) + (set! sv-48 #t) + ) + (when sv-48 + (cond + ((and (or (= (-> arg0 poly-pat mode) (pat-mode ground)) + (and (logtest? sv-32 8) + (>= (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) + (zero? (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61)) + (< 0.3 (fabs (-> arg0 surface-angle))) ) ) - ) - (set! sv-32 (logior sv-32 128)) - (set! (-> arg0 unknown-dword-coverage) (the-as int (current-time))) - (set! sv-40 (logior sv-40 128)) - (set-time! (-> arg0 unknown-dword21)) - (let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector22))) - (f0-21 (if (logtest? sv-32 2) - (cos (- 16384.0 (acos (-> arg0 coverage)))) - (-> arg0 coverage) - ) - ) - (f1-11 (vector-dot - (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-tri intersect)) - ) - ) - ) - (if (or (not (logtest? sv-32 32)) (< 0.5 f0-21)) - (set! sv-48 (the-as symbol #f)) - ) - (when (and (or (and (< f0-21 0.95) (>= f30-0 0.0)) - (and (logtest? sv-32 32) (< f0-21 0.3)) - (< f1-11 (/ (-> arg1 best-from-prim local-sphere w) -4)) - ) - (>= (vector-dot sv-52 sv-16) -0.000001) - ) - (set! (-> arg0 surf) *edge-surface*) - (set! sv-32 (logior sv-32 1024)) - (set! sv-48 (the-as symbol #f)) - (when (logtest? sv-32 32) - (set! sv-48 #t) - (set! sv-32 (logior sv-32 4096)) + (not (logtest? sv-32 128)) + ) + (logior! sv-32 64) + (logior! sv-40 128) + (set-time! (-> arg0 unknown-dword21)) + (set! sv-48 (the-as symbol #f)) + ) + (#t + (logior! sv-32 64) + (logior! sv-40 128) + (set-time! (-> arg0 unknown-dword21)) ) ) ) + (set! (-> sv-24 0) sv-40) + (set! (-> sv-20 0) sv-32) + (set! (-> sv-28 0) sv-48) ) - (if (< (-> arg0 surface-angle) 0.0) - (set! sv-48 #t) - ) - (when sv-48 - (cond - ((and (or (= (-> arg0 poly-pat mode) (pat-mode ground)) - (and (logtest? sv-32 8) - (>= (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) - (zero? (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61)) - (< 0.3 (fabs (-> arg0 surface-angle))) - ) - ) - (not (logtest? sv-32 128)) - ) - (set! sv-32 (logior sv-32 64)) - (set! sv-40 (logior sv-40 128)) - (set-time! (-> arg0 unknown-dword21)) - (set! sv-48 (the-as symbol #f)) - ) - (#t - (set! sv-32 (logior sv-32 64)) - (set! sv-40 (logior sv-40 128)) - (set-time! (-> arg0 unknown-dword21)) - ) - ) - ) - (set! (-> sv-24 0) sv-40) - (set! (-> sv-20 0) sv-32) - (set! (-> sv-28 0) sv-48) (the-as uint 0) ) @@ -243,198 +237,200 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs cshape-moving-flags. (defun target-collision-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) - (local-vars (sv-80 vector) (sv-84 vector) (sv-88 matrix) (sv-96 int) (sv-104 int) (sv-160 symbol)) - (set! sv-80 (new-stack-vector0)) - (set! sv-84 (new-stack-vector0)) - (let ((v1-2 (new 'stack-no-clear 'matrix))) + (let ((sv-80 (new-stack-vector0)) + (sv-84 (new-stack-vector0)) + (v1-2 (new 'stack-no-clear 'matrix)) + ) (dotimes (a0-1 2) (set! (-> v1-2 vector a0-1 quad) (the-as uint128 0)) ) - (set! sv-88 v1-2) - ) - (set! sv-96 0) - (set! sv-104 0) - (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) - (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) - (move-by-vector! arg0 a1-3) - ) - (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) - (if (= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! sv-104 (logior sv-104 1)) - ) - (if (logtest? (-> arg0 unknown-surface00 flags) (surface-flags jump)) - (set! sv-104 (logior sv-104 32)) - ) - (let ((v1-23 (new 'stack-no-clear 'vector))) - (set! (-> v1-23 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) - (vector-! sv-80 v1-23 (-> arg1 best-tri intersect)) - ) - (vector-normalize! sv-80 1.0) - (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) - (when (< (-> arg0 coverage) 0.0) - (set! (-> arg0 coverage) 0.0) - (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) - (vector-normalize! sv-80 1.0) - ) - (if (< (-> arg0 coverage) 0.9999) - (set! sv-104 (logior sv-104 24)) - ) - (let ((v1-33 (-> sv-80 quad))) - (set! (-> sv-84 quad) v1-33) - ) - (if (= (-> arg1 best-u) 0.0) - (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) - ) - (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) - (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 vector 0)) - (if (< (-> arg0 poly-angle) -0.2) - (set! sv-96 (logior sv-96 16)) - ) - (if (< (-> arg0 poly-angle) 0.0) - (set! sv-96 (logior sv-96 #x4000)) - ) - (set! sv-160 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - (if (and sv-160 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.2 (fabs (-> arg0 surface-angle))))) - (set! sv-160 (the-as symbol #f)) - ) - (if sv-160 - (set! sv-104 (logior sv-104 2)) - ) - (if (logtest? sv-104 8) - (target-collision-low-coverage - arg0 - arg1 - sv-84 - (the-as (pointer uint32) (& sv-104)) - (the-as (pointer uint64) (& sv-96)) - (& sv-160) - ) - ) - (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) - (set! sv-96 (logior sv-96 2048)) - (when (not sv-160) - (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) - (when (< f30-0 1.0) - (let ((s3-1 (new-stack-vector0)) - (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 vector 0))) - ) - 0.0 - (vector-! s3-1 (-> sv-88 vector 0) (vector-float*! s3-1 (-> arg0 dynam gravity-normal) f28-0)) - (let* ((f0-20 (vector-length s3-1)) - (f1-9 f0-20) - ) - (if (< f28-0 0.0) - (set! f28-0 (* f28-0 f30-0)) - ) - (vector+! - (-> sv-88 vector 0) - (vector-float*! (-> sv-88 vector 0) (-> arg0 dynam gravity-normal) f28-0) - (vector-float*! s3-1 s3-1 (/ f0-20 f1-9)) + (let ((sv-88 v1-2) + (sv-96 0) + ) + (let ((sv-104 0)) + (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) + (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) + (move-by-vector! arg0 a1-3) + ) + (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) + (logior! sv-104 1) + ) + (if (logtest? (-> arg0 unknown-surface00 flags) (surface-flags jump)) + (logior! sv-104 32) + ) + (let ((v1-23 (new 'stack-no-clear 'vector))) + (set! (-> v1-23 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-23 (-> arg1 best-tri intersect)) + ) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) + (vector-normalize! sv-80 1.0) + ) + (if (< (-> arg0 coverage) 0.9999) + (logior! sv-104 24) + ) + (set! (-> sv-84 quad) (-> sv-80 quad)) + (if (= (-> arg1 best-u) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 vector 0)) + (if (< (-> arg0 poly-angle) -0.2) + (logior! sv-96 16) + ) + (if (< (-> arg0 poly-angle) 0.0) + (logior! sv-96 #x4000) + ) + (let ((sv-160 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (if (and sv-160 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.2 (fabs (-> arg0 surface-angle))))) + (set! sv-160 (the-as symbol #f)) + ) + (if sv-160 + (logior! sv-104 2) + ) + (if (logtest? sv-104 8) + (target-collision-low-coverage + arg0 + arg1 + sv-84 + (the-as (pointer uint32) (& sv-104)) + (the-as (pointer uint64) (& sv-96)) + (& sv-160) ) ) - ) - ) - ) - ) - ) - (set! sv-96 (logior sv-96 4)) - (cond - ((-> arg1 best-to-prim) - (set! sv-96 (logior sv-96 32)) - (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process))) - ) - ((= (-> arg0 poly-pat material) (pat-material waterbottom)) - ) - (else - (set! sv-96 (logior sv-96 4096)) - ) - ) - (cond - (sv-160 - (set! sv-104 (logior sv-104 4)) - (set! sv-96 (logior sv-96 8)) - (set! (-> arg0 cur-pat mode) 1) - (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-vector121 quad) (-> sv-84 quad)) - (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) - (-> arg0 history-data (logand (+ (-> arg0 unknown-halfword00) 127) 127)) - (cond - (#f - (sound-play "cursor-options") - (set! sv-104 (logior sv-104 8192)) - (vector-reflect-flat-above! arg2 (-> sv-88 vector 0) sv-84) - ) - (else - (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) - ) - ) - (cond - ((not (and (>= (-> arg1 best-from-prim local-sphere w) - (vector-dot - (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) - ) - ) - (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) - (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) - (not (logtest? sv-104 32)) + (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (logior! sv-96 2048) + (when (not sv-160) + (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) + (when (< f30-0 1.0) + (let ((s3-1 (new-stack-vector0)) + (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 vector 0))) ) - ) + 0.0 + (vector-! s3-1 (-> sv-88 vector 0) (vector-float*! s3-1 (-> arg0 dynam gravity-normal) f28-0)) + (let* ((f0-20 (vector-length s3-1)) + (f1-9 f0-20) + ) + (if (< f28-0 0.0) + (set! f28-0 (* f28-0 f30-0)) + ) + (vector+! + (-> sv-88 vector 0) + (vector-float*! (-> sv-88 vector 0) (-> arg0 dynam gravity-normal) f28-0) + (vector-float*! s3-1 s3-1 (/ f0-20 f1-9)) + ) + ) + ) + ) + ) ) - ) - (else - (set! sv-104 (logior sv-104 256)) - (set! sv-104 (logand -65 sv-104)) - (let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) - (vector-normalize! s3-4 1.0) - (vector-float*! arg2 s3-4 (vector-dot (-> sv-88 vector 0) s3-4)) ) - (vector+! arg2 arg2 (-> arg0 poly-normal)) - ) - ) - ) - (else - (set! sv-96 (logior sv-96 1)) - (set! (-> arg0 cur-pat mode) 0) - (if (= (-> arg1 best-from-prim prim-id) 6) - (set! (-> arg0 local-normal quad) (-> sv-84 quad)) - ) - (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) - (vector+! arg2 arg2 sv-84) - (set! (-> arg0 ground-touch-point w) 0.0) - (when (not (or (logtest? sv-104 15) (nonzero? (-> arg0 poly-pat event)))) - (set! sv-96 (logior sv-96 2)) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) - (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) - (set-time! (-> arg0 unknown-dword10)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector55 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) - (set! sv-104 (logior sv-104 2048)) - (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) - (set! sv-96 (logior sv-96 1024)) + (logior! sv-96 4) + (cond + ((-> arg1 best-to-prim) + (logior! sv-96 32) + (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process))) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (logior! sv-96 4096) + ) ) + (cond + (sv-160 + (logior! sv-104 4) + (logior! sv-96 8) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector121 quad) (-> sv-84 quad)) + (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) + (-> arg0 history-data (logand (+ (-> arg0 unknown-halfword00) 127) 127)) + (cond + (#f + (sound-play "cursor-options") + (logior! sv-104 8192) + (vector-reflect-flat-above! arg2 (-> sv-88 vector 0) sv-84) + ) + (else + (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) + ) + ) + (cond + ((not (and (>= (-> arg1 best-from-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) + ) + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) + (not (logtest? sv-104 32)) + ) + ) + ) + ) + (else + (logior! sv-104 256) + (logand! sv-104 -65) + (let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) + (vector-normalize! s3-4 1.0) + (vector-float*! arg2 s3-4 (vector-dot (-> sv-88 vector 0) s3-4)) + ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + ) + ) + (else + (logior! sv-96 1) + (set! (-> arg0 cur-pat mode) 0) + (if (= (-> arg1 best-from-prim prim-id) 6) + (set! (-> arg0 local-normal quad) (-> sv-84 quad)) + ) + (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) + (vector+! arg2 arg2 sv-84) + (set! (-> arg0 ground-touch-point w) 0.0) + (when (not (or (logtest? sv-104 15) (nonzero? (-> arg0 poly-pat event)))) + (logior! sv-96 2) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) + (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (set-time! (-> arg0 unknown-dword10)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector55 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (logior! sv-104 2048) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) + (logior! sv-96 1024) + ) + ) + ) + ) + ) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) ) + (update! + (-> arg0 history-data (-> arg0 unknown-halfword00)) + arg0 + (-> arg1 best-tri intersect) + (-> sv-88 vector 1) + arg2 + ) + (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) + (the-as cshape-moving-flags sv-96) ) ) - (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) - (update! - (-> arg0 history-data (-> arg0 unknown-halfword00)) - arg0 - (-> arg1 best-tri intersect) - (-> sv-88 vector 1) - arg2 - ) - (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) - (the-as cshape-moving-flags sv-96) ) ;; definition for function target-collision-no-reaction diff --git a/test/decompiler/reference/jak1/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak1/engine/target/logic-target_REF.gc index b73e901e2f..20e2b9755a 100644 --- a/test/decompiler/reference/jak1/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/logic-target_REF.gc @@ -263,49 +263,30 @@ ;; WARN: Stack slot load at 160 mismatch: defined as size 4, got size 16 ;; WARN: Stack slot load at 176 mismatch: defined as size 4, got size 16 (defun-debug target-print-stats ((arg0 target) (arg1 symbol)) - (local-vars - (sv-64 string) - (sv-80 string) - (sv-96 string) - (sv-112 string) - (sv-128 string) - (sv-144 string) - (sv-160 float) - (sv-176 float) - ) (when (and *display-ground-stats* arg0) - (let ((s4-0 format) - (s3-0 arg1) - (s2-0 "~0kpoly:~6X mode:~-8S material:~-10S event:~S~%") - (s1-0 (-> arg0 control poly-pat)) - (s0-0 (pat-mode->string (-> arg0 control poly-pat))) - ) - (set! sv-64 (pat-material->string (-> arg0 control poly-pat))) - (let ((t1-0 (pat-event->string (-> arg0 control poly-pat)))) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-64 t1-0) - ) + (format + arg1 + "~0kpoly:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control poly-pat) + (pat-mode->string (-> arg0 control poly-pat)) + (pat-material->string (-> arg0 control poly-pat)) + (pat-event->string (-> arg0 control poly-pat)) ) - (let ((s4-1 format) - (s3-1 arg1) - (s2-1 "~0kgrnd:~6X mode:~-8S material:~-10S event:~S~%") - (s1-1 (-> arg0 control ground-pat)) - (s0-1 (pat-mode->string (-> arg0 control ground-pat))) - ) - (set! sv-80 (pat-material->string (-> arg0 control ground-pat))) - (let ((t1-1 (pat-event->string (-> arg0 control ground-pat)))) - (s4-1 s3-1 s2-1 s1-1 s0-1 sv-80 t1-1) - ) + (format + arg1 + "~0kgrnd:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control ground-pat) + (pat-mode->string (-> arg0 control ground-pat)) + (pat-material->string (-> arg0 control ground-pat)) + (pat-event->string (-> arg0 control ground-pat)) ) - (let ((s4-2 format) - (s3-2 arg1) - (s2-2 "~0kwall:~6X mode:~-8S material:~-10S event:~S~%") - (s1-2 (-> arg0 control wall-pat)) - (s0-2 (pat-mode->string (-> arg0 control wall-pat))) - ) - (set! sv-96 (pat-material->string (-> arg0 control wall-pat))) - (let ((t1-2 (pat-event->string (-> arg0 control wall-pat)))) - (s4-2 s3-2 s2-2 s1-2 s0-2 sv-96 t1-2) - ) + (format + arg1 + "~0kwall:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control wall-pat) + (pat-mode->string (-> arg0 control wall-pat)) + (pat-material->string (-> arg0 control wall-pat)) + (pat-event->string (-> arg0 control wall-pat)) ) ) (when (and *stats-target* arg0) @@ -397,58 +378,46 @@ (let ((v1-74 (-> arg0 control trans))) (format arg1 "pos: ~6,,2m ~6,,2m ~6,,2m " (-> v1-74 x) (-> v1-74 y) (-> v1-74 z)) ) - (let ((s4-3 format) - (s3-3 arg1) - (s2-3 "~0kpol:~X/~S/~S/~S~%") - (s1-3 (-> arg0 control poly-pat)) - (s0-3 (pat-mode->string (-> arg0 control poly-pat))) - ) - (set! sv-112 (pat-material->string (-> arg0 control poly-pat))) - (let ((t1-7 (pat-event->string (-> arg0 control poly-pat)))) - (s4-3 s3-3 s2-3 s1-3 s0-3 sv-112 t1-7) - ) + (format + arg1 + "~0kpol:~X/~S/~S/~S~%" + (-> arg0 control poly-pat) + (pat-mode->string (-> arg0 control poly-pat)) + (pat-material->string (-> arg0 control poly-pat)) + (pat-event->string (-> arg0 control poly-pat)) ) - (let ((s4-4 format) - (s3-4 arg1) - (s2-4 "~0kcur:~X/~S/~S/~S ") - (s1-4 (-> arg0 control cur-pat)) - (s0-4 (pat-mode->string (-> arg0 control cur-pat))) - ) - (set! sv-128 (pat-material->string (-> arg0 control cur-pat))) - (let ((t1-8 (pat-event->string (-> arg0 control cur-pat)))) - (s4-4 s3-4 s2-4 s1-4 s0-4 sv-128 t1-8) - ) + (format + arg1 + "~0kcur:~X/~S/~S/~S " + (-> arg0 control cur-pat) + (pat-mode->string (-> arg0 control cur-pat)) + (pat-material->string (-> arg0 control cur-pat)) + (pat-event->string (-> arg0 control cur-pat)) ) - (let ((s4-5 format) - (s3-5 arg1) - (s2-5 "~0kgnd:~X/~S/~S/~S~%") - (s1-5 (-> arg0 control ground-pat)) - (s0-5 (pat-mode->string (-> arg0 control ground-pat))) - ) - (set! sv-144 (pat-material->string (-> arg0 control ground-pat))) - (let ((t1-9 (pat-event->string (-> arg0 control ground-pat)))) - (s4-5 s3-5 s2-5 s1-5 s0-5 sv-144 t1-9) - ) + (format + arg1 + "~0kgnd:~X/~S/~S/~S~%" + (-> arg0 control ground-pat) + (pat-mode->string (-> arg0 control ground-pat)) + (pat-material->string (-> arg0 control ground-pat)) + (pat-event->string (-> arg0 control ground-pat)) ) (let ((s4-6 format) (s3-6 arg1) (s2-6 "~0kvel: x:~M y:~M z:~M yv:~M xzv:~M~%") (s1-6 (-> arg0 control transv x)) (s0-6 (-> arg0 control transv y)) + (sv-160 (-> arg0 control transv z)) + (sv-176 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv))) + (a0-36 (new-stack-vector0)) ) - (set! sv-160 (-> arg0 control transv z)) - (set! sv-176 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv))) - (let ((a0-36 (new-stack-vector0))) - (let ((f0-17 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv)))) - 0.0 - (vector-! a0-36 (-> arg0 control transv) (vector-float*! a0-36 (-> arg0 control dynam gravity-normal) f0-17)) - ) - (let ((f0-18 (vector-length a0-36))) - f0-18 - (let ((t2-4 f0-18)) - (s4-6 s3-6 s2-6 s1-6 s0-6 sv-160 sv-176 t2-4) - ) - ) + (let ((f0-17 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv)))) + 0.0 + (vector-! a0-36 (-> arg0 control transv) (vector-float*! a0-36 (-> arg0 control dynam gravity-normal) f0-17)) + ) + (let ((f0-18 (vector-length a0-36))) + f0-18 + (s4-6 s3-6 s2-6 s1-6 s0-6 sv-160 sv-176 f0-18) ) ) (format @@ -703,7 +672,7 @@ ) (if (< 0.0 f30-1) (vector-xz-normalize! s5-0 (+ f0-11 (* f30-1 (-> self control unknown-surface01 slope-down-factor)))) - (vector-xz-normalize! s5-0 (- f0-11 (* f30-1 f30-1 (-> self control unknown-surface01 slope-up-factor)))) + (vector-xz-normalize! s5-0 (- f0-11 (* (square f30-1) (-> self control unknown-surface01 slope-up-factor)))) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc b/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc index 001febd9ab..23645cba1c 100644 --- a/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc @@ -398,31 +398,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs symbol. (defbehavior target-send-attack target ((arg0 process) (arg1 uint) (arg2 touching-shapes-entry) (arg3 int) (arg4 int)) - (local-vars - (sv-96 touching-prims-entry) - (sv-128 touching-prims-entry) - (sv-176 touching-prims-entry) - (sv-224 int) - (sv-240 symbol) - (sv-256 symbol) - (sv-272 symbol) - (sv-288 int) - (sv-304 symbol) - (sv-320 symbol) - (sv-336 symbol) - (sv-352 int) - (sv-368 symbol) - (sv-384 symbol) - (sv-400 symbol) - (sv-416 int) - (sv-432 symbol) - (sv-448 symbol) - (sv-464 symbol) - (sv-480 int) - (sv-496 symbol) - (sv-512 symbol) - (sv-528 symbol) - ) (let ((v1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> v1-0 from) self) (set! (-> v1-0 num-params) 4) @@ -436,43 +411,21 @@ (let ((v1-5 (-> self control unknown-symbol30))) (cond ((or (= v1-5 'spin) (= v1-5 'spin-air)) - (set! sv-96 (prims-touching? arg2 (-> self control) (the-as uint 64))) - (cond - (sv-96 - (let ((s4-0 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-0 - (let ((t9-3 (method-of-type part-tracker activate))) - (t9-3 (the-as part-tracker s4-0) self 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s3-0 run-function-in-process) - (s2-0 s4-0) - (s1-0 part-tracker-init) - (s0-0 group-spin-hit) - ) - (set! sv-224 -1) - (set! sv-240 (the-as symbol #f)) - (set! sv-256 (the-as symbol #f)) - (set! sv-272 (the-as symbol #f)) - (let ((t3-0 (get-intersect-point (new 'stack-no-clear 'vector) sv-96 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-224 - sv-240 - sv-256 - sv-272 - t3-0 - ) - ) - ) - (-> s4-0 ppointer) + (let ((sv-96 (prims-touching? arg2 (-> self control) (the-as uint 64)))) + (if sv-96 + (process-spawn + part-tracker + :init part-tracker-init + group-spin-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-96 (-> self control) arg2) + :to self ) + (effect-control-method-10 (-> self skel effect) 'group-spin-hit (the-as float -1.0) 74) ) - ) - (else - (effect-control-method-10 (-> self skel effect) 'group-spin-hit (the-as float -1.0) 74) - ) ) (effect-control-method-12 (-> self skel effect) @@ -485,75 +438,38 @@ (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2)) ) ((= v1-5 'punch) - (set! sv-128 (prims-touching? arg2 (-> self control) (the-as uint 64))) - (cond - (sv-128 - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-11 (method-of-type part-tracker activate))) - (t9-11 (the-as part-tracker s4-1) self 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s3-1 run-function-in-process) - (s2-1 s4-1) - (s1-1 part-tracker-init) - (s0-1 group-punch-hit) - ) - (set! sv-288 -1) - (set! sv-304 (the-as symbol #f)) - (set! sv-320 (the-as symbol #f)) - (set! sv-336 (the-as symbol #f)) - (let ((t3-1 (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-1) - s2-1 - s1-1 - s0-1 - sv-288 - sv-304 - sv-320 - sv-336 - t3-1 - ) - ) - ) - (-> s4-1 ppointer) + (let ((sv-128 (prims-touching? arg2 (-> self control) (the-as uint 64)))) + (cond + (sv-128 + (process-spawn + part-tracker + :init part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) + :to self ) ) - ) - ((let ((v0-14 (prims-touching? arg2 (-> self control) (the-as uint 32)))) - (set! sv-128 v0-14) - v0-14 - ) - (let ((s4-2 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-2 - (let ((t9-16 (method-of-type part-tracker activate))) - (t9-16 (the-as part-tracker s4-2) self 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s3-2 run-function-in-process) - (s2-2 s4-2) - (s1-2 part-tracker-init) - (s0-2 group-punch-hit) - ) - (set! sv-352 -1) - (set! sv-368 (the-as symbol #f)) - (set! sv-384 (the-as symbol #f)) - (set! sv-400 (the-as symbol #f)) - (let ((t3-2 (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-2) - s2-2 - s1-2 - s0-2 - sv-352 - sv-368 - sv-384 - sv-400 - t3-2 - ) - ) - ) - (-> s4-2 ppointer) + ((let ((v0-14 (prims-touching? arg2 (-> self control) (the-as uint 32)))) + (set! sv-128 v0-14) + v0-14 + ) + (process-spawn + part-tracker + :init part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) + :to self ) ) - ) + ) ) (effect-control-method-12 (-> self skel effect) @@ -577,75 +493,38 @@ (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) ) ((= v1-5 'uppercut) - (set! sv-176 (prims-touching? arg2 (-> self control) (the-as uint 64))) - (cond - (sv-176 - (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-3 - (let ((t9-25 (method-of-type part-tracker activate))) - (t9-25 (the-as part-tracker s4-3) self 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s3-3 run-function-in-process) - (s2-3 s4-3) - (s1-3 part-tracker-init) - (s0-3 group-punch-hit) - ) - (set! sv-416 -1) - (set! sv-432 (the-as symbol #f)) - (set! sv-448 (the-as symbol #f)) - (set! sv-464 (the-as symbol #f)) - (let ((t3-3 (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-3) - s2-3 - s1-3 - s0-3 - sv-416 - sv-432 - sv-448 - sv-464 - t3-3 - ) - ) - ) - (-> s4-3 ppointer) + (let ((sv-176 (prims-touching? arg2 (-> self control) (the-as uint 64)))) + (cond + (sv-176 + (process-spawn + part-tracker + :init part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) + :to self ) ) - ) - ((let ((v0-26 (prims-touching? arg2 (-> self control) (the-as uint 32)))) - (set! sv-176 v0-26) - v0-26 - ) - (let ((s4-4 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-4 - (let ((t9-30 (method-of-type part-tracker activate))) - (t9-30 (the-as part-tracker s4-4) self 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s3-4 run-function-in-process) - (s2-4 s4-4) - (s1-4 part-tracker-init) - (s0-4 group-punch-hit) - ) - (set! sv-480 -1) - (set! sv-496 (the-as symbol #f)) - (set! sv-512 (the-as symbol #f)) - (set! sv-528 (the-as symbol #f)) - (let ((t3-4 (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-4) - s2-4 - s1-4 - s0-4 - sv-480 - sv-496 - sv-512 - sv-528 - t3-4 - ) - ) - ) - (-> s4-4 ppointer) + ((let ((v0-26 (prims-touching? arg2 (-> self control) (the-as uint 32)))) + (set! sv-176 v0-26) + v0-26 + ) + (process-spawn + part-tracker + :init part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) + :to self ) ) - ) + ) ) (effect-control-method-10 (-> self skel effect) 'group-uppercut-hit (the-as float -1.0) 23) (effect-control-method-12 diff --git a/test/decompiler/reference/jak1/engine/target/target-part_REF.gc b/test/decompiler/reference/jak1/engine/target/target-part_REF.gc index 5d2ad363b9..876d8cab97 100644 --- a/test/decompiler/reference/jak1/engine/target/target-part_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/target-part_REF.gc @@ -87,14 +87,15 @@ ;; definition for function birth-func-target-orient ;; INFO: Return type mismatch int vs none. (defun birth-func-target-orient ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) - (local-vars (v1-10 float) (v1-11 float) (sv-16 target)) + (local-vars (v1-10 float) (v1-11 float)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) ) (init-vf0-vector) - (set! sv-16 *target*) - (let ((s3-0 (new 'stack-no-clear 'vector))) + (let ((sv-16 *target*) + (s3-0 (new 'stack-no-clear 'vector)) + ) (new 'stack-no-clear 'vector) (let ((s5-0 (new 'stack-no-clear 'quaternion))) (let ((s2-0 (-> sv-16 control local-normal))) diff --git a/test/decompiler/reference/jak1/engine/target/target2_REF.gc b/test/decompiler/reference/jak1/engine/target/target2_REF.gc index bd8f0da791..83a4ea2578 100644 --- a/test/decompiler/reference/jak1/engine/target/target2_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/target2_REF.gc @@ -509,7 +509,6 @@ ) ) :trans (behavior () - (local-vars (sv-48 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -545,8 +544,8 @@ (s2-0 s4-0) (s1-0 projectile-init-by-other) (s0-0 (-> self entity)) + (sv-48 s5-1) ) - (set! sv-48 s5-1) (let ((v0-3 (camera-pos))) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> v0-3 quad)) @@ -554,23 +553,18 @@ (.lvf vf5 (&-> s5-1 quad)) (.add.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-48 quad) vf6) - (let ((t1-0 (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) - 56 - 40 - ) - ) - (t2-0 #f) - ) - ((the-as (function object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-48 - gp-1 - t1-0 - t2-0 - ) - ) + ((the-as (function object object object object object object object none) s3-0) + s2-0 + s1-0 + s0-0 + sv-48 + gp-1 + (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) + 56 + 40 + ) + #f + ) ) (-> s4-0 ppointer) ) @@ -660,7 +654,6 @@ (target-exit) ) :trans (behavior () - (local-vars (sv-48 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -696,8 +689,8 @@ (s2-0 s4-0) (s1-0 projectile-init-by-other) (s0-0 (-> self entity)) + (sv-48 s5-1) ) - (set! sv-48 s5-1) (let ((v0-4 (camera-pos))) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> v0-4 quad)) @@ -705,23 +698,18 @@ (.lvf vf5 (&-> s5-1 quad)) (.add.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-48 quad) vf6) - (let ((t1-0 (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) - 120 - 104 - ) - ) - (t2-0 #f) - ) - ((the-as (function object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-48 - gp-1 - t1-0 - t2-0 - ) - ) + ((the-as (function object object object object object object object none) s3-0) + s2-0 + s1-0 + s0-0 + sv-48 + gp-1 + (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) + 120 + 104 + ) + #f + ) ) (-> s4-0 ppointer) ) @@ -2563,61 +2551,63 @@ process (lambda :behavior process ((arg0 vector) (arg1 time-frame) (arg2 float)) - (local-vars (sv-32 time-frame) (sv-40 vector) (sv-44 symbol)) - (set! sv-32 (current-time)) - (let ((v1-2 (new-stack-vector0))) + (let ((sv-32 (current-time)) + (v1-2 (new-stack-vector0)) + ) (set! (-> v1-2 quad) (-> arg0 quad)) - (set! sv-40 v1-2) - ) - (set! sv-44 #t) - (until (time-elapsed? sv-32 arg1) - (let ((s4-0 (ppointer->process (-> self parent)))) - (cond - ((and sv-44 - (< (- (-> (the-as target s4-0) control trans y) (-> (the-as target s4-0) control unknown-vector52 y)) arg2) - ) - (vector-xz-normalize! (-> (the-as target s4-0) control transv) (the-as float 0.0)) - (case (-> (the-as target s4-0) current-level name) - (('jungleb) - (let ((v1-16 (vector-! (new-stack-vector0) (-> (the-as target s4-0) control trans) sv-40))) - (set! (-> (the-as target s4-0) control trans x) (+ (-> sv-40 x) (fmax -4096.0 (fmin 4096.0 (-> v1-16 x))))) - (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -4096.0 (fmin 4096.0 (-> v1-16 z))))) - ) - ) - ) - ) - (else - (if sv-44 - (set! sv-32 (current-time)) - ) - (set! sv-44 (the-as symbol #f)) - (when (or (= (-> (the-as target s4-0) next-state name) 'target-duck-high-jump-jump) - (= (-> (the-as target s4-0) next-state name) 'target-falling) - ) - (let ((v1-30 (-> (the-as target s4-0) control trans)) - (s3-0 (-> (the-as target s4-0) control transv)) + (let ((sv-40 v1-2) + (sv-44 #t) + ) + (until (time-elapsed? sv-32 arg1) + (let ((s4-0 (ppointer->process (-> self parent)))) + (cond + ((and sv-44 + (< (- (-> (the-as target s4-0) control trans y) (-> (the-as target s4-0) control unknown-vector52 y)) arg2) ) - (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-30 x))) - (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-30 z))) - (let ((f30-0 (vector-xz-length s3-0))) - (if (< 122880.0 f30-0) - (vector-xz-normalize! s3-0 (the-as float 122880.0)) - ) - (if (< 4096.0 f30-0) - (forward-up-nopitch->quaternion - (-> (the-as target s4-0) control dir-targ) - (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 (the-as float 1.0)) - (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target s4-0) control quat)) + (vector-xz-normalize! (-> (the-as target s4-0) control transv) (the-as float 0.0)) + (case (-> (the-as target s4-0) current-level name) + (('jungleb) + (let ((v1-16 (vector-! (new-stack-vector0) (-> (the-as target s4-0) control trans) sv-40))) + (set! (-> (the-as target s4-0) control trans x) (+ (-> sv-40 x) (fmax -4096.0 (fmin 4096.0 (-> v1-16 x))))) + (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -4096.0 (fmin 4096.0 (-> v1-16 z))))) + ) + ) + ) + ) + (else + (if sv-44 + (set! sv-32 (current-time)) + ) + (set! sv-44 (the-as symbol #f)) + (when (or (= (-> (the-as target s4-0) next-state name) 'target-duck-high-jump-jump) + (= (-> (the-as target s4-0) next-state name) 'target-falling) + ) + (let ((v1-30 (-> (the-as target s4-0) control trans)) + (s3-0 (-> (the-as target s4-0) control transv)) ) + (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-30 x))) + (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-30 z))) + (let ((f30-0 (vector-xz-length s3-0))) + (if (< 122880.0 f30-0) + (vector-xz-normalize! s3-0 (the-as float 122880.0)) + ) + (if (< 4096.0 f30-0) + (forward-up-nopitch->quaternion + (-> (the-as target s4-0) control dir-targ) + (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 (the-as float 1.0)) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target s4-0) control quat)) + ) + ) ) + ) ) ) ) ) + (suspend) + 0 ) ) - (suspend) - 0 ) #f ) diff --git a/test/decompiler/reference/jak1/engine/ui/progress/progress-draw_REF.gc b/test/decompiler/reference/jak1/engine/ui/progress/progress-draw_REF.gc index b19b2c8b02..fd679d5336 100644 --- a/test/decompiler/reference/jak1/engine/ui/progress/progress-draw_REF.gc +++ b/test/decompiler/reference/jak1/engine/ui/progress/progress-draw_REF.gc @@ -13,16 +13,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod draw-fuel-cell-screen ((this progress) (arg0 int)) - (local-vars - (sv-112 int) - (sv-128 int) - (sv-144 int) - (sv-160 (function trsqv float quaternion)) - (sv-176 trsqv) - (sv-192 int) - (sv-208 int) - (sv-224 (function string float font-context int none)) - ) (hide-progress-icons) (let ((s5-0 (-> *level-task-data* arg0))) (if (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3)) @@ -32,141 +22,144 @@ (set! (-> *progress-process* 0 particles 15 init-pos x) -320.0) (set! (-> *progress-process* 0 icons 4 icon-x) -320) (when (and (!= s5-0 #f) (= (-> *game-info* level-opened arg0) 1)) - (set! sv-112 (- (-> *task-egg-starting-x* (-> s5-0 nb-of-tasks)) (-> this left-x-offset))) - (set! sv-128 (the int (* 47.0 (-> this transition-percentage-invert)))) - 0 - (let ((s0-0 6) - (s2-0 0) - (s4-1 (if (= (-> this level-transition) 1) - (- (-> this transition-offset)) - (-> this transition-offset) - ) - ) - (f30-0 (-> this transition-percentage-invert)) - (s1-0 0) - (s3-0 #f) + (let ((sv-112 (- (-> *task-egg-starting-x* (-> s5-0 nb-of-tasks)) (-> this left-x-offset))) + (sv-128 (the int (* 47.0 (-> this transition-percentage-invert)))) ) - (when (-> this stat-transition) - (set! sv-128 47) - (set! s2-0 (if (!= (-> this display-state) (-> this next-display-state)) - (- (-> this transition-offset)) - (-> this transition-offset) - ) - ) - (set! s4-1 0) - (set! f30-0 1.0) - ) - (set! sv-144 0) - (while (< sv-144 4) - (let ((a0-18 (-> this icons sv-144 icon 0 root))) - (set! sv-176 a0-18) - (set! sv-160 (method-of-object sv-176 set-yaw-angle-clear-roll-pitch!)) - (let ((a1-2 (+ (y-angle a0-18) (* 182.04445 (/ (-> *display* time-adjust-ratio) 2))))) - (sv-160 sv-176 a1-2) - ) - ) - (set! sv-144 (+ sv-144 1)) - ) - (set! sv-192 (+ sv-112 (/ (- (* 47 (-> s5-0 nb-of-tasks)) (* sv-128 (-> s5-0 nb-of-tasks))) 2))) - (set! sv-208 0) - (while (< sv-208 (-> s5-0 nb-of-tasks)) - (let ((v0-4 (get-task-status (-> s5-0 task-info sv-208 task-id))) - (v1-59 -1) - (a0-25 #f) - ) - (set! (-> this particle-state s0-0) 2) - (cond - ((or (= v0-4 (task-status need-hint)) (= v0-4 (task-status unknown))) - (if (= *kernel-boot-message* 'play) - (set! (-> this particle-state s0-0) 1) - ) - ) - ((= v0-4 (task-status invalid)) - (set! v1-59 (-> s5-0 task-info sv-208 text-index-when-resolved)) - (set! (-> this particle-state s0-0) 3) - (set! a0-25 #t) - ) - ((= v0-4 (task-status need-introduction)) - (set! v1-59 0) - ) - ((= v0-4 (task-status need-reminder-a)) - (set! v1-59 0) - ) - ((= v0-4 (task-status need-reminder)) - (set! v1-59 1) - ) - ((= v0-4 (task-status need-reward-speech)) - (set! v1-59 2) - ) - ((= v0-4 (task-status need-resolution)) - (set! v1-59 2) - ) - ) - (if (and (!= *kernel-boot-message* 'play) (= v1-59 -1)) - (set! v1-59 0) - ) - (set! (-> this particles s0-0 init-pos x) (the float (+ sv-192 s2-0))) - (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 204))) - (+! s0-0 1) - (when (= sv-208 (-> this task-index)) - (set! s1-0 v1-59) - (set! s3-0 a0-25) - (set! (-> this particles 5 init-pos x) (the float (+ sv-192 s2-0))) - (set! (-> this particles 5 init-pos y) (the float (+ s4-1 204))) - ) - ) - (set! sv-192 (+ sv-192 sv-128)) - (set! sv-208 (+ sv-208 1)) - ) - (dotimes (v1-77 (- 8 (-> s5-0 nb-of-tasks))) - (set! (-> *progress-process* 0 particles s0-0 init-pos x) (the float (+ s2-0 -320))) - (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 194))) - (+! s0-0 1) - ) - (when *common-text* - (when (and (!= s1-0 -1) - (> (-> s5-0 nb-of-tasks) 0) - (>= (-> this task-index) 0) - (< (-> this task-index) (-> s5-0 nb-of-tasks)) - ) - (let ((s0-1 (new - 'stack - 'font-context - *font-default-matrix* - (- (+ s2-0 32) (-> this left-x-offset)) - (+ (/ s4-1 2) 125) - 8325000.0 - (font-color progress-yellow) - (font-flags shadow kerning) - ) + 0 + (let ((s0-0 6) + (s2-0 0) + (s4-1 (if (= (-> this level-transition) 1) + (- (-> this transition-offset)) + (-> this transition-offset) ) - ) - (set-width! s0-1 328) - (set-height! s0-1 50) - (set-scale! s0-1 0.7) - (set! (-> s0-1 flags) (font-flags shadow kerning middle middle-vert large)) - (set! sv-224 print-game-text-scaled) - (let ((a0-47 (lookup-text! *common-text* (-> s5-0 task-info (-> this task-index) task-name s1-0) #f)) - (a1-57 f30-0) - (a2-15 s0-1) - (a3-2 (the int (* 128.0 f30-0))) ) - (sv-224 a0-47 a1-57 a2-15 a3-2) - ) - (when s3-0 - (set! (-> s0-1 origin x) (the float (- (+ s2-0 32) (-> this left-x-offset)))) - (set! (-> s0-1 origin y) (the float (+ (/ s4-1 2) 175))) - (let ((a0-49 s0-1)) - (set! (-> a0-49 color) (font-color progress-blue)) + (f30-0 (-> this transition-percentage-invert)) + (s1-0 0) + (s3-0 #f) + ) + (when (-> this stat-transition) + (set! sv-128 47) + (set! s2-0 (if (!= (-> this display-state) (-> this next-display-state)) + (- (-> this transition-offset)) + (-> this transition-offset) + ) ) - (set-height! s0-1 15) - (set-scale! s0-1 0.5) + (set! s4-1 0) + (set! f30-0 1.0) + ) + (let ((sv-144 0)) + (while (< sv-144 4) + (let ((a0-18 (-> this icons sv-144 icon 0 root))) + (set-yaw-angle-clear-roll-pitch! + a0-18 + (+ (y-angle a0-18) (* 182.04445 (/ (-> *display* time-adjust-ratio) 2))) + ) + ) + (+! sv-144 1) + ) + ) + (let ((sv-192 (+ sv-112 (/ (- (* 47 (-> s5-0 nb-of-tasks)) (* sv-128 (-> s5-0 nb-of-tasks))) 2))) + (sv-208 0) + ) + (while (< sv-208 (-> s5-0 nb-of-tasks)) + (let ((v0-4 (get-task-status (-> s5-0 task-info sv-208 task-id))) + (v1-59 -1) + (a0-25 #f) + ) + (set! (-> this particle-state s0-0) 2) + (cond + ((or (= v0-4 (task-status need-hint)) (= v0-4 (task-status unknown))) + (if (= *kernel-boot-message* 'play) + (set! (-> this particle-state s0-0) 1) + ) + ) + ((= v0-4 (task-status invalid)) + (set! v1-59 (-> s5-0 task-info sv-208 text-index-when-resolved)) + (set! (-> this particle-state s0-0) 3) + (set! a0-25 #t) + ) + ((= v0-4 (task-status need-introduction)) + (set! v1-59 0) + ) + ((= v0-4 (task-status need-reminder-a)) + (set! v1-59 0) + ) + ((= v0-4 (task-status need-reminder)) + (set! v1-59 1) + ) + ((= v0-4 (task-status need-reward-speech)) + (set! v1-59 2) + ) + ((= v0-4 (task-status need-resolution)) + (set! v1-59 2) + ) + ) + (if (and (!= *kernel-boot-message* 'play) (= v1-59 -1)) + (set! v1-59 0) + ) + (set! (-> this particles s0-0 init-pos x) (the float (+ sv-192 s2-0))) + (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 204))) + (+! s0-0 1) + (when (= sv-208 (-> this task-index)) + (set! s1-0 v1-59) + (set! s3-0 a0-25) + (set! (-> this particles 5 init-pos x) (the float (+ sv-192 s2-0))) + (set! (-> this particles 5 init-pos y) (the float (+ s4-1 204))) + ) + ) + (+! sv-192 sv-128) + (+! sv-208 1) + ) + ) + (dotimes (v1-77 (- 8 (-> s5-0 nb-of-tasks))) + (set! (-> *progress-process* 0 particles s0-0 init-pos x) (the float (+ s2-0 -320))) + (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 194))) + (+! s0-0 1) + ) + (when *common-text* + (when (and (!= s1-0 -1) + (> (-> s5-0 nb-of-tasks) 0) + (>= (-> this task-index) 0) + (< (-> this task-index) (-> s5-0 nb-of-tasks)) + ) + (let ((s0-1 + (new + 'stack + 'font-context + *font-default-matrix* + (- (+ s2-0 32) (-> this left-x-offset)) + (+ (/ s4-1 2) 125) + 8325000.0 + (font-color progress-yellow) + (font-flags shadow kerning) + ) + ) + ) + (set-width! s0-1 328) + (set-height! s0-1 50) + (set-scale! s0-1 0.7) + (set! (-> s0-1 flags) (font-flags shadow kerning middle middle-vert large)) (print-game-text-scaled - (lookup-text! *common-text* (text-id task-completed) #f) + (lookup-text! *common-text* (-> s5-0 task-info (-> this task-index) task-name s1-0) #f) f30-0 s0-1 (the int (* 128.0 f30-0)) ) + (when s3-0 + (set! (-> s0-1 origin x) (the float (- (+ s2-0 32) (-> this left-x-offset)))) + (set! (-> s0-1 origin y) (the float (+ (/ s4-1 2) 175))) + (let ((a0-49 s0-1)) + (set! (-> a0-49 color) (font-color progress-blue)) + ) + (set-height! s0-1 15) + (set-scale! s0-1 0.5) + (print-game-text-scaled + (lookup-text! *common-text* (text-id task-completed) #f) + f30-0 + s0-1 + (the int (* 128.0 f30-0)) + ) + ) ) ) ) @@ -545,17 +538,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod draw-memcard-file-select ((this progress) (arg0 font-context)) - (local-vars - (sv-16 (function _varargs_ object)) - (sv-32 (function _varargs_ object)) - (sv-48 (function _varargs_ object)) - (sv-64 (function _varargs_ object)) - (sv-80 (function _varargs_ object)) - (sv-96 (function _varargs_ object)) - (sv-112 (function _varargs_ object)) - (sv-128 (function _varargs_ object)) - (sv-144 (function _varargs_ object)) - ) (let ((s4-0 (* (+ (-> this transition-offset) -256) 2))) (if (< s4-0 0) (set! s4-0 0) @@ -652,35 +634,17 @@ (set! (-> arg0 origin x) (the float (- -73 (-> this left-x-offset)))) (set-width! arg0 350) (let ((s0-2 print-game-text)) - (set! sv-16 format) - (let ((a0-40 (clear *temp-string*)) - (a1-13 "~D") - (a2-5 (the int (-> s3-3 file s1-0 fuel-cell-count))) - ) - (sv-16 a0-40 a1-13 a2-5) - ) + (format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 fuel-cell-count))) (s0-2 *temp-string* arg0 #f s4-1 22) ) (set! (-> arg0 origin x) (the float (- 1 (-> this left-x-offset)))) (let ((s0-3 print-game-text)) - (set! sv-32 format) - (let ((a0-44 (clear *temp-string*)) - (a1-15 "~D") - (a2-7 (the int (-> s3-3 file s1-0 money-count))) - ) - (sv-32 a0-44 a1-15 a2-7) - ) + (format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 money-count))) (s0-3 *temp-string* arg0 #f s4-1 22) ) (set! (-> arg0 origin x) (the float (- 79 (-> this left-x-offset)))) (let ((s0-4 print-game-text)) - (set! sv-48 format) - (let ((a0-48 (clear *temp-string*)) - (a1-17 "~D") - (a2-9 (the int (-> s3-3 file s1-0 buzzer-count))) - ) - (sv-48 a0-48 a1-17 a2-9) - ) + (format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 buzzer-count))) (s0-4 *temp-string* arg0 #f s4-1 22) ) (+! (-> arg0 origin y) 1.0) @@ -688,13 +652,7 @@ (set! (-> arg0 flags) (font-flags shadow kerning right large)) (set! (-> arg0 origin x) (the float (- 352 (-> this left-x-offset)))) (let ((s0-5 print-game-text)) - (set! sv-64 format) - (let ((a0-52 (clear *temp-string*)) - (a1-19 "~D%") - (a2-11 (the int (-> s3-3 file s1-0 completion-percentage))) - ) - (sv-64 a0-52 a1-19 a2-11) - ) + (format (clear *temp-string*) "~D%" (the int (-> s3-3 file s1-0 completion-percentage))) (s0-5 *temp-string* arg0 #f s4-1 22) ) (set-scale! arg0 0.5) @@ -702,39 +660,23 @@ (set! (-> arg0 flags) (font-flags shadow kerning large)) (set! (-> arg0 origin x) (the float (- 85 (-> this left-x-offset)))) (let ((s0-6 print-game-text)) - (set! sv-80 format) - (let ((a0-56 (clear *temp-string*)) - (a1-21 "/~D") - (a2-17 (if (< 100 (the int (-> s3-3 file s1-0 fuel-cell-count))) - (-> this total-nb-of-power-cells) - 100 - ) - ) - ) - (sv-80 a0-56 a1-21 a2-17) + (let ((sv-80 format)) + (sv-80 (clear *temp-string*) "/~D" (if (< 100 (the int (-> s3-3 file s1-0 fuel-cell-count))) + (-> this total-nb-of-power-cells) + 100 + ) + ) ) (s0-6 *temp-string* arg0 #f s4-1 22) ) (set! (-> arg0 origin x) (the float (- 150 (-> this left-x-offset)))) (let ((s0-7 print-game-text)) - (set! sv-96 format) - (let ((a0-60 (clear *temp-string*)) - (a1-23 "/~D") - (a2-19 (-> this total-nb-of-orbs)) - ) - (sv-96 a0-60 a1-23 a2-19) - ) + (format (clear *temp-string*) "/~D" (-> this total-nb-of-orbs)) (s0-7 *temp-string* arg0 #f s4-1 22) ) (set! (-> arg0 origin x) (the float (- 238 (-> this left-x-offset)))) (let ((s0-8 print-game-text)) - (set! sv-112 format) - (let ((a0-64 (clear *temp-string*)) - (a1-25 "/~D") - (a2-21 (-> this total-nb-of-buzzers)) - ) - (sv-112 a0-64 a1-25 a2-21) - ) + (format (clear *temp-string*) "/~D" (-> this total-nb-of-buzzers)) (s0-8 *temp-string* arg0 #f s4-1 22) ) (+! (-> arg0 origin y) 15.0) @@ -748,32 +690,28 @@ (cond ((= (scf-get-territory) 1) (let ((s0-10 print-game-text)) - (set! sv-128 format) - (let ((a0-69 (clear *temp-string*)) - (a1-27 "~X/~X/20~2X ~2X:~2X") - (a2-23 (-> s3-3 file s1-0 day)) - (a3-10 (-> s3-3 file s1-0 month)) - (t0-10 (-> s3-3 file s1-0 year)) - (t1-0 (-> s3-3 file s1-0 hour)) - (t2-0 (-> s3-3 file s1-0 minute)) - ) - (sv-128 a0-69 a1-27 a2-23 a3-10 t0-10 t1-0 t2-0) + (format + (clear *temp-string*) + "~X/~X/20~2X ~2X:~2X" + (-> s3-3 file s1-0 day) + (-> s3-3 file s1-0 month) + (-> s3-3 file s1-0 year) + (-> s3-3 file s1-0 hour) + (-> s3-3 file s1-0 minute) ) (s0-10 *temp-string* arg0 #f s4-1 22) ) ) (else (let ((s0-11 print-game-text)) - (set! sv-144 format) - (let ((a0-72 (clear *temp-string*)) - (a1-29 "~X/~X/20~2X ~2X:~2X") - (a2-25 (-> s3-3 file s1-0 month)) - (a3-12 (-> s3-3 file s1-0 day)) - (t0-12 (-> s3-3 file s1-0 year)) - (t1-1 (-> s3-3 file s1-0 hour)) - (t2-1 (-> s3-3 file s1-0 minute)) - ) - (sv-144 a0-72 a1-29 a2-25 a3-12 t0-12 t1-1 t2-1) + (format + (clear *temp-string*) + "~X/~X/20~2X ~2X:~2X" + (-> s3-3 file s1-0 month) + (-> s3-3 file s1-0 day) + (-> s3-3 file s1-0 year) + (-> s3-3 file s1-0 hour) + (-> s3-3 file s1-0 minute) ) (s0-11 *temp-string* arg0 #f s4-1 22) ) @@ -1308,59 +1246,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod draw-options ((this progress) (arg0 int) (arg1 int) (arg2 float)) - (local-vars - (sv-112 font-context) - (sv-128 int) - (sv-144 int) - (sv-160 (function _varargs_ object)) - (sv-176 string) - (sv-192 string) - (sv-208 string) - (sv-224 (function _varargs_ object)) - (sv-240 string) - (sv-256 string) - (sv-272 string) - (sv-288 (function string font-context symbol int int float)) - (sv-304 (function _varargs_ object)) - (sv-320 (function _varargs_ object)) - (sv-336 string) - (sv-352 string) - (sv-368 string) - (sv-384 (function _varargs_ object)) - (sv-400 string) - (sv-416 string) - (sv-432 string) - (sv-448 uint) - (sv-464 int) - (sv-480 int) - (sv-496 int) - (sv-512 int) - (sv-528 (function _varargs_ object)) - (sv-544 string) - (sv-560 string) - (sv-576 string) - (sv-592 (function _varargs_ object)) - (sv-608 string) - (sv-624 string) - (sv-640 string) - (sv-656 (function _varargs_ object)) - (sv-672 string) - (sv-688 string) - (sv-704 string) - (sv-720 (function _varargs_ object)) - (sv-736 string) - (sv-752 string) - (sv-768 string) - (sv-784 (function _varargs_ object)) - (sv-800 string) - (sv-816 string) - (sv-832 string) - (sv-848 (function _varargs_ object)) - (sv-864 string) - (sv-880 string) - (sv-896 string) - (sv-912 string) - ) + (local-vars (sv-464 int)) (let ((s3-0 (-> *options-remap* (-> this display-state)))) (when s3-0 (let ((s2-1 (- arg0 (/ (* arg1 (length s3-0)) 2))) @@ -1368,359 +1254,323 @@ ) 27 0 - (set! sv-112 - (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) + (let ((sv-112 + (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) + ) ) - (set-width! sv-112 350) - (set-height! sv-112 25) - (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) - (dotimes (s0-0 (length s3-0)) - (set! sv-912 (the-as string #f)) - (set! sv-128 27) - (set! sv-144 s2-1) - (let ((v1-18 (-> s3-0 s0-0 option-type))) - (cond - ((= v1-18 (game-option-type yes-no)) - (cond - ((-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) - (set! sv-160 format) - (set! sv-176 (clear *temp-string*)) - (set! sv-192 "~30L~S~0L ~S") - (set! sv-208 (lookup-text! *common-text* (text-id yes) #f)) - (let ((a3-2 (lookup-text! *common-text* (text-id no) #f))) - (sv-160 sv-176 sv-192 sv-208 a3-2) - ) - (set! sv-912 *temp-string*) - sv-912 + (set-width! sv-112 350) + (set-height! sv-112 25) + (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) + (dotimes (s0-0 (length s3-0)) + (let ((sv-912 (the-as string #f)) + (sv-128 27) + (sv-144 s2-1) ) - (else - (set! sv-224 format) - (set! sv-240 (clear *temp-string*)) - (set! sv-256 "~0L~S ~30L~S~1L") - (set! sv-272 (lookup-text! *common-text* (text-id yes) #f)) - (let ((a3-3 (lookup-text! *common-text* (text-id no) #f))) - (sv-224 sv-240 sv-256 sv-272 a3-3) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - ) - ) - ((or (= v1-18 (game-option-type menu)) (= v1-18 (game-option-type button))) - (cond - ((nonzero? (-> s3-0 s0-0 name)) - (set! sv-912 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) - sv-912 - ) - (else - (set! sv-912 (the-as string #f)) - (the-as symbol sv-912) - ) - ) - ) - ((and (-> this selected-option) (= (-> this option-index) s0-0)) - (let ((a0-19 sv-112)) - (set! (-> a0-19 color) (font-color default)) - ) - (set! (-> sv-112 origin x) (the float (- sv-128 (-> this left-x-offset)))) - (case (-> s3-0 s0-0 option-type) - (((game-option-type center-screen)) - (set! (-> sv-112 origin y) (the float (+ s2-1 -20))) - ) - (else - (set! (-> sv-112 origin y) (the float (+ s2-1 -8))) - ) - ) - (set-scale! sv-112 0.6) - (set! sv-288 print-game-text) - (let ((a0-23 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) - (a1-11 sv-112) - (a2-10 #f) - (a3-4 128) - (t0-1 22) - ) - (sv-288 a0-23 a1-11 a2-10 a3-4 t0-1) - ) - (case (-> s3-0 s0-0 option-type) - (((game-option-type center-screen)) - (set! sv-144 (+ s2-1 3)) - sv-144 - ) - (else - (set! sv-144 (+ s2-1 7)) - sv-144 - ) - ) - (case (-> s3-0 s0-0 option-type) - (((game-option-type slider)) - (let* ((v1-82 (the-as uint #x8000ffff)) - (f0-12 (/ (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))) 100)) - (a0-34 (logior (logand v1-82 -256) (shr (shl (the int (+ 64.0 (* 191.0 f0-12))) 56) 56))) - (a3-5 (logior (logand a0-34 -65281) (shr (shl (shr (shl a0-34 56) 56) 56) 48))) - ) - (draw-percent-bar (- 75 (-> this left-x-offset)) (+ s2-1 8) f0-12 (the-as rgba a3-5)) - ) - (set! sv-304 format) - (let ((a0-42 (clear *temp-string*)) - (a1-13 "~D") - (a2-12 (the int (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) - ) - (sv-304 a0-42 a1-13 a2-12) - ) - (set! sv-912 *temp-string*) - (set! sv-128 (+ (the int (* 2.5 (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) -100)) - sv-128 - ) - (((game-option-type on-off)) - (cond - ((-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) - (set! sv-320 format) - (set! sv-336 (clear *temp-string*)) - (set! sv-352 "~30L~S~0L ~S") - (set! sv-368 (lookup-text! *common-text* (text-id on) #f)) - (let ((a3-6 (lookup-text! *common-text* (text-id off) #f))) - (sv-320 sv-336 sv-352 sv-368 a3-6) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - (else - (set! sv-384 format) - (set! sv-400 (clear *temp-string*)) - (set! sv-416 "~0L~S ~30L~S~1L") - (set! sv-432 (lookup-text! *common-text* (text-id on) #f)) - (let ((a3-7 (lookup-text! *common-text* (text-id off) #f))) - (sv-384 sv-400 sv-416 sv-432 a3-7) + (let ((v1-18 (-> s3-0 s0-0 option-type))) + (cond + ((= v1-18 (game-option-type yes-no)) + (cond + ((-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) + (format + (clear *temp-string*) + "~30L~S~0L ~S" + (lookup-text! *common-text* (text-id yes) #f) + (lookup-text! *common-text* (text-id no) #f) ) (set! sv-912 *temp-string*) sv-912 ) - ) - ) - (((game-option-type language)) - (set! sv-512 (the-as int (-> this language-selection))) - (set! sv-448 (-> (the-as (pointer uint64) (-> s3-0 s0-0 value-to-modify)))) - (if (and (zero? (scf-get-territory)) - (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2))) - ) - (set! sv-464 5) - (set! sv-464 6) - ) - (if (-> this language-transition) - (seekl! (-> this language-x-offset) 200 (the int (* 10.0 (-> *display* time-adjust-ratio)))) - ) - (when (>= (-> this language-x-offset) 100) - (set! (-> this language-selection) (the-as language-enum sv-448)) - (set! sv-512 (the-as int sv-448)) - (set! (-> this language-transition) #f) - (set! (-> this language-x-offset) 0) - 0 - ) - (set! (-> sv-112 origin y) (the float (+ s2-1 3))) - (let ((a0-62 sv-112)) - (set! (-> a0-62 color) (font-color progress-blue)) - ) - 0 - (set! sv-480 (mod (+ sv-512 1) sv-464)) - (let ((a0-66 (mod (+ sv-464 -1 sv-512) sv-464)) - (v1-153 (mod (+ sv-512 2) sv-464)) - ) - (set! sv-496 (mod (+ sv-464 -2 sv-512) sv-464)) - (cond - ((-> this language-direction) - (let ((a2-22 (- 200 (+ (-> this language-x-offset) 100)))) - (print-language-name a0-66 sv-112 a2-22 #f) + (else + (format + (clear *temp-string*) + "~0L~S ~30L~S~1L" + (lookup-text! *common-text* (text-id yes) #f) + (lookup-text! *common-text* (text-id no) #f) ) - (let ((a2-23 (+ (-> this language-x-offset) 100))) - (cond - ((< a2-23 150) - (let ((t9-27 print-language-name) - (a1-30 sv-112) - (a3-9 #t) - ) - (t9-27 sv-480 a1-30 a2-23 a3-9) - ) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) + ((or (= v1-18 (game-option-type menu)) (= v1-18 (game-option-type button))) + (cond + ((nonzero? (-> s3-0 s0-0 name)) + (set! sv-912 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) + sv-912 + ) + (else + (set! sv-912 (the-as string #f)) + (the-as symbol (the-as symbol sv-912)) + ) + ) + ) + ((and (-> this selected-option) (= (-> this option-index) s0-0)) + (let ((a0-19 sv-112)) + (set! (-> a0-19 color) (font-color default)) + ) + (set! (-> sv-112 origin x) (the float (- sv-128 (-> this left-x-offset)))) + (case (-> s3-0 s0-0 option-type) + (((game-option-type center-screen)) + (set! (-> sv-112 origin y) (the float (+ s2-1 -20))) + ) + (else + (set! (-> sv-112 origin y) (the float (+ s2-1 -8))) + ) + ) + (set-scale! sv-112 0.6) + (print-game-text (lookup-text! *common-text* (-> s3-0 s0-0 name) #f) sv-112 #f 128 22) + (case (-> s3-0 s0-0 option-type) + (((game-option-type center-screen)) + (set! sv-144 (+ s2-1 3)) + sv-144 + ) + (else + (set! sv-144 (+ s2-1 7)) + sv-144 + ) + ) + (case (-> s3-0 s0-0 option-type) + (((game-option-type slider)) + (let* ((v1-82 (the-as uint #x8000ffff)) + (f0-12 (/ (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))) 100)) + (a0-34 (logior (logand v1-82 -256) (shr (shl (the int (+ 64.0 (* 191.0 f0-12))) 56) 56))) + (a3-5 (logior (logand a0-34 -65281) (shr (shl (shr (shl a0-34 56) 56) 56) 48))) + ) + (draw-percent-bar (- 75 (-> this left-x-offset)) (+ s2-1 8) f0-12 (the-as rgba a3-5)) + ) + (format (clear *temp-string*) "~D" (the int (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) + (set! sv-912 *temp-string*) + (set! sv-128 (+ (the int (* 2.5 (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) -100)) + sv-128 + ) + (((game-option-type on-off)) + (cond + ((-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) + (format + (clear *temp-string*) + "~30L~S~0L ~S" + (lookup-text! *common-text* (text-id on) #f) + (lookup-text! *common-text* (text-id off) #f) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + (else + (format + (clear *temp-string*) + "~0L~S ~30L~S~1L" + (lookup-text! *common-text* (text-id on) #f) + (lookup-text! *common-text* (text-id off) #f) ) - (else - (let ((a2-24 (- 200 (-> this language-x-offset))) - (t9-28 print-language-name) - (a1-31 sv-112) - (a3-10 #f) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) + (((game-option-type language)) + (let ((sv-512 (the-as int (-> this language-selection)))) + (let ((sv-448 (-> (the-as (pointer uint64) (-> s3-0 s0-0 value-to-modify))))) + (set! sv-464 (cond + ((and (zero? (scf-get-territory)) + (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2))) + ) + (set! sv-464 5) + sv-464 + ) + (else + 6 + ) + ) + ) + (if (-> this language-transition) + (seekl! (-> this language-x-offset) 200 (the int (* 10.0 (-> *display* time-adjust-ratio)))) + ) + (when (>= (-> this language-x-offset) 100) + (set! (-> this language-selection) (the-as language-enum sv-448)) + (set! sv-512 (the-as int sv-448)) + (set! (-> this language-transition) #f) + (set! (-> this language-x-offset) 0) + 0 + ) + ) + (set! (-> sv-112 origin y) (the float (+ s2-1 3))) + (let ((a0-62 sv-112)) + (set! (-> a0-62 color) (font-color progress-blue)) + ) + 0 + (let ((sv-480 (mod (+ sv-512 1) sv-464)) + (a0-66 (mod (+ sv-464 -1 sv-512) sv-464)) + (v1-153 (mod (+ sv-512 2) sv-464)) + (sv-496 (mod (+ sv-464 -2 sv-512) sv-464)) + ) + (cond + ((-> this language-direction) + (let ((a2-22 (- 200 (+ (-> this language-x-offset) 100)))) + (print-language-name a0-66 sv-112 a2-22 #f) + ) + (let ((a2-23 (+ (-> this language-x-offset) 100))) + (cond + ((< a2-23 150) + (print-language-name sv-480 sv-112 a2-23 #t) + ) + (else + (let ((a2-24 (- 200 (-> this language-x-offset)))) + (print-language-name sv-496 sv-112 a2-24 #f) + ) ) - (t9-28 sv-496 a1-31 a2-24 a3-10) + ) ) ) - ) - ) - ) - (else - (let ((a2-25 (+ (-> this language-x-offset) 100))) - (cond - ((< a2-25 150) - (print-language-name a0-66 sv-112 a2-25 #f) - ) (else - (let ((a2-26 (- 200 (-> this language-x-offset)))) - (print-language-name v1-153 sv-112 a2-26 #t) + (let ((a2-25 (+ (-> this language-x-offset) 100))) + (cond + ((< a2-25 150) + (print-language-name a0-66 sv-112 a2-25 #f) + ) + (else + (let ((a2-26 (- 200 (-> this language-x-offset)))) + (print-language-name v1-153 sv-112 a2-26 #t) + ) + ) + ) + ) + (let ((a2-27 (- 200 (+ (-> this language-x-offset) 100)))) + (print-language-name sv-480 sv-112 a2-27 #t) ) ) ) ) - (let ((a2-27 (- 200 (+ (-> this language-x-offset) 100)))) - (print-language-name sv-480 sv-112 a2-27 #t) + (when (not (-> this language-transition)) + (let ((a0-75 sv-112)) + (set! (-> a0-75 color) (font-color progress-selected)) + ) + ) + (print-language-name sv-512 sv-112 (-> this language-x-offset) (-> this language-direction)) + ) + ) + (((game-option-type center-screen)) + (set! sv-912 (lookup-text! *common-text* (text-id move-dpad) #f)) + sv-912 + ) + (((game-option-type aspect-ratio)) + (cond + ((= (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) 'aspect4x3) + (format + (clear *temp-string*) + "~30L~S~0L ~S" + (lookup-text! *common-text* (text-id 4x3) #f) + (lookup-text! *common-text* (text-id 16x9) #f) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + (else + (format + (clear *temp-string*) + "~0L~S ~30L~S~1L" + (lookup-text! *common-text* (text-id 4x3) #f) + (lookup-text! *common-text* (text-id 16x9) #f) + ) + (set! sv-912 *temp-string*) + sv-912 ) ) ) - ) - (when (not (-> this language-transition)) - (let ((a0-75 sv-112)) - (set! (-> a0-75 color) (font-color progress-selected)) - ) - ) - (let ((t9-32 print-language-name) - (a1-37 sv-112) - (a2-28 (-> this language-x-offset)) - (a3-14 (-> this language-direction)) - ) - (t9-32 sv-512 a1-37 a2-28 a3-14) - ) - ) - (((game-option-type center-screen)) - (set! sv-912 (lookup-text! *common-text* (text-id move-dpad) #f)) - sv-912 - ) - (((game-option-type aspect-ratio)) - (cond - ((= (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) 'aspect4x3) - (set! sv-528 format) - (set! sv-544 (clear *temp-string*)) - (set! sv-560 "~30L~S~0L ~S") - (set! sv-576 (lookup-text! *common-text* (text-id 4x3) #f)) - (let ((a3-15 (lookup-text! *common-text* (text-id 16x9) #f))) - (sv-528 sv-544 sv-560 sv-576 a3-15) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - (else - (set! sv-592 format) - (set! sv-608 (clear *temp-string*)) - (set! sv-624 "~0L~S ~30L~S~1L") - (set! sv-640 (lookup-text! *common-text* (text-id 4x3) #f)) - (let ((a3-16 (lookup-text! *common-text* (text-id 16x9) #f))) - (sv-592 sv-608 sv-624 sv-640 a3-16) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - ) - ) - (((game-option-type video-mode)) - (cond - ((= (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) 'ntsc) - (set! sv-656 format) - (set! sv-672 (clear *temp-string*)) - (set! sv-688 "~0L~S ~30L~S~1L") - (set! sv-704 (lookup-text! *common-text* (text-id 50hz) #f)) - (let ((a3-17 (lookup-text! *common-text* (text-id 60hz) #f))) - (sv-656 sv-672 sv-688 sv-704 a3-17) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - (else - (set! sv-720 format) - (set! sv-736 (clear *temp-string*)) - (set! sv-752 "~30L~S~0L ~S") - (set! sv-768 (lookup-text! *common-text* (text-id 50hz) #f)) - (let ((a3-18 (lookup-text! *common-text* (text-id 60hz) #f))) - (sv-720 sv-736 sv-752 sv-768 a3-18) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - ) - ) - ) - ) - (else - (case (-> s3-0 s0-0 option-type) - (((game-option-type slider) - (game-option-type center-screen) - (game-option-type aspect-ratio) - (game-option-type video-mode) - ) - (set! sv-912 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) - sv-912 - ) - (((game-option-type on-off)) - (set! sv-784 format) - (set! sv-800 (clear *temp-string*)) - (set! sv-816 "~S: ~S") - (set! sv-832 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) - (let ((a3-19 (if (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) - (lookup-text! *common-text* (text-id on) #f) - (lookup-text! *common-text* (text-id off) #f) - ) - ) + (((game-option-type video-mode)) + (cond + ((= (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) 'ntsc) + (format + (clear *temp-string*) + "~0L~S ~30L~S~1L" + (lookup-text! *common-text* (text-id 50hz) #f) + (lookup-text! *common-text* (text-id 60hz) #f) + ) + (set! sv-912 *temp-string*) + sv-912 ) - (sv-784 sv-800 sv-816 sv-832 a3-19) + (else + (format + (clear *temp-string*) + "~30L~S~0L ~S" + (lookup-text! *common-text* (text-id 50hz) #f) + (lookup-text! *common-text* (text-id 60hz) #f) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) ) - (set! sv-912 *temp-string*) - sv-912 ) - (((game-option-type language)) - (set! sv-848 format) - (set! sv-864 (clear *temp-string*)) - (set! sv-880 "~S: ~S") - (set! sv-896 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) - (let ((a3-20 (lookup-text! - *common-text* - (-> *language-name-remap* (-> (the-as (pointer uint64) (-> s3-0 s0-0 value-to-modify)))) - #f - ) - ) + (else + (case (-> s3-0 s0-0 option-type) + (((game-option-type slider) + (game-option-type center-screen) + (game-option-type aspect-ratio) + (game-option-type video-mode) + ) + (set! sv-912 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) + sv-912 + ) + (((game-option-type on-off)) + (let ((sv-784 format) + (sv-800 (clear *temp-string*)) + (sv-816 "~S: ~S") + (sv-832 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) + ) + (sv-784 sv-800 sv-816 sv-832 (if (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) + (lookup-text! *common-text* (text-id on) #f) + (lookup-text! *common-text* (text-id off) #f) + ) + ) ) - (sv-848 sv-864 sv-880 sv-896 a3-20) - ) - (set! sv-912 *temp-string*) - sv-912 - ) + (set! sv-912 *temp-string*) + sv-912 + ) + (((game-option-type language)) + (format + (clear *temp-string*) + "~S: ~S" + (lookup-text! *common-text* (-> s3-0 s0-0 name) #f) + (lookup-text! + *common-text* + (-> *language-name-remap* (-> (the-as (pointer uint64) (-> s3-0 s0-0 value-to-modify)))) + #f + ) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) + ) + ) + (when sv-912 + (let ((f0-23 (-> this transition-percentage-invert))) + (let ((v1-235 sv-112)) + (set! (-> v1-235 color) (if (and (= s0-0 (-> this option-index)) (not (-> this in-transition))) + (font-color progress-selected) + (font-color default) + ) + ) + ) + (set! (-> sv-112 origin x) (the float (- sv-128 (-> this left-x-offset)))) + (set! (-> sv-112 origin y) (the float (the int (* (the float sv-144) (if (-> s3-0 s0-0 scale) + f0-23 + 1.0 + ) + ) + ) + ) + ) + (set-scale! sv-112 (* arg2 f0-23)) + (print-game-text sv-912 sv-112 #f (the int (* 128.0 f0-23)) 22) ) ) ) + (+! s2-1 arg1) + (+! s1-0 1) ) - (when sv-912 - (let ((f0-23 (-> this transition-percentage-invert))) - (let ((v1-235 sv-112)) - (set! (-> v1-235 color) (if (and (= s0-0 (-> this option-index)) (not (-> this in-transition))) - (font-color progress-selected) - (font-color default) - ) - ) - ) - (set! (-> sv-112 origin x) (the float (- sv-128 (-> this left-x-offset)))) - (set! (-> sv-112 origin y) (the float (the int (* (the float sv-144) (if (-> s3-0 s0-0 scale) - f0-23 - 1.0 - ) - ) - ) - ) - ) - (set-scale! sv-112 (* arg2 f0-23)) - (let ((t9-60 print-game-text) - (a1-64 sv-112) - (a2-50 #f) - (a3-21 (the int (* 128.0 f0-23))) - (t0-2 22) - ) - (t9-60 sv-912 a1-64 a2-50 a3-21 t0-2) - ) - ) - ) - (+! s2-1 arg1) - (+! s1-0 1) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc b/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc index ce94e04d41..59f910fa1f 100644 --- a/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc +++ b/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc @@ -287,51 +287,45 @@ ;; definition for function calculate-completion (defun calculate-completion ((the-progress progress)) - (local-vars - (current-cells int) - (current-buzzers int) - (current-orbs int) - (total-cells int) - (total-buzzers int) - (total-orbs int) - ) - (set! current-cells 0) - (set! current-buzzers 0) - (set! current-orbs 0) - (set! total-cells 0) - (set! total-buzzers 0) - (set! total-orbs 0) - (dotimes (s5-0 (length *level-task-data*)) - (let ((s4-0 (-> *level-task-data* s5-0))) - (when (!= s4-0 #f) - (when (or (= *kernel-boot-message* 'play) (= (-> s4-0 level-name-id) (text-id misty-level-name))) - (dotimes (s3-0 (-> s4-0 nb-of-tasks)) - (if (= (get-task-status (-> s4-0 task-info s3-0 task-id)) (task-status invalid)) - (set! current-cells (+ current-cells 1)) + (let ((current-cells 0) + (current-buzzers 0) + (current-orbs 0) + (total-cells 0) + (total-buzzers 0) + (total-orbs 0) + ) + (dotimes (s5-0 (length *level-task-data*)) + (let ((s4-0 (-> *level-task-data* s5-0))) + (when (!= s4-0 #f) + (when (or (= *kernel-boot-message* 'play) (= (-> s4-0 level-name-id) (text-id misty-level-name))) + (dotimes (s3-0 (-> s4-0 nb-of-tasks)) + (if (= (get-task-status (-> s4-0 task-info s3-0 task-id)) (task-status invalid)) + (+! current-cells 1) + ) + ) + (+! total-cells (-> s4-0 nb-of-tasks)) + (+! current-orbs (-> *game-info* money-per-level s5-0)) + (+! total-orbs (-> *game-counts* data s5-0 money-count)) + (let ((v1-20 (-> s4-0 buzzer-task-index))) + (when (!= v1-20 -1) + (+! current-buzzers (buzzer-count *game-info* (-> s4-0 task-info v1-20 task-id))) + (+! total-buzzers (-> *game-counts* data s5-0 buzzer-count)) ) - ) - (set! total-cells (+ total-cells (-> s4-0 nb-of-tasks))) - (set! current-orbs (+ current-orbs (-> *game-info* money-per-level s5-0))) - (set! total-orbs (+ total-orbs (-> *game-counts* data s5-0 money-count))) - (let ((v1-20 (-> s4-0 buzzer-task-index))) - (when (!= v1-20 -1) - (set! current-buzzers (+ current-buzzers (buzzer-count *game-info* (-> s4-0 task-info v1-20 task-id)))) - (set! total-buzzers (+ total-buzzers (-> *game-counts* data s5-0 buzzer-count))) ) ) ) ) ) + (when the-progress + (set! (-> the-progress total-nb-of-power-cells) total-cells) + (set! (-> the-progress total-nb-of-buzzers) total-buzzers) + (set! (-> the-progress total-nb-of-orbs) total-orbs) + ) + (+ (/ (* 80.0 (the float current-cells)) (the float total-cells)) + (/ (* 10.0 (the float current-orbs)) (the float total-orbs)) + (/ (* 10.0 (the float current-buzzers)) (the float total-buzzers)) + ) ) - (when the-progress - (set! (-> the-progress total-nb-of-power-cells) total-cells) - (set! (-> the-progress total-nb-of-buzzers) total-buzzers) - (set! (-> the-progress total-nb-of-orbs) total-orbs) - ) - (+ (/ (* 80.0 (the float current-cells)) (the float total-cells)) - (/ (* 10.0 (the float current-orbs)) (the float total-orbs)) - (/ (* 10.0 (the float current-buzzers)) (the float total-buzzers)) - ) ) ;; definition for symbol *progress-save-info*, type mc-slot-info diff --git a/test/decompiler/reference/jak1/engine/ui/text_REF.gc b/test/decompiler/reference/jak1/engine/ui/text_REF.gc index 8970c2d8fc..6882f4575b 100644 --- a/test/decompiler/reference/jak1/engine/ui/text_REF.gc +++ b/test/decompiler/reference/jak1/engine/ui/text_REF.gc @@ -104,76 +104,78 @@ ;; definition for function load-game-text-info ;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. (defun load-game-text-info ((txt-name string) (curr-text symbol) (heap kheap)) - (local-vars (v0-2 int) (heap-sym-heap game-text-info) (lang int) (load-status int) (heap-free int)) - (set! heap-sym-heap (the-as game-text-info (-> curr-text value))) - (set! lang (the-as int (-> *setting-control* current language))) - (set! load-status 0) - (set! heap-free (&- (-> heap top) (the-as uint (-> heap base)))) - (if (and (= (scf-get-territory) 1) (zero? lang)) - (set! lang 6) - ) - (when (or (= heap-sym-heap #f) - (!= (-> heap-sym-heap language-id) lang) - (not (string= (-> heap-sym-heap group-name) txt-name)) - ) - (let ((v1-16 heap)) - (set! (-> v1-16 current) (-> v1-16 base)) - ) - (b! #t cfg-14 :delay (nop!)) - (label cfg-13) - (set! v0-2 0) - (b! #t cfg-27 :delay (nop!)) - (label cfg-14) - (let ((s3-0 str-load)) - (format (clear *temp-string*) "~D~S.TXT" lang txt-name) - (b! - (not (s3-0 - *temp-string* - -1 - (logand -64 (&+ (-> heap current) 63)) - (&- (-> heap top) (the-as uint (-> heap current))) - ) - ) - cfg-13 - :delay (nop!) + (local-vars (v0-2 int)) + (let ((heap-sym-heap (the-as game-text-info (-> curr-text value))) + (lang (the-as int (-> *setting-control* current language))) + (load-status 0) + (heap-free (&- (-> heap top) (the-as uint (-> heap base)))) ) - ) - (label cfg-16) - (let ((v1-20 (str-load-status (the-as (pointer int32) (& load-status))))) - (b! (!= v1-20 'error) cfg-19 :delay (empty-form)) - (format 0 "Error loading text~%") + (if (and (= (scf-get-territory) 1) (zero? (the-as language-enum lang))) + (set! lang 6) + ) + (when (or (= heap-sym-heap #f) + (!= (-> heap-sym-heap language-id) lang) + (not (string= (-> heap-sym-heap group-name) txt-name)) + ) + (let ((v1-16 heap)) + (set! (-> v1-16 current) (-> v1-16 base)) + ) + (b! #t cfg-14 :delay (nop!)) + (label cfg-13) (set! v0-2 0) (b! #t cfg-27 :delay (nop!)) - (the-as none 0) - (b! #t cfg-24 :delay (nop!)) - (label cfg-19) - (cond - ((>= load-status (+ heap-free -300)) - (format 0 "Game text heap overrun!~%") - (return 0) - ) - ((= v1-20 'busy) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (goto cfg-16) - ) - ) - ) - (label cfg-24) - (let ((s2-1 (logand -64 (&+ (-> heap current) 63)))) - (flush-cache 0) - (let ((s3-1 link)) + (label cfg-14) + (let ((s3-0 str-load)) (format (clear *temp-string*) "~D~S.TXT" lang txt-name) - (set! (-> curr-text value) (s3-1 s2-1 (-> *temp-string* data) load-status heap 0)) + (b! + (not (s3-0 + *temp-string* + -1 + (logand -64 (&+ (-> heap current) 63)) + (&- (-> heap top) (the-as uint (-> heap current))) + ) + ) + cfg-13 + :delay (nop!) + ) ) + (label cfg-16) + (let ((v1-20 (str-load-status (the-as (pointer int32) (& load-status))))) + (b! (!= v1-20 'error) cfg-19 :delay (empty-form)) + (format 0 "Error loading text~%") + (set! v0-2 0) + (b! #t cfg-27 :delay (nop!)) + (the-as none 0) + (b! #t cfg-24 :delay (nop!)) + (label cfg-19) + (cond + ((>= load-status (+ heap-free -300)) + (format 0 "Game text heap overrun!~%") + (return 0) + ) + ((= v1-20 'busy) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (goto cfg-16) + ) + ) + ) + (label cfg-24) + (let ((s2-1 (logand -64 (&+ (-> heap current) 63)))) + (flush-cache 0) + (let ((s3-1 link)) + (format (clear *temp-string*) "~D~S.TXT" lang txt-name) + (set! (-> curr-text value) (s3-1 s2-1 (-> *temp-string* data) load-status heap 0)) + ) + ) + (if (<= (the-as int (-> curr-text value)) 0) + (set! (-> curr-text value) (the-as object #f)) + ) ) - (if (<= (the-as int (-> curr-text value)) 0) - (set! (-> curr-text value) (the-as object #f)) - ) ) (set! v0-2 0) (label cfg-27) @@ -338,29 +340,6 @@ ;; WARN: Stack slot offset 132 signed mismatch ;; WARN: Stack slot offset 164 signed mismatch (defun print-game-text ((str string) (font-ctxt font-context) (opaque symbol) (alpha int) (line-height int)) - (local-vars - (sv-112 float) - (sv-116 float) - (sv-120 float) - (sv-124 float) - (sv-128 float) - (sv-132 float) - (sv-136 float) - (sv-140 (pointer uint8)) - (sv-144 float) - (sv-148 float) - (sv-152 float) - (sv-156 float) - (sv-160 float) - (sv-164 float) - (sv-168 int) - (sv-176 int) - (sv-184 int) - (sv-192 int) - (sv-200 int) - (sv-208 symbol) - (sv-212 symbol) - ) (let ((gp-0 (new 'stack 'font-context @@ -374,174 +353,190 @@ ) ) (when (< 0.1 (-> font-ctxt scale)) - (set! sv-112 (-> font-ctxt mat vector 0 x)) - (set! sv-116 (-> font-ctxt mat vector 1 y)) - (set! sv-120 (-> *video-parms* relative-x-scale)) - (set! sv-124 (-> *video-parms* relative-y-scale)) - (set! sv-128 (-> *video-parms* relative-x-scale-reciprical)) - (set! sv-132 (-> *video-parms* relative-y-scale-reciprical)) - (set! sv-136 (-> font-ctxt scale)) - (set! (-> gp-0 origin z) (-> font-ctxt origin z)) - (set! (-> gp-0 flags) (-> font-ctxt flags)) - (set! (-> gp-0 color) (-> font-ctxt color)) - (set! (-> gp-0 scale) sv-136) - (when (logtest? (-> gp-0 flags) (font-flags middle-vert)) - (logclear! (-> gp-0 flags) (font-flags middle-vert)) - (let ((f30-0 (-> gp-0 width)) - (f28-0 (-> gp-0 height)) - ) - (set! (-> gp-0 width) (-> font-ctxt width)) - (set! (-> gp-0 height) (-> font-ctxt height)) - (+! (-> gp-0 origin y) - (the float (the int (* 0.5 (- (-> gp-0 height) (print-game-text str gp-0 #t 128 22))))) - ) - (set! (-> gp-0 width) f30-0) - (set! (-> gp-0 height) f28-0) + (let ((sv-112 (-> font-ctxt mat vector 0 x)) + (sv-116 (-> font-ctxt mat vector 1 y)) + (sv-120 (-> *video-parms* relative-x-scale)) + (sv-124 (-> *video-parms* relative-y-scale)) + (sv-128 (-> *video-parms* relative-x-scale-reciprical)) + (sv-132 (-> *video-parms* relative-y-scale-reciprical)) + (sv-136 (-> font-ctxt scale)) + ) + (set! (-> gp-0 origin z) (-> font-ctxt origin z)) + (set! (-> gp-0 flags) (-> font-ctxt flags)) + (set! (-> gp-0 color) (-> font-ctxt color)) + (set! (-> gp-0 scale) sv-136) + (when (logtest? (-> gp-0 flags) (font-flags middle-vert)) + (logclear! (-> gp-0 flags) (font-flags middle-vert)) + (let ((f30-0 (-> gp-0 width)) + (f28-0 (-> gp-0 height)) + ) + (set! (-> gp-0 width) (-> font-ctxt width)) + (set! (-> gp-0 height) (-> font-ctxt height)) + (+! (-> gp-0 origin y) + (the float (the int (* 0.5 (- (-> gp-0 height) (print-game-text str gp-0 #t 128 22))))) + ) + (set! (-> gp-0 width) f30-0) + (set! (-> gp-0 height) f28-0) + ) ) - ) - (set! (-> gp-0 mat vector 0 x) (* (-> gp-0 mat vector 0 x) sv-136)) - (set! (-> gp-0 mat vector 1 y) (* (-> gp-0 mat vector 1 y) sv-136)) - (set! (-> *video-parms* relative-x-scale) (* (-> *video-parms* relative-x-scale) sv-136)) - (set! (-> *video-parms* relative-y-scale) (* (-> *video-parms* relative-y-scale) sv-136)) - (set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale))) - (set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 sv-136)) - (set! sv-140 (-> str data)) - (set! sv-144 (-> gp-0 origin x)) - (set! sv-148 (-> gp-0 origin x)) - (set! sv-152 (+ (-> gp-0 origin x) (-> font-ctxt width))) - (set! sv-156 (+ (-> gp-0 origin y) (-> font-ctxt height))) - (set! sv-160 (* (get-string-length " " gp-0) (-> *video-parms* relative-x-scale))) - (set! sv-164 (* (if (logtest? (-> gp-0 flags) (font-flags large)) - (the float line-height) - 14.0 - ) - sv-136 + (set! (-> gp-0 mat vector 0 x) (* (-> gp-0 mat vector 0 x) sv-136)) + (set! (-> gp-0 mat vector 1 y) (* (-> gp-0 mat vector 1 y) sv-136)) + (set! (-> *video-parms* relative-x-scale) (* (-> *video-parms* relative-x-scale) sv-136)) + (set! (-> *video-parms* relative-y-scale) (* (-> *video-parms* relative-y-scale) sv-136)) + (set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale))) + (set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 sv-136)) + (let ((sv-140 (-> str data)) + (sv-144 (-> gp-0 origin x)) + (sv-148 (-> gp-0 origin x)) + (sv-152 (+ (-> gp-0 origin x) (-> font-ctxt width))) + (sv-156 (+ (-> gp-0 origin y) (-> font-ctxt height))) + (sv-160 (* (get-string-length " " gp-0) (-> *video-parms* relative-x-scale))) + (sv-164 (* (if (logtest? (-> gp-0 flags) (font-flags large)) + (the float line-height) + 14.0 + ) + sv-136 + ) ) - ) - (set! sv-168 0) - (if (logtest? (-> gp-0 flags) (font-flags middle)) - (+! (-> gp-0 origin x) (/ (-> font-ctxt width) 2)) - ) - (set! sv-176 (the-as int (-> sv-140 0))) - (set! sv-184 0) - (set! sv-192 0) - (set! sv-200 0) - (set! sv-208 (the-as symbol #f)) - (set! sv-212 (the-as symbol #f)) - (set! (-> *game-text-line* data 0) (the-as uint 0)) - (while (or (not (and (zero? sv-176) (zero? sv-184) (zero? sv-192))) (>= sv-156 (-> gp-0 origin y))) - (cond - ((= sv-176 32) - (set! (-> *game-text-word* data sv-184) (the-as uint sv-176)) - (set! sv-184 (+ sv-184 1)) - (set! sv-208 #t) - ) - ((zero? sv-176) - (if (zero? sv-184) - (set! sv-212 #t) - (set! sv-208 #t) - ) - ) - (else - (if (= sv-176 95) - (set! sv-176 32) - ) - (set! (-> *game-text-word* data sv-184) (the-as uint sv-176)) - (set! sv-184 (+ sv-184 1)) - ) - ) - (when (= sv-208 #t) - (set! (-> *game-text-word* data sv-184) (the-as uint 0)) - (let* ((f30-1 sv-144) - (f0-49 (* (get-string-length *game-text-word* gp-0) (-> *video-parms* relative-x-scale))) - (f1-14 (+ f30-1 f0-49)) - ) - (if (= (-> *game-text-word* data (+ sv-184 -1)) 32) - (set! f1-14 (- f1-14 sv-160)) - ) - (cond - ((< sv-152 f1-14) - (set! sv-144 (+ sv-148 f0-49)) - (set! sv-212 #t) - ) - (else - (set! sv-144 (+ sv-144 f0-49)) - ) + (sv-168 0) ) - ) - ) - (when (= sv-212 #t) - (when (>= sv-200 (the-as int (-> gp-0 start-line))) - (let ((f30-2 (+ (-> gp-0 origin y) sv-164))) - (when (>= sv-156 f30-2) - (when (= (-> *game-text-line* data (+ sv-192 -1)) 32) - (set! (-> *game-text-line* data (+ sv-192 -1)) (the-as uint 0)) - (when (and (= (-> *game-text-line* data (+ sv-192 -5)) 126) (= (-> *game-text-line* data (+ sv-192 -2)) 72)) - (set! (-> *game-text-line* data (+ sv-192 -5)) (the-as uint 0)) - 0 + (if (logtest? (-> gp-0 flags) (font-flags middle)) + (+! (-> gp-0 origin x) (/ (-> font-ctxt width) 2)) + ) + (let ((sv-176 (the-as int (-> sv-140 0))) + (sv-184 0) + (sv-192 0) + (sv-200 0) + (sv-208 (the-as symbol #f)) + (sv-212 (the-as symbol #f)) + ) + (set! (-> *game-text-line* data 0) (the-as uint 0)) + (while (or (not (and (zero? sv-176) (zero? sv-184) (zero? sv-192))) (>= sv-156 (-> gp-0 origin y))) + (set! sv-208 (cond + ((= sv-176 32) + (set! (-> *game-text-word* data sv-184) (the-as uint sv-176)) + (+! sv-184 1) + (set! sv-208 #t) + sv-208 + ) + ((zero? sv-176) + (cond + ((zero? sv-184) + (set! sv-212 #t) + sv-208 + ) + (else + #t + ) + ) + ) + (else + (if (= sv-176 95) + (set! sv-176 32) + ) + (set! (-> *game-text-word* data sv-184) (the-as uint sv-176)) + (+! sv-184 1) + sv-208 + ) + ) ) - ) - ) - (when (and (= (-> *game-text-line* data (+ sv-192 -4)) 126) (= (-> *game-text-line* data (+ sv-192 -1)) 72)) - (set! (-> *game-text-line* data (+ sv-192 -4)) (the-as uint 0)) - 0 - ) - (if (nonzero? (-> *game-text-line* data 0)) - (set! sv-168 (+ sv-168 1)) - ) - (when (not opaque) - (let* ((s1-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) - (s2-1 (-> s1-1 base)) + (when (= sv-208 #t) + (set! (-> *game-text-word* data sv-184) (the-as uint 0)) + (let* ((f30-1 sv-144) + (f0-49 (* (get-string-length *game-text-word* gp-0) (-> *video-parms* relative-x-scale))) + (f1-14 (+ f30-1 f0-49)) ) - (set-font-color-alpha (-> font-ctxt color) alpha) - (draw-string *game-text-line* s1-1 gp-0) - (set-font-color-alpha (-> font-ctxt color) 128) - (set! (-> gp-0 color) (-> *font-work* last-color)) - (let ((a3-3 (-> s1-1 base))) - (let ((v1-127 (the-as object (-> s1-1 base)))) - (set! (-> (the-as dma-packet v1-127) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-127) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-127) vif1) (new 'static 'vif-tag)) - (set! (-> s1-1 base) (&+ (the-as pointer v1-127) 16)) + (if (= (-> *game-text-word* data (+ sv-184 -1)) 32) + (set! f1-14 (- f1-14 sv-160)) ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id debug) - s2-1 - (the-as (pointer dma-tag) a3-3) - ) - ) + (set! sv-212 (cond + ((< sv-152 f1-14) + (set! sv-144 (+ sv-148 f0-49)) + #t + ) + (else + (+! sv-144 f0-49) + sv-212 + ) + ) + ) ) ) - (set! (-> gp-0 origin y) f30-2) + (when (= sv-212 #t) + (when (>= sv-200 (the-as int (-> gp-0 start-line))) + (let ((f30-2 (+ (-> gp-0 origin y) sv-164))) + (when (>= sv-156 f30-2) + (when (= (-> *game-text-line* data (+ sv-192 -1)) 32) + (set! (-> *game-text-line* data (+ sv-192 -1)) (the-as uint 0)) + (when (and (= (-> *game-text-line* data (+ sv-192 -5)) 126) (= (-> *game-text-line* data (+ sv-192 -2)) 72)) + (set! (-> *game-text-line* data (+ sv-192 -5)) (the-as uint 0)) + 0 + ) + ) + ) + (when (and (= (-> *game-text-line* data (+ sv-192 -4)) 126) (= (-> *game-text-line* data (+ sv-192 -1)) 72)) + (set! (-> *game-text-line* data (+ sv-192 -4)) (the-as uint 0)) + 0 + ) + (if (nonzero? (-> *game-text-line* data 0)) + (+! sv-168 1) + ) + (when (not opaque) + (let* ((s1-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (s2-1 (-> s1-1 base)) + ) + (set-font-color-alpha (-> font-ctxt color) alpha) + (draw-string *game-text-line* s1-1 gp-0) + (set-font-color-alpha (-> font-ctxt color) 128) + (set! (-> gp-0 color) (-> *font-work* last-color)) + (let ((a3-3 (-> s1-1 base))) + (let ((v1-127 (the-as object (-> s1-1 base)))) + (set! (-> (the-as dma-packet v1-127) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-127) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-127) vif1) (new 'static 'vif-tag)) + (set! (-> s1-1 base) (&+ (the-as pointer v1-127) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug) + s2-1 + (the-as (pointer dma-tag) a3-3) + ) + ) + ) + ) + (set! (-> gp-0 origin y) f30-2) + ) + ) + (+! sv-200 1) + (set! (-> *game-text-line* data 0) (the-as uint 0)) + (set! sv-192 0) + (set! sv-212 (the-as symbol #f)) + ) + (when (= sv-208 #t) + (copy-charp<-charp (&-> *game-text-line* data sv-192) (-> *game-text-word* data)) + (+! sv-192 sv-184) + (set! sv-184 0) + (set! sv-208 (the-as symbol #f)) + ) + (when (nonzero? sv-176) + (set! sv-140 (&-> sv-140 1)) + (set! sv-176 (the-as int (-> sv-140 0))) + ) ) ) - (set! sv-200 (+ sv-200 1)) - (set! (-> *game-text-line* data 0) (the-as uint 0)) - (set! sv-192 0) - (set! sv-212 (the-as symbol #f)) - ) - (when (= sv-208 #t) - (copy-charp<-charp (&-> *game-text-line* data sv-192) (-> *game-text-word* data)) - (set! sv-192 (+ sv-192 sv-184)) - (set! sv-184 0) - (set! sv-208 (the-as symbol #f)) - ) - (when (nonzero? sv-176) - (set! sv-140 (&-> sv-140 1)) - (set! sv-176 (the-as int (-> sv-140 0))) + (set! (-> gp-0 mat vector 0 x) sv-112) + (set! (-> gp-0 mat vector 1 y) sv-116) + (set! (-> *video-parms* relative-x-scale) sv-120) + (set! (-> *video-parms* relative-y-scale) sv-124) + (set! (-> *video-parms* relative-x-scale-reciprical) sv-128) + (set! (-> *video-parms* relative-y-scale-reciprical) sv-132) + (if (> sv-168 0) + (* sv-164 (the float sv-168)) + 0.0 + ) ) ) - (set! (-> gp-0 mat vector 0 x) sv-112) - (set! (-> gp-0 mat vector 1 y) sv-116) - (set! (-> *video-parms* relative-x-scale) sv-120) - (set! (-> *video-parms* relative-y-scale) sv-124) - (set! (-> *video-parms* relative-x-scale-reciprical) sv-128) - (set! (-> *video-parms* relative-y-scale-reciprical) sv-132) - (if (> sv-168 0) - (* sv-164 (the float sv-168)) - 0.0 - ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/util/capture_REF.gc b/test/decompiler/reference/jak1/engine/util/capture_REF.gc index edae6e0c62..ce6ea803d0 100644 --- a/test/decompiler/reference/jak1/engine/util/capture_REF.gc +++ b/test/decompiler/reference/jak1/engine/util/capture_REF.gc @@ -78,7 +78,6 @@ ;; definition for function store-image ;; INFO: Used lq/sq (defun store-image ((oddeven int)) - (local-vars (ptr-1 (pointer uint128)) (y-idx int) (y-idx-2 int)) (let ((width 512) (height (-> *video-parms* screen-sy)) (file (new 'debug 'file-stream "image.raw" 'write)) @@ -95,23 +94,26 @@ (gs-store-image packet (-> buff1 data)) ) (sync-path 0 0) - (let ((ptr-0 (-> buff0 data))) - (set! ptr-1 (-> buff1 data)) + (let ((ptr-0 (-> buff0 data)) + (ptr-1 (-> buff1 data)) + ) (cond ((zero? oddeven) - (set! y-idx 0) - (while (< y-idx height) - (file-stream-write file (&+ ptr-0 (* y-idx (* width 4))) (the-as uint (* width 4))) - (file-stream-write file (&+ ptr-1 (* y-idx (* width 4))) (the-as uint (* width 4))) - (set! y-idx (+ y-idx 1)) + (let ((y-idx 0)) + (while (< y-idx height) + (file-stream-write file (&+ ptr-0 (* y-idx (* width 4))) (the-as uint (* width 4))) + (file-stream-write file (&+ ptr-1 (* y-idx (* width 4))) (the-as uint (* width 4))) + (+! y-idx 1) + ) ) ) (else - (set! y-idx-2 0) - (while (< y-idx-2 height) - (file-stream-write file (&+ ptr-1 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) - (file-stream-write file (&+ ptr-0 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) - (set! y-idx-2 (+ y-idx-2 1)) + (let ((y-idx-2 0)) + (while (< y-idx-2 height) + (file-stream-write file (&+ ptr-1 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) + (file-stream-write file (&+ ptr-0 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) + (+! y-idx-2 1) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/util/sync-info_REF.gc b/test/decompiler/reference/jak1/engine/util/sync-info_REF.gc index d0608b7521..7ea65c6fea 100644 --- a/test/decompiler/reference/jak1/engine/util/sync-info_REF.gc +++ b/test/decompiler/reference/jak1/engine/util/sync-info_REF.gc @@ -43,7 +43,7 @@ (let* ((total-normal-phase (- 1.0 total-easing-phase)) (f0-10 out-param) (f1-12 (+ out-param total-normal-phase)) - (f2-5 (* f0-10 f0-10)) + (f2-5 (square f0-10)) (f3-3 (+ (* 2.0 f0-10 (- f1-12 f0-10)) f2-5)) (f4-3 (/ f0-10 (- 1.0 f1-12))) (y-end (+ (* (- 1.0 f1-12) (- 1.0 f1-12) f4-3) f3-3)) @@ -99,9 +99,9 @@ (default-out float) (default-in float) ) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))) + ) (cond (v1-1 (setup-params! @@ -130,9 +130,9 @@ (default-out float) (default-in float) ) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))) + ) (cond (v1-1 (if (>= (-> sv-16 elt-count) (the-as uint 4)) @@ -170,9 +170,9 @@ (default-out float) (default-in float) ) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))) + ) (cond (v1-1 (if (>= (-> sv-16 elt-count) (the-as uint 4)) @@ -317,14 +317,14 @@ (let* ((tlo (-> this tlo)) (eased-phase (/ (cond ((< current-val tlo) - (* current-val current-val) + (square current-val) ) ((< current-val (-> this thi)) (+ (* 2.0 tlo (- current-val tlo)) (-> this ylo)) ) (else (let ((f1-7 (- 1.0 current-val))) - (- (-> this yend) (* f1-7 f1-7 (-> this m2))) + (- (-> this yend) (* (square f1-7) (-> this m2))) ) ) ) diff --git a/test/decompiler/reference/jak1/kernel/gstate_REF.gc b/test/decompiler/reference/jak1/kernel/gstate_REF.gc index 0d4c7724b8..49f9a6a90c 100644 --- a/test/decompiler/reference/jak1/kernel/gstate_REF.gc +++ b/test/decompiler/reference/jak1/kernel/gstate_REF.gc @@ -47,7 +47,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [jr t9] ;; ERROR: Unsupported inline assembly instruction kind - [sw v0, 0(sp)] (defun enter-state ((arg0 object) (arg1 object) (arg2 object) (arg3 object) (arg4 object) (arg5 object)) - (local-vars (s7-0 none) (sp-0 int) (ra-0 int) (sv-0 none)) + (local-vars (s7-0 none) (sp-0 int) (ra-0 int)) (with-pp (logclear! (-> pp mask) (process-mask sleep sleep-code)) (logior! (-> pp mask) (process-mask going)) diff --git a/test/decompiler/reference/jak1/levels/beach/beach-obs_REF.gc b/test/decompiler/reference/jak1/levels/beach/beach-obs_REF.gc index a7496724ee..d4dd356040 100644 --- a/test/decompiler/reference/jak1/levels/beach/beach-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/beach/beach-obs_REF.gc @@ -592,7 +592,6 @@ (set-time! (-> self state-time)) ) :code (behavior ((arg0 symbol)) - (local-vars (sv-128 symbol)) (ja-channel-set! 0) (clear-collide-with-as (-> self root)) (ja-post) @@ -623,7 +622,7 @@ (f1-2 (- (-> s5-1 z) (-> v1-14 z))) (f2-1 7372.8) (f30-0 5734.4) - (f2-2 (/ f2-1 (sqrtf (+ (* f0-1 f0-1) (* f1-2 f1-2))))) + (f2-2 (/ f2-1 (sqrtf (+ (square f0-1) (square f1-2))))) (f28-0 (* f0-1 f2-2)) (f26-0 (* f1-2 f2-2)) (s4-0 (new-stack-vector0)) @@ -660,32 +659,33 @@ ) ) (when (or (-> self link prev) (-> self link next)) - (set! sv-128 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) - (when sv-128 - (suspend-for (seconds 0.5) - ) - (let ((gp-1 (cond - (arg0 - (the-as int #f) - ) - (else - (ambient-hint-spawn "gamcam10" (the-as vector #f) *entity-pool* 'camera) - (ppointer->handle - (process-spawn pov-camera (-> self root trans) *beachcam-sg* (-> self name) 0 #f '() :to self) + (let ((sv-128 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) + (when sv-128 + (suspend-for (seconds 0.5) + ) + (let ((gp-1 (cond + (arg0 + (the-as int #f) + ) + (else + (ambient-hint-spawn "gamcam10" (the-as vector #f) *entity-pool* 'camera) + (ppointer->handle + (process-spawn pov-camera (-> self root trans) *beachcam-sg* (-> self name) 0 #f '() :to self) + ) ) ) ) - ) + ) + (process-drawable-birth-fuel-cell (the-as entity #f) (the-as vector #f) #f) + (while (handle->process (the-as handle gp-1)) + (suspend) ) - (process-drawable-birth-fuel-cell (the-as entity #f) (the-as vector #f) #f) - (while (handle->process (the-as handle gp-1)) + ) + (while (-> self child) (suspend) ) ) - (while (-> self child) - (suspend) - ) ) ) (process-entity-status! self (entity-perm-status dead) #t) diff --git a/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc index 216ecbfa88..3f9441ac94 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc @@ -869,51 +869,37 @@ ;; failed to figure out what this is: (defstate citb-robotboss-idle (citb-robotboss) :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (sv-96 int) (sv-112 int)) - (the-as - symbol - (cond - ((= message 'shield-off) - (stop! (-> self sound)) - (if (-> self shield-on) - (sound-play "robotcage-off") - ) - (set! (-> self shield-on) #f) - #f - ) - ((= message 'shield-on) - (let ((v0-3 #t)) - (set! (-> self shield-on) v0-3) - v0-3 - ) - ) - ((= message 'die) - (cleanup-for-death self) - (the-as symbol (deactivate self)) - ) - ((or (= message 'touch) (= message 'attack)) - (let ((s4-0 sound-play-by-name) - (s3-0 (make-u128 #x7061 (the-as uint #x7a2d646c65696873))) - (s2-0 (new-sound-id)) - (s1-0 1024) - (s0-0 0) - ) - (set! sv-96 0) - (set! sv-112 1) - (let ((t2-1 (target-pos 0))) - (s4-0 (the-as sound-name s3-0) s2-0 s1-0 s0-0 sv-96 (the-as sound-group sv-112) (the-as symbol t2-1)) - ) - ) - (the-as symbol (send-event - proc - 'shove - (-> block param 0) - (static-attack-info ((shove-up (meters 2)) (shove-back (meters 3)))) + (the-as symbol (cond + ((= message 'shield-off) + (stop! (-> self sound)) + (if (-> self shield-on) + (sound-play "robotcage-off") ) - ) - ) - ) - ) + (set! (-> self shield-on) #f) + #f + ) + ((= message 'shield-on) + (let ((v0-3 #t)) + (set! (-> self shield-on) v0-3) + v0-3 + ) + ) + ((= message 'die) + (cleanup-for-death self) + (the-as symbol (deactivate self)) + ) + ((or (= message 'touch) (= message 'attack)) + (sound-play "shield-zap" :position (the-as symbol (target-pos 0))) + (the-as symbol (send-event + proc + 'shove + (-> block param 0) + (static-attack-info ((shove-up (meters 2)) (shove-back (meters 3)))) + ) + ) + ) + ) + ) ) :code (behavior () (let ((gp-0 (manipy-spawn (-> self root trans) (-> self entity) *citb-robotboss-nose-sg* #f :to self))) diff --git a/test/decompiler/reference/jak1/levels/citadel/citadel-part_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citadel-part_REF.gc index ff1b0cd7c4..25c207fa5c 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citadel-part_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citadel-part_REF.gc @@ -610,7 +610,7 @@ (set! (-> v1-3 x) f0-13) (set! (-> v1-3 y) f1-4) (set! (-> v1-3 z) f2-0) - (set! (-> v1-3 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-4 f1-4)) (* f0-13 f0-13)))) + (set! (-> v1-3 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-4)) (square f0-13)))) ) (quaternion-rotate-y! (the-as quaternion s5-0) (the-as quaternion s5-0) (+ 16384.0 f30-0)) (cond diff --git a/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc index 58f3f6ec8e..bae52062af 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc @@ -166,9 +166,9 @@ (set! (-> gp-0 quad) (-> self root trans quad)) (set! (-> gp-0 y) (-> (the-as process-drawable (-> self parent 0)) root trans y)) (loop - (let ((f0-6 (fmax 0.0 (- 1.0 (* 0.0033333334 (the float (- (current-time) (-> self state-time)))))))) - (set! (-> self interp) (* f0-6 f0-6)) - ) + (set! (-> self interp) + (square (fmax 0.0 (- 1.0 (* 0.0033333334 (the float (- (current-time) (-> self state-time))))))) + ) (set! (-> self root trans y) (- (-> (the-as process-drawable (-> self parent 0)) root trans y) (* 204800.0 (-> self interp))) ) @@ -288,11 +288,7 @@ (s4-0 (new 'stack-no-clear 'vector)) ) (set! (-> s3-0 x) (* 65536.0 (rand-vu))) - (let ((f30-1 14563.556) - (f0-2 (rand-vu-float-range -1.0 1.0)) - ) - (set! (-> s3-0 y) (* f30-1 (* f0-2 f0-2))) - ) + (set! (-> s3-0 y) (* 14563.556 (square (rand-vu-float-range -1.0 1.0)))) (vector-sincos! s5-0 s4-0 s3-0) (set! (-> this spin-axis x) (* (-> s4-0 y) (-> s4-0 x))) (set! (-> this spin-axis y) (-> s5-0 y)) @@ -395,7 +391,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defbehavior citb-drop-plat-spawn-children citb-drop-plat () - (local-vars (s0-0 int) (sv-48 process) (sv-64 int)) + (local-vars (s0-0 int)) (let ((gp-0 (new 'stack-no-clear 'vector))) 6 0 @@ -419,32 +415,26 @@ (set! s0-0 (rand-vu-int-range 0 5)) ) (when (nonzero? s0-0) - (set! sv-64 (the int (* 150.0 (rand-vu)))) - (set! sv-48 (get-process *default-dead-pool* drop-plat #x4000)) - (set! (-> self child-array data s1-0) - (ppointer->handle (when sv-48 - (let ((t9-6 (method-of-type drop-plat activate))) - (t9-6 (the-as drop-plat sv-48) self 'drop-plat (the-as pointer #x70004000)) - ) - (let ((t9-7 run-function-in-process) - (a0-8 sv-48) - (a1-5 drop-plat-init-by-other) - (a2-4 gp-0) - (t0-0 (-> self duration)) - ) - ((the-as (function process function vector int int int none) t9-7) - a0-8 - a1-5 - a2-4 - sv-64 - (the-as int t0-0) - s0-0 - ) - ) - (-> sv-48 ppointer) - ) - ) + (let ((sv-64 (the int (* 150.0 (rand-vu)))) + (sv-48 (get-process *default-dead-pool* drop-plat #x4000)) ) + (set! (-> self child-array data s1-0) + (ppointer->handle + (when sv-48 + ((method-of-type drop-plat activate) (the-as drop-plat sv-48) self 'drop-plat (the-as pointer #x70004000)) + ((the-as (function process function vector int int int none) run-function-in-process) + sv-48 + drop-plat-init-by-other + gp-0 + sv-64 + (the-as int (-> self duration)) + s0-0 + ) + (-> sv-48 ppointer) + ) + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc index 6bd27c8ed9..d97641e88d 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc @@ -345,7 +345,7 @@ (set! (-> self root trans y) (-> self rise-height)) (go-virtual citb-base-plat-active) ) - (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (* f30-0 f30-0))) + (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (square f30-0))) ) (let ((f0-12 (fmax 0.0 (fmin 1.0 (* 0.000012207031 (+ 409600.0 (-> self root trans y))))))) (set! (-> self draw color-mult x) f0-12) @@ -1120,7 +1120,7 @@ (set! (-> self root trans y) (-> self rise-height)) (go-virtual plat-button-idle) ) - (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (* f30-0 f30-0))) + (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (square f30-0))) ) (suspend) ) diff --git a/test/decompiler/reference/jak1/levels/common/battlecontroller_REF.gc b/test/decompiler/reference/jak1/levels/common/battlecontroller_REF.gc index 0219ba6896..ff47aaaa2c 100644 --- a/test/decompiler/reference/jak1/levels/common/battlecontroller_REF.gc +++ b/test/decompiler/reference/jak1/levels/common/battlecontroller_REF.gc @@ -684,7 +684,6 @@ battlecontroller-default-event-handler ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod battlecontroller-method-27 ((this battlecontroller)) - (local-vars (sv-16 res-tag)) (set! (-> this fact) (new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc)) ) @@ -756,8 +755,9 @@ battlecontroller-default-event-handler (set! (-> this creature-type-array 0 type2) babak) (set! (-> this creature-type-array 0 percent) 1.0) (let ((s5-3 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-49 (res-lump-data (-> this entity) 'lurker-type pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-49 (res-lump-data (-> this entity) 'lurker-type pointer :tag-ptr (& sv-16))) + ) (when v1-49 (dotimes (a0-22 (the-as int (-> sv-16 elt-count))) (let ((a1-15 (-> (the-as (pointer uint32) (&+ v1-49 (* a0-22 4)))))) diff --git a/test/decompiler/reference/jak1/levels/demo/static-screen_REF.gc b/test/decompiler/reference/jak1/levels/demo/static-screen_REF.gc index c882bf8001..87691f6a9f 100644 --- a/test/decompiler/reference/jak1/levels/demo/static-screen_REF.gc +++ b/test/decompiler/reference/jak1/levels/demo/static-screen_REF.gc @@ -170,16 +170,19 @@ (arg5 symbol) (arg6 process-tree) ) - (local-vars (sv-16 process)) - (set! sv-16 (get-process *default-dead-pool* static-screen #x4000)) - (the-as - (pointer static-screen) - (when sv-16 - (let ((t9-1 (method-of-type static-screen activate))) - (t9-1 (the-as static-screen sv-16) arg6 'static-screen (the-as pointer #x70004000)) + (let ((sv-16 (get-process *default-dead-pool* static-screen #x4000))) + (the-as + (pointer static-screen) + (when sv-16 + ((method-of-type static-screen activate) + (the-as static-screen sv-16) + arg6 + 'static-screen + (the-as pointer #x70004000) + ) + (run-now-in-process sv-16 static-screen-init-by-other arg0 arg1 arg2 arg3 arg4 arg5) + (-> sv-16 ppointer) ) - (run-now-in-process sv-16 static-screen-init-by-other arg0 arg1 arg2 arg3 arg4 arg5) - (-> sv-16 ppointer) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc b/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc index 35ceb8df8e..d1dc7746e1 100644 --- a/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc +++ b/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc @@ -374,7 +374,6 @@ (set-letterbox-frames (seconds 0.017)) ) :code (behavior ((arg0 basic) (arg1 handle)) - (local-vars (sv-144 process) (sv-160 vector) (sv-176 process) (sv-192 vector)) (let ((a0-2 (get-task-control (game-task finalboss-movies)))) (save-reminder a0-2 (logior (get-reminder a0-2 0) 2) 0) ) @@ -393,17 +392,20 @@ ) (dotimes (s2-0 50) (when (handle->process (the-as handle arg0)) - (let ((s1-0 (handle->process (the-as handle arg0))) - (s0-0 (+ s2-0 4)) - ) - (set! sv-160 - (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-0) node-list data s0-0)) - ) - (set! sv-144 (get-process *default-dead-pool* powercellalt #x4000)) + (let* ((s1-0 (handle->process (the-as handle arg0))) + (s0-0 (+ s2-0 4)) + (sv-160 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-0) node-list data s0-0)) + ) + (sv-144 (get-process *default-dead-pool* powercellalt #x4000)) + ) (when sv-144 - (let ((t9-16 (method-of-type powercellalt activate))) - (t9-16 (the-as powercellalt sv-144) s1-0 'powercellalt (the-as pointer #x70004000)) - ) + ((method-of-type powercellalt activate) + (the-as powercellalt sv-144) + s1-0 + 'powercellalt + (the-as pointer #x70004000) + ) (run-now-in-process sv-144 powercellalt-init-by-other s4-3 s3-1 sv-160 s0-0) (-> sv-144 ppointer) ) @@ -412,17 +414,20 @@ (suspend-for (seconds 0.1) ) (when (handle->process arg1) - (let ((s1-2 (handle->process arg1)) - (s0-1 (+ s2-0 4)) - ) - (set! sv-192 - (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-2) node-list data s0-1)) - ) - (set! sv-176 (get-process *default-dead-pool* powercellalt #x4000)) + (let* ((s1-2 (handle->process arg1)) + (s0-1 (+ s2-0 4)) + (sv-192 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-2) node-list data s0-1)) + ) + (sv-176 (get-process *default-dead-pool* powercellalt #x4000)) + ) (when sv-176 - (let ((t9-20 (method-of-type powercellalt activate))) - (t9-20 (the-as powercellalt sv-176) s1-2 'powercellalt (the-as pointer #x70004000)) - ) + ((method-of-type powercellalt activate) + (the-as powercellalt sv-176) + s1-2 + 'powercellalt + (the-as pointer #x70004000) + ) (run-now-in-process sv-176 powercellalt-init-by-other s4-3 s3-1 sv-192 s0-1) (-> sv-176 ppointer) ) diff --git a/test/decompiler/reference/jak1/levels/finalboss/robotboss-weapon_REF.gc b/test/decompiler/reference/jak1/levels/finalboss/robotboss-weapon_REF.gc index 158dcc8370..73d39c812f 100644 --- a/test/decompiler/reference/jak1/levels/finalboss/robotboss-weapon_REF.gc +++ b/test/decompiler/reference/jak1/levels/finalboss/robotboss-weapon_REF.gc @@ -36,7 +36,7 @@ (vector-flatten! s5-0 gp-0 (-> this axis)) (vector-normalize! s5-0 (-> this radius-primary)) (vector-! arg1 gp-0 s5-0) - (< (vector-length-squared arg1) (* f30-0 f30-0)) + (< (vector-length-squared arg1) (square f30-0)) ) ) @@ -78,7 +78,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod torus-method-9 ((this torus) (arg0 vector)) - (local-vars (sv-256 int) (sv-272 int) (sv-288 int)) (let ((s0-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) @@ -93,10 +92,11 @@ (vector-cross! s4-0 s0-0 (-> this axis)) (matrix-axis-angle! s2-0 s4-0 8192.0) (vector-float*! (-> s1-0 0) s0-0 (-> this radius-secondary)) - (set! sv-256 0) - (while (< sv-256 7) - (vector-matrix*! (-> s1-0 (+ sv-256 1)) (-> s1-0 sv-256) s2-0) - (set! sv-256 (+ sv-256 1)) + (let ((sv-256 0)) + (while (< sv-256 7) + (vector-matrix*! (-> s1-0 (+ sv-256 1)) (-> s1-0 sv-256) s2-0) + (+! sv-256 1) + ) ) (vector-float*! s0-0 s0-0 (-> this radius-primary)) (dotimes (v1-21 8) @@ -104,22 +104,24 @@ ) (matrix-axis-angle! s2-0 (-> this axis) 4096.0) (dotimes (s0-1 16) - (set! sv-272 0) - (while (< sv-272 7) - (vector+! s4-0 (-> s1-0 sv-272) (-> this origin)) - (vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> this origin)) - (camera-line s4-0 s3-0 (the-as vector4w arg0)) - (set! sv-272 (+ sv-272 1)) + (let ((sv-272 0)) + (while (< sv-272 7) + (vector+! s4-0 (-> s1-0 sv-272) (-> this origin)) + (vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> this origin)) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) + (+! sv-272 1) + ) ) (vector+! s4-0 (-> s1-0 0) (-> this origin)) (camera-line s4-0 s3-0 (the-as vector4w arg0)) - (set! sv-288 0) - (while (< sv-288 8) - (vector+! s4-0 (-> s1-0 sv-288) (-> this origin)) - (vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0) - (vector+! s3-0 (-> s1-0 sv-288) (-> this origin)) - (camera-line s4-0 s3-0 (the-as vector4w arg0)) - (set! sv-288 (+ sv-288 1)) + (let ((sv-288 0)) + (while (< sv-288 8) + (vector+! s4-0 (-> s1-0 sv-288) (-> this origin)) + (vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0) + (vector+! s3-0 (-> s1-0 sv-288) (-> this origin)) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) + (+! sv-288 1) + ) ) ) ) @@ -194,7 +196,7 @@ (let ((f0-6 (* -4.0 v1-2)) (f3-1 (* 4.0 v1-2 (- (-> arg1 y) (-> arg0 y)))) ) - (set! (-> self y-vel) (* 0.5 (- (sqrtf (- (* f0-6 f0-6) (* 4.0 f3-1))) f0-6))) + (set! (-> self y-vel) (* 0.5 (- (sqrtf (- (square f0-6) (* 4.0 f3-1))) f0-6))) ) (set! (-> self grav) (/ (- (* (-> self y-vel) (-> self y-vel))) (* 2.0 v1-2))) ) @@ -802,21 +804,21 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defbehavior redshot-init-by-other redshot ((arg0 vector) (arg1 vector) (arg2 float) (arg3 time-frame) (arg4 time-frame) (arg5 int)) - (local-vars (sv-16 collide-shape-prim-sphere)) (let ((s0-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) (set! (-> s0-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s0-0 reaction) default-collision-reaction) (set! (-> s0-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing) ) - (set! sv-16 (new 'process 'collide-shape-prim-sphere s0-0 (the-as uint 0))) - (set! (-> sv-16 prim-core collide-as) (collide-kind wall-object)) - (set! (-> sv-16 collide-with) (collide-kind target)) - (set! (-> sv-16 prim-core action) (collide-action solid)) - (set! (-> sv-16 prim-core offense) (collide-offense indestructible)) - (set! (-> sv-16 transform-index) 4) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 12288.0) - (set-root-prim! s0-0 sv-16) + (let ((sv-16 (new 'process 'collide-shape-prim-sphere s0-0 (the-as uint 0)))) + (set! (-> sv-16 prim-core collide-as) (collide-kind wall-object)) + (set! (-> sv-16 collide-with) (collide-kind target)) + (set! (-> sv-16 prim-core action) (collide-action solid)) + (set! (-> sv-16 prim-core offense) (collide-offense indestructible)) + (set! (-> sv-16 transform-index) 4) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 12288.0) + (set-root-prim! s0-0 sv-16) + ) (set! (-> s0-0 nav-radius) (* 0.75 (-> s0-0 root-prim local-sphere w))) (backup-collide-with-as s0-0) (set! (-> self root) s0-0) diff --git a/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc b/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc index cacd84dc18..54f71cdee6 100644 --- a/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc +++ b/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc @@ -1393,9 +1393,9 @@ ;; INFO: Used lq/sq ;; WARN: Stack slot load at 64 mismatch: defined as size 4, got size 16 (defbehavior robotboss-redshot robotboss ((arg0 redshot-launch-info) (arg1 symbol)) - (local-vars (sv-32 redshot-launch-info) (sv-48 vector) (sv-64 float) (sv-80 time-frame) (sv-96 time-frame)) - (set! sv-32 arg0) - (let ((s5-0 arg1)) + (let ((sv-32 arg0) + (s5-0 arg1) + ) (+! (-> self children-spawned) 1) (let ((gp-0 (new 'stack-no-clear 'vector))) (vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg red_ecoTip)) @@ -1404,35 +1404,32 @@ (let ((t9-2 (method-of-type redshot activate))) (t9-2 (the-as redshot s4-0) self 'redshot (the-as pointer #x70004000)) ) - (let ((s3-0 run-function-in-process) - (s2-0 s4-0) - (s1-0 redshot-init-by-other) - (s0-0 gp-0) - ) - (set! sv-48 (-> sv-32 dest)) - (let ((f30-0 20480.0) - (f28-0 12288.0) - ) - (set! sv-64 (+ f30-0 (* f28-0 (rand-float-gen)))) - ) - (set! sv-80 (-> sv-32 flight-time)) - (set! sv-96 (-> sv-32 stall-time)) - (let* ((f30-1 300.0) - (v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-20 (the-as number (logior #x3f800000 v1-19))) - (t3-0 (the int (* f30-1 (+ -1.0 (the-as float v1-20))))) - ) - ((the-as (function object object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-48 - sv-64 - sv-80 - sv-96 - t3-0 - ) - ) + (let* ((s3-0 run-function-in-process) + (s2-0 s4-0) + (s1-0 redshot-init-by-other) + (s0-0 gp-0) + (sv-48 (-> sv-32 dest)) + (f30-0 20480.0) + (f28-0 12288.0) + (v1-10 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-11 (the-as number (logior #x3f800000 v1-10))) + (sv-64 (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-11))))) + (sv-80 (-> sv-32 flight-time)) + (sv-96 (-> sv-32 stall-time)) + (f30-1 300.0) + (v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-20 (the-as number (logior #x3f800000 v1-19))) + ) + ((the-as (function object object object object object object object object none) s3-0) + s2-0 + s1-0 + s0-0 + sv-48 + sv-64 + sv-80 + sv-96 + (the int (* f30-1 (+ -1.0 (the-as float v1-20)))) + ) ) (-> s4-0 ppointer) ) diff --git a/test/decompiler/reference/jak1/levels/jungle/jungle-mirrors_REF.gc b/test/decompiler/reference/jak1/levels/jungle/jungle-mirrors_REF.gc index 911fac7375..666f4aeebe 100644 --- a/test/decompiler/reference/jak1/levels/jungle/jungle-mirrors_REF.gc +++ b/test/decompiler/reference/jak1/levels/jungle/jungle-mirrors_REF.gc @@ -712,7 +712,6 @@ ) ) :code (behavior () - (local-vars (sv-32 int) (sv-48 int)) (let* ((gp-0 (-> self change-event-from)) (f28-0 (the-as float (-> (the-as periscope (-> gp-0 0)) tilt))) (f30-0 (the-as float (-> (the-as periscope (-> gp-0 0)) turn))) @@ -741,28 +740,15 @@ ) (set! (-> s5-0 y) (- (-> s5-0 y) (* 136.53334 (- f26-0)))) (set! (-> s5-0 x) (- (-> s5-0 x) (* 136.53334 (- f0-0)))) - (cond - ((and (= f26-0 0.0) (= f0-0 0.0)) - (sound-stop (-> (the-as periscope (-> gp-0 0)) sound-id)) - ) - (else - (let ((s4-0 sound-play-by-name) - (s3-0 (make-u128 101 (the-as uint #x706f6373656c6574))) - (s2-0 (-> (the-as periscope (-> gp-0 0)) sound-id)) - (s1-0 1024) - (s0-0 0) - ) - (set! sv-32 0) - (set! sv-48 1) - (let ((t2-0 (target-pos 0))) - (the-as - int - (s4-0 (the-as sound-name s3-0) s2-0 s1-0 s0-0 sv-32 (the-as sound-group sv-48) (the-as symbol t2-0)) - ) - ) - ) + (if (and (= f26-0 0.0) (= f0-0 0.0)) + (sound-stop (-> (the-as periscope (-> gp-0 0)) sound-id)) + (the-as int (sound-play + "telescope" + :id (-> (the-as periscope (-> gp-0 0)) sound-id) + :position (the-as symbol (target-pos 0)) + ) + ) ) - ) ) ) (cond @@ -1129,19 +1115,19 @@ ;; definition for function periscope-test-task-complete? (defbehavior periscope-test-task-complete? periscope () - (local-vars (sv-16 symbol)) - (set! sv-16 #t) - (apply-all - (-> self link) - (lambda ((arg0 entity-actor) (arg1 (pointer symbol))) - (when (and (= (-> arg0 etype) periscope) (not (logtest? (-> arg0 extra perm status) (entity-perm-status complete)))) - (set! (-> arg1 0) #f) - #t + (let ((sv-16 #t)) + (apply-all + (-> self link) + (lambda ((arg0 entity-actor) (arg1 (pointer symbol))) + (when (and (= (-> arg0 etype) periscope) (not (logtest? (-> arg0 extra perm status) (entity-perm-status complete)))) + (set! (-> arg1 0) #f) + #t + ) ) + (& sv-16) ) - (& sv-16) + sv-16 ) - sv-16 ) ;; definition for function peri-beamcam-init-by-other diff --git a/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc b/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc index c846be0b2c..d1026765c1 100644 --- a/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc @@ -440,7 +440,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this lurkerm-piston) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (logior! (-> this mask) (process-mask platform)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -468,21 +467,22 @@ (logior! (-> this skel status) (janim-status inited)) (update-transforms! (-> this root)) (set! (-> this base quad) (-> this root trans quad)) - (let ((f30-0 (-> this base y))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-32 (res-lump-data arg0 'height-info pointer :tag-ptr (& sv-16)))) - (set! (-> this base y) (+ f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) - (-> (the-as (pointer float) v1-32)) - 0.0 - ) - ) - ) - ) + (let* ((f30-0 (-> this base y)) + (sv-16 (new 'static 'res-tag)) + (v1-32 (res-lump-data arg0 'height-info pointer :tag-ptr (& sv-16))) + ) + (set! (-> this base y) (+ f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) + (-> (the-as (pointer float) v1-32)) + 0.0 + ) + ) + ) ) (let ((s4-1 (-> this height))) (set! (-> s4-1 x) 0.0) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-35 (res-lump-data arg0 'height-info (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-35 (res-lump-data arg0 'height-info (pointer float) :tag-ptr (& sv-32))) + ) (set! (-> s4-1 y) (if (and v1-35 (< 1 (the-as int (-> sv-32 elt-count)))) (-> v1-35 1) 20480.0 diff --git a/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc b/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc index 5648f43f8f..030993735f 100644 --- a/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc +++ b/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc @@ -114,7 +114,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this plat-flip) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (logior! (-> this mask) (process-mask platform)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -140,27 +139,27 @@ (set! (-> this base-pos quad) (-> this root trans quad)) (initialize-skeleton this *plat-flip-sg* '()) (logior! (-> this skel status) (janim-status inited)) - (let ((f30-0 300.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16)))) - (set! (-> this before-turn-down-time) (* f30-0 (if (and v1-28 (> (the-as int (-> sv-16 elt-count)) 0)) - (-> (the-as (pointer float) v1-28)) - 2.0 - ) - ) - ) - ) - ) - (let ((f30-1 300.0)) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-31 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-32)))) - (set! (-> this before-turn-up-time) (* f30-1 (if (and v1-31 (< 1 (the-as int (-> sv-32 elt-count)))) - (-> (the-as (pointer float) v1-31) 1) - 0.2 + (let* ((f30-0 300.0) + (sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16))) + ) + (set! (-> this before-turn-down-time) (* f30-0 (if (and v1-28 (> (the-as int (-> sv-16 elt-count)) 0)) + (-> (the-as (pointer float) v1-28)) + 2.0 ) ) - ) - ) + ) + ) + (let* ((f30-1 300.0) + (sv-32 (new 'static 'res-tag)) + (v1-31 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-32))) + ) + (set! (-> this before-turn-up-time) (* f30-1 (if (and v1-31 (< 1 (the-as int (-> sv-32 elt-count)))) + (-> (the-as (pointer float) v1-31) 1) + 0.2 + ) + ) + ) ) (set! (-> this turn-down-time) 300.0) (set! (-> this turn-up-time) 300.0) @@ -170,22 +169,21 @@ (-> this turn-up-time) ) ) - (let ((s4-1 (-> this sync)) - (s3-1 (method-of-type sync-info setup-params!)) - (s2-0 (the int (-> this total-time))) - ) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-35 (res-lump-data arg0 'sync-percent pointer :tag-ptr (& sv-48)))) - (s3-1 - s4-1 - (the-as uint s2-0) - (if (and v1-35 (> (the-as int (-> sv-48 elt-count)) 0)) - (-> (the-as (pointer float) v1-35) 0) - 0.0 - ) - 0.15 - 0.15 - ) + (let* ((s4-1 (-> this sync)) + (s3-1 (method-of-type sync-info setup-params!)) + (s2-0 (the int (-> this total-time))) + (sv-48 (new 'static 'res-tag)) + (v1-35 (res-lump-data arg0 'sync-percent pointer :tag-ptr (& sv-48))) + ) + (s3-1 + s4-1 + (the-as uint s2-0) + (if (and v1-35 (> (the-as int (-> sv-48 elt-count)) 0)) + (-> (the-as (pointer float) v1-35) 0) + 0.0 + ) + 0.15 + 0.15 ) ) (update-transforms! (-> this root)) diff --git a/test/decompiler/reference/jak1/levels/lavatube/lavatube-obs_REF.gc b/test/decompiler/reference/jak1/levels/lavatube/lavatube-obs_REF.gc index 577d0af0a7..e552c74cac 100644 --- a/test/decompiler/reference/jak1/levels/lavatube/lavatube-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/lavatube/lavatube-obs_REF.gc @@ -776,7 +776,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this darkecobarrel) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this root) (the-as collide-shape-moving (new 'process 'trsqv))) (darkecobarrel-base-init arg0) (set! (-> this sound) @@ -784,8 +783,9 @@ ) (logior! (-> this draw status) (draw-status hidden)) (set! (-> this speed) (/ 300.0 (res-lump-float (-> this entity) 'speed :default 61440.0))) - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-1 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-1 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16))) + ) (cond (s5-1 (set! (-> this spawn-array) (new 'process 'boxed-array time-frame (the-as int (-> sv-16 elt-count)))) diff --git a/test/decompiler/reference/jak1/levels/maincave/driller-lurker_REF.gc b/test/decompiler/reference/jak1/levels/maincave/driller-lurker_REF.gc index 7344e30623..0b9e2fcfee 100644 --- a/test/decompiler/reference/jak1/levels/maincave/driller-lurker_REF.gc +++ b/test/decompiler/reference/jak1/levels/maincave/driller-lurker_REF.gc @@ -236,7 +236,6 @@ ;; definition for function driller-lurker-default-event-handler ;; INFO: Used lq/sq (defbehavior driller-lurker-default-event-handler driller-lurker ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (sv-96 collide-shape-prim)) (cond ((= arg2 'attack) (cond @@ -269,15 +268,16 @@ (s0-0 (-> s1-0 head)) ) (while s0-0 - (set! sv-96 (get-touched-prim s0-0 (-> self root-overeride) s1-0)) - (if (and (logtest? (-> (get-touched-prim s0-0 (-> s4-0 control) s1-0) prim-core action) (collide-action solid)) - (logtest? (-> sv-96 prim-id) 1) - ) - (set! s2-0 #t) - ) - (if (logtest? (-> sv-96 prim-id) 2) - (set! s3-0 #t) - ) + (let ((sv-96 (get-touched-prim s0-0 (-> self root-overeride) s1-0))) + (if (and (logtest? (-> (get-touched-prim s0-0 (-> s4-0 control) s1-0) prim-core action) (collide-action solid)) + (logtest? (-> sv-96 prim-id) 1) + ) + (set! s2-0 #t) + ) + (if (logtest? (-> sv-96 prim-id) 2) + (set! s3-0 #t) + ) + ) (set! s0-0 (-> s0-0 next)) ) ) @@ -1004,7 +1004,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this driller-lurker) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this hit-player?) #f) (set! (-> this played-drill-sound?) #f) (set! (-> this hit-player-time) 0) @@ -1109,7 +1108,8 @@ (set! (-> this path-speed) 15360.0) (set! (-> this targ-path-speed) 15360.0) (set! (-> this up-blend) 0.0) - (set! sv-16 (new 'static 'res-tag)) + (let ((sv-16 (new 'static 'res-tag))) + ) (let ((v1-91 (res-lump-data arg0 diff --git a/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc b/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc index 3bc2dbb476..064ebf1b19 100644 --- a/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc +++ b/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc @@ -479,7 +479,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod gnawer-method-24 ((this gnawer)) - (local-vars (sv-48 vector) (sv-64 vector)) (let ((s5-0 0) (s4-0 0) ) @@ -496,15 +495,17 @@ (set! s0-0 (mod (+ s1-0 1) s3-0)) ) ) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (eval-path-curve-div! (-> this path) sv-48 (the float s1-0) 'interp) - (eval-path-curve-div! (-> this path) sv-64 (the float s0-0) 'interp) - (let ((f0-4 (vector-vector-distance sv-48 sv-64))) - (when (< f30-0 f0-4) - (set! f30-0 f0-4) - (set! s5-0 s1-0) - (set! s4-0 s0-0) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-64 (new 'stack-no-clear 'vector)) + ) + (eval-path-curve-div! (-> this path) sv-48 (the float s1-0) 'interp) + (eval-path-curve-div! (-> this path) sv-64 (the float s0-0) 'interp) + (let ((f0-4 (vector-vector-distance sv-48 sv-64))) + (when (< f30-0 f0-4) + (set! f30-0 f0-4) + (set! s5-0 s1-0) + (set! s4-0 s0-0) + ) ) ) ) @@ -565,7 +566,7 @@ ) (set-vector! (-> this route surface-dir) f30-5 f28-0 0.0 1.0) (vector-normalize! (-> this route surface-dir) 1.0) - (let ((f0-25 (sqrtf (+ (* f30-5 f30-5) (* f28-0 f28-0))))) + (let ((f0-25 (sqrtf (+ (square f30-5) (square f28-0))))) (set! (-> this route surface-dist) f0-25) (set! (-> this route total-dist) (+ 20480.0 f0-25)) ) @@ -620,7 +621,7 @@ (let* ((f0-10 (- (-> s4-0 max x) (-> this root trans x))) (f1-12 (- (-> s4-0 max y) (-> this root trans y))) (f2-7 (- (-> s4-0 max z) (-> this root trans z))) - (f0-14 (sqrtf (+ (* f0-10 f0-10) (* f1-12 f1-12) (* f2-7 f2-7)))) + (f0-14 (sqrtf (+ (square f0-10) (square f1-12) (square f2-7)))) (a0-3 (-> this draw bounds)) (v1-21 (-> this root root-prim)) (f0-15 (+ 12288.0 f0-14)) @@ -837,7 +838,6 @@ ;; definition for method 30 of type gnawer ;; INFO: Used lq/sq (defmethod gnawer-method-30 ((this gnawer) (arg0 process-drawable)) - (local-vars (sv-48 vector)) (let ((gp-0 (-> this entity extra perm))) (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage)) (let ((s5-0 (-> gp-0 user-uint16 0)) @@ -848,17 +848,15 @@ ) (dotimes (s0-0 s1-0) (when (logtest? (ash 1 s0-0) s5-0) - (let ((a2-0 (new 'stack-no-clear 'vector))) - (set! sv-48 (new 'stack-no-clear 'vector)) + (let ((a2-0 (new 'stack-no-clear 'vector)) + (sv-48 (new 'stack-no-clear 'vector)) + ) (gnawer-method-29 this s0-0 a2-0 sv-48) - ) - (let* ((t9-1 vector-vector-xz-distance) - (a1-2 (-> arg0 root trans)) - (f0-0 (t9-1 sv-48 a1-2)) - ) - (when (or (< s2-0 0) (< f0-0 f30-0)) - (set! s2-0 s0-0) - (set! f30-0 f0-0) + (let ((f0-0 (vector-vector-xz-distance sv-48 (-> arg0 root trans)))) + (when (or (< s2-0 0) (< f0-0 f30-0)) + (set! s2-0 s0-0) + (set! f30-0 f0-0) + ) ) ) ) @@ -1180,7 +1178,6 @@ (spool-push *art-control* "maincavecam-gnawer-fuel-cell" 0 self -1.0) ) :code (behavior () - (local-vars (sv-128 symbol)) (clear-collide-with-as (-> self root)) (set! (-> self skel postbind-function) #f) (ja-channel-set! 0) @@ -1218,11 +1215,12 @@ (suspend) ) ) - (set! sv-128 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) - (when sv-128 - (save-reminder (get-task-control (game-task cave-gnawers)) (-> self gnawer-id) 3) - (go gnawer-give-fuel-cell) + (let ((sv-128 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) + (when sv-128 + (save-reminder (get-task-control (game-task cave-gnawers)) (-> self gnawer-id) 3) + (go gnawer-give-fuel-cell) + ) ) (set! (-> self trans-hook) #f) (process-entity-status! self (entity-perm-status bit-3) #f) @@ -1409,7 +1407,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this gnawer) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (set! (-> this hidden?) #f) (set! (-> this show-damage?) #f) (set! (-> this hit-points) 6) @@ -1501,8 +1498,9 @@ (quaternion-rotate-y! (-> this root quat) (-> this root quat) f0-40) ) (+! (-> this root trans y) -2048.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-81 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-81 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-81 (+! (-> this root trans x) (-> v1-81 0)) (+! (-> this root trans y) (-> v1-81 1)) @@ -1517,8 +1515,9 @@ (set! (-> this part2) (create-launch-control group-gnawer-crumbs this)) (set! (-> this total-money) 0) (set! (-> this money-mask) (the-as uint 0)) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-96 (res-lump-data arg0 'extra-count (pointer int32) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-96 (res-lump-data arg0 'extra-count (pointer int32) :tag-ptr (& sv-32))) + ) (when v1-96 (case (-> v1-96 0) ((5) @@ -1528,8 +1527,9 @@ ) ) (when (> (-> this total-money) 0) - (set! sv-48 (new 'static 'res-tag)) - (let ((a0-49 (res-lump-data arg0 'gnawer (pointer int32) :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (a0-49 (res-lump-data arg0 'gnawer (pointer int32) :tag-ptr (& sv-48))) + ) (cond (a0-49 (let ((v1-100 0)) diff --git a/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc b/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc index 36e81e7731..f320e562d4 100644 --- a/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc @@ -558,7 +558,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this caveflamepots) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (set! (-> this was-deadly?) #f) (set! (-> this should-play-sound?) #f) (set! (-> this shove-up) (res-lump-float arg0 'shove :default 8192.0)) @@ -643,43 +642,43 @@ ) ) (update-transforms! (-> this root)) - (let ((f30-1 300.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-70 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16)))) - (set! (-> this cycle-speed) (the int (* f30-1 (if (and v1-70 (> (the-as int (-> sv-16 elt-count)) 0)) - (-> v1-70 0) - 4.0 - ) - ) - ) - ) - ) - ) - (let ((f30-2 (the float (-> this cycle-speed)))) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-74 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-32)))) - (set! (-> this cycle-offset) - (the-as uint (the int (* f30-2 (if (and v1-74 (< 1 (the-as int (-> sv-32 elt-count)))) - (-> v1-74 1) - 0.0 - ) + (let* ((f30-1 300.0) + (sv-16 (new 'static 'res-tag)) + (v1-70 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) + (set! (-> this cycle-speed) (the int (* f30-1 (if (and v1-70 (> (the-as int (-> sv-16 elt-count)) 0)) + (-> v1-70 0) + 4.0 + ) + ) ) - ) - ) - ) - ) + ) ) - (let ((f30-3 300.0)) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-77 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-48)))) - (set! (-> this cycle-pause) (the int (* f30-3 (if (and v1-77 (< 2 (the-as int (-> sv-48 elt-count)))) - (-> v1-77 2) - 2.0 - ) - ) - ) - ) - ) + (let* ((f30-2 (the float (-> this cycle-speed))) + (sv-32 (new 'static 'res-tag)) + (v1-74 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-32))) + ) + (set! (-> this cycle-offset) + (the-as uint (the int (* f30-2 (if (and v1-74 (< 1 (the-as int (-> sv-32 elt-count)))) + (-> v1-74 1) + 0.0 + ) + ) + ) + ) + ) + ) + (let* ((f30-3 300.0) + (sv-48 (new 'static 'res-tag)) + (v1-77 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-48))) + ) + (set! (-> this cycle-pause) (the int (* f30-3 (if (and v1-77 (< 2 (the-as int (-> sv-48 elt-count)))) + (-> v1-77 2) + 2.0 + ) + ) + ) + ) ) (go caveflamepots-active) (none) @@ -1203,7 +1202,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this caveelevator) (arg0 entity-actor)) - (local-vars (v1-43 int) (sv-16 res-tag)) + (local-vars (v1-43 int)) (set! (-> this prev-frame-num) 10000.0) (set! (-> this last-update-bounce-time) 0) (logior! (-> this mask) (process-mask platform)) @@ -1231,8 +1230,9 @@ (initialize-skeleton this *caveelevator-sg* '()) (logior! (-> this skel status) (janim-status inited)) (set! (-> this skel postbind-function) caveelevator-joint-callback) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-28 (+! (-> this root trans x) (-> v1-28 0)) (+! (-> this root trans y) (-> v1-28 1)) diff --git a/test/decompiler/reference/jak1/levels/maincave/mother-spider_REF.gc b/test/decompiler/reference/jak1/levels/maincave/mother-spider_REF.gc index 234e5ede04..9534725d71 100644 --- a/test/decompiler/reference/jak1/levels/maincave/mother-spider_REF.gc +++ b/test/decompiler/reference/jak1/levels/maincave/mother-spider_REF.gc @@ -506,7 +506,6 @@ ;; definition for method 21 of type mother-spider ;; INFO: Used lq/sq (defmethod mother-spider-method-21 ((this mother-spider) (arg0 vector) (arg1 float) (arg2 symbol)) - (local-vars (sv-112 process) (sv-128 vector) (sv-144 vector)) (let ((f30-0 (vector-length (-> this swing-pos)))) (when (< 0.0 f30-0) (let ((s1-0 (new 'stack-no-clear 'vector)) @@ -543,9 +542,10 @@ (logior! (-> this leg-socket-part-mask) (ash 1 s4-1)) (set-time! (-> this leg-socket-part-time s4-1)) (let ((s1-1 (-> *mother-spider-leg-infos* s4-1))) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! sv-144 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (sv-128 (new 'stack-no-clear 'vector)) + (sv-144 (new 'stack-no-clear 'vector)) + ) (vector<-cspace! s0-0 (-> this node-list data (-> s1-1 joint-index0))) (vector<-cspace! sv-128 (-> this node-list data (-> s1-1 joint-index1))) (vector-! sv-128 sv-128 s0-0) @@ -554,13 +554,17 @@ (vector-normalize! sv-144 1.0) (+! (-> sv-144 y) (rand-vu-float-range 0.0 0.3)) (vector-normalize! sv-144 1.0) - (set! sv-112 (get-process *default-dead-pool* mother-spider-leg #x4000)) - (when sv-112 - (let ((t9-15 (method-of-type mother-spider-leg activate))) - (t9-15 (the-as mother-spider-leg sv-112) this 'mother-spider-leg (the-as pointer #x70004000)) + (let ((sv-112 (get-process *default-dead-pool* mother-spider-leg #x4000))) + (when sv-112 + ((method-of-type mother-spider-leg activate) + (the-as mother-spider-leg sv-112) + this + 'mother-spider-leg + (the-as pointer #x70004000) + ) + (run-now-in-process sv-112 mother-spider-leg-init-by-other this s0-0 sv-128 sv-144) + (-> sv-112 ppointer) ) - (run-now-in-process sv-112 mother-spider-leg-init-by-other this s0-0 sv-128 sv-144) - (-> sv-112 ppointer) ) ) (let ((v1-43 (-> (the-as collide-shape-prim-group s3-1) prims (-> s1-1 cprim-index)))) @@ -1640,7 +1644,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this mother-spider) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-64 vector)) (set! (-> this baby-count) 0) (set! (-> this spit-counter) 0) (set! (-> this leg-socket-part-mask) 0) @@ -1781,8 +1784,9 @@ (set! (-> this max-swing-radius) 73728.0) (set! (-> this max-baby-count) 4) (let ((s4-1 #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-31 (res-lump-data arg0 'mother-spider pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-31 (res-lump-data arg0 'mother-spider pointer :tag-ptr (& sv-16))) + ) (cond (v0-31 (+! (-> this thread-min-trans y) (-> (the-as (pointer float) v0-31) 0)) @@ -1849,14 +1853,7 @@ (eval-path-curve-div! (-> this path) s4-2 (the float s2-9) 'interp) (vector-! s3-1 (target-pos 0) s4-2) (set! (-> s3-1 y) 0.0) - (let ((s1-2 vector-rotate-around-y!) - (s0-0 s3-1) - ) - (set! sv-64 s3-1) - (let ((a2-21 (rand-vu-float-range -7281.778 7281.778))) - (s1-2 s0-0 sv-64 a2-21) - ) - ) + (vector-rotate-around-y! s3-1 s3-1 (rand-vu-float-range -7281.778 7281.778)) (vector-normalize! s3-1 1.0) (spawn-child this s4-2 s3-1 #f) ) diff --git a/test/decompiler/reference/jak1/levels/misty/balloonlurker_REF.gc b/test/decompiler/reference/jak1/levels/misty/balloonlurker_REF.gc index 178752306d..aa43ed783a 100644 --- a/test/decompiler/reference/jak1/levels/misty/balloonlurker_REF.gc +++ b/test/decompiler/reference/jak1/levels/misty/balloonlurker_REF.gc @@ -827,37 +827,38 @@ (set! (-> self dead) #t) ) :code (behavior () - (local-vars (v1-27 symbol) (sv-16 symbol) (sv-20 (pointer process-tree)) (sv-24 entity-actor)) + (local-vars (v1-27 symbol)) (process-entity-status! self (entity-perm-status bit-4) #t) (process-entity-status! self (entity-perm-status dead) #t) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (set! sv-20 (-> self child)) - (set! sv-24 (entity-actor-lookup (-> self entity) 'alt-actor 0)) - (entity-birth-no-kill sv-24) - (apply-all (-> self link) actor-link-dead-hook (& sv-16)) - (when (and sv-16 sv-24) - (process-grab? *target*) - (suspend-for (seconds 1) + (let ((sv-16 (the-as symbol #f))) + (let ((sv-20 (-> self child))) ) - (process-release? *target*) - (while (let ((a1-4 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-4 from) self) - (set! (-> a1-4 num-params) 0) - (set! (-> a1-4 message) 'task-complete) - (let ((t9-7 send-event-function) - (v1-17 sv-24) - ) - (not (t9-7 - (if v1-17 - (-> v1-17 extra process) + (let ((sv-24 (entity-actor-lookup (-> self entity) 'alt-actor 0))) + (entity-birth-no-kill sv-24) + (apply-all (-> self link) actor-link-dead-hook (& sv-16)) + (when (and sv-16 sv-24) + (process-grab? *target*) + (suspend-for (seconds 1) + ) + (process-release? *target*) + (while (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) self) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'task-complete) + (let ((v1-17 sv-24)) + (not (send-event-function + (if v1-17 + (-> v1-17 extra process) + ) + a1-4 ) - a1-4 - ) - ) - ) - ) - (suspend) + ) + ) + ) + (suspend) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc b/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc index 281172af8c..aa67e3dbae 100644 --- a/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc +++ b/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc @@ -253,7 +253,6 @@ (defstate keg-on-path (keg) :event keg-event-handler :code (behavior () - (local-vars (sv-48 float) (sv-64 float) (sv-80 float) (sv-96 float) (sv-112 float)) (let ((gp-0 (new-stack-vector0)) (s5-0 (new 'stack 'vector3s)) ) @@ -268,90 +267,92 @@ (/ 1.0 f24-0) (let ((f22-0 1.0) (f20-0 2.5) + (sv-48 0.0) + (sv-64 0.0) + (sv-80 (- (-> *standard-dynamics* gravity-length))) ) - (set! sv-48 0.0) - (set! sv-64 0.0) - (set! sv-80 (- (-> *standard-dynamics* gravity-length))) (loop - (let ((f0-13 (+ (get-current-phase (-> (the-as keg-conveyor-paddle (-> self parent 0)) sync)) f26-1))) - (set! sv-96 (- f0-13 (the float (the int f0-13)))) - ) - (if (< sv-96 f30-0) - (go keg-in-chute) - ) - (set! f30-0 sv-96) - (set! sv-112 (* sv-96 f28-0)) - (eval-path-curve-div! - (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) - (-> self path-position) - sv-112 - 'interp - ) - (path-control-method-12 (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) gp-0 sv-112) - (seek-toward-heading-vec! (-> self root) gp-0 131072.0 (seconds 0.1)) - (set! (-> self root trans quad) (-> self path-position quad)) - (when (= (-> self keg-behavior) 1) - (cond - ((>= (vector4-dot (camera-pos) (-> self shadow-enable-plane)) 0.0) - (let ((v1-32 (-> self draw shadow-ctrl))) - (logclear! (-> v1-32 settings flags) (shadow-flags disable-draw)) + (let* ((f0-13 (+ (get-current-phase (-> (the-as keg-conveyor-paddle (-> self parent 0)) sync)) f26-1)) + (sv-96 (- f0-13 (the float (the int f0-13)))) ) - 0 - (let ((v1-35 (-> self draw shadow-ctrl))) - (set! (-> v1-35 settings top-plane w) (- (-> self path-position y))) - ) - 0 - (let ((v1-38 (-> self draw shadow-ctrl))) - (set! (-> v1-38 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))) - ) - 0 - ) - (else - (let ((v1-41 (-> self draw shadow-ctrl))) - (logior! (-> v1-41 settings flags) (shadow-flags disable-draw)) + (if (< sv-96 f30-0) + (go keg-in-chute) + ) + (set! f30-0 sv-96) + (let ((sv-112 (* sv-96 f28-0))) + (eval-path-curve-div! + (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) + (-> self path-position) + sv-112 + 'interp + ) + (path-control-method-12 (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) gp-0 sv-112) + (seek-toward-heading-vec! (-> self root) gp-0 131072.0 (seconds 0.1)) + (set! (-> self root trans quad) (-> self path-position quad)) + (when (= (-> self keg-behavior) 1) + (cond + ((>= (vector4-dot (camera-pos) (-> self shadow-enable-plane)) 0.0) + (let ((v1-32 (-> self draw shadow-ctrl))) + (logclear! (-> v1-32 settings flags) (shadow-flags disable-draw)) + ) + 0 + (let ((v1-35 (-> self draw shadow-ctrl))) + (set! (-> v1-35 settings top-plane w) (- (-> self path-position y))) + ) + 0 + (let ((v1-38 (-> self draw shadow-ctrl))) + (set! (-> v1-38 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))) + ) + 0 + ) + (else + (let ((v1-41 (-> self draw shadow-ctrl))) + (logior! (-> v1-41 settings flags) (shadow-flags disable-draw)) + ) + 0 + (let ((v1-44 (-> self draw shadow-ctrl))) + (set! (-> v1-44 settings top-plane w) (- (-> self path-position y))) + ) + 0 + (let ((v1-47 (-> self draw shadow-ctrl))) + (set! (-> v1-47 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))) + ) + 0 + ) ) - 0 - (let ((v1-44 (-> self draw shadow-ctrl))) - (set! (-> v1-44 settings top-plane w) (- (-> self path-position y))) + (let ((f0-32 (- f28-0 sv-112))) + (if (< f0-32 f20-0) + (set! f22-0 (/ f0-32 f20-0)) + ) ) - 0 - (let ((v1-47 (-> self draw shadow-ctrl))) - (set! (-> v1-47 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))) + (+! sv-64 (* sv-80 (seconds-per-frame))) + (+! sv-48 (* sv-64 (seconds-per-frame))) + (when (< sv-48 0.0) + (set! sv-48 0.0) + (activate! (-> self smush) -0.15 90 150 1.0 1.0) + (set! sv-64 f24-0) + (sound-play "barrel-bounce" :vol 80) + (process-spawn + part-tracker + :init part-tracker-init + group-keg-bounce + -1 + keg-bounce-set-particle-rotation-callback + (-> self ppointer) + #f + (-> self root trans) + :to self + ) ) - 0 + (let ((f0-39 (update! (-> self smush)))) + (keg-update-smush self f0-39) + ) + (+! (-> self root trans y) (* f22-0 sv-48)) + (set! (-> s5-0 x) 0.0) + (set! (-> s5-0 y) 1.0) + (set! (-> s5-0 z) 0.0) ) ) - (let ((f0-32 (- f28-0 sv-112))) - (if (< f0-32 f20-0) - (set! f22-0 (/ f0-32 f20-0)) - ) - ) - (set! sv-64 (+ sv-64 (* sv-80 (seconds-per-frame)))) - (set! sv-48 (+ sv-48 (* sv-64 (seconds-per-frame)))) - (when (< sv-48 0.0) - (set! sv-48 0.0) - (activate! (-> self smush) -0.15 90 150 1.0 1.0) - (set! sv-64 f24-0) - (sound-play "barrel-bounce" :vol 80) - (process-spawn - part-tracker - :init part-tracker-init - group-keg-bounce - -1 - keg-bounce-set-particle-rotation-callback - (-> self ppointer) - #f - (-> self root trans) - :to self - ) - ) - (let ((f0-39 (update! (-> self smush)))) - (keg-update-smush self f0-39) - ) - (+! (-> self root trans y) (* f22-0 sv-48)) - (set! (-> s5-0 x) 0.0) - (set! (-> s5-0 y) 1.0) - (set! (-> s5-0 z) 0.0) ) (ja :num! (loop!)) (suspend) diff --git a/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc b/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc index ab1c050c3a..50c4c894c9 100644 --- a/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc +++ b/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc @@ -1354,7 +1354,7 @@ (f0-3 f1-3) (f30-0 (- (* arg2 arg1 arg1))) (f2-6 (+ f1-3 (* arg1 arg1 arg3))) - (f1-5 (- (* f30-0 f30-0) (* 4.0 f2-6 f0-3))) + (f1-5 (- (square f30-0) (* 4.0 f2-6 f0-3))) (f28-0 (/ 0.5 f0-3)) ) (if (< f1-5 0.0) @@ -1769,7 +1769,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this mistycannon) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (logior! (-> this mask) (process-mask enemy)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-others)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -1838,24 +1837,27 @@ (set! (-> this center-point w) (-> this fact idle-distance)) ) (else - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-64 (res-lump-data arg0 'center-point pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-64 (res-lump-data arg0 'center-point pointer :tag-ptr (& sv-16))) + ) (set! (-> this center-point x) (if (and v1-64 (< 0.0 (the float (-> sv-16 elt-count)))) (-> (the-as (pointer float) v1-64)) 0.0 ) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-67 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-67 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-32))) + ) (set! (-> this center-point y) (if (and v1-67 (< 1.0 (the float (-> sv-32 elt-count)))) (-> v1-67 1) 0.0 ) ) ) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-70 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-70 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-48))) + ) (set! (-> this center-point z) (if (and v1-70 (< 2.0 (the float (-> sv-48 elt-count)))) (-> v1-70 2) 0.0 diff --git a/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc b/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc index 1396193698..7189f4d90e 100644 --- a/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc +++ b/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc @@ -1538,12 +1538,9 @@ ) ) ) - (let* ((gp-0 (the int (* (-> self difficulty) (+ 8.0 (* 4.0 (-> self level)))))) - (f0-17 1.0) - (f1-2 0.15) - (f2-2 (-> self difficulty)) - (f30-0 (+ f0-17 (* f1-2 (* f2-2 f2-2) (-> self level)))) - ) + (let ((gp-0 (the int (* (-> self difficulty) (+ 8.0 (* 4.0 (-> self level)))))) + (f30-0 (+ 1.0 (* 0.15 (square (-> self difficulty)) (-> self level)))) + ) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! ogreboss-attack2-start-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) diff --git a/test/decompiler/reference/jak1/levels/racer_common/collide-reaction-racer_REF.gc b/test/decompiler/reference/jak1/levels/racer_common/collide-reaction-racer_REF.gc index ef250c41d9..e0d1e6ceb1 100644 --- a/test/decompiler/reference/jak1/levels/racer_common/collide-reaction-racer_REF.gc +++ b/test/decompiler/reference/jak1/levels/racer_common/collide-reaction-racer_REF.gc @@ -5,188 +5,189 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs cshape-moving-flags. (defun racer-collision-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) - (local-vars (sv-80 vector) (sv-84 vector) (sv-88 (inline-array vector)) (sv-96 int) (sv-104 int)) - (set! sv-80 (new-stack-vector0)) - (set! sv-84 (new-stack-vector0)) - (let ((v1-2 (new 'stack-no-clear 'inline-array 'vector 2))) + (let ((sv-80 (new-stack-vector0)) + (sv-84 (new-stack-vector0)) + (v1-2 (new 'stack-no-clear 'inline-array 'vector 2)) + ) (dotimes (a0-1 2) (set! (-> v1-2 a0-1 quad) (the-as uint128 0)) ) - (set! sv-88 v1-2) - ) - (set! sv-96 0) - (set! sv-104 0) - (set! (-> sv-88 0 quad) (-> arg3 quad)) - (set! (-> sv-88 1 quad) (-> arg3 quad)) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) - (move-by-vector! arg0 a1-3) - ) - (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) - (if (= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! sv-104 (logior sv-104 1)) - ) - (if (= (-> arg0 unknown-surface00 mode) 'air) - (set! sv-104 (logior sv-104 32)) - ) - (let ((v1-21 (new 'stack-no-clear 'vector))) - (set! (-> v1-21 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) - (vector-! sv-80 v1-21 (-> arg1 best-tri intersect)) - ) - (vector-normalize! sv-80 1.0) - (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) - (when (< (-> arg0 coverage) 0.0) - (set! (-> arg0 coverage) 0.0) - (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) - (vector-normalize! sv-80 1.0) - ) - (if (< (-> arg0 coverage) 0.9999) - (set! sv-104 (logior sv-104 24)) - ) - (let ((v1-31 (-> sv-80 quad))) - (set! (-> sv-84 quad) v1-31) - ) - (if (= (-> arg1 best-u) 0.0) - (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) - ) - (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) - (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 0)) - (if (< (-> arg0 poly-angle) -0.2) - (set! sv-96 (logior sv-96 16)) - ) - (let ((s3-1 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) - (if s3-1 - (set! sv-104 (logior sv-104 2)) - ) - (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) - (set! sv-96 (logior sv-96 2048)) - (when (not s3-1) - (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) - (when (< f30-0 1.0) - (let ((s2-1 (new-stack-vector0)) - (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 0))) - ) - 0.0 - (vector-! s2-1 (-> sv-88 0) (vector-float*! s2-1 (-> arg0 dynam gravity-normal) f28-0)) - (let* ((f0-18 (vector-length s2-1)) - (f1-6 f0-18) - ) - (if (< f28-0 0.0) - (set! f28-0 (* f28-0 f30-0)) - ) - (vector+! - (-> sv-88 0) - (vector-float*! (-> sv-88 0) (-> arg0 dynam gravity-normal) f28-0) - (vector-float*! s2-1 s2-1 (/ f0-18 f1-6)) - ) - ) - ) - ) + (let ((sv-88 v1-2) + (sv-96 0) ) - ) - ) - (set! sv-96 (logior sv-96 4)) - (cond - ((-> arg1 best-to-prim) - (set! sv-96 (logior sv-96 32)) - (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process))) - ) - ((= (-> arg0 poly-pat material) (pat-material waterbottom)) - ) - (else - (set! sv-96 (logior sv-96 4096)) - ) - ) - (if (and s3-1 (logtest? (collide-action racer-unused) (-> arg0 root-prim prim-core action))) - (set! s3-1 #f) - ) - (cond - (s3-1 - (set! sv-104 (logior sv-104 4)) - (set! sv-96 (logior sv-96 8)) - (set! (-> arg0 cur-pat mode) 1) - (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) - (vector-reflect-flat-above! arg2 (-> sv-88 0) sv-84) - (cond - ((not (and (>= (-> arg1 best-from-prim local-sphere w) - (vector-dot - (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) + (let ((sv-104 0)) + (set! (-> sv-88 0 quad) (-> arg3 quad)) + (set! (-> sv-88 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) + (move-by-vector! arg0 a1-3) + ) + (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) + (logior! sv-104 1) + ) + (if (= (-> arg0 unknown-surface00 mode) 'air) + (logior! sv-104 32) + ) + (let ((v1-21 (new 'stack-no-clear 'vector))) + (set! (-> v1-21 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-21 (-> arg1 best-tri intersect)) + ) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) + (vector-normalize! sv-80 1.0) + ) + (if (< (-> arg0 coverage) 0.9999) + (logior! sv-104 24) + ) + (set! (-> sv-84 quad) (-> sv-80 quad)) + (if (= (-> arg1 best-u) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 0)) + (if (< (-> arg0 poly-angle) -0.2) + (logior! sv-96 16) + ) + (let ((s3-1 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (if s3-1 + (logior! sv-104 2) + ) + (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (logior! sv-96 2048) + (when (not s3-1) + (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) + (when (< f30-0 1.0) + (let ((s2-1 (new-stack-vector0)) + (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 0))) + ) + 0.0 + (vector-! s2-1 (-> sv-88 0) (vector-float*! s2-1 (-> arg0 dynam gravity-normal) f28-0)) + (let* ((f0-18 (vector-length s2-1)) + (f1-6 f0-18) ) - ) - (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) - (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) - (not (logtest? sv-104 32)) + (if (< f28-0 0.0) + (set! f28-0 (* f28-0 f30-0)) ) - ) + (vector+! + (-> sv-88 0) + (vector-float*! (-> sv-88 0) (-> arg0 dynam gravity-normal) f28-0) + (vector-float*! s2-1 s2-1 (/ f0-18 f1-6)) + ) + ) + ) + ) ) - ) - (else - (set! sv-104 (logior sv-104 256)) - (set! sv-104 (logand -65 sv-104)) - (let ((s3-3 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) - (vector-normalize! s3-3 1.0) - (vector-float*! arg2 s3-3 (vector-dot (-> sv-88 0) s3-3)) ) - (vector+! arg2 arg2 (-> arg0 poly-normal)) ) - ) - (let* ((s2-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-88 0) 1.0)) - (s3-4 (new-stack-vector0)) - (f30-1 (vector-dot s2-2 arg2)) - ) - 0.0 - (vector-! s3-4 arg2 (vector-float*! s3-4 s2-2 f30-1)) - (let* ((f1-11 (vector-length s3-4)) - (f0-27 f1-11) - (f1-12 (* 0.9 f1-11)) + (logior! sv-96 4) + (cond + ((-> arg1 best-to-prim) + (logior! sv-96 32) + (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process))) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (logior! sv-96 4096) + ) + ) + (if (and s3-1 (logtest? (collide-action racer-unused) (-> arg0 root-prim prim-core action))) + (set! s3-1 #f) + ) + (cond + (s3-1 + (logior! sv-104 4) + (logior! sv-96 8) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) + (vector-reflect-flat-above! arg2 (-> sv-88 0) sv-84) + (cond + ((not (and (>= (-> arg1 best-from-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) + ) + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) + (not (logtest? sv-104 32)) + ) + ) + ) ) - (vector+! arg2 (vector-float*! arg2 s2-2 f30-1) (vector-float*! s3-4 s3-4 (/ f1-12 f0-27))) - ) - ) - ) - (else - (set! sv-96 (logior sv-96 1)) - (set! (-> arg0 cur-pat mode) 0) - (if (and (= (-> arg1 best-from-prim prim-id) 6) (not (logtest? sv-104 7))) - (set! (-> arg0 local-normal quad) (-> sv-84 quad)) - ) - (vector-reflect-flat! arg2 (-> sv-88 0) sv-84) - (dotimes (v1-142 16) - (vector+! arg2 arg2 (-> arg0 poly-normal)) - ) - (set! sv-96 (logior sv-96 2)) - (set! (-> arg0 ground-touch-point w) 0.0) - (when (not (logtest? sv-104 15)) - (set! sv-96 (logior sv-96 2)) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) - (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) - (set-time! (-> arg0 unknown-dword10)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) - (set! sv-104 (logior sv-104 2048)) - (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) - (set! sv-96 (logior sv-96 1024)) + (else + (logior! sv-104 256) + (logand! sv-104 -65) + (let ((s3-3 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) + (vector-normalize! s3-3 1.0) + (vector-float*! arg2 s3-3 (vector-dot (-> sv-88 0) s3-3)) + ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + ) + (let* ((s2-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-88 0) 1.0)) + (s3-4 (new-stack-vector0)) + (f30-1 (vector-dot s2-2 arg2)) + ) + 0.0 + (vector-! s3-4 arg2 (vector-float*! s3-4 s2-2 f30-1)) + (let* ((f1-11 (vector-length s3-4)) + (f0-27 f1-11) + (f1-12 (* 0.9 f1-11)) + ) + (vector+! arg2 (vector-float*! arg2 s2-2 f30-1) (vector-float*! s3-4 s3-4 (/ f1-12 f0-27))) + ) + ) ) + (else + (logior! sv-96 1) + (set! (-> arg0 cur-pat mode) 0) + (if (and (= (-> arg1 best-from-prim prim-id) 6) (not (logtest? sv-104 7))) + (set! (-> arg0 local-normal quad) (-> sv-84 quad)) + ) + (vector-reflect-flat! arg2 (-> sv-88 0) sv-84) + (dotimes (v1-142 16) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + (logior! sv-96 2) + (set! (-> arg0 ground-touch-point w) 0.0) + (when (not (logtest? sv-104 15)) + (logior! sv-96 2) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) + (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (set-time! (-> arg0 unknown-dword10)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + (logior! sv-104 2048) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) + (logior! sv-96 1024) + ) + ) + ) + ) ) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) ) + (update! + (-> arg0 history-data (-> arg0 unknown-halfword00)) + arg0 + (-> arg1 best-tri intersect) + (-> sv-88 1) + arg2 + ) + (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) + (the-as cshape-moving-flags sv-96) ) ) - (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) - (update! - (-> arg0 history-data (-> arg0 unknown-halfword00)) - arg0 - (-> arg1 best-tri intersect) - (-> sv-88 1) - arg2 - ) - (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) - (the-as cshape-moving-flags sv-96) ) diff --git a/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc b/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc index aa7e76b742..4cd32c0ce4 100644 --- a/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc +++ b/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc @@ -4,7 +4,7 @@ ;; definition for function find-adjacent-bounds-one ;; INFO: Used lq/sq (defun find-adjacent-bounds-one ((arg0 nav-mesh) (arg1 nav-poly) (arg2 int) (arg3 (array int8)) (arg4 (array int8)) (arg5 vector)) - (local-vars (v0-2 object) (v1-2 int) (v1-30 int) (a0-2 int) (a0-12 int) (sv-16 nav-poly) (sv-32 int)) + (local-vars (v0-2 object) (v1-2 int) (v1-30 int) (a0-2 int) (a0-12 int)) (let ((v1-1 (+ arg2 1))) (let ((a0-1 2)) (set-on-less-than a0-2 a0-1 v1-1) @@ -21,51 +21,53 @@ ) ) ) - (let ((s0-0 (-> arg1 vertex (-> arg3 arg2)))) - (set! sv-16 arg1) + (let ((s0-0 (-> arg1 vertex (-> arg3 arg2))) + (sv-16 arg1) + ) (while (begin (label cfg-28) #t) - (set! sv-32 0) - (while (< sv-32 3) - (cond - ((and (= sv-32 arg2) (= sv-16 arg1)) - ) - ((= s0-0 (-> sv-16 vertex (-> arg4 sv-32))) - (vector+! arg5 (-> arg0 origin) (the-as vector (-> arg0 vertex (-> sv-16 vertex (-> arg3 sv-32))))) - (let ((v1-29 (+ sv-32 1))) - (let ((a0-11 2)) - (set-on-less-than a0-12 a0-11 v1-29) - ) - (move-if-not-zero v1-30 0 a0-12 v1-29) + (let ((sv-32 0)) + (while (< sv-32 3) + (cond + ((and (= sv-32 arg2) (= sv-16 arg1)) ) - (let ((v1-32 (-> sv-16 adj-poly v1-30))) - (if (= v1-32 255) - (return #t) + ((= s0-0 (-> sv-16 vertex (-> arg4 sv-32))) + (vector+! arg5 (-> arg0 origin) (the-as vector (-> arg0 vertex (-> sv-16 vertex (-> arg3 sv-32))))) + (let ((v1-29 (+ sv-32 1))) + (let ((a0-11 2)) + (set-on-less-than a0-12 a0-11 v1-29) ) - (let ((v1-35 (-> arg0 poly v1-32))) - (set! v0-2 (cond - ((= arg1 v1-35) - (format 0 "ERROR: find-adjacent-bounds-one given tried to go back~%") - ) - (else - (cond - ((logtest? (-> v1-35 pat) 1) - (return #t) - ) - (else - (set! arg1 sv-16) - (set! sv-16 v1-35) - (goto cfg-28) + (move-if-not-zero v1-30 0 a0-12 v1-29) + ) + (let ((v1-32 (-> sv-16 adj-poly v1-30))) + (if (= v1-32 255) + (return #t) + ) + (let ((v1-35 (-> arg0 poly v1-32))) + (set! v0-2 (cond + ((= arg1 v1-35) + (format 0 "ERROR: find-adjacent-bounds-one given tried to go back~%") + ) + (else + (cond + ((logtest? (-> v1-35 pat) 1) + (return #t) + ) + (else + (set! arg1 sv-16) + (set! sv-16 v1-35) + (goto cfg-28) + ) ) + v0-2 ) - v0-2 ) - ) - ) + ) + ) ) ) - ) + ) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) (format 0 "ERROR: abnormal exit from find-adjacent-bounds-one~%") (return #f) @@ -219,7 +221,6 @@ ;; definition for function fleeing-nav-enemy-clip-travel ;; INFO: Used lq/sq (defun fleeing-nav-enemy-clip-travel ((arg0 fleeing-nav-enemy) (arg1 vector)) - (local-vars (sv-224 vector) (sv-240 vector) (sv-256 vector) (sv-272 vector) (sv-288 vector)) (let ((s2-0 (new 'stack 'clip-travel-vector-to-mesh-return-info)) (gp-0 (new 'stack-no-clear 'vector)) (s1-0 #f) @@ -252,21 +253,8 @@ (cond ((< (cos f28-1) f30-0) (vector--float*! s3-0 s0-0 (-> s2-0 boundary-normal) f30-0) - (let ((s0-1 vector-normalize!)) - (set! sv-224 s3-0) - (let ((a1-7 (sin f28-1))) - (s0-1 sv-224 a1-7) - ) - ) - (let ((s0-2 vector+float*!)) - (set! sv-240 s3-0) - (set! sv-256 s3-0) - (let ((s2-1 (-> s2-0 boundary-normal)) - (a3-1 (cos f28-1)) - ) - (s0-2 sv-240 sv-256 s2-1 a3-1) - ) - ) + (vector-normalize! s3-0 (sin f28-1)) + (vector+float*! s3-0 s3-0 (-> s2-0 boundary-normal) (cos f28-1)) ) (else (let ((v1-15 s3-0)) @@ -280,31 +268,13 @@ ((< (cos (-> arg0 flee-info min-reflect-angle)) f30-0) (vector--float*! s3-0 s0-0 (-> s2-0 boundary-normal) f30-0) (vector-normalize! s3-0 (sin (-> arg0 flee-info min-reflect-angle))) - (let ((s1-2 vector--float*!) - (s0-4 s3-0) - ) - (set! sv-272 s3-0) - (let ((s2-2 (-> s2-0 boundary-normal)) - (a3-3 (cos (-> arg0 flee-info min-reflect-angle))) - ) - (s1-2 s0-4 sv-272 s2-2 a3-3) - ) - ) + (vector--float*! s3-0 s3-0 (-> s2-0 boundary-normal) (cos (-> arg0 flee-info min-reflect-angle))) (set! s1-0 #t) ) ((< f30-0 (cos (-> arg0 flee-info max-reflect-angle))) (vector--float*! s3-0 s0-0 (-> s2-0 boundary-normal) f30-0) (vector-normalize! s3-0 (sin (-> arg0 flee-info max-reflect-angle))) - (let ((s1-4 vector--float*!) - (s0-6 s3-0) - ) - (set! sv-288 s3-0) - (let ((s2-3 (-> s2-0 boundary-normal)) - (a3-5 (cos (-> arg0 flee-info max-reflect-angle))) - ) - (s1-4 s0-6 sv-288 s2-3 a3-5) - ) - ) + (vector--float*! s3-0 s3-0 (-> s2-0 boundary-normal) (cos (-> arg0 flee-info max-reflect-angle))) (set! s1-0 #t) ) (else @@ -572,41 +542,41 @@ ;; definition for function lightning-mole-task-complete? (defbehavior lightning-mole-task-complete? lightning-mole () - (local-vars (sv-16 symbol)) (process-entity-status! self (entity-perm-status complete) #t) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (cond - (sv-16 - (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) - (process-spawn-function - process - (lambda :behavior lightning-mole - () - (while (or (-> *setting-control* current ambient) - (-> *setting-control* current movie) - (-> *setting-control* current hint) - ) - (suspend) + (let ((sv-16 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (cond + (sv-16 + (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) + (process-spawn-function + process + (lambda :behavior lightning-mole + () + (while (or (-> *setting-control* current ambient) + (-> *setting-control* current movie) + (-> *setting-control* current hint) + ) + (suspend) + ) + (level-hint-spawn + (text-id rolling-moles-resolution) + "sksp0112" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (none) ) - (level-hint-spawn - (text-id rolling-moles-resolution) - "sksp0112" - (the-as entity #f) - *entity-pool* - (game-task none) - ) - (none) + :to self ) - :to self + (format #t "lightning-mole task is complete~%") + ) + (else ) - (format #t "lightning-mole task is complete~%") - ) - (else ) + sv-16 ) - sv-16 ) ) diff --git a/test/decompiler/reference/jak1/levels/rolling/rolling-robber_REF.gc b/test/decompiler/reference/jak1/levels/rolling/rolling-robber_REF.gc index 026854e9b6..a4fc718d34 100644 --- a/test/decompiler/reference/jak1/levels/rolling/rolling-robber_REF.gc +++ b/test/decompiler/reference/jak1/levels/rolling/rolling-robber_REF.gc @@ -141,20 +141,20 @@ ;; definition for function robber-task-complete? (defbehavior robber-task-complete? robber () - (local-vars (sv-16 symbol)) (process-entity-status! self (entity-perm-status complete) #t) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (cond - (sv-16 - (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) - (format #t "robber task is complete~%") - ) - (else + (let ((sv-16 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (cond + (sv-16 + (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) + (format #t "robber task is complete~%") + ) + (else + ) ) + sv-16 ) - sv-16 ) ) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc index 8e3407cbc6..f70f367949 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc @@ -213,9 +213,7 @@ (let ((f0-6 (-> this path-faded-up-u))) (cond ((< (-> this path-u) f0-6) - (let* ((f0-7 (/ (-> this path-u) f0-6)) - (f0-8 (* f0-7 f0-7)) - ) + (let ((f0-8 (square (/ (-> this path-u) f0-6)))) (set-vector! (-> this draw color-mult) f0-8 f0-8 f0-8 1.0) ) ) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-bumper_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-bumper_REF.gc index 71d549cbc8..974515841c 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-bumper_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-bumper_REF.gc @@ -233,7 +233,6 @@ ) :trans rider-trans :code (behavior () - (local-vars (sv-16 symbol)) (logclear! (-> self mask) (process-mask actor-pause)) (sound-play "bumper-pwr-dwn") (ja-no-eval :group! snow-bumper-button-ja :num! (seek! max 0.05) :frame-num 0.0) @@ -254,11 +253,12 @@ (ja :num! (seek! max 0.02)) ) (process-entity-status! self (entity-perm-status complete) #t) - (set! sv-16 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (when sv-16 - (save-reminder (get-task-control (game-task snow-bumpers)) (-> self bumper-id) 0) - (go snow-bumper-spawn-fuel-cell) + (let ((sv-16 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (when sv-16 + (save-reminder (get-task-control (game-task snow-bumpers)) (-> self bumper-id) 0) + (go snow-bumper-spawn-fuel-cell) + ) ) (go snow-bumper-inactive-idle) ) @@ -323,7 +323,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this snow-bumper) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this last-shoved-player-time) 0) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -382,8 +381,9 @@ (transform-post) (set! (-> this base-shove-ry) 0.0) (set! (-> this max-shove-diff-ry) 32768.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-52 (res-lump-data (-> this entity) 'rotmin (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-52 (res-lump-data (-> this entity) 'rotmin (pointer float) :tag-ptr (& sv-16))) + ) (when v1-52 (set! (-> this base-shove-ry) (-> v1-52 0)) (set! (-> this max-shove-diff-ry) (-> v1-52 1)) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-bunny_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-bunny_REF.gc index fbea0e8d42..4a7880162f 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-bunny_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-bunny_REF.gc @@ -545,7 +545,6 @@ ;; definition for method 54 of type snow-bunny ;; INFO: Used lq/sq (defmethod nav-enemy-method-54 ((this snow-bunny)) - (local-vars (sv-48 (function float float))) (set! (-> this using-jump-event?) #f) (let* ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> this final-dest) (-> this collide-info trans))) (f30-0 (vector-length s5-1)) @@ -569,16 +568,7 @@ (vector-rotate-around-y! s5-1 s5-1 16384.0) (vector-normalize! s5-1 (- f30-0 f28-0)) (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((s3-0 vector+*!) - (s2-0 s4-0) - (s1-0 (-> this final-dest)) - (s0-0 s5-1) - ) - (set! sv-48 sin) - (let ((a0-9 (rand-vu-float-range -16384.0 16384.0))) - (s3-0 s2-0 s1-0 s0-0 (sv-48 a0-9)) - ) - ) + (vector+*! s4-0 (-> this final-dest) s5-1 (sin (rand-vu-float-range -16384.0 16384.0))) (vector-! s5-1 s4-0 (-> this collide-info trans)) (when (< f28-0 (vector-length s5-1)) (vector-normalize! s5-1 f28-0) @@ -734,7 +724,6 @@ ;; definition for method 52 of type snow-bunny ;; INFO: Used lq/sq (defmethod nav-enemy-method-52 ((this snow-bunny)) - (local-vars (sv-48 (function float float))) (set! (-> this using-jump-event?) #f) (if (not *target*) (return #f) @@ -757,15 +746,7 @@ (vector-rotate-around-y! s5-2 s5-2 16384.0) (vector-normalize! s5-2 (- f28-0 f30-0)) (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((s2-0 vector+*!) - (s1-0 s3-0) - (s0-0 s5-2) - ) - (set! sv-48 sin) - (let ((a0-11 (rand-vu-float-range -16384.0 16384.0))) - (s2-0 s1-0 s4-0 s0-0 (sv-48 a0-11)) - ) - ) + (vector+*! s3-0 s4-0 s5-2 (sin (rand-vu-float-range -16384.0 16384.0))) (vector-! s5-2 s3-0 (-> this collide-info trans)) (when (< f30-0 (vector-length s5-2)) (vector-normalize! s5-2 f30-0) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc index 9044fd4731..5764d43d76 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc @@ -616,8 +616,7 @@ :trans (behavior () (plat-trans) (let* ((f0-1 (fmin 1.0 (/ (the float (- (current-time) (-> self state-time))) (the float (-> self rise-time))))) - (f0-2 (- 1.0 f0-1)) - (f0-3 (* f0-2 f0-2)) + (f0-3 (square (- 1.0 f0-1))) (f30-0 (- 1.0 f0-3)) ) (vector-lerp! (-> self basetrans) (-> self appear-trans-bottom) (-> self appear-trans-top) f30-0) @@ -758,9 +757,10 @@ ) :trans (behavior () (plat-trans) - (let* ((f0-1 (fmin 1.0 (/ (the float (- (current-time) (-> self state-time))) (the float (-> self fall-time))))) - (f30-0 (* f0-1 f0-1)) - ) + (let ((f30-0 + (square (fmin 1.0 (/ (the float (- (current-time) (-> self state-time))) (the float (-> self fall-time))))) + ) + ) (vector-lerp! (-> self basetrans) (-> self start-trans) (-> self appear-trans-bottom) f30-0) (quaternion-slerp! (-> self root quat) (-> self appear-quat-top) (-> self appear-quat-bottom) f30-0) (let ((f0-3 (- 1.0 f30-0))) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc index a7c64a3ef1..0411831ef1 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc @@ -574,13 +574,13 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this snowpusher) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (logior! (-> this mask) (process-mask enemy platform)) (let ((s3-0 0) (s4-0 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data (-> this entity) 'mode (pointer int32) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data (-> this entity) 'mode (pointer int32) :tag-ptr (& sv-16))) + ) (when v1-3 (set! s3-0 (-> v1-3 0)) (set! s4-0 (-> v1-3 1)) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-ram_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-ram_REF.gc index b00f938486..e977f977d7 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-ram_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-ram_REF.gc @@ -211,7 +211,6 @@ ) ) :code (behavior () - (local-vars (sv-16 symbol)) (ja-channel-push! 1 (seconds 0.075)) (loop (sound-play "set-ram") @@ -239,15 +238,16 @@ ) ) (logior! (-> self mask) (process-mask actor-pause)) - (set! sv-16 (the-as symbol #f)) - (apply-function-forward (-> self link) actor-link-dead-hook (& sv-16)) - (when (or sv-16 (nonzero? (-> self root riders num-riders))) - (let ((v1-67 (-> self entity extra perm))) - (logior! (-> v1-67 status) (entity-perm-status user-set-from-cstage)) - (set! (-> v1-67 user-int8 0) 1) + (let ((sv-16 (the-as symbol #f))) + (apply-function-forward (-> self link) actor-link-dead-hook (& sv-16)) + (when (or sv-16 (nonzero? (-> self root riders num-riders))) + (let ((v1-67 (-> self entity extra perm))) + (logior! (-> v1-67 status) (entity-perm-status user-set-from-cstage)) + (set! (-> v1-67 user-int8 0) 1) + ) + (send-event (ppointer->process (-> self child)) 'jump) + (go ram-fun-idle) ) - (send-event (ppointer->process (-> self child)) 'jump) - (go ram-fun-idle) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc b/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc index 144450449d..ce8407c404 100644 --- a/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc @@ -1117,7 +1117,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this puffer) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this cprims-type) (the-as uint 0)) (set! (-> this attacking?) #f) (set! (-> this buddy) #f) @@ -1170,8 +1169,9 @@ (let ((f28-0 8192.0) (f30-0 -8192.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-54 (res-lump-data arg0 'distance (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-54 (res-lump-data arg0 'distance (pointer float) :tag-ptr (& sv-16))) + ) (when v1-54 (set! f28-0 (-> v1-54 0)) (set! f30-0 (-> v1-54 1)) diff --git a/test/decompiler/reference/jak1/levels/sunken/shover_REF.gc b/test/decompiler/reference/jak1/levels/sunken/shover_REF.gc index 3f3b359bc2..13bdaf3ab2 100644 --- a/test/decompiler/reference/jak1/levels/sunken/shover_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/shover_REF.gc @@ -77,7 +77,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this shover) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this shove-up) (res-lump-float arg0 'shove :default 12288.0)) (let ((s3-0 (res-lump-value arg0 'collision-mesh-id uint128)) (s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player))) @@ -104,8 +103,9 @@ (go process-drawable-art-error "no path") ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-23 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-23 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-23 (+! (-> this root trans x) (-> v1-23 0)) (+! (-> this root trans y) (-> v1-23 1)) diff --git a/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc b/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc index 273d553bfd..a0606d9854 100644 --- a/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc @@ -209,7 +209,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod square-platform-method-27 ((this square-platform) (arg0 symbol)) - (local-vars (v0-3 sound-id) (sv-48 int)) + (local-vars (v0-3 sound-id)) (let ((s4-0 (new 'stack-no-clear 'vector))) (set! (-> s4-0 quad) (-> this root trans quad)) (+! (-> s4-0 y) -20480.0) @@ -245,19 +245,7 @@ (else (when (>= f0-2 (-> s4-0 y)) (set-time! (-> this start-splash-time)) - (let ((s2-0 sound-play-by-name) - (s1-0 (make-u128 #x6873616c (the-as uint #x70732d656772616c))) - (s0-0 (new-sound-id)) - ) - (set! sv-48 1024) - (let ((a3-0 (the int (* 1524.0 (rand-vu-float-range -0.8 0.8)))) - (t0-0 0) - (t1-0 1) - (t2-0 #t) - ) - (s2-0 (the-as sound-name s1-0) s0-0 sv-48 a3-0 t0-0 (the-as sound-group t1-0) t2-0) - ) - ) + (sound-play "large-splash" :pitch (rand-vu-float-range -0.8 0.8)) ) ) ) @@ -451,7 +439,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this square-platform) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (set! (-> this pos-u) 0.0) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -487,27 +474,25 @@ ) (set! (-> s4-1 frame-num) 0.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let* ((v1-32 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-16))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-32 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-16))) (f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-32)) -8192.0 ) ) + (sv-32 (new 'static 'res-tag)) + (v1-35 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-32))) + (f0-10 (if (and v1-35 (< 1 (the-as int (-> sv-32 elt-count)))) + (-> (the-as (pointer float) v1-35) 1) + 16384.0 + ) + ) ) - (set! sv-32 (new 'static 'res-tag)) - (let* ((v1-35 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-32))) - (f0-10 (if (and v1-35 (< 1 (the-as int (-> sv-32 elt-count)))) - (-> (the-as (pointer float) v1-35) 1) - 16384.0 - ) - ) - ) - (set! (-> this down-pos quad) (-> this root trans quad)) - (+! (-> this down-pos y) f30-0) - (set! (-> this up-pos quad) (-> this root trans quad)) - (+! (-> this up-pos y) f0-10) - ) + (set! (-> this down-pos quad) (-> this root trans quad)) + (+! (-> this down-pos y) f30-0) + (set! (-> this up-pos quad) (-> this root trans quad)) + (+! (-> this up-pos y) f0-10) ) (set! (-> this basetrans quad) (-> this down-pos quad)) (set! (-> this root trans quad) (-> this basetrans quad)) diff --git a/test/decompiler/reference/jak1/levels/sunken/steam-cap_REF.gc b/test/decompiler/reference/jak1/levels/sunken/steam-cap_REF.gc index 5ebb6b1aef..426d648770 100644 --- a/test/decompiler/reference/jak1/levels/sunken/steam-cap_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/steam-cap_REF.gc @@ -709,7 +709,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this steam-cap) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (logior! (-> this mask) (process-mask platform)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -751,8 +750,9 @@ (let ((f30-0 0.4) (f28-0 0.9) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-36 (res-lump-data arg0 'percent (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-36 (res-lump-data arg0 'percent (pointer float) :tag-ptr (& sv-16))) + ) (when v1-36 (set! f30-0 (-> v1-36 0)) (set! f28-0 (-> v1-36 1)) diff --git a/test/decompiler/reference/jak1/levels/sunken/sun-iris-door_REF.gc b/test/decompiler/reference/jak1/levels/sunken/sun-iris-door_REF.gc index 9013fa0d63..7b589542b1 100644 --- a/test/decompiler/reference/jak1/levels/sunken/sun-iris-door_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/sun-iris-door_REF.gc @@ -314,7 +314,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this sun-iris-door) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this move-to?) #f) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-others)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) @@ -350,8 +349,9 @@ (set! (-> v1-25 local-sphere w) (* 24576.0 f0-11 f0-11)) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-28 (+! (-> this root trans x) (-> v1-28 0)) (+! (-> this root trans y) (-> v1-28 1)) diff --git a/test/decompiler/reference/jak1/levels/sunken/sunken-fish_REF.gc b/test/decompiler/reference/jak1/levels/sunken/sunken-fish_REF.gc index 006bc6c6f1..79d9b7c21b 100644 --- a/test/decompiler/reference/jak1/levels/sunken/sunken-fish_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/sunken-fish_REF.gc @@ -265,7 +265,6 @@ ;; definition for method 27 of type sunkenfisha ;; INFO: Used lq/sq (defmethod sunkenfisha-method-27 ((this sunkenfisha)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (vector-reset! (-> this path-trans-offset)) (set! (-> this path-u) (rand-vu-float-range 0.0 1.0)) (if (zero? (rand-vu-int-count 2)) @@ -273,8 +272,9 @@ (set! (-> this path-dir) -1.0) ) (set-vector! (-> this max-local-path-offset) 16384.0 28672.0 0.0 1.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-5 (res-lump-data (-> this entity) 'path-max-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-5 (res-lump-data (-> this entity) 'path-max-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-5 (set! (-> this max-local-path-offset x) (-> v1-5 0)) (set! (-> this max-local-path-offset y) (-> v1-5 1)) @@ -299,8 +299,9 @@ (set! (-> this change-path-dir-time) (+ (current-time) (rand-vu-int-range (seconds 5) (seconds 18)))) (set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0)) (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data (-> this entity) 'path-trans-offset (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-16 (res-lump-data (-> this entity) 'path-trans-offset (pointer float) :tag-ptr (& sv-32))) + ) (when v1-16 (+! (-> this path-trans-offset x) (-> v1-16 0)) (+! (-> this path-trans-offset y) (-> v1-16 1)) @@ -313,8 +314,9 @@ (let ((f28-0 8192.0) (f30-0 26624.0) ) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-23 (res-lump-data (-> this entity) 'speed (pointer float) :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-23 (res-lump-data (-> this entity) 'speed (pointer float) :tag-ptr (& sv-48))) + ) (when v1-23 (set! f28-0 (-> v1-23 0)) (set! f30-0 (-> v1-23 1)) diff --git a/test/decompiler/reference/jak1/levels/sunken/whirlpool_REF.gc b/test/decompiler/reference/jak1/levels/sunken/whirlpool_REF.gc index b4a657f8b9..09b79401ee 100644 --- a/test/decompiler/reference/jak1/levels/sunken/whirlpool_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/whirlpool_REF.gc @@ -298,8 +298,7 @@ (f28-0 (vector-vector-xz-distance (-> this root trans) gp-0)) ) (when (< f28-0 40960.0) - (let* ((f0-2 (* 0.000024414063 (- 40960.0 f28-0))) - (f26-0 (* f0-2 f0-2)) + (let* ((f26-0 (square (* 0.000024414063 (- 40960.0 f28-0)))) (f0-7 (atan (- (-> gp-0 x) (-> this root trans x)) (- (-> gp-0 z) (-> this root trans z)))) (f30-0 (* (/ f26-0 2) arg0 (seconds-per-frame))) (f24-0 (+ f0-7 f30-0)) @@ -367,7 +366,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this whirlpool) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this spin-ry) (rand-vu-float-range 0.0 65536.0)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) @@ -388,8 +386,9 @@ (let ((f30-0 32768.0) (f28-0 145635.56) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-17 (res-lump-data arg0 'speed (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-17 (res-lump-data arg0 'speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-17 (set! f30-0 (-> v1-17 0)) (set! f28-0 (-> v1-17 1)) diff --git a/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc b/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc index 00d02dd988..6e46374642 100644 --- a/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc +++ b/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc @@ -108,7 +108,6 @@ ;; definition for method 13 of type vehicle-path ;; INFO: Used lq/sq (defmethod debug-draw ((this vehicle-path)) - (local-vars (sv-64 int) (sv-80 (function _varargs_ object))) (let ((s5-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) @@ -149,22 +148,10 @@ ) (let ((s1-0 add-debug-text-3d) (s0-0 #t) + (sv-64 68) ) - (set! sv-64 68) - (set! sv-80 format) - (let ((a0-9 (clear *temp-string*)) - (a1-6 "~D") - (a2-2 s2-0) - ) - (sv-80 a0-9 a1-6 a2-2) - ) - (let ((a2-3 *temp-string*) - (a3-2 s4-0) - (t0-2 4) - (t1-2 #f) - ) - (s1-0 s0-0 (the-as bucket-id sv-64) a2-3 a3-2 (the-as font-color t0-2) (the-as vector2h t1-2)) - ) + (format (clear *temp-string*) "~D" s2-0) + (s1-0 s0-0 (the-as bucket-id sv-64) *temp-string* s4-0 (font-color orange) (the-as vector2h #f)) ) ) ) @@ -380,13 +367,10 @@ (if (= (-> this left-circle) 1) (vector-float*! s3-0 s3-0 -1.0) ) - (let* ((f0-5 f30-0) - (f0-7 (* f0-5 f0-5)) - (f1-0 f28-0) - (f0-9 (sqrtf (- f0-7 (* f1-0 f1-0)))) + (let* ((f0-9 (sqrtf (- (square f30-0) (square f28-0)))) (f28-1 (/ (* f28-0 f0-9) f30-0)) ) - (let ((f0-12 (/ (* f0-9 f0-9) f30-0))) + (let ((f0-12 (/ (square f0-9) f30-0))) (set! (-> arg1 quad) (-> arg0 quad)) (vector+*! arg1 (-> this target-point) s5-0 f0-12) ) @@ -635,7 +619,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod rigid-body-platform-method-23 ((this fishermans-boat) (arg0 float)) - (local-vars (sv-128 int) (sv-144 rigid-body-control-point) (sv-160 int) (sv-176 vector)) (let ((s4-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) (s5-0 (new 'stack-no-clear 'vector)) @@ -644,41 +627,45 @@ (s3-0 (-> this rbody matrix)) ) (set! (-> s2-0 quad) (-> s3-0 vector 2 quad)) - (set! sv-128 0) - (while (< sv-128 6) - (set! sv-144 (-> this control-point-array data sv-128)) - (vector-matrix*! s5-0 (-> sv-144 local-pos) s3-0) - (set! (-> sv-144 world-pos quad) (-> s5-0 quad)) - (rigid-body-method-17 (-> this rbody) s5-0 s1-0) - (set! (-> sv-144 velocity quad) (-> s1-0 quad)) - (set! (-> sv-144 world-pos w) (ocean-get-height s5-0)) - (let* ((f0-2 (- (-> sv-144 world-pos w) (-> s5-0 y))) - (f30-0 (fmin 1.0 (/ f0-2 (-> this info max-buoyancy-depth)))) - ) - (when (< 0.0 f0-2) - (vector-float*! s4-0 *y-vector* (* 20.0 f0-2 (-> this rbody mass))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - (vector-float*! s4-0 *y-vector* (* 1.6 f30-0 (fmax 0.0 (vector-dot s2-0 s1-0)))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - (vector-float*! s4-0 s1-0 (* -1.0 (-> this info drag-factor) f30-0)) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - (vector-float*! s4-0 (-> s3-0 vector 0) (* -0.5 (vector-dot (-> s3-0 vector 0) s1-0))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + (let ((sv-128 0)) + (while (< sv-128 6) + (let ((sv-144 (-> this control-point-array data sv-128))) + (vector-matrix*! s5-0 (-> sv-144 local-pos) s3-0) + (set! (-> sv-144 world-pos quad) (-> s5-0 quad)) + (rigid-body-method-17 (-> this rbody) s5-0 s1-0) + (set! (-> sv-144 velocity quad) (-> s1-0 quad)) + (set! (-> sv-144 world-pos w) (ocean-get-height s5-0)) + (let* ((f0-2 (- (-> sv-144 world-pos w) (-> s5-0 y))) + (f30-0 (fmin 1.0 (/ f0-2 (-> this info max-buoyancy-depth)))) + ) + (when (< 0.0 f0-2) + (vector-float*! s4-0 *y-vector* (* 20.0 f0-2 (-> this rbody mass))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + (vector-float*! s4-0 *y-vector* (* 1.6 f30-0 (fmax 0.0 (vector-dot s2-0 s1-0)))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + (vector-float*! s4-0 s1-0 (* -1.0 (-> this info drag-factor) f30-0)) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + (vector-float*! s4-0 (-> s3-0 vector 0) (* -0.5 (vector-dot (-> s3-0 vector 0) s1-0))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + ) + ) ) + 0 + (+! sv-128 1) ) - 0 - (set! sv-128 (+ sv-128 1)) ) - (set! sv-160 0) - (while (< sv-160 2) - (set! sv-176 (-> this stabilizer-array sv-160 local-pos)) - (vector-matrix*! s5-0 (the-as vector (&-> sv-176 x)) s3-0) - (vector-rotate*! s0-0 (&+ sv-176 16) s3-0) - (rigid-body-method-17 (-> this rbody) s5-0 s1-0) - (vector-float*! s4-0 s0-0 (* -1.0 (vector-dot s0-0 s1-0))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - 0 - (set! sv-160 (+ sv-160 1)) + (let ((sv-160 0)) + (while (< sv-160 2) + (let ((sv-176 (-> this stabilizer-array sv-160 local-pos))) + (vector-matrix*! s5-0 (the-as vector (&-> sv-176 x)) s3-0) + (vector-rotate*! s0-0 (&+ sv-176 16) s3-0) + ) + (rigid-body-method-17 (-> this rbody) s5-0 s1-0) + (vector-float*! s4-0 s0-0 (* -1.0 (vector-dot s0-0 s1-0))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + 0 + (+! sv-160 1) + ) ) (when (-> this anchored) (let ((s1-1 (new 'stack-no-clear 'vector))) diff --git a/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc b/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc index e2e353133c..64e84e72e6 100644 --- a/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc +++ b/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc @@ -217,7 +217,6 @@ yakow-default-event-handler ;; definition for function yakow-task-complete? (defbehavior yakow-task-complete? yakow ((arg0 symbol)) - (local-vars (sv-16 symbol) (sv-20 (pointer process-tree))) (let ((gp-0 (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete)))) ) @@ -227,30 +226,32 @@ yakow-default-event-handler (process-entity-status! self (entity-perm-status complete) #f) ) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (set! sv-20 (-> self child)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (cond - (sv-16 - (close-specific-task! (-> self entity extra perm task) (task-status need-hint)) - (close-specific-task! (-> self entity extra perm task) (task-status need-introduction)) - (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) - (if gp-0 - (yakow-cam) + (let ((sv-16 (the-as symbol #f))) + (let ((sv-20 (-> self child))) + ) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (cond + (sv-16 + (close-specific-task! (-> self entity extra perm task) (task-status need-hint)) + (close-specific-task! (-> self entity extra perm task) (task-status need-introduction)) + (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) + (if gp-0 + (yakow-cam) + ) + (level-hint-spawn + (text-id village1-yakow-resolution) + "sksp018a" + (the-as entity #f) + *entity-pool* + (game-task none) ) - (level-hint-spawn - (text-id village1-yakow-resolution) - "sksp018a" - (the-as entity #f) - *entity-pool* - (game-task none) + ) + (else + (open-specific-task! (-> self entity extra perm task) (task-status need-reminder)) ) ) - (else - (open-specific-task! (-> self entity extra perm task) (task-status need-reminder)) - ) + sv-16 ) - sv-16 ) ) ) diff --git a/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc b/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc index 33a3a90c7e..c97944cb2b 100644 --- a/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc +++ b/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc @@ -1110,11 +1110,7 @@ 0.0 ) (else - (let ((f0-2 1.0) - (f1-3 (- 1.0 arg0)) - ) - (- f0-2 (* f1-3 f1-3)) - ) + (- 1.0 (square (- 1.0 arg0))) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/village_common/villagep-obs_REF.gc b/test/decompiler/reference/jak1/levels/village_common/villagep-obs_REF.gc index e327f5abff..6c2ad454ce 100644 --- a/test/decompiler/reference/jak1/levels/village_common/villagep-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/village_common/villagep-obs_REF.gc @@ -268,7 +268,6 @@ ) ) :code (behavior () - (local-vars (sv-112 int) (sv-128 int) (sv-144 int)) (let ((gp-0 (get-next-slot-up self (+ (-> self level-slot) -1)))) 0 (let ((s5-0 #f) @@ -326,18 +325,15 @@ (set! (-> a0-34 color) (font-color progress-blue)) ) 0 - (let ((s0-3 (get-next-slot-up self gp-0))) - (set! sv-112 (get-next-slot-down self gp-0)) - (set! sv-144 (get-next-slot-up self s0-3)) - (set! sv-128 (get-next-slot-down self sv-112)) + (let* ((s0-3 (get-next-slot-up self gp-0)) + (sv-112 (get-next-slot-down self gp-0)) + (sv-144 (get-next-slot-up self s0-3)) + (sv-128 (get-next-slot-down self sv-112)) + ) (cond (s4-0 - (let ((a2-6 (- 300 (+ s2-0 150))) - (t9-20 print-level-name) - (a1-16 s1-3) - (a3-4 #f) - ) - (t9-20 sv-112 a1-16 a2-6 (the-as int a3-4)) + (let ((a2-6 (- 300 (+ s2-0 150)))) + (print-level-name sv-112 s1-3 a2-6 (the-as int #f)) ) (let ((a2-7 (+ s2-0 150))) (cond @@ -345,12 +341,8 @@ (print-level-name s0-3 s1-3 a2-7 (the-as int #t)) ) (else - (let ((a2-8 (- 300 s2-0)) - (t9-22 print-level-name) - (a1-18 s1-3) - (a3-6 #f) - ) - (t9-22 sv-128 a1-18 a2-8 (the-as int a3-6)) + (let ((a2-8 (- 300 s2-0))) + (print-level-name sv-128 s1-3 a2-8 (the-as int #f)) ) ) ) @@ -363,12 +355,8 @@ (print-level-name sv-112 s1-3 a2-9 (the-as int #f)) ) (else - (let ((a2-10 (- 300 s2-0)) - (t9-24 print-level-name) - (a1-20 s1-3) - (a3-8 #t) - ) - (t9-24 sv-144 a1-20 a2-10 (the-as int a3-8)) + (let ((a2-10 (- 300 s2-0))) + (print-level-name sv-144 s1-3 a2-10 (the-as int #t)) ) ) )