unused version of collide line sphere collide list (#1071)

This commit is contained in:
water111
2022-01-09 17:45:19 -05:00
committed by GitHub
parent 90e860aef8
commit 38c805ca7c
70 changed files with 2160 additions and 826 deletions
+37
View File
@@ -1247,6 +1247,43 @@ bool ControlFlowGraph::clean_up_asm_branches() {
old_seq->parent_claim(seq);
bds->parent_claim(seq);
return false;
} else if (b0_seq && !b1_seq) {
replaced = true;
m_blocks.at(bds->succ_branch->get_first_block_id())->needs_label = true;
auto* seq = dynamic_cast<SequenceVtx*>(b0);
assert(seq);
if (b0->succ_branch) {
b0->succ_branch->replace_preds_with_and_check({b0}, nullptr);
}
if (bds->succ_branch) {
// likely delay slots "branch" in this graph.
bds->succ_branch->replace_preds_with_and_check({bds}, nullptr);
}
seq->seq.push_back(bds);
seq->seq.push_back(b1);
for (auto* x : b1->succs()) {
// printf("fix preds of %s\n", x->to_string().c_str());
x->replace_pred_and_check(b1, seq);
}
seq->succ_branch = b1->succ_branch;
seq->succ_ft = b1->succ_ft;
seq->end_branch = b1->end_branch;
seq->next = b1->next;
if (seq->next) {
seq->next->prev = seq;
}
// todo - proper trash?
b1->parent_claim(seq);
bds->parent_claim(seq);
return false;
}
+11
View File
@@ -91,6 +91,8 @@ std::string goal_to_c_function_name(const FunctionName& name) {
switch (name.kind) {
case FunctionName::FunctionKind::GLOBAL:
return goal_to_c_name(name.function_name);
case FunctionName::FunctionKind::METHOD:
return fmt::format("method_{}_{}", name.method_id, goal_to_c_name(name.type_name));
default:
assert(false);
}
@@ -826,6 +828,12 @@ Mips2C_Line handle_clts(const Instruction& i0, const std::string& instr_string)
instr_string};
}
Mips2C_Line handle_cles(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};
}
@@ -1001,6 +1009,9 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
case InstructionKind::CLTS:
output.needs_cop1_bc = true;
return handle_clts(i0, instr_str);
case InstructionKind::CLES:
output.needs_cop1_bc = true;
return handle_cles(i0, instr_str);
case InstructionKind::VWAITQ:
return handle_plain_op(i0, instr_str, "vwaitq");
case InstructionKind::VOPMULA:
+25 -23
View File
@@ -11030,7 +11030,7 @@
(:methods
(debug-draw-tris (_type_ process-drawable int) none 9)
(dummy-10 (_type_ object vector) none 10) ;; what is the second arg!?
(dummy-11 (_type_) none 11)
(dummy-11 (_type_ collide-mesh-cache-tri collide-tri-result vector float) none 11)
(dummy-12 (_type_ collide-mesh-cache-tri collide-tri-result vector float) float 12)
(dummy-13 (_type_) none 13)
(dummy-14 (_type_) none 14)
@@ -11344,7 +11344,7 @@
(TODO-RENAME-28 (_type_ vector) object 28) ;; ret - symbol | float (CSPG::9)
(dummy-29 (_type_ int) none 29)
(TODO-RENAME-30 (_type_ vector) object 30) ;; ret - symbol | float (CSPG::9)
(dummy-31 (_type_) none 31)
(debug-draw (_type_) none 31)
(dummy-32 (_type_ object collide-kind) none 32)
(dummy-33 (_type_ vector collide-kind) none 33)
(dummy-34 (_type_ uint) collide-shape-prim 34)
@@ -11403,7 +11403,7 @@
:size-assert #x1bc
:flag-assert #x41000001bc
(:methods
(dummy-56 (_type_ pat-surface) none 56)
(set-and-handle-pat! (_type_ pat-surface) none 56)
(dummy-57 (_type_ vector) none 57)
(dummy-58 (_type_ vector) symbol 58)
(dummy-59 (_type_ vector uint float symbol symbol symbol) none 59)
@@ -11695,7 +11695,7 @@
:flag-assert #xf00000208
(:methods
(new (symbol type) _type_ 0)
(dummy-9 (_type_ collide-shape-prim collide-shape-prim float collide-shape collide-mesh-cache-tri) none 9)
(add-touching-prims (_type_ collide-shape-prim collide-shape-prim float collide-tri-result collide-tri-result) none 9)
(dummy-10 () none 10)
(dummy-11 (_type_ float) none 11)
(dummy-12 (_type_) none 12)
@@ -12487,7 +12487,7 @@
(deftype collide-puyp-work (structure)
((best-u float :offset-assert 0)
(ignore-pat uint32 :offset-assert 4)
(ignore-pat pat-surface :offset-assert 4)
(tri-out collide-tri-result :offset-assert 8)
(start-pos vector :inline :offset-assert 16)
(move-dist vector :inline :offset-assert 32)
@@ -12514,7 +12514,7 @@
((prim-core collide-prim-core :inline :offset-assert 0)
;;(extra-quad UNKNOWN 16 :offset-assert 32)
(ccache collide-cache :offset-assert 32)
(prim (pointer collide-shape-prim) :offset-assert 36)
(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)
@@ -12528,15 +12528,17 @@
:size-assert #x30
:flag-assert #xb00000030
(:methods
(dummy-9 (_type_ collide-mesh-cache-tri collide-prim-core vector float collide-action) float 9)
(dummy-10 (_type_ collide-mesh-cache-tri collide-prim-core vector float collide-action) float 10)
(resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float 9)
(resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float 10)
)
)
(deftype collide-cache (basic)
((num-tris int32 :offset-assert 4)
;;(num-tris-u uint32 :offset 4) ;; added
(num-prims int32 :offset-assert 8)
(ignore-mask uint32 :offset-assert 12)
(num-prims-u uint32 :offset 8 );; added
(ignore-mask pat-surface :offset-assert 12)
(proc process-drawable :offset-assert 16) ;; types: target
(collide-box bounding-box :inline :offset-assert 32)
(collide-box4w bounding-box4w :inline :offset-assert 64)
@@ -12549,22 +12551,22 @@
:flag-assert #x2100008670
(:methods
(dummy-9 (_type_) none 9)
(dummy-10 (_type_ vector vector float int process collide-tri-result int) float 10)
(dummy-11 (_type_ collide-using-spheres-params) none 11)
(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-y-probe (_type_ vector float collide-kind process collide-tri-result uint) float 12)
(dummy-13 (_type_ bounding-box collide-kind process-drawable pat-surface) none 13)
(dummy-14 (_type_ vector vector float int process int) none 14)
(dummy-15 (_type_ collide-using-spheres-params) none 15)
(dummy-16 (_type_ vector float uint process-drawable uint) none 16)
(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)
(fill-using-spheres (_type_ collide-using-spheres-params) none 15)
(fill-using-y-probe (_type_ vector float collide-kind process-drawable uint) none 16)
(initialize (_type_) none 17)
(dummy-18 (_type_ vector vector float collide-kind collide-tri-result int) float 18)
(probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result int) float 18)
(probe-using-spheres (_type_) none 19)
(dummy-20 (_type_ vector float uint collide-tri-result uint) float 20)
(dummy-21 (_type_ (function bsp-header int collide-list none) (function collide-cache none)) none 21) ;; second functiom is method 28
(dummy-22 (_type_) none 22)
(dummy-23 (_type_) none 23)
(dummy-24 (_type_) none 24)
(dummy-25 (_type_ water-control) none 25) ;; or whatever is from 152 in the process passed to 16
(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-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)
(dummy-27 (_type_) none 27)
(dummy-28 (_type_) none 28)
@@ -12576,7 +12578,7 @@
)
(deftype collide-list-item (structure)
((mesh basic :offset-assert 0)
((mesh collide-frag-mesh :offset-assert 0)
(inst basic :offset-assert 4)
)
:method-count-assert 9
@@ -283,10 +283,10 @@
"(method 12 collide-shape-prim-group)", // CFG
"(method 12 collide-shape-prim-mesh)", // CFG
"(method 27 collide-cache)", // CFG
"(method 14 collide-cache)", // CFG
// "(method 14 collide-cache)", // CFG
"(method 28 collide-cache)", // CFG
"(method 26 collide-cache)", // CFG
"(method 21 collide-cache)", // CFG
//"(method 21 collide-cache)", // CFG
"(method 32 collide-cache)", // CFG
// memory-usage BUG
@@ -480,7 +480,9 @@
"birth-pickup-at-point": [0],
"draw-bones": [0, 1, 2, 8, 81],
"draw-bones-hud": [7, 8],
"(method 16 drawable-tree)": [7, 9, 10]
"(method 16 drawable-tree)": [7, 9, 10],
"(method 21 collide-cache)" : [3, 5, 19, 20,24,25,28,29],
"(method 14 collide-cache)" : [0, 1,2, 3, 4, 5]
},
// Sometimes the game might use format strings that are fetched dynamically,
@@ -528,7 +530,9 @@
"time-of-day-interp-colors-scratch",
"normalize-frame-quaternions",
"collide-do-primitives",
"moving-sphere-triangle-intersect"
"moving-sphere-triangle-intersect",
"(method 12 collide-mesh)",
"(method 11 collide-mesh)"
],
// there are some missing textures. I don't know what the game actually does here.
@@ -1845,7 +1845,7 @@
["L414", "attack-info"],
["L415", "attack-info"],
["L416", "attack-info"],
["L417", "attack-info"],
["L417", "vector"],
["L418", "attack-info"],
["L419", "attack-info"],
["L420", "vector"],
@@ -1873,7 +1873,8 @@
],
"collide-cache": [
["L304", "vector"]
["L304", "vector"],
["L303", "vector4w"]
],
"load-boundary-data": [
@@ -4139,7 +4139,7 @@
],
"(method 9 touching-list)": [
[16, "touching-shapes-entry"]
[16, "add-prims-touching-work"]
],
"(method 11 touching-prims-entry)": [
@@ -4420,7 +4420,7 @@
[160, "vector"]
],
"(method 19 collide-shape-prim-sphere)": [[16, "collide-mesh-cache-tri"]],
"(method 19 collide-shape-prim-sphere)": [[16, "collide-tri-result"]],
"(method 37 collide-shape)": [[16, "vector"]],
"starts": [
@@ -6063,5 +6063,9 @@
[48, "vector"]
],
"(method 14 collide-cache)" : [
[16, "bounding-box"]
],
"placeholder-do-not-add-below!": []
}
@@ -7542,5 +7542,14 @@
[[47, 49], "v1", "drawable-inline-array-node"]
],
"(method 21 collide-cache)": [
[114, "a0", "(pointer int32)"],
[156, "t0", "(pointer int32)"],
[190, "v1", "(pointer int32)"],
[147, "v1", "collide-list-item"],
[148, "v1", "collide-list-item"],
[[217, 227], "s3", "collide-list-item"]
],
"placeholder-do-not-add-below": []
}
+1
View File
@@ -61,6 +61,7 @@ set(RUNTIME_SOURCE
kernel/ksound.cpp
mips2c/mips2c_table.cpp
mips2c/functions/collide_func.cpp
mips2c/functions/collide_mesh.cpp
mips2c/functions/draw_string.cpp
mips2c/functions/sky_tng.cpp
mips2c/functions/sparticle.cpp
+379
View File
@@ -0,0 +1,379 @@
//--------------------------MIPS2C---------------------
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/kscheme.h"
// clang-format off
namespace Mips2C {
namespace method_12_collide_mesh {
struct Cache {
void* closest_pt_in_triangle; // closest-pt-in-triangle
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
c->daddiu(sp, sp, -160); // daddiu sp, sp, -160
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(s1, 64, sp); // sq s1, 64(sp)
c->sq(s2, 80, sp); // sq s2, 80(sp)
c->sq(s3, 96, sp); // sq s3, 96(sp)
c->sq(s4, 112, sp); // sq s4, 112(sp)
c->sq(s5, 128, sp); // sq s5, 128(sp)
c->sq(gp, 144, sp); // sq gp, 144(sp)
c->mov64(gp, a2); // or gp, a2, r0
c->mov64(s5, a3); // or s5, a3, r0
c->mov64(s2, t0); // or s2, t0, r0
c->daddiu(s4, sp, 16); // daddiu s4, sp, 16
c->lw_float_constant(v1, 0x42f5c28f); // lw v1, L34(fp) 122.88
c->mov64(s3, a1); // or s3, a1, r0
c->lqc2(vf3, 0, s5); // lqc2 vf3, 0(s5)
c->mov128_vf_gpr(vf14, v1); // qmtc2.i vf14, v1
c->lwu(s1, 4, a0); // lwu s1, 4(a0)
c->vadd_bc(DEST::w, BC::x, vf3, vf3, vf14); // vaddx.w vf3, vf3, vf14
// nop // sll r0, r0, 0
c->vsub_bc(DEST::xyzw, BC::w, vf12, vf3, vf3); // vsubw.xyzw vf12, vf3, vf3
// nop // sll r0, r0, 0
c->vadd_bc(DEST::xyzw, BC::w, vf13, vf3, vf3); // vaddw.xyzw vf13, vf3, vf3
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf12, vf12); // vftoi0.xyzw vf12, vf12
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf13, vf13); // vftoi0.xyzw vf13, vf13
// nop // sll r0, r0, 0
c->mov128_gpr_vf(v1, vf12); // qmfc2.i v1, vf12
c->sqc2(vf12, 16, s4); // sqc2 vf12, 16(s4)
c->mov128_gpr_vf(a0, vf13); // qmfc2.i a0, vf13
c->sqc2(vf13, 32, s4); // sqc2 vf13, 32(s4)
block_1:
bc = c->sgpr64(s1) == 0; // beq s1, r0, L29
c->lwu(a2, 60, s3); // lwu a2, 60(s3)
if (bc) {goto block_14;} // branch non-likely
c->addiu(a3, r0, 56); // addiu a3, r0, 56
c->addiu(a1, r0, 0); // addiu a1, r0, 0
c->and_(a2, a2, a3); // and a2, a2, a3
c->addiu(a3, r0, 16); // addiu a3, r0, 16
bc = c->sgpr64(a2) == c->sgpr64(a1); // beq a2, a1, L27
c->daddiu(s1, s1, -1); // daddiu s1, s1, -1
if (bc) {goto block_5;} // branch non-likely
if (((s64)c->sgpr64(a2)) != ((s64)c->sgpr64(a3))) {// bnel a2, a3, L26
c->daddiu(s3, s3, 96); // daddiu s3, s3, 96
goto block_1;
}
block_5:
// nop // sll r0, r0, 0
c->lq(a2, 64, s3); // lq a2, 64(s3)
// nop // sll r0, r0, 0
c->lq(a1, 80, s3); // lq a1, 80(s3)
c->pcgtw(a2, a2, a0); // pcgtw a2, a2, a0
c->mfc1(r0, f31); // mfc1 r0, f31
c->pcgtw(a1, v1, a1); // pcgtw a1, v1, a1
c->mfc1(r0, f31); // mfc1 r0, f31
c->por(a1, a2, a1); // por a1, a2, a1
// nop // sll r0, r0, 0
c->ppach(a1, r0, a1); // ppach a1, r0, a1
c->mfc1(r0, f31); // mfc1 r0, f31
c->dsll(a1, a1, 16); // dsll a1, a1, 16
// nop // sll r0, r0, 0
if (((s64)c->sgpr64(a1)) != ((s64)0)) { // bnel a1, r0, L26
c->daddiu(s3, s3, 96); // daddiu s3, s3, 96
goto block_1;
}
block_7:
c->load_symbol(t9, cache.closest_pt_in_triangle); // lw t9, closest-pt-in-triangle(s7)
c->daddu(a0, r0, s4); // daddu a0, r0, s4
c->mov64(a1, s5); // or a1, s5, r0
c->daddu(a2, r0, s3); // daddu a2, r0, s3
c->daddiu(a3, s3, 48); // daddiu a3, s3, 48
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
c->lqc2(vf2, 0, s4); // lqc2 vf2, 0(s4)
c->lqc2(vf3, 0, s5); // lqc2 vf3, 0(s5)
c->lqc2(vf1, 48, s3); // lqc2 vf1, 48(s3)
c->lq(v1, 16, s4); // lq v1, 16(s4)
c->lq(a0, 32, s4); // lq a0, 32(s4)
c->vsub(DEST::xyzw, vf4, vf3, vf2); // vsub.xyzw vf4, vf3, vf2
c->lwu(a1, 60, s3); // lwu a1, 60(s3)
c->vmul(DEST::xyzw, vf5, vf4, vf1); // vmul.xyzw vf5, vf4, vf1
c->lqc2(vf7, 0, s3); // lqc2 vf7, 0(s3)
c->vmul(DEST::xyzw, vf6, vf4, vf4); // vmul.xyzw vf6, vf4, vf4
c->lqc2(vf8, 16, s3); // lqc2 vf8, 16(s3)
c->vmove(DEST::w, vf1, vf0); // vmove.w vf1, vf0
c->lqc2(vf9, 32, s3); // lqc2 vf9, 32(s3)
c->vadd_bc(DEST::y, BC::x, vf5, vf5, vf5); // vaddx.y vf5, vf5, vf5
c->daddiu(s3, s3, 96); // daddiu s3, s3, 96
c->vadd_bc(DEST::x, BC::y, vf6, vf6, vf6); // vaddy.x vf6, vf6, vf6
c->mtc1(f5, s2); // mtc1 f5, s2
c->vadd_bc(DEST::y, BC::z, vf5, vf5, vf5); // vaddz.y vf5, vf5, vf5
c->fprs[f3] = 122.88; // lwc1 f3, L34(fp)
c->vadd_bc(DEST::x, BC::z, vf6, vf6, vf6); // vaddz.x vf6, vf6, vf6
c->fprs[f4] = -1024.0; // lwc1 f4, L33(fp)
c->vsqrt(vf6, BC::x); // vsqrt Q, vf6.x
c->mov128_gpr_vf(a2, vf5); // qmfc2.i a2, vf5
c->vwaitq(); // vwaitq
c->lwc1(f1, 12, s5); // lwc1 f1, 12(s5)
c->vaddq(DEST::x, vf6, vf0); // vaddq.x vf6, vf0, Q
c->vmove(DEST::xyzw, vf10, vf6); // vmove.xyzw vf10, vf6
if (((s64)c->sgpr64(a2)) < 0) { // bltzl a2, L28
c->vsub(DEST::xyzw, vf10, vf0, vf10); // vsub.xyzw vf10, vf0, vf10
goto block_9;
}
block_9:
c->mov128_gpr_vf(a2, vf10); // qmfc2.i a2, vf10
c->mtc1(f2, a2); // mtc1 f2, a2
c->subs(f2, f2, f1); // sub.s f2, f2, f1
cop1_bc = c->fprs[f5] < c->fprs[f2]; // c.lt.s f5, f2
bc = cop1_bc; // bc1t L26
c->vdiv(vf0, BC::w, vf6, BC::x); // vdiv Q, vf0.w, vf6.x
if (bc) {goto block_1;} // branch non-likely
cop1_bc = c->fprs[f3] <= c->fprs[f2]; // c.le.s f3, f2
bc = cop1_bc; // bc1t L26
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
cop1_bc = c->fprs[f2] <= c->fprs[f4]; // c.le.s f2, f4
bc = cop1_bc; // bc1t L26
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
c->vwaitq(); // vwaitq
// nop // sll r0, r0, 0
c->vmulq(DEST::xyzw, vf11, vf4); // vmulq.xyzw vf11, vf4, Q
c->fprs[f6] = 0.707; // lwc1 f6, L35(fp)
c->vmul(DEST::xyzw, vf5, vf11, vf1); // vmul.xyzw vf5, vf11, vf1
c->vadd_bc(DEST::x, BC::y, vf5, vf5, vf5); // vaddy.x vf5, vf5, vf5
c->vadd_bc(DEST::x, BC::z, vf5, vf5, vf5); // vaddz.x vf5, vf5, vf5
c->mov128_gpr_vf(a2, vf5); // qmfc2.i a2, vf5
c->mtc1(f7, a2); // mtc1 f7, a2
cop1_bc = c->fprs[f7] < c->fprs[f6]; // c.lt.s f7, f6
bc = cop1_bc; // bc1t L26
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
c->mfc1(s2, f2); // mfc1 s2, f2
c->sqc2(vf7, 0, gp); // sqc2 vf7, 0(gp)
c->sqc2(vf8, 16, gp); // sqc2 vf8, 16(gp)
c->sqc2(vf9, 32, gp); // sqc2 vf9, 32(gp)
c->sqc2(vf2, 48, gp); // sqc2 vf2, 48(gp)
c->sqc2(vf1, 64, gp); // sqc2 vf1, 64(gp)
//beq r0, r0, L26 // beq r0, r0, L26
c->sw(a1, 80, gp); // sw a1, 80(gp)
goto block_1; // branch always
block_14:
c->mov64(v0, s2); // or v0, s2, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->ld(fp, 8, sp); // ld fp, 8(sp)
c->lq(gp, 144, sp); // lq gp, 144(sp)
c->lq(s5, 128, sp); // lq s5, 128(sp)
c->lq(s4, 112, sp); // lq s4, 112(sp)
c->lq(s3, 96, sp); // lq s3, 96(sp)
c->lq(s2, 80, sp); // lq s2, 80(sp)
c->lq(s1, 64, sp); // lq s1, 64(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 160); // daddiu sp, sp, 160
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.closest_pt_in_triangle = intern_from_c("closest-pt-in-triangle").c();
gLinkedFunctionTable.reg("(method 12 collide-mesh)", execute, 256);
}
} // namespace method_12_collide_mesh
} // namespace Mips2C
//--------------------------MIPS2C---------------------
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/kscheme.h"
namespace Mips2C {
namespace method_11_collide_mesh {
struct Cache {
void* closest_pt_in_triangle; // closest-pt-in-triangle
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
c->daddiu(sp, sp, -160); // daddiu sp, sp, -160
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(s1, 64, sp); // sq s1, 64(sp)
c->sq(s2, 80, sp); // sq s2, 80(sp)
c->sq(s3, 96, sp); // sq s3, 96(sp)
c->sq(s4, 112, sp); // sq s4, 112(sp)
c->sq(s5, 128, sp); // sq s5, 128(sp)
c->sq(gp, 144, sp); // sq gp, 144(sp)
c->mov64(gp, a2); // or gp, a2, r0
c->mov64(s5, a3); // or s5, a3, r0
c->mov64(s1, t0); // or s1, t0, r0
c->daddiu(s4, sp, 16); // daddiu s4, sp, 16
// nop // sll r0, r0, 0
c->mov64(s3, a1); // or s3, a1, r0
c->lqc2(vf3, 0, s5); // lqc2 vf3, 0(s5)
// nop // sll r0, r0, 0
c->lwu(s2, 4, a0); // lwu s2, 4(a0)
c->vsub_bc(DEST::xyzw, BC::w, vf12, vf3, vf3); // vsubw.xyzw vf12, vf3, vf3
// nop // sll r0, r0, 0
c->vadd_bc(DEST::xyzw, BC::w, vf13, vf3, vf3); // vaddw.xyzw vf13, vf3, vf3
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf12, vf12); // vftoi0.xyzw vf12, vf12
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf13, vf13); // vftoi0.xyzw vf13, vf13
// nop // sll r0, r0, 0
c->mov128_gpr_vf(v1, vf12); // qmfc2.i v1, vf12
c->sqc2(vf12, 16, s4); // sqc2 vf12, 16(s4)
c->mov128_gpr_vf(a0, vf13); // qmfc2.i a0, vf13
c->sqc2(vf13, 32, s4); // sqc2 vf13, 32(s4)
block_1:
bc = c->sgpr64(s2) == 0; // beq s2, r0, L24
c->lq(a2, 64, s3); // lq a2, 64(s3)
if (bc) {goto block_10;} // branch non-likely
c->daddiu(s2, s2, -1); // daddiu s2, s2, -1
c->lq(a1, 80, s3); // lq a1, 80(s3)
c->pcgtw(a2, a2, a0); // pcgtw a2, a2, a0
c->mfc1(r0, f31); // mfc1 r0, f31
c->pcgtw(a1, v1, a1); // pcgtw a1, v1, a1
c->mfc1(r0, f31); // mfc1 r0, f31
c->por(a1, a2, a1); // por a1, a2, a1
// nop // sll r0, r0, 0
c->ppach(a1, r0, a1); // ppach a1, r0, a1
c->mfc1(r0, f31); // mfc1 r0, f31
c->dsll(a1, a1, 16); // dsll a1, a1, 16
// nop // sll r0, r0, 0
if (((s64)c->sgpr64(a1)) != ((s64)0)) { // bnel a1, r0, L22
c->daddiu(s3, s3, 96); // daddiu s3, s3, 96
goto block_1;
}
block_4:
c->load_symbol(t9, cache.closest_pt_in_triangle); // lw t9, closest-pt-in-triangle(s7)
c->daddu(a0, r0, s4); // daddu a0, r0, s4
c->mov64(a1, s5); // or a1, s5, r0
c->daddu(a2, r0, s3); // daddu a2, r0, s3
c->daddiu(a3, s3, 48); // daddiu a3, s3, 48
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
c->lqc2(vf2, 0, s4); // lqc2 vf2, 0(s4)
c->lqc2(vf3, 0, s5); // lqc2 vf3, 0(s5)
c->lqc2(vf1, 48, s3); // lqc2 vf1, 48(s3)
c->lq(v1, 16, s4); // lq v1, 16(s4)
c->lq(a0, 32, s4); // lq a0, 32(s4)
c->vsub(DEST::xyzw, vf4, vf3, vf2); // vsub.xyzw vf4, vf3, vf2
c->lwu(a1, 60, s3); // lwu a1, 60(s3)
c->vmul(DEST::xyzw, vf5, vf4, vf1); // vmul.xyzw vf5, vf4, vf1
c->lqc2(vf7, 0, s3); // lqc2 vf7, 0(s3)
c->vmul(DEST::xyzw, vf6, vf4, vf4); // vmul.xyzw vf6, vf4, vf4
c->lqc2(vf8, 16, s3); // lqc2 vf8, 16(s3)
c->vmove(DEST::w, vf1, vf0); // vmove.w vf1, vf0
c->lqc2(vf9, 32, s3); // lqc2 vf9, 32(s3)
c->vadd_bc(DEST::y, BC::x, vf5, vf5, vf5); // vaddx.y vf5, vf5, vf5
c->daddiu(s3, s3, 96); // daddiu s3, s3, 96
c->vadd_bc(DEST::x, BC::y, vf6, vf6, vf6); // vaddy.x vf6, vf6, vf6
c->mtc1(f3, s1); // mtc1 f3, s1
c->vadd_bc(DEST::y, BC::z, vf5, vf5, vf5); // vaddz.y vf5, vf5, vf5
c->vadd_bc(DEST::x, BC::z, vf6, vf6, vf6); // vaddz.x vf6, vf6, vf6
c->vsqrt(vf6, BC::x); // vsqrt Q, vf6.x
c->mov128_gpr_vf(a2, vf5); // qmfc2.i a2, vf5
c->mtc1(f0, r0); // mtc1 f0, r0
c->vwaitq(); // vwaitq
c->lwc1(f1, 12, s5); // lwc1 f1, 12(s5)
c->vaddq(DEST::x, vf6, vf0); // vaddq.x vf6, vf0, Q
c->vmove(DEST::xyzw, vf10, vf6); // vmove.xyzw vf10, vf6
if (((s64)c->sgpr64(a2)) < 0) { // bltzl a2, L23
c->vsub(DEST::xyzw, vf10, vf0, vf10); // vsub.xyzw vf10, vf0, vf10
goto block_6;
}
block_6:
c->mov128_gpr_vf(a2, vf10); // qmfc2.i a2, vf10
c->mtc1(f2, a2); // mtc1 f2, a2
c->subs(f2, f2, f1); // sub.s f2, f2, f1
c->vdiv(vf0, BC::w, vf6, BC::x); // vdiv Q, vf0.w, vf6.x
cop1_bc = c->fprs[f3] < c->fprs[f2]; // c.lt.s f3, f2
bc = cop1_bc; // bc1t L22
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
cop1_bc = c->fprs[f0] <= c->fprs[f2]; // c.le.s f0, f2
bc = cop1_bc; // bc1t L22
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
c->vwaitq(); // vwaitq
// nop // sll r0, r0, 0
c->vmulq(DEST::xyzw, vf11, vf4); // vmulq.xyzw vf11, vf4, Q
c->fprs[f4] = 0.707; // lwc1 f4, L35(fp)
c->vmul(DEST::xyzw, vf5, vf11, vf1); // vmul.xyzw vf5, vf11, vf1
c->vadd_bc(DEST::x, BC::y, vf5, vf5, vf5); // vaddy.x vf5, vf5, vf5
c->vadd_bc(DEST::x, BC::z, vf5, vf5, vf5); // vaddz.x vf5, vf5, vf5
c->mov128_gpr_vf(a2, vf5); // qmfc2.i a2, vf5
c->mtc1(f5, a2); // mtc1 f5, a2
cop1_bc = c->fprs[f5] < c->fprs[f4]; // c.lt.s f5, f4
bc = cop1_bc; // bc1t L22
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
c->mfc1(s1, f2); // mfc1 s1, f2
c->sqc2(vf7, 0, gp); // sqc2 vf7, 0(gp)
c->sqc2(vf8, 16, gp); // sqc2 vf8, 16(gp)
c->sqc2(vf9, 32, gp); // sqc2 vf9, 32(gp)
c->sqc2(vf2, 48, gp); // sqc2 vf2, 48(gp)
c->sqc2(vf1, 64, gp); // sqc2 vf1, 64(gp)
//beq r0, r0, L22 // beq r0, r0, L22
c->sw(a1, 80, gp); // sw a1, 80(gp)
goto block_1; // branch always
block_10:
c->mov64(v0, s1); // or v0, s1, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->ld(fp, 8, sp); // ld fp, 8(sp)
c->lq(gp, 144, sp); // lq gp, 144(sp)
c->lq(s5, 128, sp); // lq s5, 128(sp)
c->lq(s4, 112, sp); // lq s4, 112(sp)
c->lq(s3, 96, sp); // lq s3, 96(sp)
c->lq(s2, 80, sp); // lq s2, 80(sp)
c->lq(s1, 64, sp); // lq s1, 64(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 160); // daddiu sp, sp, 160
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.closest_pt_in_triangle = intern_from_c("closest-pt-in-triangle").c();
gLinkedFunctionTable.reg("(method 11 collide-mesh)", execute, 512);
}
} // namespace method_11_collide_mesh
} // namespace Mips2C
+10 -1
View File
@@ -108,6 +108,14 @@ namespace moving_sphere_triangle_intersect {
extern void link();
}
namespace method_12_collide_mesh {
extern void link();
}
namespace method_11_collide_mesh {
extern void link();
}
LinkedFunctionTable gLinkedFunctionTable;
Rng gRng;
std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks = {
@@ -125,7 +133,8 @@ std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks =
draw_boundary_polygon::link}},
{"tfrag", {draw_inline_array_tfrag::link, stats_tfrag_asm::link}},
{"time-of-day", {time_of_day_interp_colors_scratch::link}},
{"collide-func", {collide_do_primitives::link, moving_sphere_triangle_intersect::link}}};
{"collide-func", {collide_do_primitives::link, moving_sphere_triangle_intersect::link}},
{"collide-mesh", {method_12_collide_mesh::link, method_11_collide_mesh::link}}};
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
const auto& it = m_executes.insert({name, {exec, Ptr<u8>()}});
+118 -120
View File
@@ -65,10 +65,9 @@
(set! (-> self foot-offset) (-> *CAMERA_MASTER-bank* onscreen-foot-height))
(set! (-> self head-offset) (-> *CAMERA_MASTER-bank* onscreen-head-height))
(set! (-> self target-height) (-> *CAMERA_MASTER-bank* target-height))
(set! (-> self on-ground) (not (and
(logtest? (-> *target* control unknown-surface00 flags) 2048)
(zero? (logand (-> *target* control status) 1))
)
(set! (-> self on-ground) (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048)
(zero? (logand (-> *target* control status) 1))
)
)
)
(set! (-> self on-pole) #f)
@@ -78,10 +77,10 @@
(set! (-> self string-push-z) (fmax (-> self string-min value z) (-> *CAMERA-bank* default-string-push-z)))
(cond
((>= (- (-> *display* base-frame-counter) (if *target*
(-> *target* neck notice-time)
0
)
)
(-> *target* neck notice-time)
0
)
)
(the-as int (-> *CAMERA-bank* attack-timeout))
)
(set! (-> self being-attacked) #f)
@@ -89,10 +88,9 @@
(else
(set! (-> self attack-start) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self being-attacked) #t)
(when (and
(zero? (logand (-> self master-options) 64))
(or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0))
)
(when (and (zero? (logand (-> self master-options) 64))
(or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0))
)
(set! (-> self string-max target y) (fmax (-> self string-max target y) (-> last-try-to-look-at-data vert)))
(set! (-> self string-max target z) (fmax (-> self string-max target z) (-> last-try-to-look-at-data horz)))
(set! (-> self string-push-z) (fmax (-> self string-push-z) (-> self string-max target z)))
@@ -203,11 +201,10 @@
(defbehavior master-track-target camera-master ()
(cond
((and
(logtest? (-> self master-options) 2)
(!= (-> self drawable-target) #f)
(not (handle->process (-> self drawable-target)))
)
((and (logtest? (-> self master-options) 2)
(!= (-> self drawable-target) #f)
(not (handle->process (-> self drawable-target)))
)
(set! (-> self master-options) (logand -3 (-> self master-options)))
(set! (-> self drawable-target) (the-as handle #f))
)
@@ -300,10 +297,10 @@
)
(cond
((>= (- (-> *display* base-frame-counter) (if *target*
(-> *target* neck notice-time)
0
)
)
(-> *target* neck notice-time)
0
)
)
(the-as int (-> *CAMERA-bank* attack-timeout))
)
(set! (-> self being-attacked) #f)
@@ -313,10 +310,9 @@
(set! (-> self attack-start) (the-as uint (-> *display* base-frame-counter)))
)
(set! (-> self being-attacked) #t)
(when (and
(zero? (logand (-> self master-options) 64))
(or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0))
)
(when (and (zero? (logand (-> self master-options) 64))
(or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0))
)
(set! (-> self string-max target y) (fmax (-> self string-max target y) (-> last-try-to-look-at-data vert)))
(set! (-> self string-max target z) (fmax (-> self string-max target z) (-> last-try-to-look-at-data horz)))
(set! (-> self string-push-z) (fmax (-> self string-push-z) (-> self string-max target z)))
@@ -363,7 +359,7 @@
(set! (-> self tpos-curr quad) (-> (target-cam-pos) quad))
)
)
(when (logtest? (-> *target* control root-prim prim-core action) 128)
(when (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-7))
(if *display-cam-los-debug*
(format *stdcon* "ride edge~%")
)
@@ -374,29 +370,37 @@
(vector--float*! s5-2 (-> self tpos-curr) (-> self local-down) (-> self target-height))
(vector-float*! gp-5 (-> self tgt-rot-mat vector 2) 4915.2)
(vector-! s5-2 s5-2 gp-5)
(let ((f0-20 (dummy-10 *collide-cache* s5-2 gp-5 4300.8 1 (the-as process #f) s4-2 4098)))
(let ((f0-20 (fill-and-probe-using-line-sphere
*collide-cache*
s5-2
gp-5
4300.8
(collide-kind background)
(the-as process #f)
s4-2
4098
)
)
)
(if (and (< 0.0 f0-20) (< f0-20 1.0))
(vector+float*! (-> self tpos-curr) (-> self tpos-curr) gp-5 (+ -1.0 f0-20))
)
)
)
)
(set! (-> self on-ground) (not (and
(logtest? (-> *target* control unknown-surface00 flags) 2048)
(zero? (logand (-> *target* control status) 1))
)
(set! (-> self on-ground) (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048)
(zero? (logand (-> *target* control status) 1))
)
)
)
(let ((gp-6 (new-stack-vector0)))
0.0
(cond
((and
(and
(logtest? (-> *target* control unknown-surface00 flags) 2048)
(zero? (logand (-> *target* control status) 1))
)
(!= (-> *target* control unknown-surface00 name) 'launch-jump)
)
((and (and (logtest? (-> *target* control unknown-surface00 flags) 2048)
(zero? (logand (-> *target* control status) 1))
)
(!= (-> *target* control unknown-surface00 name) 'launch-jump)
)
(if *display-cam-los-debug*
(format *stdcon* "air tracking~%")
)
@@ -534,9 +538,9 @@
(else
(dotimes (a0-2 (the-as int (-> sv-16 elt-count)))
(if (< arg2 (- (vector-dot arg0 (-> (the-as (inline-array vector) v1-1) a0-2))
(-> (the-as (inline-array vector) v1-1) a0-2 w)
)
)
(-> (the-as (inline-array vector) v1-1) a0-2 w)
)
)
(goto cfg-12)
)
)
@@ -780,43 +784,39 @@
((or (not *target*) (logtest? (-> self master-options) 1))
(master-unset-region)
)
((and
(logtest? (-> self master-options) 4)
(not (-> self on-ground))
(or (not (-> self cam-entity)) (zero? (logand #x20000 (cam-slave-get-flags (-> self cam-entity) 'flags))))
)
((and (logtest? (-> self master-options) 4)
(not (-> self on-ground))
(or (not (-> self cam-entity)) (zero? (logand #x20000 (cam-slave-get-flags (-> self cam-entity) 'flags))))
)
#f
)
((and
(-> self cam-entity)
(not (in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 0.0 'cutoutvol))
(or
(in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 1024.0 'pvol)
(in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 1024.0 'vol)
(and
(not ((method-of-type res-lump get-property-data)
(-> self cam-entity)
'pvol
'exact
0.0
(the-as pointer #f)
(the-as (pointer res-tag) #f)
*res-static-buf*
)
)
(not ((method-of-type res-lump get-property-data)
(-> self cam-entity)
'vol
'exact
0.0
(the-as pointer #f)
(the-as (pointer res-tag) #f)
*res-static-buf*
)
)
)
)
)
((and (-> self cam-entity)
(not (in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 0.0 'cutoutvol))
(or (in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 1024.0 'pvol)
(in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 1024.0 'vol)
(and (not ((method-of-type res-lump get-property-data)
(-> self cam-entity)
'pvol
'exact
0.0
(the-as pointer #f)
(the-as (pointer res-tag) #f)
*res-static-buf*
)
)
(not ((method-of-type res-lump get-property-data)
(-> self cam-entity)
'vol
'exact
0.0
(the-as pointer #f)
(the-as (pointer res-tag) #f)
*res-static-buf*
)
)
)
)
)
#f
)
(else
@@ -825,10 +825,9 @@
(let ((gp-5 (-> v1-17 next0)))
(while (!= v1-17 (-> *camera-engine* alive-list-end))
(let ((s5-1 (-> (the-as connection v1-17) param1)))
(when (and
(not (in-cam-entity-volume? (target-pos 0) (the-as entity s5-1) 1024.0 'cutoutvol))
(in-cam-entity-volume? (target-pos 0) (the-as entity s5-1) 0.0 'vol)
)
(when (and (not (in-cam-entity-volume? (target-pos 0) (the-as entity s5-1) 1024.0 'cutoutvol))
(in-cam-entity-volume? (target-pos 0) (the-as entity s5-1) 0.0 'vol)
)
(if (master-switch-to-entity (the-as entity s5-1))
(return #t)
)
@@ -849,42 +848,42 @@
(defstate cam-master-active (camera-master)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-0 object)) ;; hack
(rlet ((vf0 :class vf))
(init-vf0-vector)
(let ((v1-0 arg2))
(cond
((= v1-0 'dist-from-interp-src)
(set! v0-0 (the-as object (cond
((not *camera-combiner*)
409600.0
)
((= (-> *camera-combiner* interp-val) 0.0)
0.0
)
(else
(-> *camera-combiner* dist-from-src)
)
)
)
)
)
((= v1-0 'dist-from-interp-dest)
(set! v0-0 (the-as object (cond
((not *camera-combiner*)
0.0
)
((= (-> *camera-combiner* interp-val) 0.0)
409600.0
)
(else
(-> *camera-combiner* dist-from-dest)
)
)
)
)
)
((= v1-0 'level-deactivate)
(local-vars (v0-0 object));; todo
(rlet ((vf0 :class vf))
(init-vf0-vector)
(let ((v1-0 arg2))
(cond
((= v1-0 'dist-from-interp-src)
(set! v0-0 (the-as object (cond
((not *camera-combiner*)
409600.0
)
((= (-> *camera-combiner* interp-val) 0.0)
0.0
)
(else
(-> *camera-combiner* dist-from-src)
)
)
)
)
)
((= v1-0 'dist-from-interp-dest)
(set! v0-0 (the-as object (cond
((not *camera-combiner*)
0.0
)
((= (-> *camera-combiner* interp-val) 0.0)
409600.0
)
(else
(-> *camera-combiner* dist-from-dest)
)
)
)
)
)
((= v1-0 'level-deactivate)
(set! v0-0 (the-as
object
(if (and (-> self cam-entity) (= (-> (get-level (-> self cam-entity)) name) (-> arg3 param 0)))
@@ -1106,10 +1105,9 @@
)
)
)
(if (and
(> (-> self num-slaves) 0)
(or (= (-> self slave 0 0 next-state name) 'cam-stick) (= (-> self slave 0 0 next-state name) 'cam-string))
)
(if (and (> (-> self num-slaves) 0)
(or (= (-> self slave 0 0 next-state name) 'cam-stick) (= (-> self slave 0 0 next-state name) 'cam-string))
)
(set! (-> self view-off-param-save) (-> self slave 0 0 view-off-param))
)
(set! (-> self changer) (the-as uint (process->ppointer arg0)))
+175 -160
View File
@@ -632,7 +632,10 @@
(none)
)
:exit
(behavior () '() (none))
(behavior ()
'()
(none)
)
:trans
(behavior ()
(if (zero? (logand (-> *camera* master-options) 2))
@@ -763,8 +766,8 @@
(curve-get-pos! s5-1 (the-as float 0.0) (-> self spline-curve))
(curve-get-pos! gp-1 (the-as float 1.0) (-> self spline-curve))
(if (< (vector-vector-distance-squared s5-1 (-> self tracking follow-pt))
(vector-vector-distance-squared gp-1 (-> self tracking follow-pt))
)
(vector-vector-distance-squared gp-1 (-> self tracking follow-pt))
)
(set! (-> self spline-follow-dist) (- (-> self spline-follow-dist)))
)
)
@@ -860,10 +863,9 @@
(curve-get-pos! gp-0 (parameter-ease-sin-clamp (-> *camera* outro-t)) (-> *camera* outro-curve))
(vector-! gp-0 gp-0 s5-0)
(cond
((or
(and (< (-> *camera* outro-t-step) 0.0) (>= (-> *camera* outro-exit-value) (-> *camera* outro-t)))
(and (< 0.0 (-> *camera* outro-t-step)) (>= (-> *camera* outro-t) (-> *camera* outro-exit-value)))
)
((or (and (< (-> *camera* outro-t-step) 0.0) (>= (-> *camera* outro-exit-value) (-> *camera* outro-t)))
(and (< 0.0 (-> *camera* outro-t-step)) (>= (-> *camera* outro-t) (-> *camera* outro-exit-value)))
)
(set! (-> *camera* outro-t) (-> *camera* outro-exit-value))
(set! (-> *camera* outro-t-step) 0.0)
(vector+! (-> self velocity) (-> self velocity) gp-0)
@@ -1026,13 +1028,11 @@
)
(vector-matrix*! arg0 arg1 s3-0)
)
((and
(logtest? (-> self options) 2)
(or
(and (>= f26-0 (+ -8192.0 f30-0)) (>= f30-0 (+ -8192.0 (-> self pivot-rad))))
(and (>= (+ 8192.0 f30-0) f26-0) (>= (+ 8192.0 (-> self pivot-rad)) f30-0))
)
)
((and (logtest? (-> self options) 2)
(or (and (>= f26-0 (+ -8192.0 f30-0)) (>= f30-0 (+ -8192.0 (-> self pivot-rad))))
(and (>= (+ 8192.0 f30-0) f26-0) (>= (+ 8192.0 (-> self pivot-rad)) f30-0))
)
)
(let ((s2-1 (new 'stack-no-clear 'vector)))
(vector-cross! s2-1 arg1 arg0)
(vector-normalize! s2-1 (the-as float 1.0))
@@ -1171,10 +1171,9 @@
)
(set! (-> self fov1) (cam-slave-get-float (-> self cam-entity) 'focalPull (the-as float 0.0)))
(cond
((and
(!= (-> self fov1) 0.0)
(dummy-9 (-> self fov-index) 'focalpull (-> self cam-entity) (-> self saved-pt) (the-as curve #f))
)
((and (!= (-> self fov1) 0.0)
(dummy-9 (-> self fov-index) 'focalpull (-> self cam-entity) (-> self saved-pt) (the-as curve #f))
)
(set! (-> self fov0) (-> self fov))
(set! (-> self fov)
(lerp-clamp (-> self fov0) (-> self fov1) (dummy-10 (-> self fov-index) (-> *camera* tpos-curr-adj)))
@@ -1293,18 +1292,18 @@
(set! (-> arg0 quad) (-> s5-0 quad))
(while #t
(vector--float*! s4-0 arg0 (-> *camera* local-down) (-> *camera* target-height))
(if (< (dummy-10
*collide-cache*
(-> *camera* tpos-curr-adj)
arg0
(the-as float 409.6)
#x4a09
(the-as process #f)
s3-0
2
)
0.0
(if (< (fill-and-probe-using-line-sphere
*collide-cache*
(-> *camera* tpos-curr-adj)
arg0
(the-as float 409.6)
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s3-0
2
)
0.0
)
(return #t)
)
(set! f30-0 (cond
@@ -1619,7 +1618,15 @@
)
0.0
(vector-! s5-0 arg1 arg0)
(dummy-14 s4-0 arg0 s5-0 (-> *CAM_STRING-bank* los-coll-rad2) #x4a09 (the-as process #f) (the-as int arg2))
(fill-using-line-sphere
s4-0
arg0
s5-0
(-> *CAM_STRING-bank* los-coll-rad2)
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process-drawable #f)
(the-as int arg2)
)
(let* ((f0-2 (vector-length s5-0))
(f28-0
(cond
@@ -1685,26 +1692,20 @@
)
(vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad)))
)
((and
(or
(< 0.01 (-> arg0 vert-1 y))
(and
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
(< 0.01 (the-as float (-> arg0 gap-poly)))
)
)
(or
(< (-> arg0 vert-1 x) -0.01)
(and
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
(< (the-as float (-> arg0 poly)) -0.01)
)
)
(and
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(or (< (-> arg0 boundary-normal y) 0.01) (< -0.01 (-> arg0 boundary-normal x)))
)
)
((and (or (< 0.01 (-> arg0 vert-1 y))
(and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
(< 0.01 (the-as float (-> arg0 gap-poly)))
)
)
(or (< (-> arg0 vert-1 x) -0.01)
(and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
(< (the-as float (-> arg0 poly)) -0.01)
)
)
(and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(or (< (-> arg0 boundary-normal y) 0.01) (< -0.01 (-> arg0 boundary-normal x)))
)
)
(when (not (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))))
)
(if (not (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))))
@@ -1716,26 +1717,20 @@
(set! (-> self los-state) (slave-los-state ccw))
(vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad)))
)
((and
(or
(< 0.01 (-> arg0 vert-1 w))
(and
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(< 0.01 (-> arg0 boundary-normal y))
)
)
(or
(< (-> arg0 vert-1 z) -0.01)
(and
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(< (-> arg0 boundary-normal x) -0.01)
)
)
(and
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
(or (< (the-as float (-> arg0 gap-poly)) 0.01) (< -0.01 (the-as float (-> arg0 poly))))
)
)
((and (or (< 0.01 (-> arg0 vert-1 w))
(and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(< 0.01 (-> arg0 boundary-normal y))
)
)
(or (< (-> arg0 vert-1 z) -0.01)
(and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(< (-> arg0 boundary-normal x) -0.01)
)
)
(and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
(or (< (the-as float (-> arg0 gap-poly)) 0.01) (< -0.01 (the-as float (-> arg0 poly))))
)
)
(if (not (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))))
(format #t "s diag cw invalid ccw~%")
)
@@ -1764,36 +1759,33 @@
)
)
)
((and
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
(< 0.01 (the-as float (-> arg0 gap-poly)))
(< (the-as float (-> arg0 poly)) -0.01)
(or (< (-> arg0 boundary-normal y) 0.01) (< -0.01 (-> arg0 boundary-normal x)))
)
((and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
(< 0.01 (the-as float (-> arg0 gap-poly)))
(< (the-as float (-> arg0 poly)) -0.01)
(or (< (-> arg0 boundary-normal y) 0.01) (< -0.01 (-> arg0 boundary-normal x)))
)
(if *display-cam-los-debug*
(format *stdcon* "diagonal ccw~%")
)
(set! (-> self los-state) (slave-los-state ccw))
(vector-normalize! arg1 (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 next-normal z)))
)
((and
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
(< 0.01 (-> arg0 boundary-normal y))
(< (-> arg0 boundary-normal x) -0.01)
(or (< (the-as float (-> arg0 gap-poly)) 0.01) (< -0.01 (the-as float (-> arg0 poly))))
)
((and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
(< 0.01 (-> arg0 boundary-normal y))
(< (-> arg0 boundary-normal x) -0.01)
(or (< (the-as float (-> arg0 gap-poly)) 0.01) (< -0.01 (the-as float (-> arg0 poly))))
)
(if *display-cam-los-debug*
(format *stdcon* "diagonal cw~%")
)
(set! (-> self los-state) (slave-los-state cw))
(vector-normalize! arg1 (- (-> arg0 intersection z) (-> *CAM_STRING-bank* los-coll-rad)))
)
((and
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
)
((and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))
(dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))
)
(set! (-> self los-state) (slave-los-state between))
(vector-normalize! arg1 (the-as float 0.0001))
)
@@ -1849,7 +1841,15 @@
(f26-0 (vector-length arg1))
(f30-0 (vector-normalize-ret-len! s4-0 (the-as float 1.0)))
)
(dummy-14 s0-0 arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) #x4a09 (the-as process #f) arg3)
(fill-using-line-sphere
s0-0
arg0
arg1
(-> *CAM_STRING-bank* los-coll-rad)
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process-drawable #f)
arg3
)
(let ((s1-1 (-> s0-0 tris))
(f28-0 (/ 2048.0 f26-0))
(f26-1 (/ (+ -8192.0 f26-0) f26-0))
@@ -1879,9 +1879,10 @@
(f6-0 (-> sv-224 y))
(f7-0 (-> sv-224 z))
)
; (.mula.s f2-0 f5-0)
; (.madda.s f3-0 f6-0)
; (.madd.s f2-1 f4-0 f7-0) TODO - fix me
; (.mula.s f2-0 f5-0)
; (.madda.s f3-0 f6-0)
; (.madd.s f2-1 f4-0 f7-0)
(set! f2-1 (+ (* f2-0 f5-0) (* f3-0 f6-0) (* f4-0 f7-0)))
)
(< f1-2 f2-1)
)
@@ -2007,26 +2008,24 @@
)
(set! s2-2 (-> self los-tgt-spline-pt))
(set! s1-3 -134250495)
(while (and
(!= s2-2 -134250495)
(begin
(set! f30-1
(cam-los-spline-collide
(the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 s2-2)))
arg0
(the-as vector 4098)
)
)
(< f30-1 0.0)
)
)
(while (and (!= s2-2 -134250495)
(begin
(set! f30-1
(cam-los-spline-collide
(the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 s2-2)))
arg0
(the-as vector 4098)
)
)
(< f30-1 0.0)
)
)
(set! s1-3 s2-2)
(set! s2-2 (-> *camera* target-spline point s2-2 next))
)
(and
(= s2-2 (-> *camera* target-spline used-point))
(!= (-> *camera* target-spline point s2-2 next) -134250495)
)
(and (= s2-2 (-> *camera* target-spline used-point))
(!= (-> *camera* target-spline point s2-2 next) -134250495)
)
)
(when *display-cam-los-debug*
(format 0 "looking at used point~%")
@@ -2082,10 +2081,9 @@
(set! f28-1 0.4096)
)
(let ((f30-2 (cond
((and
(= (-> self string-vel-dir) 6)
(< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity)))
)
((and (= (-> self string-vel-dir) 6)
(< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity)))
)
(fmin 1.0 (+ 0.001 f30-1))
)
((= (-> self string-vel-dir) 6)
@@ -2105,11 +2103,10 @@
)
(vector-flatten! s2-3 s2-3 (-> *camera* local-down))
(cond
((and
(< (fabs (- (-> self desired-pos y) (-> self trans y))) 8192.0)
(< f28-1 (+ 1024.0 (-> self string-min-val z)))
(< (vector-length s2-3) 8192.0)
)
((and (< (fabs (- (-> self desired-pos y) (-> self trans y))) 8192.0)
(< f28-1 (+ 1024.0 (-> self string-min-val z)))
(< (vector-length s2-3) 8192.0)
)
(set! f30-2 0.0)
)
((< f28-1 (+ 1024.0 (-> self string-min-val z)))
@@ -2257,10 +2254,9 @@
((< f28-0 f0-4)
(vector-normalize! (-> self view-flat) f0-4)
)
((and
(< f30-0 f28-0)
(or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw)))
)
((and (< f30-0 f28-0)
(or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw)))
)
(vector-normalize! (-> self view-flat) f30-0)
)
((< f26-0 f28-0)
@@ -2352,10 +2348,9 @@
(if (-> self have-phony-joystick)
(set! f28-0 (* 0.05 (-> self phony-joystick-y)))
)
(if (and
(-> *camera* being-attacked)
(< (- (-> *display* base-frame-counter) (the-as int (-> *camera* attack-start))) 75)
)
(if (and (-> *camera* being-attacked)
(< (- (-> *display* base-frame-counter) (the-as int (-> *camera* attack-start))) 75)
)
(set! f28-0 0.05)
)
(if (!= f28-0 0.0)
@@ -2395,10 +2390,9 @@
)
((and (>= f28-0 0.0) (>= f0-16 1.0))
)
((and
(< 0.0 f28-0)
(or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw)))
)
((and (< 0.0 f28-0)
(or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw)))
)
)
((< (* 0.05 (- 1.0 f0-16)) f28-0)
(let ((f0-17 (+ f0-16 (* 0.05 (- 1.0 f0-16)))))
@@ -2508,7 +2502,16 @@
(vector--float*! s5-0 (-> *camera* tpos-curr-adj) (-> *camera* local-down) (-> *camera* target-height))
(vector-! s5-0 s5-0 (-> self string-trans))
(cond
((< (dummy-10 *collide-cache* (-> self string-trans) s5-0 (the-as float 40.96) #x4a09 (the-as process #f) s4-0 2)
((< (fill-and-probe-using-line-sphere
*collide-cache*
(-> self string-trans)
s5-0
(the-as float 40.96)
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s4-0
2
)
0.0
)
(set! (-> self time-dist-too-far) (the-as uint 0))
@@ -2555,10 +2558,9 @@
(vector-normalize-copy! s4-1 (-> self view-flat) (the-as float 1.0))
(vector-cross! gp-1 s4-1 s5-1)
(cond
((and
(< (vector-length (-> self velocity)) (-> *CAMERA-bank* min-detectable-velocity))
(< (vector-length s3-0) (-> *CAMERA-bank* min-detectable-velocity))
)
((and (< (vector-length (-> self velocity)) (-> *CAMERA-bank* min-detectable-velocity))
(< (vector-length s3-0) (-> *CAMERA-bank* min-detectable-velocity))
)
(set! (-> self string-vel-dir) (the-as uint 0))
0
)
@@ -2595,21 +2597,20 @@
(cam-collision-record-save (-> self string-trans) (-> self velocity) -1 'no-hit self)
)
)
(while (and
(< 0.01 f30-2)
(and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (< gp-2 4))
)
(while (and (< 0.01 f30-2)
(and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (< gp-2 4))
)
(vector-float*! s5-2 (-> self velocity) f30-2)
(if *debug-segment*
(cam-collision-record-save (-> self string-trans) s5-2 gp-2 'normal self)
)
(let ((f28-1 (if (logtest? (-> self options) 32)
(dummy-10
(fill-and-probe-using-line-sphere
*collide-cache*
(-> self string-trans)
s5-2
(-> *CAMERA-bank* collide-move-rad)
#x4a09
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s4-2
2
@@ -2904,9 +2905,17 @@
)
(vector--float*! s5-0 (-> *camera* tpos-curr-adj) (-> *camera* local-down) (-> *camera* target-height))
(vector-! gp-1 (-> self string-trans) s5-0)
(let ((f0-31
(dummy-10 *collide-cache* s5-0 gp-1 (-> *CAMERA-bank* collide-move-rad) #x4a09 (the-as process #f) s4-0 4098)
)
(let ((f0-31 (fill-and-probe-using-line-sphere
*collide-cache*
s5-0
gp-1
(-> *CAMERA-bank* collide-move-rad)
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s4-0
4098
)
)
)
(when (and (< 0.0 f0-31) (< f0-31 1.0))
(vector-float*! gp-1 gp-1 f0-31)
@@ -3029,19 +3038,18 @@
(s2-0 0)
)
(let ((s3-0 (new 'stack-no-clear 'collide-tri-result)))
(while (and
(< 0.01 f30-1)
(and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (> s4-0 0))
)
(while (and (< 0.01 f30-1)
(and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (> s4-0 0))
)
(+! s4-0 -1)
(vector-float*! gp-2 (-> self velocity) f30-1)
(let ((f28-0 (if (logtest? (-> self options) 32)
(dummy-10
(fill-and-probe-using-line-sphere
*collide-cache*
(-> self trans)
gp-2
(-> *CAMERA-bank* collide-move-rad)
#x4a09
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s3-0
2
@@ -3299,18 +3307,25 @@
(s5-3 4)
(s4-3 (new 'stack-no-clear 'collide-tri-result))
)
(while (and
(< 0.01 f30-2)
(and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (> s5-3 0))
)
(while (and (< 0.01 f30-2)
(and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (> s5-3 0))
)
(+! s5-3 -1)
(vector-float*! gp-3 (-> self velocity) f30-2)
(let ((f28-0
(if (logtest? (-> self options) 32)
(dummy-10 *collide-cache* (-> self trans) gp-3 (the-as float 4096.0) #x4a09 (the-as process #f) s4-3 2)
-100000000.0
)
)
(let ((f28-0 (if (logtest? (-> self options) 32)
(fill-and-probe-using-line-sphere
*collide-cache*
(-> self trans)
gp-3
(the-as float 4096.0)
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s4-3
2
)
-100000000.0
)
)
)
(cond
((>= f28-0 0.0)
+30 -28
View File
@@ -63,7 +63,7 @@
;; primitive using y probe
(deftype collide-puyp-work (structure)
((best-u float :offset-assert 0)
(ignore-pat uint32 :offset-assert 4)
(ignore-pat pat-surface :offset-assert 4)
(tri-out collide-tri-result :offset-assert 8)
(start-pos vector :inline :offset-assert 16)
(move-dist vector :inline :offset-assert 32)
@@ -96,7 +96,7 @@
(deftype collide-cache-prim (structure)
((prim-core collide-prim-core :inline :offset-assert 0)
(ccache collide-cache :offset-assert 32)
(prim (pointer collide-shape-prim) :offset-assert 36) ;; really? maybe just plain prim.
(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)
@@ -111,44 +111,46 @@
:size-assert #x30
:flag-assert #xb00000030
(:methods
(dummy-9 (_type_ collide-mesh-cache-tri collide-prim-core vector float collide-action) float 9)
(dummy-10 (_type_ collide-mesh-cache-tri collide-prim-core vector float collide-action) float 10)
(resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float 9)
(resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float 10)
)
)
;; The actual cache!
(deftype collide-cache (basic)
((num-tris int32 :offset-assert 4)
(num-prims int32 :offset-assert 8)
(ignore-mask uint32 :offset-assert 12) ;; pat?
(proc process-drawable :offset-assert 16)
(collide-box bounding-box :inline :offset-assert 32)
(collide-box4w bounding-box4w :inline :offset-assert 64)
(collide-with collide-kind :offset-assert 96)
(prims collide-cache-prim 100 :inline :offset-assert 112)
(tris collide-cache-tri 461 :inline :offset-assert 4912)
((num-tris int32 :offset-assert 4)
;;(num-tris-u uint32 :offset 4) ;; added
(num-prims int32 :offset-assert 8)
(num-prims-u uint32 :offset 8 );; added
(ignore-mask pat-surface :offset-assert 12)
(proc process-drawable :offset-assert 16) ;; types: target
(collide-box bounding-box :inline :offset-assert 32)
(collide-box4w bounding-box4w :inline :offset-assert 64)
(collide-with collide-kind :offset-assert 96)
(prims collide-cache-prim 100 :inline :offset-assert 112)
(tris collide-cache-tri 461 :inline :offset-assert 4912)
)
:method-count-assert 33
:size-assert #x8670
:flag-assert #x2100008670
(:methods
(dummy-9 (_type_) none 9)
(dummy-10 (_type_ vector vector float int process collide-tri-result int) float 10)
(dummy-11 (_type_ collide-using-spheres-params) none 11)
(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-y-probe (_type_ vector float collide-kind process collide-tri-result uint) float 12)
(dummy-13 (_type_ bounding-box collide-kind process-drawable pat-surface) none 13) ;; uint is a pat mask.
(dummy-14 (_type_ vector vector float int process int) none 14)
(dummy-15 (_type_ collide-using-spheres-params) none 15)
(dummy-16 (_type_ vector float uint process-drawable uint) none 16)
(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)
(fill-using-spheres (_type_ collide-using-spheres-params) none 15)
(fill-using-y-probe (_type_ vector float collide-kind process-drawable uint) none 16)
(initialize (_type_) none 17)
(dummy-18 (_type_ vector vector float collide-kind collide-tri-result int) float 18)
(probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result int) float 18)
(probe-using-spheres (_type_) none 19)
(dummy-20 (_type_ vector float uint collide-tri-result uint) float 20)
(dummy-21 (_type_ (function bsp-header int collide-list none) (function collide-cache none)) none 21) ;; second functiom is method 28
(dummy-22 (_type_) none 22)
(dummy-23 (_type_) none 23)
(dummy-24 (_type_) none 24)
(dummy-25 (_type_ water-control) none 25) ;; or whatever is from 152 in the process passed to 16
(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-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)
(dummy-27 (_type_) none 27)
(dummy-28 (_type_) none 28)
@@ -161,8 +163,8 @@
(deftype collide-list-item (structure)
((mesh basic :offset-assert 0) ;; maybe collide frag
(inst basic :offset-assert 4) ;; tie collision?
((mesh collide-frag-mesh :offset-assert 0)
(inst basic :offset-assert 4)
)
:method-count-assert 9
:size-assert #x8
+206
View File
@@ -38,4 +38,210 @@
(.mov v1-1 vf1)
(<= (the-as int v1-1) 0)
)
)
;;;;;;;;;;;;;;;;;;;;;
;; Line Sphere Test
;;;;;;;;;;;;;;;;;;;;;
;; In this mode, we collide a line of spheres.
;; The first pass sets up a non-axis-aligned bounding box in *collide-work*
;; The box is stored as an axis-aligned box, and an inv-rot to transform from world to aligned-box coordinates.
(defun collide-cache-using-line-sphere-test ((arg0 vector))
"Check if the input sphere is in the rotated bounding box volume of the current
line-sphere query."
(local-vars
(v1-1 uint128)
(v1-2 uint128)
(v1-3 uint128)
(a0-1 uint128)
(a1-2 uint128)
(a2-0 uint128)
(zero uint128)
)
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(set! zero (the uint128 0))
(let ((a1-0 *collide-work*))
(.lvf vf5 (&-> arg0 quad))
(.lvf vf4 (&-> a1-0 inv-mat vector 3 quad))
(.lvf vf1 (&-> a1-0 inv-mat vector 0 quad))
(.mul.w.vf acc vf4 vf0)
(.lvf vf2 (&-> a1-0 inv-mat vector 1 quad))
(.add.mul.x.vf acc vf1 vf5 acc)
(.lvf vf3 (&-> a1-0 inv-mat vector 2 quad))
(.add.mul.y.vf acc vf2 vf5 acc)
(let ((v1-0 (-> a1-0 collide-box4w min quad)))
(.add.mul.z.vf vf10 vf3 vf5 acc)
(let ((a1-1 (-> a1-0 collide-box4w max quad)))
(.sub.w.vf vf6 vf10 vf5 :mask #b111)
(.add.w.vf vf7 vf10 vf5 :mask #b111)
(.ftoi.vf vf8 vf6)
(.ftoi.vf vf9 vf7)
(.mov a2-0 vf8)
(.mov a0-1 vf9)
(.pcgtw a1-2 a2-0 a1-1)
)
(.pcgtw v1-1 v1-0 a0-1)
)
)
(.por v1-2 a1-2 v1-1)
(.ppach v1-3 zero v1-2)
(let ((v1-4 (shl (the-as int v1-3) 16)))
(nop!)
(zero? v1-4)
)
)
)
(defun make-collide-list-using-line-sphere-inst-test ((arg0 collide-fragment) (arg1 instance-tie))
"Check if a collide-fragment at a given instance is in the rotated bounding box volume
of the current line-sphere query."
(local-vars (v1-1 uint128) (v1-2 uint128) (v1-3 uint128) (v1-4 uint128) (a1-2 uint128) (a2-1 uint128)
(a3-1 uint128) (a3-3 uint128) (a3-4 uint128) (t0-1 uint128) (t0-2 uint128) (t1-0 uint128) (t2-1 uint128)
(t2-2 uint128) (zero uint128))
(rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) (vf10 :class vf) (vf11 :class vf) (vf12 :class vf)
(vf13 :class vf) (vf14 :class vf) (vf15 :class vf) (vf2 :class vf) (vf3 :class vf) (vf4 :class vf)
(vf5 :class vf) (vf6 :class vf) (vf7 :class vf) (vf8 :class vf) (vf9 :class vf))
(init-vf0-vector)
(set! zero (the uint128 0))
(let ((v1-0 *collide-work*))
(let ((a2-0 (-> arg1 max-scale)))
(let ((a3-0 (the-as uint128 (-> arg1 origin vector4h 3 long))))
(let ((t2-0 (the-as uint128 (-> arg1 origin vector4h 0 long))))
(.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 zero)
(.pw.sra t2-2 t2-1 16)
(.pextlh t0-1 t0-0 zero)
(.mov vf4 t1-0)
(.pw.sra t0-2 t0-1 16)
(.mov vf1 t2-2)
(.pextlh a3-3 a3-2 zero)
)
)
)
)
(.mov vf2 t0-2)
(.pw.sra a3-4 a3-3 16)
(.lvf vf5 (&-> arg1 bsphere quad))
(.mov vf3 a3-4)
(.mov vf6 a2-0)
)
(.itof.vf vf4 vf4)
(vitof12.xyzw vf1 vf1)
(vitof12.xyzw vf2 vf2)
(vitof12.xyzw vf3 vf3)
(.add.vf vf4 vf4 vf5 :mask #b111)
(.lvf vf5 (&-> arg0 bsphere quad))
(vitof12.xyzw vf6 vf6)
(.mul.x.vf acc vf1 vf5)
(.add.mul.y.vf acc vf2 vf5 acc)
(.add.mul.z.vf acc vf3 vf5 acc)
(.add.mul.w.vf vf11 vf4 vf0 acc)
(.lvf vf7 (&-> v1-0 inv-mat vector 0 quad))
(.lvf vf8 (&-> v1-0 inv-mat vector 1 quad))
(.lvf vf9 (&-> v1-0 inv-mat vector 2 quad))
(.lvf vf10 (&-> v1-0 inv-mat vector 3 quad))
(.mul.x.vf acc vf7 vf11)
(let ((a0-1 (-> v1-0 collide-box4w min quad)))
(.add.mul.y.vf acc vf8 vf11 acc)
(let ((a1-1 (-> v1-0 collide-box4w max quad)))
(.add.mul.z.vf acc vf9 vf11 acc)
(.add.mul.w.vf vf11 vf10 vf0 acc)
(.mul.w.vf vf15 vf6 vf5 :mask #b1)
(.add.x.vf vf12 vf11 vf15 :mask #b111)
(.sub.x.vf vf11 vf11 vf15 :mask #b111)
(.ftoi.vf vf14 vf12)
(.ftoi.vf vf13 vf11)
(.mov v1-1 vf14)
(.mov a2-1 vf13)
(.pcgtw a1-2 a2-1 a1-1)
)
(.pcgtw v1-2 a0-1 v1-1)
)
)
(.por v1-3 a1-2 v1-2)
(.ppach v1-4 zero v1-3)
(let ((v1-5 (shl (the-as int v1-4) 16)))
(nop!)
(zero? v1-5)
)
)
)
(defmethod collide-ray collide-fragment ((obj collide-fragment) (arg0 int) (arg1 collide-list))
"Inline-array function to do line-sphere with non-instanced fragments.
If the bsphere of the mesh is in the non-aligned bounding box, the mesh will be added
to the given collide-list.
Note: collide-probe is the faster implementation of this."
*collide-work*
;; just iterate over all and check their bsphere.
(dotimes (s3-0 arg0)
(when (collide-cache-using-line-sphere-test (-> obj bsphere))
(let ((v1-5 (-> arg1 items (-> arg1 num-items))))
(set! (-> v1-5 mesh) (-> obj mesh))
(set! (-> v1-5 inst) #f) ;; non-instanced.
)
(+! (-> arg1 num-items) 1)
)
(&+! obj 32)
)
0
(none)
)
(defmethod collide-ray instance-tie ((obj instance-tie) (arg0 int) (arg1 collide-list))
"Inline-array function to do line-sphere with TIE instances.
If the bsphere of the mesh is in the non-aligned bounding box, the mesh will be added
to the given collide-list.
Note: collide-probe is the faster implementation of this."
;; loop over instance-ties
(dotimes (s3-0 arg0)
;; first check the instance-tie's bsphere
(when (and (zero? (logand (-> obj flags) 1)) (collide-cache-using-line-sphere-test (-> obj bsphere)))
;; now, find the collide-frag
(let ((s2-0 (-> obj bucket-ptr collide-frag)))
(when (nonzero? s2-0)
(let ((s1-0 (the-as object (-> s2-0 data))))
;; and check each mesh in the collide-frag
(dotimes (s0-0 (-> s2-0 length))
(when (make-collide-list-using-line-sphere-inst-test (the-as collide-fragment s1-0) obj)
(let ((v1-10 (-> arg1 items (-> arg1 num-items))))
(set! (-> v1-10 mesh) (-> (the-as collide-fragment s1-0) mesh))
(set! (-> v1-10 inst) obj)
)
(+! (-> arg1 num-items) 1)
)
(set! s1-0 (-> (the-as (inline-array collide-fragment) s1-0) 1))
)
)
)
)
)
(&+! obj 64)
)
0
(none)
)
+2 -3
View File
@@ -49,7 +49,7 @@
((joint-id int32 :offset-assert 4)
(num-tris uint32 :offset-assert 8)
(num-verts uint32 :offset-assert 12)
(vertex-data (inline-array vector) :offset-assert 16)
(vertex-data (inline-array vector) :offset-assert 16)
(tris collide-mesh-tri 1 :inline :offset 32)
)
:method-count-assert 16
@@ -58,7 +58,7 @@
(:methods
(debug-draw-tris (_type_ process-drawable int) none 9)
(dummy-10 (_type_ object vector) none 10) ;; what is the second arg!?
(dummy-11 (_type_) none 11)
(dummy-11 (_type_ collide-mesh-cache-tri collide-tri-result vector float) none 11)
(dummy-12 (_type_ collide-mesh-cache-tri collide-tri-result vector float) float 12)
(dummy-13 (_type_) none 13)
(dummy-14 (_type_) none 14)
@@ -66,7 +66,6 @@
)
)
;;;;;;;;;;;;;;;;;;;;
;; cache
;;;;;;;;;;;;;;;;;;;;
+101
View File
@@ -5,3 +5,104 @@
;; name in dgo: collide-mesh
;; dgos: GAME, ENGINE
(defmethod asize-of collide-mesh ((obj collide-mesh))
"Compute the size in memory of a collide-mesh. Somehow this only counts num-tris and not verts."
(the-as int (+ (-> collide-mesh size) (* (+ (-> obj num-tris) -1) 8)))
)
(defmethod mem-usage collide-mesh ((obj collide-mesh) (arg0 memory-usage-block) (arg1 int))
"Compute the memory usage of a collide-mesh."
(set! (-> arg0 length) (max 79 (-> arg0 length)))
(set! (-> arg0 data 78 name) "collide-mesh")
(+! (-> arg0 data 78 count) 1)
(let ((v1-6 (asize-of obj)))
(+! (-> arg0 data 78 used) v1-6)
(+! (-> arg0 data 78 total) (logand -16 (+ v1-6 15)))
)
(set! (-> arg0 length) (max 79 (-> arg0 length)))
(set! (-> arg0 data 78 name) "collide-mesh")
(+! (-> arg0 data 78 count) 1)
(let ((v1-16 (* (-> obj num-verts) 16)))
(+! (-> arg0 data 78 used) v1-16)
(+! (-> arg0 data 78 total) (logand -16 (+ v1-16 15)))
)
(the-as collide-mesh 0)
)
(defmethod debug-draw-tris collide-mesh ((obj collide-mesh) (arg0 process-drawable) (arg1 int))
"Draw a collide-mesh."
(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)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((s5-0 (the-as object (-> obj tris)))
(s4-0 (-> arg0 node-list data arg1 bone transform))
)
(countdown (s3-0 (-> obj num-tris))
(let ((a2-1 (new 'stack-no-clear 'vector))
(a3-0 (new 'stack-no-clear 'vector))
(t0-0 (new 'stack-no-clear 'vector))
)
(.lvf vf4 (&-> s4-0 vector 0 quad))
(.lvf vf5 (&-> s4-0 vector 1 quad))
(.lvf vf6 (&-> s4-0 vector 2 quad))
(.lvf vf7 (&-> s4-0 vector 3 quad))
(.lvf vf1 (&-> (-> obj vertex-data (-> (the-as collide-mesh-tri s5-0) vertex-index 0)) quad))
(.lvf vf2 (&-> (-> obj vertex-data (-> (the-as collide-mesh-tri s5-0) vertex-index 1)) quad))
(.lvf vf3 (&-> (-> obj vertex-data (-> (the-as collide-mesh-tri s5-0) vertex-index 2)) quad))
(let ((t1-0 (copy-and-set-field (-> *pat-mode-info* (-> (the-as collide-mesh-tri s5-0) pat mode) color) a 16)))
(.mul.w.vf acc vf7 vf0)
(.add.mul.x.vf acc vf4 vf1 acc)
(.add.mul.y.vf acc vf5 vf1 acc)
(.add.mul.z.vf vf1 vf6 vf1 acc)
(.mul.w.vf acc vf7 vf0)
(.add.mul.x.vf acc vf4 vf2 acc)
(.add.mul.y.vf acc vf5 vf2 acc)
(.add.mul.z.vf vf2 vf6 vf2 acc)
(.mul.w.vf acc vf7 vf0)
(.add.mul.x.vf acc vf4 vf3 acc)
(.add.mul.y.vf acc vf5 vf3 acc)
(.add.mul.z.vf vf3 vf6 vf3 acc)
(.svf (&-> a2-1 quad) vf1)
(.svf (&-> a3-0 quad) vf2)
(.svf (&-> t0-0 quad) vf3)
(add-debug-flat-triangle #t (bucket-id debug-draw1) a2-1 a3-0 t0-0 t1-0)
)
)
(set! s5-0 (-> (the-as (inline-array collide-mesh-tri) s5-0) 1))
)
)
0
(none)
)
)
(deftype sopt-work (structure)
((intersect vector :inline :offset-assert 0)
(sphere-bbox4w bounding-box4w :inline :offset-assert 16)
)
:method-count-assert 9
:size-assert #x30
:flag-assert #x900000030
)
(defmethod-mips2c "(method 12 collide-mesh)" 12 collide-mesh)
(deftype spat-work (structure)
((intersect vector :inline :offset-assert 0)
(sphere-bbox4w bounding-box4w :inline :offset-assert 16)
)
:method-count-assert 9
:size-assert #x30
:flag-assert #x900000030
)
(defmethod-mips2c "(method 11 collide-mesh)" 11 collide-mesh)
+2 -2
View File
@@ -379,7 +379,7 @@
(TODO-RENAME-28 (_type_ vector) object 28) ;; ret - symbol | float (CSPG::9)
(dummy-29 (_type_ int) none 29)
(TODO-RENAME-30 (_type_ vector) object 30) ;; ret - symbol | float (CSPG::9)
(dummy-31 (_type_) none 31)
(debug-draw (_type_) none 31)
(dummy-32 (_type_ object collide-kind) none 32)
(dummy-33 (_type_ vector collide-kind) none 33)
(dummy-34 (_type_ uint) collide-shape-prim 34)
@@ -439,7 +439,7 @@
:size-assert #x1bc
:flag-assert #x41000001bc
(:methods
(dummy-56 (_type_ pat-surface) none 56)
(set-and-handle-pat! (_type_ pat-surface) none 56)
(dummy-57 (_type_ vector) none 57)
(dummy-58 (_type_ vector) symbol 58)
(dummy-59 (_type_ vector uint float symbol symbol symbol) none 59)
+54 -53
View File
@@ -56,15 +56,15 @@
)
(defmethod collide-with-collide-cache-prim-sphere collide-shape-prim-sphere ((obj collide-shape-prim-sphere) (arg0 collide-shape-intersect) (arg1 collide-cache-prim))
(local-vars (v1-4 collide-offense) (a3-2 uint))
(local-vars (v1-4 collide-offense) (a3-2 pat-surface))
(rlet ((vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
)
(let* ((s5-0 (new 'stack-no-clear 'collide-mesh-cache-tri))
(f0-1 (dummy-10
(let* ((s5-0 (new 'stack-no-clear 'collide-tri-result))
(f0-1 (resolve-moving-sphere-sphere
arg1
s5-0
(-> obj prim-core)
@@ -88,25 +88,25 @@
(let ((a3-1 (logand a1-3 (collide-action solid)))
(a1-4 (-> obj prim-core offense))
)
(b! (zero? a3-1) cfg-5 :delay (set! a3-2 (-> s5-0 bbox4w max data 0)))
(b! (zero? a3-1) cfg-5 :delay (set! a3-2 (-> s5-0 pat)))
(b! (= a0-2 v1-3) cfg-5 :delay (set! v1-4 (- a1-4 a0-2)))
)
(b! (> (the-as int v1-4) 0) cfg-5 :delay (.lvf vf1 (&-> s5-0 normal quad)))
(.lvf vf2 (&-> s5-0 bbox4w min quad))
(b! (> (the-as int v1-4) 0) cfg-5 :delay (.lvf vf1 (&-> s5-0 intersect quad)))
(.lvf vf2 (&-> s5-0 normal quad))
(.lvf vf3 (&-> s5-0 vertex 0 quad))
(.lvf vf4 (&-> s5-0 vertex 1 quad))
(.lvf vf5 (&-> s5-0 vertex 2 quad))
(set! (-> arg0 best-u) f0-1)
(set! (-> arg0 best-to-prim) (the-as collide-shape-prim a2-3))
(set! (-> arg0 best-to-prim) a2-3)
(set! (-> arg0 best-from-prim) obj)
(set! (-> arg0 best-tri pat) (the-as pat-surface a3-2))
(set! (-> arg0 best-tri pat) a3-2)
(.svf (&-> arg0 best-tri intersect quad) vf1)
(.svf (&-> arg0 best-tri normal quad) vf2)
(.svf (&-> arg0 best-tri vertex 0 quad) vf3)
(.svf (&-> arg0 best-tri vertex 1 quad) vf4)
(.svf (&-> arg0 best-tri vertex 2 quad) vf5)
(label cfg-5)
(dummy-9 *touching-list* obj (the-as collide-shape-prim a2-3) f0-1 (the-as collide-shape #f) s5-0)
(add-touching-prims *touching-list* obj a2-3 f0-1 (the-as collide-tri-result #f) s5-0)
)
)
)
@@ -154,7 +154,13 @@
)
(set! (-> a1-1 min y) (+ -40960.0 (-> s2-0 y)))
(set! (-> a1-1 max y) (+ 20480.0 (-> s2-0 y)))
(dummy-13 *collide-cache* a1-1 (-> arg0 root-prim collide-with) (-> arg0 process) (new 'static 'pat-surface :skip #x1 :noentity #x1))
(fill-using-bounding-box
*collide-cache*
a1-1
(-> arg0 root-prim collide-with)
(-> arg0 process)
(new 'static 'pat-surface :skip #x1 :noentity #x1)
)
)
(set! sv-176 0)
(while (< sv-176 8)
@@ -169,7 +175,7 @@
(let ((f26-0 arg3))
(set-vector! s1-0 0.0 0.0 arg3 1.0)
(vector-rotate-y! s1-0 s1-0 f28-0)
(if (>= (dummy-18
(if (>= (probe-using-line-sphere
*collide-cache*
(vector+! (new 'stack-no-clear 'vector) s2-0 (new 'static 'vector :y 20480.0 :w 1.0))
s1-0
@@ -188,7 +194,7 @@
(vector-rotate-y! s1-0 s1-0 f28-0)
(vector+! s1-0 s2-0 s1-0)
(set! (-> s1-0 y) (+ 20480.0 (-> s2-0 y)))
(when (>= (dummy-18
(when (>= (probe-using-line-sphere
*collide-cache*
s1-0
(new 'static 'vector :y -251658240.0 :w 1.0)
@@ -298,7 +304,7 @@
)
)
(defmethod dummy-56 collide-shape-moving ((obj collide-shape-moving) (arg0 pat-surface))
(defmethod set-and-handle-pat! collide-shape-moving ((obj collide-shape-moving) (arg0 pat-surface))
(with-pp
(set! (-> obj cur-pat) arg0)
(set! (-> obj poly-pat) arg0)
@@ -319,7 +325,7 @@
(set! (-> obj surf) *standard-ground-surface*)
)
)
(if (logtest? (-> obj root-prim prim-core action) 512)
(if (logtest? (-> obj root-prim prim-core action) (collide-action ca-9))
(set! (-> obj surf) *race-track-surface*)
)
(when (nonzero? (-> arg0 event))
@@ -356,7 +362,9 @@
(target-attack-up (the-as target (-> obj process)) 'attack-or-shove 'deadlyup)
)
(((pat-event burnup))
(if (zero? (logand (-> (the-as target (-> obj process)) control root-prim prim-core action) 512))
(if (zero?
(logand (-> (the-as target (-> obj process)) control root-prim prim-core action) (collide-action ca-9))
)
(target-attack-up (the-as target (-> obj process)) 'attack-or-shove 'burnup)
)
)
@@ -404,7 +412,7 @@
(vector-float*! a1-1 (-> arg1 move-vec) (-> arg1 best-u))
(TODO-RENAME-28 arg0 a1-1)
)
(dummy-56 arg0 (-> arg1 best-tri pat))
(set-and-handle-pat! arg0 (-> arg1 best-tri pat))
(vector-! sv-64 (the-as vector (-> arg1 best-from-prim prim-core)) (-> arg1 best-tri intersect))
(set! (-> sv-64 w) 1.0)
(vector-normalize! sv-64 1.0)
@@ -856,12 +864,12 @@
0.0
(let ((f0-4 (if s1-0
(misty-ambush-height-probe s0-0 81920.0)
(dummy-10
(fill-and-probe-using-line-sphere
*collide-cache*
s0-0
(new 'static 'vector :y -81920.0 :w 1.0)
40.96
(the-as int arg1)
(the-as collide-kind arg1)
(-> obj process)
sv-144
1
@@ -887,7 +895,7 @@
)
)
)
(when (logtest? (-> obj root-prim collide-with) 30)
(when (logtest? (-> obj root-prim collide-with) (collide-kind cak-1 cak-2 cak-3 target))
(let ((a1-7 (new 'stack-no-clear 'touching-shapes-entry)))
(set! (-> a1-7 cshape1) (the-as collide-shape 1))
(set! (-> a1-7 cshape2) (the-as collide-shape *touching-list*))
@@ -1011,7 +1019,7 @@
(let ((s5-0 (new 'stack-no-clear 'bounding-box)))
(cond
((dummy-36 obj s5-0 (the-as float arg0) arg1)
(dummy-13 *collide-cache* s5-0 arg1 (-> obj process) (-> obj pat-ignore-mask))
(fill-using-bounding-box *collide-cache* s5-0 arg1 (-> obj process) (-> obj pat-ignore-mask))
(if (and *display-collide-cache* (= (-> obj process type) target))
(dummy-9 *collide-cache*)
)
@@ -1198,15 +1206,13 @@
(let ((gp-1 (-> v1-4 next0)))
(while (!= v1-4 (-> *collide-player-list* alive-list-end))
(let ((s5-1 (-> (the-as connection v1-4) param1)))
(if (or
(and (not *display-actor-anim*) (not *display-process-anim*))
(or
(= (-> (the-as collide-shape s5-1) process) *target*)
(name= *display-actor-anim* (-> (the-as collide-shape s5-1) process name))
(= (ppointer->process *display-process-anim*) (-> (the-as collide-shape s5-1) process))
)
(if (or (and (not *display-actor-anim*) (not *display-process-anim*))
(or (= (-> (the-as collide-shape s5-1) process) *target*)
(name= *display-actor-anim* (-> (the-as collide-shape s5-1) process name))
(= (ppointer->process *display-process-anim*) (-> (the-as collide-shape s5-1) process))
)
)
(dummy-31 (the-as collide-shape s5-1))
(debug-draw (the-as collide-shape s5-1))
)
)
(set! v1-4 gp-1)
@@ -1220,15 +1226,13 @@
(let ((gp-2 (-> v1-19 next0)))
(while (!= v1-19 (-> *collide-hit-by-player-list* alive-list-end))
(let ((s5-2 (-> (the-as connection v1-19) param1)))
(if (or
(and (not *display-actor-anim*) (not *display-process-anim*))
(or
(= (-> (the-as collide-shape s5-2) process) *target*)
(name= *display-actor-anim* (-> (the-as collide-shape s5-2) process name))
(= (ppointer->process *display-process-anim*) (-> (the-as collide-shape s5-2) process))
)
(if (or (and (not *display-actor-anim*) (not *display-process-anim*))
(or (= (-> (the-as collide-shape s5-2) process) *target*)
(name= *display-actor-anim* (-> (the-as collide-shape s5-2) process name))
(= (ppointer->process *display-process-anim*) (-> (the-as collide-shape s5-2) process))
)
)
(dummy-31 (the-as collide-shape s5-2))
(debug-draw (the-as collide-shape s5-2))
)
)
(set! v1-19 gp-2)
@@ -1242,15 +1246,13 @@
(let ((gp-3 (-> v1-34 next0)))
(while (!= v1-34 (-> *collide-usually-hit-by-player-list* alive-list-end))
(let ((s5-3 (-> (the-as connection v1-34) param1)))
(if (or
(and (not *display-actor-anim*) (not *display-process-anim*))
(or
(= (-> (the-as collide-shape s5-3) process) *target*)
(name= *display-actor-anim* (-> (the-as collide-shape s5-3) process name))
(= (ppointer->process *display-process-anim*) (-> (the-as collide-shape s5-3) process))
)
(if (or (and (not *display-actor-anim*) (not *display-process-anim*))
(or (= (-> (the-as collide-shape s5-3) process) *target*)
(name= *display-actor-anim* (-> (the-as collide-shape s5-3) process name))
(= (ppointer->process *display-process-anim*) (-> (the-as collide-shape s5-3) process))
)
)
(dummy-31 (the-as collide-shape s5-3))
(debug-draw (the-as collide-shape s5-3))
)
)
(set! v1-34 gp-3)
@@ -1264,15 +1266,13 @@
(let ((gp-4 (-> v1-49 next0)))
(while (!= v1-49 (-> *collide-hit-by-others-list* alive-list-end))
(let ((s5-4 (-> (the-as connection v1-49) param1)))
(if (or
(and (not *display-actor-anim*) (not *display-process-anim*))
(or
(= (-> (the-as collide-shape s5-4) process) *target*)
(name= *display-actor-anim* (-> (the-as collide-shape s5-4) process name))
(= (ppointer->process *display-process-anim*) (-> (the-as collide-shape s5-4) process))
)
(if (or (and (not *display-actor-anim*) (not *display-process-anim*))
(or (= (-> (the-as collide-shape s5-4) process) *target*)
(name= *display-actor-anim* (-> (the-as collide-shape s5-4) process name))
(= (ppointer->process *display-process-anim*) (-> (the-as collide-shape s5-4) process))
)
)
(dummy-31 (the-as collide-shape s5-4))
(debug-draw (the-as collide-shape s5-4))
)
)
(set! v1-49 gp-4)
@@ -1286,7 +1286,8 @@
(none)
)
(defmethod dummy-31 collide-shape ((obj collide-shape))
(defmethod debug-draw collide-shape ((obj collide-shape))
(if (sphere-in-view-frustum? (the-as sphere (-> obj root-prim prim-core)))
(debug-draw-world-sphere (-> obj root-prim))
)
+1 -1
View File
@@ -126,7 +126,7 @@
:flag-assert #xf00000208
(:methods
(new (symbol type) _type_ 0)
(dummy-9 (_type_ collide-shape-prim collide-shape-prim float collide-shape collide-mesh-cache-tri) none 9)
(add-touching-prims (_type_ collide-shape-prim collide-shape-prim float collide-tri-result collide-tri-result) none 9)
(dummy-10 () none 10)
(dummy-11 (_type_ float) none 11)
(dummy-12 (_type_) none 12)
+14 -14
View File
@@ -147,16 +147,16 @@
;; WARN: Expression building failed: Function (method 9 touching-list) has a return type of none, but the expression builder found a return statement.
(defmethod dummy-9 touching-list ((obj touching-list)
(arg0 collide-shape-prim)
(arg1 collide-shape-prim)
(arg2 float)
(arg3 collide-shape)
(arg4 collide-mesh-cache-tri)
)
(let ((gp-0 (new 'stack-no-clear 'touching-shapes-entry)))
(set! (-> gp-0 cshape1) arg3)
(set! (-> gp-0 cshape2) (the-as collide-shape arg4))
(defmethod add-touching-prims touching-list ((obj touching-list)
(arg0 collide-shape-prim)
(arg1 collide-shape-prim)
(arg2 float)
(arg3 collide-tri-result)
(arg4 collide-tri-result)
)
(let ((gp-0 (new 'stack-no-clear 'add-prims-touching-work)))
(set! (-> gp-0 tri1) arg3)
(set! (-> gp-0 tri2) arg4)
(let ((s2-0 (get-shapes-entry obj (-> arg0 cshape) (-> arg1 cshape))))
(when s2-0
(when (= (-> s2-0 cshape1) (-> arg1 cshape))
@@ -171,7 +171,7 @@
(when (< arg2 (-> s0-0 u))
(-> s0-0 u)
(let ((v1-12 (-> s0-0 prim1))
(a1-2 (-> gp-0 cshape1))
(a1-2 (-> gp-0 tri1))
)
(cond
(a1-2
@@ -184,7 +184,7 @@
)
)
(let ((v1-15 (-> s0-0 prim2))
(a1-3 (-> gp-0 cshape2))
(a1-3 (-> gp-0 tri2))
)
(cond
(a1-3
@@ -218,7 +218,7 @@
(set! (-> obj resolve-u) 1)
)
(let ((v1-26 (-> s0-1 prim1))
(a1-4 (-> gp-0 cshape1))
(a1-4 (-> gp-0 tri1))
)
(set! (-> v1-26 cprim) arg0)
(cond
@@ -232,7 +232,7 @@
)
)
(let ((v1-29 (-> s0-1 prim2))
(a1-5 (-> gp-0 cshape2))
(a1-5 (-> gp-0 tri2))
)
(set! (-> v1-29 cprim) arg1)
(cond
+5
View File
@@ -1136,4 +1136,9 @@
)
0
(none)
)
(defmethod collide-ray drawable ((obj drawable) (arg0 int) (arg1 collide-list))
0
(none)
)
+1 -1
View File
@@ -113,7 +113,7 @@
(vector-float*! a1-1 (-> arg1 move-vec) (-> arg1 best-u))
(TODO-RENAME-28 arg0 a1-1)
)
(dummy-56 arg0 (-> arg1 best-tri pat))
(set-and-handle-pat! arg0 (-> arg1 best-tri pat))
(case (-> arg1 best-tri pat material)
(((pat-material stopproj))
(send-event (-> arg0 process) 'die)
+1 -1
View File
@@ -39,7 +39,7 @@
((color-indices uint32 :offset 8)
(bucket-ptr prototype-bucket-tie :offset 12)
(max-scale uint16 :offset 38)
(flags uint16 :offset 46)
(flags uint16 :offset 46) ;; 1 = has collision?
)
:method-count-assert 18
:size-assert #x40
+18 -18
View File
@@ -106,9 +106,9 @@
`(begin
(rlet ((temp :class vf))
(.itof.vf ,dst ,src)
(set! temp 0.0625)
(.mul.x.vf temp ,src temp)
(.ftoi.vf ,dst temp)
(.mul.x.vf ,dst ,dst temp)
)
)
)
@@ -120,14 +120,14 @@
NOTE: this is the only version of the instruction used in Jak 1, so we
don't need to worry about masks."
`(begin
(rlet ((temp :class vf))
(set! temp 0.000244140625)
(.mul.x.vf temp ,src temp)
(.ftoi.vf ,dst temp)
)
)
)
`(begin
(rlet ((temp :class vf))
(.itof.vf ,dst ,src)
(set! temp 0.000244140625)
(.mul.x.vf ,dst ,dst temp)
)
)
)
(defmacro vitof15.xyzw (dst src)
"convert from a 17.15 integer. This does the multiply while the number is still
@@ -136,14 +136,14 @@
NOTE: this is the only version of the instruction used in Jak 1, so we
don't need to worry about masks."
`(begin
(rlet ((temp :class vf))
(set! temp 0.000030517578125)
(.mul.x.vf temp ,src temp)
(.ftoi.vf ,dst temp)
)
)
)
`(begin
(rlet ((temp :class vf))
(.itof.vf ,dst ,src)
(set! temp 0.000030517578125)
(.mul.x.vf ,dst ,dst temp)
)
)
)
;; In the original game, init-for-transform stashed a bunch of stuff in registers, to be used by other functions.
;; In OpenGOAL, this seems risky so we're going to back up this manually.
+1 -2
View File
@@ -862,7 +862,7 @@
(set! (-> gp-0 proc) #f)
(set! (-> gp-0 ignore-pat) (the-as uint 1))
(set! (-> gp-0 solid-only) #t)
(if (dummy-11 *collide-cache* gp-0)
(if (fill-and-probe-using-spheres *collide-cache* gp-0)
#f
#t
)
@@ -1240,7 +1240,6 @@
)
)
(defun target-rot ()
(let ((v1-0 *target*))
(if v1-0
+1 -1
View File
@@ -1523,7 +1523,7 @@
(set! (-> a1-2 proc) #f)
(set! (-> a1-2 ignore-pat) (the-as uint 1))
(set! (-> a1-2 solid-only) #t)
(when (not (dummy-11 *collide-cache* a1-2))
(when (not (fill-and-probe-using-spheres *collide-cache* a1-2))
(remove-exit)
(go
target-edge-grab-jump
+237
View File
@@ -0,0 +1,237 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Unused version of line sphere, touching list test
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; it looks like there's two ways to collide a ray with the background.
;; the "old version" is slow, but simpler. So let's start with that.
;; The inputs here are an "origin" point, a "line", and a radius.
;; From this, we build an axis aligned bounding box, then find the collide-frag-meshes that are inside.
;; It's about the simplest possible implementation, but it's a nice check to see if we really understand what's going on.
(defmacro pabsw-hack (out in)
`(let ((temp (new 'stack-no-clear 'array 'int32 4)))
(set! (-> (the (pointer uint128) temp)) ,in)
(set! (-> temp 0) (abs (-> temp 0)))
(set! (-> temp 1) (abs (-> temp 1)))
(set! (-> temp 2) (abs (-> temp 2)))
(set! (-> temp 3) (abs (-> temp 3)))
(set! ,out (-> (the (pointer uint128) temp)))
)
)
;; This is mostly stolen from collide-cache.gc. It builds the bounding box we'll use for later tests.
;; The bounding box is stored in *collide-work*.
(defun setup-collide-for-line-sphere ((origin vector) (line vector) (radius float))
(local-vars (a0-2 uint128) (a0-3 uint128) (a0-7 float) (t0-1 uint128) (t0-2 uint128) (zero uint128))
(rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) (vf1 :class vf) (vf10 :class vf) (vf11 :class vf) (vf12 :class vf)
(vf13 :class vf) (vf14 :class vf) (vf15 :class vf) (vf16 :class vf) (vf17 :class vf) (vf18 :class vf) (vf19 :class vf)
(vf2 :class vf) (vf20 :class vf) (vf21 :class vf) (vf22 :class vf) (vf23 :class vf) (vf3 :class vf) (vf4 :class vf)
(vf5 :class vf) (vf6 :class vf) (vf7 :class vf) (vf8 :class vf) (vf9 :class vf))
(init-vf0-vector)
(set! zero (the uint128 0))
(let ((v1-0 (new 'static 'vector4w :x #x1000 :y #x1000 :z #x1000)))
(.mov vf9 (the uint128 radius)) ;; vf9.x = radius
(.lvf vf3 (&-> line quad)) ;; vf3 = line
(let ((a0-1 (-> v1-0 quad))) ;; a0-1 = 0x1000,
(.ftoi.vf vf21 vf3) ;; vf21 is the line
(.lvf vf1 (&-> origin quad)) ;; vf1 is the origin
(.mul.vf vf8 vf3 vf3) ;;
(let ((v1-1 *collide-work*))
(.add.vf vf2 vf1 vf3) ;; vf2 is the endpoint
;;(set! (-> obj ignore-mask) pat-ignore)
(.mov t0-1 vf21) ;; t0-1 is the line
(pabsw-hack t0-2 t0-1) ;; t0-2 is the line, absolute value
(.pcgtw a0-2 t0-2 a0-1)
(.ppach a0-3 zero a0-2)
(let ((a0-4 (shl (the-as int a0-3) 16)))
(b! (nonzero? a0-4) cfg-3)
)
(format 0 "BAD case in setup-collide-for-line-sphere")
(b! #t cfg-13 :delay (nop!))
(label cfg-3)
(.add.y.vf vf8 vf8 vf8 :mask #b1)
;;(set! (-> obj num-tris) 0)
(.min.vf vf4 vf1 vf2)
;;(set! (-> obj num-prims) 0)
(.max.vf vf5 vf1 vf2)
;;(set! (-> obj collide-with) collide-with)
(.sub.x.vf vf10 vf0 vf9 :mask #b111)
;;(set! (-> obj proc) proc)
(.add.z.vf vf8 vf8 vf8 :mask #b1)
(.sub.x.vf vf4 vf4 vf9 :mask #b111)
(.add.x.vf vf5 vf5 vf9 :mask #b111)
(.ftoi.vf vf15 vf10)
(.isqrt.vf Q vf0 vf8 :fsf #b11 :ftf #b0)
(.add.x.vf vf11 vf0 vf9 :mask #b111)
(.svf (&-> v1-1 collide-box4w min quad) vf15)
(.ftoi.vf vf6 vf4)
;;(.svf (&-> obj collide-box min quad) vf4)
(.ftoi.vf vf7 vf5)
;;(.svf (&-> obj collide-box max quad) vf5)
(.mov.vf vf13 vf0)
;;(.svf (&-> obj collide-box4w min quad) vf6)
;;(.svf (&-> obj collide-box4w max quad) vf7)
(.wait.vf)
(.add.vf vf8 vf0 Q :mask #b1)
(.mul.x.vf vf12 vf3 vf8)
(.div.vf Q vf0 vf8 :fsf #b11 :ftf #b0)
(.mul.vf vf22 vf12 vf12)
(.abs.vf vf23 vf12)
(.add.y.vf vf22 vf22 vf22 :mask #b1)
(.mov a0-7 vf23)
(.wait.vf)
(.add.vf vf8 vf0 Q :mask #b1)
(b! (zero? a0-7) cfg-6 :likely-delay (.add.z.vf vf13 vf0 vf12 :mask #b1))
(.sub.y.vf vf13 vf0 vf12 :mask #b1)
(.isqrt.vf Q vf0 vf22 :fsf #b11 :ftf #b0)
(.add.x.vf vf13 vf0 vf12 :mask #b10)
(.wait.vf)
(.mul.vf vf13 vf13 Q :mask #b11)
(label cfg-6)
(.outer.product.a.vf acc vf12 vf13)
(.add.x.vf vf11 vf11 vf8 :mask #b1)
(.outer.product.b.vf vf14 vf13 vf12 acc)
(.ftoi.vf vf16 vf11)
(.mov.vf vf17 vf12)
(.mov.vf vf18 vf13)
(.mov.vf vf19 vf14)
(.mov.vf vf17 vf0 :mask #b1110)
(.svf (&-> v1-1 collide-box4w max quad) vf16)
(.mov.vf vf18 vf0 :mask #b1101)
(.mov.vf vf19 vf0 :mask #b1011)
(.add.x.vf vf17 vf17 vf13 :mask #b10)
(.add.y.vf vf18 vf18 vf12 :mask #b1)
(.add.z.vf vf19 vf19 vf12 :mask #b1)
(.add.x.vf vf17 vf17 vf14 :mask #b100)
(.add.y.vf vf18 vf18 vf14 :mask #b100)
(.add.z.vf vf19 vf19 vf13 :mask #b10)
(.mul.x.vf acc vf17 vf1)
(.add.mul.y.vf acc vf18 vf1 acc)
(.svf (&-> v1-1 inv-mat vector 0 quad) vf17)
(.add.mul.z.vf vf20 vf19 vf1 acc)
(.svf (&-> v1-1 inv-mat vector 1 quad) vf18)
(.sub.vf vf20 vf0 vf20)
(.svf (&-> v1-1 inv-mat vector 2 quad) vf19)
(.svf (&-> v1-1 inv-mat vector 3 quad) vf20)
(label cfg-13)
)
)
)
)
)
;; convert vector of ints to floats.
(defmacro vector-as-floats (in)
`(let ((vec (new 'stack-no-clear 'vector)))
(rlet ((reg :class vf))
(.lvf reg (&-> ,in quad))
(.itof.vf reg reg)
(.svf (&-> vec quad) reg)
)
vec
)
)
;; incrementing counter to make the test input move around.
(define *debug-counter* 0)
(defun debug-draw-collide-work ()
(+! *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))
)
(set! (-> line z) (* (sin (degrees (the float *debug-counter*))) (meters 15.0)))
(set! (-> line x) (* (cos (degrees (the float *debug-counter*))) (meters 15.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.)))
(+! (-> origin x) (meters -50.))
)
;; 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)
;; loop over active levels
(dotimes (lev-idx (-> *level* length))
(let ((lev (-> *level* level lev-idx)))
(when (= (-> lev status) 'active)
;; do the collision check!
(collide-ray (-> lev bsp) 0 *collide-list*)
)
)
)
;; print results
(format *stdcon* "got ~d in list~%" (-> *collide-list* num-items))
(format *stdcon* "cam at: ~`vector`P~%" (camera-pos))
;; visualize results
(dotimes (i (-> *collide-list* num-items))
(let ((mesh (the collide-frag-mesh (-> *collide-list* items i mesh)))
(inst (the instance-tie (-> *collide-list* items i inst))))
(if inst
(add-debug-sphere #t (bucket-id debug-draw0) (-> inst bsphere) (-> inst bsphere w) (new 'static 'rgba :b #x80 :a #x80))
(add-debug-sphere #t (bucket-id debug-draw0) (vector-as-floats (-> mesh base-trans)) (meters 5.0) (new 'static 'rgba :g #x80 :a #x80))
)
;
)
)
#f
)
)
(defun start-debug-drawer ()
(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 ()
(while #t
(debug-draw-collide-work)
(suspend)
)
)
)
)
)
+4
View File
@@ -621,3 +621,7 @@
(set! ,name (the-as ,type (__pc-get-mips2c ,(symbol->string name))))
)
)
(defmacro defmethod-mips2c (name method-id method-type)
`(method-set! ,method-type ,method-id (__pc-get-mips2c ,name))
)
+12 -1
View File
@@ -1119,7 +1119,18 @@
(let ((gp-0 (new 'stack-no-clear 'vector)))
(set! (-> self root-override transv y) (* 4096.0 (- arg0)))
(set! (-> gp-0 quad) (-> self root-override transv quad))
(let ((f30-0 (dummy-10 *collide-cache* (-> self root-override trans) gp-0 409.6 1 self s5-0 1)))
(let ((f30-0 (fill-and-probe-using-line-sphere
*collide-cache*
(-> self root-override trans)
gp-0
409.6
(collide-kind background)
self
s5-0
1
)
)
)
(when (or (< f30-0 0.0) (or (< 1.0 f30-0) (nonzero? (-> s5-0 pat mode))))
(suspend)
(go seagull-soaring)
+4 -2
View File
@@ -407,7 +407,7 @@
)
(defmethod TODO-RENAME-22 joint-exploder ((obj joint-exploder) (arg0 joint-exploder-list))
(dummy-13
(fill-using-bounding-box
*collide-cache*
(-> arg0 bbox)
(collide-kind background)
@@ -424,7 +424,9 @@
(s3-0 (new 'stack-no-clear 'collide-tri-result))
)
(vector-! a2-1 s4-0 (-> s5-1 prev-pos))
(when (>= (dummy-18 *collide-cache* (-> s5-1 prev-pos) a2-1 40.96 (collide-kind background) s3-0 1) 0.0)
(when (>= (probe-using-line-sphere *collide-cache* (-> s5-1 prev-pos) a2-1 40.96 (collide-kind background) s3-0 1)
0.0
)
(set! (-> s4-0 quad) (-> s3-0 intersect quad))
(let ((f28-0 (vector-xz-length (-> s5-1 transv))))
(vector-reflect! (-> s5-1 transv) (-> s5-1 transv) (-> s3-0 normal))
+12 -1
View File
@@ -3880,7 +3880,18 @@
(a2-0 (new 'stack-no-clear 'vector))
)
(vector-! a2-0 gp-0 s4-0)
(when (>= (dummy-10 *collide-cache* s4-0 a2-0 (the-as float 4096.0) 16 self t2-0 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere
*collide-cache*
s4-0
a2-0
(the-as float 4096.0)
(collide-kind target)
self
t2-0
1
)
0.0
)
(let ((a1-13 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-13 from) self)
(set! (-> a1-13 num-params) 2)
+12 -1
View File
@@ -2317,7 +2317,18 @@
(vector-length s4-1)
(let ((t2-0 (new 'stack-no-clear 'collide-mesh-cache-tri)))
0.0
(if (>= (dummy-10 *collide-cache* arg0 s4-1 6144.0 16 (the-as process #f) (the-as collide-tri-result t2-0) 1) 0.0)
(if (>= (fill-and-probe-using-line-sphere
*collide-cache*
arg0
s4-1
6144.0
(collide-kind target)
(the-as process #f)
(the-as collide-tri-result t2-0)
1
)
0.0
)
(send-event *target* 'get-pickup 3 5.0)
)
)
+3 -1
View File
@@ -680,7 +680,9 @@
(when (>= (-> obj explode-danger-radius) (vector-vector-distance s5-0 s3-0))
(vector-! s4-0 s3-0 s5-0)
(let ((t2-0 (new 'stack-no-clear 'collide-tri-result)))
(if (< (dummy-10 *collide-cache* s5-0 s4-0 819.2 1 obj t2-0 1) 0.0)
(if (< (fill-and-probe-using-line-sphere *collide-cache* s5-0 s4-0 819.2 (collide-kind background) obj t2-0 1)
0.0
)
(send-event *target* 'attack #f (new 'static 'attack-info))
)
)
@@ -202,7 +202,9 @@
(set! (-> a1-1 y) (+ 1228.8 (-> a1-1 y)))
(set-vector! a2-1 0.0 -61440.0 0.0 1.0)
(cond
((>= (dummy-10 *collide-cache* a1-1 a2-1 7372.8 1 obj s5-0 1) 0.0)
((>= (fill-and-probe-using-line-sphere *collide-cache* a1-1 a2-1 7372.8 (collide-kind background) obj s5-0 1)
0.0
)
(let ((v1-11 (-> obj draw shadow-ctrl)))
(set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags)))
)
+51 -5
View File
@@ -115,7 +115,18 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-1 quad) vf1)
)
(when (>= (dummy-10 *collide-cache* (-> self root trans) a2-0 3276.8 1 self gp-0 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere
*collide-cache*
(-> self root trans)
a2-0
3276.8
(collide-kind background)
self
gp-0
1
)
0.0
)
(let ((f28-0 (vector-xz-length (-> self transv))))
(vector-reflect! (-> self transv) (-> self transv) (-> gp-0 normal))
(let ((f30-0 (-> self transv y)))
@@ -452,7 +463,9 @@
(set-vector! a2-0 0.0 -81920.0 0.0 1.0)
(set! (-> a1-0 y) (+ -8192.0 (-> a1-0 y)))
(cond
((>= (dummy-10 *collide-cache* a1-0 a2-0 8192.0 1 obj s5-0 1) 0.0)
((>= (fill-and-probe-using-line-sphere *collide-cache* a1-0 a2-0 8192.0 (collide-kind background) obj s5-0 1)
0.0
)
(let ((v1-11 (-> obj draw shadow-ctrl)))
(set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags)))
)
@@ -743,7 +756,18 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-20 quad) vf1)
)
(when (>= (dummy-10 *collide-cache* s4-0 s3-0 4915.2 1 obj (the-as collide-tri-result s5-1) 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere
*collide-cache*
s4-0
s3-0
4915.2
(collide-kind background)
obj
(the-as collide-tri-result s5-1)
1
)
0.0
)
(vector-reflect! (-> obj swing-vel) (-> obj swing-vel) (the-as vector (&-> s5-1 param 6)))
(set! (-> obj swing-vel y) 0.0)
(vector-normalize! (-> obj swing-vel) (* 0.5 (vector-length (-> obj swing-vel))))
@@ -1558,7 +1582,18 @@
(vector+! arg0 (-> obj root-override trans) (-> obj nav travel))
(let ((s2-2 (new 'stack-no-clear 'collide-tri-result)))
(cond
((>= (dummy-10 *collide-cache* arg0 (new 'static 'vector :y -69632.0 :w 1.0) 40.96 1 obj s2-2 1) 0.0)
((>= (fill-and-probe-using-line-sphere
*collide-cache*
arg0
(new 'static 'vector :y -69632.0 :w 1.0)
40.96
(collide-kind background)
obj
s2-2
1
)
0.0
)
(set! (-> arg0 y) (-> s2-2 intersect y))
(set! (-> arg1 quad) (-> s2-2 normal quad))
(return #t)
@@ -1581,7 +1616,18 @@
(set! (-> a1-12 quad) (-> arg0 quad))
(set! (-> a1-12 y) (+ 8192.0 (-> a1-12 y)))
(cond
((>= (dummy-10 *collide-cache* a1-12 (new 'static 'vector :y -69632.0 :w 1.0) 40.96 1 obj s3-2 1) 0.0)
((>= (fill-and-probe-using-line-sphere
*collide-cache*
a1-12
(new 'static 'vector :y -69632.0 :w 1.0)
40.96
(collide-kind background)
obj
s3-2
1
)
0.0
)
(set! (-> arg0 y) (-> s3-2 intersect y))
(set! (-> arg1 quad) (-> s3-2 normal quad))
(return #t)
+13 -2
View File
@@ -992,7 +992,7 @@
(defstate mistycannon-missile-explode (mistycannon-missile)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('touched)
(let* ((s4-0 arg0)
@@ -1010,7 +1010,18 @@
)
0.0
(vector-! a2-1 (the-as vector v1-5) (the-as vector a1-2))
(when (< (dummy-10 *collide-cache* (the-as vector a1-2) a2-1 40.96 1 self (the-as collide-tri-result t2-0) 1) 0.0)
(when (< (fill-and-probe-using-line-sphere
*collide-cache*
(the-as vector a1-2)
a2-1
40.96
(collide-kind background)
self
(the-as collide-tri-result t2-0)
1
)
0.0
)
(cond
((= (-> arg0 type) target)
(let ((a1-3 (new 'stack-no-clear 'event-message-block)))
+3 -1
View File
@@ -448,7 +448,9 @@
(set! (-> a1-1 quad) (-> obj root trans quad))
(set! (-> a1-1 y) (+ -8192.0 (-> a1-1 y)))
(set-vector! a2-0 0.0 -81920.0 0.0 1.0)
(when (>= (dummy-10 *collide-cache* a1-1 a2-0 8192.0 1 pp s3-1 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere *collide-cache* a1-1 a2-0 8192.0 (collide-kind background) pp s3-1 1)
0.0
)
(set! (-> s3-1 intersect w) 8192.0)
(when (and (sphere-in-view-frustum? (the-as sphere (-> s3-1 intersect)))
(< 822083600.0 (vector-vector-distance-squared (-> s3-1 intersect) (camera-pos)))
@@ -7,248 +7,191 @@
;; DECOMP BEGINS
(defun
racer-collision-reaction
((arg0 control-info)
(arg1 collide-shape-intersect)
(arg2 vector)
(arg3 vector)
)
(local-vars
(sv-80 vector)
(sv-84 vector)
(sv-88 (inline-array vector))
(sv-96 int)
(sv-104 int)
)
(defun racer-collision-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector))
(local-vars (sv-80 vector) (sv-84 vector) (sv-88 (inline-array vector)) (sv-96 int) (sv-104 int))
(set! sv-80 (new-stack-vector0))
(set! sv-84 (new-stack-vector0))
(let ((v1-2 (new 'stack-no-clear 'inline-array 'vector 2)))
(dotimes (a0-1 2)
(set! (-> v1-2 a0-1 quad) (the-as uint128 0))
(dotimes (a0-1 2)
(set! (-> v1-2 a0-1 quad) (the-as uint128 0))
)
(set! sv-88 v1-2)
)
(set! sv-88 v1-2)
)
(set! sv-96 0)
(set! sv-104 0)
(set! (-> sv-88 0 quad) (-> arg3 quad))
(set! (-> sv-88 1 quad) (-> arg3 quad))
(let ((a1-3 (new 'stack-no-clear 'vector)))
(vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u))
(TODO-RENAME-28 arg0 a1-3)
)
(dummy-56 arg0 (-> arg1 best-tri pat))
(vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u))
(TODO-RENAME-28 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))
)
(set! sv-104 (logior sv-104 1))
)
(if (= (-> arg0 unknown-surface00 mode) 'air)
(set! sv-104 (logior sv-104 32))
)
(set! sv-104 (logior sv-104 32))
)
(let ((v1-21 (new 'stack-no-clear 'vector)))
(set! (-> v1-21 quad) (-> arg1 best-from-prim prim-core world-sphere quad))
(vector-! sv-80 v1-21 (-> arg1 best-tri intersect))
)
(set! (-> v1-21 quad) (-> arg1 best-from-prim prim-core world-sphere quad))
(vector-! sv-80 v1-21 (-> 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)
)
(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))
)
(set! sv-104 (logior sv-104 24))
)
(let ((v1-31 (-> sv-80 quad)))
(set! (-> sv-84 quad) v1-31)
)
(set! (-> sv-84 quad) v1-31)
)
(if (= (-> arg1 best-u) 0.0)
(TODO-RENAME-28 arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0))
)
(TODO-RENAME-28 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 (-> sv-88 0))
(if (< (-> arg0 poly-angle) -0.2)
(set! sv-96 (logior sv-96 16))
)
(let
((s3-1
(<
(fabs (-> arg0 surface-angle))
(-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)
(set! sv-96 (logior sv-96 16))
)
)
)
(if s3-1
(set! sv-104 (logior sv-104 2))
)
(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 s3-1)
(let ((f30-0 (- 1.0 (-> arg0 surf impact-fric))))
(when (< f30-0 1.0)
(let ((s2-1 (new-stack-vector0))
(f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 0)))
)
0.0
(vector-!
s2-1
(-> sv-88 0)
(vector-float*! s2-1 (-> arg0 dynam gravity-normal) f28-0)
)
(let* ((f0-18 (vector-length s2-1))
(f1-6 f0-18)
)
(if (< f28-0 0.0)
(set! f28-0 (* f28-0 f30-0))
)
(vector+!
(-> sv-88 0)
(vector-float*! (-> sv-88 0) (-> arg0 dynam gravity-normal) f28-0)
(vector-float*! s2-1 s2-1 (/ f0-18 f1-6))
)
)
(let ((s3-1 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))))
(if s3-1
(set! sv-104 (logior sv-104 2))
)
)
)
)
)
(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))
)
)
(if (and s3-1 (logtest? #x10000 (-> arg0 root-prim prim-core action)))
(set! s3-1 #f)
)
(cond
(s3-1
(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-int60) (the-as uint (-> arg1 best-tri pat)))
(vector-reflect-flat-above! arg2 (-> sv-88 0) 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)
(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 s3-1)
(let ((f30-0 (- 1.0 (-> arg0 surf impact-fric))))
(when (< f30-0 1.0)
(let ((s2-1 (new-stack-vector0))
(f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 0)))
)
0.0
(vector-! s2-1 (-> sv-88 0) (vector-float*! s2-1 (-> arg0 dynam gravity-normal) f28-0))
(let* ((f0-18 (vector-length s2-1))
(f1-6 f0-18)
)
(if (< f28-0 0.0)
(set! f28-0 (* f28-0 f30-0))
)
(vector+!
(-> sv-88 0)
(vector-float*! (-> sv-88 0) (-> arg0 dynam gravity-normal) f28-0)
(vector-float*! s2-1 s2-1 (/ f0-18 f1-6))
)
)
)
)
)
)
(and
(< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2))
(< (- (-> *display* base-frame-counter) (-> arg0 unknown-dword10)) 90)
(zero? (logand sv-104 32))
)
)
)
)
(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-104 (logior sv-104 256))
(set! sv-104 (logand -65 sv-104))
(let
((s3-3
(vector-cross!
(new 'stack-no-clear 'vector)
(-> arg0 poly-normal)
(-> arg0 ground-poly-normal)
)
)
)
(vector-normalize! s3-3 1.0)
(vector-float*! arg2 s3-3 (vector-dot (-> sv-88 0) s3-3))
(set! sv-96 (logior sv-96 4096))
)
(vector+! arg2 arg2 (-> arg0 poly-normal))
)
)
(let*
((s2-2
(vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-88 0) 1.0)
(if (and s3-1 (logtest? (collide-action ca-16) (-> arg0 root-prim prim-core action)))
(set! s3-1 #f)
)
(s3-4 (new-stack-vector0))
(f30-1 (vector-dot s2-2 arg2))
)
0.0
(vector-! s3-4 arg2 (vector-float*! s3-4 s2-2 f30-1))
(let* ((f1-11 (vector-length s3-4))
(f0-27 f1-11)
(f1-12 (* 0.9 f1-11))
(cond
(s3-1
(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-int60) (the-as uint (-> arg1 best-tri pat)))
(vector-reflect-flat-above! arg2 (-> sv-88 0) 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))
)
)
)
(vector+!
arg2
(vector-float*! arg2 s2-2 f30-1)
(vector-float*! s3-4 s3-4 (/ f1-12 f0-27))
)
(else
(set! sv-104 (logior sv-104 256))
(set! sv-104 (logand -65 sv-104))
(let ((s3-3 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal))))
(vector-normalize! s3-3 1.0)
(vector-float*! arg2 s3-3 (vector-dot (-> sv-88 0) s3-3))
)
(vector+! arg2 arg2 (-> arg0 poly-normal))
)
)
(let* ((s2-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-88 0) 1.0))
(s3-4 (new-stack-vector0))
(f30-1 (vector-dot s2-2 arg2))
)
0.0
(vector-! s3-4 arg2 (vector-float*! s3-4 s2-2 f30-1))
(let* ((f1-11 (vector-length s3-4))
(f0-27 f1-11)
(f1-12 (* 0.9 f1-11))
)
(vector+! arg2 (vector-float*! arg2 s2-2 f30-1) (vector-float*! s3-4 s3-4 (/ f1-12 f0-27)))
)
)
)
(else
(set! sv-96 (logior sv-96 1))
(set! (-> arg0 cur-pat mode) 0)
(if (and (= (-> arg1 best-from-prim prim-id) 6) (zero? (logand sv-104 7)))
(set! (-> arg0 local-normal quad) (-> sv-84 quad))
)
(vector-reflect-flat! arg2 (-> sv-88 0) sv-84)
(dotimes (v1-142 16)
(vector+! arg2 arg2 (-> arg0 poly-normal))
)
(set! sv-96 (logior sv-96 2))
(set! (-> arg0 ground-touch-point w) 0.0)
(when (zero? (logand sv-104 15))
(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! sv-104 (logior sv-104 2048))
(if (= (-> arg0 poly-pat material) (pat-material waterbottom))
(set! sv-96 (logior sv-96 1024))
)
)
)
)
)
)
(else
(set! sv-96 (logior sv-96 1))
(set! (-> arg0 cur-pat mode) 0)
(if (and (= (-> arg1 best-from-prim prim-id) 6) (zero? (logand sv-104 7)))
(set! (-> arg0 local-normal quad) (-> sv-84 quad))
)
(vector-reflect-flat! arg2 (-> sv-88 0) sv-84)
(dotimes (v1-142 16)
(vector+! arg2 arg2 (-> arg0 poly-normal))
)
(set! sv-96 (logior sv-96 2))
(set! (-> arg0 ground-touch-point w) 0.0)
(when (zero? (logand sv-104 15))
(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! 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 1)
arg2
)
(set!
(-> arg0 unknown-halfword00)
(logand (+ (-> arg0 unknown-halfword00) 1) 127)
)
(-> arg0 history-data (-> arg0 unknown-halfword00))
arg0
(-> arg1 best-tri intersect)
(-> sv-88 1)
arg2
)
(set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127))
sv-96
(none)
)
+11 -1
View File
@@ -156,7 +156,17 @@
(set! (-> gp-0 quad) (-> self root-override trans quad))
(let ((t2-0 (new 'stack-no-clear 'collide-tri-result)))
(set! (-> gp-0 y) (+ 8192.0 (-> gp-0 y)))
(let ((f0-2 (dummy-10 *collide-cache* gp-0 (new 'static 'vector :y -81920.0 :w 1.0) 40.96 1 self t2-0 1))
(let ((f0-2 (fill-and-probe-using-line-sphere
*collide-cache*
gp-0
(new 'static 'vector :y -81920.0 :w 1.0)
40.96
(collide-kind background)
self
t2-0
1
)
)
(v1-5 (new 'stack-no-clear 'vector))
)
(set! (-> v1-5 quad) (-> self root-override trans quad))
+12 -1
View File
@@ -891,7 +891,18 @@
)
(set! (-> a1-5 quad) (-> arg0 quad))
(set! (-> a1-5 y) (+ 8192.0 (-> a1-5 y)))
(when (>= (dummy-10 *collide-cache* a1-5 (new 'static 'vector :y -40960.0 :w 1.0) 40.96 1 obj s4-0 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere
*collide-cache*
a1-5
(new 'static 'vector :y -40960.0 :w 1.0)
40.96
(collide-kind background)
obj
s4-0
1
)
0.0
)
(set! (-> arg0 y) (-> s4-0 intersect y))
(return #t)
)
+12 -1
View File
@@ -163,7 +163,18 @@
(set! (-> a1-0 quad) (-> obj root-override trans quad))
(set-vector! a2-0 0.0 -40960.0 0.0 1.0)
(cond
((>= (dummy-10 *collide-cache* a1-0 a2-0 8192.0 2057 obj s5-0 1) 0.0)
((>= (fill-and-probe-using-line-sphere
*collide-cache*
a1-0
a2-0
8192.0
(collide-kind background cak-3 ground-object)
obj
s5-0
1
)
0.0
)
(let ((v1-11 (-> obj draw shadow-ctrl)))
(set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags)))
)
+12 -1
View File
@@ -879,7 +879,18 @@
(v1-1 (-> self tongue-control target-pos))
(s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 gp-0))
(t2-0 (new 'stack 'collide-tri-result))
(f30-0 (dummy-10 *collide-cache* gp-0 s5-1 409.6 3973 self t2-0 1))
(f30-0
(fill-and-probe-using-line-sphere
*collide-cache*
gp-0
s5-1
409.6
(collide-kind background cak-2 crate enemy wall-object projectile ground-object)
self
t2-0
1
)
)
(gp-1 (< f30-0 0.0))
)
(set! (-> self tongue-control forward-scale-max)
+89 -75
View File
@@ -528,10 +528,10 @@
:code
(behavior ()
(if (!= (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
(get-art-elem self)
)
(-> self skel root-channel 0 frame-group)
)
(get-art-elem self)
)
(ja-channel-push! 1 15)
)
(while #t
@@ -595,12 +595,12 @@
(set! (-> a0-21 param 0) 0.0)
(set! (-> a0-21 param 1) 1.0)
(set! (-> a0-21 frame-num) (the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-1
)
)
@@ -663,12 +663,12 @@
)
)
(set! (-> a0-35 param 0) (the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-1
)
)
@@ -700,12 +700,12 @@
(set! (-> a0-40 param 0) 0.0)
(set! (-> a0-40 param 1) 1.0)
(set! (-> a0-40 frame-num) (the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-1
)
)
@@ -735,12 +735,12 @@
)
)
(set! (-> a0-45 param 0) (the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-1
)
)
@@ -806,7 +806,10 @@
(none)
)
:trans
(behavior () '() (none))
(behavior ()
'()
(none)
)
)
(defmethod should-display? assistant-bluehut ((obj assistant-bluehut))
@@ -1522,7 +1525,18 @@
(vector-! s4-0 gp-0 s5-0)
(let ((t2-0 (new 'stack-no-clear 'collide-tri-result)))
0.0
(when (>= (dummy-10 *collide-cache* s5-0 s4-0 6144.0 16 (the-as process #f) t2-0 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere
*collide-cache*
s5-0
s4-0
6144.0
(collide-kind target)
(the-as process #f)
t2-0
1
)
0.0
)
(let ((a1-7 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-7 from) self)
(set! (-> a1-7 num-params) 2)
@@ -1655,33 +1669,30 @@
:trans
(behavior ()
((-> (method-of-type process-taskable hidden) trans))
(when (and
(cond
((and *target* (>= 61440.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))))
#t
(when (and (cond
((and *target* (>= 61440.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))))
#t
)
(else
(set! (-> self state-time) (-> *display* base-frame-counter))
#f
)
)
(and (closed? (-> self tasks) (game-task village2-levitator) (task-status need-introduction))
(not (closed? (-> self tasks) (game-task village2-levitator) (task-status need-reward-speech)))
(not (movie?))
(not (level-hint-displayed?))
(not (and *cheat-mode* (cpad-hold? 0 l3)))
(< (- (-> *display* base-frame-counter) (-> self state-time)) 3000)
)
)
(else
(set! (-> self state-time) (-> *display* base-frame-counter))
#f
)
)
(and
(closed? (-> self tasks) (game-task village2-levitator) (task-status need-introduction))
(not (closed? (-> self tasks) (game-task village2-levitator) (task-status need-reward-speech)))
(not (movie?))
(not (level-hint-displayed?))
(not (and *cheat-mode* (cpad-hold? 0 l3)))
(< (- (-> *display* base-frame-counter) (-> self state-time)) 3000)
)
)
(hide-hud)
(kill-current-level-hint '() '(sidekick voicebox) 'exit)
(when (and
(seen-text? *game-info* (game-text-id village2-not-enough-cells-levitator))
(hud-hidden?)
(can-grab-display? self)
(not (-> *setting-control* current hint))
)
(when (and (seen-text? *game-info* (game-text-id village2-not-enough-cells-levitator))
(hud-hidden?)
(can-grab-display? self)
(not (-> *setting-control* current hint))
)
(let ((gp-0
(new 'stack 'font-context *font-default-matrix* 32 160 0.0 (font-color default) (font-flags shadow kerning))
)
@@ -1724,7 +1735,11 @@
(defstate idle (assistant-levitator)
:virtual #t
:exit
(behavior () (stop! (-> self sound)) ((-> (method-of-type process-taskable idle) exit)) (none))
(behavior ()
(stop! (-> self sound))
((-> (method-of-type process-taskable idle) exit))
(none)
)
:trans
(behavior ()
(assistant-levitator-blue-glow)
@@ -1735,10 +1750,10 @@
:code
(behavior ()
(if (!= (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
(get-art-elem self)
)
(-> self skel root-channel 0 frame-group)
)
(get-art-elem self)
)
(ja-channel-push! 1 15)
)
(while #t
@@ -1778,12 +1793,12 @@
)
)
(set! (-> a0-16 param 0) (the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-1
)
)
@@ -1839,12 +1854,12 @@
)
)
(set! (-> a0-27 param 0) (the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-1
)
)
@@ -1894,10 +1909,9 @@
)
(defmethod should-display? assistant-levitator ((obj assistant-levitator))
(or
(= (get-task-status (game-task village2-levitator)) (task-status need-reward-speech))
(zero? (get-task-status (game-task village2-levitator)))
)
(or (= (get-task-status (game-task village2-levitator)) (task-status need-reward-speech))
(zero? (get-task-status (game-task village2-levitator)))
)
)
(defstate just-particles (assistant-levitator)
+3 -2
View File
@@ -355,8 +355,9 @@ Val* Compiler::compile_asm_svf(const goos::Object& form, const goos::Object& res
auto dest = compile_error_guard(args.unnamed.at(0), env);
auto src = compile_error_guard(args.unnamed.at(1), env)->to_reg(form, env);
if (!src->settable() || src->ireg().reg_class != RegClass::VECTOR_FLOAT) {
throw_compiler_error(form, "Cannot .svf from this. Got a {}.", dest->print());
if (!src->settable() || (src->ireg().reg_class != RegClass::VECTOR_FLOAT &&
src->ireg().reg_class != RegClass::INT_128)) {
throw_compiler_error(form, "Cannot .svf from this. Got a {}.", src->print());
}
auto as_co = dynamic_cast<MemoryOffsetConstantVal*>(dest);
+12 -1
View File
@@ -387,7 +387,18 @@
(vector--float*! s5-2 (-> self tpos-curr) (-> self local-down) (-> self target-height))
(vector-float*! gp-5 (-> self tgt-rot-mat vector 2) 4915.2)
(vector-! s5-2 s5-2 gp-5)
(let ((f0-20 (dummy-10 *collide-cache* s5-2 gp-5 4300.8 1 (the-as process #f) s4-2 4098)))
(let ((f0-20 (fill-and-probe-using-line-sphere
*collide-cache*
s5-2
gp-5
4300.8
(collide-kind background)
(the-as process #f)
s4-2
4098
)
)
)
(if (and (< 0.0 f0-20) (< f0-20 1.0))
(vector+float*! (-> self tpos-curr) (-> self tpos-curr) gp-5 (+ -1.0 f0-20))
)
+59 -18
View File
@@ -1336,12 +1336,12 @@
(set! (-> arg0 quad) (-> s5-0 quad))
(while #t
(vector--float*! s4-0 arg0 (-> *camera* local-down) (-> *camera* target-height))
(if (< (dummy-10
(if (< (fill-and-probe-using-line-sphere
*collide-cache*
(-> *camera* tpos-curr-adj)
arg0
(the-as float 409.6)
#x4a09
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s3-0
2
@@ -1713,7 +1713,15 @@
)
0.0
(vector-! s5-0 arg1 arg0)
(dummy-14 s4-0 arg0 s5-0 (-> *CAM_STRING-bank* los-coll-rad2) #x4a09 (the-as process #f) (the-as int arg2))
(fill-using-line-sphere
s4-0
arg0
s5-0
(-> *CAM_STRING-bank* los-coll-rad2)
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process-drawable #f)
(the-as int arg2)
)
(let* ((f0-2 (vector-length s5-0))
(f28-0
(cond
@@ -1932,7 +1940,15 @@
(f26-0 (vector-length arg1))
(f30-0 (vector-normalize-ret-len! s4-0 (the-as float 1.0)))
)
(dummy-14 s0-0 arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) #x4a09 (the-as process #f) arg3)
(fill-using-line-sphere
s0-0
arg0
arg1
(-> *CAM_STRING-bank* los-coll-rad)
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process-drawable #f)
arg3
)
(let ((s1-1 (-> s0-0 tris))
(f28-0 (/ 2048.0 f26-0))
(f26-1 (/ (+ -8192.0 f26-0) f26-0))
@@ -2592,7 +2608,16 @@
(vector--float*! s5-0 (-> *camera* tpos-curr-adj) (-> *camera* local-down) (-> *camera* target-height))
(vector-! s5-0 s5-0 (-> self string-trans))
(cond
((< (dummy-10 *collide-cache* (-> self string-trans) s5-0 (the-as float 40.96) #x4a09 (the-as process #f) s4-0 2)
((< (fill-and-probe-using-line-sphere
*collide-cache*
(-> self string-trans)
s5-0
(the-as float 40.96)
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s4-0
2
)
0.0
)
(set! (-> self time-dist-too-far) (the-as uint 0))
@@ -2688,12 +2713,12 @@
(cam-collision-record-save (-> self string-trans) s5-2 gp-2 'normal self)
)
(let ((f28-1 (if (logtest? (-> self options) 32)
(dummy-10
(fill-and-probe-using-line-sphere
*collide-cache*
(-> self string-trans)
s5-2
(-> *CAMERA-bank* collide-move-rad)
#x4a09
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s4-2
2
@@ -2993,9 +3018,17 @@
)
(vector--float*! s5-0 (-> *camera* tpos-curr-adj) (-> *camera* local-down) (-> *camera* target-height))
(vector-! gp-1 (-> self string-trans) s5-0)
(let ((f0-31
(dummy-10 *collide-cache* s5-0 gp-1 (-> *CAMERA-bank* collide-move-rad) #x4a09 (the-as process #f) s4-0 4098)
)
(let ((f0-31 (fill-and-probe-using-line-sphere
*collide-cache*
s5-0
gp-1
(-> *CAMERA-bank* collide-move-rad)
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s4-0
4098
)
)
)
(when (and (< 0.0 f0-31) (< f0-31 1.0))
(vector-float*! gp-1 gp-1 f0-31)
@@ -3137,12 +3170,12 @@
(+! s4-0 -1)
(vector-float*! gp-2 (-> self velocity) f30-1)
(let ((f28-0 (if (logtest? (-> self options) 32)
(dummy-10
(fill-and-probe-using-line-sphere
*collide-cache*
(-> self trans)
gp-2
(-> *CAMERA-bank* collide-move-rad)
#x4a09
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s3-0
2
@@ -3420,12 +3453,20 @@
)
(+! s5-3 -1)
(vector-float*! gp-3 (-> self velocity) f30-2)
(let ((f28-0
(if (logtest? (-> self options) 32)
(dummy-10 *collide-cache* (-> self trans) gp-3 (the-as float 4096.0) #x4a09 (the-as process #f) s4-3 2)
-100000000.0
)
)
(let ((f28-0 (if (logtest? (-> self options) 32)
(fill-and-probe-using-line-sphere
*collide-cache*
(-> self trans)
gp-3
(the-as float 4096.0)
(collide-kind background cak-3 wall-object ground-object cak-14)
(the-as process #f)
s4-3
2
)
-100000000.0
)
)
)
(cond
((>= f28-0 0.0)
+31 -30
View File
@@ -76,7 +76,7 @@
;; definition of type collide-puyp-work
(deftype collide-puyp-work (structure)
((best-u float :offset-assert 0)
(ignore-pat uint32 :offset-assert 4)
(ignore-pat pat-surface :offset-assert 4)
(tri-out collide-tri-result :offset-assert 8)
(start-pos vector :inline :offset-assert 16)
(move-dist vector :inline :offset-assert 32)
@@ -124,24 +124,24 @@
;; 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 (pointer collide-shape-prim) :offset-assert 36)
(first-tri uint16 :offset-assert 40)
(num-tris uint16 :offset-assert 42)
(unused uint8 4 :offset-assert 44)
(world-sphere vector :inline :offset 0)
(collide-as collide-kind :offset 16)
(action collide-action :offset 24)
(offense collide-offense :offset 28)
(prim-type int8 :offset 29)
((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)
(world-sphere vector :inline :offset 0)
(collide-as collide-kind :offset 16)
(action collide-action :offset 24)
(offense collide-offense :offset 28)
(prim-type int8 :offset 29)
)
:method-count-assert 11
:size-assert #x30
:flag-assert #xb00000030
(:methods
(dummy-9 (_type_ collide-mesh-cache-tri collide-prim-core vector float collide-action) float 9)
(dummy-10 (_type_ collide-mesh-cache-tri collide-prim-core vector float collide-action) float 10)
(resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float 9)
(resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float 10)
)
)
@@ -167,7 +167,8 @@
(deftype collide-cache (basic)
((num-tris int32 :offset-assert 4)
(num-prims int32 :offset-assert 8)
(ignore-mask uint32 :offset-assert 12)
(num-prims-u uint32 :offset 8)
(ignore-mask pat-surface :offset-assert 12)
(proc process-drawable :offset-assert 16)
(collide-box bounding-box :inline :offset-assert 32)
(collide-box4w bounding-box4w :inline :offset-assert 64)
@@ -180,22 +181,22 @@
:flag-assert #x2100008670
(:methods
(dummy-9 (_type_) none 9)
(dummy-10 (_type_ vector vector float int process collide-tri-result int) float 10)
(dummy-11 (_type_ collide-using-spheres-params) none 11)
(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-y-probe (_type_ vector float collide-kind process collide-tri-result uint) float 12)
(dummy-13 (_type_ bounding-box collide-kind process-drawable pat-surface) none 13)
(dummy-14 (_type_ vector vector float int process int) none 14)
(dummy-15 (_type_ collide-using-spheres-params) none 15)
(dummy-16 (_type_ vector float uint process-drawable uint) none 16)
(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)
(fill-using-spheres (_type_ collide-using-spheres-params) none 15)
(fill-using-y-probe (_type_ vector float collide-kind process-drawable uint) none 16)
(initialize (_type_) none 17)
(dummy-18 (_type_ vector vector float collide-kind collide-tri-result int) float 18)
(probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result int) float 18)
(probe-using-spheres (_type_) none 19)
(dummy-20 (_type_ vector float uint collide-tri-result uint) float 20)
(dummy-21 (_type_ (function bsp-header int collide-list none) (function collide-cache none)) none 21)
(dummy-22 (_type_) none 22)
(dummy-23 (_type_) none 23)
(dummy-24 (_type_) none 24)
(dummy-25 (_type_ water-control) none 25)
(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-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)
(dummy-27 (_type_) none 27)
(dummy-28 (_type_) none 28)
@@ -223,8 +224,8 @@
;; definition of type collide-list-item
(deftype collide-list-item (structure)
((mesh basic :offset-assert 0)
(inst basic :offset-assert 4)
((mesh collide-frag-mesh :offset-assert 0)
(inst basic :offset-assert 4)
)
:method-count-assert 9
:size-assert #x8
+1 -1
View File
@@ -58,7 +58,7 @@
(:methods
(debug-draw-tris (_type_ process-drawable int) none 9)
(dummy-10 (_type_ object vector) none 10)
(dummy-11 (_type_) none 11)
(dummy-11 (_type_ collide-mesh-cache-tri collide-tri-result vector float) none 11)
(dummy-12 (_type_ collide-mesh-cache-tri collide-tri-result vector float) float 12)
(dummy-13 (_type_) none 13)
(dummy-14 (_type_) none 14)
+2 -2
View File
@@ -394,7 +394,7 @@
(TODO-RENAME-28 (_type_ vector) object 28)
(dummy-29 (_type_ int) none 29)
(TODO-RENAME-30 (_type_ vector) object 30)
(dummy-31 (_type_) none 31)
(debug-draw (_type_) none 31)
(dummy-32 (_type_ object collide-kind) none 32)
(dummy-33 (_type_ vector collide-kind) none 33)
(dummy-34 (_type_ uint) collide-shape-prim 34)
@@ -483,7 +483,7 @@
:size-assert #x1bc
:flag-assert #x41000001bc
(:methods
(dummy-56 (_type_ pat-surface) none 56)
(set-and-handle-pat! (_type_ pat-surface) none 56)
(dummy-57 (_type_ vector) none 57)
(dummy-58 (_type_ vector) symbol 58)
(dummy-59 (_type_ vector uint float symbol symbol symbol) none 59)
+1 -1
View File
@@ -158,7 +158,7 @@
:flag-assert #xf00000208
(:methods
(new (symbol type) _type_ 0)
(dummy-9 (_type_ collide-shape-prim collide-shape-prim float collide-shape collide-mesh-cache-tri) none 9)
(add-touching-prims (_type_ collide-shape-prim collide-shape-prim float collide-tri-result collide-tri-result) none 9)
(dummy-10 () none 10)
(dummy-11 (_type_ float) none 11)
(dummy-12 (_type_) none 12)
+14 -14
View File
@@ -159,16 +159,16 @@
;; definition for method 9 of type touching-list
;; INFO: Return type mismatch int vs none.
;; WARN: Expression building failed: Function (method 9 touching-list) has a return type of none, but the expression builder found a return statement.
(defmethod dummy-9 touching-list ((obj touching-list)
(arg0 collide-shape-prim)
(arg1 collide-shape-prim)
(arg2 float)
(arg3 collide-shape)
(arg4 collide-mesh-cache-tri)
)
(let ((gp-0 (new 'stack-no-clear 'touching-shapes-entry)))
(set! (-> gp-0 cshape1) arg3)
(set! (-> gp-0 cshape2) (the-as collide-shape arg4))
(defmethod add-touching-prims touching-list ((obj touching-list)
(arg0 collide-shape-prim)
(arg1 collide-shape-prim)
(arg2 float)
(arg3 collide-tri-result)
(arg4 collide-tri-result)
)
(let ((gp-0 (new 'stack-no-clear 'add-prims-touching-work)))
(set! (-> gp-0 tri1) arg3)
(set! (-> gp-0 tri2) arg4)
(let ((s2-0 (get-shapes-entry obj (-> arg0 cshape) (-> arg1 cshape))))
(when s2-0
(when (= (-> s2-0 cshape1) (-> arg1 cshape))
@@ -183,7 +183,7 @@
(when (< arg2 (-> s0-0 u))
(-> s0-0 u)
(let ((v1-12 (-> s0-0 prim1))
(a1-2 (-> gp-0 cshape1))
(a1-2 (-> gp-0 tri1))
)
(cond
(a1-2
@@ -196,7 +196,7 @@
)
)
(let ((v1-15 (-> s0-0 prim2))
(a1-3 (-> gp-0 cshape2))
(a1-3 (-> gp-0 tri2))
)
(cond
(a1-3
@@ -230,7 +230,7 @@
(set! (-> obj resolve-u) 1)
)
(let ((v1-26 (-> s0-1 prim1))
(a1-4 (-> gp-0 cshape1))
(a1-4 (-> gp-0 tri1))
)
(set! (-> v1-26 cprim) arg0)
(cond
@@ -244,7 +244,7 @@
)
)
(let ((v1-29 (-> s0-1 prim2))
(a1-5 (-> gp-0 cshape2))
(a1-5 (-> gp-0 tri2))
)
(set! (-> v1-29 cprim) arg1)
(cond
+1 -1
View File
@@ -130,7 +130,7 @@
(vector-float*! a1-1 (-> arg1 move-vec) (-> arg1 best-u))
(TODO-RENAME-28 arg0 a1-1)
)
(dummy-56 arg0 (-> arg1 best-tri pat))
(set-and-handle-pat! arg0 (-> arg1 best-tri pat))
(case (-> arg1 best-tri pat material)
(((pat-material stopproj))
(send-event (-> arg0 process) 'die)
+1 -1
View File
@@ -965,7 +965,7 @@
(set! (-> gp-0 proc) #f)
(set! (-> gp-0 ignore-pat) (the-as uint 1))
(set! (-> gp-0 solid-only) #t)
(if (dummy-11 *collide-cache* gp-0)
(if (fill-and-probe-using-spheres *collide-cache* gp-0)
#f
#t
)
+1 -1
View File
@@ -1559,7 +1559,7 @@
(set! (-> a1-2 proc) #f)
(set! (-> a1-2 ignore-pat) (the-as uint 1))
(set! (-> a1-2 solid-only) #t)
(when (not (dummy-11 *collide-cache* a1-2))
(when (not (fill-and-probe-using-spheres *collide-cache* a1-2))
(remove-exit)
(go
target-edge-grab-jump
+12 -1
View File
@@ -1182,7 +1182,18 @@
(let ((gp-0 (new 'stack-no-clear 'vector)))
(set! (-> self root-override transv y) (* 4096.0 (- arg0)))
(set! (-> gp-0 quad) (-> self root-override transv quad))
(let ((f30-0 (dummy-10 *collide-cache* (-> self root-override trans) gp-0 409.6 1 self s5-0 1)))
(let ((f30-0 (fill-and-probe-using-line-sphere
*collide-cache*
(-> self root-override trans)
gp-0
409.6
(collide-kind background)
self
s5-0
1
)
)
)
(when (or (< f30-0 0.0) (or (< 1.0 f30-0) (nonzero? (-> s5-0 pat mode))))
(suspend)
(go seagull-soaring)
+4 -2
View File
@@ -500,7 +500,7 @@
;; definition for method 22 of type joint-exploder
;; Used lq/sq
(defmethod TODO-RENAME-22 joint-exploder ((obj joint-exploder) (arg0 joint-exploder-list))
(dummy-13
(fill-using-bounding-box
*collide-cache*
(-> arg0 bbox)
(collide-kind background)
@@ -517,7 +517,9 @@
(s3-0 (new 'stack-no-clear 'collide-tri-result))
)
(vector-! a2-1 s4-0 (-> s5-1 prev-pos))
(when (>= (dummy-18 *collide-cache* (-> s5-1 prev-pos) a2-1 40.96 (collide-kind background) s3-0 1) 0.0)
(when (>= (probe-using-line-sphere *collide-cache* (-> s5-1 prev-pos) a2-1 40.96 (collide-kind background) s3-0 1)
0.0
)
(set! (-> s4-0 quad) (-> s3-0 intersect quad))
(let ((f28-0 (vector-xz-length (-> s5-1 transv))))
(vector-reflect! (-> s5-1 transv) (-> s5-1 transv) (-> s3-0 normal))
+12 -1
View File
@@ -1068,7 +1068,18 @@
)
0.0
(vector-! a2-1 (the-as vector v1-5) (the-as vector a1-2))
(when (< (dummy-10 *collide-cache* (the-as vector a1-2) a2-1 40.96 1 self (the-as collide-tri-result t2-0) 1) 0.0)
(when (< (fill-and-probe-using-line-sphere
*collide-cache*
(the-as vector a1-2)
a2-1
40.96
(collide-kind background)
self
(the-as collide-tri-result t2-0)
1
)
0.0
)
(cond
((= (-> arg0 type) target)
(let ((a1-3 (new 'stack-no-clear 'event-message-block)))
+12 -1
View File
@@ -3943,7 +3943,18 @@
(a2-0 (new 'stack-no-clear 'vector))
)
(vector-! a2-0 gp-0 s4-0)
(when (>= (dummy-10 *collide-cache* s4-0 a2-0 (the-as float 4096.0) 16 self t2-0 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere
*collide-cache*
s4-0
a2-0
(the-as float 4096.0)
(collide-kind target)
self
t2-0
1
)
0.0
)
(let ((a1-13 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-13 from) self)
(set! (-> a1-13 num-params) 2)
+12 -1
View File
@@ -2457,7 +2457,18 @@
(vector-length s4-1)
(let ((t2-0 (new 'stack-no-clear 'collide-mesh-cache-tri)))
0.0
(if (>= (dummy-10 *collide-cache* arg0 s4-1 6144.0 16 (the-as process #f) (the-as collide-tri-result t2-0) 1) 0.0)
(if (>= (fill-and-probe-using-line-sphere
*collide-cache*
arg0
s4-1
6144.0
(collide-kind target)
(the-as process #f)
(the-as collide-tri-result t2-0)
1
)
0.0
)
(send-event *target* 'get-pickup 3 5.0)
)
)
+3 -1
View File
@@ -709,7 +709,9 @@
(when (>= (-> obj explode-danger-radius) (vector-vector-distance s5-0 s3-0))
(vector-! s4-0 s3-0 s5-0)
(let ((t2-0 (new 'stack-no-clear 'collide-tri-result)))
(if (< (dummy-10 *collide-cache* s5-0 s4-0 819.2 1 obj t2-0 1) 0.0)
(if (< (fill-and-probe-using-line-sphere *collide-cache* s5-0 s4-0 819.2 (collide-kind background) obj t2-0 1)
0.0
)
(send-event *target* 'attack #f (new 'static 'attack-info))
)
)
+3 -1
View File
@@ -217,7 +217,9 @@
(set! (-> a1-1 y) (+ 1228.8 (-> a1-1 y)))
(set-vector! a2-1 0.0 -61440.0 0.0 1.0)
(cond
((>= (dummy-10 *collide-cache* a1-1 a2-1 7372.8 1 obj s5-0 1) 0.0)
((>= (fill-and-probe-using-line-sphere *collide-cache* a1-1 a2-1 7372.8 (collide-kind background) obj s5-0 1)
0.0
)
(let ((v1-11 (-> obj draw shadow-ctrl)))
(set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags)))
)
+51 -5
View File
@@ -113,7 +113,18 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-1 quad) vf1)
)
(when (>= (dummy-10 *collide-cache* (-> self root trans) a2-0 3276.8 1 self gp-0 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere
*collide-cache*
(-> self root trans)
a2-0
3276.8
(collide-kind background)
self
gp-0
1
)
0.0
)
(let ((f28-0 (vector-xz-length (-> self transv))))
(vector-reflect! (-> self transv) (-> self transv) (-> gp-0 normal))
(let ((f30-0 (-> self transv y)))
@@ -466,7 +477,9 @@
(set-vector! a2-0 0.0 -81920.0 0.0 1.0)
(set! (-> a1-0 y) (+ -8192.0 (-> a1-0 y)))
(cond
((>= (dummy-10 *collide-cache* a1-0 a2-0 8192.0 1 obj s5-0 1) 0.0)
((>= (fill-and-probe-using-line-sphere *collide-cache* a1-0 a2-0 8192.0 (collide-kind background) obj s5-0 1)
0.0
)
(let ((v1-11 (-> obj draw shadow-ctrl)))
(set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags)))
)
@@ -765,7 +778,18 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-20 quad) vf1)
)
(when (>= (dummy-10 *collide-cache* s4-0 s3-0 4915.2 1 obj (the-as collide-tri-result s5-1) 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere
*collide-cache*
s4-0
s3-0
4915.2
(collide-kind background)
obj
(the-as collide-tri-result s5-1)
1
)
0.0
)
(vector-reflect! (-> obj swing-vel) (-> obj swing-vel) (the-as vector (&-> s5-1 param 6)))
(set! (-> obj swing-vel y) 0.0)
(vector-normalize! (-> obj swing-vel) (* 0.5 (vector-length (-> obj swing-vel))))
@@ -1590,7 +1614,18 @@
(vector+! arg0 (-> obj root-override trans) (-> obj nav travel))
(let ((s2-2 (new 'stack-no-clear 'collide-tri-result)))
(cond
((>= (dummy-10 *collide-cache* arg0 (new 'static 'vector :y -69632.0 :w 1.0) 40.96 1 obj s2-2 1) 0.0)
((>= (fill-and-probe-using-line-sphere
*collide-cache*
arg0
(new 'static 'vector :y -69632.0 :w 1.0)
40.96
(collide-kind background)
obj
s2-2
1
)
0.0
)
(set! (-> arg0 y) (-> s2-2 intersect y))
(set! (-> arg1 quad) (-> s2-2 normal quad))
(return #t)
@@ -1613,7 +1648,18 @@
(set! (-> a1-12 quad) (-> arg0 quad))
(set! (-> a1-12 y) (+ 8192.0 (-> a1-12 y)))
(cond
((>= (dummy-10 *collide-cache* a1-12 (new 'static 'vector :y -69632.0 :w 1.0) 40.96 1 obj s3-2 1) 0.0)
((>= (fill-and-probe-using-line-sphere
*collide-cache*
a1-12
(new 'static 'vector :y -69632.0 :w 1.0)
40.96
(collide-kind background)
obj
s3-2
1
)
0.0
)
(set! (-> arg0 y) (-> s3-2 intersect y))
(set! (-> arg1 quad) (-> s3-2 normal quad))
(return #t)
+3 -1
View File
@@ -489,7 +489,9 @@
(set! (-> a1-1 quad) (-> obj root trans quad))
(set! (-> a1-1 y) (+ -8192.0 (-> a1-1 y)))
(set-vector! a2-0 0.0 -81920.0 0.0 1.0)
(when (>= (dummy-10 *collide-cache* a1-1 a2-0 8192.0 1 pp s3-1 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere *collide-cache* a1-1 a2-0 8192.0 (collide-kind background) pp s3-1 1)
0.0
)
(set! (-> s3-1 intersect w) 8192.0)
(when (and (sphere-in-view-frustum? (the-as sphere (-> s3-1 intersect)))
(< 822083600.0 (vector-vector-distance-squared (-> s3-1 intersect) (camera-pos)))
@@ -22,7 +22,7 @@
(vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u))
(TODO-RENAME-28 arg0 a1-3)
)
(dummy-56 arg0 (-> arg1 best-tri pat))
(set-and-handle-pat! arg0 (-> arg1 best-tri pat))
(if (= (-> arg0 poly-pat mode) (pat-mode wall))
(set! sv-104 (logior sv-104 1))
)
+11 -1
View File
@@ -180,7 +180,17 @@
(set! (-> gp-0 quad) (-> self root-override trans quad))
(let ((t2-0 (new 'stack-no-clear 'collide-tri-result)))
(set! (-> gp-0 y) (+ 8192.0 (-> gp-0 y)))
(let ((f0-2 (dummy-10 *collide-cache* gp-0 (new 'static 'vector :y -81920.0 :w 1.0) 40.96 1 self t2-0 1))
(let ((f0-2 (fill-and-probe-using-line-sphere
*collide-cache*
gp-0
(new 'static 'vector :y -81920.0 :w 1.0)
40.96
(collide-kind background)
self
t2-0
1
)
)
(v1-5 (new 'stack-no-clear 'vector))
)
(set! (-> v1-5 quad) (-> self root-override trans quad))
+12 -1
View File
@@ -939,7 +939,18 @@
)
(set! (-> a1-5 quad) (-> arg0 quad))
(set! (-> a1-5 y) (+ 8192.0 (-> a1-5 y)))
(when (>= (dummy-10 *collide-cache* a1-5 (new 'static 'vector :y -40960.0 :w 1.0) 40.96 1 obj s4-0 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere
*collide-cache*
a1-5
(new 'static 'vector :y -40960.0 :w 1.0)
40.96
(collide-kind background)
obj
s4-0
1
)
0.0
)
(set! (-> arg0 y) (-> s4-0 intersect y))
(return #t)
)
+12 -1
View File
@@ -195,7 +195,18 @@
(set! (-> a1-0 quad) (-> obj root-override trans quad))
(set-vector! a2-0 0.0 -40960.0 0.0 1.0)
(cond
((>= (dummy-10 *collide-cache* a1-0 a2-0 8192.0 2057 obj s5-0 1) 0.0)
((>= (fill-and-probe-using-line-sphere
*collide-cache*
a1-0
a2-0
8192.0
(collide-kind background cak-3 ground-object)
obj
s5-0
1
)
0.0
)
(let ((v1-11 (-> obj draw shadow-ctrl)))
(set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags)))
)
+6
View File
@@ -1121,6 +1121,12 @@
(process-entity-status! self (entity-perm-status bit-3) #t)
(none)
)
:exit
(behavior ()
(set! (-> self target) (the-as handle #f))
(process-entity-status! self (entity-perm-status bit-3) #f)
(none)
)
:trans
(behavior ()
(let ((gp-0 (handle->process (-> self target))))
+12 -1
View File
@@ -964,7 +964,18 @@
(v1-1 (-> self tongue-control target-pos))
(s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 gp-0))
(t2-0 (new 'stack 'collide-tri-result))
(f30-0 (dummy-10 *collide-cache* gp-0 s5-1 409.6 3973 self t2-0 1))
(f30-0
(fill-and-probe-using-line-sphere
*collide-cache*
gp-0
s5-1
409.6
(collide-kind background cak-2 crate enemy wall-object projectile ground-object)
self
t2-0
1
)
)
(gp-1 (< f30-0 0.0))
)
(set! (-> self tongue-control forward-scale-max)
+12 -1
View File
@@ -1578,7 +1578,18 @@
(vector-! s4-0 gp-0 s5-0)
(let ((t2-0 (new 'stack-no-clear 'collide-tri-result)))
0.0
(when (>= (dummy-10 *collide-cache* s5-0 s4-0 6144.0 16 (the-as process #f) t2-0 1) 0.0)
(when (>= (fill-and-probe-using-line-sphere
*collide-cache*
s5-0
s4-0
6144.0
(collide-kind target)
(the-as process #f)
t2-0
1
)
0.0
)
(let ((a1-7 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-7 from) self)
(set! (-> a1-7 num-params) 2)