First batch of monster.md functions

This commit is contained in:
Chesyon
2025-08-12 19:09:25 -06:00
parent bb8c7a8429
commit 2f5fddf343
11 changed files with 52 additions and 113 deletions

View File

@@ -1,2 +0,0 @@
#pragma once
.public MONSTER_DATA_TABLE_PTR

View File

@@ -1,82 +0,0 @@
.include "asm/macros.inc"
.include "main_02052890.inc"
.text
arm_func_start GetRegenSpeed
GetRegenSpeed: ; 0x02052890
ldr r2, _020528B0 ; =MONSTER_DATA_TABLE_PTR
mov r1, #0x44
ldr r2, [r2]
smlabb r0, r0, r1, r2
ldrb r0, [r0, #0x30]
mov r0, r0, lsl #1
and r0, r0, #0xff
bx lr
.align 2, 0
_020528B0: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetRegenSpeed
arm_func_start GetCanMoveFlag
GetCanMoveFlag: ; 0x020528B4
ldr r2, _020528DC ; =MONSTER_DATA_TABLE_PTR
mov r1, #0x44
ldr r2, [r2]
smlabb r0, r0, r1, r2
ldrb r0, [r0, #0x1a]
tst r0, #0x10
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_020528DC: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetCanMoveFlag
arm_func_start GetChanceAsleep
GetChanceAsleep: ; 0x020528E0
ldr r2, _020528F8 ; =MONSTER_DATA_TABLE_PTR
mov r1, #0x44
ldr r2, [r2]
smlabb r0, r0, r1, r2
ldrb r0, [r0, #0x2f]
bx lr
.align 2, 0
_020528F8: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetChanceAsleep
arm_func_start GetWeightMultiplier
GetWeightMultiplier: ; 0x020528FC
ldr r2, _02052914 ; =MONSTER_DATA_TABLE_PTR
mov r1, #0x44
ldr r2, [r2]
smlabb r0, r0, r1, r2
ldrh r0, [r0, #0x28]
bx lr
.align 2, 0
_02052914: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetWeightMultiplier
arm_func_start GetSize
GetSize: ; 0x02052918
ldr r2, _02052930 ; =MONSTER_DATA_TABLE_PTR
mov r1, #0x44
ldr r2, [r2]
smlabb r0, r0, r1, r2
ldrh r0, [r0, #0x2a]
bx lr
.align 2, 0
_02052930: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetSize
arm_func_start GetBaseHp
GetBaseHp: ; 0x02052934
ldr r2, _0205294C ; =MONSTER_DATA_TABLE_PTR
mov r1, #0x44
ldr r2, [r2]
smlabb r0, r0, r1, r2
ldrh r0, [r0, #0x20]
bx lr
.align 2, 0
_0205294C: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetBaseHp

View File

@@ -2,7 +2,15 @@
#define PMDSKY_MAIN_02052874_H
#include "enums.h"
#include "util.h"
enum mobility_type GetMobilityType(s16 monster_id);
u8 GetRegenSpeed(s16 monster_id);
bool8 GetCanMoveFlag(s16 monster_id);
u8 GetChanceAsleep(s16 monster_id);
u16 GetWeightMultiplier(s16 monster_id);
u16 GetSize(s16 monster_id);
u16 GetBaseHp(s16 monster_id);
bool8 CanThrowItems(s16 monster_id);
#endif //PMDSKY_MAIN_02052874_H

View File

@@ -1,8 +0,0 @@
#ifndef PMDSKY_MAIN_02052950_H
#define PMDSKY_MAIN_02052950_H
#include "util.h"
bool8 CanThrowItems(s16 monster_id);
#endif //PMDSKY_MAIN_02052950_H

View File

@@ -3,6 +3,8 @@
#include "enums.h"
extern struct monster_data_table *MONSTER_DATA_TABLE_PTR;
struct monster_data_table_entry {
u16 entity_id; // 0x0: A entity-unique ID to identify the entity in both of its 2 entries. Seems to match pokedex number.
u16 unk_0x2; // 0x2: Unknown. Pokemon with the same category string have the same value in here.
@@ -25,18 +27,18 @@ struct monster_data_table_entry {
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!
s16 base_hp; // 0x20: The HP the Pokemon has at lvl 1.
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.
s16 weight; // 0x28: The weight tier for weight based damages.
s16 size; // 0x2A: The size tier for size based damages.
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.
s8 unk_0x2d; // 0x2D: Unknown. Most of the time 0xA.
s8 shadow_size; // 0x2E: The size of the Pokemon's shadow.
s8 spawn_asleep_chance; // 0x2F: The percent chance that a Pokemon will spawn asleep. Most of the time 0x8.
u8 spawn_asleep_chance; // 0x2F: The percent chance that a Pokemon will spawn asleep. Most of the time 0x8.
u8 hp_regeneration; // 0x30: The rate at which a Pokemon regenerates HP. Always 0x64.
s8 unk_0x31; // 0x31: Unknown.
s16 base_form_idx; // 0x32: The base evolutionary stage of the Pokemon. Seems to always be between 0 and 600.

View File

@@ -66,8 +66,6 @@ Static main
Object src/main_02051760.o
Object asm/main_02051788.o
Object src/main_02052874.o
Object asm/main_02052890.o
Object src/main_02052950.o
Object asm/main_0205297C.o
Object src/main_02054AA4.o
Object asm/main_02054AD4.o

View File

@@ -1,6 +1,5 @@
#include "dungeon_action.h"
extern bool8 GetCanMoveFlag(s16 monster_id);
#include "main_02052874.h"
void ClearMonsterActionFields(struct action_data *monster_action)
{

View File

@@ -10,6 +10,7 @@
#include "dungeon_util_static.h"
#include "dungeon_util.h"
#include "dungeon_visibility.h"
#include "main_02052874.h"
#include "overlay_29_022FB538.h"
#include "status_checks.h"
#include "targeting.h"
@@ -25,7 +26,6 @@
extern void EndFrozenClassStatus(struct entity *user, struct entity *target, bool8 log);
extern void SubstitutePlaceholderStringTags(u8 *string_id, struct entity *entity, u32 param_3);
extern void LogMessageByIdWithPopupCheckUser(struct entity *user, u32 message_id);
extern bool8 GetCanMoveFlag(s16 monster_id);
extern void AiMovement(struct entity *monster, bool8 show_run_away_effect);
void RunMonsterAi(struct entity *monster, u32 unused)

View File

@@ -1,5 +1,5 @@
#include "dungeon_logic_2.h"
#include "main_02052950.h"
#include "main_02052874.h"
bool8 MonsterCanThrowItems(struct monster *monster)
{

View File

@@ -1,9 +1,42 @@
#include "main_02052874.h"
#include "monster_data.h"
extern struct monster_data_table *MONSTER_DATA_TABLE_PTR;
enum mobility_type GetMobilityType(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].movement_type;
}
u8 GetRegenSpeed(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].hp_regeneration << 1;
}
bool8 GetCanMoveFlag(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].flags & 0b00010000 ? TRUE : FALSE;
}
u8 GetChanceAsleep(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].spawn_asleep_chance;
}
u16 GetWeightMultiplier(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].weight;
}
u16 GetSize(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].size;
}
u16 GetBaseHp(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].base_hp;
}
bool8 CanThrowItems(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].flags & 0b00100000 ? TRUE : FALSE;
}

View File

@@ -1,9 +0,0 @@
#include "main_02052950.h"
#include "monster_data.h"
extern struct monster_data_table *MONSTER_DATA_TABLE_PTR;
bool8 CanThrowItems(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].flags & 0b00100000 ? TRUE : FALSE;
}