[jak2] fix shadow origin using wrong joint (#3271)

Copypasta. Fixes #3269
This commit is contained in:
ManDude 2023-12-22 16:52:53 +00:00 committed by GitHub
parent 708c15788b
commit a01d78c7d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 86 additions and 122 deletions

View file

@ -3141,11 +3141,11 @@ goos::Object DefskelgroupElement::to_form_internal(const Env& env) const {
}
if (m_static_info.shadow_joint_index != 0) {
forms.push_back(pretty_print::to_symbol(
fmt::format(":shadow-joint-index {}", m_static_info.origin_joint_index)));
fmt::format(":shadow-joint-index {}", m_static_info.shadow_joint_index)));
}
if (m_static_info.light_index != 0) {
forms.push_back(pretty_print::to_symbol(
fmt::format(":light-index {}", m_static_info.origin_joint_index)));
forms.push_back(
pretty_print::to_symbol(fmt::format(":light-index {}", m_static_info.light_index)));
}
}

View file

@ -24881,7 +24881,7 @@
(define-extern shadow-add-single-tris function)
(define-extern shadow-add-double-tris function)
(define-extern shadow-add-double-edges function)
(define-extern debug-draw-settings (function matrix none))
(define-extern debug-draw-settings (function shadow-settings symbol))
(define-extern shadow-execute (function shadow-dma-packet pointer pointer))
(define-extern shadow-vu0-upload (function none))
(define-extern shadow-execute-all (function dma-buffer none))

View file

