[decomp] improve types around enter-state (#923)

* clean up

* restore hack
This commit is contained in:
water111
2021-10-20 20:55:25 -04:00
committed by GitHub
parent 29d15f7fbc
commit b7fe8447e2
104 changed files with 5493 additions and 2733 deletions
@@ -5301,6 +5301,7 @@
)
;; definition for function cam-layout-init
;; INFO: Return type mismatch object vs none.
(defbehavior cam-layout-init cam-layout ()
(set! (-> self res-key) (-> (new 'static 'array float 1 -1000000000.0) 0))
(set! (-> self num-entities) 0)
+10 -10
View File
@@ -157,16 +157,15 @@
:virtual #t
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as object (when (= v1-0 'abort)
(when (logtest? (-> self flags) 1)
(logior! (-> self flags) 2)
(if (= (-> self anim-name type) string)
(go-virtual pov-camera-abort)
)
)
)
)
(case arg2
(('abort)
(when (logtest? (-> self flags) 1)
(logior! (-> self flags) 2)
(if (= (-> self anim-name type) string)
(go-virtual pov-camera-abort)
)
)
)
)
)
:enter
@@ -328,6 +327,7 @@
)
;; definition for function pov-camera-init-by-other
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defbehavior
pov-camera-init-by-other pov-camera
+38 -46
View File
@@ -1249,55 +1249,46 @@
)
;; definition for function anim-tester-standard-event-handler
;; INFO: Return type mismatch none vs object.
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code?
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code?
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code?
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code?
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code?
(defbehavior
anim-tester-standard-event-handler anim-tester
((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as object (cond
((= v1-0 'reset)
(process-disconnect self)
(set! (-> self flags) (logand -2 (-> self flags)))
(when (!= (-> *anim-tester* 0 edit-mode) 1)
(set! (-> *debug-menu-context* is-hidden) #f)
(set! (-> *anim-tester* 0 edit-mode) 0)
(set! *camera-read-buttons* #t)
)
(anim-tester-reset)
(go anim-tester-process)
)
((= v1-0 'change-anim)
(go anim-tester-process)
)
((= v1-0 'pick-object)
(set! (-> self edit-mode) 1)
(set! *camera-read-buttons* #f)
#f
)
((= v1-0 'pick-joint-anim)
(set! (-> self edit-mode) 2)
(set! *camera-read-buttons* #f)
#f
)
((= v1-0 'pick-sequence)
(set! (-> self edit-mode) 3)
(set! *camera-read-buttons* #f)
#f
)
((= v1-0 'edit-sequence)
(set! (-> self edit-mode) 4)
(set! *camera-read-buttons* #f)
#f
)
((= v1-0 'save-sequences)
(anim-tester-save-all-objects self)
)
)
(case arg2
(('reset)
(process-disconnect self)
(set! (-> self flags) (logand -2 (-> self flags)))
(when (!= (-> *anim-tester* 0 edit-mode) 1)
(set! (-> *debug-menu-context* is-hidden) #f)
(set! (-> *anim-tester* 0 edit-mode) 0)
(set! *camera-read-buttons* #t)
)
(anim-tester-reset)
(go anim-tester-process)
)
(('change-anim)
(go anim-tester-process)
)
(('pick-object)
(set! (-> self edit-mode) 1)
(set! *camera-read-buttons* #f)
#f
)
(('pick-joint-anim)
(set! (-> self edit-mode) 2)
(set! *camera-read-buttons* #f)
#f
)
(('pick-sequence)
(set! (-> self edit-mode) 3)
(set! *camera-read-buttons* #f)
#f
)
(('edit-sequence)
(set! (-> self edit-mode) 4)
(set! *camera-read-buttons* #f)
#f
)
(('save-sequences)
(anim-tester-save-all-objects self)
)
)
)
@@ -3259,6 +3250,7 @@
)
;; definition for function initialize-anim-tester
;; INFO: Return type mismatch object vs none.
(defbehavior initialize-anim-tester anim-tester ()
(glst-init-list! (-> self obj-list))
(logclear! (-> self mask) (process-mask menu))
+47 -62
View File
@@ -927,68 +927,53 @@
:virtual #t
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as object (cond
((= v1-0 'touched)
(when (-> self attack-mode)
(when (cond
((= (-> arg0 type) target)
(let
((a1-1
(new 'stack-no-clear 'event-message-block)
)
)
(set! (-> a1-1 from) self)
(set! (-> a1-1 num-params) 2)
(set! (-> a1-1 message) 'attack)
(set! (-> a1-1 param 0) (-> arg3 param 0))
(let
((a0-4 (new 'static 'attack-info :mask #x20)))
(set! (-> a0-4 mode) (-> self attack-mode))
(set! (-> a1-1 param 1) (the-as uint a0-4))
)
(send-event-function arg0 a1-1)
)
)
(else
(let
((a1-2
(new 'stack-no-clear 'event-message-block)
)
)
(set! (-> a1-2 from) self)
(set! (-> a1-2 num-params) 4)
(set! (-> a1-2 message) 'attack)
(set! (-> a1-2 param 0) (-> arg3 param 0))
(set!
(-> a1-2 param 1)
(the-as uint (-> self attack-mode))
)
(let ((v1-13 (+ *global-attack-id* 1)))
(set! *global-attack-id* v1-13)
(set! (-> a1-2 param 2) (the-as uint v1-13))
)
(set! (-> a1-2 param 3) (the-as uint 0))
(send-event-function arg0 a1-2)
)
)
)
(let ((v1-14 (-> self notify-handle)))
(if (handle->process v1-14)
(send-event (-> v1-14 process 0) 'notify 'attack arg0)
)
)
(+! (-> self hits) 1)
(if (>= (-> self hits) (-> self max-hits))
(go-virtual projectile-impact)
)
)
)
)
((= v1-0 'die)
(go-virtual projectile-impact)
)
)
(case arg2
(('touched)
(when (-> self attack-mode)
(when (cond
((= (-> arg0 type) target)
(let ((a1-1 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-1 from) self)
(set! (-> a1-1 num-params) 2)
(set! (-> a1-1 message) 'attack)
(set! (-> a1-1 param 0) (-> arg3 param 0))
(let ((a0-4 (new 'static 'attack-info :mask #x20)))
(set! (-> a0-4 mode) (-> self attack-mode))
(set! (-> a1-1 param 1) (the-as uint a0-4))
)
(send-event-function arg0 a1-1)
)
)
(else
(let ((a1-2 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-2 from) self)
(set! (-> a1-2 num-params) 4)
(set! (-> a1-2 message) 'attack)
(set! (-> a1-2 param 0) (-> arg3 param 0))
(set! (-> a1-2 param 1) (the-as uint (-> self attack-mode)))
(let ((v1-13 (+ *global-attack-id* 1)))
(set! *global-attack-id* v1-13)
(set! (-> a1-2 param 2) (the-as uint v1-13))
)
(set! (-> a1-2 param 3) (the-as uint 0))
(send-event-function arg0 a1-2)
)
)
)
(let ((v1-14 (-> self notify-handle)))
(if (handle->process v1-14)
(send-event (-> v1-14 process 0) 'notify 'attack arg0)
)
)
(+! (-> self hits) 1)
(if (>= (-> self hits) (-> self max-hits))
(go-virtual projectile-impact)
)
)
)
)
(('die)
(go-virtual projectile-impact)
)
)
)
@@ -332,6 +332,7 @@
)
;; definition for method 38 of type process-taskable
;; INFO: Return type mismatch object vs none.
(defmethod dummy-38 process-taskable ((obj process-taskable))
(if (nonzero? (-> obj cell-for-task))
(go (method-of-object obj give-cell))
@@ -945,6 +946,7 @@
)
;; definition for function process-taskable-hide-handler
;; INFO: Return type mismatch object vs none.
(defbehavior
process-taskable-hide-handler process-taskable
((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
@@ -1103,46 +1105,53 @@
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as object (cond
((= v1-0 'shadow)
(the-as shadow-geo (cond
((-> arg3 param 0)
(let ((v0-0 (-> self shadow-backup)))
(set! (-> self draw shadow) v0-0)
v0-0
)
)
(else
(set! (-> self draw shadow) #f)
(the-as shadow-geo #f)
)
)
)
)
((= v1-0 'shadow-min-max)
(let ((v1-5 (-> self draw shadow-ctrl)))
(let ((a0-5 v1-5))
(set!
(-> a0-5 settings bot-plane w)
(- (the-as float (-> arg3 param 0)))
(the-as shadow-geo (cond
((= v1-0 'shadow)
(the-as shadow-geo (cond
((-> arg3 param 0)
(let
((v0-0 (-> self shadow-backup)))
(set! (-> self draw shadow) v0-0)
v0-0
)
)
(else
(set! (-> self draw shadow) #f)
(the-as shadow-geo #f)
)
)
)
)
((= v1-0 'shadow-min-max)
(let ((v1-5 (-> self draw shadow-ctrl)))
(let ((a0-5 v1-5))
(set!
(-> a0-5 settings bot-plane w)
(- (the-as float (-> arg3 param 0)))
)
)
0
(set!
(-> v1-5 settings top-plane w)
(- (the-as float (-> arg3 param 1)))
)
)
(the-as shadow-geo 0)
)
((= v1-0 'end-mode)
(the-as shadow-geo (if (should-display? self)
(the-as
shadow-geo
(go-virtual idle)
)
(the-as
shadow-geo
(go-virtual hidden)
)
)
)
)
)
)
0
(set!
(-> v1-5 settings top-plane w)
(- (the-as float (-> arg3 param 1)))
)
)
(the-as shadow-geo 0)
)
((= v1-0 'end-mode)
(the-as shadow-geo (if (should-display? self)
(the-as shadow-geo (go-virtual idle))
(the-as shadow-geo (go-virtual hidden))
)
)
)
)
)
)
)
@@ -1559,6 +1568,7 @@
)
;; definition for method 42 of type process-taskable
;; INFO: Return type mismatch object vs none.
(defmethod dummy-42 process-taskable ((obj process-taskable))
(cond
((not (should-display? obj))
@@ -2722,6 +2722,7 @@
)
;; definition for function init-target
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defbehavior init-target target ((arg0 continue-point))
(set-setting! *setting-control* self 'allow-pause #f 0.0 0)
+49 -57
View File
@@ -1103,77 +1103,69 @@
)
;; definition for function fall-test
;; INFO: Return type mismatch none vs object.
(defbehavior fall-test target ((arg0 symbol) (arg1 symbol))
(the-as
object
(when
(and
(zero? (logand (-> self control status) 1))
(>=
(- (-> *display* base-frame-counter) (-> self control unknown-dword10))
(the-as int (-> *TARGET-bank* ground-timeout))
)
(>=
0.0
(vector-dot
(-> self control dynam gravity-normal)
(-> self control transv)
)
)
(let ((v1-15 (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
)
)
(or
(not
(or
(= v1-15 (-> self draw art-group data 59))
(= v1-15 (-> self draw art-group data 60))
(= v1-15 (-> self draw art-group data 61))
)
)
(< 4096.0 (target-height-above-ground))
)
)
)
(when
(and
(zero? (logand (-> self control status) 1))
(>=
(- (-> *display* base-frame-counter) (-> self control unknown-dword10))
(<
(-
(-> *display* base-frame-counter)
(the-as int (-> self control rider-time))
)
(the-as int (-> *TARGET-bank* ground-timeout))
)
(>=
0.0
(vector-dot
(-> self control dynam gravity-normal)
(-> self control transv)
)
)
(let ((v1-15 (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
)
)
(or
(not
(or
(= v1-15 (-> self draw art-group data 59))
(= v1-15 (-> self draw art-group data 60))
(= v1-15 (-> self draw art-group data 61))
)
)
(< 4096.0 (target-height-above-ground))
)
)
(logtest? (-> self control unknown-surface01 flags) #x4000)
)
(when
(and
(<
(-
(-> *display* base-frame-counter)
(the-as int (-> self control rider-time))
)
(the-as int (-> *TARGET-bank* ground-timeout))
)
(logtest? (-> self control unknown-surface01 flags) #x4000)
)
(+! (-> self control transv x) (-> self control rider-last-move x))
(+! (-> self control transv z) (-> self control rider-last-move z))
)
(go target-falling #f)
(+! (-> self control transv x) (-> self control rider-last-move x))
(+! (-> self control transv z) (-> self control rider-last-move z))
)
(go target-falling #f)
)
)
;; definition for function slide-down-test
;; INFO: Return type mismatch none vs object.
(defbehavior slide-down-test target ((arg0 symbol) (arg1 symbol))
(the-as
object
(if
(and
(zero? (logand (-> self control status) 129))
(>=
(- (-> *display* base-frame-counter) (-> self control unknown-dword10))
(the-as int (-> *TARGET-bank* ground-timeout))
)
(logtest? (-> self control status) 4)
(< 0.5 (-> self control surface-angle))
(if
(and
(zero? (logand (-> self control status) 129))
(>=
(- (-> *display* base-frame-counter) (-> self control unknown-dword10))
(the-as int (-> *TARGET-bank* ground-timeout))
)
(go target-slide-down)
(logtest? (-> self control status) 4)
(< 0.5 (-> self control surface-angle))
)
(go target-slide-down)
)
)