[collision] implement most of background collision, spawn target! (#1076)

* fill collide cache with bounding box working

* yprobe fully working for background at least

* target

* final cleanup, add a bit more foreground mesh stuff that is untested

* warnings, merge issues

* tests

* revert debug changes, format'

* rendering perf
This commit is contained in:
water111 2022-01-15 16:52:47 -05:00 committed by GitHub
parent 79ac3a0c3a
commit e84b5a2346
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
91 changed files with 14778 additions and 9250 deletions

View file

@ -2,6 +2,7 @@
#include "mips2c.h"
#include "common/symbols.h"
#include "common/util/print_float.h"
#include "decompiler/Disasm/InstructionMatching.h"
#include "decompiler/Function/Function.h"
@ -570,8 +571,29 @@ Mips2C_Line handle_generic_op2_u16(const Instruction& i0, const std::string& ins
instr_str};
}
Mips2C_Line handle_daddiu(Mips2C_Output& out, const Instruction& i0, const std::string& instr_str) {
if (i0.get_src(1).is_label()) {
return {instr_str, instr_str};
} else if (i0.get_src(0).is_reg(rs7()) && i0.get_src(1).is_sym("#t")) {
return {fmt::format("c->{}({}, {}, {});", i0.op_name_to_string(), reg_to_name(i0.get_dst(0)),
reg_to_name(i0.get_src(0)), FIX_SYM_TRUE),
instr_str};
} else if (i0.get_src(0).is_reg(rs7()) && i0.get_src(1).is_sym()) {
out.require_symbol(i0.get_src(1).get_sym());
return {fmt::format("c->load_symbol_addr({}, cache.{});", reg_to_name(i0.get_dst(0)),
goal_to_c_name(i0.get_src(1).get_sym())),
instr_str};
} else {
return handle_generic_op2_u16(i0, instr_str);
}
}
Mips2C_Line handle_sw(Mips2C_Output& out, const Instruction& i0, const std::string& instr_str) {
if (i0.get_src(1).is_sym() && i0.get_src(2).is_reg(rs7())) {
out.require_symbol(i0.get_src(1).get_sym());
return {fmt::format("c->store_symbol({}, cache.{});", reg_to_name(i0.get_src(0)),
goal_to_c_name(i0.get_src(1).get_sym())),
instr_str};
return handle_unknown(instr_str);
// auto name = i0.get_src(1).get_sym();
// // store into symbol table!
@ -747,12 +769,22 @@ Mips2C_Line handle_likely_branch_bc(const Instruction& i0, const std::string& in
switch (i0.kind) {
case InstructionKind::BLTZL:
return {fmt::format("((s64){}) < 0", reg64_or_zero(i0.get_src(0))), instr_str};
case InstructionKind::BGEZL:
return {fmt::format("((s64){}) >= 0", reg64_or_zero(i0.get_src(0))), instr_str};
case InstructionKind::BGTZL:
return {fmt::format("((s64){}) > 0", reg64_or_zero(i0.get_src(0))), instr_str};
case InstructionKind::BNEL:
return {fmt::format("((s64){}) != ((s64){})", reg64_or_zero(i0.get_src(0)),
reg64_or_zero(i0.get_src(1))),
instr_str};
case InstructionKind::BEQL:
return {fmt::format("((s64){}) == ((s64){})", reg64_or_zero(i0.get_src(0)),
reg64_or_zero(i0.get_src(1))),
instr_str};
case InstructionKind::BC1TL:
return {"cop1_bc", instr_str};
case InstructionKind::BC1FL:
return {"!cop1_bc", instr_str};
default:
return handle_unknown(instr_str);
}
@ -834,6 +866,12 @@ Mips2C_Line handle_cles(const Instruction& i0, const std::string& instr_string)
instr_string};
}
Mips2C_Line handle_ceqs(const Instruction& i0, const std::string& instr_string) {
return {fmt::format("cop1_bc = c->fprs[{}] == c->fprs[{}];", reg_to_name(i0.get_src(0)),
reg_to_name(i0.get_src(1))),
instr_string};
}
Mips2C_Line handle_pmfhl_lh(const Instruction& i0, const std::string& instr_string) {
return {fmt::format("c->pmfhl_lh({});", reg_to_name(i0.get_dst(0))), instr_string};
}
@ -892,12 +930,16 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
return handle_generic_op2_mask(i0, instr_str, "vmove");
case InstructionKind::VITOF0:
return handle_generic_op2_mask(i0, instr_str, "vitof0");
case InstructionKind::VITOF12:
return handle_generic_op2_mask(i0, instr_str, "vitof12");
case InstructionKind::VFTOI0:
return handle_generic_op2_mask(i0, instr_str, "vftoi0");
case InstructionKind::VFTOI4:
return handle_generic_op2_mask(i0, instr_str, "vftoi4");
case InstructionKind::VFTOI12:
return handle_generic_op2_mask(i0, instr_str, "vftoi12");
case InstructionKind::VABS:
return handle_generic_op2_mask(i0, instr_str, "vabs");
case InstructionKind::VADDQ:
return handle_generic_op2_mask(i0, instr_str, "vaddq");
case InstructionKind::ANDI:
@ -956,6 +998,7 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
case InstructionKind::AND:
return handle_generic_op3(i0, instr_str, "and_"); // and isn't allowed in C++
case InstructionKind::DADDIU:
return handle_daddiu(output, i0, instr_str);
case InstructionKind::ADDIU:
return handle_generic_op2_u16(i0, instr_str);
case InstructionKind::QMTC2:
@ -996,6 +1039,8 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
return handle_generic_op2(i0, instr_str, "mtc1");
case InstructionKind::NEGS:
return handle_generic_op2(i0, instr_str, "negs");
case InstructionKind::MOVS:
return handle_generic_op2(i0, instr_str, "movs");
case InstructionKind::CVTWS:
return handle_generic_op2(i0, instr_str, "cvtws");
case InstructionKind::CVTSW:
@ -1014,6 +1059,9 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
case InstructionKind::CLES:
output.needs_cop1_bc = true;
return handle_cles(i0, instr_str);
case InstructionKind::CEQS:
output.needs_cop1_bc = true;
return handle_ceqs(i0, instr_str);
case InstructionKind::VWAITQ:
return handle_plain_op(i0, instr_str, "vwaitq");
case InstructionKind::VOPMULA:

View file

@ -11238,6 +11238,7 @@
(declare-type collide-cache-prim structure)
(declare-type collide-shape-prim-group basic)
(declare-type collide-cache basic)
(deftype collide-shape-prim (basic)
((cshape collide-shape :offset-assert 4)
(prim-id uint32 :offset-assert 8)
@ -11260,9 +11261,9 @@
(move-by-vector! (_type_ vector) none 9)
(find-prim-by-id (_type_ uint) collide-shape-prim 10)
(debug-draw-world-sphere (_type_) symbol 11)
(add-fg-prim-using-box (_type_ process-drawable) none 12)
(add-fg-prim-using-line-sphere (_type_ process-drawable) none 13)
(add-fg-prim-using-y-probe (_type_ process-drawable) none 14)
(add-fg-prim-using-box (_type_ collide-cache) none 12)
(add-fg-prim-using-line-sphere (_type_ collide-cache) none 13)
(add-fg-prim-using-y-probe (_type_ collide-cache) none 14)
(overlaps-others-test (_type_ overlaps-others-params collide-shape-prim) symbol 15)
(overlaps-others-group (_type_ overlaps-others-params collide-shape-prim-group) symbol 16)
(dummy-17 () none 17)
@ -11357,10 +11358,10 @@
(on-platform (_type_ collide-shape collide-overlap-result) symbol 39)
(find-overlapping-shapes (_type_ overlaps-others-params) symbol 40) ;; check if blocked??
(dummy-41 (_type_ attack-info float) vector 41)
(compute-overlap (_type_ collide-shape collide-overlap-result) symbol 42)
(should-push-away (_type_ collide-shape collide-overlap-result) symbol 42)
(pull-rider! (_type_ pull-rider-info) none 43)
(pull-riders! (_type_) symbol 44)
(respond-to-collisions! (_type_) symbol 45)
(do-push-aways! (_type_) symbol 45)
(set-root-prim! (_type_ collide-shape-prim) collide-shape-prim 46)
(update-transforms! (_type_) symbol 47)
(clear-collide-with-as (_type_) none 48)
@ -11516,6 +11517,15 @@
(unknown-float64 float :offset 1316) ;; from - logic-target::target-compute-slopes
(unknown-dword20 int64 :offset 1320) ;; from target-util::turn-around? - TODO
(unknown-dword21 int64 :offset 1328) ;; from target-util::turn-around? - TODO
(unknown-dword-coverage int64 :offset 1336)
(unknown-float-coverage-0 float :offset 1344)
(unknown-float-coverage-1 float :offset 1348)
(unknown-float-coverage-2 float :offset 1352)
(unknown-u32-coverage-0 uint32 :offset 1356)
(unknown-vector-coverage-0 vector :inline :offset 1376)
(unknown-vector-coverage-1 vector :inline :offset 1392)
(unknown-vector-coverage-2 vector :inline :offset 1440)
(unknown-vector-coverage-3 vector :inline :offset 1472)
(unknown-vector60 vector :inline :offset 1456) ;; from - logic-target::add-thrust
(unknown-vector61 vector :inline :offset 1504) ;; from - logic-target::add-thrust
(unknown-float70 float :offset 1520) ;; from - logic-target::add-thrust
@ -11601,6 +11611,7 @@
(unknown-dword82 int64 :offset 18912) ;; from logic-target::reset-target-state
(unknown-vector120 vector :inline :offset 18928) ;; from target::(code target-running-attack)
(unknown-float150 float :offset 18944) ;; from target::(code target-wheel-flip)
(unknown-vector121 vector :inline :offset 18960) ;; from target collide response
(unknown-int60 uint32 :offset 18976) ;; from logic-target::print-target-stats
(unknown-soundid00 sound-id :offset 18980) ;; from powerups::target-powerup-process
(unknown-float141 float :offset 18984) ;; from powerups::target-powerup-process
@ -11790,7 +11801,7 @@
:flag-assert #xb00000810
(:methods
(debug-draw (_type_) object 9)
(dummy-10 () none 10)
(dummy-10 (_type_ collide-edge-hold-item) none 10)
)
)
@ -11832,12 +11843,12 @@
(debug-draw-edges (_type_) object 10)
(dummy-11 (_type_) none 11)
(debug-draw-sphere (_type_) symbol 12)
(dummy-13 (_type_) none 13)
(dummy-13 (_type_ collide-edge-hold-item vector) none 13)
(dummy-14 (_type_ vector vector int) float 14)
(dummy-15 (_type_) none 15)
(dummy-16 (_type_) none 16)
(find-grabbable-tris! (_type_) none 16)
(dummy-17 (_type_) none 17)
(dummy-18 (_type_) none 18)
(dummy-18 (_type_ collide-edge-hold-list edge-grab-info) none 18)
(dummy-19 (_type_ collide-edge-hold-item edge-grab-info) symbol 19)
)
)
@ -12482,8 +12493,8 @@
:size-assert #xc60
:flag-assert #xb00000c60
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-9 (_type_ object object) symbol 9)
(dummy-10 (_type_ object object) symbol 10)
)
)
@ -12502,10 +12513,11 @@
(deftype collide-cache-tri (structure)
((vertex vector 3 :inline :offset-assert 0)
;(extra-quad UNKNOWN 16 :offset-assert 48)
(pat pat-surface :offset-assert 48)
(prim-index uint16 :offset-assert 52)
(user16 uint16 :offset-assert 54)
(user32 uint32 2 :offset-assert 56)
(extra-quad uint128 :offset 48)
(pat pat-surface :offset 48)
(prim-index uint16 :offset 52)
(user16 uint16 :offset 54)
(user32 uint32 2 :offset 56)
)
:method-count-assert 9
:size-assert #x40
@ -12514,12 +12526,12 @@
(deftype collide-cache-prim (structure)
((prim-core collide-prim-core :inline :offset-assert 0)
;;(extra-quad UNKNOWN 16 :offset-assert 32)
(ccache collide-cache :offset-assert 32)
(prim collide-shape-prim :offset-assert 36)
(first-tri uint16 :offset-assert 40)
(num-tris uint16 :offset-assert 42)
(unused uint8 4 :offset-assert 44)
(extra-quad uint128 :offset-assert 32)
(ccache collide-cache :offset 32)
(prim collide-shape-prim :offset 36)
(first-tri uint16 :offset 40)
(num-tris uint16 :offset 42)
(unused uint8 4 :offset 44)
(world-sphere vector :inline :offset 0)
(collide-as collide-kind :offset 16)
(action collide-action :offset 24)
@ -12554,7 +12566,7 @@
(:methods
(debug-draw (_type_) none 9)
(fill-and-probe-using-line-sphere (_type_ vector vector float collide-kind process collide-tri-result int) float 10)
(fill-and-probe-using-spheres (_type_ collide-using-spheres-params) none 11)
(fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol 11)
(fill-and-probe-using-y-probe (_type_ vector float collide-kind process collide-tri-result uint) float 12)
(fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none 13)
(fill-using-line-sphere (_type_ vector vector float collide-kind process-drawable int) none 14)
@ -12562,20 +12574,20 @@
(fill-using-y-probe (_type_ vector float collide-kind process-drawable uint) none 16)
(initialize (_type_) none 17)
(probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result int) float 18)
(probe-using-spheres (_type_) none 19)
(probe-using-spheres (_type_ collide-using-spheres-params) symbol 19)
(probe-using-y-probe (_type_ vector float collide-kind collide-tri-result uint) float 20)
(fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache none)) none 21) ;; second functiom is method 28
(fill-from-foreground-using-spheres (_type_) none 22)
(fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache object none)) none 21) ;; second functiom is method 28
(fill-from-foreground-using-box (_type_) none 22)
(fill-from-foreground-using-line-sphere (_type_) none 23)
(fill-from-foreground-using-y-probe (_type_) none 24)
(fill-from-water (_type_ water-control) none 25) ;; or whatever is from 152 in the process passed to 16
(dummy-26 (_type_) none 26)
(load-mesh-from-spad-in-box (_type_ collide-frag-mesh) none 26)
(dummy-27 (_type_) none 27)
(dummy-28 (_type_) none 28)
(dummy-29 (_type_ collide-frag-mesh) none 29)
(dummy-30 (_type_) none 30)
(dummy-31 (_type_ collide-puyp-work collide-cache-prim) vector 31)
(dummy-32 (_type_) none 32)
(puyp-mesh (_type_ collide-puyp-work collide-cache-prim) none 30)
(puyp-sphere (_type_ collide-puyp-work collide-cache-prim) vector 31)
(unpack-background-collide-mesh (_type_ object object object) none 32) ;; helper for fill from background.
)
)
@ -14439,7 +14451,7 @@
(print-nth-point (_type_ int) none 11)
(TODO-RENAME-12 (_type_) none 12)
(TODO-RENAME-13 (_type_ int) none 13)
(TODO-RENAME-14 (_type_ vector) none 14)
(TODO-RENAME-14 (_type_ tracking-spline-sampler) none 14)
(TODO-RENAME-15 (_type_) none 15)
(TODO-RENAME-16 (_type_ float) none 16)
(TODO-RENAME-17 (_type_ vector float float symbol) int 17) ; - return value is actually none but they do a manual `return`
@ -19940,7 +19952,7 @@
;; - Functions
(define-extern collide-shape-moving-angle-set! (function collide-shape-moving vector vector none))
(define-extern target-collision-low-coverage (function control-info collide-shape-intersect vector (pointer int) (pointer int) (pointer symbol) uint)) ;; i think the pointers are lies - TODO
(define-extern target-collision-low-coverage (function control-info collide-shape-intersect vector (pointer uint32) (pointer uint64) (pointer symbol) uint)) ;; i think the pointers are lies - TODO
(define-extern poly-find-nearest-edge (function vector (inline-array vector) vector vector vector))
(define-extern target-collision-reaction (function control-info collide-shape-intersect vector vector none))
(define-extern target-collision-no-reaction (function control-info collide-shape-intersect vector vector none))
@ -20080,7 +20092,7 @@
(define-extern target-apply-tongue (function vector symbol :behavior target))
(define-extern get-intersect-point (function vector touching-prims-entry control-info process vector))
(define-extern target-powerup-effect (function symbol none :behavior target))
(define-extern target-shoved (function meters meters process (state target) object :behavior target))
(define-extern target-shoved (function meters meters process (state object object target) object :behavior target))
(define-extern target-dangerous-event-handler (function process int symbol event-message-block object :behavior target))
(define-extern target-jump-event-handler (function process int symbol event-message-block object :behavior target))
(define-extern target-walk-event-handler (function process int symbol event-message-block object :behavior target))

View file

@ -237,10 +237,10 @@
"(method 13 collide-edge-work)", // CFG
"(method 17 collide-edge-work)", // CFG
"(method 15 collide-edge-work)", // CFG
"(method 16 collide-edge-work)", // CFG
// CFG
"(method 9 edge-grab-info)", // CFG
"(method 18 collide-edge-work)", // CFG
"(method 10 collide-edge-hold-list)", // CFG
// CFG
"(method 12 collide-mesh)",
@ -253,7 +253,7 @@
"ambient-inspect",
// target BUG
"target-falling-anim-trans", // CFG resolution
//"target-falling-anim-trans", // CFG resolution
// target2 BUG
"look-for-points-of-interest", // Failed to split nested sc - looks like dead code to me
@ -261,20 +261,14 @@
// collide-cache
"(method 10 collide-puss-work)", // CFG
"(method 9 collide-puss-work)", // decompiler crash
"(method 19 collide-cache)", // decompiler crash
"(method 10 collide-cache-prim)", // CFG
"(method 9 collide-cache-prim)", // CFG
"(method 30 collide-cache)", // unsupported asm - c.le.s
"(method 13 collide-shape-prim-group)", // CFG
"(method 13 collide-shape-prim-mesh)", // CFG
"(method 14 collide-shape-prim-group)", // CFG
"(method 14 collide-shape-prim-mesh)", // CFG
"(method 12 collide-shape-prim-group)", // CFG
"(method 12 collide-shape-prim-mesh)", // CFG
"(method 27 collide-cache)", // CFG
// decompiler crash
// CFG
// CFG
// CFG
// "(method 14 collide-cache)", // CFG
"(method 28 collide-cache)", // CFG
"(method 26 collide-cache)", // CFG
// CFG
// "(method 26 collide-cache)", // CFG
//"(method 21 collide-cache)", // CFG
"(method 32 collide-cache)", // CFG
@ -487,7 +481,20 @@
"(method 16 collide-shape-prim)" : [1, 2, 3, 4, 5, 6],
"(method 15 collide-shape-prim-sphere)" : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
"(method 15 collide-shape-prim-mesh)" : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 29],
"(method 35 collide-shape)" : [1]
"(method 35 collide-shape)" : [1],
"(method 22 collide-cache)":[2, 3, 4, 13, 14, 15, 23, 24, 25, 33, 34, 35],
"(method 12 collide-shape-prim-sphere)" : [0, 1],
"(method 12 collide-shape-prim-group)" : [1, 2, 3, 4],
"(method 24 collide-cache)" : [2, 3, 4, 13, 14, 15, 23, 24, 25, 33, 34, 35],
"(method 14 collide-shape-prim-sphere)" : [0, 1, 2, 3],
"(method 14 collide-shape-prim-group)" : [0, 1, 2, 3, 4],
"(method 23 collide-cache)" : [2, 3, 4, 13, 14, 15, 23, 24, 25, 33, 34, 35],
"(method 13 collide-shape-prim-sphere)" : [0, 1, 2],
"(method 13 collide-shape-prim-group)" : [0, 1, 2,3,4],
"(method 19 collide-cache)" : [0, 1, 3, 4, 5, 18, 19],
"(method 10 collide-mesh)" : [1, 2, 4, 5],
"target-falling-anim-trans" : [5, 6]
},
// Sometimes the game might use format strings that are fetched dynamically,
@ -539,7 +546,27 @@
"(method 12 collide-mesh)",
"(method 11 collide-mesh)",
"collide-probe-node",
"collide-probe-instance-tie"
"collide-probe-instance-tie",
"(method 32 collide-cache)",
"(method 28 collide-cache)",
"(method 26 collide-cache)",
"(method 27 collide-cache)",
"(method 29 collide-cache)",
"(method 12 collide-shape-prim-mesh)",
"(method 14 collide-shape-prim-mesh)",
"(method 13 collide-shape-prim-mesh)",
"(method 30 collide-cache)",
"(method 9 collide-cache-prim)",
"(method 10 collide-cache-prim)",
"(method 9 collide-puss-work)",
"(method 10 collide-puss-work)",
// these could easily be goal, but probably faster/easier this way.
"(method 14 collide-mesh)",
"(method 15 collide-mesh)",
"(method 16 collide-edge-work)",
"(method 10 collide-edge-hold-list)"
],
// there are some missing textures. I don't know what the game actually does here.

View file

