From bb8c7a842974fc0d55ebe23de7af54186dd46476 Mon Sep 17 00:00:00 2001 From: Chesyon <55322011+Chesyon@users.noreply.github.com> Date: Tue, 12 Aug 2025 18:09:55 -0600 Subject: [PATCH] Integrated revised monster data into existing code It compiles and matches now! Yay! --- include/monster_data.h | 89 ++++++++++++++++++++++-------------------- src/main_02052874.c | 2 +- src/main_02052950.c | 2 +- 3 files changed, 48 insertions(+), 45 deletions(-) diff --git a/include/monster_data.h b/include/monster_data.h index c016e701..8dca6c28 100644 --- a/include/monster_data.h +++ b/include/monster_data.h @@ -1,50 +1,53 @@ #ifndef PMDSKY_MONSTER_DATA_TABLE_PTR_H #define PMDSKY_MONSTER_DATA_TABLE_PTR_H +#include "enums.h" + 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. - u16 pokedex_number; // 0x4: The national Pokedex number, as displayed in Chimecho Assembly. - u16 base_movement_speed; // 0x6: The base movement speed in dungeons. - u16 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 movement_type; // 0x16: This decides what terrains the entity can move over, and whether its hovering or not. [Enum?] - 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?] - u16 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. Bits 8-15: Unknown. - 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. - 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. - 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 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. - s16 exclusive_item_1; // 0x34: The first 1-star exclusive item for this Pokemon. Null if NA. [Enum?] - s16 exclusive_item_2; // 0x36: The second 1-star exclusive item for this Pokemon. Null if NA. [Enum?] - s16 exclusive_item_3; // 0x38: The 2-star exclusive item for this Pokemon. Null if NA. [Enum?] - s16 exclusive_item_4; // 0x3A: The 3-star exclusive item for this Pokemon. Null if NA. [Enum?] - s16 unk_0x3c; // 0x3C: Unknown. - s16 unk_0x3e; // 0x3E: Unknown. Often 0xF. - s16 unk_0x40; // 0x40: Unknown. - s16 unk_0x42; // 0x42: Unknown. + 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. + u16 pokedex_number; // 0x4: The national Pokedex number, as displayed in Chimecho Assembly. + u16 base_movement_speed; // 0x6: The base movement speed in dungeons. + u16 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?] + 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 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! + s16 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. + 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 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. + s16 exclusive_item_1; // 0x34: The first 1-star exclusive item for this Pokemon. Null if NA. [Enum?] + s16 exclusive_item_2; // 0x36: The second 1-star exclusive item for this Pokemon. Null if NA. [Enum?] + s16 exclusive_item_3; // 0x38: The 2-star exclusive item for this Pokemon. Null if NA. [Enum?] + s16 exclusive_item_4; // 0x3A: The 3-star exclusive item for this Pokemon. Null if NA. [Enum?] + s16 unk_0x3c; // 0x3C: Unknown. + s16 unk_0x3e; // 0x3E: Unknown. Often 0xF. + s16 unk_0x40; // 0x40: Unknown. + s16 unk_0x42; // 0x42: Unknown. }; // The monster.md file without the header. This is what MONSTER_DATA_TABLE_PTR points to, though the diff --git a/src/main_02052874.c b/src/main_02052874.c index 21c45b57..85db0cd8 100644 --- a/src/main_02052874.c +++ b/src/main_02052874.c @@ -5,5 +5,5 @@ extern struct monster_data_table *MONSTER_DATA_TABLE_PTR; enum mobility_type GetMobilityType(s16 monster_id) { - return MONSTER_DATA_TABLE_PTR->entries[monster_id].mobility_type; + return MONSTER_DATA_TABLE_PTR->entries[monster_id].movement_type; } diff --git a/src/main_02052950.c b/src/main_02052950.c index 1765c90d..42dde747 100644 --- a/src/main_02052950.c +++ b/src/main_02052950.c @@ -5,5 +5,5 @@ extern struct monster_data_table *MONSTER_DATA_TABLE_PTR; bool8 CanThrowItems(s16 monster_id) { - return MONSTER_DATA_TABLE_PTR->entries[monster_id].can_throw_items & 0x20 ? TRUE : FALSE; + return MONSTER_DATA_TABLE_PTR->entries[monster_id].flags & 0b00100000 ? TRUE : FALSE; }