diff --git a/headers/data/ram.h b/headers/data/ram.h index 89e3d373..fb4e8241 100644 --- a/headers/data/ram.h +++ b/headers/data/ram.h @@ -95,7 +95,7 @@ extern int TRIPLE_KICK_SUCCESSIVE_HITS; extern int METRONOME_NEXT_INDEX; extern struct tile DEFAULT_TILE_COPY; extern struct floor_generation_status FLOOR_GENERATION_STATUS; -extern struct secret_bazaar_dialogue_info* SECRET_BAZAAR_DIALOGUE_INFO_PTR; +extern struct dungeon_dialogue_info* DUNGEON_DIALOGUE_INFO_PTR; extern struct stairs_menu* STAIRS_MENU_PTR; #endif diff --git a/headers/functions/arm9.h b/headers/functions/arm9.h index 036024ae..88afe22b 100644 --- a/headers/functions/arm9.h +++ b/headers/functions/arm9.h @@ -461,7 +461,7 @@ void SelectWaza(int waza_id); void PlayBgmByIdVeneer(enum music_id music_id); void PlayBgmByIdVolumeVeneer(enum music_id music_id, undefined param_2, int volume); bool IsMePlaying(int me_id); -void PlaySeByIdVolumeWrapper(int index); +void PlaySeByIdVolumeWrapper(int se_id); void PlaySeVolumeWrapper(int index); void PlayBgmById(enum music_id music_id); void PlayBgmByIdVolume(enum music_id music_id, undefined param_2, int volume); @@ -529,6 +529,8 @@ void SetAndPlayAnimationForAnimationControl(struct animation_control* anim_ctrl, void SwitchAnimationControlToNextFrame(struct animation_control* anim_ctrl); void LoadAnimationFrameAndIncrementInAnimationControl(struct animation_control* anim_ctrl, struct wan_animation_frame* anim_frame); +void DisplayAnimationControlCurrentFrame(struct animation_control* anim_ctrl); +void DisplayAndSwitchAnimationControlCurrentFrame(struct animation_control* anim_ctrl); void FillOamAdjustmentInfo(struct animation_control* dst, uint16_t* src); uint32_t AnimationControlGetAllocForMaxFrame(struct animation_control* anim_ctrl); void DeleteWanTableEntry(struct wan_table* wan_table, int wan_id); diff --git a/headers/functions/overlay29.h b/headers/functions/overlay29.h index b5700a77..56dd2388 100644 --- a/headers/functions/overlay29.h +++ b/headers/functions/overlay29.h @@ -30,6 +30,7 @@ void ResetDungeonColorPalette(void); struct trap* GetTrapInfo(struct entity* trap_entity); struct item* GetItemInfo(struct entity* item_entity); struct tile* GetTileAtEntity(struct entity* entity); +void DisplayMonstersAndItems(void); void UpdateEntityPixelPos(struct entity* entity, struct pixel_position* pixel_pos); void SetEntityPixelPosXY(struct entity* entity, uint32_t x, uint32_t y); void IncrementEntityPixelPosXY(struct entity* entity, uint32_t x, uint32_t y); @@ -37,6 +38,7 @@ struct entity* CreateEnemyEntity(enum monster_id monster_id); struct entity* SpawnTrap(enum trap_id trap_id, struct position* position, uint8_t team, uint8_t flags); struct entity* SpawnItemEntity(struct position* position); +void CreateTemporaryEntity(struct entity* entity); bool ShouldMinimapDisplayEntity(struct entity* entity); bool ShouldDisplayEntity(struct entity* entity, undefined param_2); bool ShouldDisplayEntityWrapper(struct entity* entity); @@ -61,6 +63,7 @@ int PlayEffectAnimationEntity(struct entity* entity, int effect_id, bool play_no int PlayEffectAnimationPos(struct position* pos, int effect_id, bool play_now); int PlayEffectAnimationPixelPos(struct pixel_position* pixel_pos, int effect_id, bool play_now); void AnimationDelayOrSomething(undefined param_1); +void CopyStatusIconFlags(struct status_icon_flags* dst, struct entity* src); void UpdateStatusIconFlags(struct entity* entity); void PlayQuestionMarkEffect(struct entity* entity); void PlayExclamationPointEffect(struct entity* entity); @@ -113,12 +116,14 @@ void AssignTopScreenHandlers(void** funcs, top_screen_status_fn_t init_func, void HandleTopScreenFades(void); int FreeTopScreen(void); void DungeonChangeTopScreenType(int top_screen_type); +void DrawDungeonControlsText(int window_id); enum direction_id GetDirectionTowardsPosition(struct position* origin, struct position* target); int GetChebyshevDistance(struct position* position_a, struct position* position_b); bool IsPositionActuallyInSight(struct position* origin, struct position* target, bool user_has_dropeye); bool IsPositionInSight(struct position* origin, struct position* target, bool user_has_dropeye); bool IsPositionWithinTwoTiles(struct position* origin, struct position* target); +bool DisplayThrownItemShadow(int16_t x, int16_t y); struct entity* GetLeader(void); struct monster* GetLeaderMonster(void); bool GetRandomTile(struct position* pos_out, bool exclude_key_doors); @@ -191,6 +196,7 @@ bool AreLateGameTrapsEnabledWrapper(void); void SpawnTraps(void); void SpawnEnemyTrapAtPos(enum trap_id trap_id, int16_t x, int16_t y, uint8_t flags, bool is_visible); +void CreateTrapAndStairsHallucinations(void); void PrepareTrapperTrap(struct entity* entity, enum trap_id trap_id, uint8_t team); bool CanLayTrap(struct position* pos); bool TrySpawnTrap(struct position* pos, enum trap_id trap_id, uint8_t team, bool visible); @@ -224,6 +230,8 @@ void RevealTrapsNearby(struct entity* monster); bool RevealTrapAtPos(int x, int y); void CheckBossFightVictory(struct entity* fainted_entity, enum monster_behavior behavior, bool change_music); +void ChangeTeamAnimationsToIdle(void); +bool IsFloorOver2(void); bool ShouldRunMonsterAi(struct entity* monster); bool DebugRecruitingEnabled(void); void TryActivateIqBooster(void); @@ -236,6 +244,7 @@ bool TalkToSecretBazaarNpcWithYesNoMenu(int string_id, struct entity* shopkeeper struct simple_menu_id_item* menu_items); void MakeTargetFaceUserAndIdle(struct entity* target, struct entity* user); void SubtractMoneyCarriedWithSfx(int amount); +void MakeSecretBazaarNpcsIdleInDirection(enum direction_id dir); void ReopenMinimap(void); void GonePebbleGradualPaletteShift(struct rgba* palette, uint32_t param_2); bool TalkToSecretBazaarNpc(int string_id, struct entity* shopkeeper, enum portrait_emotion emotion, @@ -295,7 +304,7 @@ bool CheckTeamMemberIdxVeneer(int member_idx); bool CheckMonsterTeamMemberIdx(struct entity* entity); bool IsMonsterIdInNormalRangeVeneer(enum monster_id monster_id); void BoostIQ(struct entity* entity, int iq_boost, bool suppress_logs); -void ChangeMonsterAnimationToIdle(struct entity* entity, enum direction_id direction); +void MakeMonsterIdleInDirection2(struct entity* entity, enum direction_id direction); bool ShouldMonsterHeadToStairs(struct entity* entity); void DisplayLinkedMovesWarnings(struct entity* entity, int move_slot); bool MewSpawnCheck(enum monster_id monster_id, bool fail_if_mew); @@ -359,7 +368,7 @@ bool IsInvalidSpawnTile(enum monster_id monster_id, struct tile* tile); enum mobility_type GetMobilityTypeAfterIqSkills(struct entity* monster, enum mobility_type mobility_type); bool CanMoveThroughWalls(struct entity* monster); -bool CannotStandOnTile(struct entity* monster, struct tile* tile); +bool CannotStandOnTile(struct entity* monster, struct position* tile_pos); int CalcSpeedStage(struct entity* entity, int counter_weight); int CalcSpeedStageWrapper(struct entity* entity); int GetNumberOfAttacks(struct entity* entity); @@ -438,9 +447,14 @@ void GetMonsterMoves(struct move_id_16* out_moves, enum monster_id monster_id, i void EvolveMonster(struct entity* user, struct entity* target, enum monster_id new_monster_id); void DisplayMonsterShadow(bool display_shadow, enum shadow_type shadow_type, bool yellow_circle, int16_t x, int16_t y); +void DisplayMonster(struct entity* entity); +void AnimateFlyingMoves(struct entity* entity); void ChangeMonsterAnimation(struct entity* monster, int8_t animation_id, enum direction_id direction); +void ChangeMonsterAnimationToIdle(struct entity* monster, enum direction_id direction); +void ChangeMonsterAnimationToHurt(struct entity* monster, enum direction_id direction); uint8_t GetIdleAnimationId(struct entity* entity); +void MakeMonsterIdleInDirection(struct entity* entity, enum direction_id direction); void DetermineAllMonsterShadow(void); enum shadow_type DetermineMonsterShadow(struct entity* monster); bool DisplayActions(struct entity* param_1); @@ -994,6 +1008,8 @@ void GenerateCleanItem(struct item* item, enum item_id item_id); void TryLeaderItemPickUp(struct position* position, bool flag); bool SpawnItem(struct position* position, struct item* item, bool flag); void RemoveGroundItem(struct position* position, bool update_shop_counters); +bool DisplayItem(struct entity* item, bool hallucinate, bool on_floor, enum direction_id dir, + bool priority); void SpawnDroppedItemWrapper(struct entity* entity, struct position* pos, struct item* item, undefined4 param_4); void SpawnDroppedItem(struct entity* entity, struct entity* item_entity, struct item* item, @@ -1006,6 +1022,9 @@ void AddHeldItemToBag(struct monster* monster); void RemoveEmptyItemsInBagWrapper(void); void GenerateItem(struct item* item, enum item_id item_id, uint16_t quantity, enum gen_item_stickiness sticky_type); +void HandleRegularProjectileThrow(struct entity* user, struct item* item, + struct position* start_pos, enum direction dir, + struct projectile_throw_info* projectile_throw_info); void HandleCurvedProjectileThrow(struct entity* user, struct item* item, struct position* start_pos, struct position* target_pos, struct projectile_throw_info* projectile_throw_info); @@ -1105,10 +1124,11 @@ void DisplayMessage2(struct portrait_params* portrait, int message_id, bool wait bool YesNoMenu(undefined param_1, int string_id, int default_option, undefined param_4); void CloseMinimap(void); void DisplayMessageInternal(int message_id, bool wait_for_input, struct portrait_params* portrait, - undefined4 param_4, undefined4 param_5, undefined4 param_6); + undefined4 param_4, struct preprocessor_args* preprocessor_args, + undefined4 param_6); void PrintMissionCompleteString(int string_id, undefined4 param_2, undefined4 param_3, undefined4 param_4, undefined1 param_5); -void InitSecretBazaarDialogueInfo(void); +void InitDungeonDialogueInfo(void); void OpenMenu(undefined param_1, undefined param_2, bool open_bag); void StairsMenuAfterStep(struct entity* leader, bool leave_minimap_closed_after); int DungeonModeSetupAndShowNameKeyboard(char* str_keyboard_result, char* buffer, diff --git a/headers/types/common/graphics.h b/headers/types/common/graphics.h index 5ee8fa30..f921839e 100644 --- a/headers/types/common/graphics.h +++ b/headers/types/common/graphics.h @@ -10,7 +10,9 @@ // Mentioned under the name of "AnimeCtrl" in a debug message. struct animation_control { uint16_t some_bitfield; - undefined2 field1_0x2; + uint16_t unk_flags1 : 4; + uint16_t no_auto_frame_switch : 1; + uint16_t unk_flags2 : 11; undefined2 field2_0x4; uint16_t anim_frame_duration; undefined2 field4_0x8; diff --git a/headers/types/dungeon_mode/dungeon_mode.h b/headers/types/dungeon_mode/dungeon_mode.h index 23951123..a133f3c2 100644 --- a/headers/types/dungeon_mode/dungeon_mode.h +++ b/headers/types/dungeon_mode/dungeon_mode.h @@ -233,7 +233,7 @@ struct statuses { // A value of 1 mean "high up" (Fly/Bounce). A value of 2 means some other condition like // Dig, Shadow Force, etc. Other values are treated as invalid. Also used for the move // Seismic Toss when throwing up the target. - uint8_t two_turn_move_invincible; + struct two_turn_invincibility_8 two_turn_move_invincible; // 0x63: Related to handling AI when a decoy is present on the floor? // Seems to only be 0, 1, 2 undefined decoy_ai_tracker; @@ -526,7 +526,9 @@ struct monster { struct position pixel_pos; // 0x182: The monster's graphical position on screen? undefined field_0x186; undefined field_0x187; - int elevation_mirror; // 0x188: Mirror of the elevation field in struct entity + // 0x188: Works the same as the elevation field in struct entity, but is not + // tied to it. + int elevation2; // 0x18C: Bitflags that cause non-damaging exclusive items to trigger on the // attacker after they have completed their move. For example, the Eclipse Robe // (Darkrai exclusive item) may afflict attacking enemies with the nightmare @@ -708,7 +710,7 @@ struct entity { enum entity_type type; // 0x0 struct position pos; // 0x4 struct position prev_pos; // 0x8 - struct pixel_position pixel_pos; // 0xC + struct pixel_position pixel_pos; // 0xC: Shifted left by 8 struct pixel_position pixel_pos_mirror; // 0x14: Monsters only? // 0x1C: Graphical parameter for evelation above the ground. Last byte behaves weirdly. int elevation; @@ -2577,7 +2579,7 @@ struct dungeon_button_input { }; ASSERT_SIZE(struct dungeon_button_input, 14); -struct secret_bazaar_dialogue_info { +struct dungeon_dialogue_info { undefined field_0x0[16]; int8_t dialogue_window_id; // 0x10 int8_t menu_window_id; // 0x11 @@ -2599,7 +2601,7 @@ struct secret_bazaar_dialogue_info { struct simple_menu_id_item* menu_items; // 0x470 undefined4 field_0x474; }; -ASSERT_SIZE(struct secret_bazaar_dialogue_info, 1144); +ASSERT_SIZE(struct dungeon_dialogue_info, 1144); // Temporary struct used by TryRecruit. struct recruit_info { diff --git a/symbols/arm9.yml b/symbols/arm9.yml index de5b36d6..c88b089e 100644 --- a/symbols/arm9.yml +++ b/symbols/arm9.yml @@ -5021,6 +5021,20 @@ arm9: r0: animation_control r1: animation_frame + - name: DisplayAnimationControlCurrentFrame + address: + EU: 0x201C660 + description: |- + Displays the current frame of the animation_control struct. + + r0: animation_control + - name: DisplayAndSwitchAnimationControlCurrentFrame + address: + EU: 0x201CFF8 + description: |- + Displays the current frame of the animation_control struct and switches it afterwards if applicable. + + r0: animation_control - name: FillOamAdjustmentInfo aliases: - FillOamAttributeInfo diff --git a/symbols/overlay29.yml b/symbols/overlay29.yml index 44a56970..87f9fd7b 100644 --- a/symbols/overlay29.yml +++ b/symbols/overlay29.yml @@ -441,6 +441,13 @@ overlay29: r0: pointer to entity return: pointer to tile + - name: DisplayMonstersAndItems + address: + EU: 0x22E2194 + description: |- + Displays all monsters on the top and bottom screen as well as all items (including hallucinated ones) on the floor. + + No params. - name: UpdateEntityPixelPos address: EU: 0x22E2380 @@ -508,6 +515,13 @@ overlay29: r0: position return: entity pointer for the newly added item, or null on failure + - name: CreateTemporaryEntity + address: + EU: 0x22E2DB0 + description: |- + Creates a temporary entity to be used as a placeholder for functions that require one. + + r0: [output] entity pointer - name: ShouldMinimapDisplayEntity address: EU: 0x22E2DD8 @@ -801,6 +815,14 @@ overlay29: Might wait until the animation is done? Contains several loops that call AdvanceFrame. r0: ? + - name: CopyStatusIconFlags + address: + EU: 0x22E43F0 + description: |- + Copies a monster's status_icon_flags to the destination pointer. + + r0: [output] status_icon_flags + r1: entity pointer - name: UpdateStatusIconFlags address: EU: 0x22E4464 @@ -1321,6 +1343,13 @@ overlay29: Seems to change the top screen display type in dungeon mode. r0: index of top screen mode to change to + - name: DrawDungeonControlsText + address: + EU: 0x22E9810 + description: |- + Draws the text for the top screen controls menu in the given window. + + r0: window id - name: GetDirectionTowardsPosition address: EU: 0x22E99D0 @@ -1381,6 +1410,15 @@ overlay29: r0: Origin position r1: Target position return: True if the target position within two tiles of the origin position. + - name: DisplayThrownItemShadow + address: + EU: 0x22E9E38 + description: |- + Displays the shadow of an item that is being thrown. + + r0: x (pixel pos) + r1: y (pixel pos) + return: true if the shadow was displayed (pixel pos was not out of bounds) - name: GetLeader address: EU: 0x22E9F30 @@ -2082,6 +2120,15 @@ overlay29: r2: y position r3: flags stack[0]: visibility flag + - name: CreateTrapAndStairsHallucinations + address: + EU: 0x22EE380 + description: |- + Places hallucination items at the locations of traps and stairs. + + Removing the original texture of the tile is handled elsewhere. + + No params. - name: PrepareTrapperTrap address: EU: 0x22EE584 @@ -2396,6 +2443,20 @@ overlay29: r0: fainted entity r1: behavior of fainted monster (the function will do nothing if it's not a fixed room enemy) r2: whether to change the music if the boss fight is over + - name: ChangeTeamAnimationsToIdle + address: + EU: 0x22F02EC + description: |- + Changes the animations of all team members to idle. + + No params. + - name: IsFloorOver2 + address: + EU: 0x22F037C + description: |- + Same as IsFloorOver, but with a redundant check for end_floor_flag. + + return: bool - name: ShouldRunMonsterAi address: EU: 0x22F03A0 @@ -2494,6 +2555,13 @@ overlay29: Subtracts the amount of money from the the player's current amount of money and plays the sound effect for buying an item. r0: money amount + - name: MakeSecretBazaarNpcsIdleInDirection + address: + EU: 0x22F119C + description: |- + Changes the animations of all secret bazaar shopkeepers to idle in the given direction and updates their target_pos field. + + r0: direction - name: ReopenMinimap address: EU: 0x22F11FC @@ -2525,7 +2593,7 @@ overlay29: r1: shopkeeper entity pointer r2: portrait emotion r3: pointer to an array of simple_menu_id_items (null if there is no menu) - stack[0]: ? (changes something in secret_bazaar_dialogue_info if true. seems to only be true if there is a menu) + stack[0]: ? (changes something in dungeon_dialogue_info if true. seems to only be true if there is a menu) return: ? (bool) - name: GetLeaderAction address: @@ -3106,13 +3174,13 @@ overlay29: r0: monster entity pointer r1: iq boost r2: bool suppress logs - - name: ChangeMonsterAnimationToIdle + - name: MakeMonsterIdleInDirection2 address: EU: 0x22FAD6C NA: 0x22FA360 JP: 0x22FB908 description: |- - Makes the monster play their idle animation in the given direction. + Makes the monster play their idle animation in the given direction and sets the direction field of their action struct. r0: entity pointer r1: direction @@ -3766,11 +3834,13 @@ overlay29: return: True if the monster can move through walls. - name: CannotStandOnTile address: - EU: 0x23006C8 + EU: + - 0x2300384 + - 0x23006C8 NA: 0x22FFC9C JP: 0x23010AC description: |- - Checks if a given monster cannot stand on a given tile. + Checks if a given monster cannot stand on the tile at the given position. Reasons include: - The coordinates of the tile are out of bounds @@ -3778,7 +3848,7 @@ overlay29: - The monster does not have the required mobility to stand on the tile r0: Entity pointer - r1: Tile pointer + r1: Tile position pointer return: True if the monster cannot stand on the specified tile, false if it can - name: CalcSpeedStage address: @@ -4599,6 +4669,20 @@ overlay29: r2: whether to display a yellow circle (for team members and special cases like decoys, rescue clients, etc.) r3: the x-coordinate in OAM plus some constant offset. Valid input range: (-0x20, 0x11F) stack[0]: the y-coordinate in OAM plus some constant offset. Valid input range: (-0x20, 0xE0) + - name: DisplayMonster + address: + EU: 0x2304944 + description: |- + Handles displaying the monster on the bottom screen. + + r0: entity pointer + - name: AnimateFlyingMoves + address: + EU: 0x2305114 + description: |- + Called every frame to make the monster fly up when its two_turn_move_invincible field is set to TWO_TURN_FLYING, and back down when its value is changed. + + r0: entity pointer - name: ChangeMonsterAnimation address: EU: 0x23053D4 @@ -4612,6 +4696,26 @@ overlay29: r0: Entity pointer r1: ID of the animation to set r2: Direction to turn the monster in, or DIR_NONE to keep the current direction + - name: ChangeMonsterAnimationToIdle + address: + EU: 0x2305474 + description: |- + Changes the animation a monster is currently playing to its idle animation. Optionally changes their direction as well. + + Does nothing if the provided entity is not a monster. + + r0: Entity pointer + r1: Direction to turn the monster in, or DIR_NONE to keep the current direction + - name: ChangeMonsterAnimationToHurt + address: + EU: 0x23054B0 + description: |- + Changes the animation a monster is currently playing to its hurt animation. Optionally changes their direction as well. + + Does nothing if the provided entity is not a monster. + + r0: Entity pointer + r1: Direction to turn the monster in, or DIR_NONE to keep the current direction - name: GetIdleAnimationId address: EU: 0x23054E0 @@ -4624,6 +4728,14 @@ overlay29: r0: pointer to entity return: animation ID + - name: MakeMonsterIdleInDirection + address: + EU: 0x2305528 + description: |- + Makes the monster play their idle animation in the given direction and sets the direction field of their action struct. + + r0: entity pointer + r1: direction - name: DetermineAllMonsterShadow address: EU: 0x2305590 @@ -9732,6 +9844,18 @@ overlay29: r0: Position where the item is located r1: If true, update dungeon::poke_buy_kecleon_shop and dungeon::poke_sold_kecleon_shop + - name: DisplayItem + address: + EU: 0x23463B4 + description: |- + Displays an item. + + r0: item entity pointer + r1: whether the camera entity is hallucinating + r2: whether the item is on the floor + r3: direction + stack[0]: whether the item should be displayed at a higher priority than monsters + return: whether the item was successfully displayed - name: SpawnDroppedItemWrapper address: EU: 0x2346628 @@ -9838,6 +9962,17 @@ overlay29: r1: item ID r2: quantity r3: stickiness type (enum gen_item_stickiness) + - name: HandleRegularProjectileThrow + address: + EU: 0x2348118 + description: |- + Throws an item in a straight line. + + r0: monster entity throwing the item + r1: item being thrown + r2: position to start throwing the item from + r3: direction to throw the item in + stack[0]: Metadata about the item being thrown - name: HandleCurvedProjectileThrow address: EU: 0x23487C8 @@ -10760,7 +10895,7 @@ overlay29: r1: True to wait for player input before closing the dialogue box, false to close it automatically once all the characters get printed. r2: pointer to the structure representing the desired state of the portrait r3: ? - stack[0]: ? + stack[0]: preprocessor args stack[1]: ? - name: PrintMissionCompleteString address: @@ -10776,13 +10911,15 @@ overlay29: r2: ? r3: ? stack[0]: ? - - name: InitSecretBazaarDialogueInfo + - name: InitDungeonDialogueInfo + aliases: + - InitSecretBazaarDialogueInfo address: EU: 0x234E758 NA: 0x234DB58 JP: 0x234EDE4 description: |- - Initializes the struct pointed to by SECRET_BAZAAR_DIALOGUE_INFO_PTR. + Initializes the struct pointed to by DUNGEON_DIALOGUE_INFO_PTR. No params. - name: OpenMenu diff --git a/symbols/ram.yml b/symbols/ram.yml index 1be576fe..c8027557 100644 --- a/symbols/ram.yml +++ b/symbols/ram.yml @@ -997,14 +997,16 @@ ram: This data is populated as the dungeon floor is generated. type: struct floor_generation_status - - name: SECRET_BAZAAR_DIALOGUE_INFO_PTR + - name: DUNGEON_DIALOGUE_INFO_PTR + aliases: + - SECRET_BAZAAR_DIALOGUE_INFO_PTR address: EU: 0x2383400 NA: 0x2382800 JP: 0x2383A80 length: EU: 0x4 - description: "[Runtime] Pointer to the secret_bazaar_dialogue_info struct during dungeon mode." + description: "[Runtime] Pointer to the dungeon_dialogue_info struct during dungeon mode." - name: STAIRS_MENU_PTR address: EU: 0x238AEC4