Decompile btl_check_player_defeated function (#326)

* Decompile btl_check_player_defeated

* Ran coverage.py

* Replaced pointer arithmetic with undefined symbol

* Actually did the math to use the correct undefined symbol

* Address style for pull request
This commit is contained in:
Nalfein (Kenny) 2021-07-20 22:58:08 -04:00 committed by GitHub
parent cbb656f3c9
commit 9e9bb3a049
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 28 deletions

View File

@ -24,7 +24,9 @@ extern s32 gBattleState;
extern BattleStatus gBattleStatus;
extern s32 D_800DC4D0;
extern s32 D_800DC4D4;
extern s32 D_800DC4D8;
extern s32 gBattleState2;
extern s32 D_800DC4E4;
extern s32 D_800DC4E8;
extern u8 gCurrentBattleSection; // in the middle of the previous var
extern u8 D_800DC4EB; // in the middle of the previous var

View File

@ -1076,7 +1076,15 @@ INCLUDE_ASM(s32, "190B20", btl_are_all_enemies_defeated);
INCLUDE_ASM(s32, "190B20", btl_check_enemies_defeated);
INCLUDE_ASM(s32, "190B20", btl_check_player_defeated);
s32 btl_check_player_defeated(void) {
if (gPlayerData.curHP > 0) {
return FALSE;
}
D_800DC4E4 = gBattleState;
D_800DC4D8 = gBattleState2;
btl_set_state(0x1B);
return TRUE;
}
INCLUDE_ASM(s32, "190B20", func_802634B8);

View File

@ -1,27 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel btl_check_player_defeated
/* 191D44 80263464 3C028011 */ lui $v0, %hi(gPlayerData+0x2)
/* 191D48 80263468 8042F292 */ lb $v0, %lo(gPlayerData+0x2)($v0)
/* 191D4C 8026346C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 191D50 80263470 1C40000D */ bgtz $v0, .L802634A8
/* 191D54 80263474 AFBF0010 */ sw $ra, 0x10($sp)
/* 191D58 80263478 3C02800E */ lui $v0, %hi(gBattleState)
/* 191D5C 8026347C 8C42C068 */ lw $v0, %lo(gBattleState)($v0)
/* 191D60 80263480 3C03800E */ lui $v1, %hi(gBattleState2)
/* 191D64 80263484 8C63C4DC */ lw $v1, %lo(gBattleState2)($v1)
/* 191D68 80263488 3C01800E */ lui $at, %hi(gBattleStatus+0x474)
/* 191D6C 8026348C AC22C4E4 */ sw $v0, %lo(gBattleStatus+0x474)($at)
/* 191D70 80263490 3C01800E */ lui $at, %hi(D_800DC4D8)
/* 191D74 80263494 AC23C4D8 */ sw $v1, %lo(D_800DC4D8)($at)
/* 191D78 80263498 0C090464 */ jal btl_set_state
/* 191D7C 8026349C 2404001B */ addiu $a0, $zero, 0x1b
/* 191D80 802634A0 08098D2B */ j .L802634AC
/* 191D84 802634A4 24020001 */ addiu $v0, $zero, 1
.L802634A8:
/* 191D88 802634A8 0000102D */ daddu $v0, $zero, $zero
.L802634AC:
/* 191D8C 802634AC 8FBF0010 */ lw $ra, 0x10($sp)
/* 191D90 802634B0 03E00008 */ jr $ra
/* 191D94 802634B4 27BD0018 */ addiu $sp, $sp, 0x18