jak2: fix rigid-body-object-event-handler type (#2761)

Fixes #2760
This commit is contained in:
ManDude 2023-06-21 02:06:28 +01:00 committed by GitHub
parent b350525294
commit d3e7a48639
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 142 additions and 175 deletions

View file

@ -34163,7 +34163,7 @@
(define-extern damping-time-adjust (function float float float))
(define-extern transform-rigid-body-prims (function collide-shape-prim matrix symbol))
(define-extern *rigid-body-object-constants* rigid-body-object-constants)
(define-extern rigid-body-object-event-handler (function process int symbol event-message-block none :behavior rigid-body-object))
(define-extern rigid-body-object-event-handler (function process int symbol event-message-block object :behavior rigid-body-object))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; rigid-body-queue ;;

View file

@ -1419,10 +1419,8 @@ This commonly includes things such as:
)
)
;; WARN: Return type mismatch object vs none.
(defbehavior rigid-body-object-event-handler rigid-body-object ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(rigid-body-object-method-46 self (the-as process-drawable arg0) arg1 arg2 arg3)
(none)
)
(defstate idle (rigid-body-object)
@ -1444,10 +1442,7 @@ This commonly includes things such as:
(defstate active (rigid-body-object)
:virtual #t
:event (the-as
(function process int symbol event-message-block object :behavior rigid-body-object)
rigid-body-object-event-handler
)
:event rigid-body-object-event-handler
:trans (behavior ()
(if (or (not *target*)
(or (< (+ 4096.0 (-> self info extra idle-distance))

View file

@ -238,7 +238,7 @@
(set! (-> self last-ridden-time) (current-time))
)
)
(the-as object (rigid-body-object-event-handler proc arg1 event-type event))
(rigid-body-object-event-handler proc arg1 event-type event)
)
)

View file

@ -1410,7 +1410,7 @@ This commonly includes things such as:
(set! (-> self last-ridden-time) (current-time))
)
)
(the-as object (rigid-body-object-event-handler proc arg1 event-type event))
(rigid-body-object-event-handler proc arg1 event-type event)
)
:trans (the-as (function none :behavior dig-tipping-rock) rider-trans)
:code (the-as (function none :behavior dig-tipping-rock) sleep-code)

View file