@ -4228,7 +4228,9 @@
"vars": {
"v1-3": "shadow-settings",
"a3-0": "shadow-geo",
"t0-0": "dist"
"t0-0": "dist",
"a3-2": ["shadow-pack1", "shadow-dma-packet"],
"t2-11": ["shadow-pack2", "shadow-dma-packet"]
}
},
"progress-selected": {

View file

@ -56,7 +56,7 @@
:bounds (static-spherem 0 0 0 0.6)
:shadow collectables-skill-shadow-mg
:texture-level 6
:shadow-joint-index 0
:shadow-joint-index 3
)
(deftype collectable (process-drawable)

View file

@ -563,8 +563,7 @@
)
)
;; todo foreground-shadow
;;(define-extern foreground-shadow (function draw-control (inline-array pris-mtx) pointer pointer))
;; ERROR: Unsupported inline assembly instruction kind - [lq ra, 32(v1)]
(defun foreground-shadow ((draw-ctrl draw-control) (arg1 (inline-array pris-mtx)) (arg2 pointer))
(local-vars (shadow-settings shadow-settings))
(let ((shadow-geo (-> draw-ctrl shadow))
@ -574,12 +573,7 @@
(cond
((-> draw-ctrl shadow-ctrl)
(set! shadow-settings (-> draw-ctrl shadow-ctrl settings))
(let ((t1-2 (the-as vector (+ (the-as uint (the-as vector (-> draw-ctrl skeleton bones 0 transform trans)))
(* (the-as uint 80) (-> draw-ctrl shadow-joint-index))
)
)
)
)
(let ((t1-2 (-> draw-ctrl skeleton bones (-> draw-ctrl shadow-joint-index) transform trans)))
(set! (-> shadow-settings center x) (-> t1-2 x))
(set! (-> shadow-settings center y) (-> t1-2 y))
(set! (-> shadow-settings center z) (-> t1-2 z))
@ -609,21 +603,21 @@
(t4-0 (-> shadow-geo total-qwc))
)
0
(let ((a3-2 (the-as object arg2)))
(set! (-> (the-as shadow-dma-packet a3-2) tag dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt)))
(set! (-> (the-as shadow-dma-packet a3-2) tag vif0) (the-as vif-tag t4-0))
(set! (-> (the-as shadow-dma-packet a3-2) tag vif1) (new 'static 'vif-tag))
(let ((shadow-pack1 (the-as shadow-dma-packet arg2)))
(set! (-> shadow-pack1 tag dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt)))
(set! (-> shadow-pack1 tag vif0) (the-as vif-tag t4-0))
(set! (-> shadow-pack1 tag vif1) (new 'static 'vif-tag))
(let ((t0-11 (-> *shadow-globals* bucket (-> shadow-settings shadow-type))))
(let ((t3-2 (-> t0-11 next)))
(if (nonzero? t3-2)
(set! (-> (the-as (pointer shadow-dma-packet) t3-2) 0) (the-as shadow-dma-packet a3-2))
(set! (-> (the-as (pointer shadow-dma-packet) t3-2) 0) shadow-pack1)
)
)
(if (zero? (-> t0-11 first))
(set! (-> t0-11 first) (the-as pointer a3-2))
(set! (-> t0-11 first) (the-as pointer shadow-pack1))
)
(let ((t3-7 (&-> (the-as shadow-dma-packet a3-2) tag vif1)))
(let ((t5-1 (the-as object (-> (the-as shadow-dma-packet a3-2) settings)))
(let ((t3-7 (&-> shadow-pack1 tag vif1)))
(let ((t5-1 (the-as object (-> shadow-pack1 settings)))
(t6-0 (-> shadow-settings center quad))
(t7-0 (-> shadow-settings shadow-dir quad))
(t8-0 (-> shadow-settings bot-plane quad))
@ -636,32 +630,24 @@
(set! (-> (the-as (inline-array vector) t5-1) 3 quad) t9-0)
(set! (-> (the-as (inline-array vector) t5-1) 4 quad) v1-4)
)
(let ((v1-7
(the-as
vector
(+ (the-as uint (the-as vector (-> draw-ctrl skeleton bones 0 transform trans)))
(* (the-as uint 80) (-> draw-ctrl shadow-joint-index))
)
)
)
)
(set! (-> (the-as shadow-dma-packet a3-2) settings center x) (-> v1-7 x))
(set! (-> (the-as shadow-dma-packet a3-2) settings center y) (-> v1-7 y))
(set! (-> (the-as shadow-dma-packet a3-2) settings center z) (-> v1-7 z))
(let ((v1-7 (-> draw-ctrl skeleton bones (-> draw-ctrl shadow-joint-index) transform trans)))
(set! (-> shadow-pack1 settings center x) (-> v1-7 x))
(set! (-> shadow-pack1 settings center y) (-> v1-7 y))
(set! (-> shadow-pack1 settings center z) (-> v1-7 z))
)
(set! (-> (the-as shadow-dma-packet a3-2) geo-ref dma)
(set! (-> shadow-pack1 geo-ref dma)
(new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int t2-5) :qwc t4-0)
)
(set! (-> (the-as shadow-dma-packet a3-2) geo-ref vif0) (new 'static 'vif-tag))
(set! (-> (the-as shadow-dma-packet a3-2) geo-ref vif1) (new 'static 'vif-tag))
(set! (-> (the-as shadow-dma-packet a3-2) mtx-ref dma)
(set! (-> shadow-pack1 geo-ref vif0) (new 'static 'vif-tag))
(set! (-> shadow-pack1 geo-ref vif1) (new 'static 'vif-tag))
(set! (-> shadow-pack1 mtx-ref dma)
(new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int (-> arg1 2)) :qwc t1-6)
)
(set! (-> (the-as shadow-dma-packet a3-2) mtx-ref vif0) (new 'static 'vif-tag))
(set! (-> (the-as shadow-dma-packet a3-2) mtx-ref vif1) (new 'static 'vif-tag))
(set! (-> (the-as shadow-dma-packet a3-2) end-tag dma) (new 'static 'dma-tag :id (dma-tag-id end)))
(set! (-> (the-as shadow-dma-packet a3-2) end-tag vif0) (new 'static 'vif-tag))
(set! (-> (the-as shadow-dma-packet a3-2) end-tag vif1) (new 'static 'vif-tag))
(set! (-> shadow-pack1 mtx-ref vif0) (new 'static 'vif-tag))
(set! (-> shadow-pack1 mtx-ref vif1) (new 'static 'vif-tag))
(set! (-> shadow-pack1 end-tag dma) (new 'static 'dma-tag :id (dma-tag-id end)))
(set! (-> shadow-pack1 end-tag vif0) (new 'static 'vif-tag))
(set! (-> shadow-pack1 end-tag vif1) (new 'static 'vif-tag))
(set! arg2 (&+ arg2 144))
(set! (-> t0-11 next) t3-7)
)
@ -676,21 +662,21 @@
(t6-1 (-> shadow-geo frags t1-7 qwc))
)
0
(let ((t2-11 (the-as object arg2)))
(set! (-> (the-as shadow-dma-packet t2-11) tag dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt)))
(set! (-> (the-as shadow-dma-packet t2-11) tag vif0) (the-as vif-tag t6-1))
(set! (-> (the-as shadow-dma-packet t2-11) tag vif1) (new 'static 'vif-tag))
(let ((shadow-pack2 (the-as shadow-dma-packet arg2)))
(set! (-> shadow-pack2 tag dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt)))
(set! (-> shadow-pack2 tag vif0) (the-as vif-tag t6-1))
(set! (-> shadow-pack2 tag vif1) (new 'static 'vif-tag))
(let ((t3-12 (-> *shadow-globals* bucket (-> shadow-settings shadow-type))))
(let ((t5-4 (-> t3-12 next)))
(if (nonzero? t5-4)
(set! (-> (the-as (pointer shadow-dma-packet) t5-4) 0) (the-as shadow-dma-packet t2-11))
(set! (-> (the-as (pointer shadow-dma-packet) t5-4) 0) shadow-pack2)
)
)
(if (zero? (-> t3-12 first))
(set! (-> t3-12 first) (the-as pointer t2-11))
(set! (-> t3-12 first) (the-as pointer shadow-pack2))
)
(let ((t5-9 (&-> (the-as shadow-dma-packet t2-11) tag vif1)))
(let ((t7-2 (the-as object (-> (the-as shadow-dma-packet t2-11) settings)))
(let ((t5-9 (&-> shadow-pack2 tag vif1)))
(let ((t7-2 (the-as object (-> shadow-pack2 settings)))
(t8-1 (-> shadow-settings center quad))
(t9-1 (-> shadow-settings shadow-dir quad))
(plane (-> shadow-settings bot-plane quad)) ; (.lq ra-0 32 shadow-settings)
@ -705,32 +691,24 @@
(set! (-> (the-as (inline-array vector) t7-2) 4 quad) s5-0)
)
)
(let ((t7-5
(the-as
vector
(+ (the-as uint (the-as vector (-> draw-ctrl skeleton bones 0 transform trans)))
(* (the-as uint 80) (-> draw-ctrl shadow-joint-index))
)
)
)
)
(set! (-> (the-as shadow-dma-packet t2-11) settings center x) (-> t7-5 x))
(set! (-> (the-as shadow-dma-packet t2-11) settings center y) (-> t7-5 y))
(set! (-> (the-as shadow-dma-packet t2-11) settings center z) (-> t7-5 z))
(let ((t7-5 (-> draw-ctrl skeleton bones (-> draw-ctrl shadow-joint-index) transform trans)))
(set! (-> shadow-pack2 settings center x) (-> t7-5 x))
(set! (-> shadow-pack2 settings center y) (-> t7-5 y))
(set! (-> shadow-pack2 settings center z) (-> t7-5 z))
)
(set! (-> (the-as shadow-dma-packet t2-11) geo-ref dma)
(set! (-> shadow-pack2 geo-ref dma)
(new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int t4-1) :qwc t6-1)
)
(set! (-> (the-as shadow-dma-packet t2-11) geo-ref vif0) (new 'static 'vif-tag))
(set! (-> (the-as shadow-dma-packet t2-11) geo-ref vif1) (new 'static 'vif-tag))
(set! (-> (the-as shadow-dma-packet t2-11) mtx-ref dma)
(set! (-> shadow-pack2 geo-ref vif0) (new 'static 'vif-tag))
(set! (-> shadow-pack2 geo-ref vif1) (new 'static 'vif-tag))
(set! (-> shadow-pack2 mtx-ref dma)
(new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int (-> arg1 2)) :qwc t0-13)
)
(set! (-> (the-as shadow-dma-packet t2-11) mtx-ref vif0) (new 'static 'vif-tag))
(set! (-> (the-as shadow-dma-packet t2-11) mtx-ref vif1) (new 'static 'vif-tag))
(set! (-> (the-as shadow-dma-packet t2-11) end-tag dma) (new 'static 'dma-tag :id (dma-tag-id end)))
(set! (-> (the-as shadow-dma-packet t2-11) end-tag vif0) (new 'static 'vif-tag))
(set! (-> (the-as shadow-dma-packet t2-11) end-tag vif1) (new 'static 'vif-tag))
(set! (-> shadow-pack2 mtx-ref vif0) (new 'static 'vif-tag))
(set! (-> shadow-pack2 mtx-ref vif1) (new 'static 'vif-tag))
(set! (-> shadow-pack2 end-tag dma) (new 'static 'dma-tag :id (dma-tag-id end)))
(set! (-> shadow-pack2 end-tag vif0) (new 'static 'vif-tag))
(set! (-> shadow-pack2 end-tag vif1) (new 'static 'vif-tag))
(&+! arg2 144)
(set! (-> t3-12 next) t5-9)
)

View file

@ -585,43 +585,34 @@
)
;; WARN: Return type mismatch symbol vs none.
(defun debug-draw-settings ((arg0 matrix))
(let ((v1-0 (-> arg0 vector 1))
(a2-0 (-> arg0 vector))
(s5-0 (-> arg0 trans))
(s4-0 (-> arg0 vector 2))
(defun debug-draw-settings ((arg0 shadow-settings))
(let ((v1-0 (-> arg0 shadow-dir))
(a2-0 (-> arg0 center))
(s5-0 (-> arg0 top-plane))
(s4-0 (-> arg0 bot-plane))
(s3-0 (new 'stack-no-clear 'vector))
(s2-0 (new 'stack-no-clear 'vector))
)
(cond
((logtest? (the-as int (-> arg0 vector 0 w)) 4)
(vector+float*! s3-0 (the-as vector a2-0) v1-0 (- (vector-dot s5-0 (the-as vector a2-0)) (-> s5-0 w)))
(vector+float*! s2-0 (the-as vector a2-0) v1-0 (- (vector-dot s4-0 (the-as vector a2-0)) (-> s4-0 w)))
((logtest? (-> arg0 flags) (shadow-flags shdf02))
(vector+float*! s3-0 a2-0 v1-0 (- (vector-dot (the-as vector s5-0) a2-0) (-> s5-0 w)))
(vector+float*! s2-0 a2-0 v1-0 (- (vector-dot (the-as vector s4-0) a2-0) (-> s4-0 w)))
)
(else
(let ((a0-8 (vector+float*! (new 'stack-no-clear 'vector) (the-as vector a2-0) v1-0 (-> v1-0 w))))
(vector+float*! s3-0 a0-8 v1-0 (- (vector-dot s5-0 a0-8) (-> s5-0 w)))
(vector+float*! s2-0 a0-8 v1-0 (- (vector-dot s4-0 a0-8) (-> s4-0 w)))
(let ((a0-8 (vector+float*! (new 'stack-no-clear 'vector) a2-0 v1-0 (-> v1-0 w))))
(vector+float*! s3-0 a0-8 v1-0 (- (vector-dot (the-as vector s5-0) a0-8) (-> s5-0 w)))
(vector+float*! s2-0 a0-8 v1-0 (- (vector-dot (the-as vector s4-0) a0-8) (-> s4-0 w)))
)
)
)
(add-debug-sphere #t (bucket-id debug-no-zbuf1) (the-as vector a2-0) (meters 0.8) *color-magenta*)
(add-debug-sphere #t (bucket-id debug-no-zbuf1) a2-0 (meters 0.8) *color-magenta*)
(add-debug-x #t (bucket-id debug-no-zbuf1) s3-0 *color-blue*)
(add-debug-vector #t (bucket-id debug-no-zbuf1) s3-0 s5-0 (meters 2) *color-blue*)
(add-debug-line
#t
(bucket-id debug-no-zbuf1)
(the-as vector (-> arg0 vector))
s3-0
*color-magenta*
#f
(the-as rgba -1)
)
(add-debug-line #t (bucket-id debug-no-zbuf1) (-> arg0 center) s3-0 *color-magenta* #f (the-as rgba -1))
(add-debug-x #t (bucket-id debug-no-zbuf1) s2-0 *color-green*)
(add-debug-vector #t (bucket-id debug-no-zbuf1) s2-0 s4-0 (meters 2) *color-green*)
(add-debug-line #t (bucket-id debug-no-zbuf1) s3-0 s2-0 *color-green* #f (the-as rgba -1))
)
(none)
)
(def-mips2c shadow-execute (function shadow-dma-packet pointer pointer))

View file

@ -246,7 +246,7 @@
:bounds (static-spherem 0 0 0 5)
:shadow keira-highres-shadow-mg
:origin-joint-index 3
:shadow-joint-index 3
:shadow-joint-index 4
)
(defskelgroup skel-sew-gold-key sew-gold-key sew-gold-key-lod0-jg sew-gold-key-idle-ja

View file

@ -360,7 +360,7 @@
:bounds (static-spherem 8 11.25 0 16.5)
:shadow fort-turret-shadow-mg
:origin-joint-index 3
:shadow-joint-index 3
:shadow-joint-index 10
)
(defskelgroup skel-fort-turret-explode fort-turret fort-turret-explode-lod0-jg fort-turret-explode-idle-ja

View file

@ -38,7 +38,7 @@
:bounds (static-spherem 0 0 0 0.6)
:shadow collectables-skill-shadow-mg
:texture-level 6
:shadow-joint-index 0
:shadow-joint-index 3
)
;; definition of type collectable

View file

@ -668,44 +668,34 @@
)
;; definition for function debug-draw-settings
;; WARN: Return type mismatch symbol vs none.
(defun debug-draw-settings ((arg0 matrix))
(let ((v1-0 (-> arg0 vector 1))
(a2-0 (-> arg0 vector))
(s5-0 (-> arg0 trans))
(s4-0 (-> arg0 vector 2))
(defun debug-draw-settings ((arg0 shadow-settings))
(let ((v1-0 (-> arg0 shadow-dir))
(a2-0 (-> arg0 center))
(s5-0 (-> arg0 top-plane))
(s4-0 (-> arg0 bot-plane))
(s3-0 (new 'stack-no-clear 'vector))
(s2-0 (new 'stack-no-clear 'vector))
)
(cond
((logtest? (the-as int (-> arg0 vector 0 w)) 4)
(vector+float*! s3-0 (the-as vector a2-0) v1-0 (- (vector-dot s5-0 (the-as vector a2-0)) (-> s5-0 w)))
(vector+float*! s2-0 (the-as vector a2-0) v1-0 (- (vector-dot s4-0 (the-as vector a2-0)) (-> s4-0 w)))
((logtest? (-> arg0 flags) (shadow-flags shdf02))
(vector+float*! s3-0 a2-0 v1-0 (- (vector-dot (the-as vector s5-0) a2-0) (-> s5-0 w)))
(vector+float*! s2-0 a2-0 v1-0 (- (vector-dot (the-as vector s4-0) a2-0) (-> s4-0 w)))
)
(else
(let ((a0-8 (vector+float*! (new 'stack-no-clear 'vector) (the-as vector a2-0) v1-0 (-> v1-0 w))))
(vector+float*! s3-0 a0-8 v1-0 (- (vector-dot s5-0 a0-8) (-> s5-0 w)))
(vector+float*! s2-0 a0-8 v1-0 (- (vector-dot s4-0 a0-8) (-> s4-0 w)))
(let ((a0-8 (vector+float*! (new 'stack-no-clear 'vector) a2-0 v1-0 (-> v1-0 w))))
(vector+float*! s3-0 a0-8 v1-0 (- (vector-dot (the-as vector s5-0) a0-8) (-> s5-0 w)))
(vector+float*! s2-0 a0-8 v1-0 (- (vector-dot (the-as vector s4-0) a0-8) (-> s4-0 w)))
)
)
)
(add-debug-sphere #t (bucket-id debug-no-zbuf1) (the-as vector a2-0) (meters 0.8) *color-magenta*)
(add-debug-sphere #t (bucket-id debug-no-zbuf1) a2-0 (meters 0.8) *color-magenta*)
(add-debug-x #t (bucket-id debug-no-zbuf1) s3-0 *color-blue*)
(add-debug-vector #t (bucket-id debug-no-zbuf1) s3-0 s5-0 (meters 2) *color-blue*)
(add-debug-line
#t
(bucket-id debug-no-zbuf1)
(the-as vector (-> arg0 vector))
s3-0
*color-magenta*
#f
(the-as rgba -1)
)
(add-debug-line #t (bucket-id debug-no-zbuf1) (-> arg0 center) s3-0 *color-magenta* #f (the-as rgba -1))
(add-debug-x #t (bucket-id debug-no-zbuf1) s2-0 *color-green*)
(add-debug-vector #t (bucket-id debug-no-zbuf1) s2-0 s4-0 (meters 2) *color-green*)
(add-debug-line #t (bucket-id debug-no-zbuf1) s3-0 s2-0 *color-green* #f (the-as rgba -1))
)
(none)
)
;; definition for function shadow-execute

View file

@ -270,7 +270,7 @@
:bounds (static-spherem 0 0 0 5)
:shadow keira-highres-shadow-mg
:origin-joint-index 3
:shadow-joint-index 3
:shadow-joint-index 4
)
;; failed to figure out what this is:
@ -526,6 +526,7 @@ This commonly includes things such as:
)
;; definition for method 3 of type keira-npc
;; INFO: this function exists in multiple non-identical object files
(defmethod inspect ((this keira-npc))
(when (not this)
(set! this this)
@ -539,6 +540,7 @@ This commonly includes things such as:
)
;; definition for method 35 of type keira-npc
;; INFO: this function exists in multiple non-identical object files
(defmethod get-art-elem ((this keira-npc))
"Checks various things such the current actor, task status, etc to determine the right art-group data to use
@returns the appropriate [[art-element]] for the given NPC"
@ -553,6 +555,7 @@ This commonly includes things such as:
)
;; definition for method 33 of type keira-npc
;; INFO: this function exists in multiple non-identical object files
;; WARN: Return type mismatch int vs none.
(defmethod init-art! ((this keira-npc))
"@see [[initialize-skeleton]]"

View file

@ -379,7 +379,7 @@
:bounds (static-spherem 8 11.25 0 16.5)
:shadow fort-turret-shadow-mg
:origin-joint-index 3
:shadow-joint-index 3
:shadow-joint-index 10
)
;; failed to figure out what this is: