From 9103d9b35a85ac3c48c36b22f3130025fec58bb7 Mon Sep 17 00:00:00 2001 From: Muskellunge <37986958+Muskellunge@users.noreply.github.com> Date: Wed, 25 Aug 2021 12:05:22 +0200 Subject: [PATCH] decompiled func_80242178_7ECE88 (#387) * decompiled func_80242178_7ECE88 * Delete Paper Mario (U) [!].z64:Zone.Identifier * update pr --- include/common_structs.h | 2 +- src/world/area_mac/mac_00/7EB340.c | 9 ++++++- .../data/world/area_mac/mac_00/7F0A20.data.s | 6 ++--- .../mac_00/7EB340/func_80242178_7ECE88.s | 26 ------------------- ver/us/symbol_addrs.txt | 2 +- 5 files changed, 13 insertions(+), 32 deletions(-) delete mode 100644 ver/us/asm/nonmatchings/world/area_mac/mac_00/7EB340/func_80242178_7ECE88.s diff --git a/include/common_structs.h b/include/common_structs.h index 5b9ec15736..ca546e4851 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -1627,7 +1627,7 @@ typedef struct Shop { typedef struct Encounter { /* 0x00 */ s32 count; /* 0x04 */ struct Enemy* enemy[16]; - /* 0x44 */ s16 battle; + /* 0x44 */ u16 battle; /* 0x46 */ s16 stage; /* 0x48 */ s16 encounterID; /* 0x4A */ char unk_4C[0x12]; diff --git a/src/world/area_mac/mac_00/7EB340.c b/src/world/area_mac/mac_00/7EB340.c index 96583fe005..aa0b3d0489 100644 --- a/src/world/area_mac/mac_00/7EB340.c +++ b/src/world/area_mac/mac_00/7EB340.c @@ -2,6 +2,8 @@ #define UNK_ALPHA_FUNC_NPC 6 +extern s32 mac_00_dojoBattleIDs[]; + INCLUDE_ASM(s32, "world/area_mac/mac_00/7EB340", func_80240630_7EB340); /* ApiStatus N(func_80240630_7EB340)(Evt* script, s32 isInitialCall) { @@ -375,7 +377,12 @@ INCLUDE_ASM(s32, "world/area_mac/mac_00/7EB340", func_80241FF0_7ECD00); #include "world/common/UnkPositionFunc.inc.c" -INCLUDE_ASM(s32, "world/area_mac/mac_00/7EB340", func_80242178_7ECE88); +ApiStatus func_80242178_7ECE88(Evt* script, s32 isInitialCall) { + Enemy* enemy = script->owner1.enemy; + + gCurrentEncounter.encounterList[enemy->encounterIndex]->battle = mac_00_dojoBattleIDs[get_variable(script, SI_SAVE_VAR(28))]; + return ApiStatus_DONE2; +} INCLUDE_ASM(s32, "world/area_mac/mac_00/7EB340", func_802421D0_7ECEE0); diff --git a/ver/us/asm/data/world/area_mac/mac_00/7F0A20.data.s b/ver/us/asm/data/world/area_mac/mac_00/7F0A20.data.s index b4ed87106d..be76153982 100644 --- a/ver/us/asm/data/world/area_mac/mac_00/7F0A20.data.s +++ b/ver/us/asm/data/world/area_mac/mac_00/7F0A20.data.s @@ -192,10 +192,10 @@ glabel D_8024A520_7F5230 .word 0x00000014, 0x00000001, 0xF5DE0180, 0x00000021, 0x00000002, 0xFFFFFFF3, 0x00000005, 0x0000000A, 0x00000002, 0xF8405C78, 0x00000000, 0x00000043, 0x00000005, SetNpcPos, 0x00000001, 0x00000000, 0xFFFFFC18, 0x00000000, 0x00000013, 0x00000000, 0x00000023, 0x00000000, 0x00000043, 0x00000003, BindNpcInteract, 0xFFFFFFFF, D_8024A4D4_7F51E4, 0x00000002, 0x00000000, 0x00000001, 0x00000000 glabel D_8024A59C_7F52AC -.short 0x0000, 0x0014, 0x0000, 0x0001, 0xF5DE, 0x0180, 0x0000, 0x0021, 0x0000, 0x0002, 0xFFFF, 0xFFF3, 0x0000, 0x0005, 0x0000, 0x000A, 0x0000, 0x0002, 0xF840, 0x5C78, 0x0000, 0x0000, 0x0000, 0x0043, 0x0000, 0x0005, 0x802C, 0xDCB0, 0xFFFF, 0xFFFF, 0x0000, 0x0069, 0x0000, 0x0000, 0xFFFF, 0xFFD8, 0x0000, 0x0043, 0x0000, 0x0003, 0x8004, 0x50A4, 0xFFFF, 0xFFFF, 0x8024, 0xA4F0, 0x0000, 0x0002, 0x0000, 0x0000, 0x0000, 0x0013, 0x0000, 0x0000, 0x0000, 0x0023, 0x0000, 0x0000, 0x0000, 0x0043, 0x0000, 0x0002, 0x8004, 0x4340, 0xFFFF, 0xFFFF, 0x0000, 0x0002, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000 +.short 0x0000, 0x0014, 0x0000, 0x0001, 0xF5DE, 0x0180, 0x0000, 0x0021, 0x0000, 0x0002, 0xFFFF, 0xFFF3, 0x0000, 0x0005, 0x0000, 0x000A, 0x0000, 0x0002, 0xF840, 0x5C78, 0x0000, 0x0000, 0x0000, 0x0043, 0x0000, 0x0005, 0x802C, 0xDCB0, 0xFFFF, 0xFFFF, 0x0000, 0x0069, 0x0000, 0x0000, 0xFFFF, 0xFFD8, 0x0000, 0x0043, 0x0000, 0x0003, 0x8004, 0x50A4, 0xFFFF, 0xFFFF, 0x8024, 0xA4F0, 0x0000, 0x0002, 0x0000, 0x0000, 0x0000, 0x0013, 0x0000, 0x0000, 0x0000, 0x0023, 0x0000, 0x0000, 0x0000, 0x0043, 0x0000, 0x0002, 0x8004, 0x4340, 0xFFFF, 0xFFFF, 0x0000, 0x0002, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000 -glabel D_8024A632_7F5342 -.short 0x0300, 0x0000, 0x0301, 0x0000, 0x0302, 0x0000, 0x0303, 0x0000, 0x0304 +glabel mac_00_dojoBattleIDs +.short 0x0000, 0x0300, 0x0000, 0x0301, 0x0000, 0x0302, 0x0000, 0x0303, 0x0000, 0x0304 glabel D_8024A644_7F5354 .word 0x0000000C, 0x00000002, 0xF5DE0180, 0xFFFFFF98, 0x00000024, 0x00000002, 0xFE363C80, 0x00020015, 0x00000012, 0x00000000, 0x00000024, 0x00000002, 0xFE363C80, 0x0002001B, 0x00000013, 0x00000000, 0x00000043, 0x00000006, SpeakToPlayer, 0xFFFFFFFF, 0x00A30004, 0x00A30001, 0x00000000, 0xFE363C80, 0x00000002, 0x00000000, 0x00000001, 0x00000000 diff --git a/ver/us/asm/nonmatchings/world/area_mac/mac_00/7EB340/func_80242178_7ECE88.s b/ver/us/asm/nonmatchings/world/area_mac/mac_00/7EB340/func_80242178_7ECE88.s deleted file mode 100644 index b764e65368..0000000000 --- a/ver/us/asm/nonmatchings/world/area_mac/mac_00/7EB340/func_80242178_7ECE88.s +++ /dev/null @@ -1,26 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80242178_7ECE88 -/* 7ECE88 80242178 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 7ECE8C 8024217C 3C05F5DE */ lui $a1, 0xf5de -/* 7ECE90 80242180 AFBF0014 */ sw $ra, 0x14($sp) -/* 7ECE94 80242184 AFB00010 */ sw $s0, 0x10($sp) -/* 7ECE98 80242188 8C900148 */ lw $s0, 0x148($a0) -/* 7ECE9C 8024218C 0C0B1EAF */ jal get_variable -/* 7ECEA0 80242190 34A5019C */ ori $a1, $a1, 0x19c -/* 7ECEA4 80242194 82030004 */ lb $v1, 4($s0) -/* 7ECEA8 80242198 00021080 */ sll $v0, $v0, 2 -/* 7ECEAC 8024219C 00031880 */ sll $v1, $v1, 2 -/* 7ECEB0 802421A0 3C04800B */ lui $a0, %hi(gCurrentEncounter+0x28) -/* 7ECEB4 802421A4 00832021 */ addu $a0, $a0, $v1 -/* 7ECEB8 802421A8 8C840F38 */ lw $a0, %lo(gCurrentEncounter+0x28)($a0) -/* 7ECEBC 802421AC 3C038025 */ lui $v1, %hi(D_8024A632_7F5342) -/* 7ECEC0 802421B0 00621821 */ addu $v1, $v1, $v0 -/* 7ECEC4 802421B4 9463A632 */ lhu $v1, %lo(D_8024A632_7F5342)($v1) -/* 7ECEC8 802421B8 A4830044 */ sh $v1, 0x44($a0) -/* 7ECECC 802421BC 8FBF0014 */ lw $ra, 0x14($sp) -/* 7ECED0 802421C0 8FB00010 */ lw $s0, 0x10($sp) -/* 7ECED4 802421C4 24020002 */ addiu $v0, $zero, 2 -/* 7ECED8 802421C8 03E00008 */ jr $ra -/* 7ECEDC 802421CC 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/ver/us/symbol_addrs.txt b/ver/us/symbol_addrs.txt index f3788af101..87a92d88a2 100644 --- a/ver/us/symbol_addrs.txt +++ b/ver/us/symbol_addrs.txt @@ -7732,7 +7732,7 @@ D_802483EC_7F30FC = 0x802483EC; // type:data rom:0x7F30FC D_80248F18_7F3C28 = 0x80248F18; // type:data rom:0x7F3C28 D_80248F20_7F3C30 = 0x80248F20; // type:data rom:0x7F3C30 D_80248F28_7F3C38 = 0x80248F28; // type:data rom:0x7F3C38 -D_8024A632_7F5342 = 0x8024A632; // type:data rom:0x7F5342 +mac_00_dojoBattleIDs = 0x8024A632; // type:data rom:0x7F5340 D_8024ECE8_7F99F8 = 0x8024ECE8; // type:data rom:0x7F99F8 D_8024ED4C_7F9A5C = 0x8024ED4C; // type:data rom:0x7F9A5C D_8024ED50_7F9A60 = 0x8024ED50; // type:data rom:0x7F9A60