@ -344,91 +344,79 @@ This commonly includes things such as:
)
)
;; WARN: Return type mismatch none vs object.
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 109]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 114]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 119]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 142]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 59]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 67]
(defbehavior defend-stadium-rift-rider-handler rift-rider ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as
object
(cond
((= v1-0 'get-position)
(let ((s5-1 (new 'stack-no-clear 'vector)))
(set! (-> s5-1 quad) (-> self root-override-2 trans quad))
(let ((s4-0 (-> self root-override-2 quat)))
(case (-> arg3 param 0)
(('left)
(vector+float*! s5-1 s5-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) s4-0) 24576.0)
(vector+float*!
(the-as vector (-> arg3 param 1))
s5-1
(vector-x-quaternion! (new 'stack-no-clear 'vector) s4-0)
12288.0
)
)
(('right)
(vector+float*!
(the-as vector (-> arg3 param 1))
s5-1
(vector-x-quaternion! (new 'stack-no-clear 'vector) s4-0)
-12288.0
)
)
)
)
(case arg2
(('get-position)
(let ((s5-1 (new 'stack-no-clear 'vector)))
(set! (-> s5-1 quad) (-> self root-override-2 trans quad))
(let ((s4-0 (-> self root-override-2 quat)))
(case (-> arg3 param 0)
(('left)
(vector+float*! s5-1 s5-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) s4-0) 24576.0)
(vector+float*!
(the-as vector (-> arg3 param 1))
s5-1
(vector-x-quaternion! (new 'stack-no-clear 'vector) s4-0)
12288.0
)
)
(('right)
(vector+float*!
(the-as vector (-> arg3 param 1))
s5-1
(vector-x-quaternion! (new 'stack-no-clear 'vector) s4-0)
-12288.0
)
)
)
(set! (-> (the-as vector (-> arg3 param 1)) y)
(-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self path-pos) 'interp) y)
)
(-> arg3 param 1)
)
((= v1-0 'die)
(go-virtual defend-stadium-die)
)
((= v1-0 'touch)
(let* ((gp-1 (-> arg3 param 0))
(s3-7 arg0)
(s4-1 (if (type? s3-7 process-focusable)
s3-7
)
)
(set! (-> (the-as vector (-> arg3 param 1)) y)
(-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self path-pos) 'interp) y)
)
(-> arg3 param 1)
)
(('die)
(go-virtual defend-stadium-die)
)
(('touch)
(let* ((gp-1 (-> arg3 param 0))
(s3-7 arg0)
(s4-1 (if (type? s3-7 process-focusable)
s3-7
)
)
(if (and gp-1
s4-1
((method-of-type touching-shapes-entry prims-touching-action?)
(the-as touching-shapes-entry gp-1)
(-> self root-override-2)
(collide-action no-standon)
(collide-action)
)
)
(if (and gp-1
s4-1
((method-of-type touching-shapes-entry prims-touching-action?)
(the-as touching-shapes-entry gp-1)
(-> self root-override-2)
(collide-action no-standon)
(collide-action)
)
(not (logtest? (-> self root-override-2 penetrated-by)
(-> (the-as collide-shape (-> (the-as process-drawable s4-1) root)) penetrate-using)
)
)
(not (logtest? (-> self root-override-2 penetrated-by)
(-> (the-as collide-shape (-> (the-as process-drawable s4-1) root)) penetrate-using)
)
)
)
(send-shoves (-> self root-override-2) arg0 (the-as touching-shapes-entry gp-1) 0.7 6144.0 16384.0)
)
)
(send-shoves (-> self root-override-2) arg0 (the-as touching-shapes-entry gp-1) 0.7 6144.0 16384.0)
)
)
((= v1-0 'trans)
(-> self root-override-2 trans)
)
((= v1-0 'quat)
(-> self root-override-2 quat)
)
((= v1-0 'hold)
(set! (-> self escort-force (-> arg3 param 0) y)
(seek (-> self escort-force (-> arg3 param 0) y) 1.0 (* 2.0 (-> self clock seconds-per-frame)))
)
)
(else
(rigid-body-object-event-handler arg0 arg1 arg2 arg3)
)
)
)
)
(('trans)
(-> self root-override-2 trans)
)
(('quat)
(-> self root-override-2 quat)
)
(('hold)
(set! (-> self escort-force (-> arg3 param 0) y)
(seek (-> self escort-force (-> arg3 param 0) y) 1.0 (* 2.0 (-> self clock seconds-per-frame)))
)
)
(else
(rigid-body-object-event-handler arg0 arg1 arg2 arg3)
)
)
)

View file

@ -882,6 +882,7 @@
)
;; definition for method 10 of type rigid-body-control
;; INFO: this function exists in multiple non-identical object files
;; WARN: Return type mismatch int vs object.
(defmethod rigid-body-control-method-10 rigid-body-control ((obj rigid-body-control) (arg0 rigid-body-object) (arg1 float) (arg2 float))
(let* ((s4-1 (max 1 (min 4 (+ (the int (* 0.9999 (/ arg1 arg2))) 1))))
@ -1525,10 +1526,8 @@ This commonly includes things such as:
)
;; definition for function rigid-body-object-event-handler
;; WARN: Return type mismatch object vs none.
(defbehavior rigid-body-object-event-handler rigid-body-object ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(rigid-body-object-method-46 self (the-as process-drawable arg0) arg1 arg2 arg3)
(none)
)
;; failed to figure out what this is:
@ -1552,10 +1551,7 @@ This commonly includes things such as:
;; failed to figure out what this is:
(defstate active (rigid-body-object)
:virtual #t
:event (the-as
(function process int symbol event-message-block object :behavior rigid-body-object)
rigid-body-object-event-handler
)
:event rigid-body-object-event-handler
:trans (behavior ()
(if (or (not *target*)
(or (< (+ 4096.0 (-> self info extra idle-distance))

View file

@ -265,7 +265,7 @@
(set! (-> self last-ridden-time) (current-time))
)
)
(the-as object (rigid-body-object-event-handler proc arg1 event-type event))
(rigid-body-object-event-handler proc arg1 event-type event)
)
)

View file

@ -1578,7 +1578,7 @@ This commonly includes things such as:
(set! (-> self last-ridden-time) (current-time))
)
)
(the-as object (rigid-body-object-event-handler proc arg1 event-type event))
(rigid-body-object-event-handler proc arg1 event-type event)
)
:trans (the-as (function none :behavior dig-tipping-rock) rider-trans)
:code (the-as (function none :behavior dig-tipping-rock) sleep-code)

View file

@ -429,91 +429,79 @@ This commonly includes things such as:
;; definition for function defend-stadium-rift-rider-handler
;; INFO: Used lq/sq
;; WARN: Return type mismatch none vs object.
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 109]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 114]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 119]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 142]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 59]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 67]
(defbehavior defend-stadium-rift-rider-handler rift-rider ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as
object
(cond
((= v1-0 'get-position)
(let ((s5-1 (new 'stack-no-clear 'vector)))
(set! (-> s5-1 quad) (-> self root-override-2 trans quad))
(let ((s4-0 (-> self root-override-2 quat)))
(case (-> arg3 param 0)
(('left)
(vector+float*! s5-1 s5-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) s4-0) 24576.0)
(vector+float*!
(the-as vector (-> arg3 param 1))
s5-1
(vector-x-quaternion! (new 'stack-no-clear 'vector) s4-0)
12288.0
)
)
(('right)
(vector+float*!
(the-as vector (-> arg3 param 1))
s5-1
(vector-x-quaternion! (new 'stack-no-clear 'vector) s4-0)
-12288.0
)
)
)
)
(case arg2
(('get-position)
(let ((s5-1 (new 'stack-no-clear 'vector)))
(set! (-> s5-1 quad) (-> self root-override-2 trans quad))
(let ((s4-0 (-> self root-override-2 quat)))
(case (-> arg3 param 0)
(('left)
(vector+float*! s5-1 s5-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) s4-0) 24576.0)
(vector+float*!
(the-as vector (-> arg3 param 1))
s5-1
(vector-x-quaternion! (new 'stack-no-clear 'vector) s4-0)
12288.0
)
)
(('right)
(vector+float*!
(the-as vector (-> arg3 param 1))
s5-1
(vector-x-quaternion! (new 'stack-no-clear 'vector) s4-0)
-12288.0
)
)
)
(set! (-> (the-as vector (-> arg3 param 1)) y)
(-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self path-pos) 'interp) y)
)
(-> arg3 param 1)
)
((= v1-0 'die)
(go-virtual defend-stadium-die)
)
((= v1-0 'touch)
(let* ((gp-1 (-> arg3 param 0))
(s3-7 arg0)
(s4-1 (if (type? s3-7 process-focusable)
s3-7
)
)
(set! (-> (the-as vector (-> arg3 param 1)) y)
(-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self path-pos) 'interp) y)
)
(-> arg3 param 1)
)
(('die)
(go-virtual defend-stadium-die)
)
(('touch)
(let* ((gp-1 (-> arg3 param 0))
(s3-7 arg0)
(s4-1 (if (type? s3-7 process-focusable)
s3-7
)
)
(if (and gp-1
s4-1
((method-of-type touching-shapes-entry prims-touching-action?)
(the-as touching-shapes-entry gp-1)
(-> self root-override-2)
(collide-action no-standon)
(collide-action)
)
)
(if (and gp-1
s4-1
((method-of-type touching-shapes-entry prims-touching-action?)
(the-as touching-shapes-entry gp-1)
(-> self root-override-2)
(collide-action no-standon)
(collide-action)
)
(not (logtest? (-> self root-override-2 penetrated-by)
(-> (the-as collide-shape (-> (the-as process-drawable s4-1) root)) penetrate-using)
)
)
(not (logtest? (-> self root-override-2 penetrated-by)
(-> (the-as collide-shape (-> (the-as process-drawable s4-1) root)) penetrate-using)
)
)
)
(send-shoves (-> self root-override-2) arg0 (the-as touching-shapes-entry gp-1) 0.7 6144.0 16384.0)
)
)
(send-shoves (-> self root-override-2) arg0 (the-as touching-shapes-entry gp-1) 0.7 6144.0 16384.0)
)
)
((= v1-0 'trans)
(-> self root-override-2 trans)
)
((= v1-0 'quat)
(-> self root-override-2 quat)
)
((= v1-0 'hold)
(set! (-> self escort-force (-> arg3 param 0) y)
(seek (-> self escort-force (-> arg3 param 0) y) 1.0 (* 2.0 (-> self clock seconds-per-frame)))
)
)
(else
(rigid-body-object-event-handler arg0 arg1 arg2 arg3)
)
)
)
)
(('trans)
(-> self root-override-2 trans)
)
(('quat)
(-> self root-override-2 quat)
)
(('hold)
(set! (-> self escort-force (-> arg3 param 0) y)
(seek (-> self escort-force (-> arg3 param 0) y) 1.0 (* 2.0 (-> self clock seconds-per-frame)))
)
)
(else
(rigid-body-object-event-handler arg0 arg1 arg2 arg3)
)
)
)