[decomp] collide-hash, collide-frag, collide-probe (#1998)

The only interesting one is `collide-hash`, which is untested.
The other two are very likely unused. I skipped the annoying code in
`collide-probe` because it's not used and the same as jak 1.
This commit is contained in:
water111
2022-10-29 20:32:03 -04:00
committed by GitHub
parent 50076537b7
commit 8ae4829f48
41 changed files with 3802 additions and 419 deletions
+19
View File
@@ -757,6 +757,18 @@ Mips2C_Line handle_vmadda(const Instruction& i0, const std::string& instr_str) {
instr_str};
}
Mips2C_Line handle_vmsuba(const Instruction& i0, const std::string& instr_str) {
return {fmt::format("c->vmsuba(DEST::{}, {}, {});", dest_to_char(i0.cop2_dest),
reg_to_name(i0.get_src(0)), reg_to_name(i0.get_src(1))),
instr_str};
}
Mips2C_Line handle_vmula(const Instruction& i0, const std::string& instr_str) {
return {fmt::format("c->vmula(DEST::{}, {}, {});", dest_to_char(i0.cop2_dest),
reg_to_name(i0.get_src(0)), reg_to_name(i0.get_src(1))),
instr_str};
}
Mips2C_Line handle_vadda_bc(const Instruction& i0, const std::string& instr_str) {
return {fmt::format("c->vadda_bc(DEST::{}, BC::{}, {}, {});", dest_to_char(i0.cop2_dest),
i0.cop2_bc_to_char(), reg_to_name(i0.get_src(0)), reg_to_name(i0.get_src(1))),
@@ -988,6 +1000,8 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
return handle_generic_op3_bc_mask(i0, instr_str, "vmul_bc");
case InstructionKind::VMADD:
return handle_generic_op3_mask(i0, instr_str, "vmadd");
case InstructionKind::VMSUB:
return handle_generic_op3_mask(i0, instr_str, "vmsub");
case InstructionKind::VMUL:
return handle_generic_op3_mask(i0, instr_str, "vmul");
case InstructionKind::VADD:
@@ -1072,6 +1086,7 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
case InstructionKind::SLTU:
case InstructionKind::DSRAV:
case InstructionKind::DSLLV:
case InstructionKind::SLLV:
case InstructionKind::PAND:
case InstructionKind::PCEQB:
case InstructionKind::PPACW:
@@ -1112,6 +1127,10 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
return handle_vmsuba_bc(i0, instr_str);
case InstructionKind::VMADDA:
return handle_vmadda(i0, instr_str);
case InstructionKind::VMSUBA:
return handle_vmsuba(i0, instr_str);
case InstructionKind::VMULA:
return handle_vmula(i0, instr_str);
case InstructionKind::VMADD_BC:
return handle_generic_op3_bc_mask(i0, instr_str, "vmadd_bc");
case InstructionKind::VMSUB_BC:
+88 -78
View File
@@ -8457,6 +8457,8 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(declare-type region-prim-list structure)
(declare-type collide-list structure)
(declare-type collide-query structure)
(deftype drawable (basic)
((id int16 :offset-assert 4)
@@ -8468,11 +8470,11 @@
(:methods
(login (_type_) _type_ 9)
(draw (_type_ _type_ display-frame) none 10)
(drawable-method-11 () none 11) ;; (collide-with-box (_type_ int collide-list) none 11)
(drawable-method-12 () none 12) ;; (collide-y-probe (_type_ int collide-list) none 12)
(collect-stats (_type_) none 13) ;; (collide-ray (_type_ int collide-list) none 13)
(fill-collide-list-from-box (_type_ int collide-list collide-query) int 11)
(fill-collide-list-from-line-sphere (_type_ int collide-list collide-query) int 12)
(collect-stats (_type_) none 13)
(debug-draw (_type_ drawable display-frame) none 14)
(unpack-vis (_type_ (pointer int8) (pointer int8)) (pointer int8) 15) ;;
(unpack-vis (_type_ (pointer int8) (pointer int8)) (pointer int8) 15)
(collect-regions
"Determines the number of [[drawable]]s in the `obj` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count
@param area-of-interest The area defined by a sphere that we care about overlaps
@@ -10653,7 +10655,7 @@
(ocean-method-15 () none 15)
(ocean-method-16 () none 16)
(ocean-method-17 () none 17)
(ocean-method-18 () none 18)
(ocean-method-18 (_type_ object object) none 18)
(ocean-method-19 () none 19)
(ocean-method-20 () none 20)
(ocean-method-21 (_type_ float float) float 21)
@@ -13164,8 +13166,8 @@
(disable 0)
(tpage-alpha 2)
(vanish 3)
(no-collide 6)
(tpage-water 7)
)
(deftype prototype-bucket (basic)
@@ -13229,6 +13231,7 @@
)
(declare-type prototype-tie drawable)
(declare-type collide-hash-fragment-array basic)
(deftype prototype-bucket-tie (prototype-bucket)
((next uint32 12 :offset-assert 64) ;; guessed by decompiler
@@ -13242,7 +13245,7 @@
(envmap-fade-far float :offset-assert 164)
(envmap-shader adgif-shader :offset-assert 168)
(tint-color uint32 :offset-assert 172)
(collide-hash-fragment-array basic :offset-assert 176)
(collide-hash-fragment-array collide-hash-fragment-array :offset-assert 176)
(tie-colors time-of-day-palette :offset-assert 180) ;; guessed by decompiler
(data uint32 :dynamic :offset-assert 184) ;; guessed by decompiler
(color-index-qwc uint32 :dynamic :offset-assert 184) ;; guessed by decompiler
@@ -13340,10 +13343,15 @@
:flag-assert #x900000010
)
(defenum instance-flags
:type uint16
:bitfield #t
(no-collide 0)
)
(deftype instance (drawable)
((bucket-index uint16 :offset 6)
(origin matrix4h :inline :offset-assert 32)
(flags uint16 :offset 46)
(flags instance-flags :offset 46)
(wind-index uint16 :offset 62)
)
:method-count-assert 17
@@ -16024,8 +16032,8 @@
(:methods
(new (symbol type collide-shape uint int) _type_ 0)
(collide-shape-prim-method-9 () none 9) ;; (move-by-vector! (_type_ vector) none 9)
(collide-shape-prim-method-10 () none 10) ;; (find-prim-by-id (_type_ uint) collide-shape-prim 10)
(collide-shape-prim-method-11 () none 11) ;; (debug-draw-world-sphere (_type_) symbol 11)
(add-fg-prim-using-box () none 10) ;; (find-prim-by-id (_type_ uint) collide-shape-prim 10)
(add-fg-prim-using-line-sphere () none 11) ;; (debug-draw-world-sphere (_type_) symbol 11)
(collide-shape-prim-method-12 () none 12) ;; (add-fg-prim-using-box (_type_ collide-cache) none 12)
(collide-shape-prim-method-13 () none 13) ;; (add-fg-prim-using-line-sphere (_type_ collide-cache) none 13)
(collide-shape-prim-method-14 () none 14) ;; (add-fg-prim-using-y-probe (_type_ collide-cache) none 14)
@@ -17396,6 +17404,7 @@
((id uint32 :offset-assert 0)
(collidable basic :offset-assert 4)
)
:pack-me
:method-count-assert 9
:size-assert #x8
:flag-assert #x900000008
@@ -17452,7 +17461,7 @@
)
(deftype collide-hash-fragment-array (array)
()
((fragments collide-hash-fragment :dynamic :offset 16))
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
@@ -17469,7 +17478,7 @@
(axis-scale vector :inline :offset 48)
(avg-extents vector :inline :offset 64)
(bucket-array uint32 :offset 44)
(item-array uint32 :offset 60)
(item-array (inline-array collide-hash-item) :offset 60 :score 1)
(dimension-array uint32 3 :offset 76) ;; ?
(num-items uint32 :offset 92)
)
@@ -17610,7 +17619,7 @@
"Spawns associated particles with the projectile if applicable"
(_type_) none 25)
(spawn-shell-particles "TODO - confirm" (_type_) none 26)
(unknown-particles "TODO - confirm" (_type_) none 27)
(unknown-particles "TODO - confirm" (_type_) none 27)
(play-impact-sound (_type_ projectile-options) sound-id 28)
(stop-sound!
"Stops the current `sound-id` if set, re-init the `sound-id` after being stopped"
@@ -18167,10 +18176,14 @@
)
(declare-type collide-query structure)
(declare-type collide-list structure)
(deftype collide-cache (basic)
((num-tris int32 :offset-assert 4)
(num-tris-u32 uint32 :offset 4)
(num-prims int32 :offset-assert 8)
(num-prims-u32 uint32 :offset 8)
(ignore-mask pat-surface :offset-assert 12) ;; guessed by decompiler
(ignore-processes process 2 :offset-assert 16)
(collide-box bounding-box :inline :offset-assert 32)
@@ -18187,16 +18200,16 @@
(collide-cache-method-9 () none 9) ;; (debug-draw (_type_) none 9)
(fill-and-probe-using-line-sphere (_type_ collide-query) float 10)
(fill-and-probe-using-spheres (_type_ collide-query) symbol 11)
(collide-cache-method-12 (_type_ collide-query) none 12) ;; (fill-and-probe-using-y-probe (_type_ vector float collide-kind process-drawable collide-tri-result pat-surface) float 12)
(fill-using-bounding-box (_type_ collide-query) none 12) ;; (fill-and-probe-using-y-probe (_type_ vector float collide-kind process-drawable collide-tri-result pat-surface) float 12)
(fill-using-line-sphere (_type_ collide-query) none 13) ;; (fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none 13)
(fill-using-spheres (_type_ collide-query) none 14)
(collide-cache-method-15 () none 15)
(collide-cache-method-16 (_type_ collide-query) float 16) ;; (fill-using-y-probe (_type_ vector float collide-kind process-drawable pat-surface) none 16)
(reset (_type_) none 15)
(probe-using-line-sphere (_type_ collide-query) float 16) ;; (fill-using-y-probe (_type_ vector float collide-kind process-drawable pat-surface) none 16)
(probe-using-spheres (_type_ collide-query) symbol 17) ;; (initialize (_type_) none 17)
(collide-cache-method-18 () none 18) ;; (probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result pat-surface) float 18)
(collide-cache-method-19 () none 19) ;; (probe-using-spheres (_type_ collide-using-spheres-params) symbol 19)
(collide-cache-method-20 () none 20) ;; (probe-using-y-probe (_type_ vector float collide-kind collide-tri-result pat-surface) float 20)
(collide-cache-method-21 () none 21) ;; (fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache object none)) none 21)
(fill-from-bg (_type_ (function collide-hash int collide-list collide-query int) (function collide-cache collide-list collide-query none) collide-query) none 18) ;; (probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result pat-surface) float 18)
(fill-from-fg-boxes (_type_) none 19) ;; (probe-using-spheres (_type_ collide-using-spheres-params) symbol 19)
(fill-from-fg-line-sphere (_type_) none 20) ;; (probe-using-y-probe (_type_ vector float collide-kind collide-tri-result pat-surface) float 20)
(fill-from-water (_type_ water-control) none 21) ;; (fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache object none)) none 21)
(collide-cache-method-22 () none 22) ;; (fill-from-foreground-using-box (_type_) none 22)
(collide-cache-method-23 () none 23) ;; (fill-from-foreground-using-line-sphere (_type_) none 23)
(collide-cache-method-24 () none 24) ;; (fill-from-foreground-using-y-probe (_type_) none 24)
@@ -18204,8 +18217,10 @@
)
)
(declare-type instance-tie basic)
(deftype collide-list-item (structure)
((mesh collide-frag-mesh :offset-assert 0) ;; guessed by decompiler
((mesh instance-tie :offset-assert 0) ;; guessed by decompiler
(inst basic :offset-assert 4)
)
:pack-me
@@ -18233,11 +18248,14 @@
(deftype collide-query (structure)
((best-other-tri collide-tri-result :inline :offset-assert 0)
(best-my-tri collide-tri-result :inline :offset 0)
(ignore-processes process-tree 2 :offset-assert 88)
(ignore-process0 process-tree :offset 88)
(ignore-process1 process-tree :offset 92)
(ignore-processes process-tree 2 :offset-assert 88)
(ignore-process0 process-tree :offset 88)
(ignore-process1 process-tree :offset 92)
(ignore-pat pat-surface :offset-assert 96)
(ignore-pat-s32 int32 :offset 96)
(collide-with collide-spec :offset-assert 100)
(collide-with-s32 int32 :offset 100)
(overlay-params uint32 3 :offset 112) ;; ?
(bbox bounding-box :inline :offset-assert 128)
(bbox4w bounding-box4w :inline :offset-assert 160)
@@ -18245,7 +18263,7 @@
(start-pos vector :inline :offset-assert 208)
(move-dist vector :inline :offset-assert 224)
(rlength vector :inline :offset-assert 240)
(exit-planes plane 2 :offset-assert 256) ;; ?
(exit-planes plane 2 :inline :offset-assert 256) ;; ?
(radius float :offset 268)
(inv-mat matrix :inline :offset 288)
(spheres (inline-array sphere) :offset 112 :score 1)
@@ -26145,19 +26163,18 @@
;; collide-hash ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (define-extern add-collide-debug-box function)
;; (define-extern print-collide-cache-tri-count function)
;; (define-extern print-exceeded-max-cache-tris function)
;; (define-extern fill-bg-using-box-new function)
;; (define-extern fill-bg-using-line-sphere-new function)
;; (define-extern collide-list-fill-bg-using-box function)
;; (define-extern collide-list-fill-bg-using-line-sphere function)
(define-extern add-collide-debug-box (function vector rgba none))
(define-extern print-collide-cache-tri-count (function none))
(define-extern print-exceeded-max-cache-tris (function none))
(define-extern fill-bg-using-box-new (function collide-cache object collide-query none))
(define-extern fill-bg-using-line-sphere-new (function collide-cache object collide-query none))
(define-extern collide-list-fill-bg-using-box (function collide-cache collide-list collide-query none))
(define-extern collide-list-fill-bg-using-line-sphere (function collide-cache collide-list collide-query none))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; collide-probe ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#|
(deftype collide-probe-stack-elem (structure)
((child uint32 :offset-assert 0)
(count uint32 :offset-assert 4)
@@ -26166,40 +26183,37 @@
:size-assert #x8
:flag-assert #x900000008
)
|#
#|
(deftype collide-probe-stack (structure)
((data collide-probe-stack-elem 1024 :offset-assert 0) ;; guessed by decompiler
((data collide-probe-stack-elem 1024 :inline :offset-assert 0) ;; guessed by decompiler
)
:method-count-assert 9
:size-assert #x4000
:flag-assert #x900004000
)
|#
;; (define-extern creates-new-method? function) ;; (function type int symbol)
;; (define-extern overrides-parent-method? function) ;; (function type int symbol)
;; (define-extern describe-methods function) ;; (function type symbol)
;; (define-extern indent-to function) ;; (function int none)
;; (define-extern probe-traverse-draw-node function) ;; (function draw-node int none)
;; (define-extern probe-traverse-inline-array-node function) ;; (function drawable-inline-array-node int none)
;; (define-extern probe-traverse-collide-fragment function) ;; (function drawable-tree-collide-fragment int none)
;; (define-extern *collide-probe-stack* object) ;; collide-probe-stack
;; (define-extern collide-vu0-block object) ;; vu-function
;; (define-extern collide-probe-node function) ;; (function (inline-array draw-node) int collide-list int)
;; (define-extern print-out function) ;; (function int object)
;; (define-extern collide-probe-instance-tie-collide-frags function) ;; (function none)
;; (define-extern collide-probe-instance-tie function) ;; (function object int collide-list int int)
;; (define-extern collide-probe-collide-fragment-tree-make-list function) ;; (function drawable-tree-collide-fragment collide-list none)
;; (define-extern collide-probe-instance-tie-tree-make-list function) ;; (function drawable-tree-instance-tie collide-list int)
;; (define-extern collide-upload-vu0 function) ;; (function none)
;; (define-extern collide-probe-make-list function) ;; (function level collide-list none)
;; (define-extern distc function) ;; (function vector vector float)
;; (define-extern interpolate function) ;; (function float float float float float float)
;; (define-extern misty-ambush-height function) ;; (function vector float)
;; (define-extern misty-ambush-height-probe function) ;; (function vector float float)
;; (define-extern pke-collide-test function) ;; (function none)
(define-extern creates-new-method? (function type int symbol))
(define-extern overrides-parent-method? (function type int symbol))
(define-extern describe-methods (function type symbol))
(define-extern indent-to (function int none))
(define-extern probe-traverse-draw-node (function draw-node int none))
(define-extern probe-traverse-inline-array-node (function drawable-inline-array-node int none))
(define-extern probe-traverse-collide-fragment (function drawable-tree-collide-fragment int none))
(define-extern *collide-probe-stack* collide-probe-stack)
(define-extern collide-vu0-block vu-function)
(define-extern collide-probe-node (function (inline-array draw-node) int collide-list int))
(define-extern print-out (function int object))
(define-extern collide-probe-instance-tie-collide-frags (function none))
(define-extern collide-probe-instance-tie (function object int collide-list int int))
(define-extern collide-probe-collide-fragment-tree-make-list (function drawable-tree-collide-fragment collide-list none))
(define-extern collide-probe-instance-tie-tree-make-list (function drawable-tree-instance-tie collide-list int))
(define-extern collide-upload-vu0 (function none))
(define-extern collide-probe-make-list (function level collide-list none))
(define-extern distc (function vector vector float))
(define-extern interpolate (function float float float float float float))
(define-extern misty-ambush-height (function vector float))
(define-extern misty-ambush-height-probe (function vector float float))
(define-extern pke-collide-test (function none))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; collide-frag ;;
@@ -28324,7 +28338,7 @@
)
(define-extern remote-track (function none :behavior remote))
(define-extern voicebox-init-by-other (function vector handle none :behavior voicebox)) ;;
(define-extern voicebox-init-by-other (function vector handle none :behavior voicebox)) ;;
(define-extern voicebox-spawn (function process-drawable vector (pointer process))) ;; (function process vector (pointer process))
(define-extern judge-init-by-other (function vector uint none :behavior judge))
(define-extern judge-spawn (function process-tree vector uint (pointer judge)))
@@ -29261,9 +29275,9 @@
;; main-collide ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-extern drawable-sphere-box-intersect? (function drawable bounding-box4w symbol)) ;;
(define-extern instance-sphere-box-intersect? (function drawable instance-tie bounding-box4w symbol)) ;;
(define-extern instance-tfragment-add-debug-sphere (function drawable instance-tie symbol)) ;;
(define-extern drawable-sphere-box-intersect? (function drawable bounding-box4w symbol)) ;;
(define-extern instance-sphere-box-intersect? (function drawable instance-tie bounding-box4w symbol)) ;;
(define-extern instance-tfragment-add-debug-sphere (function drawable instance-tie symbol)) ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; video ;;
@@ -29328,7 +29342,6 @@
;; collide-cache ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#|
(deftype collide-puls-work (structure)
((ignore-pat pat-surface :offset-assert 0) ;; guessed by decompiler
(bsphere sphere :inline :offset-assert 16)
@@ -29338,9 +29351,7 @@
:size-assert #x30
:flag-assert #x900000030
)
|#
#|
(deftype lsmi-work (structure)
((best-u float :offset-assert 0)
(orig-best-u float :offset-assert 4)
@@ -29351,9 +29362,8 @@
:size-assert #x22c
:flag-assert #x90000022c
)
|#
;; (define-extern test-closest-pt-in-triangle function) ;; (function collide-cache symbol)
(define-extern test-closest-pt-in-triangle (function collide-cache symbol))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; collide-debug ;;
@@ -30766,15 +30776,15 @@
(define-extern *viewer* viewer)
(define-extern *viewer-sg* skeleton-group) ;; skeleton-group
(define-extern viewer-process (state viewer)) ;;
(define-extern viewer-string string) ;;
(define-extern viewer-process (state viewer)) ;;
(define-extern viewer-string string) ;;
(define-extern viewer-ja-name string) ;; string
(define-extern viewer-geo-name string) ;; string
(define-extern actor-get-arg! (function string string string symbol)) ;;
(define-extern art-part-name (function string string)) ;;
(define-extern init-viewer (function string string none :behavior viewer)) ;;
(define-extern init-viewer-for-other (function string vector entity-actor none :behavior viewer)) ;;
(define-extern add-a-bunch (function string int int float process-tree entity-actor symbol)) ;;
(define-extern actor-get-arg! (function string string string symbol)) ;;
(define-extern art-part-name (function string string)) ;;
(define-extern init-viewer (function string string none :behavior viewer)) ;;
(define-extern init-viewer-for-other (function string vector entity-actor none :behavior viewer)) ;;
(define-extern add-a-bunch (function string int int float process-tree entity-actor symbol)) ;;
(define-extern birth-viewer (function process entity-actor object))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -32854,7 +32864,7 @@
(define-extern *nav-enemy-null-callback-info* nav-callback-info)
(define-extern *nav-enemy-callback-info* nav-callback-info)
(define-extern *nav-enemy-physics-callback-info* nav-callback-info)
(define-extern nav-enemy-simple-post (function none :behavior nav-enemy)) ;;
(define-extern nav-enemy-simple-post (function none :behavior nav-enemy)) ;;
(define-extern nav-enemy-die-falling-post (function none :behavior nav-enemy))
(define-extern nav-enemy-travel-post (function none :behavior nav-enemy)) ;; (function none :behavior nav-enemy)
(define-extern nav-enemy-patrol-post (function none :behavior nav-enemy)) ;; (function none :behavior nav-enemy)
@@ -32863,8 +32873,8 @@
(define-extern nav-enemy-face-focus-post (function none :behavior nav-enemy))
(define-extern nav-enemy-stare-post (function none :behavior nav-enemy))
(define-extern nav-enemy-falling-post (function none :behavior nav-enemy)) ;; (function none :behavior nav-enemy)
(define-extern nav-enemy-turn-to-face-dir (function vector float none :behavior nav-enemy)) ;;
(define-extern nav-enemy-turn-to-face-point (function vector float none :behavior nav-enemy)) ;;
(define-extern nav-enemy-turn-to-face-dir (function vector float none :behavior nav-enemy)) ;;
(define-extern nav-enemy-turn-to-face-point (function vector float none :behavior nav-enemy)) ;;
(define-extern *nav-enemy-debug-control-info* nav-enemy-debug-control-info)
(define-extern nav-enemy-debug-control-post (function none :behavior nav-enemy))
+9 -2
View File
@@ -345,6 +345,7 @@
"(method 11 sparticle-launch-control)": [
18, 24, 25, 28, 29, 32, 33, 34, 36, 41, 55, 58, 93, 95
],
"(method 22 gui-control)": [
10, // goto L63 (B39)
16, // goto L58 (B27)
@@ -362,9 +363,11 @@
117, // goto L91
120
],
"(anon-function 11 game-save)": [0, 3, 4, 5],
"update-actor-hash": [0, 2, 4],
"(code target-death)": [111, 140]
"(code target-death)": [111, 140],
"(method 13 collide-cache)": [7, 9]
},
// Sometimes the game might use format strings that are fetched dynamically,
@@ -426,7 +429,11 @@
"(method 33 sky-work)",
"(method 28 sky-work)",
"(method 29 sky-work)",
"(method 30 sky-work)"
"(method 30 sky-work)",
"(method 11 collide-hash)",
"(method 12 collide-hash)",
"fill-bg-using-box-new",
"fill-bg-using-line-sphere-new"
],
"mips2c_jump_table_functions": {},
+13 -1
View File
@@ -1102,5 +1102,17 @@
"(code target-carry-drop)": [[672, ["inline-array", "sphere", 1]]],
"(code target-carry-throw)": [[640, ["inline-array", "sphere", 1]]],
"(code target-hit)": [[16, "vector"]],
"(method 39 battle)": [[64, "transformq"]]
"(method 39 battle)": [[64, "transformq"]],
"add-collide-debug-box":[
[16, "bounding-box"]
],
"collide-list-fill-bg-using-box": [
[32, "matrix"],
[96, "collide-query"]
],
"collide-list-fill-bg-using-line-sphere": [
[32, "matrix"],
[96, "collide-query"]
],
"add-a-bunch": [[16, "vector"]]
}
+22
View File
@@ -4048,5 +4048,27 @@
"(method 29 battle)": [
["_stack_", 16, "res-tag"],
["_stack_", 32, "res-tag"]
],
"(method 12 collide-cache)": [
[76, "v1", "process-drawable"]
],
"collide-list-fill-bg-using-box": [
[[207, 213], "v1", "collide-hash-scratch"],
[223, "a0", "collide-hash-scratch"],
[[241, 247], "v1", "collide-hash-scratch"],
[255, "a0", "collide-hash-scratch"]
],
"collide-list-fill-bg-using-line-sphere": [
[261, "a0", "collide-hash-scratch"],
[[279, 285], "v1", "collide-hash-scratch"],
[[246, 251], "v1", "collide-hash-scratch"],
[293, "a0", "collide-hash-scratch"],
[102, "v1", "float"]
],
"(method 8 collide-hash)": [
[34, "a1", "collide-hash-scratch"],
[50, "a2", "collide-hash-scratch"],
[62, "a2", "collide-hash-scratch"],
[73, "a1", "collide-hash-scratch"]
]
}
+7 -6
View File
@@ -750,12 +750,13 @@ end_type_pass:
auto& type = instr.unknown_stack_structure_tag->selected_type.value();
int offset = instr.unknown_stack_structure_tag->stack_offset;
ASSERT(type.base_type() != "pointer"); // want to test this if we find example...
StackStructureHint hint;
hint.stack_offset = offset;
hint.container_type = StackStructureHint::ContainerType::NONE;
hint.element_type = type.print();
env.add_stack_structure_hint(hint);
if (type.base_type() != "pointer") {
StackStructureHint hint;
hint.stack_offset = offset;
hint.container_type = StackStructureHint::ContainerType::NONE;
hint.element_type = type.print();
env.add_stack_structure_hint(hint);
}
}
}
+1
View File
@@ -83,6 +83,7 @@ set(RUNTIME_SOURCE
mips2c/jak1_functions/tie_methods.cpp
mips2c/jak1_functions/time_of_day.cpp
mips2c/jak2_functions/collide_func.cpp
mips2c/jak2_functions/collide_hash.cpp
mips2c/jak2_functions/debug.cpp
mips2c/jak2_functions/font.cpp
mips2c/jak2_functions/joint.cpp
File diff suppressed because it is too large Load Diff
@@ -13,7 +13,6 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->mov64(v1, a0); // or v1, a0, r0
c->mov64(v1, a2); // or v1, a2, r0
c->mov64(v1, a3); // or v1, a3, r0
@@ -34,7 +33,6 @@ u64 execute(void* ctxt) {
goto block_1;
}
block_3:
c->dsubu(a1, a2, a3); // dsubu a1, a2, a3
// nop // sll r0, r0, 0
bc = ((s64)c->sgpr64(a1)) >= 0; // bgez a1, L292
+14
View File
@@ -894,6 +894,17 @@ struct ExecutionContext {
}
}
void vmsuba(DEST mask, int src0, int src1) {
auto s0 = vf_src(src0);
auto s1 = vf_src(src1);
for (int i = 0; i < 4; i++) {
if ((u64)mask & (1 << i)) {
acc.f[i] -= s0.f[i] * s1.f[i];
}
}
}
void vmsuba_bc(DEST mask, BC bc, int src0, int src1) {
auto s0 = vf_src(src0);
auto s1 = vf_src(src1);
@@ -1064,6 +1075,9 @@ struct ExecutionContext {
void dsllv(int dst, int src, int sa) {
gprs[dst].ds64[0] = gpr_src(src).ds64[0] << (gpr_src(sa).du32[0] & 0b111111);
}
void sllv(int dst, int src, int sa) {
gprs[dst].ds64[0] = gpr_src(src).ds32[0] << (gpr_src(sa).du32[0] & 0b11111);
}
void dsra32(int dst, int src, int sa) { gprs[dst].ds64[0] = gpr_src(src).ds64[0] >> (32 + sa); }
void dsrl32(int dst, int src, int sa) { gprs[dst].du64[0] = gpr_src(src).du64[0] >> (32 + sa); }
void sra(int dst, int src, int sa) { gprs[dst].ds64[0] = gpr_src(src).ds32[0] >> sa; }
+8 -1
View File
@@ -147,6 +147,10 @@ namespace method_33_sky_work { extern void link(); }
namespace method_28_sky_work { extern void link(); }
namespace method_29_sky_work { extern void link(); }
namespace method_30_sky_work { extern void link(); }
namespace method_11_collide_hash { extern void link(); }
namespace method_12_collide_hash { extern void link(); }
namespace fill_bg_using_box_new { extern void link(); }
namespace fill_bg_using_line_sphere_new { extern void link(); }
}
// clang-format on
@@ -241,7 +245,10 @@ PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2C
jak2::render_sky_tri::link, jak2::method_16_sky_work::link, jak2::method_17_sky_work::link,
jak2::method_32_sky_work::link, jak2::method_33_sky_work::link,
jak2::method_28_sky_work::link, jak2::method_29_sky_work::link,
jak2::method_30_sky_work::link, jak2::set_sky_vf23_value::link}}},
jak2::method_30_sky_work::link, jak2::set_sky_vf23_value::link}},
{"collide-hash",
{jak2::method_11_collide_hash::link, jak2::method_12_collide_hash::link,
jak2::fill_bg_using_box_new::link, jak2::fill_bg_using_line_sphere_new::link}}},
};
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
@@ -6,6 +6,8 @@
;; dgos: ENGINE, GAME
(declare-type collide-query structure)
(declare-type instance-tie basic)
;; DECOMP BEGINS
@@ -76,7 +78,9 @@
(deftype collide-cache (basic)
((num-tris int32 :offset-assert 4)
(num-tris-u32 uint32 :offset 4)
(num-prims int32 :offset-assert 8)
(num-prims-u32 uint32 :offset 8)
(ignore-mask pat-surface :offset-assert 12)
(ignore-processes process 2 :offset-assert 16)
(collide-box bounding-box :inline :offset-assert 32)
@@ -93,16 +97,16 @@
(collide-cache-method-9 () none 9)
(fill-and-probe-using-line-sphere (_type_ collide-query) float 10)
(fill-and-probe-using-spheres (_type_ collide-query) symbol 11)
(collide-cache-method-12 (_type_ collide-query) none 12)
(fill-using-bounding-box (_type_ collide-query) none 12)
(fill-using-line-sphere (_type_ collide-query) none 13)
(fill-using-spheres (_type_ collide-query) none 14)
(collide-cache-method-15 () none 15)
(collide-cache-method-16 (_type_ collide-query) float 16)
(reset (_type_) none 15)
(probe-using-line-sphere (_type_ collide-query) float 16)
(probe-using-spheres (_type_ collide-query) symbol 17)
(collide-cache-method-18 () none 18)
(collide-cache-method-19 () none 19)
(collide-cache-method-20 () none 20)
(collide-cache-method-21 () none 21)
(fill-from-bg (_type_ (function collide-hash int collide-list collide-query int) (function collide-cache collide-list collide-query none) collide-query) none 18)
(fill-from-fg-boxes (_type_) none 19)
(fill-from-fg-line-sphere (_type_) none 20)
(fill-from-water (_type_ water-control) none 21)
(collide-cache-method-22 () none 22)
(collide-cache-method-23 () none 23)
(collide-cache-method-24 () none 24)
@@ -112,7 +116,7 @@
(deftype collide-list-item (structure)
((mesh collide-frag-mesh :offset-assert 0)
((mesh instance-tie :offset-assert 0)
(inst basic :offset-assert 4)
)
:pack-me
@@ -5,5 +5,95 @@
;; name in dgo: collide-frag
;; dgos: ENGINE, GAME
;; Note: this is probably not used in jak 2 - this is the old tree-based background collision stuff.
;; DECOMP BEGINS
(defmethod login drawable-tree-collide-fragment ((obj drawable-tree-collide-fragment))
obj
)
(defmethod draw drawable-tree-collide-fragment ((obj drawable-tree-collide-fragment) (arg0 drawable-tree-collide-fragment) (arg1 display-frame))
(when *display-render-collision*
(dotimes (s4-0 (-> obj length))
(draw (-> obj data s4-0) (-> obj data s4-0) arg1)
)
)
0
(none)
)
(defmethod unpack-vis drawable-tree-collide-fragment ((obj drawable-tree-collide-fragment) (arg0 (pointer int8)) (arg1 (pointer int8)))
arg1
)
(defmethod mem-usage collide-fragment ((obj collide-fragment) (arg0 memory-usage-block) (arg1 int))
(let ((s5-0 (if (logtest? arg1 1)
54
50
)
)
(s4-0 (-> obj mesh))
)
(set! (-> arg0 data s5-0 name) (symbol->string 'collide-fragment))
(+! (-> arg0 data s5-0 count) 1)
(let ((v1-11 (+ (asize-of obj) (asize-of s4-0))))
(+! (-> arg0 data s5-0 used) v1-11)
(+! (-> arg0 data s5-0 total) (logand -16 (+ v1-11 15)))
)
(set! (-> arg0 data (+ s5-0 1) name) "collision-poly")
(+! (-> arg0 data (+ s5-0 1) count) (-> s4-0 poly-count))
(let ((v1-22 (+ (-> s4-0 strip-data-len) (-> s4-0 poly-count))))
(+! (-> arg0 data (+ s5-0 1) used) v1-22)
(+! (-> arg0 data (+ s5-0 1) total) v1-22)
)
(set! (-> arg0 data (+ s5-0 2) name) "collision-vertex")
(+! (-> arg0 data (+ s5-0 2) count) (-> s4-0 vertex-count))
(let ((v1-31 (* (-> s4-0 vertex-data-qwc) 16)))
(+! (-> arg0 data (+ s5-0 2) used) v1-31)
(let ((v0-2 (+ (-> arg0 data (+ s5-0 2) total) v1-31)))
(set! (-> arg0 data (+ s5-0 2) total) v0-2)
(the-as collide-fragment v0-2)
)
)
)
)
(defmethod login drawable-inline-array-collide-fragment ((obj drawable-inline-array-collide-fragment))
obj
)
(defmethod draw collide-fragment ((obj collide-fragment) (arg0 collide-fragment) (arg1 display-frame))
0
(none)
)
(defmethod draw drawable-inline-array-collide-fragment ((obj drawable-inline-array-collide-fragment)
(arg0 drawable-inline-array-collide-fragment)
(arg1 display-frame)
)
(dotimes (s4-0 (-> obj length))
(let ((s3-0 (-> obj data s4-0)))
(if (sphere-cull (-> s3-0 bsphere))
(draw s3-0 s3-0 arg1)
)
)
)
0
(none)
)
(defmethod mem-usage drawable-inline-array-collide-fragment ((obj drawable-inline-array-collide-fragment) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 1 (-> arg0 length)))
(set! (-> arg0 data 0 name) (symbol->string 'drawable-group))
(+! (-> arg0 data 0 count) 1)
(let ((v1-7 32))
(+! (-> arg0 data 0 used) v1-7)
(+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15)))
)
(dotimes (s3-0 (-> obj length))
(mem-usage (-> obj data s3-0) arg0 arg1)
)
obj
)
+40 -37
View File
@@ -10,43 +10,46 @@
;; DECOMP BEGINS
(deftype collide-query (structure)
((best-other-tri collide-tri-result :inline :offset-assert 0)
(best-my-tri collide-tri-result :inline :offset 0)
(ignore-processes process-tree 2 :offset-assert 88)
(ignore-process0 process-tree :offset 88)
(ignore-process1 process-tree :offset 92)
(ignore-pat pat-surface :offset-assert 96)
(collide-with collide-spec :offset-assert 100)
(overlay-params uint32 3 :offset 112)
(bbox bounding-box :inline :offset-assert 128)
(bbox4w bounding-box4w :inline :offset-assert 160)
(bsphere sphere :inline :offset-assert 192)
(start-pos vector :inline :offset-assert 208)
(move-dist vector :inline :offset-assert 224)
(rlength vector :inline :offset-assert 240)
(exit-planes plane 2 :offset-assert 256)
(radius float :offset 268)
(inv-mat matrix :inline :offset 288)
(spheres (inline-array sphere) :offset 112)
(num-spheres uint32 :offset 116)
(solid-only symbol :offset 120)
(best-dist float :offset 112)
(best-other-prim basic :offset 116)
(best-my-prim collide-shape-prim :offset 120)
(move-vec vector :inline :offset 224)
(best-u float :offset 112)
(action-mask collide-action :offset-assert 352)
(local-box4w bounding-box4w :inline :offset-assert 368)
(search-box bounding-box4w :inline :offset-assert 400)
(search-vector vector4w :inline :offset-assert 432)
(instance-mat matrix :inline :offset-assert 448)
(instance-ptr basic :offset-assert 512)
(x-addr uint32 :offset-assert 516)
(x-step uint32 :offset-assert 520)
(y-addr uint32 :offset-assert 524)
(y-step uint32 :offset-assert 528)
(z-addr uint32 :offset-assert 532)
(z-step uint32 :offset-assert 536)
((best-other-tri collide-tri-result :inline :offset-assert 0)
(best-my-tri collide-tri-result :inline :offset 0)
(ignore-processes process-tree 2 :offset-assert 88)
(ignore-process0 process-tree :offset 88)
(ignore-process1 process-tree :offset 92)
(ignore-pat pat-surface :offset-assert 96)
(ignore-pat-s32 int32 :offset 96)
(collide-with collide-spec :offset-assert 100)
(collide-with-s32 int32 :offset 100)
(overlay-params uint32 3 :offset 112) ;; ?
(bbox bounding-box :inline :offset-assert 128)
(bbox4w bounding-box4w :inline :offset-assert 160)
(bsphere sphere :inline :offset-assert 192)
(start-pos vector :inline :offset-assert 208)
(move-dist vector :inline :offset-assert 224)
(rlength vector :inline :offset-assert 240)
(exit-planes plane 2 :inline :offset-assert 256) ;; ?
(radius float :offset 268)
(inv-mat matrix :inline :offset 288)
(spheres (inline-array sphere) :offset 112 :score 1)
(num-spheres uint32 :offset 116)
(solid-only symbol :offset 120)
(best-dist float :offset 112 :score -1)
(best-other-prim basic :offset 116)
(best-my-prim collide-shape-prim :offset 120 :score 1)
(move-vec vector :inline :offset 224)
(best-u float :offset 112 :score -1)
(action-mask collide-action :offset-assert 352)
(local-box4w bounding-box4w :inline :offset-assert 368)
(search-box bounding-box4w :inline :offset-assert 400)
(search-vector vector4w :inline :offset-assert 432)
(instance-mat matrix :inline :offset-assert 448)
(instance-ptr basic :offset-assert 512)
(x-addr uint32 :offset-assert 516)
(x-step uint32 :offset-assert 520)
(y-addr uint32 :offset-assert 524)
(y-step uint32 :offset-assert 528)
(z-addr uint32 :offset-assert 532)
(z-step uint32 :offset-assert 536)
)
:method-count-assert 9
:size-assert #x21c
@@ -7,3 +7,230 @@
;; DECOMP BEGINS
;; this file is unused in jak 2.
;; a number of functions require a bunch of annoying casts/mips2c stuff, but are unused.
(defun creates-new-method? ((arg0 type) (arg1 int))
(let ((v1-1 (-> arg0 parent allocated-length)))
(-> arg0 allocated-length)
(>= arg1 (the-as int v1-1))
)
)
(defun overrides-parent-method? ((arg0 type) (arg1 int))
(!= (-> arg0 method-table arg1) (-> arg0 parent method-table arg1))
)
(defun describe-methods ((arg0 type))
(let ((s5-0 (-> arg0 allocated-length)))
(dotimes (s4-0 (the-as int s5-0))
(let ((s3-0 arg0))
(format #t "~3d:~%" s4-0)
(while (!= s3-0 basic)
(cond
((creates-new-method? s3-0 s4-0)
(format #t " created by ~s.~%" (symbol->string (-> s3-0 symbol)))
(set! s3-0 basic)
)
((overrides-parent-method? s3-0 s4-0)
(format #t " overridden by ~s.~%" (symbol->string (-> s3-0 symbol)))
(set! s3-0 (-> s3-0 parent))
)
(else
(set! s3-0 (-> s3-0 parent))
)
)
)
)
)
)
#f
)
(defun indent-to ((arg0 int))
(dotimes (s5-0 arg0)
(format #t " ")
)
(none)
)
(define-extern probe-traverse-draw-node (function draw-node int none))
(defun probe-traverse-draw-node ((arg0 draw-node) (arg1 int))
(indent-to arg1)
(format
#t
"[~08x] child-count: ~d, flags: ~d, dist: ~f, child: ~a~%"
arg0
(-> arg0 child-count)
(-> arg0 flags)
(-> arg0 distance)
(-> arg0 child)
)
(cond
((nonzero? (-> arg0 flags))
(let ((s4-0 (-> arg0 child)))
(dotimes (s3-0 (the-as int (-> arg0 child-count)))
(probe-traverse-draw-node (the-as draw-node (+ (the-as uint s4-0) (* s3-0 32))) (+ arg1 1))
)
)
)
(else
)
)
0
(none)
)
(defun probe-traverse-inline-array-node ((arg0 drawable-inline-array-node) (arg1 int))
(indent-to arg1)
(format #t "[~08x] drawable-inline-array-node: length = ~d~%" arg0 (-> arg0 length))
(let ((s4-0 (-> arg0 length)))
(dotimes (s3-0 s4-0)
(indent-to arg1)
(format #t "(~3d) ~a~%" s3-0 (-> arg0 data s3-0))
(if (= (-> arg0 data s3-0 type) draw-node)
(probe-traverse-draw-node (-> arg0 data s3-0) (+ arg1 1))
)
)
)
(none)
)
(defun probe-traverse-collide-fragment ((arg0 drawable-tree-collide-fragment) (arg1 int))
(indent-to arg1)
(format #t "[~08x] drawable-tree-collide-fragment: length = ~d~%" arg0 (-> arg0 length))
(let ((s4-0 (-> arg0 length)))
(dotimes (s3-0 (+ s4-0 -1))
(indent-to arg1)
(if (= (-> arg0 data s3-0 type) drawable-inline-array-node)
(probe-traverse-inline-array-node (the-as drawable-inline-array-node (-> arg0 data s3-0)) (+ arg1 1))
(format #t "unknown: ~a~%" (-> arg0 data s3-0))
)
)
)
(none)
)
(deftype collide-probe-stack-elem (structure)
((child uint32 :offset-assert 0)
(count uint32 :offset-assert 4)
)
:method-count-assert 9
:size-assert #x8
:flag-assert #x900000008
)
(deftype collide-probe-stack (structure)
((data collide-probe-stack-elem 1024 :inline :offset-assert 0)
)
:method-count-assert 9
:size-assert #x4000
:flag-assert #x900004000
)
(define *collide-probe-stack* (the-as collide-probe-stack (+ 4192 #x70000000)))
(define collide-vu0-block (new 'static 'vu-function :length 90 :qlength 45))
;; definition for function collide-probe-node
;; ERROR: function was not converted to expressions. Cannot decompile.
(defun print-out ((arg0 int))
(format *stdcon* "~d~%" arg0)
)
(defun collide-probe-instance-tie-collide-frags ()
0
(none)
)
;; definition for function collide-probe-instance-tie
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function collide-probe-collide-fragment-tree-make-list
;; ERROR: failed type prop at 6: Could not figure out load: (set! v1 (l.h (+ v1 2)))
;; ERROR: Function may read a register that is not set: a2
;; definition for function collide-probe-instance-tie-tree-make-list
;; ERROR: failed type prop at 6: Could not figure out load: (set! v1 (l.h (+ v1 2)))
;; WARN: Return type mismatch none vs int.
;; ERROR: Function may read a register that is not set: a2
;; definition for function collide-upload-vu0
;; WARN: Return type mismatch int vs none.
;; WARN: Failed store: (s.d! (+ a0-5 8) 0) at op 17
;; definition for function collide-probe-make-list
;; ERROR: failed type prop at 23: Could not figure out load: (set! a1 (l.h (+ v1 2)))
;; WARN: Return type mismatch symbol vs none.
;; ERROR: Function may read a register that is not set: a2
(defun distc ((arg0 vector) (arg1 vector))
(let* ((f0-1 (- (-> arg0 x) (-> arg1 x)))
(f0-3 (* f0-1 f0-1))
(f1-2 (- (-> arg0 z) (-> arg1 z)))
)
(sqrtf (+ f0-3 (* f1-2 f1-2)))
)
)
(defun interpolate ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float))
(let ((f0-1 (- arg3 arg1))
(f1-2 (- arg4 arg2))
(f3-1 (- arg0 arg1))
)
(+ arg2 (/ (* f3-1 f1-2) f0-1))
)
)
(defun misty-ambush-height ((arg0 vector))
(let* ((a1-0 (new 'static 'vector :x -808960.0 :y 111656.96 :z 3924992.0))
(f0-0 (distc arg0 a1-0))
)
(cond
((< f0-0 52019.2)
111656.96
)
((>= 58982.4 f0-0)
(interpolate f0-0 52019.2 111656.96 58982.4 116776.96)
)
((>= 124436.48 f0-0)
(interpolate f0-0 58982.4 116776.96 124436.48 114688.0)
)
((>= 219217.92 f0-0)
(interpolate f0-0 124436.48 114688.0 219217.92 113254.4)
)
(else
113254.4
)
)
)
)
(defun misty-ambush-height-probe ((arg0 vector) (arg1 float))
(let ((f0-0 (misty-ambush-height arg0)))
(cond
((< f0-0 (-> arg0 y))
(/ (- (-> arg0 y) f0-0) arg1)
)
(else
(format 0 "WARNING: ~%height = ~f, pos.y = ~f" (* 0.00024414062 f0-0) (* 0.00024414062 (-> arg0 y)))
-1.0
)
)
)
)
(defun pke-collide-test ()
0
(none)
)
@@ -381,8 +381,8 @@
(:methods
(new (symbol type collide-shape uint int) _type_ 0)
(collide-shape-prim-method-9 () none 9)
(collide-shape-prim-method-10 () none 10)
(collide-shape-prim-method-11 () none 11)
(add-fg-prim-using-box () none 10)
(add-fg-prim-using-line-sphere () none 11)
(collide-shape-prim-method-12 () none 12)
(collide-shape-prim-method-13 () none 13)
(collide-shape-prim-method-14 () none 14)
+1 -1
View File
@@ -50,7 +50,7 @@
(set! (-> query action-mask) (collide-action solid))
)
(fill-using-line-sphere *collide-cache* cquery)
(let ((f30-0 (collide-cache-method-16 *collide-cache* cquery)))
(let ((f30-0 (probe-using-line-sphere *collide-cache* cquery)))
(quad-copy! (the-as pointer (-> obj last-collide-result)) (the-as pointer (-> cquery best-other-tri)) 6)
(if (>= 0.0 f30-0)
(set! (-> obj have-no-los) (-> self clock frame-counter))
+9 -4
View File
@@ -6,6 +6,9 @@
;; dgos: ENGINE, GAME
(declare-type region-prim-list structure)
(declare-type collide-list structure)
(declare-type collide-query structure)
;; NOTE - for sparticle-launcher and editable
(define-extern sphere-in-view-frustum? (function sphere symbol))
@@ -18,12 +21,13 @@
(define-extern prototype-bucket-recalc-fields (function prototype-bucket prototype-bucket))
(define-extern determine-pause-mode (function int))
(define-extern vis-cull (function int symbol))
(define-extern sphere-cull (function vector symbol))
;; DECOMP BEGINS
(deftype drawable (basic)
((id int16 :offset-assert 4)
(bsphere vector :inline :offset-assert 16)
((id int16 :offset-assert 4)
(bsphere vector :inline :offset-assert 16)
)
:method-count-assert 17
:size-assert #x20
@@ -31,11 +35,12 @@
(:methods
(login (_type_) _type_ 9)
(draw (_type_ _type_ display-frame) none 10)
(drawable-method-11 () none 11)
(drawable-method-12 () none 12)
(fill-collide-list-from-box (_type_ int collide-list collide-query) int 11)
(fill-collide-list-from-line-sphere (_type_ int collide-list collide-query) int 12)
(collect-stats (_type_) none 13)
(debug-draw (_type_ drawable display-frame) none 14)
(unpack-vis (_type_ (pointer int8) (pointer int8)) (pointer int8) 15)
(unpack-vis (_type_ (pointer int8) (pointer int8)) (pointer int8) 15)
(collect-regions (_type_ sphere int region-prim-list) none 16)
)
)
+4 -4
View File
@@ -224,14 +224,14 @@
(none)
)
(defmethod drawable-method-11 drawable ()
(defmethod fill-collide-list-from-box drawable ((obj drawable) (arg0 int) (arg1 collide-list) (arg2 collide-query))
"Collect a list of collision meshes contained in the box."
0
(none)
)
(defmethod drawable-method-12 drawable ()
(defmethod fill-collide-list-from-line-sphere drawable ((obj drawable) (arg0 int) (arg1 collide-list) (arg2 collide-query))
"Collect a list of collision meshes contained in 'line-sphere'."
0
(none)
)
(defmethod collect-regions drawable ((obj drawable) (arg0 sphere) (arg1 int) (arg2 region-prim-list))
@@ -6,6 +6,7 @@
;; dgos: ENGINE, GAME
(declare-type prototype-tie drawable)
(declare-type collide-hash-fragment-array basic)
(defenum prototype-flags
:bitfield #t
@@ -14,10 +15,17 @@
;; (use-envmap 1) maybe
(tpage-alpha 2)
(vanish 3)
(no-collide 6)
(tpage-water 7)
)
(defenum instance-flags
:type uint16
:bitfield #t
(no-collide 0)
)
;; DECOMP BEGINS
(deftype prototype-bucket (basic)
@@ -90,7 +98,7 @@
(envmap-fade-far float :offset-assert 164)
(envmap-shader adgif-shader :offset-assert 168)
(tint-color uint32 :offset-assert 172)
(collide-hash-fragment-array basic :offset-assert 176)
(collide-hash-fragment-array collide-hash-fragment-array :offset-assert 176)
(tie-colors time-of-day-palette :offset-assert 180)
(data uint32 :dynamic :offset-assert 184)
(color-index-qwc uint32 :dynamic :offset-assert 184)
@@ -188,12 +196,13 @@
)
(deftype instance (drawable)
((bucket-index uint16 :offset 6)
(origin matrix4h :inline :offset-assert 32)
(flags uint16 :offset 46)
(wind-index uint16 :offset 62)
((bucket-index uint16 :offset 6)
(origin matrix4h :inline :offset-assert 32)
(flags instance-flags :offset 46)
(wind-index uint16 :offset 62)
)
:method-count-assert 17
:size-assert #x40
:flag-assert #x1100000040
)
@@ -582,7 +582,7 @@
)
(fill-using-line-sphere *collide-cache* s4-0)
(cond
((>= (collide-cache-method-16 *collide-cache* s4-0) 0.0)
((>= (probe-using-line-sphere *collide-cache* s4-0) 0.0)
(set! (-> arg1 user-float) (-> s4-0 best-other-tri intersect y))
(let ((f0-8 (+ 65536.0 (-> *math-camera* trans y))))
(if (< (-> arg1 user-float) f0-8)
+1 -1
View File
@@ -519,7 +519,7 @@
(ocean-method-15 () none 15)
(ocean-method-16 () none 16)
(ocean-method-17 () none 17)
(ocean-method-18 () none 18)
(ocean-method-18 (_type_ object object) none 18)
(ocean-method-19 () none 19)
(ocean-method-20 () none 20)
(ocean-method-21 (_type_ float float) float 21)
+1 -1
View File
@@ -162,7 +162,7 @@
)
(set! (-> a0-6 radius) (-> obj radius))
(set! (-> a0-6 collide-with) (-> obj collide-with))
(set! (-> a0-6 ignore-process0) v1-2)
(set! (-> a0-6 ignore-process0) (the process-drawable v1-2))
(set! (-> a0-6 ignore-process1) #f)
(set! (-> a0-6 ignore-pat) arg2)
(set! (-> a0-6 action-mask) (collide-action solid))
@@ -41,6 +41,7 @@
((id uint32 :offset-assert 0)
(collidable basic :offset-assert 4)
)
:pack-me
:method-count-assert 9
:size-assert #x8
:flag-assert #x900000008
@@ -95,26 +96,26 @@
)
(deftype collide-hash-fragment-array (array)
()
((fragments collide-hash-fragment :dynamic :offset 16))
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(deftype collide-hash (drawable)
((num-ids uint16 :offset 4)
(id-count uint16 :offset 6)
(num-buckets uint32 :offset 8)
(qwc-id-bits uint32 :offset 12)
(grid-step vector :inline :offset 16)
(bbox bounding-box :inline :offset-assert 32)
(bbox4w bounding-box4w :inline :offset-assert 64)
(axis-scale vector :inline :offset 48)
(avg-extents vector :inline :offset 64)
(bucket-array uint32 :offset 44)
(item-array uint32 :offset 60)
(dimension-array uint32 3 :offset 76)
(num-items uint32 :offset 92)
((num-ids uint16 :offset 4)
(id-count uint16 :offset 6)
(num-buckets uint32 :offset 8)
(qwc-id-bits uint32 :offset 12)
(grid-step vector :inline :offset 16)
(bbox bounding-box :inline :offset-assert 32)
(bbox4w bounding-box4w :inline :offset-assert 64)
(axis-scale vector :inline :offset 48)
(avg-extents vector :inline :offset 64)
(bucket-array uint32 :offset 44)
(item-array (inline-array collide-hash-item) :offset 60)
(dimension-array uint32 3 :offset 76)
(num-items uint32 :offset 92)
)
:method-count-assert 17
:size-assert #x60
@@ -7,3 +7,595 @@
;; DECOMP BEGINS
;; collide-hash is the broad phase collision detector for background collisions.
;; It esssentially answers the question "what collide fragments are near X"?
;; and this answer is passed down to lower level collision checks.
;; unlike jak 1, this uses a "spatial hash". The idea is to divide space into a grid, then map
;; cells in this grid to a smaller number of buckets using a hash function.
;; hash collisions are probably not too common, as most space is empty, and can be reject relatively quickly
;; by doing a bounding sphere check with the collision fragments.
;; in this file, boxes are commonly represented as a vector, with xyz being the origin, and w being half
;; the side length.
(defun add-collide-debug-box ((arg0 vector) (arg1 rgba))
"Debug draw a box represented as (origin, half-side-length)."
(rlet ((vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
)
(let ((a3-0 (new 'stack-no-clear 'bounding-box)))
(.lvf vf1 (&-> arg0 quad))
(.sub.w.vf vf2 vf1 vf1)
(.add.w.vf vf3 vf1 vf1)
(.svf (&-> a3-0 min quad) vf2)
(.svf (&-> a3-0 max quad) vf3)
(add-debug-box #t (bucket-id debug2) (-> a3-0 min) (-> a3-0 max) arg1)
)
(none)
)
)
(defun-debug print-collide-cache-tri-count ()
"Print the number of triangles in the collide cache."
(let ((gp-0 0)
(s4-0 0)
(s5-0 0)
(s3-0 0)
)
(let ((v1-0 *collide-cache*))
(dotimes (a0-0 (-> v1-0 num-tris))
(case (-> v1-0 tris a0-0 pat mode)
(((pat-mode ground))
(+! gp-0 1)
)
(((pat-mode wall))
(+! s5-0 1)
)
(((pat-mode obstacle))
(+! s4-0 1)
)
(else
(+! s3-0 1)
)
)
)
(format *stdcon* "tris ~d (~4,,1f%) " (-> v1-0 num-tris) (* 0.2173913 (the float (-> v1-0 num-tris))))
)
(format *stdcon* "(ground ~d, wall ~d, obstacle ~d, other ~d)~%" gp-0 s5-0 s4-0 s3-0)
)
(none)
)
(defun-debug print-exceeded-max-cache-tris ()
"Complain that the collide cache is full."
(with-pp
(when (not *already-printed-exeeded-max-cache-tris*)
(set! *already-printed-exeeded-max-cache-tris* #t)
(if pp
(format *stdcon* "Exceeded collide cache max # of tris (~s)!~%" (-> pp name))
(format *stdcon* "Exceeded collide cache max # of tris!~%")
)
(print-collide-cache-tri-count)
)
0
(none)
)
)
;; these methods fill a collide list, given a collide query. This does the actual spatial hash.
(defmethod-mips2c "(method 11 collide-hash)" 11 collide-hash)
(defmethod-mips2c "(method 12 collide-hash)" 12 collide-hash)
;; these methods do the work of writing triangles into the collide cache.
(def-mips2c fill-bg-using-box-new (function collide-cache object collide-query none))
(def-mips2c fill-bg-using-line-sphere-new (function collide-cache object collide-query none))
(defun collide-list-fill-bg-using-box ((arg0 collide-cache) (arg1 collide-list) (arg2 collide-query))
"Given a list of collision meshes, fill the given collide collide with triangles which are
inside the box."
(local-vars
(v1-12 uint128)
(v1-14 uint128)
(v1-15 uint128)
(a0-10 uint128)
(a0-11 uint128)
(a1-3 uint128)
(a2-3 uint128)
(a2-4 uint128)
(sv-16 int)
(sv-20 collide-list)
(sv-640 int)
)
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :class vf)
(vf13 :class vf)
(vf14 :class vf)
(vf16 :class vf)
(vf17 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(set! sv-16 (-> arg1 num-items))
(set! sv-20 arg1)
;; loop over collision meshes.
(dotimes (s4-0 sv-16)
(let ((s3-0 (-> sv-20 items s4-0 mesh)))
(cond
((= (-> s3-0 type) instance-tie) ;; it's an instanced collision mesh.
(let* ((v1-4 s3-0)
(s1-0 (-> v1-4 bucket-ptr))
)
;; only both checking if collision is enabled on this geometry.
(when (not (or (logtest? (-> s1-0 flags) (prototype-flags no-collide))
(logtest? (-> v1-4 flags) (instance-flags no-collide))
)
)
;; debug draw.
(if *collide-list-boxes*
(add-collide-debug-box (-> s3-0 bsphere) (new 'static 'rgba :r #xff :a #x80))
)
;; we need to created a modified query to account for the transformation of the instanced mesh.
(let ((s0-0 (new 'stack-no-clear 'matrix))
(s2-0 (new 'stack-no-clear 'collide-query))
)
;; start with the input query, copied.
(mem-copy! (the-as pointer s2-0) (the-as pointer arg2) 540)
;; unpack the instance matrix.
(let ((v1-11 (the-as uint128 (-> s3-0 origin vector4h 3 long))))
(let ((a2-2 (the-as uint128 (-> s3-0 origin vector4h 0 long))))
(.pextlh v1-12 v1-11 0)
(let ((a0-9 (the-as uint128 (-> s3-0 origin vector4h 1 long))))
(.pw.sra a1-3 v1-12 10)
(let ((v1-13 (the-as uint128 (-> s3-0 origin vector4h 2 long))))
(.pextlh a2-3 a2-2 0)
(.pw.sra a2-4 a2-3 16)
(.pextlh a0-10 a0-9 0)
(.mov vf4 a1-3)
(.pw.sra a0-11 a0-10 16)
(.mov vf1 a2-4)
(.pextlh v1-14 v1-13 0)
)
)
)
)
(.mov vf2 a0-11)
(.pw.sra v1-15 v1-14 16)
(.lvf vf5 (&-> s3-0 bsphere quad))
(.mov vf3 v1-15)
(.itof.vf vf4 vf4)
(vitof12.xyzw vf1 vf1)
(vitof12.xyzw vf2 vf2)
(vitof12.xyzw vf3 vf3)
(.add.vf vf4 vf4 vf5 :mask #b111)
;; pass the instance mat down.
(.svf (&-> s2-0 instance-mat vector 0 quad) vf1)
(.svf (&-> s2-0 instance-mat vector 1 quad) vf2)
(.svf (&-> s2-0 instance-mat vector 2 quad) vf3)
(.svf (&-> s2-0 instance-mat trans quad) vf4)
;; transform the bounding box to instance coordinates.
(matrix-4x4-inverse! s0-0 (-> s2-0 instance-mat))
(.lvf vf7 (&-> arg2 bbox min quad))
(.lvf vf14 (&-> arg2 bbox max quad))
(.lvf vf1 (&-> s0-0 vector 0 quad))
(.lvf vf2 (&-> s0-0 vector 1 quad))
(.lvf vf3 (&-> s0-0 vector 2 quad))
(.lvf vf4 (&-> s0-0 trans quad))
(.mul.w.vf acc vf4 vf0)
(.add.mul.x.vf acc vf1 vf7 acc)
(.add.mul.y.vf acc vf2 vf7 acc)
(.add.mul.z.vf vf8 vf3 vf14 acc)
(.mul.w.vf acc vf4 vf0)
(.add.mul.x.vf acc vf1 vf7 acc)
(.add.mul.y.vf acc vf2 vf14 acc)
(.add.mul.z.vf vf9 vf3 vf7 acc)
(.mul.w.vf acc vf4 vf0)
(.add.mul.x.vf acc vf1 vf7 acc)
(.add.mul.y.vf acc vf2 vf14 acc)
(.add.mul.z.vf vf10 vf3 vf14 acc)
(.min.vf vf5 vf8 vf9)
(.max.vf vf6 vf8 vf9)
(.mul.w.vf acc vf4 vf0)
(.add.mul.x.vf acc vf1 vf14 acc)
(.add.mul.y.vf acc vf2 vf7 acc)
(.add.mul.z.vf vf11 vf3 vf7 acc)
(.min.vf vf5 vf5 vf10)
(.max.vf vf6 vf6 vf10)
(.mul.w.vf acc vf4 vf0)
(.add.mul.x.vf acc vf1 vf14 acc)
(.add.mul.y.vf acc vf2 vf7 acc)
(.add.mul.z.vf vf12 vf3 vf14 acc)
(.min.vf vf5 vf5 vf11)
(.max.vf vf6 vf6 vf11)
(.mul.w.vf acc vf4 vf0)
(.add.mul.x.vf acc vf1 vf14 acc)
(.add.mul.y.vf acc vf2 vf14 acc)
(.add.mul.z.vf vf13 vf3 vf7 acc)
(.min.vf vf5 vf5 vf12)
(.max.vf vf6 vf6 vf12)
(.mul.w.vf acc vf4 vf0)
(.add.mul.x.vf acc vf1 vf14 acc)
(.add.mul.y.vf acc vf2 vf14 acc)
(.add.mul.z.vf vf14 vf3 vf14 acc)
(.min.vf vf5 vf5 vf13)
(.max.vf vf6 vf6 vf13)
(.mul.w.vf acc vf4 vf0)
(.add.mul.x.vf acc vf1 vf7 acc)
(.add.mul.y.vf acc vf2 vf7 acc)
(.add.mul.z.vf vf7 vf3 vf7 acc)
(.min.vf vf5 vf5 vf14)
(.max.vf vf6 vf6 vf14)
(.min.vf vf5 vf5 vf7)
(.max.vf vf6 vf6 vf7)
(.ftoi.vf vf16 vf5)
(.ftoi.vf vf17 vf6)
;; update collision query with transformed box
(.svf (&-> s2-0 bbox min quad) vf5)
(.svf (&-> s2-0 bbox max quad) vf6)
(.svf (&-> s2-0 bbox4w min quad) vf16)
(.svf (&-> s2-0 bbox4w max quad) vf17)
;; loop over fragments in the mesh.
(let ((s1-1 (-> s1-0 collide-hash-fragment-array)))
(set! sv-640 (-> s1-1 length))
(set! (-> s2-0 instance-ptr) s3-0)
(dotimes (s3-1 sv-640)
;; not sure why we set this, maybe something used by the asm function
(set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0))
(set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0))
;; reset triangle count
(set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0))
;; unpack triangles, filter, and store in collide cache.
(fill-bg-using-box-new arg0 (-> s1-1 fragments s3-1) s2-0)
;; update stats
(+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) tris))
)
)
)
)
)
)
(else
;; colliding with non-instanced mesh. Don't need to update query.
(if *collide-list-boxes*
(add-collide-debug-box (-> s3-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80))
)
(set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0))
(set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0))
(set! (-> arg2 instance-ptr) #f)
(set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0))
(fill-bg-using-box-new arg0 s3-0 arg2)
(+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) tris))
)
)
)
)
0
(none)
)
)
(defmacro .sll (result in sa)
`(set! ,result (sext32 (the-as int (shl (logand ,in #xffffffff) ,sa))))
)
(defun collide-list-fill-bg-using-line-sphere ((arg0 collide-cache) (arg1 collide-list) (arg2 collide-query))
"line-sphere version of collide-list-fill-bg-using-box.
Logic is basically the same, but transforming the line-sphere query is a bit trickier."
(local-vars
(v1-12 uint128)
(v1-14 uint128)
(v1-15 uint128)
(v1-17 number)
(v1-26 float)
(a0-10 uint128)
(a0-11 uint128)
(a1-3 uint128)
(a2-3 uint128)
(a2-4 uint128)
(sv-16 int)
(sv-640 int)
)
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(set! sv-16 (-> arg1 num-items))
(dotimes (s3-0 sv-16)
(let ((s2-0 (-> arg1 items s3-0 mesh)))
(cond
((= (-> s2-0 type) instance-tie)
;; it's an instance, we'll need some fancy logic to transform the query to be in the instance coordinates.
(let ((v1-4 s2-0))
(when (not (or (logtest? (-> v1-4 bucket-ptr flags) (prototype-flags no-collide))
(logtest? (-> v1-4 flags) (instance-flags no-collide))
)
)
(if *collide-list-boxes*
(add-collide-debug-box (-> s2-0 bsphere) (new 'static 'rgba :r #xff :a #x80))
)
(let ((s0-0 (new 'stack-no-clear 'matrix))
(s1-0 (new 'stack-no-clear 'collide-query))
)
;; copy original query
(mem-copy! (the-as pointer s1-0) (the-as pointer arg2) 540)
;; unpack instance matrix
(let ((v1-11 (the-as uint128 (-> s2-0 origin vector4h 3 long))))
(let ((a2-2 (the-as uint128 (-> s2-0 origin vector4h 0 long))))
(.pextlh v1-12 v1-11 0)
(let ((a0-9 (the-as uint128 (-> s2-0 origin vector4h 1 long))))
(.pw.sra a1-3 v1-12 10)
(let ((v1-13 (the-as uint128 (-> s2-0 origin vector4h 2 long))))
(.pextlh a2-3 a2-2 0)
(.pw.sra a2-4 a2-3 16)
(.pextlh a0-10 a0-9 0)
(.mov vf4 a1-3)
(.pw.sra a0-11 a0-10 16)
(.mov vf1 a2-4)
(.pextlh v1-14 v1-13 0)
)
)
)
)
(.mov vf2 a0-11)
(.pw.sra v1-15 v1-14 16)
(.lvf vf5 (&-> s2-0 bsphere quad))
(.mov vf3 v1-15)
(.itof.vf vf4 vf4)
(vitof12.xyzw vf1 vf1)
(vitof12.xyzw vf2 vf2)
(vitof12.xyzw vf3 vf3)
(.add.vf vf4 vf4 vf5 :mask #b111)
(.svf (&-> s1-0 instance-mat vector 0 quad) vf1)
(.svf (&-> s1-0 instance-mat vector 1 quad) vf2)
(.svf (&-> s1-0 instance-mat vector 2 quad) vf3)
(.svf (&-> s1-0 instance-mat trans quad) vf4)
;; invert
(matrix-4x4-inverse! s0-0 (-> s1-0 instance-mat))
(.lvf vf7 (&-> arg2 start-pos quad))
(.lvf vf8 (&-> arg2 move-dist quad))
(.lvf vf1 (&-> s0-0 vector 0 quad))
(.lvf vf2 (&-> s0-0 vector 1 quad))
(.lvf vf3 (&-> s0-0 vector 2 quad))
(.lvf vf4 (&-> s0-0 trans quad))
(.add.vf vf8 vf7 vf8)
(let ((v1-16 (-> s2-0 rmin-scale)))
(.mul.x.vf acc vf1 vf7)
(let ((f2-0 (-> arg2 radius)))
(.add.mul.y.vf acc vf2 vf7 acc)
(.sll v1-17 v1-16 16)
(.add.mul.z.vf acc vf3 vf7 acc)
(let ((f1-0 (the-as float v1-17)))
(.add.mul.w.vf vf7 vf4 vf0 acc)
(.mul.x.vf acc vf1 vf8)
(let ((f2-1 (* f2-0 f1-0)))
(.add.mul.y.vf acc vf2 vf8 acc)
(.add.mul.z.vf acc vf3 vf8 acc)
(.add.mul.w.vf vf8 vf4 vf0 acc)
(.svf (&-> s1-0 start-pos quad) vf7)
(.min.vf vf5 vf7 vf8)
(set! (-> s1-0 radius) f2-1)
)
)
)
)
(.max.vf vf6 vf7 vf8)
(.lvf vf9 (&-> s1-0 exit-planes 0 quad))
(.sub.vf vf8 vf8 vf7)
(.sub.w.vf vf5 vf5 vf9)
(.add.w.vf vf6 vf6 vf9)
(.svf (&-> s1-0 move-dist quad) vf8)
(.ftoi.vf vf10 vf5)
(.ftoi.vf vf11 vf6)
(.svf (&-> s1-0 bbox min quad) vf5)
(.svf (&-> s1-0 bbox max quad) vf6)
(.svf (&-> s1-0 bbox4w min quad) vf10)
(.svf (&-> s1-0 bbox4w max quad) vf11)
(set! (-> s1-0 rlength x) (if (= (-> s1-0 move-dist x) 0.0)
0.0
(/ 1.0 (-> s1-0 move-dist x))
)
)
(set! (-> s1-0 rlength y) (if (= (-> s1-0 move-dist y) 0.0)
0.0
(/ 1.0 (-> s1-0 move-dist y))
)
)
(set! (-> s1-0 rlength z) (if (= (-> s1-0 move-dist z) 0.0)
0.0
(/ 1.0 (-> s1-0 move-dist z))
)
)
(let ((f0-12 1.0))
(.lvf vf1 (&-> (-> s1-0 move-dist) quad))
(.add.w.vf vf2 vf0 vf0 :mask #b1)
(.mul.vf vf1 vf1 vf1)
(.mul.x.vf acc vf2 vf1 :mask #b1)
(.add.mul.y.vf acc vf2 vf1 acc :mask #b1)
(.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1)
(.mov v1-26 vf1)
(set! (-> s1-0 rlength w) (/ f0-12 v1-26))
)
(set! (-> s1-0 exit-planes 0 x) (if (< 0.0 (-> s1-0 move-dist x))
0.0
100000000000000000000000000000000000000.0
)
)
(set! (-> s1-0 exit-planes 0 y) (if (< 0.0 (-> s1-0 move-dist y))
0.0
100000000000000000000000000000000000000.0
)
)
(set! (-> s1-0 exit-planes 0 z) (if (< 0.0 (-> s1-0 move-dist z))
0.0
100000000000000000000000000000000000000.0
)
)
(set! (-> s1-0 exit-planes 1 x) (if (< (-> s1-0 move-dist x) 0.0)
0.0
100000000000000000000000000000000000000.0
)
)
(set! (-> s1-0 exit-planes 1 y) (if (< (-> s1-0 move-dist y) 0.0)
0.0
100000000000000000000000000000000000000.0
)
)
(set! (-> s1-0 exit-planes 1 z) (if (< (-> s1-0 move-dist z) 0.0)
0.0
100000000000000000000000000000000000000.0
)
)
(let ((s0-1 (-> s2-0 bucket-ptr collide-hash-fragment-array)))
(set! sv-640 (-> s0-1 length))
(set! (-> s1-0 instance-ptr) s2-0)
(dotimes (s2-1 sv-640)
(set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0))
(set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0))
(set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0))
(fill-bg-using-line-sphere-new arg0 (-> s0-1 fragments s2-1) s1-0)
(+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) tris))
)
)
)
)
)
)
(else
(if *collide-list-boxes*
(add-collide-debug-box (-> s2-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80))
)
(set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0))
(set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0))
(set! (-> arg2 instance-ptr) #f)
(set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0))
(fill-bg-using-line-sphere-new arg0 s2-0 arg2)
(+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) tris))
)
)
)
)
0
(none)
)
)
(defmethod mem-usage collide-hash ((obj collide-hash) (arg0 memory-usage-block) (arg1 int))
"This one is a bit weird because it touches stuff in the scratchpad...
It's called from the bsp-header's mem-usage function, so it should be fine."
(set! (-> arg0 length) (max 51 (-> arg0 length)))
(set! (-> arg0 data 50 name) (symbol->string 'collision))
(+! (-> arg0 data 50 count) 1)
(let ((v1-10 (+ (* (-> obj num-items) 8) 96 (* (-> obj num-buckets) 4))))
(+! (-> arg0 data 50 used) v1-10)
(+! (-> arg0 data 50 total) (logand -16 (+ v1-10 15)))
)
(dotimes (v1-14 (the-as int (-> obj qwc-id-bits)))
(set! (-> (scratchpad-object collide-hash-scratch) collidable-bits v1-14) (the-as uint128 0))
)
(dotimes (s3-0 (the-as int (-> obj num-items)))
(let* ((a0-12 (-> obj item-array s3-0 id))
(v1-19 (shr a0-12 5))
)
(when (not (logtest? (-> (scratchpad-object collide-hash-scratch) id-bits v1-19) (ash 1 (logand a0-12 31))))
(logior! (-> (scratchpad-object collide-hash-scratch) id-bits v1-19) (ash 1 (logand a0-12 31)))
(if (= (-> obj item-array s3-0 collidable type) collide-hash-fragment)
(mem-usage (-> obj item-array s3-0 collidable) arg0 arg1)
)
)
)
)
obj
)
(defmethod mem-usage collide-hash-fragment ((obj collide-hash-fragment) (arg0 memory-usage-block) (arg1 int))
(cond
((logtest? arg1 1)
(set! (-> arg0 length) (max 58 (-> arg0 length)))
(set! (-> arg0 data 55 name) (symbol->string 'prototype-fragment))
(+! (-> arg0 data 55 count) 1)
(set! (-> arg0 data 56 name) (symbol->string 'prototype-poly))
(+! (-> arg0 data 56 count) (the-as int (-> obj stats num-polys)))
(set! (-> arg0 data 57 name) (symbol->string 'prototype-vertex))
(+! (-> arg0 data 57 count) (the-as int (-> obj stats num-verts)))
(let ((a3-0 (+ (-> obj num-indices) 112 (* (-> obj num-buckets) 4)))
(a2-9 (* (-> obj stats num-polys) 4))
(v1-22 (* (the-as uint 6) (the-as uint (-> obj stats num-verts))))
)
(+! (-> arg0 data 55 used) a3-0)
(+! (-> arg0 data 55 total) (- (logand -16 (+ v1-22 15 a2-9 a3-0)) (the-as int (+ a2-9 v1-22))))
(+! (-> arg0 data 56 used) a2-9)
(+! (-> arg0 data 56 total) a2-9)
(+! (-> arg0 data 57 used) v1-22)
(+! (-> arg0 data 57 total) v1-22)
)
)
(else
(set! (-> arg0 length) (max 54 (-> arg0 length)))
(set! (-> arg0 data 51 name) (symbol->string 'collision-fragment))
(+! (-> arg0 data 51 count) 1)
(set! (-> arg0 data 52 name) (symbol->string 'collision-poly))
(+! (-> arg0 data 52 count) (the-as int (-> obj stats num-polys)))
(set! (-> arg0 data 53 name) (symbol->string 'collision-vertex))
(+! (-> arg0 data 53 count) (the-as int (-> obj stats num-verts)))
(let ((a3-8 (+ (-> obj num-indices) 112 (* (-> obj num-buckets) 4)))
(a2-22 (* (-> obj stats num-polys) 4))
(v1-45 (* (the-as uint 6) (the-as uint (-> obj stats num-verts))))
)
(+! (-> arg0 data 51 used) a3-8)
(+! (-> arg0 data 51 total) (- (logand -16 (+ v1-45 15 a2-22 a3-8)) (the-as int (+ a2-22 v1-45))))
(+! (-> arg0 data 52 used) a2-22)
(+! (-> arg0 data 52 total) a2-22)
(+! (-> arg0 data 53 used) v1-45)
(+! (-> arg0 data 53 total) v1-45)
)
)
)
obj
)
(defmethod mem-usage collide-hash-fragment-array ((obj collide-hash-fragment-array) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 55 (-> arg0 length)))
(set! (-> arg0 data 54 name) (symbol->string 'prototype-collision))
(+! (-> arg0 data 54 count) 1)
(let ((v1-8 (asize-of obj)))
(+! (-> arg0 data 54 used) v1-8)
(+! (-> arg0 data 54 total) (logand -16 (+ v1-8 15)))
)
(dotimes (s3-0 (-> obj length))
(mem-usage (-> obj fragments s3-0) arg0 arg1)
)
obj
)
+4 -4
View File
@@ -704,7 +704,7 @@
(set! (-> gp-0 ignore-process0) self)
(set! (-> gp-0 ignore-process1) #f)
(set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask))
(collide-cache-method-12 *collide-cache* gp-0)
(fill-using-bounding-box *collide-cache* gp-0)
(dotimes (s5-0 3)
(set! (-> gp-0 start-pos quad) (-> self control unknown-sphere-array00 s5-0 prim-core world-sphere quad))
(vector-float*! (-> gp-0 move-dist) (-> self control unknown-vector25) -8192.0)
@@ -717,7 +717,7 @@
(set! (-> v1-48 action-mask) (collide-action solid))
)
(cond
((and (>= (collide-cache-method-16 *collide-cache* gp-0) 0.0)
((and (>= (probe-using-line-sphere *collide-cache* gp-0) 0.0)
(< 0.8 (vector-dot (-> gp-0 best-other-tri normal) (-> self control unknown-vector25)))
)
)
@@ -1390,7 +1390,7 @@
(set! (-> gp-0 ignore-process0) self)
(set! (-> gp-0 ignore-process1) #f)
(set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask))
(collide-cache-method-12 *collide-cache* gp-0)
(fill-using-bounding-box *collide-cache* gp-0)
(dotimes (s5-0 2)
(let ((a1-4 (not (or (logtest? (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))
(and (logtest? (-> self control unknown-surface00 flags) (surface-flag air))
@@ -1481,7 +1481,7 @@
(set! (-> v1-66 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
(set! (-> v1-66 action-mask) (collide-action solid))
)
(let ((f30-0 (collide-cache-method-16 *collide-cache* gp-0)))
(let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0)))
(cond
((and (>= f30-0 0.0) (< 0.5 (-> gp-0 best-other-tri normal y)))
(set! (-> s4-0 quad) (-> gp-0 best-other-tri normal quad))
@@ -0,0 +1,87 @@
(define *collide-hash-test-origin* (new 'global 'vector))
(define *collide-hash-test-size* (new 'global 'vector))
(set-vector! *collide-hash-test-size* (meters 2.0) (meters 2.0) (meters 2.0) 0.0)
(defun test-collide-hash ((iter int))
;; create a collide query
(let ((query (new 'stack 'collide-query)))
;; set the min/max
(vector+! (-> query bbox max) *collide-hash-test-origin* *collide-hash-test-size*)
(vector-! (-> query bbox min) *collide-hash-test-origin* *collide-hash-test-size*)
(add-debug-box #t (bucket-id debug2) (-> query bbox min) (-> query bbox max) (new 'static 'rgba :g #xff :b #xff :a #x80))
(set! (-> query collide-with) (collide-spec backgnd))
(set! (-> query ignore-process0) #f)
(set! (-> query ignore-process1) #f)
(set! (-> query ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1))
;; set integer box
(dotimes (i 4)
(set! (-> query bbox4w min data i) (the int (-> query bbox min data i)))
(set! (-> query bbox4w max data i) (the int (-> query bbox max data i)))
)
;; first is fill-collide-list-from-box
;; sec is collide-list-fill-bg-using-box
(set! (-> *collide-list* num-items) 0)
(dotimes (i (-> *level* length))
(let ((lev (-> *level* level i)))
(when (= (-> lev status) 'active)
(fill-collide-list-from-box (-> lev bsp collide-hash) 0 *collide-list* query)
)
)
)
(format *stdcon* "got ~d things in the list~%" (-> *collide-list* num-items))
(dotimes (i (-> *collide-list* num-items))
(let ((item (-> *collide-list* items i)))
(cond
((= (-> item mesh type) instance-tie)
(add-debug-sphere
#t
(bucket-id debug2)
(-> (the instance-tie (-> item mesh)) bsphere)
(-> (the instance-tie (-> item mesh)) bsphere w)
(new 'static 'rgba :r #xff :g #xff :a #x80))
)
((= (-> item mesh type) collide-hash-fragment)
(add-debug-sphere
#t
(bucket-id debug2)
(-> (the collide-hash-fragment (-> item mesh)) bsphere)
(-> (the collide-hash-fragment (-> item mesh)) bsphere w)
(new 'static 'rgba :r #xff :b #xff :a #x80))
)
)
)
(format *stdcon* "[~d] ~A~%" i (-> *collide-list* items i mesh))
)
)
)
(defun move-box-to-cam ()
(vector-copy! *collide-hash-test-origin* (target-cam-pos))
)
(defun launch-collide-hash-debug-process ()
(set! *stats-profile-bars* #f)
(let ((proc (get-process *nk-dead-pool* process 1024)))
(activate proc *entity-pool* "test" *kernel-dram-stack*)
(run-next-time-in-process proc (lambda ()
(let ((iter 0))
(while #t
(test-collide-hash iter)
(suspend)
(+! iter 1)
)
)
)
)
proc)
)
+8 -4
View File
@@ -598,6 +598,10 @@
)
)
(defmacro .sll (result in sa)
`(set! ,result (sext32 (the-as int (shl (logand ,in #xffffffff) ,sa))))
)
(defmacro .mfc0 (&rest stuff)
`(empty)
)
@@ -1037,8 +1041,8 @@
)
(defmacro sp-rnd-flt (field-name val range mult)
`(new 'static 'sp-field-init-spec
:field (sp-field-id ,field-name)
`(new 'static 'sp-field-init-spec
:field (sp-field-id ,field-name)
:initial-valuef ,val
:random-rangef ,range
:random-multf ,mult
@@ -1047,8 +1051,8 @@
)
(defmacro sp-flt (field-name val)
`(new 'static 'sp-field-init-spec
:field (sp-field-id ,field-name)
`(new 'static 'sp-field-init-spec
:field (sp-field-id ,field-name)
:initial-valuef ,val
:random-rangef 0.0
:random-multf 1.0
+11 -28
View File
@@ -1,7 +1,5 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type collide-puss-sphere
(deftype collide-puss-sphere (structure)
((bsphere sphere :inline :offset-assert 0)
(bbox4w bounding-box4w :inline :offset-assert 16)
@@ -11,7 +9,6 @@
:flag-assert #x900000030
)
;; definition for method 3 of type collide-puss-sphere
(defmethod inspect collide-puss-sphere ((obj collide-puss-sphere))
(when (not obj)
(set! obj obj)
@@ -24,7 +21,6 @@
obj
)
;; definition of type collide-puss-work
(deftype collide-puss-work (structure)
((closest-pt vector :inline :offset-assert 0)
(tri-normal vector :inline :offset-assert 16)
@@ -41,7 +37,6 @@
)
)
;; definition for method 3 of type collide-puss-work
(defmethod inspect collide-puss-work ((obj collide-puss-work))
(when (not obj)
(set! obj obj)
@@ -57,7 +52,6 @@
obj
)
;; definition of type collide-cache-tri
(deftype collide-cache-tri (structure)
((vertex vector 3 :inline :offset-assert 0)
(extra-quad uint8 16 :offset-assert 48)
@@ -72,7 +66,6 @@
:flag-assert #x900000040
)
;; definition for method 3 of type collide-cache-tri
(defmethod inspect collide-cache-tri ((obj collide-cache-tri))
(when (not obj)
(set! obj obj)
@@ -90,7 +83,6 @@
obj
)
;; definition of type collide-cache-prim
(deftype collide-cache-prim (structure)
((prim-core collide-prim-core :inline :offset-assert 0)
(extra-quad uint8 16 :offset-assert 32)
@@ -113,7 +105,6 @@
)
)
;; definition for method 3 of type collide-cache-prim
(defmethod inspect collide-cache-prim ((obj collide-cache-prim))
(when (not obj)
(set! obj obj)
@@ -135,10 +126,11 @@
obj
)
;; definition of type collide-cache
(deftype collide-cache (basic)
((num-tris int32 :offset-assert 4)
(num-tris-u32 uint32 :offset 4)
(num-prims int32 :offset-assert 8)
(num-prims-u32 uint32 :offset 8)
(ignore-mask pat-surface :offset-assert 12)
(ignore-processes process 2 :offset-assert 16)
(collide-box bounding-box :inline :offset-assert 32)
@@ -155,16 +147,16 @@
(collide-cache-method-9 () none 9)
(fill-and-probe-using-line-sphere (_type_ collide-query) float 10)
(fill-and-probe-using-spheres (_type_ collide-query) symbol 11)
(collide-cache-method-12 (_type_ collide-query) none 12)
(fill-using-bounding-box (_type_ collide-query) none 12)
(fill-using-line-sphere (_type_ collide-query) none 13)
(fill-using-spheres (_type_ collide-query) none 14)
(collide-cache-method-15 () none 15)
(collide-cache-method-16 (_type_ collide-query) float 16)
(reset (_type_) none 15)
(probe-using-line-sphere (_type_ collide-query) float 16)
(probe-using-spheres (_type_ collide-query) symbol 17)
(collide-cache-method-18 () none 18)
(collide-cache-method-19 () none 19)
(collide-cache-method-20 () none 20)
(collide-cache-method-21 () none 21)
(fill-from-bg (_type_ (function collide-hash int collide-list collide-query int) (function collide-cache collide-list collide-query none) collide-query) none 18)
(fill-from-fg-boxes (_type_) none 19)
(fill-from-fg-line-sphere (_type_) none 20)
(fill-from-water (_type_ water-control) none 21)
(collide-cache-method-22 () none 22)
(collide-cache-method-23 () none 23)
(collide-cache-method-24 () none 24)
@@ -172,7 +164,6 @@
)
)
;; definition for method 3 of type collide-cache
(defmethod inspect collide-cache ((obj collide-cache))
(when (not obj)
(set! obj obj)
@@ -193,10 +184,9 @@
obj
)
;; definition of type collide-list-item
(deftype collide-list-item (structure)
((mesh collide-frag-mesh :offset-assert 0)
(inst basic :offset-assert 4)
((mesh instance-tie :offset-assert 0)
(inst basic :offset-assert 4)
)
:pack-me
:method-count-assert 9
@@ -204,7 +194,6 @@
:flag-assert #x900000008
)
;; definition for method 3 of type collide-list-item
(defmethod inspect collide-list-item ((obj collide-list-item))
(when (not obj)
(set! obj obj)
@@ -217,7 +206,6 @@
obj
)
;; definition of type collide-list
(deftype collide-list (structure)
((num-items int32 :offset-assert 0)
(items collide-list-item 256 :inline :offset 16)
@@ -227,7 +215,6 @@
:flag-assert #x900000810
)
;; definition for method 3 of type collide-list
(defmethod inspect collide-list ((obj collide-list))
(when (not obj)
(set! obj obj)
@@ -240,14 +227,10 @@
obj
)
;; failed to figure out what this is:
(kmemopen global "collide-cache")
;; definition (perm) for symbol *collide-cache*, type collide-cache
(define-perm *collide-cache* collide-cache (new 'global 'collide-cache))
;; definition (perm) for symbol *collide-list*, type collide-list
(define-perm *collide-list* collide-list (new 'global 'collide-list))
;; failed to figure out what this is:
(kmemclose)
+106
View File
@@ -0,0 +1,106 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for method 9 of type drawable-tree-collide-fragment
(defmethod login drawable-tree-collide-fragment ((obj drawable-tree-collide-fragment))
obj
)
;; definition for method 10 of type drawable-tree-collide-fragment
;; WARN: Return type mismatch int vs none.
(defmethod draw drawable-tree-collide-fragment ((obj drawable-tree-collide-fragment) (arg0 drawable-tree-collide-fragment) (arg1 display-frame))
(when *display-render-collision*
(dotimes (s4-0 (-> obj length))
(draw (-> obj data s4-0) (-> obj data s4-0) arg1)
)
)
0
(none)
)
;; definition for method 15 of type drawable-tree-collide-fragment
(defmethod unpack-vis drawable-tree-collide-fragment ((obj drawable-tree-collide-fragment) (arg0 (pointer int8)) (arg1 (pointer int8)))
arg1
)
;; definition for method 8 of type collide-fragment
;; WARN: Return type mismatch int vs collide-fragment.
(defmethod mem-usage collide-fragment ((obj collide-fragment) (arg0 memory-usage-block) (arg1 int))
(let ((s5-0 (if (logtest? arg1 1)
54
50
)
)
(s4-0 (-> obj mesh))
)
(set! (-> arg0 data s5-0 name) (symbol->string 'collide-fragment))
(+! (-> arg0 data s5-0 count) 1)
(let ((v1-11 (+ (asize-of obj) (asize-of s4-0))))
(+! (-> arg0 data s5-0 used) v1-11)
(+! (-> arg0 data s5-0 total) (logand -16 (+ v1-11 15)))
)
(set! (-> arg0 data (+ s5-0 1) name) "collision-poly")
(+! (-> arg0 data (+ s5-0 1) count) (-> s4-0 poly-count))
(let ((v1-22 (+ (-> s4-0 strip-data-len) (-> s4-0 poly-count))))
(+! (-> arg0 data (+ s5-0 1) used) v1-22)
(+! (-> arg0 data (+ s5-0 1) total) v1-22)
)
(set! (-> arg0 data (+ s5-0 2) name) "collision-vertex")
(+! (-> arg0 data (+ s5-0 2) count) (-> s4-0 vertex-count))
(let ((v1-31 (* (-> s4-0 vertex-data-qwc) 16)))
(+! (-> arg0 data (+ s5-0 2) used) v1-31)
(let ((v0-2 (+ (-> arg0 data (+ s5-0 2) total) v1-31)))
(set! (-> arg0 data (+ s5-0 2) total) v0-2)
(the-as collide-fragment v0-2)
)
)
)
)
;; definition for method 9 of type drawable-inline-array-collide-fragment
(defmethod login drawable-inline-array-collide-fragment ((obj drawable-inline-array-collide-fragment))
obj
)
;; definition for method 10 of type collide-fragment
;; WARN: Return type mismatch int vs none.
(defmethod draw collide-fragment ((obj collide-fragment) (arg0 collide-fragment) (arg1 display-frame))
0
(none)
)
;; definition for method 10 of type drawable-inline-array-collide-fragment
;; WARN: Return type mismatch int vs none.
(defmethod draw drawable-inline-array-collide-fragment ((obj drawable-inline-array-collide-fragment)
(arg0 drawable-inline-array-collide-fragment)
(arg1 display-frame)
)
(dotimes (s4-0 (-> obj length))
(let ((s3-0 (-> obj data s4-0)))
(if (sphere-cull (-> s3-0 bsphere))
(draw s3-0 s3-0 arg1)
)
)
)
0
(none)
)
;; definition for method 8 of type drawable-inline-array-collide-fragment
(defmethod mem-usage drawable-inline-array-collide-fragment ((obj drawable-inline-array-collide-fragment) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 1 (-> arg0 length)))
(set! (-> arg0 data 0 name) (symbol->string 'drawable-group))
(+! (-> arg0 data 0 count) 1)
(let ((v1-7 32))
(+! (-> arg0 data 0 used) v1-7)
(+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15)))
)
(dotimes (s3-0 (-> obj length))
(mem-usage (-> obj data s3-0) arg0 arg1)
)
obj
)
+39 -42
View File
@@ -1,52 +1,51 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type collide-query
(deftype collide-query (structure)
((best-other-tri collide-tri-result :inline :offset-assert 0)
(best-my-tri collide-tri-result :inline :offset 0)
(ignore-processes process-tree 2 :offset-assert 88)
(ignore-process0 process-tree :offset 88)
(ignore-process1 process-tree :offset 92)
(ignore-pat pat-surface :offset-assert 96)
(collide-with collide-spec :offset-assert 100)
(overlay-params uint32 3 :offset 112)
(bbox bounding-box :inline :offset-assert 128)
(bbox4w bounding-box4w :inline :offset-assert 160)
(bsphere sphere :inline :offset-assert 192)
(start-pos vector :inline :offset-assert 208)
(move-dist vector :inline :offset-assert 224)
(rlength vector :inline :offset-assert 240)
(exit-planes plane 2 :offset-assert 256)
(radius float :offset 268)
(inv-mat matrix :inline :offset 288)
(spheres (inline-array sphere) :offset 112)
(num-spheres uint32 :offset 116)
(solid-only symbol :offset 120)
(best-dist float :offset 112)
(best-other-prim basic :offset 116)
(best-my-prim collide-shape-prim :offset 120)
(move-vec vector :inline :offset 224)
(best-u float :offset 112)
(action-mask collide-action :offset-assert 352)
(local-box4w bounding-box4w :inline :offset-assert 368)
(search-box bounding-box4w :inline :offset-assert 400)
(search-vector vector4w :inline :offset-assert 432)
(instance-mat matrix :inline :offset-assert 448)
(instance-ptr basic :offset-assert 512)
(x-addr uint32 :offset-assert 516)
(x-step uint32 :offset-assert 520)
(y-addr uint32 :offset-assert 524)
(y-step uint32 :offset-assert 528)
(z-addr uint32 :offset-assert 532)
(z-step uint32 :offset-assert 536)
((best-other-tri collide-tri-result :inline :offset-assert 0)
(best-my-tri collide-tri-result :inline :offset 0)
(ignore-processes process-tree 2 :offset-assert 88)
(ignore-process0 process-tree :offset 88)
(ignore-process1 process-tree :offset 92)
(ignore-pat pat-surface :offset-assert 96)
(ignore-pat-s32 int32 :offset 96)
(collide-with collide-spec :offset-assert 100)
(collide-with-s32 int32 :offset 100)
(overlay-params uint32 3 :offset 112)
(bbox bounding-box :inline :offset-assert 128)
(bbox4w bounding-box4w :inline :offset-assert 160)
(bsphere sphere :inline :offset-assert 192)
(start-pos vector :inline :offset-assert 208)
(move-dist vector :inline :offset-assert 224)
(rlength vector :inline :offset-assert 240)
(exit-planes plane 2 :inline :offset-assert 256)
(radius float :offset 268)
(inv-mat matrix :inline :offset 288)
(spheres (inline-array sphere) :offset 112)
(num-spheres uint32 :offset 116)
(solid-only symbol :offset 120)
(best-dist float :offset 112)
(best-other-prim basic :offset 116)
(best-my-prim collide-shape-prim :offset 120)
(move-vec vector :inline :offset 224)
(best-u float :offset 112)
(action-mask collide-action :offset-assert 352)
(local-box4w bounding-box4w :inline :offset-assert 368)
(search-box bounding-box4w :inline :offset-assert 400)
(search-vector vector4w :inline :offset-assert 432)
(instance-mat matrix :inline :offset-assert 448)
(instance-ptr basic :offset-assert 512)
(x-addr uint32 :offset-assert 516)
(x-step uint32 :offset-assert 520)
(y-addr uint32 :offset-assert 524)
(y-step uint32 :offset-assert 528)
(z-addr uint32 :offset-assert 532)
(z-step uint32 :offset-assert 536)
)
:method-count-assert 9
:size-assert #x21c
:flag-assert #x90000021c
)
;; definition for method 3 of type collide-query
(defmethod inspect collide-query ((obj collide-query))
(when (not obj)
(set! obj obj)
@@ -94,8 +93,6 @@
obj
)
;; definition for symbol *collide-test-flag*, type symbol
(define *collide-test-flag* #f)
;; failed to figure out what this is:
0
+2 -2
View File
@@ -212,8 +212,8 @@
(:methods
(new (symbol type collide-shape uint int) _type_ 0)
(collide-shape-prim-method-9 () none 9)
(collide-shape-prim-method-10 () none 10)
(collide-shape-prim-method-11 () none 11)
(add-fg-prim-using-box () none 10)
(add-fg-prim-using-line-sphere () none 11)
(collide-shape-prim-method-12 () none 12)
(collide-shape-prim-method-13 () none 13)
(collide-shape-prim-method-14 () none 14)
+1 -12
View File
@@ -1,12 +1,7 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for symbol *los-time-offset*, type time-frame
(define *los-time-offset* (the-as time-frame 0))
;; definition for method 9 of type los-control
;; INFO: Used lq/sq
;; WARN: Return type mismatch time-frame vs none.
(defmethod los-control-method-9 los-control ((obj los-control) (process process-focusable) (trans-vec vector) (radius float))
(when (and (>= (- (-> self clock frame-counter) (-> obj last-check-time)) (-> obj check-interval))
(-> obj src-proc)
@@ -47,7 +42,7 @@
(set! (-> query action-mask) (collide-action solid))
)
(fill-using-line-sphere *collide-cache* cquery)
(let ((f30-0 (collide-cache-method-16 *collide-cache* cquery)))
(let ((f30-0 (probe-using-line-sphere *collide-cache* cquery)))
(quad-copy! (the-as pointer (-> obj last-collide-result)) (the-as pointer (-> cquery best-other-tri)) 6)
(if (>= 0.0 f30-0)
(set! (-> obj have-no-los) (-> self clock frame-counter))
@@ -64,30 +59,24 @@
(none)
)
;; definition for method 10 of type los-control
(defmethod check-los? los-control ((obj los-control) (arg0 time-frame))
(and (>= (- (-> self clock frame-counter) (-> obj have-los)) (+ (-> obj check-interval) arg0))
(< (- (-> self clock frame-counter) (-> obj have-no-los)) (-> obj check-interval))
)
)
;; definition for method 11 of type los-control
(defmethod skip-check-los? los-control ((obj los-control) (arg0 int))
(and (>= (- (-> self clock frame-counter) (-> obj have-no-los)) (+ (-> obj check-interval) arg0))
(< (- (-> self clock frame-counter) (-> obj have-los)) (-> obj check-interval))
)
)
;; definition for method 12 of type los-control
;; WARN: Return type mismatch int vs none.
(defmethod set-dst-proc! los-control ((obj los-control) (dst handle))
(set! (-> obj dst-proc) dst)
0
(none)
)
;; definition for method 13 of type los-control
;; WARN: Return type mismatch int vs none.
(defmethod new-source! los-control ((obj los-control) (proc process) (check-interval time-frame) (c-spec collide-spec))
(set! (-> obj src-proc) (process->handle proc))
(set! (-> obj dst-proc) (the-as handle #f))
+2 -8
View File
@@ -1,7 +1,5 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type drawable
(deftype drawable (basic)
((id int16 :offset-assert 4)
(bsphere vector :inline :offset-assert 16)
@@ -12,8 +10,8 @@
(:methods
(login (_type_) _type_ 9)
(draw (_type_ _type_ display-frame) none 10)
(drawable-method-11 () none 11)
(drawable-method-12 () none 12)
(fill-collide-list-from-box (_type_ int collide-list collide-query) int 11)
(fill-collide-list-from-line-sphere (_type_ int collide-list collide-query) int 12)
(collect-stats (_type_) none 13)
(debug-draw (_type_ drawable display-frame) none 14)
(unpack-vis (_type_ (pointer int8) (pointer int8)) (pointer int8) 15)
@@ -21,7 +19,6 @@
)
)
;; definition for method 3 of type drawable
(defmethod inspect drawable ((obj drawable))
(when (not obj)
(set! obj obj)
@@ -34,7 +31,6 @@
obj
)
;; definition of type drawable-error
(deftype drawable-error (drawable)
((name string :offset-assert 32)
)
@@ -43,7 +39,6 @@
:flag-assert #x1100000024
)
;; definition for method 3 of type drawable-error
(defmethod inspect drawable-error ((obj drawable-error))
(when (not obj)
(set! obj obj)
@@ -57,5 +52,4 @@
obj
)
;; failed to figure out what this is:
0
+84 -103
View File
@@ -1,7 +1,5 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type prototype-bucket
(deftype prototype-bucket (basic)
((name string :offset-assert 4)
(flags prototype-flags :offset-assert 8)
@@ -25,7 +23,6 @@
:flag-assert #x900000040
)
;; definition for method 3 of type prototype-bucket
(defmethod inspect prototype-bucket ((obj prototype-bucket))
(when (not obj)
(set! obj obj)
@@ -52,7 +49,6 @@
obj
)
;; definition of type prototype-bucket-shrub
(deftype prototype-bucket-shrub (prototype-bucket)
((next uint32 4 :offset-assert 64)
(count uint16 4 :offset-assert 80)
@@ -68,8 +64,6 @@
:flag-assert #x900000070
)
;; definition for method 3 of type prototype-bucket-shrub
;; INFO: Used lq/sq
(defmethod inspect prototype-bucket-shrub ((obj prototype-bucket-shrub))
(when (not obj)
(set! obj obj)
@@ -103,7 +97,6 @@
obj
)
;; definition of type prototype-inline-array-shrub
(deftype prototype-inline-array-shrub (drawable)
((length int16 :offset 6)
(data prototype-bucket-shrub 1 :inline :offset 32)
@@ -114,7 +107,6 @@
:flag-assert #x1100000094
)
;; definition for method 3 of type prototype-inline-array-shrub
(defmethod inspect prototype-inline-array-shrub ((obj prototype-inline-array-shrub))
(when (not obj)
(set! obj obj)
@@ -129,7 +121,6 @@
obj
)
;; definition of type prototype-array-shrub-info
(deftype prototype-array-shrub-info (basic)
((prototype-inline-array-shrub prototype-inline-array-shrub :offset-assert 4)
(wind-vectors uint32 :offset-assert 8)
@@ -140,7 +131,6 @@
:flag-assert #x900000010
)
;; definition for method 3 of type prototype-array-shrub-info
(defmethod inspect prototype-array-shrub-info ((obj prototype-array-shrub-info))
(when (not obj)
(set! obj obj)
@@ -154,95 +144,93 @@
obj
)
;; definition of type prototype-bucket-tie
(deftype prototype-bucket-tie (prototype-bucket)
((next uint32 12 :offset-assert 64)
(count uint16 12 :offset-assert 112)
(frag-count uint8 4 :offset-assert 136)
(index-start uint8 4 :offset-assert 140)
(base-qw uint16 4 :offset-assert 144)
(tie-rvanish float :offset-assert 152)
(tie-vanish-far float :offset-assert 156)
(envmap-rfade float :offset-assert 160)
(envmap-fade-far float :offset-assert 164)
(envmap-shader adgif-shader :offset-assert 168)
(tint-color uint32 :offset-assert 172)
(collide-hash-fragment-array basic :offset-assert 176)
(tie-colors time-of-day-palette :offset-assert 180)
(data uint32 :dynamic :offset-assert 184)
(color-index-qwc uint32 :dynamic :offset-assert 184)
(scissor-frag-count uint8 :offset 136)
(near-frag-count uint8 :offset 137)
(mid-frag-count uint8 :offset 138)
(far-frag-count uint8 :offset 139)
(scissor-index-start uint8 :offset 140)
(near-index-start uint8 :offset 141)
(mid-index-start uint8 :offset 142)
(far-index-start uint8 :offset 143)
(scissor-base-qw uint16 :offset 144)
(near-base-qw uint16 :offset 146)
(mid-base-qw uint16 :offset 148)
(far-base-qw uint16 :offset 150)
(tie-next uint32 4 :offset 64)
(tie-scissor-next uint32 :offset 64)
(tie-near-next uint32 :offset 68)
(tie-mid-next uint32 :offset 72)
(tie-far-next uint32 :offset 76)
(trans-next uint32 4 :offset 64)
(trans-scissor-next uint32 4 :offset 64)
(trans-near-next uint32 :offset 68)
(trans-mid-next uint32 :offset 72)
(trans-far-next uint32 :offset 76)
(water-next uint32 4 :offset 64)
(water-scissor-next uint32 4 :offset 64)
(water-near-next uint32 :offset 68)
(water-mid-next uint32 :offset 72)
(water-far-next uint32 :offset 76)
(envmap-next uint32 4 :offset 80)
(envmap-scissor-next uint32 4 :offset 80)
(envmap-near-next uint32 :offset 84)
(envmap-mid-next uint32 :offset 88)
(envmap-far-next uint32 :offset 92)
(generic-next uint32 3 :offset 96)
(generic-near-next uint32 :offset 96)
(generic-mid-next uint32 :offset 100)
(generic-far-next uint32 :offset 104)
(vanish-next uint32 :offset 108)
(tie-count uint16 4 :offset 112)
(tie-scissor-count uint16 :offset 112)
(tie-near-count uint16 :offset 114)
(tie-mid-count uint16 :offset 116)
(tie-far-count uint16 :offset 118)
(trans-count uint16 4 :offset 112)
(trans-scissor-count uint16 :offset 112)
(trans-near-count uint16 :offset 114)
(trans-mid-count uint16 :offset 116)
(trans-far-count uint16 :offset 118)
(water-count uint16 4 :offset 112)
(water-scissor-count uint16 :offset 112)
(water-near-count uint16 :offset 114)
(water-mid-count uint16 :offset 116)
(water-far-count uint16 :offset 118)
(envmap-count uint16 4 :offset 120)
(envmap-scissor-count uint16 :offset 120)
(envmap-near-count uint16 :offset 122)
(envmap-mid-count uint16 :offset 124)
(envmap-far-count uint16 :offset 126)
(generic-count uint16 3 :offset 128)
(generic-near-count uint16 :offset 128)
(generic-mid-count uint16 :offset 130)
(generic-far-count uint16 :offset 132)
(vanish-count uint16 :offset 134)
(next-clear uint128 3 :offset 64)
(count-clear uint64 3 :offset 112)
(tie-geom prototype-tie 4 :offset 16)
((next uint32 12 :offset-assert 64)
(count uint16 12 :offset-assert 112)
(frag-count uint8 4 :offset-assert 136)
(index-start uint8 4 :offset-assert 140)
(base-qw uint16 4 :offset-assert 144)
(tie-rvanish float :offset-assert 152)
(tie-vanish-far float :offset-assert 156)
(envmap-rfade float :offset-assert 160)
(envmap-fade-far float :offset-assert 164)
(envmap-shader adgif-shader :offset-assert 168)
(tint-color uint32 :offset-assert 172)
(collide-hash-fragment-array collide-hash-fragment-array :offset-assert 176)
(tie-colors time-of-day-palette :offset-assert 180)
(data uint32 :dynamic :offset-assert 184)
(color-index-qwc uint32 :dynamic :offset-assert 184)
(scissor-frag-count uint8 :offset 136)
(near-frag-count uint8 :offset 137)
(mid-frag-count uint8 :offset 138)
(far-frag-count uint8 :offset 139)
(scissor-index-start uint8 :offset 140)
(near-index-start uint8 :offset 141)
(mid-index-start uint8 :offset 142)
(far-index-start uint8 :offset 143)
(scissor-base-qw uint16 :offset 144)
(near-base-qw uint16 :offset 146)
(mid-base-qw uint16 :offset 148)
(far-base-qw uint16 :offset 150)
(tie-next uint32 4 :offset 64)
(tie-scissor-next uint32 :offset 64)
(tie-near-next uint32 :offset 68)
(tie-mid-next uint32 :offset 72)
(tie-far-next uint32 :offset 76)
(trans-next uint32 4 :offset 64)
(trans-scissor-next uint32 4 :offset 64)
(trans-near-next uint32 :offset 68)
(trans-mid-next uint32 :offset 72)
(trans-far-next uint32 :offset 76)
(water-next uint32 4 :offset 64)
(water-scissor-next uint32 4 :offset 64)
(water-near-next uint32 :offset 68)
(water-mid-next uint32 :offset 72)
(water-far-next uint32 :offset 76)
(envmap-next uint32 4 :offset 80)
(envmap-scissor-next uint32 4 :offset 80)
(envmap-near-next uint32 :offset 84)
(envmap-mid-next uint32 :offset 88)
(envmap-far-next uint32 :offset 92)
(generic-next uint32 3 :offset 96)
(generic-near-next uint32 :offset 96)
(generic-mid-next uint32 :offset 100)
(generic-far-next uint32 :offset 104)
(vanish-next uint32 :offset 108)
(tie-count uint16 4 :offset 112)
(tie-scissor-count uint16 :offset 112)
(tie-near-count uint16 :offset 114)
(tie-mid-count uint16 :offset 116)
(tie-far-count uint16 :offset 118)
(trans-count uint16 4 :offset 112)
(trans-scissor-count uint16 :offset 112)
(trans-near-count uint16 :offset 114)
(trans-mid-count uint16 :offset 116)
(trans-far-count uint16 :offset 118)
(water-count uint16 4 :offset 112)
(water-scissor-count uint16 :offset 112)
(water-near-count uint16 :offset 114)
(water-mid-count uint16 :offset 116)
(water-far-count uint16 :offset 118)
(envmap-count uint16 4 :offset 120)
(envmap-scissor-count uint16 :offset 120)
(envmap-near-count uint16 :offset 122)
(envmap-mid-count uint16 :offset 124)
(envmap-far-count uint16 :offset 126)
(generic-count uint16 3 :offset 128)
(generic-near-count uint16 :offset 128)
(generic-mid-count uint16 :offset 130)
(generic-far-count uint16 :offset 132)
(vanish-count uint16 :offset 134)
(next-clear uint128 3 :offset 64)
(count-clear uint64 3 :offset 112)
(tie-geom prototype-tie 4 :offset 16)
)
:method-count-assert 9
:size-assert #xb8
:flag-assert #x9000000b8
)
;; definition for method 3 of type prototype-bucket-tie
(defmethod inspect prototype-bucket-tie ((obj prototype-bucket-tie))
(when (not obj)
(set! obj obj)
@@ -348,7 +336,6 @@
obj
)
;; definition of type prototype-array-tie
(deftype prototype-array-tie (array)
((array-data prototype-bucket-tie :dynamic :offset 16)
)
@@ -360,7 +347,6 @@
)
)
;; definition for method 3 of type prototype-array-tie
(defmethod inspect prototype-array-tie ((obj prototype-array-tie))
(when (not obj)
(set! obj obj)
@@ -375,7 +361,6 @@
obj
)
;; definition of type proxy-prototype-array-tie
(deftype proxy-prototype-array-tie (basic)
((prototype-array-tie prototype-array-tie :offset-assert 4)
(wind-vectors uint32 :offset-assert 8)
@@ -387,7 +372,6 @@
:flag-assert #x900000010
)
;; definition for method 3 of type proxy-prototype-array-tie
(defmethod inspect proxy-prototype-array-tie ((obj proxy-prototype-array-tie))
(when (not obj)
(set! obj obj)
@@ -402,19 +386,17 @@
obj
)
;; definition of type instance
(deftype instance (drawable)
((bucket-index uint16 :offset 6)
(origin matrix4h :inline :offset-assert 32)
(flags uint16 :offset 46)
(wind-index uint16 :offset 62)
((bucket-index uint16 :offset 6)
(origin matrix4h :inline :offset-assert 32)
(flags instance-flags :offset 46)
(wind-index uint16 :offset 62)
)
:method-count-assert 17
:size-assert #x40
:flag-assert #x1100000040
)
;; definition for method 3 of type instance
(defmethod inspect instance ((obj instance))
(when (not obj)
(set! obj obj)
@@ -431,5 +413,4 @@
obj
)
;; failed to figure out what this is:
0
+1 -1
View File
@@ -575,7 +575,7 @@
)
(fill-using-line-sphere *collide-cache* s4-0)
(cond
((>= (collide-cache-method-16 *collide-cache* s4-0) 0.0)
((>= (probe-using-line-sphere *collide-cache* s4-0) 0.0)
(set! (-> arg1 user-float) (-> s4-0 best-other-tri intersect y))
(let ((f0-8 (+ 65536.0 (-> *math-camera* trans y))))
(if (< (-> arg1 user-float) f0-8)
+1 -1
View File
@@ -935,7 +935,7 @@
(ocean-method-15 () none 15)
(ocean-method-16 () none 16)
(ocean-method-17 () none 17)
(ocean-method-18 () none 18)
(ocean-method-18 (_type_ object object) none 18)
(ocean-method-19 () none 19)
(ocean-method-20 () none 20)
(ocean-method-21 (_type_ float float) float 21)
+17 -42
View File
@@ -1,22 +1,15 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for symbol *collide-list-boxes*, type object
(define *collide-list-boxes* (the-as object #f))
;; definition for symbol *collide-hash-fragments*, type object
(define *collide-hash-fragments* (the-as object 0))
;; definition for symbol *collide-hash-fragments-tfrag*, type object
(define *collide-hash-fragments-tfrag* (the-as object 0))
;; definition for symbol *collide-hash-fragments-instance*, type object
(define *collide-hash-fragments-instance* (the-as object 0))
;; definition for symbol *already-printed-exeeded-max-cache-tris*, type symbol
(define *already-printed-exeeded-max-cache-tris* #f)
;; definition of type collide-hash-scratch
(deftype collide-hash-scratch (structure)
((collidable-bits uint128 128 :offset-assert 0)
(poly-bits uint64 2 :offset 0)
@@ -28,7 +21,6 @@
:flag-assert #x900000804
)
;; definition for method 3 of type collide-hash-scratch
(defmethod inspect collide-hash-scratch ((obj collide-hash-scratch))
(when (not obj)
(set! obj obj)
@@ -43,7 +35,6 @@
obj
)
;; definition of type collide-hash-bucket
(deftype collide-hash-bucket (structure)
((index int16 :offset-assert 0)
(count int16 :offset-assert 2)
@@ -53,7 +44,6 @@
:flag-assert #x900000004
)
;; definition for method 3 of type collide-hash-bucket
(defmethod inspect collide-hash-bucket ((obj collide-hash-bucket))
(when (not obj)
(set! obj obj)
@@ -66,17 +56,16 @@
obj
)
;; definition of type collide-hash-item
(deftype collide-hash-item (structure)
((id uint32 :offset-assert 0)
(collidable basic :offset-assert 4)
)
:pack-me
:method-count-assert 9
:size-assert #x8
:flag-assert #x900000008
)
;; definition for method 3 of type collide-hash-item
(defmethod inspect collide-hash-item ((obj collide-hash-item))
(when (not obj)
(set! obj obj)
@@ -89,7 +78,6 @@
obj
)
;; definition of type collide-hash-poly
(deftype collide-hash-poly (structure)
((data uint8 4 :offset-assert 0)
(vert-index0 uint8 :offset 0)
@@ -103,7 +91,6 @@
:flag-assert #x900000004
)
;; definition for method 3 of type collide-hash-poly
(defmethod inspect collide-hash-poly ((obj collide-hash-poly))
(when (not obj)
(set! obj obj)
@@ -120,7 +107,6 @@
obj
)
;; definition of type collide-hash-fragment-stats
(deftype collide-hash-fragment-stats (structure)
((num-verts uint16 :offset-assert 0)
(num-polys uint8 :offset-assert 2)
@@ -132,7 +118,6 @@
:flag-assert #x900000004
)
;; definition for method 3 of type collide-hash-fragment-stats
(defmethod inspect collide-hash-fragment-stats ((obj collide-hash-fragment-stats))
(when (not obj)
(set! obj obj)
@@ -146,7 +131,6 @@
obj
)
;; definition of type collide-hash-fragment
(deftype collide-hash-fragment (drawable)
((num-buckets uint16 :offset 4)
(num-indices uint16 :offset 6)
@@ -171,7 +155,6 @@
:flag-assert #x1100000070
)
;; definition for method 3 of type collide-hash-fragment
(defmethod inspect collide-hash-fragment ((obj collide-hash-fragment))
(when (not obj)
(set! obj obj)
@@ -201,15 +184,14 @@
obj
)
;; definition of type collide-hash-fragment-array
(deftype collide-hash-fragment-array (array)
()
((fragments collide-hash-fragment :dynamic :offset 16)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
;; definition for method 3 of type collide-hash-fragment-array
(defmethod inspect collide-hash-fragment-array ((obj collide-hash-fragment-array))
(when (not obj)
(set! obj obj)
@@ -224,28 +206,26 @@
obj
)
;; definition of type collide-hash
(deftype collide-hash (drawable)
((num-ids uint16 :offset 4)
(id-count uint16 :offset 6)
(num-buckets uint32 :offset 8)
(qwc-id-bits uint32 :offset 12)
(grid-step vector :inline :offset 16)
(bbox bounding-box :inline :offset-assert 32)
(bbox4w bounding-box4w :inline :offset-assert 64)
(axis-scale vector :inline :offset 48)
(avg-extents vector :inline :offset 64)
(bucket-array uint32 :offset 44)
(item-array uint32 :offset 60)
(dimension-array uint32 3 :offset 76)
(num-items uint32 :offset 92)
((num-ids uint16 :offset 4)
(id-count uint16 :offset 6)
(num-buckets uint32 :offset 8)
(qwc-id-bits uint32 :offset 12)
(grid-step vector :inline :offset 16)
(bbox bounding-box :inline :offset-assert 32)
(bbox4w bounding-box4w :inline :offset-assert 64)
(axis-scale vector :inline :offset 48)
(avg-extents vector :inline :offset 64)
(bucket-array uint32 :offset 44)
(item-array (inline-array collide-hash-item) :offset 60)
(dimension-array uint32 3 :offset 76)
(num-items uint32 :offset 92)
)
:method-count-assert 17
:size-assert #x60
:flag-assert #x1100000060
)
;; definition for method 3 of type collide-hash
(defmethod inspect collide-hash ((obj collide-hash))
(when (not obj)
(set! obj obj)
@@ -264,16 +244,11 @@
(format #t "~1Taxis-scale: #<vector @ #x~X>~%" (-> obj bbox max))
(format #t "~1Tavg-extents: #<vector @ #x~X>~%" (-> obj bbox4w))
(format #t "~1Tbucket-array: #x~X~%" (-> obj bbox min w))
(format #t "~1Titem-array: #x~X~%" (-> obj bbox max w))
(format #t "~1Titem-array: #x~X~%" (-> obj item-array))
(format #t "~1Tdimension-array[3] @ #x~X~%" (&-> obj bbox4w min w))
(format #t "~1Tnum-items: ~D~%" (-> obj num-items))
(label cfg-4)
obj
)
;; failed to figure out what this is:
0
+703
View File
@@ -0,0 +1,703 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for function add-collide-debug-box
;; WARN: Return type mismatch symbol vs none.
(defun add-collide-debug-box ((arg0 vector) (arg1 rgba))
(rlet ((vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
)
(let ((a3-0 (new 'stack-no-clear 'bounding-box)))
(nop!)
(.lvf vf1 (&-> arg0 quad))
(.sub.w.vf vf2 vf1 vf1)
(nop!)
(.add.w.vf vf3 vf1 vf1)
(nop!)
(nop!)
(.svf (&-> a3-0 min quad) vf2)
(nop!)
(.svf (&-> a3-0 max quad) vf3)
(add-debug-box #t (bucket-id debug2) (-> a3-0 min) (-> a3-0 max) arg1)
)
(none)
)
)
;; definition (debug) for function print-collide-cache-tri-count
;; WARN: Return type mismatch object vs none.
(defun-debug print-collide-cache-tri-count ()
(let ((gp-0 0)
(s4-0 0)
(s5-0 0)
(s3-0 0)
)
(let ((v1-0 *collide-cache*))
(dotimes (a0-0 (-> v1-0 num-tris))
(case (-> v1-0 tris a0-0 pat mode)
(((pat-mode ground))
(+! gp-0 1)
)
(((pat-mode wall))
(+! s5-0 1)
)
(((pat-mode obstacle))
(+! s4-0 1)
)
(else
(+! s3-0 1)
)
)
)
(format *stdcon* "tris ~d (~4,,1f%) " (-> v1-0 num-tris) (* 0.2173913 (the float (-> v1-0 num-tris))))
)
(format *stdcon* "(ground ~d, wall ~d, obstacle ~d, other ~d)~%" gp-0 s5-0 s4-0 s3-0)
)
(none)
)
;; definition (debug) for function print-exceeded-max-cache-tris
;; WARN: Return type mismatch int vs none.
(defun-debug print-exceeded-max-cache-tris ()
(with-pp
(when (not *already-printed-exeeded-max-cache-tris*)
(set! *already-printed-exeeded-max-cache-tris* #t)
(if pp
(format *stdcon* "Exceeded collide cache max # of tris (~s)!~%" (-> pp name))
(format *stdcon* "Exceeded collide cache max # of tris!~%")
)
(print-collide-cache-tri-count)
)
0
(none)
)
)
;; definition for method 11 of type collide-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 12 of type collide-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function fill-bg-using-box-new
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function fill-bg-using-line-sphere-new
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function collide-list-fill-bg-using-box
;; INFO: Used lq/sq
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 640 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 640 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 640 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 640 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Return type mismatch int vs none.
(defun collide-list-fill-bg-using-box ((arg0 collide-cache) (arg1 collide-list) (arg2 collide-query))
(local-vars
(v1-12 uint128)
(v1-14 uint128)
(v1-15 uint128)
(a0-10 uint128)
(a0-11 uint128)
(a1-3 uint128)
(a2-3 uint128)
(a2-4 uint128)
(sv-16 int)
(sv-20 collide-list)
(sv-640 int)
)
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :class vf)
(vf13 :class vf)
(vf14 :class vf)
(vf16 :class vf)
(vf17 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(set! sv-16 (-> arg1 num-items))
(set! sv-20 arg1)
(dotimes (s4-0 sv-16)
(let ((s3-0 (-> sv-20 items s4-0 mesh)))
(cond
((= (-> s3-0 type) instance-tie)
(let* ((v1-4 s3-0)
(s1-0 (-> v1-4 bucket-ptr))
)
(when (not (or (logtest? (-> s1-0 flags) (prototype-flags no-collide))
(logtest? (-> v1-4 flags) (instance-flags no-collide))
)
)
(if *collide-list-boxes*
(add-collide-debug-box (-> s3-0 bsphere) (new 'static 'rgba :r #xff :a #x80))
)
(let ((s0-0 (new 'stack-no-clear 'matrix))
(s2-0 (new 'stack-no-clear 'collide-query))
)
(mem-copy! (the-as pointer s2-0) (the-as pointer arg2) 540)
(nop!)
(nop!)
(let ((v1-11 (the-as uint128 (-> s3-0 origin vector4h 3 long))))
(nop!)
(let ((a2-2 (the-as uint128 (-> s3-0 origin vector4h 0 long))))
(.pextlh v1-12 v1-11 0)
(let ((a0-9 (the-as uint128 (-> s3-0 origin vector4h 1 long))))
(.pw.sra a1-3 v1-12 10)
(let ((v1-13 (the-as uint128 (-> s3-0 origin vector4h 2 long))))
(.pextlh a2-3 a2-2 0)
(nop!)
(.pw.sra a2-4 a2-3 16)
(nop!)
(.pextlh a0-10 a0-9 0)
(.mov vf4 a1-3)
(.pw.sra a0-11 a0-10 16)
(.mov vf1 a2-4)
(.pextlh v1-14 v1-13 0)
)
)
)
)
(.mov vf2 a0-11)
(.pw.sra v1-15 v1-14 16)
(.lvf vf5 (&-> s3-0 bsphere quad))
(nop!)
(.mov vf3 v1-15)
(.itof.vf vf4 vf4)
(nop!)
(vitof12.xyzw vf1 vf1)
(nop!)
(vitof12.xyzw vf2 vf2)
(nop!)
(vitof12.xyzw vf3 vf3)
(nop!)
(.add.vf vf4 vf4 vf5 :mask #b111)
(nop!)
(nop!)
(.svf (&-> s2-0 instance-mat vector 0 quad) vf1)
(nop!)
(.svf (&-> s2-0 instance-mat vector 1 quad) vf2)
(nop!)
(.svf (&-> s2-0 instance-mat vector 2 quad) vf3)
(nop!)
(.svf (&-> s2-0 instance-mat trans quad) vf4)
(matrix-4x4-inverse! s0-0 (-> s2-0 instance-mat))
(nop!)
(nop!)
(.lvf vf7 (&-> arg2 bbox min quad))
(nop!)
(.lvf vf14 (&-> arg2 bbox max quad))
(nop!)
(.lvf vf1 (&-> s0-0 vector 0 quad))
(nop!)
(.lvf vf2 (&-> s0-0 vector 1 quad))
(nop!)
(.lvf vf3 (&-> s0-0 vector 2 quad))
(nop!)
(.lvf vf4 (&-> s0-0 trans quad))
(.mul.w.vf acc vf4 vf0)
(nop!)
(.add.mul.x.vf acc vf1 vf7 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf7 acc)
(nop!)
(.add.mul.z.vf vf8 vf3 vf14 acc)
(nop!)
(.mul.w.vf acc vf4 vf0)
(nop!)
(.add.mul.x.vf acc vf1 vf7 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf14 acc)
(nop!)
(.add.mul.z.vf vf9 vf3 vf7 acc)
(nop!)
(.mul.w.vf acc vf4 vf0)
(nop!)
(.add.mul.x.vf acc vf1 vf7 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf14 acc)
(nop!)
(.add.mul.z.vf vf10 vf3 vf14 acc)
(nop!)
(.min.vf vf5 vf8 vf9)
(nop!)
(.max.vf vf6 vf8 vf9)
(nop!)
(.mul.w.vf acc vf4 vf0)
(nop!)
(.add.mul.x.vf acc vf1 vf14 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf7 acc)
(nop!)
(.add.mul.z.vf vf11 vf3 vf7 acc)
(nop!)
(.min.vf vf5 vf5 vf10)
(nop!)
(.max.vf vf6 vf6 vf10)
(nop!)
(.mul.w.vf acc vf4 vf0)
(nop!)
(.add.mul.x.vf acc vf1 vf14 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf7 acc)
(nop!)
(.add.mul.z.vf vf12 vf3 vf14 acc)
(nop!)
(.min.vf vf5 vf5 vf11)
(nop!)
(.max.vf vf6 vf6 vf11)
(nop!)
(.mul.w.vf acc vf4 vf0)
(nop!)
(.add.mul.x.vf acc vf1 vf14 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf14 acc)
(nop!)
(.add.mul.z.vf vf13 vf3 vf7 acc)
(nop!)
(.min.vf vf5 vf5 vf12)
(nop!)
(.max.vf vf6 vf6 vf12)
(nop!)
(.mul.w.vf acc vf4 vf0)
(nop!)
(.add.mul.x.vf acc vf1 vf14 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf14 acc)
(nop!)
(.add.mul.z.vf vf14 vf3 vf14 acc)
(nop!)
(.min.vf vf5 vf5 vf13)
(nop!)
(.max.vf vf6 vf6 vf13)
(nop!)
(.mul.w.vf acc vf4 vf0)
(nop!)
(.add.mul.x.vf acc vf1 vf7 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf7 acc)
(nop!)
(.add.mul.z.vf vf7 vf3 vf7 acc)
(nop!)
(.min.vf vf5 vf5 vf14)
(nop!)
(.max.vf vf6 vf6 vf14)
(nop!)
(.min.vf vf5 vf5 vf7)
(nop!)
(.max.vf vf6 vf6 vf7)
(nop!)
(.ftoi.vf vf16 vf5)
(nop!)
(.ftoi.vf vf17 vf6)
(nop!)
(nop!)
(.svf (&-> s2-0 bbox min quad) vf5)
(nop!)
(.svf (&-> s2-0 bbox max quad) vf6)
(nop!)
(.svf (&-> s2-0 bbox4w min quad) vf16)
(nop!)
(.svf (&-> s2-0 bbox4w max quad) vf17)
(let ((s1-1 (-> s1-0 collide-hash-fragment-array)))
(set! sv-640 (-> s1-1 length))
(set! (-> s2-0 instance-ptr) s3-0)
(dotimes (s3-1 sv-640)
(set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0))
(set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0))
(set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0))
(fill-bg-using-box-new arg0 (-> s1-1 fragments s3-1) s2-0)
(+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris))
)
)
)
)
)
)
(else
(if *collide-list-boxes*
(add-collide-debug-box (-> s3-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80))
)
(set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0))
(set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0))
(set! (-> arg2 instance-ptr) #f)
(set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0))
(fill-bg-using-box-new arg0 s3-0 arg2)
(+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris))
)
)
)
)
0
(none)
)
)
;; definition for function collide-list-fill-bg-using-line-sphere
;; INFO: Used lq/sq
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 640 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 640 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 640 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 640 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Return type mismatch int vs none.
;; ERROR: Unsupported inline assembly instruction kind - [sll v1, v1, 16]
(defun collide-list-fill-bg-using-line-sphere ((arg0 collide-cache) (arg1 collide-list) (arg2 collide-query))
(local-vars
(v1-12 uint128)
(v1-14 uint128)
(v1-15 uint128)
(v1-17 number)
(v1-26 float)
(a0-10 uint128)
(a0-11 uint128)
(a1-3 uint128)
(a2-3 uint128)
(a2-4 uint128)
(sv-16 int)
(sv-640 int)
)
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(set! sv-16 (-> arg1 num-items))
(dotimes (s3-0 sv-16)
(let ((s2-0 (-> arg1 items s3-0 mesh)))
(cond
((= (-> s2-0 type) instance-tie)
(let ((v1-4 s2-0))
(when (not (or (logtest? (-> v1-4 bucket-ptr flags) (prototype-flags no-collide))
(logtest? (-> v1-4 flags) (instance-flags no-collide))
)
)
(if *collide-list-boxes*
(add-collide-debug-box (-> s2-0 bsphere) (new 'static 'rgba :r #xff :a #x80))
)
(let ((s0-0 (new 'stack-no-clear 'matrix))
(s1-0 (new 'stack-no-clear 'collide-query))
)
(mem-copy! (the-as pointer s1-0) (the-as pointer arg2) 540)
(nop!)
(let ((v1-11 (the-as uint128 (-> s2-0 origin vector4h 3 long))))
(nop!)
(let ((a2-2 (the-as uint128 (-> s2-0 origin vector4h 0 long))))
(.pextlh v1-12 v1-11 0)
(let ((a0-9 (the-as uint128 (-> s2-0 origin vector4h 1 long))))
(.pw.sra a1-3 v1-12 10)
(let ((v1-13 (the-as uint128 (-> s2-0 origin vector4h 2 long))))
(.pextlh a2-3 a2-2 0)
(nop!)
(.pw.sra a2-4 a2-3 16)
(nop!)
(.pextlh a0-10 a0-9 0)
(.mov vf4 a1-3)
(.pw.sra a0-11 a0-10 16)
(.mov vf1 a2-4)
(.pextlh v1-14 v1-13 0)
)
)
)
)
(.mov vf2 a0-11)
(.pw.sra v1-15 v1-14 16)
(.lvf vf5 (&-> s2-0 bsphere quad))
(nop!)
(.mov vf3 v1-15)
(.itof.vf vf4 vf4)
(nop!)
(vitof12.xyzw vf1 vf1)
(nop!)
(vitof12.xyzw vf2 vf2)
(nop!)
(vitof12.xyzw vf3 vf3)
(nop!)
(.add.vf vf4 vf4 vf5 :mask #b111)
(nop!)
(nop!)
(.svf (&-> s1-0 instance-mat vector 0 quad) vf1)
(nop!)
(.svf (&-> s1-0 instance-mat vector 1 quad) vf2)
(nop!)
(.svf (&-> s1-0 instance-mat vector 2 quad) vf3)
(nop!)
(.svf (&-> s1-0 instance-mat trans quad) vf4)
(matrix-4x4-inverse! s0-0 (-> s1-0 instance-mat))
(nop!)
(nop!)
(.lvf vf7 (&-> arg2 start-pos quad))
(nop!)
(.lvf vf8 (&-> arg2 move-dist quad))
(nop!)
(.lvf vf1 (&-> s0-0 vector 0 quad))
(nop!)
(.lvf vf2 (&-> s0-0 vector 1 quad))
(nop!)
(.lvf vf3 (&-> s0-0 vector 2 quad))
(nop!)
(.lvf vf4 (&-> s0-0 trans quad))
(.add.vf vf8 vf7 vf8)
(let ((v1-16 (-> s2-0 rmin-scale)))
(.mul.x.vf acc vf1 vf7)
(let ((f2-0 (-> arg2 radius)))
(.add.mul.y.vf acc vf2 vf7 acc)
(.sll v1-17 v1-16 16)
(.add.mul.z.vf acc vf3 vf7 acc)
(let ((f1-0 (the-as float v1-17)))
(.add.mul.w.vf vf7 vf4 vf0 acc)
(nop!)
(.mul.x.vf acc vf1 vf8)
(let ((f2-1 (* f2-0 f1-0)))
(.add.mul.y.vf acc vf2 vf8 acc)
(nop!)
(.add.mul.z.vf acc vf3 vf8 acc)
(nop!)
(.add.mul.w.vf vf8 vf4 vf0 acc)
(nop!)
(nop!)
(.svf (&-> s1-0 start-pos quad) vf7)
(.min.vf vf5 vf7 vf8)
(set! (-> s1-0 radius) f2-1)
)
)
)
)
(.max.vf vf6 vf7 vf8)
(nop!)
(nop!)
(.lvf vf9 (&-> s1-0 exit-planes 0 quad))
(.sub.vf vf8 vf8 vf7)
(nop!)
(.sub.w.vf vf5 vf5 vf9)
(nop!)
(.add.w.vf vf6 vf6 vf9)
(nop!)
(nop!)
(.svf (&-> s1-0 move-dist quad) vf8)
(.ftoi.vf vf10 vf5)
(nop!)
(.ftoi.vf vf11 vf6)
(nop!)
(nop!)
(.svf (&-> s1-0 bbox min quad) vf5)
(nop!)
(.svf (&-> s1-0 bbox max quad) vf6)
(nop!)
(.svf (&-> s1-0 bbox4w min quad) vf10)
(nop!)
(.svf (&-> s1-0 bbox4w max quad) vf11)
(set! (-> s1-0 rlength x) (if (= (-> s1-0 move-dist x) 0.0)
0.0
(/ 1.0 (-> s1-0 move-dist x))
)
)
(set! (-> s1-0 rlength y) (if (= (-> s1-0 move-dist y) 0.0)
0.0
(/ 1.0 (-> s1-0 move-dist y))
)
)
(set! (-> s1-0 rlength z) (if (= (-> s1-0 move-dist z) 0.0)
0.0
(/ 1.0 (-> s1-0 move-dist z))
)
)
(let ((f0-12 1.0))
(.lvf vf1 (&-> (-> s1-0 move-dist) quad))
(.add.w.vf vf2 vf0 vf0 :mask #b1)
(.mul.vf vf1 vf1 vf1)
(.mul.x.vf acc vf2 vf1 :mask #b1)
(.add.mul.y.vf acc vf2 vf1 acc :mask #b1)
(.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1)
(.mov v1-26 vf1)
(set! (-> s1-0 rlength w) (/ f0-12 v1-26))
)
(set! (-> s1-0 exit-planes 0 x) (if (< 0.0 (-> s1-0 move-dist x))
0.0
100000000000000000000000000000000000000.0
)
)
(set! (-> s1-0 exit-planes 0 y) (if (< 0.0 (-> s1-0 move-dist y))
0.0
100000000000000000000000000000000000000.0
)
)
(set! (-> s1-0 exit-planes 0 z) (if (< 0.0 (-> s1-0 move-dist z))
0.0
100000000000000000000000000000000000000.0
)
)
(set! (-> s1-0 exit-planes 1 x) (if (< (-> s1-0 move-dist x) 0.0)
0.0
100000000000000000000000000000000000000.0
)
)
(set! (-> s1-0 exit-planes 1 y) (if (< (-> s1-0 move-dist y) 0.0)
0.0
100000000000000000000000000000000000000.0
)
)
(set! (-> s1-0 exit-planes 1 z) (if (< (-> s1-0 move-dist z) 0.0)
0.0
100000000000000000000000000000000000000.0
)
)
(let ((s0-1 (-> s2-0 bucket-ptr collide-hash-fragment-array)))
(set! sv-640 (-> s0-1 length))
(set! (-> s1-0 instance-ptr) s2-0)
(dotimes (s2-1 sv-640)
(set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0))
(set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0))
(set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0))
(fill-bg-using-line-sphere-new arg0 (-> s0-1 fragments s2-1) s1-0)
(+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris))
)
)
)
)
)
)
(else
(if *collide-list-boxes*
(add-collide-debug-box (-> s2-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80))
)
(set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0))
(set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0))
(set! (-> arg2 instance-ptr) #f)
(set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0))
(fill-bg-using-line-sphere-new arg0 s2-0 arg2)
(+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris))
)
)
)
)
0
(none)
)
)
;; definition for method 8 of type collide-hash
;; INFO: Used lq/sq
(defmethod mem-usage collide-hash ((obj collide-hash) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 51 (-> arg0 length)))
(set! (-> arg0 data 50 name) (symbol->string 'collision))
(+! (-> arg0 data 50 count) 1)
(let ((v1-10 (+ (* (-> obj num-items) 8) 96 (* (-> obj num-buckets) 4))))
(+! (-> arg0 data 50 used) v1-10)
(+! (-> arg0 data 50 total) (logand -16 (+ v1-10 15)))
)
(dotimes (v1-14 (the-as int (-> obj qwc-id-bits)))
(set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits v1-14) (the-as uint128 0))
)
(dotimes (s3-0 (the-as int (-> obj num-items)))
(let* ((a0-12 (-> obj item-array s3-0 id))
(v1-19 (shr a0-12 5))
)
(when (not (logtest? (-> (the-as collide-hash-scratch #x70000000) id-bits v1-19) (ash 1 (logand a0-12 31))))
(logior! (-> (the-as collide-hash-scratch #x70000000) id-bits v1-19) (ash 1 (logand a0-12 31)))
(if (= (-> obj item-array s3-0 collidable type) collide-hash-fragment)
(mem-usage (-> obj item-array s3-0 collidable) arg0 arg1)
)
)
)
)
obj
)
;; definition for method 8 of type collide-hash-fragment
(defmethod mem-usage collide-hash-fragment ((obj collide-hash-fragment) (arg0 memory-usage-block) (arg1 int))
(cond
((logtest? arg1 1)
(set! (-> arg0 length) (max 58 (-> arg0 length)))
(set! (-> arg0 data 55 name) (symbol->string 'prototype-fragment))
(+! (-> arg0 data 55 count) 1)
(set! (-> arg0 data 56 name) (symbol->string 'prototype-poly))
(+! (-> arg0 data 56 count) (the-as int (-> obj stats num-polys)))
(set! (-> arg0 data 57 name) (symbol->string 'prototype-vertex))
(+! (-> arg0 data 57 count) (the-as int (-> obj stats num-verts)))
(let ((a3-0 (+ (-> obj num-indices) 112 (* (-> obj num-buckets) 4)))
(a2-9 (* (-> obj stats num-polys) 4))
(v1-22 (* (the-as uint 6) (the-as uint (-> obj stats num-verts))))
)
(+! (-> arg0 data 55 used) a3-0)
(+! (-> arg0 data 55 total) (- (logand -16 (+ v1-22 15 a2-9 a3-0)) (the-as int (+ a2-9 v1-22))))
(+! (-> arg0 data 56 used) a2-9)
(+! (-> arg0 data 56 total) a2-9)
(+! (-> arg0 data 57 used) v1-22)
(+! (-> arg0 data 57 total) v1-22)
)
)
(else
(set! (-> arg0 length) (max 54 (-> arg0 length)))
(set! (-> arg0 data 51 name) (symbol->string 'collision-fragment))
(+! (-> arg0 data 51 count) 1)
(set! (-> arg0 data 52 name) (symbol->string 'collision-poly))
(+! (-> arg0 data 52 count) (the-as int (-> obj stats num-polys)))
(set! (-> arg0 data 53 name) (symbol->string 'collision-vertex))
(+! (-> arg0 data 53 count) (the-as int (-> obj stats num-verts)))
(let ((a3-8 (+ (-> obj num-indices) 112 (* (-> obj num-buckets) 4)))
(a2-22 (* (-> obj stats num-polys) 4))
(v1-45 (* (the-as uint 6) (the-as uint (-> obj stats num-verts))))
)
(+! (-> arg0 data 51 used) a3-8)
(+! (-> arg0 data 51 total) (- (logand -16 (+ v1-45 15 a2-22 a3-8)) (the-as int (+ a2-22 v1-45))))
(+! (-> arg0 data 52 used) a2-22)
(+! (-> arg0 data 52 total) a2-22)
(+! (-> arg0 data 53 used) v1-45)
(+! (-> arg0 data 53 total) v1-45)
)
)
)
obj
)
;; definition for method 8 of type collide-hash-fragment-array
(defmethod mem-usage collide-hash-fragment-array ((obj collide-hash-fragment-array) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 55 (-> arg0 length)))
(set! (-> arg0 data 54 name) (symbol->string 'prototype-collision))
(+! (-> arg0 data 54 count) 1)
(let ((v1-8 (asize-of obj)))
(+! (-> arg0 data 54 used) v1-8)
(+! (-> arg0 data 54 total) (logand -16 (+ v1-8 15)))
)
(dotimes (s3-0 (-> obj length))
(mem-usage (-> obj fragments s3-0) arg0 arg1)
)
obj
)
+4 -4
View File
@@ -671,7 +671,7 @@
(set! (-> gp-0 ignore-process0) self)
(set! (-> gp-0 ignore-process1) #f)
(set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask))
(collide-cache-method-12 *collide-cache* gp-0)
(fill-using-bounding-box *collide-cache* gp-0)
(dotimes (s5-0 3)
(set! (-> gp-0 start-pos quad) (-> self control unknown-sphere-array00 s5-0 prim-core world-sphere quad))
(vector-float*! (-> gp-0 move-dist) (-> self control unknown-vector25) -8192.0)
@@ -684,7 +684,7 @@
(set! (-> v1-48 action-mask) (collide-action solid))
)
(cond
((and (>= (collide-cache-method-16 *collide-cache* gp-0) 0.0)
((and (>= (probe-using-line-sphere *collide-cache* gp-0) 0.0)
(< 0.8 (vector-dot (-> gp-0 best-other-tri normal) (-> self control unknown-vector25)))
)
)
@@ -1357,7 +1357,7 @@
(set! (-> gp-0 ignore-process0) self)
(set! (-> gp-0 ignore-process1) #f)
(set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask))
(collide-cache-method-12 *collide-cache* gp-0)
(fill-using-bounding-box *collide-cache* gp-0)
(dotimes (s5-0 2)
(let ((a1-4 (not (or (logtest? (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))
(and (logtest? (-> self control unknown-surface00 flags) (surface-flag air))
@@ -1448,7 +1448,7 @@
(set! (-> v1-66 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
(set! (-> v1-66 action-mask) (collide-action solid))
)
(let ((f30-0 (collide-cache-method-16 *collide-cache* gp-0)))
(let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0)))
(cond
((and (>= f30-0 0.0) (< 0.5 (-> gp-0 best-other-tri normal y)))
(set! (-> s4-0 quad) (-> gp-0 best-other-tri normal quad))
+1
View File
@@ -584,6 +584,7 @@ int main(int argc, char* argv[]) {
if (!total.compare.total_pass) {
lg::error("Comparison failed.");
for (auto& f : total.compare.failing_files) {
fmt::print("{}\n", f.filename);
fmt::print("{}\n", f.diff);
}
lg::error("Failing files:");