From e12e1334580eab729e3fb67270c66dc3a7b0980c Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Fri, 18 Nov 2022 10:00:22 -0800 Subject: [PATCH] document more functions and cleanup some code --- asm/code_8046CE4.s | 2 +- asm/code_80521D0.s | 16 +++++----- asm/code_8057824.s | 36 +++++++++++------------ asm/code_8073CF0.s | 2 +- asm/code_807FCD4.s | 2 +- include/dungeon_ai.h | 24 ++++++++++++++- include/status.h | 14 ++++----- include/status_checker.h | 2 +- src/code_8048480.c | 18 ++++++------ src/code_8048DB8.c | 17 +++++------ src/code_8057824.c | 37 ++++++++++------------- src/code_8077274_1.c | 63 ++++++++++++++++++++-------------------- src/dungeon_ai.c | 21 +++++++------- src/status.c | 26 ++++++++--------- src/status_checker.c | 54 ++++++++++++++++++---------------- 15 files changed, 175 insertions(+), 159 deletions(-) diff --git a/asm/code_8046CE4.s b/asm/code_8046CE4.s index 6cbade5f..b3a03a0f 100644 --- a/asm/code_8046CE4.s +++ b/asm/code_8046CE4.s @@ -1652,7 +1652,7 @@ _0804802E: _08048038: adds r0, r4, 0 adds r1, r5, 0 - bl sub_8048400 + bl XEyeSeedAction b _080482B4 _08048042: adds r0, r4, 0 diff --git a/asm/code_80521D0.s b/asm/code_80521D0.s index d34ae813..84546aee 100644 --- a/asm/code_80521D0.s +++ b/asm/code_80521D0.s @@ -4525,7 +4525,7 @@ _08054BC8: adds r1, r5, 0 mov r2, r8 mov r3, r9 - bl sub_805B7FC + bl ReflectMoveAction bl _080554BA _08054BD8: adds r0, r7, 0 @@ -4723,7 +4723,7 @@ _08054D72: adds r1, r5, 0 mov r2, r8 mov r3, r9 - bl sub_805B2E4 + bl MagicCoatMoveAction b _080554BA _08054D80: adds r0, r7, 0 @@ -5010,7 +5010,7 @@ _08054FB0: adds r1, r5, 0 mov r2, r8 mov r3, r9 - bl sub_805777C + bl VitalThrowMoveAction b _080554BA _08054FBE: adds r0, r7, 0 @@ -5271,7 +5271,7 @@ _080551BA: adds r1, r5, 0 mov r2, r8 mov r3, r9 - bl sub_805B3A8 + bl MirrorCoatMoveAction b _080554BA _080551C8: adds r0, r7, 0 @@ -5292,7 +5292,7 @@ _080551E4: adds r1, r5, 0 mov r2, r8 mov r3, r9 - bl sub_805B37C + bl DestinyBondMoveAction b _080554BA _080551F2: adds r0, r7, 0 @@ -6829,7 +6829,7 @@ _08055DEC: bl SendMessage adds r0, r4, 0 adds r1, r4, 0 - bl sub_80769CC + bl ImmobilizedStatusTarget _08055E10: ldrh r1, [r5] movs r0, 0x2 @@ -6842,7 +6842,7 @@ _08055E10: bl SendMessage adds r0, r4, 0 adds r1, r4, 0 - bl sub_80769CC + bl ImmobilizedStatusTarget _08055E2C: ldrh r1, [r5] movs r0, 0x4 @@ -6855,7 +6855,7 @@ _08055E2C: bl SendMessage adds r0, r4, 0 adds r1, r4, 0 - bl sub_80769CC + bl ImmobilizedStatusTarget _08055E48: ldrh r1, [r5] movs r0, 0x8 diff --git a/asm/code_8057824.s b/asm/code_8057824.s index f3014415..5a9059c2 100644 --- a/asm/code_8057824.s +++ b/asm/code_8057824.s @@ -201,7 +201,7 @@ sub_8057ED0: adds r0, r5, 0 adds r1, r6, 0 movs r3, 0x80 - bl sub_80772C0 + bl ChangeAttackMultiplierTarget _08057F12: adds r0, r7, 0 add sp, 0x4 @@ -232,14 +232,14 @@ sub_8057F24: str r4, [sp] adds r0, r6, 0 movs r3, 0x40 - bl sub_80772C0 + bl ChangeAttackMultiplierTarget ldr r0, _08057F78 ldr r2, [r0] str r4, [sp] adds r0, r6, 0 mov r1, r8 movs r3, 0x40 - bl sub_80772C0 + bl ChangeAttackMultiplierTarget movs r0, 0xAA lsls r0, 1 adds r5, r0 @@ -287,7 +287,7 @@ sub_8057F7C: adds r0, r5, 0 adds r1, r6, 0 movs r3, 0 - bl sub_80775DC + bl LowerAccuracyStageTarget _08057FBA: adds r0, r7, 0 add sp, 0x4 @@ -645,7 +645,7 @@ sub_805825C: push {lr} ldr r2, _0805826C ldr r2, [r2] - bl sub_8077540 + bl RaiseAccuracyStageTarget movs r0, 0x1 pop {r1} bx r1 @@ -1096,7 +1096,7 @@ sub_8058580: adds r1, r6, 0 movs r2, 0x1 movs r3, 0 - bl sub_80779F0 + bl LowerMovementSpeedTarget _080585BC: adds r0, r7, 0 add sp, 0x4 @@ -1190,7 +1190,7 @@ sub_8058638: adds r1, r6, 0 movs r2, 0x1 movs r3, 0 - bl sub_80779F0 + bl LowerMovementSpeedTarget _08058670: adds r0, r7, 0 add sp, 0x4 @@ -1491,7 +1491,7 @@ _08058898: .4byte gUnknown_8106A4C thumb_func_start sub_805889C sub_805889C: push {lr} - bl sub_80769CC + bl ImmobilizedStatusTarget movs r0, 0x1 pop {r1} bx r1 @@ -1603,7 +1603,7 @@ sub_8058930: adds r1, r7, 0 movs r2, 0 movs r3, 0x1 - bl sub_8077910 + bl RaiseMovementSpeedTarget ldr r0, _080589CC ldr r5, [r0] adds r0, r7, 0 @@ -1681,7 +1681,7 @@ sub_8058A08: push {lr} movs r2, 0 movs r3, 0x1 - bl sub_8077910 + bl RaiseMovementSpeedTarget movs r0, 0x1 pop {r1} bx r1 @@ -1936,7 +1936,7 @@ sub_8058BF0: push {lr} movs r2, 0x1 movs r3, 0x1 - bl sub_80779F0 + bl LowerMovementSpeedTarget movs r0, 0x1 pop {r1} bx r1 @@ -3175,7 +3175,7 @@ sub_8059528: ldr r2, _0805953C ldr r2, [r2] movs r3, 0x1 - bl sub_80775DC + bl LowerAccuracyStageTarget movs r0, 0x1 pop {r1} bx r1 @@ -3672,7 +3672,7 @@ sub_80598CC: adds r0, r5, 0 adds r1, r6, 0 movs r3, 0 - bl sub_80775DC + bl LowerAccuracyStageTarget _0805990A: adds r0, r7, 0 add sp, 0x4 @@ -3824,7 +3824,7 @@ sub_8059A18: push {lr} ldr r2, _08059A28 ldr r2, [r2] - bl sub_8077540 + bl RaiseAccuracyStageTarget movs r0, 0x1 pop {r1} bx r1 @@ -4300,7 +4300,7 @@ _08059D8E: thumb_func_start sub_8059D98 sub_8059D98: push {lr} - bl sub_80769CC + bl ImmobilizedStatusTarget movs r0, 0x1 pop {r1} bx r1 @@ -4944,7 +4944,7 @@ sub_805A258: adds r0, r5, 0 adds r1, r6, 0 movs r3, 0 - bl sub_80775DC + bl LowerAccuracyStageTarget _0805A292: adds r0, r7, 0 add sp, 0x4 @@ -6180,7 +6180,7 @@ _0805AC08: adds r1, r6, 0 movs r2, 0x1 movs r3, 0 - bl sub_80779F0 + bl LowerMovementSpeedTarget b _0805AC86 _0805AC16: ldr r0, _0805AC30 @@ -6216,7 +6216,7 @@ _0805AC50: adds r0, r5, 0 adds r1, r6, 0 movs r3, 0 - bl sub_80775DC + bl LowerAccuracyStageTarget b _0805AC86 .align 2, 0 _0805AC60: .4byte gUnknown_8106A4C diff --git a/asm/code_8073CF0.s b/asm/code_8073CF0.s index acc2ada4..8792590c 100644 --- a/asm/code_8073CF0.s +++ b/asm/code_8073CF0.s @@ -978,7 +978,7 @@ _080744D8: adds r1, r5, 0 movs r2, 0x7F movs r3, 0 - bl sub_8077910 + bl RaiseMovementSpeedTarget _0807450C: mov r0, r8 adds r0, 0xA8 diff --git a/asm/code_807FCD4.s b/asm/code_807FCD4.s index b1b7b238..f84d53f4 100644 --- a/asm/code_807FCD4.s +++ b/asm/code_807FCD4.s @@ -887,7 +887,7 @@ sub_80803B4: beq _080803C2 movs r2, 0x1 movs r3, 0x1 - bl sub_80779F0 + bl LowerMovementSpeedTarget _080803C2: pop {r0} bx r0 diff --git a/include/dungeon_ai.h b/include/dungeon_ai.h index d7ba85e5..6c9e60b4 100644 --- a/include/dungeon_ai.h +++ b/include/dungeon_ai.h @@ -4,6 +4,28 @@ #include "dungeon_entity.h" void DecideAction(struct DungeonEntity *pokemon, u32 unused); -u8 sub_8075BF4(struct DungeonEntity * pokemon, s32 param_2); +u8 sub_8075BF4(struct DungeonEntity * pokemon, s32 sleepTurns); +void sub_8075C58(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 turns, bool8 displayMessage); +bool8 CannotSleep(struct DungeonEntity * pokemon, struct DungeonEntity * target, u8 param_3, bool8 displayMessage); +void NightmareStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 turns); +void NappingStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 turns); +void YawnedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 turns); +void SleeplessStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target); +void PausedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, u8 param_3, s32 turns, bool8 displayMessage); +void InfatuateStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 displayMessage); +void BurnedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, u8 param_3, bool8 displayMessage); +void PoisonedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 displayMessage); +void BadlyPoisonedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 displayMessage); +void FrozenStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 displayMessage); +void SqueezedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s16 param_3, bool32 displayMessage); +void ImmobilizedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target); +void IngrainedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target); +void WrapTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target); +void sub_8076CB4(s32 param_1); +void PetrifiedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target); +void LowerAttackStageTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 index, s32 decrement, u8 param_5, bool8 displayMessage); +void LowerDefenseStageTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 index, s32 decrement, u8 param_5, bool8 displayMessage); +void RaiseAttackStageTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 index, s32 increment); +void RaiseDefenseStageTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 index, s32 increment); #endif diff --git a/include/status.h b/include/status.h index d6a25cde..18dc4636 100644 --- a/include/status.h +++ b/include/status.h @@ -9,17 +9,17 @@ u8 GetFlashFireStatus(struct DungeonEntity *pokemon); void UpdateFlashFireBoost(struct DungeonEntity * pokemon, struct DungeonEntity *target); -void sub_80772C0(struct DungeonEntity *pokemon, struct DungeonEntity *target, u32 statStage, s32 param_4, bool8 displayMessage); -void sub_8077434(struct DungeonEntity *pokemon, struct DungeonEntity *target, u32 statStage, s32 param_4, bool8 displayMessage); -void sub_8077540(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 statStage); -void sub_80775DC(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 statStage, bool8 displayMessage); +void ChangeAttackMultiplierTarget(struct DungeonEntity *pokemon, struct DungeonEntity *target, u32 statStage, s32 param_4, bool8 displayMessage); +void ChangeDefenseMultiplierTarget(struct DungeonEntity *pokemon, struct DungeonEntity *target, u32 statStage, s32 param_4, bool8 displayMessage); +void RaiseAccuracyStageTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 statStage); +void LowerAccuracyStageTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 statStage, bool8 displayMessage); void CringeStatusTarget(struct DungeonEntity * pokemon,struct DungeonEntity * target, bool8 displayMessage); void ParalyzeStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 displayMessage); -void sub_8077910(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 turns, bool8 diplayMessage); -void sub_80779F0(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 param_3, bool8 displayMessage); +void RaiseMovementSpeedTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 turns, bool8 diplayMessage); +void LowerMovementSpeedTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 levels, bool8 displayMessage); void ConfuseStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 displayMessage); void CowerStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 displayMessage); -void HealTargetHP(struct DungeonEntity *pokemon, struct DungeonEntity *target, s32 param_3, s32 param_4, u32 displayMessage); +void HealTargetHP(struct DungeonEntity *pokemon, struct DungeonEntity *target, s32 param_3, s32 param_4, bool32 displayMessage); void HandleScannerOrb(struct DungeonEntity* pokemon, struct DungeonEntity* target); void HandleStairsOrb(struct DungeonEntity* pokemon, struct DungeonEntity* target); void HandleRadarOrb(struct DungeonEntity* pokemon, struct DungeonEntity* target); diff --git a/include/status_checker.h b/include/status_checker.h index 8f9a2e07..d3cc1f85 100644 --- a/include/status_checker.h +++ b/include/status_checker.h @@ -7,7 +7,7 @@ bool8 sub_805B668(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4); bool8 sub_805B734(struct DungeonEntity *pokemon, struct DungeonEntity *target); bool8 RecycleMoveAction(struct DungeonEntity *pokemon, struct DungeonEntity *target); -bool8 sub_805B7FC(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4); +bool8 ReflectMoveAction(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4); bool8 sub_805B808(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4); bool8 sub_805B884(struct DungeonEntity *pokemon, struct DungeonEntity *target); bool8 SkullBashMoveAction(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4); diff --git a/src/code_8048480.c b/src/code_8048480.c index dbeb976d..4faeffcb 100644 --- a/src/code_8048480.c +++ b/src/code_8048480.c @@ -3,11 +3,13 @@ #include "constants/status.h" #include "dungeon_entity.h" #include "dungeon_global_data.h" +#include "dungeon_ai.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" #include "number_util.h" #include "moves.h" #include "code_8077274_1.h" +#include "position.h" #include "status.h" extern u8 *gUnknown_80F89F4[]; @@ -34,10 +36,8 @@ extern u8 *gPtrSelfHealPreventedHungerMessage[]; extern u8 *gUnknown_80F9740[]; extern u8 *gUnknown_80F9760[]; -extern void sub_807D148(struct DungeonEntity *pokemon, struct DungeonEntity *r1, u32 r2, u32 r3); -extern void SleeplessStatusTarget(struct DungeonEntity *pokemon, struct DungeonEntity *r1); +extern void sub_807D148(struct DungeonEntity *pokemon, struct DungeonEntity *r1, u32 r2, struct Position *r3); extern void sub_8072008(struct DungeonEntity *pokemon, struct DungeonEntity *r1, u32 r2, u8 r3, u32); -extern void PetrifiedStatusTarget(struct DungeonEntity *pokemon, struct DungeonEntity *r1); extern void LevelDownTarget(struct DungeonEntity *pokemon, struct DungeonEntity *r1, u32 r2); extern void sub_8078B5C(struct DungeonEntity *, struct DungeonEntity *, u32, u32, u32); extern void SetMessageArgument(u8 *buffer, struct DungeonEntity *r1, u32); @@ -61,12 +61,12 @@ void sub_8048364(struct DungeonEntity *pokemon, struct DungeonEntity *target, u8 void sub_8048374(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - HealTargetHP(pokemon, target, gUnknown_80F4FB6, gUnknown_80F4FB8, 1); + HealTargetHP(pokemon, target, gUnknown_80F4FB6, gUnknown_80F4FB8, TRUE); } void sub_804839C(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - HealTargetHP(pokemon, target, gUnknown_80F4FBA, gUnknown_80F4FBC, 1); + HealTargetHP(pokemon, target, gUnknown_80F4FBA, gUnknown_80F4FBC, TRUE); } void sub_80483C4(struct DungeonEntity *pokemon, struct DungeonEntity *target) @@ -76,7 +76,7 @@ void sub_80483C4(struct DungeonEntity *pokemon, struct DungeonEntity *target) void sub_80483D4(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - HealTargetHP(pokemon, target, 0, gUnknown_80F4FBE, 1); + HealTargetHP(pokemon, target, 0, gUnknown_80F4FBE, TRUE); } void sub_80483F4(struct DungeonEntity *pokemon, struct DungeonEntity *target) @@ -84,14 +84,14 @@ void sub_80483F4(struct DungeonEntity *pokemon, struct DungeonEntity *target) BlindTarget(pokemon, target); } -void sub_8048400(struct DungeonEntity *pokemon, struct DungeonEntity *target) +void XEyeSeedAction(struct DungeonEntity *pokemon, struct DungeonEntity *target) { CrossEyeVisionTarget(pokemon, target); } void sub_804840C(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - sub_8077910(pokemon, target, 0, 1); + RaiseMovementSpeedTarget(pokemon, target, 0, TRUE); } void sub_804841C(struct DungeonEntity *pokemon, struct DungeonEntity *target) @@ -119,7 +119,7 @@ void sub_8048450(struct DungeonEntity *pokemon, struct DungeonEntity *target) void sub_8048480(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - sub_807D148(pokemon, target, 0, 0); + sub_807D148(pokemon, target, 0, NULL); } void sub_8048490(struct DungeonEntity *pokemon, struct DungeonEntity *target) diff --git a/src/code_8048DB8.c b/src/code_8048DB8.c index f5718337..c60f8d3b 100644 --- a/src/code_8048DB8.c +++ b/src/code_8048DB8.c @@ -1,6 +1,7 @@ #include "global.h" #include "constants/status.h" #include "code_80521D0.h" +#include "dungeon_ai.h" #include "dungeon_random.h" #include "item.h" #include "status.h" @@ -8,10 +9,6 @@ extern void sub_803E708(u32, u32); extern void sub_80421C0(struct DungeonEntity *r0, u16 r1); extern void sub_8078B5C(struct DungeonEntity *, struct DungeonEntity *, u32, u32, u32); -extern void PoisonedStatusTarget(struct DungeonEntity *, struct DungeonEntity *, u32); -extern void sub_80769CC(struct DungeonEntity *, struct DungeonEntity *); -extern void BurnedStatusTarget(struct DungeonEntity *, struct DungeonEntity *, u32, u32); -extern void LowerAttackStageTarget(struct DungeonEntity *, struct DungeonEntity *, u32, u32, u32, u32); extern u8 gAvailablePokemonNames[]; extern u8 gUnknown_202DE58[]; @@ -34,9 +31,9 @@ extern u8 *gUnknown_80FE3E8[]; bool8 sub_8048D50(struct DungeonEntity * pokemon, struct ItemSlot *item) { - struct DungeonEntityData *iVar2; + struct DungeonEntityData *entityData; - iVar2 = pokemon->entityData; + entityData = pokemon->entityData; if ((item->itemFlags & ITEM_FLAG_STICKY) != 0) { sub_8045BF8(gUnknown_202DE58, item); @@ -45,7 +42,7 @@ bool8 sub_8048D50(struct DungeonEntity * pokemon, struct ItemSlot *item) } else { - if ((iVar2->muzzledStatus == MUZZLED_STATUS_MUZZLED) && (IsEdibleItem(item->itemIndex))) { + if ((entityData->muzzledStatus == MUZZLED_STATUS_MUZZLED) && (IsEdibleItem(item->itemIndex))) { SetMessageArgument(gAvailablePokemonNames,pokemon,0); SendMessage(pokemon,*gUnknown_80FDCA4); return FALSE; @@ -72,7 +69,7 @@ void sub_8048E04(struct DungeonEntity *pokemon, struct DungeonEntity * target) PoisonedStatusTarget(pokemon, target, TRUE); break; case 1: - sub_80769CC(pokemon, target); + ImmobilizedStatusTarget(pokemon, target); break; case 2: BurnedStatusTarget(pokemon, target, 1, TRUE); @@ -81,8 +78,8 @@ void sub_8048E04(struct DungeonEntity *pokemon, struct DungeonEntity * target) ParalyzeStatusTarget(pokemon, target, TRUE); break; case 4: - LowerAttackStageTarget(pokemon, target, gUnknown_8106A4C, 3, 1, 1); - LowerAttackStageTarget(pokemon, target, gUnknown_8106A50, 3, 1, 1); + LowerAttackStageTarget(pokemon, target, gUnknown_8106A4C, 3, 1, TRUE); + LowerAttackStageTarget(pokemon, target, gUnknown_8106A50, 3, 1, TRUE); break; } } diff --git a/src/code_8057824.c b/src/code_8057824.c index 173cec57..1dbb513a 100644 --- a/src/code_8057824.c +++ b/src/code_8057824.c @@ -3,6 +3,7 @@ #include "constants/weather.h" #include "charge_move.h" #include "dungeon_global_data.h" +#include "dungeon_ai.h" #include "dungeon_entity.h" #include "dungeon_util.h" #include "code_8077274_1.h" @@ -55,20 +56,14 @@ struct unkStruct_80928C0 void sub_80928C0(u8 *buffer, struct PokemonMove *move, struct unkStruct_80928C0 *param_3); -extern void SqueezedStatusTarget(struct DungeonEntity *, struct DungeonEntity *, u32, u32); extern u8 sub_807EAA0(u32, u32); extern void sub_80522F4(struct DungeonEntity *r1, struct DungeonEntity *r2, const char[]); extern s32 sub_80556BC(struct DungeonEntity *, struct DungeonEntity *, u8, struct PokemonMove *, u32, u32); extern u8 sub_805727C(struct DungeonEntity *, struct DungeonEntity *, s16); extern void sub_8078968(struct DungeonEntity *r0, struct DungeonEntity *r1); -extern void RaiseAttackStageTarget(struct DungeonEntity *pokemon, struct DungeonEntity *target, u32, u32); -extern void LowerDefenseStageTarget(struct DungeonEntity *, struct DungeonEntity *, u32, u32, u32, u32); extern void sub_806F370(struct DungeonEntity *r0, struct DungeonEntity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); extern void SetMessageArgument(char[], struct DungeonEntity*, u32); extern u32 sub_8055640(struct DungeonEntity *, struct DungeonEntity *, struct PokemonMove *, u32, u32); -extern void NightmareStatusTarget(struct DungeonEntity *, struct DungeonEntity *, s32); -extern void YawnedStatusTarget(struct DungeonEntity *, struct DungeonEntity *, s32); -extern void sub_8075C58(struct DungeonEntity *, struct DungeonEntity *, s32, s32); u8 sub_8057620(u32 param_1); extern s16 sub_8094828(u16, u8); @@ -121,9 +116,9 @@ void sub_8057588(struct DungeonEntity * pokemon, u8 param_2) } } -s16 sub_8057600(struct PokemonMove *param_1, s32 param_2) +s16 sub_8057600(struct PokemonMove *move, s32 param_2) { - return sub_8094828(param_1->moveID, sub_8057620(param_2)); + return sub_8094828(move->moveID, sub_8057620(param_2)); } u8 sub_8057620(u32 param_1) @@ -142,7 +137,7 @@ bool8 sub_8057634(struct DungeonEntity *pokemon, struct DungeonEntity *target, s if (sub_8055640(pokemon, target, move, 0x100, param_4) != 0) { uVar3 = TRUE; if (sub_805727C(pokemon, target, gUnknown_80F4DB4) != 0) { - LowerDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, 0); + LowerDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, FALSE); } } return uVar3; @@ -170,7 +165,7 @@ bool8 sub_80576D0(struct DungeonEntity * pokemon, struct DungeonEntity *target) bool8 sub_80576F8(struct DungeonEntity * pokemon, struct DungeonEntity *target) { - sub_8075C58(pokemon, target, CalculateStatusTurns(target, gUnknown_80F4E74, TRUE), 1); + sub_8075C58(pokemon, target, CalculateStatusTurns(target, gUnknown_80F4E74, TRUE), TRUE); return TRUE; } @@ -182,11 +177,11 @@ bool8 sub_8057720(struct DungeonEntity * pokemon, struct DungeonEntity *target) bool8 sub_8057748(struct DungeonEntity * pokemon,struct DungeonEntity * target) { - HealTargetHP(pokemon, target, gUnknown_80F502A[GetWeather(pokemon)], 0, 1); + HealTargetHP(pokemon, target, gUnknown_80F502A[GetWeather(pokemon)], 0, TRUE); return TRUE; } -bool8 sub_805777C(struct DungeonEntity * pokemon, struct DungeonEntity * target) +bool8 VitalThrowMoveAction(struct DungeonEntity * pokemon, struct DungeonEntity * target) { VitalThrowStatusTarget(pokemon, target); return TRUE; @@ -218,14 +213,14 @@ bool8 sub_8057788(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool32 sub_8057824(struct DungeonEntity *pokemon, struct DungeonEntity *target) { // Lower evasion? - sub_80775DC(pokemon,target,gUnknown_8106A50,1); + LowerAccuracyStageTarget(pokemon,target,gUnknown_8106A50,TRUE); return TRUE; } bool32 sub_805783C(struct DungeonEntity *pokemon, struct DungeonEntity *target) { // Lower attack? - sub_80772C0(pokemon,target,gUnknown_8106A4C,0x80,1); + ChangeAttackMultiplierTarget(pokemon,target,gUnknown_8106A4C,0x80,TRUE); return TRUE; } @@ -263,7 +258,7 @@ bool32 sub_80578FC(struct DungeonEntity *pokemon, struct DungeonEntity *target, if (sub_8055640(pokemon, target, move, 0x100, param_4) != 0) { uVar3 = TRUE; if (sub_805727C(pokemon,target, gUnknown_80F4DB6) != 0) { - sub_80779F0(pokemon, target, 1, 0); + LowerMovementSpeedTarget(pokemon, target, 1, FALSE); } } return uVar3; @@ -393,13 +388,13 @@ bool8 TormentMoveAction(struct DungeonEntity *pokemon, struct DungeonEntity *tar bool8 sub_8057BB4(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - sub_80779F0(pokemon, target, 1, 1); + LowerMovementSpeedTarget(pokemon, target, 1, TRUE); return TRUE; } bool8 sub_8057BC4(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - ConfuseStatusTarget(pokemon, target, 1); + ConfuseStatusTarget(pokemon, target, TRUE); RaiseAttackStageTarget(pokemon, target, gUnknown_8106A4C, 2); return TRUE; } @@ -413,7 +408,7 @@ bool8 sub_8057BEC(struct DungeonEntity *pokemon, struct DungeonEntity *target, s if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { uVar3 = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4E0A) != 0) { - CringeStatusTarget(pokemon,target,0); + CringeStatusTarget(pokemon,target,FALSE); } } } @@ -425,7 +420,7 @@ bool8 sub_8057BEC(struct DungeonEntity *pokemon, struct DungeonEntity *target, s bool8 sub_8057C68(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - sub_8077434(pokemon, target, gUnknown_8106A4C, 0x40, 1); + ChangeDefenseMultiplierTarget(pokemon, target, gUnknown_8106A4C, 0x40, 1); return TRUE; } @@ -437,7 +432,7 @@ bool8 sub_8057C88(struct DungeonEntity *pokemon, struct DungeonEntity *target, s if (sub_8055640(pokemon, target, move, 0x100, param_4) != 0) { uVar3 = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4DF6) != 0) { - CringeStatusTarget(pokemon,target,0); + CringeStatusTarget(pokemon,target,FALSE); } } return uVar3; @@ -472,7 +467,7 @@ bool8 sub_8057D20(struct DungeonEntity * pokemon, struct DungeonEntity * target, if (sub_8055640(pokemon,target,move,uVar3,param_4) != 0) { uVar4 = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4E08) != 0) { - SqueezedStatusTarget(pokemon,target,0x3b,0); + SqueezedStatusTarget(pokemon,target,0x3b,FALSE); } } return uVar4; diff --git a/src/code_8077274_1.c b/src/code_8077274_1.c index 60f1f09f..185ac91f 100644 --- a/src/code_8077274_1.c +++ b/src/code_8077274_1.c @@ -5,6 +5,7 @@ #include "constants/type.h" #include "dungeon_entity.h" #include "dungeon_global_data.h" +#include "dungeon_ai.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" #include "dungeon_items.h" @@ -169,7 +170,6 @@ extern void SetMessageArgument(u8 *buffer, struct DungeonEntity *r1, u32); extern void sub_80522F4(struct DungeonEntity *pokemon, struct DungeonEntity *r1, const char[]); extern void DungeonEntityUpdateStatusSprites(struct DungeonEntity *); extern void sub_8042A74(struct DungeonEntity *r0); -extern void sub_8076CB4(u32); extern void sub_807EC28(u32); extern s32 sub_8069F54(struct DungeonEntity *param_1, s16 param_2); extern u32 sub_80687D0(s16); @@ -177,7 +177,6 @@ extern void sub_806A898(struct DungeonEntity *, u32, u32); extern void HealTargetHP(struct DungeonEntity *pokemon, struct DungeonEntity *r1, s16, s16, u32); extern void sub_806CE68(struct DungeonEntity *, s32); extern void sub_806F324(struct DungeonEntity *, s16, u32, u32); -extern void sub_8075C58(struct DungeonEntity *, struct DungeonEntity *, s32, s32); extern void sub_806BFC0(struct DungeonEntityData *, u32); extern void sub_80420C8(struct DungeonEntity *r0); extern void nullsub_68(struct DungeonEntity *); @@ -1024,33 +1023,33 @@ void VitalThrowStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity void sub_8079E34(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 param_3) { bool8 statChanged; - struct DungeonEntityData *iVar3; + struct DungeonEntityData *entityData; s32 index; statChanged = FALSE; if (EntityExists(target)) { - iVar3 = target->entityData; + entityData = target->entityData; for(index = 0; index < 2; index++) { - if (iVar3->attackStages[index] != DEFAULT_STAT_STAGE) { - iVar3->attackStages[index] = DEFAULT_STAT_STAGE; + if (entityData->attackStages[index] != DEFAULT_STAT_STAGE) { + entityData->attackStages[index] = DEFAULT_STAT_STAGE; statChanged = TRUE; } - if (iVar3->defenseStages[index] != DEFAULT_STAT_STAGE) { - iVar3->defenseStages[index] = DEFAULT_STAT_STAGE; + if (entityData->defenseStages[index] != DEFAULT_STAT_STAGE) { + entityData->defenseStages[index] = DEFAULT_STAT_STAGE; statChanged = TRUE; } - if (iVar3->accuracyStages[index] != DEFAULT_STAT_STAGE) { - iVar3->accuracyStages[index] = DEFAULT_STAT_STAGE; + if (entityData->accuracyStages[index] != DEFAULT_STAT_STAGE) { + entityData->accuracyStages[index] = DEFAULT_STAT_STAGE; statChanged = TRUE; } - if (iVar3->attackMultipliers[index] != DEFAULT_STAT_MULTIPLIER) { - iVar3->attackMultipliers[index] = DEFAULT_STAT_MULTIPLIER; + if (entityData->attackMultipliers[index] != DEFAULT_STAT_MULTIPLIER) { + entityData->attackMultipliers[index] = DEFAULT_STAT_MULTIPLIER; statChanged = TRUE; } - if (iVar3->defenseMultipliers[index] != DEFAULT_STAT_MULTIPLIER) { - iVar3->defenseMultipliers[index] = DEFAULT_STAT_MULTIPLIER; + if (entityData->defenseMultipliers[index] != DEFAULT_STAT_MULTIPLIER) { + entityData->defenseMultipliers[index] = DEFAULT_STAT_MULTIPLIER; statChanged = TRUE; } } @@ -1170,9 +1169,9 @@ void sub_807A0CC(struct DungeonEntity * pokemon, struct DungeonEntity * target) void SendSleepEndMessage(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 param_3, bool8 param_4) { struct DungeonEntityData *entityData; - bool8 bVar4; + bool8 isAsleep; - bVar4 = FALSE; + isAsleep = FALSE; if (!EntityExists(target)) { return; } @@ -1183,30 +1182,30 @@ void SendSleepEndMessage(struct DungeonEntity * pokemon, struct DungeonEntity * case 6: break; case SLEEP_STATUS_SLEEP: - bVar4 = TRUE; + isAsleep = TRUE; sub_80522F4(pokemon,target,*gUnknown_80FA6E8); break; case SLEEP_STATUS_SLEEPLESS: sub_80522F4(pokemon,target,*gUnknown_80FA708); break; case SLEEP_STATUS_NIGHTMARE: - bVar4 = TRUE; + isAsleep = TRUE; sub_80522F4(pokemon,target,*gUnknown_80FA70C); if (param_4) { sub_806F324(target,gUnknown_80F4F78,8,0x20f); } break; case SLEEP_STATUS_NAPPING: - bVar4 = TRUE; + isAsleep = TRUE; sub_80522F4(pokemon,target,*gUnknown_80FA710); - HealTargetHP(pokemon,target,gUnknown_80F4F7A,0,0); + HealTargetHP(pokemon,target,gUnknown_80F4F7A, 0, FALSE); entityData->sleepStatus = 0; sub_8079F20(pokemon,target,1,1); break; case SLEEP_STATUS_YAWNING: if (param_3) { entityData->sleepStatus = SLEEP_STATUS_NONE; - sub_8075C58(pokemon,target,CalculateStatusTurns(target, gUnknown_80F4F2C, TRUE) + 1, 1); + sub_8075C58(pokemon,target,CalculateStatusTurns(target, gUnknown_80F4F2C, TRUE) + 1, TRUE); return; } sub_80522F4(pokemon,target,*gUnknown_80FA734); @@ -1214,7 +1213,7 @@ void SendSleepEndMessage(struct DungeonEntity * pokemon, struct DungeonEntity * } entityData->sleepStatus = SLEEP_STATUS_NONE; DungeonEntityUpdateStatusSprites(target); - if (bVar4) { + if (isAsleep) { sub_806CE68(target,8); } } @@ -1250,10 +1249,10 @@ void SendNonVolatileEndMessage(struct DungeonEntity * pokemon, struct DungeonEnt void SendImmobilizeEndMessage(struct DungeonEntity * pokemon, struct DungeonEntity *target) { - bool8 bVar1; + bool8 isFrozen; struct DungeonEntityData *entityData; - bVar1 = FALSE; + isFrozen = FALSE; if (!EntityExists(target)) { return; } @@ -1265,7 +1264,7 @@ void SendImmobilizeEndMessage(struct DungeonEntity * pokemon, struct DungeonEnti break; case IMMOBILIZE_STATUS_FROZEN: sub_80522F4(pokemon,target,*gUnknown_80FA8BC); - bVar1 = TRUE; + isFrozen = TRUE; break; case IMMOBILIZE_STATUS_SQUEEZED: sub_80522F4(pokemon,target,*gUnknown_80FA820); @@ -1285,7 +1284,7 @@ void SendImmobilizeEndMessage(struct DungeonEntity * pokemon, struct DungeonEnti } entityData->immobilizeStatus = IMMOBILIZE_STATUS_NONE; DungeonEntityUpdateStatusSprites(target); - if (bVar1) { + if (isFrozen) { sub_8042A74(target); } } @@ -1648,14 +1647,14 @@ void sub_807A9B0(struct DungeonEntity * pokemon) void SendThawedMessage(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - struct DungeonEntityData *iVar2; + struct DungeonEntityData *entityData; if (EntityExists(target)) { - iVar2 = target->entityData; - if (iVar2->immobilizeStatus == IMMOBILIZE_STATUS_FROZEN) { - iVar2->immobilizeStatus = IMMOBILIZE_STATUS_NONE; - iVar2->immobilizeStatusTurnsLeft = 0; - iVar2->immobilizeStatusDamageTimer = 0; + entityData = target->entityData; + if (entityData->immobilizeStatus == IMMOBILIZE_STATUS_FROZEN) { + entityData->immobilizeStatus = IMMOBILIZE_STATUS_NONE; + entityData->immobilizeStatusTurnsLeft = 0; + entityData->immobilizeStatusDamageTimer = 0; SetMessageArgument(gAvailablePokemonNames,target,0); sub_80522F4(pokemon,target,*gUnknown_80FA8BC); // $m0 thawed out! DungeonEntityUpdateStatusSprites(target); diff --git a/src/dungeon_ai.c b/src/dungeon_ai.c index c16daec4..d81064eb 100644 --- a/src/dungeon_ai.c +++ b/src/dungeon_ai.c @@ -123,6 +123,8 @@ extern u8 *gUnknown_80FC248[]; extern u8 *gUnknown_80FC09C[]; extern u8 *gUnknown_80FC13C[]; extern u8 *gUnknown_80FC270[]; +extern u8 *gUnknown_80FC138[]; +extern u8 *gUnknown_80FC21C[]; extern bool8 sub_8071728(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 displayMessage); extern void sub_8041F28(struct DungeonEntity *, s32); @@ -394,16 +396,16 @@ void DecideAction(struct DungeonEntity *pokemon, u32 unused) } } -void sub_8075BA4(struct DungeonEntity *param_1,char param_2) +void sub_8075BA4(struct DungeonEntity *param_1, u8 param_2) { - struct DungeonEntityData * iVar2 = param_1->entityData; + struct DungeonEntityData * entityData = param_1->entityData; - if ((param_2 != '\0') && (iVar2->volatileStatus == VOLATILE_STATUS_COWERING)) { - iVar2->action.facingDir = (iVar2->action.facingDir + 4) & DIRECTION_MASK; + if ((param_2 != 0) && (entityData->volatileStatus == VOLATILE_STATUS_COWERING)) { + entityData->action.facingDir = (entityData->action.facingDir + 4) & DIRECTION_MASK; TargetTileInFront(param_1); } - else if (iVar2->volatileStatus == VOLATILE_STATUS_CONFUSED) { - iVar2->action.facingDir = DungeonRandomCapped(NUM_DIRECTIONS); + else if (entityData->volatileStatus == VOLATILE_STATUS_CONFUSED) { + entityData->action.facingDir = DungeonRandomCapped(NUM_DIRECTIONS); TargetTileInFront(param_1); } } @@ -1035,7 +1037,7 @@ void SqueezedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * SetMessageArgument(gAvailablePokemonNames,target,0); if (entityData->immobilizeStatus != IMMOBILIZE_STATUS_SQUEEZED) { entityData->immobilizeStatus = IMMOBILIZE_STATUS_SQUEEZED; - entityData->immobilizeStatusTurnsLeft = CalculateStatusTurns(target,gUnknown_80F4E58,1) + 1; + entityData->immobilizeStatusTurnsLeft = CalculateStatusTurns(target,gUnknown_80F4E58,TRUE) + 1; entityData->immobilizeStatusDamageTimer = 0; entityData->unkB4 = param_3_s32; nullsub_71(target); @@ -1049,7 +1051,7 @@ void SqueezedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * } } -void sub_80769CC(struct DungeonEntity * pokemon, struct DungeonEntity * target) +void ImmobilizedStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target) { struct DungeonEntityData *entityData; @@ -1368,9 +1370,6 @@ void RaiseAttackStageTarget(struct DungeonEntity * pokemon, struct DungeonEntity DungeonEntityUpdateStatusSprites(target); } -extern u8 *gUnknown_80FC138[]; -extern u8 *gUnknown_80FC21C[]; - void RaiseDefenseStageTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 index, s32 increment) { struct DungeonEntityData *entityData; diff --git a/src/status.c b/src/status.c index 8f4334fd..f50e9839 100644 --- a/src/status.c +++ b/src/status.c @@ -208,7 +208,7 @@ void UpdateFlashFireBoost(struct DungeonEntity * pokemon, struct DungeonEntity * } } -void sub_80772C0(struct DungeonEntity *pokemon, struct DungeonEntity *target, u32 statStage, s32 param_4, bool8 displayMessage) +void ChangeAttackMultiplierTarget(struct DungeonEntity *pokemon, struct DungeonEntity *target, u32 statStage, s32 param_4, bool8 displayMessage) { struct DungeonEntityData *entityData; s32 oldMulti; @@ -273,7 +273,7 @@ void sub_80772C0(struct DungeonEntity *pokemon, struct DungeonEntity *target, u3 DungeonEntityUpdateStatusSprites(target); } -void sub_8077434(struct DungeonEntity *pokemon, struct DungeonEntity *target, u32 statStage, s32 param_4, bool8 displayMessage) +void ChangeDefenseMultiplierTarget(struct DungeonEntity *pokemon, struct DungeonEntity *target, u32 statStage, s32 param_4, bool8 displayMessage) { struct DungeonEntityData *entityData; s32 oldMulti; @@ -324,7 +324,7 @@ void sub_8077434(struct DungeonEntity *pokemon, struct DungeonEntity *target, u3 DungeonEntityUpdateStatusSprites(target); } -void sub_8077540(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 statStage) +void RaiseAccuracyStageTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 statStage) { struct DungeonEntityData *entityData; @@ -349,7 +349,7 @@ void sub_8077540(struct DungeonEntity * pokemon, struct DungeonEntity * target, } } -void sub_80775DC(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 statStage, bool8 displayMessage) +void LowerAccuracyStageTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 statStage, bool8 displayMessage) { struct DungeonEntityData *entityData; @@ -474,7 +474,7 @@ void ParalyzeStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * } } -void sub_8077910(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 turns, bool8 displayMessage) +void RaiseMovementSpeedTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 turns, bool8 displayMessage) { s32 movSpeed; s32 index; @@ -518,7 +518,7 @@ void sub_8077910(struct DungeonEntity * pokemon, struct DungeonEntity * target, DungeonEntityUpdateStatusSprites(target); } -void sub_80779F0(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 param_3, bool8 displayMessage) +void LowerMovementSpeedTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 levels, bool8 displayMessage) { s32 movSpeed; s32 counter; @@ -540,7 +540,7 @@ void sub_80779F0(struct DungeonEntity * pokemon, struct DungeonEntity * target, sub_80522F4(pokemon,target,*gUnknown_80FC2D8); } else { - for(counter = 0; counter < param_3; counter++) + for(counter = 0; counter < levels; counter++) { for(index = 0; index < NUM_SPEED_TURN_COUNTERS; index++) { @@ -624,7 +624,7 @@ void CowerStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * ta } } -void HealTargetHP(struct DungeonEntity *pokemon, struct DungeonEntity *target, s32 param_3, s32 param_4, u32 displayMessage) +void HealTargetHP(struct DungeonEntity *pokemon, struct DungeonEntity *target, s32 param_3, s32 param_4, bool32 displayMessage) { struct DungeonEntityData *entityData; s32 HP; @@ -1030,7 +1030,7 @@ void sub_80783C4(struct DungeonEntity * pokemon, struct DungeonEntity * target, void CurseStatusTarget(struct DungeonEntity *pokemon, struct DungeonEntity * target) { - u32 uVar1; + u32 statStage; s32 HP; struct DungeonEntityData * pokemonEntityData; struct DungeonEntityData * targetEntityData; @@ -1059,10 +1059,10 @@ void CurseStatusTarget(struct DungeonEntity *pokemon, struct DungeonEntity * tar sub_80522F4(pokemon,target,*gUnknown_80FB004); } else { - uVar1 = gUnknown_8106A4C; - RaiseAttackStageTarget(pokemon,pokemon,uVar1,1); - RaiseDefenseStageTarget(pokemon,pokemon,uVar1,1); - sub_80779F0(pokemon,pokemon,1,1); + statStage = gUnknown_8106A4C; + RaiseAttackStageTarget(pokemon,pokemon,statStage,1); + RaiseDefenseStageTarget(pokemon,pokemon,statStage,1); + LowerMovementSpeedTarget(pokemon,pokemon,1,TRUE); } DungeonEntityUpdateStatusSprites(target); } diff --git a/src/status_checker.c b/src/status_checker.c index bfbc1901..c94b3229 100644 --- a/src/status_checker.c +++ b/src/status_checker.c @@ -55,7 +55,6 @@ extern void sub_807FE04(u32 *, u32); extern void sub_807DB74(struct DungeonEntity *); extern void SetMessageArgument(char[], struct DungeonEntity*, u32); extern void HandleLuminousOrbAction(struct DungeonEntity *pokemon); -extern void PetrifiedStatusTarget(struct DungeonEntity *, struct DungeonEntity *); extern void sub_807D510(struct DungeonEntity *, struct DungeonEntity *); extern void sub_807DA14(struct DungeonEntity *, struct DungeonEntity *, s32); extern s16 sub_803D970(u32); @@ -70,17 +69,25 @@ extern void sub_807D3CC(struct DungeonEntity *, struct DungeonEntity *); extern u8 sub_8069D18(s32 *); extern u8 sub_804AD34(s32 *); extern u8 sub_8057308(struct DungeonEntity *, u32); -extern void LowerDefenseStageTarget(struct DungeonEntity *, struct DungeonEntity *, u32, u32, u32, u32); -extern void RaiseAttackStageTarget(struct DungeonEntity *, struct DungeonEntity *, u32, u32); + + +// TODO include dungeon_ai.h when SqueezedStatusTarget is figured out +extern void LowerDefenseStageTarget(struct DungeonEntity *, struct DungeonEntity *, s32, s32, u8, bool8); +extern void RaiseAttackStageTarget(struct DungeonEntity *, struct DungeonEntity *, s32, s32); +extern void PoisonedStatusTarget(struct DungeonEntity *, struct DungeonEntity *, bool8); +extern void RaiseDefenseStageTarget(struct DungeonEntity *, struct DungeonEntity *, s32, s32); +extern void InfatuateStatusTarget(struct DungeonEntity *, struct DungeonEntity *, bool8); +extern void LowerAttackStageTarget(struct DungeonEntity *, struct DungeonEntity *, s32, s32, u8, bool8); +extern void PetrifiedStatusTarget(struct DungeonEntity *, struct DungeonEntity *); +extern void WrapTarget(struct DungeonEntity *, struct DungeonEntity *); + +// TODO having matching issues when this isn't s32.. +extern void SqueezedStatusTarget(struct DungeonEntity *, struct DungeonEntity *, s32, bool32); + extern void sub_806F324(struct DungeonEntity *, s32, u32, u32); -extern void RaiseDefenseStageTarget(struct DungeonEntity *, struct DungeonEntity *, u32, u32); extern bool8 sub_805755C(struct DungeonEntity* pokemon,u16 moveID); -extern void InfatuateStatusTarget(struct DungeonEntity *, struct DungeonEntity *, u32); -extern void LowerAttackStageTarget(struct DungeonEntity *, struct DungeonEntity *, u32, u32, u32, u32); extern void sub_80783C4(struct DungeonEntity *, struct DungeonEntity *, u32); extern bool8 sub_807FCD4(struct Position *, u32, u8); -extern void WrapTarget(struct DungeonEntity *, struct DungeonEntity *); -extern void SqueezedStatusTarget(struct DungeonEntity *, struct DungeonEntity *, s32, s32); extern void sub_807CD9C(struct DungeonEntity *, struct DungeonEntity *, u8 facingDir); @@ -231,7 +238,6 @@ const u8 gDungeonCamouflageTypes[76] = { extern s16 gUnknown_80F4DC6; extern u8 *gUnknown_80FEFF4[]; -extern void PoisonedStatusTarget(struct DungeonEntity *, struct DungeonEntity *, u32); extern u32 gUnknown_80F51C4[]; @@ -405,30 +411,28 @@ bool8 TrapperOrbAction(struct DungeonEntity * pokemon, struct DungeonEntity * ta return trapLaid; } -s32 sub_805B264(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove *move, s32 param_4) +bool8 sub_805B264(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove *move, s32 param_4) { - u32 uVar2; s32 r3; - s32 r6; + bool8 r6; s32 iVar5; struct DungeonEntityData *entityData; entityData = target->entityData; r3 = gUnknown_202F224; - r6 = 0; + r6 = FALSE; gDungeonGlobalData->unk18200 = gUnknown_8106A8C[r3]; gDungeonGlobalData->unk18204 = 0; iVar5 = gUnknown_80F4F94[r3]; - if (entityData->chargingStatus == 0xA) { - iVar5 = iVar5 << 1; + if (entityData->chargingStatus == CHARGING_STATUS_DIG) { + iVar5 *= 2; } - uVar2 = sub_8055864(pokemon,target,move,iVar5,param_4); - r6 = -((int)(-uVar2 | uVar2) >> 0x1f); + r6 = sub_8055864(pokemon,target,move,iVar5,param_4) ? TRUE : FALSE; return r6; } -bool8 sub_805B2E4(struct DungeonEntity * pokemon,struct DungeonEntity * target,struct PokemonMove *move, s32 param_4) +bool8 MagicCoatMoveAction(struct DungeonEntity * pokemon,struct DungeonEntity * target,struct PokemonMove *move, s32 param_4) { MagicCoatStatusTarget(pokemon, target); return TRUE; @@ -466,7 +470,7 @@ bool8 sub_805B324(struct DungeonEntity * pokemon,struct DungeonEntity * target,s return uVar3; } -bool8 sub_805B37C(struct DungeonEntity * pokemon,struct DungeonEntity * target,struct PokemonMove *move, s32 param_4) +bool8 DestinyBondMoveAction(struct DungeonEntity * pokemon,struct DungeonEntity * target,struct PokemonMove *move, s32 param_4) { DestinyBondStatusTarget(pokemon, target); return TRUE; @@ -477,7 +481,7 @@ bool8 sub_805B388(struct DungeonEntity * pokemon,struct DungeonEntity * target,s return (sub_8055640(pokemon,target,move,0x100,param_4)) ? TRUE : FALSE; } -bool8 sub_805B3A8(struct DungeonEntity * pokemon,struct DungeonEntity * target,struct PokemonMove *move, s32 param_4) +bool8 MirrorCoatMoveAction(struct DungeonEntity * pokemon,struct DungeonEntity * target,struct PokemonMove *move, s32 param_4) { MirrorCoatStatusTarget(pokemon, target); return TRUE; @@ -666,7 +670,7 @@ bool8 sub_805B668(struct DungeonEntity * pokemon, struct DungeonEntity * target, sub_806F324(pokemon,iVar4,0xd,0x1fa); } else { - HealTargetHP(pokemon,pokemon,iVar4,0,1); + HealTargetHP(pokemon,pokemon,iVar4,0,TRUE); } } } @@ -724,7 +728,7 @@ bool8 RecycleMoveAction(struct DungeonEntity * pokemon, struct DungeonEntity * t return isTMRecycled; } -bool8 sub_805B7FC(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove *move, s32 param_4) +bool8 ReflectMoveAction(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove *move, s32 param_4) { ReflectStatusTarget(pokemon, target); return TRUE; @@ -743,7 +747,7 @@ bool8 sub_805B808(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 sub_805B884( struct DungeonEntity * pokemon, struct DungeonEntity * target) { RaiseAttackStageTarget(pokemon, target, gUnknown_8106A4C, 1); - sub_8077910(pokemon, target, 0, TRUE); + RaiseMovementSpeedTarget(pokemon, target, 0, TRUE); return TRUE; } @@ -964,7 +968,7 @@ bool8 CleanseOrbAction(struct DungeonEntity * pokemon, struct DungeonEntity * ta bool8 sub_805BC70(struct DungeonEntity * pokemon, struct DungeonEntity * target) { - sub_8075C58(pokemon,target,CalculateStatusTurns(target, gUnknown_80F4E74, TRUE), 1); + sub_8075C58(pokemon,target,CalculateStatusTurns(target, gUnknown_80F4E74, TRUE), TRUE); return TRUE; } @@ -1065,7 +1069,7 @@ bool8 TransferOrbAction(struct DungeonEntity *pokemon, struct DungeonEntity * ta bool8 sub_805BE90(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - sub_80779F0(pokemon, target, 1, TRUE); + LowerMovementSpeedTarget(pokemon, target, 1, TRUE); return TRUE; }