mirror of
https://github.com/open-goal/jak-project
synced 2026-09-10 04:22:13 -04:00
decomp: Decompile ripple (#512)
* decomp: Decompile `ripple` * decomp: Finish decompiling `ripple` * update necessary src files
This commit is contained in:
@@ -350,8 +350,8 @@
|
||||
|
||||
;; definition of type lod-group
|
||||
(deftype lod-group (structure)
|
||||
((geo basic :offset-assert 0)
|
||||
(dist float :offset-assert 4)
|
||||
((geo merc-ctrl :offset-assert 0)
|
||||
(dist float :offset-assert 4)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
@@ -391,46 +391,46 @@
|
||||
|
||||
;; definition of type draw-control
|
||||
(deftype draw-control (basic)
|
||||
((status uint8 :offset-assert 4)
|
||||
(matrix-type uint8 :offset-assert 5)
|
||||
(data-format uint8 :offset-assert 6)
|
||||
(global-effect uint8 :offset-assert 7)
|
||||
(art-group art-group :offset-assert 8)
|
||||
(jgeo art-joint-geo :offset-assert 12)
|
||||
(mgeo art-mesh-geo :offset-assert 16)
|
||||
(dma-add-func function :offset-assert 20)
|
||||
(skeleton skeleton-group :offset-assert 24)
|
||||
(lod-set lod-set :inline :offset-assert 28)
|
||||
(lod lod-group 4 :inline :offset 28)
|
||||
(max-lod int8 :offset 60)
|
||||
(force-lod int8 :offset-assert 61)
|
||||
(cur-lod int8 :offset-assert 62)
|
||||
(desired-lod int8 :offset-assert 63)
|
||||
(ripple basic :offset-assert 64)
|
||||
(longest-edge float :offset-assert 68)
|
||||
(longest-edge? uint32 :offset 68)
|
||||
(light-index uint8 :offset-assert 72)
|
||||
(dummy uint8 2 :offset-assert 73)
|
||||
(death-draw-overlap uint8 :offset-assert 75)
|
||||
(death-timer uint8 :offset-assert 76)
|
||||
(death-timer-org uint8 :offset-assert 77)
|
||||
(death-vertex-skip uint16 :offset-assert 78)
|
||||
(death-effect uint32 :offset-assert 80)
|
||||
(sink-group basic :offset-assert 84)
|
||||
(process process :offset-assert 88)
|
||||
(shadow basic :offset-assert 92)
|
||||
(shadow-ctrl basic :offset-assert 96)
|
||||
(origin vector :inline :offset-assert 112)
|
||||
(bounds vector :inline :offset-assert 128)
|
||||
(radius float :offset 140)
|
||||
(color-mult rgbaf :inline :offset-assert 144)
|
||||
(color-emissive rgbaf :inline :offset-assert 160)
|
||||
(secondary-interp float :offset-assert 176)
|
||||
(current-secondary-interp float :offset-assert 180)
|
||||
(shadow-mask uint8 :offset-assert 184)
|
||||
(level-index uint8 :offset-assert 185)
|
||||
(origin-joint-index uint8 :offset-assert 186)
|
||||
(shadow-joint-index uint8 :offset-assert 187)
|
||||
((status uint8 :offset-assert 4)
|
||||
(matrix-type uint8 :offset-assert 5)
|
||||
(data-format uint8 :offset-assert 6)
|
||||
(global-effect uint8 :offset-assert 7)
|
||||
(art-group art-group :offset-assert 8)
|
||||
(jgeo art-joint-geo :offset-assert 12)
|
||||
(mgeo art-mesh-geo :offset-assert 16)
|
||||
(dma-add-func function :offset-assert 20)
|
||||
(skeleton skeleton-group :offset-assert 24)
|
||||
(lod-set lod-set :inline :offset-assert 28)
|
||||
(lod lod-group 4 :inline :offset 28)
|
||||
(max-lod int8 :offset 60)
|
||||
(force-lod int8 :offset-assert 61)
|
||||
(cur-lod int8 :offset-assert 62)
|
||||
(desired-lod int8 :offset-assert 63)
|
||||
(ripple ripple-control :offset-assert 64)
|
||||
(longest-edge float :offset-assert 68)
|
||||
(longest-edge? uint32 :offset 68)
|
||||
(light-index uint8 :offset-assert 72)
|
||||
(dummy uint8 2 :offset-assert 73)
|
||||
(death-draw-overlap uint8 :offset-assert 75)
|
||||
(death-timer uint8 :offset-assert 76)
|
||||
(death-timer-org uint8 :offset-assert 77)
|
||||
(death-vertex-skip uint16 :offset-assert 78)
|
||||
(death-effect uint32 :offset-assert 80)
|
||||
(sink-group dma-foreground-sink-group :offset-assert 84)
|
||||
(process process :offset-assert 88)
|
||||
(shadow shadow-geo :offset-assert 92)
|
||||
(shadow-ctrl shadow-control :offset-assert 96)
|
||||
(origin vector :inline :offset-assert 112)
|
||||
(bounds vector :inline :offset-assert 128)
|
||||
(radius float :offset 140)
|
||||
(color-mult rgbaf :inline :offset-assert 144)
|
||||
(color-emissive rgbaf :inline :offset-assert 160)
|
||||
(secondary-interp float :offset-assert 176)
|
||||
(current-secondary-interp float :offset-assert 180)
|
||||
(shadow-mask uint8 :offset-assert 184)
|
||||
(level-index uint8 :offset-assert 185)
|
||||
(origin-joint-index uint8 :offset-assert 186)
|
||||
(shadow-joint-index uint8 :offset-assert 187)
|
||||
)
|
||||
:method-count-assert 12
|
||||
:size-assert #xbc
|
||||
@@ -500,7 +500,3 @@
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-21 0))
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -563,8 +563,8 @@
|
||||
;; definition of type merc-ctrl
|
||||
(deftype merc-ctrl (art-element)
|
||||
((num-joints int32 :offset 20)
|
||||
(header merc-ctrl-header :inline :offset-assert 32)
|
||||
(effect uint8 :dynamic :offset-assert 112)
|
||||
(header merc-ctrl-header :inline :offset-assert 32)
|
||||
(effect merc-effect :inline :dynamic :offset-assert 112)
|
||||
)
|
||||
:method-count-assert 13
|
||||
:size-assert #x70
|
||||
@@ -664,15 +664,15 @@
|
||||
|
||||
;; definition of type ripple-control
|
||||
(deftype ripple-control (basic)
|
||||
((global-scale float :offset-assert 4)
|
||||
(last-frame-scale float :offset-assert 8)
|
||||
(close-fade-dist float :offset-assert 12)
|
||||
(far-fade-dist float :offset-assert 16)
|
||||
(faded-scale float :offset-assert 20)
|
||||
(individual-normal-scale float :offset-assert 24)
|
||||
(waveform basic :offset-assert 28)
|
||||
(send-query basic :offset-assert 32)
|
||||
(query basic :offset-assert 36)
|
||||
((global-scale float :offset-assert 4)
|
||||
(last-frame-scale float :offset-assert 8)
|
||||
(close-fade-dist float :offset-assert 12)
|
||||
(far-fade-dist float :offset-assert 16)
|
||||
(faded-scale float :offset-assert 20)
|
||||
(individual-normal-scale float :offset-assert 24)
|
||||
(waveform ripple-wave-set :offset-assert 28)
|
||||
(send-query basic :offset-assert 32)
|
||||
(query basic :offset-assert 36)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x28
|
||||
@@ -720,7 +720,3 @@
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-23 0))
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition of type ripple-request
|
||||
(deftype ripple-request (structure)
|
||||
((waveform ripple-wave :offset-assert 0)
|
||||
(effect merc-effect :offset-assert 4)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
)
|
||||
|
||||
;; definition for method 3 of type ripple-request
|
||||
(defmethod inspect ripple-request ((obj ripple-request))
|
||||
(format #t "[~8x] ~A~%" obj 'ripple-request)
|
||||
(format #t "~Twaveform: ~A~%" (-> obj waveform))
|
||||
(format #t "~Teffect: #<merc-effect @ #x~X>~%" (-> obj effect))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition of type ripple-globals
|
||||
(deftype ripple-globals (structure)
|
||||
((count int32 :offset-assert 0)
|
||||
(requests ripple-request 16 :inline :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x84
|
||||
:flag-assert #x900000084
|
||||
)
|
||||
|
||||
;; definition for method 3 of type ripple-globals
|
||||
(defmethod inspect ripple-globals ((obj ripple-globals))
|
||||
(format #t "[~8x] ~A~%" obj 'ripple-globals)
|
||||
(format #t "~Tcount: ~D~%" (-> obj count))
|
||||
(format #t "~Trequests[16] @ #x~X~%" (-> obj requests))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition for symbol *ripple-globals*, type ripple-globals
|
||||
(define *ripple-globals* (new 'global 'ripple-globals))
|
||||
|
||||
;; definition for function ripple-make-request
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defun ripple-make-request ((arg0 ripple-wave) (arg1 merc-effect))
|
||||
(let ((v1-1 (-> *ripple-globals* count))
|
||||
(a2-1 (-> *ripple-globals* requests))
|
||||
(a3-0 0)
|
||||
)
|
||||
(when (< v1-1 16)
|
||||
(dotimes (t0-1 v1-1)
|
||||
(if (= arg1 (-> a2-1 t0-1 effect))
|
||||
(set! a3-0 1)
|
||||
)
|
||||
)
|
||||
(when (zero? a3-0)
|
||||
(set! (-> a2-1 v1-1 effect) arg1)
|
||||
(set! (-> a2-1 v1-1 waveform) arg0)
|
||||
(set! (-> *ripple-globals* count) (+ (-> *ripple-globals* count) 1))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v0-0 0))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function ripple-update-waveform-offs
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defun ripple-update-waveform-offs ((arg0 ripple-wave-set))
|
||||
(let
|
||||
((f0-1
|
||||
(the float (- (-> *display* integral-frame-counter) (-> arg0 frame-save)))
|
||||
)
|
||||
)
|
||||
(when (!= f0-1 0.0)
|
||||
(dotimes (v1-4 (-> arg0 count))
|
||||
(let ((a1-4 (-> arg0 wave v1-4)))
|
||||
(set! (-> a1-4 offs) (+ (-> a1-4 offs) (* f0-1 (-> a1-4 delta))))
|
||||
(set! (-> a1-4 offs) (the float (logand (the int (-> a1-4 offs)) #xffff)))
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 frame-save) (-> *display* integral-frame-counter))
|
||||
)
|
||||
)
|
||||
(let ((v0-0 0))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function ripple-execute-init
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
;; definition for function ripple-create-wave-table
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
;; definition for function ripple-apply-wave-table
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
;; definition for function ripple-execute
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defun ripple-execute ()
|
||||
(when (-> *ripple-globals* count)
|
||||
(ripple-execute-init)
|
||||
(let ((gp-0 0)
|
||||
(s5-0 (-> *ripple-globals* count))
|
||||
(s4-0 (-> *ripple-globals* requests))
|
||||
)
|
||||
(while (!= gp-0 s5-0)
|
||||
(when (-> s4-0 gp-0 waveform)
|
||||
(let ((s3-0 gp-0)
|
||||
(s2-0 (-> s4-0 gp-0 waveform))
|
||||
)
|
||||
(ripple-create-wave-table (the-as ripple-wave-set s2-0))
|
||||
(while (!= s3-0 s5-0)
|
||||
(when (= s2-0 (-> s4-0 s3-0 waveform))
|
||||
(ripple-apply-wave-table (-> s4-0 s3-0 effect))
|
||||
(set! (-> s4-0 s3-0 waveform) #f)
|
||||
)
|
||||
(+! s3-0 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! gp-0 1)
|
||||
)
|
||||
)
|
||||
(set! (-> *ripple-globals* count) 0)
|
||||
(let ((v0-3 0))
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function ripple-matrix-scale
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
;; definition (debug) for function ripple-add-debug-sphere
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
;; Used lq/sq
|
||||
(defun-debug
|
||||
ripple-add-debug-sphere
|
||||
((arg0 process-drawable) (arg1 vector) (arg2 float) (arg3 float))
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(let ((f30-0 (- (quaternion-y-angle (the-as quaternion (-> arg0 root rot)))))
|
||||
(s5-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(set! (-> s5-0 quad) (the-as uint128 0))
|
||||
(let ((f28-0 (+ (-> arg1 x) (* arg2 (-> arg1 z))))
|
||||
(f26-0 (+ (-> arg1 y) (* arg3 (-> arg1 z))))
|
||||
)
|
||||
(set! (-> s5-0 x) (- (* f28-0 (cos f30-0)) (* f26-0 (sin f30-0))))
|
||||
(set! (-> s5-0 y) 0.0)
|
||||
(set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0))))
|
||||
)
|
||||
(set! (-> s5-0 w) 0.0)
|
||||
(let ((a0-6 s5-0))
|
||||
(let ((v1-1 s5-0)
|
||||
(a1-2 (-> arg0 root trans))
|
||||
)
|
||||
(.mov.vf vf6 vf0 :mask #b1000)
|
||||
(.lvf vf4 (&-> v1-1 quad))
|
||||
(.lvf vf5 (&-> a1-2 quad))
|
||||
)
|
||||
(.add.vf vf6 vf4 vf5 :mask #b111)
|
||||
(.svf (&-> a0-6 quad) vf6)
|
||||
)
|
||||
(add-debug-sphere #t 67 s5-0 2048.0 (the-as int #x8000ffff))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function ripple-slow-add-sine-waves
|
||||
(defun
|
||||
ripple-slow-add-sine-waves
|
||||
((arg0 ripple-wave-set) (arg1 float) (arg2 float))
|
||||
(let ((f30-0 0.0))
|
||||
(dotimes (s3-0 (-> arg0 count))
|
||||
(let* ((v1-3 (-> arg0 wave s3-0))
|
||||
(f0-2
|
||||
(+
|
||||
(+ (-> v1-3 offs) (* arg1 (-> v1-3 xmul)))
|
||||
(* arg2 (-> v1-3 zmul))
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! f30-0 (* (-> v1-3 scale) (cos f0-2)))
|
||||
)
|
||||
)
|
||||
(fmax -127.0 (fmin 127.0 f30-0))
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function ripple-find-height
|
||||
(defun ripple-find-height ((arg0 process-drawable) (arg1 basic) (arg2 vector))
|
||||
(local-vars (sv-16 float) (sv-32 float))
|
||||
(let* ((f30-0 (-> arg0 root trans y))
|
||||
(v1-1 (-> arg0 draw))
|
||||
(a1-4 (-> v1-1 lod-set lod (-> v1-1 cur-lod) geo effect))
|
||||
)
|
||||
(if (or (zero? (logand (-> a1-4 0 effect-bits) 4)) (not (-> v1-1 ripple)))
|
||||
(return f30-0)
|
||||
)
|
||||
(let* ((a1-5 (-> a1-4 0 extra-info))
|
||||
(s4-0
|
||||
(the-as
|
||||
mei-ripple
|
||||
(+ (the-as uint a1-5) (the-as uint (* (-> a1-5 ripple-offset) 16)))
|
||||
)
|
||||
)
|
||||
(gp-0 (-> v1-1 ripple))
|
||||
(s5-0 (-> gp-0 waveform))
|
||||
)
|
||||
(if (not (-> gp-0 waveform))
|
||||
(return f30-0)
|
||||
)
|
||||
(if (not (-> s5-0 converted))
|
||||
(return f30-0)
|
||||
)
|
||||
(let* ((f28-0 (- (-> arg2 x) (-> arg0 root trans x)))
|
||||
(f26-0 (- (-> arg2 z) (-> arg0 root trans z)))
|
||||
(f22-0
|
||||
(+
|
||||
(quaternion-y-angle (the-as quaternion (-> arg0 root rot)))
|
||||
(-> s4-0 angle)
|
||||
)
|
||||
)
|
||||
(f24-0 (cos f22-0))
|
||||
(f1-3 (sin f22-0))
|
||||
(f0-4 (- (* f28-0 f24-0) (* f26-0 f1-3)))
|
||||
(f1-5 (+ (* f26-0 f24-0) (* f28-0 f1-3)))
|
||||
(f2-3 (/ 1.0 (-> s4-0 grid-size)))
|
||||
(f28-1 (* f2-3 (- f0-4 (-> s4-0 x-base))))
|
||||
(f26-1 (* f2-3 (- f1-5 (-> s4-0 z-base))))
|
||||
)
|
||||
(ripple-update-waveform-offs s5-0)
|
||||
(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))
|
||||
)
|
||||
(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 (* (* 0.0078125 f1-12) f0-23))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user