decomp sub_808F798

This commit is contained in:
Seth Barberee 2024-12-07 19:20:44 -08:00
parent fd1e3ad981
commit c7248641ee
4 changed files with 57 additions and 102 deletions

View File

@ -5,98 +5,6 @@
.text
thumb_func_start sub_808F798
sub_808F798:
push {r4-r6,lr}
sub sp, 0xA4
adds r4, r0, 0
lsls r1, 16
asrs r5, r1, 16
mov r0, sp
adds r1, r4, 0
movs r2, 0x58
bl memcpy
mov r0, sp
movs r1, 0x8
ldrsh r6, [r0, r1]
add r0, sp, 0x58
mov r1, sp
ldrb r2, [r1, 0x3]
adds r1, r5, 0
bl GetPokemonLevelData
ldr r0, [sp, 0x58]
str r0, [sp, 0x1C]
movs r0, 0
strh r0, [r4]
mov r0, sp
strh r5, [r0, 0x8]
ldrb r0, [r0, 0xC]
cmp r0, 0
bne _0808F7DA
mov r0, sp
mov r1, sp
ldrb r1, [r1, 0x3]
strb r1, [r0, 0xC]
b _0808F7EA
_0808F7DA:
mov r0, sp
ldrb r0, [r0, 0x10]
cmp r0, 0
bne _0808F7EA
mov r0, sp
mov r1, sp
ldrb r1, [r1, 0x3]
strb r1, [r0, 0x10]
_0808F7EA:
add r4, sp, 0x64
adds r0, r6, 0
bl GetMonSpecies
adds r1, r0, 0
adds r0, r4, 0
bl CopyStringtoBuffer
movs r2, 0
b _0808F800
_0808F7FE:
adds r2, 0x1
_0808F800:
cmp r2, 0x9
bgt _0808F816
adds r1, r4, r2
add r0, sp, 0x4C
adds r0, r2
ldrb r1, [r1]
ldrb r0, [r0]
cmp r1, r0
bne _0808F82E
cmp r1, 0
bne _0808F7FE
_0808F816:
movs r0, 0x1
cmp r0, 0
beq _0808F82E
add r4, sp, 0x4C
adds r0, r5, 0
bl GetMonSpecies
adds r1, r0, 0
adds r0, r4, 0
movs r2, 0xA
bl BoundedCopyStringtoBuffer
_0808F82E:
mov r0, sp
bl sub_808D1DC
add sp, 0xA4
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_808F798
thumb_func_start sub_808F83C
sub_808F83C:
movs r0, 0
strb r0, [r2]
bx lr
thumb_func_end sub_808F83C
thumb_func_start CreatePokemonInfoTabScreen
CreatePokemonInfoTabScreen:
push {r4-r7,lr}

View File

@ -30,10 +30,12 @@ void SetIQSkill(IqSkillFlags *iq, u32 skillIndex);
bool8 IsIQSkillSet(IqSkillFlags *iq, u32 IQSkillBit);
void SetDefaultIQSkills(IqSkillFlags *iq, bool8 enableSelfCurer);
void sub_808F468(PokemonStruct1 *param_1, EvolveStatus *evolveStatus, u8 param_3);
u32 sub_808F734(PokemonStruct1 *pokemon, s16 _species);
s32 sub_808F700(PokemonStruct1 *pokemon);
PokemonStruct1 *sub_808F734(PokemonStruct1 *pokemon, s16 _species);
s16 ExtractSpeciesIndex(UnkDungeonGlobal_unk1CD98 *r0);
void SetSpeciesLevelToExtract(UnkDungeonGlobal_unk1CD98 *r0, s32 level, s32 species);
s32 ExtractLevel(UnkDungeonGlobal_unk1CD98 *r0);
PokemonStruct1 *sub_808F798(PokemonStruct1 *pokemon, short _species);
// pokemon_3.s
extern void CreatePokemonInfoTabScreen(u32, s16, u32 *, u32 *, u32);

View File

