mirror of
https://github.com/open-goal/jak-project
synced 2026-07-01 04:10:32 -04:00
lights, death, and rotation fix (#2042)
- decompile `lights.gc` - decompile remaining `target-death` function, you can die now - fix float issue with `matrix-from-two-vectors-smooth!` making jak face the wrong way in the slide thing
This commit is contained in:
@@ -14127,8 +14127,8 @@
|
||||
(define-extern *default-lights* vu-lights)
|
||||
(define-extern vu-lights-default! (function vu-lights vu-lights))
|
||||
(define-extern init-light-hash (function none))
|
||||
(define-extern light-hash-count-items (function light-hash none))
|
||||
;; (define-extern light-hash-add-items function)
|
||||
(define-extern light-hash-count-items (function light-hash light-sphere none))
|
||||
(define-extern light-hash-add-items (function light-hash light-sphere integer object))
|
||||
(define-extern reset-light-hash (function light-hash none))
|
||||
(define-extern update-light-hash (function light-hash none))
|
||||
(define-extern lookup-light-sphere-by-name (function string light-hash light-sphere))
|
||||
|
||||
@@ -445,7 +445,20 @@
|
||||
"bones-mtx-calc-execute": [19, 7],
|
||||
"foreground-draw": [0, 1, 126],
|
||||
"dma-add-process-drawable": [0, 136],
|
||||
"(anon-function 3 ruins-obs)": [14]
|
||||
"(anon-function 3 ruins-obs)": [14],
|
||||
"(anon-function 0 target-death)": [
|
||||
50, // goto 52
|
||||
51, // goto L65
|
||||
63, // goto L47
|
||||
73, // goto L25
|
||||
78, // goto L46
|
||||
84, // goto L42
|
||||
95, // goto next
|
||||
96, // goto L36
|
||||
115, // goto L55
|
||||
121,
|
||||
131
|
||||
]
|
||||
},
|
||||
|
||||
// Sometimes the game might use format strings that are fetched dynamically,
|
||||
@@ -556,7 +569,11 @@
|
||||
"(method 10 collide-puss-work)",
|
||||
"bones-mtx-calc",
|
||||
"foreground-check-longest-edge-asm",
|
||||
"foreground-merc"
|
||||
"foreground-merc",
|
||||
"add-light-sphere-to-light-group",
|
||||
"light-hash-add-items",
|
||||
"light-hash-count-items",
|
||||
"light-hash-get-bucket-index"
|
||||
],
|
||||
|
||||
"mips2c_jump_table_functions": {},
|
||||
|
||||
@@ -196,7 +196,10 @@
|
||||
"FEB.DGO",
|
||||
|
||||
"LDJAKBRN.DGO",
|
||||
|
||||
// "HIDEOUT.DGO",
|
||||
"KIOSK.DGO",
|
||||
"DMI.DGO",
|
||||
"RUI.DGO",
|
||||
"VI1.DGO",
|
||||
"CIB.DGO",
|
||||
"FEB.DGO"
|
||||
|
||||
@@ -468,12 +468,17 @@
|
||||
],
|
||||
"sidekick": [["L71", "vector"]],
|
||||
"target-death": [
|
||||
["L441", "uint64", true],
|
||||
["L445", "uint64", true],
|
||||
["L447", "uint64", true],
|
||||
["L446", "uint64", true],
|
||||
["L440", "uint64", true],
|
||||
["L441", "uint64", true],
|
||||
["L442", "uint64", true],
|
||||
["L443", "uint64", true],
|
||||
["L444", "uint64", true],
|
||||
["L445", "uint64", true],
|
||||
["L446", "uint64", true],
|
||||
["L447", "uint64", true],
|
||||
["L448", "uint64", true],
|
||||
["L449", "uint64", true],
|
||||
["L450", "uint64", true],
|
||||
["L459", "uint64", true],
|
||||
["L436", "vector"]
|
||||
],
|
||||
|
||||
@@ -1214,5 +1214,10 @@
|
||||
"(method 25 turret-shot)": [[32, "vector"]],
|
||||
"check-drop-level-ruins-tower-userdata": [[16, "vector"]],
|
||||
"check-drop-level-ruins-tower-userdata-nosplat": [[16, "vector"]],
|
||||
"check-drop-level-ruins-rubble": [[16, "vector"]]
|
||||
"check-drop-level-ruins-rubble": [[16, "vector"]],
|
||||
"update-light-hash": [
|
||||
[16, "bounding-box"],
|
||||
[48, "vector"],
|
||||
[64, "vector"]
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5230,5 +5230,10 @@
|
||||
[39, "v1", "collide-shape-prim-group"]
|
||||
],
|
||||
"(event fall ruins-drop-plat)": [[10, "v1", "collide-shape-prim-group"]],
|
||||
"(post fall ruins-drop-plat)": [[20, "t9", "(function none)"]]
|
||||
"(post fall ruins-drop-plat)": [[20, "t9", "(function none)"]],
|
||||
"(code target-death)": [
|
||||
[467, "v1", "art-joint-anim"],
|
||||
[594, "v1", "art-joint-anim"],
|
||||
[852, "v1", "art-joint-anim"]
|
||||
]
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ set(RUNTIME_SOURCE
|
||||
mips2c/jak2_functions/font.cpp
|
||||
mips2c/jak2_functions/foreground.cpp
|
||||
mips2c/jak2_functions/joint.cpp
|
||||
mips2c/jak2_functions/lights.cpp
|
||||
mips2c/jak2_functions/sky.cpp
|
||||
mips2c/jak2_functions/sparticle.cpp
|
||||
mips2c/jak2_functions/sparticle_launcher.cpp
|
||||
|
||||
@@ -195,6 +195,9 @@ void OpenGLRenderer::init_bucket_renderers_jak2() {
|
||||
// 270
|
||||
init_bucket_renderer<TextureUploadHandler>("tex-l2-water", BucketCategory::TEX,
|
||||
BucketId::TEX_L2_WATER);
|
||||
init_bucket_renderer<Merc2>("merc-l2-water", BucketCategory::MERC, BucketId::MERC_L2_WATER);
|
||||
init_bucket_renderer<TextureUploadHandler>("tex-l3-water", BucketCategory::TEX,
|
||||
BucketId::TEX_L3_WATER);
|
||||
// 280
|
||||
// 290
|
||||
// 300
|
||||
|
||||
@@ -130,6 +130,8 @@ enum class BucketId {
|
||||
TEX_L1_WATER = 261,
|
||||
MERC_L1_WATER = 262,
|
||||
TEX_L2_WATER = 270,
|
||||
MERC_L2_WATER = 271,
|
||||
TEX_L3_WATER = 279,
|
||||
TEX_LCOM_WATER = 306,
|
||||
MERC_LCOM_WATER = 307,
|
||||
TEX_LCOM_SKY_POST = 309,
|
||||
|
||||
@@ -0,0 +1,762 @@
|
||||
//--------------------------MIPS2C---------------------
|
||||
// clang-format off
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak2/kscheme.h"
|
||||
using ::jak2::intern_from_c;
|
||||
namespace Mips2C::jak2 {
|
||||
namespace add_light_sphere_to_light_group {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
bool bc = false;
|
||||
u32 call_addr = 0;
|
||||
bool cop1_bc = false;
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf2, 0, a2); // lqc2 vf2, 0(a2)
|
||||
c->vmax_bc(DEST::xyzw, BC::w, vf1, vf0, vf0); // vmaxw.xyzw vf1, vf0, vf0
|
||||
c->lqc2(vf3, 16, a1); // lqc2 vf3, 16(a1)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf19, 0, a1); // lqc2 vf19, 0(a1)
|
||||
c->vsub(DEST::xyzw, vf4, vf3, vf2); // vsub.xyzw vf4, vf3, vf2
|
||||
c->lqc2(vf8, 16, a0); // lqc2 vf8, 16(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf9, 64, a0); // lqc2 vf9, 64(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf10, 112, a0); // lqc2 vf10, 112(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf11, 160, a0); // lqc2 vf11, 160(a0)
|
||||
c->vmul(DEST::xyzw, vf6, vf4, vf4); // vmul.xyzw vf6, vf4, vf4
|
||||
c->lqc2(vf5, 32, a1); // lqc2 vf5, 32(a1)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf25, 0, a0); // lqc2 vf25, 0(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf26, 48, a0); // lqc2 vf26, 48(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf27, 96, a0); // lqc2 vf27, 96(a0)
|
||||
c->vmula_bc(DEST::w, BC::x, vf0, vf6); // vmulax.w acc, vf0, vf6
|
||||
c->lqc2(vf15, 32, a0); // lqc2 vf15, 32(a0)
|
||||
c->vmadda_bc(DEST::w, BC::y, vf0, vf6); // vmadday.w acc, vf0, vf6
|
||||
c->lqc2(vf16, 80, a0); // lqc2 vf16, 80(a0)
|
||||
c->vmadd_bc(DEST::w, BC::z, vf6, vf0, vf6); // vmaddz.w vf6, vf0, vf6
|
||||
c->lqc2(vf17, 128, a0); // lqc2 vf17, 128(a0)
|
||||
c->vsqrt(vf6, BC::w); // vsqrt Q, vf6.w
|
||||
c->lqc2(vf18, 176, a0); // lqc2 vf18, 176(a0)
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf8, vf8, vf15); // vmulx.xyzw vf8, vf8, vf15
|
||||
c->lwc1(f2, 28, a1); // lwc1 f2, 28(a1)
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf9, vf9, vf16); // vmulx.xyzw vf9, vf9, vf16
|
||||
c->lwc1(f3, 4, a1); // lwc1 f3, 4(a1)
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf10, vf10, vf17); // vmulx.xyzw vf10, vf10, vf17
|
||||
c->lwc1(f4, 44, a1); // lwc1 f4, 44(a1)
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf11, vf11, vf18); // vmulx.xyzw vf11, vf11, vf18
|
||||
c->mov128_gpr_vf(v1, vf1); // qmfc2.i v1, vf1
|
||||
c->vsub_bc(DEST::w, BC::z, vf19, vf0, vf19); // vsubz.w vf19, vf0, vf19
|
||||
c->mtc1(f1, v1); // mtc1 f1, v1
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf25, vf25, vf15); // vmulx.xyzw vf25, vf25, vf15
|
||||
c->lwc1(f6, 12, a1); // lwc1 f6, 12(a1)
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf26, vf26, vf16); // vmulx.xyzw vf26, vf26, vf16
|
||||
c->lb(v1, 63, a1); // lb v1, 63(a1)
|
||||
c->subs(f7, f1, f3); // sub.s f7, f1, f3
|
||||
c->lqc2(vf21, 48, a1); // lqc2 vf21, 48(a1)
|
||||
c->vmul_bc(DEST::xyzw, BC::z, vf20, vf21, vf19); // vmulz.xyzw vf20, vf21, vf19
|
||||
c->dsll(a1, v1, 4); // dsll a1, v1, 4
|
||||
c->vmul_bc(DEST::xyzw, BC::w, vf21, vf21, vf19); // vmulw.xyzw vf21, vf21, vf19
|
||||
c->daddu(a1, a1, a3); // daddu a1, a1, a3
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf27, vf27, vf17); // vmulx.xyzw vf27, vf27, vf17
|
||||
c->lwc1(f9, 1660, a1); // lwc1 f9, 1660(a1)
|
||||
// nop // sll r0, r0, 0
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf7, vf1); // vmulq.xyzw vf7, vf1, Q
|
||||
c->mtc1(f0, r0); // mtc1 f0, r0
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(a3, vf15); // qmfc2.i a3, vf15
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(a2, vf16); // qmfc2.i a2, vf16
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(a1, vf17); // qmfc2.i a1, vf17
|
||||
c->vdiv(vf0, BC::w, vf7, BC::w); // vdiv Q, vf0.w, vf7.w
|
||||
c->mov128_gpr_vf(t0, vf7); // qmfc2.i t0, vf7
|
||||
// nop // sll r0, r0, 0
|
||||
c->mtc1(f5, t0); // mtc1 f5, t0
|
||||
cop1_bc = c->fprs[f2] < c->fprs[f5]; // c.lt.s f2, f5
|
||||
c->divs(f5, f5, f2); // div.s f5, f5, f2
|
||||
bc = cop1_bc; // bc1t L11
|
||||
cop1_bc = c->fprs[f4] == c->fprs[f0]; // c.eq.s f4, f0
|
||||
if (bc) {goto block_21;} // branch non-likely
|
||||
|
||||
bc = cop1_bc; // bc1t L2
|
||||
cop1_bc = c->fprs[f3] == c->fprs[f1]; // c.eq.s f3, f1
|
||||
if (bc) {goto block_3;} // branch non-likely
|
||||
|
||||
//beq r0, r0, L3 // beq r0, r0, L3
|
||||
c->vmove(DEST::xyzw, vf6, vf5); // vmove.xyzw vf6, vf5
|
||||
goto block_4; // branch always
|
||||
|
||||
|
||||
block_3:
|
||||
// nop // sll r0, r0, 0
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf6, vf4); // vmulq.xyzw vf6, vf4, Q
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
block_4:
|
||||
bc = cop1_bc; // bc1t L4
|
||||
c->subs(f8, f5, f3); // sub.s f8, f5, f3
|
||||
if (bc) {goto block_6;} // branch non-likely
|
||||
|
||||
c->maxs(f8, f8, f0); // max.s f8, f8, f0
|
||||
// nop // sll r0, r0, 0
|
||||
c->divs(f8, f8, f7); // div.s f8, f8, f7
|
||||
// nop // sll r0, r0, 0
|
||||
c->subs(f8, f1, f8); // sub.s f8, f1, f8
|
||||
// nop // sll r0, r0, 0
|
||||
c->muls(f6, f6, f8); // mul.s f6, f6, f8
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
block_6:
|
||||
bc = ((s64)c->sgpr64(v1)) < 0; // bltz v1, L5
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_8;} // branch non-likely
|
||||
|
||||
c->muls(f6, f6, f9); // mul.s f6, f6, f9
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
block_8:
|
||||
// nop // sll r0, r0, 0
|
||||
c->dsll32(v1, a3, 0); // dsll32 v1, a3, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->dsll32(a2, a2, 0); // dsll32 a2, a2, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->dsll32(a1, a1, 0); // dsll32 a1, a1, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->mfc1(a3, f6); // mfc1 a3, f6
|
||||
bc = c->sgpr64(a3) == 0; // beq a3, r0, L11
|
||||
c->mov128_vf_gpr(vf23, a3); // qmtc2.i vf23, a3
|
||||
if (bc) {goto block_21;} // branch non-likely
|
||||
|
||||
bc = c->sgpr64(v1) == 0; // beq v1, r0, L8
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf21, vf21, vf23); // vmulx.xyzw vf21, vf21, vf23
|
||||
if (bc) {goto block_18;} // branch non-likely
|
||||
|
||||
bc = c->sgpr64(a2) == 0; // beq a2, r0, L9
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_19;} // branch non-likely
|
||||
|
||||
bc = c->sgpr64(a1) == 0; // beq a1, r0, L10
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_20;} // branch non-likely
|
||||
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf15, vf15); // vmulax.xyzw acc, vf15, vf15
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadda_bc(DEST::xyzw, BC::x, vf16, vf16); // vmaddax.xyzw acc, vf16, vf16
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadd_bc(DEST::xyzw, BC::x, vf22, vf17, vf17); // vmaddx.xyzw vf22, vf17, vf17
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd(DEST::xyzw, vf11, vf11, vf21); // vadd.xyzw vf11, vf11, vf21
|
||||
c->swc1(f1, 176, a0); // swc1 f1, 176(a0)
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf20, vf20, vf23); // vmulx.xyzw vf20, vf20, vf23
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf6, vf6, vf23); // vmulx.xyzw vf6, vf6, vf23
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->vrsqrt(vf0, BC::w, vf22, BC::x); // vrsqrt Q, vf0.w, vf22.x
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf11, 160, a0); // sqc2 vf11, 160(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf15, vf15); // vmulq.xyzw vf15, vf15, Q
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmulq(DEST::xyzw, vf16, vf16); // vmulq.xyzw vf16, vf16, Q
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmulq(DEST::xyzw, vf17, vf17); // vmulq.xyzw vf17, vf17, Q
|
||||
// nop // sll r0, r0, 0
|
||||
c->vsub_bc(DEST::xyzw, BC::x, vf15, vf1, vf15); // vsubx.xyzw vf15, vf1, vf15
|
||||
// nop // sll r0, r0, 0
|
||||
c->vsub_bc(DEST::xyzw, BC::x, vf16, vf1, vf16); // vsubx.xyzw vf16, vf1, vf16
|
||||
// nop // sll r0, r0, 0
|
||||
c->vsub_bc(DEST::xyzw, BC::x, vf17, vf1, vf17); // vsubx.xyzw vf17, vf1, vf17
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf1, vf15); // vmulax.xyzw acc, vf1, vf15
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf16); // vmaddax.xyzw acc, vf1, vf16
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadd_bc(DEST::xyzw, BC::x, vf22, vf1, vf17); // vmaddx.xyzw vf22, vf1, vf17
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->vdiv(vf0, BC::w, vf22, BC::x); // vdiv Q, vf0.w, vf22.x
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf12, 32, a0); // lqc2 vf12, 32(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf13, 80, a0); // lqc2 vf13, 80(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf14, 128, a0); // lqc2 vf14, 128(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf15, vf15); // vmulq.xyzw vf15, vf15, Q
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmulq(DEST::xyzw, vf16, vf16); // vmulq.xyzw vf16, vf16, Q
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmulq(DEST::xyzw, vf17, vf17); // vmulq.xyzw vf17, vf17, Q
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmula(DEST::xyzw, vf1, vf25); // vmula.xyzw acc, vf1, vf25
|
||||
c->mov128_gpr_vf(a2, vf15); // qmfc2.i a2, vf15
|
||||
c->vmadd_bc(DEST::xyzw, BC::x, vf25, vf6, vf15); // vmaddx.xyzw vf25, vf6, vf15
|
||||
c->mov128_gpr_vf(a1, vf16); // qmfc2.i a1, vf16
|
||||
c->vmula(DEST::xyzw, vf1, vf26); // vmula.xyzw acc, vf1, vf26
|
||||
c->mov128_gpr_vf(v1, vf17); // qmfc2.i v1, vf17
|
||||
c->vmadd_bc(DEST::xyzw, BC::x, vf26, vf6, vf16); // vmaddx.xyzw vf26, vf6, vf16
|
||||
c->dsll32(a2, a2, 0); // dsll32 a2, a2, 0
|
||||
c->vmula(DEST::xyzw, vf1, vf27); // vmula.xyzw acc, vf1, vf27
|
||||
c->dsll32(a1, a1, 0); // dsll32 a1, a1, 0
|
||||
c->vmadd_bc(DEST::xyzw, BC::x, vf27, vf6, vf17); // vmaddx.xyzw vf27, vf6, vf17
|
||||
c->dsll32(v1, v1, 0); // dsll32 v1, v1, 0
|
||||
c->vmula(DEST::xyzw, vf1, vf8); // vmula.xyzw acc, vf1, vf8
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadd_bc(DEST::xyzw, BC::x, vf8, vf20, vf15); // vmaddx.xyzw vf8, vf20, vf15
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmula(DEST::xyzw, vf1, vf9); // vmula.xyzw acc, vf1, vf9
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadd_bc(DEST::xyzw, BC::x, vf9, vf20, vf16); // vmaddx.xyzw vf9, vf20, vf16
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmula(DEST::xyzw, vf1, vf10); // vmula.xyzw acc, vf1, vf10
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadd_bc(DEST::xyzw, BC::x, vf10, vf20, vf17); // vmaddx.xyzw vf10, vf20, vf17
|
||||
// nop // sll r0, r0, 0
|
||||
bc = c->sgpr64(a2) == 0; // beq a2, r0, L6
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_14;} // branch non-likely
|
||||
|
||||
c->vmul(DEST::xyzw, vf24, vf25, vf25); // vmul.xyzw vf24, vf25, vf25
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf15, vf15, vf23); // vmul.xyzw vf15, vf15, vf23
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf1, vf24); // vmulax.xyzw acc, vf1, vf24
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadda_bc(DEST::xyzw, BC::y, vf1, vf24); // vmadday.xyzw acc, vf1, vf24
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadd_bc(DEST::xyzw, BC::z, vf24, vf1, vf24); // vmaddz.xyzw vf24, vf1, vf24
|
||||
// nop // sll r0, r0, 0
|
||||
c->vrsqrt(vf0, BC::w, vf24, BC::x); // vrsqrt Q, vf0.w, vf24.x
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd(DEST::xyzw, vf15, vf15, vf12); // vadd.xyzw vf15, vf15, vf12
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(a2, vf15); // qmfc2.i a2, vf15
|
||||
// nop // sll r0, r0, 0
|
||||
c->mtc1(f10, a2); // mtc1 f10, a2
|
||||
c->divs(f10, f1, f10); // div.s f10, f1, f10
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->sw(a2, 32, a0); // sw a2, 32(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->mfc1(a2, f10); // mfc1 a2, f10
|
||||
// nop // sll r0, r0, 0
|
||||
c->mfc1(a2, f10); // mfc1 a2, f10
|
||||
c->mov128_vf_gpr(vf15, a2); // qmtc2.i vf15, a2
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf8, vf8, vf15); // vmulx.xyzw vf8, vf8, vf15
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf25, vf25); // vmulq.xyzw vf25, vf25, Q
|
||||
c->sqc2(vf8, 16, a0); // sqc2 vf8, 16(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf25, 0, a0); // sqc2 vf25, 0(a0)
|
||||
|
||||
block_14:
|
||||
bc = c->sgpr64(a1) == 0; // beq a1, r0, L7
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_16;} // branch non-likely
|
||||
|
||||
c->vmul(DEST::xyzw, vf24, vf26, vf26); // vmul.xyzw vf24, vf26, vf26
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf16, vf16, vf23); // vmul.xyzw vf16, vf16, vf23
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf1, vf24); // vmulax.xyzw acc, vf1, vf24
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadda_bc(DEST::xyzw, BC::y, vf1, vf24); // vmadday.xyzw acc, vf1, vf24
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadd_bc(DEST::xyzw, BC::z, vf24, vf1, vf24); // vmaddz.xyzw vf24, vf1, vf24
|
||||
// nop // sll r0, r0, 0
|
||||
c->vrsqrt(vf0, BC::w, vf24, BC::x); // vrsqrt Q, vf0.w, vf24.x
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd(DEST::xyzw, vf16, vf16, vf13); // vadd.xyzw vf16, vf16, vf13
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(a1, vf16); // qmfc2.i a1, vf16
|
||||
// nop // sll r0, r0, 0
|
||||
c->mtc1(f11, a1); // mtc1 f11, a1
|
||||
c->divs(f11, f1, f11); // div.s f11, f1, f11
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->sw(a1, 80, a0); // sw a1, 80(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->mfc1(a1, f11); // mfc1 a1, f11
|
||||
// nop // sll r0, r0, 0
|
||||
c->mfc1(a1, f11); // mfc1 a1, f11
|
||||
c->mov128_vf_gpr(vf16, a1); // qmtc2.i vf16, a1
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf9, vf9, vf16); // vmulx.xyzw vf9, vf9, vf16
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf26, vf26); // vmulq.xyzw vf26, vf26, Q
|
||||
c->sqc2(vf9, 64, a0); // sqc2 vf9, 64(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf26, 48, a0); // sqc2 vf26, 48(a0)
|
||||
|
||||
block_16:
|
||||
bc = c->sgpr64(v1) == 0; // beq v1, r0, L11
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_21;} // branch non-likely
|
||||
|
||||
c->vmul(DEST::xyzw, vf24, vf27, vf27); // vmul.xyzw vf24, vf27, vf27
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf17, vf17, vf23); // vmul.xyzw vf17, vf17, vf23
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf1, vf24); // vmulax.xyzw acc, vf1, vf24
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadda_bc(DEST::xyzw, BC::y, vf1, vf24); // vmadday.xyzw acc, vf1, vf24
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadd_bc(DEST::xyzw, BC::z, vf24, vf1, vf24); // vmaddz.xyzw vf24, vf1, vf24
|
||||
// nop // sll r0, r0, 0
|
||||
c->vrsqrt(vf0, BC::w, vf24, BC::x); // vrsqrt Q, vf0.w, vf24.x
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd(DEST::xyzw, vf17, vf17, vf14); // vadd.xyzw vf17, vf17, vf14
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(v1, vf17); // qmfc2.i v1, vf17
|
||||
// nop // sll r0, r0, 0
|
||||
c->mtc1(f12, v1); // mtc1 f12, v1
|
||||
c->divs(f12, f1, f12); // div.s f12, f1, f12
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->sw(v1, 128, a0); // sw v1, 128(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->mfc1(v1, f12); // mfc1 v1, f12
|
||||
// nop // sll r0, r0, 0
|
||||
c->mfc1(v1, f12); // mfc1 v1, f12
|
||||
c->mov128_vf_gpr(vf17, v1); // qmtc2.i vf17, v1
|
||||
c->vmul_bc(DEST::xyzw, BC::x, vf10, vf10, vf17); // vmulx.xyzw vf10, vf10, vf17
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf27, vf27); // vmulq.xyzw vf27, vf27, Q
|
||||
c->sqc2(vf10, 112, a0); // sqc2 vf10, 112(a0)
|
||||
//beq r0, r0, L11 // beq r0, r0, L11
|
||||
c->sqc2(vf27, 96, a0); // sqc2 vf27, 96(a0)
|
||||
goto block_21; // branch always
|
||||
|
||||
|
||||
block_18:
|
||||
c->vadd(DEST::xyzw, vf11, vf11, vf21); // vadd.xyzw vf11, vf11, vf21
|
||||
c->swc1(f1, 176, a0); // swc1 f1, 176(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf6, 0, a0); // sqc2 vf6, 0(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf20, 16, a0); // sqc2 vf20, 16(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->swc1(f6, 32, a0); // swc1 f6, 32(a0)
|
||||
//beq r0, r0, L11 // beq r0, r0, L11
|
||||
c->sqc2(vf11, 160, a0); // sqc2 vf11, 160(a0)
|
||||
goto block_21; // branch always
|
||||
|
||||
|
||||
block_19:
|
||||
c->vadd(DEST::xyzw, vf11, vf11, vf21); // vadd.xyzw vf11, vf11, vf21
|
||||
c->swc1(f1, 176, a0); // swc1 f1, 176(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf6, 48, a0); // sqc2 vf6, 48(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf20, 64, a0); // sqc2 vf20, 64(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->swc1(f6, 80, a0); // swc1 f6, 80(a0)
|
||||
//beq r0, r0, L11 // beq r0, r0, L11
|
||||
c->sqc2(vf11, 160, a0); // sqc2 vf11, 160(a0)
|
||||
goto block_21; // branch always
|
||||
|
||||
|
||||
block_20:
|
||||
c->vadd(DEST::xyzw, vf11, vf11, vf21); // vadd.xyzw vf11, vf11, vf21
|
||||
c->swc1(f1, 176, a0); // swc1 f1, 176(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf6, 96, a0); // sqc2 vf6, 96(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf20, 112, a0); // sqc2 vf20, 112(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->swc1(f6, 128, a0); // swc1 f6, 128(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf11, 160, a0); // sqc2 vf11, 160(a0)
|
||||
|
||||
block_21:
|
||||
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("add-light-sphere-to-light-group", execute, 256);
|
||||
}
|
||||
|
||||
} // namespace add_light_sphere_to_light_group
|
||||
} // namespace Mips2C
|
||||
|
||||
//--------------------------MIPS2C---------------------
|
||||
// clang-format off
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak2/kscheme.h"
|
||||
using ::jak2::intern_from_c;
|
||||
namespace Mips2C::jak2 {
|
||||
namespace light_hash_add_items {
|
||||
struct Cache {
|
||||
void* light_hash_work; // *light-hash-work*
|
||||
} cache;
|
||||
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
bool bc = false;
|
||||
u32 call_addr = 0;
|
||||
c->daddiu(sp, sp, -48); // daddiu sp, sp, -48
|
||||
c->sd(ra, 0, sp); // sd ra, 0(sp)
|
||||
c->daddiu(t0, sp, 16); // daddiu t0, sp, 16
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf2, 16, a1); // lqc2 vf2, 16(a1)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf1, 12, a0); // lqc2 vf1, 12(a0)
|
||||
c->vadd_bc(DEST::xyzw, BC::w, vf3, vf2, vf2); // vaddw.xyzw vf3, vf2, vf2
|
||||
c->lqc2(vf4, 28, a0); // lqc2 vf4, 28(a0)
|
||||
c->vsub_bc(DEST::xyzw, BC::w, vf2, vf2, vf2); // vsubw.xyzw vf2, vf2, vf2
|
||||
c->load_symbol2(a1, cache.light_hash_work); // lw a1, *light-hash-work*(s7)
|
||||
c->vsub(DEST::xyzw, vf2, vf2, vf1); // vsub.xyzw vf2, vf2, vf1
|
||||
c->lq(v1, 44, a0); // lq v1, 44(a0)
|
||||
c->vsub(DEST::xyzw, vf3, vf3, vf1); // vsub.xyzw vf3, vf3, vf1
|
||||
c->lq(a1, 0, a1); // lq a1, 0(a1)
|
||||
c->vmul(DEST::xyzw, vf2, vf2, vf4); // vmul.xyzw vf2, vf2, vf4
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf3, vf3, vf4); // vmul.xyzw vf3, vf3, vf4
|
||||
c->dsubu(v1, v1, a1); // dsubu v1, v1, a1
|
||||
c->vftoi0(DEST::xyzw, vf2, vf2); // vftoi0.xyzw vf2, vf2
|
||||
// nop // sll r0, r0, 0
|
||||
c->vftoi0(DEST::xyzw, vf3, vf3); // vftoi0.xyzw vf3, vf3
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(a3, vf2); // qmfc2.i a3, vf2
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(a1, vf3); // qmfc2.i a1, vf3
|
||||
c->pmaxw(a3, a3, r0); // pmaxw a3, a3, r0
|
||||
c->mfc1(r0, f31); // mfc1 r0, f31
|
||||
c->pmaxw(a1, a1, r0); // pmaxw a1, a1, r0
|
||||
c->mfc1(r0, f31); // mfc1 r0, f31
|
||||
c->pminw(a3, a3, v1); // pminw a3, a3, v1
|
||||
c->mfc1(r0, f31); // mfc1 r0, f31
|
||||
c->pminw(v1, a1, v1); // pminw v1, a1, v1
|
||||
c->mfc1(r0, f31); // mfc1 r0, f31
|
||||
// nop // sll r0, r0, 0
|
||||
c->sq(a3, 0, t0); // sq a3, 0(t0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sq(v1, 16, t0); // sq v1, 16(t0)
|
||||
c->addiu(v1, r0, 4); // addiu v1, r0, 4
|
||||
c->lw(a1, 44, a0); // lw a1, 44(a0)
|
||||
c->mult3(a1, a1, v1); // mult3 a1, a1, v1
|
||||
c->lw(a3, 52, a0); // lw a3, 52(a0)
|
||||
c->mult3(a3, a3, a1); // mult3 a3, a3, a1
|
||||
c->addiu(t1, r0, 1); // addiu t1, r0, 1
|
||||
c->lw(t2, 0, t0); // lw t2, 0(t0)
|
||||
c->dsubu(t1, t1, t2); // dsubu t1, t1, t2
|
||||
c->lw(t2, 16, t0); // lw t2, 16(t0)
|
||||
c->daddu(t1, t1, t2); // daddu t1, t1, t2
|
||||
c->addiu(t2, r0, 1); // addiu t2, r0, 1
|
||||
c->lw(t3, 4, t0); // lw t3, 4(t0)
|
||||
c->dsubu(t2, t2, t3); // dsubu t2, t2, t3
|
||||
c->lw(t3, 20, t0); // lw t3, 20(t0)
|
||||
c->daddu(t3, t2, t3); // daddu t3, t2, t3
|
||||
c->addiu(t2, r0, 1); // addiu t2, r0, 1
|
||||
c->lw(t4, 8, t0); // lw t4, 8(t0)
|
||||
c->dsubu(t2, t2, t4); // dsubu t2, t2, t4
|
||||
c->lw(t4, 24, t0); // lw t4, 24(t0)
|
||||
c->daddu(t2, t2, t4); // daddu t2, t2, t4
|
||||
c->lwu(t4, 60, a0); // lwu t4, 60(a0)
|
||||
c->lw(t5, 0, t0); // lw t5, 0(t0)
|
||||
c->mult3(t5, t5, v1); // mult3 t5, t5, v1
|
||||
c->lw(t6, 4, t0); // lw t6, 4(t0)
|
||||
c->mult3(t6, t6, a3); // mult3 t6, t6, a3
|
||||
c->daddu(t5, t5, t6); // daddu t5, t5, t6
|
||||
c->lw(t0, 8, t0); // lw t0, 8(t0)
|
||||
c->mult3(t0, t0, a1); // mult3 t0, t0, a1
|
||||
c->daddu(t0, t5, t0); // daddu t0, t5, t0
|
||||
c->daddu(t0, t4, t0); // daddu t0, t4, t0
|
||||
c->mov64(t3, t3); // or t3, t3, r0
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
block_1:
|
||||
c->mov64(t4, t2); // or t4, t2, r0
|
||||
c->mov64(t5, t0); // or t5, t0, r0
|
||||
|
||||
block_2:
|
||||
c->mov64(t6, t1); // or t6, t1, r0
|
||||
c->mov64(t7, t5); // or t7, t5, r0
|
||||
|
||||
block_3:
|
||||
// nop // sll r0, r0, 0
|
||||
c->lhu(ra, 0, t7); // lhu ra, 0(t7)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lhu(t9, 2, t7); // lhu t9, 2(t7)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lw(t8, 64, a0); // lw t8, 64(a0)
|
||||
c->daddu(ra, ra, t9); // daddu ra, ra, t9
|
||||
c->daddiu(t9, t9, 1); // daddiu t9, t9, 1
|
||||
c->daddu(t8, t8, ra); // daddu t8, t8, ra
|
||||
c->sh(t9, 2, t7); // sh t9, 2(t7)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sb(a2, 0, t8); // sb a2, 0(t8)
|
||||
c->daddiu(t6, t6, -1); // daddiu t6, t6, -1
|
||||
// nop // sll r0, r0, 0
|
||||
bc = c->sgpr64(t6) != 0; // bne t6, r0, L51
|
||||
c->daddu(t7, t7, v1); // daddu t7, t7, v1
|
||||
if (bc) {goto block_3;} // branch non-likely
|
||||
|
||||
c->daddiu(t4, t4, -1); // daddiu t4, t4, -1
|
||||
// nop // sll r0, r0, 0
|
||||
bc = c->sgpr64(t4) != 0; // bne t4, r0, L50
|
||||
c->daddu(t5, t5, a1); // daddu t5, t5, a1
|
||||
if (bc) {goto block_2;} // branch non-likely
|
||||
|
||||
c->daddiu(t3, t3, -1); // daddiu t3, t3, -1
|
||||
// nop // sll r0, r0, 0
|
||||
bc = c->sgpr64(t3) != 0; // bne t3, r0, L49
|
||||
c->daddu(t0, t0, a3); // daddu t0, t0, a3
|
||||
if (bc) {goto block_1;} // branch non-likely
|
||||
|
||||
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
|
||||
c->ld(ra, 0, sp); // ld ra, 0(sp)
|
||||
//jr ra // jr ra
|
||||
c->daddiu(sp, sp, 48); // daddiu sp, sp, 48
|
||||
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.light_hash_work = intern_from_c("*light-hash-work*").c();
|
||||
gLinkedFunctionTable.reg("light-hash-add-items", execute, 64);
|
||||
}
|
||||
|
||||
} // namespace light_hash_add_items
|
||||
} // namespace Mips2C
|
||||
|
||||
//--------------------------MIPS2C---------------------
|
||||
// clang-format off
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak2/kscheme.h"
|
||||
using ::jak2::intern_from_c;
|
||||
namespace Mips2C::jak2 {
|
||||
namespace light_hash_count_items {
|
||||
struct Cache {
|
||||
void* light_hash_work; // *light-hash-work*
|
||||
} cache;
|
||||
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
bool bc = false;
|
||||
u32 call_addr = 0;
|
||||
c->daddiu(sp, sp, -48); // daddiu sp, sp, -48
|
||||
c->daddiu(v1, sp, 16); // daddiu v1, sp, 16
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf2, 16, a1); // lqc2 vf2, 16(a1)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf1, 12, a0); // lqc2 vf1, 12(a0)
|
||||
c->vadd_bc(DEST::xyzw, BC::w, vf3, vf2, vf2); // vaddw.xyzw vf3, vf2, vf2
|
||||
c->lqc2(vf4, 28, a0); // lqc2 vf4, 28(a0)
|
||||
c->vsub_bc(DEST::xyzw, BC::w, vf2, vf2, vf2); // vsubw.xyzw vf2, vf2, vf2
|
||||
c->load_symbol2(a2, cache.light_hash_work); // lw a2, *light-hash-work*(s7)
|
||||
c->vsub(DEST::xyzw, vf2, vf2, vf1); // vsub.xyzw vf2, vf2, vf1
|
||||
c->lq(a1, 44, a0); // lq a1, 44(a0)
|
||||
c->vsub(DEST::xyzw, vf3, vf3, vf1); // vsub.xyzw vf3, vf3, vf1
|
||||
c->lq(a2, 0, a2); // lq a2, 0(a2)
|
||||
c->vmul(DEST::xyzw, vf2, vf2, vf4); // vmul.xyzw vf2, vf2, vf4
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf3, vf3, vf4); // vmul.xyzw vf3, vf3, vf4
|
||||
c->dsubu(a1, a1, a2); // dsubu a1, a1, a2
|
||||
c->vftoi0(DEST::xyzw, vf2, vf2); // vftoi0.xyzw vf2, vf2
|
||||
// nop // sll r0, r0, 0
|
||||
c->vftoi0(DEST::xyzw, vf3, vf3); // vftoi0.xyzw vf3, vf3
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(a3, vf2); // qmfc2.i a3, vf2
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(a2, vf3); // qmfc2.i a2, vf3
|
||||
c->pmaxw(a3, a3, r0); // pmaxw a3, a3, r0
|
||||
c->mfc1(r0, f31); // mfc1 r0, f31
|
||||
c->pmaxw(a2, a2, r0); // pmaxw a2, a2, r0
|
||||
c->mfc1(r0, f31); // mfc1 r0, f31
|
||||
c->pminw(a3, a3, a1); // pminw a3, a3, a1
|
||||
c->mfc1(r0, f31); // mfc1 r0, f31
|
||||
c->pminw(a1, a2, a1); // pminw a1, a2, a1
|
||||
c->mfc1(r0, f31); // mfc1 r0, f31
|
||||
// nop // sll r0, r0, 0
|
||||
c->sq(a3, 0, v1); // sq a3, 0(v1)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sq(a1, 16, v1); // sq a1, 16(v1)
|
||||
c->addiu(a1, r0, 4); // addiu a1, r0, 4
|
||||
c->lw(a2, 44, a0); // lw a2, 44(a0)
|
||||
c->mult3(a2, a2, a1); // mult3 a2, a2, a1
|
||||
c->lw(a3, 52, a0); // lw a3, 52(a0)
|
||||
c->mult3(a3, a3, a2); // mult3 a3, a3, a2
|
||||
c->addiu(t0, r0, 1); // addiu t0, r0, 1
|
||||
c->lw(t1, 0, v1); // lw t1, 0(v1)
|
||||
c->dsubu(t0, t0, t1); // dsubu t0, t0, t1
|
||||
c->lw(t1, 16, v1); // lw t1, 16(v1)
|
||||
c->daddu(t0, t0, t1); // daddu t0, t0, t1
|
||||
c->addiu(t1, r0, 1); // addiu t1, r0, 1
|
||||
c->lw(t2, 4, v1); // lw t2, 4(v1)
|
||||
c->dsubu(t1, t1, t2); // dsubu t1, t1, t2
|
||||
c->lw(t2, 20, v1); // lw t2, 20(v1)
|
||||
c->daddu(t2, t1, t2); // daddu t2, t1, t2
|
||||
c->addiu(t1, r0, 1); // addiu t1, r0, 1
|
||||
c->lw(t3, 8, v1); // lw t3, 8(v1)
|
||||
c->dsubu(t1, t1, t3); // dsubu t1, t1, t3
|
||||
c->lw(t3, 24, v1); // lw t3, 24(v1)
|
||||
c->daddu(t1, t1, t3); // daddu t1, t1, t3
|
||||
c->lwu(a0, 60, a0); // lwu a0, 60(a0)
|
||||
c->lw(t3, 0, v1); // lw t3, 0(v1)
|
||||
c->mult3(t3, t3, a1); // mult3 t3, t3, a1
|
||||
c->lw(t4, 4, v1); // lw t4, 4(v1)
|
||||
c->mult3(t4, t4, a3); // mult3 t4, t4, a3
|
||||
c->daddu(t3, t3, t4); // daddu t3, t3, t4
|
||||
c->lw(v1, 8, v1); // lw v1, 8(v1)
|
||||
c->mult3(v1, v1, a2); // mult3 v1, v1, a2
|
||||
c->daddu(v1, t3, v1); // daddu v1, t3, v1
|
||||
c->daddu(v1, a0, v1); // daddu v1, a0, v1
|
||||
c->mov64(a0, t2); // or a0, t2, r0
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
block_1:
|
||||
c->mov64(t2, t1); // or t2, t1, r0
|
||||
c->mov64(t3, v1); // or t3, v1, r0
|
||||
|
||||
block_2:
|
||||
c->mov64(t4, t0); // or t4, t0, r0
|
||||
c->mov64(t5, t3); // or t5, t3, r0
|
||||
|
||||
block_3:
|
||||
// nop // sll r0, r0, 0
|
||||
c->lhu(t6, 2, t5); // lhu t6, 2(t5)
|
||||
// nop // sll r0, r0, 0
|
||||
c->daddiu(t6, t6, 1); // daddiu t6, t6, 1
|
||||
// nop // sll r0, r0, 0
|
||||
c->sh(t6, 2, t5); // sh t6, 2(t5)
|
||||
c->daddiu(t4, t4, -1); // daddiu t4, t4, -1
|
||||
// nop // sll r0, r0, 0
|
||||
bc = c->sgpr64(t4) != 0; // bne t4, r0, L55
|
||||
c->daddu(t5, t5, a1); // daddu t5, t5, a1
|
||||
if (bc) {goto block_3;} // branch non-likely
|
||||
|
||||
c->daddiu(t2, t2, -1); // daddiu t2, t2, -1
|
||||
// nop // sll r0, r0, 0
|
||||
bc = c->sgpr64(t2) != 0; // bne t2, r0, L54
|
||||
c->daddu(t3, t3, a2); // daddu t3, t3, a2
|
||||
if (bc) {goto block_2;} // branch non-likely
|
||||
|
||||
c->daddiu(a0, a0, -1); // daddiu a0, a0, -1
|
||||
// nop // sll r0, r0, 0
|
||||
bc = c->sgpr64(a0) != 0; // bne a0, r0, L53
|
||||
c->daddu(v1, v1, a3); // daddu v1, v1, a3
|
||||
if (bc) {goto block_1;} // branch non-likely
|
||||
|
||||
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
|
||||
//jr ra // jr ra
|
||||
c->daddiu(sp, sp, 48); // daddiu sp, sp, 48
|
||||
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.light_hash_work = intern_from_c("*light-hash-work*").c();
|
||||
gLinkedFunctionTable.reg("light-hash-count-items", execute, 128);
|
||||
}
|
||||
|
||||
} // namespace light_hash_count_items
|
||||
} // namespace Mips2C
|
||||
|
||||
//--------------------------MIPS2C---------------------
|
||||
// clang-format off
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak2/kscheme.h"
|
||||
using ::jak2::intern_from_c;
|
||||
namespace Mips2C::jak2 {
|
||||
namespace light_hash_get_bucket_index {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
bool bc = false;
|
||||
u32 call_addr = 0;
|
||||
c->daddiu(sp, sp, -32); // daddiu sp, sp, -32
|
||||
c->daddiu(v1, sp, 16); // daddiu v1, sp, 16
|
||||
// nop // sll r0, r0, 0
|
||||
c->pceqw(a2, r0, r0); // pceqw a2, r0, r0
|
||||
c->lqc2(vf2, 0, a1); // lqc2 vf2, 0(a1)
|
||||
c->lqc2(vf1, 12, a0); // lqc2 vf1, 12(a0)
|
||||
c->lqc2(vf3, 28, a0); // lqc2 vf3, 28(a0)
|
||||
c->vsub(DEST::xyzw, vf2, vf2, vf1); // vsub.xyzw vf2, vf2, vf1
|
||||
c->lq(a3, 44, a0); // lq a3, 44(a0)
|
||||
c->vmul(DEST::xyzw, vf2, vf2, vf3); // vmul.xyzw vf2, vf2, vf3
|
||||
c->vftoi0(DEST::xyzw, vf2, vf2); // vftoi0.xyzw vf2, vf2
|
||||
c->mov128_gpr_vf(a1, vf2); // qmfc2.i a1, vf2
|
||||
c->paddw(a3, a3, a2); // paddw a3, a3, a2
|
||||
c->pcgtw(a2, r0, a1); // pcgtw a2, r0, a1
|
||||
c->pcgtw(a3, a1, a3); // pcgtw a3, a1, a3
|
||||
c->ppach(a2, r0, a2); // ppach a2, r0, a2
|
||||
c->ppach(a3, r0, a3); // ppach a3, r0, a3
|
||||
c->sq(a1, 0, v1); // sq a1, 0(v1)
|
||||
c->or_(a1, a2, a3); // or a1, a2, a3
|
||||
c->dsll(a1, a1, 16); // dsll a1, a1, 16
|
||||
bc = c->sgpr64(a1) != 0; // bne a1, r0, L13
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_2;} // branch non-likely
|
||||
|
||||
c->lw(a1, 0, v1); // lw a1, 0(v1)
|
||||
c->lw(a2, 4, v1); // lw a2, 4(v1)
|
||||
c->lbu(a3, 6, a0); // lbu a3, 6(a0)
|
||||
c->mult3(a2, a2, a3); // mult3 a2, a2, a3
|
||||
c->daddu(a1, a1, a2); // daddu a1, a1, a2
|
||||
c->lw(v1, 8, v1); // lw v1, 8(v1)
|
||||
c->lbu(a0, 7, a0); // lbu a0, 7(a0)
|
||||
c->mult3(v1, v1, a0); // mult3 v1, v1, a0
|
||||
c->daddu(v0, a1, v1); // daddu v0, a1, v1
|
||||
//beq r0, r0, L14 // beq r0, r0, L14
|
||||
// nop // sll r0, r0, 0
|
||||
goto block_3; // branch always
|
||||
|
||||
|
||||
block_2:
|
||||
c->addiu(v0, r0, -1); // addiu v0, r0, -1
|
||||
|
||||
block_3:
|
||||
//jr ra // jr ra
|
||||
c->daddiu(sp, sp, 32); // daddiu sp, sp, 32
|
||||
goto end_of_function; // return
|
||||
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
end_of_function:
|
||||
return c->gprs[v0].du64[0];
|
||||
}
|
||||
|
||||
void link() {
|
||||
gLinkedFunctionTable.reg("light-hash-get-bucket-index", execute, 128);
|
||||
}
|
||||
|
||||
} // namespace light_hash_get_bucket_index
|
||||
} // namespace Mips2C
|
||||
@@ -195,6 +195,11 @@ namespace method_10_collide_puss_work { extern void link(); }
|
||||
namespace bones_mtx_calc { extern void link(); }
|
||||
namespace foreground_check_longest_edge_asm { extern void link(); }
|
||||
namespace foreground_merc { extern void link(); }
|
||||
namespace add_light_sphere_to_light_group { extern void link(); }
|
||||
namespace light_hash_add_items { extern void link(); }
|
||||
namespace light_hash_count_items { extern void link(); }
|
||||
namespace light_hash_get_bucket_index { extern void link(); }
|
||||
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
@@ -270,61 +275,69 @@ PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2C
|
||||
jak1::draw_inline_array_prototype_tie_generic_asm::link}},
|
||||
{"generic-tie", {jak1::generic_tie_dma_to_spad_sync::link, jak1::generic_tie_convert::link}}},
|
||||
/////////// JAK 2
|
||||
{{"collide-func",
|
||||
{jak2::collide_do_primitives::link, jak2::moving_sphere_triangle_intersect::link}},
|
||||
{"joint", {jak2::calc_animation_from_spr::link, jak2::cspace_parented_transformq_joint::link}},
|
||||
{"font",
|
||||
{jak2::draw_string::link, jak2::get_string_length::link, jak2::draw_string_asm::link}},
|
||||
{"texture", {jak2::adgif_shader_texture_with_update::link}},
|
||||
{"debug",
|
||||
{jak2::debug_line_clip::link, jak2::init_boundary_regs::link,
|
||||
jak2::render_boundary_quad::link, jak2::render_boundary_tri::link, jak2::set_sky_vf27::link,
|
||||
jak2::draw_boundary_polygon::link}},
|
||||
{"sparticle-launcher",
|
||||
{jak2::sp_init_fields::link, jak2::particle_adgif::link, jak2::sp_launch_particles_var::link,
|
||||
jak2::sparticle_motion_blur::link}},
|
||||
{"sparticle", {jak2::sp_process_block_2d::link, jak2::sp_process_block_3d::link}},
|
||||
{"sky-tng",
|
||||
{jak2::set_tex_offset::link, jak2::draw_large_polygon::link, jak2::render_sky_quad::link,
|
||||
jak2::render_sky_tri::link, jak2::method_16_sky_work::link, jak2::method_17_sky_work::link,
|
||||
jak2::method_32_sky_work::link, jak2::method_33_sky_work::link,
|
||||
jak2::method_28_sky_work::link, jak2::method_29_sky_work::link,
|
||||
jak2::method_30_sky_work::link, jak2::set_sky_vf23_value::link}},
|
||||
{"collide-hash",
|
||||
{jak2::method_11_collide_hash::link, jak2::method_12_collide_hash::link,
|
||||
jak2::fill_bg_using_box_new::link, jak2::fill_bg_using_line_sphere_new::link}},
|
||||
{"collide-mesh",
|
||||
{jak2::method_12_collide_mesh::link, jak2::method_14_collide_mesh::link,
|
||||
jak2::method_15_collide_mesh::link}},
|
||||
{"collide-edge-grab",
|
||||
{jak2::method_10_collide_edge_hold_list::link, jak2::method_19_collide_edge_work::link,
|
||||
jak2::method_9_edge_grab_info::link, jak2::method_16_collide_edge_work::link,
|
||||
jak2::method_17_collide_edge_work::link, jak2::method_18_collide_edge_work::link}},
|
||||
{"ocean-vu0",
|
||||
{jak2::method_16_ocean::link, jak2::method_15_ocean::link, jak2::method_14_ocean::link}},
|
||||
{"ocean",
|
||||
{jak2::init_ocean_far_regs::link, jak2::draw_large_polygon_ocean::link,
|
||||
jak2::render_ocean_quad::link}},
|
||||
{"spatial-hash",
|
||||
{jak2::method_18_grid_hash::link, jak2::method_19_grid_hash::link,
|
||||
jak2::method_20_grid_hash::link, jak2::method_22_grid_hash::link,
|
||||
jak2::method_28_sphere_hash::link, jak2::method_33_sky_work::link,
|
||||
jak2::method_29_sphere_hash::link, jak2::method_30_sphere_hash::link,
|
||||
jak2::method_31_sphere_hash::link, jak2::method_32_sphere_hash::link,
|
||||
jak2::method_33_spatial_hash::link, jak2::method_39_spatial_hash::link,
|
||||
jak2::method_36_spatial_hash::link, jak2::method_37_spatial_hash::link,
|
||||
jak2::method_35_spatial_hash::link, jak2::method_33_sphere_hash::link}},
|
||||
{"collide-cache",
|
||||
{jak2::method_10_collide_shape_prim_mesh::link,
|
||||
jak2::method_10_collide_shape_prim_sphere::link,
|
||||
jak2::method_10_collide_shape_prim_group::link,
|
||||
jak2::method_11_collide_shape_prim_mesh::link,
|
||||
jak2::method_11_collide_shape_prim_sphere::link,
|
||||
jak2::method_11_collide_shape_prim_group::link, jak2::method_9_collide_cache_prim::link,
|
||||
jak2::method_10_collide_cache_prim::link, jak2::method_17_collide_cache::link,
|
||||
jak2::method_9_collide_puss_work::link, jak2::method_10_collide_puss_work::link}},
|
||||
{"bones", {jak2::bones_mtx_calc::link}},
|
||||
{"foreground", {jak2::foreground_check_longest_edge_asm::link, jak2::foreground_merc::link}}},
|
||||
{
|
||||
{"collide-func",
|
||||
{jak2::collide_do_primitives::link, jak2::moving_sphere_triangle_intersect::link}},
|
||||
{"joint",
|
||||
{jak2::calc_animation_from_spr::link, jak2::cspace_parented_transformq_joint::link}},
|
||||
{"font",
|
||||
{jak2::draw_string::link, jak2::get_string_length::link, jak2::draw_string_asm::link}},
|
||||
{"texture", {jak2::adgif_shader_texture_with_update::link}},
|
||||
{"debug",
|
||||
{jak2::debug_line_clip::link, jak2::init_boundary_regs::link,
|
||||
jak2::render_boundary_quad::link, jak2::render_boundary_tri::link,
|
||||
jak2::set_sky_vf27::link, jak2::draw_boundary_polygon::link}},
|
||||
{"sparticle-launcher",
|
||||
{jak2::sp_init_fields::link, jak2::particle_adgif::link,
|
||||
jak2::sp_launch_particles_var::link, jak2::sparticle_motion_blur::link}},
|
||||
{"sparticle", {jak2::sp_process_block_2d::link, jak2::sp_process_block_3d::link}},
|
||||
{"sky-tng",
|
||||
{jak2::set_tex_offset::link, jak2::draw_large_polygon::link, jak2::render_sky_quad::link,
|
||||
jak2::render_sky_tri::link, jak2::method_16_sky_work::link,
|
||||
jak2::method_17_sky_work::link, jak2::method_32_sky_work::link,
|
||||
jak2::method_33_sky_work::link, jak2::method_28_sky_work::link,
|
||||
jak2::method_29_sky_work::link, jak2::method_30_sky_work::link,
|
||||
jak2::set_sky_vf23_value::link}},
|
||||
{"collide-hash",
|
||||
{jak2::method_11_collide_hash::link, jak2::method_12_collide_hash::link,
|
||||
jak2::fill_bg_using_box_new::link, jak2::fill_bg_using_line_sphere_new::link}},
|
||||
{"collide-mesh",
|
||||
{jak2::method_12_collide_mesh::link, jak2::method_14_collide_mesh::link,
|
||||
jak2::method_15_collide_mesh::link}},
|
||||
{"collide-edge-grab",
|
||||
{jak2::method_10_collide_edge_hold_list::link, jak2::method_19_collide_edge_work::link,
|
||||
jak2::method_9_edge_grab_info::link, jak2::method_16_collide_edge_work::link,
|
||||
jak2::method_17_collide_edge_work::link, jak2::method_18_collide_edge_work::link}},
|
||||
{"ocean-vu0",
|
||||
{jak2::method_16_ocean::link, jak2::method_15_ocean::link, jak2::method_14_ocean::link}},
|
||||
{"ocean",
|
||||
{jak2::init_ocean_far_regs::link, jak2::draw_large_polygon_ocean::link,
|
||||
jak2::render_ocean_quad::link}},
|
||||
{"spatial-hash",
|
||||
{jak2::method_18_grid_hash::link, jak2::method_19_grid_hash::link,
|
||||
jak2::method_20_grid_hash::link, jak2::method_22_grid_hash::link,
|
||||
jak2::method_28_sphere_hash::link, jak2::method_33_sky_work::link,
|
||||
jak2::method_29_sphere_hash::link, jak2::method_30_sphere_hash::link,
|
||||
jak2::method_31_sphere_hash::link, jak2::method_32_sphere_hash::link,
|
||||
jak2::method_33_spatial_hash::link, jak2::method_39_spatial_hash::link,
|
||||
jak2::method_36_spatial_hash::link, jak2::method_37_spatial_hash::link,
|
||||
jak2::method_35_spatial_hash::link, jak2::method_33_sphere_hash::link}},
|
||||
{"collide-cache",
|
||||
{jak2::method_10_collide_shape_prim_mesh::link,
|
||||
jak2::method_10_collide_shape_prim_sphere::link,
|
||||
jak2::method_10_collide_shape_prim_group::link,
|
||||
jak2::method_11_collide_shape_prim_mesh::link,
|
||||
jak2::method_11_collide_shape_prim_sphere::link,
|
||||
jak2::method_11_collide_shape_prim_group::link, jak2::method_9_collide_cache_prim::link,
|
||||
jak2::method_10_collide_cache_prim::link, jak2::method_17_collide_cache::link,
|
||||
jak2::method_9_collide_puss_work::link, jak2::method_10_collide_puss_work::link}},
|
||||
{"bones", {jak2::bones_mtx_calc::link}},
|
||||
{"foreground",
|
||||
{jak2::foreground_check_longest_edge_asm::link, jak2::foreground_merc::link}},
|
||||
{"lights",
|
||||
{jak2::add_light_sphere_to_light_group::link, jak2::light_hash_add_items::link,
|
||||
jak2::light_hash_count_items::link, jak2::light_hash_get_bucket_index::link}},
|
||||
},
|
||||
};
|
||||
|
||||
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
|
||||
|
||||
@@ -544,6 +544,16 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; hack for the smoothed matrix from vectors to handle cases where they accidentally set turnvf to 0.
|
||||
;; this causes the smoothing to go away on ps2, due to some behavior of inf/nan that differ.
|
||||
;; if we cheat this to a small but nonzero value, it behaves like on ps2.
|
||||
(defmacro int-to-float-nonzero-hack (f)
|
||||
`(if (= ,f 0)
|
||||
0.00000000001
|
||||
(the float ,f)
|
||||
)
|
||||
)
|
||||
|
||||
(defun matrix-from-two-vectors-smooth! ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 float) (arg4 int))
|
||||
"This function can help smoothly rotate from a current heading vector to a target one.
|
||||
It returns a rotation to move arg1 closer to arg2, subject to two different speed limits.
|
||||
@@ -554,7 +564,7 @@
|
||||
(let* ((s5-1 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) arg2 arg1) 1.0))
|
||||
(f0-1 (vector-dot arg1 arg2))
|
||||
(f0-2 (acos f0-1))
|
||||
(f1-2 (fmin (* arg3 (-> pp clock seconds-per-frame)) (/ (* 5.0 (fabs f0-2)) (the float arg4))))
|
||||
(f1-2 (fmin (* arg3 (-> pp clock seconds-per-frame)) (/ (* 5.0 (fabs f0-2)) (int-to-float-nonzero-hack arg4))))
|
||||
(f30-0 (fmax (fmin f0-2 f1-2) (- f1-2)))
|
||||
)
|
||||
(matrix-axis-sin-cos! arg0 s5-1 (sin f30-0) (cos f30-0))
|
||||
@@ -570,7 +580,7 @@
|
||||
(let* ((s5-1 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) arg2 arg1) 1.0))
|
||||
(f0-1 (vector-dot arg1 arg2))
|
||||
(f0-3 (- (acos f0-1)))
|
||||
(f1-2 (fmin (* arg3 (-> pp clock seconds-per-frame)) (/ (* 5.0 (fabs f0-3)) (the float arg4))))
|
||||
(f1-2 (fmin (* arg3 (-> pp clock seconds-per-frame)) (/ (* 5.0 (fabs f0-3)) (int-to-float-nonzero-hack arg4))))
|
||||
(f30-0 (fmax (fmin f0-3 f1-2) (- f1-2)))
|
||||
)
|
||||
(matrix-axis-sin-cos! arg0 s5-1 (sin f30-0) (cos f30-0))
|
||||
|
||||
@@ -48,11 +48,141 @@
|
||||
arg0
|
||||
)
|
||||
|
||||
;; stub
|
||||
(defun light-hash-get-bucket-index ((arg0 light-hash) (arg1 vector))
|
||||
-1
|
||||
(defun-debug init-light-hash ()
|
||||
(when (not *light-hash*)
|
||||
(set! *light-hash* (new 'loading-level 'light-hash))
|
||||
(set! (-> *light-hash* num-lights) (the-as uint 0))
|
||||
(set! (-> *light-hash* num-indices) (the-as uint 0))
|
||||
(set! (-> *light-hash* num-buckets) (the-as uint 0))
|
||||
(set! (-> *light-hash* bucket-array) (the-as (inline-array light-hash-bucket) (malloc 'loading-level 4096)))
|
||||
(set! (-> *light-hash* index-array) (malloc 'loading-level #x10000))
|
||||
(set! (-> *light-hash* light-sphere-array)
|
||||
(the-as (inline-array light-sphere) (malloc 'loading-level #x4000))
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun add-light-sphere-to-light-group (arg0 arg1 arg2 arg3)
|
||||
(the object #f)
|
||||
(init-light-hash)
|
||||
|
||||
;; definition (debug) for function light-hash-count-items
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
(def-mips2c light-hash-count-items (function light-hash light-sphere none))
|
||||
|
||||
|
||||
;; definition (debug) for function light-hash-add-items
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
(def-mips2c light-hash-add-items (function light-hash light-sphere integer object))
|
||||
|
||||
|
||||
(defun-debug reset-light-hash ((arg0 light-hash))
|
||||
(set! (-> *light-hash* num-lights) (the-as uint 0))
|
||||
(set! (-> *light-hash* num-indices) (the-as uint 0))
|
||||
(set! (-> *light-hash* num-buckets) (the-as uint 0))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun-debug update-light-hash ((arg0 light-hash))
|
||||
(let ((v1-0 (new 'stack-no-clear 'bounding-box))
|
||||
(s5-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(let ((s4-0 (new 'stack-no-clear 'vector)))
|
||||
(let ((f0-0 0.0))
|
||||
(set-vector! (-> v1-0 min) 4095996000.0 4095996000.0 4095996000.0 1.0)
|
||||
(set-vector! (-> v1-0 max) -4095996000.0 -4095996000.0 -4095996000.0 1.0)
|
||||
(dotimes (a0-3 (the-as int (-> arg0 num-lights)))
|
||||
(let ((a1-9 (-> arg0 light-sphere-array a0-3)))
|
||||
(set! (-> v1-0 min x) (fmin (-> v1-0 min x) (- (-> a1-9 bsphere x) (-> a1-9 bsphere w))))
|
||||
(set! (-> v1-0 min y) (fmin (-> v1-0 min y) (- (-> a1-9 bsphere y) (-> a1-9 bsphere w))))
|
||||
(set! (-> v1-0 min z) (fmin (-> v1-0 min z) (- (-> a1-9 bsphere z) (-> a1-9 bsphere w))))
|
||||
(set! (-> v1-0 max x) (fmax (-> v1-0 max x) (+ (-> a1-9 bsphere x) (-> a1-9 bsphere w))))
|
||||
(set! (-> v1-0 max y) (fmax (-> v1-0 max y) (+ (-> a1-9 bsphere y) (-> a1-9 bsphere w))))
|
||||
(set! (-> v1-0 max z) (fmax (-> v1-0 max z) (+ (-> a1-9 bsphere z) (-> a1-9 bsphere w))))
|
||||
(+! f0-0 (-> a1-9 bsphere w))
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 base-trans quad) (-> v1-0 min quad))
|
||||
(let ((f0-1 (/ f0-0 (the float (-> arg0 num-lights)))))
|
||||
(dotimes (a0-8 3)
|
||||
(set! (-> s5-0 data a0-8) (- (-> v1-0 max data a0-8) (-> v1-0 min data a0-8)))
|
||||
(set! (-> s4-0 data a0-8) (if (= (-> s5-0 data a0-8) 0.0)
|
||||
1.0
|
||||
(/ (-> s5-0 data a0-8) (/ f0-1 (the float (-> arg0 num-lights))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f0-5 (cube-root (/ (the float (-> arg0 num-lights)) (* (-> s4-0 x) (-> s4-0 y) (-> s4-0 z))))))
|
||||
(set! (-> arg0 dimension-array x) (max 1 (min 16 (the int (+ 0.5 (* f0-5 (-> s4-0 x)))))))
|
||||
(set! (-> arg0 dimension-array y) (max 1 (min 4 (the int (+ 0.5 (* f0-5 (-> s4-0 y)))))))
|
||||
(set! (-> arg0 dimension-array z) (max 1 (min 16 (the int (+ 0.5 (* f0-5 (-> s4-0 z)))))))
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 bucket-step 0)
|
||||
(the-as uint (* (the-as int (-> arg0 dimension-array z)) (the-as int (-> arg0 dimension-array x))))
|
||||
)
|
||||
(set! (-> arg0 bucket-step 1) (the-as uint (-> arg0 dimension-array x)))
|
||||
(dotimes (v1-13 3)
|
||||
(set! (-> arg0 axis-scale data v1-13)
|
||||
(/ (the float (-> arg0 dimension-array data v1-13)) (-> s5-0 data v1-13))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 num-buckets)
|
||||
(the-as uint (* (* (the-as int (-> arg0 dimension-array x)) (the-as int (-> arg0 dimension-array y)))
|
||||
(the-as int (-> arg0 dimension-array z))
|
||||
)
|
||||
)
|
||||
)
|
||||
(dotimes (v1-19 (the-as int (-> arg0 num-buckets)))
|
||||
(let ((a0-27 (-> arg0 bucket-array v1-19)))
|
||||
(set! (-> a0-27 index) (the-as uint 0))
|
||||
(set! (-> a0-27 count) (the-as uint 0))
|
||||
)
|
||||
0
|
||||
)
|
||||
(dotimes (s5-1 (the-as int (-> arg0 num-lights)))
|
||||
(light-hash-count-items arg0 (-> arg0 light-sphere-array s5-1))
|
||||
)
|
||||
(let ((v1-26 0))
|
||||
(dotimes (a0-31 (the-as int (-> arg0 num-buckets)))
|
||||
(let ((a1-38 (-> arg0 bucket-array a0-31)))
|
||||
(set! (-> a1-38 index) (the-as uint v1-26))
|
||||
(+! v1-26 (-> a1-38 count))
|
||||
(set! (-> a1-38 count) (the-as uint 0))
|
||||
)
|
||||
0
|
||||
)
|
||||
(set! (-> arg0 num-indices) (the-as uint v1-26))
|
||||
)
|
||||
(dotimes (s5-2 (the-as int (-> arg0 num-lights)))
|
||||
(light-hash-add-items arg0 (-> arg0 light-sphere-array s5-2) s5-2)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun lookup-light-sphere-by-name ((arg0 string) (arg1 light-hash))
|
||||
(when (and arg1 (nonzero? arg1))
|
||||
(dotimes (s4-0 (the-as int (-> arg1 num-lights)))
|
||||
(let ((s3-0 (-> arg1 light-sphere-array s4-0)))
|
||||
(if (string= arg0 (-> s3-0 name))
|
||||
(return s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as light-sphere #f)
|
||||
)
|
||||
|
||||
(def-mips2c light-hash-get-bucket-index (function light-hash vector int))
|
||||
|
||||
;; definition for function add-light-sphere-to-light-group
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
(def-mips2c add-light-sphere-to-light-group (function object object object object object))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,15 +7,12 @@
|
||||
(define-extern start-sig-recorder (function none))
|
||||
(define-extern intro-play (function none))
|
||||
(define-extern find-nearest-entity (function vector type entity))
|
||||
|
||||
|
||||
;; DECOMP BEGINS
|
||||
(define-extern warp-gate type)
|
||||
|
||||
;; definition for symbol *auto-continue*, type symbol
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(define *auto-continue* #f)
|
||||
|
||||
;; definition for function next-continue
|
||||
;; WARN: Return type mismatch object vs continue-point.
|
||||
(defun next-continue ((arg0 continue-point))
|
||||
(let* ((v1-0 #f)
|
||||
@@ -44,7 +41,6 @@
|
||||
(the-as continue-point #f)
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(defstate target-continue (target)
|
||||
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
||||
(local-vars (v0-0 object))
|
||||
@@ -425,7 +421,6 @@
|
||||
:post target-no-move-post
|
||||
)
|
||||
|
||||
;; definition for symbol *smack-mods*, type surface
|
||||
(define *smack-mods* (new 'static 'surface
|
||||
:name 'jump
|
||||
:tiltv 32768.0
|
||||
@@ -469,7 +464,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for symbol *smack-up-mods*, type surface
|
||||
(define *smack-up-mods* (new 'static 'surface
|
||||
:name 'jump
|
||||
:turnv 131072.0
|
||||
@@ -517,8 +511,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function velocity-set-to-target!
|
||||
;; INFO: Used lq/sq
|
||||
(defbehavior velocity-set-to-target! target ((arg0 vector) (arg1 float) (arg2 attack-info))
|
||||
(let* ((v1-1 (-> self control trans))
|
||||
(gp-1 (vector-! (new 'stack-no-clear 'vector) arg0 v1-1))
|
||||
@@ -533,9 +525,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function target-hit-effect
|
||||
;; INFO: Used lq/sq
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defbehavior target-hit-effect target ((arg0 attack-info))
|
||||
(let ((s5-0 (get-process *default-dead-pool* part-tracker #x4000)))
|
||||
(when s5-0
|
||||
@@ -636,8 +625,6 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function target-hit-push
|
||||
;; INFO: Used lq/sq
|
||||
(defbehavior target-hit-push target ((arg0 vector) (arg1 matrix) (arg2 float) (arg3 float) (arg4 attack-info))
|
||||
(case (-> arg4 mode)
|
||||
(('shock 'shockup 'shock-red 'shock-green)
|
||||
@@ -744,7 +731,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function target-hit-orient
|
||||
(defbehavior target-hit-orient target ((arg0 attack-info) (arg1 vector))
|
||||
(let ((s5-0 #f))
|
||||
(if (and (!= (-> arg0 angle) 'front)
|
||||
@@ -780,7 +766,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function target-hit-setup-anim
|
||||
(defbehavior target-hit-setup-anim target ((arg0 attack-info))
|
||||
(let ((v1-0 (-> arg0 angle)))
|
||||
(cond
|
||||
@@ -888,9 +873,6 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function target-hit-move
|
||||
;; INFO: Used lq/sq
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defbehavior target-hit-move target ((arg0 attack-info) (arg1 symbol) (arg2 (function none :behavior target)) (arg3 float))
|
||||
(local-vars (v1-29 symbol) (s1-1 symbol))
|
||||
(vector-identity! (-> self control transv))
|
||||
@@ -941,7 +923,6 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(defstate target-hit (target)
|
||||
:event target-standard-event-handler
|
||||
:exit (behavior ()
|
||||
@@ -1295,7 +1276,6 @@
|
||||
:post target-post
|
||||
)
|
||||
|
||||
;; definition for symbol *death-spool-array*, type (array spool-anim)
|
||||
(define *death-spool-array*
|
||||
(new 'static 'boxed-array :type spool-anim
|
||||
(new 'static 'spool-anim :name "jak-death-1" :anim-name "jak-death-1" :parts 1 :command-list '())
|
||||
@@ -1306,7 +1286,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function death-movie-remap
|
||||
(defun death-movie-remap ((arg0 int) (arg1 int))
|
||||
(let ((v1-0 (/ arg0 arg1)))
|
||||
(mod
|
||||
@@ -1319,7 +1298,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; definition of type kill-nearby-enemies-info
|
||||
(deftype kill-nearby-enemies-info (basic)
|
||||
((dist float :offset-assert 4)
|
||||
(pos vector :inline :offset-assert 16)
|
||||
@@ -1329,24 +1307,9 @@
|
||||
:flag-assert #x900000020
|
||||
)
|
||||
|
||||
;; definition for method 3 of type kill-nearby-enemies-info
|
||||
(defmethod inspect kill-nearby-enemies-info ((obj kill-nearby-enemies-info))
|
||||
(when (not obj)
|
||||
(set! obj obj)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~1Tdist: ~f~%" (-> obj dist))
|
||||
(format #t "~1Tpos: #<vector @ #x~X>~%" (-> obj pos))
|
||||
(label cfg-4)
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition for symbol *kill-nearby-enemies-info*, type kill-nearby-enemies-info
|
||||
(define *kill-nearby-enemies-info* (new 'static 'kill-nearby-enemies-info))
|
||||
|
||||
;; definition for function kill-nearby-enemies
|
||||
;; INFO: Used lq/sq
|
||||
(defun kill-nearby-enemies ((arg0 vector) (arg1 float))
|
||||
(let ((v1-0 *kill-nearby-enemies-info*))
|
||||
(set! (-> v1-0 dist) arg1)
|
||||
@@ -1369,8 +1332,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function target-death-anim-trans
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defbehavior target-death-anim-trans target ()
|
||||
(send-event *camera* 'joystick 0 -1082130432)
|
||||
(compute-alignment! (-> self align))
|
||||
@@ -1384,8 +1345,6 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function target-death-anim
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defbehavior target-death-anim target ((arg0 spool-anim))
|
||||
(set! (-> self control mod-surface) *neutral-mods*)
|
||||
(set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags)))
|
||||
@@ -1412,8 +1371,6 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function target-death-main
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defbehavior target-death-main target ((arg0 symbol))
|
||||
(case arg0
|
||||
(('tar)
|
||||
@@ -1473,9 +1430,6 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function target-death-reset
|
||||
;; INFO: Used lq/sq
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defbehavior target-death-reset target ((arg0 symbol) (arg1 symbol))
|
||||
(let ((v1-1 (-> *task-manager-engine* alive-list next0)))
|
||||
*task-manager-engine*
|
||||
@@ -1535,7 +1489,6 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(defstate target-death (target)
|
||||
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
||||
(let ((v1-0 event-type))
|
||||
@@ -1610,14 +1563,582 @@
|
||||
)
|
||||
:trans (-> target-hit trans)
|
||||
:code (behavior ((arg0 symbol))
|
||||
(while #t
|
||||
(format 0 "no code~%")
|
||||
(set! (-> self control unknown-word04) (the-as uint #f))
|
||||
(set! (-> self control did-move-to-pole-or-max-jump-height)
|
||||
(the-as float (send-event (handle->process (-> self attack-info attacker)) 'target 'die arg0))
|
||||
)
|
||||
(set! (-> self neck flex-blend) 0.0)
|
||||
(set! (-> self control pat-ignore-mask)
|
||||
(logior (new 'static 'pat-surface :noendlessfall #x1) (-> self control pat-ignore-mask))
|
||||
)
|
||||
(target-timed-invulnerable-off self 0)
|
||||
(case arg0
|
||||
(('bot 'centipede)
|
||||
(set-setting! 'process-mask 'set 0 (process-mask platform projectile death))
|
||||
)
|
||||
(('endlessfall)
|
||||
(set-setting! 'process-mask 'set 0 (process-mask enemy projectile death))
|
||||
)
|
||||
(('instant-death 'lava 'dark-eco-pool 'melt 'explode 'grenade 'big-explosion 'turret)
|
||||
(set-setting! 'process-mask 'set 0 (process-mask enemy platform projectile death))
|
||||
)
|
||||
(else
|
||||
(let ((v1-21 (-> self water flags)))
|
||||
(if (or (and (logtest? (water-flags touch-water) v1-21)
|
||||
(logtest? (water-flags under-water swimming) v1-21)
|
||||
(zero? (logand (focus-status mech) (-> self focus-status)))
|
||||
)
|
||||
(= (-> self control cur-pat material) (pat-material waterbottom))
|
||||
)
|
||||
(set! arg0 'drown)
|
||||
)
|
||||
)
|
||||
(set-setting! 'process-mask 'set 0 (process-mask enemy platform projectile death))
|
||||
(when (using-gun? self)
|
||||
(send-event (ppointer->process (-> self gun gun)) 'die)
|
||||
(target-gun-end-mode #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(apply-settings *setting-control*)
|
||||
(set! (-> self control transv quad) (the-as uint128 0))
|
||||
(logior! (-> self focus-status) (focus-status dead))
|
||||
(set! (-> self state-flags) (logior (state-flags disable-attacks) (-> self state-flags)))
|
||||
(let ((v1-50 arg0))
|
||||
(b! (not (or (= v1-50 'none) (= v1-50 'instant-death))) cfg-52 :delay (nop!))
|
||||
(b! #t cfg-167 :delay (nop!))
|
||||
(label cfg-52)
|
||||
(b!
|
||||
(not (or (= v1-50 'lava)
|
||||
(= v1-50 'dark-eco-pool)
|
||||
(= v1-50 'melt)
|
||||
(= v1-50 'explode)
|
||||
(= v1-50 'grenade)
|
||||
(= v1-50 'big-explosion)
|
||||
)
|
||||
)
|
||||
cfg-132
|
||||
:delay (nop!)
|
||||
)
|
||||
(let ((s5-0 (handle->process (-> self attack-info attacker))))
|
||||
(when (if (type? s5-0 water-vol)
|
||||
s5-0
|
||||
)
|
||||
(logior! (-> self state-flags) (state-flags sf14))
|
||||
(set! (-> self alt-cam-pos y) (+ 4096.0 (-> self water height)))
|
||||
)
|
||||
)
|
||||
(set! (-> self control mod-surface) *neutral-mods*)
|
||||
(let ((v1-63 arg0))
|
||||
(b! (!= v1-63 'dark-eco-pool) cfg-79 :delay (empty-form))
|
||||
(sound-play "death-darkeco")
|
||||
(let ((s5-2 (get-process *default-dead-pool* part-tracker #x4000)))
|
||||
(when s5-2
|
||||
(let ((t9-14 (method-of-type part-tracker activate)))
|
||||
(t9-14
|
||||
(the-as part-tracker s5-2)
|
||||
*entity-pool*
|
||||
(symbol->string (-> part-tracker symbol))
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
(let ((t9-15 run-function-in-process)
|
||||
(a0-61 s5-2)
|
||||
(a1-27 part-tracker-init)
|
||||
(a2-10 (-> *part-group-id-table* 56))
|
||||
(a3-6 0)
|
||||
(t0-5 #f)
|
||||
(t1-5 #f)
|
||||
(t2-1 #f)
|
||||
(t3-0 *launch-matrix*)
|
||||
)
|
||||
(set! (-> t3-0 trans quad) (-> self control trans quad))
|
||||
((the-as (function object object object object object object object object none) t9-15)
|
||||
a0-61
|
||||
a1-27
|
||||
a2-10
|
||||
a3-6
|
||||
t0-5
|
||||
t1-5
|
||||
t2-1
|
||||
t3-0
|
||||
)
|
||||
)
|
||||
(-> s5-2 ppointer)
|
||||
)
|
||||
)
|
||||
(let ((v1-75 (-> self control root-prim)))
|
||||
(set! (-> v1-75 prim-core collide-as) (collide-spec))
|
||||
(set! (-> v1-75 prim-core collide-with) (collide-spec))
|
||||
)
|
||||
0
|
||||
(set! (-> self post-hook) target-no-ja-move-post)
|
||||
(ja-channel-set! 0)
|
||||
(ja-post)
|
||||
(let ((s5-3 (-> self clock frame-counter)))
|
||||
(until (>= (- (-> self clock frame-counter) s5-3) (seconds 2))
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
(b! #t cfg-131 :delay (nop!))
|
||||
(label cfg-79)
|
||||
(b! (not (or (= v1-63 'grenade) (= v1-63 'big-explosion) (= v1-63 'explode))) cfg-122 :delay (empty-form))
|
||||
(set! (-> self post-hook) target-no-stick-post)
|
||||
(set! (-> self control dynam gravity-max) 294912.0)
|
||||
(set! (-> self control dynam gravity-length) 294912.0)
|
||||
(vector-float*!
|
||||
(-> self control dynam gravity)
|
||||
(-> self control dynam gravity-normal)
|
||||
(the-as float (-> self control dynam gravity-length))
|
||||
)
|
||||
(case arg0
|
||||
(('big-explosion)
|
||||
(sound-play "jak-explode")
|
||||
)
|
||||
(else
|
||||
(sound-play "explosion")
|
||||
)
|
||||
)
|
||||
(let ((s5-6 (get-process *default-dead-pool* part-tracker #x4000)))
|
||||
(when s5-6
|
||||
(let ((t9-23 (method-of-type part-tracker activate)))
|
||||
(t9-23
|
||||
(the-as part-tracker s5-6)
|
||||
*entity-pool*
|
||||
(symbol->string (-> part-tracker symbol))
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
(let ((t9-24 run-function-in-process)
|
||||
(a0-80 s5-6)
|
||||
(a1-36 part-tracker-init)
|
||||
(a2-17 (-> *part-group-id-table* 58))
|
||||
(a3-10 0)
|
||||
(t0-8 #f)
|
||||
(t1-8 #f)
|
||||
(t2-4 #f)
|
||||
(t3-1 *launch-matrix*)
|
||||
)
|
||||
(set! (-> t3-1 trans quad) (-> self control trans quad))
|
||||
((the-as (function object object object object object object object object none) t9-24)
|
||||
a0-80
|
||||
a1-36
|
||||
a2-17
|
||||
a3-10
|
||||
t0-8
|
||||
t1-8
|
||||
t2-4
|
||||
t3-1
|
||||
)
|
||||
)
|
||||
(-> s5-6 ppointer)
|
||||
)
|
||||
)
|
||||
(set-vector! (-> self control transv) 0.0 65502.96 0.0 1.0)
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja-no-eval :group! (-> self draw art-group data 66)
|
||||
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 66)) frames num-frames) -1)))
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(b!
|
||||
(not (and (logtest? (-> self control status) (collide-status on-surface))
|
||||
(>= 409.6 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))
|
||||
)
|
||||
)
|
||||
cfg-98
|
||||
:delay (empty-form)
|
||||
)
|
||||
(b! #t cfg-106 :delay (nop!))
|
||||
(the-as none 0)
|
||||
(label cfg-98)
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
(while (not (or (logtest? (-> self control status) (collide-status on-surface))
|
||||
(>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2))
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
(label cfg-106)
|
||||
(when (logtest? (-> self control status) (collide-status on-surface))
|
||||
(let ((v1-159 (-> self water flags)))
|
||||
(b!
|
||||
(or (and (logtest? (water-flags touch-water) v1-159)
|
||||
(logtest? (water-flags under-water swimming) v1-159)
|
||||
(zero? (logand (focus-status mech) (-> self focus-status)))
|
||||
)
|
||||
(= (-> self control cur-pat material) (pat-material waterbottom))
|
||||
)
|
||||
cfg-149
|
||||
:delay (nop!)
|
||||
)
|
||||
)
|
||||
(set! (-> self post-hook) target-no-move-post)
|
||||
(let ((v1-171 (-> self control root-prim)))
|
||||
(set! (-> v1-171 prim-core collide-as) (collide-spec))
|
||||
(set! (-> v1-171 prim-core collide-with) (collide-spec))
|
||||
)
|
||||
0
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja-no-eval :group! (-> self draw art-group data 70)
|
||||
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 70)) frames num-frames) -1)))
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(set! (-> self control transv quad) (the-as uint128 0))
|
||||
(vector-seek!
|
||||
(-> self draw color-mult)
|
||||
(new 'static 'vector :x 0.5 :y 0.5 :z 0.5 :w 1.0)
|
||||
(* 5.0 (-> self clock seconds-per-frame))
|
||||
)
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
(let ((s5-7 (-> self clock frame-counter)))
|
||||
(until (>= (- (-> self clock frame-counter) s5-7) (seconds 2))
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
(b! #t cfg-131 :delay (nop!))
|
||||
(label cfg-122)
|
||||
(when (or (= v1-63 'lava) (= v1-63 'melt))
|
||||
(sound-play "death-melt")
|
||||
(let ((s5-9 (get-process *default-dead-pool* part-tracker #x4000)))
|
||||
(when s5-9
|
||||
(let ((t9-37 (method-of-type part-tracker activate)))
|
||||
(t9-37
|
||||
(the-as part-tracker s5-9)
|
||||
*entity-pool*
|
||||
(symbol->string (-> part-tracker symbol))
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
(let ((t9-38 run-function-in-process)
|
||||
(a0-107 s5-9)
|
||||
(a1-49 part-tracker-init)
|
||||
(a2-28 (-> *part-group-id-table* 57))
|
||||
(a3-13 0)
|
||||
(t0-10 #f)
|
||||
(t1-10 #f)
|
||||
(t2-6 #f)
|
||||
(t3-2 *launch-matrix*)
|
||||
)
|
||||
(set! (-> t3-2 trans quad) (-> self control trans quad))
|
||||
((the-as (function object object object object object object object object none) t9-38)
|
||||
a0-107
|
||||
a1-49
|
||||
a2-28
|
||||
a3-13
|
||||
t0-10
|
||||
t1-10
|
||||
t2-6
|
||||
t3-2
|
||||
)
|
||||
)
|
||||
(-> s5-9 ppointer)
|
||||
)
|
||||
)
|
||||
(let ((v1-219 (-> self control root-prim)))
|
||||
(set! (-> v1-219 prim-core collide-as) (collide-spec))
|
||||
(set! (-> v1-219 prim-core collide-with) (collide-spec))
|
||||
)
|
||||
0
|
||||
(set! (-> self post-hook) target-no-ja-move-post)
|
||||
(ja-channel-set! 0)
|
||||
(ja-post)
|
||||
(let ((s5-10 (-> self clock frame-counter)))
|
||||
(until (>= (- (-> self clock frame-counter) s5-10) (seconds 2))
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(label cfg-131)
|
||||
(b! #t cfg-167 :delay (nop!))
|
||||
(label cfg-132)
|
||||
(cond
|
||||
((= v1-50 'turret)
|
||||
(let ((v1-228 (-> self control root-prim)))
|
||||
(set! (-> v1-228 prim-core collide-as) (collide-spec))
|
||||
(set! (-> v1-228 prim-core collide-with) (collide-spec))
|
||||
)
|
||||
0
|
||||
(set! (-> self post-hook) target-no-ja-move-post)
|
||||
(ja-channel-set! 0)
|
||||
(ja-post)
|
||||
(let ((s5-11 (-> self clock frame-counter)))
|
||||
(until (>= (- (-> self clock frame-counter) s5-11) (seconds 1.2))
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-50 'endlessfall)
|
||||
((lambda :behavior target
|
||||
()
|
||||
(local-vars (v1-24 symbol))
|
||||
(sound-play "death-fall")
|
||||
(set! (-> self control unknown-sound-id00)
|
||||
(gui-control-method-9 *gui-control* *target* (gui-channel daxter) (gui-action play) "jakfall" -99.0 0)
|
||||
)
|
||||
(gui-control-method-20 *gui-control* (-> self control unknown-sound-id00) #t -1 100 2)
|
||||
(set-setting! 'mode-name 'cam-endlessfall 0 0)
|
||||
(logclear! (-> self water flags) (water-flags swim-ground))
|
||||
(let ((f0-1 (fmin -4096.0 (- (-> self control ground-impact-vel)))))
|
||||
(set! (-> self control unknown-word04) (the-as uint f0-1))
|
||||
(let ((v1-13 (new-stack-vector0)))
|
||||
(let ((f1-3 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))))
|
||||
0.0
|
||||
(vector-! v1-13 (-> self control transv) (vector-float*! v1-13 (-> self control dynam gravity-normal) f1-3))
|
||||
)
|
||||
(let* ((f1-4 (vector-length v1-13))
|
||||
(f2-1 f1-4)
|
||||
)
|
||||
(vector+!
|
||||
(-> self control transv)
|
||||
(vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-1)
|
||||
(vector-float*! v1-13 v1-13 (/ f1-4 f2-1))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (and (logtest? (-> self control status) (collide-status on-surface)) (!= (-> self control cur-pat event) 2))
|
||||
(set! v1-24 'target-hit-ground-hard)
|
||||
(goto cfg-17)
|
||||
)
|
||||
(target-falling-anim 30 (seconds 0.33))
|
||||
(ja-channel-push! 1 (seconds 0.3))
|
||||
(ja-no-eval :group! (-> self draw art-group data 32) :num! (loop! 0.5) :frame-num 0.0)
|
||||
(let ((gp-1 (-> self clock frame-counter)))
|
||||
(until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.8))
|
||||
(when (and (logtest? (-> self control status) (collide-status on-surface)) (!= (-> self control cur-pat event) 2))
|
||||
(set! v1-24 'target-hit-ground-hard)
|
||||
(goto cfg-17)
|
||||
)
|
||||
(vector-seek! (-> self draw color-mult) *zero-vector* (-> self clock seconds-per-frame))
|
||||
(let ((v1-49 (new-stack-vector0))
|
||||
(f0-7 (the-as number (vector-dot (-> self control dynam gravity-normal) (-> self control transv))))
|
||||
)
|
||||
0.0
|
||||
(vector-!
|
||||
v1-49
|
||||
(-> self control transv)
|
||||
(vector-float*! v1-49 (-> self control dynam gravity-normal) (the-as float f0-7))
|
||||
)
|
||||
(let* ((f1-7 (vector-length v1-49))
|
||||
(f2-2 f1-7)
|
||||
)
|
||||
(if (< (the-as float (-> self control unknown-word04)) (the-as float f0-7))
|
||||
(set! f0-7 (-> self control unknown-word04))
|
||||
)
|
||||
(vector+!
|
||||
(-> self control transv)
|
||||
(vector-float*! (-> self control transv) (-> self control dynam gravity-normal) (the-as float f0-7))
|
||||
(vector-float*! v1-49 v1-49 (/ f1-7 f2-2))
|
||||
)
|
||||
)
|
||||
)
|
||||
(ja :group! (-> self draw art-group data 32) :num! (loop! 0.5))
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
(set! v1-24 #f)
|
||||
(label cfg-17)
|
||||
(when (= v1-24 'target-hit-ground-hard)
|
||||
(set! (-> self control mod-surface) *neutral-mods*)
|
||||
(set! (-> self post-hook) target-no-move-post)
|
||||
(set! (-> self control transv quad) (the-as uint128 0))
|
||||
(ja-channel-push! 1 (seconds 0.05))
|
||||
(ja-no-eval :group! (-> self draw art-group data 70)
|
||||
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 70)) frames num-frames) -1)))
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(vector-seek! (-> self draw color-mult) *identity-vector* (-> self clock seconds-per-frame))
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
(let ((gp-2 (-> self clock frame-counter)))
|
||||
(until (>= (- (-> self clock frame-counter) gp-2) (seconds 2))
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
(remove-setting! 'mode-name)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
)
|
||||
((or (= v1-50 'burn) (= v1-50 'burnup))
|
||||
(let ((s5-12 (get-process *default-dead-pool* part-tracker #x4000)))
|
||||
(when s5-12
|
||||
(let ((t9-45 (method-of-type part-tracker activate)))
|
||||
(t9-45
|
||||
(the-as part-tracker s5-12)
|
||||
*entity-pool*
|
||||
(symbol->string (-> part-tracker symbol))
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
(let ((t9-46 run-function-in-process)
|
||||
(a0-118 s5-12)
|
||||
(a1-53 part-tracker-init)
|
||||
(a2-33 (-> *part-group-id-table* 59))
|
||||
(a3-15 0)
|
||||
(t0-11 #f)
|
||||
(t1-11 #f)
|
||||
(t2-7 #f)
|
||||
(t3-3 *launch-matrix*)
|
||||
)
|
||||
(set! (-> t3-3 trans quad) (-> self control trans quad))
|
||||
((the-as (function object object object object object object object object none) t9-46)
|
||||
a0-118
|
||||
a1-53
|
||||
a2-33
|
||||
a3-15
|
||||
t0-11
|
||||
t1-11
|
||||
t2-7
|
||||
t3-3
|
||||
)
|
||||
)
|
||||
(-> s5-12 ppointer)
|
||||
)
|
||||
)
|
||||
(target-death-anim (the-as spool-anim #f))
|
||||
)
|
||||
((or (= v1-50 'drown) (= v1-50 'drown-death))
|
||||
(label cfg-149)
|
||||
((lambda :behavior target
|
||||
()
|
||||
(logior! (-> self state-flags) (state-flags sf14))
|
||||
(set! (-> self alt-cam-pos y) (+ -8192.0 (-> self water height)))
|
||||
(sound-play "death-drown")
|
||||
(logclear! (-> self water flags) (water-flags swim-ground))
|
||||
(set! (-> self control mod-surface) *dive-mods*)
|
||||
(set! (-> self control dynam gravity-max) 6144.0)
|
||||
(set! (-> self control dynam gravity-length) 6144.0)
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja-no-eval :group! (-> self draw art-group data 89)
|
||||
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 89)) frames num-frames) -1)))
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(if (< (+ -10240.0 (-> self water height)) (-> self control trans y))
|
||||
(seek!
|
||||
(-> self control trans y)
|
||||
(+ -10240.0 (-> self water height))
|
||||
(* 81920.0 (-> self clock seconds-per-frame))
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
(dotimes (gp-1 1)
|
||||
(ja-no-eval :group! (-> self draw art-group data 90)
|
||||
:num! (seek!
|
||||
(the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 90)) frames num-frames) -1))
|
||||
0.75
|
||||
)
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! max 0.75))
|
||||
)
|
||||
)
|
||||
(ja-no-eval :group! (-> self draw art-group data 91)
|
||||
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 91)) frames num-frames) -1)) 0.5)
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! max 0.5))
|
||||
)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
((or (= v1-50 'target-hit-ground-hard) (= v1-50 'smush))
|
||||
(set! (-> self control mod-surface) *neutral-mods*)
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja-no-eval :group! (-> self draw art-group data 70)
|
||||
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 70)) frames num-frames) -1)))
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
(let ((s5-13 (-> self clock frame-counter)))
|
||||
(until (>= (- (-> self clock frame-counter) s5-13) (seconds 2))
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-50 'centipede)
|
||||
(set! (-> self trans-hook) #f)
|
||||
(set! (-> self control mod-surface) *neutral-mods*)
|
||||
(set! (-> self post-hook) target-no-move-post)
|
||||
(ja-channel-push! 1 (seconds 0.075))
|
||||
(ja :group! (-> self draw art-group data 67) :num! min)
|
||||
(while (not (-> self control unknown-spool-anim00))
|
||||
(suspend)
|
||||
(ja :num! (loop!))
|
||||
)
|
||||
)
|
||||
((= v1-50 'bot)
|
||||
((lambda :behavior target
|
||||
()
|
||||
(set! (-> self trans-hook) #f)
|
||||
(let ((gp-0 0))
|
||||
(while (not (logtest? (-> self control status) (collide-status on-surface)))
|
||||
(target-falling-anim-trans)
|
||||
(+! gp-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter)))
|
||||
(if (-> self control unknown-spool-anim00)
|
||||
(return #f)
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
(if (or (> gp-0 0) (let ((v1-14 (ja-group)))
|
||||
(and v1-14 (or (= v1-14 (-> self draw art-group data 23))
|
||||
(= v1-14 (-> self draw art-group data 27))
|
||||
(= v1-14 (-> self draw art-group data 30))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(target-hit-ground-anim #f (are-still?))
|
||||
)
|
||||
)
|
||||
(target-stance-push 1)
|
||||
(until #f
|
||||
(ja-no-eval :group! (-> self draw art-group data 5)
|
||||
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 5)) frames num-frames) -1)))
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(if (-> self control unknown-spool-anim00)
|
||||
(return #f)
|
||||
)
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(target-death-main arg0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(label cfg-167)
|
||||
(target-death-reset arg0 #f)
|
||||
(none)
|
||||
)
|
||||
:post target-no-stick-post
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1722,8 +1722,8 @@
|
||||
"levels/common/enemy/hover/wasp.gc"
|
||||
"levels/common/enemy/hover/crimson-guard-hover.gc"
|
||||
"levels/common/enemy/hover/flamer.gc"
|
||||
"levels/drill_platform/target-turret-shot.gc"
|
||||
"levels/drill_platform/target-turret.gc"
|
||||
"engine/target/target-turret-shot.gc"
|
||||
"engine/target/target-turret.gc"
|
||||
"levels/drill_platform/drill-turret.gc"
|
||||
"levels/drill_platform/drillmid-obs.gc"
|
||||
"levels/drill_platform/drill-part.gc"
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
;; WARN: Return type mismatch object vs none.
|
||||
(defmethod init-from-entity! hide-door-b ((obj hide-door-b) (arg0 entity-actor))
|
||||
(stack-size-set! (-> obj main-thread) 1024)
|
||||
(let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player))))
|
||||
(set! (-> s5-0 penetrated-by) (penetrate))
|
||||
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0)))
|
||||
|
||||
+193
@@ -0,0 +1,193 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for symbol *light-hash-work*, type light-hash-work
|
||||
(define *light-hash-work* (new 'static 'light-hash-work :ones (new 'static 'vector4w :x 1 :y 1 :z 1)))
|
||||
|
||||
;; definition for function light-slerp
|
||||
(defun light-slerp ((arg0 light) (arg1 light) (arg2 light) (arg3 float))
|
||||
(let ((s3-0 (fmax 0.0 (fmin 1.0 arg3))))
|
||||
(vector-lerp! (-> arg0 color) (-> arg1 color) (-> arg2 color) s3-0)
|
||||
(vector-deg-slerp (-> arg0 direction) (-> arg1 direction) (-> arg2 direction) s3-0)
|
||||
(let ((f0-2 (-> arg1 extra x))
|
||||
(f1-2 (-> arg2 extra x))
|
||||
)
|
||||
(set! (-> arg0 extra x) (+ f0-2 (* s3-0 (- f1-2 f0-2))))
|
||||
)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
;; definition for function light-group-slerp
|
||||
(defun light-group-slerp ((arg0 light-group) (arg1 light-group) (arg2 light-group) (arg3 float))
|
||||
(dotimes (s2-0 4)
|
||||
(light-slerp (-> arg0 lights s2-0) (-> arg1 lights s2-0) (-> arg2 lights s2-0) arg3)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
;; definition for function light-group-process!
|
||||
(defun light-group-process! ((arg0 vu-lights) (arg1 light-group) (arg2 vector) (arg3 vector))
|
||||
(rotate-y<-vector+vector arg3 arg2)
|
||||
(vu-lights<-light-group! arg0 arg1)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for symbol *default-lights*, type vu-lights
|
||||
(define *default-lights* (new 'global 'vu-lights))
|
||||
|
||||
;; definition for function vu-lights-default!
|
||||
(defun vu-lights-default! ((arg0 vu-lights))
|
||||
(set-vector! (-> arg0 ambient) 0.3 0.3 0.3 1.0)
|
||||
(set-vector! (-> arg0 color 0) 1.0 1.0 1.0 1.0)
|
||||
(set-vector! (-> arg0 color 1) 0.2 0.2 0.2 1.0)
|
||||
(set-vector! (-> arg0 color 2) 0.0 0.0 0.0 1.0)
|
||||
(set-vector! (-> arg0 direction 0) 1.0 0.0 0.0 1.0)
|
||||
(set-vector! (-> arg0 direction 1) 0.0 1.0 0.0 1.0)
|
||||
(set-vector! (-> arg0 direction 2) 0.0 0.0 1.0 1.0)
|
||||
arg0
|
||||
)
|
||||
|
||||
;; definition (debug) for function init-light-hash
|
||||
;; WARN: Return type mismatch pointer vs none.
|
||||
(defun-debug init-light-hash ()
|
||||
(when (not *light-hash*)
|
||||
(set! *light-hash* (new 'loading-level 'light-hash))
|
||||
(set! (-> *light-hash* num-lights) (the-as uint 0))
|
||||
(set! (-> *light-hash* num-indices) (the-as uint 0))
|
||||
(set! (-> *light-hash* num-buckets) (the-as uint 0))
|
||||
(set! (-> *light-hash* bucket-array) (the-as (inline-array light-hash-bucket) (malloc 'loading-level 4096)))
|
||||
(set! (-> *light-hash* index-array) (malloc 'loading-level #x10000))
|
||||
(set! (-> *light-hash* light-sphere-array)
|
||||
(the-as (inline-array light-sphere) (malloc 'loading-level #x4000))
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(init-light-hash)
|
||||
|
||||
;; definition (debug) for function light-hash-count-items
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
;; definition (debug) for function light-hash-add-items
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
;; definition (debug) for function reset-light-hash
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defun-debug reset-light-hash ((arg0 light-hash))
|
||||
(set! (-> *light-hash* num-lights) (the-as uint 0))
|
||||
(set! (-> *light-hash* num-indices) (the-as uint 0))
|
||||
(set! (-> *light-hash* num-buckets) (the-as uint 0))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition (debug) for function update-light-hash
|
||||
;; INFO: Used lq/sq
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defun-debug update-light-hash ((arg0 light-hash))
|
||||
(let ((v1-0 (new 'stack-no-clear 'bounding-box))
|
||||
(s5-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(let ((s4-0 (new 'stack-no-clear 'vector)))
|
||||
(let ((f0-0 0.0))
|
||||
(set-vector! (-> v1-0 min) 4095996000.0 4095996000.0 4095996000.0 1.0)
|
||||
(set-vector! (-> v1-0 max) -4095996000.0 -4095996000.0 -4095996000.0 1.0)
|
||||
(dotimes (a0-3 (the-as int (-> arg0 num-lights)))
|
||||
(let ((a1-9 (-> arg0 light-sphere-array a0-3)))
|
||||
(set! (-> v1-0 min x) (fmin (-> v1-0 min x) (- (-> a1-9 bsphere x) (-> a1-9 bsphere w))))
|
||||
(set! (-> v1-0 min y) (fmin (-> v1-0 min y) (- (-> a1-9 bsphere y) (-> a1-9 bsphere w))))
|
||||
(set! (-> v1-0 min z) (fmin (-> v1-0 min z) (- (-> a1-9 bsphere z) (-> a1-9 bsphere w))))
|
||||
(set! (-> v1-0 max x) (fmax (-> v1-0 max x) (+ (-> a1-9 bsphere x) (-> a1-9 bsphere w))))
|
||||
(set! (-> v1-0 max y) (fmax (-> v1-0 max y) (+ (-> a1-9 bsphere y) (-> a1-9 bsphere w))))
|
||||
(set! (-> v1-0 max z) (fmax (-> v1-0 max z) (+ (-> a1-9 bsphere z) (-> a1-9 bsphere w))))
|
||||
(+! f0-0 (-> a1-9 bsphere w))
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 base-trans quad) (-> v1-0 min quad))
|
||||
(let ((f0-1 (/ f0-0 (the float (-> arg0 num-lights)))))
|
||||
(dotimes (a0-8 3)
|
||||
(set! (-> s5-0 data a0-8) (- (-> v1-0 max data a0-8) (-> v1-0 min data a0-8)))
|
||||
(set! (-> s4-0 data a0-8) (if (= (-> s5-0 data a0-8) 0.0)
|
||||
1.0
|
||||
(/ (-> s5-0 data a0-8) (/ f0-1 (the float (-> arg0 num-lights))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f0-5 (cube-root (/ (the float (-> arg0 num-lights)) (* (-> s4-0 x) (-> s4-0 y) (-> s4-0 z))))))
|
||||
(set! (-> arg0 dimension-array x) (max 1 (min 16 (the int (+ 0.5 (* f0-5 (-> s4-0 x)))))))
|
||||
(set! (-> arg0 dimension-array y) (max 1 (min 4 (the int (+ 0.5 (* f0-5 (-> s4-0 y)))))))
|
||||
(set! (-> arg0 dimension-array z) (max 1 (min 16 (the int (+ 0.5 (* f0-5 (-> s4-0 z)))))))
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 bucket-step 0)
|
||||
(the-as uint (* (the-as int (-> arg0 dimension-array z)) (the-as int (-> arg0 dimension-array x))))
|
||||
)
|
||||
(set! (-> arg0 bucket-step 1) (the-as uint (-> arg0 dimension-array x)))
|
||||
(dotimes (v1-13 3)
|
||||
(set! (-> arg0 axis-scale data v1-13)
|
||||
(/ (the float (-> arg0 dimension-array data v1-13)) (-> s5-0 data v1-13))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 num-buckets)
|
||||
(the-as uint (* (* (the-as int (-> arg0 dimension-array x)) (the-as int (-> arg0 dimension-array y)))
|
||||
(the-as int (-> arg0 dimension-array z))
|
||||
)
|
||||
)
|
||||
)
|
||||
(dotimes (v1-19 (the-as int (-> arg0 num-buckets)))
|
||||
(let ((a0-27 (-> arg0 bucket-array v1-19)))
|
||||
(set! (-> a0-27 index) (the-as uint 0))
|
||||
(set! (-> a0-27 count) (the-as uint 0))
|
||||
)
|
||||
0
|
||||
)
|
||||
(dotimes (s5-1 (the-as int (-> arg0 num-lights)))
|
||||
(light-hash-count-items arg0 (-> arg0 light-sphere-array s5-1))
|
||||
)
|
||||
(let ((v1-26 0))
|
||||
(dotimes (a0-31 (the-as int (-> arg0 num-buckets)))
|
||||
(let ((a1-38 (-> arg0 bucket-array a0-31)))
|
||||
(set! (-> a1-38 index) (the-as uint v1-26))
|
||||
(+! v1-26 (-> a1-38 count))
|
||||
(set! (-> a1-38 count) (the-as uint 0))
|
||||
)
|
||||
0
|
||||
)
|
||||
(set! (-> arg0 num-indices) (the-as uint v1-26))
|
||||
)
|
||||
(dotimes (s5-2 (the-as int (-> arg0 num-lights)))
|
||||
(light-hash-add-items arg0 (-> arg0 light-sphere-array s5-2) s5-2)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function lookup-light-sphere-by-name
|
||||
(defun lookup-light-sphere-by-name ((arg0 string) (arg1 light-hash))
|
||||
(when (and arg1 (nonzero? arg1))
|
||||
(dotimes (s4-0 (the-as int (-> arg1 num-lights)))
|
||||
(let ((s3-0 (-> arg1 light-sphere-array s4-0)))
|
||||
(if (string= arg0 (-> s3-0 name))
|
||||
(return s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as light-sphere #f)
|
||||
)
|
||||
|
||||
;; definition for function light-hash-get-bucket-index
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
;; definition for function add-light-sphere-to-light-group
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user