From 333be4720d8c1802bc5acf3a12b31c21167c1d2f Mon Sep 17 00:00:00 2001 From: ElectroDeoxys Date: Tue, 2 Sep 2025 22:18:15 +0100 Subject: [PATCH 1/3] Document dungeon belly functions/exit reasons, identify struct fields --- include/dungeon_8083AB0.h | 2 +- include/dungeon_config.h | 28 +++- include/dungeon_cutscene.h | 2 +- include/dungeon_damage.h | 6 +- include/dungeon_misc.h | 58 +++++++- include/dungeon_move_util.h | 2 +- include/dungeon_run_end.h | 2 +- include/explosion.h | 2 +- include/move_orb_actions_1.h | 150 +++++++++---------- include/move_orb_actions_2.h | 130 ++++++++-------- include/move_orb_actions_3.h | 116 +++++++-------- include/move_orb_actions_4.h | 114 +++++++------- include/move_orb_actions_5.h | 16 +- include/number_util.h | 4 +- include/structs/dungeon_entity.h | 4 +- include/structs/str_dungeon.h | 2 +- src/blow_away.c | 4 +- src/code_8066D04.c | 2 +- src/code_806FDF4.c | 4 +- src/dungeon_8083AB0.c | 6 +- src/dungeon_config.c | 51 ++++--- src/dungeon_cutscene.c | 4 +- src/dungeon_cutscene_articuno.c | 2 +- src/dungeon_cutscene_celebi.c | 2 +- src/dungeon_cutscene_deoxys.c | 2 +- src/dungeon_cutscene_entei.c | 2 +- src/dungeon_cutscene_groudon.c | 8 +- src/dungeon_cutscene_hooh.c | 2 +- src/dungeon_cutscene_jirachi.c | 2 +- src/dungeon_cutscene_kyogre.c | 2 +- src/dungeon_cutscene_latios.c | 2 +- src/dungeon_cutscene_lugia.c | 2 +- src/dungeon_cutscene_magma_cavern.c | 4 +- src/dungeon_cutscene_mankey.c | 2 +- src/dungeon_cutscene_medicham.c | 4 +- src/dungeon_cutscene_mewtwo.c | 2 +- src/dungeon_cutscene_moltres.c | 2 +- src/dungeon_cutscene_raikou.c | 2 +- src/dungeon_cutscene_rayquaza.c | 2 +- src/dungeon_cutscene_regis.c | 6 +- src/dungeon_cutscene_skarmory.c | 4 +- src/dungeon_cutscene_smeargle.c | 4 +- src/dungeon_cutscene_suicune.c | 2 +- src/dungeon_cutscene_zapdos.c | 2 +- src/dungeon_damage.c | 64 ++++---- src/dungeon_item_action.c | 14 +- src/dungeon_jobs.c | 6 +- src/dungeon_main.c | 2 +- src/dungeon_menu_others.c | 3 +- src/dungeon_misc.c | 18 +-- src/dungeon_mon_spawn.c | 4 +- src/dungeon_move.c | 22 +-- src/dungeon_move_util.c | 8 +- src/dungeon_run_end.c | 7 +- src/dungeon_serializer.c | 8 +- src/dungeon_turn_effects.c | 77 +++++----- src/dungeon_vram.c | 2 +- src/dungeon_wind.c | 2 +- src/explosion.c | 20 +-- src/hurl_orb.c | 4 +- src/move_orb_actions_1.c | 222 ++++++++++++++-------------- src/move_orb_actions_2.c | 206 +++++++++++++------------- src/move_orb_actions_3.c | 176 +++++++++++----------- src/move_orb_actions_4.c | 148 +++++++++---------- src/move_orb_actions_5.c | 18 +-- src/move_orb_effects_5.c | 5 +- src/number_util.c | 2 +- src/run_dungeon.c | 24 +-- src/trap.c | 12 +- 69 files changed, 972 insertions(+), 873 deletions(-) diff --git a/include/dungeon_8083AB0.h b/include/dungeon_8083AB0.h index 2d75d1ea4..8a1b96a11 100644 --- a/include/dungeon_8083AB0.h +++ b/include/dungeon_8083AB0.h @@ -3,7 +3,7 @@ #include "structs/dungeon_entity.h" -void sub_8083AB0(s16 param_0, Entity *target, Entity *entity); +void sub_8083AB0(s16 dungeonExitReason, Entity *target, Entity *entity); bool8 sub_8083C24(void); bool8 sub_8083C50(void); bool8 sub_8083C88(u8 param_1); diff --git a/include/dungeon_config.h b/include/dungeon_config.h index eb7782459..0b3ef2ac6 100644 --- a/include/dungeon_config.h +++ b/include/dungeon_config.h @@ -245,9 +245,35 @@ extern const struct CastformWeatherData gCastformByWeather[WEATHER_COUNT]; extern const s16 gTypeEffectivenessChart[NUM_TYPES][NUM_TYPES]; extern const s32 gEffectivenessChart[NUM_EFFECTIVENESS][NUM_EFFECTIVENESS]; +#define RESIDUAL_DAMAGE_REGULAR 0 +#define RESIDUAL_DAMAGE_BURN 1 +#define RESIDUAL_DAMAGE_CONSTRICT 2 +#define RESIDUAL_DAMAGE_POISON 3 +#define RESIDUAL_DAMAGE_UNUSED_4 4 +#define RESIDUAL_DAMAGE_WRAP 5 +#define RESIDUAL_DAMAGE_COUNTERATTACK 6 +#define RESIDUAL_DAMAGE_CURSE 7 +#define RESIDUAL_DAMAGE_NIGHTMARE 8 +#define RESIDUAL_DAMAGE_LEECH_SEED 9 +#define RESIDUAL_DAMAGE_SPIKES 10 +#define RESIDUAL_DAMAGE_PERISH_SONG 11 +#define RESIDUAL_DAMAGE_DESTINY_BOND 12 +#define RESIDUAL_DAMAGE_LIQUID_OOZE 13 +#define RESIDUAL_DAMAGE_HUNGER 14 +#define RESIDUAL_DAMAGE_CHESTNUT_TRAP 15 +#define RESIDUAL_DAMAGE_UNUSED_16 16 +#define RESIDUAL_DAMAGE_PITFALL 17 +#define RESIDUAL_DAMAGE_BAD_WEATHER 18 +#define RESIDUAL_DAMAGE_MOVE_FAIL 19 +#define RESIDUAL_DAMAGE_RECOIL 20 + #define BELLY_GO_DOWN_VALUES_COUNT 20 extern const s48_16 gBellyGoDownValues[BELLY_GO_DOWN_VALUES_COUNT]; +#define EMPTY_BELLY_ALERT_YOUR_BELLYS_EMPTY 1 +#define EMPTY_BELLY_ALERT_HURRY_EAT_SOMETHING 2 +#define EMPTY_BELLY_ALERT_YOULL_FAINT 3 + #define WARP_SCARF_ACTIVATION_CHANCES_COUNT 20 extern const s16 gWarpScarfActivationChances[WARP_SCARF_ACTIVATION_CHANCES_COUNT]; @@ -291,6 +317,6 @@ extern const struct CalledMove gNaturePowerCalledMoves[]; extern const u16 gUnknown_80F5F70[UNK12A18_ARR_COUNT]; extern const s32 gUnknown_80F5FAC[76]; -extern const s32 gUnknown_80F60DC[5]; +extern const s32 gLinkedMovesBellyGoDownValues[5]; #endif diff --git a/include/dungeon_cutscene.h b/include/dungeon_cutscene.h index 18f14c36c..6fc6af005 100644 --- a/include/dungeon_cutscene.h +++ b/include/dungeon_cutscene.h @@ -17,7 +17,7 @@ void sub_80847D4(void); bool8 ShouldShowDungeonBanner(void); void sub_80848F0(void); void DisplayPreFightDialogue(void); -void sub_8084E00(Entity *entity, u8 param_2, u8 param_3); +void sub_8084E00(Entity *entity, u8 param_2, bool8 param_3); void sub_8085140(void); bool8 sub_808529C(s32 speciesId_); void sub_8085374(void); diff --git a/include/dungeon_damage.h b/include/dungeon_damage.h index 3c6011d55..94a7c7df1 100644 --- a/include/dungeon_damage.h +++ b/include/dungeon_damage.h @@ -4,12 +4,12 @@ #include "structs/dungeon_entity.h" #include "structs/str_damage.h" -void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 arg4, bool32 arg8, s32 argC); +void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 dungeonExitReason, bool32 arg8, s32 argC); s32 WeightWeakTypePicker(Entity *user, Entity *target, u8 moveType); void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s32 critChance, struct DamageStruct *dmgStruct, s24_8 arg8, u16 moveId, bool8 arg_10); void sub_806F2BC(Entity *attacker, Entity *target, u8 moveType, s32 a2, struct DamageStruct *dmgStruct); -void DealDamageToEntity(Entity *entity, s32 dmg, s32 r6, s32 r4); -void sub_806F370(Entity *pokemon, Entity *target, s32 dmg, s32 giveExp, bool8 *tookNoDamage, u8 moveType, s16 arg_8, s32 residualDmgType, s32 arg_10, s32 arg_14); +void DealDamageToEntity(Entity *entity, s32 dmg, s32 residualDmgType, s32 dungeonExitReason); +void sub_806F370(Entity *pokemon, Entity *target, s32 dmg, s32 giveExp, bool8 *tookNoDamage, u8 moveType, s16 dungeonExitReason, s32 residualDmgType, s32 arg_10, s32 arg_14); void SetShopkeeperAggression(Entity *pokemon, Entity *target); void sub_806F480(Entity *pokemon, bool8 attackEnemies); u8 sub_806F4A4(Entity *pokemon, u8 type); diff --git a/include/dungeon_misc.h b/include/dungeon_misc.h index 8c6a3eb0d..acba3edfe 100644 --- a/include/dungeon_misc.h +++ b/include/dungeon_misc.h @@ -22,6 +22,62 @@ struct unkStruct_8069D4C HiddenPower hiddenPower; }; +#define DUNGEON_EXIT_TRANSFORMED_INTO_FRIEND 0x1f4 +#define DUNGEON_EXIT_LEFT_WITHOUT_BEING_BEFRIENDED 0x1f5 +#define DUNGEON_EXIT_FAINTED_FROM_DEBUG_ATTACK 0x1f6 +#define DUNGEON_EXIT_MISSED_JUMP_KICK 0x1f7 +#define DUNGEON_EXIT_MISSED_HI_JUMP_KICK 0x1f8 +#define DUNGEON_EXIT_FAINTED_FROM_DESTINY_BOND 0x1f9 +#define DUNGEON_EXIT_FAINTED_COVERED_IN_SLUDGE 0x1fa +#define DUNGEON_EXIT_UNUSED_507 0x1fb +#define DUNGEON_EXIT_UNUSED_508 0x1fc +#define DUNGEON_EXIT_FAINTED_FROM_RECOIL 0x1fd +#define DUNGEON_EXIT_FAINTED_FROM_DAMAGE_BOUNCING 0x1fe +#define DUNGEON_EXIT_DEFEATED_PENT_UP_ENERGY 0x1ff +#define DUNGEON_EXIT_UNUSED_512 0x200 +#define DUNGEON_EXIT_UNUSED_513 0x201 +#define DUNGEON_EXIT_UNUSED_514 0x202 +#define DUNGEON_EXIT_UNUSED_515 0x203 +#define DUNGEON_EXIT_UNUSED_516 0x204 +#define DUNGEON_EXIT_UNUSED_517 0x205 +#define DUNGEON_EXIT_FAINTED_FROM_SPIKES 0x206 +#define DUNGEON_EXIT_DEBUG_DAMAGE 0x207 +#define DUNGEON_EXIT_FAINTED_FROM_BURN 0x208 +#define DUNGEON_EXIT_FAINTED_FROM_CONSTRICTION 0x209 +#define DUNGEON_EXIT_FAINTED_FROM_POISON 0x20a +#define DUNGEON_EXIT_FAINTED_FROM_WRAP 0x20b +#define DUNGEON_EXIT_FELLED_BY_CURSE 0x20c +#define DUNGEON_EXIT_DRAINED_BY_LEECH_SEED 0x20d +#define DUNGEON_EXIT_FAINTED_FROM_PERISH_SONG 0x20e +#define DUNGEON_EXIT_FAINTED_WHILE_IN_NIGHTMARE 0x20f +#define DUNGEON_EXIT_FELLED_BY_THROWN_ROCK 0x210 +#define DUNGEON_EXIT_FAINTED_FROM_HUNGER 0x211 +#define DUNGEON_EXIT_DISAPPEARED_IN_EXPLOSION 0x212 +#define DUNGEON_EXIT_TRIPPED_CHESTNUT_TRAP 0x213 +#define DUNGEON_EXIT_FAINTED_DUE_TO_TRAP 0x214 +#define DUNGEON_EXIT_FELL_INTO_PITFALL 0x215 +#define DUNGEON_EXIT_DEFEATED_BLAST_SEED 0x216 +#define DUNGEON_EXIT_FELLED_BY_THROWN_ITEM 0x217 +#define DUNGEON_EXIT_TRANSFORMED_INTO_ITEM 0x218 +#define DUNGEON_EXIT_FAINTED_FROM_BEING_KNOCKED 0x219 +#define DUNGEON_EXIT_FELLED_BY_POKEMON_FLYING 0x21a +#define DUNGEON_EXIT_GAVE_UP_EXPLORATION 0x21b +#define DUNGEON_EXIT_DELETED_FOR_EVENT 0x21c +#define DUNGEON_EXIT_WENT_AWAY 0x21d +#define DUNGEON_EXIT_BLOWN_OUT_UNSEEN_FORCE 0x21e +#define DUNGEON_EXIT_RETURNED_WITH_FALLEN_PARTNER 0x21f +#define DUNGEON_EXIT_FAINTED_DUE_TO_WEATHER 0x220 +#define DUNGEON_EXIT_WAS_POSSESSED 0x221 +#define DUNGEON_EXIT_FAILED_TO_PROTECT_CLIENT 0x222 +#define DUNGEON_EXIT_FAINTED_FROM_WONDER_ORB 0x223 +#define DUNGEON_EXIT_FAINTED_FROM_ITEM 0x224 +#define DUNGEON_EXIT_UNK 0x225 +#define DUNGEON_EXIT_ESCAPED_MIDDLE_OF_EXPLORATION 0x226 +#define DUNGEON_EXIT_CLEARED_DUNGEON 0x227 +#define DUNGEON_EXIT_SUCCEEDED_IN_RESCUE_MISSION 0x228 +#define DUNGEON_EXIT_IMPRESSIVELY_COMPLETED_MISSION 0x229 +#define DUNGEON_EXIT_BEFRIENDED_MEW 0x22a + void OpenDungeonPaletteFile(void); void CloseDungeonPaletteFile(void); void LoadDungeonPokemonSprites(void); @@ -35,7 +91,7 @@ void sub_8068A84(Pokemon *pokemon); void sub_8068BDC(bool8 a0); void sub_8068F28(void); void sub_8068F80(void); -void HandleFaint(Entity *entity, s32 param_2, Entity *param_3); +void HandleFaint(Entity *entity, s32 dungeonExitReason, Entity *param_3); void sub_80694C0(Entity *target,s32 x,s32 y,u8 param_4); void sub_80695EC(Entity *param_1,int x,int y); Entity * sub_8069660(Entity *target); diff --git a/include/dungeon_move_util.h b/include/dungeon_move_util.h index b9df1fba4..f4e8f70b9 100644 --- a/include/dungeon_move_util.h +++ b/include/dungeon_move_util.h @@ -27,6 +27,6 @@ bool8 sub_805744C(Entity * pokemon, Move *move, bool8 param_3); void SortTargets(Entity **targetsArray, Entity *attacker); bool8 MoveRequiresCharging(Entity* pokemon, u16 moveID); void sub_8057588(Entity * pokemon, u8 param_2); -s16 sub_8057600(Move *move, s32 itemID); +s16 GetDungeonExitReasonFromMoveOrItem(Move *move, s32 itemID); #endif diff --git a/include/dungeon_run_end.h b/include/dungeon_run_end.h index a26503bb9..d7bac0973 100644 --- a/include/dungeon_run_end.h +++ b/include/dungeon_run_end.h @@ -4,6 +4,6 @@ #include "structs/str_dungeon.h" void PrintOnDungeonFinishedWindow(u32 windowId, const u8 *headerText, UnkDungeonGlobal_unk1CE98_sub *param_3); -s16 sub_8094828(u16 moveID, u8 id); +s16 GetDungeonExitReasonFromMoveOrItemID(u16 moveID, u8 id); #endif diff --git a/include/explosion.h b/include/explosion.h index b3bdc4447..3df7adc3f 100644 --- a/include/explosion.h +++ b/include/explosion.h @@ -4,6 +4,6 @@ #include "structs/str_position.h" #include "structs/dungeon_entity.h" -void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 param_4,u8 moveType,s16 param_6); +void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 param_4,u8 moveType,s16 dungeonExitReason); #endif // GUARD_EXPLOSION_H diff --git a/include/move_orb_actions_1.h b/include/move_orb_actions_1.h index 4d33225fc..0dae4dc0c 100644 --- a/include/move_orb_actions_1.h +++ b/include/move_orb_actions_1.h @@ -3,81 +3,81 @@ #include "structs/dungeon_entity.h" -bool8 IronTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805768C(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 YawnMoveAction(Entity * pokemon, Entity *target, Move *move, s32 param_4); -bool8 BasicSleepMoveAction(Entity * pokemon, Entity *target, Move *move, s32 param_4); -bool8 NightmareMoveAction(Entity * pokemon, Entity *target, Move *move, s32 param_4); -bool8 MorningSunMoveAction(Entity * pokemon,Entity * target, Move *move, s32 param_4); -bool8 VitalThrowMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4); -bool8 DigMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4); -bool8 SweetScentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 CharmMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RainDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 HailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_80578EC(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BubbleMoveAction(Entity *pokemon, Entity *target, Move * move, s32 param_4); -bool8 EncoreMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SuperFangMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PainSplitMoveAction(Entity *attacker, Entity *target, Move *move, s32 param_4); -bool8 TormentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 StringShotMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SwaggerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SnoreMoveAction(Entity *pokemon, Entity *target, Move * move, s32 param_4); -bool8 ScreechMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RockSlideMoveAction(Entity *pokemon, Entity *target, Move * move, s32 param_4); -bool32 WeatherBallMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4); -bool8 WhirlpoolMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4); -bool8 FakeTearsMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4); -bool8 SpiteMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4); -bool8 FocusEnergyMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4); -bool8 SmokescreenMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MirrorMoveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 OverheatMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 AuroraBeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MementoMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 OctazookaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 FlatterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 WillOWispMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ReturnMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4); -bool8 GrudgeMoveAction(Entity *pokemon, Entity * target, Move *move, s32 param_4); -bool8 CounterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 FlameWheelMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BasicFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ExposeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 DoubleTeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 GustMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BasicRaiseDefenseMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 DisableMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BasicRaiseAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RazorWindMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4); -bool8 BideMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 Bide2MoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ShadowBallMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BiteMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ThunderMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 EndeavorMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 FacadeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_8058580(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BrickBreakMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RockTombMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 FocusPunchMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4); -bool8 GigaDrainMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4); -bool8 ReversalMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4); -bool8 SmellingSaltMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4); -bool8 MetalSoundMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TickleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805889C(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 HazeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 OutrageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 LowKickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 AncientPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SynthesisMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 AgilityMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RapidSpinMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SureShotMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 CosmicPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 IronTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805768C(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 YawnMoveAction(Entity * pokemon, Entity *target, Move *move, s32 itemId); +bool8 BasicSleepMoveAction(Entity * pokemon, Entity *target, Move *move, s32 itemId); +bool8 NightmareMoveAction(Entity * pokemon, Entity *target, Move *move, s32 itemId); +bool8 MorningSunMoveAction(Entity * pokemon,Entity * target, Move *move, s32 itemId); +bool8 VitalThrowMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId); +bool8 DigMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId); +bool8 SweetScentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 CharmMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RainDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 HailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_80578EC(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BubbleMoveAction(Entity *pokemon, Entity *target, Move * move, s32 itemId); +bool8 EncoreMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SuperFangMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PainSplitMoveAction(Entity *attacker, Entity *target, Move *move, s32 itemId); +bool8 TormentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 StringShotMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SwaggerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SnoreMoveAction(Entity *pokemon, Entity *target, Move * move, s32 itemId); +bool8 ScreechMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RockSlideMoveAction(Entity *pokemon, Entity *target, Move * move, s32 itemId); +bool32 WeatherBallMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId); +bool8 WhirlpoolMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId); +bool8 FakeTearsMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId); +bool8 SpiteMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId); +bool8 FocusEnergyMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId); +bool8 SmokescreenMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MirrorMoveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 OverheatMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 AuroraBeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MementoMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 OctazookaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 FlatterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 WillOWispMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ReturnMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId); +bool8 GrudgeMoveAction(Entity *pokemon, Entity * target, Move *move, s32 itemId); +bool8 CounterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 FlameWheelMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BasicFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ExposeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 DoubleTeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 GustMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BasicRaiseDefenseMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 DisableMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BasicRaiseAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RazorWindMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId); +bool8 BideMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 Bide2MoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ShadowBallMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BiteMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ThunderMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 EndeavorMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 FacadeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_8058580(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BrickBreakMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RockTombMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 FocusPunchMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId); +bool8 GigaDrainMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId); +bool8 ReversalMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId); +bool8 SmellingSaltMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId); +bool8 MetalSoundMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TickleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805889C(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 HazeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 OutrageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 LowKickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 AncientPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SynthesisMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 AgilityMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RapidSpinMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SureShotMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 CosmicPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); extern const s32 gStatIndexAtkDef; extern const s32 gStatIndexSpecial; diff --git a/include/move_orb_actions_2.h b/include/move_orb_actions_2.h index 5c3073e3c..fddf05910 100644 --- a/include/move_orb_actions_2.h +++ b/include/move_orb_actions_2.h @@ -3,72 +3,72 @@ #include "structs/dungeon_entity.h" -bool8 SkyAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BasicIceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MeteorMashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ScaryFaceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_8058E5C(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 LickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 FissureMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ExtrasensoryMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 AbsorbMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SkillSwapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 HeadbuttMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 DoubleEdgeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_8059528(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SmogMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SacredFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_80595EC(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MuddyWaterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TwisterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TwineedleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_8059A2C(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SupersonicMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TauntMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 HornDrillMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ThundershockMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ThunderWaveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BlockMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PoisonGasMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ToxicMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PoisonFangMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool32 EarthquakeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 UproarMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SandstormMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 Conversion2MoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PsychUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ConversionMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SketchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 NaturePowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 HelpingHandMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 EndureMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_8058C98(Entity *pokemon, Entity *target, Move *move, s32 param_4, u32 param_5); -bool8 SonicboomMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SelfDestructMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ExplosionMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ChargeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 WaterSpoutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 StockpileMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 SkyAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BasicIceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MeteorMashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ScaryFaceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_8058E5C(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 LickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 FissureMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ExtrasensoryMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 AbsorbMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SkillSwapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 HeadbuttMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 DoubleEdgeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_8059528(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SmogMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SacredFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_80595EC(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MuddyWaterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TwisterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TwineedleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_8059A2C(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SupersonicMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TauntMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 HornDrillMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ThundershockMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ThunderWaveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BlockMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PoisonGasMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ToxicMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PoisonFangMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool32 EarthquakeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 UproarMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SandstormMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 Conversion2MoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PsychUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ConversionMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SketchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 NaturePowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 HelpingHandMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 EndureMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_8058C98(Entity *pokemon, Entity *target, Move *move, s32 itemId, u32 param_5); +bool8 SonicboomMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SelfDestructMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ExplosionMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ChargeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 WaterSpoutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 StockpileMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); void sub_80783C4(Entity * pokemon, Entity * target, bool8 param_3); -bool8 StunSporeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_8058C00(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_8059CD8(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ThunderboltMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ZapCannonMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MinimizeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SwordsDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 GrowthMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PsychoBoostMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SafeguardMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MistMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MoonlightMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SolarBeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_80599EC(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_8058EE0(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PsywaveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 WarpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 FlyMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 DiveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 StunSporeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_8058C00(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_8059CD8(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ThunderboltMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ZapCannonMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MinimizeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SwordsDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 GrowthMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PsychoBoostMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SafeguardMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MistMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MoonlightMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SolarBeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_80599EC(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_8058EE0(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PsywaveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 WarpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 FlyMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 DiveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); #endif /* ifndef GUARD_MOVE_ORB_ACTIONS_2_H */ diff --git a/include/move_orb_actions_3.h b/include/move_orb_actions_3.h index 19d41c9e2..29a67736f 100644 --- a/include/move_orb_actions_3.h +++ b/include/move_orb_actions_3.h @@ -3,63 +3,63 @@ #include "structs/dungeon_entity.h" -bool8 PoisonStingMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TriAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TrickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TripleKickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MudSlapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ThiefMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RolePlayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 LeerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PayDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 CurseMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805A568(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SuperpowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 DynamicPunchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 KnockOffMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SecretPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805AC90(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ObserverOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 FeatherDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BeatUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BlastBurnMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 CrushClawMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BlazeKickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PresentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 EruptionMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 GlareMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PoisonTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RoarMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805B17C(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 WrapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MagnitudeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 FakeOutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TailGlowMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SurfMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PerishSongMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SunnyDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BellyDrumMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 HiJumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4,u8 param_5); -bool8 JumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4,u8 param_5); -bool8 SteelWingMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4, u32 param_5); -bool8 BulkUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 AmnesiaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 HandleColorChange(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TransformMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SplashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SpitUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SwallowMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 GrowlMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 LightScreenMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RestMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805A450(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MudWaterSportMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 IngrainMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MagicCoatMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SpikesMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 WishMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 BounceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 AssistMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805AAD0(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 PoisonStingMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TriAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TrickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TripleKickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MudSlapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ThiefMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RolePlayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 LeerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PayDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 CurseMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805A568(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SuperpowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 DynamicPunchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 KnockOffMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SecretPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805AC90(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ObserverOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 FeatherDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BeatUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BlastBurnMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 CrushClawMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BlazeKickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PresentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 EruptionMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 GlareMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PoisonTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RoarMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805B17C(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 WrapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MagnitudeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 FakeOutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TailGlowMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SurfMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PerishSongMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SunnyDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BellyDrumMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 HiJumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId,u8 param_5); +bool8 JumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId,u8 param_5); +bool8 SteelWingMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId, u32 param_5); +bool8 BulkUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 AmnesiaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 HandleColorChange(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TransformMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SplashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SpitUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SwallowMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 GrowlMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 LightScreenMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RestMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805A450(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MudWaterSportMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 IngrainMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MagicCoatMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SpikesMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 WishMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 BounceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 AssistMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805AAD0(Entity *pokemon, Entity *target, Move *move, s32 itemId); #endif /* ifndef GUARD_MOVE_ORB_ACTIONS_3_H */ diff --git a/include/move_orb_actions_4.h b/include/move_orb_actions_4.h index d0020cbc6..0ee9f29c5 100644 --- a/include/move_orb_actions_4.h +++ b/include/move_orb_actions_4.h @@ -3,63 +3,63 @@ #include "structs/dungeon_entity.h" -bool8 DreamEaterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805B734(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RecycleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ReflectMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 DragonRageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 DragonDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SkullBashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 LusterPurgeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 StruggleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RockSmashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805BA44(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ThiefAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805BB64(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SwitcherOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 StayawayOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 CleanseOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4); -bool8 SlumberOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TwoEdgeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SilenceOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4); -bool8 ScannerOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 RadarOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TransferOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4); -bool8 SlowDownMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 LuminousOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4); -bool8 PetrifyOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PounceOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TrawlOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 EscapeOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4); -bool8 DroughtOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TrapbustOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4); -bool8 RollcallOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 OneShotOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 IdentifyOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 VacuumCutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ReviverOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ShockerOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805C208(Entity *pokemon, Entity *target, Move *move, u32 param_4); -bool8 sub_805C288(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 OneRoomOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MistBallMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 DestinyBondMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 FalseSwipeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 HiddenPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 AttractMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MimicMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 FrustrationMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 LeechSeedMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MetalClawMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4, s32 param_5); -bool8 InvisifyOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 CalmMindMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 DefenseCurlMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 SnatchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MetronomeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ReboundOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 sub_805B314(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 ProtectMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MirrorCoatMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 DreamEaterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805B734(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RecycleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ReflectMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 DragonRageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 DragonDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SkullBashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 LusterPurgeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 StruggleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RockSmashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805BA44(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ThiefAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805BB64(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SwitcherOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 StayawayOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 CleanseOrbAction(Entity *pokemon,Entity *target, Move *move, s32 itemId); +bool8 SlumberOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TwoEdgeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SilenceOrbAction(Entity *pokemon,Entity *target, Move *move, s32 itemId); +bool8 ScannerOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 RadarOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TransferOrbAction(Entity *pokemon,Entity *target, Move *move, s32 itemId); +bool8 SlowDownMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 LuminousOrbAction(Entity *pokemon,Entity *target, Move *move, s32 itemId); +bool8 PetrifyOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PounceOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TrawlOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 EscapeOrbAction(Entity *pokemon,Entity *target, Move *move, s32 itemId); +bool8 DroughtOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TrapbustOrbAction(Entity *pokemon,Entity *target, Move *move, s32 itemId); +bool8 RollcallOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 OneShotOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 IdentifyOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 VacuumCutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ReviverOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ShockerOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805C208(Entity *pokemon, Entity *target, Move *move, u32 itemId); +bool8 sub_805C288(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 OneRoomOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MistBallMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 DestinyBondMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 FalseSwipeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 HiddenPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 AttractMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MimicMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 FrustrationMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 LeechSeedMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MetalClawMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId, s32 param_5); +bool8 InvisifyOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 CalmMindMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 DefenseCurlMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 SnatchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MetronomeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ReboundOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 sub_805B314(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 ProtectMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MirrorCoatMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); #endif /* ifndef MOVE_ORB_ACTIONS_4_H */ diff --git a/include/move_orb_actions_5.h b/include/move_orb_actions_5.h index d32c6b383..85bd3d4f5 100644 --- a/include/move_orb_actions_5.h +++ b/include/move_orb_actions_5.h @@ -3,13 +3,13 @@ #include "structs/dungeon_entity.h" -bool8 FillInOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4); -bool8 ItemizeOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 HurlOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 MobileOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 StairsOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 LongtossOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 PierceOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); -bool8 TrapperOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 FillInOrbAction(Entity *pokemon,Entity *target, Move *move, s32 itemId); +bool8 ItemizeOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 HurlOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 MobileOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 StairsOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 LongtossOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 PierceOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); +bool8 TrapperOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId); #endif /* ifndef MOVE_ORB_ACTIONS_5_H */ diff --git a/include/number_util.h b/include/number_util.h index 132cab308..cbab8120d 100644 --- a/include/number_util.h +++ b/include/number_util.h @@ -40,13 +40,15 @@ typedef struct s48_16 #define F4816_ONE ((s48_16){0, 0x10000}) #define F4816_MAX ((s48_16){0x7FFFFFFF, 0xFFFFFFFF}) +#define S48_16(x) ((s48_16){ ((x) * (1 >> 0x10)), (((x) * (1 << 0x10))) }) + FixedPoint FixedPoint_Add(FixedPoint a, FixedPoint b); FixedPoint FixedPoint_Subtract(FixedPoint a, FixedPoint b); FixedPoint FixedPoint_Min(FixedPoint a, FixedPoint b); FixedPoint FixedPoint_Max(FixedPoint a, FixedPoint b); FixedPoint sub_8094370(FixedPoint param_1, FixedPoint param_2); FixedPoint IntToFixedPoint(s32 a); -FixedPoint FixedPoint_SetFromUnk(s48_16* param_1); +FixedPoint FixedPoint_SetFromS48_16(s48_16* param_1); FixedPoint FixedPoint_Div(FixedPoint a, FixedPoint b); s32 FixedPointToInt(FixedPoint a); // Always rounded up diff --git a/include/structs/dungeon_entity.h b/include/structs/dungeon_entity.h index 8e82b8613..6997d9e0f 100644 --- a/include/structs/dungeon_entity.h +++ b/include/structs/dungeon_entity.h @@ -292,7 +292,7 @@ typedef struct EntityInfo /* 0x140 */ FixedPoint maxBelly; /* 0x144 */ bool8 aiAllySkip; // True if an AI Pokémon is following another Pokémon and is already adjacent to them. /* 0x145 */ bool8 recalculateFollow; // Used by the AI to defer a movement decision until after all other Pokémon have moved. - /* 0x146 */ u8 unk146; + /* 0x146 */ bool8 bellyEmpty; /* 0x147 */ bool8 waiting; // True if an AI Pokémon decided to do nothing this turn. /* 0x148 */ bool8 attacking; /* 0x149 */ u8 unk149; @@ -303,7 +303,7 @@ typedef struct EntityInfo /* 0x14E */ u16 visualFlags; /* 0x150 */ u16 previousVisualFlags; /* 0x152 */ u8 unk152; - u8 unk153; + /* 0x153 */ u8 usedLinkedMovesCounter; // how many linked moves were used this turn. u8 unk154; u8 unk155; u8 unk156; diff --git a/include/structs/str_dungeon.h b/include/structs/str_dungeon.h index c856824fa..b8e7a7b5f 100644 --- a/include/structs/str_dungeon.h +++ b/include/structs/str_dungeon.h @@ -271,7 +271,7 @@ typedef struct unkDungeon644 /* 0x32 */ bool8 itemHoldersIdentified; /* 0x33 */ u8 unk33; /* 0x34 */ u8 unk34; - /* 0x35 */ u8 unk35; + /* 0x35 */ u8 emptyBellyAlert; // which alert message to show when belly gets empty. /* 0x36 */ u8 unk36; /* 0x37 */ s8 unk37; /* 0x38 */ u32 unk38; diff --git a/src/blow_away.c b/src/blow_away.c index 12e46ae8a..53e847bd9 100644 --- a/src/blow_away.c +++ b/src/blow_away.c @@ -109,7 +109,7 @@ void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction) _0807CF26: sub_807D068(target,&target->pos); - sub_806F370(pokemon,target,gBlowAwayDmgValue,0,0,0,0x219,0,0,0); + sub_806F370(pokemon,target,gBlowAwayDmgValue,0,0,0,DUNGEON_EXIT_FAINTED_FROM_BEING_KNOCKED,RESIDUAL_DAMAGE_REGULAR,0,0); } if (IsFloorOver()) { return; @@ -118,7 +118,7 @@ void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction) InitPokemonMove(&move,0x163); if (!sub_80571F0(entity,&move)) { TrySendImmobilizeSleepEndMsg(pokemon,entity); - sub_806F370(pokemon,entity,gBlowAwayDmgValue,0,0,0,0x21a,0,0,0); + sub_806F370(pokemon,entity,gBlowAwayDmgValue,0,0,0,DUNGEON_EXIT_FELLED_BY_POKEMON_FLYING,RESIDUAL_DAMAGE_REGULAR,0,0); } } if (IsFloorOver()) { diff --git a/src/code_8066D04.c b/src/code_8066D04.c index c04bd8302..6b185bbff 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -733,7 +733,7 @@ void sub_8067794(Entity *entity, Entity *targetEntity, s32 a2) u8 tempText[64]; strncpy(tempText, gFormatBuffer_Monsters[0], sizeof(tempText)); - HandleFaint(targetEntity, 0x21D, 0); + HandleFaint(targetEntity, DUNGEON_EXIT_WENT_AWAY, 0); strncpy(gFormatBuffer_Monsters[0], tempText, sizeof(tempText)); DisplayDungeonMessage(NULL, stringPtr2, TRUE); } diff --git a/src/code_806FDF4.c b/src/code_806FDF4.c index 45879ca06..65aca0d34 100644 --- a/src/code_806FDF4.c +++ b/src/code_806FDF4.c @@ -271,7 +271,7 @@ bool8 sub_806FA5C(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *pa UnlockFriendArea(friendArea); flag = TRUE; } - HandleFaint(entity2,500,entity1); + HandleFaint(entity2,DUNGEON_EXIT_TRANSFORMED_INTO_FRIEND,entity1); pokeStruct2 = &gRecruitedPokemonRef->dungeonTeam[pokeIndex]; pokeStruct2->flags = 3; pokeStruct2->isTeamLeader = FALSE; @@ -438,7 +438,7 @@ bool8 sub_806FDF4(Entity *entity1,Entity *entity2,Entity **entityPtr) flag = TRUE; } IncrementAdventureNumJoined(); - HandleFaint(entity2,500,entity1); + HandleFaint(entity2,DUNGEON_EXIT_TRANSFORMED_INTO_FRIEND,entity1); if (SpawnTeamMember(local_74.id,local_74.pos.x,local_74.pos.y,pokeStruct2,&local_2c,0,0) == 0) { pokeStruct2->flags = 0; } diff --git a/src/dungeon_8083AB0.c b/src/dungeon_8083AB0.c index 3f67c181a..c9e02eb37 100644 --- a/src/dungeon_8083AB0.c +++ b/src/dungeon_8083AB0.c @@ -9,7 +9,7 @@ #include "dungeon_strings.h" #include "run_dungeon.h" -void sub_8083AB0(s16 param_0, Entity *target, Entity *entity) +void sub_8083AB0(s16 dungeonExitReason_, Entity *target, Entity *entity) { u8 *defPtr; u8 *attackPtr; @@ -20,7 +20,7 @@ void sub_8083AB0(s16 param_0, Entity *target, Entity *entity) u8 buffer [0x14]; UnkDungeonGlobal_unk1CE98_sub *temp; u8 *id; - s32 param_0_s32 = param_0; + s32 dungeonExitReason = dungeonExitReason_; temp = &gDungeon->unk1CE98; targetEntityInfo = NULL; @@ -37,7 +37,7 @@ void sub_8083AB0(s16 param_0, Entity *target, Entity *entity) } sub_80709C8(buffer,entityInfo); CopyStringtoBuffer(temp->buffer2, buffer); - temp->moveID = param_0_s32; + temp->moveID = dungeonExitReason; temp->heldItem = entityInfo->heldItem; temp->exp = entityInfo->exp; temp->level = entityInfo->level; diff --git a/src/dungeon_config.c b/src/dungeon_config.c index 24ac7409c..827588d16 100644 --- a/src/dungeon_config.c +++ b/src/dungeon_config.c @@ -428,29 +428,28 @@ const s32 gEffectivenessChart[NUM_EFFECTIVENESS][NUM_EFFECTIVENESS] = { }, }; -// Todo: change to readable format const s48_16 gBellyGoDownValues[BELLY_GO_DOWN_VALUES_COUNT] = { - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0x199A}, - {0, 0x4000}, - {0, 0x8000}, - {0, 0xC000}, - {0, 0x10000}, - {0, 0x20000}, - {0, 0x40000}, - {0, 0x80000}, - {0, 0x100000}, - {0, 0x200000}, - {0, 0x400000}, - {0, 0x800000}, - {0, 0x800000}, - {0, 0x800000}, + S48_16(0.0), + S48_16(0.0), + S48_16(0.0), + S48_16(0.0), + S48_16(0.0), + S48_16(0.0), + S48_16(0.10001), + S48_16(0.25), + S48_16(0.5), + S48_16(0.75), + S48_16(1.0), + S48_16(2.0), + S48_16(4.0), + S48_16(8.0), + S48_16(16.0), + S48_16(32.0), + S48_16(64.0), + S48_16(128.0), + S48_16(128.0), + S48_16(128.0) }; const s16 gWarpScarfActivationChances[WARP_SCARF_ACTIVATION_CHANCES_COUNT] = {0, 6, 12, 30, 50, 70, 90, 110, 130, 150, 170, 190, 210, 230, 250, 270, 290, 310, 999, 0}; @@ -1036,4 +1035,12 @@ const s32 gUnknown_80F5FAC[76] = { 1, 1, 2, 1, 1, 4, 4, 1 }; -const s32 gUnknown_80F60DC[5] = {1, 1, 1, 2, 4}; +// belly will go down by this amount after using linked moves +// value depends on number of moves that are linked +const s32 gLinkedMovesBellyGoDownValues[5] = { + 1, // 0 moves + 1, // 1 move + 1, // 2 moves + 2, // 3 moves + 4 // 4 moves +}; diff --git a/src/dungeon_cutscene.c b/src/dungeon_cutscene.c index 450c35341..81e0f992b 100644 --- a/src/dungeon_cutscene.c +++ b/src/dungeon_cutscene.c @@ -533,7 +533,7 @@ void DisplayPreFightDialogue(void) sub_8097FF8(); } -void sub_8084E00(Entity *entity, u8 param_2, u8 param_3) +void sub_8084E00(Entity *entity, u8 param_2, bool8 param_3) { if (param_2 != 0) { switch(gDungeon->unk3A0D) { @@ -965,7 +965,7 @@ static void sub_8085764(void) { entity = gDungeon->wildPokemon[index]; if ((EntityIsValid(entity)) && (GetEntInfo(entity)->monsterBehavior == BEHAVIOR_ALLY)) { - HandleFaint(entity,0x207,&stackEntity); + HandleFaint(entity,DUNGEON_EXIT_DEBUG_DAMAGE,&stackEntity); } } } diff --git a/src/dungeon_cutscene_articuno.c b/src/dungeon_cutscene_articuno.c index f9587c676..d575da8e0 100644 --- a/src/dungeon_cutscene_articuno.c +++ b/src/dungeon_cutscene_articuno.c @@ -88,7 +88,7 @@ void sub_8087FF8(void) sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if (sub_8086AE4(MONSTER_ARTICUNO)) { - HandleFaint(articunoEntity,0x21c,0); + HandleFaint(articunoEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { LevelUpTarget(articunoEntity,articunoEntity,gArticunoConfigLevel,0,0); diff --git a/src/dungeon_cutscene_celebi.c b/src/dungeon_cutscene_celebi.c index 6a9bda2e7..35cddc50e 100644 --- a/src/dungeon_cutscene_celebi.c +++ b/src/dungeon_cutscene_celebi.c @@ -79,7 +79,7 @@ void CelebiJoinDialogue(void) celebiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_CELEBI); if ((HasRecruitedMon(MONSTER_CELEBI)) || (!sub_806FD18(celebiEntity))) { - HandleFaint(celebiEntity,0x21c,0); + HandleFaint(celebiEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); SpriteLookAroundEffect(leaderEntity); sub_803E708(10,0x46); // ......... diff --git a/src/dungeon_cutscene_deoxys.c b/src/dungeon_cutscene_deoxys.c index 04f3c43d8..cdcc6fa23 100644 --- a/src/dungeon_cutscene_deoxys.c +++ b/src/dungeon_cutscene_deoxys.c @@ -134,7 +134,7 @@ static void sub_808C550(void) static void sub_808C590(Entity *r0) { - HandleFaint(r0, 0x21C, 0); + HandleFaint(r0, DUNGEON_EXIT_DELETED_FOR_EVENT, 0); } static void SetupDeoxysFacingDirection(Entity *deoxysEntity) diff --git a/src/dungeon_cutscene_entei.c b/src/dungeon_cutscene_entei.c index 3b242fe95..b91c29e7f 100644 --- a/src/dungeon_cutscene_entei.c +++ b/src/dungeon_cutscene_entei.c @@ -66,7 +66,7 @@ void sub_8089C90(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(MONSTER_ENTEI)) { - HandleFaint(EnteiEntity,0x21c,0); + HandleFaint(EnteiEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { SetFacingDirection(EnteiEntity, DIRECTION_SOUTH); diff --git a/src/dungeon_cutscene_groudon.c b/src/dungeon_cutscene_groudon.c index 10a7612ec..a709dc791 100644 --- a/src/dungeon_cutscene_groudon.c +++ b/src/dungeon_cutscene_groudon.c @@ -85,7 +85,7 @@ void sub_80886C4(void) sub_8085374(); sub_80854D4(); sub_8085930(DIRECTION_NORTH); - HandleFaint(alakazamEntity,0x21c,0); + HandleFaint(alakazamEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); SetFacingDirection(groudonEntity, DIRECTION_SOUTH); sub_8086A3C(groudonEntity); sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y); @@ -109,9 +109,9 @@ void sub_808875C(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); - HandleFaint(alakazamEntity,0x21c,0); + HandleFaint(alakazamEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); if (sub_8086AE4(MONSTER_GROUDON)) { - HandleFaint(groudonEntity,0x21c,0); + HandleFaint(groudonEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { LevelUpTarget(groudonEntity,groudonEntity,gGroudonConfigLevel,0,0); @@ -179,7 +179,7 @@ void GroudonPreFightDialogue(void) sub_80861B8(alakazamEntity,6,DIRECTION_NORTH); PlaySoundEffect(0x205); sub_8086738(); - HandleFaint(alakazamEntity,0x21c,0); + HandleFaint(alakazamEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); DisplayDungeonDialogue(&GroudonPreFightDialogue_8); sub_803E708(10,0x46); DisplayDungeonDialogue(&GroudonPreFightDialogue_9); diff --git a/src/dungeon_cutscene_hooh.c b/src/dungeon_cutscene_hooh.c index 6aac60626..b0877952f 100644 --- a/src/dungeon_cutscene_hooh.c +++ b/src/dungeon_cutscene_hooh.c @@ -72,7 +72,7 @@ void sub_808A668(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(MONSTER_HO_OH)) { - HandleFaint(HoOhEntity,0x21c,0); + HandleFaint(HoOhEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { SetFacingDirection(HoOhEntity, DIRECTION_SOUTH); diff --git a/src/dungeon_cutscene_jirachi.c b/src/dungeon_cutscene_jirachi.c index a44f8c870..14280bc08 100644 --- a/src/dungeon_cutscene_jirachi.c +++ b/src/dungeon_cutscene_jirachi.c @@ -84,7 +84,7 @@ void sub_808B35C(void) sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if (HasRecruitedMon(MONSTER_JIRACHI)) { - HandleFaint(jirachiEntity,0x21c,0); + HandleFaint(jirachiEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { SetFacingDirection(jirachiEntity, DIRECTION_SOUTH); diff --git a/src/dungeon_cutscene_kyogre.c b/src/dungeon_cutscene_kyogre.c index 792317995..06d8c3052 100644 --- a/src/dungeon_cutscene_kyogre.c +++ b/src/dungeon_cutscene_kyogre.c @@ -58,7 +58,7 @@ void sub_808C10C(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(MONSTER_KYOGRE)) { - HandleFaint(kyogreEntity,0x21c,0); + HandleFaint(kyogreEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { gDungeon->unk7 = 1; diff --git a/src/dungeon_cutscene_latios.c b/src/dungeon_cutscene_latios.c index 2241c46e2..1c0c7ebcf 100644 --- a/src/dungeon_cutscene_latios.c +++ b/src/dungeon_cutscene_latios.c @@ -84,7 +84,7 @@ void sub_808AA94(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); - HandleFaint(LatiosEntity,0x21c,0); + HandleFaint(LatiosEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3); CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_LATIOS); } diff --git a/src/dungeon_cutscene_lugia.c b/src/dungeon_cutscene_lugia.c index 6a20657aa..bb2776c6f 100644 --- a/src/dungeon_cutscene_lugia.c +++ b/src/dungeon_cutscene_lugia.c @@ -56,7 +56,7 @@ void sub_808BDEC(void) sub_80855E4(sub_8086A3C); if (HasRecruitedMon(MONSTER_LUGIA)) { DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE); - HandleFaint(lugiaEntity,0x21c,0); + HandleFaint(lugiaEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { gDungeon->unk7 = 1; diff --git a/src/dungeon_cutscene_magma_cavern.c b/src/dungeon_cutscene_magma_cavern.c index 1b16419e5..c9605e438 100644 --- a/src/dungeon_cutscene_magma_cavern.c +++ b/src/dungeon_cutscene_magma_cavern.c @@ -79,8 +79,8 @@ void sub_8088E5C(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); - HandleFaint(groudonEntity,0x21c,0); - HandleFaint(alakazamEntity,0x21c,0); + HandleFaint(groudonEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); + HandleFaint(alakazamEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y + -3); CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_GROUDON); CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_ALAKAZAM); diff --git a/src/dungeon_cutscene_mankey.c b/src/dungeon_cutscene_mankey.c index 0d6f334ce..f352d8e05 100644 --- a/src/dungeon_cutscene_mankey.c +++ b/src/dungeon_cutscene_mankey.c @@ -150,7 +150,7 @@ void sub_80898E4(void) static void sub_80898F8(Entity *r0) { - HandleFaint(r0, 0x21C, 0); + HandleFaint(r0, DUNGEON_EXIT_DELETED_FOR_EVENT, 0); } static void sub_8089908(Entity *r0) diff --git a/src/dungeon_cutscene_medicham.c b/src/dungeon_cutscene_medicham.c index 2eddd47f5..e64fcb1f6 100644 --- a/src/dungeon_cutscene_medicham.c +++ b/src/dungeon_cutscene_medicham.c @@ -101,7 +101,7 @@ void MedichamRescueDialogue(void) sub_806CE68(medichamEntity, DIRECTION_SOUTH); sub_803E708(0x20, 0x46); sub_8042B0C(medichamEntity); - HandleFaint(medichamEntity, 0x21C, 0); + HandleFaint(medichamEntity, DUNGEON_EXIT_DELETED_FOR_EVENT, 0); gDungeon->unk4 = 1; gDungeon->unk11 = 4; } @@ -116,7 +116,7 @@ void sub_808CB5C(void) DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); sub_8085930(DIRECTION_NORTH); - HandleFaint(medichamEntity, 0x21C, 0); + HandleFaint(medichamEntity, DUNGEON_EXIT_DELETED_FOR_EVENT, 0); sub_8085860(leaderEntity->pos.x, leaderEntity->pos.y); CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_MEDICHAM); } diff --git a/src/dungeon_cutscene_mewtwo.c b/src/dungeon_cutscene_mewtwo.c index f898f1dbb..2281ffff0 100644 --- a/src/dungeon_cutscene_mewtwo.c +++ b/src/dungeon_cutscene_mewtwo.c @@ -72,7 +72,7 @@ void sub_8089978(void) sub_80855E4(sub_8086A3C); if(HasRecruitedMon(MONSTER_MEWTWO)){ DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE); - HandleFaint(MewtwoEntity,0x21c,0); + HandleFaint(MewtwoEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { gDungeon->unk7 = 1; diff --git a/src/dungeon_cutscene_moltres.c b/src/dungeon_cutscene_moltres.c index a1d884c7b..4512b75cc 100644 --- a/src/dungeon_cutscene_moltres.c +++ b/src/dungeon_cutscene_moltres.c @@ -79,7 +79,7 @@ void sub_8087848(void) sub_8085930(DIRECTION_WEST); sub_80855E4(sub_8086A3C); if (sub_8086AE4(MONSTER_MOLTRES)) { - HandleFaint(moltresEntity,0x21c,0); + HandleFaint(moltresEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { LevelUpTarget(moltresEntity,moltresEntity,gMoltresConfigLevel,0,0); diff --git a/src/dungeon_cutscene_raikou.c b/src/dungeon_cutscene_raikou.c index 416b38a16..7f6b08fdd 100644 --- a/src/dungeon_cutscene_raikou.c +++ b/src/dungeon_cutscene_raikou.c @@ -82,7 +82,7 @@ void sub_8089F8C(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(MONSTER_RAIKOU)) { - HandleFaint(RaikouEntity,0x21c,0); + HandleFaint(RaikouEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { SetFacingDirection(RaikouEntity, DIRECTION_SOUTH); diff --git a/src/dungeon_cutscene_rayquaza.c b/src/dungeon_cutscene_rayquaza.c index e994be968..9f5b4e55f 100644 --- a/src/dungeon_cutscene_rayquaza.c +++ b/src/dungeon_cutscene_rayquaza.c @@ -72,7 +72,7 @@ void sub_8089328(void) sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if (sub_8086AE4(MONSTER_RAYQUAZA)) { - HandleFaint(rayquazaEntity,0x21c,0); + HandleFaint(rayquazaEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { LevelUpTarget(rayquazaEntity,rayquazaEntity,gRayquazaConfigLevel,0,0); diff --git a/src/dungeon_cutscene_regis.c b/src/dungeon_cutscene_regis.c index 077bdf7bc..8ddc46a3c 100644 --- a/src/dungeon_cutscene_regis.c +++ b/src/dungeon_cutscene_regis.c @@ -51,7 +51,7 @@ void sub_808ACC0(void) if (HasRecruitedMon(MONSTER_REGIROCK)) { entity = GetEntityFromMonsterBehavior(BEHAVIOR_REGIROCK); - HandleFaint(entity,0x21c,0); + HandleFaint(entity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); sub_8097FA8(0x22); sub_8097FA8(0x1d); sub_808B1CC(ITEM_ROCK_PART); @@ -78,7 +78,7 @@ void sub_808AD48(void) if (HasRecruitedMon(MONSTER_REGICE)) { entity = GetEntityFromMonsterBehavior(BEHAVIOR_REGICE); - HandleFaint(entity,0x21c,0); + HandleFaint(entity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); sub_8097FA8(0x22); sub_8097FA8(0x1d); sub_808B1CC(ITEM_ICE_PART); @@ -106,7 +106,7 @@ void sub_808ADCC(void) if (HasRecruitedMon(MONSTER_REGISTEEL)) { entity = GetEntityFromMonsterBehavior(BEHAVIOR_REGISTEEL); - HandleFaint(entity,0x21c,0); + HandleFaint(entity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); sub_8097FA8(0x22); sub_8097FA8(0x1d); sub_808B1CC(ITEM_STEEL_PART); diff --git a/src/dungeon_cutscene_skarmory.c b/src/dungeon_cutscene_skarmory.c index e3ee7f37c..0e78dd1f8 100644 --- a/src/dungeon_cutscene_skarmory.c +++ b/src/dungeon_cutscene_skarmory.c @@ -71,8 +71,8 @@ void sub_8086B94(void) diglettEntity = GetEntityFromMonsterBehavior(BEHAVIOR_DIGLETT); skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); - HandleFaint(skarmoryEntity,0x21c,0); - HandleFaint(diglettEntity,0x21c,0); + HandleFaint(skarmoryEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); + HandleFaint(diglettEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y); diff --git a/src/dungeon_cutscene_smeargle.c b/src/dungeon_cutscene_smeargle.c index 84a92ea75..54ad0fd32 100644 --- a/src/dungeon_cutscene_smeargle.c +++ b/src/dungeon_cutscene_smeargle.c @@ -107,7 +107,7 @@ void SmeargleRescueDialogue(void) sub_806CE68(smeargleEntity, DIRECTION_SOUTH); sub_803E708(0x20, 0x46); sub_8042B0C(smeargleEntity); - HandleFaint(smeargleEntity, 0x21C, 0); + HandleFaint(smeargleEntity, DUNGEON_EXIT_DELETED_FOR_EVENT, 0); gDungeon->unk4 = 1; gDungeon->unk11 = 4; } @@ -123,7 +123,7 @@ void sub_808CD44(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); - HandleFaint(smeargleEntity, 540, 0); + HandleFaint(smeargleEntity, DUNGEON_EXIT_DELETED_FOR_EVENT, 0); sub_8085860(leaderEntity->pos.x, leaderEntity->pos.y - 3); CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_SMEARGLE); } diff --git a/src/dungeon_cutscene_suicune.c b/src/dungeon_cutscene_suicune.c index a4653fbe3..4a6caff57 100644 --- a/src/dungeon_cutscene_suicune.c +++ b/src/dungeon_cutscene_suicune.c @@ -84,7 +84,7 @@ void sub_808A308(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(MONSTER_SUICUNE)) { - HandleFaint(SuicuneEntity,0x21c,0); + HandleFaint(SuicuneEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { SetFacingDirection(SuicuneEntity, DIRECTION_SOUTH); diff --git a/src/dungeon_cutscene_zapdos.c b/src/dungeon_cutscene_zapdos.c index b9eab71e2..3f9d3b392 100644 --- a/src/dungeon_cutscene_zapdos.c +++ b/src/dungeon_cutscene_zapdos.c @@ -82,7 +82,7 @@ void sub_808729C(void) sub_8085930(4); sub_80855E4(sub_8086A3C); if (sub_8086AE4(0x91) != 0) { - HandleFaint(zapdosEntity,0x21c,0); + HandleFaint(zapdosEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); } else { LevelUpTarget(zapdosEntity,zapdosEntity,gZapdosConfigLevel,0,0); diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index c957b1f58..0e9759fc0 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -72,7 +72,7 @@ extern void sub_8042978(Entity *); extern void sub_804298C(Entity *); extern void sub_80428EC(Entity *); -static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *r5, bool32 isFalseSwipe, bool32 giveExp, s16 arg4_, s32 arg8); +static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *r5, bool32 isFalseSwipe, bool32 giveExp, s16 dungeonExitReason_, s32 arg8); static bool8 sub_806E100(s48_16 *param_1, Entity *pokemon, Entity *target, u8 type, DamageStruct *dmgStruct); static void sub_806F500(void); static void sub_806F63C(Entity *param_1); @@ -89,14 +89,14 @@ static const s48_16 gUnknown_8106F3C = {0x0, 0x8000}; static const s48_16 gUnknown_8106F44 = {0x0, 0xE666}; static const s48_16 gUnknown_8106F4C = {0x0, 0x18000}; -void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 arg4, bool32 arg8, s32 argC) +void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 dungeonExitReason_, bool32 arg8, s32 argC) { bool32 r9; - // Some compiler weirdness, because it won't match without creating arg4 again - s32 r10 = arg4; + // Some compiler weirdness, because it won't match without creating dungeonExitReason_ again + s32 dungeonExitReason = dungeonExitReason_; s32 returnDmg = 0; - if (HandleDealingDamageInternal(attacker, target, dmgStruct, isFalseSwipe, giveExp, r10, argC)) + if (HandleDealingDamageInternal(attacker, target, dmgStruct, isFalseSwipe, giveExp, dungeonExitReason, argC)) return; if (dmgStruct->tookNoDamage) return; @@ -152,12 +152,12 @@ void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct * TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80FCFA4); sp.dmg = (dmgStruct->dmg * returnDmg) / 4; sp.type = dmgStruct->type; - sp.residualDmgType = 6; + sp.residualDmgType = RESIDUAL_DAMAGE_COUNTERATTACK; sp.typeEffectiveness = 2; sp.isCrit = FALSE; sp.unkE = 0; sp.tookNoDamage = FALSE; - HandleDealingDamageInternal(target, attacker, &sp, FALSE, giveExp, r10, argC); + HandleDealingDamageInternal(target, attacker, &sp, FALSE, giveExp, dungeonExitReason, argC); } } if (!EntityIsValid(attacker) || !EntityIsValid(target)) @@ -246,7 +246,7 @@ void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct * } else { sub_8041D00(destBondTarget, target); - DealDamageToEntity(destBondTarget, dmgStruct->dmg, 0xC, 0x1F9); + DealDamageToEntity(destBondTarget, dmgStruct->dmg, RESIDUAL_DAMAGE_DESTINY_BOND, DUNGEON_EXIT_FAINTED_FROM_DESTINY_BOND); } } } @@ -257,11 +257,11 @@ static inline u32 ItemId(Item *item) return item->id; } -static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 arg4_, s32 arg8) +static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 dungeonExitReason_, s32 arg8) { s32 hpBefore, hpChange; EntityInfo *targetData; - s32 arg4 = arg4_; + s32 dungeonExitReason = dungeonExitReason_; bool32 var_24 = FALSE; bool32 r10 = FALSE; s32 r8 = 0; @@ -283,7 +283,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc dmgStruct->dmg = gSetDamageDmgValue; } - if (arg4 != 0x20E && AbilityIsActive(target, ABILITY_STURDY) && dmgStruct->dmg == 9999) { + if (dungeonExitReason != DUNGEON_EXIT_FAINTED_FROM_PERISH_SONG && AbilityIsActive(target, ABILITY_STURDY) && dmgStruct->dmg == 9999) { SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[1], target, 0); TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80FCA90); sub_8042238(attacker, target); @@ -375,7 +375,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc targetData->unkA0 = 999; if (ShouldDisplayEntity(target)) { - if (dmgStruct->residualDmgType != 14) { + if (dmgStruct->residualDmgType != RESIDUAL_DAMAGE_HUNGER) { sub_803ED30(-dmgStruct->dmg, target, 1, -1); } if (targetData->unk152 == 0 && str != NULL) { @@ -389,7 +389,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc } } - if ((dmgStruct->residualDmgType != 14 || targetData->HP <= 1) && unkTile == NULL && ShouldDisplayEntity(target)) { + if ((dmgStruct->residualDmgType != RESIDUAL_DAMAGE_HUNGER || targetData->HP <= 1) && unkTile == NULL && ShouldDisplayEntity(target)) { if ((attacker->pos.x != target->pos.x || attacker->pos.y != target->pos.y) && GetEntityType(attacker) == ENTITY_MONSTER) { bool32 unkBool = FALSE; if (targetData->isTeamLeader) { @@ -481,7 +481,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc targetData->unk14C = 0; SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], attacker, 0); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[1], target, 0); - if (dmgStruct->residualDmgType == 19 || dmgStruct->residualDmgType == 20) { + if (dmgStruct->residualDmgType == RESIDUAL_DAMAGE_MOVE_FAIL || dmgStruct->residualDmgType == RESIDUAL_DAMAGE_RECOIL) { if (targetData->isNotTeamMember) { TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80F9E44); } @@ -539,7 +539,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc targetData->unk14C = 1; targetData->belly = targetData->maxBelly; if (targetData->isTeamLeader) { - gDungeon->unk644.unk35 = 0; + gDungeon->unk644.emptyBellyAlert = 0; gDungeon->unk644.itemHoldersIdentified = 0; } ZeroOutItem(&targetData->heldItem); @@ -586,7 +586,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc sub_8042148(target); monPos = teamMember->pos; - HandleFaint(teamMember, 0x221, target); + HandleFaint(teamMember, DUNGEON_EXIT_WAS_POSSESSED, target); sub_80694C0(target, monPos.x, monPos.y, 1); UpdateEntityPixelPos(target, NULL); target->unk22 = 0; @@ -596,7 +596,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc targetData->unk14C = 1; targetData->belly = targetData->maxBelly; if (targetData->isTeamLeader) { - gDungeon->unk644.unk35 = 0; + gDungeon->unk644.emptyBellyAlert = 0; gDungeon->unk644.itemHoldersIdentified = 0; } ZeroOutItem(heldItem); @@ -651,7 +651,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc targetData->unk14C = 1; targetData->belly = targetData->maxBelly; if (targetData->isTeamLeader) { - gDungeon->unk644.unk35 = 0; + gDungeon->unk644.emptyBellyAlert = 0; gDungeon->unk644.itemHoldersIdentified = 0; } if (targetData->curseClassStatus.status == STATUS_SNATCH) { @@ -737,18 +737,18 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc sub_8069D4C(&sp, target); if (sub_806F660(attacker, target)) { if (!sub_806FA5C(attacker, target, &sp)) { - HandleFaint(target, 0x1F5, attacker); + HandleFaint(target, DUNGEON_EXIT_LEFT_WITHOUT_BEING_BEFRIENDED, attacker); } else { gUnknown_202F221 = 1; } } else { - HandleFaint(target, arg4, attacker); + HandleFaint(target, dungeonExitReason, attacker); } } else { - HandleFaint(target, arg4, attacker); + HandleFaint(target, dungeonExitReason, attacker); } return TRUE; @@ -994,7 +994,7 @@ s32 WeightWeakTypePicker(Entity *user, Entity *target, u8 moveType) weight /= 2; if (weight == 0) { - // BUG: If the Pokémon's first type resists the move, the second type is ignored. + // BUG: If the Pokémon's first type resists the move, the second type is ignored. // This calculates type effectiveness incorrectly if the first type resists the move and the second type is weak to the move. // For example, a Fire-type move is considered not very effective against a Rock/Bug-type like Anorith. return 2; @@ -1184,7 +1184,7 @@ static void ApplyAtkDefStatBoosts(Entity *attacker, Entity *target, u8 moveType, static inline void SetDamageOne(struct DamageStruct *dmgStruct, u8 moveType) { dmgStruct->dmg = 1; - dmgStruct->residualDmgType = 0; + dmgStruct->residualDmgType = RESIDUAL_DAMAGE_REGULAR; dmgStruct->typeEffectiveness = EFFECTIVENESS_NEUTRAL; dmgStruct->type = moveType; dmgStruct->isCrit = FALSE; @@ -1448,7 +1448,7 @@ void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s3 gDungeon->unk134.unk158 = FP48_16_ToS32(&unkSp9); dmgStruct->dmg = FP48_16_ToS32(&unkSp8); - dmgStruct->residualDmgType = 0; + dmgStruct->residualDmgType = RESIDUAL_DAMAGE_REGULAR; if (dmgStruct->dmg == 0) { dmgStruct->isCrit = FALSE; } @@ -1469,31 +1469,31 @@ void sub_806F2BC(Entity *attacker, Entity *target, u8 moveType, s32 a2, struct D FP48_16_FromS32(&unkSp2, a2New); F48_16_SMul(&unkSp2, &unkSp2, &unkSp1); dmgStruct->dmg = FP48_16_ToS32(&unkSp2); - dmgStruct->residualDmgType = 0; + dmgStruct->residualDmgType = RESIDUAL_DAMAGE_REGULAR; } -void DealDamageToEntity(Entity *entity, s32 dmg, s32 r6, s32 r4) +void DealDamageToEntity(Entity *entity, s32 dmg, s32 residualDmgType, s32 dungeonExitReason_) { Entity spEntity; struct DamageStruct dmgStruct; - s32 r4_ = (s16) r4; + s32 dungeonExitReason = (s16) dungeonExitReason_; sub_80457DC(&spEntity); dmgStruct.dmg = dmg; dmgStruct.typeEffectiveness = EFFECTIVENESS_NEUTRAL; dmgStruct.type = TYPE_NONE; - dmgStruct.residualDmgType = r6; + dmgStruct.residualDmgType = residualDmgType; dmgStruct.isCrit = FALSE; dmgStruct.unkE = 0; dmgStruct.tookNoDamage = FALSE; - HandleDealingDamage(&spEntity, entity, &dmgStruct, FALSE, FALSE, r4_, FALSE, 0); + HandleDealingDamage(&spEntity, entity, &dmgStruct, FALSE, FALSE, dungeonExitReason, FALSE, 0); } -void sub_806F370(Entity *pokemon, Entity *target, s32 dmg, s32 giveExp, bool8 *tookNoDamage, u8 moveType, s16 arg_8, s32 residualDmgType, s32 arg_10, s32 arg_14) +void sub_806F370(Entity *pokemon, Entity *target, s32 dmg, s32 giveExp, bool8 *tookNoDamage, u8 moveType, s16 dungeonExitReason_, s32 residualDmgType, s32 arg_10, s32 arg_14) { s32 i; struct DamageStruct dmgStruct; - s32 arg_8_ = arg_8; + s32 dungeonExitReason = dungeonExitReason_; s32 dmgNew = dmg; dmgStruct.typeEffectiveness = EFFECTIVENESS_NEUTRAL; @@ -1524,7 +1524,7 @@ void sub_806F370(Entity *pokemon, Entity *target, s32 dmg, s32 giveExp, bool8 *t dmgStruct.tookNoDamage = FALSE; } - HandleDealingDamage(pokemon, target, &dmgStruct, FALSE, giveExp, arg_8_, arg_10, arg_14); + HandleDealingDamage(pokemon, target, &dmgStruct, FALSE, giveExp, dungeonExitReason, arg_10, arg_14); if (tookNoDamage != NULL) { *tookNoDamage = dmgStruct.tookNoDamage; } diff --git a/src/dungeon_item_action.c b/src/dungeon_item_action.c index 41cbdf762..823d65c02 100644 --- a/src/dungeon_item_action.c +++ b/src/dungeon_item_action.c @@ -135,7 +135,7 @@ void sub_80479B8(char param_1, char param_2, u8 param_3, Entity *pokemon, Entity sub_8045BF8(gFormatBuffer_Items[0],item); TryDisplayDungeonLoggableMessage3(pokemon,target,gItemStickyDoesntWorkText); if (param_1 != '\0') { - sub_806F370(pokemon,target,gUnknown_80F4FAE,1,&uStack_24,0,0x217,0,0,0); + sub_806F370(pokemon,target,gUnknown_80F4FAE,1,&uStack_24,0,DUNGEON_EXIT_FELLED_BY_THROWN_ITEM,RESIDUAL_DAMAGE_REGULAR,0,0); EnemyEvolution(pokemon); return; } @@ -151,7 +151,7 @@ _jump: } if ((GetItemCategory(item->id) == CATEGORY_TMS_HMS) || (GetItemCategory(item->id) == CATEGORY_LINK_BOX)) { if (param_1 != '\0') { - sub_806F370(pokemon,target,gUnknown_80F4FAC,1,&uStack_23,0,0x217,0,0,0); + sub_806F370(pokemon,target,gUnknown_80F4FAC,1,&uStack_23,0,DUNGEON_EXIT_FELLED_BY_THROWN_ITEM,RESIDUAL_DAMAGE_REGULAR,0,0); goto _080482B4; } else @@ -356,7 +356,7 @@ _jump: break; default: if (param_1 != '\0') { - sub_806F370(pokemon,target,gUnknown_80F4FAC,1,&auStack_22,0,0x217,0,0,0); + sub_806F370(pokemon,target,gUnknown_80F4FAC,1,&auStack_22,0,DUNGEON_EXIT_FELLED_BY_THROWN_ITEM,RESIDUAL_DAMAGE_REGULAR,0,0); } else { @@ -386,7 +386,7 @@ static void sub_80482FC(Entity *pokemon, Entity *target, u32 pp, u8 param_4) static void sub_8048340(Entity *pokemon, Entity *target, u32 r2) { - sub_806F370(pokemon, target, r2, 1, 0, 0, 528, 0, 0, 0); + sub_806F370(pokemon, target, r2, 1, 0, 0, DUNGEON_EXIT_FELLED_BY_THROWN_ROCK, RESIDUAL_DAMAGE_REGULAR, 0, 0); } static void HealSeedItemAction(Entity *pokemon, Entity *target, u8 r2) @@ -590,7 +590,7 @@ static void BlastSeedItemAction(Entity *pokemon, Entity * target, u8 param_3) if (entityInfo_1->frozenClassStatus.status == STATUS_FROZEN) { EndFrozenClassStatus(pokemon, target); } - sub_806F370(pokemon, target, dmg, 1, auStack28, 0, 0x216, 0, 0, 0); + sub_806F370(pokemon, target, dmg, 1, auStack28, 0, DUNGEON_EXIT_DEFEATED_BLAST_SEED, RESIDUAL_DAMAGE_REGULAR, 0, 0); } else { @@ -613,7 +613,7 @@ static void BlastSeedItemAction(Entity *pokemon, Entity * target, u8 param_3) if (entityInfo->frozenClassStatus.status == STATUS_FROZEN) { EndFrozenClassStatus(pokemon, entity); } - sub_806F370(pokemon, entity, dmg, 1, auStack28, 0, 0x216, 0, 0, 0); + sub_806F370(pokemon, entity, dmg, 1, auStack28, 0, DUNGEON_EXIT_DEFEATED_BLAST_SEED, RESIDUAL_DAMAGE_REGULAR, 0, 0); } } } @@ -924,7 +924,7 @@ static void KeyItemAction(Entity *pokemon, Entity *target, u8 r2) { u8 temp; if(r2 != 0) - sub_806F370(pokemon, target, gUnknown_80F4FAC, 1, &temp, 0, 0x217, 0, 0, 0); + sub_806F370(pokemon, target, gUnknown_80F4FAC, 1, &temp, 0, DUNGEON_EXIT_FELLED_BY_THROWN_ITEM, RESIDUAL_DAMAGE_REGULAR, 0, 0); else sub_8051E7C(pokemon); } diff --git a/src/dungeon_jobs.c b/src/dungeon_jobs.c index e27b01290..baa21895e 100644 --- a/src/dungeon_jobs.c +++ b/src/dungeon_jobs.c @@ -127,7 +127,7 @@ void sub_8084448(Entity *pokemon) sub_80843BC(entInfo->id); sub_8042A34(&pokemon->pos); - HandleFaint(pokemon,0x21c,0); + HandleFaint(pokemon,DUNGEON_EXIT_DELETED_FOR_EVENT,0); sub_804178C(1); while(1) { if (DisplayDungeonYesNoMessage(0,str,1) == 1) { @@ -186,8 +186,8 @@ void sub_80845E0(Entity *pokemon) info2->joinedAt.id = gDungeon->unk644.dungeonLocation.id; sub_8042A34(&pokemon->pos); sub_8042A34(&entity->pos); - HandleFaint(pokemon,0x21c,0); - HandleFaint(entity,0x21c,0); + HandleFaint(pokemon,DUNGEON_EXIT_DELETED_FOR_EVENT,0); + HandleFaint(entity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); sub_804178C(1); while(1) { if (DisplayDungeonYesNoMessage(0,gUnknown_80FA4D8,1) == 1) { diff --git a/src/dungeon_main.c b/src/dungeon_main.c index 196b72c77..71a40a2e6 100644 --- a/src/dungeon_main.c +++ b/src/dungeon_main.c @@ -1056,7 +1056,7 @@ void sub_805F02C(void) DisplayDungeonLoggableMessageTrue(r7, gUnknown_80F9C2C); } else { - gDungeon->unk644.unk35 = 0; + gDungeon->unk644.emptyBellyAlert = 0; r8->isTeamLeader = TRUE; leaderInfo->isTeamLeader = FALSE; for (i = 0; i < 4; i++) { diff --git a/src/dungeon_menu_others.c b/src/dungeon_menu_others.c index 04a625944..1bc9ecc79 100644 --- a/src/dungeon_menu_others.c +++ b/src/dungeon_menu_others.c @@ -16,6 +16,7 @@ #include "dungeon_menu_recruitment.h" #include "dungeon_message.h" #include "dungeon_message_log.h" +#include "dungeon_misc.h" #include "dungeon_music.h" #include "dungeon_strings.h" #include "dungeon_submenu.h" @@ -441,7 +442,7 @@ static bool8 AskToGiveUp(void) return TRUE; } SetMonsterActionFields(GetLeaderActionContainer(), ACTION_GIVE_UP); - sub_8083AB0(0x21B, NULL, GetLeader()); + sub_8083AB0(DUNGEON_EXIT_GAVE_UP_EXPLORATION, NULL, GetLeader()); gDungeon->unk644.unk10 = 1; return FALSE; } diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index f50dd31dd..3c16bdead 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -466,12 +466,12 @@ static inline void ClearMonItemId(Pokemon *mon) mon->heldItem.id = ITEM_NOTHING; } -void HandleFaint(Entity *entity, s32 param_2, Entity *param_3) +void HandleFaint(Entity *entity, s32 dungeonExitReason_, Entity *param_3) { u16 joinId; Entity EStack_a4; s32 i; - s32 unkArg = (s16) param_2; + s32 dungeonExitReason = (s16) dungeonExitReason_; EntityInfo *entInfo = GetEntInfo(entity); Tile *tile = GetTileAtEntitySafe(entity); if (param_3 == NULL) { @@ -521,9 +521,9 @@ void HandleFaint(Entity *entity, s32 param_2, Entity *param_3) DisplayMessageLog(); if (gDungeon->unk6 == 0) { if (gDungeon->unk644.unk2A == 0 - && unkArg != 0x21c - && unkArg != 0x222 - && unkArg != 0x21e + && dungeonExitReason != DUNGEON_EXIT_DELETED_FOR_EVENT + && dungeonExitReason != DUNGEON_EXIT_FAILED_TO_PROTECT_CLIENT + && dungeonExitReason != DUNGEON_EXIT_BLOWN_OUT_UNSEEN_FORCE && gDungeon->unk3A0D == 0 && gDungeon->unk644.unk37 >= 0 && gDungeon->unk644.unk34 != TRUE) @@ -550,8 +550,8 @@ void HandleFaint(Entity *entity, s32 param_2, Entity *param_3) return; } - sub_8083AB0(unkArg,param_3,entity); - if (unkArg == 0x21f) { + sub_8083AB0(dungeonExitReason,param_3,entity); + if (dungeonExitReason == DUNGEON_EXIT_RETURNED_WITH_FALLEN_PARTNER) { EntityInfo *partnerInfo = NULL; for (i = 0; i < MAX_TEAM_MEMBERS; i++) { Entity *teamMon = gDungeon->teamPokemon[i]; @@ -597,8 +597,8 @@ void HandleFaint(Entity *entity, s32 param_2, Entity *param_3) SubstitutePlaceholderStringTags(gDungeon->faintStringBuffer,entity,0); } - if (GetLeader() != NULL && unkArg != 0x21c && !entInfo->isTeamLeader && !gDungeon->unk10) { - sub_8084E00(entity,entInfo->monsterBehavior, unkArg == 500); + if (GetLeader() != NULL && dungeonExitReason != DUNGEON_EXIT_DELETED_FOR_EVENT && !entInfo->isTeamLeader && !gDungeon->unk10) { + sub_8084E00(entity,entInfo->monsterBehavior, dungeonExitReason == DUNGEON_EXIT_TRANSFORMED_INTO_FRIEND); if (IS_DEOXYS_FORM_MONSTER(entInfo->apparentID) && !IsBossFight() && entInfo->isNotTeamMember) { gDungeon->deoxysDefeat = 1; DisplayDungeonLoggableMessageTrue(entity,gUnknown_80FA580); diff --git a/src/dungeon_mon_spawn.c b/src/dungeon_mon_spawn.c index 72e2df9b5..879cba879 100644 --- a/src/dungeon_mon_spawn.c +++ b/src/dungeon_mon_spawn.c @@ -786,7 +786,7 @@ static void InitEntityFromSpawnInfo(bool8 a0, Entity *entity, struct MonSpawnInf entInfo->unk165 = 0xFF; entInfo->expGainedInTurn = 0; entInfo->waiting = 0; - entInfo->unk146 = 0; + entInfo->bellyEmpty = FALSE; entInfo->unk166 = 0; entInfo->unk1F8 = 0; entInfo->mobileTurnTimer = 0; @@ -800,7 +800,7 @@ static void InitEntityFromSpawnInfo(bool8 a0, Entity *entity, struct MonSpawnInf entInfo->visualFlags = 0; entInfo->previousVisualFlags = 0; entInfo->unk152 = 0; - entInfo->unk153 = 0; + entInfo->usedLinkedMovesCounter = 0; entInfo->unk154 = 0; entInfo->unk155 = 0; entInfo->turnsSinceWarpScarfActivation = 0; diff --git a/src/dungeon_move.c b/src/dungeon_move.c index 576898bf3..fbe830230 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -46,7 +46,7 @@ #include "warp_target.h" extern void sub_80429C8(Entity *r0); -extern s16 sub_8057600(Move *move, s32 itemID); +extern s16 GetDungeonExitReasonFromMoveOrItem(Move *move, s32 itemID); extern void sub_8042238(Entity *pokemon, Entity *target); extern void sub_806A1E8(Entity *pokemon); extern void sub_804178C(u32); @@ -1353,31 +1353,31 @@ bool8 HandleRegularDamagingMove(Entity *attacker, Entity *target, Move *move, s3 s32 HandleDamagingMove(Entity *attacker, Entity *target, Move *move, s24_8 modifier, s32 itemId) { struct DamageStruct dmgStruct; - s16 unk; + s16 dungeonExitReason; s32 moveType = GetMoveTypeForMonster(attacker, move); s32 movePower = GetMovePower(attacker, move); s32 critChance = GetMoveCritChance(move); CalcDamage(attacker, target, moveType, movePower, critChance, &dmgStruct, modifier, move->id, 1); - unk = sub_8057600(move, itemId); - return TryHitTarget(attacker, target, move, &dmgStruct, unk); + dungeonExitReason = GetDungeonExitReasonFromMoveOrItem(move, itemId); + return TryHitTarget(attacker, target, move, &dmgStruct, dungeonExitReason); } s32 sub_80556BC(Entity *attacker, Entity *target, u8 moveType, Move *move, s24_8 modifier, s32 itemId) { struct DamageStruct dmgStruct; - s16 unk; + s16 dungeonExitReason; s32 movePower = GetMovePower(attacker, move); s32 critChance = GetMoveCritChance(move); CalcDamage(attacker, target, moveType, movePower, critChance, &dmgStruct, modifier, move->id, 1); - unk = sub_8057600(move, itemId); - return TryHitTarget(attacker, target, move, &dmgStruct, unk); + dungeonExitReason = GetDungeonExitReasonFromMoveOrItem(move, itemId); + return TryHitTarget(attacker, target, move, &dmgStruct, dungeonExitReason); } -static s32 TryHitTarget(Entity *attacker, Entity *target, Move *move, struct DamageStruct *dmgStruct, s16 unk_) +static s32 TryHitTarget(Entity *attacker, Entity *target, Move *move, struct DamageStruct *dmgStruct, s16 dungeonExitReason_) { - s32 unk = unk_; // It's happening again... + s32 dungeonExitReason = dungeonExitReason_; // It's happening again... if (AccuracyCalc(attacker, target, move, ACCURACY_2, TRUE)) { // Move hits bool32 isFalseSwipe = (move->id == MOVE_FALSE_SWIPE); @@ -1387,7 +1387,7 @@ static s32 TryHitTarget(Entity *attacker, Entity *target, Move *move, struct Dam gDungeon->unk17B40 = target->spawnGenID; } - HandleDealingDamage(attacker, target, dmgStruct, isFalseSwipe, TRUE, unk, TRUE, 0); + HandleDealingDamage(attacker, target, dmgStruct, isFalseSwipe, TRUE, dungeonExitReason, TRUE, 0); } else { SetMessageArgument_2(gFormatBuffer_Monsters[1], GetEntInfo(target), 0); @@ -1419,7 +1419,7 @@ s32 sub_8055864(Entity *attacker, Entity *target, Move *move, s32 param_4, s32 i s32 moveType = GetMoveTypeForMonster(attacker, move); sub_806F2BC(attacker, target, moveType, param_4, &dmgStruct); - HandleDealingDamage(attacker, target, &dmgStruct, FALSE, TRUE, sub_8057600(move, itemId), TRUE, 0); + HandleDealingDamage(attacker, target, &dmgStruct, FALSE, TRUE, GetDungeonExitReasonFromMoveOrItem(move, itemId), TRUE, 0); if (dmgStruct.tookNoDamage) { return 0; } diff --git a/src/dungeon_move_util.c b/src/dungeon_move_util.c index 2e25a49e1..6f6cb8010 100644 --- a/src/dungeon_move_util.c +++ b/src/dungeon_move_util.c @@ -394,8 +394,8 @@ bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, gUnknown_202F21A = 0; gUnknown_202F21C = 0; gUnknown_202F220 = 0; - if (isLinkedMove && GetEntInfo(attacker)->unk153 <= 3) { - GetEntInfo(attacker)->unk153++; + if (isLinkedMove && GetEntInfo(attacker)->usedLinkedMovesCounter <= 3) { + GetEntInfo(attacker)->usedLinkedMovesCounter++; } var_2C = sub_8057070(move); @@ -1398,9 +1398,9 @@ void sub_8057588(Entity * pokemon, u8 param_2) } } -s16 sub_8057600(Move *move, s32 itemID) +s16 GetDungeonExitReasonFromMoveOrItem(Move *move, s32 itemID) { - return sub_8094828(move->id, ToItemID(itemID)); + return GetDungeonExitReasonFromMoveOrItemID(move->id, ToItemID(itemID)); } static u8 ToItemID(u32 itemID) diff --git a/src/dungeon_run_end.c b/src/dungeon_run_end.c index ffa69713e..78bc343fb 100644 --- a/src/dungeon_run_end.c +++ b/src/dungeon_run_end.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_misc.h" #include "dungeon_run_end.h" #include "structs/str_dungeon.h" #include "data_serializer.h" @@ -132,14 +133,14 @@ void PrintOnDungeonFinishedWindow(u32 windowId, const u8 *headerText, UnkDungeon sub_80073E0(windowId); } -s16 sub_8094828(u16 moveID, u8 id) +s16 GetDungeonExitReasonFromMoveOrItemID(u16 moveID, u8 id) { if(id != 0) { if(GetItemCategory(id) == CATEGORY_ORBS) - return 0x223; + return DUNGEON_EXIT_FAINTED_FROM_WONDER_ORB; else - return 0x224; + return DUNGEON_EXIT_FAINTED_FROM_ITEM; } else { diff --git a/src/dungeon_serializer.c b/src/dungeon_serializer.c index 3cf6a4d80..c32ba242b 100644 --- a/src/dungeon_serializer.c +++ b/src/dungeon_serializer.c @@ -363,7 +363,7 @@ static void WriteMonster(DataSerializer *seri, Entity *src) WriteBool8(seri, info->aiAllySkip); WriteBool8(seri, info->recalculateFollow); WriteBool8(seri, info->waiting); - WriteBool8(seri, info->unk146); + WriteBool8(seri, info->bellyEmpty); WriteBool8(seri, info->attacking); WriteBool8(seri, info->unk149); WriteBool8(seri, info->unk14A); @@ -372,7 +372,7 @@ static void WriteMonster(DataSerializer *seri, Entity *src) WriteU16(seri, info->visualFlags); WriteU16(seri, info->previousVisualFlags); WriteBool8(seri, info->unk152); - WriteU8(seri, info->unk153); + WriteU8(seri, info->usedLinkedMovesCounter); WriteBool8(seri, info->unk154); WriteBool8(seri, info->unk155); WriteBool8(seri, info->unk156); @@ -1047,7 +1047,7 @@ static void ReadMonster(DataSerializer *seri, bool8 isTeamMember, s32 index) entInfo.aiAllySkip = ReadBool8(seri); entInfo.recalculateFollow = ReadBool8(seri); entInfo.waiting = ReadBool8(seri); - entInfo.unk146 = ReadBool8(seri); + entInfo.bellyEmpty = ReadBool8(seri); entInfo.attacking = ReadBool8(seri); entInfo.unk149 = ReadBool8(seri); entInfo.unk14A = ReadBool8(seri); @@ -1056,7 +1056,7 @@ static void ReadMonster(DataSerializer *seri, bool8 isTeamMember, s32 index) entInfo.visualFlags = ReadU16(seri); entInfo.previousVisualFlags = ReadU16(seri); entInfo.unk152 = ReadBool8(seri); - entInfo.unk153 = ReadU8(seri); + entInfo.usedLinkedMovesCounter = ReadU8(seri); entInfo.unk154 = ReadBool8(seri); entInfo.unk155 = ReadBool8(seri); entInfo.unk156 = ReadBool8(seri); diff --git a/src/dungeon_turn_effects.c b/src/dungeon_turn_effects.c index 489162ccc..137b402c1 100644 --- a/src/dungeon_turn_effects.c +++ b/src/dungeon_turn_effects.c @@ -33,6 +33,7 @@ #include "dungeon_strings.h" #include "dungeon_engine.h" #include "dungeon_damage.h" +#include "dungeon_misc.h" #include "dungeon_range.h" #include "dungeon_move_util.h" #include "warp_target.h" @@ -54,7 +55,7 @@ void ApplyEndOfTurnEffects(Entity *entity) return; entityInfo = GetEntInfo(entity); - entityInfo->unk146 = 0; + entityInfo->bellyEmpty = FALSE; sub_805229C(); sub_807E8F0(entity); if (HasHeldItem(entity, ITEM_WARP_SCARF)) { @@ -74,9 +75,9 @@ void ApplyEndOfTurnEffects(Entity *entity) } } + // handle belly decrease if (entityInfo->isTeamLeader) { - s48_16 sp8, sp10; - FixedPoint var_38; + s48_16 baseBellyDecrementValue, modifiedBellyDecrementValue; FixedPoint bellyBefore; bool8 sound; @@ -100,16 +101,16 @@ void ApplyEndOfTurnEffects(Entity *entity) if (arrIndex >= BELLY_GO_DOWN_VALUES_COUNT) arrIndex = BELLY_GO_DOWN_VALUES_COUNT - 1; - sp8.hi = 0; - sp8.lo = 6554; - F48_16_SMul(&sp10, &sp8, &gBellyGoDownValues[arrIndex]); - if (entityInfo->unk153 > 1) - sp10.lo += (gUnknown_80F60DC[entityInfo->unk153] << 0x10); - entityInfo->unk153 = 0; + baseBellyDecrementValue.hi = 0; + baseBellyDecrementValue.lo = 6554; + // baseBellyDecrementValue = 0.1; + F48_16_SMul(&modifiedBellyDecrementValue, &baseBellyDecrementValue, &gBellyGoDownValues[arrIndex]); + if (entityInfo->usedLinkedMovesCounter > 1) + modifiedBellyDecrementValue.lo += (gLinkedMovesBellyGoDownValues[entityInfo->usedLinkedMovesCounter] << 0x10); + entityInfo->usedLinkedMovesCounter = 0; bellyBefore = entityInfo->belly; - var_38 = FixedPoint_SetFromUnk(&sp10); - entityInfo->belly = FixedPoint_Subtract(bellyBefore, var_38); + entityInfo->belly = FixedPoint_Subtract(bellyBefore, FixedPoint_SetFromS48_16(&modifiedBellyDecrementValue)); sound = TRUE; if (FixedPointToInt(bellyBefore) > 19 && FixedPointToInt(entityInfo->belly) <= 19) str = gUnknown_80FD594; @@ -127,30 +128,36 @@ void ApplyEndOfTurnEffects(Entity *entity) DisplayActions(NULL); if (!EntityIsValid(entity) || IsFloorOver()) return; - if (gDungeon->unk644.unk35 < 10) - gDungeon->unk644.unk35++; - if (gDungeon->unk644.unk35 == 1) - str = gUnknown_80FD5DC; - if (gDungeon->unk644.unk35 == 2) - str = gUnknown_80FD608, sound = FALSE; - if (gDungeon->unk644.unk35 == 3) - str = gUnknown_80FD628, sound = FALSE; + if (gDungeon->unk644.emptyBellyAlert < 10) + gDungeon->unk644.emptyBellyAlert++; + if (gDungeon->unk644.emptyBellyAlert == EMPTY_BELLY_ALERT_YOUR_BELLYS_EMPTY) + str = gUnknown_80FD5DC; // "Oh, no! Your Belly's empty!" + if (gDungeon->unk644.emptyBellyAlert == EMPTY_BELLY_ALERT_HURRY_EAT_SOMETHING) + { + str = gUnknown_80FD608; // "Hurry! You've got to eat something!" + sound = FALSE; + } + if (gDungeon->unk644.emptyBellyAlert == EMPTY_BELLY_ALERT_YOULL_FAINT) + { + str = gUnknown_80FD628; // "You'll faint from hunger!" + sound = FALSE; + } TrySendImmobilizeSleepEndMsg(entity, entity); - DealDamageToEntity(entity, 1, 0xE, 0x211); - entityInfo->unk146 = 1; + DealDamageToEntity(entity, 1, RESIDUAL_DAMAGE_HUNGER, DUNGEON_EXIT_FAINTED_FROM_HUNGER); + entityInfo->bellyEmpty = TRUE; if (FixedPointToInt(entityInfo->belly) != 0) str = NULL; } else { - gDungeon->unk644.unk35 = 0; + gDungeon->unk644.emptyBellyAlert = 0; } if (str != NULL) { if (sound) PlaySoundEffect(0x153); LogMessageByIdWithPopupCheckUser(entity, str); - sub_803E708(0x1E, 0x32); + sub_803E708(30, 0x32); } } @@ -159,12 +166,12 @@ void ApplyEndOfTurnEffects(Entity *entity) if (gDungeon->weather.weatherDamageCounter == 0) { if (GetApparentWeather(entity) == WEATHER_HAIL) { if (!MonsterIsType(entity, TYPE_ICE)) { - DealDamageToEntity(entity, gHailSandstormDmgValue, 0x12, 0x220); + DealDamageToEntity(entity, gHailSandstormDmgValue, RESIDUAL_DAMAGE_BAD_WEATHER, DUNGEON_EXIT_FAINTED_DUE_TO_WEATHER); } } else if (GetApparentWeather(entity) == WEATHER_SANDSTORM) { if (!MonsterIsType(entity, TYPE_GROUND) && !MonsterIsType(entity, TYPE_ROCK) && !MonsterIsType(entity, TYPE_STEEL)) { - DealDamageToEntity(entity, gHailSandstormDmgValue, 0x12, 0x220); + DealDamageToEntity(entity, gHailSandstormDmgValue, RESIDUAL_DAMAGE_BAD_WEATHER, DUNGEON_EXIT_FAINTED_DUE_TO_WEATHER); } } if (!EntityIsValid(entity) || IsFloorOver()) @@ -202,7 +209,7 @@ void ApplyEndOfTurnEffects(Entity *entity) return; entityInfo->burnClassStatus.damageCountdown = gBurnDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); - DealDamageToEntity(entity, gBurnDmgValue, 1, 0x208); + DealDamageToEntity(entity, gBurnDmgValue, RESIDUAL_DAMAGE_BURN, DUNGEON_EXIT_FAINTED_FROM_BURN); } if (!EntityIsValid(entity) || IsFloorOver()) return; @@ -215,7 +222,7 @@ void ApplyEndOfTurnEffects(Entity *entity) return; entityInfo->burnClassStatus.damageCountdown = gPoisonDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); - DealDamageToEntity(entity, gPoisonDmgValue, 3, 0x20A); + DealDamageToEntity(entity, gPoisonDmgValue, RESIDUAL_DAMAGE_POISON, DUNGEON_EXIT_FAINTED_FROM_POISON); } if (!EntityIsValid(entity) || IsFloorOver()) return; @@ -234,7 +241,7 @@ void ApplyEndOfTurnEffects(Entity *entity) return; TrySendImmobilizeSleepEndMsg(entity, entity); - DealDamageToEntity(entity, gBadPoisonDmgValuesByTurn[turns], 3, 0x20A); + DealDamageToEntity(entity, gBadPoisonDmgValuesByTurn[turns], RESIDUAL_DAMAGE_POISON, DUNGEON_EXIT_FAINTED_FROM_POISON); } if (!EntityIsValid(entity) || IsFloorOver()) return; @@ -248,7 +255,7 @@ void ApplyEndOfTurnEffects(Entity *entity) entityInfo->frozenClassStatus.damageCountdown = gConstrictionDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); sub_8041C4C(entity, entityInfo->frozenClassStatus.unk4); - DealDamageToEntity(entity, gConstrictionDmgValue, 2, 0x209); + DealDamageToEntity(entity, gConstrictionDmgValue, RESIDUAL_DAMAGE_CONSTRICT, DUNGEON_EXIT_FAINTED_FROM_CONSTRICTION); } if (!EntityIsValid(entity) || IsFloorOver()) return; @@ -260,7 +267,7 @@ void ApplyEndOfTurnEffects(Entity *entity) return; entityInfo->frozenClassStatus.damageCountdown = gWrapDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); - DealDamageToEntity(entity, gWrapDmgValue, 5, 0x20B); + DealDamageToEntity(entity, gWrapDmgValue, RESIDUAL_DAMAGE_WRAP, DUNGEON_EXIT_FAINTED_FROM_WRAP); } if (!EntityIsValid(entity) || IsFloorOver()) return; @@ -286,7 +293,7 @@ void ApplyEndOfTurnEffects(Entity *entity) return; TrySendImmobilizeSleepEndMsg(entity, entity); - DealDamageToEntity(entity, dmg, 7, 0x20C); + DealDamageToEntity(entity, dmg, RESIDUAL_DAMAGE_CURSE, DUNGEON_EXIT_FELLED_BY_CURSE); } if (!EntityIsValid(entity) || IsFloorOver()) return; @@ -315,10 +322,10 @@ void ApplyEndOfTurnEffects(Entity *entity) if (entityInfo->frozenClassStatus.status != STATUS_FROZEN) { TrySendImmobilizeSleepEndMsg(entity, entity); - DealDamageToEntity(entity, hp, 9, 0x20D); + DealDamageToEntity(entity, hp, RESIDUAL_DAMAGE_LEECH_SEED, DUNGEON_EXIT_DRAINED_BY_LEECH_SEED); if (dmgUser) { TrySendImmobilizeSleepEndMsg(target, target); - DealDamageToEntity(target, hp, 0xD, 0x1FA); + DealDamageToEntity(target, hp, RESIDUAL_DAMAGE_LIQUID_OOZE, DUNGEON_EXIT_FAINTED_COVERED_IN_SLUDGE); } else { HealTargetHP(target, target, hp, 0, TRUE); @@ -344,7 +351,7 @@ void ApplyEndOfTurnEffects(Entity *entity) LogMessageByIdWithPopupCheckUser(entity, gPtrProtectSavedItMessage); } else { - DealDamageToEntity(entity, 0x270F, 0xB, 0x20E); + DealDamageToEntity(entity, 9999, RESIDUAL_DAMAGE_PERISH_SONG, DUNGEON_EXIT_FAINTED_FROM_PERISH_SONG); } if (!EntityIsValid(entity) || IsFloorOver()) return; @@ -401,7 +408,7 @@ void TickStatusAndHealthRegen(Entity *entity) entityInfo = GetEntInfo(entity); // HP heal - if (entityInfo->unk146 == 0 && entityInfo->burnClassStatus.status != STATUS_POISONED && entityInfo->burnClassStatus.status != STATUS_BADLY_POISONED) { + if (!entityInfo->bellyEmpty && entityInfo->burnClassStatus.status != STATUS_POISONED && entityInfo->burnClassStatus.status != STATUS_BADLY_POISONED) { s32 regenSpeed = 0; if (!entityInfo->isNotTeamMember) diff --git a/src/dungeon_vram.c b/src/dungeon_vram.c index e9f2dc67e..e4677629c 100644 --- a/src/dungeon_vram.c +++ b/src/dungeon_vram.c @@ -275,7 +275,7 @@ void sub_803E724(s32 r0) do { DungeonRunFrameActions(r0); - } while (gRealInputs.held & 0xF0); + } while (gRealInputs.held & DPAD_ANY); } void sub_803E748(void) diff --git a/src/dungeon_wind.c b/src/dungeon_wind.c index 439e3c4c6..cfd1780e6 100644 --- a/src/dungeon_wind.c +++ b/src/dungeon_wind.c @@ -79,7 +79,7 @@ void sub_807E378(void) LogMessageByIdWithPopupCheckUser(leader,gUnknown_80F9CBC); sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],3); gDungeon->unk644.unk36 = 4; - HandleFaint(leader,0x21e,leader); + HandleFaint(leader,DUNGEON_EXIT_BLOWN_OUT_UNSEEN_FORCE,leader); } } } diff --git a/src/explosion.c b/src/explosion.c index 927a54c99..6bef4964a 100644 --- a/src/explosion.c +++ b/src/explosion.c @@ -81,9 +81,9 @@ static const DungeonPos *const gUnknown_8107178[3] = { gUnknown_8107110 }; -static void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 param_4,s32 param_5); +static void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 dungeonExitReason,s32 param_5); -void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 param_4,u8 moveType,s16 param_6) +void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 param_4,u8 moveType,s16 dungeonExitReason_) { bool8 flag; const DungeonPos *posPtr; @@ -95,9 +95,9 @@ void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 para int index; DungeonPos pos; - u32 uStack_2c; + u32 dungeonExitReason; - uStack_2c = param_6; + dungeonExitReason = dungeonExitReason_; for (index = 0; index < DUNGEON_MAX_POKEMON; index++) { entity1 = gDungeon->activePokemon[index]; if ((EntityIsValid(entity1)) && (AbilityIsActive(entity1, ABILITY_DAMP))) break; @@ -143,7 +143,7 @@ void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 para } entity2 = tile->monster; if (((entity2 != NULL) && (entity2 != target)) && (GetEntityType(entity2) == ENTITY_MONSTER)) { - sub_807E1A0(pokemon,entity2,moveType,uStack_2c,gUnknown_203B444[param_4]); + sub_807E1A0(pokemon,entity2,moveType,dungeonExitReason,gUnknown_203B444[param_4]); if (IsFloorOver()) break; } } @@ -154,7 +154,7 @@ void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 para return; } if (GetEntityType(target) == ENTITY_MONSTER) { - sub_807E1A0(pokemon,target,moveType,uStack_2c,gUnknown_203B444[param_4]); + sub_807E1A0(pokemon,target,moveType,dungeonExitReason,gUnknown_203B444[param_4]); } if (!flag) { return; @@ -171,15 +171,15 @@ void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 para } } -static void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 param_4,s32 param_5) +static void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 dungeonExitReason_,s32 param_5) { EntityInfo *targetInfo; u8 flag; Move move; s32 newHP; - s32 param_4_s32; + s32 dungeonExitReason; - param_4_s32 = (s16) param_4; + dungeonExitReason = (s16) dungeonExitReason_; if (EntityIsValid(target)) { targetInfo = GetEntInfo(target); @@ -201,7 +201,7 @@ static void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 param_4,s newHP /= 2; } } - sub_806F370(pokemon,target,newHP,0,&flag,moveType,param_4_s32,0,0,0); + sub_806F370(pokemon,target,newHP,0,&flag,moveType,dungeonExitReason,RESIDUAL_DAMAGE_REGULAR,0,0); } } } diff --git a/src/hurl_orb.c b/src/hurl_orb.c index 0c4d424cd..a9f1d13b6 100644 --- a/src/hurl_orb.c +++ b/src/hurl_orb.c @@ -215,14 +215,14 @@ void HandleHurlOrb(Entity *target, Entity *attacker) InitPokemonMove(&move, MOVE_REGULAR_ATTACK); if (!sub_80571F0(tileEntity, &move)) { - sub_806F370(target, tileEntity, gHurlOrbDmgValue, FALSE, NULL, TYPE_NONE, 0x21A, 0, 0, 0); + sub_806F370(target, tileEntity, gHurlOrbDmgValue, FALSE, NULL, TYPE_NONE, DUNGEON_EXIT_FELLED_BY_POKEMON_FLYING, RESIDUAL_DAMAGE_REGULAR, 0, 0); } if (EntityIsValid(tileEntity)) { sub_806CE68(tileEntity, GetEntInfo(tileEntity)->action.direction); } } - sub_806F370(target, attacker, gHurlOrbDmgValue, FALSE, NULL, TYPE_NONE, 0x219, 0, 0, 0); + sub_806F370(target, attacker, gHurlOrbDmgValue, FALSE, NULL, TYPE_NONE, DUNGEON_EXIT_FAINTED_FROM_BEING_KNOCKED, RESIDUAL_DAMAGE_REGULAR, 0, 0); if (EntityIsValid(attacker)) { sub_806CE68(attacker, GetEntInfo(attacker)->action.direction); } diff --git a/src/move_orb_actions_1.c b/src/move_orb_actions_1.c index dd34d3138..45a1875a5 100644 --- a/src/move_orb_actions_1.c +++ b/src/move_orb_actions_1.c @@ -34,12 +34,12 @@ #include "dungeon_damage.h" #include "move_util.h" -bool8 IronTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 IronTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon, target, gIronTailSecondaryChance)) { LowerDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 1, 1, FALSE); @@ -50,52 +50,52 @@ bool8 IronTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ static const s24_8 sRolloutModifiers[]; -bool8 sub_805768C(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_805768C(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; gUnknown_202F21C++; - if (HandleDamagingMove(pokemon, target, move, sRolloutModifiers[gUnknown_202F21C], param_4) == 0) + if (HandleDamagingMove(pokemon, target, move, sRolloutModifiers[gUnknown_202F21C], itemId) == 0) gUnknown_202F220 = 1; else flag = TRUE; return flag; } -bool8 YawnMoveAction(Entity * pokemon, Entity *target, Move *move, s32 param_4) +bool8 YawnMoveAction(Entity * pokemon, Entity *target, Move *move, s32 itemId) { YawnedStatusTarget(pokemon, target, CalculateStatusTurns(target,gYawnTurnRange,TRUE) + 1); return TRUE; } // NOTE: Is there a better name for this? -bool8 BasicSleepMoveAction(Entity * pokemon, Entity *target, Move *move, s32 param_4) +bool8 BasicSleepMoveAction(Entity * pokemon, Entity *target, Move *move, s32 itemId) { SleepStatusTarget(pokemon, target, CalculateStatusTurns(target, gSleepTurnRange, TRUE), TRUE); return TRUE; } -bool8 NightmareMoveAction(Entity * pokemon, Entity *target, Move *move, s32 param_4) +bool8 NightmareMoveAction(Entity * pokemon, Entity *target, Move *move, s32 itemId) { NightmareStatusTarget(pokemon, target, CalculateStatusTurns(target,gNightmareTurnRange,TRUE)); return TRUE; } -bool8 MorningSunMoveAction(Entity * pokemon,Entity * target, Move *move, s32 param_4) +bool8 MorningSunMoveAction(Entity * pokemon,Entity * target, Move *move, s32 itemId) { HealTargetHP(pokemon, target, gMorningSunHealValueByWeather[GetApparentWeather(pokemon)], 0, TRUE); return TRUE; } -bool8 VitalThrowMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 VitalThrowMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { VitalThrowStatusTarget(pokemon, target); return TRUE; } -bool8 DigMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 DigMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { Tile *tile; bool8 flag; @@ -107,7 +107,7 @@ bool8 DigMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) } else { if (MoveMatchesBideClassStatus(pokemon,move)) { - HandleDamagingMove(pokemon,target,move,gDigModifier,param_4); + HandleDamagingMove(pokemon,target,move,gDigModifier,itemId); sub_8079764(pokemon); } else { @@ -118,19 +118,19 @@ bool8 DigMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) return flag; } -bool8 SweetScentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SweetScentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { LowerAccuracyStageTarget(pokemon,target,gStatIndexSpecial,TRUE); return TRUE; } -bool8 CharmMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 CharmMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { ChangeAttackMultiplierTarget(pokemon,target,gStatIndexAtkDef,FloatToF248(0.5),TRUE); return TRUE; } -bool8 RainDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 RainDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { gDungeon->weather.unkE267[WEATHER_RAIN] = gMoveWeatherDuration; if (sub_807EAA0(1,0) == 0) { @@ -140,7 +140,7 @@ bool8 RainDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param return TRUE; } -bool8 HailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 HailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { gDungeon->weather.unkE267[WEATHER_HAIL] = gMoveWeatherDuration; if (sub_807EAA0(1,0) == 0) { @@ -150,18 +150,18 @@ bool8 HailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return TRUE; } -bool8 sub_80578EC(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_80578EC(Entity *pokemon, Entity *target, Move *move, s32 itemId) { sub_8079F20(pokemon, target, 1, 0); return TRUE; } -bool8 BubbleMoveAction(Entity *pokemon, Entity *target, Move * move, s32 param_4) +bool8 BubbleMoveAction(Entity *pokemon, Entity *target, Move * move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target, gBubbleSecondaryChance)) { LowerMovementSpeedTarget(pokemon, target, 1, FALSE); @@ -170,20 +170,20 @@ bool8 BubbleMoveAction(Entity *pokemon, Entity *target, Move * move, s32 param_4 return flag; } -bool8 EncoreMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 EncoreMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { EncoreStatusTarget(pokemon, target); return TRUE; } -bool8 RageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 RageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { // {POKEMON_0} is enraged SetChargeStatusTarget(pokemon,target,STATUS_ENRAGED,move,gUnknown_80FAC88); return TRUE; } -bool8 SuperFangMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SuperFangMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { s32 newHP; bool8 local_24; @@ -191,7 +191,7 @@ bool8 SuperFangMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param newHP = GetEntInfo(target)->HP / 2; local_24 = FALSE; if (newHP != 0) { - sub_806F370(pokemon,target,newHP,1,&local_24,GetMoveType(move),sub_8057600(move,param_4),0,1,0); + sub_806F370(pokemon,target,newHP,1,&local_24,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,1,0); local_24 = local_24 == 0; } else @@ -202,7 +202,7 @@ bool8 SuperFangMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param return local_24; } -bool8 PainSplitMoveAction(Entity *attacker, Entity *target, Move *move, s32 param_4) +bool8 PainSplitMoveAction(Entity *attacker, Entity *target, Move *move, s32 itemId) { EntityInfo *attackerInfo = GetEntInfo(attacker); EntityInfo *targetInfo = GetEntInfo(target); @@ -225,7 +225,7 @@ bool8 PainSplitMoveAction(Entity *attacker, Entity *target, Move *move, s32 para return TRUE; } -bool8 TormentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 TormentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { Move *movePtr; s32 iVar4; @@ -282,26 +282,26 @@ bool8 TormentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 return isTormented; } -bool8 StringShotMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 StringShotMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { LowerMovementSpeedTarget(pokemon, target, 1, TRUE); return TRUE; } -bool8 SwaggerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SwaggerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { ConfuseStatusTarget(pokemon, target, TRUE); RaiseAttackStageTarget(pokemon, target, gStatIndexAtkDef, 2); return TRUE; } -bool8 SnoreMoveAction(Entity *pokemon, Entity *target, Move * move, s32 param_4) +bool8 SnoreMoveAction(Entity *pokemon, Entity *target, Move * move, s32 itemId) { bool8 flag; flag = FALSE; if (IsSleeping(pokemon)) { - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gSnoreSecondaryChance)) { CringeStatusTarget(pokemon,target,FALSE); @@ -314,18 +314,18 @@ bool8 SnoreMoveAction(Entity *pokemon, Entity *target, Move * move, s32 param_4) return flag; } -bool8 ScreechMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ScreechMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { ChangeDefenseMultiplierTarget(pokemon, target, gStatIndexAtkDef, FloatToF248(0.25), 1); return TRUE; } -bool8 RockSlideMoveAction(Entity *pokemon, Entity *target, Move * move, s32 param_4) +bool8 RockSlideMoveAction(Entity *pokemon, Entity *target, Move * move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gRockSlideSecondaryChance)) { CringeStatusTarget(pokemon,target,FALSE); @@ -334,21 +334,21 @@ bool8 RockSlideMoveAction(Entity *pokemon, Entity *target, Move * move, s32 para return flag; } -bool32 WeatherBallMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool32 WeatherBallMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { u32 weather; s32 flag; weather = GetApparentWeather(pokemon); flag = sub_80556BC(pokemon,target,gWeatherBallTypes[weather],move, - gWeatherBallModifiers[weather],param_4); + gWeatherBallModifiers[weather],itemId); if (flag) { flag = TRUE; } return flag; } -bool8 WhirlpoolMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 WhirlpoolMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { s24_8 modifier; bool8 flag; @@ -360,7 +360,7 @@ bool8 WhirlpoolMoveAction(Entity * pokemon, Entity * target, Move * move, s32 pa if (chargeStatus == STATUS_DIVING) { modifier = IntToF248_2(2); } - if (HandleDamagingMove(pokemon,target,move,modifier,param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,modifier,itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gMovesConstrictionChance)) { SqueezedStatusTarget(pokemon,target,0x3b,FALSE); @@ -369,13 +369,13 @@ bool8 WhirlpoolMoveAction(Entity * pokemon, Entity * target, Move * move, s32 pa return flag; } -bool8 FakeTearsMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 FakeTearsMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { LowerDefenseStageTarget(pokemon, target, gStatIndexSpecial, 2, 1, TRUE); return TRUE; } -bool8 SpiteMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 SpiteMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { s32 i; EntityInfo *targetInfo = GetEntInfo(target); @@ -400,26 +400,26 @@ bool8 SpiteMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4 return flag; } -bool8 FocusEnergyMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 FocusEnergyMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { FocusEnergyStatusTarget(pokemon, target); return TRUE; } -bool8 SmokescreenMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SmokescreenMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { WhifferStatusTarget(pokemon, target, CalculateStatusTurns(target, gWhifferTurnRange, TRUE)); return TRUE; } -bool8 MirrorMoveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 MirrorMoveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { SendThawedMessage(pokemon, target); MirrorMoveStatusTarget(pokemon, target); return TRUE; } -bool8 OverheatMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 OverheatMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { EntityInfo *entityInfo; bool8 flag; @@ -427,7 +427,7 @@ bool8 OverheatMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ flag = FALSE; entityInfo = GetEntInfo(pokemon); SendThawedMessage(pokemon,target); - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if (RollSecondaryEffect(pokemon, 0)) { entityInfo->unk155 = 1; @@ -436,12 +436,12 @@ bool8 OverheatMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ return flag; } -bool8 AuroraBeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 AuroraBeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gAuroraBeamAtkLowerChance)) { @@ -451,7 +451,7 @@ bool8 AuroraBeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para return flag; } -bool8 MementoMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 MementoMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { EntityInfo *entityInfo; @@ -463,12 +463,12 @@ bool8 MementoMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 return TRUE; } -bool8 OctazookaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 OctazookaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gOctazookaAccLowerChance)) { @@ -478,14 +478,14 @@ bool8 OctazookaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param return flag; } -bool8 FlatterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 FlatterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { ConfuseStatusTarget(pokemon, target, TRUE); RaiseAttackStageTarget(pokemon, target, gStatIndexSpecial, 1); return TRUE; } -bool8 WillOWispMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 WillOWispMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { u8 flashFireStatus; @@ -508,7 +508,7 @@ bool8 WillOWispMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param return TRUE; } -bool8 ReturnMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 ReturnMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId) { s32 i; bool8 local_24; @@ -522,12 +522,12 @@ bool8 ReturnMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) } } - sub_806F370(pokemon,target,dmg,1,&local_24,GetMoveType(move),sub_8057600(move,param_4),0,1,0); + sub_806F370(pokemon,target,dmg,1,&local_24,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,1,0); local_24 = (local_24 == 0); return local_24; } -bool8 GrudgeMoveAction(Entity *pokemon, Entity * target, Move *move, s32 param_4) +bool8 GrudgeMoveAction(Entity *pokemon, Entity * target, Move *move, s32 itemId) { EntityInfo *entityInfo; bool8 hasGrudge; @@ -546,19 +546,19 @@ bool8 GrudgeMoveAction(Entity *pokemon, Entity * target, Move *move, s32 param_4 return hasGrudge; } -bool8 CounterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 CounterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { CounterStatusTarget(pokemon, target, STATUS_COUNTER); return TRUE; } -bool8 FlameWheelMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 FlameWheelMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; SendThawedMessage(pokemon, target); - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gFlameWheelSecondaryChance)) { @@ -569,13 +569,13 @@ bool8 FlameWheelMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para } // NOTE: Do we have a better name for this?? -bool8 BasicFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 BasicFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; SendThawedMessage(pokemon, target); - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gFireMoveBurnSecondaryChance)) { @@ -585,7 +585,7 @@ bool8 BasicFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param return flag; } -bool8 ExposeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ExposeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { u16 uVar1; uVar1 = (move->id == MOVE_FORESIGHT) ? 0x7A : 0x51; @@ -593,13 +593,13 @@ bool8 ExposeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return TRUE; } -bool8 DoubleTeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 DoubleTeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { RaiseAccuracyStageTarget(pokemon, target, gStatIndexSpecial); return TRUE; } -bool8 GustMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 GustMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; s32 modifierInt; @@ -609,36 +609,36 @@ bool8 GustMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) targetInfo = GetEntInfo(target); if(targetInfo->bideClassStatus.status == STATUS_FLYING || targetInfo->bideClassStatus.status == STATUS_BOUNCING) modifierInt = 2; - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),itemId) ? TRUE : FALSE; return flag; } // NOTE: Is there a better name for this? -bool8 BasicRaiseDefenseMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 BasicRaiseDefenseMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { RaiseDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 1); return TRUE; } -bool8 DisableMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 DisableMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { ParalyzeStatusTarget(pokemon, target, TRUE); return TRUE; } // NOTE: Is there a better name for this? -bool8 BasicRaiseAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 BasicRaiseAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { RaiseAttackStageTarget(pokemon, target, gStatIndexAtkDef, 1); return TRUE; } -bool8 RazorWindMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 RazorWindMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { bool8 flag; if (MoveMatchesBideClassStatus(pokemon,move)) { - flag = HandleDamagingMove(pokemon,target,move,gRazorWindModifier,param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,gRazorWindModifier,itemId) ? TRUE : FALSE; sub_8079764(pokemon); } else { @@ -648,13 +648,13 @@ bool8 RazorWindMoveAction(Entity * pokemon, Entity * target, Move * move, s32 pa return flag; } -bool8 BideMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 BideMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { SetChargeStatusTarget(pokemon, target, STATUS_BIDE, move, gUnknown_80FAC74); return TRUE; } -bool8 Bide2MoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 Bide2MoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { s32 iVar2; bool8 local_18; @@ -664,18 +664,18 @@ bool8 Bide2MoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) if (999 < iVar2) { iVar2 = 999; } - sub_806F370(pokemon,target,iVar2,1,&local_18, GetMoveType(move),0x1ff,0,1,0); + sub_806F370(pokemon,target,iVar2,1,&local_18, GetMoveType(move),DUNGEON_EXIT_DEFEATED_PENT_UP_ENERGY,RESIDUAL_DAMAGE_REGULAR,1,0); local_18 = local_18 == 0; return local_18; } -bool8 ShadowBallMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ShadowBallMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gShadowBallSecondaryChance)) { @@ -685,12 +685,12 @@ bool8 ShadowBallMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para return flag; } -bool8 BiteMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 BiteMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gBiteSecondaryChance)) { @@ -700,12 +700,12 @@ bool8 BiteMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return flag; } -bool8 ThunderMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ThunderMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gThunderSecondaryChance)) { @@ -715,7 +715,7 @@ bool8 ThunderMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 return flag; } -bool8 EndeavorMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 EndeavorMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { s32 diffHP; bool8 local_24; @@ -730,13 +730,13 @@ bool8 EndeavorMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ if (diffHP < 0) { diffHP = 0; } - sub_806F370(pokemon,target,diffHP,0,&local_24,GetMoveType(move),sub_8057600(move,param_4),0,1,0); + sub_806F370(pokemon,target,diffHP,0,&local_24,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,1,0); local_24 = local_24 == 0; return local_24; } -bool8 FacadeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 FacadeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; s24_8 modifier; @@ -744,16 +744,16 @@ bool8 FacadeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) modifier = IntToF248_2(1); if((GetEntInfo(pokemon)->burnClassStatus.status) != STATUS_NONE) modifier = gFacadeModifier; - flag = HandleDamagingMove(pokemon,target,move,modifier,param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,modifier,itemId) ? TRUE : FALSE; return flag; } -bool8 sub_8058580(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_8058580(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gConstrictBubblebeamSecondaryChance)) { @@ -763,7 +763,7 @@ bool8 sub_8058580(Entity *pokemon, Entity *target, Move *move, s32 param_4) return flag; } -bool8 BrickBreakMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 BrickBreakMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; @@ -774,16 +774,16 @@ bool8 BrickBreakMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para flag = TRUE; } - flag |= (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0); + flag |= (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0); return flag; } -bool8 RockTombMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 RockTombMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -793,12 +793,12 @@ bool8 RockTombMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ return flag; } -bool8 FocusPunchMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 FocusPunchMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { bool8 flag; if (MoveMatchesBideClassStatus(pokemon,move)) { - flag = HandleDamagingMove(pokemon,target,move,gFocusPunchModifier,param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,gFocusPunchModifier,itemId) ? TRUE : FALSE; sub_8079764(pokemon); } else { @@ -808,7 +808,7 @@ bool8 FocusPunchMoveAction(Entity * pokemon, Entity * target, Move * move, s32 p return flag; } -bool8 GigaDrainMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 GigaDrainMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { bool8 hasLiquidOoze; s32 uVar3; @@ -817,7 +817,7 @@ bool8 GigaDrainMoveAction(Entity * pokemon, Entity * target, Move * move, s32 pa EntityInfo *entityInfo; hasLiquidOoze = AbilityIsActive(target, ABILITY_LIQUID_OOZE); - uVar3 = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4); + uVar3 = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId); flag = uVar3 != 0 ? TRUE : FALSE; if (flag && RollSecondaryEffect(pokemon, 0)) { newHP = uVar3 / 2; @@ -828,7 +828,7 @@ bool8 GigaDrainMoveAction(Entity * pokemon, Entity * target, Move * move, s32 pa } SetExpMultplier(entityInfo); if (hasLiquidOoze) { - DealDamageToEntity(pokemon, newHP, 0xd, 0x1fa); + DealDamageToEntity(pokemon, newHP, RESIDUAL_DAMAGE_LIQUID_OOZE, DUNGEON_EXIT_FAINTED_COVERED_IN_SLUDGE); } else { HealTargetHP(pokemon, pokemon, newHP, 0, TRUE); @@ -837,7 +837,7 @@ bool8 GigaDrainMoveAction(Entity * pokemon, Entity * target, Move * move, s32 pa return flag; } -bool8 ReversalMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 ReversalMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { s32 index; bool8 flag; @@ -856,31 +856,31 @@ bool8 ReversalMoveAction(Entity * pokemon, Entity * target, Move * move, s32 par index = 3; } - flag = HandleDamagingMove(pokemon,target,move,gReversalModifiers[index],param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,gReversalModifiers[index],itemId) ? TRUE : FALSE; return flag; } -bool8 SmellingSaltMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 SmellingSaltMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { bool8 flag; if (GetEntInfo(target)->burnClassStatus.status == STATUS_PARALYSIS) { - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),itemId) ? TRUE : FALSE; EndBurnClassStatus(pokemon, target); } else { - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) ? TRUE : FALSE; } return flag; } -bool8 MetalSoundMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 MetalSoundMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { LowerDefenseStageTarget(pokemon, target, gStatIndexSpecial, 3, 1, TRUE); return TRUE; } -bool8 TickleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 TickleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { s32 index = gStatIndexAtkDef; LowerAttackStageTarget(pokemon, target, index, 1, 1, TRUE); @@ -888,22 +888,22 @@ bool8 TickleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return TRUE; } -bool8 sub_805889C(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_805889C(Entity *pokemon, Entity *target, Move *move, s32 itemId) { ImmobilizedStatusTarget(pokemon, target); return TRUE; } -bool8 HazeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 HazeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { sub_8079E34(pokemon, target, TRUE); return TRUE; } -bool8 OutrageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 OutrageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, 0)) @@ -914,24 +914,24 @@ bool8 OutrageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 return flag; } -bool8 LowKickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 LowKickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { s24_8 weight; bool8 flag; EntityInfo *entityInfo = GetEntInfo(target); weight.raw = GetWeight(entityInfo->apparentID); - flag = HandleDamagingMove(pokemon, target, move, weight, param_4) != 0 ? TRUE: FALSE; + flag = HandleDamagingMove(pokemon, target, move, weight, itemId) != 0 ? TRUE: FALSE; return flag; } -bool8 AncientPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 AncientPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag = FALSE; EntityInfo *entityInfo; s32 index1; s32 index2; - if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, gAncientPowerSecondaryChance)) @@ -950,22 +950,22 @@ bool8 AncientPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 pa return flag; } -bool8 SynthesisMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SynthesisMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { HealTargetHP(pokemon, target, gSynthesisHealValueByWeather[GetApparentWeather(pokemon)], 0, TRUE); return TRUE; } -bool8 AgilityMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 AgilityMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { RaiseMovementSpeedTarget(pokemon, target, 0, TRUE); return TRUE; } -bool8 RapidSpinMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 RapidSpinMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, 0)) @@ -976,13 +976,13 @@ bool8 RapidSpinMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param return flag; } -bool8 SureShotMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SureShotMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { SureShotStatusTarget(pokemon, target, CalculateStatusTurns(target, gSureShotTurnRange, FALSE)); return TRUE; } -bool8 CosmicPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 CosmicPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { RaiseDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 1); RaiseDefenseStageTarget(pokemon, target, gStatIndexSpecial, 1); diff --git a/src/move_orb_actions_2.c b/src/move_orb_actions_2.c index 83fa74473..ae24c717c 100644 --- a/src/move_orb_actions_2.c +++ b/src/move_orb_actions_2.c @@ -39,13 +39,13 @@ extern void nullsub_92(Entity *); -bool8 SkyAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SkyAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag = FALSE; if(MoveMatchesBideClassStatus(pokemon, move)) { - if (HandleDamagingMove(pokemon, target, move, gSkyAttackModifier, param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, gSkyAttackModifier, itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gSkyAttackSecondaryChance)) CringeStatusTarget(pokemon, target, FALSE); @@ -60,12 +60,12 @@ bool8 SkyAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param } // NOTE: Is there a better name for this? -bool8 BasicIceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 BasicIceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gIceMoveFreezeSecondaryChance)) { @@ -75,13 +75,13 @@ bool8 BasicIceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ return flag; } -bool8 MeteorMashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 MeteorMashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; EntityInfo *entityInfo; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, pokemon, gMeteorMashSecondaryChance)) { @@ -93,24 +93,24 @@ bool8 MeteorMashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para return flag; } -bool8 EndureMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 EndureMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { EndureStatusTarget(pokemon, pokemon); return TRUE; } -bool8 ScaryFaceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ScaryFaceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { LowerMovementSpeedTarget(pokemon, target, 1, TRUE); return TRUE; } -bool8 sub_8058C00(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_8058C00(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gMovesConfusionSecondaryChance)) { @@ -120,7 +120,7 @@ bool8 sub_8058C00(Entity *pokemon, Entity *target, Move *move, s32 param_4) return flag; } -bool8 PsywaveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 PsywaveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { s32 rand; bool8 flag; @@ -133,11 +133,11 @@ bool8 PsywaveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 if (199 < rand) { rand = 199; } - flag = sub_8055864(pokemon,target,move,rand,param_4) != 0 ? TRUE: FALSE; + flag = sub_8055864(pokemon,target,move,rand,itemId) != 0 ? TRUE: FALSE; return flag; } -bool8 sub_8058C98(Entity *pokemon, Entity *target, Move *move, s32 param_4, u32 param_5) +bool8 sub_8058C98(Entity *pokemon, Entity *target, Move *move, s32 itemId, u32 param_5) { bool8 flag; @@ -146,16 +146,16 @@ bool8 sub_8058C98(Entity *pokemon, Entity *target, Move *move, s32 param_4, u32 flag = TRUE; if(sub_805727C(pokemon, target, gPsychicSecondaryChance)) { - LowerDefenseStageTarget(pokemon, target, param_4, 1, 1, FALSE); + LowerDefenseStageTarget(pokemon, target, itemId, 1, 1, FALSE); } } return flag; } -bool8 PsychoBoostMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 PsychoBoostMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, 0)) @@ -166,13 +166,13 @@ bool8 PsychoBoostMoveAction(Entity *pokemon, Entity *target, Move *move, s32 par return flag; } -bool8 UproarMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 UproarMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { SleeplessStatusTarget(pokemon, target); return TRUE; } -bool8 WaterSpoutMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 WaterSpoutMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { s32 index; bool8 flag; @@ -191,11 +191,11 @@ bool8 WaterSpoutMoveAction(Entity * pokemon, Entity * target, Move * move, s32 p index = 3; } - flag = HandleDamagingMove(pokemon,target,move,gWaterSpoutModifiers[index],param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,gWaterSpoutModifiers[index],itemId) ? TRUE : FALSE; return flag; } -bool8 PsychUpMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 PsychUpMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { s32 index; EntityInfo *iVar3; @@ -219,14 +219,14 @@ bool8 PsychUpMoveAction(Entity * pokemon, Entity * target, Move * move, s32 para return TRUE; } -bool8 sub_8058E5C(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_8058E5C(Entity *pokemon, Entity *target, Move *move, s32 itemId) { int iVar2; int iVar3; bool8 flag; flag = FALSE; - if ((HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) && (EntityIsValid(pokemon))) { + if ((HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) && (EntityIsValid(pokemon))) { iVar2 = GetEntInfo(pokemon)->maxHPStat; if (iVar2 < 0) { iVar2 = iVar2 + 7; @@ -237,19 +237,19 @@ bool8 sub_8058E5C(Entity *pokemon, Entity *target, Move *move, s32 param_4) } flag = TRUE; if ((!AbilityIsActive(pokemon, ABILITY_ROCK_HEAD)) && RollSecondaryEffect(pokemon, 0)) { - sub_806F370(pokemon,pokemon,iVar3,0,0,0,0x1fd,0x14,1,0); + sub_806F370(pokemon,pokemon,iVar3,0,0,0,DUNGEON_EXIT_FAINTED_FROM_RECOIL,RESIDUAL_DAMAGE_RECOIL,1,0); } } return flag; } -bool8 sub_8058EE0(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_8058EE0(Entity *pokemon, Entity *target, Move *move, s32 itemId) { HealTargetHP(pokemon, target, GetEntInfo(target)->maxHPStat / 2, 0, TRUE); return TRUE; } -bool32 EarthquakeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool32 EarthquakeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool32 flag; EntityInfo *entityInfo; @@ -262,14 +262,14 @@ bool32 EarthquakeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 par if (entityInfo->bideClassStatus.status == STATUS_DIGGING) { modifierInt = 2; } - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),param_4); + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),itemId); if (flag != 0) { flag = TRUE; } return flag; } -bool8 NaturePowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 NaturePowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; s32 tileset; @@ -283,16 +283,16 @@ bool8 NaturePowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 par tileset = 0x4a; } InitPokemonMove(&natureMove, gNaturePowerCalledMoves[tileset].moveID); - flag = gNaturePowerCalledMoves[tileset].callback(pokemon,target,&natureMove,param_4); + flag = gNaturePowerCalledMoves[tileset].callback(pokemon,target,&natureMove,itemId); return flag; } -bool8 LickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 LickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gLickSecondaryChance)) { @@ -302,30 +302,30 @@ bool8 LickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return flag; } -bool8 SelfDestructMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SelfDestructMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { - HandleExplosion(pokemon, target, &target->pos, 1, GetMoveType(move), sub_8057600(move, param_4)); + HandleExplosion(pokemon, target, &target->pos, 1, GetMoveType(move), GetDungeonExitReasonFromMoveOrItem(move, itemId)); return TRUE; } -bool8 StunSporeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 StunSporeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { ParalyzeStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 ChargeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ChargeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { SetChargeStatusTarget(pokemon, target, STATUS_CHARGING, move, gUnknown_80FAD6C); return TRUE; } -bool8 ThunderboltMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ThunderboltMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gThunderboltSecondaryChance)) { @@ -335,13 +335,13 @@ bool8 ThunderboltMoveAction(Entity *pokemon, Entity *target, Move *move, s32 par return flag; } -bool8 MistMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 MistMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { MistStatusTarget(pokemon, target); return TRUE; } -bool8 FissureMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 FissureMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { u8 moveType; bool8 uVar5; @@ -359,18 +359,18 @@ bool8 FissureMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FEB88); } else { - sub_806F370(pokemon,target,9999,1,&flag,GetMoveType(move),sub_8057600(move,param_4),0,1,1); + sub_806F370(pokemon,target,9999,1,&flag,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,1,1); flag = flag == 0; } return flag; } -bool8 ExtrasensoryMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ExtrasensoryMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gExtrasensorySecondaryChance)) { @@ -380,13 +380,13 @@ bool8 ExtrasensoryMoveAction(Entity *pokemon, Entity *target, Move *move, s32 pa return flag; } -bool8 SafeguardMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SafeguardMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { SafeguardStatusTarget(pokemon, target); return TRUE; } -bool8 AbsorbMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 AbsorbMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 hasLiquidOoze; s32 iVar3; @@ -395,7 +395,7 @@ bool8 AbsorbMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) flag = FALSE; hasLiquidOoze = AbilityIsActive(target, ABILITY_LIQUID_OOZE); - iVar3 = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4); + iVar3 = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId); if (iVar3 != 0) { iVar4 = iVar3 / 2; if (iVar4 < 1) { @@ -407,7 +407,7 @@ bool8 AbsorbMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) SetExpMultplier(entityInfo); if (RollSecondaryEffect(pokemon,0)) { if (hasLiquidOoze) { - DealDamageToEntity(pokemon,iVar4,0xd,0x1fa); + DealDamageToEntity(pokemon,iVar4,RESIDUAL_DAMAGE_LIQUID_OOZE,DUNGEON_EXIT_FAINTED_COVERED_IN_SLUDGE); } else { HealTargetHP(pokemon,pokemon,iVar4,0,1); @@ -418,7 +418,7 @@ bool8 AbsorbMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return flag; } -bool8 SkillSwapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SkillSwapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool32 flag; @@ -449,7 +449,7 @@ bool8 SkillSwapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param return flag; } -bool8 SketchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SketchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { s32 i; bool8 ret = FALSE; @@ -488,12 +488,12 @@ bool8 SketchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return ret; } -bool8 HeadbuttMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 HeadbuttMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gHeadbuttSecondaryChance)) { @@ -503,13 +503,13 @@ bool8 HeadbuttMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ return flag; } -bool8 DoubleEdgeMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 DoubleEdgeMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId) { s32 HP; bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if ((!AbilityIsActive(pokemon, ABILITY_ROCK_HEAD)) && (RollSecondaryEffect(pokemon,0) != 0)) { HP = GetEntInfo(pokemon)->maxHPStat; @@ -520,13 +520,13 @@ bool8 DoubleEdgeMoveAction(Entity * pokemon,Entity * target,Move * move,s32 para if (HP == 0) { HP = 1; } - sub_806F370(pokemon,pokemon,HP,0,0,0,0x1fd,0x14,1,0); + sub_806F370(pokemon,pokemon,HP,0,0,0,DUNGEON_EXIT_FAINTED_FROM_RECOIL,RESIDUAL_DAMAGE_RECOIL,1,0); } } return flag; } -bool8 SandstormMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SandstormMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { gDungeon->weather.unkE267[WEATHER_SANDSTORM] = gMoveWeatherDuration; if(sub_807EAA0(1, 0) == 0) @@ -536,18 +536,18 @@ bool8 SandstormMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param return TRUE; } -bool8 sub_8059528(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_8059528(Entity *pokemon, Entity *target, Move *move, s32 itemId) { LowerAccuracyStageTarget(pokemon, target, gStatIndexAtkDef, TRUE); return TRUE; } -bool8 SmogMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SmogMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gSmogSecondaryChance)) { @@ -557,18 +557,18 @@ bool8 SmogMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return flag; } -bool8 GrowthMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 GrowthMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { RaiseAttackStageTarget(pokemon, target, gStatIndexSpecial, 1); return TRUE; } -bool8 SacredFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SacredFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gSacredFireSecondaryChance)) { @@ -578,7 +578,7 @@ bool8 SacredFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para return flag; } -bool8 sub_80595EC(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 sub_80595EC(Entity * pokemon,Entity * target,Move * move,s32 itemId) { u8 moveType; u8 local_20; @@ -590,13 +590,13 @@ bool8 sub_80595EC(Entity * pokemon,Entity * target,Move * move,s32 param_4) } else { moveType = GetMoveType(move); - sub_806F370(pokemon,target,9999,1,&local_20,moveType,sub_8057600(move,param_4),0,1,0); + sub_806F370(pokemon,target,9999,1,&local_20,moveType,GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,1,0); local_20 = (local_20 == 0); return local_20; } } -bool8 SolarBeamMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 SolarBeamMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId) { u8 weather; // weather and flag are reused in same variable s24_8 modifier; @@ -608,7 +608,7 @@ bool8 SolarBeamMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param if (((weather == WEATHER_SANDSTORM) || (weather == WEATHER_RAIN)) || weather == WEATHER_HAIL) { modifier.raw /= 2; } - weather = HandleDamagingMove(pokemon,target,move,modifier,param_4) != 0 ? TRUE : FALSE; + weather = HandleDamagingMove(pokemon,target,move,modifier,itemId) != 0 ? TRUE : FALSE; sub_8079764(pokemon); } else { @@ -618,23 +618,23 @@ bool8 SolarBeamMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param return weather; } -bool8 SonicboomMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 SonicboomMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId) { u8 local_20; local_20 = 0; - sub_806F370(pokemon,target,gSonicboomDmgValue,1,&local_20,GetMoveType(move),sub_8057600(move,param_4),0,1,0); + sub_806F370(pokemon,target,gSonicboomDmgValue,1,&local_20,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,1,0); local_20 = local_20 == 0; return local_20; } -bool8 FlyMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 FlyMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { bool8 flag; flag = FALSE; if (MoveMatchesBideClassStatus(pokemon,move)) { - flag = HandleDamagingMove(pokemon,target,move,gFlyModifier,param_4) != 0 ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,gFlyModifier,itemId) != 0 ? TRUE : FALSE; sub_8079764(pokemon); } else { @@ -644,13 +644,13 @@ bool8 FlyMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) return flag; } -bool8 ExplosionMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 ExplosionMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId) { - HandleExplosion(pokemon,target,&target->pos,2,GetMoveType(move),sub_8057600(move,param_4)); + HandleExplosion(pokemon,target,&target->pos,2,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId)); return TRUE; } -bool8 DiveMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 DiveMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { bool8 flag; @@ -659,7 +659,7 @@ bool8 DiveMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4 TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FD128); } else if (MoveMatchesBideClassStatus(pokemon,move)) { - flag = HandleDamagingMove(pokemon,target,move,gDiveModifier,param_4) != 0 ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,gDiveModifier,itemId) != 0 ? TRUE : FALSE; sub_8079764(pokemon); } else { @@ -669,12 +669,12 @@ bool8 DiveMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4 return flag; } -bool8 MuddyWaterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 MuddyWaterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gMuddyWaterAccLowerChance)) { @@ -684,13 +684,13 @@ bool8 MuddyWaterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para return flag; } -bool8 StockpileMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 StockpileMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { HandleStockpile(pokemon, target); return TRUE; } -bool8 TwisterMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 TwisterMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId) { s32 modifierInt = 1; bool8 flag = FALSE; @@ -699,7 +699,7 @@ bool8 TwisterMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4 if (entInfo->bideClassStatus.status == STATUS_FLYING || entInfo->bideClassStatus.status == STATUS_BOUNCING) { modifierInt = 2; } - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),param_4) != 0) + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon,target,gTwisterSecondaryChance) != 0) { @@ -709,12 +709,12 @@ bool8 TwisterMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4 return flag; } -bool8 TwineedleMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 TwineedleMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; gUnknown_202F218 = 1; } @@ -725,7 +725,7 @@ bool8 TwineedleMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param return flag; } -bool8 sub_80599EC(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_80599EC(Entity *pokemon, Entity *target, Move *move, s32 itemId) { s32 HP; @@ -736,43 +736,43 @@ bool8 sub_80599EC(Entity *pokemon, Entity *target, Move *move, s32 param_4) return TRUE; } -bool8 MinimizeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 MinimizeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { RaiseAccuracyStageTarget(pokemon, target, gStatIndexSpecial); return TRUE; } -bool8 sub_8059A2C(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 sub_8059A2C(Entity * pokemon,Entity * target,Move * move,s32 itemId) { u8 local_20; u32 level; local_20 = 0; level = GetEntInfo(pokemon)->level; - sub_806F370(pokemon,target,level,1,&local_20,GetMoveType(move),sub_8057600(move,param_4),0,1,0); + sub_806F370(pokemon,target,level,1,&local_20,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,1,0); local_20 = local_20 == 0; return local_20; } -bool8 SupersonicMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SupersonicMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { ConfuseStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 TauntMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 TauntMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { TauntStatusTarget(pokemon, target); return TRUE; } -bool8 MoonlightMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 MoonlightMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { HealTargetHP(pokemon, target, gMoonlightHealValueByWeather[GetApparentWeather(pokemon)], 0, TRUE); return TRUE; } -bool8 HornDrillMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 HornDrillMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId) { u8 local_20; @@ -782,19 +782,19 @@ bool8 HornDrillMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param return FALSE; } else { - sub_806F370(pokemon,target,9999,1,&local_20,GetMoveType(move),sub_8057600(move,param_4),0,0,0); + sub_806F370(pokemon,target,9999,1,&local_20,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,0,0); local_20 = local_20 == 0; return local_20; } } -bool8 SwordsDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SwordsDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { RaiseAttackStageTarget(pokemon, target, gStatIndexAtkDef, 2); return TRUE; } -bool8 ConversionMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 ConversionMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId) { u8 moveType; Move *movePtr; @@ -838,13 +838,13 @@ bool8 ConversionMoveAction(Entity * pokemon,Entity * target,Move * move,s32 para } } -bool8 Conversion2MoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 Conversion2MoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { Conversion2StatusTarget(pokemon, target); return TRUE; } -bool8 HelpingHandMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 HelpingHandMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; @@ -860,24 +860,24 @@ bool8 HelpingHandMoveAction(Entity *pokemon, Entity *target, Move *move, s32 par return flag; } -bool8 sub_8059CD8(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_8059CD8(Entity *pokemon, Entity *target, Move *move, s32 itemId) { RaiseDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 2); return TRUE; } -bool8 WarpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 WarpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { WarpTarget(pokemon, target, 0, NULL); return TRUE; } -bool8 ThundershockMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ThundershockMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gThundershockSecondaryChance)) { @@ -887,18 +887,18 @@ bool8 ThundershockMoveAction(Entity *pokemon, Entity *target, Move *move, s32 pa return flag; } -bool8 ThunderWaveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ThunderWaveMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { ParalyzeStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 ZapCannonMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ZapCannonMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -908,30 +908,30 @@ bool8 ZapCannonMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param return flag; } -bool8 BlockMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 BlockMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { ImmobilizedStatusTarget(pokemon, target); return TRUE; } -bool8 PoisonGasMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 PoisonGasMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { PoisonedStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 ToxicMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ToxicMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { BadlyPoisonedStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 PoisonFangMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 PoisonFangMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gPoisonFangSecondaryChance)) { diff --git a/src/move_orb_actions_3.c b/src/move_orb_actions_3.c index 6f59d2c79..26bccee6d 100644 --- a/src/move_orb_actions_3.c +++ b/src/move_orb_actions_3.c @@ -47,12 +47,12 @@ static void sub_805A7D4(Entity *, Entity *, Item *, DungeonPos *); -bool8 PoisonStingMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 PoisonStingMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gPoisonStingSecondaryChance)) { @@ -62,7 +62,7 @@ bool8 PoisonStingMoveAction(Entity *pokemon, Entity *target, Move *move, s32 par return flag; } -bool8 JumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4,u8 param_5) +bool8 JumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId,u8 param_5) { u8 moveType; u32 movePower; @@ -73,7 +73,7 @@ bool8 JumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_ flag = FALSE; if (param_5 == 0) { - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0 ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0 ? TRUE : FALSE; } if (!flag) { moveType = GetMoveTypeForMonster(pokemon,move); @@ -86,18 +86,18 @@ bool8 JumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_ if (dmgStruct.dmg == 0) { dmgStruct.dmg = 1; } - sub_806F370(pokemon,pokemon,dmgStruct.dmg,0,&auStack_20,0,0x1f7,0x13,1,0); + sub_806F370(pokemon,pokemon,dmgStruct.dmg,0,&auStack_20,0,DUNGEON_EXIT_MISSED_JUMP_KICK,RESIDUAL_DAMAGE_MOVE_FAIL,1,0); } return flag; } -bool8 BounceMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) +bool8 BounceMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId) { bool8 flag; flag = FALSE; if (MoveMatchesBideClassStatus(pokemon, move)) { - if (HandleDamagingMove(pokemon, target, move, gBounceModifier, param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, gBounceModifier, itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon, target, gBounceSecondaryChance) != 0) { ParalyzeStatusTarget(pokemon, target, FALSE); @@ -112,7 +112,7 @@ bool8 BounceMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4) return flag; } -bool8 HiJumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param_4,u8 param_5) +bool8 HiJumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId,u8 param_5) { u8 moveType; u32 movePower; @@ -123,7 +123,7 @@ bool8 HiJumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 para flag = FALSE; if (param_5 == 0) { - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),param_4) != 0 ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),itemId) != 0 ? TRUE : FALSE; } if (!flag) { moveType = GetMoveTypeForMonster(pokemon,move); @@ -136,17 +136,17 @@ bool8 HiJumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 para if (dmgStruct.dmg == 0) { dmgStruct.dmg = 1; } - sub_806F370(pokemon,pokemon,dmgStruct.dmg,0,&auStack_20,0,0x1f8,0x13,1,0); + sub_806F370(pokemon,pokemon,dmgStruct.dmg,0,&auStack_20,0,DUNGEON_EXIT_MISSED_HI_JUMP_KICK,RESIDUAL_DAMAGE_MOVE_FAIL,1,0); } return flag; } -bool8 TriAttackMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 TriAttackMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4)) + if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId)) { flag = TRUE; if(sub_805727C(pokemon, target, gTriAttackSecondaryChance)) @@ -169,7 +169,7 @@ bool8 TriAttackMoveAction(Entity * pokemon, Entity * target, Move *move, s32 par return flag; } -bool8 TrickMoveAction(Entity * pokemon,Entity * target, Move *move, s32 param_4) +bool8 TrickMoveAction(Entity * pokemon,Entity * target, Move *move, s32 itemId) { EntityInfo *r9; EntityInfo *r8; @@ -225,16 +225,16 @@ bool8 TrickMoveAction(Entity * pokemon,Entity * target, Move *move, s32 param_4) } } -bool8 TripleKickMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 TripleKickMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 flag; gUnknown_202F210++; - flag = HandleDamagingMove(pokemon, target, move, IntToF248_2(gUnknown_202F210), param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon, target, move, IntToF248_2(gUnknown_202F210), itemId) ? TRUE : FALSE; return flag; } -bool8 MudWaterSportMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 MudWaterSportMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { if(move->id == MOVE_MUD_SPORT) { @@ -247,12 +247,12 @@ bool8 MudWaterSportMoveAction(Entity * pokemon, Entity * target, Move *move, s32 return TRUE; } -bool8 MudSlapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 MudSlapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -262,24 +262,24 @@ bool8 MudSlapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 return flag; } -bool8 ThiefMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ThiefMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { - return ThiefAction(pokemon, target, move, param_4); + return ThiefAction(pokemon, target, move, itemId); } -bool8 AmnesiaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 AmnesiaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { RaiseDefenseStageTarget(pokemon, target, gStatIndexSpecial, 2); return TRUE; } -bool8 GrowlMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 GrowlMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { LowerAttackStageTarget(pokemon, target, gStatIndexAtkDef, 1, 1, TRUE); return TRUE; } -bool8 SurfMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SurfMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; s32 modifierInt; @@ -293,12 +293,12 @@ bool8 SurfMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) modifierInt = IntToF248_2(1).raw; } modifier.raw = modifierInt; - if(HandleDamagingMove(pokemon,target,move,modifier,param_4) != 0) + if(HandleDamagingMove(pokemon,target,move,modifier,itemId) != 0) flag = TRUE; return flag; } -bool8 RolePlayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 RolePlayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { EntityInfo * entityInfo; EntityInfo * targetEntityInfo; @@ -321,7 +321,7 @@ bool8 RolePlayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ } } -bool8 SunnyDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SunnyDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { gDungeon->weather.unkE267[WEATHER_SUNNY] = gMoveWeatherDuration; if (sub_807EAA0(1,0) == 0) { @@ -330,24 +330,24 @@ bool8 SunnyDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ return TRUE; } -bool8 LeerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 LeerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { LowerDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 1, 1, TRUE); return TRUE; } -bool8 WishMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 WishMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { WishStatusTarget(pokemon, target); return TRUE; } -bool8 FakeOutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 FakeOutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gFakeOutSecondaryChance)) { @@ -357,20 +357,20 @@ bool8 FakeOutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 return flag; } -bool8 sub_805A450(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_805A450(Entity *pokemon, Entity *target, Move *move, s32 itemId) { TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC730); return FALSE; } -bool8 PayDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 PayDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; Item item; DungeonPos pos; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if (RollSecondaryEffect(pokemon, 0) != 0) { if (!EntityIsValid(target)) { @@ -384,25 +384,25 @@ bool8 PayDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return flag; } -bool8 AssistMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 AssistMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC74C); return FALSE; } -bool8 RestMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 RestMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { NappingStatusTarget(pokemon, target, CalculateStatusTurns(target, gNappingTurnRange, FALSE)); return TRUE; } -bool8 IngrainMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 IngrainMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { IngrainedStatusTarget(pokemon, target); return TRUE; } -bool8 SwallowMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SwallowMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { u8 *stockpileStage; @@ -417,27 +417,27 @@ bool8 SwallowMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 return TRUE; } -bool8 CurseMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 CurseMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { CurseStatusTarget(pokemon, target); return TRUE; } -bool8 sub_805A568(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 sub_805A568(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 flag; - flag = HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) ? TRUE : FALSE; return flag; } -bool8 SuperpowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SuperpowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { u32 stat; bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,pokemon,0) != 0) { stat = gStatIndexAtkDef; @@ -465,13 +465,13 @@ bool8 SteelWingMoveAction(Entity *pokemon, Entity *target, Move *move, s32 stat, return flag; } -bool8 SpitUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SpitUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { u8 *stockpileStage; stockpileStage = &GetEntInfo(pokemon)->stockpileStage; if (*stockpileStage != 0) { - HandleDamagingMove(pokemon,target,move,IntToF248_2(*stockpileStage),param_4); + HandleDamagingMove(pokemon,target,move,IntToF248_2(*stockpileStage),itemId); *stockpileStage = 0; } else { @@ -480,12 +480,12 @@ bool8 SpitUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return TRUE; } -bool8 DynamicPunchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 DynamicPunchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -495,7 +495,7 @@ bool8 DynamicPunchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 pa return flag; } -bool8 KnockOffMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 KnockOffMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { EntityInfo *entityInfo; EntityInfo *targetEntityInfo; @@ -559,7 +559,7 @@ static void sub_805A7D4(Entity * pokemon, Entity * target, Item *item, SpawnDroppedItem(pokemon,&stackEntity,item,1,0); } -bool8 SplashMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 SplashMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { int x; int y; @@ -610,10 +610,10 @@ _0805A8C2: if (GetEntityType(entity) == ENTITY_MONSTER) { InitPokemonMove(&stackMove,MOVE_REGULAR_ATTACK); if (sub_80571F0(entity,&stackMove) == 0) { - sub_806F370(pokemon,entity,gSplashDmgValue,0,0,TYPE_NONE,sub_8057600(move, param_4),0,1,0); + sub_806F370(pokemon,entity,gSplashDmgValue,0,0,TYPE_NONE,GetDungeonExitReasonFromMoveOrItem(move, itemId),RESIDUAL_DAMAGE_REGULAR,1,0); } if ((IsFloorOver() == 0) && (EntityIsValid(pokemon))) { - sub_806F370(pokemon,pokemon,gSplashDmgValue,0,0,0,0x1fe,0,0,0); + sub_806F370(pokemon,pokemon,gSplashDmgValue,0,0,0,DUNGEON_EXIT_FAINTED_FROM_DAMAGE_BOUNCING,RESIDUAL_DAMAGE_REGULAR,0,0); if ((IsFloorOver() == 0) && (EntityIsValid(pokemon))) goto _0805A9FE; } } @@ -657,13 +657,13 @@ _0805AA5E: return TRUE; } -bool8 sub_805AAD0(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 sub_805AAD0(Entity * pokemon, Entity * target, Move *move, s32 itemId) { FixedDamageStatusTarget(pokemon, pokemon); return TRUE; } -bool8 BellyDrumMoveAction(Entity * pokemon,Entity * target, Move *move, s32 param_4) +bool8 BellyDrumMoveAction(Entity * pokemon,Entity * target, Move *move, s32 itemId) { EntityInfo *info; bool8 flag; @@ -682,18 +682,18 @@ bool8 BellyDrumMoveAction(Entity * pokemon,Entity * target, Move *move, s32 para return flag; } -bool8 LightScreenMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 LightScreenMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { LightScreenStatusTarget(pokemon, target); return TRUE; } -bool8 SecretPowerMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 SecretPowerMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gSecretPowerSecondaryEffectChance) != 0) { switch(gSecretPowerTable[gDungeon->tileset]) { @@ -731,12 +731,12 @@ bool8 SecretPowerMoveAction(Entity * pokemon, Entity * target, Move *move, s32 p return flag; } -bool8 sub_805AC90(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 sub_805AC90(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gDizzyPunchSecondaryChance) != 0) { ConfuseStatusTarget(pokemon, target, FALSE); @@ -745,7 +745,7 @@ bool8 sub_805AC90(Entity * pokemon, Entity * target, Move *move, s32 param_4) return flag; } -bool8 BulkUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 BulkUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { s32 stat = gStatIndexAtkDef; RaiseAttackStageTarget(pokemon, target, stat, 1); @@ -753,19 +753,19 @@ bool8 BulkUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return TRUE; } -bool8 ObserverOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ObserverOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { PausedStatusTarget(pokemon, target, 1, CalculateStatusTurns(target, gObserverOrbPausedTurnRange, TRUE), TRUE); return TRUE; } -bool8 FeatherDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 FeatherDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { LowerAttackStageTarget(pokemon, target, gStatIndexAtkDef, 2, 1, TRUE); return TRUE; } -bool8 BeatUpMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 BeatUpMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { s32 numPossibleTargets; s32 i; @@ -803,21 +803,21 @@ bool8 BeatUpMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_ return flag; } -bool8 BlastBurnMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 BlastBurnMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; SendThawedMessage(pokemon, target); - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),param_4) != 0 ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),itemId) != 0 ? TRUE : FALSE; return flag; } -bool8 CrushClawMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 CrushClawMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gCrushClawSecondaryChance) != 0) { LowerDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 1, 1, FALSE); @@ -826,13 +826,13 @@ bool8 CrushClawMoveAction(Entity * pokemon, Entity * target, Move *move, s32 par return flag; } -bool8 BlazeKickMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 BlazeKickMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; SendThawedMessage(pokemon, target); - if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gBlazeKickSecondaryChance) != 0) { BurnedStatusTarget(pokemon, target, 0, FALSE); @@ -841,14 +841,14 @@ bool8 BlazeKickMoveAction(Entity * pokemon, Entity * target, Move *move, s32 par return flag; } -bool8 PresentMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 PresentMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 flag; s32 rand1 = DungeonRandInt(100); s32 rand2 = rand1; if (rand1 < 10) { - flag = (sub_8055864(pokemon,target,move,0x78,param_4) != 0); + flag = (sub_8055864(pokemon,target,move,0x78,itemId) != 0); return flag; } else { @@ -858,17 +858,17 @@ bool8 PresentMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param return TRUE; } else if (rand2 >= 60) { - flag = (sub_8055864(pokemon,target,move,0x28,param_4) != 0); + flag = (sub_8055864(pokemon,target,move,0x28,itemId) != 0); return flag; } else { - flag = (sub_8055864(pokemon,target,move,0x50,param_4) != 0); + flag = (sub_8055864(pokemon,target,move,0x50,itemId) != 0); return flag; } } } -bool8 EruptionMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 EruptionMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { EntityInfo *entityInfo; s32 maxHp; @@ -891,17 +891,17 @@ bool8 EruptionMoveAction(Entity * pokemon, Entity * target, Move *move, s32 para index = 3; } - flag = HandleDamagingMove(pokemon,target,move,gEruptionModifiers[index],param_4) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,gEruptionModifiers[index],itemId) ? TRUE : FALSE; return flag; } -bool8 GlareMoveAction(Entity * pokemon,Entity * target,Move *move,s32 param_4) +bool8 GlareMoveAction(Entity * pokemon,Entity * target,Move *move,s32 itemId) { ParalyzeStatusTarget(pokemon,target, TRUE); return TRUE; } -bool8 TransformMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 TransformMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { if (IsBossFight()) { TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FEFF4); @@ -914,12 +914,12 @@ bool8 TransformMoveAction(Entity * pokemon, Entity * target, Move *move, s32 par } } -bool8 PoisonTailMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 PoisonTailMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gPoisonTailSecondaryChance) != 0) { PoisonedStatusTarget(pokemon,target,FALSE); @@ -928,13 +928,13 @@ bool8 PoisonTailMoveAction(Entity * pokemon, Entity * target, Move *move, s32 pa return flag; } -bool8 RoarMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 RoarMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { BlowAwayTarget(pokemon, target, GetEntInfo(pokemon)->action.direction); return TRUE; } -bool8 HandleColorChange(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 HandleColorChange(Entity * pokemon, Entity * target, Move *move, s32 itemId) { u8 newType; const char *typeString; @@ -958,13 +958,13 @@ bool8 HandleColorChange(Entity * pokemon, Entity * target, Move *move, s32 param } } -bool8 TailGlowMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 TailGlowMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { RaiseAttackStageTarget(pokemon,target,gStatIndexSpecial, 2); return TRUE; } -bool8 sub_805B17C(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 sub_805B17C(Entity * pokemon, Entity * target, Move *move, s32 itemId) { s32 uVar4; bool8 flag; @@ -980,7 +980,7 @@ bool8 sub_805B17C(Entity * pokemon, Entity * target, Move *move, s32 param_4) uVar4 = 0x7e; } } - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gMovesConstrictionChance) != 0) { SqueezedStatusTarget(pokemon,target,uVar4,0); @@ -989,19 +989,19 @@ bool8 sub_805B17C(Entity * pokemon, Entity * target, Move *move, s32 param_4) return flag; } -bool8 PerishSongMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 PerishSongMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { PerishSongTarget(pokemon, target); return TRUE; } -bool8 WrapMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 WrapMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { WrapTarget(pokemon, target); return TRUE; } -bool8 SpikesMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 SpikesMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 trapLaid; u8 uVar2; @@ -1027,7 +1027,7 @@ bool8 SpikesMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_ const s32 gUnknown_8106A8C[] = {6, 12, 18, 20, 24, 30, 30}; -bool8 MagnitudeMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 MagnitudeMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { s32 r3; bool8 r6; @@ -1044,11 +1044,11 @@ bool8 MagnitudeMoveAction(Entity * pokemon, Entity * target, Move *move, s32 par if (entityInfo->bideClassStatus.status == STATUS_DIGGING) { magnitudeDmgVal *= 2; } - r6 = sub_8055864(pokemon,target,move,magnitudeDmgVal,param_4) ? TRUE : FALSE; + r6 = sub_8055864(pokemon,target,move,magnitudeDmgVal,itemId) ? TRUE : FALSE; return r6; } -bool8 MagicCoatMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 MagicCoatMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { MagicCoatStatusTarget(pokemon, target); return TRUE; diff --git a/src/move_orb_actions_4.c b/src/move_orb_actions_4.c index 8af091543..acbe28243 100644 --- a/src/move_orb_actions_4.c +++ b/src/move_orb_actions_4.c @@ -48,30 +48,30 @@ #include "switcher_orb.h" #include "trawl_orb.h" -bool8 ProtectMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 ProtectMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { ProtectStatusTarget(pokemon, target); return TRUE; } -bool8 DefenseCurlMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 DefenseCurlMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { RaiseDefenseStageTarget(pokemon,target,gStatIndexAtkDef,1); return TRUE; } -bool8 sub_805B314(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 sub_805B314(Entity * pokemon,Entity * target,Move *move, s32 itemId) { sub_80783C4(pokemon, target, TRUE); return TRUE; } -bool8 MistBallMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 MistBallMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gMistBallSecondaryChance) != 0) { LowerAttackStageTarget(pokemon,target,gStatIndexSpecial,1,1,0); @@ -80,24 +80,24 @@ bool8 MistBallMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_ return flag; } -bool8 DestinyBondMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 DestinyBondMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { DestinyBondStatusTarget(pokemon, target); return TRUE; } -bool8 FalseSwipeMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 FalseSwipeMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { - return (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4)) ? TRUE : FALSE; + return (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId)) ? TRUE : FALSE; } -bool8 MirrorCoatMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 MirrorCoatMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { MirrorCoatStatusTarget(pokemon, target); return TRUE; } -bool8 CalmMindMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 CalmMindMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { u32 stat = gStatIndexSpecial; RaiseAttackStageTarget(pokemon,target,stat,1); @@ -105,13 +105,13 @@ bool8 CalmMindMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_ return TRUE; } -bool8 HiddenPowerMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) +bool8 HiddenPowerMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { - HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4); + HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId); return TRUE; } -bool8 MetalClawMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4, s32 param_5) +bool8 MetalClawMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId, s32 param_5) { EntityInfo *entityInfo; bool8 flag; @@ -121,20 +121,20 @@ bool8 MetalClawMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param flag = TRUE; if (sub_805727C(pokemon,pokemon,gMetalClawSecondaryChance) != 0) { entityInfo = GetEntInfo(pokemon); - RaiseAttackStageTarget(pokemon,pokemon,param_4,1); + RaiseAttackStageTarget(pokemon,pokemon,itemId,1); SetExpMultplier(entityInfo); } } return flag; } -bool8 AttractMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 AttractMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { InfatuateStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 MimicMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 MimicMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { EntityInfo *entityInfo; EntityInfo *targetEntityInfo; @@ -171,7 +171,7 @@ bool8 MimicMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4 return mimicSuccess; } -bool8 FrustrationMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 FrustrationMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { s32 i; bool8 local_24 = FALSE; @@ -185,19 +185,19 @@ bool8 FrustrationMoveAction(Entity * pokemon, Entity * target, Move *move, s32 p } } - sub_806F370(pokemon,target,dmg,1,&local_24,GetMoveType(move),sub_8057600(move,param_4),0,1,0); + sub_806F370(pokemon,target,dmg,1,&local_24,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,1,0); local_24 = (local_24 == 0); return local_24; } -bool8 LeechSeedMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 LeechSeedMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { HandleLeechSeed(pokemon, target, TRUE); SetExpMultplier(GetEntInfo(pokemon)); return TRUE; } -bool8 MetronomeMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 MetronomeMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 flag; Move natureMove; @@ -206,11 +206,11 @@ bool8 MetronomeMoveAction(Entity * pokemon, Entity * target, Move *move, s32 par index = gMetronomeCalledArrayId; InitPokemonMove(&natureMove, gMetronomeCalledMoves[index].moveID); - flag = gMetronomeCalledMoves[index].callback(pokemon, target, &natureMove, param_4); + flag = gMetronomeCalledMoves[index].callback(pokemon, target, &natureMove, itemId); return flag; } -bool8 DreamEaterMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 DreamEaterMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 hasLiquidOoze; s32 iVar3; @@ -220,7 +220,7 @@ bool8 DreamEaterMoveAction(Entity * pokemon, Entity * target, Move *move, s32 pa flag = FALSE; hasLiquidOoze = AbilityIsActive(target, ABILITY_LIQUID_OOZE); if (IsSleeping(target)) { - iVar3 = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4); + iVar3 = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId); if (iVar3 != 0) { flag = TRUE; newHP = iVar3 / 2; @@ -231,7 +231,7 @@ bool8 DreamEaterMoveAction(Entity * pokemon, Entity * target, Move *move, s32 pa SetExpMultplier(GetEntInfo(pokemon)); if (RollSecondaryEffect(pokemon,0) != 0) { if (hasLiquidOoze) { - DealDamageToEntity(pokemon,newHP,0xd,0x1fa); + DealDamageToEntity(pokemon,newHP,RESIDUAL_DAMAGE_LIQUID_OOZE,DUNGEON_EXIT_FAINTED_COVERED_IN_SLUDGE); } else { HealTargetHP(pokemon,pokemon,newHP,0,TRUE); @@ -246,13 +246,13 @@ bool8 DreamEaterMoveAction(Entity * pokemon, Entity * target, Move *move, s32 pa return flag; } -bool8 SnatchMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 SnatchMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { SnatchStatusTarget(pokemon, target); return TRUE; } -bool8 RecycleMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 RecycleMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { s32 i; EntityInfo *entityInfo = GetEntInfo(target); @@ -285,35 +285,35 @@ bool8 RecycleMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param return isTMRecycled; } -bool8 ReflectMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 ReflectMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { ReflectStatusTarget(pokemon, target); return TRUE; } -bool8 DragonRageMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 DragonRageMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { u8 local_20; local_20 = 0; - sub_806F370(pokemon,target,gDragonRageDmgValue,1,&local_20,GetMoveType(move),sub_8057600(move,param_4),0,1,0); + sub_806F370(pokemon,target,gDragonRageDmgValue,1,&local_20,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,1,0); local_20 = (local_20 == 0); return local_20; } -bool8 DragonDanceMoveAction( Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 DragonDanceMoveAction( Entity * pokemon, Entity * target, Move *move, s32 itemId) { RaiseAttackStageTarget(pokemon, target, gStatIndexAtkDef, 1); RaiseMovementSpeedTarget(pokemon, target, 0, TRUE); return TRUE; } -bool8 SkullBashMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 SkullBashMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { bool8 flag; if (MoveMatchesBideClassStatus(pokemon,move)) { - flag = HandleDamagingMove(pokemon,target,move,gSkullBashModifier,param_4) != 0 ? 1 : 0; + flag = HandleDamagingMove(pokemon,target,move,gSkullBashModifier,itemId) != 0 ? 1 : 0; sub_8079764(pokemon); } else { @@ -323,12 +323,12 @@ bool8 SkullBashMoveAction(Entity * pokemon, Entity * target, Move * move, s32 pa return flag; } -bool8 LusterPurgeMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 LusterPurgeMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gLusterPurgeSecondaryChance)) { @@ -338,14 +338,14 @@ bool8 LusterPurgeMoveAction(Entity * pokemon, Entity * target, Move * move, s32 return flag; } -bool8 StruggleMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) +bool8 StruggleMoveAction(Entity * pokemon, Entity * target, Move * move, s32 itemId) { s32 entityHP; s32 newHP; bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { flag = TRUE; if (RollSecondaryEffect(pokemon, 0) != 0) { entityHP = GetEntInfo(pokemon)->maxHPStat; @@ -356,14 +356,14 @@ bool8 StruggleMoveAction(Entity * pokemon, Entity * target, Move * move, s32 par if (newHP < 1) { newHP = 1; } - sub_806F370(pokemon, pokemon, newHP, 0, 0, 0, sub_8057600(move, param_4), 0, 1, 0); + sub_806F370(pokemon, pokemon, newHP, 0, 0, 0, GetDungeonExitReasonFromMoveOrItem(move, itemId), RESIDUAL_DAMAGE_REGULAR, 1, 0); } } return flag; } // overlay_0005.bin::0216AF44 -bool8 RockSmashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 RockSmashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { DungeonPos pos; bool8 flag = FALSE; @@ -382,13 +382,13 @@ bool8 RockSmashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param return flag; } -bool8 sub_805BA44(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_805BA44(Entity *pokemon, Entity *target, Move *move, s32 itemId) { sub_807D3CC(pokemon); return TRUE; } -bool8 ThiefAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ThiefAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { EntityInfo *pokemonInfo1; EntityInfo *pokemonInfo2; @@ -399,7 +399,7 @@ bool8 ThiefAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) Item *targetItem; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target, 0) != 0) { pokemonInfo1 = GetEntInfo(pokemon); @@ -440,26 +440,26 @@ bool8 ThiefAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return flag; } -bool8 ReboundOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 ReboundOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { CounterStatusTarget(pokemon, target, STATUS_MINI_COUNTER); return TRUE; } -bool8 SwitcherOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 SwitcherOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { SetExpMultplier(GetEntInfo(pokemon)); HandleSwitcherOrb(pokemon, target, TRUE); return TRUE; } -bool8 StayawayOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 StayawayOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { WarpTarget(pokemon, target, 1, NULL); return TRUE; } -bool8 CleanseOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 CleanseOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { s32 i; EntityInfo *entityInfo = GetEntInfo(target); @@ -497,13 +497,13 @@ bool8 CleanseOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_ return isItemCleaned; } -bool8 SlumberOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 SlumberOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { SleepStatusTarget(pokemon,target,CalculateStatusTurns(target, gSleepTurnRange, TRUE), TRUE); return TRUE; } -bool8 TwoEdgeMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 TwoEdgeMoveAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { EntityInfo *entityInfo; bool8 flag; @@ -519,12 +519,12 @@ bool8 TwoEdgeMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param if (targetHP < 0) { targetHP = 0; } - sub_806F370(pokemon,target,targetHP,0,&local_28,0,sub_8057600(move,param_4),0,0,0); + sub_806F370(pokemon,target,targetHP,0,&local_28,0,GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,0,0); pokeHP = entityInfo->HP / 2; if (pokeHP < 0) { pokeHP = 0; } - sub_806F370(pokemon,pokemon,pokeHP,0,&local_27,0,sub_8057600(move,param_4),0,0,0); + sub_806F370(pokemon,pokemon,pokeHP,0,&local_27,0,GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,0,0); local_28 = (local_28 == 0); local_27 = (local_27 == 0); @@ -536,25 +536,25 @@ bool8 TwoEdgeMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param return flag; } -bool8 SilenceOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 SilenceOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { MuzzleTarget(pokemon, target); return TRUE; } -bool8 ScannerOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 ScannerOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { HandleScannerOrb(pokemon, target); return TRUE; } -bool8 RadarOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 RadarOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { HandleRadarOrb(pokemon, target); return TRUE; } -bool8 TransferOrbAction(Entity *pokemon, Entity * target, Move *move, s32 param_4) +bool8 TransferOrbAction(Entity *pokemon, Entity * target, Move *move, s32 itemId) { EntityInfo *entityInfo; s32 oldID; //r8 @@ -598,37 +598,37 @@ bool8 TransferOrbAction(Entity *pokemon, Entity * target, Move *move, s32 param_ return didTransfer; } -bool8 SlowDownMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 SlowDownMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { LowerMovementSpeedTarget(pokemon, target, 1, TRUE); return TRUE; } -bool8 LuminousOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 LuminousOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { HandleLuminousOrbAction(pokemon); return TRUE; } -bool8 PetrifyOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 PetrifyOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { PetrifiedStatusTarget(pokemon, target); return TRUE; } -bool8 PounceOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 PounceOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { HandlePounceOrb(pokemon, target, 8); return TRUE; } -bool8 TrawlOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 TrawlOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { HandleTrawlOrb(pokemon, target); return TRUE; } -bool8 EscapeOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 EscapeOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0); if (gDungeon->unk644.unk2A != 0) { @@ -642,13 +642,13 @@ bool8 EscapeOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4 return FALSE; } -bool8 DroughtOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 DroughtOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { HandleDroughtOrb(pokemon, target); return TRUE; } -bool8 TrapbustOrbAction(Entity * pokemon,Entity * target, Move *move, s32 param_4) +bool8 TrapbustOrbAction(Entity * pokemon,Entity * target, Move *move, s32 itemId) { const Tile *tile; Entity *object; @@ -704,7 +704,7 @@ bool8 TrapbustOrbAction(Entity * pokemon,Entity * target, Move *move, s32 param_ return foundTrap; } -bool8 RollcallOrbAction(Entity * pokemon, Entity *target, Move *move, s32 param_4) +bool8 RollcallOrbAction(Entity * pokemon, Entity *target, Move *move, s32 itemId) { Entity **possibleTargets; s32 numPossibleTargets; @@ -735,68 +735,68 @@ bool8 RollcallOrbAction(Entity * pokemon, Entity *target, Move *move, s32 param_ return foundTarget; } -bool8 InvisifyOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 InvisifyOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { InvisibleStatusTarget(pokemon, pokemon); return TRUE; } -bool8 OneShotOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 OneShotOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { u8 local_20; local_20 = 0; - sub_806F370(pokemon,target,9999,1,&local_20,GetMoveType(move),sub_8057600(move,param_4),0,1,0); + sub_806F370(pokemon,target,9999,1,&local_20,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,1,0); local_20 = (local_20 == 0); return local_20; } -bool8 IdentifyOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 IdentifyOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { IdentityItemHolders(pokemon, target); return TRUE; } -bool8 VacuumCutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 VacuumCutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag; - flag = sub_8055864(pokemon, target, move, gVacuumCutDmgValue, param_4) != 0 ? TRUE : FALSE; + flag = sub_8055864(pokemon, target, move, gVacuumCutDmgValue, itemId) != 0 ? TRUE : FALSE; return flag; } -bool8 ReviverOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ReviverOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80FD454); return FALSE; } -bool8 ShockerOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ShockerOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { CowerStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 sub_805C208(Entity *pokemon, Entity *target, Move *move, u32 param_4) +bool8 sub_805C208(Entity *pokemon, Entity *target, Move *move, u32 itemId) { u32 targetSize; u8 local_24; local_24 = 0; targetSize = GetSize(GetEntInfo(target)->apparentID); - sub_806F370(pokemon,target,targetSize,1,&local_24,GetMoveType(move),sub_8057600(move,param_4),0,1,0); + sub_806F370(pokemon,target,targetSize,1,&local_24,GetMoveType(move),GetDungeonExitReasonFromMoveOrItem(move,itemId),RESIDUAL_DAMAGE_REGULAR,1,0); local_24 = local_24 == 0; return local_24; } -bool8 sub_805C288(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 sub_805C288(Entity *pokemon, Entity *target, Move *move, s32 itemId) { sub_8078A58(pokemon, target, gFamishBellyDownValue, 0); return TRUE; } -bool8 OneRoomOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 OneRoomOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { HandleOneRoomOrb(pokemon, target); return TRUE; diff --git a/src/move_orb_actions_5.c b/src/move_orb_actions_5.c index dfbed442d..1bd43ccc5 100644 --- a/src/move_orb_actions_5.c +++ b/src/move_orb_actions_5.c @@ -21,7 +21,7 @@ extern void sub_807FC3C(DungeonPos *, u32, u32); extern void sub_8042A54(DungeonPos *); extern void sub_8042A64(DungeonPos *); -bool8 FillInOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4) +bool8 FillInOrbAction(Entity *pokemon,Entity *target, Move *move, s32 itemId) { Tile *tileToFill; EntityInfo *targetInfo; @@ -71,7 +71,7 @@ bool8 FillInOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4) } } -bool8 TrapperOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 TrapperOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { u32 var; var = (GetEntInfo(target)->isNotTeamMember ? 2 : 1); @@ -79,7 +79,7 @@ bool8 TrapperOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) return TRUE; } -bool8 ItemizeOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 ItemizeOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { Item stack; DungeonPos posStruct = target->pos; @@ -94,36 +94,36 @@ bool8 ItemizeOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) target->isVisible = FALSE; CreateItemWithStickyChance(&stack, GetRandomFloorItem(0), 0); SpawnDroppedItemWrapper(pokemon, &posStruct, &stack); - HandleFaint(target, 0x218, pokemon); + HandleFaint(target, DUNGEON_EXIT_TRANSFORMED_INTO_ITEM, pokemon); return TRUE; } } -bool8 HurlOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 HurlOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { HandleHurlOrb(pokemon, target); return TRUE; } -bool8 MobileOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 MobileOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { MobileStatusTarget(pokemon, target); return TRUE; } -bool8 StairsOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 StairsOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { HandleStairsOrb(pokemon, target); return TRUE; } -bool8 LongtossOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 LongtossOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { LongTossStatusTarget(pokemon, target); return TRUE; } -bool8 PierceOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) +bool8 PierceOrbAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { PierceStatusTarget(pokemon, target); return TRUE; diff --git a/src/move_orb_effects_5.c b/src/move_orb_effects_5.c index 4579d9c25..caf079637 100644 --- a/src/move_orb_effects_5.c +++ b/src/move_orb_effects_5.c @@ -27,14 +27,13 @@ #include "dungeon_strings.h" #include "dungeon_pos_data.h" #include "dungeon_damage.h" +#include "dungeon_misc.h" #include "dungeon_mon_spawn.h" #include "dungeon_kecleon_shop.h" extern void UpdateMinimap(); extern void EntityUpdateStatusSprites(Entity *); extern void sub_8042A74(Entity *r0); -extern s32 GetMonsterApparentID(Entity *param_1, s16 param_2); -extern void sub_806A898(Entity *, u32, u32); extern void HealTargetHP(Entity *pokemon, Entity *r1, s16, s16, u32); extern void sub_80420C8(Entity *r0); extern void nullsub_68(Entity *); @@ -188,7 +187,7 @@ void EndSleepClassStatus(Entity * pokemon, Entity * target, bool8 param_3, bool8 isAsleep = TRUE; TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FA70C); if (param_4) { - DealDamageToEntity(target,gNightmareDmgValue,8,0x20f); + DealDamageToEntity(target,gNightmareDmgValue,RESIDUAL_DAMAGE_NIGHTMARE,DUNGEON_EXIT_FAINTED_WHILE_IN_NIGHTMARE); } break; case STATUS_NAPPING: diff --git a/src/number_util.c b/src/number_util.c index e8806a0b8..70427c1ba 100644 --- a/src/number_util.c +++ b/src/number_util.c @@ -83,7 +83,7 @@ FixedPoint IntToFixedPoint(s32 a) return p; } -FixedPoint FixedPoint_SetFromUnk(s48_16* param_1) +FixedPoint FixedPoint_SetFromS48_16(s48_16* param_1) { FixedPoint s; diff --git a/src/run_dungeon.c b/src/run_dungeon.c index 2fd2024f1..6e709d1ac 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -290,7 +290,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) gDungeon->unkE = 0; gDungeon->unk1BDD4.unk1C05E = 0; if (!r6) { - gDungeon->unk644.unk35 = 0; + gDungeon->unk644.emptyBellyAlert = 0; gDungeon->unk644.unk48 = 0; gDungeon->unk644.unk4C = 0; gDungeon->unk644.unk50 = 0; @@ -517,7 +517,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) leader = GetLeader(); DisplayDungeonMessage(0, gPtrClientFaintedMessage, 1); gDungeon->unk6 = 0; - sub_8083AB0(0x222, leader, leader); + sub_8083AB0(DUNGEON_EXIT_FAILED_TO_PROTECT_CLIENT, leader, leader); } CloseAllSpriteFiles(); sub_8049820(); @@ -550,30 +550,30 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) check = TRUE; } else if (gDungeon->unk11 == 1) { - sub_8083AB0(0x226, NULL, GetLeader()); + sub_8083AB0(DUNGEON_EXIT_ESCAPED_MIDDLE_OF_EXPLORATION, NULL, GetLeader()); check = TRUE; } else if (gDungeon->unk11 == 2) { - sub_8083AB0(0x229, NULL, GetLeader()); + sub_8083AB0(DUNGEON_EXIT_IMPRESSIVELY_COMPLETED_MISSION, NULL, GetLeader()); if (gDungeon->unk644.unk2A != 0) { IncrementThievingSuccesses(); } check = TRUE; } else if (gDungeon->unk11 == 3) { - sub_8083AB0(0x22A, NULL, GetLeader()); + sub_8083AB0(DUNGEON_EXIT_BEFRIENDED_MEW, NULL, GetLeader()); if (gDungeon->unk644.unk2A != 0) { IncrementThievingSuccesses(); } check = TRUE; } else if (gDungeon->unk11 == 4) { - var = 0x227; + var = DUNGEON_EXIT_CLEARED_DUNGEON; sub_8083AB0(var, NULL, GetLeader()); check = TRUE; } else if (gDungeon->unk644.unk34 == 1 && GetFloorType() == FLOOR_TYPE_RESCUE && gDungeon->unk644.unk10 == 2) { - sub_8083AB0(0x228, NULL, GetLeader()); + sub_8083AB0(DUNGEON_EXIT_SUCCEEDED_IN_RESCUE_MISSION, NULL, GetLeader()); if (gDungeon->unk644.unk2A != 0) { IncrementThievingSuccesses(); } @@ -597,7 +597,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) continue; } else { - var = 0x227; + var = DUNGEON_EXIT_CLEARED_DUNGEON; sub_8083AB0(var, NULL, GetLeader()); check = TRUE; // This goto is a fakematch I had to create in order to generate matching code. @@ -728,7 +728,7 @@ void sub_8043D60(void) unk = FALSE; if (unk) { - HandleFaint(mon, 0x207, mon); + HandleFaint(mon, DUNGEON_EXIT_DEBUG_DAMAGE, mon); } } } @@ -787,7 +787,7 @@ bool8 TryForcedLoss(bool8 a0) DisplayDungeonMessage(0, gUnknown_80F89B4, 1); } sub_8042B0C(leader); - HandleFaint(leader, 0x21F, leader); + HandleFaint(leader, DUNGEON_EXIT_RETURNED_WITH_FALLEN_PARTNER, leader); ret = TRUE; } } @@ -799,7 +799,7 @@ bool8 TryForcedLoss(bool8 a0) DisplayDungeonMessage(0, gUnknown_80F89D4, 1); } sub_8042B0C(leader); - HandleFaint(leader, 0x222, leader); + HandleFaint(leader, DUNGEON_EXIT_FAILED_TO_PROTECT_CLIENT, leader); ret = TRUE; } } @@ -811,7 +811,7 @@ bool8 TryForcedLoss(bool8 a0) DisplayDungeonMessage(0, gUnknown_80F89D8, 1); } sub_8042B0C(leader); - HandleFaint(leader, 0x222, leader); + HandleFaint(leader, DUNGEON_EXIT_FAILED_TO_PROTECT_CLIENT, leader); ret = TRUE; } } diff --git a/src/trap.c b/src/trap.c index d426f90d8..ae704205b 100644 --- a/src/trap.c +++ b/src/trap.c @@ -382,7 +382,7 @@ void TryTriggerTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4) break; case TRAP_CHESTNUT_TRAP: if (target != NULL) { - DealDamageToEntity(target,gChestnutTrapDmgValue,0xf,0x213); + DealDamageToEntity(target,gChestnutTrapDmgValue,RESIDUAL_DAMAGE_CHESTNUT_TRAP,DUNGEON_EXIT_TRIPPED_CHESTNUT_TRAP); } break; case TRAP_WONDER_TILE: @@ -394,7 +394,7 @@ void TryTriggerTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4) break; case TRAP_SPIKE_TRAP: if (target != NULL) { - DealDamageToEntity(target,gSpikeTrapDmgValue,10,0x206); + DealDamageToEntity(target,gSpikeTrapDmgValue,RESIDUAL_DAMAGE_SPIKES,DUNGEON_EXIT_FAINTED_FROM_SPIKES); } } if (EntityIsValid(target)) { @@ -509,12 +509,12 @@ void HandlePoisonTrap(Entity *pokemon, Entity *target) void HandleSelfdestructTrap(Entity *pokemon, Entity *target) { - HandleExplosion(pokemon, target, &target->pos, 1, TYPE_NONE, 0x212); + HandleExplosion(pokemon, target, &target->pos, 1, TYPE_NONE, DUNGEON_EXIT_DISAPPEARED_IN_EXPLOSION); } void HandleExplosionTrap(Entity *pokemon, Entity *target) { - HandleExplosion(pokemon, target, &target->pos, 2, TYPE_NONE, 0x212); + HandleExplosion(pokemon, target, &target->pos, 2, TYPE_NONE, DUNGEON_EXIT_DISAPPEARED_IN_EXPLOSION); } void HandleGrimyTrap(Entity *pokemon, Entity *target) @@ -590,7 +590,7 @@ void HandlePitfallTrap(Entity *pokemon, Entity *target, Tile *tile) info->unk15C = 1; info->unk15E = 1; sub_803E708(0x28,0x4b); - DealDamageToEntity(target,gPitfallTrapDmgValue,0x11,0x215); + DealDamageToEntity(target,gPitfallTrapDmgValue,RESIDUAL_DAMAGE_PITFALL,DUNGEON_EXIT_FELL_INTO_PITFALL); gDungeon->unk2 = 2; return; } @@ -605,7 +605,7 @@ void HandlePitfallTrap(Entity *pokemon, Entity *target, Tile *tile) else { DisplayDungeonLoggableMessageTrue(pokemon,gUnknown_80F970C); // $m0 fell into the pitfall! } - HandleFaint(target,0x215,pokemon); + HandleFaint(target,DUNGEON_EXIT_FELL_INTO_PITFALL,pokemon); } if (flag) { SetTrap(tile, TRAP_PITFALL_TRAP); From 675aea42d9e8c988ec6039dbbbe73878679955dd Mon Sep 17 00:00:00 2001 From: Electro Date: Fri, 5 Sep 2025 19:28:02 +0100 Subject: [PATCH 2/3] Create constant files for dungeon exit reasons and residual damage types, label some magic numbers, misc fixes --- include/constants/dungeon_exit.h | 72 ++++++++++++++++++ include/constants/residual_damage.h | 31 ++++++++ include/dungeon_8083AB0.h | 2 +- include/dungeon_config.h | 24 +----- include/dungeon_misc.h | 56 -------------- include/dungeon_run_end.h | 2 +- include/dungeon_strings.h | 3 +- include/strings.h | 3 +- include/structs/str_dungeon.h | 8 +- src/blow_away.c | 2 + src/code_8066D04.c | 1 + src/code_806FDF4.c | 1 + src/dungeon_8083AB0.c | 55 +++++++------- src/dungeon_cleared_window.c | 4 +- src/dungeon_cutscene.c | 1 + src/dungeon_cutscene_articuno.c | 1 + src/dungeon_cutscene_celebi.c | 1 + src/dungeon_cutscene_deoxys.c | 1 + src/dungeon_cutscene_entei.c | 1 + src/dungeon_cutscene_groudon.c | 1 + src/dungeon_cutscene_hooh.c | 1 + src/dungeon_cutscene_jirachi.c | 1 + src/dungeon_cutscene_kyogre.c | 1 + src/dungeon_cutscene_latios.c | 1 + src/dungeon_cutscene_lugia.c | 1 + src/dungeon_cutscene_magma_cavern.c | 1 + src/dungeon_cutscene_mankey.c | 1 + src/dungeon_cutscene_medicham.c | 1 + src/dungeon_cutscene_mewtwo.c | 1 + src/dungeon_cutscene_moltres.c | 1 + src/dungeon_cutscene_raikou.c | 1 + src/dungeon_cutscene_rayquaza.c | 1 + src/dungeon_cutscene_regis.c | 1 + src/dungeon_cutscene_skarmory.c | 1 + src/dungeon_cutscene_smeargle.c | 1 + src/dungeon_cutscene_suicune.c | 1 + src/dungeon_cutscene_zapdos.c | 1 + src/dungeon_damage.c | 4 +- src/dungeon_item_action.c | 2 + src/dungeon_jobs.c | 1 + src/dungeon_menu_others.c | 1 + src/dungeon_misc.c | 1 + src/dungeon_move_util.c | 2 +- src/dungeon_run_end.c | 55 +++++++------- src/dungeon_strings.c | 45 +++++------ src/dungeon_turn_effects.c | 6 +- src/dungeon_wind.c | 1 + src/explosion.c | 1 + src/hurl_orb.c | 2 + src/move_orb_actions_1.c | 2 + src/move_orb_actions_2.c | 2 + src/move_orb_actions_3.c | 2 + src/move_orb_actions_4.c | 2 + src/move_orb_actions_5.c | 1 + src/move_orb_effects_5.c | 2 + src/run_dungeon.c | 3 +- src/strings.c | 112 ++++++++++++++-------------- src/trap.c | 2 + 58 files changed, 312 insertions(+), 224 deletions(-) create mode 100644 include/constants/dungeon_exit.h create mode 100644 include/constants/residual_damage.h diff --git a/include/constants/dungeon_exit.h b/include/constants/dungeon_exit.h new file mode 100644 index 000000000..e51f27456 --- /dev/null +++ b/include/constants/dungeon_exit.h @@ -0,0 +1,72 @@ +#ifndef GUARD_CONSTANTS_DUNGEON_EXIT_H +#define GUARD_CONSTANTS_DUNGEON_EXIT_H + +// constants start at this value +#define DUNGEON_EXIT_REASON_START 500 + +// reasons after this value are considered successful exits +#define DUNGEON_EXIT_REASON_SUCCESS 550 + +enum DungeonExitReason +{ + DUNGEON_EXIT_TRANSFORMED_INTO_FRIEND = DUNGEON_EXIT_REASON_START, + DUNGEON_EXIT_LEFT_WITHOUT_BEING_BEFRIENDED, + DUNGEON_EXIT_FAINTED_FROM_DEBUG_ATTACK, + DUNGEON_EXIT_MISSED_JUMP_KICK, + DUNGEON_EXIT_MISSED_HI_JUMP_KICK, + DUNGEON_EXIT_FAINTED_FROM_DESTINY_BOND, + DUNGEON_EXIT_FAINTED_COVERED_IN_SLUDGE, + DUNGEON_EXIT_UNUSED_507, + DUNGEON_EXIT_UNUSED_508, + DUNGEON_EXIT_FAINTED_FROM_RECOIL, + DUNGEON_EXIT_FAINTED_FROM_DAMAGE_BOUNCING, + DUNGEON_EXIT_DEFEATED_PENT_UP_ENERGY, + DUNGEON_EXIT_UNUSED_512, + DUNGEON_EXIT_UNUSED_513, + DUNGEON_EXIT_UNUSED_514, + DUNGEON_EXIT_UNUSED_515, + DUNGEON_EXIT_UNUSED_516, + DUNGEON_EXIT_UNUSED_517, + DUNGEON_EXIT_FAINTED_FROM_SPIKES, + DUNGEON_EXIT_DEBUG_DAMAGE, + DUNGEON_EXIT_FAINTED_FROM_BURN, + DUNGEON_EXIT_FAINTED_FROM_CONSTRICTION, + DUNGEON_EXIT_FAINTED_FROM_POISON, + DUNGEON_EXIT_FAINTED_FROM_WRAP, + DUNGEON_EXIT_FELLED_BY_CURSE, + DUNGEON_EXIT_DRAINED_BY_LEECH_SEED, + DUNGEON_EXIT_FAINTED_FROM_PERISH_SONG, + DUNGEON_EXIT_FAINTED_WHILE_IN_NIGHTMARE, + DUNGEON_EXIT_FELLED_BY_THROWN_ROCK, + DUNGEON_EXIT_FAINTED_FROM_HUNGER, + DUNGEON_EXIT_DISAPPEARED_IN_EXPLOSION, + DUNGEON_EXIT_TRIPPED_CHESTNUT_TRAP, + DUNGEON_EXIT_FAINTED_DUE_TO_TRAP, + DUNGEON_EXIT_FELL_INTO_PITFALL, + DUNGEON_EXIT_DEFEATED_BLAST_SEED, + DUNGEON_EXIT_FELLED_BY_THROWN_ITEM, + DUNGEON_EXIT_TRANSFORMED_INTO_ITEM, + DUNGEON_EXIT_FAINTED_FROM_BEING_KNOCKED, + DUNGEON_EXIT_FELLED_BY_POKEMON_FLYING, + DUNGEON_EXIT_GAVE_UP_EXPLORATION, + DUNGEON_EXIT_DELETED_FOR_EVENT, + DUNGEON_EXIT_WENT_AWAY, + DUNGEON_EXIT_BLOWN_OUT_UNSEEN_FORCE, + DUNGEON_EXIT_RETURNED_WITH_FALLEN_PARTNER, + DUNGEON_EXIT_FAINTED_DUE_TO_WEATHER, + DUNGEON_EXIT_WAS_POSSESSED, + DUNGEON_EXIT_FAILED_TO_PROTECT_CLIENT, + DUNGEON_EXIT_FAINTED_FROM_WONDER_ORB, + DUNGEON_EXIT_FAINTED_FROM_ITEM, + DUNGEON_EXIT_UNUSED_549, + + DUNGEON_EXIT_ESCAPED_MIDDLE_OF_EXPLORATION = DUNGEON_EXIT_REASON_SUCCESS, + DUNGEON_EXIT_CLEARED_DUNGEON, + DUNGEON_EXIT_SUCCEEDED_IN_RESCUE_MISSION, + DUNGEON_EXIT_IMPRESSIVELY_COMPLETED_MISSION, + DUNGEON_EXIT_BEFRIENDED_MEW, +}; + +#define NUM_DUNGEON_EXIT_REASONS 55 + +#endif diff --git a/include/constants/residual_damage.h b/include/constants/residual_damage.h new file mode 100644 index 000000000..cebf27cd9 --- /dev/null +++ b/include/constants/residual_damage.h @@ -0,0 +1,31 @@ +#ifndef GUARD_CONSTANTS_RESIDUAL_DAMAGE_H +#define GUARD_CONSTANTS_RESIDUAL_DAMAGE_H + +enum ResidualDamageType +{ + RESIDUAL_DAMAGE_REGULAR, + RESIDUAL_DAMAGE_BURN, + RESIDUAL_DAMAGE_CONSTRICT, + RESIDUAL_DAMAGE_POISON, + RESIDUAL_DAMAGE_UNUSED_4, + RESIDUAL_DAMAGE_WRAP, + RESIDUAL_DAMAGE_COUNTERATTACK, + RESIDUAL_DAMAGE_CURSE, + RESIDUAL_DAMAGE_NIGHTMARE, + RESIDUAL_DAMAGE_LEECH_SEED, + RESIDUAL_DAMAGE_SPIKES, + RESIDUAL_DAMAGE_PERISH_SONG, + RESIDUAL_DAMAGE_DESTINY_BOND, + RESIDUAL_DAMAGE_LIQUID_OOZE, + RESIDUAL_DAMAGE_HUNGER, + RESIDUAL_DAMAGE_CHESTNUT_TRAP, + RESIDUAL_DAMAGE_UNUSED_16, + RESIDUAL_DAMAGE_PITFALL, + RESIDUAL_DAMAGE_BAD_WEATHER, + RESIDUAL_DAMAGE_MOVE_FAIL, + RESIDUAL_DAMAGE_RECOIL, + + NUM_RESIDUAL_DAMAGE_TYPES +}; + +#endif diff --git a/include/dungeon_8083AB0.h b/include/dungeon_8083AB0.h index 8a1b96a11..9b73786cc 100644 --- a/include/dungeon_8083AB0.h +++ b/include/dungeon_8083AB0.h @@ -4,7 +4,7 @@ #include "structs/dungeon_entity.h" void sub_8083AB0(s16 dungeonExitReason, Entity *target, Entity *entity); -bool8 sub_8083C24(void); +bool8 IsUnsuccessfulDungeonExit(void); bool8 sub_8083C50(void); bool8 sub_8083C88(u8 param_1); diff --git a/include/dungeon_config.h b/include/dungeon_config.h index 0b3ef2ac6..1494fe059 100644 --- a/include/dungeon_config.h +++ b/include/dungeon_config.h @@ -245,28 +245,6 @@ extern const struct CastformWeatherData gCastformByWeather[WEATHER_COUNT]; extern const s16 gTypeEffectivenessChart[NUM_TYPES][NUM_TYPES]; extern const s32 gEffectivenessChart[NUM_EFFECTIVENESS][NUM_EFFECTIVENESS]; -#define RESIDUAL_DAMAGE_REGULAR 0 -#define RESIDUAL_DAMAGE_BURN 1 -#define RESIDUAL_DAMAGE_CONSTRICT 2 -#define RESIDUAL_DAMAGE_POISON 3 -#define RESIDUAL_DAMAGE_UNUSED_4 4 -#define RESIDUAL_DAMAGE_WRAP 5 -#define RESIDUAL_DAMAGE_COUNTERATTACK 6 -#define RESIDUAL_DAMAGE_CURSE 7 -#define RESIDUAL_DAMAGE_NIGHTMARE 8 -#define RESIDUAL_DAMAGE_LEECH_SEED 9 -#define RESIDUAL_DAMAGE_SPIKES 10 -#define RESIDUAL_DAMAGE_PERISH_SONG 11 -#define RESIDUAL_DAMAGE_DESTINY_BOND 12 -#define RESIDUAL_DAMAGE_LIQUID_OOZE 13 -#define RESIDUAL_DAMAGE_HUNGER 14 -#define RESIDUAL_DAMAGE_CHESTNUT_TRAP 15 -#define RESIDUAL_DAMAGE_UNUSED_16 16 -#define RESIDUAL_DAMAGE_PITFALL 17 -#define RESIDUAL_DAMAGE_BAD_WEATHER 18 -#define RESIDUAL_DAMAGE_MOVE_FAIL 19 -#define RESIDUAL_DAMAGE_RECOIL 20 - #define BELLY_GO_DOWN_VALUES_COUNT 20 extern const s48_16 gBellyGoDownValues[BELLY_GO_DOWN_VALUES_COUNT]; @@ -274,6 +252,8 @@ extern const s48_16 gBellyGoDownValues[BELLY_GO_DOWN_VALUES_COUNT]; #define EMPTY_BELLY_ALERT_HURRY_EAT_SOMETHING 2 #define EMPTY_BELLY_ALERT_YOULL_FAINT 3 +#define MAX_EMPTY_BELLY_ALERT_STEPS 10 + #define WARP_SCARF_ACTIVATION_CHANCES_COUNT 20 extern const s16 gWarpScarfActivationChances[WARP_SCARF_ACTIVATION_CHANCES_COUNT]; diff --git a/include/dungeon_misc.h b/include/dungeon_misc.h index acba3edfe..01823c666 100644 --- a/include/dungeon_misc.h +++ b/include/dungeon_misc.h @@ -22,62 +22,6 @@ struct unkStruct_8069D4C HiddenPower hiddenPower; }; -#define DUNGEON_EXIT_TRANSFORMED_INTO_FRIEND 0x1f4 -#define DUNGEON_EXIT_LEFT_WITHOUT_BEING_BEFRIENDED 0x1f5 -#define DUNGEON_EXIT_FAINTED_FROM_DEBUG_ATTACK 0x1f6 -#define DUNGEON_EXIT_MISSED_JUMP_KICK 0x1f7 -#define DUNGEON_EXIT_MISSED_HI_JUMP_KICK 0x1f8 -#define DUNGEON_EXIT_FAINTED_FROM_DESTINY_BOND 0x1f9 -#define DUNGEON_EXIT_FAINTED_COVERED_IN_SLUDGE 0x1fa -#define DUNGEON_EXIT_UNUSED_507 0x1fb -#define DUNGEON_EXIT_UNUSED_508 0x1fc -#define DUNGEON_EXIT_FAINTED_FROM_RECOIL 0x1fd -#define DUNGEON_EXIT_FAINTED_FROM_DAMAGE_BOUNCING 0x1fe -#define DUNGEON_EXIT_DEFEATED_PENT_UP_ENERGY 0x1ff -#define DUNGEON_EXIT_UNUSED_512 0x200 -#define DUNGEON_EXIT_UNUSED_513 0x201 -#define DUNGEON_EXIT_UNUSED_514 0x202 -#define DUNGEON_EXIT_UNUSED_515 0x203 -#define DUNGEON_EXIT_UNUSED_516 0x204 -#define DUNGEON_EXIT_UNUSED_517 0x205 -#define DUNGEON_EXIT_FAINTED_FROM_SPIKES 0x206 -#define DUNGEON_EXIT_DEBUG_DAMAGE 0x207 -#define DUNGEON_EXIT_FAINTED_FROM_BURN 0x208 -#define DUNGEON_EXIT_FAINTED_FROM_CONSTRICTION 0x209 -#define DUNGEON_EXIT_FAINTED_FROM_POISON 0x20a -#define DUNGEON_EXIT_FAINTED_FROM_WRAP 0x20b -#define DUNGEON_EXIT_FELLED_BY_CURSE 0x20c -#define DUNGEON_EXIT_DRAINED_BY_LEECH_SEED 0x20d -#define DUNGEON_EXIT_FAINTED_FROM_PERISH_SONG 0x20e -#define DUNGEON_EXIT_FAINTED_WHILE_IN_NIGHTMARE 0x20f -#define DUNGEON_EXIT_FELLED_BY_THROWN_ROCK 0x210 -#define DUNGEON_EXIT_FAINTED_FROM_HUNGER 0x211 -#define DUNGEON_EXIT_DISAPPEARED_IN_EXPLOSION 0x212 -#define DUNGEON_EXIT_TRIPPED_CHESTNUT_TRAP 0x213 -#define DUNGEON_EXIT_FAINTED_DUE_TO_TRAP 0x214 -#define DUNGEON_EXIT_FELL_INTO_PITFALL 0x215 -#define DUNGEON_EXIT_DEFEATED_BLAST_SEED 0x216 -#define DUNGEON_EXIT_FELLED_BY_THROWN_ITEM 0x217 -#define DUNGEON_EXIT_TRANSFORMED_INTO_ITEM 0x218 -#define DUNGEON_EXIT_FAINTED_FROM_BEING_KNOCKED 0x219 -#define DUNGEON_EXIT_FELLED_BY_POKEMON_FLYING 0x21a -#define DUNGEON_EXIT_GAVE_UP_EXPLORATION 0x21b -#define DUNGEON_EXIT_DELETED_FOR_EVENT 0x21c -#define DUNGEON_EXIT_WENT_AWAY 0x21d -#define DUNGEON_EXIT_BLOWN_OUT_UNSEEN_FORCE 0x21e -#define DUNGEON_EXIT_RETURNED_WITH_FALLEN_PARTNER 0x21f -#define DUNGEON_EXIT_FAINTED_DUE_TO_WEATHER 0x220 -#define DUNGEON_EXIT_WAS_POSSESSED 0x221 -#define DUNGEON_EXIT_FAILED_TO_PROTECT_CLIENT 0x222 -#define DUNGEON_EXIT_FAINTED_FROM_WONDER_ORB 0x223 -#define DUNGEON_EXIT_FAINTED_FROM_ITEM 0x224 -#define DUNGEON_EXIT_UNK 0x225 -#define DUNGEON_EXIT_ESCAPED_MIDDLE_OF_EXPLORATION 0x226 -#define DUNGEON_EXIT_CLEARED_DUNGEON 0x227 -#define DUNGEON_EXIT_SUCCEEDED_IN_RESCUE_MISSION 0x228 -#define DUNGEON_EXIT_IMPRESSIVELY_COMPLETED_MISSION 0x229 -#define DUNGEON_EXIT_BEFRIENDED_MEW 0x22a - void OpenDungeonPaletteFile(void); void CloseDungeonPaletteFile(void); void LoadDungeonPokemonSprites(void); diff --git a/include/dungeon_run_end.h b/include/dungeon_run_end.h index d7bac0973..dc411a648 100644 --- a/include/dungeon_run_end.h +++ b/include/dungeon_run_end.h @@ -3,7 +3,7 @@ #include "structs/str_dungeon.h" -void PrintOnDungeonFinishedWindow(u32 windowId, const u8 *headerText, UnkDungeonGlobal_unk1CE98_sub *param_3); +void PrintOnDungeonFinishedWindow(u32 windowId, const u8 *headerText, DungeonExitSummary *param_3); s16 GetDungeonExitReasonFromMoveOrItemID(u16 moveID, u8 id); #endif diff --git a/include/dungeon_strings.h b/include/dungeon_strings.h index b9ebcb6b3..af1bd3f4f 100644 --- a/include/dungeon_strings.h +++ b/include/dungeon_strings.h @@ -2,6 +2,7 @@ #define GUARD_DUNGEON_STRINGS_H #include "structs/str_item_text.h" +#include "constants/residual_damage.h" #include "constants/trap.h" #include "constants/weather.h" @@ -134,7 +135,7 @@ extern const u8 *const gUnknown_80F970C; extern const u8 *const gUnknown_80F9728; extern const u8 *const gUnknown_80F9740; extern const u8 *const gUnknown_80F9760; -extern const u8 *const gUnknown_80F9764[]; +extern const u8 *const gResidualDamageMessages[NUM_RESIDUAL_DAMAGE_TYPES]; extern const u8 *const gWeatherNames[WEATHER_COUNT]; extern const u8 *const gUnknown_80F9ACC; extern const u8 *const gUnknown_80F9AEC; diff --git a/include/strings.h b/include/strings.h index abf15e291..3b5c88e62 100644 --- a/include/strings.h +++ b/include/strings.h @@ -6,6 +6,7 @@ #include "constants/type.h" #include "constants/ability.h" #include "constants/dungeon.h" +#include "constants/dungeon_exit.h" #include "constants/iq_skill.h" #include "constants/tactic.h" #include "constants/friend_area.h" @@ -77,7 +78,7 @@ extern const u8 *const gIQSkillNames[NUM_IQ_SKILLS]; extern const u8 *const gIQSkillDescriptions[NUM_IQ_SKILLS]; extern const u8 *const gTacticsNames[NUM_TACTICS]; extern const u8 *const gTacticsDescriptions[NUM_TACTICS + 12]; -extern const struct unkStruct_8113080 gSpecialDeathTexts[55]; +extern const struct unkStruct_8113080 gDungeonExitReasonTexts[NUM_DUNGEON_EXIT_REASONS]; extern const u8 *const gText_DeathToMove; extern const u8 *const gText_AlignPlaceX; extern const u8 *const gText_Pokemon1WasDefeatedBy; diff --git a/include/structs/str_dungeon.h b/include/structs/str_dungeon.h index b8e7a7b5f..a18972e69 100644 --- a/include/structs/str_dungeon.h +++ b/include/structs/str_dungeon.h @@ -35,11 +35,11 @@ typedef struct Weather // 0xE264 } Weather; // size: 0x30 -typedef struct UnkDungeonGlobal_unk1CE98_sub +typedef struct DungeonExitSummary { /* 0x0 */ u8 buffer1[10]; /* 0xA */ u8 buffer2[10]; - /* 0x14 */ s16 moveID; + /* 0x14 */ s16 exitReason; // which move knocked out player, or reason to exit dungeon /* 0x16 */ u8 fill16[0x2]; /* 0x18 */ DungeonLocation dungeonLocation; /* 0x1C */ Item heldItem; @@ -55,7 +55,7 @@ typedef struct UnkDungeonGlobal_unk1CE98_sub /* 0x2D */ u8 defBoost; /* 0x2E */ u8 spDefBoost; u8 unk2F; // speedBoost? -} UnkDungeonGlobal_unk1CE98_sub; +} DungeonExitSummary; // size: 0x10 typedef struct DungeonMusicPlayer @@ -482,7 +482,7 @@ typedef struct Dungeon /* 0x1C590 */ ItemSpawns itemSpawns[ITEM_SPAWN_TYPES_COUNT]; /* 0x1CD70 */ u16 trapSpawnChances[NUM_TRAPS]; SpawnPokemonData fileMonsterSpawns[MONSTER_SPAWNS_ARR_COUNT]; // Taken directly from "mapparam" which corresponds to available monsters on given dungeon's floor. - UnkDungeonGlobal_unk1CE98_sub unk1CE98; // TODO: not sure how large this is + DungeonExitSummary exitSummary; // TODO: not sure how large this is u8 unk1CEC8; /* 0x1CECC */ DungeonMusicPlayer musPlayer; } Dungeon; diff --git a/src/blow_away.c b/src/blow_away.c index 53e847bd9..5feae8e0e 100644 --- a/src/blow_away.c +++ b/src/blow_away.c @@ -2,6 +2,8 @@ #include "globaldata.h" #include "blow_away.h" #include "constants/ability.h" +#include "constants/dungeon_exit.h" +#include "constants/residual_damage.h" #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" diff --git a/src/code_8066D04.c b/src/code_8066D04.c index 6b185bbff..a0b0d378d 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -1,6 +1,7 @@ #include "global.h" #include "globaldata.h" #include "constants/dungeon.h" +#include "constants/dungeon_exit.h" #include "constants/item.h" #include "constants/move_id.h" #include "dungeon_vram.h" diff --git a/src/code_806FDF4.c b/src/code_806FDF4.c index 65aca0d34..a3b789a6f 100644 --- a/src/code_806FDF4.c +++ b/src/code_806FDF4.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "constants/dungeon_exit.h" #include "constants/type.h" #include "structs/str_pokemon.h" #include "dungeon_main.h" diff --git a/src/dungeon_8083AB0.c b/src/dungeon_8083AB0.c index c9e02eb37..040fc1d1b 100644 --- a/src/dungeon_8083AB0.c +++ b/src/dungeon_8083AB0.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "constants/dungeon_exit.h" #include "dungeon_8083AB0.h" #include "dungeon_info.h" #include "dungeon_util.h" @@ -18,11 +19,11 @@ void sub_8083AB0(s16 dungeonExitReason_, Entity *target, Entity *entity) EntityInfo * targetEntityInfo; u8 *spAttPtr; u8 buffer [0x14]; - UnkDungeonGlobal_unk1CE98_sub *temp; + DungeonExitSummary *exitSummary; u8 *id; s32 dungeonExitReason = dungeonExitReason_; - temp = &gDungeon->unk1CE98; + exitSummary = &gDungeon->exitSummary; targetEntityInfo = NULL; if ((EntityIsValid(target)) && (GetEntityType(target) == ENTITY_MONSTER)) { targetEntityInfo = GetEntInfo(target); @@ -30,30 +31,30 @@ void sub_8083AB0(s16 dungeonExitReason_, Entity *target, Entity *entity) entityInfo = GetEntInfo(entity); if (targetEntityInfo != NULL) { sub_80709C8(buffer, targetEntityInfo); - CopyStringtoBuffer(temp->buffer1, buffer); + CopyStringtoBuffer(exitSummary->buffer1, buffer); } else { - CopyStringtoBuffer(temp->buffer1, gUnknown_80FE6F4); // Someone + CopyStringtoBuffer(exitSummary->buffer1, gUnknown_80FE6F4); // Someone } sub_80709C8(buffer,entityInfo); - CopyStringtoBuffer(temp->buffer2, buffer); - temp->moveID = dungeonExitReason; - temp->heldItem = entityInfo->heldItem; - temp->exp = entityInfo->exp; - temp->level = entityInfo->level; - temp->maxHPStat = entityInfo->maxHPStat; - temp->atk = entityInfo->atk[0]; - temp->spAtk = entityInfo->atk[1]; - temp->def = entityInfo->def[0]; - temp->spDef = entityInfo->def[1]; - temp->dungeonLocation = gDungeon->unk644.dungeonLocation; - attackPtr = &temp->attBoost; + CopyStringtoBuffer(exitSummary->buffer2, buffer); + exitSummary->exitReason = dungeonExitReason; + exitSummary->heldItem = entityInfo->heldItem; + exitSummary->exp = entityInfo->exp; + exitSummary->level = entityInfo->level; + exitSummary->maxHPStat = entityInfo->maxHPStat; + exitSummary->atk = entityInfo->atk[0]; + exitSummary->spAtk = entityInfo->atk[1]; + exitSummary->def = entityInfo->def[0]; + exitSummary->spDef = entityInfo->def[1]; + exitSummary->dungeonLocation = gDungeon->unk644.dungeonLocation; + attackPtr = &exitSummary->attBoost; *attackPtr = 0; - spAttPtr = &temp->spAttBoost; + spAttPtr = &exitSummary->spAttBoost; *spAttPtr = 0; - defPtr = &temp->defBoost; + defPtr = &exitSummary->defBoost; *defPtr = 0; - spDefPtr = &temp->spDefBoost; + spDefPtr = &exitSummary->spDefBoost; *spDefPtr = 0; if ((entityInfo->heldItem.flags & ITEM_FLAG_EXISTS) && !(entityInfo->heldItem.flags & ITEM_FLAG_STICKY)) { id = &entityInfo->heldItem.id; @@ -78,11 +79,11 @@ void sub_8083AB0(s16 dungeonExitReason_, Entity *target, Entity *entity) } } -bool8 sub_8083C24(void) +bool8 IsUnsuccessfulDungeonExit(void) { - UnkDungeonGlobal_unk1CE98_sub *temp = &gDungeon->unk1CE98; + DungeonExitSummary *exitSummary = &gDungeon->exitSummary; - if (temp->moveID < 0x226) + if (exitSummary->exitReason < DUNGEON_EXIT_REASON_SUCCESS) return TRUE; return FALSE; @@ -90,9 +91,11 @@ bool8 sub_8083C24(void) bool8 sub_8083C50(void) { - UnkDungeonGlobal_unk1CE98_sub *temp = &gDungeon->unk1CE98; + DungeonExitSummary *exitSummary = &gDungeon->exitSummary; - if (temp->moveID == 0x227 || temp->moveID == 0x22A || temp->moveID == 0x228) + if (exitSummary->exitReason == DUNGEON_EXIT_CLEARED_DUNGEON + || exitSummary->exitReason == DUNGEON_EXIT_BEFRIENDED_MEW + || exitSummary->exitReason == DUNGEON_EXIT_SUCCEEDED_IN_RESCUE_MISSION) return TRUE; return FALSE; @@ -100,10 +103,10 @@ bool8 sub_8083C50(void) bool8 sub_8083C88(u8 param_1) { - UnkDungeonGlobal_unk1CE98_sub *temp = &gDungeon->unk1CE98; + DungeonExitSummary *exitSummary = &gDungeon->exitSummary; if ((!HasCheckpoint(gDungeon->unk644.dungeonLocation.id) && (gDungeon->unk644.unk18 != 0 || param_1 != 0)) - || temp->moveID != 0x227) { + || exitSummary->exitReason != DUNGEON_EXIT_CLEARED_DUNGEON) { return TRUE; } diff --git a/src/dungeon_cleared_window.c b/src/dungeon_cleared_window.c index ee77b23f7..23a23096c 100644 --- a/src/dungeon_cleared_window.c +++ b/src/dungeon_cleared_window.c @@ -37,13 +37,13 @@ void ShowDungeonClearedWindow(void) header.f3 = 0; windows.id[0].pos.y = 20; DungeonShowWindows(&windows, TRUE); - if (gDungeon->unk1CE98.moveID > 549) { + if (gDungeon->exitSummary.exitReason > 549) { PlayDungeonCompleteBGM(); } else { PlayDungeonFailBGM(); } - PrintOnDungeonFinishedWindow(0, gText_TheLastOuting,&gDungeon->unk1CE98); + PrintOnDungeonFinishedWindow(0, gText_TheLastOuting,&gDungeon->exitSummary); while(1) { sub_803E668(0x36); UpdateDungeonMusic(); diff --git a/src/dungeon_cutscene.c b/src/dungeon_cutscene.c index 81e0f992b..5f875a128 100644 --- a/src/dungeon_cutscene.c +++ b/src/dungeon_cutscene.c @@ -5,6 +5,7 @@ #include "constants/dungeon.h" #include "constants/direction.h" #include "constants/dungeon.h" +#include "constants/dungeon_exit.h" #include "structs/str_dungeon.h" #include "structs/sprite_oam.h" #include "dungeon_cutscenes.h" diff --git a/src/dungeon_cutscene_articuno.c b/src/dungeon_cutscene_articuno.c index d575da8e0..147bbcd0d 100644 --- a/src/dungeon_cutscene_articuno.c +++ b/src/dungeon_cutscene_articuno.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_celebi.c b/src/dungeon_cutscene_celebi.c index 35cddc50e..fe27c7e6e 100644 --- a/src/dungeon_cutscene_celebi.c +++ b/src/dungeon_cutscene_celebi.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_deoxys.c b/src/dungeon_cutscene_deoxys.c index cdcc6fa23..9d9b98acf 100644 --- a/src/dungeon_cutscene_deoxys.c +++ b/src/dungeon_cutscene_deoxys.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_entei.c b/src/dungeon_cutscene_entei.c index b91c29e7f..fa989ef28 100644 --- a/src/dungeon_cutscene_entei.c +++ b/src/dungeon_cutscene_entei.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_groudon.c b/src/dungeon_cutscene_groudon.c index a709dc791..4417f7c1f 100644 --- a/src/dungeon_cutscene_groudon.c +++ b/src/dungeon_cutscene_groudon.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_hooh.c b/src/dungeon_cutscene_hooh.c index b0877952f..b28a18585 100644 --- a/src/dungeon_cutscene_hooh.c +++ b/src/dungeon_cutscene_hooh.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_jirachi.c b/src/dungeon_cutscene_jirachi.c index 14280bc08..5e6552470 100644 --- a/src/dungeon_cutscene_jirachi.c +++ b/src/dungeon_cutscene_jirachi.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_kyogre.c b/src/dungeon_cutscene_kyogre.c index 06d8c3052..b6457b815 100644 --- a/src/dungeon_cutscene_kyogre.c +++ b/src/dungeon_cutscene_kyogre.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_latios.c b/src/dungeon_cutscene_latios.c index 1c0c7ebcf..1fbd51e26 100644 --- a/src/dungeon_cutscene_latios.c +++ b/src/dungeon_cutscene_latios.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_lugia.c b/src/dungeon_cutscene_lugia.c index bb2776c6f..345fee538 100644 --- a/src/dungeon_cutscene_lugia.c +++ b/src/dungeon_cutscene_lugia.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_magma_cavern.c b/src/dungeon_cutscene_magma_cavern.c index c9605e438..baf8e1fcf 100644 --- a/src/dungeon_cutscene_magma_cavern.c +++ b/src/dungeon_cutscene_magma_cavern.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_mankey.c b/src/dungeon_cutscene_mankey.c index f352d8e05..b535b7124 100644 --- a/src/dungeon_cutscene_mankey.c +++ b/src/dungeon_cutscene_mankey.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_medicham.c b/src/dungeon_cutscene_medicham.c index e64fcb1f6..935419742 100644 --- a/src/dungeon_cutscene_medicham.c +++ b/src/dungeon_cutscene_medicham.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_mewtwo.c b/src/dungeon_cutscene_mewtwo.c index 2281ffff0..5f7b07ef0 100644 --- a/src/dungeon_cutscene_mewtwo.c +++ b/src/dungeon_cutscene_mewtwo.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_moltres.c b/src/dungeon_cutscene_moltres.c index 4512b75cc..1c2f5b5e5 100644 --- a/src/dungeon_cutscene_moltres.c +++ b/src/dungeon_cutscene_moltres.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_raikou.c b/src/dungeon_cutscene_raikou.c index 7f6b08fdd..5a534c112 100644 --- a/src/dungeon_cutscene_raikou.c +++ b/src/dungeon_cutscene_raikou.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_rayquaza.c b/src/dungeon_cutscene_rayquaza.c index 9f5b4e55f..d74f34ac9 100644 --- a/src/dungeon_cutscene_rayquaza.c +++ b/src/dungeon_cutscene_rayquaza.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_regis.c b/src/dungeon_cutscene_regis.c index 8ddc46a3c..83c129ba8 100644 --- a/src/dungeon_cutscene_regis.c +++ b/src/dungeon_cutscene_regis.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_skarmory.c b/src/dungeon_cutscene_skarmory.c index 0e78dd1f8..7698b9e80 100644 --- a/src/dungeon_cutscene_skarmory.c +++ b/src/dungeon_cutscene_skarmory.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_smeargle.c b/src/dungeon_cutscene_smeargle.c index 54ad0fd32..00040ad5c 100644 --- a/src/dungeon_cutscene_smeargle.c +++ b/src/dungeon_cutscene_smeargle.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_suicune.c b/src/dungeon_cutscene_suicune.c index 4a6caff57..024e373e1 100644 --- a/src/dungeon_cutscene_suicune.c +++ b/src/dungeon_cutscene_suicune.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_cutscene_zapdos.c b/src/dungeon_cutscene_zapdos.c index 3f9d3b392..5275c0151 100644 --- a/src/dungeon_cutscene_zapdos.c +++ b/src/dungeon_cutscene_zapdos.c @@ -8,6 +8,7 @@ #include "code_806CD90.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/dungeon_exit.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index 0e9759fc0..e83f4e875 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -8,8 +8,10 @@ #include "pokemon_types.h" #include "dungeon_message.h" #include "string_format.h" +#include "constants/dungeon_exit.h" #include "constants/move_id.h" #include "constants/monster.h" +#include "constants/residual_damage.h" #include "constants/status.h" #include "constants/type.h" #include "constants/iq_skill.h" @@ -366,7 +368,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc const u8 *str; gFormatArgs[0] = dmgStruct->dmg; - str = gUnknown_80F9764[dmgStruct->residualDmgType]; + str = gResidualDamageMessages[dmgStruct->residualDmgType]; ASM_MATCH_TRICK(dmgStruct); diff --git a/src/dungeon_item_action.c b/src/dungeon_item_action.c index 823d65c02..cb0af702e 100644 --- a/src/dungeon_item_action.c +++ b/src/dungeon_item_action.c @@ -7,6 +7,8 @@ #include "dungeon_random.h" #include "constants/dungeon_action.h" #include "constants/dungeon.h" +#include "constants/dungeon_exit.h" +#include "constants/residual_damage.h" #include "constants/iq_skill.h" #include "constants/status.h" #include "constants/type.h" diff --git a/src/dungeon_jobs.c b/src/dungeon_jobs.c index baa21895e..5ee8e153e 100644 --- a/src/dungeon_jobs.c +++ b/src/dungeon_jobs.c @@ -14,6 +14,7 @@ #include "pokemon.h" #include "structs/str_dungeon.h" #include "constants/dungeon.h" +#include "constants/dungeon_exit.h" extern void sub_8042A34(DungeonPos *r0); extern void sub_804178C(u32); diff --git a/src/dungeon_menu_others.c b/src/dungeon_menu_others.c index 1bc9ecc79..a96af0300 100644 --- a/src/dungeon_menu_others.c +++ b/src/dungeon_menu_others.c @@ -1,6 +1,7 @@ #include "global.h" #include "globaldata.h" #include "code_803D110.h" +#include "constants/dungeon_exit.h" #include "dungeon_vram.h" #include "dungeon_tilemap.h" #include "dungeon_action.h" diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index 3c16bdead..b739d4637 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -23,6 +23,7 @@ #include "constants/friend_area.h" #include "constants/status.h" #include "constants/ability.h" +#include "constants/dungeon_exit.h" #include "constants/iq_skill.h" #include "constants/type.h" #include "constants/weather.h" diff --git a/src/dungeon_move_util.c b/src/dungeon_move_util.c index 6f6cb8010..befeb1e8f 100644 --- a/src/dungeon_move_util.c +++ b/src/dungeon_move_util.c @@ -394,7 +394,7 @@ bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, gUnknown_202F21A = 0; gUnknown_202F21C = 0; gUnknown_202F220 = 0; - if (isLinkedMove && GetEntInfo(attacker)->usedLinkedMovesCounter <= 3) { + if (isLinkedMove && GetEntInfo(attacker)->usedLinkedMovesCounter < MAX_MON_MOVES) { GetEntInfo(attacker)->usedLinkedMovesCounter++; } diff --git a/src/dungeon_run_end.c b/src/dungeon_run_end.c index 78bc343fb..ab0fb73ff 100644 --- a/src/dungeon_run_end.c +++ b/src/dungeon_run_end.c @@ -2,6 +2,7 @@ #include "globaldata.h" #include "dungeon_misc.h" #include "dungeon_run_end.h" +#include "constants/dungeon_exit.h" #include "structs/str_dungeon.h" #include "data_serializer.h" #include "dungeon_info.h" @@ -21,30 +22,30 @@ static void WriteDeathText(s16 moveID, u8 *buffer) s32 moveID_s32 = moveID; Move move; - if (moveID_s32 < 0x1F4) { + if (moveID_s32 < DUNGEON_EXIT_REASON_START) { // Needed this cast/variable to match moveID_u16 = moveID_s32; InitPokemonMoveOrNullObject(&move, moveID_u16); BufferMoveName(gFormatBuffer_Items[0], &move, NULL); FormatString(gText_DeathToMove, buffer, buffer + TEXT_BUFFER_LEN, 0); // $m0's $i0 } else { - strncpy(buffer, gSpecialDeathTexts[moveID - 0x1F4].text, TEXT_BUFFER_LEN); + strncpy(buffer, gDungeonExitReasonTexts[moveID - DUNGEON_EXIT_REASON_START].text, TEXT_BUFFER_LEN); } } static bool8 WasDefeatedByMove(s16 moveID) { - if(moveID < 0x1F4) + if (moveID < DUNGEON_EXIT_REASON_START) { return TRUE; } else { - return gSpecialDeathTexts[moveID - 0x1F4].unk0; + return gDungeonExitReasonTexts[moveID - DUNGEON_EXIT_REASON_START].unk0; } } -void PrintOnDungeonFinishedWindow(u32 windowId, const u8 *headerText, UnkDungeonGlobal_unk1CE98_sub *param_3) +void PrintOnDungeonFinishedWindow(u32 windowId, const u8 *headerText, DungeonExitSummary *exitSummary) { u8 buffer[TEXT_BUFFER_LEN]; s32 x, y; @@ -52,12 +53,12 @@ void PrintOnDungeonFinishedWindow(u32 windowId, const u8 *headerText, UnkDungeon sub_80073B8(windowId); PrintFormattedStringOnWindow(16,0,headerText,windowId,0); - PrintYellowDungeonNametoBuffer(gFormatBuffer_Monsters[0], ¶m_3->dungeonLocation); + PrintYellowDungeonNametoBuffer(gFormatBuffer_Monsters[0], &exitSummary->dungeonLocation); PrintFormattedStringOnWindow(4,16,gText_AlignPlaceX,windowId,0); // #+Place: $m0 y = 26; - StrncpyCustom(gFormatBuffer_Monsters[0], param_3->buffer1, POKEMON_NAME_LENGTH); - StrncpyCustom(gFormatBuffer_Monsters[1], param_3->buffer2, POKEMON_NAME_LENGTH); - if (WasDefeatedByMove(param_3->moveID) != 0) { + StrncpyCustom(gFormatBuffer_Monsters[0], exitSummary->buffer1, POKEMON_NAME_LENGTH); + StrncpyCustom(gFormatBuffer_Monsters[1], exitSummary->buffer2, POKEMON_NAME_LENGTH); + if (WasDefeatedByMove(exitSummary->exitReason) != 0) { // $m1 was defeated by FormatString(gText_Pokemon1WasDefeatedBy,buffer, buffer + sizeof(buffer),0); } @@ -70,14 +71,14 @@ void PrintOnDungeonFinishedWindow(u32 windowId, const u8 *headerText, UnkDungeon PrintFormattedStringOnWindow(x,y,buffer,windowId,0); y += 10; - WriteDeathText(param_3->moveID, buffer); + WriteDeathText(exitSummary->exitReason, buffer); x = (176 - GetStringLineWidth(buffer)) / 2; PrintFormattedStringOnWindow(x,y,buffer,windowId,0); y += 16; - gFormatArgs[0] = param_3->exp; - gFormatArgs[1] = param_3->level; + gFormatArgs[0] = exitSummary->exp; + gFormatArgs[1] = exitSummary->level; if (gFormatArgs[1] >= 100) { PrintFormattedStringOnWindow(4,y,gUnknown_81138C0,windowId,0); } @@ -85,45 +86,45 @@ void PrintOnDungeonFinishedWindow(u32 windowId, const u8 *headerText, UnkDungeon PrintFormattedStringOnWindow(4,y,gUnknown_8113898,windowId,0); } y += 10; - gFormatArgs[0] = param_3->maxHPStat; + gFormatArgs[0] = exitSummary->maxHPStat; PrintFormattedStringOnWindow(4,y,gUnknown_81138D0,windowId,0); y += 10; - gFormatArgs[0] = param_3->atk; - gFormatArgs[1] = param_3->def; - if (param_3->attBoost) { - gFormatArgs[0] = gFormatArgs[0] + param_3->attBoost; + gFormatArgs[0] = exitSummary->atk; + gFormatArgs[1] = exitSummary->def; + if (exitSummary->attBoost) { + gFormatArgs[0] = gFormatArgs[0] + exitSummary->attBoost; PrintFormattedStringOnWindow(4,y,gUnknown_8113950,windowId,0); } else { PrintFormattedStringOnWindow(4,y,gUnknown_81138E4,windowId,0); } - if (param_3->defBoost) { - gFormatArgs[1] = gFormatArgs[1] + param_3->defBoost; + if (exitSummary->defBoost) { + gFormatArgs[1] = gFormatArgs[1] + exitSummary->defBoost; PrintFormattedStringOnWindow(4,y,gUnknown_8113974,windowId,0); } else { PrintFormattedStringOnWindow(4,y,gUnknown_8113900,windowId,0); } y += 10; - gFormatArgs[0] = param_3->spAtk; - gFormatArgs[1] = param_3->spDef; - if (param_3->spAttBoost) { - gFormatArgs[0] = gFormatArgs[0] + param_3->spAttBoost; + gFormatArgs[0] = exitSummary->spAtk; + gFormatArgs[1] = exitSummary->spDef; + if (exitSummary->spAttBoost) { + gFormatArgs[0] = gFormatArgs[0] + exitSummary->spAttBoost; PrintFormattedStringOnWindow(4,y,gUnknown_8113990,windowId,0); } else { PrintFormattedStringOnWindow(4,y,gUnknown_8113918,windowId,0); } - if (param_3->spDefBoost) { - gFormatArgs[1] = gFormatArgs[1] + param_3->spDefBoost; + if (exitSummary->spDefBoost) { + gFormatArgs[1] = gFormatArgs[1] + exitSummary->spDefBoost; PrintFormattedStringOnWindow(4,y,gUnknown_81139B4,windowId,0); } else { PrintFormattedStringOnWindow(4,y,gUnknown_8113934,windowId,0); } y += 16; - item = &(param_3->heldItem); - if ((param_3->heldItem.flags & ITEM_FLAG_EXISTS)) { + item = &(exitSummary->heldItem); + if ((exitSummary->heldItem.flags & ITEM_FLAG_EXISTS)) { sub_8090E14(gFormatBuffer_Items[0],item,0); } else { diff --git a/src/dungeon_strings.c b/src/dungeon_strings.c index b02d716f5..ff7c05679 100644 --- a/src/dungeon_strings.c +++ b/src/dungeon_strings.c @@ -260,28 +260,29 @@ const u8 *const gUnknown_80F970C = _("{POKEMON_0} fell into the pitfall!"); const u8 *const gUnknown_80F9728 = _("Avoided the pitfall!"); const u8 *const gUnknown_80F9740 = _("{POKEMON_0} is famished."); const u8 *const gUnknown_80F9760 = _("{POKEMON_0} is already famished."); -const u8 *const gUnknown_80F9764[] = { - [0] = _("{POKEMON_1} took {VALUE_0} damage!"), - [1] = _("{POKEMON_1}'s burn inflicted\n{VALUE_0} damage!"), - [2] = _("{POKEMON_1} was squeezed for\n{VALUE_0} damage!"), - [3] = _("{POKEMON_1} took {VALUE_0} damage\nfrom poison!"), - [4] = _("{POKEMON_1} took {VALUE_0} damage!"), - [5] = _("{POKEMON_1} was wrapped for\n{VALUE_0} damage!"), - [6] = _("{POKEMON_1} took {VALUE_0} damage\nfrom the counterattack!"), - [7] = _("{POKEMON_1} was cursed for\n{VALUE_0} damage!"), - [8] = _("{POKEMON_1} awoke from its nightmare\nand took {VALUE_0} damage!"), - [9] = _("{POKEMON_1} took {VALUE_0} damage\nfrom Leech Seed!"), - [10] = _("{POKEMON_1} stepped on spikes for\n{VALUE_0} damage!"), - [11] = _("{POKEMON_1} took {VALUE_0} damage\nfrom Perish Song!"), - [12] = _("{POKEMON_1} took {VALUE_0} damage\nfrom Destiny Bond!"), - [13] = _("{POKEMON_1} was showered with sludge\nfor {VALUE_0} damage!"), - [14] = NULL, - [15] = _("The Chestnut Trap hit {POKEMON_1}\nfor {VALUE_0} damage!"), - [16] = _("The Chestnut Trap hit {POKEMON_1}\nfor {VALUE_0} damage!"), - [17] = _("{POKEMON_1} took {VALUE_0} damage!"), - [18] = _("The bad weather inflicted {VALUE_0} damage\non {POKEMON_1}!"), - [19] = _("The move failed!\n{POKEMON_1} took {VALUE_0} damage!"), - [20] = _("The recoil hit {POKEMON_1} for\n{VALUE_0} damage!"), + +const u8 *const gResidualDamageMessages[NUM_RESIDUAL_DAMAGE_TYPES] = { + [RESIDUAL_DAMAGE_REGULAR] = _("{POKEMON_1} took {VALUE_0} damage!"), + [RESIDUAL_DAMAGE_BURN] = _("{POKEMON_1}'s burn inflicted\n{VALUE_0} damage!"), + [RESIDUAL_DAMAGE_CONSTRICT] = _("{POKEMON_1} was squeezed for\n{VALUE_0} damage!"), + [RESIDUAL_DAMAGE_POISON] = _("{POKEMON_1} took {VALUE_0} damage\nfrom poison!"), + [RESIDUAL_DAMAGE_UNUSED_4] = _("{POKEMON_1} took {VALUE_0} damage!"), + [RESIDUAL_DAMAGE_WRAP] = _("{POKEMON_1} was wrapped for\n{VALUE_0} damage!"), + [RESIDUAL_DAMAGE_COUNTERATTACK] = _("{POKEMON_1} took {VALUE_0} damage\nfrom the counterattack!"), + [RESIDUAL_DAMAGE_CURSE] = _("{POKEMON_1} was cursed for\n{VALUE_0} damage!"), + [RESIDUAL_DAMAGE_NIGHTMARE] = _("{POKEMON_1} awoke from its nightmare\nand took {VALUE_0} damage!"), + [RESIDUAL_DAMAGE_LEECH_SEED] = _("{POKEMON_1} took {VALUE_0} damage\nfrom Leech Seed!"), + [RESIDUAL_DAMAGE_SPIKES] = _("{POKEMON_1} stepped on spikes for\n{VALUE_0} damage!"), + [RESIDUAL_DAMAGE_PERISH_SONG] = _("{POKEMON_1} took {VALUE_0} damage\nfrom Perish Song!"), + [RESIDUAL_DAMAGE_DESTINY_BOND] = _("{POKEMON_1} took {VALUE_0} damage\nfrom Destiny Bond!"), + [RESIDUAL_DAMAGE_LIQUID_OOZE] = _("{POKEMON_1} was showered with sludge\nfor {VALUE_0} damage!"), + [RESIDUAL_DAMAGE_HUNGER] = NULL, + [RESIDUAL_DAMAGE_CHESTNUT_TRAP] = _("The Chestnut Trap hit {POKEMON_1}\nfor {VALUE_0} damage!"), + [RESIDUAL_DAMAGE_UNUSED_16] = _("The Chestnut Trap hit {POKEMON_1}\nfor {VALUE_0} damage!"), + [RESIDUAL_DAMAGE_PITFALL] = _("{POKEMON_1} took {VALUE_0} damage!"), + [RESIDUAL_DAMAGE_BAD_WEATHER] = _("The bad weather inflicted {VALUE_0} damage\non {POKEMON_1}!"), + [RESIDUAL_DAMAGE_MOVE_FAIL] = _("The move failed!\n{POKEMON_1} took {VALUE_0} damage!"), + [RESIDUAL_DAMAGE_RECOIL] = _("The recoil hit {POKEMON_1} for\n{VALUE_0} damage!"), }; const u8 *const gWeatherNames[WEATHER_COUNT] = { diff --git a/src/dungeon_turn_effects.c b/src/dungeon_turn_effects.c index 137b402c1..e49e1a472 100644 --- a/src/dungeon_turn_effects.c +++ b/src/dungeon_turn_effects.c @@ -18,7 +18,9 @@ #include "moves.h" #include "dungeon_random.h" #include "constants/dungeon.h" +#include "constants/dungeon_exit.h" #include "constants/iq_skill.h" +#include "constants/residual_damage.h" #include "constants/status.h" #include "constants/ability.h" #include "constants/type.h" @@ -103,7 +105,7 @@ void ApplyEndOfTurnEffects(Entity *entity) baseBellyDecrementValue.hi = 0; baseBellyDecrementValue.lo = 6554; - // baseBellyDecrementValue = 0.1; + // here baseBellyDecrementValue is 0.1 F48_16_SMul(&modifiedBellyDecrementValue, &baseBellyDecrementValue, &gBellyGoDownValues[arrIndex]); if (entityInfo->usedLinkedMovesCounter > 1) modifiedBellyDecrementValue.lo += (gLinkedMovesBellyGoDownValues[entityInfo->usedLinkedMovesCounter] << 0x10); @@ -128,7 +130,7 @@ void ApplyEndOfTurnEffects(Entity *entity) DisplayActions(NULL); if (!EntityIsValid(entity) || IsFloorOver()) return; - if (gDungeon->unk644.emptyBellyAlert < 10) + if (gDungeon->unk644.emptyBellyAlert < MAX_EMPTY_BELLY_ALERT_STEPS) gDungeon->unk644.emptyBellyAlert++; if (gDungeon->unk644.emptyBellyAlert == EMPTY_BELLY_ALERT_YOUR_BELLYS_EMPTY) str = gUnknown_80FD5DC; // "Oh, no! Your Belly's empty!" diff --git a/src/dungeon_wind.c b/src/dungeon_wind.c index cfd1780e6..902b7eae9 100644 --- a/src/dungeon_wind.c +++ b/src/dungeon_wind.c @@ -4,6 +4,7 @@ #include "code_804267C.h" #include "dungeon_message.h" #include "constants/ability.h" +#include "constants/dungeon_exit.h" #include "constants/type.h" #include "dungeon_ai.h" #include "dungeon_range.h" diff --git a/src/explosion.c b/src/explosion.c index 6bef4964a..43f198fa4 100644 --- a/src/explosion.c +++ b/src/explosion.c @@ -2,6 +2,7 @@ #include "globaldata.h" #include "explosion.h" #include "constants/ability.h" +#include "constants/residual_damage.h" #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" diff --git a/src/hurl_orb.c b/src/hurl_orb.c index a9f1d13b6..0d41cee79 100644 --- a/src/hurl_orb.c +++ b/src/hurl_orb.c @@ -8,7 +8,9 @@ #include "code_806CD90.h" #include "code_8077274_1.h" #include "constants/ability.h" +#include "constants/dungeon_exit.h" #include "constants/monster.h" +#include "constants/residual_damage.h" #include "constants/type.h" #include "constants/weather.h" #include "dungeon_info.h" diff --git a/src/move_orb_actions_1.c b/src/move_orb_actions_1.c index 45a1875a5..dd6392101 100644 --- a/src/move_orb_actions_1.c +++ b/src/move_orb_actions_1.c @@ -8,6 +8,8 @@ #include "code_8077274_1.h" #include "dungeon_random.h" #include "constants/ability.h" +#include "constants/dungeon_exit.h" +#include "constants/residual_damage.h" #include "constants/status.h" #include "constants/targeting.h" #include "constants/type.h" diff --git a/src/move_orb_actions_2.c b/src/move_orb_actions_2.c index ae24c717c..27306687d 100644 --- a/src/move_orb_actions_2.c +++ b/src/move_orb_actions_2.c @@ -8,6 +8,8 @@ #include "code_8077274_1.h" #include "dungeon_random.h" #include "constants/ability.h" +#include "constants/dungeon_exit.h" +#include "constants/residual_damage.h" #include "constants/status.h" #include "constants/targeting.h" #include "constants/type.h" diff --git a/src/move_orb_actions_3.c b/src/move_orb_actions_3.c index 26bccee6d..c6861ff80 100644 --- a/src/move_orb_actions_3.c +++ b/src/move_orb_actions_3.c @@ -7,7 +7,9 @@ #include "code_8077274_1.h" #include "dungeon_random.h" #include "constants/ability.h" +#include "constants/dungeon_exit.h" #include "constants/move_id.h" +#include "constants/residual_damage.h" #include "constants/status.h" #include "constants/targeting.h" #include "constants/type.h" diff --git a/src/move_orb_actions_4.c b/src/move_orb_actions_4.c index acbe28243..e4d0c7aeb 100644 --- a/src/move_orb_actions_4.c +++ b/src/move_orb_actions_4.c @@ -11,7 +11,9 @@ #include "code_8077274_1.h" #include "dungeon_random.h" #include "constants/ability.h" +#include "constants/dungeon_exit.h" #include "constants/move_id.h" +#include "constants/residual_damage.h" #include "constants/status.h" #include "constants/targeting.h" #include "constants/type.h" diff --git a/src/move_orb_actions_5.c b/src/move_orb_actions_5.c index 1bd43ccc5..e4c443f37 100644 --- a/src/move_orb_actions_5.c +++ b/src/move_orb_actions_5.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "constants/dungeon_exit.h" #include "dungeon_info.h" #include "dungeon_move_util.h" #include "run_dungeon.h" diff --git a/src/move_orb_effects_5.c b/src/move_orb_effects_5.c index caf079637..1759e8566 100644 --- a/src/move_orb_effects_5.c +++ b/src/move_orb_effects_5.c @@ -8,7 +8,9 @@ #include "code_8077274_1.h" #include "dungeon_random.h" #include "constants/ability.h" +#include "constants/dungeon_exit.h" #include "constants/item.h" +#include "constants/residual_damage.h" #include "constants/status.h" #include "constants/type.h" #include "dungeon_items.h" diff --git a/src/run_dungeon.c b/src/run_dungeon.c index 6e709d1ac..eec8be2ec 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -2,6 +2,7 @@ #include "globaldata.h" #include "run_dungeon.h" #include "constants/dungeon.h" +#include "constants/dungeon_exit.h" #include "constants/monster.h" #include "constants/trap.h" #include "structs/rgb.h" @@ -623,7 +624,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) ShowDungeonClearedWindow(); } - if (sub_8083C24()) { + if (IsUnsuccessfulDungeonExit()) { if (gDungeon->unk6 != 0) { setupPtr->info.unk7C = -2; memset(&setupPtr->info.unk84, 0, sizeof(setupPtr->info.unk84)); diff --git a/src/strings.c b/src/strings.c index 2b6bdd8ec..5c75ccb54 100644 --- a/src/strings.c +++ b/src/strings.c @@ -859,62 +859,62 @@ const u8 *const gTacticsDescriptions[NUM_TACTICS + 12] = { [NUM_TACTICS ... NUM_TACTICS + 11] = NULL // Used for testing? }; -const struct unkStruct_8113080 gSpecialDeathTexts[55] = { - [0] = { 0, _("was transformed into a friend.")}, - [1] = { 0, _("left without being befriended.")}, - [2] = { 0, _("fainted from a debug attack.")}, - [3] = { 0, _("missed a Jump Kick and wiped out.")}, - [4] = { 0, _("missed a Hi Jump Kick and wiped out.")}, - [5] = { 0, _("fainted from the foe's Destiny Bond.")}, - [6] = { 0, _("fainted, covered in sludge.")}, - [7] = { 1, _("was defeated by a powerful move.")}, - [8] = { 1, _("was defeated by a powerful move.")}, - [9] = { 0, _("fainted from a move's recoil damage.")}, - [10] = { 0, _("fainted from damage it took bouncing.")}, - [11] = { 1, _("a foe's pent-up energy.")}, - [12] = { 1, _("was defeated by a powerful move.")}, - [13] = { 1, _("was defeated by a powerful move.")}, - [14] = { 1, _("was defeated by a powerful move.")}, - [15] = { 1, _("was defeated by a powerful move.")}, - [16] = { 1, _("was defeated by a powerful move.")}, - [17] = { 1, _("was defeated by a powerful move.")}, - [18] = { 0, _("fainted from stepping on spikes.")}, - [19] = { 0, _("debug damage.")}, - [20] = { 0, _("fainted from a bad burn.")}, - [21] = { 0, _("fainted, unable to bear constriction.")}, - [22] = { 0, _("fainted after the poison spread.")}, - [23] = { 0, _("fainted while still being wrapped.")}, - [24] = { 0, _("was felled by a curse.")}, - [25] = { 0, _("was drained to nothing by Leech Seed.")}, - [26] = { 0, _("fainted from hearing Perish Song.")}, - [27] = { 0, _("fainted while in a nightmare.")}, - [28] = { 0, _("was felled by a thrown rock.")}, - [29] = { 0, _("fainted from hunger.")}, - [30] = { 0, _("disappeared in an explosion.")}, - [31] = { 0, _("tripped a Chestnut Trap and fainted.")}, - [32] = { 0, _("fainted due to a trap's damage.")}, - [33] = { 0, _("fell into a Pitfall Trap and fainted.")}, - [34] = { 1, _("a Blast Seed's damage.")}, - [35] = { 0, _("was felled by a thrown item.")}, - [36] = { 0, _("was transformed into an item.")}, - [37] = { 0, _("fainted from being knocked flying.")}, - [38] = { 0, _("was felled by a Pokémon sent flying.")}, - [39] = { 0, _("gave up the exploration.")}, - [40] = { 0, _("was deleted for the sake of an event.")}, - [41] = { 0, _("went away.")}, - [42] = { 0, _("was blown out by an unseen force.")}, - [43] = { 0, _("returned with the fallen partner.")}, - [44] = { 0, _("fainted due to the weather.")}, - [45] = { 0, _("was possessed.")}, - [46] = { 0, _("failed to protect the client Pokémon.")}, - [47] = { 0, _("fainted from a Wonder Orb.")}, - [48] = { 0, _("fainted from an item.")}, - [49] = { 0, _("- ")}, - [50] = { 0, _("escaped in the middle of exploration.")}, - [51] = { 0, _("cleared the dungeon.")}, - [52] = { 0, _("succeeded in the rescue mission.")}, - [53] = { 0, _("impressively completed a mission.")}, - [54] = { 0, _("befriended Mew!")}, +const struct unkStruct_8113080 gDungeonExitReasonTexts[NUM_DUNGEON_EXIT_REASONS] = { + [DUNGEON_EXIT_TRANSFORMED_INTO_FRIEND - DUNGEON_EXIT_REASON_START] = { FALSE, _("was transformed into a friend.")}, + [DUNGEON_EXIT_LEFT_WITHOUT_BEING_BEFRIENDED - DUNGEON_EXIT_REASON_START] = { FALSE, _("left without being befriended.")}, + [DUNGEON_EXIT_FAINTED_FROM_DEBUG_ATTACK - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted from a debug attack.")}, + [DUNGEON_EXIT_MISSED_JUMP_KICK - DUNGEON_EXIT_REASON_START] = { FALSE, _("missed a Jump Kick and wiped out.")}, + [DUNGEON_EXIT_MISSED_HI_JUMP_KICK - DUNGEON_EXIT_REASON_START] = { FALSE, _("missed a Hi Jump Kick and wiped out.")}, + [DUNGEON_EXIT_FAINTED_FROM_DESTINY_BOND - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted from the foe's Destiny Bond.")}, + [DUNGEON_EXIT_FAINTED_COVERED_IN_SLUDGE - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted, covered in sludge.")}, + [DUNGEON_EXIT_UNUSED_507 - DUNGEON_EXIT_REASON_START] = { TRUE, _("was defeated by a powerful move.")}, + [DUNGEON_EXIT_UNUSED_508 - DUNGEON_EXIT_REASON_START] = { TRUE, _("was defeated by a powerful move.")}, + [DUNGEON_EXIT_FAINTED_FROM_RECOIL - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted from a move's recoil damage.")}, + [DUNGEON_EXIT_FAINTED_FROM_DAMAGE_BOUNCING - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted from damage it took bouncing.")}, + [DUNGEON_EXIT_DEFEATED_PENT_UP_ENERGY - DUNGEON_EXIT_REASON_START] = { TRUE, _("a foe's pent-up energy.")}, + [DUNGEON_EXIT_UNUSED_512 - DUNGEON_EXIT_REASON_START] = { TRUE, _("was defeated by a powerful move.")}, + [DUNGEON_EXIT_UNUSED_513 - DUNGEON_EXIT_REASON_START] = { TRUE, _("was defeated by a powerful move.")}, + [DUNGEON_EXIT_UNUSED_514 - DUNGEON_EXIT_REASON_START] = { TRUE, _("was defeated by a powerful move.")}, + [DUNGEON_EXIT_UNUSED_515 - DUNGEON_EXIT_REASON_START] = { TRUE, _("was defeated by a powerful move.")}, + [DUNGEON_EXIT_UNUSED_516 - DUNGEON_EXIT_REASON_START] = { TRUE, _("was defeated by a powerful move.")}, + [DUNGEON_EXIT_UNUSED_517 - DUNGEON_EXIT_REASON_START] = { TRUE, _("was defeated by a powerful move.")}, + [DUNGEON_EXIT_FAINTED_FROM_SPIKES - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted from stepping on spikes.")}, + [DUNGEON_EXIT_DEBUG_DAMAGE - DUNGEON_EXIT_REASON_START] = { FALSE, _("debug damage.")}, + [DUNGEON_EXIT_FAINTED_FROM_BURN - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted from a bad burn.")}, + [DUNGEON_EXIT_FAINTED_FROM_CONSTRICTION - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted, unable to bear constriction.")}, + [DUNGEON_EXIT_FAINTED_FROM_POISON - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted after the poison spread.")}, + [DUNGEON_EXIT_FAINTED_FROM_WRAP - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted while still being wrapped.")}, + [DUNGEON_EXIT_FELLED_BY_CURSE - DUNGEON_EXIT_REASON_START] = { FALSE, _("was felled by a curse.")}, + [DUNGEON_EXIT_DRAINED_BY_LEECH_SEED - DUNGEON_EXIT_REASON_START] = { FALSE, _("was drained to nothing by Leech Seed.")}, + [DUNGEON_EXIT_FAINTED_FROM_PERISH_SONG - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted from hearing Perish Song.")}, + [DUNGEON_EXIT_FAINTED_WHILE_IN_NIGHTMARE - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted while in a nightmare.")}, + [DUNGEON_EXIT_FELLED_BY_THROWN_ROCK - DUNGEON_EXIT_REASON_START] = { FALSE, _("was felled by a thrown rock.")}, + [DUNGEON_EXIT_FAINTED_FROM_HUNGER - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted from hunger.")}, + [DUNGEON_EXIT_DISAPPEARED_IN_EXPLOSION - DUNGEON_EXIT_REASON_START] = { FALSE, _("disappeared in an explosion.")}, + [DUNGEON_EXIT_TRIPPED_CHESTNUT_TRAP - DUNGEON_EXIT_REASON_START] = { FALSE, _("tripped a Chestnut Trap and fainted.")}, + [DUNGEON_EXIT_FAINTED_DUE_TO_TRAP - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted due to a trap's damage.")}, + [DUNGEON_EXIT_FELL_INTO_PITFALL - DUNGEON_EXIT_REASON_START] = { FALSE, _("fell into a Pitfall Trap and fainted.")}, + [DUNGEON_EXIT_DEFEATED_BLAST_SEED - DUNGEON_EXIT_REASON_START] = { TRUE, _("a Blast Seed's damage.")}, + [DUNGEON_EXIT_FELLED_BY_THROWN_ITEM - DUNGEON_EXIT_REASON_START] = { FALSE, _("was felled by a thrown item.")}, + [DUNGEON_EXIT_TRANSFORMED_INTO_ITEM - DUNGEON_EXIT_REASON_START] = { FALSE, _("was transformed into an item.")}, + [DUNGEON_EXIT_FAINTED_FROM_BEING_KNOCKED - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted from being knocked flying.")}, + [DUNGEON_EXIT_FELLED_BY_POKEMON_FLYING - DUNGEON_EXIT_REASON_START] = { FALSE, _("was felled by a Pokémon sent flying.")}, + [DUNGEON_EXIT_GAVE_UP_EXPLORATION - DUNGEON_EXIT_REASON_START] = { FALSE, _("gave up the exploration.")}, + [DUNGEON_EXIT_DELETED_FOR_EVENT - DUNGEON_EXIT_REASON_START] = { FALSE, _("was deleted for the sake of an event.")}, + [DUNGEON_EXIT_WENT_AWAY - DUNGEON_EXIT_REASON_START] = { FALSE, _("went away.")}, + [DUNGEON_EXIT_BLOWN_OUT_UNSEEN_FORCE - DUNGEON_EXIT_REASON_START] = { FALSE, _("was blown out by an unseen force.")}, + [DUNGEON_EXIT_RETURNED_WITH_FALLEN_PARTNER - DUNGEON_EXIT_REASON_START] = { FALSE, _("returned with the fallen partner.")}, + [DUNGEON_EXIT_FAINTED_DUE_TO_WEATHER - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted due to the weather.")}, + [DUNGEON_EXIT_WAS_POSSESSED - DUNGEON_EXIT_REASON_START] = { FALSE, _("was possessed.")}, + [DUNGEON_EXIT_FAILED_TO_PROTECT_CLIENT - DUNGEON_EXIT_REASON_START] = { FALSE, _("failed to protect the client Pokémon.")}, + [DUNGEON_EXIT_FAINTED_FROM_WONDER_ORB - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted from a Wonder Orb.")}, + [DUNGEON_EXIT_FAINTED_FROM_ITEM - DUNGEON_EXIT_REASON_START] = { FALSE, _("fainted from an item.")}, + [DUNGEON_EXIT_UNUSED_549 - DUNGEON_EXIT_REASON_START] = { FALSE, _("- ")}, + [DUNGEON_EXIT_ESCAPED_MIDDLE_OF_EXPLORATION - DUNGEON_EXIT_REASON_START] = { FALSE, _("escaped in the middle of exploration.")}, + [DUNGEON_EXIT_CLEARED_DUNGEON - DUNGEON_EXIT_REASON_START] = { FALSE, _("cleared the dungeon.")}, + [DUNGEON_EXIT_SUCCEEDED_IN_RESCUE_MISSION - DUNGEON_EXIT_REASON_START] = { FALSE, _("succeeded in the rescue mission.")}, + [DUNGEON_EXIT_IMPRESSIVELY_COMPLETED_MISSION - DUNGEON_EXIT_REASON_START] = { FALSE, _("impressively completed a mission.")}, + [DUNGEON_EXIT_BEFRIENDED_MEW - DUNGEON_EXIT_REASON_START] = { FALSE, _("befriended Mew!")}, }; const u8 *const gText_DeathToMove = _("{POKEMON_0}'s {MOVE_ITEM_0}."); diff --git a/src/trap.c b/src/trap.c index ae704205b..e816aab89 100644 --- a/src/trap.c +++ b/src/trap.c @@ -7,6 +7,8 @@ #include "code_8077274_1.h" #include "dungeon_random.h" #include "code_806CD90.h" +#include "constants/dungeon_exit.h" +#include "constants/residual_damage.h" #include "constants/trap.h" #include "constants/type.h" #include "run_dungeon.h" From 723e83f45108b734841be5baa18bdc3d7598b6f2 Mon Sep 17 00:00:00 2001 From: Electro Date: Fri, 5 Sep 2025 20:15:49 +0100 Subject: [PATCH 3/3] Label defeatedByPrefix, rename some dungeonExitReason variables --- include/strings.h | 2 +- src/dungeon_run_end.c | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/strings.h b/include/strings.h index 3b5c88e62..962ed8be1 100644 --- a/include/strings.h +++ b/include/strings.h @@ -20,7 +20,7 @@ typedef struct DungeonName struct unkStruct_8113080 { - u8 unk0; + bool8 defeatedByPrefix; const u8 *text; }; diff --git a/src/dungeon_run_end.c b/src/dungeon_run_end.c index ab0fb73ff..d6c8b2e88 100644 --- a/src/dungeon_run_end.c +++ b/src/dungeon_run_end.c @@ -16,32 +16,34 @@ #define TEXT_BUFFER_LEN 200 -static void WriteDeathText(s16 moveID, u8 *buffer) +static void WriteDeathText(s16 dungeonExitReason, u8 *buffer) { - u16 moveID_u16; - s32 moveID_s32 = moveID; + u16 dungeonExitReason_u16; + s32 dungeonExitReason_s32 = dungeonExitReason; Move move; - if (moveID_s32 < DUNGEON_EXIT_REASON_START) { + if (dungeonExitReason_s32 < DUNGEON_EXIT_REASON_START) { // Needed this cast/variable to match - moveID_u16 = moveID_s32; - InitPokemonMoveOrNullObject(&move, moveID_u16); + dungeonExitReason_u16 = dungeonExitReason_s32; + InitPokemonMoveOrNullObject(&move, dungeonExitReason_u16); BufferMoveName(gFormatBuffer_Items[0], &move, NULL); FormatString(gText_DeathToMove, buffer, buffer + TEXT_BUFFER_LEN, 0); // $m0's $i0 } else { - strncpy(buffer, gDungeonExitReasonTexts[moveID - DUNGEON_EXIT_REASON_START].text, TEXT_BUFFER_LEN); + strncpy(buffer, gDungeonExitReasonTexts[dungeonExitReason - DUNGEON_EXIT_REASON_START].text, TEXT_BUFFER_LEN); } } -static bool8 WasDefeatedByMove(s16 moveID) +static bool8 HasDefeatedByPrefix(s16 dungeonExitReason) { - if (moveID < DUNGEON_EXIT_REASON_START) + if (dungeonExitReason < DUNGEON_EXIT_REASON_START) { + // all moves are prefixed by "was defeated by..." return TRUE; } else { - return gDungeonExitReasonTexts[moveID - DUNGEON_EXIT_REASON_START].unk0; + // some exit reason texts are to be put after "was defeated by..." + return gDungeonExitReasonTexts[dungeonExitReason - DUNGEON_EXIT_REASON_START].defeatedByPrefix; } } @@ -58,7 +60,7 @@ void PrintOnDungeonFinishedWindow(u32 windowId, const u8 *headerText, DungeonExi y = 26; StrncpyCustom(gFormatBuffer_Monsters[0], exitSummary->buffer1, POKEMON_NAME_LENGTH); StrncpyCustom(gFormatBuffer_Monsters[1], exitSummary->buffer2, POKEMON_NAME_LENGTH); - if (WasDefeatedByMove(exitSummary->exitReason) != 0) { + if (HasDefeatedByPrefix(exitSummary->exitReason)) { // $m1 was defeated by FormatString(gText_Pokemon1WasDefeatedBy,buffer, buffer + sizeof(buffer),0); }