diff --git a/asm/main_02052B44.s b/asm/main_02052B44.s index c1a52371..10a17010 100644 --- a/asm/main_02052B44.s +++ b/asm/main_02052B44.s @@ -3,22 +3,6 @@ .text - arm_func_start GetExclusiveItem -GetExclusiveItem: ; 0x02052B8C - ldr r2, _02052BB4 ; =MONSTER_DATA_TABLE_PTR - mov r3, r1, lsr #0x1f - ldr ip, [r2] - mov r2, #0x44 - rsb r1, r3, r1, lsl #30 - smlabb r2, r0, r2, ip - add r0, r3, r1, ror #30 - add r0, r2, r0, lsl #1 - ldrsh r0, [r0, #0x34] - bx lr - .align 2, 0 -_02052BB4: .word MONSTER_DATA_TABLE_PTR - arm_func_end GetExclusiveItem - arm_func_start GetFamilyIndex GetFamilyIndex: ; 0x02052BB8 ldr r2, _02052BD0 ; =MONSTER_DATA_TABLE_PTR diff --git a/include/main_02052B28.h b/include/main_02052B28.h index b428f195..4eb74083 100644 --- a/include/main_02052B28.h +++ b/include/main_02052B28.h @@ -6,6 +6,6 @@ s32 GetIqGroup(s16 monster_id); u8 GetSpawnThreshold(s16 monster_id); bool8 NeedsItemToSpawn(s16 monster_id); - +s16 GetExclusiveItem(s16 monster_id, s32 item_index); #endif //PMDSKY_MAIN_02052B28_H diff --git a/include/monster_data.h b/include/monster_data.h index 11de1a3e..b4a7ce15 100644 --- a/include/monster_data.h +++ b/include/monster_data.h @@ -5,15 +5,19 @@ extern struct monster_data_table *MONSTER_DATA_TABLE_PTR; +struct monster_evolution_parameters { + s16 pre_evolution_idx; // 0x8: The pre-evolution of the monster. + 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. +}; + 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. s16 pokedex_number; // 0x4: The national Pokedex number, as displayed in Chimecho Assembly. s16 base_movement_speed; // 0x6: The base movement speed in dungeons. - s16 pre_evolution_idx; // 0x8: The pre-evolution of the monster. - 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. + struct monster_evolution_parameters evolution_param; 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. u8 body_size; // 0x13: The body size of the Pokemon. Used when determining how many Pokemon fits in the party. @@ -38,10 +42,10 @@ struct monster_data_table_entry { u8 hp_regeneration; // 0x30: The rate at which a Pokemon regenerates HP. Always 0x64. 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. - s16 exclusive_item_3; // 0x38: The 2-star exclusive item for this Pokemon. Null if NA. - s16 exclusive_item_4; // 0x3A: The 3-star exclusive item for this Pokemon. Null if NA. + s16 exclusive_item[4]; // 0x34: The first 1-star exclusive item for this Pokemon + // 0x36: The second 1-star exclusive item for this Pokemon. Null if NA. + // 0x38: The 2-star exclusive item for this Pokemon. Null if NA. + // 0x3A: The 3-star exclusive item for this Pokemon. Null if NA. s16 unk_0x3c; // 0x3C: Unknown. s16 unk_0x3e; // 0x3E: Unknown. Often 0xF. s16 unk_0x40; // 0x40: Unknown. diff --git a/src/main_0205283C.c b/src/main_0205283C.c index 3bf1ef39..2d6b13f6 100644 --- a/src/main_0205283C.c +++ b/src/main_0205283C.c @@ -58,7 +58,7 @@ bool8 CanEvolve(s16 monster_id) s16 GetMonsterPreEvolution(s16 monster_id) { - return MONSTER_DATA_TABLE_PTR->entries[monster_id].pre_evolution_idx; + return MONSTER_DATA_TABLE_PTR->entries[monster_id].evolution_param.pre_evolution_idx; } u8 GetBaseOffensiveStat(s16 monster_id, u8 stat_idx) diff --git a/src/main_02052B28.c b/src/main_02052B28.c index 35dc003b..1858267d 100644 --- a/src/main_02052B28.c +++ b/src/main_02052B28.c @@ -15,3 +15,8 @@ bool8 NeedsItemToSpawn(s16 monster_id) { return MONSTER_DATA_TABLE_PTR->entries[monster_id].flags & 0b10000000 ? TRUE : FALSE; } + +s16 GetExclusiveItem(s16 monster_id, s32 item_index) +{ + return MONSTER_DATA_TABLE_PTR->entries[monster_id].exclusive_item[item_index % 4]; +}