monster.md functions batch 3

That should be the rest of the functions that have the simple logic.
This commit is contained in:
Chesyon
2025-08-12 21:22:01 -06:00
parent 91fc06a840
commit f686cb3aba
6 changed files with 110 additions and 167 deletions

View File

@@ -1,4 +1,59 @@
#pragma once
.public Debug_Print0
.public DecompressAtNormalVeneer
.public DexNumbersEqual
.public DirectoryFileMngr_OpenDirectoryFile
.public DungeonToGroundMoveset
.public EnableAllLearnableIqSkills
.public FORBIDDEN_FORGOT_MOVE_LIST
.public FemaleToMaleForm
.public GetBaseDefensiveStat
.public GetBaseHp
.public GetBaseOffensiveStat
.public GetDexNumber
.public GetInfoGroundMoveset
.public GetInfoMoveGround
.public GetKeyM2NSwitch
.public GetKeyN2MSwitch
.public GetLanguage
.public GetMonsterGender
.public GetMonsterPreEvolution
.public GetMovesetEggPtr
.public GetMovesetHmTmPtr
.public GetMovesetIdx__02013CAC
.public GetMovesetLevelUpPtr
.public GetNameRaw
.public GetNameString
.public GetNbMoves
.public GetSpriteSize
.public GroundToDungeonMoveset
.public HIDDEN_POWER_BASE_POWER_TABLE
.public HandleSir0Translation
.public IsShaymin
.public IsValidTeamMember
.public ItemZInit
.public LEVEL_UP_DATA_DECOMPRESS_BUFFER
.public LEVEL_UP_DATA_MONSTER_ID
.public LoadFileFromRom
.public LoadMonsterMd
.public MONSTER_DATA_TABLE_PTR
.public MemAlloc
.public MemFree
.public PointsToZero
.public Rand16Bit
.public RandIntSafe
.public RemoveActiveMembersFromAllTeams
.public RemoveActiveMembersFromRescueTeam
.public RemoveActiveMembersFromSpecialEpisodeTeam
.public SprintfStatic__02052418
.public StrcpyName
.public StrncmpSimple
.public StrncpyName
.public StrncpySimple
.public TEAM_MEMBER_TABLE
.public TEAM_MEMBER_TABLE_PTR
.public UnloadFile
.public ZInit8
.public _020A1880
.public _020A1884
.public _020A189C
@@ -17,54 +72,6 @@
.public _020B12F4_EU
.public _020B1308_EU
.public _s32_div_f
.public Debug_Print0
.public DecompressAtNormalVeneer
.public DexNumbersEqual
.public DirectoryFileMngr_OpenDirectoryFile
.public DungeonToGroundMoveset
.public EnableAllLearnableIqSkills
.public FemaleToMaleForm
.public FORBIDDEN_FORGOT_MOVE_LIST
.public GetBaseHp
.public GetDexNumber
.public GetInfoGroundMoveset
.public GetInfoMoveGround
.public GetKeyM2NSwitch
.public GetKeyN2MSwitch
.public GetLanguage
.public GetMonsterGender
.public GetMovesetEggPtr
.public GetMovesetHmTmPtr
.public GetMovesetIdx__02013CAC
.public GetMovesetLevelUpPtr
.public GetNameRaw
.public GetNameString
.public GetNbMoves
.public GetSpriteSize
.public GroundToDungeonMoveset
.public HandleSir0Translation
.public HIDDEN_POWER_BASE_POWER_TABLE
.public IsShaymin
.public IsValidTeamMember
.public ItemZInit
.public LEVEL_UP_DATA_DECOMPRESS_BUFFER
.public LEVEL_UP_DATA_MONSTER_ID
.public LoadFileFromRom
.public LoadMonsterMd
.public MemAlloc
.public MemFree
.public MONSTER_DATA_TABLE_PTR
.public PointsToZero
.public Rand16Bit
.public RandIntSafe
.public RemoveActiveMembersFromAllTeams
.public RemoveActiveMembersFromRescueTeam
.public RemoveActiveMembersFromSpecialEpisodeTeam
.public SprintfStatic__02052418
.public StrcpyName
.public StrncmpSimple
.public StrncpyName
.public StrncpySimple
.public sub_01FF8F28
.public sub_02015090
.public sub_02025304_JP
@@ -78,8 +85,4 @@
.public sub_020560B8
.public sub_020564B0
.public sub_02056504
.public TEAM_MEMBER_TABLE
.public TEAM_MEMBER_TABLE_PTR
.public UnloadFile
.public vsprintf
.public ZInit8

View File

