From f0bd067b729e42c57b4baecfbc0240adf38ac234 Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Mon, 19 Jan 2026 17:38:51 -0800 Subject: [PATCH] few more monster funcs --- asm/main_02052B44.s | 28 ---------------------------- include/main_02052B28.h | 5 +++++ include/monster_data.h | 2 +- src/main_02052B28.c | 10 ++++++++++ 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/asm/main_02052B44.s b/asm/main_02052B44.s index 525d9014..c1a52371 100644 --- a/asm/main_02052B44.s +++ b/asm/main_02052B44.s @@ -3,34 +3,6 @@ .text - arm_func_start GetSpawnThreshold -GetSpawnThreshold: ; 0x02052B44 - ldr r2, _02052B5C ; =MONSTER_DATA_TABLE_PTR - mov r1, #0x44 - ldr r2, [r2] - smlabb r0, r0, r1, r2 - ldrb r0, [r0, #0x31] - bx lr - .align 2, 0 -_02052B5C: .word MONSTER_DATA_TABLE_PTR - arm_func_end GetSpawnThreshold - - arm_func_start NeedsItemToSpawn -NeedsItemToSpawn: ; 0x02052B60 - ldr r2, _02052B88 ; =MONSTER_DATA_TABLE_PTR - mov r1, #0x44 - ldr r2, [r2] - smlabb r0, r0, r1, r2 - ldrb r0, [r0, #0x1a] - tst r0, #0x80 - movne r0, #1 - moveq r0, #0 - and r0, r0, #0xff - bx lr - .align 2, 0 -_02052B88: .word MONSTER_DATA_TABLE_PTR - arm_func_end NeedsItemToSpawn - arm_func_start GetExclusiveItem GetExclusiveItem: ; 0x02052B8C ldr r2, _02052BB4 ; =MONSTER_DATA_TABLE_PTR diff --git a/include/main_02052B28.h b/include/main_02052B28.h index f4439f58..b428f195 100644 --- a/include/main_02052B28.h +++ b/include/main_02052B28.h @@ -1,6 +1,11 @@ #ifndef PMDSKY_MAIN_02052B28_H #define PMDSKY_MAIN_02052B28_H +#include "util.h" + s32 GetIqGroup(s16 monster_id); +u8 GetSpawnThreshold(s16 monster_id); +bool8 NeedsItemToSpawn(s16 monster_id); + #endif //PMDSKY_MAIN_02052B28_H diff --git a/include/monster_data.h b/include/monster_data.h index eddf2c9c..11de1a3e 100644 --- a/include/monster_data.h +++ b/include/monster_data.h @@ -36,7 +36,7 @@ struct monster_data_table_entry { u8 shadow_size; // 0x2E: The size of the Pokemon's shadow. 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. + s8 spawn_threshold; // 0x31: s16 base_form_idx; // 0x32: The base evolutionary stage of the Pokemon. Seems to always be between 0 and 600. s16 exclusive_item_1; // 0x34: The first 1-star exclusive item for this Pokemon. Null if NA. s16 exclusive_item_2; // 0x36: The second 1-star exclusive item for this Pokemon. Null if NA. diff --git a/src/main_02052B28.c b/src/main_02052B28.c index 8e908872..35dc003b 100644 --- a/src/main_02052B28.c +++ b/src/main_02052B28.c @@ -5,3 +5,13 @@ s32 GetIqGroup(s16 monster_id) { return MONSTER_DATA_TABLE_PTR->entries[monster_id].iq_group; } + +u8 GetSpawnThreshold(s16 monster_id) +{ + return MONSTER_DATA_TABLE_PTR->entries[monster_id].spawn_threshold; +} + +bool8 NeedsItemToSpawn(s16 monster_id) +{ + return MONSTER_DATA_TABLE_PTR->entries[monster_id].flags & 0b10000000 ? TRUE : FALSE; +}