@ -696,7 +696,7 @@
[48, "collide-tri-result"]
],
"(method 20 collide-cache)": [[16, "vector"]],
"(method 20 collide-cache)": [[16, "collide-puyp-work"]],
"(method 12 wobbler)": [[16, "vector"]],
@ -4366,7 +4366,7 @@
"target-collision-reaction": [
[16, "vector"],
[32, "vector"],
[48, "vector"],
[48, "matrix"],
[112, "vector"],
[128, "vector"],
[144, "vector"],
@ -6082,6 +6082,15 @@
"(method 18 collide-shape-prim-sphere)" : [
[16, "collide-tri-result"]
],
"target-collision-low-coverage" : [
[64, "collide-tri-result"],
[176, "vector"],
[192, "vector"],
[224, "vector"],
[240, "vector"],
[256, "vector"],
[288, "vector"]
],
"placeholder-do-not-add-below!": []
}

View file

@ -5795,16 +5795,13 @@
],
"(method 9 collide-cache)": [
[5, "gp", "collide-cache-tri"],
[19, "gp", "collide-cache-tri"],
[20, "gp", "collide-cache-tri"],
[21, "gp", "collide-cache-tri"],
[23, "gp", "(inline-array collide-cache-tri)"],
[33, "gp", "collide-cache-prim"],
[[1,29], "gp", "collide-cache-tri"],
[[29,56], "gp", "collide-cache-prim"],
[35, "gp", "collide-cache-prim"],
[50, "gp", "collide-cache-prim"],
[51, "gp", "collide-cache-prim"],
[55, "gp", "(inline-array collide-cache-prim)"]
[55, "gp", "collide-cache-prim"],
[36, "v1", "collide-shape-prim-sphere"]
],
"(method 9 collide-mesh)": [
@ -7547,6 +7544,9 @@
[190, "v1", "(pointer int32)"],
[147, "v1", "collide-list-item"],
[148, "v1", "collide-list-item"],
[[91, 95], "v1", "dma-packet"],
[[112, 141], "v1", "dma-bank-spr"],
[[154, 188], "a2", "dma-bank-spr"],
[[217, 227], "s3", "collide-list-item"]
],
@ -7590,5 +7590,63 @@
[[16, 55], "gp", "collide-shape-prim-mesh"]
],
"(method 25 collide-cache)" : [
[[83, 104], "a2", "(inline-array collide-cache-tri)"]
],
"(method 22 collide-cache)" : [
[14, "v1", "connection"],
[[15,31], "v1", "collide-shape"],
[74, "v1", "connection"],
[[75, 91], "v1", "collide-shape"],
[130, "v1", "connection"],
[[131, 148], "v1", "collide-shape"],
[187, "v1", "connection"],
[[188, 205], "v1", "collide-shape"]
],
"(method 12 collide-shape-prim-sphere)" : [
[[13, 23], "t0", "collide-cache-prim"]
],
"(method 24 collide-cache)" : [
[14, "v1", "connection"],
[[15,31], "v1", "collide-shape"],
[74, "v1", "connection"],
[[75, 91], "v1", "collide-shape"],
[130, "v1", "connection"],
[[131, 148], "v1", "collide-shape"],
[187, "v1", "connection"],
[[188, 205], "v1", "collide-shape"]
],
"(method 14 collide-shape-prim-sphere)" : [
[[11, 23], "t0", "collide-cache-prim"]
],
"(method 23 collide-cache)" : [
[20, "v1", "connection"],
[[21,43], "v1", "collide-shape"],
[86, "v1", "connection"],
[[87,109], "v1", "collide-shape"],
[148, "v1", "connection"],
[[149, 174], "v1", "collide-shape"],
[211, "v1", "connection"],
[[212, 235], "v1", "collide-shape"]
],
"(method 13 collide-shape-prim-sphere)" : [
[[11, 23], "t0", "collide-cache-prim"]
],
"(method 31 collide-cache)" : [
[22, "v1", "collide-shape-prim-sphere"]
],
"(method 19 collide-cache)" : [
[[52, 94], "s4", "collide-cache-prim"],
[[1, 100], "s5", "collide-puss-work"]
],
"placeholder-do-not-add-below": []
}

View file