@ -10,6 +10,7 @@
#include "constants/status.h"
#include "constants/type.h"
#include "constants/weather.h"
#include "dungeon_engine.h"
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_movement.h"
@ -65,7 +66,6 @@ extern void sub_803F4A0(Entity *a0);
extern bool8 sub_80860A8(u8 id);
extern u8 gUnknown_202F32C;
extern u8 sub_803D73C(s32 a0);
extern bool8 IsBossFight(void);
extern void DeletePokemonDungeonSprite(s32 id);
extern void sub_80429E8(Entity *r0);
extern s32 sub_803DA20(s32 param_1);
@ -84,7 +84,6 @@ extern void sub_803F580(s32);
extern void sub_8040A84(void);
extern void sub_806B678(void);
extern void EntityUpdateStatusSprites(Entity *);
extern s32 sub_808F700(PokemonStruct1 *pokemon);
extern Entity *sub_80696A8(Entity *a0);
extern int sprintf(char *, const char *, ...);
extern const u8 gUnknown_8106EA8[]; // talkp%d

View File

@ -8,6 +8,7 @@
#include "constants/iq_skill.h"
#include "constants/tactic.h"
#include "constants/type.h"
#include "structs/str_pokemon.h"
#include "sprite.h"
#include "text_util.h"
#include "friend_area.h"
@ -57,8 +58,6 @@ extern void ReadBellyBits(DataSerializer*, FixedPoint *dst);
extern void ReadHiddenPowerBits(DataSerializer*, HiddenPower*);
s16 GetPokemonEvolveConditions(s16 index, unkEvolve *r1);
u32 sub_808F798(PokemonStruct1 *, s16);
bool8 AddShadowSprite(s16 species, s16* a2, s16* a3)
{
if (species != MONSTER_DIGLETT && species != MONSTER_DUGTRIO) {
@ -1093,14 +1092,14 @@ s32 sub_808F700(PokemonStruct1 *pokemon)
}
}
u32 sub_808F734(PokemonStruct1 *pokemon, s16 _species)
PokemonStruct1 *sub_808F734(PokemonStruct1 *pokemon, s16 _species)
{
u32 uVar1;
int iVar3;
PokemonStruct1 *uVar1;
PokemonStruct1 *iVar3;
PokemonStruct1 pokeStruct;
s32 species = _species;
iVar3 = 0;
iVar3 = NULL;
pokeStruct = *pokemon;
uVar1 = sub_808F798(pokemon, species);
if (species == MONSTER_NINJASK) {
@ -1109,8 +1108,55 @@ u32 sub_808F734(PokemonStruct1 *pokemon, s16 _species)
BoundedCopyStringtoBuffer(pokeStruct.name, GetMonSpecies(MONSTER_SHEDINJA),POKEMON_NAME_LENGTH);
iVar3 = sub_808F798(&pokeStruct,MONSTER_SHEDINJA);
}
if (iVar3 != 0) {
if (iVar3 != NULL) {
IncrementAdventureNumJoined();
}
return uVar1;
}
PokemonStruct1 *sub_808F798(PokemonStruct1 *pokemon, short _species)
{
s32 r6;
s32 index;
PokemonStruct1 pokeStruct;
LevelData levelData;
u8 buffer [64];
s32 species = _species;
bool32 flag = TRUE;
pokeStruct = *pokemon;
r6 = pokeStruct.speciesNum;
GetPokemonLevelData(&levelData,species,pokeStruct.level);
pokeStruct.currExp = levelData.expRequired;
pokemon->unk0 = 0;
pokeStruct.speciesNum = species;
if (pokeStruct.unkC[0].level == 0) {
pokeStruct.unkC[0].level = pokeStruct.level;
}
else if (pokeStruct.unkC[1].level == 0) {
pokeStruct.unkC[1].level = pokeStruct.level;
}
CopyStringtoBuffer(buffer, GetMonSpecies(r6));
index = 0;
goto _start;
do
{
index++;
_start:
if(index >= POKEMON_NAME_LENGTH) break;
if(buffer[index] != pokeStruct.name[index]) goto _end;
if(buffer[index] == 0) break;
} while(TRUE);
if(flag)
BoundedCopyStringtoBuffer(pokeStruct.name, GetMonSpecies(species), POKEMON_NAME_LENGTH);
_end:
return sub_808D1DC(&pokeStruct);
}
UNUSED void sub_808F83C(PokemonStruct1 *pokemon, s16 species, u8 *r2)
{
*r2 = 0;
}