diff --git a/headers/data/arm9.h b/headers/data/arm9.h index d3ab1a7b..6b898781 100644 --- a/headers/data/arm9.h +++ b/headers/data/arm9.h @@ -119,6 +119,7 @@ extern int16_t MUNCH_BELT_STAT_BOOST; extern int16_t GUMMI_STAT_BOOST; extern int32_t MIN_IQ_EXCLUSIVE_MOVE_USER; extern int16_t WONDER_GUMMI_IQ_GAIN; +extern int16_t WONDER_GUMMI_BELLY_RESTORE; extern int16_t AURA_BOW_STAT_BOOST; extern int16_t MULTITALENT_PP_BOOST_AMOUNT; extern int32_t MIN_IQ_ITEM_MASTER; diff --git a/headers/data/overlay10.h b/headers/data/overlay10.h index 3298b902..b9be6a33 100644 --- a/headers/data/overlay10.h +++ b/headers/data/overlay10.h @@ -41,6 +41,7 @@ extern int16_t MONSTER_HOUSE_MAX_NON_MONSTER_SPAWNS; extern int16_t HEAL_ORDER_HP_RESTORATION; extern int16_t CURSE_DAMAGE_COOLDOWN; extern int16_t STEEL_WING_BOOST_DEFENSE_CHANCE; +extern int16_t GUMMI_STAT_BOOST_CHANCE; extern int16_t GOLD_THORN_POWER; extern int16_t BURN_DAMAGE; extern int16_t POISON_DAMAGE; diff --git a/headers/functions/arm9.h b/headers/functions/arm9.h index 041f3871..4462924f 100644 --- a/headers/functions/arm9.h +++ b/headers/functions/arm9.h @@ -661,7 +661,7 @@ void UpdateWindow(int window_id); void ClearWindow(int window_id); void DeleteWindow(int window_id); void GetWindowRectangle(int window_id, struct window_rectangle* rect_out); -void* GetWindowContents(int window_id); +union window_contents GetWindowContents(int window_id); void LoadCursors(void); void InitWindowTrailer(struct window_trailer* trailer); uint8_t LoadPrevMenuItem(int menu_id); @@ -1217,6 +1217,7 @@ void InitializeTeamMemberFromMentry(struct team_member* team_member, void AddStarterEggMove(struct ground_monster* ground_monster); void GetLvlUpEntry(struct level_up_entry* level_up_entry, enum monster_id monster_id, int level); uint8_t* GetEncodedHalfword(uint8_t* data_ptr, uint16_t* result); +bool CanMonsterLearnMove(enum monster_id monster_id, enum move_id move_id); int GetEvoFamily(undefined* monster, undefined* evo_family); int GetEvolutions(enum monster_id monster_id, enum monster_id* output_list, bool skip_sprite_size_check, bool skip_shedinja_check); @@ -1239,7 +1240,7 @@ bool IsShaymin(enum monster_id monster_id); bool IsCastform(enum monster_id monster_id); bool IsCherrim(enum monster_id monster_id); bool IsDeoxys(enum monster_id monster_id); -enum monster_id GetSecondFormIfValid(enum monster_id monster_id); +enum monster_id MaleToFemaleForm(enum monster_id monster_id); enum monster_id FemaleToMaleForm(enum monster_id monster_id); enum monster_id GetBaseFormCastformDeoxysCherrim(enum monster_id monster_id); bool BaseFormsEqual(enum monster_id monster1, enum monster_id monster2); @@ -1349,6 +1350,8 @@ int CountJobListMissions(void); int DungeonRequestsDone(uint8_t param_1, bool param_2); int DungeonRequestsDoneWrapper(uint8_t param_1); bool AnyDungeonRequestsDone(uint8_t param_1); +bool GetUnfulfilledMissionRestrictions(enum dungeon_id dungeon_id, struct type_id_16* type_id, + struct monster_id_16* monster_id); bool AddMissionToJobList(struct mission* mission); struct mission* GetAcceptedMission(uint8_t mission_id); bool IsAcceptedMissionSlotEmpty(int32_t mission_slot); diff --git a/headers/functions/overlay29.h b/headers/functions/overlay29.h index e52bf3af..500c7d14 100644 --- a/headers/functions/overlay29.h +++ b/headers/functions/overlay29.h @@ -101,6 +101,9 @@ void PlayEffectAnimation0x1A9(struct entity* entity); void PlayEffectAnimation0x29(struct entity* entity); void PlayEffectAnimation0x18E(struct entity* entity); void PlayKeyDoorUnlockEffect(struct entity* entity, bool is_not_treasure_memo); +void PlayEscapeEffect(int effect_id, struct entity* entity, undefined4 param_3); +void PlayStandardEscapeEffect(struct entity* entity); +void PlayEscapeOrbEscapeEffect(struct entity* entity); void PlayStairSensorArrowEffect(struct entity* entity, enum direction_id arrow_dir); void InitMonsterMoveEffect(int live_effect_unique_id, struct entity* entity, undefined4 param_3); void FreeMonsterMoveEffects(void); @@ -480,7 +483,7 @@ int GetMovePower(struct entity* entity, struct move* move); bool MonsterCanThrowItems(struct monster* monster); bool UpdateStateFlags(struct monster* monster, uint16_t mask, bool set_flags); bool IsProtectedFromNegativeStatus(struct entity* user, struct entity* target, bool log_message); -void AddExpSpecial(struct entity* attacker, struct entity* defender, int base_exp); +void AddExp(struct entity* attacker, struct entity* defender, int base_exp); void EnemyEvolution(struct entity* entity); void LevelUpItemEffect(struct entity* user, struct entity* target, int levels, bool message, bool dialogue); @@ -864,8 +867,8 @@ union damage_source GetDamageSourceWrapper(struct move* move, enum item_id item_ int LowerSshort(int x); void PlayMoveAnimation(struct entity* user, struct entity* target, struct move* move, struct position* position); -uint16_t GetMoveAnimationId(struct move* move, enum weather_id apparent_weather, - bool should_play_alternative_animation); +enum move_id GetMoveAnimationId(enum move_id move_id, enum weather_id apparent_weather, + bool should_play_alternative_animation); bool ShouldMovePlayAlternativeAnimation(struct entity* user, struct move* move); bool IsMoveBlockedByTerrain(struct entity* user, struct move* move); void ExecuteMoveEffect(struct target_list* targets, struct entity* attacker, struct move* move, diff --git a/headers/types/common/common.h b/headers/types/common/common.h index afcfb2cc..48887ebe 100644 --- a/headers/types/common/common.h +++ b/headers/types/common/common.h @@ -1201,8 +1201,7 @@ struct monster_data_table_entry { struct monster_gender_8 gender; // 0x12: Gender of this particular entity entry. uint8_t body_size; // 0x13: The body size of the Pokemon. Used when determining how many Pokemon // fits in the party. - struct type_id_8 primary_type; // 0x14: The Pokemon's primary type. - struct type_id_8 secondary_type; // 0x15: The Pokemon's secondary type. + struct type_id_8 types[2]; // 0x14 struct mobility_type_8 movement_type; // 0x16: This decides what terrains the entity can move // over, and whether its hovering or not. struct iq_group_id_8 iq_group; // 0x17: The IQ group the Pokemon belongs to. diff --git a/headers/types/common/enums.h b/headers/types/common/enums.h index a6a9ed93..a3278e55 100644 --- a/headers/types/common/enums.h +++ b/headers/types/common/enums.h @@ -2214,6 +2214,11 @@ enum type_id { ENUM_8_BIT(type_id); #pragma pack(pop) +// This is occasionally stored as a 16-bit integer +#pragma pack(push, 2) +ENUM_16_BIT(type_id); +#pragma pack(pop) + enum type_matchup { MATCHUP_IMMUNE = 0, MATCHUP_NOT_VERY_EFFECTIVE = 1, diff --git a/headers/types/common/window.h b/headers/types/common/window.h index 1775ab9b..23c703bf 100644 --- a/headers/types/common/window.h +++ b/headers/types/common/window.h @@ -31,30 +31,6 @@ struct preprocessor_args { }; ASSERT_SIZE(struct preprocessor_args, 80); -struct window; -typedef void (*update_window_fn_t)(struct window* window); - -struct window_params { - update_window_fn_t update; // 0x0: A function to update the window - // 0x4: Window left (or right in tandem with the x_offset_end window flag) edge x coordinate, - // divided by 8. - uint8_t x_offset; - // 0x5: Window top (or bottom in tandem with the y_offset_end window flag) edge y coordinate, - // divided by 8. - uint8_t y_offset; - uint8_t width; // 0x6: Window width, divided by 8. - uint8_t height; // 0x7: Window height, divided by 8. - struct screen_8 screen; // 0x8: Screen where the window resides - // 0x9: The box type can affect the window frame and/or the backdrop. - struct box_type_8 box_type; - undefined field_0xa; - undefined field_0xb; - // 0xC: heap-allocated contents for the window, varying by type. - // See callers of NewWindowScreenCheck for the different types - void* contents; -}; -ASSERT_SIZE(struct window_params, 16); - // Corner coordinates of the rectangle a window occupies. struct window_rectangle { int y_min; // 0x0: Window top y coordinate @@ -284,47 +260,6 @@ struct window_trailer { }; ASSERT_SIZE(struct window_trailer, 36); -// Generic structure for a window containing content -struct window { - struct window_params params; // 0x0 - // 0x10: it seems like some windows, such as the scroll box, can have an associated sub-window - // within the main window - int8_t subwindow_id; - uint8_t field_0x11; - uint16_t field_0x12; - // Some heap-allocated struct pointer with size (hdr.width * hdr.height * 0x40) - undefined* field_0x14; - int field_0x18; - int field_0x1c; // hdr.width * hdr.height * 0x40 - uint32_t field_0x20; - undefined field_0x24; - undefined field_0x25; - undefined field_0x26; - undefined field_0x27; - int field_0x28; - undefined field_0x2c; - undefined field_0x2d; - undefined field_0x2e; - undefined field_0x2f; - uint16_t field_0x30; - undefined field_0x32; - undefined field_0x33; - struct render_3d_element_64 backdrop; // 0x34: type RENDER64_RECTANGLE - struct render_3d_element_64 frame; // 0x74: type RENDER64_WINDOW_FRAME - uint8_t field_0xb4; - undefined field_0xb5; - int8_t valid; // 0xB6: usually seems to be 0-3 - uint8_t field_0xb7; - int32_t field_0xb8; - struct window_trailer trailer; // 0xBC -}; -ASSERT_SIZE(struct window, 224); - -struct window_list { - struct window windows[20]; -}; -ASSERT_SIZE(struct window_list, 4480); - // Tracks state related to interactive windows. // This struct seems to always be at +0x4 of the various window contents structs // stored in window_params / returned by GetWindowContents. @@ -371,6 +306,8 @@ struct unk_scroll_box_coords { }; ASSERT_SIZE(struct unk_scroll_box_coords, 24); +typedef void (*update_window_fn_t)(struct window* window); + // Also see CreateScrollBoxSingle/CreateScrollBoxMulti // Up/down paged text boxes with formatting? // Observed examples: @@ -1145,4 +1082,87 @@ struct storage_collection_menu_manager { }; ASSERT_SIZE(struct storage_collection_menu_manager, 160); +union window_contents { + struct simple_menu* simple_menu; + struct advanced_menu* advanced_menu; + struct collection_menu* collection_menu; + struct options_menu* options_menu; + struct debug_menu* debug_menu; + struct scroll_box* scroll_box; + struct dialogue_box* dialogue_box; + struct portrait_box* portrait_box; + struct text_box* text_box; + struct area_name_box* area_name_box; + struct controls_chart* controls_chart; + struct alert_box* alert_box; + struct advanced_text_box* advanced_text_box; + struct team_selection_menu* team_selection_menu; + struct inventory_menu* inventory_menu; +}; +ASSERT_SIZE(union window_contents, 4); + +struct window; + +struct window_params { + update_window_fn_t update; // 0x0: A function to update the window + // 0x4: Window left (or right in tandem with the x_offset_end window flag) edge x coordinate, + // divided by 8. + uint8_t x_offset; + // 0x5: Window top (or bottom in tandem with the y_offset_end window flag) edge y coordinate, + // divided by 8. + uint8_t y_offset; + uint8_t width; // 0x6: Window width, divided by 8. + uint8_t height; // 0x7: Window height, divided by 8. + struct screen_8 screen; // 0x8: Screen where the window resides + // 0x9: The box type can affect the window frame and/or the backdrop. + struct box_type_8 box_type; + undefined field_0xa; + undefined field_0xb; + // 0xC: heap-allocated contents for the window, varying by type. + // See callers of NewWindowScreenCheck for the different types + union window_contents contents; +}; +ASSERT_SIZE(struct window_params, 16); + +// Generic structure for a window containing content +struct window { + struct window_params params; // 0x0 + // 0x10: it seems like some windows, such as the scroll box, can have an associated sub-window + // within the main window + int8_t subwindow_id; + uint8_t field_0x11; + uint16_t field_0x12; + // Some heap-allocated struct pointer with size (hdr.width * hdr.height * 0x40) + undefined* field_0x14; + int field_0x18; + int field_0x1c; // hdr.width * hdr.height * 0x40 + uint32_t field_0x20; + undefined field_0x24; + undefined field_0x25; + undefined field_0x26; + undefined field_0x27; + int field_0x28; + undefined field_0x2c; + undefined field_0x2d; + undefined field_0x2e; + undefined field_0x2f; + uint16_t field_0x30; + undefined field_0x32; + undefined field_0x33; + struct render_3d_element_64 backdrop; // 0x34: type RENDER64_RECTANGLE + struct render_3d_element_64 frame; // 0x74: type RENDER64_WINDOW_FRAME + uint8_t field_0xb4; + undefined field_0xb5; + int8_t valid; // 0xB6: usually seems to be 0-3 + uint8_t field_0xb7; + int32_t field_0xb8; + struct window_trailer trailer; // 0xBC +}; +ASSERT_SIZE(struct window, 224); + +struct window_list { + struct window windows[20]; +}; +ASSERT_SIZE(struct window_list, 4480); + #endif diff --git a/headers/types/dungeon_mode/dungeon.h b/headers/types/dungeon_mode/dungeon.h index be6f4268..c44a389d 100644 --- a/headers/types/dungeon_mode/dungeon.h +++ b/headers/types/dungeon_mode/dungeon.h @@ -1529,9 +1529,7 @@ struct dungeon { // 0x1990C: Stores statuses::unique_id for the monster pointed to by dungeon::snatch_monster. uint32_t snatch_status_unique_id; // 0x19910: Spawn genid of the monster to be spawned by the effect of Illuminate - uint16_t illuminate_spawn_genid; - undefined field_0x19912; - undefined field_0x19913; + enum monster_id illuminate_spawn_genid; // 0x19914: List that matches monster IDs with their sprite index on this floor struct monster_id_16 sprite_indexes[1155]; undefined field_0x1a21a; diff --git a/headers/types/dungeon_mode/dungeon_mode.h b/headers/types/dungeon_mode/dungeon_mode.h index 32029cec..63d76fe6 100644 --- a/headers/types/dungeon_mode/dungeon_mode.h +++ b/headers/types/dungeon_mode/dungeon_mode.h @@ -705,6 +705,13 @@ ASSERT_SIZE(struct monster, 572); ASSERT_SIZE(struct monster, 576); #endif +union entity_info { + struct monster* monster; + struct item* item; + struct trap* trap; +}; +ASSERT_SIZE(union entity_info, 4); + // Generic entity data struct entity { enum entity_type type; // 0x0 @@ -742,7 +749,7 @@ struct entity { uint8_t animation_id_mirror0; // 0xB1 undefined field_0xb2; undefined field_0xb3; - void* info; // 0xB4: Points to info struct for monster/item/trap + union entity_info info; // 0xB4: Points to info struct for monster/item/trap }; ASSERT_SIZE(struct entity, 184); diff --git a/symbols/arm9.yml b/symbols/arm9.yml index 000a49b3..4f36d492 100644 --- a/symbols/arm9.yml +++ b/symbols/arm9.yml @@ -11623,6 +11623,17 @@ arm9: r0: Pointer to encoded value r1: [output] Buffer where the resulting 2-byte value will be stored. return: Pointer to the next byte to decode + - name: CanMonsterLearnMove + address: + EU: 0x2054098 + description: |- + Returns true if the monster can learn the given move, whether by leveling up or HM/TM. + + Always returns false if the move is Struggle or the monster is the Decoy. + + r0: monster id + r1: move id + return: bool - name: GetEvoFamily address: EU: 0x205414C @@ -11834,16 +11845,18 @@ arm9: r0: monster ID return: bool - - name: GetSecondFormIfValid + - name: MaleToFemaleForm + aliases: + - GetSecondFormIfValid address: EU: 0x2054F20 NA: 0x2054BA4 JP: 0x2054EDC description: |- - Note: unverified, ported from Irdkwia's notes + Returns the ID of the second form of the specified monster if the specified ID corresponds to a primary form with male gender and the second form has female gender. If those conditions don't meet, returns the same ID unchanged. - r0: monster ID - return: second form + r0: Monster ID + return: ID of the female form of the monster if the requirements meet, same ID otherwise. - name: FemaleToMaleForm address: EU: 0x2054F5C @@ -12937,6 +12950,16 @@ arm9: r0: ? return: bool: whether the number of missions completed is greater than 0 + - name: GetUnfulfilledMissionRestrictions + address: + EU: 0x205F1BC + description: |- + Checks if the player's party doesn't meet the restrictions for missions they have active in the given dungeon, and outputs their values if so. + + r0: dungeon id + r1: [output] type id of an unfulfilled type restriction + r2: [output] monster id of an unfulfilled monster restriction + return: whether at least one unfulfilled mission restriction was found for this dungeon id - name: AddMissionToJobList address: EU: 0x205F434 @@ -14987,7 +15010,13 @@ arm9: EU: 0x2 NA: 0x2 JP: 0x2 - description: IQ gain when ingesting wonder gummis. + description: IQ gain when ingesting wonder gummis (15). + - name: WONDER_GUMMI_BELLY_RESTORE + address: + EU: 0x20A1E18 + length: + EU: 0x2 + description: Belly gain when ingesting wonder gummis (50). - name: AURA_BOW_STAT_BOOST address: EU: 0x20A1E1C diff --git a/symbols/overlay10.yml b/symbols/overlay10.yml index 1f2fa590..3917da2d 100644 --- a/symbols/overlay10.yml +++ b/symbols/overlay10.yml @@ -962,6 +962,12 @@ overlay10: NA: 0x2 JP: 0x2 description: "The chance of Steel Wing boosting defense, as a percentage (20%)." + - name: GUMMI_STAT_BOOST_CHANCE + address: + EU: 0x22C4E24 + length: + EU: 0x2 + description: The chance of a permanent stat boost occurring after eating a Gummi (25%). - name: GOLD_THORN_POWER address: EU: 0x22C4E28 diff --git a/symbols/overlay29.yml b/symbols/overlay29.yml index f2a35794..9b7e7fa6 100644 --- a/symbols/overlay29.yml +++ b/symbols/overlay29.yml @@ -1208,6 +1208,32 @@ overlay29: r0: entity pointer r1: whether the key door is not for a treasure memo (plays a sound if true) + - name: PlayEscapeEffect + address: + EU: 0x22E7194 + description: |- + Plays the given effect on the entity while making it fly out of the map. + + r0: effect id + r1: entity pointer + r2: ? + - name: PlayStandardEscapeEffect + address: + EU: + - 0x22E726C + - 0x22E72A0 + - 0x22E72BC + description: |- + Plays the standard escape effect (the yellow light / Reviver Seed effect, 0x13E) on the entity while making it fly out of the map. + + r0: entity pointer + - name: PlayEscapeOrbEscapeEffect + address: + EU: 0x22E7288 + description: |- + Plays the Escape Orb effect (0x1BC) on the entity while making it fly out of the map. + + r0: entity pointer - name: PlayStairSensorArrowEffect address: EU: 0x22E72D8 @@ -4972,7 +4998,9 @@ overlay29: r1: target entity pointer r2: flag to log a message return: bool - - name: AddExpSpecial + - name: AddExp + aliases: + - AddExpSpecial address: EU: 0x2302F68 NA: 0x230253C @@ -4980,8 +5008,6 @@ overlay29: description: |- Adds to a monster's experience points, subject to experience boosting effects. - This function appears to be called only under special circumstances. Possibly when granting experience from damage (e.g., Joy Ribbon)? - Interestingly, the parameter in r0 isn't actually used. This might be a compiler optimization to avoid shuffling registers, since this function might be called alongside lots of other functions that have both the attacker and defender as the first two arguments. r0: attacker pointer