[decomp] add (most) PAL changes to main (#925)

* add (most) PAL changes to `main`

* fix examplecam movement

* fix up camera code

* Use `score` system when decompiling structures

* typo

* restore asserts
This commit is contained in:
ManDude
2021-10-23 20:38:06 +01:00
committed by GitHub
parent 5b7b872ca1
commit 8ca67a5c21
28 changed files with 1012 additions and 1215 deletions
File diff suppressed because it is too large Load Diff
+35 -19
View File
@@ -2239,13 +2239,13 @@
(set! f30-0 (fmin f30-0 (- (-> arg0 next-normal w))))
)
(cond
((= (-> self los-state) 2)
((= (-> self los-state) (slave-los-state ccw))
(if *display-cam-los-debug*
(format *stdcon* "straddle stick ccw~%")
)
(vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad)))
)
((= (-> self los-state) 1)
((= (-> self los-state) (slave-los-state cw))
(if *display-cam-los-debug*
(format *stdcon* "straddle stick cw~%")
)
@@ -2296,7 +2296,7 @@
(if *display-cam-los-debug*
(format *stdcon* "straddle diagonal ccw~%")
)
(set! (-> self los-state) (the-as uint 2))
(set! (-> self los-state) (slave-los-state ccw))
(vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad)))
)
((and
@@ -2342,21 +2342,21 @@
(if *display-cam-los-debug*
(format *stdcon* "straddle diagonal cw~%")
)
(set! (-> self los-state) (the-as uint 1))
(set! (-> self los-state) (slave-los-state cw))
(vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad)))
)
((< f28-0 (- f30-0))
(if *display-cam-los-debug*
(format *stdcon* "straddle ccw~%")
)
(set! (-> self los-state) (the-as uint 2))
(set! (-> self los-state) (slave-los-state ccw))
(vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad)))
)
(else
(if *display-cam-los-debug*
(format *stdcon* "straddle cw~%")
)
(set! (-> self los-state) (the-as uint 1))
(set! (-> self los-state) (slave-los-state cw))
(vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad)))
)
)
@@ -2375,7 +2375,7 @@
(if *display-cam-los-debug*
(format *stdcon* "diagonal ccw~%")
)
(set! (-> self los-state) (the-as uint 2))
(set! (-> self los-state) (slave-los-state ccw))
(vector-normalize!
arg1
(- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 next-normal z))
@@ -2394,7 +2394,7 @@
(if *display-cam-los-debug*
(format *stdcon* "diagonal cw~%")
)
(set! (-> self los-state) (the-as uint 1))
(set! (-> self los-state) (slave-los-state cw))
(vector-normalize!
arg1
(- (-> arg0 intersection z) (-> *CAM_STRING-bank* los-coll-rad))
@@ -2404,14 +2404,14 @@
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
)
(set! (-> self los-state) (the-as uint 3))
(set! (-> self los-state) (slave-los-state between))
(vector-normalize! arg1 (the-as float 0.0001))
)
((dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(if *display-cam-los-debug*
(format *stdcon* "regular cw~%")
)
(set! (-> self los-state) (the-as uint 1))
(set! (-> self los-state) (slave-los-state cw))
(vector-normalize!
arg1
(- (-> arg0 intersection z) (-> *CAM_STRING-bank* los-coll-rad))
@@ -2421,14 +2421,14 @@
(if *display-cam-los-debug*
(format *stdcon* "regular ccw~%")
)
(set! (-> self los-state) (the-as uint 2))
(set! (-> self los-state) (slave-los-state ccw))
(vector-normalize!
arg1
(- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 next-normal z))
)
)
(else
(set! (-> self los-state) (the-as uint 0))
(set! (-> self los-state) (slave-los-state none))
(vector-reset! arg1)
)
)
@@ -2956,9 +2956,15 @@
)
((= (-> self string-vel-dir) 5)
)
((and (= (-> self string-vel-dir) 2) (= (-> self los-state) 1))
((and
(= (-> self string-vel-dir) 2)
(= (-> self los-state) (slave-los-state cw))
)
)
((and (= (-> self string-vel-dir) 1) (= (-> self los-state) 2))
((and
(= (-> self string-vel-dir) 1)
(= (-> self los-state) (slave-los-state ccw))
)
)
)
(when *display-cam-los-debug*
@@ -3072,7 +3078,10 @@
)
((and
(< f30-0 f28-0)
(or (= (-> self los-state) 2) (= (-> self los-state) 1))
(or
(= (-> self los-state) (slave-los-state ccw))
(= (-> self los-state) (slave-los-state cw))
)
)
(vector-normalize! (-> self view-flat) f30-0)
)
@@ -3106,7 +3115,11 @@
(vector-! s5-0 s5-0 (-> self string-trans))
(cam-los-collide (-> self string-trans) s5-0 gp-0 4098)
(when (-> gp-0 vert-next y)
(when (or (= (-> self los-state) 2) (= (-> self los-state) 1))
(when
(or
(= (-> self los-state) (slave-los-state ccw))
(= (-> self los-state) (slave-los-state cw))
)
(let ((a0-6 (new 'stack-no-clear 'vector)))
(vector-! a0-6 (-> *camera* tpos-curr) (-> *camera* tpos-old))
(if
@@ -3271,7 +3284,10 @@
)
((and
(< 0.0 f28-0)
(or (= (-> self los-state) 2) (= (-> self los-state) 1))
(or
(= (-> self los-state) (slave-los-state ccw))
(= (-> self los-state) (slave-los-state cw))
)
)
)
((< (* 0.05 (- 1.0 f0-16)) f28-0)
@@ -3341,7 +3357,7 @@
)
)
(cond
((and (= (-> self los-state) 2) (< 0.0 f0-29))
((and (= (-> self los-state) (slave-los-state ccw)) (< 0.0 f0-29))
(let
((f0-34
(fmax
@@ -3360,7 +3376,7 @@
)
)
)
((and (= (-> self los-state) 1) (< f0-29 0.0))
((and (= (-> self los-state) (slave-los-state cw)) (< f0-29 0.0))
(let
((f0-40
(fmax
+5 -5
View File
@@ -6,7 +6,7 @@
((collide-move-rad float :offset-assert 4)
(joypad uint32 :offset-assert 8)
(min-detectable-velocity float :offset-assert 12)
(attack-timeout uint64 :offset-assert 16)
(attack-timeout seconds :offset-assert 16)
(default-string-max-y meters :offset-assert 24)
(default-string-min-y meters :offset-assert 28)
(default-string-max-z meters :offset-assert 32)
@@ -61,7 +61,7 @@
(new 'static 'camera-bank
:collide-move-rad 1638.4
:min-detectable-velocity 40.96
:attack-timeout #x4b
:attack-timeout (seconds 0.25)
:default-string-max-y (meters 3.0)
:default-string-min-y (meters 1.0)
:default-string-max-z (meters 12.5)
@@ -73,8 +73,8 @@
;; definition of type cam-index
(deftype cam-index (structure)
((flags uint32 :offset-assert 0)
(vec vector 2 :inline :offset 16)
((flags cam-index-options :offset-assert 0)
(vec vector 2 :inline :offset 16)
)
:method-count-assert 11
:size-assert #x30
@@ -507,7 +507,7 @@
(velocity vector :inline :offset-assert 2208)
(desired-pos vector :inline :offset-assert 2224)
(time-dist-too-far uint32 :offset-assert 2240)
(los-state uint32 :offset-assert 2244)
(los-state slave-los-state :offset-assert 2244)
(good-point vector :inline :offset-assert 2256)
(los-tgt-spline-pt int32 :offset-assert 2272)
(los-tgt-spline-pt-incarnation int32 :offset-assert 2276)
+13 -10
View File
@@ -385,7 +385,10 @@
(format (clear *cam-res-string*) "~S-flags" arg0)
(set!
(-> obj flags)
(the-as uint (cam-slave-get-flags arg1 (string->symbol *res-key-string*)))
(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))
@@ -455,7 +458,7 @@
(let ((s4-1 (new-stack-vector0)))
0.0
(cond
((logtest? (-> obj flags) 2)
((logtest? (-> obj flags) (cam-index-options SPHERICAL))
(vector-! s4-1 (-> obj vec 1) arg2)
(set! (-> obj vec 1 w) (vector-length s4-1))
(vector-! s4-1 (the-as vector (-> obj vec)) arg2)
@@ -463,7 +466,7 @@
(set! (-> obj vec 1 w) (- (-> obj vec 1 w) (-> obj vec 1 x)))
(set! (-> obj vec 0 quad) (-> arg2 quad))
)
((logtest? (-> obj flags) 1)
((logtest? (-> obj flags) (cam-index-options RADIAL))
(vector-! s4-1 (-> obj vec 1) arg2)
(set! (-> obj vec 1 w) (vector-length s4-1))
(vector-! s4-1 (the-as vector (-> obj vec)) arg2)
@@ -487,11 +490,11 @@
0.0
(vector-! s5-0 arg0 (the-as vector (-> obj vec)))
(cond
((logtest? (-> obj flags) 2)
((logtest? (-> obj flags) (cam-index-options SPHERICAL))
(vector-flatten! s5-0 s5-0 (-> *camera* local-down))
(/ (- (vector-length s5-0) (-> obj vec 1 x)) (-> obj vec 1 w))
)
((logtest? (-> obj flags) 1)
((logtest? (-> obj flags) (cam-index-options RADIAL))
(/ (- (vector-length s5-0) (-> obj vec 1 x)) (-> obj vec 1 w))
)
(else
@@ -940,11 +943,11 @@
((< f26-0 0.0)
(if (and *debug-segment* *display-camera-marks*)
(camera-line-rel-len
(-> obj point s1-0)
(the-as vector (-> obj point s1-0))
s2-0
(* -40.96 f26-0)
(the-as
rgba
vector4w
(new 'static 'inline-array qword 1
(new 'static 'qword
:data
@@ -958,11 +961,11 @@
)
((and *debug-segment* *display-camera-marks*)
(camera-line-rel-len
(-> obj point s1-0)
(the-as vector (-> obj point s1-0))
s2-0
(* 40.96 f26-0)
(the-as
rgba
vector4w
(new 'static 'inline-array qword 1
(new 'static 'qword
:data
@@ -1174,7 +1177,7 @@
(set! (-> self intro-t) 1.0)
(set! (-> self intro-t-step) 0.0)
(set! (-> self spline-exists) #f)
(set! (-> self los-state) (the-as uint 0))
(set! (-> self los-state) (slave-los-state none))
(set! (-> self enter-has-run) #f)
(set! (-> self cam-entity) #f)
(set! (-> self tracking no-follow) #f)
+1 -2
View File
@@ -407,8 +407,7 @@
(new 'static 'vector :z 1.0)
)
)
:color-shadow
(new 'static 'vector4w :data (new 'static 'array int32 4 0 0 0 #x80))
:color-shadow (new 'static 'vector4w :w #x80)
:color-table
(new 'static 'inline-array char-color 64
(new 'static 'char-color
@@ -586,10 +586,7 @@
(new 'static 'vector :x 0.5 :y 100.0 :z 0.0166 :w -1.0)
:constants (new 'static 'vector :x 128.0 :y 1.0)
:color-constant
(new 'static 'vector4w
:data
(new 'static 'array int32 4 #x47000000 #x47000000 #x47000000 0)
)
(new 'static 'vector4w :x #x47000000 :y #x47000000 :z #x47000000)
:start-bank
(new 'static 'array uint8 20
#x0
+7 -7
View File
@@ -250,13 +250,13 @@
;; definition of type vector4w
(deftype vector4w (structure)
((data int32 4 :offset-assert 0)
(x int32 :offset 0)
(y int32 :offset 4)
(z int32 :offset 8)
(w int32 :offset 12)
(dword uint64 2 :offset 0)
(quad uint128 :offset 0)
((data int32 4 :offset 0)
(x int32 :offset 0)
(y int32 :offset 4)
(z int32 :offset 8)
(w int32 :offset 12)
(dword uint64 2 :offset 0)
(quad uint128 :offset 0)
)
:method-count-assert 9
:size-assert #x10
+22 -22
View File
@@ -60,13 +60,13 @@
(swim-jump-height-max meters :offset-assert 68)
(tube-jump-height-min meters :offset-assert 72)
(tube-jump-height-max meters :offset-assert 76)
(wheel-duration uint64 :offset-assert 80)
(wheel-jump-pre-window uint64 :offset-assert 88)
(wheel-jump-post-window uint64 :offset-assert 96)
(wheel-timeout uint64 :offset-assert 104)
(wheel-duration seconds :offset-assert 80)
(wheel-jump-pre-window seconds :offset-assert 88)
(wheel-jump-post-window seconds :offset-assert 96)
(wheel-timeout seconds :offset-assert 104)
(wheel-speed-min meters :offset-assert 112)
(wheel-speed-inc meters :offset-assert 116)
(wheel-flip-duration uint64 :offset-assert 120)
(wheel-flip-duration seconds :offset-assert 120)
(wheel-flip-height meters :offset-assert 128)
(wheel-flip-dist meters :offset-assert 132)
(wheel-flip-art-height meters :offset-assert 136)
@@ -74,13 +74,13 @@
(duck-slide-distance meters :offset-assert 144)
(fall-far meters :offset-assert 148)
(fall-far-inc meters :offset-assert 152)
(attack-timeout uint64 :offset-assert 160)
(ground-timeout uint64 :offset-assert 168)
(slide-down-timeout uint64 :offset-assert 176)
(fall-timeout uint64 :offset-assert 184)
(attack-timeout seconds :offset-assert 160)
(ground-timeout seconds :offset-assert 168)
(slide-down-timeout seconds :offset-assert 176)
(fall-timeout seconds :offset-assert 184)
(fall-stumble-threshold meters :offset-assert 192)
(yellow-projectile-speed meters :offset-assert 196)
(hit-invulnerable-timeout uint64 :offset-assert 200)
(hit-invulnerable-timeout seconds :offset-assert 200)
(run-cycle-length float :offset-assert 208)
(walk-cycle-dist meters :offset-assert 212)
(walk-up-cycle-dist meters :offset-assert 216)
@@ -122,7 +122,7 @@
(stuck-distance meters :offset-assert 576)
(tongue-pull-speed-min float :offset-assert 580)
(tongue-pull-speed-max float :offset-assert 584)
(yellow-attack-timeout uint64 :offset-assert 592)
(yellow-attack-timeout seconds :offset-assert 592)
)
:method-count-assert 9
:size-assert #x258
@@ -368,12 +368,12 @@
:swim-jump-height-max (meters 5.0)
:tube-jump-height-min (meters 1.75)
:tube-jump-height-max (meters 2.5)
:wheel-duration #x96
:wheel-jump-pre-window #x12c
:wheel-jump-post-window #x1e
:wheel-duration (seconds 0.5)
:wheel-jump-pre-window (seconds 1)
:wheel-jump-post-window (seconds 0.1)
:wheel-speed-min (meters 11.5)
:wheel-speed-inc (meters 1.5)
:wheel-flip-duration #xd2
:wheel-flip-duration (seconds 0.7)
:wheel-flip-height (meters 3.52)
:wheel-flip-dist (meters 17.3)
:wheel-flip-art-height (meters 3.2969)
@@ -381,13 +381,13 @@
:duck-slide-distance (meters 5.75)
:fall-far (meters 30.0)
:fall-far-inc (meters 20.0)
:attack-timeout #x5a
:ground-timeout #x3c
:slide-down-timeout #x3c
:fall-timeout #x12c
:attack-timeout (seconds 0.3)
:ground-timeout (seconds 0.2)
:slide-down-timeout (seconds 0.2)
:fall-timeout (seconds 1)
:fall-stumble-threshold (meters 39.9)
:yellow-projectile-speed (meters 60.0)
:hit-invulnerable-timeout #x384
:hit-invulnerable-timeout (seconds 3)
:run-cycle-length 60.0
:walk-cycle-dist (meters 2.8)
:walk-up-cycle-dist (meters 2.8)
@@ -429,7 +429,7 @@
:stuck-distance (meters 0.05)
:tongue-pull-speed-min 0.15
:tongue-pull-speed-max 0.22
:yellow-attack-timeout #x3c
:yellow-attack-timeout (seconds 0.2)
)
)
@@ -1433,7 +1433,7 @@
;; definition for function target-timed-invulnerable
;; INFO: Return type mismatch int vs none.
(defun target-timed-invulnerable ((arg0 uint) (arg1 target))
(defun target-timed-invulnerable ((arg0 seconds) (arg1 target))
(logior! (-> arg1 state-flags) 32)
(set! (-> arg1 control unknown-dword70) (-> *display* base-frame-counter))
(set! (-> arg1 control unknown-dword71) (the-as int arg0))