@@ -1,112 +1,8 @@
.include "asm/macros.inc"
.include "main_0205297C.inc"
.include "main_02052A7C.inc"
.text
arm_func_start CanEvolve
CanEvolve: ; 0x0205297C
ldr r2, _020529A4 ; =MONSTER_DATA_TABLE_PTR
mov r1, #0x44
ldr r2, [r2]
smlabb r0, r0, r1, r2
ldrb r0, [r0, #0x1a]
tst r0, #0x40
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_020529A4: .word MONSTER_DATA_TABLE_PTR
arm_func_end CanEvolve
arm_func_start GetMonsterPreEvolution
GetMonsterPreEvolution: ; 0x020529A8
ldr r2, _020529C0 ; =MONSTER_DATA_TABLE_PTR
mov r1, #0x44
ldr r2, [r2]
smlabb r0, r0, r1, r2
ldrsh r0, [r0, #8]
bx lr
.align 2, 0
_020529C0: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetMonsterPreEvolution
arm_func_start GetBaseOffensiveStat
GetBaseOffensiveStat: ; 0x020529C4
ldr r3, _020529E0 ; =MONSTER_DATA_TABLE_PTR
mov r2, #0x44
ldr r3, [r3]
smlabb r0, r0, r2, r3
add r0, r0, r1
ldrb r0, [r0, #0x24]
bx lr
.align 2, 0
_020529E0: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetBaseOffensiveStat
arm_func_start GetBaseDefensiveStat
GetBaseDefensiveStat: ; 0x020529E4
ldr r3, _02052A00 ; =MONSTER_DATA_TABLE_PTR
mov r2, #0x44
ldr r3, [r3]
smlabb r0, r0, r2, r3
add r0, r0, r1
ldrb r0, [r0, #0x26]
bx lr
.align 2, 0
_02052A00: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetBaseDefensiveStat
arm_func_start GetType
GetType: ; 0x02052A04
ldr r3, _02052A20 ; =MONSTER_DATA_TABLE_PTR
mov r2, #0x44
ldr r3, [r3]
smlabb r0, r0, r2, r3
add r0, r0, r1
ldrb r0, [r0, #0x14]
bx lr
.align 2, 0
_02052A20: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetType
arm_func_start GetAbility
GetAbility: ; 0x02052A24
ldr r3, _02052A40 ; =MONSTER_DATA_TABLE_PTR
mov r2, #0x44
ldr r3, [r3]
smlabb r0, r0, r2, r3
add r0, r0, r1
ldrb r0, [r0, #0x18]
bx lr
.align 2, 0
_02052A40: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetAbility
arm_func_start GetRecruitRate2
GetRecruitRate2: ; 0x02052A44
ldr r2, _02052A5C ; =MONSTER_DATA_TABLE_PTR
mov r1, #0x44
ldr r2, [r2]
smlabb r0, r0, r1, r2
ldrsh r0, [r0, #0x22]
bx lr
.align 2, 0
_02052A5C: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetRecruitRate2
arm_func_start GetRecruitRate1
GetRecruitRate1: ; 0x02052A60
ldr r2, _02052A78 ; =MONSTER_DATA_TABLE_PTR
mov r1, #0x44
ldr r2, [r2]
smlabb r0, r0, r1, r2
ldrsh r0, [r0, #0x1e]
bx lr
.align 2, 0
_02052A78: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetRecruitRate1
arm_func_start GetExp
GetExp: ; 0x02052A7C
stmdb sp!, {r4, lr}

View File

@@ -14,5 +14,13 @@ u16 GetWeightMultiplier(s16 monster_id);
u16 GetSize(s16 monster_id);
u16 GetBaseHp(s16 monster_id);
bool8 CanThrowItems(s16 monster_id);
bool8 CanEvolve(s16 monster_id);
s16 GetMonsterPreEvolution(s16 monster_id);
u8 GetBaseOffensiveStat(s16 monster_id, u8 stat_idx);
u8 GetBaseDefensiveStat(s16 monster_id, u8 stat_idx);
u8 GetType(s16 monster_id, u8 type_idx);
u8 GetAbility(s16 monster_id, u8 ability_idx);
s16 GetRecruitRate2(s16 monster_id);
s16 GetRecruitRate1(s16 monster_id);
#endif //PMDSKY_MAIN_0205283C_H

View File

@@ -10,29 +10,25 @@ struct monster_data_table_entry {
u16 unk_0x2; // 0x2: Unknown. Pokemon with the same category string have the same value in here.
s16 pokedex_number; // 0x4: The national Pokedex number, as displayed in Chimecho Assembly.
s16 base_movement_speed; // 0x6: The base movement speed in dungeons.
u16 pre_evolution_idx; // 0x8: The pre-evolution of the monster. [Enum?]
s16 pre_evolution_idx; // 0x8: The pre-evolution of the monster. [Enum?]
u16 evolution_method; // 0xA: The evolution method required to evolve to this Pokemon from the pre-evo specified in PreEvoIndex. Null if unused.
u16 evolution_param_1; // 0xC: The first parameter for the evolution method. Null if unused.
u16 evolution_param_2; // 0xE: The second parameter for the evolution method. Null if unused.
u16 sprite_index; // 0x10: The index of the entity's sprite. It's the index inside the three Pokemon sprite files inside the "/MONSTER/" directory!
u8 gender; // 0x12: Gender of this particular entity entry. [Enum?]
u8 body_size; // 0x13: The body size of the Pokemon. Used when determining how many Pokemon fits in the party.
u8 primary_type; // 0x14: The Pokemon's primary type. [Enum?]
u8 secondary_type; // 0x15: The Pokemon's secondary type. [Enum?]
u8 types[2]; // 0x14: The Pokemon's types. [Enum?]
enum mobility_type movement_type; // 0x16: This decides what terrains the entity can move over, and whether its hovering or not.
u8 iq_group; // 0x17: The IQ group the Pokemon belongs to. [Enum?]
u8 primary_ability; // 0x18: The Pokemon's primary ability's ID. [Enum?]
u8 secondary_ability; // 0x19: The Pokemon's secondary ability's ID. [Enum?]
u8 abilities[2]; // 0x18: The Pokemon's abilities. [Enum?]
u8 flags; // 0x1A: Stores bitflags. Bits 0-3: Unknown. Bit 4: If false, the Pokemon can't move inside of dungeons. Bit 5: If false, the Pokemon can't throw items. Bit 6: If false, the Pokemon can't evolve at Luminous Spring, even if it has an evolution. Bit 7: If true, the Pokemon requires a special item to spawn.
u8 unk_0x1b; // 0x1B: Unknown. Possibly more flags?
u16 exp_yield; // 0x1C: The Exp yield.
s16 recruit_rate_1; // 0x1E: Another recruit rate, this one is usually closer to 0 when RecruitRate1 and RecruitRate2 are different!
u16 base_hp; // 0x20: The HP the Pokemon has at lvl 1.
s16 recruit_rate_2; // 0x22: Recruit rate.
s8 base_atk; // 0x24: The attack stat of the Pokemon at lvl 1.
s8 base_sp_atk; // 0x25: The special attack stat of the Pokemon at lvl 1.
s8 base_def; // 0x26: The defense stat of the pokemon at lvl 1.
s8 base_sp_def; // 0x27: The base special defense of the pokemon at lvl 1.
u8 base_atk[2]; // 0x24: The attack stat of the Pokemon at lvl 1, followed by the special attack stat of the Pokemon at lvl 1.
u8 base_def[2]; // 0x26: The defense stat of the Pokemon at lvl 1, followed by the special defense stat of the Pokemon at lvl 1.
u16 weight; // 0x28: The weight tier for weight based damages.
u16 size; // 0x2A: The size tier for size based damages.
s8 unk_0x2c; // 0x2C: Unknown. Most of the time 0xA.

View File

@@ -70,7 +70,7 @@ Static main
Object src/main_020527A8.o
Object asm/main_020527E0.o
Object src/main_0205283C.o
Object asm/main_0205297C.o
Object asm/main_02052A7C.o
Object src/main_02054AA4.o
Object asm/main_02054AD4.o
Object src/main_02054BE0.o

View File

@@ -50,3 +50,43 @@ bool8 CanThrowItems(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].flags & 0b00100000 ? TRUE : FALSE;
}
bool8 CanEvolve(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].flags & 0b01000000 ? TRUE : FALSE;
}
s16 GetMonsterPreEvolution(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].pre_evolution_idx;
}
u8 GetBaseOffensiveStat(s16 monster_id, u8 stat_idx)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].base_atk[stat_idx];
}
u8 GetBaseDefensiveStat(s16 monster_id, u8 stat_idx)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].base_def[stat_idx];
}
u8 GetType(s16 monster_id, u8 type_idx)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].types[type_idx];
}
u8 GetAbility(s16 monster_id, u8 ability_idx)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].abilities[ability_idx];
}
s16 GetRecruitRate2(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].recruit_rate_2;
}
s16 GetRecruitRate1(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].recruit_rate_1;
}