From 30f66666d65e347b3ba2c24efdf9b9e3f114dfab Mon Sep 17 00:00:00 2001 From: Nasina Date: Fri, 18 Mar 2022 05:34:15 -0400 Subject: [PATCH] Matched func_802A1628_795908 (#664) * Decompiled and Matched func_802A1628_795908 * Fix flag checks and removed cast * Remove unnecessary scope * Fixed else code styling * Fixed if statement whitespace --- src/battle/star/up_and_away/7952E0.c | 22 +++++---- .../up_and_away/7952E0/func_802A1628_795908.s | 47 ------------------- 2 files changed, 12 insertions(+), 57 deletions(-) delete mode 100644 ver/us/asm/nonmatchings/battle/star/up_and_away/7952E0/func_802A1628_795908.s diff --git a/src/battle/star/up_and_away/7952E0.c b/src/battle/star/up_and_away/7952E0.c index c66ff48471..f305c54039 100644 --- a/src/battle/star/up_and_away/7952E0.c +++ b/src/battle/star/up_and_away/7952E0.c @@ -43,23 +43,25 @@ ApiStatus func_802A15B4_795894(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } -#ifdef NON_EQUIVALENT ApiStatus func_802A1628_795908(Evt* script, s32 isInitialCall) { Actor* targetActor = get_actor(get_actor(script->owner1.actorID)->targetActorID); - s32 flags = targetActor->flags; - + u32 flags; + script->varTable[0] = 0; - - if ((flags & ACTOR_FLAG_TARGET_ONLY) == NULL && (flags & ACTOR_FLAG_NO_DMG_APPLY) == NULL && (flags & ACTOR_FLAG_2000) == NULL && targetActor->actorBlueprint->upAndAwayChance != 0 && targetActor->actorBlueprint->upAndAwayChance >= rand_int(100)) { - script->varTable[0] = 1; + flags = targetActor->flags; + + if (!(flags & ACTOR_FLAG_TARGET_ONLY)) { + if (!(flags & ACTOR_FLAG_NO_DMG_APPLY)) { + if (!(flags & ACTOR_FLAG_2000) && targetActor->actorBlueprint->upAndAwayChance != 0 && rand_int(100) <= targetActor->actorBlueprint->upAndAwayChance) { + script->varTable[0] = 1; + } + } else { + return ApiStatus_DONE2; + } } return ApiStatus_DONE2; } -#else -ApiStatus func_802A1628_795908(Evt* script, s32 isInitialCall); -INCLUDE_ASM(s32, "battle/star/up_and_away/7952E0", func_802A1628_795908); -#endif EvtScript N(802A16D0) = { EVT_CALL(GetOwnerID, LW(10)) diff --git a/ver/us/asm/nonmatchings/battle/star/up_and_away/7952E0/func_802A1628_795908.s b/ver/us/asm/nonmatchings/battle/star/up_and_away/7952E0/func_802A1628_795908.s deleted file mode 100644 index 529f658a80..0000000000 --- a/ver/us/asm/nonmatchings/battle/star/up_and_away/7952E0/func_802A1628_795908.s +++ /dev/null @@ -1,47 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802A1628_795908 -/* 795908 802A1628 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 79590C 802A162C AFB10014 */ sw $s1, 0x14($sp) -/* 795910 802A1630 0080882D */ daddu $s1, $a0, $zero -/* 795914 802A1634 AFBF0018 */ sw $ra, 0x18($sp) -/* 795918 802A1638 AFB00010 */ sw $s0, 0x10($sp) -/* 79591C 802A163C 0C09A75B */ jal get_actor -/* 795920 802A1640 8E240148 */ lw $a0, 0x148($s1) -/* 795924 802A1644 0C09A75B */ jal get_actor -/* 795928 802A1648 84440428 */ lh $a0, 0x428($v0) -/* 79592C 802A164C 0040802D */ daddu $s0, $v0, $zero -/* 795930 802A1650 AE200084 */ sw $zero, 0x84($s1) -/* 795934 802A1654 8E030000 */ lw $v1, ($s0) -/* 795938 802A1658 30624000 */ andi $v0, $v1, 0x4000 -/* 79593C 802A165C 14400016 */ bnez $v0, .L802A16B8 -/* 795940 802A1660 24020002 */ addiu $v0, $zero, 2 -/* 795944 802A1664 3C020040 */ lui $v0, 0x40 -/* 795948 802A1668 00621024 */ and $v0, $v1, $v0 -/* 79594C 802A166C 14400012 */ bnez $v0, .L802A16B8 -/* 795950 802A1670 24020002 */ addiu $v0, $zero, 2 -/* 795954 802A1674 30622000 */ andi $v0, $v1, 0x2000 -/* 795958 802A1678 1440000F */ bnez $v0, .L802A16B8 -/* 79595C 802A167C 24020002 */ addiu $v0, $zero, 2 -/* 795960 802A1680 8E020008 */ lw $v0, 8($s0) -/* 795964 802A1684 9042001C */ lbu $v0, 0x1c($v0) -/* 795968 802A1688 1040000B */ beqz $v0, .L802A16B8 -/* 79596C 802A168C 24020002 */ addiu $v0, $zero, 2 -/* 795970 802A1690 0C00A67F */ jal rand_int -/* 795974 802A1694 24040064 */ addiu $a0, $zero, 0x64 -/* 795978 802A1698 8E030008 */ lw $v1, 8($s0) -/* 79597C 802A169C 9063001C */ lbu $v1, 0x1c($v1) -/* 795980 802A16A0 0062182A */ slt $v1, $v1, $v0 -/* 795984 802A16A4 14600004 */ bnez $v1, .L802A16B8 -/* 795988 802A16A8 24020002 */ addiu $v0, $zero, 2 -/* 79598C 802A16AC 24020001 */ addiu $v0, $zero, 1 -/* 795990 802A16B0 AE220084 */ sw $v0, 0x84($s1) -/* 795994 802A16B4 24020002 */ addiu $v0, $zero, 2 -.L802A16B8: -/* 795998 802A16B8 8FBF0018 */ lw $ra, 0x18($sp) -/* 79599C 802A16BC 8FB10014 */ lw $s1, 0x14($sp) -/* 7959A0 802A16C0 8FB00010 */ lw $s0, 0x10($sp) -/* 7959A4 802A16C4 03E00008 */ jr $ra -/* 7959A8 802A16C8 27BD0020 */ addiu $sp, $sp, 0x20 -/* 7959AC 802A16CC 00000000 */ nop