From 44260c5bff738415c71861e1c13218cbe53dbc70 Mon Sep 17 00:00:00 2001 From: Rainchus Date: Mon, 15 Mar 2021 06:24:30 -0600 Subject: [PATCH] Decoration-related functions (#210) * decomp some functions in code_182B30.c * run coverage.py * remove blank line * decomp func_80259A48, func_8025C840, func_8025C8A0, func_8025CCC8, func_8025CD28 in code_182B30.c * fix small style stuff * another small style fix --- include/common_structs.h | 17 ++++- src/code_182B30.c | 66 +++++++++++++++++-- .../nonmatchings/code_182B30/func_80259A48.s | 32 --------- .../nonmatchings/code_182B30/func_8025C840.s | 31 --------- .../nonmatchings/code_182B30/func_8025C8A0.s | 36 ---------- .../nonmatchings/code_182B30/func_8025CCC8.s | 31 --------- .../nonmatchings/code_182B30/func_8025CD28.s | 11 ---- 7 files changed, 76 insertions(+), 148 deletions(-) delete mode 100644 ver/us/asm/nonmatchings/code_182B30/func_80259A48.s delete mode 100644 ver/us/asm/nonmatchings/code_182B30/func_8025C840.s delete mode 100644 ver/us/asm/nonmatchings/code_182B30/func_8025C8A0.s delete mode 100644 ver/us/asm/nonmatchings/code_182B30/func_8025CCC8.s delete mode 100644 ver/us/asm/nonmatchings/code_182B30/func_8025CD28.s diff --git a/include/common_structs.h b/include/common_structs.h index 56ed84d65c..1f3d5c90e9 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -1187,7 +1187,19 @@ typedef struct CollisionStatus { } CollisionStatus; // size = 0x28 typedef struct DecorationTable { - /* 0x000 */ char unk_00[2011]; + /* 0x000 */ char unk_00[1729]; + /* 0x6C1 */ s8 unk_6C1; + /* 0x6C2 */ char unk_6C2[142]; + /* 0x750 */ s8 unk_750; + /* 0x751 */ s8 unk_751; + /* 0x752 */ s8 unk_752; + /* 0x753 */ char unk_753[17]; + /* 0x764 */ s8 unk_764; + /* 0x765 */ s8 unk_765; + /* 0x766 */ s8 unk_766; + /* 0x767 */ s8 unk_767; + /* 0x768 */ s8 unk_768; + /* 0x769 */ char unk_769[114]; /* 0x7DB */ s8 unk_7DB; /* 0x7DC */ s16 scale[16]; /* 0x7FC */ s16 posX[16]; @@ -1199,7 +1211,8 @@ typedef struct DecorationTable { /* 0x88C */ u8 rotY[16]; /* 0x89C */ u8 rotZ[16]; /* 0x8AC */ u8 effectType; /* 0 = blur, 14 = none? */ - /* 0x8AD */ char unk_8AD[11]; + /* 0x8AD */ char unk_8AD[3]; + /* 0x8B0 */ s32* unk_8B0[2]; /* 0x8B8 */ u8 decorationType[2]; /* 0x8BA */ u8 unk_8BA[2]; /* 0x8BC */ u8 unk_8BC[2]; diff --git a/src/code_182B30.c b/src/code_182B30.c index bf5392b865..c61ef9c3cd 100644 --- a/src/code_182B30.c +++ b/src/code_182B30.c @@ -175,7 +175,21 @@ INCLUDE_ASM(s32, "code_182B30", func_802597B0); INCLUDE_ASM(s32, "code_182B30", func_8025995C); -INCLUDE_ASM(s32, "code_182B30", func_80259A48); +void func_80259A48(s32 arg0, ActorPart* arg1, s32 arg2, s32 arg3) { + DecorationTable* decorationTable = arg1->decorationTable; + + if (decorationTable->unk_6C1 != 0) { + arg1->verticalStretch = 1; + arg1->unkOffset[0] = 0; + arg1->unkOffset[1] = 0; + decorationTable->unk_6C1 = 0; + } + if (arg0 == 0) { + func_802597B0(arg1, arg2, arg3); + } else { + func_8025950C(arg1, arg2, arg3); + } +} INCLUDE_ASM(s32, "code_182B30", func_80259AAC); @@ -199,15 +213,57 @@ INCLUDE_ASM(s32, "code_182B30", func_8025BAA0); INCLUDE_ASM(s32, "code_182B30", func_8025C120); -INCLUDE_ASM(s32, "code_182B30", func_8025C840); +s32 func_8025C840(s32 arg0, ActorPart *arg1) { -INCLUDE_ASM(s32, "code_182B30", func_8025C8A0); + if (!(arg1->flags & 2)) { + switch (arg1->decorationTable->unk_750) { + case 0: + func_8025C8A0(arg0, arg1); + return 0; + case 11: + func_8025C918(); + break; + } + } + return 0; +} + +s32 func_8025C8A0(s32 arg0, ActorPart *arg1) { + + if (arg1->decorationTable->unk_751 != 0) { + arg1->decorationTable->unk_751 = 0; + if (arg0 == 0) { + return func_802DDFF8(0, 0, 0, 0, 0, 0, 0); + } + return func_802DE894(arg1->unk_84, 0, 0, 0, 0, 0, 0); + } +} INCLUDE_ASM(s32, "code_182B30", func_8025C918); -INCLUDE_ASM(s32, "code_182B30", func_8025CCC8); +s32 func_8025CCC8(s32 arg0, ActorPart *arg1) { -INCLUDE_ASM(s32, "code_182B30", func_8025CD28); + if (!(arg1->flags & 2)) { + switch (arg1->decorationTable->unk_764) { + case 0: + func_8025CD28(arg0, arg1); + return 0; + case 1: + func_8025CD40(); + break; + } + } + return 0; +} + +void func_8025CD28(s32 arg0, ActorPart* arg1) { + DecorationTable* decorationTable = arg1->decorationTable; + + if (decorationTable->unk_765 != 0 ) { + decorationTable->unk_765 = 0; + } + decorationTable->unk_768 = 0; +} INCLUDE_ASM(s32, "code_182B30", func_8025CD40); diff --git a/ver/us/asm/nonmatchings/code_182B30/func_80259A48.s b/ver/us/asm/nonmatchings/code_182B30/func_80259A48.s deleted file mode 100644 index 325f7c12a3..0000000000 --- a/ver/us/asm/nonmatchings/code_182B30/func_80259A48.s +++ /dev/null @@ -1,32 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80259A48 -/* 188328 80259A48 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 18832C 80259A4C 0080402D */ daddu $t0, $a0, $zero -/* 188330 80259A50 00A0202D */ daddu $a0, $a1, $zero -/* 188334 80259A54 AFBF0010 */ sw $ra, 0x10($sp) -/* 188338 80259A58 8C8300C0 */ lw $v1, 0xc0($a0) -/* 18833C 80259A5C 00C0282D */ daddu $a1, $a2, $zero -/* 188340 80259A60 806206C1 */ lb $v0, 0x6c1($v1) -/* 188344 80259A64 10400006 */ beqz $v0, .L80259A80 -/* 188348 80259A68 00E0302D */ daddu $a2, $a3, $zero -/* 18834C 80259A6C 24020001 */ addiu $v0, $zero, 1 -/* 188350 80259A70 A0820074 */ sb $v0, 0x74($a0) -/* 188354 80259A74 A4800068 */ sh $zero, 0x68($a0) -/* 188358 80259A78 A480006A */ sh $zero, 0x6a($a0) -/* 18835C 80259A7C A06006C1 */ sb $zero, 0x6c1($v1) -.L80259A80: -/* 188360 80259A80 15000005 */ bnez $t0, .L80259A98 -/* 188364 80259A84 00000000 */ nop -/* 188368 80259A88 0C0965EC */ jal func_802597B0 -/* 18836C 80259A8C 00000000 */ nop -/* 188370 80259A90 080966A8 */ j .L80259AA0 -/* 188374 80259A94 00000000 */ nop -.L80259A98: -/* 188378 80259A98 0C096543 */ jal func_8025950C -/* 18837C 80259A9C 00000000 */ nop -.L80259AA0: -/* 188380 80259AA0 8FBF0010 */ lw $ra, 0x10($sp) -/* 188384 80259AA4 03E00008 */ jr $ra -/* 188388 80259AA8 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/ver/us/asm/nonmatchings/code_182B30/func_8025C840.s b/ver/us/asm/nonmatchings/code_182B30/func_8025C840.s deleted file mode 100644 index ccace86e64..0000000000 --- a/ver/us/asm/nonmatchings/code_182B30/func_8025C840.s +++ /dev/null @@ -1,31 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8025C840 -/* 18B120 8025C840 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 18B124 8025C844 AFBF0010 */ sw $ra, 0x10($sp) -/* 18B128 8025C848 8CA20000 */ lw $v0, ($a1) -/* 18B12C 8025C84C 30420002 */ andi $v0, $v0, 2 -/* 18B130 8025C850 14400010 */ bnez $v0, .L8025C894 -/* 18B134 8025C854 0000102D */ daddu $v0, $zero, $zero -/* 18B138 8025C858 8CA200C0 */ lw $v0, 0xc0($a1) -/* 18B13C 8025C85C 80430750 */ lb $v1, 0x750($v0) -/* 18B140 8025C860 10600005 */ beqz $v1, .L8025C878 -/* 18B144 8025C864 2402000B */ addiu $v0, $zero, 0xb -/* 18B148 8025C868 10620007 */ beq $v1, $v0, .L8025C888 -/* 18B14C 8025C86C 0000102D */ daddu $v0, $zero, $zero -/* 18B150 8025C870 08097225 */ j .L8025C894 -/* 18B154 8025C874 00000000 */ nop -.L8025C878: -/* 18B158 8025C878 0C097228 */ jal func_8025C8A0 -/* 18B15C 8025C87C 00000000 */ nop -/* 18B160 8025C880 08097225 */ j .L8025C894 -/* 18B164 8025C884 0000102D */ daddu $v0, $zero, $zero -.L8025C888: -/* 18B168 8025C888 0C097246 */ jal func_8025C918 -/* 18B16C 8025C88C 00000000 */ nop -/* 18B170 8025C890 0000102D */ daddu $v0, $zero, $zero -.L8025C894: -/* 18B174 8025C894 8FBF0010 */ lw $ra, 0x10($sp) -/* 18B178 8025C898 03E00008 */ jr $ra -/* 18B17C 8025C89C 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/ver/us/asm/nonmatchings/code_182B30/func_8025C8A0.s b/ver/us/asm/nonmatchings/code_182B30/func_8025C8A0.s deleted file mode 100644 index 6dd3142d9c..0000000000 --- a/ver/us/asm/nonmatchings/code_182B30/func_8025C8A0.s +++ /dev/null @@ -1,36 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8025C8A0 -/* 18B180 8025C8A0 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 18B184 8025C8A4 00A0382D */ daddu $a3, $a1, $zero -/* 18B188 8025C8A8 AFBF0020 */ sw $ra, 0x20($sp) -/* 18B18C 8025C8AC 8CE300C0 */ lw $v1, 0xc0($a3) -/* 18B190 8025C8B0 80620751 */ lb $v0, 0x751($v1) -/* 18B194 8025C8B4 10400015 */ beqz $v0, .L8025C90C -/* 18B198 8025C8B8 00000000 */ nop -/* 18B19C 8025C8BC 1480000B */ bnez $a0, .L8025C8EC -/* 18B1A0 8025C8C0 A0600751 */ sb $zero, 0x751($v1) -/* 18B1A4 8025C8C4 0000202D */ daddu $a0, $zero, $zero -/* 18B1A8 8025C8C8 0080282D */ daddu $a1, $a0, $zero -/* 18B1AC 8025C8CC 0080302D */ daddu $a2, $a0, $zero -/* 18B1B0 8025C8D0 0080382D */ daddu $a3, $a0, $zero -/* 18B1B4 8025C8D4 AFA00010 */ sw $zero, 0x10($sp) -/* 18B1B8 8025C8D8 AFA00014 */ sw $zero, 0x14($sp) -/* 18B1BC 8025C8DC 0C0B77FE */ jal func_802DDFF8 -/* 18B1C0 8025C8E0 AFA00018 */ sw $zero, 0x18($sp) -/* 18B1C4 8025C8E4 08097243 */ j .L8025C90C -/* 18B1C8 8025C8E8 00000000 */ nop -.L8025C8EC: -/* 18B1CC 8025C8EC 0000282D */ daddu $a1, $zero, $zero -/* 18B1D0 8025C8F0 00A0302D */ daddu $a2, $a1, $zero -/* 18B1D4 8025C8F4 AFA00010 */ sw $zero, 0x10($sp) -/* 18B1D8 8025C8F8 AFA00014 */ sw $zero, 0x14($sp) -/* 18B1DC 8025C8FC AFA00018 */ sw $zero, 0x18($sp) -/* 18B1E0 8025C900 8CE40084 */ lw $a0, 0x84($a3) -/* 18B1E4 8025C904 0C0B7A25 */ jal func_802DE894 -/* 18B1E8 8025C908 00A0382D */ daddu $a3, $a1, $zero -.L8025C90C: -/* 18B1EC 8025C90C 8FBF0020 */ lw $ra, 0x20($sp) -/* 18B1F0 8025C910 03E00008 */ jr $ra -/* 18B1F4 8025C914 27BD0028 */ addiu $sp, $sp, 0x28 diff --git a/ver/us/asm/nonmatchings/code_182B30/func_8025CCC8.s b/ver/us/asm/nonmatchings/code_182B30/func_8025CCC8.s deleted file mode 100644 index bba2b4e153..0000000000 --- a/ver/us/asm/nonmatchings/code_182B30/func_8025CCC8.s +++ /dev/null @@ -1,31 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8025CCC8 -/* 18B5A8 8025CCC8 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 18B5AC 8025CCCC AFBF0010 */ sw $ra, 0x10($sp) -/* 18B5B0 8025CCD0 8CA20000 */ lw $v0, ($a1) -/* 18B5B4 8025CCD4 30420002 */ andi $v0, $v0, 2 -/* 18B5B8 8025CCD8 14400010 */ bnez $v0, .L8025CD1C -/* 18B5BC 8025CCDC 0000102D */ daddu $v0, $zero, $zero -/* 18B5C0 8025CCE0 8CA200C0 */ lw $v0, 0xc0($a1) -/* 18B5C4 8025CCE4 80430764 */ lb $v1, 0x764($v0) -/* 18B5C8 8025CCE8 10600005 */ beqz $v1, .L8025CD00 -/* 18B5CC 8025CCEC 24020001 */ addiu $v0, $zero, 1 -/* 18B5D0 8025CCF0 10620007 */ beq $v1, $v0, .L8025CD10 -/* 18B5D4 8025CCF4 0000102D */ daddu $v0, $zero, $zero -/* 18B5D8 8025CCF8 08097347 */ j .L8025CD1C -/* 18B5DC 8025CCFC 00000000 */ nop -.L8025CD00: -/* 18B5E0 8025CD00 0C09734A */ jal func_8025CD28 -/* 18B5E4 8025CD04 00000000 */ nop -/* 18B5E8 8025CD08 08097347 */ j .L8025CD1C -/* 18B5EC 8025CD0C 0000102D */ daddu $v0, $zero, $zero -.L8025CD10: -/* 18B5F0 8025CD10 0C097350 */ jal func_8025CD40 -/* 18B5F4 8025CD14 00000000 */ nop -/* 18B5F8 8025CD18 0000102D */ daddu $v0, $zero, $zero -.L8025CD1C: -/* 18B5FC 8025CD1C 8FBF0010 */ lw $ra, 0x10($sp) -/* 18B600 8025CD20 03E00008 */ jr $ra -/* 18B604 8025CD24 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/ver/us/asm/nonmatchings/code_182B30/func_8025CD28.s b/ver/us/asm/nonmatchings/code_182B30/func_8025CD28.s deleted file mode 100644 index 1526195e97..0000000000 --- a/ver/us/asm/nonmatchings/code_182B30/func_8025CD28.s +++ /dev/null @@ -1,11 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8025CD28 -/* 18B608 8025CD28 8CA300C0 */ lw $v1, 0xc0($a1) -/* 18B60C 8025CD2C 80620765 */ lb $v0, 0x765($v1) -/* 18B610 8025CD30 54400001 */ bnel $v0, $zero, .L8025CD38 -/* 18B614 8025CD34 A0600765 */ sb $zero, 0x765($v1) -.L8025CD38: -/* 18B618 8025CD38 03E00008 */ jr $ra -/* 18B61C 8025CD3C A0600768 */ sb $zero, 0x768($v1)