diff --git a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/DemoGj_Destroy.s b/asm/non_matchings/overlays/actors/ovl_Demo_Gj/DemoGj_Destroy.s deleted file mode 100644 index 93c28d593b..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/DemoGj_Destroy.s +++ /dev/null @@ -1,16 +0,0 @@ -glabel DemoGj_Destroy -/* 0015C 80978A8C 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00160 80978A90 AFBF0014 */ sw $ra, 0x0014($sp) -/* 00164 80978A94 AFA40018 */ sw $a0, 0x0018($sp) -/* 00168 80978A98 0C25E276 */ jal func_809789D8 -/* 0016C 80978A9C AFA5001C */ sw $a1, 0x001C($sp) -/* 00170 80978AA0 8FA4001C */ lw $a0, 0x001C($sp) -/* 00174 80978AA4 8FAE0018 */ lw $t6, 0x0018($sp) -/* 00178 80978AA8 24850810 */ addiu $a1, $a0, 0x0810 ## $a1 = 00000810 -/* 0017C 80978AAC 0C00FB56 */ jal DynaPoly_DeleteBgActor - ## DynaPoly_DeleteBgActor -/* 00180 80978AB0 8DC6014C */ lw $a2, 0x014C($t6) ## 0000014C -/* 00184 80978AB4 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00188 80978AB8 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 0018C 80978ABC 03E00008 */ jr $ra -/* 00190 80978AC0 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978930.s b/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978930.s deleted file mode 100644 index 020c0674c8..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978930.s +++ /dev/null @@ -1,5 +0,0 @@ -glabel func_80978930 -/* 00000 80978930 8483001C */ lh $v1, 0x001C($a0) ## 0000001C -/* 00004 80978934 00031AC3 */ sra $v1, $v1, 11 -/* 00008 80978938 03E00008 */ jr $ra -/* 0000C 8097893C 3062001F */ andi $v0, $v1, 0x001F ## $v0 = 00000000 diff --git a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978940.s b/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978940.s deleted file mode 100644 index 7abfd1c609..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978940.s +++ /dev/null @@ -1,5 +0,0 @@ -glabel func_80978940 -/* 00010 80978940 8483001C */ lh $v1, 0x001C($a0) ## 0000001C -/* 00014 80978944 00031A03 */ sra $v1, $v1, 8 -/* 00018 80978948 03E00008 */ jr $ra -/* 0001C 8097894C 30620007 */ andi $v0, $v1, 0x0007 ## $v0 = 00000000 diff --git a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978950.s b/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978950.s deleted file mode 100644 index 146d2d0182..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978950.s +++ /dev/null @@ -1,4 +0,0 @@ -glabel func_80978950 -/* 00020 80978950 8483001C */ lh $v1, 0x001C($a0) ## 0000001C -/* 00024 80978954 03E00008 */ jr $ra -/* 00028 80978958 306200FF */ andi $v0, $v1, 0x00FF ## $v0 = 00000000 diff --git a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_8097895C.s b/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_8097895C.s deleted file mode 100644 index 9a87f698c1..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_8097895C.s +++ /dev/null @@ -1,20 +0,0 @@ -glabel func_8097895C -/* 0002C 8097895C 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00030 80978960 AFA40018 */ sw $a0, 0x0018($sp) -/* 00034 80978964 AFBF0014 */ sw $ra, 0x0014($sp) -/* 00038 80978968 AFA5001C */ sw $a1, 0x001C($sp) -/* 0003C 8097896C 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00040 80978970 AFA60020 */ sw $a2, 0x0020($sp) -/* 00044 80978974 AFA70024 */ sw $a3, 0x0024($sp) -/* 00048 80978978 0C0170D9 */ jal Collider_InitCylinder - -/* 0004C 8097897C 00C02825 */ or $a1, $a2, $zero ## $a1 = 00000000 -/* 00050 80978980 8FA4001C */ lw $a0, 0x001C($sp) -/* 00054 80978984 8FA50020 */ lw $a1, 0x0020($sp) -/* 00058 80978988 8FA60018 */ lw $a2, 0x0018($sp) -/* 0005C 8097898C 0C017114 */ jal Collider_SetCylinderType1 -/* 00060 80978990 8FA70024 */ lw $a3, 0x0024($sp) -/* 00064 80978994 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00068 80978998 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 0006C 8097899C 03E00008 */ jr $ra -/* 00070 809789A0 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_809789D8.s b/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_809789D8.s deleted file mode 100644 index 681c2e70d6..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_809789D8.s +++ /dev/null @@ -1,57 +0,0 @@ -glabel func_809789D8 -/* 000A8 809789D8 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0 -/* 000AC 809789DC AFBF001C */ sw $ra, 0x001C($sp) -/* 000B0 809789E0 AFB10018 */ sw $s1, 0x0018($sp) -/* 000B4 809789E4 AFB00014 */ sw $s0, 0x0014($sp) -/* 000B8 809789E8 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 000BC 809789EC 0C25E254 */ jal func_80978950 -/* 000C0 809789F0 00A08825 */ or $s1, $a1, $zero ## $s1 = 00000000 -/* 000C4 809789F4 24010010 */ addiu $at, $zero, 0x0010 ## $at = 00000010 -/* 000C8 809789F8 10410009 */ beq $v0, $at, .L80978A20 -/* 000CC 809789FC 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 000D0 80978A00 24010011 */ addiu $at, $zero, 0x0011 ## $at = 00000011 -/* 000D4 80978A04 10410010 */ beq $v0, $at, .L80978A48 -/* 000D8 80978A08 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 000DC 80978A0C 24010016 */ addiu $at, $zero, 0x0016 ## $at = 00000016 -/* 000E0 80978A10 10410017 */ beq $v0, $at, .L80978A70 -/* 000E4 80978A14 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 000E8 80978A18 10000018 */ beq $zero, $zero, .L80978A7C -/* 000EC 80978A1C 8FBF001C */ lw $ra, 0x001C($sp) -.L80978A20: -/* 000F0 80978A20 0C0170EB */ jal Collider_DestroyCylinder - -/* 000F4 80978A24 26050184 */ addiu $a1, $s0, 0x0184 ## $a1 = 00000184 -/* 000F8 80978A28 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 000FC 80978A2C 0C0170EB */ jal Collider_DestroyCylinder - -/* 00100 80978A30 260501D0 */ addiu $a1, $s0, 0x01D0 ## $a1 = 000001D0 -/* 00104 80978A34 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 00108 80978A38 0C0170EB */ jal Collider_DestroyCylinder - -/* 0010C 80978A3C 2605021C */ addiu $a1, $s0, 0x021C ## $a1 = 0000021C -/* 00110 80978A40 1000000E */ beq $zero, $zero, .L80978A7C -/* 00114 80978A44 8FBF001C */ lw $ra, 0x001C($sp) -.L80978A48: -/* 00118 80978A48 0C0170EB */ jal Collider_DestroyCylinder - -/* 0011C 80978A4C 26050184 */ addiu $a1, $s0, 0x0184 ## $a1 = 00000184 -/* 00120 80978A50 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 00124 80978A54 0C0170EB */ jal Collider_DestroyCylinder - -/* 00128 80978A58 260501D0 */ addiu $a1, $s0, 0x01D0 ## $a1 = 000001D0 -/* 0012C 80978A5C 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 00130 80978A60 0C0170EB */ jal Collider_DestroyCylinder - -/* 00134 80978A64 2605021C */ addiu $a1, $s0, 0x021C ## $a1 = 0000021C -/* 00138 80978A68 10000004 */ beq $zero, $zero, .L80978A7C -/* 0013C 80978A6C 8FBF001C */ lw $ra, 0x001C($sp) -.L80978A70: -/* 00140 80978A70 0C0170EB */ jal Collider_DestroyCylinder - -/* 00144 80978A74 26050184 */ addiu $a1, $s0, 0x0184 ## $a1 = 00000184 -/* 00148 80978A78 8FBF001C */ lw $ra, 0x001C($sp) -.L80978A7C: -/* 0014C 80978A7C 8FB00014 */ lw $s0, 0x0014($sp) -/* 00150 80978A80 8FB10018 */ lw $s1, 0x0018($sp) -/* 00154 80978A84 03E00008 */ jr $ra -/* 00158 80978A88 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000 diff --git a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978AC4.s b/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978AC4.s deleted file mode 100644 index e736c1c124..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978AC4.s +++ /dev/null @@ -1,16 +0,0 @@ -glabel func_80978AC4 -/* 00194 80978AC4 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00198 80978AC8 AFA40018 */ sw $a0, 0x0018($sp) -/* 0019C 80978ACC AFA5001C */ sw $a1, 0x001C($sp) -/* 001A0 80978AD0 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 001A4 80978AD4 8FA50018 */ lw $a1, 0x0018($sp) -/* 001A8 80978AD8 AFBF0014 */ sw $ra, 0x0014($sp) -/* 001AC 80978ADC 24060032 */ addiu $a2, $zero, 0x0032 ## $a2 = 00000032 -/* 001B0 80978AE0 240728C2 */ addiu $a3, $zero, 0x28C2 ## $a3 = 000028C2 -/* 001B4 80978AE4 0C01AEB6 */ jal Audio_PlaySoundAtPosition - -/* 001B8 80978AE8 24A50024 */ addiu $a1, $a1, 0x0024 ## $a1 = 00000024 -/* 001BC 80978AEC 8FBF0014 */ lw $ra, 0x0014($sp) -/* 001C0 80978AF0 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 001C4 80978AF4 03E00008 */ jr $ra -/* 001C8 80978AF8 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978EBC.s b/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978EBC.s deleted file mode 100644 index a01aa928db..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978EBC.s +++ /dev/null @@ -1,12 +0,0 @@ -glabel func_80978EBC -/* 0058C 80978EBC 3C0E8016 */ lui $t6, %hi(gSaveContext+0x1360) -/* 00590 80978EC0 8DCEF9C0 */ lw $t6, %lo(gSaveContext+0x1360)($t6) -/* 00594 80978EC4 24020001 */ addiu $v0, $zero, 0x0001 ## $v0 = 00000001 -/* 00598 80978EC8 29C10004 */ slti $at, $t6, 0x0004 -/* 0059C 80978ECC 10200003 */ beq $at, $zero, .L80978EDC -/* 005A0 80978ED0 00000000 */ nop -/* 005A4 80978ED4 03E00008 */ jr $ra -/* 005A8 80978ED8 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000 -.L80978EDC: -/* 005AC 80978EDC 03E00008 */ jr $ra -/* 005B0 80978EE0 00000000 */ nop diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 6c2d878225..22e278ca7e 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -97,33 +97,140 @@ static ColliderCylinderInitType1 sCylinderInit = { { 25, 200, 0, { 0, 0, 0 } }, }; */ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978930.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978940.s") +/* +static InitChainEntry sInitChain[] = { + ICHAIN_VEC3F_DIV1000(unk_50, 100, ICHAIN_STOP), +}; +*/ +// D_8097BE84 +extern InitChainEntry sInitChain[]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978950.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_8097895C.s") +s32 func_80978930(DemoGj *this) { + s32 params = this->dyna.actor.params >> 0xB; + return params & 0x1F; +} +s32 func_80978940(DemoGj *this) { + s32 params = this->dyna.actor.params >> 0x8; + return params & 7; +} + +s32 func_80978950(DemoGj *this) { + s32 params = this->dyna.actor.params; + return params & 0xFF; +} + +void func_8097895C(DemoGj* this, GlobalContext* globalCtx, ColliderCylinder* arg2, ColliderCylinderInitType1* arg3) { + Collider_InitCylinder(globalCtx, arg2); + Collider_SetCylinderType1(globalCtx, arg2, &this->dyna.actor, arg3); +} + +#ifdef NON_MATCHING +/*s32 func_809789A4(s32 arg0, GlobalContext* globalCtx, Collider* collider) { + if (Actor_GetCollidedExplosive(globalCtx, collider) != 0) { + return 1; + } + return 0; +}*/ +#else #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_809789A4.s") +#endif -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_809789D8.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/DemoGj_Destroy.s") +void func_809789D8(DemoGj* this, GlobalContext* globalCtx) { + s32 temp_v0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978AC4.s") + temp_v0 = func_80978950(this); + + switch (temp_v0) { + case 0x10: + Collider_DestroyCylinder(globalCtx, &this->unk_184); + Collider_DestroyCylinder(globalCtx, &this->unk_1D0); + Collider_DestroyCylinder(globalCtx, &this->unk_21C); + break; + + case 0x11: + Collider_DestroyCylinder(globalCtx, &this->unk_184); + Collider_DestroyCylinder(globalCtx, &this->unk_1D0); + Collider_DestroyCylinder(globalCtx, &this->unk_21C); + return; + + case 0x16: + Collider_DestroyCylinder(globalCtx, &this->unk_184); + return; + + default: + break; + } +} + +void DemoGj_Destroy(Actor* thisx, GlobalContext* globalCtx) { + DemoGj* this = THIS; + func_809789D8(this, globalCtx); + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +} + +void func_80978AC4(DemoGj* this, GlobalContext* globalCtx) { + Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.world.pos, 0x32, NA_SE_EV_GRAVE_EXPLOSION); +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978AFC.s") +void func_80978B90(DemoGj* this, GlobalContext* globalCtx); +#ifdef NON_MATCHING +// register usage doesn't match. +void func_80978B90(DemoGj* this, GlobalContext* globalCtx) { + s32 temp_v0; + s16 temp_s2; + + s32 i; + + temp_s2 = func_80978930(this); + temp_v0 = func_80978940(this); + + for (i = 0; i < temp_v0; i++) { + Item_DropCollectible(globalCtx, &this->dyna.actor.world.pos, temp_s2); + } +} +#else #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978B90.s") +#endif #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978C20.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978EBC.s") +s32 func_80978EBC(void) { + if (gSaveContext.sceneSetupIndex < 4) { + return 0; + } + return 1; +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978EE4.s") +#ifdef NON_MATCHING +void func_80978F60(DemoGj* this, GlobalContext* globalCtx, void *arg2) { + GlobalContext* glb_ctx; + Actor* actor; + DynaCollisionContext* colctx_dyna; + CollisionHeader *sp18; + + actor = &this->dyna.actor; + glb_ctx = globalCtx; + colctx_dyna = &glb_ctx->colCtx.dyna; + + if (arg2 != NULL) { + Actor_ProcessInitChain(actor, sInitChain); + DynaPolyActor_Init(&this->dyna, 0); + sp18 = NULL; + CollisionHeader_GetVirtual(arg2, &sp18); + this->dyna.bgId = DynaPoly_SetBgActor(glb_ctx, colctx_dyna, actor, sp18); + } +} +#else #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978F60.s") +#endif #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_80978FCC.s") @@ -329,7 +436,58 @@ static ColliderCylinderInitType1 sCylinderInit = { #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/DemoGj_Update.s") +#ifdef NON_MATCHING +/*void DemoGj_Init(Actor* thisx, GlobalContext *globalCtx) { + DemoGj *this = THIS + DemoGj *temp_a2; + u32 temp_t6; + + temp_t6 = func_80978950() - 4; + temp_a2 = this; + if (temp_t6 < 0x13U) { + goto **(&jtbl_8097C234 + (temp_t6 * 4)); + case 0: + func_8097ADC0(temp_a2, globalCtx, temp_a2); + return; + case 4: + func_80979FD0(temp_a2, globalCtx, temp_a2); + return; + case 5: + func_8097A208(temp_a2, globalCtx, temp_a2); + return; + case 6: + func_8097A444(temp_a2, globalCtx, temp_a2); + return; + case 7: + func_8097A614(temp_a2, globalCtx, temp_a2); + return; + case 8: + func_8097A7E4(temp_a2, globalCtx, temp_a2); + return; + case 9: + func_8097A9B4(temp_a2, globalCtx, temp_a2); + return; + case 10: + func_8097AB84(temp_a2, globalCtx, temp_a2); + return; + case 12: + func_8097AE5C(temp_a2, globalCtx, temp_a2); + return; + case 13: + func_8097B3C4(temp_a2, globalCtx, temp_a2); + return; + case 18: + func_8097B8E8(temp_a2, globalCtx, temp_a2); + return; + } +default: + this = temp_a2; + osSyncPrintf((const char *) "\x1b[31mDemo_Gj_Actor_ct そんな引数は無い!!!!!!!!!!!!!!!!!!!!!!\n\x1b[m", globalCtx, temp_a2); + Actor_Kill((Actor *) this); +}*/ +#else #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/DemoGj_Init.s") +#endif #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_8097BD70.s") diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h index c750e4ec03..f27c96e191 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h @@ -7,8 +7,12 @@ struct DemoGj; typedef struct DemoGj { - /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x12C]; + /* 0x0000 */ DynaPolyActor dyna; + /* 0x0164 */ char unk_164[0x20]; + /* 0x0184 */ ColliderCylinder unk_184; + /* 0x01D0 */ ColliderCylinder unk_1D0; + /* 0x021C */ ColliderCylinder unk_21C; + /* 0x0268 */ char unk_268[0x10]; } DemoGj; // size = 0x0278 extern const ActorInit Demo_Gj_InitVars;