@ -60,6 +60,8 @@ set(RUNTIME_SOURCE
kernel/ksocket.cpp
kernel/ksound.cpp
mips2c/mips2c_table.cpp
mips2c/functions/collide_cache.cpp
mips2c/functions/collide_edge_grab.cpp
mips2c/functions/collide_func.cpp
mips2c/functions/collide_mesh.cpp
mips2c/functions/collide_probe.cpp

View file

@ -63,6 +63,9 @@ struct SharedRenderState {
bool dump_playback = false;
bool use_sky_cpu = true;
bool has_camera_planes = false;
math::Vector4f camera_planes[4];
};
/*!

View file

@ -120,6 +120,7 @@ void OpenGLRenderer::render(DmaFollower dma, const RenderOptions& settings) {
m_render_state.dump_playback = settings.playing_from_dump;
m_render_state.ee_main_memory = settings.playing_from_dump ? nullptr : g_ee_main_mem;
m_render_state.offset_of_s7 = offset_of_s7();
m_render_state.has_camera_planes = false;
{
auto prof = m_profiler.root()->make_scoped_child("frame-setup");

View file

@ -2,6 +2,7 @@
#include "third-party/imgui/imgui.h"
#include "SpriteRenderer.h"
#include "game/graphics/opengl_renderer/dma_helpers.h"
#include "game/graphics/opengl_renderer/tfrag/tfrag_common.h"
namespace {
@ -99,12 +100,12 @@ SpriteRenderer::SpriteRenderer(const std::string& name, BucketId my_id)
* the table upload stuff that runs every frame, even if there are no sprites.
*/
void SpriteRenderer::render_distorter(DmaFollower& dma,
SharedRenderState* render_state,
ScopedProfilerNode& prof) {
SharedRenderState* /*render_state*/,
ScopedProfilerNode& /*prof*/) {
// Next thing should be the sprite-distorter setup
// m_direct_renderer.reset_state();
while (dma.current_tag().qwc != 7) {
auto direct_data = dma.read_and_advance();
dma.read_and_advance();
// m_direct_renderer.render_vif(direct_data.vif0(), direct_data.vif1(), direct_data.data,
// direct_data.size_bytes, render_state, prof);
}
@ -194,10 +195,6 @@ void SpriteRenderer::render_2d_group0(DmaFollower& dma,
m_3d_matrix_data.hvdf_offset.data());
glUniform1f(glGetUniformLocation(render_state->shaders[ShaderId::SPRITE].id(), "pfog0"),
m_frame_data.pfog0);
glUniform1f(glGetUniformLocation(render_state->shaders[ShaderId::SPRITE].id(), "fog_min"),
m_frame_data.fog_min);
glUniform1f(glGetUniformLocation(render_state->shaders[ShaderId::SPRITE].id(), "fog_max"),
m_frame_data.fog_max);
glUniform1f(glGetUniformLocation(render_state->shaders[ShaderId::SPRITE].id(), "min_scale"),
m_frame_data.min_scale);
glUniform1f(glGetUniformLocation(render_state->shaders[ShaderId::SPRITE].id(), "max_scale"),
@ -417,16 +414,10 @@ void SpriteRenderer::draw_debug_window() {
m_debug_stats.count_2d_grp0);
ImGui::Text("2D Group 1 (HUD) blocks: %d sprites: %d", m_debug_stats.blocks_2d_grp1,
m_debug_stats.count_2d_grp1);
ImGui::Checkbox("Extra Debug", &m_extra_debug);
ImGui::Checkbox("Culling", &m_enable_culling);
ImGui::Checkbox("2d", &m_2d_enable);
ImGui::SameLine();
ImGui::Checkbox("3d", &m_3d_enable);
ImGui::SameLine();
ImGui::Checkbox("3d-debug", &m_3d_debug);
if (ImGui::TreeNode("direct")) {
// m_sprite_renderer.draw_debug_window();
ImGui::TreePop();
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -471,8 +462,8 @@ void SpriteRenderer::flush_sprites(SharedRenderState* render_state, ScopedProfil
}
void SpriteRenderer::handle_tex0(u64 val,
SharedRenderState* render_state,
ScopedProfilerNode& prof) {
SharedRenderState* /*render_state*/,
ScopedProfilerNode& /*prof*/) {
GsTex0 reg(val);
// update tbp
@ -495,8 +486,8 @@ void SpriteRenderer::handle_tex0(u64 val,
}
void SpriteRenderer::handle_tex1(u64 val,
SharedRenderState* render_state,
ScopedProfilerNode& prof) {
SharedRenderState* /*render_state*/,
ScopedProfilerNode& /*prof*/) {
GsTex1 reg(val);
// for now, we aren't going to handle mipmapping. I don't think it's used with direct.
// assert(reg.mxl() == 0);
@ -512,8 +503,8 @@ void SpriteRenderer::handle_tex1(u64 val,
}
void SpriteRenderer::handle_zbuf(u64 val,
SharedRenderState* render_state,
ScopedProfilerNode& prof) {
SharedRenderState* /*render_state*/,
ScopedProfilerNode& /*prof*/) {
// note: we can basically ignore this. There's a single z buffer that's always configured the same
// way - 24-bit, at offset 448.
GsZbuf x(val);
@ -524,8 +515,8 @@ void SpriteRenderer::handle_zbuf(u64 val,
}
void SpriteRenderer::handle_clamp(u64 val,
SharedRenderState* render_state,
ScopedProfilerNode& prof) {
SharedRenderState* /*render_state*/,
ScopedProfilerNode& /*prof*/) {
if (!(val == 0b101 || val == 0 || val == 1 || val == 0b100)) {
fmt::print("clamp: 0x{:x}\n", val);
assert(false);
@ -559,20 +550,20 @@ void SpriteRenderer::update_gl_blend(AdGifState& state) {
// unsupported blend: a 0 b 2 c 2 d 1
lg::error("unsupported blend: a {} b {} c {} d {}\n", (int)state.a, (int)state.b,
(int)state.c, (int)state.d);
assert(false);
// assert(false);
}
}
}
void SpriteRenderer::handle_alpha(u64 val,
SharedRenderState* render_state,
ScopedProfilerNode& prof) {
SharedRenderState* /*render_state*/,
ScopedProfilerNode& /*prof*/) {
GsAlpha reg(val);
m_adgif_state.from_register(reg);
}
void SpriteRenderer::update_gl_prim(SharedRenderState* render_state) {
void SpriteRenderer::update_gl_prim(SharedRenderState* /*render_state*/) {
// currently gouraud is handled in setup.
const auto& state = m_prim_gl_state;
if (state.fogging_enable) {
@ -655,6 +646,16 @@ void SpriteRenderer::do_block_common(SpriteMode mode,
flush_sprites(render_state, prof);
}
if (mode == Mode2D && render_state->has_camera_planes && m_enable_culling) {
// we can skip sprites that are out of view
// it's probably possible to do this for 3D as well.
auto bsphere = m_vec_data_2d[sprite_idx].xyz_sx;
bsphere.w() = std::max(bsphere.w(), m_vec_data_2d[sprite_idx].sy());
if (bsphere.w() == 0 || !sphere_in_view_ref(bsphere, render_state->camera_planes)) {
continue;
}
}
auto& adgif = m_adgif[sprite_idx];
// fmt::print("adgif: {:X} {:X} {:X} {:X}\n", adgif.tex0_data, adgif.tex1_data,
// adgif.clamp_data, adgif.alpha_data); fmt::print("adgif regs: {} {} {} {} {}\n",

View file

@ -197,8 +197,7 @@ class SpriteRenderer : public BucketRenderer {
int count_2d_grp1 = 0;
} m_debug_stats;
bool m_extra_debug = false;
bool m_3d_debug = false;
bool m_enable_culling = true;
bool m_2d_enable = true;
bool m_3d_enable = true;

View file

@ -12,8 +12,6 @@ uniform mat4 hud_matrix;
uniform vec4 hud_hvdf_offset;
uniform vec4 hud_hvdf_user[75];
uniform float pfog0;
uniform float fog_min;
uniform float fog_max;
uniform float min_scale;
uniform float max_scale;
uniform float bonus;
@ -62,8 +60,6 @@ vec4 sprite_transform2(vec3 root, vec4 off, mat3 sprite_rot, float sx, float sy)
float Q = pfog0 / transformed_pos.w;
transformed_pos.xyz *= Q;
transformed_pos.xyz += hvdf_offset.xyz;
// transformed_pos.w = max(transformed_pos.w, fog_max);
// transformed_pos.w = min(transformed_pos.w, fog_min);
return transformed_pos;
}
@ -108,8 +104,7 @@ void main() {
transformed_pos_vf02.xyz *= Q;
vec4 offset_pos_vf10 = transformed_pos_vf02 + hvdf_offset;
offset_pos_vf10.w = max(offset_pos_vf10.w, fog_max);
offset_pos_vf10.w = min(offset_pos_vf10.w, fog_min);
/* transformed_pos_vf02.w = offset_pos_vf10.w - fog_max;
int fge = matrix == 0;
if (transformed_pos_vf02.w != 0) {
@ -136,8 +131,6 @@ void main() {
transformed_pos_vf02.xyz *= Q;
vec4 offset_pos_vf10 = transformed_pos_vf02 + (matrix == 0 ? hud_hvdf_offset : hud_hvdf_user[matrix - 1]);
offset_pos_vf10.w = max(offset_pos_vf10.w, fog_max);
offset_pos_vf10.w = min(offset_pos_vf10.w, fog_min);
scales_vf01.z = min(max(scales_vf01.z, min_scale), max_scale);
scales_vf01.w = min(max(scales_vf01.w, min_scale), max_scale);

View file

@ -111,7 +111,9 @@ void TFragment::render(DmaFollower& dma,
for (int i = 0; i < 4; i++) {
settings.planes[i] = m_pc_port_data.planes[i];
render_state->camera_planes[i] = m_pc_port_data.planes[i];
}
render_state->has_camera_planes = true;
if (m_override_time_of_day) {
for (int i = 0; i < 8; i++) {

View file

@ -429,7 +429,9 @@ void Tie3::render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfi
for (int i = 0; i < 4; i++) {
settings.planes[i] = m_pc_port_data.planes[i];
render_state->camera_planes[i] = m_pc_port_data.planes[i];
}
render_state->has_camera_planes = true;
if (false) {
// for (int i = 0; i < 8; i++) {

View file

@ -44,6 +44,7 @@ void interp_time_of_day_fast(const float weights[8],
void cull_check_all_slow(const math::Vector4f* planes,
const std::vector<tfrag3::VisNode>& nodes,
u8* out);
bool sphere_in_view_ref(const math::Vector4f& sphere, const math::Vector4f* planes);
struct TfragPcPortData {
math::Vector4f planes[4];

View file

@ -889,6 +889,7 @@ void ultimate_memcpy(void* dst, void* src, uint32_t size) {
auto sym = find_symbol_from_c("ultimate-memcpy");
if (sym->value == 0) {
memmove(dst, src, size);
return;
}
gfunc_774.offset = sym->value;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,191 @@
//--------------------------MIPS2C---------------------
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/kscheme.h"
namespace Mips2C {
namespace method_16_collide_edge_work {
struct Cache {
void* format; // format
} cache;
// clang-format off
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
c->daddiu(sp, sp, -32); // daddiu sp, sp, -32
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sd(fp, 8, sp); // sd fp, 8(sp)
c->mov64(fp, t9); // or fp, t9, r0
c->sq(gp, 16, sp); // sq gp, 16(sp)
c->mov64(gp, a0); // or gp, a0, r0
c->fprs[f0] = 0.707; // lwc1 f0, L95(fp)
c->addiu(v1, r0, 5); // addiu v1, r0, 5
// nop // sll r0, r0, 0
c->addiu(a0, r0, 56); // addiu a0, r0, 56
c->lwu(t3, 0, gp); // lwu t3, 0(gp)
c->addiu(a1, r0, 0); // addiu a1, r0, 0
c->daddiu(a2, gp, 6272); // daddiu a2, gp, 6272
c->addiu(a3, r0, 16); // addiu a3, r0, 16
c->lwu(t0, 0, t3); // lwu t0, 0(t3)
c->gprs[t1].du64[0] = 0; // or t1, r0, r0
c->lq(t2, 96, gp); // lq t2, 96(gp)
c->daddiu(t3, t3, 4908); // daddiu t3, t3, 4908
c->lq(t4, 112, gp); // lq t4, 112(gp)
block_1:
bc = c->sgpr64(t0) == 0; // beq t0, r0, L30
c->lwu(t5, 48, t3); // lwu t5, 48(t3)
if (bc) {goto block_14;} // branch non-likely
c->daddiu(t0, t0, -1); // daddiu t0, t0, -1
c->lqc2(vf1, 0, t3); // lqc2 vf1, 0(t3)
c->and_(t6, t5, a0); // and t6, t5, a0
c->lqc2(vf2, 16, t3); // lqc2 vf2, 16(t3)
bc = c->sgpr64(t6) == c->sgpr64(a1); // beq t6, a1, L29
c->lqc2(vf3, 32, t3); // lqc2 vf3, 32(t3)
if (bc) {goto block_5;} // branch non-likely
if (((s64)c->sgpr64(t6)) != ((s64)c->sgpr64(a3))) {// bnel t6, a3, L28
c->daddiu(t3, t3, 64); // daddiu t3, t3, 64
goto block_1;
}
block_5:
c->and_(t6, t5, v1); // and t6, t5, v1
c->vmini(DEST::xyzw, vf7, vf1, vf2); // vmini.xyzw vf7, vf1, vf2
bc = c->sgpr64(t6) != 0; // bne t6, r0, L28
c->vmax(DEST::xyzw, vf8, vf1, vf2); // vmax.xyzw vf8, vf1, vf2
if (bc) {goto block_1;} // branch non-likely
c->vsub(DEST::xyz, vf4, vf2, vf1); // vsub.xyz vf4, vf2, vf1
// nop // sll r0, r0, 0
c->vsub(DEST::xyz, vf5, vf3, vf1); // vsub.xyz vf5, vf3, vf1
// nop // sll r0, r0, 0
c->vmini(DEST::xyzw, vf7, vf7, vf3); // vmini.xyzw vf7, vf7, vf3
// nop // sll r0, r0, 0
c->vmax(DEST::xyzw, vf8, vf8, vf3); // vmax.xyzw vf8, vf8, vf3
// nop // sll r0, r0, 0
c->vopmula(vf4, vf5); // vopmula.xyz acc, vf4, vf5
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf7, vf7); // vftoi0.xyzw vf7, vf7
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf8, vf8); // vftoi0.xyzw vf8, vf8
// nop // sll r0, r0, 0
c->vopmsub(vf6, vf5, vf4); // vopmsub.xyz vf6, vf5, vf4
// nop // sll r0, r0, 0
c->mov128_gpr_vf(t7, vf7); // qmfc2.i t7, vf7
// nop // sll r0, r0, 0
c->mov128_gpr_vf(t6, vf8); // qmfc2.i t6, vf8
// nop // sll r0, r0, 0
c->pcgtw(t7, t7, t4); // pcgtw t7, t7, t4
c->mfc1(r0, f31); // mfc1 r0, f31
c->vmul(DEST::xyzw, vf9, vf6, vf6); // vmul.xyzw vf9, vf6, vf6
// nop // sll r0, r0, 0
c->pcgtw(t6, t2, t6); // pcgtw t6, t2, t6
c->mfc1(r0, f31); // mfc1 r0, f31
c->por(t6, t7, t6); // por t6, t7, t6
c->mfc1(r0, f31); // mfc1 r0, f31
c->ppach(t6, r0, t6); // ppach t6, r0, t6
c->mfc1(r0, f31); // mfc1 r0, f31
c->dsll(t6, t6, 16); // dsll t6, t6, 16
// nop // sll r0, r0, 0
if (((s64)c->sgpr64(t6)) != ((s64)0)) { // bnel t6, r0, L28
c->daddiu(t3, t3, 64); // daddiu t3, t3, 64
goto block_1;
}
// block_8:
c->vmula_bc(DEST::w, BC::x, vf0, vf9); // vmulax.w acc, vf0, vf9
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::w, BC::y, vf0, vf9); // vmadday.w acc, vf0, vf9
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::w, BC::z, vf9, vf0, vf9); // vmaddz.w vf9, vf0, vf9
// nop // sll r0, r0, 0
c->vrsqrt(vf0, BC::w, vf9, BC::w); // vrsqrt Q, vf0.w, vf9.w
// nop // sll r0, r0, 0
c->dsll32(t5, t5, 12); // dsll32 t5, t5, 12
c->dsrl32(t5, t5, 26); // dsrl32 t5, t5, 26
c->addiu(t6, r0, 2); // addiu t6, r0, 2
// nop // sll r0, r0, 0
c->vwaitq(); // vwaitq
// nop // sll r0, r0, 0
c->vmulq(DEST::xyz, vf6, vf6); // vmulq.xyz vf6, vf6, Q
// nop // sll r0, r0, 0
c->mov128_gpr_vf(t7, vf6); // qmfc2.i t7, vf6
// nop // sll r0, r0, 0
c->dsra32(t7, t7, 0); // dsra32 t7, t7, 0
// nop // sll r0, r0, 0
c->mtc1(f1, t7); // mtc1 f1, t7
// nop // sll r0, r0, 0
cop1_bc = c->fprs[f1] < c->fprs[f0]; // c.lt.s f1, f0
c->addiu(t7, r0, 48); // addiu t7, r0, 48
if (cop1_bc) { // bc1tl L28
c->daddiu(t3, t3, 64); // daddiu t3, t3, 64
goto block_1;
}
// block_10:
if (((s64)c->sgpr64(t5)) == ((s64)c->sgpr64(t6))) {// beql t5, t6, L28
c->daddiu(t3, t3, 64); // daddiu t3, t3, 64
goto block_1;
}
// block_12:
bc = c->sgpr64(t1) == c->sgpr64(t7); // beq t1, t7, L31
// nop // sll r0, r0, 0
if (bc) {goto block_15;} // branch non-likely
c->daddiu(t1, t1, 1); // daddiu t1, t1, 1
c->sw(t3, 0, a2); // sw t3, 0(a2)
// nop // sll r0, r0, 0
c->sqc2(vf6, 16, a2); // sqc2 vf6, 16(a2)
c->daddiu(a2, a2, 32); // daddiu a2, a2, 32
// nop // sll r0, r0, 0
//beq r0, r0, L28 // beq r0, r0, L28
c->daddiu(t3, t3, 64); // daddiu t3, t3, 64
goto block_1; // branch always
block_14:
//beq r0, r0, L32 // beq r0, r0, L32
c->sw(t1, 16, gp); // sw t1, 16(gp)
goto block_16; // branch always
block_15:
c->load_symbol(t9, cache.format); // lw t9, format(s7)
c->addiu(a0, r0, 0); // addiu a0, r0, 0
//daddiu a1, fp, L88 // daddiu a1, fp, L88
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
//c->jalr(call_addr); // jalr ra, t9
printf("ERROR: Exceeded max # of grabbable tris\n");
c->addiu(v1, r0, 48); // addiu v1, r0, 48
c->sw(v1, 16, gp); // sw v1, 16(gp)
block_16:
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->ld(fp, 8, sp); // ld fp, 8(sp)
c->lq(gp, 16, sp); // lq gp, 16(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 32); // daddiu sp, sp, 32
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.format = intern_from_c("format").c();
gLinkedFunctionTable.reg("(method 16 collide-edge-work)", execute, 128);
}
} // namespace method_16_collide_edge_work
} // namespace Mips2C

View file

@ -375,3 +375,513 @@ void link() {
} // namespace method_11_collide_mesh
} // namespace Mips2C
//--------------------------MIPS2C---------------------
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/kscheme.h"
namespace Mips2C {
namespace method_14_collide_mesh {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
// u32 call_addr = 0;
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->lwu(v1, 12, a0); // lwu v1, 12(a0)
// nop // sll r0, r0, 0
c->lwu(a0, 8, a0); // lwu a0, 8(a0)
// nop // sll r0, r0, 0
c->lqc2(vf1, 0, a1); // lqc2 vf1, 0(a1)
// nop // sll r0, r0, 0
c->lqc2(vf2, 16, a1); // lqc2 vf2, 16(a1)
// nop // sll r0, r0, 0
c->lqc2(vf3, 32, a1); // lqc2 vf3, 32(a1)
// nop // sll r0, r0, 0
c->lqc2(vf4, 48, a1); // lqc2 vf4, 48(a1)
// nop // sll r0, r0, 0
c->lqc2(vf5, 0, v1); // lqc2 vf5, 0(v1)
// nop // sll r0, r0, 0
c->lqc2(vf6, 16, v1); // lqc2 vf6, 16(v1)
// nop // sll r0, r0, 0
c->lqc2(vf7, 32, v1); // lqc2 vf7, 32(v1)
// nop // sll r0, r0, 0
c->lqc2(vf8, 48, v1); // lqc2 vf8, 48(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf9, 64, v1); // lqc2 vf9, 64(v1)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf5); // vmaddax.xyzw acc, vf1, vf5
c->lqc2(vf10, 80, v1); // lqc2 vf10, 80(v1)
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf5); // vmadday.xyzw acc, vf2, vf5
c->lqc2(vf11, 96, v1); // lqc2 vf11, 96(v1)
c->vmadd_bc(DEST::xyzw, BC::z, vf5, vf3, vf5); // vmaddz.xyzw vf5, vf3, vf5
c->lqc2(vf12, 112, v1); // lqc2 vf12, 112(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf6); // vmaddax.xyzw acc, vf1, vf6
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf6); // vmadday.xyzw acc, vf2, vf6
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf6, vf3, vf6); // vmaddz.xyzw vf6, vf3, vf6
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf7); // vmaddax.xyzw acc, vf1, vf7
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf7); // vmadday.xyzw acc, vf2, vf7
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf7, vf3, vf7); // vmaddz.xyzw vf7, vf3, vf7
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf8); // vmaddax.xyzw acc, vf1, vf8
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf8); // vmadday.xyzw acc, vf2, vf8
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf8, vf3, vf8); // vmaddz.xyzw vf8, vf3, vf8
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf13, vf5); // vftoi0.xyzw vf13, vf5
c->sqc2(vf5, 0, a2); // sqc2 vf5, 0(a2)
c->vftoi0(DEST::xyzw, vf14, vf6); // vftoi0.xyzw vf14, vf6
c->sqc2(vf6, 32, a2); // sqc2 vf6, 32(a2)
c->vftoi0(DEST::xyzw, vf15, vf7); // vftoi0.xyzw vf15, vf7
c->sqc2(vf7, 64, a2); // sqc2 vf7, 64(a2)
c->vftoi0(DEST::xyzw, vf16, vf8); // vftoi0.xyzw vf16, vf8
c->sqc2(vf8, 96, a2); // sqc2 vf8, 96(a2)
// nop // sll r0, r0, 0
c->sqc2(vf13, 16, a2); // sqc2 vf13, 16(a2)
c->daddiu(a0, a0, -4); // daddiu a0, a0, -4
c->sqc2(vf14, 48, a2); // sqc2 vf14, 48(a2)
c->daddiu(v1, v1, 128); // daddiu v1, v1, 128
c->sqc2(vf15, 80, a2); // sqc2 vf15, 80(a2)
bc = ((s64)c->sgpr64(a0)) <= 0; // blez a0, L20
c->sqc2(vf16, 112, a2); // sqc2 vf16, 112(a2)
if (bc) {goto block_3;} // branch non-likely
block_1:
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf5, 0, v1); // lqc2 vf5, 0(v1)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf9); // vmaddax.xyzw acc, vf1, vf9
c->lqc2(vf6, 16, v1); // lqc2 vf6, 16(v1)
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf9); // vmadday.xyzw acc, vf2, vf9
c->lqc2(vf7, 32, v1); // lqc2 vf7, 32(v1)
c->vmadd_bc(DEST::xyzw, BC::z, vf9, vf3, vf9); // vmaddz.xyzw vf9, vf3, vf9
c->lqc2(vf8, 48, v1); // lqc2 vf8, 48(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf10); // vmaddax.xyzw acc, vf1, vf10
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf10); // vmadday.xyzw acc, vf2, vf10
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf10, vf3, vf10); // vmaddz.xyzw vf10, vf3, vf10
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf11); // vmaddax.xyzw acc, vf1, vf11
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf11); // vmadday.xyzw acc, vf2, vf11
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf11, vf3, vf11); // vmaddz.xyzw vf11, vf3, vf11
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf12); // vmaddax.xyzw acc, vf1, vf12
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf12); // vmadday.xyzw acc, vf2, vf12
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf12, vf3, vf12); // vmaddz.xyzw vf12, vf3, vf12
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf17, vf9); // vftoi0.xyzw vf17, vf9
c->sqc2(vf9, 128, a2); // sqc2 vf9, 128(a2)
c->vftoi0(DEST::xyzw, vf18, vf10); // vftoi0.xyzw vf18, vf10
c->sqc2(vf10, 160, a2); // sqc2 vf10, 160(a2)
c->vftoi0(DEST::xyzw, vf19, vf11); // vftoi0.xyzw vf19, vf11
c->sqc2(vf11, 192, a2); // sqc2 vf11, 192(a2)
c->vftoi0(DEST::xyzw, vf20, vf12); // vftoi0.xyzw vf20, vf12
c->sqc2(vf12, 224, a2); // sqc2 vf12, 224(a2)
// nop // sll r0, r0, 0
c->sqc2(vf17, 144, a2); // sqc2 vf17, 144(a2)
c->daddiu(a0, a0, -4); // daddiu a0, a0, -4
c->sqc2(vf18, 176, a2); // sqc2 vf18, 176(a2)
// nop // sll r0, r0, 0
c->sqc2(vf19, 208, a2); // sqc2 vf19, 208(a2)
bc = ((s64)c->sgpr64(a0)) <= 0; // blez a0, L20
c->sqc2(vf20, 240, a2); // sqc2 vf20, 240(a2)
if (bc) {goto block_3;} // branch non-likely
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf9, 64, v1); // lqc2 vf9, 64(v1)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf5); // vmaddax.xyzw acc, vf1, vf5
c->lqc2(vf10, 80, v1); // lqc2 vf10, 80(v1)
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf5); // vmadday.xyzw acc, vf2, vf5
c->lqc2(vf11, 96, v1); // lqc2 vf11, 96(v1)
c->vmadd_bc(DEST::xyzw, BC::z, vf5, vf3, vf5); // vmaddz.xyzw vf5, vf3, vf5
c->lqc2(vf12, 112, v1); // lqc2 vf12, 112(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->daddiu(a2, a2, 256); // daddiu a2, a2, 256
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf6); // vmaddax.xyzw acc, vf1, vf6
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf6); // vmadday.xyzw acc, vf2, vf6
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf6, vf3, vf6); // vmaddz.xyzw vf6, vf3, vf6
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf7); // vmaddax.xyzw acc, vf1, vf7
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf7); // vmadday.xyzw acc, vf2, vf7
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf7, vf3, vf7); // vmaddz.xyzw vf7, vf3, vf7
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf8); // vmaddax.xyzw acc, vf1, vf8
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf8); // vmadday.xyzw acc, vf2, vf8
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf8, vf3, vf8); // vmaddz.xyzw vf8, vf3, vf8
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf13, vf5); // vftoi0.xyzw vf13, vf5
c->sqc2(vf5, 0, a2); // sqc2 vf5, 0(a2)
c->vftoi0(DEST::xyzw, vf14, vf6); // vftoi0.xyzw vf14, vf6
c->sqc2(vf6, 32, a2); // sqc2 vf6, 32(a2)
c->vftoi0(DEST::xyzw, vf15, vf7); // vftoi0.xyzw vf15, vf7
c->sqc2(vf7, 64, a2); // sqc2 vf7, 64(a2)
c->vftoi0(DEST::xyzw, vf16, vf8); // vftoi0.xyzw vf16, vf8
c->sqc2(vf8, 96, a2); // sqc2 vf8, 96(a2)
// nop // sll r0, r0, 0
c->sqc2(vf13, 16, a2); // sqc2 vf13, 16(a2)
c->daddiu(a0, a0, -4); // daddiu a0, a0, -4
c->sqc2(vf14, 48, a2); // sqc2 vf14, 48(a2)
c->daddiu(v1, v1, 128); // daddiu v1, v1, 128
c->sqc2(vf15, 80, a2); // sqc2 vf15, 80(a2)
bc = ((s64)c->sgpr64(a0)) > 0; // bgtz a0, L19
c->sqc2(vf16, 112, a2); // sqc2 vf16, 112(a2)
if (bc) {goto block_1;} // branch non-likely
block_3:
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
//jr ra // jr ra
c->daddu(sp, sp, r0); // daddu sp, sp, r0
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
gLinkedFunctionTable.reg("(method 14 collide-mesh)", execute, 128);
}
} // namespace method_14_collide_mesh
} // namespace Mips2C
//--------------------------MIPS2C---------------------
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/kscheme.h"
namespace Mips2C {
namespace method_15_collide_mesh {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
// u32 call_addr = 0;
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->lwu(v1, 12, a0); // lwu v1, 12(a0)
// nop // sll r0, r0, 0
c->lwu(a0, 8, a0); // lwu a0, 8(a0)
// nop // sll r0, r0, 0
c->lqc2(vf1, 0, a1); // lqc2 vf1, 0(a1)
// nop // sll r0, r0, 0
c->lqc2(vf2, 16, a1); // lqc2 vf2, 16(a1)
// nop // sll r0, r0, 0
c->lqc2(vf3, 32, a1); // lqc2 vf3, 32(a1)
// nop // sll r0, r0, 0
c->lqc2(vf4, 48, a1); // lqc2 vf4, 48(a1)
// nop // sll r0, r0, 0
c->lqc2(vf13, 0, a2); // lqc2 vf13, 0(a2)
// nop // sll r0, r0, 0
c->lqc2(vf14, 16, a2); // lqc2 vf14, 16(a2)
// nop // sll r0, r0, 0
c->lqc2(vf15, 32, a2); // lqc2 vf15, 32(a2)
// nop // sll r0, r0, 0
c->lqc2(vf16, 48, a2); // lqc2 vf16, 48(a2)
// nop // sll r0, r0, 0
c->lqc2(vf5, 0, v1); // lqc2 vf5, 0(v1)
// nop // sll r0, r0, 0
c->lqc2(vf6, 16, v1); // lqc2 vf6, 16(v1)
// nop // sll r0, r0, 0
c->lqc2(vf7, 32, v1); // lqc2 vf7, 32(v1)
// nop // sll r0, r0, 0
c->lqc2(vf8, 48, v1); // lqc2 vf8, 48(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf9, 64, v1); // lqc2 vf9, 64(v1)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf5); // vmaddax.xyzw acc, vf1, vf5
c->lqc2(vf10, 80, v1); // lqc2 vf10, 80(v1)
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf5); // vmadday.xyzw acc, vf2, vf5
c->lqc2(vf11, 96, v1); // lqc2 vf11, 96(v1)
c->vmadd_bc(DEST::xyzw, BC::z, vf5, vf3, vf5); // vmaddz.xyzw vf5, vf3, vf5
c->lqc2(vf12, 112, v1); // lqc2 vf12, 112(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf6); // vmaddax.xyzw acc, vf1, vf6
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf6); // vmadday.xyzw acc, vf2, vf6
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf6, vf3, vf6); // vmaddz.xyzw vf6, vf3, vf6
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf7); // vmaddax.xyzw acc, vf1, vf7
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf7); // vmadday.xyzw acc, vf2, vf7
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf7, vf3, vf7); // vmaddz.xyzw vf7, vf3, vf7
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf8); // vmaddax.xyzw acc, vf1, vf8
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf8); // vmadday.xyzw acc, vf2, vf8
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf8, vf3, vf8); // vmaddz.xyzw vf8, vf3, vf8
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
c->sqc2(vf5, 0, a3); // sqc2 vf5, 0(a3)
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf5); // vmaddax.xyzw acc, vf13, vf5
c->sqc2(vf6, 32, a3); // sqc2 vf6, 32(a3)
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf5); // vmadday.xyzw acc, vf14, vf5
c->sqc2(vf7, 64, a3); // sqc2 vf7, 64(a3)
c->vmadd_bc(DEST::xyzw, BC::z, vf5, vf15, vf5); // vmaddz.xyzw vf5, vf15, vf5
c->sqc2(vf8, 96, a3); // sqc2 vf8, 96(a3)
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf6); // vmaddax.xyzw acc, vf13, vf6
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf6); // vmadday.xyzw acc, vf14, vf6
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf6, vf15, vf6); // vmaddz.xyzw vf6, vf15, vf6
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf7); // vmaddax.xyzw acc, vf13, vf7
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf7); // vmadday.xyzw acc, vf14, vf7
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf7, vf15, vf7); // vmaddz.xyzw vf7, vf15, vf7
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf8); // vmaddax.xyzw acc, vf13, vf8
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf8); // vmadday.xyzw acc, vf14, vf8
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf8, vf15, vf8); // vmaddz.xyzw vf8, vf15, vf8
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf5, vf5); // vftoi0.xyzw vf5, vf5
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf6, vf6); // vftoi0.xyzw vf6, vf6
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf7, vf7); // vftoi0.xyzw vf7, vf7
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf8, vf8); // vftoi0.xyzw vf8, vf8
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->sqc2(vf5, 16, a3); // sqc2 vf5, 16(a3)
c->daddiu(a0, a0, -4); // daddiu a0, a0, -4
c->sqc2(vf6, 48, a3); // sqc2 vf6, 48(a3)
c->daddiu(v1, v1, 128); // daddiu v1, v1, 128
c->sqc2(vf7, 80, a3); // sqc2 vf7, 80(a3)
bc = ((s64)c->sgpr64(a0)) <= 0; // blez a0, L17
c->sqc2(vf8, 112, a3); // sqc2 vf8, 112(a3)
if (bc) {goto block_3;} // branch non-likely
block_1:
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf5, 0, v1); // lqc2 vf5, 0(v1)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf9); // vmaddax.xyzw acc, vf1, vf9
c->lqc2(vf6, 16, v1); // lqc2 vf6, 16(v1)
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf9); // vmadday.xyzw acc, vf2, vf9
c->lqc2(vf7, 32, v1); // lqc2 vf7, 32(v1)
c->vmadd_bc(DEST::xyzw, BC::z, vf9, vf3, vf9); // vmaddz.xyzw vf9, vf3, vf9
c->lqc2(vf8, 48, v1); // lqc2 vf8, 48(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf10); // vmaddax.xyzw acc, vf1, vf10
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf10); // vmadday.xyzw acc, vf2, vf10
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf10, vf3, vf10); // vmaddz.xyzw vf10, vf3, vf10
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf11); // vmaddax.xyzw acc, vf1, vf11
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf11); // vmadday.xyzw acc, vf2, vf11
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf11, vf3, vf11); // vmaddz.xyzw vf11, vf3, vf11
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf12); // vmaddax.xyzw acc, vf1, vf12
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf12); // vmadday.xyzw acc, vf2, vf12
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf12, vf3, vf12); // vmaddz.xyzw vf12, vf3, vf12
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
c->sqc2(vf9, 128, a3); // sqc2 vf9, 128(a3)
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf9); // vmaddax.xyzw acc, vf13, vf9
c->sqc2(vf10, 160, a3); // sqc2 vf10, 160(a3)
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf9); // vmadday.xyzw acc, vf14, vf9
c->sqc2(vf11, 192, a3); // sqc2 vf11, 192(a3)
c->vmadd_bc(DEST::xyzw, BC::z, vf9, vf15, vf9); // vmaddz.xyzw vf9, vf15, vf9
c->sqc2(vf12, 224, a3); // sqc2 vf12, 224(a3)
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf10); // vmaddax.xyzw acc, vf13, vf10
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf10); // vmadday.xyzw acc, vf14, vf10
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf10, vf15, vf10); // vmaddz.xyzw vf10, vf15, vf10
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf11); // vmaddax.xyzw acc, vf13, vf11
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf11); // vmadday.xyzw acc, vf14, vf11
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf11, vf15, vf11); // vmaddz.xyzw vf11, vf15, vf11
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf12); // vmaddax.xyzw acc, vf13, vf12
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf12); // vmadday.xyzw acc, vf14, vf12
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf12, vf15, vf12); // vmaddz.xyzw vf12, vf15, vf12
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf9, vf9); // vftoi0.xyzw vf9, vf9
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf10, vf10); // vftoi0.xyzw vf10, vf10
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf11, vf11); // vftoi0.xyzw vf11, vf11
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf12, vf12); // vftoi0.xyzw vf12, vf12
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->sqc2(vf9, 144, a3); // sqc2 vf9, 144(a3)
c->daddiu(a0, a0, -4); // daddiu a0, a0, -4
c->sqc2(vf10, 176, a3); // sqc2 vf10, 176(a3)
// nop // sll r0, r0, 0
c->sqc2(vf11, 208, a3); // sqc2 vf11, 208(a3)
bc = ((s64)c->sgpr64(a0)) <= 0; // blez a0, L17
c->sqc2(vf12, 240, a3); // sqc2 vf12, 240(a3)
if (bc) {goto block_3;} // branch non-likely
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf9, 64, v1); // lqc2 vf9, 64(v1)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf5); // vmaddax.xyzw acc, vf1, vf5
c->lqc2(vf10, 80, v1); // lqc2 vf10, 80(v1)
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf5); // vmadday.xyzw acc, vf2, vf5
c->lqc2(vf11, 96, v1); // lqc2 vf11, 96(v1)
c->vmadd_bc(DEST::xyzw, BC::z, vf5, vf3, vf5); // vmaddz.xyzw vf5, vf3, vf5
c->lqc2(vf12, 112, v1); // lqc2 vf12, 112(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->daddiu(a3, a3, 256); // daddiu a3, a3, 256
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf6); // vmaddax.xyzw acc, vf1, vf6
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf6); // vmadday.xyzw acc, vf2, vf6
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf6, vf3, vf6); // vmaddz.xyzw vf6, vf3, vf6
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf7); // vmaddax.xyzw acc, vf1, vf7
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf7); // vmadday.xyzw acc, vf2, vf7
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf7, vf3, vf7); // vmaddz.xyzw vf7, vf3, vf7
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf8); // vmaddax.xyzw acc, vf1, vf8
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf8); // vmadday.xyzw acc, vf2, vf8
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf8, vf3, vf8); // vmaddz.xyzw vf8, vf3, vf8
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
c->sqc2(vf5, 0, a3); // sqc2 vf5, 0(a3)
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf5); // vmaddax.xyzw acc, vf13, vf5
c->sqc2(vf6, 32, a3); // sqc2 vf6, 32(a3)
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf5); // vmadday.xyzw acc, vf14, vf5
c->sqc2(vf7, 64, a3); // sqc2 vf7, 64(a3)
c->vmadd_bc(DEST::xyzw, BC::z, vf5, vf15, vf5); // vmaddz.xyzw vf5, vf15, vf5
c->sqc2(vf8, 96, a3); // sqc2 vf8, 96(a3)
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf6); // vmaddax.xyzw acc, vf13, vf6
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf6); // vmadday.xyzw acc, vf14, vf6
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf6, vf15, vf6); // vmaddz.xyzw vf6, vf15, vf6
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf7); // vmaddax.xyzw acc, vf13, vf7
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf7); // vmadday.xyzw acc, vf14, vf7
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf7, vf15, vf7); // vmaddz.xyzw vf7, vf15, vf7
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf16, vf0); // vmulaw.xyzw acc, vf16, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf13, vf8); // vmaddax.xyzw acc, vf13, vf8
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf14, vf8); // vmadday.xyzw acc, vf14, vf8
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf8, vf15, vf8); // vmaddz.xyzw vf8, vf15, vf8
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf5, vf5); // vftoi0.xyzw vf5, vf5
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf6, vf6); // vftoi0.xyzw vf6, vf6
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf7, vf7); // vftoi0.xyzw vf7, vf7
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf8, vf8); // vftoi0.xyzw vf8, vf8
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->sqc2(vf5, 16, a3); // sqc2 vf5, 16(a3)
c->daddiu(a0, a0, -4); // daddiu a0, a0, -4
c->sqc2(vf6, 48, a3); // sqc2 vf6, 48(a3)
c->daddiu(v1, v1, 128); // daddiu v1, v1, 128
c->sqc2(vf7, 80, a3); // sqc2 vf7, 80(a3)
bc = ((s64)c->sgpr64(a0)) > 0; // bgtz a0, L16
c->sqc2(vf8, 112, a3); // sqc2 vf8, 112(a3)
if (bc) {goto block_1;} // branch non-likely
block_3:
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
//jr ra // jr ra
c->daddu(sp, sp, r0); // daddu sp, sp, r0
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
gLinkedFunctionTable.reg("(method 15 collide-mesh)", execute, 128);
}
} // namespace method_15_collide_mesh
} // namespace Mips2C

View file

@ -833,7 +833,7 @@ u64 execute(void* ctxt) {
block_40:
// Unknown instr: vcallms 54
fmt::print("vcallms54\n");
// fmt::print("vcallms54\n");
// nop | maddx.xyz vf19, vf04, vf00
c->vmadd_bc(DEST::xyz, BC::w, vf19, vf4, vf0);
// nop | mulaw.xyzw ACC, vf20, vf00

View file

@ -759,6 +759,15 @@ struct ExecutionContext {
}
}
void vabs(DEST mask, int dst, int src) {
auto s = vf_src(src);
for (int i = 0; i < 4; i++) {
if ((u64)mask & (1 << i)) {
vfs[dst].f[i] = std::abs(s.f[i]);
}
}
}
void vrnext(DEST mask, int dst) {
gRng.advance();
float r = gRng.R;
@ -988,7 +997,7 @@ struct ExecutionContext {
void adds(int dst, int src0, int src1) { fprs[dst] = fprs[src0] + fprs[src1]; }
void subs(int dst, int src0, int src1) { fprs[dst] = fprs[src0] - fprs[src1]; }
void divs(int dst, int src0, int src1) {
assert(fprs[src1] != 0);
// assert(fprs[src1] != 0);
fprs[dst] = fprs[src0] / fprs[src1];
}
void negs(int dst, int src) {
@ -998,6 +1007,8 @@ struct ExecutionContext {
memcpy(&fprs[dst], &v, 4);
}
void movs(int dst, int src) { fprs[dst] = fprs[src]; }
void cvtws(int dst, int src) {
// float to int
s32 value = fprs[src];

View file

@ -124,6 +124,73 @@ namespace collide_probe_instance_tie {
extern void link();
}
namespace method_26_collide_cache {
extern void link();
}
namespace method_32_collide_cache {
extern void link();
}
namespace pc_upload_collide_frag {
extern void link();
}
namespace method_28_collide_cache {
extern void link();
}
namespace method_27_collide_cache {
extern void link();
}
namespace method_29_collide_cache {
extern void link();
}
namespace method_12_collide_shape_prim_mesh {
extern void link();
}
namespace method_14_collide_shape_prim_mesh {
extern void link();
}
namespace method_13_collide_shape_prim_mesh {
extern void link();
}
namespace method_30_collide_cache {
extern void link();
}
namespace method_9_collide_cache_prim {
extern void link();
}
namespace method_10_collide_cache_prim {
extern void link();
}
namespace method_10_collide_puss_work {
extern void link();
}
namespace method_9_collide_puss_work {
extern void link();
}
namespace method_15_collide_mesh {
extern void link();
}
namespace method_14_collide_mesh {
extern void link();
}
namespace method_16_collide_edge_work {
extern void link();
}
LinkedFunctionTable gLinkedFunctionTable;
Rng gRng;
std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks = {
@ -143,7 +210,17 @@ std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks =
{"time-of-day", {time_of_day_interp_colors_scratch::link}},
{"collide-func", {collide_do_primitives::link, moving_sphere_triangle_intersect::link}},
{"collide-probe", {collide_probe_node::link, collide_probe_instance_tie::link}},
{"collide-mesh", {method_12_collide_mesh::link, method_11_collide_mesh::link}}};
{"collide-mesh",
{method_12_collide_mesh::link, method_11_collide_mesh::link, method_15_collide_mesh::link,
method_14_collide_mesh::link}},
{"collide-cache",
{method_26_collide_cache::link, method_32_collide_cache::link, pc_upload_collide_frag::link,
method_28_collide_cache::link, method_27_collide_cache::link, method_29_collide_cache::link,
method_12_collide_shape_prim_mesh::link, method_14_collide_shape_prim_mesh::link,
method_13_collide_shape_prim_mesh::link, method_30_collide_cache::link,
method_9_collide_cache_prim::link, method_10_collide_cache_prim::link,
method_10_collide_puss_work::link, method_9_collide_puss_work::link}},
{"collide-edge-grab", {method_16_collide_edge_work::link}}};
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
const auto& it = m_executes.insert({name, {exec, Ptr<u8>()}});

View file

@ -85,6 +85,12 @@ void* RPC_Loader(unsigned int /*fno*/, void* data, int size) {
printf("IOP language: %s\n", gLanguage); // added.
break;
}
case SoundCommand::LOAD_MUSIC:
printf("ignoring load music\n");
break;
case SoundCommand::UNLOAD_MUSIC:
printf("ignoring unload music\n");
break;
default:
printf("Unhandled RPC Loader command %d\n", (int)cmd->command);
assert(false);

View file

@ -50,3 +50,14 @@
)
)
(define-extern cam-debug-add-los-tri (function (inline-array collide-cache-tri) vector vector none))
(defun cam-debug-add-los-tri ((a (inline-array collide-cache-tri)) (b vector) (c vector))
(none)
)
(defun cam-collision-record-save ((a vector) (b vector) (c int) (d symbol) (e camera-slave))
(none)
)
(define-extern slave-los-state->string (function slave-los-state string))
(define-extern cam-debug-reset-coll-tri (function none)) ;; not confirmed

View file

@ -1962,9 +1962,12 @@
(when *debug-segment*
(let ((a1-22 (new 'stack-no-clear 'vector)))
(vector-! a1-22 (-> self good-point) (-> self string-trans))
(when (nonzero? cam-collision-record-save)
;; HACK
(cam-collision-record-save (-> self string-trans) a1-22 -3 'jump self)
)
)
)
(set! (-> self desired-pos quad) (-> self good-point quad))
(set! (-> self string-trans quad) (-> self good-point quad))
(vector-! (-> self view-flat) (-> self string-trans) (-> *camera* tpos-curr-adj))
@ -2697,8 +2700,10 @@
(defbehavior cam-string-code camera-slave ()
(if *debug-segment*
(when (nonzero? cam-debug-reset-coll-tri) ;; hack
(cam-debug-reset-coll-tri)
)
)
(cam-string-follow)
(if (logtest? (-> self options) 512)
(cam-string-line-of-sight)

View file

@ -156,7 +156,7 @@
(print-nth-point (_type_ int) none 11)
(TODO-RENAME-12 (_type_) none 12)
(TODO-RENAME-13 (_type_ int) none 13)
(TODO-RENAME-14 (_type_ vector) none 14)
(TODO-RENAME-14 (_type_ tracking-spline-sampler) none 14)
(TODO-RENAME-15 (_type_) none 15)
(TODO-RENAME-16 (_type_ float) none 16)
(TODO-RENAME-17 (_type_ vector float float symbol) int 17)

File diff suppressed because it is too large Load diff

View file

@ -10,11 +10,6 @@
(define-extern collide-cache-using-box-test (function vector symbol))
;; The collide cache system tries to make collision queries faster by caching intermediate results.
;; Almost all collision operations are done by calling a method of the global *collide-cache*.
;; In cases where the collide cache does not have the data in its cache, it will fill itself
;; using the appropriate collision functions.
;;;;;;;;;;;;;;;;;;;;;;;
;; Collide Helpers
@ -55,8 +50,8 @@
:size-assert #xc60
:flag-assert #xb00000c60
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-9 (_type_ object object) symbol 9)
(dummy-10 (_type_ object object) symbol 10)
)
)
@ -81,10 +76,11 @@
;; This is a common return type of collision queries.
(deftype collide-cache-tri (structure)
((vertex vector 3 :inline :offset-assert 0) ;; actual locations
(pat pat-surface :offset-assert 48) ;; metadata about the surface of this tri
(prim-index uint16 :offset-assert 52) ;; in the collide-cache-prim list
(user16 uint16 :offset-assert 54)
(user32 uint32 2 :offset-assert 56)
(extra-quad uint128 :offset 48)
(pat pat-surface :offset 48) ;; metadata about the surface of this tri
(prim-index uint16 :offset 52) ;; in the collide-cache-prim list
(user16 uint16 :offset 54)
(user32 uint32 2 :offset 56)
)
:method-count-assert 9
:size-assert #x40
@ -95,13 +91,13 @@
;; The "core" is extracted from the normal collide-shape-prim and placed inline here.
(deftype collide-cache-prim (structure)
((prim-core collide-prim-core :inline :offset-assert 0)
(ccache collide-cache :offset-assert 32)
(prim collide-shape-prim :offset-assert 36)
(first-tri uint16 :offset-assert 40)
(num-tris uint16 :offset-assert 42)
(unused uint8 4 :offset-assert 44)
(extra-quad uint128 :offset-assert 32)
(ccache collide-cache :offset 32)
(prim collide-shape-prim :offset 36)
(first-tri uint16 :offset 40)
(num-tris uint16 :offset 42)
(unused uint8 4 :offset 44)
(world-sphere vector :inline :offset 0)
;; overlays of the core
(collide-as collide-kind :offset 16)
(action collide-action :offset 24)
(offense collide-offense :offset 28)
@ -136,7 +132,7 @@
(:methods
(debug-draw (_type_) none 9)
(fill-and-probe-using-line-sphere (_type_ vector vector float collide-kind process collide-tri-result int) float 10)
(fill-and-probe-using-spheres (_type_ collide-using-spheres-params) none 11)
(fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol 11)
(fill-and-probe-using-y-probe (_type_ vector float collide-kind process collide-tri-result uint) float 12)
(fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none 13)
(fill-using-line-sphere (_type_ vector vector float collide-kind process-drawable int) none 14)
@ -144,20 +140,20 @@
(fill-using-y-probe (_type_ vector float collide-kind process-drawable uint) none 16)
(initialize (_type_) none 17)
(probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result int) float 18)
(probe-using-spheres (_type_) none 19)
(probe-using-spheres (_type_ collide-using-spheres-params) symbol 19)
(probe-using-y-probe (_type_ vector float collide-kind collide-tri-result uint) float 20)
(fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache none)) none 21) ;; second functiom is method 28
(fill-from-foreground-using-spheres (_type_) none 22)
(fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache object none)) none 21) ;; second functiom is method 28
(fill-from-foreground-using-box (_type_) none 22)
(fill-from-foreground-using-line-sphere (_type_) none 23)
(fill-from-foreground-using-y-probe (_type_) none 24)
(fill-from-water (_type_ water-control) none 25) ;; or whatever is from 152 in the process passed to 16
(dummy-26 (_type_) none 26)
(load-mesh-from-spad-in-box (_type_ collide-frag-mesh) none 26)
(dummy-27 (_type_) none 27)
(dummy-28 (_type_) none 28)
(dummy-29 (_type_ collide-frag-mesh) none 29)
(dummy-30 (_type_) none 30)
(dummy-31 (_type_ collide-puyp-work collide-cache-prim) vector 31)
(dummy-32 (_type_) none 32)
(puyp-mesh (_type_ collide-puyp-work collide-cache-prim) none 30)
(puyp-sphere (_type_ collide-puyp-work collide-cache-prim) vector 31)
(unpack-background-collide-mesh (_type_ object object object) none 32) ;; helper for fill from background.
)
)

File diff suppressed because it is too large Load diff

View file

@ -83,7 +83,7 @@
:flag-assert #xb00000810
(:methods
(debug-draw (_type_) object 9)
(dummy-10 () none 10)
(dummy-10 (_type_ collide-edge-hold-item) none 10)
)
)
@ -125,12 +125,12 @@
(debug-draw-edges (_type_) object 10)
(dummy-11 (_type_) none 11)
(debug-draw-sphere (_type_) symbol 12)
(dummy-13 (_type_) none 13)
(dummy-13 (_type_ collide-edge-hold-item vector) none 13)
(dummy-14 (_type_ vector vector int) float 14)
(dummy-15 (_type_) none 15)
(dummy-16 (_type_) none 16)
(find-grabbable-tris! (_type_) none 16)
(dummy-17 (_type_) none 17)
(dummy-18 (_type_) none 18)
(dummy-18 (_type_ collide-edge-hold-list edge-grab-info) none 18)
(dummy-19 (_type_ collide-edge-hold-item edge-grab-info) symbol 19)
)
)

View file

@ -86,3 +86,9 @@
(set! (-> v1-2 touch-hook) nothing)
(set! (-> v1-2 active-hook) nothing)
)
(defmethod find-edge-grabs! target ((obj target) (arg0 collide-cache))
(format *stdcon* "no edge grabs for you!~%")
(the object 0)
)

