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
This commit is contained in:
Nasina 2022-03-18 05:34:15 -04:00 committed by GitHub
parent 9dcb0616b6
commit 30f66666d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 57 deletions

View File

@ -43,23 +43,25 @@ ApiStatus func_802A15B4_795894(Evt* script, s32 isInitialCall) {
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
} }
#ifdef NON_EQUIVALENT
ApiStatus func_802A1628_795908(Evt* script, s32 isInitialCall) { ApiStatus func_802A1628_795908(Evt* script, s32 isInitialCall) {
Actor* targetActor = get_actor(get_actor(script->owner1.actorID)->targetActorID); Actor* targetActor = get_actor(get_actor(script->owner1.actorID)->targetActorID);
s32 flags = targetActor->flags; u32 flags;
script->varTable[0] = 0; script->varTable[0] = 0;
flags = targetActor->flags;
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)) { 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; script->varTable[0] = 1;
} }
} else {
return ApiStatus_DONE2;
}
}
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) = { EvtScript N(802A16D0) = {
EVT_CALL(GetOwnerID, LW(10)) EVT_CALL(GetOwnerID, LW(10))

View File

@ -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