match sub_8078A58

This commit is contained in:
Seth Barberee 2024-08-12 13:44:12 -07:00
parent d774d6d6ec
commit 184b6255cd
4 changed files with 70 additions and 121 deletions

View File

@ -5,125 +5,6 @@
.text
thumb_func_start sub_8078A58
sub_8078A58:
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x14
mov r8, r0
adds r6, r1, 0
adds r7, r2, 0
adds r5, r3, 0
adds r0, r6, 0
bl EntityExists
lsls r0, 24
cmp r0, 0
beq _08078B4A
ldr r4, [r6, 0x70]
cmp r5, 0
beq _08078AE0
mov r0, sp
adds r1, r5, 0
bl sub_80943A0
ldr r2, [sp]
movs r0, 0xA0
lsls r0, 1
adds r5, r4, r0
ldr r7, [r5]
add r0, sp, 0x4
adds r1, r7, 0
bl sub_80942C0
ldr r2, [sp, 0x4]
str r2, [r5]
movs r0, 0x9E
lsls r0, 1
adds r4, r0
ldr r1, [r4]
add r0, sp, 0x8
bl sub_8094318
ldr r0, [sp, 0x8]
str r0, [r4]
ldr r0, _08078AD0
adds r1, r6, 0
movs r2, 0
bl SetMessageArgument
adds r0, r7, 0
bl RoundUpFixedPoint
adds r4, r0, 0
ldr r0, [r5]
bl RoundUpFixedPoint
cmp r4, r0
beq _08078AD8
adds r0, r6, 0
bl sub_8041D9C
ldr r0, _08078AD4
b _08078B22
.align 2, 0
_08078AD0: .4byte gAvailablePokemonNames
_08078AD4: .4byte gUnknown_80FBD9C
_08078AD8:
ldr r0, _08078ADC
b _08078B22
.align 2, 0
_08078ADC: .4byte gUnknown_80FBE3C
_08078AE0:
add r0, sp, 0xC
adds r1, r7, 0
bl sub_80943A0
ldr r2, [sp, 0xC]
movs r0, 0x9E
lsls r0, 1
adds r4, r0
ldr r7, [r4]
add r0, sp, 0x10
adds r1, r7, 0
bl sub_80942C0
ldr r0, [sp, 0x10]
str r0, [r4]
ldr r0, _08078B30
adds r1, r6, 0
movs r2, 0
bl SetMessageArgument
adds r0, r7, 0
bl RoundUpFixedPoint
adds r5, r0, 0
ldr r0, [r4]
bl RoundUpFixedPoint
cmp r5, r0
beq _08078B38
adds r0, r6, 0
bl nullsub_84
ldr r0, _08078B34
_08078B22:
ldr r2, [r0]
mov r0, r8
adds r1, r6, 0
bl sub_80522F4
b _08078B44
.align 2, 0
_08078B30: .4byte gAvailablePokemonNames
_08078B34: .4byte gUnknown_80FBD78
_08078B38:
ldr r0, _08078B58
ldr r2, [r0]
mov r0, r8
adds r1, r6, 0
bl sub_80522F4
_08078B44:
adds r0, r6, 0
bl EntityUpdateStatusSprites
_08078B4A:
add sp, 0x14
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08078B58: .4byte gUnknown_80FBE40
thumb_func_end sub_8078A58
thumb_func_start sub_8078B5C
sub_8078B5C:
push {r4-r7,lr}

View File

@ -112,7 +112,7 @@ extern void sub_8072008(Entity *pokemon, Entity *r1, u32 r2, u8 r3, u32);
extern void LevelDownTarget(Entity *pokemon, Entity *r1, u32 r2);
extern void sub_80522F4(Entity *pokemon, Entity *r1, const u8[]);
extern void sub_806F370(Entity *pokemon, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32);
extern void sub_8078A58(Entity *, Entity *, s16, u32);
extern void sub_8078A58(Entity *, Entity *, s32, u32);
extern s32 sub_8042520(Entity *);
Entity *sub_80696FC(Entity *);
extern void sub_80943A0(void*, s32);