View file

@ -106,3 +106,292 @@
)
(defmethod-mips2c "(method 11 collide-mesh)" 11 collide-mesh)
(defmethod-mips2c "(method 14 collide-mesh)" 11 collide-mesh)
(defmethod-mips2c "(method 15 collide-mesh)" 11 collide-mesh)
(defmethod allocate! collide-mesh-cache ((obj collide-mesh-cache) (arg0 int))
(local-vars (a1-2 int) (a2-2 int))
(let* ((v1-0 (+ arg0 15))
(a1-1 (-> obj used-size))
(v1-1 (/ v1-0 16))
(a3-0 (-> obj data))
(a2-0 (-> obj max-size))
(v1-2 (* v1-1 16))
(a3-1 (&+ a3-0 a1-1))
)
(let ((t1-0 (- a2-0 (the-as uint v1-2)))
(t0-0 (-> obj id))
)
(b! (< (the-as int t1-0) 0) cfg-6 :delay (set! a1-2 (the-as int (+ a1-1 v1-2))))
(b! (>= (the-as int (- a2-0 (the-as uint a1-2))) 0) cfg-5 :delay (set! a2-2 (the-as int (+ t0-0 1))))
)
(b! (zero? (the-as uint a2-2)) cfg-4 :likely-delay (set! a2-2 1))
(label cfg-4)
(set! a1-2 v1-2)
(set! a3-1 (-> obj data))
(set! (-> obj id) (the-as uint a2-2))
(label cfg-5)
(set! (-> obj used-size) (the-as uint a1-2))
(let ((v0-0 a3-1))
(b! #t cfg-7 :delay (nop!))
(label cfg-6)
(format 0 "ERROR: Attempted to allocate something bigger than the entire mesh cache!~%")
(set! v0-0 (the-as (pointer uint8) #f))
(label cfg-7)
(the-as int v0-0)
)
)
)
(defmethod populate-cache! collide-mesh ((obj collide-mesh) (arg0 collide-mesh-cache-tri) (arg1 matrix))
(local-vars (t0-2 uint))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :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)
(nop!)
(let ((t0-0 (scratchpad-object int))
(v1-0 (-> obj num-verts))
)
(nop!)
(let ((a3-0 (-> obj vertex-data)))
(b! (zero? v1-0) cfg-3 :delay (.lvf vf1 (&-> arg1 vector 0 quad)))
(nop!)
(.lvf vf2 (&-> arg1 vector 1 quad))
(let ((t0-1 (+ t0-0 -64)))
(.lvf vf3 (&-> arg1 vector 2 quad))
(nop!)
(.lvf vf4 (&-> arg1 vector 3 quad))
(nop!)
(.lvf vf5 (&-> a3-0 0 quad))
(nop!)
(.lvf vf6 (&-> a3-0 1 quad))
(nop!)
(.lvf vf7 (&-> a3-0 2 quad))
(nop!)
(.lvf vf8 (&-> a3-0 3 quad))
(label cfg-2)
(.mul.w.vf acc vf4 vf0)
(set! a3-0 (the-as (inline-array vector) (-> a3-0 4)))
(.add.mul.x.vf acc vf1 vf5 acc)
(+! t0-1 64)
(.add.mul.y.vf acc vf2 vf5 acc)
(nop!)
(.add.mul.z.vf vf9 vf3 vf5 acc)
(nop!)
(.mul.w.vf acc vf4 vf0)
(.lvf vf5 (&-> a3-0 0 quad))
(.add.mul.x.vf acc vf1 vf6 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf6 acc)
(nop!)
(.add.mul.z.vf vf10 vf3 vf6 acc)
(nop!)
(.mul.w.vf acc vf4 vf0)
(.lvf vf6 (&-> a3-0 1 quad))
(.add.mul.x.vf acc vf1 vf7 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf7 acc)
(nop!)
(.add.mul.z.vf vf11 vf3 vf7 acc)
(nop!)
(.mul.w.vf acc vf4 vf0)
(.lvf vf7 (&-> a3-0 2 quad))
(.add.mul.x.vf acc vf1 vf8 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf8 acc)
(nop!)
(.add.mul.z.vf vf12 vf3 vf8 acc)
(nop!)
(nop!)
(.lvf vf8 (&-> a3-0 3 quad))
(+! v1-0 -4)
(.svf t0-1 vf9)
(nop!)
(.svf (+ t0-1 16) vf10)
(nop!)
(.svf (+ t0-1 32) vf11)
(b! (> (the-as int v1-0) 0) cfg-2 :delay (.svf (+ t0-1 48) vf12))
)
)
)
(label cfg-3)
(let ((v1-1 (the-as collide-mesh-tri (-> obj tris))))
(nop!)
(let ((a2-1 (scratchpad-object int))
(a0-1 (-> obj num-tris))
)
(b! (zero? a0-1) cfg-6 :delay (set! t0-2 (-> v1-1 vertex-index 0)))
(let* ((a1-1 (&+ arg0 -96))
(a3-1 (-> v1-1 vertex-index 1))
(t0-3 (* t0-2 16))
(t2-0 (-> v1-1 vertex-index 2))
(t1-0 (* a3-1 16))
(a3-2 (-> v1-1 pat))
)
(let* ((t2-1 (* t2-0 16))
(t0-4 (+ t0-3 a2-1))
(t1-1 (+ t1-0 a2-1))
(t2-2 (+ t2-1 a2-1))
)
(label cfg-5)
(+! a0-1 -1)
(.lvf vf1 t0-4)
(&+! v1-1 8)
(.lvf vf2 t1-1)
(&+! a1-1 96)
(.lvf vf3 t2-2)
(.sub.vf vf4 vf2 vf1)
(.svf (&-> a1-1 vertex 0 quad) vf1)
(.min.vf vf8 vf1 vf2)
(.svf (&-> a1-1 vertex 1 quad) vf2)
(.sub.vf vf5 vf3 vf1)
(.svf (&-> a1-1 vertex 2 quad) vf3)
(.max.vf vf9 vf1 vf2)
(let ((t1-2 (-> v1-1 vertex-index 0)))
(.outer.product.a.vf acc vf4 vf5)
(let ((t2-3 (-> v1-1 vertex-index 1)))
(.outer.product.b.vf vf6 vf5 vf4 acc)
(let ((t0-5 (-> v1-1 vertex-index 2)))
(.mul.vf vf7 vf6 vf6)
(nop!)
(.min.vf vf8 vf8 vf3)
(let ((t1-3 (* t1-2 16)))
(.max.vf vf9 vf9 vf3)
(let ((t2-4 (* t2-3 16)))
(.mul.x.vf acc vf0 vf7 :mask #b1000)
(let ((t3-0 (* t0-5 16)))
(.add.mul.y.vf acc vf0 vf7 acc :mask #b1000)
(set! t0-4 (+ t1-3 a2-1))
(.add.mul.z.vf vf7 vf0 vf7 acc :mask #b1000)
(set! t1-1 (+ t2-4 a2-1))
(.isqrt.vf Q vf0 vf7 :fsf #b11 :ftf #b11)
(set! t2-2 (+ t3-0 a2-1))
)
)
)
)
)
)
)
(.ftoi.vf vf8 vf8)
(nop!)
(.ftoi.vf vf9 vf9)
(nop!)
(nop!)
(.svf (&-> a1-1 bbox4w min quad) vf8)
(.wait.vf)
(.svf (&-> a1-1 bbox4w max quad) vf9)
(.mul.vf vf6 vf6 Q :mask #b111)
(nop!)
(nop!)
(.svf (&-> a1-1 normal quad) vf6)
(nop!)
(set! (-> a1-1 normal w) (the-as float a3-2))
(b! (nonzero? a0-1) cfg-5 :delay (set! a3-2 (-> v1-1 pat)))
)
)
)
(label cfg-6)
0
(none)
)
)
(defmethod overlap-test collide-mesh ((obj collide-mesh) (arg0 collide-mesh-cache-tri) (arg1 vector))
(local-vars
(zero uint128)
(v1-0 uint128)
(a0-1 uint128)
(a1-2 uint128)
(a1-3 uint128)
(a1-4 uint128)
(a1-7 uint)
(a2-1 uint128)
(a2-2 uint128)
)
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(set! zero (the-as uint128 0))
(let ((s5-0 (new 'stack-no-clear 'matrix))
(s4-0 arg0)
)
(.lvf vf2 (&-> arg1 quad))
(let ((s3-0 (-> obj num-tris)))
(.sub.w.vf vf5 vf2 vf2)
(.add.w.vf vf6 vf2 vf2)
(.ftoi.vf vf5 vf5)
(.ftoi.vf vf6 vf6)
(.mov v1-0 vf5)
(.svf (&-> s5-0 vector 1 quad) vf5)
(.mov a0-1 vf6)
(.svf (&-> s5-0 vector 2 quad) vf6)
(label cfg-1)
(b! (zero? s3-0) cfg-7 :delay (set! a2-1 (-> s4-0 bbox4w min quad)))
(+! s3-0 -1)
)
(let ((a1-1 (-> s4-0 bbox4w max quad)))
(.pcgtw a2-2 a2-1 a0-1)
(.pcgtw a1-2 v1-0 a1-1)
)
(.por a1-3 a2-2 a1-2)
(nop!)
(.ppach a1-4 zero a1-3)
(let ((a1-5 (shl (the-as int a1-4) 16)))
(nop!)
(b! (nonzero? a1-5) cfg-1 :likely-delay (set! s4-0 (&+ s4-0 96)))
)
(closest-pt-in-triangle
(the-as vector (-> s5-0 vector))
arg1
(the-as matrix (-> s4-0 vertex))
(-> s4-0 normal)
)
(.lvf vf1 (&-> s5-0 vector 0 quad))
(.lvf vf2 (&-> arg1 quad))
(set! v1-0 (-> s5-0 vector 1 quad))
(set! a0-1 (-> s5-0 vector 2 quad))
(.sub.vf vf3 vf2 vf1)
(.mul.w.vf vf4 vf2 vf2 :mask #b1000)
(.mul.vf vf3 vf3 vf3)
(.mul.x.vf acc vf0 vf3 :mask #b1000)
(.add.mul.y.vf acc vf0 vf3 acc :mask #b1000)
(.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000)
(.sub.w.vf vf3 vf3 vf4 :mask #b1000)
(.add.w.vf vf3 vf0 vf3 :mask #b10)
(.mov a1-7 vf3)
(b! (>= (the-as int a1-7) 0) cfg-1 :delay (set! s4-0 (&+ s4-0 96)))
)
(let ((v0-1 #t))
(b! #t cfg-8 :delay (nop!))
(the-as none 0)
(label cfg-7)
(set! v0-1 #f)
(label cfg-8)
v0-1
)
)
)

View file

@ -11,3 +11,389 @@
;; TODO - for collide-reaction-racer
(define-extern collide-shape-moving-angle-set! (function collide-shape-moving vector vector none)) ;; not confirmed
(defun collide-shape-moving-angle-set! ((arg0 collide-shape-moving) (arg1 vector) (arg2 vector))
(set! (-> arg0 surface-normal quad) (-> arg1 quad))
(set! (-> arg0 surface-angle) (vector-dot arg1 (-> arg0 dynam gravity-normal)))
(set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal)))
(set! (-> arg0 touch-angle)
(fmax
(-> arg0 touch-angle)
(vector-dot arg1 (vector-normalize! (vector-negate! (new-stack-vector0) arg2) 1.0))
)
)
0
(none)
)
(defun target-collision-low-coverage ((arg0 control-info)
(arg1 collide-shape-intersect)
(arg2 vector)
(arg3 (pointer uint32))
(arg4 (pointer uint64))
(arg5 (pointer symbol))
)
(local-vars
(sv-16 vector)
(sv-20 (pointer uint32))
(sv-24 (pointer uint64))
(sv-28 (pointer symbol))
(sv-32 uint)
(sv-40 uint)
(sv-48 symbol)
(sv-52 vector)
(sv-56 vector)
(sv-160 vector)
(sv-164 collide-tri-result)
(sv-208 vector)
(sv-212 vector)
(sv-272 vector)
(sv-276 vector)
)
(set! sv-16 arg2)
(set! sv-20 arg3)
(set! sv-24 arg4)
(set! sv-28 arg5)
(set! sv-32 (-> arg3 0))
(set! sv-40 (-> arg4 0))
(set! sv-48 (-> arg5 0))
(set! sv-52 (-> arg0 unknown-vector60))
(set! sv-56 (vector-cross! (-> arg0 unknown-vector-coverage-2) (-> arg0 poly-normal) sv-16))
(vector-normalize! sv-56 1.0)
(if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866)
(set! sv-32 (logior sv-32 512))
)
(vector-cross! sv-52 sv-16 sv-56)
(if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) sv-52))
(vector-negate! sv-52 sv-52)
)
(vector-normalize! sv-52 1.0)
(set! sv-160 (vector-flatten! (-> arg0 unknown-vector-coverage-3) sv-52 (-> arg0 dynam gravity-normal)))
(set! sv-164 (new 'stack 'collide-tri-result))
(vector-normalize! sv-160 1.0)
(if (< (vector-dot sv-160 sv-16) 0.0)
(vector-negate! sv-160 sv-160)
)
(set! (-> arg0 unknown-float-coverage-0) 4095996000.0)
(set! (-> arg0 unknown-float-coverage-2) 4095996000.0)
(set! sv-208 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) sv-160 2867.2))
(set! sv-212 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0))
(vector+float*! sv-212 sv-212 sv-160 4096.0)
(when (>= (probe-using-line-sphere *collide-cache* sv-208 sv-212 409.6 (-> arg1 best-from-prim collide-with) sv-164 1)
0.0
)
(set! (-> arg0 unknown-float-coverage-0)
(vector-dot
(-> arg0 dynam gravity-normal)
(vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> sv-164 intersect))
)
)
(set! (-> arg0 unknown-float-coverage-1) (the-as float (-> sv-164 pat)))
(set! (-> arg0 unknown-vector-coverage-0 quad) (-> sv-164 normal quad))
0
)
(set! sv-272 (vector+float*!
(new 'stack-no-clear 'vector)
(-> arg1 best-tri intersect)
(-> arg0 dynam gravity-normal)
819.2
)
)
(set! sv-276 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0))
(vector+float*! sv-272 sv-272 sv-160 -819.2)
(vector+float*! sv-276 sv-276 sv-160 -4096.0)
(when (>= (probe-using-line-sphere *collide-cache* sv-272 sv-276 409.6 (-> arg1 best-from-prim collide-with) sv-164 1)
0.0
)
(set! (-> arg0 unknown-float-coverage-2) (vector-vector-distance sv-272 (-> sv-164 intersect)))
(set! (-> arg0 unknown-u32-coverage-0) (the-as uint (-> sv-164 pat)))
(set! (-> arg0 unknown-vector-coverage-1 quad) (-> sv-164 normal quad))
0
)
(when (and (zero? (logand sv-32 512))
(and (or (< (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0))
(= (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61) 1)
)
(and (< (-> arg0 unknown-float-coverage-2) (* 2.0 (-> arg1 best-from-prim local-sphere w)))
(zero? (shr (shl (-> arg0 unknown-u32-coverage-0) 58) 61))
)
)
)
(set! sv-32 (logior sv-32 128))
(set! (-> arg0 unknown-dword-coverage) (-> *display* base-frame-counter))
(set! sv-40 (logior sv-40 128))
(set! (-> arg0 unknown-dword21) (-> *display* base-frame-counter))
(let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector22)))
(f0-21 (if (logtest? sv-32 2)
(cos (- 16384.0 (acos (-> arg0 coverage))))
(-> arg0 coverage)
)
)
(f1-11 (vector-dot
(-> arg0 dynam gravity-normal)
(vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-tri intersect))
)
)
)
(if (or (zero? (logand sv-32 32)) (< 0.5 f0-21))
(set! sv-48 (the-as symbol #f))
)
(when (and (or (and (< f0-21 0.95) (>= f30-0 0.0))
(and (logtest? sv-32 32) (< f0-21 0.3))
(< f1-11 (* -0.25 (-> arg1 best-from-prim local-sphere w)))
)
(>= (vector-dot sv-52 sv-16) -0.000001)
)
(set! (-> arg0 surf) *edge-surface*)
(set! sv-32 (logior sv-32 1024))
(set! sv-48 (the-as symbol #f))
(when (logtest? sv-32 32)
(set! sv-48 #t)
(set! sv-32 (logior sv-32 4096))
)
)
)
)
(if (< (-> arg0 surface-angle) 0.0)
(set! sv-48 #t)
)
(when sv-48
(cond
((and (or (= (-> arg0 poly-pat mode) (pat-mode ground))
(and (logtest? sv-32 8)
(>= (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0))
(zero? (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61))
(< 0.3 (fabs (-> arg0 surface-angle)))
)
)
(zero? (logand sv-32 128))
)
(set! sv-32 (logior sv-32 64))
(set! sv-40 (logior sv-40 128))
(set! (-> arg0 unknown-dword21) (-> *display* base-frame-counter))
(set! sv-48 (the-as symbol #f))
)
(#t
(set! sv-32 (logior sv-32 64))
(set! sv-40 (logior sv-40 128))
(set! (-> arg0 unknown-dword21) (-> *display* base-frame-counter))
)
)
)
(set! (-> sv-24 0) sv-40)
(set! (-> sv-20 0) sv-32)
(set! (-> sv-28 0) sv-48)
(the-as uint 0)
)
(defun target-collision-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector))
(local-vars (sv-80 vector) (sv-84 vector) (sv-88 matrix) (sv-96 int) (sv-104 int) (sv-160 symbol))
(set! sv-80 (new-stack-vector0))
(set! sv-84 (new-stack-vector0))
(let ((v1-2 (new 'stack-no-clear 'matrix)))
(dotimes (a0-1 2)
(set! (-> v1-2 vector a0-1 quad) (the-as uint128 0))
)
(set! sv-88 v1-2)
)
(set! sv-96 0)
(set! sv-104 0)
(set! (-> sv-88 vector 0 quad) (-> arg3 quad))
(set! (-> sv-88 vector 1 quad) (-> arg3 quad))
(let ((a1-3 (new 'stack-no-clear 'vector)))
(vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u))
(move-by-vector! arg0 a1-3)
)
(set-and-handle-pat! arg0 (-> arg1 best-tri pat))
(if (= (-> arg0 poly-pat mode) (pat-mode wall))
(set! sv-104 (logior sv-104 1))
)
(if (logtest? (-> arg0 unknown-surface00 flags) 2048)
(set! sv-104 (logior sv-104 32))
)
(let ((v1-23 (new 'stack-no-clear 'vector)))
(set! (-> v1-23 quad) (-> arg1 best-from-prim prim-core world-sphere quad))
(vector-! sv-80 v1-23 (-> arg1 best-tri intersect))
)
(vector-normalize! sv-80 1.0)
(set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal)))
(when (< (-> arg0 coverage) 0.0)
(set! (-> arg0 coverage) 0.0)
(vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal))
(vector-normalize! sv-80 1.0)
)
(if (< (-> arg0 coverage) 0.9999)
(set! sv-104 (logior sv-104 24))
)
(let ((v1-33 (-> sv-80 quad)))
(set! (-> sv-84 quad) v1-33)
)
(if (= (-> arg1 best-u) 0.0)
(move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0))
)
(set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad))
(collide-shape-moving-angle-set! arg0 sv-84 (the-as vector (-> sv-88 vector)))
(if (< (-> arg0 poly-angle) -0.2)
(set! sv-96 (logior sv-96 16))
)
(if (< (-> arg0 poly-angle) 0.0)
(set! sv-96 (logior sv-96 #x4000))
)
(set! sv-160 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))
(if (and sv-160 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.2 (fabs (-> arg0 surface-angle)))))
(set! sv-160 (the-as symbol #f))
)
(if sv-160
(set! sv-104 (logior sv-104 2))
)
(if (logtest? sv-104 8)
(target-collision-low-coverage
arg0
arg1
sv-84
(the-as (pointer uint32) (& sv-104))
(the-as (pointer uint64) (& sv-96))
(& sv-160)
)
)
(when (zero? (logand (-> arg0 prev-status) 1))
(set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal))))
(set! sv-96 (logior sv-96 2048))
(when (not sv-160)
(let ((f30-0 (- 1.0 (-> arg0 surf impact-fric))))
(when (< f30-0 1.0)
(let ((s3-1 (new-stack-vector0))
(f28-0 (vector-dot (-> arg0 dynam gravity-normal) (the-as vector (-> sv-88 vector))))
)
0.0
(vector-! s3-1 (the-as vector (-> sv-88 vector)) (vector-float*! s3-1 (-> arg0 dynam gravity-normal) f28-0))
(let* ((f0-20 (vector-length s3-1))
(f1-9 f0-20)
)
(if (< f28-0 0.0)
(set! f28-0 (* f28-0 f30-0))
)
(vector+!
(the-as vector (-> sv-88 vector))
(vector-float*! (the-as vector (-> sv-88 vector)) (-> arg0 dynam gravity-normal) f28-0)
(vector-float*! s3-1 s3-1 (/ f0-20 f1-9))
)
)
)
)
)
)
)
(set! sv-96 (logior sv-96 4))
(cond
((-> arg1 best-to-prim)
(set! sv-96 (logior sv-96 32))
(set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad))
(set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad))
(set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process)))
)
((= (-> arg0 poly-pat material) (pat-material waterbottom))
)
(else
(set! sv-96 (logior sv-96 4096))
)
)
(cond
(sv-160
(set! sv-104 (logior sv-104 4))
(set! sv-96 (logior sv-96 8))
(set! (-> arg0 cur-pat mode) 1)
(set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad))
(set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad))
(set! (-> arg0 unknown-vector121 quad) (-> sv-84 quad))
(set! (-> arg0 unknown-int60) (the-as uint (-> arg1 best-tri pat)))
(-> arg0 history-data (logand (+ (-> arg0 unknown-halfword00) 127) 127))
(cond
(#f
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(set! sv-104 (logior sv-104 8192))
(vector-reflect-flat-above! arg2 (the-as vector (-> sv-88 vector)) sv-84)
)
(else
(vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84)
)
)
(cond
((not
(and (>= (-> arg1 best-from-prim local-sphere w)
(vector-dot
(-> arg0 ground-poly-normal)
(vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point))
)
)
(and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2))
(< (- (-> *display* base-frame-counter) (-> arg0 unknown-dword10)) 90)
(zero? (logand sv-104 32))
)
)
)
)
(else
(set! sv-104 (logior sv-104 256))
(set! sv-104 (logand -65 sv-104))
(let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal))))
(vector-normalize! s3-4 1.0)
(vector-float*! arg2 s3-4 (vector-dot (the-as vector (-> sv-88 vector)) s3-4))
)
(vector+! arg2 arg2 (-> arg0 poly-normal))
)
)
)
(else
(set! sv-96 (logior sv-96 1))
(set! (-> arg0 cur-pat mode) 0)
(if (= (-> arg1 best-from-prim prim-id) 6)
(set! (-> arg0 local-normal quad) (-> sv-84 quad))
)
(vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84)
(vector+! arg2 arg2 sv-84)
(set! (-> arg0 ground-touch-point w) 0.0)
(when (not (or (logtest? sv-104 15) (nonzero? (-> arg0 poly-pat event))))
(set! sv-96 (logior sv-96 2))
(set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad))
(set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad))
(set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal)))
(set! (-> arg0 unknown-dword10) (-> *display* base-frame-counter))
(set! (-> arg0 ground-pat) (-> arg0 poly-pat))
(set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad))
(set! (-> arg0 unknown-vector55 quad) (-> arg1 best-from-prim prim-core world-sphere quad))
(set! sv-104 (logior sv-104 2048))
(if (= (-> arg0 poly-pat material) (pat-material waterbottom))
(set! sv-96 (logior sv-96 1024))
)
)
)
)
(logior! (-> arg0 status) sv-96)
(set! (-> arg0 reaction-flag) (the-as uint sv-104))
(update!
(-> arg0 history-data (-> arg0 unknown-halfword00))
arg0
(-> arg1 best-tri intersect)
(-> sv-88 vector 1)
arg2
)
(set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127))
sv-96
(none)
)
;; definition for function target-collision-no-reaction
;; INFO: Return type mismatch int vs none.
(defun target-collision-no-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector))
(if (= (-> arg0 unknown-surface00 mode) 'air)
(logior! (-> arg0 reaction-flag) 32)
)
(let ((s5-0 (-> arg0 history-data (-> arg0 unknown-halfword00))))
(update! s5-0 arg0 (-> arg0 trans) arg3 arg2)
(logior! (-> s5-0 status) 256)
)
(set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127))
0
(none)
)

