[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
+1 -2
View File
@@ -1594,8 +1594,7 @@
))
)
(if (-> obj language-transition)
(set! (-> obj language-x-offset)
(seekl (-> obj language-x-offset) 200 (the int (* 10.0 (-> *display* time-adjust-ratio))))))
(seekl! (-> obj language-x-offset) 200 (the int (* 10.0 (-> *display* time-adjust-ratio)))))
(when (>= (-> obj language-x-offset) 100)
(set! (-> obj language-selection) new-lang)
(set! old-lang new-lang)
+33 -49
View File
@@ -27,14 +27,8 @@
:flag-assert #x900000048
)
(define *progress-state*
(new 'static 'progress-global-state
:yes-no-choice #f
:which -1
:last-slot-saved -1
)
)
(define *progress-state* (new 'static 'progress-global-state :yes-no-choice #f :which -1 :last-slot-saved -1))
(defun get-game-count ((arg0 int))
(-> *game-counts* data arg0)
@@ -1914,30 +1908,26 @@
(if (and (= (-> self display-state) (-> self next-display-state))
(= (-> self display-level-index) (-> self next-level-index))
)
(set! (-> self transition-offset)
(seekl
(-> self transition-offset)
0
(* (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
(if (or (-> self stat-transition) (nonzero? (-> self level-transition)))
2
1
)
)
)
)
(set! (-> self transition-offset)
(seekl
(-> self transition-offset)
512
(* (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
(if (or (-> self stat-transition) (nonzero? (-> self level-transition)))
2
1
)
)
)
)
(seekl!
(-> self transition-offset)
0
(* (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
(if (or (-> self stat-transition) (nonzero? (-> self level-transition)))
2
1
)
)
)
(seekl!
(-> self transition-offset)
512
(* (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
(if (or (-> self stat-transition) (nonzero? (-> self level-transition)))
2
1
)
)
)
)
(set-transition-progress! self (-> self transition-offset))
(set! (-> self in-transition) (or (-> self force-transition) (nonzero? (-> self transition-offset))))
@@ -2233,16 +2223,13 @@
:code
(behavior ()
(loop
(set! (-> self in-out-position)
(seekl (-> self in-out-position) 0 (the int (* 170.0 (-> *display* time-adjust-ratio))))
)
(seekl! (-> self in-out-position) 0 (the int (* 170.0 (-> *display* time-adjust-ratio))))
(when (< (-> self in-out-position) 2867)
(set! (-> self transition-offset) (seekl
(-> self transition-offset)
0
(the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
)
)
(seekl!
(-> self transition-offset)
0
(the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
)
(set-transition-progress! self (-> self transition-offset))
)
(if (zero? (-> self in-out-position))
@@ -2273,17 +2260,14 @@
:code
(behavior ()
(loop
(set! (-> self transition-offset) (seekl
(-> self transition-offset)
512
(the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
)
)
(seekl!
(-> self transition-offset)
512
(the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
)
(set-transition-progress! self (-> self transition-offset))
(when (< 153 (-> self transition-offset))
(set! (-> self in-out-position)
(seekl (-> self in-out-position) 4096 (the int (* 170.0 (-> *display* time-adjust-ratio))))
)
(seekl! (-> self in-out-position) 4096 (the int (* 170.0 (-> *display* time-adjust-ratio))))
(if (= (-> self in-out-position) 4096)
(go progress-gone)
)