diff --git a/asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Draw.s b/asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Draw.s deleted file mode 100644 index 3afafed3d0..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Draw.s +++ /dev/null @@ -1,52 +0,0 @@ -.rdata - - -glabel D_80978740 - .asciz "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" - .balign 4 - -.text - -glabel DemoGeff_Draw -/* 006A0 809784E0 27BDFFD8 */ addiu $sp, $sp, 0xFFD8 ## $sp = FFFFFFD8 -/* 006A4 809784E4 AFBF0014 */ sw $ra, 0x0014($sp) -/* 006A8 809784E8 AFA5002C */ sw $a1, 0x002C($sp) -/* 006AC 809784EC 8C820150 */ lw $v0, 0x0150($a0) ## 00000150 -/* 006B0 809784F0 0440000B */ bltz $v0, .L80978520 -/* 006B4 809784F4 28410002 */ slti $at, $v0, 0x0002 -/* 006B8 809784F8 10200009 */ beq $at, $zero, .L80978520 -/* 006BC 809784FC 00027080 */ sll $t6, $v0, 2 -/* 006C0 80978500 3C0F8098 */ lui $t7, %hi(D_809785B0) ## $t7 = 80980000 -/* 006C4 80978504 25EF85B0 */ addiu $t7, $t7, %lo(D_809785B0) ## $t7 = 809785B0 -/* 006C8 80978508 01CF1821 */ addu $v1, $t6, $t7 -/* 006CC 8097850C 8C660000 */ lw $a2, 0x0000($v1) ## 00000000 -/* 006D0 80978510 3C188098 */ lui $t8, %hi(D_809785B0) ## $t8 = 80980000 -/* 006D4 80978514 271885B0 */ addiu $t8, $t8, %lo(D_809785B0) ## $t8 = 809785B0 -/* 006D8 80978518 14C00006 */ bne $a2, $zero, .L80978534 -/* 006DC 8097851C 00000000 */ nop -.L80978520: -/* 006E0 80978520 3C048098 */ lui $a0, %hi(D_80978740) ## $a0 = 80980000 -/* 006E4 80978524 0C00084C */ jal osSyncPrintf - -/* 006E8 80978528 24848740 */ addiu $a0, $a0, %lo(D_80978740) ## $a0 = 80978740 -/* 006EC 8097852C 1000000C */ beq $zero, $zero, .L80978560 -/* 006F0 80978530 8FBF0014 */ lw $ra, 0x0014($sp) -.L80978534: -/* 006F4 80978534 10780007 */ beq $v1, $t8, .L80978554 -/* 006F8 80978538 8FA5002C */ lw $a1, 0x002C($sp) -/* 006FC 8097853C AFA3001C */ sw $v1, 0x001C($sp) -/* 00700 80978540 0C25DFE0 */ jal func_80977F80 -/* 00704 80978544 AFA40028 */ sw $a0, 0x0028($sp) -/* 00708 80978548 8FA3001C */ lw $v1, 0x001C($sp) -/* 0070C 8097854C 8FA40028 */ lw $a0, 0x0028($sp) -/* 00710 80978550 8C660000 */ lw $a2, 0x0000($v1) ## 00000000 -.L80978554: -/* 00714 80978554 00C0F809 */ jalr $ra, $a2 -/* 00718 80978558 8FA5002C */ lw $a1, 0x002C($sp) -/* 0071C 8097855C 8FBF0014 */ lw $ra, 0x0014($sp) -.L80978560: -/* 00720 80978560 27BD0028 */ addiu $sp, $sp, 0x0028 ## $sp = 00000000 -/* 00724 80978564 03E00008 */ jr $ra -/* 00728 80978568 00000000 */ nop -/* 0072C 8097856C 00000000 */ nop - diff --git a/asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809781FC.s b/asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809781FC.s deleted file mode 100644 index 7a38c1bb10..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809781FC.s +++ /dev/null @@ -1,49 +0,0 @@ -glabel func_809781FC -/* 003BC 809781FC 8C8E0158 */ lw $t6, 0x0158($a0) ## 00000158 -/* 003C0 80978200 15C00025 */ bne $t6, $zero, .L80978298 -/* 003C4 80978204 00000000 */ nop -/* 003C8 80978208 8482001C */ lh $v0, 0x001C($a0) ## 0000001C -/* 003CC 8097820C 8CA31C64 */ lw $v1, 0x1C64($a1) ## 00001C64 -/* 003D0 80978210 24010001 */ addiu $at, $zero, 0x0001 ## $at = 00000001 -/* 003D4 80978214 10400007 */ beq $v0, $zero, .L80978234 -/* 003D8 80978218 24050174 */ addiu $a1, $zero, 0x0174 ## $a1 = 00000174 -/* 003DC 8097821C 10410005 */ beq $v0, $at, .L80978234 -/* 003E0 80978220 24010002 */ addiu $at, $zero, 0x0002 ## $at = 00000002 -/* 003E4 80978224 50410004 */ beql $v0, $at, .L80978238 -/* 003E8 80978228 24020001 */ addiu $v0, $zero, 0x0001 ## $v0 = 00000001 -/* 003EC 8097822C 10000002 */ beq $zero, $zero, .L80978238 -/* 003F0 80978230 24020002 */ addiu $v0, $zero, 0x0002 ## $v0 = 00000002 -.L80978234: -/* 003F4 80978234 24020001 */ addiu $v0, $zero, 0x0001 ## $v0 = 00000001 -.L80978238: -/* 003F8 80978238 10600017 */ beq $v1, $zero, .L80978298 -/* 003FC 8097823C 00000000 */ nop -/* 00400 80978240 846F0000 */ lh $t7, 0x0000($v1) ## 00000000 -.L80978244: -/* 00404 80978244 54AF0012 */ bnel $a1, $t7, .L80978290 -/* 00408 80978248 8C630124 */ lw $v1, 0x0124($v1) ## 00000124 -/* 0040C 8097824C 8478001C */ lh $t8, 0x001C($v1) ## 0000001C -/* 00410 80978250 5458000F */ bnel $v0, $t8, .L80978290 -/* 00414 80978254 8C630124 */ lw $v1, 0x0124($v1) ## 00000124 -/* 00418 80978258 C4840024 */ lwc1 $f4, 0x0024($a0) ## 00000024 -/* 0041C 8097825C C4660024 */ lwc1 $f6, 0x0024($v1) ## 00000024 -/* 00420 80978260 C48A0028 */ lwc1 $f10, 0x0028($a0) ## 00000028 -/* 00424 80978264 46062201 */ sub.s $f8, $f4, $f6 -/* 00428 80978268 C484002C */ lwc1 $f4, 0x002C($a0) ## 0000002C -/* 0042C 8097826C E488015C */ swc1 $f8, 0x015C($a0) ## 0000015C -/* 00430 80978270 C4700028 */ lwc1 $f16, 0x0028($v1) ## 00000028 -/* 00434 80978274 46105481 */ sub.s $f18, $f10, $f16 -/* 00438 80978278 E4920160 */ swc1 $f18, 0x0160($a0) ## 00000160 -/* 0043C 8097827C C466002C */ lwc1 $f6, 0x002C($v1) ## 0000002C -/* 00440 80978280 AC830158 */ sw $v1, 0x0158($a0) ## 00000158 -/* 00444 80978284 46062201 */ sub.s $f8, $f4, $f6 -/* 00448 80978288 E4880164 */ swc1 $f8, 0x0164($a0) ## 00000164 -/* 0044C 8097828C 8C630124 */ lw $v1, 0x0124($v1) ## 00000124 -.L80978290: -/* 00450 80978290 5460FFEC */ bnel $v1, $zero, .L80978244 -/* 00454 80978294 846F0000 */ lh $t7, 0x0000($v1) ## 00000000 -.L80978298: -/* 00458 80978298 03E00008 */ jr $ra -/* 0045C 8097829C 00000000 */ nop - - diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index 7aae5c3fbd..828bcd08ae 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -10,20 +10,21 @@ void DemoGeff_Destroy(DemoGeff* this, GlobalContext* globalCtx); void DemoGeff_Update(DemoGeff* this, GlobalContext* globalCtx); void DemoGeff_Draw(DemoGeff* this, GlobalContext* globalCtx); +void func_80978030(DemoGeff* this, GlobalContext* globalCtx); + void func_809783D4(DemoGeff* this, GlobalContext* globalCtx); void func_80978308(DemoGeff* this, GlobalContext* globalCtx); void func_809784D4(DemoGeff* this, GlobalContext* globalCtx); void func_80978344(DemoGeff* this, GlobalContext* globalCtx); -void func_80978030(DemoGeff* this, GlobalContext* globalCtx); - -s16 D_80978570[] = { 0x0186, 0x0186, 0x0186, 0x0186, 0x0186, 0x0186, 0x0186, 0x0186, 0x0186, 0x0000, }; +s16 objectIds[] = { OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, + OBJECT_GEFF, OBJECT_GEFF, OBJECT_UNSET_0, }; ActorFunc D_80978584[] = { func_80978030, func_80978030, func_80978030, func_80978030, func_80978030, func_80978030, func_80978030, func_80978030, func_80978030, }; -ActorFunc D_809785A8[] = { func_809783D4, func_80978308, }; -ActorFunc D_809785B0[] = { func_809784D4, func_80978344, }; +ActorFunc actionFuncs[] = { func_809783D4, func_80978308, }; +ActorFunc drawFuncs[] = { func_809784D4, func_80978344, }; const ActorInit Demo_Geff_InitVars = { @@ -39,7 +40,7 @@ const ActorInit Demo_Geff_InitVars = (ActorFunc)DemoGeff_Draw, }; -extern u32 D_06000EA0; +extern UNK_TYPE D_06000EA0; void DemoGeff_Destroy(DemoGeff* this, GlobalContext* globalCtx) { @@ -52,7 +53,7 @@ void DemoGeff_Init(DemoGeff* this, GlobalContext* globalCtx) { return; } this->action = 0; - this->unk_150 = 0; + this->drawConfig = 0; } #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80977EA8.s") @@ -71,10 +72,73 @@ void DemoGeff_Init(DemoGeff* this, GlobalContext* globalCtx) { }*/ #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80977F80.s") +/*void func_80977F80(DemoGeff* this, GlobalContext* globalCtx) { + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + Gfx* gfxArr[4]; + + func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_demo_geff.c", 204); + + temp_a0 = (arg1 + (this->unk_154 * 0x44)) + 0x10000; + + gSPSegment(gfxCtx->polyOpa.p++, 0x06, temp_a0->unk17B4), + + *(void *)0x80166FC0 = (s32) (temp_a0->unk17B4 + 0x80000000); + + func_800C6B54(gfxArr, &globalCtx->state.gfxCtx, "../z_demo_geff.c", 212); +}*/ #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80978030.s") +/*void func_80978030(DemoGeff* this, GlobalContext* globalCtx) { + Vec3f* thisScale = &this->actor.scale; + this->action = 1; + this->drawConfig = 1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809781FC.s") + switch ((u16)this->actor.params) { + default: + thisScale->x = ((f32) kREG(7) * 0.01f) + 0.3f; + thisScale->y = ((f32) kREG(8) * 0.01f) + 0.3f; + thisScale->z = ((f32) kREG(9) * 0.01f) + 0.3f; + break; + case 8: + break; + case 1: + case 4: + case 7: + thisScale->x = ((f32) kREG(10) * 0.01f) + 0.15f; + thisScale->y = ((f32) kREG(11) * 0.01f) + 0.29f; + thisScale->z = ((f32) kREG(12) * 0.01f) + 0.12f; + break; + case 2: + case 5: + thisScale->x = ((f32) kREG(13) * 0.01f) + 0.1f; + thisScale->y = ((f32) kREG(14) * 0.01f) + 0.15f; + thisScale->z = ((f32) kREG(15) * 0.01f) + 0.2f; + break; + } +}*/ + +void func_809781FC(DemoGeff* this, GlobalContext* globalCtx) { + s32 targetParams = 2; + Actor* demoGt; + + if (this->unk_158 == 0) { + demoGt = globalCtx->actorCtx.actorList[ACTORTYPE_PROP].first; + if ((this->actor.params != 0) && (this->actor.params != 1) && (this->actor.params != 2)) { + targetParams = 2; + } else { + targetParams = 1; + } + while (demoGt != 0) { + if (demoGt->id == ACTOR_DEMO_GT && demoGt->params == targetParams) { + this->unk_15C = (this->actor.posRot.pos.x - demoGt->posRot.pos.x); + this->unk_160 = (this->actor.posRot.pos.y - demoGt->posRot.pos.y); + this->unk_164 = (this->actor.posRot.pos.z - demoGt->posRot.pos.z); + this->unk_158 = demoGt; + } + demoGt = demoGt->next; + } + } +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809782A0.s") /*void func_809782A0(DemoGeff* this, GlobalContext* globalCtx) { @@ -100,13 +164,11 @@ void func_80978344(DemoGeff* this, GlobalContext* globalCtx) { } #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80978370.s") -/* -void func_80978370(DemoGeff* this, GlobalContext* globalCtx) { +/*void func_80978370(DemoGeff* this, GlobalContext* globalCtx) { Actor* thisx = &this->actor; - s32 params = thisx->params; - ActorFunc actorFunc = D_80978584[params]; + ActorFunc actorFunc = D_80978584[thisx->params]; if (actorFunc == NULL) { - osSyncPrintf(VT_FGCOL(RED) " Demo_Geff_main_init:初期化処理がおかしいarg_data = %d!\n" VT_RST, params); + osSyncPrintf(VT_FGCOL(RED) " Demo_Geff_main_init:初期化処理がおかしいarg_data = %d!\n" VT_RST, thisx->params); Actor_Kill(thisx); return; } @@ -117,7 +179,7 @@ void func_809783D4(DemoGeff* this, GlobalContext* globalCtx) { ObjectContext* objCtx = &globalCtx->objectCtx; Actor* thisx = &this->actor; s32 params = thisx->params; - s16 objectId = D_80978570[params]; + s16 objectId = objectIds[params]; s32 objBankIndex = Object_GetIndex(objCtx, objectId); s32 pad; @@ -133,15 +195,26 @@ void func_809783D4(DemoGeff* this, GlobalContext* globalCtx) { } void DemoGeff_Update(DemoGeff* this, GlobalContext* globalCtx) { - if (this->action < 0 || this->action >= 2 || D_809785A8[this->action] == NULL) { + if (this->action < 0 || this->action >= 2 || actionFuncs[this->action] == NULL) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - D_809785A8[this->action](this, globalCtx); + actionFuncs[this->action](this, globalCtx); } void func_809784D4(DemoGeff* this, GlobalContext* globalCtx) { } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Draw.s") +void DemoGeff_Draw(DemoGeff* this, GlobalContext* globalCtx) { + s32 drawConfig = this->drawConfig; + s16 pad; + if (drawConfig < 0 || drawConfig >= 2 || drawFuncs[drawConfig] == NULL) { + osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + return; + } + if (drawConfig != 0) { + func_80977F80(this, globalCtx); + } + drawFuncs[drawConfig](this, globalCtx); +} diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h index e7e07e8a5f..cbe4527bff 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h @@ -8,7 +8,7 @@ typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ s32 action; - /* 0x0150 */ s32 unk_150; + /* 0x0150 */ s32 drawConfig; /* 0x0154 */ s32 unk_154; /* 0x0158 */ Actor* unk_158; /* 0x015C */ f32 unk_15C;