mirror of
https://github.com/open-goal/jak-project
synced 2026-06-29 19:42:41 -04:00
[game] edge grab, small fixes, add zoomer (#1083)
* fix a few small things * fix tests * another fix * fix tests
This commit is contained in:
@@ -3027,9 +3027,9 @@ void DefpartgroupElement::apply(const std::function<void(FormElement*)>& f) {
|
||||
f(this);
|
||||
}
|
||||
|
||||
void DefpartgroupElement::apply_form(const std::function<void(Form*)>& f) {}
|
||||
void DefpartgroupElement::collect_vars(RegAccessSet& vars, bool recursive) const {}
|
||||
void DefpartgroupElement::get_modified_regs(RegSet& regs) const {}
|
||||
void DefpartgroupElement::apply_form(const std::function<void(Form*)>&) {}
|
||||
void DefpartgroupElement::collect_vars(RegAccessSet&, bool) const {}
|
||||
void DefpartgroupElement::get_modified_regs(RegSet&) const {}
|
||||
|
||||
goos::Object DefpartgroupElement::to_form_internal(const Env& env) const {
|
||||
std::vector<goos::Object> forms;
|
||||
@@ -3134,9 +3134,9 @@ void DefpartElement::apply(const std::function<void(FormElement*)>& f) {
|
||||
f(this);
|
||||
}
|
||||
|
||||
void DefpartElement::apply_form(const std::function<void(Form*)>& f) {}
|
||||
void DefpartElement::collect_vars(RegAccessSet& vars, bool recursive) const {}
|
||||
void DefpartElement::get_modified_regs(RegSet& regs) const {}
|
||||
void DefpartElement::apply_form(const std::function<void(Form*)>&) {}
|
||||
void DefpartElement::collect_vars(RegAccessSet&, bool) const {}
|
||||
void DefpartElement::get_modified_regs(RegSet&) const {}
|
||||
|
||||
goos::Object DefpartElement::to_form_internal(const Env& env) const {
|
||||
std::vector<goos::Object> forms;
|
||||
|
||||
@@ -9563,7 +9563,7 @@
|
||||
:size-assert #x30
|
||||
:flag-assert #xa00000030
|
||||
(:methods
|
||||
(dummy-9 (_type_) _type_ 9)
|
||||
(debug-print-frames (_type_) _type_ 9)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -9596,7 +9596,7 @@
|
||||
(:methods
|
||||
(new (symbol type int) _type_ 0)
|
||||
(dummy-9 (_type_) float 9)
|
||||
(dummy-10 (_type_ symbol) int 10)
|
||||
(debug-print-channels (_type_ symbol) int 10)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -11752,7 +11752,7 @@
|
||||
:flag-assert #xb00000144
|
||||
(:methods
|
||||
(dummy-9 (_type_) symbol 9)
|
||||
(dummy-10 (_type_) symbol 10)
|
||||
(debug-draw (_type_) symbol 10)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -11803,7 +11803,7 @@
|
||||
:flag-assert #xb00000810
|
||||
(:methods
|
||||
(debug-draw (_type_) object 9)
|
||||
(dummy-10 (_type_ collide-edge-hold-item) none 10)
|
||||
(add-to-list! (_type_ collide-edge-hold-item) none 10)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -11841,17 +11841,17 @@
|
||||
:size-assert #x2690
|
||||
:flag-assert #x1400002690
|
||||
(:methods
|
||||
(dummy-9 (_type_ collide-edge-hold-list) symbol 9)
|
||||
(search-for-edges (_type_ collide-edge-hold-list) symbol 9)
|
||||
(debug-draw-edges (_type_) object 10)
|
||||
(dummy-11 (_type_) none 11)
|
||||
(debug-draw-tris (_type_) none 11)
|
||||
(debug-draw-sphere (_type_) symbol 12)
|
||||
(dummy-13 (_type_ collide-edge-hold-item vector) none 13)
|
||||
(compute-center-point! (_type_ collide-edge-edge vector) float 13)
|
||||
(dummy-14 (_type_ vector vector int) float 14)
|
||||
(dummy-15 (_type_) none 15)
|
||||
(find-grabbable-edges! (_type_) none 15)
|
||||
(find-grabbable-tris! (_type_) none 16)
|
||||
(dummy-17 (_type_) none 17)
|
||||
(dummy-18 (_type_ collide-edge-hold-list edge-grab-info) none 18)
|
||||
(dummy-19 (_type_ collide-edge-hold-item edge-grab-info) symbol 19)
|
||||
(should-add-to-list? (_type_ collide-edge-hold-item collide-edge-edge) symbol 17)
|
||||
(find-best-grab! (_type_ collide-edge-hold-list edge-grab-info) symbol 18)
|
||||
(check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) symbol 19)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -234,12 +234,12 @@
|
||||
"collide-probe-node", // CFG
|
||||
|
||||
// collide-edge-grab
|
||||
"(method 13 collide-edge-work)", // CFG
|
||||
"(method 17 collide-edge-work)", // CFG
|
||||
// CFG
|
||||
// CFG
|
||||
"(method 15 collide-edge-work)", // CFG
|
||||
// CFG
|
||||
"(method 9 edge-grab-info)", // CFG
|
||||
"(method 18 collide-edge-work)", // CFG
|
||||
// CFG
|
||||
// CFG
|
||||
// CFG
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@
|
||||
|
||||
// process-drawable BUG
|
||||
"cspace-inspect-tree",
|
||||
"(method 19 process-drawable)",
|
||||
//"(method 19 process-drawable)",
|
||||
|
||||
// ambient
|
||||
"ambient-inspect",
|
||||
@@ -491,7 +491,13 @@
|
||||
"(method 13 collide-shape-prim-group)" : [0, 1, 2,3,4],
|
||||
"(method 19 collide-cache)" : [0, 1, 3, 4, 5, 18, 19],
|
||||
"(method 10 collide-mesh)" : [1, 2, 4, 5],
|
||||
"target-falling-anim-trans" : [5, 6]
|
||||
"target-falling-anim-trans" : [5, 6],
|
||||
"(method 19 process-drawable)" : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
|
||||
"(anon-function 9 racer)" : [75],
|
||||
"(method 13 collide-edge-work)" : [0, 2],
|
||||
"(method 17 collide-edge-work)" : [0, 1, 2, 3, 4],
|
||||
"(method 9 edge-grab-info)" : [15, 16, 18, 19, 21, 22, 24]
|
||||
// "(method 18 collide-edge-work)" : [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24]
|
||||
|
||||
},
|
||||
|
||||
@@ -564,7 +570,9 @@
|
||||
"(method 15 collide-mesh)",
|
||||
|
||||
"(method 16 collide-edge-work)",
|
||||
"(method 10 collide-edge-hold-list)"
|
||||
"(method 10 collide-edge-hold-list)",
|
||||
"(method 15 collide-edge-work)",
|
||||
"(method 18 collide-edge-work)"
|
||||
],
|
||||
|
||||
// there are some missing textures. I don't know what the game actually does here.
|
||||
|
||||
@@ -6190,5 +6190,14 @@
|
||||
[224, "vector"]
|
||||
],
|
||||
|
||||
"(method 18 collide-edge-work)": [
|
||||
[16, "pbhp-stack-vars"]
|
||||
],
|
||||
|
||||
"(method 9 edge-grab-info)": [
|
||||
[16, "collide-using-spheres-params"],
|
||||
[48, "event-message-block"]
|
||||
],
|
||||
|
||||
"placeholder-do-not-add-below!": []
|
||||
}
|
||||
|
||||
@@ -5738,16 +5738,14 @@
|
||||
],
|
||||
|
||||
"(method 9 collide-edge-work)": [
|
||||
[10, "s3", "collide-edge-edge"],
|
||||
[16, "s4", "collide-edge-hold-item"],
|
||||
[46, "s4", "(inline-array collide-edge-hold-item)"],
|
||||
[48, "s3", "(inline-array collide-edge-edge)"]
|
||||
[[5, 52], "s3", "collide-edge-edge"],
|
||||
[[5, 52], "s4", "collide-edge-hold-item"]
|
||||
],
|
||||
|
||||
"(method 19 collide-edge-work)": [
|
||||
[150, "a1", "int"],
|
||||
[150, "v1", "int"],
|
||||
[[149, 162], "a0", "collide-shape-prim-group"]
|
||||
[150, "v1", "int"]
|
||||
//[[149, 162], "a0", "collide-shape-prim-group"]
|
||||
],
|
||||
|
||||
"collide-probe-make-list": [
|
||||
@@ -7771,5 +7769,11 @@
|
||||
[921, "a0", "(pointer symbol)"]
|
||||
],
|
||||
|
||||
"(method 9 edge-grab-info)": [
|
||||
[23, "a0", "int"],
|
||||
[[24,31], "s5", "collide-shape-prim"],
|
||||
[29, "a0", "process-drawable"],
|
||||
[156, "s5", "collide-shape-prim"]
|
||||
],
|
||||
"placeholder-do-not-add-below": []
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ goos::Object decompile_sparticle_float_degrees_with_rand_init(const std::vector<
|
||||
}
|
||||
}
|
||||
|
||||
goos::Object decompile_sparticle_sound_spec(const std::vector<LinkedWord>& words,
|
||||
goos::Object decompile_sparticle_sound_spec(const std::vector<LinkedWord>& /*words*/,
|
||||
const std::string& field_name,
|
||||
const std::string& flag_name,
|
||||
const goos::Object& original) {
|
||||
|
||||
@@ -189,3 +189,818 @@ void link() {
|
||||
} // namespace method_16_collide_edge_work
|
||||
} // namespace Mips2C
|
||||
|
||||
namespace Mips2C {
|
||||
namespace method_15_collide_edge_work {
|
||||
struct Cache {
|
||||
void* format; // format
|
||||
} cache;
|
||||
|
||||
void sub_l20_b26(ExecutionContext* c) {
|
||||
bool bc;
|
||||
bool cop1_bc;
|
||||
// block_26:
|
||||
c->gprs[t2].du64[0] = 0; // or t2, r0, r0
|
||||
c->lwu(t1, 8, a0); // lwu t1, 8(a0)
|
||||
c->daddiu(t0, a0, 640); // daddiu t0, a0, 640
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
block_27:
|
||||
bc = c->sgpr64(t2) == c->sgpr64(t1); // beq t2, t1, L22
|
||||
c->lqc2(vf9, 0, t0); // lqc2 vf9, 0(t0)
|
||||
if (bc) {goto block_36;} // branch non-likely
|
||||
|
||||
c->daddiu(t2, t2, 1); // daddiu t2, t2, 1
|
||||
c->lqc2(vf10, 16, t0); // lqc2 vf10, 16(t0)
|
||||
c->vsub(DEST::xyzw, vf9, vf9, vf8); // vsub.xyzw vf9, vf9, vf8
|
||||
c->lqc2(vf11, 32, t0); // lqc2 vf11, 32(t0)
|
||||
c->vsub(DEST::xyzw, vf10, vf10, vf8); // vsub.xyzw vf10, vf10, vf8
|
||||
c->lqc2(vf12, 48, t0); // lqc2 vf12, 48(t0)
|
||||
c->vsub(DEST::xyzw, vf11, vf11, vf8); // vsub.xyzw vf11, vf11, vf8
|
||||
// nop // sll r0, r0, 0
|
||||
c->vsub(DEST::xyzw, vf12, vf12, vf8); // vsub.xyzw vf12, vf12, vf8
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf9, vf9, vf9); // vmul.xyzw vf9, vf9, vf9
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf10, vf10, vf10); // vmul.xyzw vf10, vf10, vf10
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf11, vf11, vf11); // vmul.xyzw vf11, vf11, vf11
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf12, vf12, vf12); // vmul.xyzw vf12, vf12, vf12
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::y, vf9, vf9, vf9); // vaddy.x vf9, vf9, vf9
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::y, vf10, vf10, vf10); // vaddy.x vf10, vf10, vf10
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::y, vf11, vf11, vf11); // vaddy.x vf11, vf11, vf11
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::y, vf12, vf12, vf12); // vaddy.x vf12, vf12, vf12
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::z, vf9, vf9, vf9); // vaddz.x vf9, vf9, vf9
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::z, vf10, vf10, vf10); // vaddz.x vf10, vf10, vf10
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::z, vf11, vf11, vf11); // vaddz.x vf11, vf11, vf11
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::z, vf12, vf12, vf12); // vaddz.x vf12, vf12, vf12
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(t3, vf9); // qmfc2.i t3, vf9
|
||||
// nop // sll r0, r0, 0
|
||||
c->mtc1(f1, t3); // mtc1 f1, t3
|
||||
// nop // sll r0, r0, 0
|
||||
cop1_bc = c->fprs[f1] <= c->fprs[f0]; // c.le.s f1, f0
|
||||
// nop // sll r0, r0, 0
|
||||
bc = cop1_bc; // bc1t L23
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_39;} // branch non-likely
|
||||
|
||||
bc = c->sgpr64(t2) == c->sgpr64(t1); // beq t2, t1, L22
|
||||
c->daddiu(t0, t0, 16); // daddiu t0, t0, 16
|
||||
if (bc) {goto block_36;} // branch non-likely
|
||||
|
||||
c->mov128_gpr_vf(t3, vf10); // qmfc2.i t3, vf10
|
||||
c->daddiu(t2, t2, 1); // daddiu t2, t2, 1
|
||||
c->mtc1(f1, t3); // mtc1 f1, t3
|
||||
// nop // sll r0, r0, 0
|
||||
cop1_bc = c->fprs[f1] <= c->fprs[f0]; // c.le.s f1, f0
|
||||
// nop // sll r0, r0, 0
|
||||
bc = cop1_bc; // bc1t L23
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_39;} // branch non-likely
|
||||
|
||||
bc = c->sgpr64(t2) == c->sgpr64(t1); // beq t2, t1, L22
|
||||
c->daddiu(t0, t0, 16); // daddiu t0, t0, 16
|
||||
if (bc) {goto block_36;} // branch non-likely
|
||||
|
||||
c->mov128_gpr_vf(t3, vf11); // qmfc2.i t3, vf11
|
||||
c->daddiu(t2, t2, 1); // daddiu t2, t2, 1
|
||||
c->mtc1(f1, t3); // mtc1 f1, t3
|
||||
// nop // sll r0, r0, 0
|
||||
cop1_bc = c->fprs[f1] <= c->fprs[f0]; // c.le.s f1, f0
|
||||
// nop // sll r0, r0, 0
|
||||
bc = cop1_bc; // bc1t L23
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_39;} // branch non-likely
|
||||
|
||||
bc = c->sgpr64(t2) == c->sgpr64(t1); // beq t2, t1, L22
|
||||
c->daddiu(t0, t0, 16); // daddiu t0, t0, 16
|
||||
if (bc) {goto block_36;} // branch non-likely
|
||||
|
||||
c->mov128_gpr_vf(t3, vf12); // qmfc2.i t3, vf12
|
||||
c->daddiu(t2, t2, 1); // daddiu t2, t2, 1
|
||||
c->mtc1(f1, t3); // mtc1 f1, t3
|
||||
// nop // sll r0, r0, 0
|
||||
cop1_bc = c->fprs[f1] <= c->fprs[f0]; // c.le.s f1, f0
|
||||
// nop // sll r0, r0, 0
|
||||
bc = cop1_bc; // bc1t L23
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_39;} // branch non-likely
|
||||
|
||||
//beq r0, r0, L21 // beq r0, r0, L21
|
||||
c->daddiu(t0, t0, 16); // daddiu t0, t0, 16
|
||||
goto block_27; // branch always
|
||||
|
||||
|
||||
block_36:
|
||||
c->addiu(t2, r0, 64); // addiu t2, r0, 64
|
||||
// nop // sll r0, r0, 0
|
||||
if (((s64)c->sgpr64(t2)) == ((s64)c->sgpr64(t1))) {// beql t2, t1, L23
|
||||
c->mov64(t0, s7); // or t0, s7, r0
|
||||
goto block_39;
|
||||
}
|
||||
|
||||
// block_38:
|
||||
c->daddiu(t1, t1, 1); // daddiu t1, t1, 1
|
||||
c->sqc2(vf8, 0, t0); // sqc2 vf8, 0(t0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sw(t1, 8, a0); // sw t1, 8(a0)
|
||||
|
||||
block_39:
|
||||
;
|
||||
//jr ra // jr ra
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
}
|
||||
|
||||
void sub_l16_b15(ExecutionContext* c) {
|
||||
bool bc;
|
||||
bool cop1_bc;
|
||||
// block_15:
|
||||
c->mov64(t4, t1); // or t4, t1, r0
|
||||
c->lwu(t3, 12, a0); // lwu t3, 12(a0)
|
||||
c->dsll32(t4, t4, 0); // dsll32 t4, t4, 0
|
||||
c->gprs[t5].du64[0] = 0; // or t5, r0, r0
|
||||
c->or_(t6, t4, t2); // or t6, t4, t2
|
||||
c->daddiu(t4, a0, 1664); // daddiu t4, a0, 1664
|
||||
|
||||
block_16:
|
||||
bc = c->sgpr64(t5) == c->sgpr64(t3); // beq t5, t3, L18
|
||||
c->ld(t7, 8, t4); // ld t7, 8(t4)
|
||||
if (bc) {goto block_20;} // branch non-likely
|
||||
|
||||
c->daddiu(t5, t5, 1); // daddiu t5, t5, 1
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
if (((s64)c->sgpr64(t6)) != ((s64)c->sgpr64(t7))) {// bnel t6, t7, L17
|
||||
c->daddiu(t4, t4, 48); // daddiu t4, t4, 48
|
||||
goto block_16;
|
||||
}
|
||||
|
||||
// block_19:
|
||||
//beq r0, r0, L19 // beq r0, r0, L19
|
||||
c->sw(r0, 0, t4); // sw r0, 0(t4)
|
||||
goto block_25; // branch always
|
||||
|
||||
|
||||
block_20:
|
||||
c->addiu(t5, r0, 96); // addiu t5, r0, 96
|
||||
// nop // sll r0, r0, 0
|
||||
if (((s64)c->sgpr64(t3)) == ((s64)c->sgpr64(t5))) {// beql t3, t5, L19
|
||||
c->mov64(t4, s7); // or t4, s7, r0
|
||||
goto block_25;
|
||||
}
|
||||
|
||||
// block_22:
|
||||
c->daddiu(t3, t3, 1); // daddiu t3, t3, 1
|
||||
c->sw(s7, 0, t4); // sw s7, 0(t4)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sw(t1, 8, t4); // sw t1, 8(t4)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sw(t2, 12, t4); // sw t2, 12(t4)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sw(a1, 4, t4); // sw a1, 4(t4)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sw(t3, 12, a0); // sw t3, 12(a0)
|
||||
c->vmove(DEST::xyzw, vf13, vf0); // vmove.xyzw vf13, vf0
|
||||
c->lqc2(vf16, 0, t1); // lqc2 vf16, 0(t1)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf17, 0, t2); // lqc2 vf17, 0(t2)
|
||||
c->vsub(DEST::xyzw, vf18, vf17, vf16); // vsub.xyzw vf18, vf17, vf16
|
||||
// nop // sll r0, r0, 0
|
||||
c->vsub(DEST::xyzw, vf19, vf1, vf16); // vsub.xyzw vf19, vf1, vf16
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf20, vf18, vf18); // vmul.xyzw vf20, vf18, vf18
|
||||
// nop // sll r0, r0, 0
|
||||
c->vsub_bc(DEST::x, BC::z, vf13, vf0, vf18); // vsubz.x vf13, vf0, vf18
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::y, vf20, vf20, vf20); // vaddy.x vf20, vf20, vf20
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::z, BC::x, vf13, vf0, vf18); // vaddx.z vf13, vf0, vf18
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::z, vf20, vf20, vf20); // vaddz.x vf20, vf20, vf20
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf15, vf13, vf19); // vmul.xyzw vf15, vf13, vf19
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf14, vf13, vf13); // vmul.xyzw vf14, vf13, vf13
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::z, vf15, vf15, vf15); // vaddz.x vf15, vf15, vf15
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::x, BC::z, vf14, vf14, vf14); // vaddz.x vf14, vf14, vf14
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(t2, vf15); // qmfc2.i t2, vf15
|
||||
// nop // sll r0, r0, 0
|
||||
c->vrsqrt(vf0, BC::w, vf14, BC::x); // vrsqrt Q, vf0.w, vf14.x
|
||||
// nop // sll r0, r0, 0
|
||||
c->mtc1(f3, t2); // mtc1 f3, t2
|
||||
// nop // sll r0, r0, 0
|
||||
cop1_bc = c->fprs[f3] < c->fprs[f2]; // c.lt.s f3, f2
|
||||
// nop // sll r0, r0, 0
|
||||
if (cop1_bc) { // bc1tl L19
|
||||
c->sw(r0, 0, t4); // sw r0, 0(t4)
|
||||
goto block_25;
|
||||
}
|
||||
|
||||
// block_24:
|
||||
c->vwaitq(); // vwaitq
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmulq(DEST::xyz, vf13, vf13); // vmulq.xyz vf13, vf13, Q
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // vnop
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // vnop
|
||||
// nop // sll r0, r0, 0
|
||||
c->vrsqrt(vf0, BC::w, vf20, BC::x); // vrsqrt Q, vf0.w, vf20.x
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul_bc(DEST::w, BC::w, vf18, vf0, vf0); // vmulw.w vf18, vf0, vf0
|
||||
c->sqc2(vf13, 16, t4); // sqc2 vf13, 16(t4)
|
||||
c->vwaitq(); // vwaitq
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmulq(DEST::xyz, vf18, vf18); // vmulq.xyz vf18, vf18, Q
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // vnop
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // vnop
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf18, 32, t4); // sqc2 vf18, 32(t4)
|
||||
|
||||
block_25:
|
||||
;
|
||||
//jr ra // jr ra
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
}
|
||||
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
bool bc = false;
|
||||
u32 call_addr = 0;
|
||||
// bool cop1_bc = false;
|
||||
c->daddiu(sp, sp, -16); // daddiu sp, sp, -16
|
||||
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->fprs[f0] = 1677.7216; // lwc1 f0, L90(fp)
|
||||
c->mtc1(f2, r0); // mtc1 f2, r0
|
||||
c->lwu(a1, 4, a0); // lwu a1, 4(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lwu(v1, 16, a0); // lwu v1, 16(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf1, 12, a1); // lqc2 vf1, 12(a1)
|
||||
c->daddiu(a1, a0, 6272); // daddiu a1, a0, 6272
|
||||
c->lqc2(vf6, 64, a0); // lqc2 vf6, 64(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf7, 80, a0); // lqc2 vf7, 80(a0)
|
||||
c->vmove(DEST::xyzw, vf2, vf1); // vmove.xyzw vf2, vf1
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::y, BC::y, vf1, vf0, vf6); // vaddy.y vf1, vf0, vf6
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::y, BC::y, vf2, vf0, vf7); // vaddy.y vf2, vf0, vf7
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
block_1:
|
||||
bc = c->sgpr64(v1) == 0; // beq v1, r0, L26
|
||||
c->lwu(t0, 0, a1); // lwu t0, 0(a1)
|
||||
if (bc) {goto block_42;} // branch non-likely
|
||||
|
||||
c->daddiu(v1, v1, -1); // daddiu v1, v1, -1
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf3, 0, t0); // lqc2 vf3, 0(t0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf4, 16, t0); // lqc2 vf4, 16(t0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf5, 32, t0); // lqc2 vf5, 32(t0)
|
||||
// Unknown instr: bgezal r0, L20
|
||||
c->vmove(DEST::xyzw, vf8, vf3); // vmove.xyzw vf8, vf3
|
||||
//if (bc) {goto block_26;} // branch non-likely
|
||||
sub_l20_b26(c);
|
||||
|
||||
bc = c->sgpr64(t0) == c->sgpr64(s7); // beq t0, s7, L24
|
||||
c->mov64(a2, t0); // or a2, t0, r0
|
||||
if (bc) {goto block_40;} // branch non-likely
|
||||
|
||||
// Unknown instr: bgezal r0, L20
|
||||
c->vmove(DEST::xyzw, vf8, vf4); // vmove.xyzw vf8, vf4
|
||||
//if (bc) {goto block_26;} // branch non-likely
|
||||
sub_l20_b26(c);
|
||||
|
||||
bc = c->sgpr64(t0) == c->sgpr64(s7); // beq t0, s7, L24
|
||||
c->mov64(a3, t0); // or a3, t0, r0
|
||||
if (bc) {goto block_40;} // branch non-likely
|
||||
|
||||
// Unknown instr: bgezal r0, L20
|
||||
c->vmove(DEST::xyzw, vf8, vf5); // vmove.xyzw vf8, vf5
|
||||
//if (bc) {goto block_26;} // branch non-likely
|
||||
sub_l20_b26(c);
|
||||
|
||||
bc = c->sgpr64(t0) == c->sgpr64(s7); // beq t0, s7, L24
|
||||
c->mov64(t0, t0); // or t0, t0, r0
|
||||
if (bc) {goto block_40;} // branch non-likely
|
||||
|
||||
c->mov64(t1, a2); // or t1, a2, r0
|
||||
// nop // sll r0, r0, 0
|
||||
// Unknown instr: bgezal r0, L16
|
||||
c->mov64(t2, a3); // or t2, a3, r0
|
||||
//if (bc) {goto block_15;} // branch non-likely
|
||||
sub_l16_b15(c);
|
||||
|
||||
bc = c->sgpr64(t4) == c->sgpr64(s7); // beq t4, s7, L25
|
||||
c->mov64(t1, a3); // or t1, a3, r0
|
||||
if (bc) {goto block_41;} // branch non-likely
|
||||
|
||||
// Unknown instr: bgezal r0, L16
|
||||
c->mov64(t2, t0); // or t2, t0, r0
|
||||
//if (bc) {goto block_15;} // branch non-likely
|
||||
sub_l16_b15(c);
|
||||
|
||||
bc = c->sgpr64(t4) == c->sgpr64(s7); // beq t4, s7, L25
|
||||
c->mov64(t1, t0); // or t1, t0, r0
|
||||
if (bc) {goto block_41;} // branch non-likely
|
||||
|
||||
// Unknown instr: bgezal r0, L16
|
||||
c->mov64(t2, a2); // or t2, a2, r0
|
||||
//if (bc) {goto block_15;} // branch non-likely
|
||||
sub_l16_b15(c);
|
||||
|
||||
bc = c->sgpr64(t1) == c->sgpr64(s7); // beq t1, s7, L25
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_41;} // branch non-likely
|
||||
|
||||
//beq r0, r0, L15 // beq r0, r0, L15
|
||||
c->daddiu(a1, a1, 32); // daddiu a1, a1, 32
|
||||
goto block_1; // branch always
|
||||
|
||||
|
||||
block_40:
|
||||
c->load_symbol(t9, cache.format); // lw t9, format(s7)
|
||||
c->addiu(a0, r0, 0); // addiu a0, r0, 0
|
||||
//daddiu a1, fp, L87 // daddiu a1, fp, L87
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->sll(v0, ra, 0); // sll v0, ra, 0
|
||||
//c->jalr(call_addr); // jalr ra, t9
|
||||
printf("ERROR: Too many edge verts found in edge grab!\n");
|
||||
//beq r0, r0, L26 // beq r0, r0, L26
|
||||
// nop // sll r0, r0, 0
|
||||
goto block_42; // branch always
|
||||
|
||||
|
||||
block_41:
|
||||
c->load_symbol(t9, cache.format); // lw t9, format(s7)
|
||||
c->addiu(a0, r0, 0); // addiu a0, r0, 0
|
||||
//daddiu a1, fp, L86 // daddiu a1, fp, L86
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->sll(v0, ra, 0); // sll v0, ra, 0
|
||||
//c->jalr(call_addr); // jalr ra, t9
|
||||
printf("ERROR: Too many edges found in edge grab!\n");
|
||||
|
||||
block_42:
|
||||
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
|
||||
c->ld(ra, 0, sp); // ld ra, 0(sp)
|
||||
c->ld(fp, 8, sp); // ld fp, 8(sp)
|
||||
//jr ra method_10_collide_edge_hold_list // jr ra
|
||||
c->daddiu(sp, sp, 16); // daddiu sp, sp, 16
|
||||
goto end_of_function; // return
|
||||
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
end_of_function:
|
||||
return c->gprs[v0].du64[0];
|
||||
}
|
||||
|
||||
void link() {
|
||||
cache.format = intern_from_c("format").c();
|
||||
gLinkedFunctionTable.reg("(method 15 collide-edge-work)", execute, 128);
|
||||
}
|
||||
|
||||
} // namespace method_15_collide_edge_work
|
||||
} // namespace Mips2C
|
||||
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/kscheme.h"
|
||||
namespace Mips2C {
|
||||
namespace method_10_collide_edge_hold_list {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
// bool bc = false;
|
||||
// u32 call_addr = 0;
|
||||
bool cop1_bc = false;
|
||||
// nop // sll r0, r0, 0
|
||||
c->daddiu(a2, a0, 1552); // daddiu a2, a0, 1552
|
||||
c->lwu(t0, 4, a0); // lwu t0, 4(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf1, 16, a1); // lqc2 vf1, 16(a1)
|
||||
c->dsll(a3, t0, 4); // dsll a3, t0, 4
|
||||
c->lwu(v1, 8, a0); // lwu v1, 8(a0)
|
||||
c->daddiu(t0, t0, 1); // daddiu t0, t0, 1
|
||||
c->lwc1(f0, 4, a1); // lwc1 f0, 4(a1)
|
||||
c->daddu(a2, a2, a3); // daddu a2, a2, a3
|
||||
c->sw(t0, 4, a0); // sw t0, 4(a0)
|
||||
c->sqc2(vf1, 0, a2); // sqc2 vf1, 0(a2)
|
||||
if (((s64)c->sgpr64(v1)) == ((s64)c->sgpr64(s7))) {// beql v1, s7, L68
|
||||
c->sw(a1, 8, a0); // sw a1, 8(a0)
|
||||
goto block_10;
|
||||
}
|
||||
|
||||
// block_2:
|
||||
c->lwc1(f1, 4, v1); // lwc1 f1, 4(v1)
|
||||
cop1_bc = c->fprs[f0] < c->fprs[f1]; // c.lt.s f0, f1
|
||||
if (cop1_bc) { // bc1tl L69
|
||||
c->sw(a1, 8, a0); // sw a1, 8(a0)
|
||||
goto block_11;
|
||||
}
|
||||
|
||||
// block_4:
|
||||
c->mov64(a0, v1); // or a0, v1, r0
|
||||
|
||||
block_5:
|
||||
c->lwu(v1, 0, v1); // lwu v1, 0(v1)
|
||||
if (((s64)c->sgpr64(v1)) == ((s64)c->sgpr64(s7))) {// beql v1, s7, L70
|
||||
c->sw(a1, 0, a0); // sw a1, 0(a0)
|
||||
goto block_12;
|
||||
}
|
||||
|
||||
// block_7:
|
||||
c->lwc1(f1, 4, v1); // lwc1 f1, 4(v1)
|
||||
cop1_bc = c->fprs[f0] < c->fprs[f1]; // c.lt.s f0, f1
|
||||
if (!cop1_bc) { // bc1fl L67
|
||||
c->mov64(a0, v1); // or a0, v1, r0
|
||||
goto block_5;
|
||||
}
|
||||
|
||||
// block_9:
|
||||
c->sw(a1, 0, a0); // sw a1, 0(a0)
|
||||
//beq r0, r0, L71 // beq r0, r0, L71
|
||||
c->sw(v1, 0, a1); // sw v1, 0(a1)
|
||||
goto block_13; // branch always
|
||||
|
||||
|
||||
block_10:
|
||||
//beq r0, r0, L71 // beq r0, r0, L71
|
||||
c->sw(s7, 0, a1); // sw s7, 0(a1)
|
||||
goto block_13; // branch always
|
||||
|
||||
|
||||
block_11:
|
||||
//beq r0, r0, L71 // beq r0, r0, L71
|
||||
c->sw(v1, 0, a1); // sw v1, 0(a1)
|
||||
goto block_13; // branch always
|
||||
|
||||
|
||||
block_12:
|
||||
c->sw(s7, 0, a1); // sw s7, 0(a1)
|
||||
|
||||
block_13:
|
||||
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
|
||||
//jr ra // jr ra
|
||||
c->daddu(sp, sp, r0); // daddu sp, sp, r0
|
||||
goto end_of_function; // return
|
||||
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
end_of_function:
|
||||
return c->gprs[v0].du64[0];
|
||||
}
|
||||
|
||||
void link() {
|
||||
gLinkedFunctionTable.reg("(method 10 collide-edge-hold-list)", execute, 128);
|
||||
}
|
||||
|
||||
} // namespace method_10_collide_edge_hold_list
|
||||
} // namespace Mips2C
|
||||
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/kscheme.h"
|
||||
namespace Mips2C {
|
||||
namespace method_18_collide_edge_work {
|
||||
struct Cache {
|
||||
void* collide_edge_hold_list; // collide-edge-hold-list
|
||||
void* collide_edge_work; // collide-edge-work
|
||||
} cache;
|
||||
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
bool bc = false;
|
||||
u32 call_addr = 0;
|
||||
c->daddiu(sp, sp, -176); // daddiu sp, sp, -176
|
||||
c->sd(ra, 0, sp); // sd ra, 0(sp)
|
||||
c->sq(s0, 64, sp); // sq s0, 64(sp)
|
||||
c->sq(s1, 80, sp); // sq s1, 80(sp)
|
||||
c->sq(s2, 96, sp); // sq s2, 96(sp)
|
||||
c->sq(s3, 112, sp); // sq s3, 112(sp)
|
||||
c->sq(s4, 128, sp); // sq s4, 128(sp)
|
||||
c->sq(s5, 144, sp); // sq s5, 144(sp)
|
||||
c->sq(gp, 160, sp); // sq gp, 160(sp)
|
||||
c->mov64(gp, a0); // or gp, a0, r0
|
||||
c->mov64(s5, a1); // or s5, a1, r0
|
||||
c->mov64(s4, a2); // or s4, a2, r0
|
||||
c->daddiu(s3, sp, 16); // daddiu s3, sp, 16
|
||||
c->addiu(s2, r0, 16); // addiu s2, r0, 16
|
||||
|
||||
block_1:
|
||||
bc = c->sgpr64(s2) == 0; // beq s2, r0, L64
|
||||
c->daddiu(s2, s2, -1); // daddiu s2, s2, -1
|
||||
if (bc) {goto block_25;} // branch non-likely
|
||||
|
||||
c->lwu(s1, 8, s5); // lwu s1, 8(s5)
|
||||
bc = c->sgpr64(s1) == c->sgpr64(s7); // beq s1, s7, L64
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_25;} // branch non-likely
|
||||
|
||||
c->mov64(a0, gp); // or a0, gp, r0
|
||||
c->load_symbol(v1, cache.collide_edge_work); // lw v1, collide-edge-work(s7)
|
||||
c->lwu(t9, 92, v1); // lwu t9, 92(v1)
|
||||
c->mov64(a1, s1); // or a1, s1, r0
|
||||
c->mov64(a2, s4); // or a2, s4, r0
|
||||
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->mov64(v1, v0); // or v1, v0, r0
|
||||
bc = c->sgpr64(v1) == c->sgpr64(s7); // beq v1, s7, L59
|
||||
c->lwu(v1, 0, s1); // lwu v1, 0(s1)
|
||||
if (bc) {goto block_5;} // branch non-likely
|
||||
|
||||
c->daddiu(v1, s7, 8); // daddiu v1, s7, #t
|
||||
c->mov64(v0, v1); // or v0, v1, r0
|
||||
//beq r0, r0, L65 // beq r0, r0, L65
|
||||
// nop // sll r0, r0, 0
|
||||
goto block_26; // branch always
|
||||
|
||||
|
||||
block_5:
|
||||
c->lb(s0, 8, s1); // lb s0, 8(s1)
|
||||
c->sw(v1, 8, s5); // sw v1, 8(s5)
|
||||
bc = ((s64)c->sgpr64(s0)) > 0; // bgtz s0, L62
|
||||
c->addiu(v1, r0, 2); // addiu v1, r0, 2
|
||||
if (bc) {goto block_17;} // branch non-likely
|
||||
|
||||
if (((s64)c->sgpr64(s0)) < 0) { // bltzl s0, L63
|
||||
c->dsubu(s0, r0, s0); // dsubu s0, r0, s0
|
||||
goto block_21;
|
||||
}
|
||||
|
||||
// block_8:
|
||||
c->dsll(v1, s0, 2); // dsll v1, s0, 2
|
||||
c->daddiu(a0, gp, 168); // daddiu a0, gp, 168
|
||||
c->daddu(v1, a0, v1); // daddu v1, a0, v1
|
||||
c->lw(v1, 0, v1); // lw v1, 0(v1)
|
||||
c->mov128_vf_gpr(vf1, v1); // qmtc2.i vf1, v1
|
||||
c->lwu(a2, 12, s1); // lwu a2, 12(s1)
|
||||
c->vmove(DEST::xyzw, vf5, vf0); // vmove.xyzw vf5, vf0
|
||||
c->lqc2(vf3, 16, s1); // lqc2 vf3, 16(s1)
|
||||
c->vmove(DEST::xyzw, vf6, vf0); // vmove.xyzw vf6, vf0
|
||||
c->lqc2(vf4, 32, a2); // lqc2 vf4, 32(a2)
|
||||
c->lwu(v1, 12, a2); // lwu v1, 12(a2)
|
||||
c->vmul_bc(DEST::xyz, BC::x, vf2, vf4, vf1); // vmulx.xyz vf2, vf4, vf1
|
||||
c->vadd(DEST::xyz, vf5, vf3, vf2); // vadd.xyz vf5, vf3, vf2
|
||||
c->vsub(DEST::xyz, vf6, vf3, vf2); // vsub.xyz vf6, vf3, vf2
|
||||
c->lqc2(vf8, 0, v1); // lqc2 vf8, 0(v1)
|
||||
c->sqc2(vf6, 16, s3); // sqc2 vf6, 16(s3)
|
||||
c->sqc2(vf2, 32, s3); // sqc2 vf2, 32(s3)
|
||||
c->sw(a2, 0, s3); // sw a2, 0(s3)
|
||||
c->sw(s7, 4, s3); // sw s7, 4(s3)
|
||||
c->vsub(DEST::xyz, vf9, vf8, vf5); // vsub.xyz vf9, vf8, vf5
|
||||
c->vmul(DEST::xyz, vf9, vf9, vf2); // vmul.xyz vf9, vf9, vf2
|
||||
c->vadd_bc(DEST::x, BC::y, vf9, vf9, vf9); // vaddy.x vf9, vf9, vf9
|
||||
c->vadd_bc(DEST::x, BC::z, vf9, vf9, vf9); // vaddz.x vf9, vf9, vf9
|
||||
c->mov128_gpr_vf(v1, vf9); // qmfc2.i v1, vf9
|
||||
bc = ((s64)c->sgpr64(v1)) < 0; // bltz v1, L60
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_12;} // branch non-likely
|
||||
|
||||
c->sqc2(vf5, 16, s1); // sqc2 vf5, 16(s1)
|
||||
c->mov64(a0, gp); // or a0, gp, r0
|
||||
c->load_symbol(v1, cache.collide_edge_work); // lw v1, collide-edge-work(s7)
|
||||
c->lwu(t9, 84, v1); // lwu t9, 84(v1)
|
||||
c->mov64(a1, s1); // or a1, s1, r0
|
||||
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->mov64(v1, v0); // or v1, v0, r0
|
||||
bc = c->sgpr64(v1) == c->sgpr64(s7); // beq v1, s7, L60
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_12;} // branch non-likely
|
||||
|
||||
c->mov64(a0, s5); // or a0, s5, r0
|
||||
c->load_symbol(v1, cache.collide_edge_hold_list); // lw v1, collide-edge-hold-list(s7)
|
||||
c->lwu(t9, 56, v1); // lwu t9, 56(v1)
|
||||
c->mov64(a1, s1); // or a1, s1, r0
|
||||
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->mov64(v1, v0); // or v1, v0, r0
|
||||
c->addiu(v1, r0, 1); // addiu v1, r0, 1
|
||||
c->sb(v1, 8, s1); // sb v1, 8(s1)
|
||||
c->addiu(v1, r0, 32); // addiu v1, r0, 32
|
||||
c->lwu(a0, 0, s5); // lwu a0, 0(s5)
|
||||
c->addiu(a1, r0, 48); // addiu a1, r0, 48
|
||||
bc = c->sgpr64(a0) == c->sgpr64(v1); // beq a0, v1, L58
|
||||
c->mult3(v1, a0, a1); // mult3 v1, a0, a1
|
||||
if (bc) {goto block_1;} // branch non-likely
|
||||
|
||||
c->daddu(v1, v1, s5); // daddu v1, v1, s5
|
||||
c->sw(r0, 4, s3); // sw r0, 4(s3)
|
||||
c->daddiu(s1, v1, 16); // daddiu s1, v1, 16
|
||||
|
||||
block_12:
|
||||
c->lwu(a2, 0, s3); // lwu a2, 0(s3)
|
||||
c->lqc2(vf6, 16, s3); // lqc2 vf6, 16(s3)
|
||||
c->lqc2(vf2, 32, s3); // lqc2 vf2, 32(s3)
|
||||
c->lwu(v1, 8, a2); // lwu v1, 8(a2)
|
||||
c->lqc2(vf7, 0, v1); // lqc2 vf7, 0(v1)
|
||||
c->vsub(DEST::xyz, vf9, vf6, vf7); // vsub.xyz vf9, vf6, vf7
|
||||
c->vmul(DEST::xyz, vf9, vf9, vf2); // vmul.xyz vf9, vf9, vf2
|
||||
c->vadd_bc(DEST::x, BC::y, vf9, vf9, vf9); // vaddy.x vf9, vf9, vf9
|
||||
c->vadd_bc(DEST::x, BC::z, vf9, vf9, vf9); // vaddz.x vf9, vf9, vf9
|
||||
c->mov128_gpr_vf(v1, vf9); // qmfc2.i v1, vf9
|
||||
bc = ((s64)c->sgpr64(v1)) < 0; // bltz v1, L58
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_1;} // branch non-likely
|
||||
|
||||
c->sqc2(vf6, 16, s1); // sqc2 vf6, 16(s1)
|
||||
c->mov64(a0, gp); // or a0, gp, r0
|
||||
c->load_symbol(v1, cache.collide_edge_work); // lw v1, collide-edge-work(s7)
|
||||
c->lwu(t9, 84, v1); // lwu t9, 84(v1)
|
||||
c->mov64(a1, s1); // or a1, s1, r0
|
||||
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->mov64(v1, v0); // or v1, v0, r0
|
||||
bc = c->sgpr64(v1) == c->sgpr64(s7); // beq v1, s7, L58
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_1;} // branch non-likely
|
||||
|
||||
c->mov64(a0, s5); // or a0, s5, r0
|
||||
c->load_symbol(v1, cache.collide_edge_hold_list); // lw v1, collide-edge-hold-list(s7)
|
||||
c->lwu(t9, 56, v1); // lwu t9, 56(v1)
|
||||
c->mov64(a1, s1); // or a1, s1, r0
|
||||
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->mov64(v1, v0); // or v1, v0, r0
|
||||
c->lwu(v1, 4, s3); // lwu v1, 4(s3)
|
||||
bc = c->sgpr64(v1) == c->sgpr64(s7); // beq v1, s7, L61
|
||||
c->lwu(v1, 0, s5); // lwu v1, 0(s5)
|
||||
if (bc) {goto block_16;} // branch non-likely
|
||||
|
||||
c->daddiu(v1, v1, 1); // daddiu v1, v1, 1
|
||||
c->sw(v1, 0, s5); // sw v1, 0(s5)
|
||||
|
||||
block_16:
|
||||
c->addiu(v1, r0, -1); // addiu v1, r0, -1
|
||||
//beq r0, r0, L58 // beq r0, r0, L58
|
||||
c->sb(v1, 8, s1); // sb v1, 8(s1)
|
||||
goto block_1; // branch always
|
||||
|
||||
|
||||
block_17:
|
||||
bc = c->sgpr64(s0) == c->sgpr64(v1); // beq s0, v1, L58
|
||||
c->lwu(a2, 12, s1); // lwu a2, 12(s1)
|
||||
if (bc) {goto block_1;} // branch non-likely
|
||||
|
||||
c->dsll(v1, s0, 2); // dsll v1, s0, 2
|
||||
c->daddiu(a0, gp, 168); // daddiu a0, gp, 168
|
||||
c->daddu(v1, a0, v1); // daddu v1, a0, v1
|
||||
c->lw(v1, 0, v1); // lw v1, 0(v1)
|
||||
c->mov128_vf_gpr(vf1, v1); // qmtc2.i vf1, v1
|
||||
c->lqc2(vf3, 16, s1); // lqc2 vf3, 16(s1)
|
||||
c->vmove(DEST::xyzw, vf5, vf0); // vmove.xyzw vf5, vf0
|
||||
c->lqc2(vf4, 32, a2); // lqc2 vf4, 32(a2)
|
||||
c->lwu(v1, 12, a2); // lwu v1, 12(a2)
|
||||
c->vmul_bc(DEST::xyz, BC::x, vf2, vf4, vf1); // vmulx.xyz vf2, vf4, vf1
|
||||
c->vadd(DEST::xyz, vf5, vf3, vf2); // vadd.xyz vf5, vf3, vf2
|
||||
c->lqc2(vf8, 0, v1); // lqc2 vf8, 0(v1)
|
||||
c->vsub(DEST::xyz, vf9, vf8, vf5); // vsub.xyz vf9, vf8, vf5
|
||||
c->vmul(DEST::xyz, vf9, vf9, vf2); // vmul.xyz vf9, vf9, vf2
|
||||
c->vadd_bc(DEST::x, BC::y, vf9, vf9, vf9); // vaddy.x vf9, vf9, vf9
|
||||
c->vadd_bc(DEST::x, BC::z, vf9, vf9, vf9); // vaddz.x vf9, vf9, vf9
|
||||
c->mov128_gpr_vf(v1, vf9); // qmfc2.i v1, vf9
|
||||
bc = ((s64)c->sgpr64(v1)) < 0; // bltz v1, L58
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_1;} // branch non-likely
|
||||
|
||||
c->sqc2(vf5, 16, s1); // sqc2 vf5, 16(s1)
|
||||
c->mov64(a0, gp); // or a0, gp, r0
|
||||
c->load_symbol(v1, cache.collide_edge_work); // lw v1, collide-edge-work(s7)
|
||||
c->lwu(t9, 84, v1); // lwu t9, 84(v1)
|
||||
c->mov64(a1, s1); // or a1, s1, r0
|
||||
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->mov64(v1, v0); // or v1, v0, r0
|
||||
bc = c->sgpr64(v1) == c->sgpr64(s7); // beq v1, s7, L58
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_1;} // branch non-likely
|
||||
|
||||
c->mov64(a0, s5); // or a0, s5, r0
|
||||
c->load_symbol(v1, cache.collide_edge_hold_list); // lw v1, collide-edge-hold-list(s7)
|
||||
c->lwu(t9, 56, v1); // lwu t9, 56(v1)
|
||||
c->mov64(a1, s1); // or a1, s1, r0
|
||||
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->mov64(v1, v0); // or v1, v0, r0
|
||||
c->daddiu(v1, s0, 1); // daddiu v1, s0, 1
|
||||
//beq r0, r0, L58 // beq r0, r0, L58
|
||||
c->sb(v1, 8, s1); // sb v1, 8(s1)
|
||||
goto block_1; // branch always
|
||||
|
||||
|
||||
block_21:
|
||||
bc = c->sgpr64(s0) == c->sgpr64(v1); // beq s0, v1, L58
|
||||
c->lwu(a2, 12, s1); // lwu a2, 12(s1)
|
||||
if (bc) {goto block_1;} // branch non-likely
|
||||
|
||||
c->dsll(v1, s0, 2); // dsll v1, s0, 2
|
||||
c->daddiu(a0, gp, 168); // daddiu a0, gp, 168
|
||||
c->daddu(v1, a0, v1); // daddu v1, a0, v1
|
||||
c->lw(v1, 0, v1); // lw v1, 0(v1)
|
||||
c->mov128_vf_gpr(vf1, v1); // qmtc2.i vf1, v1
|
||||
c->lqc2(vf3, 16, s1); // lqc2 vf3, 16(s1)
|
||||
c->vmove(DEST::xyzw, vf6, vf0); // vmove.xyzw vf6, vf0
|
||||
c->lqc2(vf4, 32, a2); // lqc2 vf4, 32(a2)
|
||||
c->lwu(v1, 8, a2); // lwu v1, 8(a2)
|
||||
c->vmul_bc(DEST::xyz, BC::x, vf2, vf4, vf1); // vmulx.xyz vf2, vf4, vf1
|
||||
c->vsub(DEST::xyz, vf6, vf3, vf2); // vsub.xyz vf6, vf3, vf2
|
||||
c->lqc2(vf7, 0, v1); // lqc2 vf7, 0(v1)
|
||||
c->vsub(DEST::xyz, vf9, vf6, vf7); // vsub.xyz vf9, vf6, vf7
|
||||
c->vmul(DEST::xyz, vf9, vf9, vf2); // vmul.xyz vf9, vf9, vf2
|
||||
c->vadd_bc(DEST::x, BC::y, vf9, vf9, vf9); // vaddy.x vf9, vf9, vf9
|
||||
c->vadd_bc(DEST::x, BC::z, vf9, vf9, vf9); // vaddz.x vf9, vf9, vf9
|
||||
c->mov128_gpr_vf(v1, vf9); // qmfc2.i v1, vf9
|
||||
bc = ((s64)c->sgpr64(v1)) < 0; // bltz v1, L58
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_1;} // branch non-likely
|
||||
|
||||
c->sqc2(vf6, 16, s1); // sqc2 vf6, 16(s1)
|
||||
c->mov64(a0, gp); // or a0, gp, r0
|
||||
c->load_symbol(v1, cache.collide_edge_work); // lw v1, collide-edge-work(s7)
|
||||
c->lwu(t9, 84, v1); // lwu t9, 84(v1)
|
||||
c->mov64(a1, s1); // or a1, s1, r0
|
||||
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->mov64(v1, v0); // or v1, v0, r0
|
||||
bc = c->sgpr64(v1) == c->sgpr64(s7); // beq v1, s7, L58
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_1;} // branch non-likely
|
||||
|
||||
c->mov64(a0, s5); // or a0, s5, r0
|
||||
c->load_symbol(v1, cache.collide_edge_hold_list); // lw v1, collide-edge-hold-list(s7)
|
||||
c->lwu(t9, 56, v1); // lwu t9, 56(v1)
|
||||
c->mov64(a1, s1); // or a1, s1, r0
|
||||
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->mov64(v1, v0); // or v1, v0, r0
|
||||
c->daddiu(v1, s0, 1); // daddiu v1, s0, 1
|
||||
c->dsubu(v1, r0, v1); // dsubu v1, r0, v1
|
||||
//beq r0, r0, L58 // beq r0, r0, L58
|
||||
c->sb(v1, 8, s1); // sb v1, 8(s1)
|
||||
goto block_1; // branch always
|
||||
|
||||
|
||||
block_25:
|
||||
c->mov64(v0, s7); // or v0, s7, r0
|
||||
|
||||
block_26:
|
||||
c->ld(ra, 0, sp); // ld ra, 0(sp)
|
||||
c->lq(gp, 160, sp); // lq gp, 160(sp)
|
||||
c->lq(s5, 144, sp); // lq s5, 144(sp)
|
||||
c->lq(s4, 128, sp); // lq s4, 128(sp)
|
||||
c->lq(s3, 112, sp); // lq s3, 112(sp)
|
||||
c->lq(s2, 96, sp); // lq s2, 96(sp)
|
||||
c->lq(s1, 80, sp); // lq s1, 80(sp)
|
||||
c->lq(s0, 64, sp); // lq s0, 64(sp)
|
||||
//jr ra // jr ra
|
||||
c->daddiu(sp, sp, 176); // daddiu sp, sp, 176
|
||||
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.collide_edge_hold_list = intern_from_c("collide-edge-hold-list").c();
|
||||
cache.collide_edge_work = intern_from_c("collide-edge-work").c();
|
||||
gLinkedFunctionTable.reg("(method 18 collide-edge-work)", execute, 256);
|
||||
}
|
||||
|
||||
} // namespace method_18_collide_edge_work
|
||||
} // namespace Mips2C
|
||||
|
||||
|
||||
@@ -191,6 +191,18 @@ namespace method_16_collide_edge_work {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_15_collide_edge_work {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_10_collide_edge_hold_list {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_18_collide_edge_work {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
LinkedFunctionTable gLinkedFunctionTable;
|
||||
Rng gRng;
|
||||
std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks = {
|
||||
@@ -220,7 +232,9 @@ std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks =
|
||||
method_13_collide_shape_prim_mesh::link, method_30_collide_cache::link,
|
||||
method_9_collide_cache_prim::link, method_10_collide_cache_prim::link,
|
||||
method_10_collide_puss_work::link, method_9_collide_puss_work::link}},
|
||||
{"collide-edge-grab", {method_16_collide_edge_work::link}}};
|
||||
{"collide-edge-grab",
|
||||
{method_16_collide_edge_work::link, method_15_collide_edge_work::link,
|
||||
method_10_collide_edge_hold_list::link, method_18_collide_edge_work::link}}};
|
||||
|
||||
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
|
||||
const auto& it = m_executes.insert({name, {exec, Ptr<u8>()}});
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
(define-extern vector<-cspace! (function vector cspace vector))
|
||||
(define-extern create-interpolated-joint-animation-frame (function (inline-array vector) int process-drawable int))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
;; These types are specific to joint control.
|
||||
;; See mspace-h.gc for the actual joint types
|
||||
|
||||
(deftype joint-control-channel (structure)
|
||||
((parent joint-control :offset-assert 0)
|
||||
@@ -33,7 +34,7 @@
|
||||
:size-assert #x30
|
||||
:flag-assert #xa00000030
|
||||
(:methods
|
||||
(dummy-9 (_type_) _type_ 9)
|
||||
(debug-print-frames (_type_) _type_ 9)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -65,7 +66,7 @@
|
||||
(:methods
|
||||
(new (symbol type int) _type_ 0)
|
||||
(dummy-9 (_type_) float 9)
|
||||
(dummy-10 (_type_ symbol) int 10)
|
||||
(debug-print-channels (_type_ symbol) int 10)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
+122
-78
@@ -5,8 +5,15 @@
|
||||
;; name in dgo: joint
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; a joint is just used to store the tree structure of a skeleton + bind pose.
|
||||
;; it's mostly used as a more user-friendly interface
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Basic Methods for joint/joint-control
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defmethod print joint ((obj joint))
|
||||
(format #t "#<~A ~S ~D @ #x~X>" (-> obj type) (-> obj name) (-> obj number) obj)
|
||||
obj
|
||||
@@ -32,6 +39,13 @@
|
||||
(-> obj length)
|
||||
)
|
||||
|
||||
(defmethod inspect joint-anim-matrix ((obj joint-anim-matrix))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tname: ~A~%" (-> obj name))
|
||||
(format #t "~Tnumber: ~D~%" (-> obj number))
|
||||
(format #t "~Tdata[~D]: @ #x~X~%" (-> obj length) (-> obj data))
|
||||
obj
|
||||
)
|
||||
|
||||
(defmethod asize-of joint-anim-matrix ((obj joint-anim-matrix))
|
||||
(the-as int (+ (-> joint-anim-matrix size) (* (-> obj length) 64)))
|
||||
@@ -66,6 +80,7 @@
|
||||
)
|
||||
|
||||
(defun joint-anim-inspect-elt ((arg0 joint-anim) (arg1 float))
|
||||
"Inspect a single element in a joint anim. The float is rounded to an int."
|
||||
(case (-> arg0 type)
|
||||
((joint-anim-matrix)
|
||||
((method-of-type matrix inspect)
|
||||
@@ -121,14 +136,12 @@
|
||||
)
|
||||
|
||||
(defmethod print joint-control-channel ((obj joint-control-channel))
|
||||
(format
|
||||
#t
|
||||
"#<joint-control-channel ~A ~A ~F @ #x~X>"
|
||||
(-> obj command)
|
||||
(-> obj frame-group)
|
||||
(-> obj frame-num)
|
||||
obj
|
||||
)
|
||||
(format #t "#<joint-control-channel ~A ~A ~F @ #x~X>"
|
||||
(-> obj command)
|
||||
(-> obj frame-group)
|
||||
(-> obj frame-num)
|
||||
obj
|
||||
)
|
||||
obj
|
||||
)
|
||||
|
||||
@@ -137,6 +150,7 @@
|
||||
)
|
||||
|
||||
(defmethod new joint-control ((allocation symbol) (type-to-make type) (arg0 int))
|
||||
"Create a new joint-control with enough room for the given number of channels"
|
||||
(let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* 48 arg0))))))
|
||||
(set! (-> v0-0 allocated-length) arg0)
|
||||
(set! (-> v0-0 active-channels) 0)
|
||||
@@ -153,7 +167,9 @@
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod dummy-9 joint-control-channel ((obj joint-control-channel))
|
||||
(defmethod debug-print-frames joint-control-channel ((obj joint-control-channel))
|
||||
"Print the current frame of each joint on this channel.
|
||||
Note: this only appears to work for uncompressed joint animations."
|
||||
(let ((s5-0 (-> obj frame-group))
|
||||
(f30-0 (-> obj frame-num))
|
||||
)
|
||||
@@ -165,54 +181,39 @@
|
||||
obj
|
||||
)
|
||||
|
||||
(defmethod dummy-10 joint-control ((obj joint-control) (arg0 symbol))
|
||||
(defmethod debug-print-channels joint-control ((obj joint-control) (arg0 symbol))
|
||||
"Print each active channel to the given stream."
|
||||
(dotimes (s4-0 (-> obj active-channels))
|
||||
(let* ((v1-6 (if (and (-> obj channel s4-0 frame-group) (nonzero? (-> obj channel s4-0 frame-group)))
|
||||
(-> obj channel s4-0 frame-group)
|
||||
)
|
||||
)
|
||||
(t9-0 format)
|
||||
(a0-5 arg0)
|
||||
(a1-1 "ch:~2d ~C ~-35S f: ~6,,2f ~4,,2f ~4,,2f%~%")
|
||||
(a2-0 s4-0)
|
||||
(a3-3 (-> obj channel s4-0 command))
|
||||
(a3-4 (cond
|
||||
((= a3-3 'push)
|
||||
80
|
||||
)
|
||||
((= a3-3 'push1)
|
||||
112
|
||||
)
|
||||
((= a3-3 'blend)
|
||||
66
|
||||
)
|
||||
((= a3-3 'stack)
|
||||
83
|
||||
)
|
||||
((= a3-3 'stack1)
|
||||
115
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
(t9-0
|
||||
a0-5
|
||||
a1-1
|
||||
a2-0
|
||||
a3-4
|
||||
(if v1-6
|
||||
(-> v1-6 name)
|
||||
"(none)"
|
||||
)
|
||||
(+ (* (-> obj channel s4-0 frame-num) (if v1-6
|
||||
(-> v1-6 artist-step)
|
||||
1.0
|
||||
)
|
||||
(format
|
||||
arg0
|
||||
"ch:~2d ~C ~-35S f: ~6,,2f ~4,,2f ~4,,2f%~%"
|
||||
s4-0 ;; channel index
|
||||
(case (-> obj channel s4-0 command) ;; how we got added.
|
||||
(('push)
|
||||
80
|
||||
)
|
||||
(if v1-6
|
||||
(-> v1-6 artist-base)
|
||||
0.0
|
||||
(('push1)
|
||||
112
|
||||
)
|
||||
(('blend)
|
||||
66
|
||||
)
|
||||
(('stack)
|
||||
83
|
||||
)
|
||||
(('stack1)
|
||||
115
|
||||
)
|
||||
)
|
||||
(if v1-6 (-> v1-6 name) "(none)") ;; name of anim (can be "none" in the real game)
|
||||
(+ (* (-> obj channel s4-0 frame-num) (if v1-6 (-> v1-6 artist-step) 1.0)) ;; frame number
|
||||
(if v1-6 (-> v1-6 artist-base) 0.0)
|
||||
)
|
||||
(-> obj channel s4-0 frame-interp)
|
||||
(-> obj channel s4-0 inspector-amount)
|
||||
@@ -222,15 +223,30 @@
|
||||
0
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Art
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; The "art" class is a super-general parent class for all art.
|
||||
;; There's an "art-group" class, which typically contains all the animations
|
||||
;; geometry, and shadow info for a character.
|
||||
|
||||
;; The most general art class shouldn't really be used for anything.
|
||||
|
||||
;; art-mesh-anim: not used
|
||||
;; art-joint-anim: used for animations. Provides joint-anim-compressed and eye-anim.
|
||||
|
||||
(defmethod needs-link? art ((obj art))
|
||||
#f
|
||||
)
|
||||
|
||||
(defmethod dummy-10 art ((obj art) (arg0 string) (arg1 type))
|
||||
"Look-up an art with the given name and type."
|
||||
(the-as joint #f)
|
||||
)
|
||||
|
||||
(defmethod dummy-11 art ((obj art) (arg0 string) (arg1 type))
|
||||
"Look up the index of an art with the given name and type."
|
||||
(the-as int #f)
|
||||
)
|
||||
|
||||
@@ -244,6 +260,8 @@
|
||||
)
|
||||
|
||||
(defmethod login art ((obj art))
|
||||
;; not sure why we have to do this, but if the res-lump isn't properly set up to point to the tags
|
||||
;; do it manually.
|
||||
(if (and (-> obj extra) (zero? (-> obj extra tag)))
|
||||
(set! (-> obj extra tag) (&+ (the-as (pointer res-tag) (-> obj extra)) 28))
|
||||
)
|
||||
@@ -307,6 +325,7 @@
|
||||
|
||||
;; definition for method 3 of type art-group
|
||||
(defmethod inspect art-group ((obj art-group))
|
||||
"Print the arts in an art-group"
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tinfo: ~A~%" (-> obj info))
|
||||
(format #t "~Tlength: ~D~%" (-> obj length))
|
||||
@@ -315,13 +334,7 @@
|
||||
(format #t "~Tdata[~D]: @ #x~X~%" (-> obj length) (-> obj data))
|
||||
(dotimes (s5-0 (-> obj length))
|
||||
(if (-> obj data s5-0)
|
||||
(format
|
||||
#t
|
||||
"~T [~D] ~A (~D bytes)~%"
|
||||
s5-0
|
||||
(-> obj data s5-0)
|
||||
(mem-size (-> obj data s5-0) #f 0)
|
||||
)
|
||||
(format #t "~T [~D] ~A (~D bytes)~%"s5-0 (-> obj data s5-0) (mem-size (-> obj data s5-0) #f 0))
|
||||
(format #t "~T [~D] ~A (~D bytes)~%" s5-0 (-> obj data s5-0) 0)
|
||||
)
|
||||
)
|
||||
@@ -329,26 +342,29 @@
|
||||
)
|
||||
|
||||
(defmethod needs-link? art-group ((obj art-group))
|
||||
(the-as symbol (and
|
||||
(-> obj length)
|
||||
(type-type? (-> obj data 0 type) art-joint-anim)
|
||||
(!= (-> obj name) (-> (the-as art-joint-anim (-> obj data 0)) master-art-group-name))
|
||||
)
|
||||
"Does this art-group need to be added to the level's art group?
|
||||
Some animations are streamed in, and need to be linked/unlinked to the level's list of art groups."
|
||||
(the-as symbol (and (-> obj length)
|
||||
(type-type? (-> obj data 0 type) art-joint-anim)
|
||||
(!= (-> obj name) (-> (the-as art-joint-anim (-> obj data 0)) master-art-group-name))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod dummy-10 art-group ((obj art-group) (arg0 string) (arg1 type))
|
||||
"Get the art with the given name and type. Set type to false if you don't care."
|
||||
(the-as
|
||||
joint
|
||||
(cond
|
||||
(arg1
|
||||
(let ((s3-0 (+ (length (-> obj name)) 1)))
|
||||
(dotimes (s2-0 (-> obj length))
|
||||
(if (and
|
||||
(-> obj data s2-0)
|
||||
(= (-> obj data s2-0 type) arg1)
|
||||
(or (name= arg0 (-> obj data s2-0 name)) (string-charp= arg0 (&-> (-> obj data s2-0 name) data s3-0)))
|
||||
)
|
||||
(if (and (-> obj data s2-0) ;; entry is populated
|
||||
(= (-> obj data s2-0 type) arg1) ;; type is right
|
||||
(or (name= arg0 (-> obj data s2-0 name)) ;; name is right.
|
||||
(string-charp= arg0 (&-> (-> obj data s2-0 name) data s3-0)) ;; also seek past ag name, and try again.
|
||||
)
|
||||
)
|
||||
(return (the-as joint (-> obj data s2-0)))
|
||||
)
|
||||
)
|
||||
@@ -356,6 +372,7 @@
|
||||
(the-as art-element #f)
|
||||
)
|
||||
(else
|
||||
;; no type (also no weird after ag name check)
|
||||
(dotimes (s4-1 (-> obj length))
|
||||
(if (and (-> obj data s4-1) (name= arg0 (-> obj data s4-1 name)))
|
||||
(return (the-as joint (-> obj data s4-1)))
|
||||
@@ -368,6 +385,8 @@
|
||||
)
|
||||
|
||||
(defmethod dummy-11 art-group ((obj art-group) (arg0 string) (arg1 type))
|
||||
"Get the index of the art with the given name and type. Set type to false if you don't care.
|
||||
Will return #f if the art is not found."
|
||||
(cond
|
||||
(arg1
|
||||
(let ((s3-0 (+ (length (-> obj name)) 1)))
|
||||
@@ -395,6 +414,7 @@
|
||||
)
|
||||
|
||||
(defmethod login art-group ((obj art-group))
|
||||
"Log in all the arts in a group."
|
||||
(dotimes (s5-0 (-> obj length))
|
||||
(if (-> obj data s5-0)
|
||||
(set! (-> obj data s5-0) (login (-> obj data s5-0)))
|
||||
@@ -423,6 +443,7 @@
|
||||
)
|
||||
|
||||
(defmethod relocate art-group ((obj art-group) (arg0 kheap) (arg1 (pointer uint8)))
|
||||
"Handle a loaded art-group."
|
||||
(let ((s4-0 (clear *temp-string*)))
|
||||
(string<-charp s4-0 arg1)
|
||||
(set! obj (cond
|
||||
@@ -440,10 +461,10 @@
|
||||
(else
|
||||
(let ((s5-1 (-> *level* loading-level)))
|
||||
(if (or (not s5-1) (= (-> s5-1 name) 'default))
|
||||
(login obj)
|
||||
(login obj) ;; not part of level load, just normal login.
|
||||
)
|
||||
(if s5-1
|
||||
(set-loaded-art (-> s5-1 art-group) obj)
|
||||
(set-loaded-art (-> s5-1 art-group) obj) ;; part of level load, add to level's ag, but don't log in yet.
|
||||
)
|
||||
)
|
||||
obj
|
||||
@@ -545,7 +566,12 @@
|
||||
obj
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Joint Control!
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun joint-control-channel-eval ((arg0 joint-control-channel))
|
||||
"Run the joint control num-func callback, remember the current time"
|
||||
(let ((f0-2 ((-> arg0 num-func) arg0 (-> arg0 param 0) (-> arg0 param 1))))
|
||||
(set! (-> arg0 eval-time) (the-as uint (-> *display* base-frame-counter)))
|
||||
f0-2
|
||||
@@ -553,6 +579,7 @@
|
||||
)
|
||||
|
||||
(defun joint-control-channel-eval! ((arg0 joint-control-channel) (arg1 (function joint-control-channel float float float)))
|
||||
"Set the joint control num-func, and evaluate it."
|
||||
(set! (-> arg0 num-func) arg1)
|
||||
(let ((f0-2 (arg1 arg0 (-> arg0 param 0) (-> arg0 param 1))))
|
||||
(set! (-> arg0 eval-time) (the-as uint (-> *display* base-frame-counter)))
|
||||
@@ -561,6 +588,7 @@
|
||||
)
|
||||
|
||||
(defun joint-control-channel-group-eval! ((arg0 joint-control-channel) (arg1 art-joint-anim) (arg2 (function joint-control-channel float float float)))
|
||||
"Set the joint control num-func, maybe update the anim, and maybe evaluate it."
|
||||
(set! (-> arg0 num-func) arg2)
|
||||
(cond
|
||||
((= (-> arg0 command) 'stack)
|
||||
@@ -577,6 +605,7 @@
|
||||
)
|
||||
|
||||
(defun joint-control-channel-group! ((arg0 joint-control-channel) (arg1 art-joint-anim) (arg2 (function joint-control-channel float float float)))
|
||||
"Set the joint control num-func and maybe update the anim."
|
||||
(set! (-> arg0 num-func) arg2)
|
||||
(cond
|
||||
((= (-> arg0 command) 'stack)
|
||||
@@ -589,22 +618,28 @@
|
||||
)
|
||||
|
||||
(defun joint-control-copy! ((arg0 joint-control) (arg1 joint-control))
|
||||
"Copy one joint control to another."
|
||||
|
||||
;; set fields
|
||||
(set! (-> arg0 blend-index) (-> arg1 blend-index))
|
||||
(set! (-> arg0 active-channels) (-> arg1 active-channels))
|
||||
;; figure out which slot the source is, and remember that we're a copy.
|
||||
(set! (-> arg0 root-channel)
|
||||
(the-as
|
||||
(inline-array joint-control-channel)
|
||||
(-> arg0
|
||||
channel
|
||||
(/ (&- (the-as pointer (-> arg1 root-channel)) (the-as uint (the-as pointer (-> arg1 channel)))) 48)
|
||||
)
|
||||
)
|
||||
(the-as (inline-array joint-control-channel)
|
||||
(-> arg0
|
||||
channel
|
||||
(/ (&- (the-as pointer (-> arg1 root-channel)) (the-as uint (the-as pointer (-> arg1 channel)))) 48)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; copy channels
|
||||
(mem-copy!
|
||||
(the-as pointer (-> arg0 channel))
|
||||
(the-as pointer (-> arg1 channel))
|
||||
(* 48 (-> arg0 allocated-length))
|
||||
)
|
||||
|
||||
;; set parents of channels to point to the dest.
|
||||
(dotimes (v1-7 (-> arg0 allocated-length))
|
||||
(set! (-> arg0 channel v1-7 parent) arg0)
|
||||
)
|
||||
@@ -669,6 +704,8 @@
|
||||
)
|
||||
|
||||
(defun flatten-joint-control-to-spr ((arg0 joint-control))
|
||||
"Take the current state of the given joint-control and upload it to the scratchpad
|
||||
in the format that will be understood by the joint animation decompressor."
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf10 :class vf)
|
||||
(vf11 :class vf)
|
||||
@@ -685,14 +722,19 @@
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(let ((nb-channels (-> arg0 active-channels)))
|
||||
(let ((f0-0 1.0)
|
||||
(v1-0 0)
|
||||
(a1-0 (-> (scratchpad-object terrain-context) work foreground joint-work flattened))
|
||||
(let ((f0-0 1.0) ;; one
|
||||
(v1-0 0) ;; offset in spad
|
||||
(a1-0 (-> (scratchpad-object terrain-context) work foreground joint-work flattened)) ;; start of data.
|
||||
)
|
||||
|
||||
;; loop over active channels.
|
||||
;;
|
||||
(dotimes (a0-1 nb-channels)
|
||||
(let ((a2-3 (-> arg0 channel a0-1)))
|
||||
(case (-> a2-3 command)
|
||||
(('push)
|
||||
;; this adds a weight of 1 for this channel always.
|
||||
;; note that the quads store 1 - weight, so we store 0's here.
|
||||
(let ((a2-4 (&+ (the-as pointer a1-0) v1-0)))
|
||||
(set! (-> a1-0 0 quad) (the-as uint128 0))
|
||||
(set! (-> a1-0 1 quad) (the-as uint128 0))
|
||||
@@ -700,8 +742,10 @@
|
||||
(set! (-> a1-0 3 quad) (the-as uint128 0))
|
||||
(set! (-> a1-0 4 quad) (the-as uint128 0))
|
||||
(set! (-> a1-0 5 quad) (the-as uint128 0))
|
||||
;; and this thing stores the normal weight.
|
||||
(set! (-> (the-as (pointer float) a2-4)) f0-0)
|
||||
)
|
||||
;; advance.
|
||||
(set! a1-0 (the-as (inline-array vector) (-> a1-0 6)))
|
||||
)
|
||||
(('blend 'push1)
|
||||
|
||||
@@ -5,19 +5,35 @@
|
||||
;; name in dgo: mspace-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; mspace is the skeleton-based animation system.
|
||||
;; There's three main types:
|
||||
;; - The cspace-array. This contains references to the bones and the joints. (called node-list)
|
||||
;; - The skeleton: This contains the bones. (called skeleton)
|
||||
;; - The joint-control: this has the logic for running joint animations. (called skel)
|
||||
|
||||
;; There's three system's involved with animation:
|
||||
;; - joint control - this figures out which animations to play.
|
||||
;; the big list of playing animations in *stats-target* are all the joint control channels.
|
||||
|
||||
;; - joint decompression. The compressed joint animations store compressed joint data that must
|
||||
;; be streamed and decompressed.
|
||||
|
||||
;; - bones. This is figuring out the location of each "bone" in the world.
|
||||
|
||||
|
||||
;; First, the joint. This type just describes how the skeleton is connected.
|
||||
(deftype joint (basic)
|
||||
((name basic :offset-assert 4)
|
||||
(number int32 :offset-assert 8)
|
||||
(parent joint :offset-assert 12)
|
||||
(bind-pose matrix :inline :offset-assert 16)
|
||||
((name basic :offset-assert 4) ;; the joint's name (neckA, neckB, Rtoes, etc)
|
||||
(number int32 :offset-assert 8) ;; the joint's number in the cspace-array
|
||||
(parent joint :offset-assert 12) ;; the parent joint (ex, Lshould has parent of chest)
|
||||
(bind-pose matrix :inline :offset-assert 16) ;; the bind pose, as a matrix. Unknown if used.
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x50
|
||||
:flag-assert #x900000050
|
||||
)
|
||||
|
||||
;; I believe this stores offsets, in bytes, of where there are stored
|
||||
;; (possibly in the scratchpad)
|
||||
(deftype bone-cache (structure)
|
||||
((bone-matrix uint32 :offset-assert 0)
|
||||
(parent-matrix uint32 :offset-assert 4)
|
||||
@@ -29,6 +45,8 @@
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; The "bone" stores the final positions of the bodies.
|
||||
;; This is a world space transform.
|
||||
(deftype bone (structure)
|
||||
((transform matrix :inline :offset-assert 0)
|
||||
(position vector :inline :offset 48) ;; overlays the matrix
|
||||
@@ -40,6 +58,7 @@
|
||||
:flag-assert #x900000060
|
||||
)
|
||||
|
||||
;; Like a real skeleton, this is a collection of bones for a single character.
|
||||
(deftype skeleton (inline-array-class)
|
||||
((bones bone :inline :dynamic))
|
||||
:method-count-assert 9
|
||||
@@ -48,15 +67,27 @@
|
||||
)
|
||||
(set! (-> skeleton heap-base) 96)
|
||||
|
||||
;; The "cspace" seems to be a system for linking bones and joints.
|
||||
;; The tree structure matches the tree of joints.
|
||||
;; For example: (-> *target* node-list data 14 parent joint) is the same as
|
||||
;; (-> *target* node-list data 14 joint parent)
|
||||
;; But, we appear to use bone indices here.
|
||||
;; So the joint index is always 1 less than the node index.
|
||||
;; By convention, node 0 is not a joint.
|
||||
;; node 1 is an "align" joint. It has parent #f, and is joint 0.
|
||||
;; node 2 is a "prejoint". It also has parent #f, and is joint 1.
|
||||
;; node 3 is "main". It has parent prejoint, and is joint 2.
|
||||
;; node 4 is the first real joint (for jak, it's upper body).
|
||||
|
||||
(deftype cspace (structure)
|
||||
((parent cspace :offset-assert 0)
|
||||
(joint joint :offset-assert 4)
|
||||
(joint-num int16 :offset-assert 8)
|
||||
(geo basic :offset-assert 12)
|
||||
(bone bone :offset-assert 16)
|
||||
(param0 function :offset-assert 20)
|
||||
(param1 basic :offset-assert 24)
|
||||
(param2 basic :offset-assert 28)
|
||||
((parent cspace :offset-assert 0) ;; the parent body
|
||||
(joint joint :offset-assert 4) ;; the joint which moves us
|
||||
(joint-num int16 :offset-assert 8) ;; seems to be 0 always??
|
||||
(geo basic :offset-assert 12) ;; seems to be #f always
|
||||
(bone bone :offset-assert 16) ;; points to our bone.
|
||||
(param0 function :offset-assert 20) ;; ??
|
||||
(param1 basic :offset-assert 24) ;; ??
|
||||
(param2 basic :offset-assert 28) ;; ??
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x20
|
||||
@@ -68,6 +99,7 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; All the cspaces for a character.
|
||||
(deftype cspace-array (inline-array-class)
|
||||
((data cspace :inline :dynamic :offset-assert 16))
|
||||
:method-count-assert 9
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
:flag-assert #xb00000144
|
||||
(:methods
|
||||
(dummy-9 (_type_) symbol 9)
|
||||
(dummy-10 (_type_) symbol 10)
|
||||
(debug-draw (_type_) symbol 10)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
:flag-assert #xb00000810
|
||||
(:methods
|
||||
(debug-draw (_type_) object 9)
|
||||
(dummy-10 (_type_ collide-edge-hold-item) none 10)
|
||||
(add-to-list! (_type_ collide-edge-hold-item) none 10)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -121,17 +121,17 @@
|
||||
:size-assert #x2690
|
||||
:flag-assert #x1400002690
|
||||
(:methods
|
||||
(dummy-9 (_type_ collide-edge-hold-list) symbol 9)
|
||||
(search-for-edges (_type_ collide-edge-hold-list) symbol 9)
|
||||
(debug-draw-edges (_type_) object 10)
|
||||
(dummy-11 (_type_) none 11)
|
||||
(debug-draw-tris (_type_) none 11)
|
||||
(debug-draw-sphere (_type_) symbol 12)
|
||||
(dummy-13 (_type_ collide-edge-hold-item vector) none 13)
|
||||
(compute-center-point! (_type_ collide-edge-edge vector) float 13)
|
||||
(dummy-14 (_type_ vector vector int) float 14)
|
||||
(dummy-15 (_type_) none 15)
|
||||
(find-grabbable-edges! (_type_) none 15)
|
||||
(find-grabbable-tris! (_type_) none 16)
|
||||
(dummy-17 (_type_) none 17)
|
||||
(dummy-18 (_type_ collide-edge-hold-list edge-grab-info) none 18)
|
||||
(dummy-19 (_type_ collide-edge-hold-item edge-grab-info) symbol 19)
|
||||
(should-add-to-list? (_type_ collide-edge-hold-item collide-edge-edge) symbol 17)
|
||||
(find-best-grab! (_type_ collide-edge-hold-list edge-grab-info) symbol 18)
|
||||
(check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) symbol 19)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -5,6 +5,731 @@
|
||||
;; name in dgo: collide-edge-grab
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(defmethod find-edge-grabs! target ((obj target) (arg0 collide-cache))
|
||||
"Main edge grabbing method.
|
||||
Will populate *edge-grab-info* and send *target* an 'edge-grab event if successful."
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
)
|
||||
(let ((gp-0 *collide-edge-work*))
|
||||
;; reset the edge work...
|
||||
(set! (-> gp-0 num-verts) (the-as uint 0))
|
||||
(set! (-> gp-0 num-edges) (the-as uint 0))
|
||||
(set! (-> gp-0 num-tris) (the-as uint 0))
|
||||
|
||||
(let ((v1-0 (-> obj control)))
|
||||
(set! (-> gp-0 ccache) arg0)
|
||||
(.lvf vf1 (&-> gp-0 local-cache-fill-box min quad))
|
||||
(.lvf vf2 (&-> gp-0 local-cache-fill-box max quad))
|
||||
(set! (-> gp-0 cshape) v1-0)
|
||||
(.lvf vf3 (&-> v1-0 trans quad))
|
||||
)
|
||||
;; translate the cache filling box
|
||||
(.add.vf vf1 vf1 vf3 :mask #b111)
|
||||
(.add.vf vf2 vf2 vf3 :mask #b111)
|
||||
(.svf (&-> gp-0 cache-fill-box min quad) vf1)
|
||||
(.svf (&-> gp-0 cache-fill-box max quad) vf2)
|
||||
;; translate the reach box
|
||||
(.lvf vf4 (&-> gp-0 local-within-reach-box min quad))
|
||||
(.lvf vf5 (&-> gp-0 local-within-reach-box max quad))
|
||||
(.add.vf vf4 vf4 vf3 :mask #b111)
|
||||
(.add.vf vf5 vf5 vf3 :mask #b111)
|
||||
;; and also provide an integer version of the box.
|
||||
(.ftoi.vf vf6 vf4)
|
||||
(.ftoi.vf vf7 vf5)
|
||||
(.svf (&-> gp-0 within-reach-box min quad) vf4)
|
||||
(.svf (&-> gp-0 within-reach-box max quad) vf5)
|
||||
(.svf (&-> gp-0 within-reach-box4w min quad) vf6)
|
||||
(.svf (&-> gp-0 within-reach-box4w max quad) vf7)
|
||||
|
||||
;; Fill the collide cache!
|
||||
(fill-using-bounding-box
|
||||
arg0
|
||||
(-> gp-0 cache-fill-box)
|
||||
(-> obj control root-prim collide-with)
|
||||
obj
|
||||
(new 'static 'pat-surface :skip #x1 :noentity #x1)
|
||||
)
|
||||
|
||||
;; Filter out tris that can't be grabbed
|
||||
(find-grabbable-tris! gp-0)
|
||||
(when (nonzero? (-> gp-0 num-tris))
|
||||
;; Find edges that we might be able to grab
|
||||
(find-grabbable-edges! gp-0)
|
||||
(when (nonzero? (-> gp-0 num-edges))
|
||||
;;
|
||||
(set! (-> gp-0 search-pt quad) (-> *target* control unknown-vector90 quad))
|
||||
;; for the search, we either use the direction of the stick, or the heading of target.
|
||||
(when (!= (-> *cpad-list* cpads (-> *target* control unknown-cpad-info00 number) stick0-speed) 0.0)
|
||||
;; use stick
|
||||
(set! (-> gp-0 search-dir-vec quad) (-> *target* control unknown-vector20 quad))
|
||||
(search-for-edges gp-0 (-> gp-0 hold-list))
|
||||
(when (find-best-grab! gp-0 (-> gp-0 hold-list) *edge-grab-info*)
|
||||
(send-event *target* 'edge-grab)
|
||||
(return (the-as object #f))
|
||||
)
|
||||
)
|
||||
;; use target's heading
|
||||
(vector-z-quaternion! (-> gp-0 search-dir-vec) (-> *target* control unknown-quaternion00))
|
||||
(search-for-edges gp-0 (-> gp-0 hold-list))
|
||||
(if (find-best-grab! gp-0 (-> gp-0 hold-list) *edge-grab-info*)
|
||||
(send-event *target* 'edge-grab)
|
||||
)
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod search-for-edges collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-hold-list))
|
||||
"Iterate through edges, adding them to the collide-edge-hold-list, if they are good"
|
||||
;; reset edge list.
|
||||
(set! (-> arg0 num-allocs) (the-as uint 0))
|
||||
(set! (-> arg0 num-attempts) (the-as uint 0))
|
||||
(set! (-> arg0 head) #f)
|
||||
(let ((s4-0 (the-as collide-edge-hold-item (-> arg0 items)))
|
||||
(s3-0 (the-as collide-edge-edge (-> obj edges)))
|
||||
)
|
||||
;; loop over edges
|
||||
(countdown (s2-0 (-> obj num-edges))
|
||||
(when (not (-> s3-0 ignore))
|
||||
;; find the grab point
|
||||
(compute-center-point! obj s3-0 (-> s4-0 center-pt))
|
||||
;; add if needed.
|
||||
(when (should-add-to-list? obj s4-0 s3-0)
|
||||
(add-to-list! arg0 s4-0)
|
||||
(+! (-> arg0 num-allocs) 1)
|
||||
(when (= (-> arg0 num-allocs) 32)
|
||||
(format 0 "ERROR: Reached limit of edge grab hold items!~%")
|
||||
(return #f)
|
||||
)
|
||||
(&+! s4-0 48)
|
||||
)
|
||||
)
|
||||
(&+! s3-0 48)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
|
||||
;; add to list.
|
||||
(defmethod-mips2c "(method 10 collide-edge-hold-list)" 10 collide-edge-hold-list)
|
||||
|
||||
(deftype pbhp-stack-vars (structure)
|
||||
((edge collide-edge-edge :offset-assert 0)
|
||||
(allocated basic :offset-assert 4)
|
||||
(neg-hold-pt vector :inline :offset-assert 16)
|
||||
(split-vec vector :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x30
|
||||
:flag-assert #x900000030
|
||||
)
|
||||
|
||||
|
||||
(defmethod-mips2c "(method 18 collide-edge-work)" 18 collide-edge-work)
|
||||
|
||||
(defmethod check-grab-for-collisions collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-hold-item) (arg1 edge-grab-info))
|
||||
(local-vars (sv-144 (function vector vector vector float vector)) (sv-160 vector) (sv-176 vector))
|
||||
(let* ((s3-0 (-> arg0 edge))
|
||||
(s1-0 (-> s3-0 etri ctri))
|
||||
(s4-0 (-> s1-0 prim-index))
|
||||
)
|
||||
(let ((s0-0 (new 'stack-no-clear 'vector)))
|
||||
(vector+*! s0-0 (-> arg0 center-pt) (-> s3-0 edge-vec-norm) 1105.92)
|
||||
(let ((f0-0 (dummy-14 obj (-> arg1 right-hand-hold) s0-0 (the-as int s4-0))))
|
||||
(if (< 491.52 f0-0)
|
||||
(return #f)
|
||||
)
|
||||
)
|
||||
(set! sv-144 vector+*!)
|
||||
(set! sv-160 s0-0)
|
||||
(set! sv-176 (-> arg0 center-pt))
|
||||
(let ((a2-3 (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm)))
|
||||
(a3-2 1105.92)
|
||||
)
|
||||
(sv-144 sv-160 sv-176 a2-3 a3-2)
|
||||
)
|
||||
(let ((f0-1 (dummy-14 obj (-> arg1 left-hand-hold) s0-0 (the-as int s4-0))))
|
||||
(if (< 491.52 f0-1)
|
||||
(return #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg1 tri-vertex 0 quad) (-> s1-0 vertex 0 quad))
|
||||
(set! (-> arg1 world-vertex 4 quad) (-> s1-0 vertex 1 quad))
|
||||
(set! (-> arg1 world-vertex 5 quad) (-> s1-0 vertex 2 quad))
|
||||
(set! (-> arg1 edge-tri-pat) (the-as uint (-> s1-0 pat)))
|
||||
(set! (-> arg1 center-hold quad) (-> arg0 center-pt quad))
|
||||
(set! (-> arg1 world-vertex 0 quad) (-> s3-0 vertex-ptr 0 0 quad))
|
||||
(set! (-> arg1 world-vertex 1 quad) (-> s3-0 vertex-ptr 1 0 quad))
|
||||
(set! (-> arg1 hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad))
|
||||
(vector-normalize!
|
||||
(vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (the-as vector (-> arg1 world-vertex)))
|
||||
1.0
|
||||
)
|
||||
(vector-normalize!
|
||||
(vector-cross!
|
||||
(the-as vector (-> arg1 hanging-matrix))
|
||||
(-> arg1 hanging-matrix vector 2)
|
||||
(-> arg1 hanging-matrix vector 1)
|
||||
)
|
||||
1.0
|
||||
)
|
||||
(vector-cross!
|
||||
(-> arg1 hanging-matrix vector 2)
|
||||
(the-as vector (-> arg1 hanging-matrix))
|
||||
(-> arg1 hanging-matrix vector 1)
|
||||
)
|
||||
(set! (-> arg1 hanging-matrix vector 3 quad) (-> arg1 center-hold quad))
|
||||
(transform-vectors! (-> arg1 hanging-matrix) (-> obj world-player-spheres) (-> obj local-player-spheres) 12)
|
||||
(let ((a1-13 (new 'stack-no-clear 'collide-using-spheres-params)))
|
||||
(set! (-> a1-13 spheres) (the-as (pointer sphere) (-> obj world-player-spheres)))
|
||||
(set! (-> a1-13 num-spheres) (the-as uint 12))
|
||||
(set! (-> a1-13 collide-with) (-> obj cshape root-prim collide-with))
|
||||
(set! (-> a1-13 proc) #f)
|
||||
(set! (-> a1-13 ignore-pat) (the-as uint 1))
|
||||
(set! (-> a1-13 solid-only) #t)
|
||||
(if (probe-using-spheres (-> obj ccache) a1-13)
|
||||
(return #f)
|
||||
)
|
||||
)
|
||||
(let* ((v1-36 (the-as object (-> obj ccache prims s4-0 prim)))
|
||||
(a0-35 (-> (the-as collide-shape-prim v1-36) cshape))
|
||||
)
|
||||
(cond
|
||||
(a0-35
|
||||
(set! (-> arg1 actor-cshape-prim-offset) (- (the-as int v1-36) (the-as int (-> a0-35 process))))
|
||||
(set! (-> arg1 actor-handle) (process->handle (-> a0-35 process)))
|
||||
(let ((a1-19
|
||||
(-> a0-35 process node-list data (-> (the-as collide-shape-prim v1-36) transform-index) bone transform)
|
||||
)
|
||||
(s5-1 (new 'stack-no-clear 'matrix))
|
||||
)
|
||||
(matrix-4x4-inverse! s5-1 a1-19)
|
||||
(dotimes (s4-1 6)
|
||||
(vector-matrix*! (-> arg1 local-vertex s4-1) (-> arg1 world-vertex s4-1) s5-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(set! (-> arg1 actor-cshape-prim-offset) 0)
|
||||
(set! (-> arg1 actor-handle) (the-as handle #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
#t
|
||||
)
|
||||
|
||||
(defmethod dummy-9 edge-grab-info ((obj edge-grab-info))
|
||||
(local-vars (v0-0 symbol) (v1-14 int))
|
||||
(rlet ((acc :class vf)
|
||||
(Q :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 #f)))
|
||||
(set! (-> obj center-hold-old quad) (-> obj center-hold quad))
|
||||
(let ((v1-1 (-> obj actor-cshape-prim-offset)))
|
||||
(when (nonzero? v1-1)
|
||||
(let ((a0-5 (handle->process (-> obj actor-handle))))
|
||||
(if (not (the-as process a0-5))
|
||||
(return #f)
|
||||
)
|
||||
(set! s5-0 (+ (the-as int a0-5) v1-1))
|
||||
(if (zero? (-> (the-as collide-shape-prim s5-0) prim-core collide-as))
|
||||
(return #f)
|
||||
)
|
||||
(let ((s4-0
|
||||
(-> (the-as process-drawable a0-5)
|
||||
node-list
|
||||
data
|
||||
(-> (the-as collide-shape-prim s5-0) transform-index)
|
||||
bone
|
||||
transform
|
||||
)
|
||||
)
|
||||
)
|
||||
(dotimes (s3-0 6)
|
||||
(vector-matrix*! (-> obj world-vertex s3-0) (-> obj local-vertex s3-0) s4-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(.lvf vf1 (&-> obj world-vertex 3 quad))
|
||||
(.lvf vf2 (&-> obj world-vertex 4 quad))
|
||||
(.lvf vf3 (&-> obj world-vertex 5 quad))
|
||||
(.sub.vf vf4 vf2 vf1)
|
||||
(.sub.vf vf5 vf3 vf1)
|
||||
(.outer.product.a.vf acc vf4 vf5)
|
||||
(.outer.product.b.vf vf6 vf5 vf4 acc)
|
||||
(.mul.vf vf7 vf6 vf6)
|
||||
(.mul.x.vf acc vf0 vf7 :mask #b1000)
|
||||
(.add.mul.y.vf acc vf0 vf7 acc :mask #b1000)
|
||||
(.add.mul.z.vf vf7 vf0 vf7 acc :mask #b1000)
|
||||
(.isqrt.vf Q vf0 vf7 :fsf #b11 :ftf #b11)
|
||||
(let ((f1-0 0.707))
|
||||
(.wait.vf)
|
||||
(nop!)
|
||||
(.mul.vf vf6 vf6 Q :mask #b111)
|
||||
(.mov v1-14 vf6)
|
||||
(b! (>= (the-as float (sar (the-as int v1-14) 32)) f1-0) cfg-17)
|
||||
)
|
||||
(set! v0-0 #f)
|
||||
(b! #t cfg-27 :delay (nop!))
|
||||
(label cfg-17)
|
||||
(set! (-> obj hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad))
|
||||
(vector-normalize!
|
||||
(vector-! (-> obj hanging-matrix vector 2) (-> obj world-vertex 1) (the-as vector (-> obj world-vertex)))
|
||||
1.0
|
||||
)
|
||||
(vector-normalize!
|
||||
(vector-cross!
|
||||
(the-as vector (-> obj hanging-matrix))
|
||||
(-> obj hanging-matrix vector 2)
|
||||
(-> obj hanging-matrix vector 1)
|
||||
)
|
||||
1.0
|
||||
)
|
||||
(vector-cross!
|
||||
(-> obj hanging-matrix vector 2)
|
||||
(the-as vector (-> obj hanging-matrix))
|
||||
(-> obj hanging-matrix vector 1)
|
||||
)
|
||||
(set! (-> obj hanging-matrix vector 3 quad) (-> obj center-hold quad))
|
||||
(let ((v1-21 *collide-edge-work*))
|
||||
(transform-vectors!
|
||||
(-> obj hanging-matrix)
|
||||
(-> v1-21 world-player-spheres)
|
||||
(-> v1-21 local-player-spheres)
|
||||
12
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-22 *collide-edge-work*)
|
||||
(a1-14 (new 'stack-no-clear 'collide-using-spheres-params))
|
||||
)
|
||||
(let ((a0-24 'target-edge-grab-jump))
|
||||
(b! (!= (-> *target* next-state name) a0-24) cfg-20 :delay (nop!))
|
||||
)
|
||||
(set! (-> a1-14 spheres) (the-as (pointer sphere) (-> v1-22 world-player-leap-up-spheres)))
|
||||
(set! (-> a1-14 num-spheres) (the-as uint 6))
|
||||
(set! (-> a1-14 collide-with) (-> v1-22 cshape root-prim collide-with))
|
||||
(set! (-> a1-14 proc) #f)
|
||||
(set! (-> a1-14 ignore-pat) (the-as uint 1))
|
||||
(set! (-> a1-14 solid-only) #t)
|
||||
(b! #t cfg-21 :delay (nop!))
|
||||
(label cfg-20)
|
||||
(set! (-> a1-14 spheres) (the-as (pointer sphere) (-> v1-22 world-player-spheres)))
|
||||
(set! (-> a1-14 num-spheres) (the-as uint 6))
|
||||
(set! (-> a1-14 collide-with) (-> v1-22 cshape root-prim collide-with))
|
||||
(set! (-> a1-14 proc) #f)
|
||||
(set! (-> a1-14 ignore-pat) (the-as uint 1))
|
||||
(set! (-> a1-14 solid-only) #t)
|
||||
(label cfg-21)
|
||||
(b! (not (fill-and-probe-using-spheres *collide-cache* a1-14)) cfg-24)
|
||||
)
|
||||
(set! v0-0 #f)
|
||||
(b! #t cfg-27 :delay (nop!))
|
||||
(the-as none 0)
|
||||
(label cfg-24)
|
||||
(b! (not (the-as int s5-0)) cfg-26)
|
||||
(let ((v1-40 (-> (the-as collide-shape-prim s5-0) cshape)))
|
||||
(send-event (-> v1-40 process) 'edge-grabbed obj)
|
||||
)
|
||||
)
|
||||
(label cfg-26)
|
||||
(set! v0-0 #t)
|
||||
(label cfg-27)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defmethod-mips2c "(method 16 collide-edge-work)" 16 collide-edge-work)
|
||||
(defmethod-mips2c "(method 15 collide-edge-work)" 15 collide-edge-work)
|
||||
|
||||
(defmethod dummy-14 collide-edge-work ((obj collide-edge-work) (arg0 vector) (arg1 vector) (arg2 int))
|
||||
(let ((f30-0 -1.0))
|
||||
(let ((s2-0 (new 'stack-no-clear 'vector)))
|
||||
(dotimes (s1-0 (the-as int (-> obj num-edges)))
|
||||
(let ((v1-3 (-> obj edges s1-0)))
|
||||
(when (not (-> v1-3 ignore))
|
||||
(when (= (-> v1-3 etri ctri prim-index) arg2)
|
||||
(let ((f0-0 (vector-segment-distance-point! arg1 (-> v1-3 vertex-ptr 0 0) (-> v1-3 vertex-ptr 1 0) s2-0)))
|
||||
(when (or (< f30-0 0.0) (< f0-0 f30-0))
|
||||
(set! f30-0 f0-0)
|
||||
(set! (-> arg0 quad) (-> s2-0 quad))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
f30-0
|
||||
)
|
||||
)
|
||||
|
||||
;; 17 cew
|
||||
(defmethod should-add-to-list? collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-hold-item) (arg1 collide-edge-edge))
|
||||
(local-vars
|
||||
(r0-0 uint128)
|
||||
(v1-1 uint128)
|
||||
(v1-2 uint128)
|
||||
(v1-4 float)
|
||||
(v1-5 float)
|
||||
(v1-6 float)
|
||||
(a3-1 uint128)
|
||||
(t0-0 uint128)
|
||||
(t1-1 uint128)
|
||||
)
|
||||
(rlet ((Q :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf10 :class vf)
|
||||
(vf11 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(.lvf vf1 (&-> arg0 center-pt quad))
|
||||
(nop!)
|
||||
(let ((a3-0 (-> obj within-reach-box4w min quad)))
|
||||
(nop!)
|
||||
(let ((t1-0 (-> obj within-reach-box4w max quad)))
|
||||
(.ftoi.vf vf2 vf1)
|
||||
(let ((v1-0 (-> obj cshape)))
|
||||
(.mov t0-0 vf2)
|
||||
(.lvf vf3 (&-> arg1 outward quad))
|
||||
(.pcgtw t1-1 t0-0 t1-0)
|
||||
(.lvf vf4 (&-> obj outward-offset quad))
|
||||
(.pcgtw a3-1 a3-0 t0-0)
|
||||
(.lvf vf5 (&-> v1-0 trans quad))
|
||||
)
|
||||
)
|
||||
)
|
||||
(.por v1-1 t1-1 a3-1)
|
||||
(let ((f0-0 (-> obj max-dist-sqrd-to-outward-pt)))
|
||||
(.ppach v1-2 r0-0 v1-1)
|
||||
(let ((f1-0 (-> obj max-dir-cosa-delta)))
|
||||
(b! (nonzero? (shl (the-as int v1-2) 16)) cfg-4 :delay (.lvf vf6 (&-> obj search-dir-vec quad)))
|
||||
(.mul.x.vf vf10 vf3 vf4)
|
||||
(.lvf vf11 (&-> obj search-pt quad))
|
||||
(.add.vf vf10 vf10 vf1)
|
||||
(.sub.vf vf7 vf5 vf10)
|
||||
(.mul.vf vf7 vf7 vf7)
|
||||
(.add.z.vf vf7 vf7 vf7 :mask #b1)
|
||||
(.mov v1-4 vf7)
|
||||
(b! (< f0-0 v1-4) cfg-4)
|
||||
(.sub.vf vf8 vf1 vf5)
|
||||
(.mul.vf vf7 vf8 vf8)
|
||||
(.add.z.vf vf7 vf7 vf7 :mask #b1)
|
||||
(.isqrt.vf Q vf0 vf7 :fsf #b11 :ftf #b0)
|
||||
(nop!)
|
||||
(.wait.vf)
|
||||
(nop!)
|
||||
(.mul.vf vf8 vf8 Q :mask #b101)
|
||||
(.mul.vf vf9 vf8 vf6)
|
||||
(.add.z.vf vf9 vf9 vf9 :mask #b1)
|
||||
(.mov v1-5 vf9)
|
||||
(b! (< v1-5 f1-0) cfg-4)
|
||||
)
|
||||
)
|
||||
(.sub.vf vf7 vf11 vf1)
|
||||
(.svf (&-> arg0 center-pt quad) vf1)
|
||||
(.mul.vf vf7 vf7 vf7)
|
||||
(set! (-> arg0 split) 0)
|
||||
(.svf (&-> arg0 outward-pt quad) vf10)
|
||||
(.add.z.vf vf7 vf7 vf7 :mask #b1)
|
||||
(set! (-> arg0 edge) arg1)
|
||||
(.mov v1-6 vf7)
|
||||
(set! (-> arg0 rating) v1-6)
|
||||
(let ((v0-0 #t))
|
||||
(b! #t cfg-6 :delay (nop!))
|
||||
(label cfg-4)
|
||||
(set! v0-0 #f)
|
||||
(b! #t cfg-6 :delay (nop!))
|
||||
(set! v0-0 (the-as symbol 0))
|
||||
(label cfg-6)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod compute-center-point! collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-edge) (arg1 vector))
|
||||
(local-vars (v0-0 float) (v1-1 float) (v1-2 float) (v1-3 float))
|
||||
(rlet ((Q :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf10 :class vf)
|
||||
(vf11 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(.mov.vf vf7 vf0)
|
||||
(.lvf vf1 (&-> obj search-pt quad))
|
||||
(let ((f0-0 0.0))
|
||||
(let ((v1-0 (-> arg0 vertex-ptr 0))
|
||||
(a0-1 (-> arg0 vertex-ptr 1))
|
||||
)
|
||||
(.lvf vf2 (&-> v1-0 0 quad))
|
||||
(.lvf vf3 (&-> a0-1 0 quad))
|
||||
)
|
||||
(.sub.vf vf4 vf1 vf2)
|
||||
(.sub.vf vf5 vf3 vf2)
|
||||
(.mul.vf vf6 vf5 vf5)
|
||||
(.add.z.vf vf6 vf6 vf6 :mask #b1)
|
||||
(.sqrt.vf Q vf6 :ftf #b0)
|
||||
(nop!)
|
||||
(.wait.vf)
|
||||
(nop!)
|
||||
(.add.vf vf6 vf0 Q :mask #b1)
|
||||
(.nop.vf)
|
||||
(.mov v1-1 vf6)
|
||||
(let ((f1-0 v1-1))
|
||||
(.div.vf Q vf0 vf6 :fsf #b11 :ftf #b0)
|
||||
(.wait.vf)
|
||||
(nop!)
|
||||
(.add.vf vf8 vf0 Q :mask #b1)
|
||||
(.mul.x.vf vf9 vf5 vf8)
|
||||
(.mov v1-2 vf8)
|
||||
(.mul.vf vf10 vf9 vf4)
|
||||
(.add.z.vf vf10 vf10 vf10 :mask #b1)
|
||||
(let ((f2-0 v1-2))
|
||||
(.mov v1-3 vf10)
|
||||
(let ((f3-0 v1-3))
|
||||
(b! (< f3-0 f0-0) cfg-4 :likely-delay (set! f3-0 f0-0))
|
||||
(b! (< f1-0 f3-0) cfg-4 :likely-delay (set! f3-0 f1-0))
|
||||
(label cfg-4)
|
||||
(let ((v1-4 (* f3-0 f2-0)))
|
||||
(.mov vf11 v1-4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(.mul.x.vf vf7 vf5 vf11 :mask #b111)
|
||||
(.add.vf vf7 vf7 vf2 :mask #b111)
|
||||
(.svf (&-> arg1 quad) vf7)
|
||||
(.mov v0-0 vf7)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defmethod debug-draw edge-grab-info ((obj edge-grab-info))
|
||||
(add-debug-line
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
(the-as vector (-> obj world-vertex))
|
||||
(-> obj world-vertex 1)
|
||||
(new 'static 'rgba :r #xff :a #x60)
|
||||
#f
|
||||
(the-as rgba -1)
|
||||
)
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
(-> obj center-hold)
|
||||
204.8
|
||||
(new 'static 'rgba :r #xff :g #xff :a #x80)
|
||||
)
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
(-> obj left-hand-hold)
|
||||
204.8
|
||||
(new 'static 'rgba :r #xff :g #xff :a #x60)
|
||||
)
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
(-> obj right-hand-hold)
|
||||
204.8
|
||||
(new 'static 'rgba :r #xff :g #xff :a #x60)
|
||||
)
|
||||
(add-debug-outline-triangle
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
(the-as vector (-> obj tri-vertex))
|
||||
(-> obj world-vertex 4)
|
||||
(-> obj world-vertex 5)
|
||||
(new 'static 'rgba :r #xff :a #x30)
|
||||
)
|
||||
(the-as symbol (cond
|
||||
((nonzero? (-> obj actor-cshape-prim-offset))
|
||||
(if (handle->process (-> obj actor-handle))
|
||||
(format *stdcon* "grab: ~A~%" (-> obj actor-handle process 0 name))
|
||||
(format *stdcon* "grab: invalid handle~%")
|
||||
)
|
||||
)
|
||||
(else
|
||||
(format *stdcon* "grab: ground~%")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod debug-draw-edges collide-edge-work ((obj collide-edge-work))
|
||||
(let ((gp-0 0))
|
||||
(dotimes (s4-0 (the-as int (-> obj num-edges)))
|
||||
(let* ((s3-0 (-> obj edges s4-0))
|
||||
(a2-0 (-> s3-0 vertex-ptr 0 0))
|
||||
(a3-0 (-> s3-0 vertex-ptr 1 0))
|
||||
(s2-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(vector+! s2-0 a2-0 a3-0)
|
||||
(vector-float*! s2-0 s2-0 0.5)
|
||||
(cond
|
||||
((-> s3-0 ignore)
|
||||
(add-debug-line
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
a2-0
|
||||
a3-0
|
||||
(new 'static 'rgba :r #x7f :g #x7f :b #x7f :a #x50)
|
||||
#f
|
||||
(the-as rgba -1)
|
||||
)
|
||||
(+! gp-0 1)
|
||||
)
|
||||
(else
|
||||
(add-debug-line
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
a2-0
|
||||
a3-0
|
||||
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x60)
|
||||
#f
|
||||
(the-as rgba -1)
|
||||
)
|
||||
(add-debug-vector
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
s2-0
|
||||
(-> s3-0 outward)
|
||||
(meters 0.3)
|
||||
(new 'static 'rgba :r #xff :a #x80)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(format *stdcon* "found ~D edges (and ~D ignored)~%" (- (-> obj num-edges) (the-as uint gp-0)) gp-0)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defmethod debug-draw-sphere collide-edge-work ((obj collide-edge-work))
|
||||
(dotimes (s5-0 (the-as int (-> obj num-verts)))
|
||||
(let ((a2-0 (-> obj verts s5-0)))
|
||||
(add-debug-sphere #t (bucket-id debug-draw1) a2-0 819.2 (new 'static 'rgba :r #xff :g #xff :a #x80))
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
|
||||
(defmethod debug-draw collide-edge-hold-list ((obj collide-edge-hold-list))
|
||||
(let ((s4-0 (-> obj head))
|
||||
(s5-0 0)
|
||||
)
|
||||
(let ((s3-0 (new 'stack-no-clear 'vector))
|
||||
(s2-0 #t)
|
||||
)
|
||||
(set! (-> s3-0 quad) (-> *target* control unknown-vector90 quad))
|
||||
(while s4-0
|
||||
(+! s5-0 1)
|
||||
(set! (-> s3-0 y) (-> s4-0 center-pt y))
|
||||
(add-debug-sphere #t (bucket-id debug-draw1) s3-0 409.6 (new 'static 'rgba :a #x80))
|
||||
(cond
|
||||
(s2-0
|
||||
(set! s2-0 #f)
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
(-> s4-0 center-pt)
|
||||
614.4
|
||||
(new 'static 'rgba :r #xff :g #xff :a #x80)
|
||||
)
|
||||
(add-debug-sphere #t (bucket-id debug-draw1) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #xff :a #x80))
|
||||
)
|
||||
(else
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
(-> s4-0 center-pt)
|
||||
614.4
|
||||
(new 'static 'rgba :r #x7f :g #x7f :a #x40)
|
||||
)
|
||||
(add-debug-sphere #t (bucket-id debug-draw1) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #x7f :a #x40))
|
||||
)
|
||||
)
|
||||
(set! s4-0 (-> s4-0 next))
|
||||
)
|
||||
)
|
||||
(format *stdcon* "hold list has ~D item(s)~%" s5-0)
|
||||
)
|
||||
(dotimes (s5-1 (the-as int (-> obj num-attempts)))
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
(the-as vector (-> obj attempts s5-1))
|
||||
409.6
|
||||
(new 'static 'rgba :a #x40)
|
||||
)
|
||||
)
|
||||
(format *stdcon* "hold list has ~D attempt(s)~%" (-> obj num-attempts))
|
||||
)
|
||||
|
||||
(defmethod debug-draw-tris collide-edge-work ((obj collide-edge-work))
|
||||
(dotimes (s5-0 (the-as int (-> obj num-tris)))
|
||||
(let* ((v1-3 (-> obj tris s5-0 ctri))
|
||||
(t1-0 (copy-and-set-field (-> *pat-mode-info* (-> v1-3 pat mode) color) a 64))
|
||||
)
|
||||
(add-debug-outline-triangle
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
(the-as vector (-> v1-3 vertex))
|
||||
(-> v1-3 vertex 1)
|
||||
(-> v1-3 vertex 2)
|
||||
t1-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(let
|
||||
((v1-1
|
||||
@@ -88,7 +813,7 @@
|
||||
)
|
||||
|
||||
|
||||
(defmethod find-edge-grabs! target ((obj target) (arg0 collide-cache))
|
||||
(format *stdcon* "no edge grabs for you!~%")
|
||||
(the object 0)
|
||||
)
|
||||
; (defmethod find-edge-grabs! target ((obj target) (arg0 collide-cache))
|
||||
; (format *stdcon* "no edge grabs for you!~%")
|
||||
; (the object 0)
|
||||
; )
|
||||
@@ -131,6 +131,8 @@
|
||||
(login (_type_) _type_ 9)
|
||||
(dummy-10 (_type_ string type) joint 10)
|
||||
(dummy-11 (_type_ string type) int 11)
|
||||
; (lookup-art (_type_ string type) joint 10) ;; can also be art-joint-anim
|
||||
; (lookup-idx-of-art (_type_ string type) int 11)
|
||||
(needs-link? (_type_) symbol 12)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -710,7 +710,7 @@
|
||||
(ja-post)
|
||||
(when (logtest? (-> self flags) (anim-tester-flags fanimt4))
|
||||
(draw-joint-spheres self)
|
||||
(dummy-10 (-> self skel) (the-as symbol *stdcon*))
|
||||
(debug-print-channels (-> self skel) (the-as symbol *stdcon*))
|
||||
)
|
||||
)
|
||||
(none)
|
||||
@@ -2239,7 +2239,7 @@
|
||||
)
|
||||
(logclear! (-> self flags) (anim-tester-flags fanimt1))
|
||||
(when (!= *master-mode* 'menu)
|
||||
(dummy-10 (-> self skel) (the-as symbol *stdcon*))
|
||||
(debug-print-channels (-> self skel) (the-as symbol *stdcon*))
|
||||
(add-debug-x
|
||||
#t
|
||||
(bucket-id debug-draw1)
|
||||
|
||||
@@ -881,6 +881,70 @@
|
||||
)
|
||||
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
(defmethod dummy-19 process-drawable ((obj process-drawable))
|
||||
(local-vars (s7-0 none) (ra-0 int))
|
||||
(let ((gp-0 (-> obj skel)))
|
||||
(label cfg-1)
|
||||
(let ((s4-0 (-> gp-0 active-channels)))
|
||||
(b! (logtest? (-> obj draw status) (draw-status drwf01)) cfg-27)
|
||||
(let ((s3-0 0))
|
||||
(b! #t cfg-13 :delay (nop!))
|
||||
(label cfg-3)
|
||||
(let ((s2-0 (-> gp-0 channel s3-0)))
|
||||
(let ((v1-7 (-> s2-0 command)))
|
||||
(b! (!= v1-7 'stack) cfg-6 :delay (nop!))
|
||||
(joint-control-channel-eval s2-0)
|
||||
(b! (!= s4-0 (-> gp-0 active-channels)) cfg-1 :delay (nop!))
|
||||
(b! #t cfg-12 :delay (nop!))
|
||||
(label cfg-6)
|
||||
(b! (!= v1-7 'stack1) cfg-9 :delay (nop!))
|
||||
)
|
||||
(joint-control-channel-eval s2-0)
|
||||
(b! (!= s4-0 (-> gp-0 active-channels)) cfg-1 :delay (nop!))
|
||||
(set! (-> gp-0 channel (+ s3-0 -1) frame-interp) (-> s2-0 frame-interp))
|
||||
(b! #t cfg-12 :delay (nop!))
|
||||
(label cfg-9)
|
||||
(let ((s1-0 (-> s2-0 frame-group)))
|
||||
(let ((v1-16 art-joint-anim))
|
||||
(b! (= (-> s1-0 type) v1-16) cfg-11)
|
||||
)
|
||||
(go process-drawable-art-error "joint-anim")
|
||||
(format 0 "dummy-19 bad~%")
|
||||
(break!)
|
||||
(nop!)
|
||||
0
|
||||
(label cfg-11)
|
||||
(set! (-> s2-0 frame-num) (fmax 0.0 (fmin (-> s2-0 frame-num) (the float (+ (-> s1-0 data 0 length) -1)))))
|
||||
)
|
||||
)
|
||||
(label cfg-12)
|
||||
(+! s3-0 1)
|
||||
(label cfg-13)
|
||||
(b! (< s3-0 s4-0) cfg-3)
|
||||
)
|
||||
(dotimes (v1-26 s4-0)
|
||||
(set! (-> gp-0 channel v1-26 frame-interp) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-26 frame-interp))))
|
||||
)
|
||||
(if (or (zero? s4-0) (not (-> gp-0 root-channel 0 frame-group)))
|
||||
(logior! (-> obj draw status) (draw-status drwf02))
|
||||
)
|
||||
)
|
||||
; (if (logtest? (-> obj skel status) 72)
|
||||
; (merc-blend-shape obj)
|
||||
; )
|
||||
; (if (logtest? (-> obj skel status) 384)
|
||||
; (merc-eye-anim obj)
|
||||
; )
|
||||
(label cfg-27)
|
||||
(let ((a0-17 (-> gp-0 effect)))
|
||||
; (if a0-17
|
||||
; (TODO-RENAME-9 a0-17)
|
||||
; )
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
;; WARN: Expression building failed: Function ja-post has a return type of none, but the expression builder found a return statement.
|
||||
(defbehavior ja-post process-drawable ()
|
||||
@@ -888,7 +952,7 @@
|
||||
(let ((gp-1 (logtest? (-> self draw status) (draw-status drwf04))))
|
||||
(logclear! (-> self draw status) (draw-status drwf02 drwf04))
|
||||
(when (nonzero? (-> self skel))
|
||||
;(dummy-19 self) TODO
|
||||
(dummy-19 self)
|
||||
|
||||
(#when TARGET_STARTUP_HACKS
|
||||
(when (eq? (-> self type) target)
|
||||
|
||||
@@ -1051,7 +1051,7 @@
|
||||
)
|
||||
)
|
||||
(if (nonzero? (-> (the-as process-drawable s5-2) skel))
|
||||
(dummy-10 (-> (the-as process-drawable s5-2) skel) (the-as symbol *stdcon*))
|
||||
(debug-print-channels (-> (the-as process-drawable s5-2) skel) (the-as symbol *stdcon*))
|
||||
)
|
||||
(if (nonzero? (-> (the-as process-drawable s5-2) nav))
|
||||
(dummy-9 (-> (the-as process-drawable s5-2) nav))
|
||||
@@ -1255,6 +1255,9 @@
|
||||
(define-extern crate type)
|
||||
(define-extern water-vol type)
|
||||
(define-extern slide-control type)
|
||||
(define-extern racer type)
|
||||
(define-extern launcher type)
|
||||
(define-extern warp-gate-switch type)
|
||||
|
||||
(defmacro heap-size-hack (info entity-type)
|
||||
`(cond
|
||||
@@ -1280,6 +1283,9 @@
|
||||
(type-type? (-> obj etype) ecovalve)
|
||||
(type-type? (-> obj etype) water-vol)
|
||||
(type-type? (-> obj etype) slide-control)
|
||||
(type-type? (-> obj etype) racer)
|
||||
(type-type? (-> obj etype) launcher)
|
||||
(type-type? (-> obj etype) warp-gate-switch)
|
||||
;(type-type? (-> obj etype) crate)
|
||||
|
||||
)
|
||||
|
||||
@@ -1115,7 +1115,7 @@
|
||||
|
||||
(defmethod initialize eco-pill ((obj eco-pill))
|
||||
(set! *eco-pill-count* (+ *eco-pill-count* 1))
|
||||
(stack-size-set! (-> obj main-thread) 128)
|
||||
(stack-size-set! (-> obj main-thread) 256) ;; bumped from 128.
|
||||
(logior! (-> obj mask) (process-mask actor-pause))
|
||||
(set! (-> obj actor-pause) #t)
|
||||
(set! (-> obj notify-parent) #f)
|
||||
|
||||
@@ -476,7 +476,7 @@
|
||||
(-> arg0 control unknown-float81)
|
||||
(-> arg0 control unknown-float82)
|
||||
)
|
||||
(dummy-10 (-> arg0 skel) arg1)
|
||||
(debug-print-channels (-> arg0 skel) arg1)
|
||||
)
|
||||
(draw-history (-> arg0 control))
|
||||
#f
|
||||
@@ -1244,7 +1244,7 @@
|
||||
(send-event self 'end-mode)
|
||||
)
|
||||
(if *display-edge-collision-marks*
|
||||
(dummy-10 s5-0)
|
||||
(debug-draw s5-0)
|
||||
)
|
||||
(set! (-> self control ground-pat) (the-as pat-surface (-> s5-0 edge-tri-pat)))
|
||||
(vector-normalize!
|
||||
@@ -1301,7 +1301,7 @@
|
||||
(send-event self 'end-mode)
|
||||
)
|
||||
(if *display-edge-collision-marks*
|
||||
(dummy-10 gp-0)
|
||||
(debug-draw gp-0)
|
||||
)
|
||||
(vector-normalize!
|
||||
(vector-! (-> self control unknown-vector100) (the-as vector (-> gp-0 world-vertex)) (-> gp-0 world-vertex 1))
|
||||
@@ -1529,6 +1529,10 @@
|
||||
|
||||
(defbehavior target-real-post target ()
|
||||
(let ((gp-0 (the int (-> *display* time-ratio))))
|
||||
;; added - this will display "LAG" on screen when target code is running in the laggy mode.
|
||||
(when (!= gp-0 1)
|
||||
(format *stdcon* "~19LLAG: ~D~%~0L" gp-0)
|
||||
)
|
||||
(set-time-ratios *display* 1.0)
|
||||
(countdown (s5-0 gp-0)
|
||||
(set! (-> self control unknown-int40) s5-0)
|
||||
|
||||
@@ -236,7 +236,7 @@
|
||||
)
|
||||
(when *display-sidekick-stats*
|
||||
(format *stdcon* "~%")
|
||||
(dummy-10 (-> self skel) (the-as symbol *stdcon*))
|
||||
(debug-print-channels (-> self skel) (the-as symbol *stdcon*))
|
||||
(add-debug-sphere
|
||||
*display-sidekick-stats*
|
||||
(bucket-id debug-draw1)
|
||||
|
||||
@@ -245,8 +245,6 @@
|
||||
)
|
||||
)
|
||||
((= v1-0 'rotate-y-angle)
|
||||
(format 0 "doing roty angle~%")
|
||||
(break!)
|
||||
(quaternion-rotate-y!
|
||||
(-> self control unknown-quaternion00)
|
||||
(-> self control unknown-quaternion00)
|
||||
|
||||
@@ -625,7 +625,7 @@
|
||||
(cond
|
||||
((not *progress-process*)
|
||||
(when (progress-allowed?)
|
||||
;;(hide-hud)
|
||||
(hide-hud)
|
||||
(make-levels-with-tasks-available-to-progress)
|
||||
(disable-level-text-file-loading)
|
||||
(set! (-> *progress-state* starting-state) screen)
|
||||
|
||||
@@ -5,21 +5,30 @@
|
||||
;; name in dgo: racer
|
||||
;; dgos: L1, FIC, LAV, MIS, OGR, RACERP, ROL
|
||||
|
||||
(define-extern blocking-plane-destroy (function none))
|
||||
(define-extern blocking-plane-spawn (function curve-control none))
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(if (not (nmember "racerp" *kernel-packages*))
|
||||
(set! *kernel-packages* (cons "racerp" *kernel-packages*))
|
||||
)
|
||||
|
||||
;; definition of type racer
|
||||
(deftype racer (process-drawable)
|
||||
((parent-override (pointer target) :score 100 :offset 12)
|
||||
(root-override collide-shape-moving :score 100 :offset 112)
|
||||
(extra-trans vector :inline :offset-assert 176)
|
||||
(condition int32 :offset-assert 192)
|
||||
(cell handle :offset-assert 200)
|
||||
(path-data path-control 2 :offset-assert 208)
|
||||
(path-target curve-control :offset 208)
|
||||
(path-racer path-control :offset 212)
|
||||
(auto-get-off symbol :offset-assert 216)
|
||||
(shadow-backup shadow-geo :offset-assert 220)
|
||||
((parent-override (pointer target) :offset 12)
|
||||
(root-override collide-shape-moving :offset 112)
|
||||
(extra-trans vector :inline :offset-assert 176)
|
||||
(condition int32 :offset-assert 192)
|
||||
(cell handle :offset-assert 200)
|
||||
(path-data path-control 2 :offset-assert 208)
|
||||
(path-target curve-control :offset 208)
|
||||
(path-racer path-control :offset 212)
|
||||
(auto-get-off symbol :offset-assert 216)
|
||||
(shadow-backup shadow-geo :offset-assert 220)
|
||||
)
|
||||
:heap-base #x70
|
||||
:method-count-assert 24
|
||||
:size-assert #xe0
|
||||
:heap-base #x70
|
||||
:flag-assert #x18007000e0
|
||||
(:methods
|
||||
(wait-for-start () _type_ :state 20)
|
||||
@@ -29,6 +38,33 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type racer
|
||||
(defmethod inspect racer ((obj racer))
|
||||
(let ((t9-0 (method-of-type process-drawable inspect)))
|
||||
(t9-0 obj)
|
||||
)
|
||||
(format #t "~T~Textra-trans: ~`vector`P~%" (-> obj extra-trans))
|
||||
(format #t "~T~Tcondition: ~D~%" (-> obj condition))
|
||||
(format #t "~T~Tcell: ~D~%" (-> obj cell))
|
||||
(format #t "~T~Tpath-data[2] @ #x~X~%" (-> obj path-data))
|
||||
(format #t "~T~Tpath-target: ~A~%" (-> obj path-target))
|
||||
(format #t "~T~Tpath-racer: ~A~%" (-> obj path-racer))
|
||||
(format #t "~T~Tauto-get-off: ~A~%" (-> obj auto-get-off))
|
||||
(format #t "~T~Tshadow-backup: ~A~%" (-> obj shadow-backup))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition for method 7 of type racer
|
||||
;; INFO: Return type mismatch process-drawable vs racer.
|
||||
(defmethod relocate racer ((obj racer) (arg0 int))
|
||||
(countdown (v1-0 2)
|
||||
(if (-> obj path-data v1-0)
|
||||
(&+! (-> obj path-data v1-0) arg0)
|
||||
)
|
||||
)
|
||||
(the-as racer ((method-of-type process-drawable relocate) obj arg0))
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(defskelgroup *racer-sg* racer
|
||||
0
|
||||
@@ -49,18 +85,443 @@
|
||||
:longest-edge (meters 0)
|
||||
)
|
||||
|
||||
|
||||
;; definition for symbol *racer-shadow-control*, type shadow-control
|
||||
(define
|
||||
*racer-shadow-control*
|
||||
(new 'static 'shadow-control
|
||||
:settings
|
||||
(new 'static 'shadow-settings
|
||||
:center
|
||||
(new 'static 'vector :w (the-as float #xa))
|
||||
:shadow-dir
|
||||
(new 'static 'vector :y -1.0 :w 614400.0)
|
||||
:bot-plane (new 'static 'plane :y 1.0 :w 81920.0)
|
||||
:top-plane (new 'static 'plane :y 1.0 :w 2048.0)
|
||||
)
|
||||
)
|
||||
(new 'static 'shadow-control :settings (new 'static 'shadow-settings
|
||||
:center
|
||||
(new 'static 'vector :w (the-as float #xa))
|
||||
:shadow-dir
|
||||
(new 'static 'vector :y -1.0 :w 614400.0)
|
||||
:bot-plane (new 'static 'plane :y 1.0 :w 81920.0)
|
||||
:top-plane (new 'static 'plane :y 1.0 :w 2048.0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function racer-effect
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defbehavior racer-effect racer ()
|
||||
(when (!= (-> self condition) 4)
|
||||
(spawn (-> self part) (-> self root-override trans))
|
||||
(update! (-> self sound))
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(defstate wait-for-start (racer)
|
||||
:virtual #t
|
||||
:event
|
||||
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
||||
(local-vars (v0-1 structure))
|
||||
(let ((v1-0 arg2))
|
||||
(the-as
|
||||
object
|
||||
(cond
|
||||
((= v1-0 'trans)
|
||||
(vector+! (the-as vector (-> arg3 param 0)) (-> self root-override trans) (-> self extra-trans))
|
||||
)
|
||||
((= v1-0 'notify)
|
||||
(set! v0-1 #t)
|
||||
(set! (-> self auto-get-off) (the-as symbol v0-1))
|
||||
v0-1
|
||||
)
|
||||
((= v1-0 'shadow)
|
||||
(cond
|
||||
((-> arg3 param 0)
|
||||
(set! v0-1 (-> self shadow-backup))
|
||||
(set! (-> self draw shadow) (the-as shadow-geo v0-1))
|
||||
v0-1
|
||||
)
|
||||
(else
|
||||
(set! (-> self draw shadow) #f)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:exit
|
||||
(behavior ()
|
||||
(set! (-> self root-override root-prim prim-core action) (collide-action))
|
||||
(set! (-> self root-override root-prim prim-core offense) (collide-offense no-offense))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(label cfg-0)
|
||||
(case (-> self condition)
|
||||
((2)
|
||||
(let ((gp-0 (get-task-control (-> self entity extra perm task))))
|
||||
(if (and *cheat-mode* (cpad-hold? 0 l3))
|
||||
(goto cfg-77)
|
||||
)
|
||||
(first-any gp-0 #t)
|
||||
(case (current-status gp-0)
|
||||
(((task-status need-reward-speech))
|
||||
(ja-channel-set! 1)
|
||||
(let ((v1-15 (-> self skel root-channel 0)))
|
||||
(set! (-> v1-15 frame-group) (the-as art-joint-anim (-> self draw art-group data 3)))
|
||||
)
|
||||
(set! (-> self root-override root-prim prim-core action) (collide-action solid ca-11))
|
||||
(set! (-> self root-override root-prim prim-core offense) (collide-offense indestructible))
|
||||
(ja-post)
|
||||
)
|
||||
(((task-status invalid))
|
||||
(goto cfg-77)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((6)
|
||||
(if (or (task-closed? (game-task village2-levitator) (task-status need-hint))
|
||||
(and *cheat-mode* (cpad-hold? 0 l3))
|
||||
(and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9)))
|
||||
)
|
||||
(goto cfg-77)
|
||||
)
|
||||
)
|
||||
((5)
|
||||
(cond
|
||||
((and *cheat-mode* (cpad-hold? 0 l3))
|
||||
(goto cfg-77)
|
||||
)
|
||||
((>= (-> *game-info* fuel) 72.0)
|
||||
(goto cfg-77)
|
||||
)
|
||||
)
|
||||
)
|
||||
((3)
|
||||
(cond
|
||||
((and (task-complete? *game-info* (-> self entity extra perm task)) (not (handle->process (-> self cell))))
|
||||
(when (and (-> self auto-get-off) (send-event *target* 'end-mode))
|
||||
(set! (-> self auto-get-off) #f)
|
||||
(go-virtual pickup (the-as (state collectable) (method-of-object self idle)))
|
||||
)
|
||||
(set! (-> self auto-get-off) #f)
|
||||
(goto cfg-77)
|
||||
)
|
||||
((not (handle->process (-> self cell)))
|
||||
(set! (-> self cell)
|
||||
(ppointer->handle
|
||||
(birth-pickup-at-point
|
||||
(vector+! (new 'stack-no-clear 'vector) (-> self root-override trans) (new 'static 'vector :y 8192.0 :w 1.0))
|
||||
(pickup-type fuel-cell)
|
||||
(the float (-> self entity extra perm task))
|
||||
#f
|
||||
self
|
||||
(-> self fact)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((4)
|
||||
(if (and *target* (zero? (logand (-> *target* control root-prim prim-core action) (collide-action ca-9))))
|
||||
(goto cfg-77)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(goto cfg-77)
|
||||
)
|
||||
)
|
||||
(racer-effect)
|
||||
(suspend)
|
||||
(b! #t cfg-0 :delay (nop!))
|
||||
(label cfg-77)
|
||||
(if (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9)))
|
||||
(go-virtual wait-for-return)
|
||||
(go-virtual idle)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(defstate idle (racer)
|
||||
:virtual #t
|
||||
:event
|
||||
(-> (method-of-type racer wait-for-start) event)
|
||||
:enter
|
||||
(behavior ()
|
||||
(blocking-plane-destroy)
|
||||
(blocking-plane-spawn (-> self path-target))
|
||||
(none)
|
||||
)
|
||||
:exit
|
||||
(-> (method-of-type racer wait-for-start) exit)
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-channel-set! 1)
|
||||
(let ((v1-2 (-> self skel root-channel 0)))
|
||||
(set! (-> v1-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 3)))
|
||||
)
|
||||
(set! (-> self root-override root-prim prim-core action) (collide-action solid ca-11))
|
||||
(set! (-> self root-override root-prim prim-core offense) (collide-offense indestructible))
|
||||
0.0
|
||||
(let ((f30-0 (if (= (-> self condition) 4)
|
||||
61440.0
|
||||
20480.0
|
||||
)
|
||||
)
|
||||
)
|
||||
(while #t
|
||||
(if (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9)))
|
||||
(go-virtual wait-for-return)
|
||||
)
|
||||
(when (and (and *target* (>= f30-0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))))
|
||||
(and (not (movie?)) (not (level-hint-displayed?)))
|
||||
)
|
||||
(hide-hud)
|
||||
(level-hint-surpress!)
|
||||
(kill-current-level-hint '() '(sidekick voicebox) 'exit)
|
||||
(when (and (hud-hidden?) (can-grab-display? (the-as process-taskable self)))
|
||||
(let ((gp-0
|
||||
(new 'stack 'font-context *font-default-matrix* 32 160 0.0 (font-color default) (font-flags shadow kerning))
|
||||
)
|
||||
)
|
||||
(let ((v1-24 gp-0))
|
||||
(set! (-> v1-24 width) (the float 440))
|
||||
)
|
||||
(let ((v1-25 gp-0))
|
||||
(set! (-> v1-25 height) (the float 80))
|
||||
)
|
||||
(set! (-> gp-0 flags) (font-flags shadow kerning large))
|
||||
(print-game-text (lookup-text! *common-text* (game-text-id press-to-use) #f) gp-0 #f 128 22)
|
||||
)
|
||||
(if (and (or (cpad-pressed? 0 circle) (= (-> self condition) 4)) (send-event *target* 'change-mode 'racing self))
|
||||
(go-virtual pickup (the-as (state collectable) (method-of-object self wait-for-return)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(racer-effect)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
:post
|
||||
(the-as (function none :behavior racer) ja-post)
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(defstate pickup (racer)
|
||||
:virtual #t
|
||||
:event
|
||||
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
||||
(case arg2
|
||||
(('draw)
|
||||
(ja-channel-set! 1)
|
||||
(let ((v1-3 (-> self skel root-channel 0)))
|
||||
(set! (-> v1-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 3)))
|
||||
)
|
||||
(set! (-> self root-override root-prim prim-core action) (collide-action solid ca-11))
|
||||
(set! (-> self root-override root-prim prim-core offense) (collide-offense indestructible))
|
||||
(transform-post)
|
||||
)
|
||||
(('trans)
|
||||
(vector+! (the-as vector (-> arg3 param 0)) (-> self root-override trans) (-> self extra-trans))
|
||||
)
|
||||
(('touch 'attack)
|
||||
#f
|
||||
)
|
||||
(('shadow)
|
||||
(cond
|
||||
((-> arg3 param 0)
|
||||
(let ((v0-1 (the-as object (-> self shadow-backup))))
|
||||
(set! (-> self draw shadow) (the-as shadow-geo v0-1))
|
||||
v0-1
|
||||
)
|
||||
)
|
||||
(else
|
||||
(set! (-> self draw shadow) #f)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter
|
||||
(behavior ((arg0 (state collectable)))
|
||||
((the-as (function none :behavior racer) (-> arg0 enter)))
|
||||
(none)
|
||||
)
|
||||
:code
|
||||
(behavior ((arg0 (state collectable)))
|
||||
(ja-channel-set! 0)
|
||||
(ja-post)
|
||||
(while (zero? (ja-group-size))
|
||||
(when (or (not *target*)
|
||||
(< 24576.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans)))
|
||||
)
|
||||
(when (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9)))
|
||||
(case (-> (level-get-target-inside *level*) name)
|
||||
(('misty)
|
||||
(close-specific-task! (game-task misty-bike) (task-status need-reminder-a))
|
||||
(level-hint-spawn
|
||||
(game-text-id misty-racer-hit-the-ballon-lurkers)
|
||||
"sksp0062"
|
||||
(the-as entity #f)
|
||||
*entity-pool*
|
||||
(game-task none)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(go arg0)
|
||||
)
|
||||
(racer-effect)
|
||||
(suspend)
|
||||
)
|
||||
(while (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9)))
|
||||
(racer-effect)
|
||||
(suspend)
|
||||
)
|
||||
(let ((s5-0 (-> *display* base-frame-counter)))
|
||||
(until (>= (- (-> *display* base-frame-counter) s5-0) 300)
|
||||
(racer-effect)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
(go arg0)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(defstate wait-for-return (racer)
|
||||
:virtual #t
|
||||
:event
|
||||
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
||||
(if (and (or (= arg2 'touch) (= arg2 'attack)) (and (!= (-> self condition) 4) (send-event *target* 'end-mode)))
|
||||
(go-virtual pickup (the-as (state collectable) (method-of-object self idle)))
|
||||
)
|
||||
(the-as
|
||||
object
|
||||
(cond
|
||||
((= arg2 'trans)
|
||||
(vector+! (the-as vector (-> arg3 param 0)) (-> self root-override trans) (-> self extra-trans))
|
||||
)
|
||||
((= arg2 'shadow)
|
||||
(cond
|
||||
((-> arg3 param 0)
|
||||
(let ((v0-3 (the-as structure (-> self shadow-backup))))
|
||||
(set! (-> self draw shadow) (the-as shadow-geo v0-3))
|
||||
v0-3
|
||||
)
|
||||
)
|
||||
(else
|
||||
(set! (-> self draw shadow) #f)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(blocking-plane-destroy)
|
||||
(blocking-plane-spawn (the-as curve-control (-> self path-racer)))
|
||||
(none)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-channel-set! 0)
|
||||
(ja-post)
|
||||
(while #t
|
||||
(if (not (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9))))
|
||||
(go-virtual idle)
|
||||
)
|
||||
(racer-effect)
|
||||
(suspend)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 11 of type racer
|
||||
;; INFO: Return type mismatch object vs none.
|
||||
(defmethod init-from-entity! racer ((obj racer) (arg0 entity-actor))
|
||||
(let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
|
||||
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
|
||||
(set! (-> s4-0 reaction) default-collision-reaction)
|
||||
(set! (-> s4-0 no-reaction)
|
||||
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
||||
)
|
||||
(let ((s3-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0))))
|
||||
(set! (-> s3-0 prim-core collide-as) (collide-kind wall-object))
|
||||
(set! (-> s3-0 collide-with) (collide-kind target))
|
||||
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 6144.0)
|
||||
(set-root-prim! s4-0 s3-0)
|
||||
)
|
||||
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
|
||||
(backup-collide-with-as s4-0)
|
||||
(set! (-> obj root-override) s4-0)
|
||||
)
|
||||
(process-drawable-from-entity! obj arg0)
|
||||
(set-yaw-angle-clear-roll-pitch! (-> obj root-override) (res-lump-float arg0 'rotoffset))
|
||||
(initialize-skeleton obj *racer-sg* '())
|
||||
(set! (-> obj shadow-backup) (-> obj draw shadow))
|
||||
(set! (-> obj draw shadow-ctrl) *racer-shadow-control*)
|
||||
(let ((v1-23 (-> obj node-list data)))
|
||||
(set! (-> v1-23 0 param0) cspace<-transformq+trans!)
|
||||
(set! (-> v1-23 0 param1) (the-as basic (-> obj root-override trans)))
|
||||
(set! (-> v1-23 0 param2) (the-as basic (-> obj extra-trans)))
|
||||
)
|
||||
(set! (-> obj condition) (res-lump-value arg0 'index int))
|
||||
(set! (-> obj fact)
|
||||
(new 'process 'fact-info obj (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc))
|
||||
)
|
||||
(set! (-> obj part) (create-launch-control (-> *part-group-id-table* 115) obj))
|
||||
(dotimes (s5-1 2)
|
||||
(let ((v1-32 (new 'process 'curve-control obj 'path (the float (+ s5-1 1)))))
|
||||
(set! (-> obj path-data s5-1) v1-32)
|
||||
(if v1-32
|
||||
(logior! (-> v1-32 flags) (path-control-flag display draw-line draw-point draw-text))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> obj path) (-> obj path-target))
|
||||
(set-vector! (-> obj extra-trans) 0.0 6144.0 0.0 1.0)
|
||||
(set! (-> obj auto-get-off) #f)
|
||||
(move-to-ground (-> obj root-override) 40960.0 40960.0 #t (collide-kind background))
|
||||
(set! (-> obj cell) (the-as handle #f))
|
||||
(blocking-plane-spawn
|
||||
(the-as
|
||||
curve-control
|
||||
(if (or (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9)))
|
||||
(= (-> obj condition) 3)
|
||||
)
|
||||
(-> obj path-racer)
|
||||
(-> obj path-target)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> obj sound) (new
|
||||
'process
|
||||
'ambient-sound
|
||||
(new 'static 'sound-spec
|
||||
:mask #x80
|
||||
:num 1.0
|
||||
:group #x1
|
||||
:sound-name (static-sound-name "zoom-teleport")
|
||||
:volume #x400
|
||||
:fo-max 30
|
||||
)
|
||||
(-> obj root-override trans)
|
||||
)
|
||||
)
|
||||
(go (method-of-object obj wait-for-start))
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+9
-9
@@ -21,7 +21,7 @@
|
||||
:flag-assert #xb00000144
|
||||
(:methods
|
||||
(dummy-9 (_type_) symbol 9)
|
||||
(dummy-10 (_type_) symbol 10)
|
||||
(debug-draw (_type_) symbol 10)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
:flag-assert #xb00000810
|
||||
(:methods
|
||||
(debug-draw (_type_) object 9)
|
||||
(dummy-10 (_type_ collide-edge-hold-item) none 10)
|
||||
(add-to-list! (_type_ collide-edge-hold-item) none 10)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -172,17 +172,17 @@
|
||||
:size-assert #x2690
|
||||
:flag-assert #x1400002690
|
||||
(:methods
|
||||
(dummy-9 (_type_ collide-edge-hold-list) symbol 9)
|
||||
(search-for-edges (_type_ collide-edge-hold-list) symbol 9)
|
||||
(debug-draw-edges (_type_) object 10)
|
||||
(dummy-11 (_type_) none 11)
|
||||
(debug-draw-tris (_type_) none 11)
|
||||
(debug-draw-sphere (_type_) symbol 12)
|
||||
(dummy-13 (_type_ collide-edge-hold-item vector) none 13)
|
||||
(compute-center-point! (_type_ collide-edge-edge vector) float 13)
|
||||
(dummy-14 (_type_ vector vector int) float 14)
|
||||
(dummy-15 (_type_) none 15)
|
||||
(find-grabbable-edges! (_type_) none 15)
|
||||
(find-grabbable-tris! (_type_) none 16)
|
||||
(dummy-17 (_type_) none 17)
|
||||
(dummy-18 (_type_ collide-edge-hold-list edge-grab-info) none 18)
|
||||
(dummy-19 (_type_ collide-edge-hold-item edge-grab-info) symbol 19)
|
||||
(should-add-to-list? (_type_ collide-edge-hold-item collide-edge-edge) symbol 17)
|
||||
(find-best-grab! (_type_ collide-edge-hold-list edge-grab-info) symbol 18)
|
||||
(check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) symbol 19)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
+67
-1
@@ -921,7 +921,73 @@
|
||||
)
|
||||
|
||||
;; definition for method 19 of type process-drawable
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
;; WARN: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)]
|
||||
;; WARN: Unsupported inline assembly instruction kind - [jr ra]
|
||||
(defmethod dummy-19 process-drawable ((obj process-drawable))
|
||||
(local-vars (s7-0 none) (ra-0 int))
|
||||
(let ((gp-0 (-> obj skel)))
|
||||
(label cfg-1)
|
||||
(let ((s4-0 (-> gp-0 active-channels)))
|
||||
(b! (logtest? (-> obj draw status) (draw-status drwf01)) cfg-27 :delay (empty-form))
|
||||
(let ((s3-0 0))
|
||||
(b! #t cfg-13 :delay (nop!))
|
||||
(label cfg-3)
|
||||
(let ((s2-0 (-> gp-0 channel s3-0)))
|
||||
(let ((v1-7 (-> s2-0 command)))
|
||||
(b! (!= v1-7 'stack) cfg-6 :delay (nop!))
|
||||
(joint-control-channel-eval s2-0)
|
||||
(b! (!= s4-0 (-> gp-0 active-channels)) cfg-1 :delay (nop!))
|
||||
(b! #t cfg-12 :delay (nop!))
|
||||
(label cfg-6)
|
||||
(b! (!= v1-7 'stack1) cfg-9 :delay (nop!))
|
||||
)
|
||||
(joint-control-channel-eval s2-0)
|
||||
(b! (!= s4-0 (-> gp-0 active-channels)) cfg-1 :delay (nop!))
|
||||
(set! (-> gp-0 channel (+ s3-0 -1) frame-interp) (-> s2-0 frame-interp))
|
||||
(b! #t cfg-12 :delay (nop!))
|
||||
(label cfg-9)
|
||||
(let ((s1-0 (-> s2-0 frame-group)))
|
||||
(let ((v1-16 art-joint-anim))
|
||||
(b! (= (-> s1-0 type) v1-16) cfg-11 :delay (empty-form))
|
||||
)
|
||||
(go process-drawable-art-error "joint-anim")
|
||||
(.lw ra-0 return-from-thread s7-0)
|
||||
(.jr ra-0)
|
||||
(nop!)
|
||||
0
|
||||
(label cfg-11)
|
||||
(set! (-> s2-0 frame-num) (fmax 0.0 (fmin (-> s2-0 frame-num) (the float (+ (-> s1-0 data 0 length) -1)))))
|
||||
)
|
||||
)
|
||||
(label cfg-12)
|
||||
(+! s3-0 1)
|
||||
(label cfg-13)
|
||||
(b! (< s3-0 s4-0) cfg-3)
|
||||
)
|
||||
(dotimes (v1-26 s4-0)
|
||||
(set! (-> gp-0 channel v1-26 frame-interp) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-26 frame-interp))))
|
||||
)
|
||||
(if (or (zero? s4-0) (not (-> gp-0 root-channel 0 frame-group)))
|
||||
(logior! (-> obj draw status) (draw-status drwf02))
|
||||
)
|
||||
)
|
||||
(if (logtest? (-> obj skel status) 72)
|
||||
(merc-blend-shape obj)
|
||||
)
|
||||
(if (logtest? (-> obj skel status) 384)
|
||||
(merc-eye-anim obj)
|
||||
)
|
||||
(label cfg-27)
|
||||
(let ((a0-17 (-> gp-0 effect)))
|
||||
(if a0-17
|
||||
(TODO-RENAME-9 a0-17)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function ja-post
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
|
||||
+2
-2
@@ -1282,7 +1282,7 @@
|
||||
(send-event self 'end-mode)
|
||||
)
|
||||
(if *display-edge-collision-marks*
|
||||
(dummy-10 s5-0)
|
||||
(debug-draw s5-0)
|
||||
)
|
||||
(set! (-> self control ground-pat) (the-as pat-surface (-> s5-0 edge-tri-pat)))
|
||||
(vector-normalize!
|
||||
@@ -1341,7 +1341,7 @@
|
||||
(send-event self 'end-mode)
|
||||
)
|
||||
(if *display-edge-collision-marks*
|
||||
(dummy-10 gp-0)
|
||||
(debug-draw gp-0)
|
||||
)
|
||||
(vector-normalize!
|
||||
(vector-! (-> self control unknown-vector100) (the-as vector (-> gp-0 world-vertex)) (-> gp-0 world-vertex 1))
|
||||
|
||||
@@ -213,7 +213,9 @@
|
||||
|
||||
// not in use in PC port
|
||||
"tie-near-init-engine",
|
||||
"tie-near-end-buffer"
|
||||
"tie-near-end-buffer",
|
||||
|
||||
"(method 19 process-drawable)"
|
||||
],
|
||||
|
||||
"skip_compile_states": {
|
||||
|
||||
Reference in New Issue
Block a user