Match some functions in EB1170 (#460)

* Match some functions in EB1170

* Code style fixes
This commit is contained in:
Gota7 2021-10-09 23:09:19 -04:00 committed by GitHub
parent 789049ee36
commit 62082fb3d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 90 deletions

View File

@ -3,7 +3,13 @@
#define NAMESPACE EB1170
extern s32 func_80059AC8(s32 a, s32 b);
extern s16 D_80169B12;
extern s32 D_802417E4_EB2644;
extern s32 D_802417E8_EB2648;
extern s32 D_802442D0[];
extern u32 D_80244494;
extern s32 D_800B8DEC;
INCLUDE_ASM(s32, "EB1170", func_80240310_EB1170);
@ -13,9 +19,30 @@ INCLUDE_ASM(s32, "EB1170", func_80240310_EB1170);
INCLUDE_ASM(s32, "EB1170", func_80240484_EB12E4);
INCLUDE_ASM(s32, "EB1170", func_80240654_EB14B4);
// LW %LO issue.
#ifdef NON_MATCHING
ApiStatus func_80240654_EB14B4(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
INCLUDE_ASM(s32, "EB1170", func_802406A8_EB1508);
if (isInitialCall) {
D_802417E4_EB2644 = 0;
}
if (D_802417E4_EB2644 != 0) {
D_802417E4_EB2644 = 0;
dead_evt_set_variable(script, *args, D_802417E8_EB2648);
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
#else
INCLUDE_ASM(s32, "EB1170", func_80240654_EB14B4);
#endif // NON_MATCHING
ApiStatus func_802406A8_EB1508(Evt* script, s32 isInitialCall) {
D_802417E8_EB2648 = evt_get_variable(script, *script->ptrReadPos);
D_802417E4_EB2644 = 1;
return ApiStatus_DONE2;
}
ApiStatus func_802406E0_EB1540(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
@ -40,10 +67,27 @@ ApiStatus func_802406E0_EB1540(Evt* script, s32 isInitialCall) {
#include "world/common/UnkYawFunc.inc.c"
INCLUDE_ASM(s32, "EB1170", func_802409F8_EB1858);
ApiStatus func_802409F8_EB1858(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(script->varTable[2]);
u32 anim = npc->currentAnim.w;
INCLUDE_ASM(s32, "EB1170", func_80240A3C_EB189C);
D_80244494 = anim;
npc->currentAnim.w = (u32)script->varTable[4];
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "EB1170", func_80240A68_EB18C8);
INCLUDE_ASM(s32, "EB1170", func_80240A8C_EB18EC);
ApiStatus func_80240A3C_EB189C(Evt* script, s32 isInitialCall) {
get_npc_unsafe(script->varTable[2])->currentAnim.w = D_80244494;
return ApiStatus_DONE2;
}
ApiStatus func_80240A68_EB18C8(Evt* script, s32 isInitialCall) {
func_80059AC8(0, 1);
return ApiStatus_DONE2;
}
ApiStatus func_80240A8C_EB18EC(Evt* script, s32 isInitialCall) {
evt_set_variable(script, *script->ptrReadPos, D_80169B12);
return ApiStatus_DONE2;
}

View File

@ -1,18 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_802406A8_EB1508
/* EB1508 802406A8 27BDFFE8 */ addiu $sp, $sp, -0x18
/* EB150C 802406AC AFBF0010 */ sw $ra, 0x10($sp)
/* EB1510 802406B0 8C82000C */ lw $v0, 0xc($a0)
/* EB1514 802406B4 0C0B53A3 */ jal dead_evt_get_variable
/* EB1518 802406B8 8C450000 */ lw $a1, ($v0)
/* EB151C 802406BC 3C018024 */ lui $at, %hi(D_802417E8_EB2648)
/* EB1520 802406C0 AC2217E8 */ sw $v0, %lo(D_802417E8_EB2648)($at)
/* EB1524 802406C4 24020002 */ addiu $v0, $zero, 2
/* EB1528 802406C8 8FBF0010 */ lw $ra, 0x10($sp)
/* EB152C 802406CC 24030001 */ addiu $v1, $zero, 1
/* EB1530 802406D0 3C018024 */ lui $at, %hi(D_802417E4_EB2644)
/* EB1534 802406D4 AC2317E4 */ sw $v1, %lo(D_802417E4_EB2644)($at)
/* EB1538 802406D8 03E00008 */ jr $ra
/* EB153C 802406DC 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,21 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_802409F8_EB1858
/* EB1858 802409F8 27BDFFE8 */ addiu $sp, $sp, -0x18
/* EB185C 802409FC AFB00010 */ sw $s0, 0x10($sp)
/* EB1860 80240A00 0080802D */ daddu $s0, $a0, $zero
/* EB1864 80240A04 AFBF0014 */ sw $ra, 0x14($sp)
/* EB1868 80240A08 0C00F92F */ jal dead_get_npc_unsafe
/* EB186C 80240A0C 8E04008C */ lw $a0, 0x8c($s0)
/* EB1870 80240A10 0040282D */ daddu $a1, $v0, $zero
/* EB1874 80240A14 8E040094 */ lw $a0, 0x94($s0)
/* EB1878 80240A18 8CA30028 */ lw $v1, 0x28($a1)
/* EB187C 80240A1C ACA40028 */ sw $a0, 0x28($a1)
/* EB1880 80240A20 8FBF0014 */ lw $ra, 0x14($sp)
/* EB1884 80240A24 8FB00010 */ lw $s0, 0x10($sp)
/* EB1888 80240A28 24020002 */ addiu $v0, $zero, 2
/* EB188C 80240A2C 3C018024 */ lui $at, %hi(D_80244494)
/* EB1890 80240A30 AC234494 */ sw $v1, %lo(D_80244494)($at)
/* EB1894 80240A34 03E00008 */ jr $ra
/* EB1898 80240A38 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,15 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80240A3C_EB189C
/* EB189C 80240A3C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* EB18A0 80240A40 AFBF0010 */ sw $ra, 0x10($sp)
/* EB18A4 80240A44 0C00F92F */ jal dead_get_npc_unsafe
/* EB18A8 80240A48 8C84008C */ lw $a0, 0x8c($a0)
/* EB18AC 80240A4C 3C038024 */ lui $v1, %hi(D_80244494)
/* EB18B0 80240A50 8C634494 */ lw $v1, %lo(D_80244494)($v1)
/* EB18B4 80240A54 AC430028 */ sw $v1, 0x28($v0)
/* EB18B8 80240A58 8FBF0010 */ lw $ra, 0x10($sp)
/* EB18BC 80240A5C 24020002 */ addiu $v0, $zero, 2
/* EB18C0 80240A60 03E00008 */ jr $ra
/* EB18C4 80240A64 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,13 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80240A68_EB18C8
/* EB18C8 80240A68 27BDFFE8 */ addiu $sp, $sp, -0x18
/* EB18CC 80240A6C 0000202D */ daddu $a0, $zero, $zero
/* EB18D0 80240A70 AFBF0010 */ sw $ra, 0x10($sp)
/* EB18D4 80240A74 0C0166B2 */ jal func_80059AC8
/* EB18D8 80240A78 24050001 */ addiu $a1, $zero, 1
/* EB18DC 80240A7C 8FBF0010 */ lw $ra, 0x10($sp)
/* EB18E0 80240A80 24020002 */ addiu $v0, $zero, 2
/* EB18E4 80240A84 03E00008 */ jr $ra
/* EB18E8 80240A88 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,17 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80240A8C_EB18EC
/* EB18EC 80240A8C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* EB18F0 80240A90 AFBF0010 */ sw $ra, 0x10($sp)
/* EB18F4 80240A94 8C82000C */ lw $v0, 0xc($a0)
/* EB18F8 80240A98 3C068017 */ lui $a2, %hi(D_80169B12)
/* EB18FC 80240A9C 84C69B12 */ lh $a2, %lo(D_80169B12)($a2)
/* EB1900 80240AA0 0C0B551A */ jal dead_evt_set_variable
/* EB1904 80240AA4 8C450000 */ lw $a1, ($v0)
/* EB1908 80240AA8 8FBF0010 */ lw $ra, 0x10($sp)
/* EB190C 80240AAC 24020002 */ addiu $v0, $zero, 2
/* EB1910 80240AB0 03E00008 */ jr $ra
/* EB1914 80240AB4 27BD0018 */ addiu $sp, $sp, 0x18
/* EB1918 80240AB8 00000000 */ nop
/* EB191C 80240ABC 00000000 */ nop