Decomped HasQuarterHPOrLess

This commit is contained in:
AnonymousRandomPerson
2022-02-20 22:51:36 -05:00
parent 7c714bd14e
commit ec6abc684e
5 changed files with 18 additions and 35 deletions

View File

@@ -1,33 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start HasQuarterHPOrLess
HasQuarterHPOrLess:
push {lr}
ldr r0, [r0, 0x70]
adds r1, r0, 0
movs r2, 0x10
ldrsh r0, [r1, r2]
cmp r0, 0
bge _08070B58
adds r0, 0x3
_08070B58:
movs r2, 0xE
ldrsh r1, [r1, r2]
asrs r0, 2
cmp r1, r0
ble _08070B66
movs r0, 0
b _08070B68
_08070B66:
movs r0, 0x1
_08070B68:
pop {r1}
bx r1
thumb_func_end HasQuarterHPOrLess
.align 2, 0

View File

@@ -7,5 +7,7 @@
bool8 HasNegativeStatus(struct DungeonEntity *pokemon);
// 0x70B28
bool8 IsSleeping(struct DungeonEntity *pokemon);
// 0x70B48
bool8 HasQuarterHPOrLess(struct DungeonEntity* pokemon);
#endif

View File

@@ -218,7 +218,6 @@ SECTIONS {
src/dungeon_movement.o(.text);
asm/code_807034C.o(.text);
src/status_checks_1.o(.text);
asm/code_8070B48.o(.text);
src/dungeon_capabilities.o(.text);
asm/code_8070BC0.o(.text);
src/dungeon_capabilities_1.o(.text);

View File

@@ -95,7 +95,6 @@ const u8 gDungeonCamouflageTypes[76] = {
TYPE_ROCK
};
extern bool8 HasQuarterHPOrLess(struct DungeonEntity*);
extern bool8 IsTileGround(struct MapTile*);
extern bool8 CanLayTrap(struct Position*);

View File

@@ -53,3 +53,19 @@ bool8 IsSleeping(struct DungeonEntity *pokemon)
}
return TRUE;
}
bool8 HasQuarterHPOrLess(struct DungeonEntity* pokemon)
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
struct DungeonEntityData *pokemonData2 = pokemon->entityData;
s32 maxHP = pokemonData->maxHP;
if (maxHP < 0)
{
maxHP += 3;
}
if (pokemonData2->HP <= maxHP >> 2)
{
return TRUE;
}
return FALSE;
}