View File

@ -17,6 +17,7 @@
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util.h"
#include "math.h"
#include "number_util.h"
#include "status_checks_1.h"
#include "structs/map.h"
#include "structs/str_dungeon.h"
@ -24,6 +25,11 @@
extern u8 gAvailablePokemonNames[];
extern u8 gUnknown_202DE58[];
extern u8 *gUnknown_80FBD78[];
extern u8 *gUnknown_80FBD9C[];
extern u8 *gUnknown_80FBE40[];
extern u8 *gUnknown_80FBE3C[];
extern u8 *gUnknown_80FBE3C[];
extern u8 *gUnknown_80FC084[];
extern u8 *gUnknown_80FC090[];
extern u8 *gUnknown_80FC1C4[];
@ -146,6 +152,13 @@ extern void nullsub_80(Entity *);
extern void nullsub_81(Entity *);
extern void nullsub_82(Entity *);
extern void nullsub_83(Entity *);
extern void nullsub_84(Entity *);
extern void sub_80943A0(void*, s32);
extern void sub_80942C0(void*, s32, s32);
extern void sub_8094318(u32 *, u32, u32 );
extern void sub_8041D9C(Entity *);
extern void sub_803F580(u32);
extern void sub_8040A84(void);
extern void sub_8041CA8(Entity *);
@ -1225,3 +1238,58 @@ void EncoreStatusTarget(Entity *pokemon,Entity *target)
}
}
}
void sub_8078A58(struct Entity *pokemon, struct Entity *target, s32 param_3, s32 param_4)
{
struct EntityInfo *targetInfo;
u32 r7;
u32 sp_0x0;
u32 sp_0x4;
u32 sp_0x8;
u32 sp_0xC;
u32 sp_0x10;
u32 temp;
u32 temp2;
u32 temp3;
if (!EntityExists(target))
return;
targetInfo = target->info;
if (param_4 != 0) {
sub_80943A0(&sp_0x0, param_4);
temp2 = sp_0x0;
r7 = targetInfo->maxBelly;
sub_80942C0(&sp_0x4, r7, temp2);
targetInfo->maxBelly = sp_0x4;
temp3 = targetInfo->belly;
sub_8094318(&sp_0x8, temp3, targetInfo->maxBelly);
targetInfo->belly = sp_0x8;
SetMessageArgument(gAvailablePokemonNames, target, 0);
if (RoundUpFixedPoint(r7) != RoundUpFixedPoint(targetInfo->maxBelly)) {
sub_8041D9C(target);
sub_80522F4(pokemon, target, *gUnknown_80FBD9C);
}
else
sub_80522F4(pokemon, target, *gUnknown_80FBE3C);
}
else {
sub_80943A0(&sp_0xC, param_3);
temp = sp_0xC;
r7 = targetInfo->belly;
sub_80942C0(&sp_0x10, r7, temp);
targetInfo->belly = sp_0x10;
SetMessageArgument(gAvailablePokemonNames, target, 0);
if (RoundUpFixedPoint(r7) != RoundUpFixedPoint(targetInfo->belly)) {
nullsub_84(target);
sub_80522F4(pokemon, target, *gUnknown_80FBD78);
}
else
sub_80522F4(pokemon, target, *gUnknown_80FBE40);
}
EntityUpdateStatusSprites(target);
}

View File

@ -34,7 +34,7 @@
extern void sub_807F43C(Entity *, Entity *);
extern void sub_807DC68(Entity *, Entity *);
extern void sub_8078A58(Entity *, Entity *, s16, u32);
extern void sub_8078A58(Entity *, Entity *, s32, u32);
extern u32 sub_803D73C(u32);
extern void sub_8045C28(Item *, u8 , u8);
extern void sub_80464C8(Entity *, Position *, Item *);