mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-30 18:00:34 +00:00
add target-board-handler (#2068)
This commit is contained in:
parent
f6c5504f6f
commit
d454dfbcd8
@ -461,7 +461,10 @@
|
||||
121,
|
||||
131
|
||||
],
|
||||
"(anon-function 4 gun-states)": [94, 96, 98]
|
||||
"(anon-function 4 gun-states)": [94, 96, 98],
|
||||
"target-board-handler": [
|
||||
13, 14, 18
|
||||
]
|
||||
},
|
||||
|
||||
// Sometimes the game might use format strings that are fetched dynamically,
|
||||
|
@ -29,10 +29,6 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defbehavior target-board-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
||||
#f
|
||||
)
|
||||
|
||||
(defun vector-vector-angle ((arg0 vector) (arg1 vector))
|
||||
(let ((s4-0 (new 'stack-no-clear 'matrix))
|
||||
(gp-0 (new 'stack-no-clear 'matrix))
|
||||
|
@ -495,7 +495,177 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
(defbehavior target-board-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
||||
(local-vars (v0-0 object) (a0-10 uint))
|
||||
(the-as
|
||||
object
|
||||
(cond
|
||||
((and (= arg2 'query) (= (-> arg3 param 0) 'mode))
|
||||
'board
|
||||
)
|
||||
(else
|
||||
(let ((v1-3 arg2))
|
||||
(cond
|
||||
((= v1-3 'end-mode)
|
||||
(go target-board-get-off (process->handle arg0) #f)
|
||||
)
|
||||
((= v1-3 'change-mode)
|
||||
(let ((v1-7 (-> arg3 param 0)))
|
||||
(b! (!= v1-7 'grab) cfg-19 :delay (set! a0-10 (the-as uint #f)))
|
||||
(b! (logtest? (-> self focus-status) (focus-status dead)) cfg-18 :delay (set! v0-0 #f))
|
||||
(set! v0-0 (if (not (-> arg3 param 1))
|
||||
#t
|
||||
(go target-board-grab (the-as symbol a0-10))
|
||||
)
|
||||
)
|
||||
(label cfg-18)
|
||||
(b! #t cfg-37 :delay (nop!))
|
||||
(label cfg-19)
|
||||
(set! v0-0 (cond
|
||||
((= v1-7 'normal)
|
||||
(go target-board-get-off (process->handle arg0) #f)
|
||||
)
|
||||
((= v1-7 'falling)
|
||||
enter-state
|
||||
(go target-board-falling)
|
||||
)
|
||||
((= v1-7 'pegasus)
|
||||
(go target-board-get-off (process->handle arg0) 'pegasus)
|
||||
)
|
||||
((= v1-7 'pilot)
|
||||
(target-standard-event-handler arg0 arg1 arg2 arg3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(label cfg-37)
|
||||
v0-0
|
||||
)
|
||||
(else
|
||||
(let ((a3-2 (= v1-3 'swim)))
|
||||
(cond
|
||||
((or a3-2 (begin (set! a3-2 (= v1-3 'wade)) a3-2) (begin (set! a3-2 (= v1-3 'slide)) a3-2) (= v1-3 'pole-grab))
|
||||
#f
|
||||
)
|
||||
((= v1-3 'clone-anim)
|
||||
(go target-board-clone-anim (process->handle (the-as process (-> arg3 param 0))))
|
||||
)
|
||||
((= v1-3 'edge-grab)
|
||||
(let ((gp-1 *edge-grab-info*)
|
||||
(s5-1 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(vector-normalize!
|
||||
(vector-!
|
||||
(-> self control edge-grab-edge-dir)
|
||||
(-> gp-1 world-vertex 1)
|
||||
(the-as vector (-> gp-1 world-vertex))
|
||||
)
|
||||
1.0
|
||||
)
|
||||
(vector+float*!
|
||||
s5-1
|
||||
(-> self control trans)
|
||||
(-> self control c-R-w vector 2)
|
||||
(* 40960.0 (-> self clock seconds-per-frame))
|
||||
)
|
||||
(let* ((t9-8 vector-segment-overlap)
|
||||
(a1-8 (-> gp-1 world-vertex))
|
||||
(a2-3 (-> gp-1 world-vertex 1))
|
||||
(f0-2 (t9-8 s5-1 (the-as vector a1-8) a2-3))
|
||||
)
|
||||
(if (and (>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.4))
|
||||
(>= f0-2 0.0)
|
||||
(>= 1.0 f0-2)
|
||||
(not (and (-> self next-state) (= (-> self next-state name) 'target-board-duck-stance)))
|
||||
)
|
||||
(go
|
||||
target-board-ride-edge
|
||||
(logtest? (-> self control mod-surface flags) (surface-flag air))
|
||||
(the-as object a1-8)
|
||||
(the-as object a2-3)
|
||||
(the-as float a3-2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-3 'touched)
|
||||
(cond
|
||||
((and (-> self control danger-mode) ((method-of-type touching-shapes-entry prims-touching?)
|
||||
(the-as touching-shapes-entry (-> arg3 param 0))
|
||||
(-> self control)
|
||||
(the-as uint 1920)
|
||||
)
|
||||
)
|
||||
(when (target-send-attack
|
||||
arg0
|
||||
(-> self control danger-mode)
|
||||
(the-as touching-shapes-entry (-> arg3 param 0))
|
||||
(the-as int (-> self control target-attack-id))
|
||||
(the-as int (-> self control attack-count))
|
||||
(-> self control penetrate-using)
|
||||
)
|
||||
(process-spawn part-tracker :init part-tracker-init (-> *part-group-id-table* 117) 0 #f #f self 25 :to self)
|
||||
(target-timed-invulnerable (seconds 0.5) self 2)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(let ((a1-15 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-15 from) (process->ppointer self))
|
||||
(set! (-> a1-15 num-params) 2)
|
||||
(set! (-> a1-15 message) 'attack)
|
||||
(set! (-> a1-15 param 0) (-> arg3 param 0))
|
||||
(let ((v1-61 (new 'static 'attack-info :mask (attack-info-mask mode id penetrate-using))))
|
||||
(set! (-> v1-61 id) (-> self board attack-id))
|
||||
(set! (-> v1-61 mode) 'board)
|
||||
(set! (-> v1-61 penetrate-using) (-> self control penetrate-using))
|
||||
(set! (-> a1-15 param 1) (the-as uint v1-61))
|
||||
)
|
||||
(set! v0-0 (send-event-function arg0 a1-15))
|
||||
)
|
||||
(when (the-as object v0-0)
|
||||
(let* ((v1-63 (-> self game))
|
||||
(a0-68 (+ (-> v1-63 attack-id) 1))
|
||||
)
|
||||
(set! (-> v1-63 attack-id) a0-68)
|
||||
(set! (-> self board attack-id) a0-68)
|
||||
)
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
((or (= v1-3 'attack) (= v1-3 'attack-or-shove) (= v1-3 'attack-invinc))
|
||||
(target-attacked
|
||||
arg2
|
||||
(the-as attack-info (-> arg3 param 1))
|
||||
arg0
|
||||
(the-as touching-shapes-entry (-> arg3 param 0))
|
||||
(the-as (state symbol attack-info target) target-board-hit)
|
||||
)
|
||||
)
|
||||
((= v1-3 'shove)
|
||||
(when (not (logtest? (-> self focus-status) (focus-status hit)))
|
||||
(mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer (-> arg3 param 1)) 160)
|
||||
(when (not (logtest? (-> self attack-info-rec mask) (attack-info-mask attacker)))
|
||||
(set! (-> self attack-info-rec attacker) (process->handle arg0))
|
||||
(logior! (-> self attack-info-rec mask) (attack-info-mask attacker))
|
||||
)
|
||||
(go target-board-hit (the-as vector 'shove) (-> self attack-info-rec))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(target-standard-event-handler arg0 arg1 arg2 arg3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defbehavior target-board-setup target ((arg0 symbol))
|
||||
(when (zero? (-> self board))
|
||||
|
191
test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc
generated
vendored
191
test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc
generated
vendored
@ -460,7 +460,192 @@
|
||||
)
|
||||
|
||||
;; definition for function target-board-handler
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
;; WARN: Return type mismatch none vs object.
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 41]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 46]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 65]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 73]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 92]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 99]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 203]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 353]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 358]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 318]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 134]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 116]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 29]
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 10]
|
||||
(defbehavior target-board-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
||||
(local-vars (v0-0 none) (a0-10 uint))
|
||||
(the-as
|
||||
object
|
||||
(cond
|
||||
((and (= arg2 'query) (= (-> arg3 param 0) 'mode))
|
||||
'board
|
||||
)
|
||||
(else
|
||||
(let ((v1-3 arg2))
|
||||
(cond
|
||||
((= v1-3 'end-mode)
|
||||
(go target-board-get-off (process->handle arg0) #f)
|
||||
)
|
||||
((= v1-3 'change-mode)
|
||||
(let ((v1-7 (-> arg3 param 0)))
|
||||
(b! (!= v1-7 'grab) cfg-19 :delay (set! a0-10 (the-as uint #f)))
|
||||
(b! (logtest? (-> self focus-status) (focus-status dead)) cfg-18 :delay (set! v0-0 (the-as none #f)))
|
||||
(set! v0-0 (if (not (-> arg3 param 1))
|
||||
#t
|
||||
(go target-board-grab (the-as symbol a0-10))
|
||||
)
|
||||
)
|
||||
(label cfg-18)
|
||||
(b! #t cfg-37 :delay (nop!))
|
||||
(label cfg-19)
|
||||
(set! v0-0 (cond
|
||||
((= v1-7 'normal)
|
||||
(go target-board-get-off (process->handle arg0) #f)
|
||||
)
|
||||
((= v1-7 'falling)
|
||||
enter-state
|
||||
(go target-board-falling)
|
||||
)
|
||||
((= v1-7 'pegasus)
|
||||
(go target-board-get-off (process->handle arg0) 'pegasus)
|
||||
)
|
||||
((= v1-7 'pilot)
|
||||
(target-standard-event-handler arg0 arg1 arg2 arg3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(label cfg-37)
|
||||
v0-0
|
||||
)
|
||||
(else
|
||||
(let ((a3-2 (= v1-3 'swim)))
|
||||
(cond
|
||||
((or a3-2 (begin (set! a3-2 (= v1-3 'wade)) a3-2) (begin (set! a3-2 (= v1-3 'slide)) a3-2) (= v1-3 'pole-grab))
|
||||
#f
|
||||
)
|
||||
((= v1-3 'clone-anim)
|
||||
(go target-board-clone-anim (process->handle (the-as process (-> arg3 param 0))))
|
||||
)
|
||||
((= v1-3 'edge-grab)
|
||||
(let ((gp-1 *edge-grab-info*)
|
||||
(s5-1 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(vector-normalize!
|
||||
(vector-!
|
||||
(-> self control edge-grab-edge-dir)
|
||||
(-> gp-1 world-vertex 1)
|
||||
(the-as vector (-> gp-1 world-vertex))
|
||||
)
|
||||
1.0
|
||||
)
|
||||
(vector+float*!
|
||||
s5-1
|
||||
(-> self control trans)
|
||||
(-> self control c-R-w vector 2)
|
||||
(* 40960.0 (-> self clock seconds-per-frame))
|
||||
)
|
||||
(let* ((t9-8 vector-segment-overlap)
|
||||
(a1-8 (-> gp-1 world-vertex))
|
||||
(a2-3 (-> gp-1 world-vertex 1))
|
||||
(f0-2 (t9-8 s5-1 (the-as vector a1-8) a2-3))
|
||||
)
|
||||
(if (and (>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.4))
|
||||
(>= f0-2 0.0)
|
||||
(>= 1.0 f0-2)
|
||||
(not (and (-> self next-state) (= (-> self next-state name) 'target-board-duck-stance)))
|
||||
)
|
||||
(go
|
||||
target-board-ride-edge
|
||||
(logtest? (-> self control mod-surface flags) (surface-flag air))
|
||||
(the-as object a1-8)
|
||||
(the-as object a2-3)
|
||||
(the-as float a3-2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-3 'touched)
|
||||
(cond
|
||||
((and (-> self control danger-mode) ((method-of-type touching-shapes-entry prims-touching?)
|
||||
(the-as touching-shapes-entry (-> arg3 param 0))
|
||||
(-> self control)
|
||||
(the-as uint 1920)
|
||||
)
|
||||
)
|
||||
(when (target-send-attack
|
||||
arg0
|
||||
(-> self control danger-mode)
|
||||
(the-as touching-shapes-entry (-> arg3 param 0))
|
||||
(the-as int (-> self control target-attack-id))
|
||||
(the-as int (-> self control attack-count))
|
||||
(-> self control penetrate-using)
|
||||
)
|
||||
(process-spawn part-tracker :init part-tracker-init (-> *part-group-id-table* 117) 0 #f #f self 25 :to self)
|
||||
(target-timed-invulnerable (seconds 0.5) self 2)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(let ((a1-15 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-15 from) (process->ppointer self))
|
||||
(set! (-> a1-15 num-params) 2)
|
||||
(set! (-> a1-15 message) 'attack)
|
||||
(set! (-> a1-15 param 0) (-> arg3 param 0))
|
||||
(let ((v1-61 (new 'static 'attack-info :mask (attack-info-mask mode id penetrate-using))))
|
||||
(set! (-> v1-61 id) (-> self board attack-id))
|
||||
(set! (-> v1-61 mode) 'board)
|
||||
(set! (-> v1-61 penetrate-using) (-> self control penetrate-using))
|
||||
(set! (-> a1-15 param 1) (the-as uint v1-61))
|
||||
)
|
||||
(set! v0-0 (the-as none (send-event-function arg0 a1-15)))
|
||||
)
|
||||
(when (the-as object v0-0)
|
||||
(let* ((v1-63 (-> self game))
|
||||
(a0-68 (+ (-> v1-63 attack-id) 1))
|
||||
)
|
||||
(set! (-> v1-63 attack-id) a0-68)
|
||||
(set! (-> self board attack-id) a0-68)
|
||||
)
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
((or (= v1-3 'attack) (= v1-3 'attack-or-shove) (= v1-3 'attack-invinc))
|
||||
(target-attacked
|
||||
arg2
|
||||
(the-as attack-info (-> arg3 param 1))
|
||||
arg0
|
||||
(the-as touching-shapes-entry (-> arg3 param 0))
|
||||
(the-as (state symbol attack-info target) target-board-hit)
|
||||
)
|
||||
)
|
||||
((= v1-3 'shove)
|
||||
(when (not (logtest? (-> self focus-status) (focus-status hit)))
|
||||
(mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer (-> arg3 param 1)) 160)
|
||||
(when (not (logtest? (-> self attack-info-rec mask) (attack-info-mask attacker)))
|
||||
(set! (-> self attack-info-rec attacker) (process->handle arg0))
|
||||
(logior! (-> self attack-info-rec mask) (attack-info-mask attacker))
|
||||
)
|
||||
(go target-board-hit (the-as vector 'shove) (-> self attack-info-rec))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(target-standard-event-handler arg0 arg1 arg2 arg3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function target-board-setup
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
@ -2858,3 +3043,7 @@
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -253,7 +253,8 @@
|
||||
|
||||
"target-send-attack",
|
||||
"bones-mtx-calc-execute", // asm
|
||||
"(method 32 fort-lift-plat)" // multiply defined
|
||||
"(method 32 fort-lift-plat)", // multiply defined
|
||||
"target-board-handler" // very strange control flow
|
||||
],
|
||||
|
||||
"skip_compile_states": {
|
||||
|
Loading…
Reference in New Issue
Block a user