View file

@ -9,8 +9,75 @@
;; A collide shape is a group of collision geometry. Typically, each actor will have a single collide shape.
;; Each collide shape may contain a number of collide-shape-prim's.
;; There are many subclasses of collide-shape-prim for different types of collision primitives.
;; Some subclasses can contain multiple collide-shape-prims.
;; There are subclasses of collide-shape-prim for different types of collision primitives.
;; The types are:
;; - mesh. A foreground collision mesh. This has a fixed max size, so something have multiple meshes.
;; - group. A list of other prims.
;; - sphere. A sphere.
;; The non-sphere classes also store a bsphere that must contain all collision geometry.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; New vs. Old Collide System
;; There are, effectively, two systems for collision queries.
;; Things that are shared:
;; Both systems use "collide-shape".
;; Both systems track foreground collision objects through the lists:
;; - collide-player-list
;; - collide-hit-by-player-list
;; - collide-usually-hit-by-player-list
;; The "old" system:
;; - generally uses recursive traversals through the collide shape tree
;; - uses "collide-mesh-cache".
;; - can't collide with water or the background.
;; The "new" system:
;; - is the only way to collide with the background/water
;; - uses "collide-cache"
;; - generally dumps stuff into the collide-cache, then uses collide-cache functions (not decompiled yet)
;; - does not support a few of the weirder collision checks
;; There is some duplicate implemenations because both the new and old system collide
;; foreground meshes.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Collision queries:
;; Push Away.
;; Some objects move on fixed paths (like platforms). When these move forward, they should "push away"
;; things they hit (generally, Jak). Push Away only works between foreground objects and uses the old system.
;; The do-push-aways! function should be called after moving a shape to push away things that you hit.
;; Internally, this uses things called SPAT/should-push-away-test.
;; The push-aways use the collide resolve system (described below) to actually push things aways
;; (you can't push-away something through a wall, for example.)
;; Collide Resolve. (made up name)
;; Some objects (like Jak) do not move on fixed paths, and will be stopped by walls or other obstacles.
;; This works on background and foreground objects, and uses the new system.
;; The fill-cache-integrate-and-collide! function should be called, which will fill the collide cache
;; and then do an iterative collision algorithm.
;; This will call the reaction function. The default "default-collision-reaction" function is in collide-shape.gc
;; will fill the touching list.
;; Nav Enemy Collision (made up name)
;; dummy-58 and integrate-for-enemy-with-move-to-ground are nav-enemy specific.
;; the details aren't super well understood yet. But they basically try to go forward if they aren't blocked.
;; Uses find-overlapping-shapes as the detector. (old system)
;; Move To Ground.
;; move-to-ground. Does what it says. (new system)
;; detect-riders
;; for platforms, detect if somebody is on the platform. (on-platform-test)
;; uses old system. Sends event adds to rider list.
(declare-type touching-list structure)
(declare-type collide-shape-prim basic)
@ -242,6 +309,8 @@
(declare-type collide-shape basic)
(declare-type collide-cache-prim structure)
(declare-type collide-shape-prim-group basic)
(declare-type collide-cache basic)
;; the base class for collision shapes.
(deftype collide-shape-prim (basic)
((cshape collide-shape :offset-assert 4) ;; our parent collide-shape
@ -267,9 +336,9 @@
(move-by-vector! (_type_ vector) none 9)
(find-prim-by-id (_type_ uint) collide-shape-prim 10)
(debug-draw-world-sphere (_type_) symbol 11)
(add-fg-prim-using-box (_type_ process-drawable) none 12)
(add-fg-prim-using-line-sphere (_type_ process-drawable) none 13)
(add-fg-prim-using-y-probe (_type_ process-drawable) none 14)
(add-fg-prim-using-box (_type_ collide-cache) none 12)
(add-fg-prim-using-line-sphere (_type_ collide-cache) none 13)
(add-fg-prim-using-y-probe (_type_ collide-cache) none 14)
(overlaps-others-test (_type_ overlaps-others-params collide-shape-prim) symbol 15)
(overlaps-others-group (_type_ overlaps-others-params collide-shape-prim-group) symbol 16)
(dummy-17 () none 17)
@ -392,10 +461,10 @@
(on-platform (_type_ collide-shape collide-overlap-result) symbol 39)
(find-overlapping-shapes (_type_ overlaps-others-params) symbol 40) ;; check if blocked??
(dummy-41 (_type_ attack-info float) vector 41)
(compute-overlap (_type_ collide-shape collide-overlap-result) symbol 42)
(should-push-away (_type_ collide-shape collide-overlap-result) symbol 42)
(pull-rider! (_type_ pull-rider-info) none 43)
(pull-riders! (_type_) symbol 44)
(respond-to-collisions! (_type_) symbol 45)
(do-push-aways! (_type_) symbol 45)
(set-root-prim! (_type_ collide-shape-prim) collide-shape-prim 46)
(update-transforms! (_type_) symbol 47)
(clear-collide-with-as (_type_) none 48)

View file

@ -8,18 +8,18 @@
;; The collide shape system is used to handle collision reactions.
;;;;;;;;;;;;;;;;;;;;;;;
;; OVERLAP
;; Should Push Away
;;;;;;;;;;;;;;;;;;;;;;;
;; The overlap algorithm determines if two collide shapes are in contact.
;; The overlap algorithm determines if the new position of obj should push away arg0.
;; If shapes are far away, it will abort early and just return #f.
;; overlap and "should push away" are the same thing.
;; both check collision flags and require "solid" flags. So this is only for solid collisions.
;; the collision isn't symmetric [collide(a, b) != collide(b, a)] because the with/as flags.
;; so there's some weirdness to get all the method dispatch stuff to work around (you can only dispatch on one type)
(defmethod compute-overlap collide-shape ((obj collide-shape) (arg0 collide-shape) (arg1 collide-overlap-result))
(defmethod should-push-away collide-shape ((obj collide-shape) (arg0 collide-shape) (arg1 collide-overlap-result))
"Find the overlap between two collide shapes. This is the main entry point for the overlap algorithm.
The result is returned in arg1. The obj is collided _with_ arg0 (meaning obj uses its collide-with, arg0 uses colide-as).
The best-dist is only valid if the result is #t (it should be negative then)"
@ -1744,8 +1744,10 @@
;; fill with the gox
(fill-using-bounding-box *collide-cache* s5-0 arg1 (-> obj process) (-> obj pat-ignore-mask))
;; only draw collide cache, if we're the target
(if (and *display-collide-cache* (= (-> obj process type) target))
(when (and *display-collide-cache* (= (-> obj process type) target))
(debug-draw *collide-cache*)
;; NOTE: added
(add-debug-box #t (bucket-id debug-draw0) (-> s5-0 min) (-> s5-0 max) (new 'static 'rgba :a #x80 :b #x70 :g #x70))
)
)
(else
@ -1861,7 +1863,6 @@
(vf31 :class vf)
(vf4 :class vf)
)
(load-bounding-box-work)
;; this first loop looks for a non-empty group.
(let ((s4-0 (-> obj num-prims))
@ -2493,7 +2494,7 @@
#f
)
(defmethod respond-to-collisions! collide-shape ((obj collide-shape))
(defmethod do-push-aways! collide-shape ((obj collide-shape))
"This is the main function to call to respond"
(local-vars
(at-0 int)
@ -2541,12 +2542,12 @@
(when (!= (-> obj process) (-> s3-0 process)) ;; self check
;; see if we collide!
(let ((s2-0 (new 'stack-no-clear 'collide-overlap-result)))
(when (and (compute-overlap obj s3-0 s2-0) (>= -81.92 (-> s2-0 best-dist))) ;; we collide!
(when (and (should-push-away obj s3-0 s2-0) (>= -81.92 (-> s2-0 best-dist))) ;; we collide!
;; fill the collide cache.
(fill-cache-for-shape! s3-0 8192.0 (-> s3-0 root-prim collide-with))
;; 3 iterations to solve it.
(let ((s5-1 3))
(until (or (<= s5-1 0) (not (compute-overlap obj s3-0 s2-0))) ;; run until we're out.
(until (or (<= s5-1 0) (not (should-push-away obj s3-0 s2-0))) ;; run until we're out.
(let ((s1-0 (new 'stack-no-clear 'vector)))
(let ((v1-19 (new 'stack-no-clear 'vector)))
(set! (-> v1-19 quad) (-> s3-0 trans quad))
@ -2627,10 +2628,10 @@
(when (logtest? s5-0 (-> s3-1 root-prim prim-core collide-as))
(when (!= (-> obj process) (-> s3-1 process))
(let ((s2-1 (new 'stack-no-clear 'collide-overlap-result)))
(when (and (compute-overlap obj s3-1 s2-1) (>= -81.92 (-> s2-1 best-dist)))
(when (and (should-push-away obj s3-1 s2-1) (>= -81.92 (-> s2-1 best-dist)))
(fill-cache-for-shape! s3-1 8192.0 (-> s3-1 root-prim collide-with))
(let ((s5-2 3))
(until (or (<= s5-2 0) (not (compute-overlap obj s3-1 s2-1)))
(until (or (<= s5-2 0) (not (should-push-away obj s3-1 s2-1)))
(let ((s1-1 (new 'stack-no-clear 'vector)))
(let ((v1-52 (new 'stack-no-clear 'vector)))
(set! (-> v1-52 quad) (-> s3-1 trans quad))
@ -2704,10 +2705,10 @@
(when (logtest? s5-0 (-> s3-2 root-prim prim-core collide-as))
(when (!= (-> obj process) (-> s3-2 process))
(let ((s2-2 (new 'stack-no-clear 'collide-overlap-result)))
(when (and (compute-overlap obj s3-2 s2-2) (>= -81.92 (-> s2-2 best-dist)))
(when (and (should-push-away obj s3-2 s2-2) (>= -81.92 (-> s2-2 best-dist)))
(fill-cache-for-shape! s3-2 8192.0 (-> s3-2 root-prim collide-with))
(let ((s5-3 3))
(until (or (<= s5-3 0) (not (compute-overlap obj s3-2 s2-2)))
(until (or (<= s5-3 0) (not (should-push-away obj s3-2 s2-2)))
(let ((s1-2 (new 'stack-no-clear 'vector)))
(let ((v1-84 (new 'stack-no-clear 'vector)))
(set! (-> v1-84 quad) (-> s3-2 trans quad))
@ -2779,10 +2780,10 @@
(when (logtest? s5-0 (-> s3-3 root-prim prim-core collide-as))
(when (!= (-> obj process) (-> s3-3 process))
(let ((s2-3 (new 'stack-no-clear 'collide-overlap-result)))
(when (and (compute-overlap obj s3-3 s2-3) (>= -81.92 (-> s2-3 best-dist)))
(when (and (should-push-away obj s3-3 s2-3) (>= -81.92 (-> s2-3 best-dist)))
(fill-cache-for-shape! s3-3 8192.0 (-> s3-3 root-prim collide-with))
(let ((s5-4 3))
(until (or (<= s5-4 0) (not (compute-overlap obj s3-3 s2-3)))
(until (or (<= s5-4 0) (not (should-push-away obj s3-3 s2-3)))
(let ((s1-3 (new 'stack-no-clear 'vector)))
(let ((v1-115 (new 'stack-no-clear 'vector)))
(set! (-> v1-115 quad) (-> s3-3 trans quad))

View file

@ -90,6 +90,15 @@
(unknown-float64 float :offset 1316) ;; from - logic-target::target-compute-slopes
(unknown-dword20 int64 :offset 1320) ;; from target-util::turn-around? - TODO
(unknown-dword21 int64 :offset 1328) ;; from target-util::turn-around? - TODO
(unknown-dword-coverage int64 :offset 1336)
(unknown-float-coverage-0 float :offset 1344)
(unknown-float-coverage-1 float :offset 1348)
(unknown-float-coverage-2 float :offset 1352)
(unknown-u32-coverage-0 uint32 :offset 1356)
(unknown-vector-coverage-0 vector :inline :offset 1376)
(unknown-vector-coverage-1 vector :inline :offset 1392)
(unknown-vector-coverage-2 vector :inline :offset 1440)
(unknown-vector-coverage-3 vector :inline :offset 1472)
(unknown-vector60 vector :inline :offset 1456) ;; from - logic-target::add-thrust
(unknown-vector61 vector :inline :offset 1504) ;; from - logic-target::add-thrust
(unknown-float70 float :offset 1520) ;; from - logic-target::add-thrust
@ -175,6 +184,7 @@
(unknown-dword82 int64 :offset 18912) ;; from logic-target::reset-target-state
(unknown-vector120 vector :inline :offset 18928) ;; from target::(code target-running-attack)
(unknown-float150 float :offset 18944) ;; from target::(code target-wheel-flip)
(unknown-vector121 vector :inline :offset 18960) ;; from target collide response
(unknown-int60 uint32 :offset 18976) ;; from logic-target::print-target-stats
(unknown-soundid00 sound-id :offset 18980) ;; from powerups::target-powerup-process
(unknown-float141 float :offset 18984) ;; from powerups::target-powerup-process

View file

@ -66,13 +66,7 @@
instance-sphere-box-intersect?
((arg0 drawable) (arg1 instance-tie) (arg2 bounding-box4w))
(local-vars
(r0-0 uint128)
(r0-1 int)
(r0-2 uint128)
(r0-3 int)
(r0-4 int)
(r0-5 uint128)
(r0-6 int)
(zero uint128)
(v1-3 uint128)
(v1-4 uint128)
(v1-5 uint128)
@ -109,19 +103,17 @@
(let ((a3-0 (the-as uint128 (-> arg1 origin vector4h 3 long))))
(nop!)
(let ((t2-0 (the-as uint128 (-> arg1 origin vector4h 0 long))))
(.pextlh a3-1 a3-0 r0-0)
(.pextlh a3-1 a3-0 zero)
(let ((t0-0 (the-as uint128 (-> arg1 origin vector4h 1 long))))
(.pw.sra t1-0 a3-1 10)
(let ((a3-2 (the-as uint128 (-> arg1 origin vector4h 2 long))))
(.pextlh t2-1 t2-0 r0-0)
(.mov r0-1 f31-0)
(.pextlh t2-1 t2-0 zero)
(.pw.sra t2-2 t2-1 16)
(.mov r0-2 f31-0)
(.pextlh t0-1 t0-0 r0-2)
(.pextlh t0-1 t0-0 zero)
(.mov vf8 t1-0)
(.pw.sra t0-2 t0-1 16)
(.mov vf5 t2-2)
(.pextlh a3-3 a3-2 r0-2)
(.pextlh a3-3 a3-2 zero)
)
)
)
@ -172,14 +164,10 @@
(nop!)
(.pcgtw a1-2 a2-1 a1-1)
)
(.mov r0-3 f31-0)
(.pcgtw v1-3 v1-2 a0-2)
)
(.mov r0-4 f31-0)
(.por v1-4 a1-2 v1-3)
(.mov r0-5 f31-0)
(.ppach v1-5 r0-5 v1-4)
(.mov r0-6 f31-0)
(.ppach v1-5 zero v1-4)
(let ((v1-6 (shl (the-as int v1-5) 16)))
(nop!)
(zero? v1-6)

View file

@ -297,20 +297,25 @@
;; gmerc
;; shadow
;; eyes
(when (logtest? #x10000 *vu1-enable-user*)
(when (logtest? (vu1-renderer-mask sprite) *vu1-enable-user*)
(swap-fake-shadow-buffers)
(sprite-draw *display*)
)
;; lots more in this function.
(when *debug-segment*
(debug-draw-actors *level* *display-actor-marks*)
;; collide-shape-debug
(collide-shape-draw-debug-marks)
)
(render-boundaries)
;; boundaries
;; touching
(send-events-for-touching-shapes *touching-list*)
(free-all-prim-nodes *touching-list*)
(actors-update *level*)
;; collide stats
(when (not (paused?))
(if *stats-collide*
(print-collide-stats)
)
)
(none)
)
@ -323,6 +328,17 @@
(define *draw-hook* main-draw-hook)
(defun-debug main-debug-hook ()
(when (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))
(execute-connections *debug-engine* #f)
;; (draw-instance-info *stdcon*)
)
(none)
)
;; definition for symbol *debug-hook*, type (function none)
(define *debug-hook* main-debug-hook)
(defun debug-init-buffer ((arg0 bucket-id) (arg1 gs-zbuf) (arg2 gs-test))
"Initialize a bucket for debug draw with the given zbuf and test settings"
(let* ((t0-0 (-> *display* frames (-> *display* on-screen) frame global-buf))
@ -1142,3 +1158,13 @@
0
(none)
)
(defmethod collide-with-box drawable ((obj drawable) (arg0 int) (arg1 collide-list))
0
(none)
)
(defmethod collide-y-probe drawable ((obj drawable) (arg0 int) (arg1 collide-list))
0
(none)
)

View file

@ -889,8 +889,23 @@
(logclear! (-> self draw status) (draw-status drwf02 drwf04))
(when (nonzero? (-> self skel))
;(dummy-19 self) TODO
(#when TARGET_STARTUP_HACKS
(when (eq? (-> self type) target)
(format *stdcon* "no bones for you~%")
(dotimes (i (length (-> self node-list)))
(matrix-identity! (-> self node-list data i bone transform))
(set! (-> self node-list data i bone position quad)
(-> (the-as target self) control trans quad)
)
(set! (-> self node-list data i bone position w) 1.0)
(+! (-> self node-list data i bone position y) (meters 0.0))
)
)
)
(when (or (logtest? (-> self skel status) 1) gp-1)
(dummy-17 self)
;; (dummy-17 self) TODO
(if (and gp-1 (type-type? (-> self root type) collide-shape))
(update-transforms! (the-as collide-shape (-> self root)))
)
@ -964,7 +979,7 @@
(let ((gp-0 (the-as collide-shape (-> self root))))
(update-transforms! gp-0)
(pull-riders! gp-0)
(respond-to-collisions! gp-0)
(do-push-aways! gp-0)
)
0
)
@ -973,7 +988,7 @@
(ja-post)
(let ((gp-0 (the-as collide-shape (-> self root))))
(update-transforms! gp-0)
(respond-to-collisions! gp-0)
(do-push-aways! gp-0)
)
0
)

View file

@ -1253,6 +1253,21 @@
(define-extern collectable type)
(define-extern ecovalve type)
(define-extern crate type)
(defmacro heap-size-hack (info entity-type)
`(cond
((type-type? ,entity-type collectable)
#x1000
)
(else
(if ,info
(-> ,info heap-size)
#x4000
)
)
)
)
(defmethod birth! entity-actor ((obj entity-actor))
"Create a process for this entity and start it."
@ -1272,10 +1287,7 @@
(let* ((entity-type (-> obj etype))
(info (entity-info-lookup entity-type))
(entity-process (get-process *default-dead-pool* entity-type (if info
(-> info heap-size)
#x4000
)
(entity-process (get-process *default-dead-pool* entity-type (heap-size-hack info entity-type) ;; hack, modified this.
)
)
)

View file

@ -131,7 +131,7 @@
(defmethod initialize eco-collectable ((obj eco-collectable))
(stack-size-set! (-> obj main-thread) 128)
(stack-size-set! (-> obj main-thread) 256) ;; hack increased from 128
(logior! (-> obj mask) (process-mask actor-pause))
(set! (-> obj actor-pause) #t)
(set! (-> obj notify-parent) #f)
@ -1273,7 +1273,7 @@
)
(defmethod initialize money ((obj money))
(stack-size-set! (-> obj main-thread) 128)
(stack-size-set! (-> obj main-thread) 256) ;; hack increased from 128
(let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s5-0 reaction) default-collision-reaction)

View file

@ -6,6 +6,7 @@
;; dgos: GAME, ENGINE
;; Global engine settings:
(defglobalconstant TARGET_STARTUP_HACKS #t)
(define *stats-poly* #f)
(define *stats-memory* #f)
(define *stats-memory-short* #f)

View file

@ -556,6 +556,7 @@
(add-ee-profile-frame 'draw :r #x80)
(add-ee-profile-frame 'draw :r #x40 :b #x40)
;; debug hook
(*debug-hook*)
(main-cheats)
(add-ee-profile-frame 'draw :r #x20 :g #x20)
(update-camera)

View file

@ -1129,6 +1129,7 @@
(spawn (-> obj part) (the-as vector (-> obj root-override root-prim prim-core)))
)
)
(#when PC_DEBUG_SOUND_ENABLE
(let ((s5-0 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> s5-0 command) (sound-command set-param))
(set! (-> s5-0 id) (-> obj sound-id))
@ -1146,6 +1147,7 @@
(set! (-> s5-0 parms mask) (the-as uint 32))
(-> s5-0 id)
)
)
0
(none)
)

View file

@ -450,8 +450,10 @@
)
)
(#when PC_PORT
(when (nonzero? (-> *pc-settings* aspect-setting))
(set! (-> gp-0 aspect-ratio) (-> *pc-settings* aspect-setting))
)
)
(if (zero? *boot-video-mode*)
(set! (-> gp-0 video-mode) 'ntsc)
(set! (-> gp-0 video-mode) 'pal)

View file

@ -172,7 +172,7 @@
0
)
(defmethod set-from-spheres! bounding-box ((obj bounding-box) (spheres (pointer sphere)) (count int))
(defmethod set-from-spheres! bounding-box ((obj bounding-box) (spheres-bad (pointer sphere)) (count int))
"Reset box to hold the given spheres. Note: this implementation could be optimized."
;; This is also unrolled, but does 7 at a time.
(rlet ((vf0 :class vf)
@ -187,12 +187,14 @@
(set! current-min vf0)
(set! current-max vf0)
(let ((spheres (the (inline-array sphere) spheres-bad)))
(dotimes (i count)
(.lvf sph (-> spheres i))
(.sub.w.vf sph-min sph sph :mask #b111)
(.add.w.vf sph-max sph sph :mask #b111)
(cond
((zero? count)
((zero? i)
(set! current-min sph-min)
(set! current-max sph-max)
)
@ -202,6 +204,7 @@
)
)
)
)
(.svf (-> obj min) current-min)
(.svf (-> obj max) current-max)

View file

@ -248,7 +248,7 @@
;; update colors, but only if needed
(when (not (or (zero? s0-0) (= s4-1 s0-0)))
(flush-cache 0)
(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-0 (-> s1-0 mood))
;;(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-0 (-> s1-0 mood))
;; remember the previous colors
(set! s4-1 s0-0)
)
@ -277,7 +277,7 @@
(upload-vis-bits s1-1 gp-1 a2-6)
(when (not (or (zero? s0-1) (= s4-1 s0-1)))
(flush-cache 0)
(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-1 (-> s1-1 mood))
;;(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-1 (-> s1-1 mood))
(set! s4-1 s0-1)
)
)
@ -303,7 +303,7 @@
(upload-vis-bits s1-2 gp-1 a2-8)
(when (not (or (zero? s0-2) (= s4-1 s0-2)))
(flush-cache 0)
(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-2 (-> s1-2 mood))
;;(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-2 (-> s1-2 mood))
(set! s4-1 s0-2)
)
)
@ -331,7 +331,7 @@
(upload-vis-bits s1-3 gp-1 a2-10)
(when (not (or (zero? s0-3) (= s4-1 s0-3)))
(flush-cache 0)
(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-3 (-> s1-3 mood))
;;(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-3 (-> s1-3 mood))
(set! s4-1 s0-3)
)
)
@ -360,7 +360,7 @@
(upload-vis-bits s1-4 gp-1 a2-12)
(when (not (or (zero? s0-4) (= s4-1 s0-4)))
(flush-cache 0)
(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-4 (-> s1-4 mood))
;;(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-4 (-> s1-4 mood))
(set! s4-1 s0-4)
)
)
@ -382,7 +382,7 @@
(upload-vis-bits s1-5 gp-1 a2-14)
(when (not (or (zero? s0-5) (= s4-1 s0-5)))
(flush-cache 0)
(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-5 (-> s1-5 mood))
;;(time-of-day-interp-colors-scratch (scratchpad-ptr rgba :offset 6160) s0-5 (-> s1-5 mood))
(set! s4-1 s0-5)
)
)

View file

@ -113,7 +113,7 @@
;; do the draw!
(reset! (-> *perf-stats* data 5))
;;(format 0 "DRAW: ~D~%" s3-0)
(draw-inline-array-tfrag sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-0)
;; (draw-inline-array-tfrag sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-0)
(read! (-> *perf-stats* data 5))
;; update stats for the draw
@ -252,7 +252,7 @@
lev
)
(reset! (-> *perf-stats* data 5))
(draw-inline-array-tfrag sv-16 s5-1 s4-1 s2-0)
;; (draw-inline-array-tfrag sv-16 s5-1 s4-1 s2-0)
(update-wait-stats (-> *perf-stats* data 5) (the-as uint 0) (-> *tfrag-work* wait-to-spr) (-> *tfrag-work* wait-from-spr))
(read! (-> *perf-stats* data 5))
(tfrag-end-buffer s2-0)
@ -426,7 +426,7 @@
(tfrag-init-buffer s2-0 (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) 1 lev)
(reset! (-> *perf-stats* data 5))
(draw-inline-array-tfrag sv-16 s5-1 s4-1 s2-0)
;; (draw-inline-array-tfrag sv-16 s5-1 s4-1 s2-0)
(update-wait-stats
(-> *perf-stats* data 5)
(the-as uint 0)
@ -596,7 +596,7 @@
lev
)
(reset! (-> *perf-stats* data 5))
(draw-inline-array-tfrag sv-16 s5-1 s4-1 s2-0)
;; (draw-inline-array-tfrag sv-16 s5-1 s4-1 s2-0)
(update-wait-stats
(-> *perf-stats* data 5)
(the-as uint 0)

View file

@ -7,22 +7,8 @@
;; contains various math helpers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; float macros
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmacro fabs (x)
"Floating point absolute value"
;; in GOAL this was implemented by the compiler.
;; at some point, this could be more optimized.
;; MIPS has an explicit abs.s instruction, but x86-64 doesn't.
;; modern clang on O3 does a comiss/branch and this is probably pretty close.
`(if (< (the float ,x) 0)
(- (the float ,x))
(the float ,x))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; float utility

View file

@ -751,66 +751,83 @@
(defun vector-normalize! ((arg0 vector) (arg1 float))
"Modify arg0 in place to have length arg1 for its xyz components. The w part is not changed."
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(let ((f0-0 (vector-length arg0)))
(let ((v1-1 (/ arg1 f0-0)))
(set! (-> arg0 data 0) (* (-> arg0 data 0) v1-1))
(set! (-> arg0 data 1) (* (-> arg0 data 1) v1-1))
(set! (-> arg0 data 2) (* (-> arg0 data 2) v1-1))
)
(init-vf0-vector)
(.lvf vf1 (&-> arg0 quad))
(.mul.vf vf2 vf1 vf1 :mask #b111)
(let ((v1-0 arg1))
(.mov vf3 v1-0)
)
(.mul.x.vf acc vf0 vf2 :mask #b1000)
(.add.mul.y.vf acc vf0 vf2 acc :mask #b1000)
(.add.mul.z.vf vf2 vf0 vf2 acc :mask #b1000)
(.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11)
(.wait.vf)
(.mul.vf vf1 vf1 Q :mask #b111)
(.nop.vf)
(.nop.vf)
(.nop.vf)
(.svf (&-> arg0 quad) vf1)
arg0
)
; (rlet ((acc :class vf)
; (Q :class vf)
; (vf0 :class vf)
; (vf1 :class vf)
; (vf2 :class vf)
; (vf3 :class vf)
; )
; (init-vf0-vector)
; (.lvf vf1 (&-> arg0 quad))
; (.mul.vf vf2 vf1 vf1 :mask #b111)
; (let ((v1-0 arg1))
; (.mov vf3 v1-0)
; )
; (.mul.x.vf acc vf0 vf2 :mask #b1000)
; (.add.mul.y.vf acc vf0 vf2 acc :mask #b1000)
; (.add.mul.z.vf vf2 vf0 vf2 acc :mask #b1000)
; (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11)
; (.wait.vf)
; (.mul.vf vf1 vf1 Q :mask #b111)
; (.nop.vf)
; (.nop.vf)
; (.nop.vf)
; (.svf (&-> arg0 quad) vf1)
; arg0
; )
)
(defun vector-normalize-ret-len! ((arg0 vector) (arg1 float))
"Modify arg0 in place to have length arg1 for its xyz components.
The w part isn't changed and the _original_ length is returned."
(local-vars (v1-1 float))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
)
(init-vf0-vector)
(.lvf vf1 (&-> arg0 quad))
(.mul.vf vf2 vf1 vf1 :mask #b111)
(let ((v1-0 arg1))
(.mov vf3 v1-0)
)
(.mul.x.vf acc vf0 vf2 :mask #b1000)
(.add.mul.y.vf acc vf0 vf2 acc :mask #b1000)
(.add.mul.z.vf vf2 vf0 vf2 acc :mask #b1000)
(.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11)
(.add.w.vf vf2 vf0 vf2 :mask #b1)
(.mov v1-1 vf2)
(let ((v0-0 (sqrtf v1-1)))
(.wait.vf)
(.mul.vf vf1 vf1 Q :mask #b111)
(.nop.vf)
(.nop.vf)
(.nop.vf)
(.svf (&-> arg0 quad) vf1)
v0-0
(let ((f0-0 (vector-length arg0)))
(let ((v1-1 (/ arg1 f0-0)))
(set! (-> arg0 data 0) (* (-> arg0 data 0) v1-1))
(set! (-> arg0 data 1) (* (-> arg0 data 1) v1-1))
(set! (-> arg0 data 2) (* (-> arg0 data 2) v1-1))
)
f0-0
)
; (local-vars (v1-1 float))
; (rlet ((acc :class vf)
; (Q :class vf)
; (vf0 :class vf)
; (vf1 :class vf)
; (vf2 :class vf)
; (vf3 :class vf)
; )
; (init-vf0-vector)
; (.lvf vf1 (&-> arg0 quad))
; (.mul.vf vf2 vf1 vf1 :mask #b111)
; (let ((v1-0 arg1))
; (.mov vf3 v1-0)
; )
; (.mul.x.vf acc vf0 vf2 :mask #b1000)
; (.add.mul.y.vf acc vf0 vf2 acc :mask #b1000)
; (.add.mul.z.vf vf2 vf0 vf2 acc :mask #b1000)
; (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11)
; (.add.w.vf vf2 vf0 vf2 :mask #b1)
; (.mov v1-1 vf2)
; (let ((v0-0 (sqrtf v1-1)))
; (.wait.vf)
; (.mul.vf vf1 vf1 Q :mask #b111)
; (.nop.vf)
; (.nop.vf)
; (.nop.vf)
; (.svf (&-> arg0 quad) vf1)
; v0-0
; )
; )
)
(defun vector-normalize-copy! ((arg0 vector) (arg1 vector) (arg2 float))

View file

@ -1938,7 +1938,7 @@
(set! arg0 (get-or-create-continue! *game-info*))
)
(set-continue! *game-info* arg0)
(stack-size-set! (-> self main-thread) 1024)
(stack-size-set! (-> self main-thread) 4096) ;; changed for PC
(logior! (-> self mask) (process-mask target))
(set! (-> self state-hook) (the-as (function none :behavior target) nothing))
(let ((s5-0 (new 'process 'control-info self (collide-list-enum player))))
@ -2079,8 +2079,8 @@
;; hack for not starting target.
(defun start ((arg0 symbol) (arg1 continue-point))
(set! *target* #f)
(return *target*)
; (set! *target* #f)
; (return *target*)
(set! (-> *level* border?) #f)
(set! (-> *setting-control* default border-mode) #f)
@ -2100,6 +2100,8 @@
(set! *target* #f)
)
)
;; hack added.
(set! *display-target-marks* #t)
*target*
)

View file

@ -277,6 +277,8 @@
)
)
)
(#unless TARGET_STARTUP_HACKS
(let ((a0-26 (-> self skel effect)))
(if a0-26
(TODO-RENAME-9 a0-26)
@ -288,6 +290,8 @@
(if (logtest? (-> self skel status) 384)
(merc-eye-anim self)
)
)
(none)
)
)

File diff suppressed because it is too large Load diff

View file

@ -862,6 +862,21 @@
(set! (-> gp-0 proc) #f)
(set! (-> gp-0 ignore-pat) (the-as uint 1))
(set! (-> gp-0 solid-only) #t)
;; NOTE: added this.
;; exit duck has failed for 2 reasons:
;; there seems to be a bogus triangle in the cache sometimes (rare)
;; sometimes it thinks we hit the spheres, but we don't.
; (dotimes (i 2)
; (add-debug-sphere
; #t
; (bucket-id debug-draw0)
; (-> (the (inline-array sphere) (-> gp-0 spheres)) i)
; (-> (the (inline-array sphere) (-> gp-0 spheres)) i w)
; (new 'static 'rgba :r #x80 :a #x80)
; )
; )
(if (fill-and-probe-using-spheres *collide-cache* gp-0)
#f
#t

File diff suppressed because it is too large Load diff

View file

@ -141,52 +141,34 @@
;; incrementing counter to make the test input move around.
(define *debug-counter* 0)
(defun debug-draw-collide-work ()
(defun debug-draw-collide-work ((my-off float))
(when (not (paused?))
(+! *debug-counter* 1)
)
;; create a test input that moves around sandover
(let ((origin (new 'static 'vector :y (meters 7.0) :x (meters 5.) :z (meters 0.0)))
(line (new 'static 'vector :y (meters 5.0) :x (meters -5.0)))
(radius (meters 0.5))
(radius (meters 2.0))
(val (+ my-off (* 0.003 (the float *debug-counter*))))
)
(set! (-> line z) (* (sin (degrees (the float *debug-counter*))) (meters 15.0)))
(set! (-> line x) (* (cos (degrees (the float *debug-counter*))) (meters 15.0)))
(set! (-> line z) (* (sin (degrees val)) (meters 35.0)))
(set! (-> line x) (* (cos (degrees val)) (meters 35.0)))
(let ((dbg2 (/ (the float *debug-counter*) 2)))
(set! (-> origin x) (* (sin (degrees dbg2)) (meters 30.)))
(set! (-> origin z) (* (cos (* 3.0 (degrees dbg2))) (meters 30.)))
(let ((dbg2 (/ val 2)))
(set! (-> origin x) (* (sin (degrees dbg2)) (meters 100.)))
(set! (-> origin z) (* (cos (* 3.0 (degrees dbg2))) (meters 100.)))
(+! (-> origin x) (meters -50.))
)
#|
;;; PROBE (at the frag finding level)
;; setup the collide work
(setup-collide-for-line-sphere origin line radius)
;; draw the line we're going to check
(add-debug-line
#t
(bucket-id debug-draw0)
origin
(vector+! (new 'stack-no-clear 'vector) origin line)
(new 'static 'rgba :r #x80)
#f
(the rgba -1)
)
;; debug draw spheres along the line
(dotimes (i 10)
(add-debug-sphere
#t
(bucket-id debug-draw0)
(vector-lerp! (new 'stack-no-clear 'vector)
origin
(vector+! (new 'stack-no-clear 'vector) origin line)
(/ (the float i) 9.0)
)
radius
(new 'static 'rgba :g #x80 :r #x80 :b #x80 :a #x80)
)
)
;; clear collide list
(set! (-> *collide-list* num-items) 0)
@ -246,23 +228,150 @@
)
)
)
|#
;; CCACHE (fill from bounding box)
(let ((bbox-fake (new 'stack 'bounding-box))
(bbox (new 'stack 'bounding-box)))
;; make box
(set! (-> bbox-fake min quad) (-> origin quad))
(vector+! (-> bbox-fake max) origin line)
(dotimes (i 3)
(set! (-> bbox min data i) (fmin (-> bbox-fake min data i) (-> bbox-fake max data i)))
(set! (-> bbox max data i) (fmax (-> bbox-fake min data i) (-> bbox-fake max data i)))
)
(set! (-> bbox min w) 1.0)
(set! (-> bbox max w) 1.0)
;; BBOX
;; draw box
;(add-debug-box #t (bucket-id debug-draw0) (-> bbox min) (-> bbox max) (new 'static 'rgba :g #x30 :a #x80))
;; now fill!
; (fill-using-bounding-box *collide-cache*
; bbox
; (collide-kind background)
; (the process-drawable #f)
; (the pat-surface 0)
; )
;; Y PROBE
; (+! (-> bbox min y) (meters 8.0))
; (let ((vec (new 'stack-no-clear 'vector)))
; (set! (-> vec quad) (-> bbox min quad))
; (-! (-> vec y) (meters 20.0))
; (add-debug-line
; #t
; (bucket-id debug-draw0)
; (-> bbox min)
; vec
; (new 'static 'rgba :r #x80 :a #x80)
; #f
; (the rgba -1)
; )
; )
; (fill-using-y-probe *collide-cache* (-> bbox min) (meters 20.0) (collide-kind background) (the process-drawable #f) (the uint 0))
;; LINE SPHERE
; (fill-using-line-sphere *collide-cache* origin line radius (collide-kind background) (the process-drawable #f) 0)
; ;; draw the line we're going to check
; (add-debug-line
; #t
; (bucket-id debug-draw0)
; origin
; (vector+! (new 'stack-no-clear 'vector) origin line)
; (new 'static 'rgba :r #x80)
; #f
; (the rgba -1)
; )
; ;; debug draw spheres along the line
; (dotimes (i 10)
; (add-debug-sphere
; #t
; (bucket-id debug-draw0)
; (vector-lerp! (new 'stack-no-clear 'vector)
; origin
; (vector+! (new 'stack-no-clear 'vector) origin line)
; (/ (the float i) 9.0)
; )
; radius
; (new 'static 'rgba :g #x80 :r #x80 :b #x80 :a #x80)
; )
; )
;; Y probe (actual probe)
(+! (-> bbox min y) (meters 8.0))
(let ((vec (new 'stack-no-clear 'vector)))
(set! (-> vec quad) (-> bbox min quad))
(-! (-> vec y) (meters 20.0))
; (add-debug-line
; #t
; (bucket-id debug-draw0)
; (-> bbox min)
; vec
; (new 'static 'rgba :r #x80 :a #x80)
; #f
; (the rgba -1)
; )
)
(let ((result (new 'stack-no-clear 'collide-tri-result)))
(let ((u (fill-and-probe-using-y-probe *collide-cache* (-> bbox min) (meters 20.0) (collide-kind background) (the process-drawable #f) result (the uint 0))))
(-! (-> bbox min y) (* u (meters 20.0)))
;; (format *stdcon* "u = ~f : ~`vector`P ~%" u (-> result vertex 0))
(add-debug-sphere
#t
(bucket-id debug-draw0)
(-> bbox min)
(meters 2.0)
(new 'static 'rgba :r #x80 :a #x80)
)
)
;(add-debug-outline-triangle #t (bucket-id debug-draw1) (-> result vertex 0) (-> result vertex 1) (-> result vertex 2) (new 'static 'rgba :r #x80 :g #x80 :a #x80))
)
;(debug-draw *collide-cache*)
)
#f
)
)
(defun start-debug-drawer ()
(kill-by-name 'debug-drawer *active-pool*)
;;(kill-by-name 'debug-drawer *active-pool*)
(let ((proc (get-process *nk-dead-pool* process 1024)))
(activate proc *active-pool* 'debug-drawer *kernel-dram-stack*)
(run-next-time-in-process
proc
(lambda ()
(let ((my-off (rand-vu-float-range 0.0 1000.0)))
(while #t
(debug-draw-collide-work)
(debug-draw-collide-work my-off)
(suspend)
)
)
)
)
)
)
(defun start-100-debug-drawer ()
(dotimes (i 100)
(start-debug-drawer)
)
)

View file

@ -257,6 +257,10 @@
"FUCV6"
"FUCV7"
"FUCV8"
"EIA1"
"EIA2"
"EIA3"
"EIA4"
)

View file

@ -818,6 +818,25 @@
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; float macros
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmacro fabs (x)
"Floating point absolute value"
;; in GOAL this was implemented by the compiler.
;; at some point, this could be more optimized.
;; MIPS has an explicit abs.s instruction, but x86-64 doesn't.
;; modern clang on O3 does a comiss/branch and this is probably pretty close.
`(if (< (the float ,x) 0)
(- (the float ,x))
(the float ,x))
)
(defmacro sqrtf (x)
`(sqrtf-no-fabs (fabs ,x))
)
;; load the default project
(load-project "goal_src/game.gp")

View file

@ -219,6 +219,7 @@
)
(else
(msg-err "illegal attempt change stack size of ~A after more heap allocation has occured.~%" proc)
(break)
)
)
)

View file

@ -109,7 +109,7 @@
16384.0
)
(the-as object (if (zero? (logand (-> obj nav-enemy-flags) 256))
(respond-to-collisions! (-> obj collide-info))
(do-push-aways! (-> obj collide-info))
)
)
)

View file

@ -716,7 +716,7 @@
((the-as (function none) t9-0))
)
)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(none)
)
)

View file

@ -656,7 +656,7 @@
(vector-seek! gp-0 a1-0 (* (-> self state-float 0) (-> *display* seconds-per-frame)))
(move-to-point! (-> self root-override) gp-0)
)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(seek-toward-heading-vec! (-> self root-override) (-> self path-vector) 131072.0 300)
(spool-push *art-control* "pelican-spit-ext" 0 self -99.0)
(none)

View file

@ -1667,7 +1667,7 @@
(meters 2.0)
(-> *TARGET-bank* smack-surface-height)
(the-as process #f)
(the-as (state target) target-flut-hit)
target-flut-hit
)
)
(if (and (logtest? (-> self water flags) 512)

View file

@ -152,7 +152,7 @@
(let ((v1-0 arg2))
(the-as object (cond
((= v1-0 'touch)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(when (-> self dangerous)
(let ((a1-1 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-1 from) self)
@ -172,7 +172,7 @@
((!= v1-10 (-> self player-attack-id))
(set! (-> self player-attack-id) (the-as int v1-10))
(when (-> self vulnerable)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(go darkvine-retreat)
)
)

View file

@ -143,7 +143,7 @@
)
)
(else
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(let ((a1-3 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-3 from) self)
(set! (-> a1-3 num-params) 2)
@ -734,7 +734,7 @@ junglesnake-default-event-handler
(let ((v1-4 (-> (the-as collide-shape-prim-group (-> obj root-override root-prim)) prims 0)))
(logior! (-> v1-4 prim-core action) (collide-action solid))
)
(respond-to-collisions! (-> obj root-override))
(do-push-aways! (-> obj root-override))
)
0
(none)

View file

@ -2384,7 +2384,7 @@
:post
(behavior ()
(plant-boss-post)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(none)
)
)
@ -2424,7 +2424,7 @@
(let ((gp-1 (-> *display* base-frame-counter)))
(until (>= (- (-> *display* base-frame-counter) gp-1) 1500)
(transform-post)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(suspend)
)
)

View file

@ -469,7 +469,7 @@
(-> self root-overlay)
(the-as uint 1)
)
(respond-to-collisions! (-> self root-overlay))
(do-push-aways! (-> self root-overlay))
(let ((a1-3 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-3 from) self)
(set! (-> a1-3 num-params) 2)

View file

@ -363,7 +363,7 @@
(set! (-> gp-1 y) 0.0)
(vector-normalize! gp-1 4096.0)
(move-by-vector! (-> *target* control) gp-1)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(detect-riders! (-> self root-override))
)
)

View file

@ -205,7 +205,7 @@
(set! (-> a1-0 to) (the-as process 1))
(set! (-> a1-0 from) (the-as process *touching-list*))
(if (find-overlapping-shapes (-> self root-override) (the-as overlaps-others-params a1-0))
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
)
)
(none)

View file

@ -158,7 +158,7 @@
)
)
(when (and v1-2 (< 8192.0 (- (-> v1-2 root trans y) (-> self root-override trans y))))
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(send-shove-back
(-> self root-override)
arg0

View file

@ -296,6 +296,11 @@ class Compiler {
u8 sa,
Env* env,
IntegerMathKind kind);
Val* compile_floating_point_division(const goos::Object& form,
const TypeSpec& result_type,
RegVal* a,
RegVal* b,
Env* env);
Val* compile_format_string(const goos::Object& form,
Env* env,

View file

@ -251,7 +251,7 @@ const std::unordered_map<
{"&+", &Compiler::compile_pointer_add},
{"fmax", &Compiler::compile_fmax},
{"fmin", &Compiler::compile_fmin},
{"sqrtf", &Compiler::compile_sqrtf},
{"sqrtf-no-fabs", &Compiler::compile_sqrtf},
// BUILDER (build-dgo/build-cgo?)
{"build-dgos", &Compiler::compile_build_dgo},

View file

@ -1,5 +1,6 @@
#include "goalc/compiler/Compiler.h"
#include "common/util/BitUtils.h"
#include <cfloat>
MathMode Compiler::get_math_mode(const TypeSpec& ts) {
if (m_ts.tc(m_ts.make_typespec("binteger"), ts)) {
@ -371,6 +372,61 @@ Val* Compiler::compile_sub(const goos::Object& form, const goos::Object& rest, E
return get_none();
}
Val* Compiler::compile_floating_point_division(const goos::Object& form,
const TypeSpec& result_type,
RegVal* a,
RegVal* b,
Env* env) {
constexpr bool use_accurate = true;
auto result = env->make_fpr(result_type);
if (use_accurate) {
auto fenv = env->function_env();
auto end_label = fenv->alloc_unnamed_label();
end_label->func = fenv;
end_label->idx = -10; // placeholder
auto zero = compile_float(0.0, env, fenv->segment_for_static_data())->to_fpr(form, env);
Condition zero_check;
zero_check.kind = ConditionKind::EQUAL;
zero_check.a = zero;
zero_check.b = b;
zero_check.is_float = true;
// check for divide by zero
auto branch_ir = std::make_unique<IR_ConditionalBranch>(zero_check, Label());
auto branch_ir_ref = branch_ir.get();
env->emit(form, std::move(branch_ir));
// code for not dividing by zero
env->emit_ir<IR_RegSet>(form, result, a);
env->emit_ir<IR_FloatMath>(form, FloatMathKind::DIV_SS, result, b);
env->emit_ir<IR_GotoLabel>(form, end_label);
branch_ir_ref->mark_as_resolved();
branch_ir_ref->label.idx = fenv->code().size();
auto flt_max = compile_integer(0x7f7fffff, env)->to_gpr(form, env);
auto mask = compile_integer(0xf0000000, env)->to_gpr(form, env);
auto temp_int = env->make_gpr(result_type);
env->emit_ir<IR_RegSet>(form, temp_int, a);
env->emit_ir<IR_IntegerMath>(form, IntegerMathKind::AND_64, temp_int, mask);
env->emit_ir<IR_IntegerMath>(form, IntegerMathKind::XOR_64, flt_max, temp_int);
env->emit_ir<IR_RegSet>(form, temp_int, b);
env->emit_ir<IR_IntegerMath>(form, IntegerMathKind::AND_64, temp_int, mask);
env->emit_ir<IR_IntegerMath>(form, IntegerMathKind::XOR_64, flt_max, temp_int);
env->emit_ir<IR_RegSet>(form, result, flt_max);
end_label->idx = fenv->code().size();
} else {
env->emit_ir<IR_RegSet>(form, result, a);
env->emit_ir<IR_FloatMath>(form, FloatMathKind::DIV_SS, result, b);
}
return result;
}
Val* Compiler::compile_div(const goos::Object& form, const goos::Object& rest, Env* env) {
auto args = get_va(form, rest);
if (!args.named.empty() || args.unnamed.size() != 2) {
@ -427,13 +483,10 @@ Val* Compiler::compile_div(const goos::Object& form, const goos::Object& rest, E
}
case MATH_FLOAT: {
auto result = env->make_fpr(first_type);
env->emit_ir<IR_RegSet>(form, result, first_val->to_fpr(form, env));
env->emit_ir<IR_FloatMath>(
form, FloatMathKind::DIV_SS, result,
to_math_type(form, compile_error_guard(args.unnamed.at(1), env), math_type, env)
->to_fpr(form, env));
return result;
auto a = first_val->to_fpr(form, env);
auto b = to_math_type(form, compile_error_guard(args.unnamed.at(1), env), math_type, env)
->to_fpr(form, env);
return compile_floating_point_division(form, first_type, a, b, env);
}
case MATH_INVALID:

View file

@ -139,7 +139,7 @@
(print-nth-point (_type_ int) none 11)
(TODO-RENAME-12 (_type_) none 12)
(TODO-RENAME-13 (_type_ int) none 13)
(TODO-RENAME-14 (_type_ vector) none 14)
(TODO-RENAME-14 (_type_ tracking-spline-sampler) none 14)
(TODO-RENAME-15 (_type_) none 15)
(TODO-RENAME-16 (_type_ float) none 16)
(TODO-RENAME-17 (_type_ vector float float symbol) int 17)

View file

@ -520,17 +520,17 @@
;; definition for method 14 of type tracking-spline
;; INFO: Return type mismatch int vs none.
(defmethod TODO-RENAME-14 tracking-spline ((obj tracking-spline) (arg0 vector))
(defmethod TODO-RENAME-14 tracking-spline ((obj tracking-spline) (arg0 tracking-spline-sampler))
(let ((v1-0 (-> obj used-point)))
(set! (-> obj partial-point) (-> arg0 y))
(set! (-> obj partial-point) (-> arg0 partial-pt))
(when (= (-> obj next-to-last-point) v1-0)
(set! (-> obj summed-len) (-> obj point v1-0 tp-length))
(if (= (-> arg0 x) (-> obj end-point))
(if (= (-> arg0 cur-pt) (-> obj end-point))
(set! (-> obj partial-point) 0.99999)
)
)
(when (!= (-> arg0 x) v1-0)
(while (and (!= (-> obj point v1-0 next) (-> arg0 x)) (!= (-> obj point v1-0 next) (-> obj next-to-last-point)))
(when (!= (-> arg0 cur-pt) v1-0)
(while (and (!= (-> obj point v1-0 next) (-> arg0 cur-pt)) (!= (-> obj point v1-0 next) (-> obj next-to-last-point)))
(set! (-> obj summed-len) (- (-> obj summed-len) (-> obj point v1-0 tp-length)))
(+! (-> obj point v1-0 incarnation) 1)
(+! (-> obj used-count) -1)
@ -541,13 +541,13 @@
(+! (-> obj used-count) -1)
(set! (-> obj point v1-0 next) (-> obj free-point))
(set! (-> obj free-point) (-> obj used-point))
(set! (-> obj used-point) (the-as int (-> arg0 x)))
(set! (-> obj used-point) (-> arg0 cur-pt))
(cond
((= (-> arg0 x) (-> obj end-point))
((= (-> arg0 cur-pt) (-> obj end-point))
(set! (-> obj partial-point) 0.0)
(set! (-> obj summed-len) 0.0)
)
((= (-> arg0 x) (-> obj next-to-last-point))
((= (-> arg0 cur-pt) (-> obj next-to-last-point))
(set! (-> obj summed-len) (-> obj point (-> obj next-to-last-point) tp-length))
)
)
@ -857,7 +857,7 @@
(set! (-> s4-0 cur-pt) v1-0)
(set! (-> s4-0 partial-pt) f0-0)
(TODO-RENAME-19 obj (* (-> obj max-move) (-> *display* time-adjust-ratio)) arg0 s4-0)
(TODO-RENAME-14 obj (the-as vector s4-0))
(TODO-RENAME-14 obj s4-0)
(dotimes (s3-0 63)
(TODO-RENAME-18 obj (* 0.015625 (-> obj sample-len)) arg0 s4-0)
)
@ -888,7 +888,7 @@
(set! (-> s5-0 partial-pt) 0.0)
(TODO-RENAME-19 obj (- (-> obj summed-len) arg0) a2-0 s5-0)
)
(TODO-RENAME-14 obj (the-as vector s5-0))
(TODO-RENAME-14 obj s5-0)
)
)
0

View file

@ -57,8 +57,8 @@
:size-assert #xc60
:flag-assert #xb00000c60
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-9 (_type_ object object) symbol 9)
(dummy-10 (_type_ object object) symbol 10)
)
)
@ -100,10 +100,11 @@
;; definition of type collide-cache-tri
(deftype collide-cache-tri (structure)
((vertex vector 3 :inline :offset-assert 0)
(pat pat-surface :offset-assert 48)
(prim-index uint16 :offset-assert 52)
(user16 uint16 :offset-assert 54)
(user32 uint32 2 :offset-assert 56)
(extra-quad uint128 :offset 48)
(pat pat-surface :offset 48)
(prim-index uint16 :offset 52)
(user16 uint16 :offset 54)
(user32 uint32 2 :offset 56)
)
:method-count-assert 9
:size-assert #x40
@ -114,7 +115,7 @@
(defmethod inspect collide-cache-tri ((obj collide-cache-tri))
(format #t "[~8x] ~A~%" obj 'collide-cache-tri)
(format #t "~Tvertex[3] @ #x~X~%" (-> obj vertex))
(format #t "~Textra-quad[16] @ #x~X~%" (&-> obj pat))
(format #t "~Textra-quad[16] @ #x~X~%" (&-> obj extra-quad))
(format #t "~Tpat: ~D~%" (-> obj pat))
(format #t "~Tprim-index: ~D~%" (-> obj prim-index))
(format #t "~Tuser16: ~D~%" (-> obj user16))
@ -125,11 +126,12 @@
;; definition of type collide-cache-prim
(deftype collide-cache-prim (structure)
((prim-core collide-prim-core :inline :offset-assert 0)
(ccache collide-cache :offset-assert 32)
(prim collide-shape-prim :offset-assert 36)
(first-tri uint16 :offset-assert 40)
(num-tris uint16 :offset-assert 42)
(unused uint8 4 :offset-assert 44)
(extra-quad uint128 :offset-assert 32)
(ccache collide-cache :offset 32)
(prim collide-shape-prim :offset 36)
(first-tri uint16 :offset 40)
(num-tris uint16 :offset 42)
(unused uint8 4 :offset 44)
(world-sphere vector :inline :offset 0)
(collide-as collide-kind :offset 16)
(action collide-action :offset 24)
@ -149,7 +151,7 @@
(defmethod inspect collide-cache-prim ((obj collide-cache-prim))
(format #t "[~8x] ~A~%" obj 'collide-cache-prim)
(format #t "~Tprim-core: #<collide-prim-core @ #x~X>~%" (-> obj prim-core))
(format #t "~Textra-quad[16] @ #x~X~%" (&-> obj ccache))
(format #t "~Textra-quad[16] @ #x~X~%" (&-> obj extra-quad))
(format #t "~Tccache: ~A~%" (-> obj ccache))
(format #t "~Tprim: ~A~%" (-> obj prim))
(format #t "~Tfirst-tri: ~D~%" (-> obj first-tri))
@ -182,7 +184,7 @@
(:methods
(debug-draw (_type_) none 9)
(fill-and-probe-using-line-sphere (_type_ vector vector float collide-kind process collide-tri-result int) float 10)
(fill-and-probe-using-spheres (_type_ collide-using-spheres-params) none 11)
(fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol 11)
(fill-and-probe-using-y-probe (_type_ vector float collide-kind process collide-tri-result uint) float 12)
(fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none 13)
(fill-using-line-sphere (_type_ vector vector float collide-kind process-drawable int) none 14)
@ -190,20 +192,20 @@
(fill-using-y-probe (_type_ vector float collide-kind process-drawable uint) none 16)
(initialize (_type_) none 17)
(probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result int) float 18)
(probe-using-spheres (_type_) none 19)
(probe-using-spheres (_type_ collide-using-spheres-params) symbol 19)
(probe-using-y-probe (_type_ vector float collide-kind collide-tri-result uint) float 20)
(fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache none)) none 21)
(fill-from-foreground-using-spheres (_type_) none 22)
(fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache object none)) none 21)
(fill-from-foreground-using-box (_type_) none 22)
(fill-from-foreground-using-line-sphere (_type_) none 23)
(fill-from-foreground-using-y-probe (_type_) none 24)
(fill-from-water (_type_ water-control) none 25)
(dummy-26 (_type_) none 26)
(load-mesh-from-spad-in-box (_type_ collide-frag-mesh) none 26)
(dummy-27 (_type_) none 27)
(dummy-28 (_type_) none 28)
(dummy-29 (_type_ collide-frag-mesh) none 29)
(dummy-30 (_type_) none 30)
(dummy-31 (_type_ collide-puyp-work collide-cache-prim) vector 31)
(dummy-32 (_type_) none 32)
(puyp-mesh (_type_ collide-puyp-work collide-cache-prim) none 30)
(puyp-sphere (_type_ collide-puyp-work collide-cache-prim) vector 31)
(unpack-background-collide-mesh (_type_ object object object) none 32)
)
)

View file

@ -124,7 +124,7 @@
:flag-assert #xb00000810
(:methods
(debug-draw (_type_) object 9)
(dummy-10 () none 10)
(dummy-10 (_type_ collide-edge-hold-item) none 10)
)
)
@ -176,12 +176,12 @@
(debug-draw-edges (_type_) object 10)
(dummy-11 (_type_) none 11)
(debug-draw-sphere (_type_) symbol 12)
(dummy-13 (_type_) none 13)
(dummy-13 (_type_ collide-edge-hold-item vector) none 13)
(dummy-14 (_type_ vector vector int) float 14)
(dummy-15 (_type_) none 15)
(dummy-16 (_type_) none 16)
(find-grabbable-tris! (_type_) none 16)
(dummy-17 (_type_) none 17)
(dummy-18 (_type_) none 18)
(dummy-18 (_type_ collide-edge-hold-list edge-grab-info) none 18)
(dummy-19 (_type_ collide-edge-hold-item edge-grab-info) symbol 19)
)
)

View file

@ -228,9 +228,9 @@
(move-by-vector! (_type_ vector) none 9)
(find-prim-by-id (_type_ uint) collide-shape-prim 10)
(debug-draw-world-sphere (_type_) symbol 11)
(add-fg-prim-using-box (_type_ process-drawable) none 12)
(add-fg-prim-using-line-sphere (_type_ process-drawable) none 13)
(add-fg-prim-using-y-probe (_type_ process-drawable) none 14)
(add-fg-prim-using-box (_type_ collide-cache) none 12)
(add-fg-prim-using-line-sphere (_type_ collide-cache) none 13)
(add-fg-prim-using-y-probe (_type_ collide-cache) none 14)
(overlaps-others-test (_type_ overlaps-others-params collide-shape-prim) symbol 15)
(overlaps-others-group (_type_ overlaps-others-params collide-shape-prim-group) symbol 16)
(dummy-17 () none 17)
@ -406,10 +406,10 @@
(on-platform (_type_ collide-shape collide-overlap-result) symbol 39)
(find-overlapping-shapes (_type_ overlaps-others-params) symbol 40)
(dummy-41 (_type_ attack-info float) vector 41)
(compute-overlap (_type_ collide-shape collide-overlap-result) symbol 42)
(should-push-away (_type_ collide-shape collide-overlap-result) symbol 42)
(pull-rider! (_type_ pull-rider-info) none 43)
(pull-riders! (_type_) symbol 44)
(respond-to-collisions! (_type_) symbol 45)
(do-push-aways! (_type_) symbol 45)
(set-root-prim! (_type_ collide-shape-prim) collide-shape-prim 46)
(update-transforms! (_type_) symbol 47)
(clear-collide-with-as (_type_) none 48)

View file

@ -98,6 +98,15 @@
(unknown-float64 float :offset 1316)
(unknown-dword20 int64 :offset 1320)
(unknown-dword21 int64 :offset 1328)
(unknown-dword-coverage int64 :offset 1336)
(unknown-float-coverage-0 float :offset 1344)
(unknown-float-coverage-1 float :offset 1348)
(unknown-float-coverage-2 float :offset 1352)
(unknown-u32-coverage-0 uint32 :offset 1356)
(unknown-vector-coverage-0 vector :inline :offset 1376)
(unknown-vector-coverage-1 vector :inline :offset 1392)
(unknown-vector-coverage-2 vector :inline :offset 1440)
(unknown-vector-coverage-3 vector :inline :offset 1472)
(unknown-vector60 vector :inline :offset 1456)
(unknown-vector61 vector :inline :offset 1504)
(unknown-float70 float :offset 1520)
@ -182,6 +191,7 @@
(unknown-dword82 int64 :offset 18912)
(unknown-vector120 vector :inline :offset 18928)
(unknown-float150 float :offset 18944)
(unknown-vector121 vector :inline :offset 18960)
(unknown-int60 uint32 :offset 18976)
(unknown-soundid00 sound-id :offset 18980)
(unknown-float141 float :offset 18984)

View file

@ -1012,7 +1012,7 @@
(let ((gp-0 (the-as collide-shape (-> self root))))
(update-transforms! gp-0)
(pull-riders! gp-0)
(respond-to-collisions! gp-0)
(do-push-aways! gp-0)
)
0
)
@ -1022,7 +1022,7 @@
(ja-post)
(let ((gp-0 (the-as collide-shape (-> self root))))
(update-transforms! gp-0)
(respond-to-collisions! gp-0)
(do-push-aways! gp-0)
)
0
)

View file

@ -111,7 +111,65 @@
)
;; definition for function target-falling-anim-trans
;; ERROR: function was not converted to expressions. Cannot decompile.
;; INFO: Return type mismatch int vs none.
(defbehavior target-falling-anim-trans target ()
(let ((v1-2 (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
)
)
(b!
(or (= v1-2 (-> self draw art-group data 38)) (= v1-2 (-> self draw art-group data 35)))
cfg-7
:delay
(empty-form)
)
)
(ja-channel-push! 1 99)
(let ((v1-8 (-> self skel root-channel 0)))
(set! (-> v1-8 frame-group) (the-as art-joint-anim (-> self draw art-group data 38)))
)
(b! #t cfg-23 :delay (nop!))
(label cfg-7)
(cond
((and (logtest? (-> self control status) 1) (not (= (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
(-> self draw art-group data 35)
)
)
)
(ja-channel-push! 1 6)
(let ((v1-21 (-> self skel root-channel 0)))
(set! (-> v1-21 frame-group) (the-as art-joint-anim (-> self draw art-group data 35)))
)
)
((= (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
(-> self draw art-group data 38)
)
(let ((a0-23 (-> self skel root-channel 0)))
(set! (-> a0-23 param 0) (-> (new 'static 'array float 1 1.0) 0))
(joint-control-channel-group-eval! a0-23 (the-as art-joint-anim #f) num-func-loop!)
)
)
((= (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
(-> self draw art-group data 35)
)
(let ((a0-28 (-> self skel root-channel 0)))
(set! (-> a0-28 param 0) (the float (+ (-> a0-28 frame-group data 0 length) -1)))
(set! (-> a0-28 param 1) (-> (new 'static 'array float 1 1.0) 0))
(joint-control-channel-group-eval! a0-28 (the-as art-joint-anim #f) num-func-seek!)
)
)
)
(label cfg-23)
0
(none)
)
;; definition for function target-falling-trans
;; INFO: Return type mismatch int vs none.
@ -3204,7 +3262,7 @@
(-> *TARGET-bank* smack-surface-dist)
(-> *TARGET-bank* smack-surface-height)
(the-as process #f)
(the-as (state target) target-hit)
target-hit
)
)
(if (and (logtest? (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) (pad-buttons x))
@ -4275,7 +4333,7 @@
(-> *TARGET-bank* smack-surface-dist)
(-> *TARGET-bank* smack-surface-height)
(the-as process #f)
(the-as (state target) target-hit)
target-hit
)
)
(if (zero? s5-0)
@ -4379,7 +4437,7 @@
(-> *TARGET-bank* smack-surface-dist)
(-> *TARGET-bank* smack-surface-height)
(the-as process #f)
(the-as (state target) target-hit)
target-hit
)
)
(if (and (logtest? (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0)

View file

@ -118,7 +118,7 @@
16384.0
)
(the-as object (if (zero? (logand (-> obj nav-enemy-flags) 256))
(respond-to-collisions! (-> obj collide-info))
(do-push-aways! (-> obj collide-info))
)
)
)

View file

@ -728,7 +728,7 @@
((the-as (function none) t9-0))
)
)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(none)
)
)

View file

@ -708,7 +708,7 @@
(vector-seek! gp-0 a1-0 (* (-> self state-float 0) (-> *display* seconds-per-frame)))
(move-to-point! (-> self root-override) gp-0)
)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(seek-toward-heading-vec! (-> self root-override) (-> self path-vector) 131072.0 300)
(spool-push *art-control* "pelican-spit-ext" 0 self -99.0)
(none)

View file

@ -1702,12 +1702,7 @@
)
(!= (-> self control unknown-uint31) 1)
)
(target-shoved
(meters 2.0)
(-> *TARGET-bank* smack-surface-height)
(the-as process #f)
(the-as (state target) target-flut-hit)
)
(target-shoved (meters 2.0) (-> *TARGET-bank* smack-surface-height) (the-as process #f) target-flut-hit)
)
(if (and (logtest? (-> self water flags) 512)
(zero? (mod (- (-> *display* base-frame-counter) (-> self state-time)) 21))

View file

@ -164,7 +164,7 @@
(let ((v1-0 arg2))
(the-as object (cond
((= v1-0 'touch)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(when (-> self dangerous)
(let ((a1-1 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-1 from) self)
@ -184,7 +184,7 @@
((!= v1-10 (-> self player-attack-id))
(set! (-> self player-attack-id) (the-as int v1-10))
(when (-> self vulnerable)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(go darkvine-retreat)
)
)

View file

@ -178,7 +178,7 @@
)
)
(else
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(let ((a1-3 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-3 from) self)
(set! (-> a1-3 num-params) 2)
@ -784,7 +784,7 @@ junglesnake-default-event-handler
(let ((v1-4 (-> (the-as collide-shape-prim-group (-> obj root-override root-prim)) prims 0)))
(logior! (-> v1-4 prim-core action) (collide-action solid))
)
(respond-to-collisions! (-> obj root-override))
(do-push-aways! (-> obj root-override))
)
0
(none)

View file

@ -2476,7 +2476,7 @@
:post
(behavior ()
(plant-boss-post)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(none)
)
)
@ -2517,7 +2517,7 @@
(let ((gp-1 (-> *display* base-frame-counter)))
(until (>= (- (-> *display* base-frame-counter) gp-1) 1500)
(transform-post)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(suspend)
)
)

View file

@ -547,7 +547,7 @@
(-> self root-overlay)
(the-as uint 1)
)
(respond-to-collisions! (-> self root-overlay))
(do-push-aways! (-> self root-overlay))
(let ((a1-3 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-3 from) self)
(set! (-> a1-3 num-params) 2)

View file

@ -404,7 +404,7 @@
(set! (-> gp-1 y) 0.0)
(vector-normalize! gp-1 4096.0)
(move-by-vector! (-> *target* control) gp-1)
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(detect-riders! (-> self root-override))
)
)

View file

@ -209,7 +209,7 @@
(set! (-> a1-0 to) (the-as process 1))
(set! (-> a1-0 from) (the-as process *touching-list*))
(if (find-overlapping-shapes (-> self root-override) (the-as overlaps-others-params a1-0))
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
)
)
(none)

View file

@ -213,7 +213,7 @@
)
)
(when (and v1-2 (< 8192.0 (- (-> v1-2 root trans y) (-> self root-override trans y))))
(respond-to-collisions! (-> self root-override))
(do-push-aways! (-> self root-override))
(send-shove-back
(-> self root-override)
arg0