[jak2] decomp cleanup of traffic things + fix stadium crash (#2319)

This commit is contained in:
ManDude
2023-03-11 22:45:14 +00:00
committed by GitHub
parent 0c64d48b0d
commit 0cf285ef99
38 changed files with 332 additions and 211 deletions
+14 -14
View File
@@ -51,7 +51,7 @@
;; definition of type traffic-suppression-params
(deftype traffic-suppression-params (structure)
((bbox bounding-box :inline :offset-assert 0)
(duration uint64 :offset-assert 32)
(duration time-frame :offset-assert 32)
(id int8 :offset-assert 40)
)
:method-count-assert 13
@@ -88,19 +88,19 @@
;; definition of type traffic-object-spawn-params
(deftype traffic-object-spawn-params (structure)
((object-type traffic-type :offset-assert 0)
(behavior uint64 :offset-assert 8)
(id uint32 :offset-assert 16)
(nav-mesh nav-mesh :offset-assert 20)
(nav-branch nav-branch :offset-assert 24)
(position vector :inline :offset-assert 32)
(rotation quaternion :inline :offset-assert 48)
(velocity vector :inline :offset-assert 64)
(handle handle :offset-assert 80)
(guard-type uint8 :offset-assert 88)
(user-data uint32 :offset-assert 92)
(flags uint32 :offset-assert 96)
(proc process :offset-assert 100)
((object-type traffic-type :offset-assert 0)
(behavior uint64 :offset-assert 8)
(id uint32 :offset-assert 16)
(nav-mesh nav-mesh :offset-assert 20)
(nav-branch nav-branch :offset-assert 24)
(position vector :inline :offset-assert 32)
(rotation quaternion :inline :offset-assert 48)
(velocity vector :inline :offset-assert 64)
(handle handle :offset-assert 80)
(guard-type uint8 :offset-assert 88)
(user-data uint32 :offset-assert 92)
(flags traffic-spawn-flags :offset-assert 96)
(proc process :offset-assert 100)
)
:method-count-assert 9
:size-assert #x68
+10 -7
View File
@@ -726,7 +726,7 @@
)
(when v1-1
(let ((a0-3 (-> v1-1 nav-mesh))
(v1-2 (the-as structure #f))
(v1-2 (the-as nav-mesh-link #f))
)
(dotimes (a1-2 (the-as int (-> a0-3 link-count)))
(let ((a2-1 (-> a0-3 link-array a1-2)))
@@ -739,13 +739,13 @@
(label cfg-7)
)
(label cfg-10)
(when (the-as nav-mesh-link v1-2)
(when v1-2
(set! (-> arg0 dest-mesh) a0-3)
(set! (-> (the-as nav-mesh v1-2) route) (the-as (pointer nav-poly) obj))
(set! (-> arg0 dest-link-poly-id) (-> (the-as nav-mesh v1-2) poly-count))
(set! (-> arg0 dest-switch-poly-id) (-> (the-as nav-mesh v1-2) static-sphere-count))
(set! (-> (the-as nav-mesh v1-2) nav-control-count) (-> arg0 src-switch-poly-id))
(set! (-> (the-as nav-mesh v1-2) max-nav-control-count) (-> arg0 src-link-poly-id))
(set! (-> v1-2 dest-mesh) obj)
(set! (-> arg0 dest-link-poly-id) (-> v1-2 src-switch-poly-id))
(set! (-> arg0 dest-switch-poly-id) (-> v1-2 src-link-poly-id))
(set! (-> v1-2 dest-link-poly-id) (-> arg0 src-switch-poly-id))
(set! (-> v1-2 dest-switch-poly-id) (-> arg0 src-link-poly-id))
#t
)
)
@@ -2835,3 +2835,6 @@
(none)
)
+2 -2
View File
@@ -735,14 +735,14 @@ This commonly includes things such as:
(init-enemy-collision! self)
(set! (-> self root-override2 trans quad) (-> arg0 position quad))
(quaternion-copy! (-> self root-override2 quat) (-> arg0 rotation))
(if (not (logtest? (-> arg0 flags) 1))
(if (not (logtest? (-> arg0 flags) (traffic-spawn-flags trsflags-00)))
(lwide-entity-hack)
)
(set! (-> self vehicle) (-> arg0 handle))
(set! (-> self interp) 0.0)
(logclear! (-> self flags) (citizen-flag run-mode))
(logclear! (-> self flags) (citizen-flag shuffle-mode))
(if (logtest? (-> arg0 flags) 8)
(if (logtest? (-> arg0 flags) (traffic-spawn-flags dark-guard))
(logior! (-> self flags) (citizen-flag dark-guard))
)
(init-enemy! self)
+1 -1
View File
@@ -1044,7 +1044,7 @@ This commonly includes things such as:
(quaternion-look-at! (-> s1-0 rotation) s2-0 *up-vector*)
(set! (-> s1-0 user-data) (the-as uint s5-1))
(set! (-> s1-0 position w) f30-0)
(logior! (-> s1-0 flags) 1)
(logior! (-> s1-0 flags) (traffic-spawn-flags trsflags-00))
(process->handle (vehicle-spawn obj barge s1-0))
)
(+! f30-0 (/ (* 4096.0 (+ 150.0 (* 150.0 (rand-vu)))) (total-distance s4-0)))
+5 -1
View File
@@ -712,7 +712,7 @@
(set! (-> s5-0 proc) #f)
(set! (-> s5-0 handle) (process->handle *target*))
(set! (-> s5-0 user-data) (the-as uint 0))
(set! (-> s5-0 flags) (the-as uint 0))
(set! (-> s5-0 flags) (traffic-spawn-flags))
(set! (-> s5-0 guard-type) (the-as uint 1))
(vector-reset! (-> s5-0 velocity))
(quaternion-identity! (-> s5-0 rotation))
@@ -906,3 +906,7 @@
)
)
)
+3 -3
View File
@@ -235,7 +235,7 @@
"Kill a suppression box, and inform the traffic manager by setting duration to 0."
(when (!= (-> obj id) -1)
(let ((s5-0 (-> obj duration)))
(set! (-> obj duration) (the-as uint 0))
(set! (-> obj duration) 0)
(send-event *traffic-manager* 'update-suppression-box obj)
(set! (-> obj duration) s5-0)
)
@@ -309,7 +309,7 @@ The param object is updated with the ID of the box and can be later used with up
(s4-1 (logior (-> s5-0 flags) (traffic-suppression-box-flags tfsb1)))
)
(mem-copy! (the-as pointer (-> s5-0 bbox)) (the-as pointer (-> arg0 bbox)) 32)
(set! (-> s5-0 duration) (-> arg0 duration))
(set! (-> s5-0 duration) (the-as uint (-> arg0 duration)))
(set! (-> s5-0 flags) s4-1)
)
)
@@ -1626,7 +1626,7 @@ Process is recycled and moved to reserved, if it deactivates."
(.add.x.vf vf5 vf4 vf6 :mask #b111)
(.svf (&-> a0-2 quad) vf5)
)
(set! (-> a1-1 duration) (the-as uint 1500))
(set! (-> a1-1 duration) (seconds 5))
(new-suppression-box obj a1-1)
)
(let ((v1-5 (-> obj danger-sphere-count)))
+8 -4
View File
@@ -190,7 +190,7 @@
cfg-29
:delay (nop!)
)
(set! (-> s2-0 flags) (logand -9 (-> s2-0 flags)))
(logclear! (-> s2-0 flags) (traffic-spawn-flags dark-guard))
(b!
(not (and (= (-> s2-0 object-type) (traffic-type crimson-guard-1))
(> (-> obj dark-guard-ratio) 0)
@@ -201,7 +201,7 @@
:delay (empty-form)
)
)
(logior! (-> s2-0 flags) 8)
(logior! (-> s2-0 flags) (traffic-spawn-flags dark-guard))
(label cfg-25)
(let ((a2-0 (traffic-object-spawn obj s2-0)))
(b! (not a2-0) cfg-27 :delay (nop!))
@@ -256,7 +256,7 @@
(set! gp-0 (-> v1-1 0))
)
)
(if (and gp-0 (logtest? (-> arg2 flags) 2))
(if (and gp-0 (logtest? (-> arg2 flags) (traffic-spawn-flags trsflags-01)))
(vehicle-method-137 (the-as vehicle gp-0) arg2)
)
(the-as process-drawable gp-0)
@@ -458,7 +458,7 @@
(set! (-> params proc) #f)
(set! (-> params handle) (the-as handle #f))
(set! (-> params user-data) (the-as uint 0))
(set! (-> params flags) (the-as uint 2))
(set! (-> params flags) (traffic-spawn-flags trsflags-01))
(set! (-> params guard-type) (the-as uint 7))
(vector-reset! (-> params velocity))
(vector-reset! (-> params position))
@@ -923,3 +923,7 @@
(none)
)
)
+5 -1
View File
@@ -517,7 +517,7 @@
(set! (-> s5-0 proc) #f)
(set! (-> s5-0 handle) (process->handle obj))
(set! (-> s5-0 user-data) (-> obj spawn-side))
(set! (-> s5-0 flags) (the-as uint 0))
(set! (-> s5-0 flags) (traffic-spawn-flags))
(set! (-> s5-0 guard-type) (the-as uint 7))
(vector-reset! (-> s5-0 velocity))
(set! (-> s5-0 position quad) (-> obj root-override trans quad))
@@ -661,3 +661,7 @@ This commonly includes things such as:
(go (method-of-object obj come-down))
(none)
)
+5 -1
View File
@@ -181,7 +181,7 @@
(set! (-> gp-0 proc) #f)
(set! (-> gp-0 handle) (process->handle (-> self parent-override 0)))
(set! (-> gp-0 user-data) (-> self draw seg-mask))
(set! (-> gp-0 flags) (the-as uint 0))
(set! (-> gp-0 flags) (traffic-spawn-flags))
(set! (-> gp-0 guard-type) (the-as uint 7))
(vector-reset! (-> gp-0 velocity))
(when (logtest? (-> self flags) 8)
@@ -519,3 +519,7 @@ This commonly includes things such as:
0
(none)
)
+1 -1
View File
@@ -1971,7 +1971,7 @@
(allocate-and-init-cshape self)
(set! (-> self root-override-2 trans quad) (-> arg0 position quad))
(quaternion-copy! (-> self root-override-2 quat) (-> arg0 rotation))
(if (not (logtest? (-> arg0 flags) 1))
(if (not (logtest? (-> arg0 flags) (traffic-spawn-flags trsflags-00)))
(lwide-entity-hack)
)
(init-skel-and-rigid-body self)
+6 -2
View File
@@ -344,7 +344,7 @@
)
)
(set! (-> s2-2 user-data) (the-as uint 0))
(set! (-> s2-2 flags) (the-as uint 0))
(set! (-> s2-2 flags) (traffic-spawn-flags))
(set! (-> s2-2 guard-type) (the-as uint 7))
(vector-reset! (-> s2-2 velocity))
(set! (-> s2-2 position quad) (-> s5-1 quad))
@@ -479,7 +479,7 @@
(set! (-> s4-1 proc) #f)
(set! (-> s4-1 handle) (the-as handle #f))
(set! (-> s4-1 user-data) (the-as uint 0))
(set! (-> s4-1 flags) (the-as uint 0))
(set! (-> s4-1 flags) (traffic-spawn-flags))
(set! (-> s4-1 guard-type) (the-as uint 7))
(vector-reset! (-> s4-1 velocity))
(set! (-> s4-1 position quad) (-> obj hal4-course spots 5 center quad))
@@ -2089,3 +2089,7 @@
;; failed to figure out what this is:
(set! (-> *bot-course-table* course 10) *hal4-course*)
@@ -51,7 +51,7 @@
(t9-0 obj)
)
(let ((v1-1 (-> obj suppress)))
(set! (-> v1-1 duration) (the-as uint 300))
(set! (-> v1-1 duration) (seconds 1))
(set! (-> v1-1 id) -1)
(let ((a0-4 (-> v1-1 bbox)))
(set! (-> a0-4 min x) 1634304.0)
@@ -807,17 +807,17 @@
;; definition of type city-lurker
(deftype city-lurker (civilian)
((nav-mesh-aid uint32 :offset-assert 1060)
(index uint32 :offset-assert 1064)
(left-right-interp float :offset-assert 1068)
(front-back-interp float :offset-assert 1072)
(v-speed vector :inline :offset-assert 1088)
(end-pos vector :inline :offset-assert 1104)
(task-done? symbol :offset-assert 1120)
(task-node uint16 :offset-assert 1124)
(jump-in-pipe? symbol :offset-assert 1128)
(pipe-name string :offset-assert 1132)
(coming-from-pw symbol :offset-assert 1136)
((nav-mesh-aid uint32 :offset-assert 1060)
(index uint32 :offset-assert 1064)
(left-right-interp float :offset-assert 1068)
(front-back-interp float :offset-assert 1072)
(v-speed vector :inline :offset-assert 1088)
(end-pos vector :inline :offset-assert 1104)
(task-done? symbol :offset-assert 1120)
(task-node game-task-node :offset-assert 1124)
(jump-in-pipe? symbol :offset-assert 1128)
(pipe-name string :offset-assert 1132)
(coming-from-pw symbol :offset-assert 1136)
)
:heap-base #x400
:method-count-assert 221
@@ -2407,7 +2407,7 @@
(set! (-> gp-1 params 0 proc) #f)
(set! (-> gp-1 params 0 handle) (the-as handle #f))
(set! (-> gp-1 params 0 user-data) (the-as uint 0))
(set! (-> gp-1 params 0 flags) (the-as uint 2))
(set! (-> gp-1 params 0 flags) (traffic-spawn-flags trsflags-01))
(set! (-> gp-1 params 0 guard-type) (the-as uint 7))
(vector-reset! (-> gp-1 params 0 velocity))
(set! (-> gp-1 params 0 position quad) (-> gp-1 vec quad))
@@ -2420,7 +2420,7 @@
(set! (-> gp-1 params 1 proc) #f)
(set! (-> gp-1 params 1 handle) (the-as handle #f))
(set! (-> gp-1 params 1 user-data) (the-as uint 0))
(set! (-> gp-1 params 1 flags) (the-as uint 1))
(set! (-> gp-1 params 1 flags) (traffic-spawn-flags trsflags-00))
(set! (-> gp-1 params 1 guard-type) (the-as uint 7))
(vector-reset! (-> gp-1 params 1 velocity))
(set! (-> gp-1 params 1 position quad) (-> gp-1 vec quad))
@@ -2443,7 +2443,7 @@
(let ((s3-0 (the-as city-lurker (citizen-spawn self city-lurker (-> gp-1 params 1)))))
(when s3-0
(set! (-> s3-0 end-pos quad) (-> s2-0 end-pos quad))
(set! (-> s3-0 task-node) (the-as uint 124))
(set! (-> s3-0 task-node) (game-task-node city-meet-brutter-meet-brutter))
(set! (-> s3-0 index) (the-as uint s5-1))
(set! (-> s3-0 nav-mesh-aid) (the-as uint 0))
(set! (-> self slave s5-1) (process->handle s3-0))
@@ -2634,7 +2634,7 @@
(set! (-> s4-0 proc) #f)
(set! (-> s4-0 handle) (-> self slave (+ gp-1 (-> self max-count))))
(set! (-> s4-0 user-data) (the-as uint 0))
(set! (-> s4-0 flags) (the-as uint 2))
(set! (-> s4-0 flags) (traffic-spawn-flags trsflags-01))
(set! (-> s4-0 guard-type) (the-as uint 7))
(vector-reset! (-> s4-0 velocity))
(set! (-> s4-0 position quad) (-> (the-as paddywagon s5-1) root-override-2 trans quad))
@@ -2687,7 +2687,7 @@
(set! (-> s3-1 proc) #f)
(set! (-> s3-1 handle) (-> self slave s5-2))
(set! (-> s3-1 user-data) (the-as uint 0))
(set! (-> s3-1 flags) (the-as uint 0))
(set! (-> s3-1 flags) (traffic-spawn-flags))
(set! (-> s3-1 guard-type) (the-as uint 7))
(vector-reset! (-> s3-1 velocity))
(set! (-> s3-1 position quad) (-> (the-as city-lurker s4-2) root-override2 trans quad))
@@ -3018,7 +3018,7 @@
(set! (-> gp-0 params 0 proc) #f)
(set! (-> gp-0 params 0 handle) (the-as handle #f))
(set! (-> gp-0 params 0 user-data) (the-as uint 0))
(set! (-> gp-0 params 0 flags) (the-as uint 2))
(set! (-> gp-0 params 0 flags) (traffic-spawn-flags trsflags-01))
(set! (-> gp-0 params 0 guard-type) (the-as uint 7))
(vector-reset! (-> gp-0 params 0 velocity))
(set! (-> gp-0 params 0 position quad) (-> gp-0 vec quad))
@@ -3031,7 +3031,7 @@
(set! (-> gp-0 params 1 proc) #f)
(set! (-> gp-0 params 1 handle) (the-as handle #f))
(set! (-> gp-0 params 1 user-data) (the-as uint 0))
(set! (-> gp-0 params 1 flags) (the-as uint 1))
(set! (-> gp-0 params 1 flags) (traffic-spawn-flags trsflags-00))
(set! (-> gp-0 params 1 guard-type) (the-as uint 7))
(vector-reset! (-> gp-0 params 1 velocity))
(set! (-> gp-0 params 1 position quad) (-> gp-0 vec quad))
@@ -3056,7 +3056,7 @@
(set! (-> s3-0 jump-in-pipe?) #t)
(set! (-> s3-0 pipe-name) (-> s2-0 pipe-name))
(set! (-> s3-0 end-pos quad) (-> s2-0 end-pos quad))
(set! (-> s3-0 task-node) (the-as uint 207))
(set! (-> s3-0 task-node) (game-task-node city-save-lurkers-save-lurkers))
(set! (-> s3-0 index) (the-as uint s5-0))
(set! (-> s3-0 nav-mesh-aid) (the-as uint 0))
(set! (-> self slave s5-0) (process->handle s3-0))
@@ -3237,7 +3237,7 @@
(set! (-> s4-0 proc) #f)
(set! (-> s4-0 handle) (-> self slave (+ gp-1 (-> self max-count))))
(set! (-> s4-0 user-data) (the-as uint 0))
(set! (-> s4-0 flags) (the-as uint 2))
(set! (-> s4-0 flags) (traffic-spawn-flags trsflags-01))
(set! (-> s4-0 guard-type) (the-as uint 7))
(vector-reset! (-> s4-0 velocity))
(set! (-> s4-0 position quad) (-> (the-as paddywagon s5-2) root-override-2 trans quad))
@@ -3290,7 +3290,7 @@
(set! (-> s3-1 proc) #f)
(set! (-> s3-1 handle) (-> self slave s5-3))
(set! (-> s3-1 user-data) (the-as uint 0))
(set! (-> s3-1 flags) (the-as uint 0))
(set! (-> s3-1 flags) (traffic-spawn-flags))
(set! (-> s3-1 guard-type) (the-as uint 7))
(vector-reset! (-> s3-1 velocity))
(set! (-> s3-1 position quad) (-> (the-as city-lurker s4-2) root-override2 trans quad))
@@ -280,7 +280,7 @@ This commonly includes things such as:
(set! (-> s5-0 proc) #f)
(set! (-> s5-0 handle) (process->handle *target*))
(set! (-> s5-0 user-data) (the-as uint 0))
(set! (-> s5-0 flags) (the-as uint 2))
(set! (-> s5-0 flags) (traffic-spawn-flags trsflags-01))
(set! (-> s5-0 guard-type) (the-as uint 1))
(vector-reset! (-> s5-0 velocity))
(forward-up-nopitch->quaternion
@@ -353,7 +353,7 @@ This commonly includes things such as:
(set! (-> s5-0 proc) #f)
(set! (-> s5-0 handle) (process->handle *target*))
(set! (-> s5-0 user-data) (the-as uint 0))
(set! (-> s5-0 flags) (the-as uint 2))
(set! (-> s5-0 flags) (traffic-spawn-flags trsflags-01))
(set! (-> s5-0 guard-type) (the-as uint 1))
(vector-reset! (-> s5-0 velocity))
(forward-up-nopitch->quaternion
@@ -568,3 +568,7 @@ This commonly includes things such as:
)
)
)
+4 -4
View File
@@ -1061,7 +1061,7 @@
(set! (-> s4-0 params proc) #f)
(set! (-> s4-0 params handle) (the-as handle #f))
(set! (-> s4-0 params user-data) (the-as uint 0))
(set! (-> s4-0 params flags) (the-as uint 0))
(set! (-> s4-0 params flags) (traffic-spawn-flags))
(set! (-> s4-0 params guard-type) (the-as uint 7))
(vector-reset! (-> s4-0 params velocity))
(set! (-> gp-0 i-player) 0)
@@ -1093,7 +1093,7 @@
(quaternion-copy! (-> s4-0 params rotation) (-> *target* control quat))
(set! (-> s4-0 params position y) (+ 12288.0 (-> s4-0 params position y)))
(set! (-> s4-0 params behavior) (the-as uint 4))
(set! (-> s4-0 params flags) (logand -3 (-> s4-0 params flags)))
(logclear! (-> s4-0 params flags) (traffic-spawn-flags trsflags-01))
(let ((s5-1 (vehicle-spawn obj (type-from-race-vehicle-type (-> s2-0 vehicle)) (-> s4-0 params))))
(when s5-1
(init-racers! gp-0 s5-1)
@@ -1117,7 +1117,7 @@
(set! (-> s4-0 params position quad) (-> s0-0 start-position quad))
(set! (-> s4-0 params id) (the-as uint s2-1))
(set! (-> s4-0 params user-data) (-> s1-0 rider))
(logior! (-> s4-0 params flags) 2)
(logior! (-> s4-0 params flags) (traffic-spawn-flags trsflags-01))
(let ((v1-48 (-> s1-0 rider)))
(cond
((or (zero? v1-48) (= v1-48 1))
@@ -1136,7 +1136,7 @@
(set! (-> s4-0 params position quad) (-> gp-0 info player-intro-pos quad))
(set! (-> s4-0 params position y) (+ 12288.0 (-> s4-0 params position y)))
)
(set! (-> s4-0 params flags) (logand -3 (-> s4-0 params flags)))
(logclear! (-> s4-0 params flags) (traffic-spawn-flags trsflags-01))
(set! sv-416 37)
sv-416
)
+1 -1
View File
@@ -359,7 +359,7 @@
(when (-> obj race mesh)
(race-control-method-9 (-> obj race) (-> obj traffic-priority-id) (-> obj root-override-2 trans))
(cond
((logtest? (-> arg0 flags) 2)
((logtest? (-> arg0 flags) (traffic-spawn-flags trsflags-01))
(set! (-> obj flags) (logior (rigid-body-object-flag riding ai-driving) (-> obj flags)))
(cond
((-> obj race path)
+3 -2
View File
@@ -2672,6 +2672,7 @@ This commonly includes things such as:
)
;; definition for function stadium-barrier-spawn
;; WARN: Return type mismatch (pointer process) vs (pointer stadium-barrier).
(defun stadium-barrier-spawn ((arg0 stad-force-field) (arg1 vector) (arg2 quaternion) (arg3 vector))
(process-spawn stadium-barrier arg1 arg2 arg3 :to arg0)
)
@@ -3583,7 +3584,7 @@ This commonly includes things such as:
(set! (-> v1-0 min w) 1.0)
)
(set-vector! (-> a0-0 bbox max) 1482301.5 204800.0 -1228800.0 1.0)
(set! (-> a0-0 duration) (the-as uint #xad08e00))
(set! (-> a0-0 duration) (seconds 604800))
(create-or-update-suppression-box a0-0)
)
(none)
@@ -3653,7 +3654,7 @@ This commonly includes things such as:
(set! (-> v1-0 min w) 1.0)
)
(set-vector! (-> a0-0 bbox max) 1482301.5 204800.0 -1228800.0 1.0)
(set! (-> a0-0 duration) (the-as uint #xad08e00))
(set! (-> a0-0 duration) (seconds 604800))
(create-or-update-suppression-box a0-0)
)
(none)