[decompiler] detect seek! and seekl! macros (#1317)

* detect `seek!` and `seekl!`

* fancy struct instead of pair mess

* fixes

* i think this was wrong?

* update refs

* update source

* More logical branching

* even better branching
This commit is contained in:
ManDude
2022-04-18 20:01:44 +01:00
committed by GitHub
parent cbc6987351
commit 66e395d547
109 changed files with 952 additions and 1398 deletions
+72 -103
View File
@@ -401,7 +401,7 @@
(('swim)
(let* ((gp-1 (-> self control last-known-safe-ground))
(s3-1 (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self control trans)))
(f30-1 (fmax (-> (new 'static 'array float 1 8192.0) 0) (fmin 40960.0 (vector-xz-length s3-1))))
(f30-1 (fmax 8192.0 (fmin 40960.0 (vector-xz-length s3-1))))
)
(vector-xz-normalize! s3-1 f30-1)
(let ((s5-0 (new 'stack-no-clear 'event-message-block)))
@@ -411,15 +411,10 @@
(set! (-> s5-0 param 0) (the-as uint #f))
(let ((s4-0 (new 'static 'attack-info :mask #x882)))
(set! (-> s4-0 vector quad) (-> s3-1 quad))
(set! (-> s4-0 shove-up) (+ (lerp-scale
(the-as float 4096.0)
(-> (new 'static 'array float 1 16384.0) 0)
f30-1
(the-as float 4096.0)
(the-as float 40960.0)
)
(fmax 0.0 (- (-> gp-1 y) (-> self control trans y)))
)
(set! (-> s4-0 shove-up)
(+ (lerp-scale (the-as float 4096.0) (the-as float 16384.0) f30-1 (the-as float 4096.0) (the-as float 40960.0))
(fmax 0.0 (- (-> gp-1 y) (-> self control trans y)))
)
)
(set! (-> s4-0 angle) 'up)
(set! (-> s5-0 param 1) (the-as uint s4-0))
@@ -513,7 +508,7 @@
(set! (-> self state-flags) (logand -1025 (-> self state-flags)))
(set! (-> self control dynam gravity-max) (-> self control unknown-dynamics00 gravity-max))
(set! (-> self control dynam gravity-length) (-> self control unknown-dynamics00 gravity-length))
(target-collide-set! 'normal (-> (new 'static 'array float 1 0.0) 0))
(target-collide-set! 'normal (the-as float 0.0))
(set! (-> self control reaction) target-collision-reaction)
(set! (-> self control unknown-vector12 quad) (the-as uint128 0))
(clear-pending-settings-from-process *setting-control* self 'sound-flava)
@@ -538,7 +533,7 @@
(set! (-> self flut entity) (-> v1-11 entity))
)
)
(target-collide-set! 'flut (-> (new 'static 'array float 1 0.0) 0))
(target-collide-set! 'flut (the-as float 0.0))
(set! (-> self control transv quad) (the-as uint128 0))
(set! (-> self control unknown-float01) 0.0)
(logior! (-> self control root-prim prim-core action) (collide-action ca-14))
@@ -598,12 +593,7 @@
)
)
(send-event (ppointer->process (-> self manipy)) 'anim-mode 'loop)
(send-event
(ppointer->process (-> self manipy))
'art-joint-anim
"flut-get-on"
(-> (new 'static 'array float 1 0.0) 0)
)
(send-event (ppointer->process (-> self manipy)) 'art-joint-anim "flut-get-on" 0.0)
(send-event (ppointer->process (-> self manipy)) 'blend-shape #t)
(send-event
(ppointer->process (-> self manipy))
@@ -842,23 +832,21 @@
(the-as float (-> self control unknown-uint20))
(* 4.0 (the-as float (-> self control unknown-uint20)))
f30-1
(-> (new 'static 'array float 1 8192.0) 0)
(the-as float 8192.0)
(the-as float 21845.334)
)
)
(if (and (= (-> self control surf name) '*tar-surface*) (< (-> (new 'static 'array float 1 8192.0) 0) f30-1))
(set! (-> self control unknown-surface00 target-speed) (seek
(-> self control unknown-surface00 target-speed)
(the-as float 4096.0)
(* 245760.0 (-> *display* seconds-per-frame))
)
)
(set! (-> self control unknown-surface00 target-speed) (seek
(-> self control unknown-surface00 target-speed)
(the-as float (-> self control unknown-uint30))
(* 81920.0 (-> *display* seconds-per-frame))
)
)
(if (and (= (-> self control surf name) '*tar-surface*) (< 8192.0 f30-1))
(seek!
(-> self control unknown-surface00 target-speed)
(the-as float 4096.0)
(* 245760.0 (-> *display* seconds-per-frame))
)
(seek!
(-> self control unknown-surface00 target-speed)
(the-as float (-> self control unknown-uint30))
(* 81920.0 (-> *display* seconds-per-frame))
)
)
)
(none)
@@ -952,7 +940,7 @@
(while #t
(suspend)
(let ((f0-13 (lerp-scale
(-> (new 'static 'array float 1 0.0) 0)
(the-as float 0.0)
(the-as float 1.0)
(-> self control unknown-float01)
(the-as float 49152.0)
@@ -1097,13 +1085,11 @@
(go target-flut-hit-ground)
)
(mod-var-jump #t #t (cpad-hold? (-> self control unknown-cpad-info00 number) x) (-> self control transv))
(set! (-> self control unknown-float122)
(seek
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
)
(seek!
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
(none)
)
:code
@@ -1267,13 +1253,11 @@
)
(sound-play-by-name (static-sound-name "flut-flap") (-> self flut flap-sound-id) 1024 0 0 1 #t)
)
(set! (-> self control unknown-float122)
(seek
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
)
(seek!
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
(none)
)
:code
@@ -1318,7 +1302,7 @@
)
)
)
(while (< (-> (new 'static 'array float 1 8192.0) 0) (target-height-above-ground))
(while (< 8192.0 (target-height-above-ground))
(suspend)
(cpad-set-buzz! (-> *cpad-list* cpads 0) 0 3 (seconds 0.1))
(let ((a0-13 (-> self skel root-channel 0)))
@@ -1331,18 +1315,16 @@
(set! (-> gp-1 frame-num) (ja-aframe (the-as float 14.0) 0))
)
)
(set! (-> self control dynam gravity-max) (seek
(-> self control dynam gravity-max)
(-> self control unknown-dynamics00 gravity-max)
(* 163840.0 (-> *display* seconds-per-frame))
)
)
(set! (-> self control dynam gravity-length) (seek
(-> self control dynam gravity-length)
(-> self control unknown-dynamics00 gravity-length)
(* 163840.0 (-> *display* seconds-per-frame))
)
)
(seek!
(-> self control dynam gravity-max)
(-> self control unknown-dynamics00 gravity-max)
(* 163840.0 (-> *display* seconds-per-frame))
)
(seek!
(-> self control dynam gravity-length)
(-> self control unknown-dynamics00 gravity-length)
(* 163840.0 (-> *display* seconds-per-frame))
)
)
(-> *display* base-frame-counter)
(ja-channel-push! 2 30)
@@ -1363,18 +1345,16 @@
)
(while #t
(suspend)
(set! (-> self control dynam gravity-max) (seek
(-> self control dynam gravity-max)
(-> self control unknown-dynamics00 gravity-max)
(* 163840.0 (-> *display* seconds-per-frame))
)
)
(set! (-> self control dynam gravity-length) (seek
(-> self control dynam gravity-length)
(-> self control unknown-dynamics00 gravity-length)
(* 163840.0 (-> *display* seconds-per-frame))
)
)
(seek!
(-> self control dynam gravity-max)
(-> self control unknown-dynamics00 gravity-max)
(* 163840.0 (-> *display* seconds-per-frame))
)
(seek!
(-> self control dynam gravity-length)
(-> self control unknown-dynamics00 gravity-length)
(* 163840.0 (-> *display* seconds-per-frame))
)
(let ((a0-23 (-> self skel root-channel 0)))
(set! (-> a0-23 param 0) (the float (+ (-> a0-23 frame-group data 0 length) -1)))
(joint-control-channel-group-eval! a0-23 (the-as art-joint-anim #f) num-func-loop!)
@@ -1484,13 +1464,11 @@
(logior! (-> self control status) 1)
(go target-flut-hit-ground)
)
(set! (-> self control unknown-float122)
(seek
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
)
(seek!
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
(none)
)
:code
@@ -1700,12 +1678,7 @@
)
(!= (-> self control unknown-uint31) 1)
)
(target-shoved
(-> (new 'static 'array float 1 8192.0) 0)
(-> *TARGET-bank* smack-surface-height)
(the-as process #f)
target-flut-hit
)
(target-shoved (meters 2.0) (-> *TARGET-bank* smack-surface-height) (the-as process #f) target-flut-hit)
)
(if (and (logtest? (-> self water flags) 512)
(zero? (mod (- (-> *display* base-frame-counter) (-> self state-time)) 21))
@@ -1778,7 +1751,7 @@
(the-as uint 12)
)
)
(set-forward-vel (-> (new 'static 'array float 1 0.0) 0))
(set-forward-vel (the-as float 0.0))
(set! f30-0 0.0)
)
((ja-done? 0)
@@ -2043,21 +2016,17 @@
)
)
(send-event (ppointer->process gp-2) 'event 'attack 'flut-attack)
(send-event
(ppointer->process gp-2)
'function
(lambda :behavior target
((arg0 nav-enemy))
(set! (-> arg0 collide-info root-prim local-sphere w) (seek
(-> arg0 collide-info root-prim local-sphere w)
(the-as float 28672.0)
(* 286720.0 (-> *display* seconds-per-frame))
)
)
(update-transforms! (-> arg0 collide-info))
(none)
)
)
(send-event (ppointer->process gp-2) 'function (lambda :behavior target
((arg0 nav-enemy))
(seek!
(-> arg0 collide-info root-prim local-sphere w)
(the-as float 28672.0)
(* 286720.0 (-> *display* seconds-per-frame))
)
(update-transforms! (-> arg0 collide-info))
(none)
)
)
)
(none)
)
@@ -2317,7 +2286,7 @@
(logior! (-> self state-flags) #x8000)
(set! (-> self neck flex-blend) 0.0)
(target-timed-invulnerable-off self)
(push-setting! *setting-control* self 'process-mask 'set (-> (new 'static 'array float 1 0.0) 0) #x14a0000)
(push-setting! *setting-control* self 'process-mask 'set 0.0 #x14a0000)
(copy-settings-from-target! *setting-control*)
(set! (-> self control transv quad) (the-as uint128 0))
(cond
@@ -2530,7 +2499,7 @@
(-> target-flut-start exit)
:code
(behavior ((arg0 handle))
(set-forward-vel (-> (new 'static 'array float 1 0.0) 0))
(set-forward-vel (the-as float 0.0))
(let ((s5-0 0))
(while (zero? (logand (-> self control status) 1))
(target-flut-falling-anim-trans)