diff --git a/asm/code_80521D0.s b/asm/code_80521D0.s index 1c5a92221..d139f6849 100644 --- a/asm/code_80521D0.s +++ b/asm/code_80521D0.s @@ -4301,7 +4301,7 @@ _080549C8: adds r1, r5, 0 mov r2, r8 mov r3, r9 - bl sub_8057954 + bl RageMoveAction bl _080554BA _080549D8: adds r0, r7, 0 @@ -4716,7 +4716,7 @@ _08054D64: adds r1, r5, 0 mov r2, r8 mov r3, r9 - bl sub_805867C + bl FocusPunchMoveAction b _080554BA _08054D72: adds r0, r7, 0 @@ -5180,7 +5180,7 @@ _08055104: adds r1, r5, 0 mov r2, r8 mov r3, r9 - bl sub_8059060 + bl ChargeMoveAction b _080554BA _08055112: adds r0, r7, 0 diff --git a/asm/code_8057824.s b/asm/code_8057824.s index 96a321b47..4e68e5669 100644 --- a/asm/code_8057824.s +++ b/asm/code_8057824.s @@ -498,7 +498,7 @@ _080596EC: adds r1, r5, 0 movs r2, 0x2 adds r3, r6, 0 - bl sub_8079618 + bl SetChargeStatusTarget movs r4, 0x1 _08059700: adds r0, r4, 0 @@ -611,7 +611,7 @@ _080597CC: adds r1, r5, 0 movs r2, 0x7 adds r3, r4, 0 - bl sub_8079618 + bl SetChargeStatusTarget movs r4, 0x1 _080597E0: adds r0, r4, 0 @@ -717,7 +717,7 @@ _080598A4: adds r1, r4, 0 movs r2, 0x9 adds r3, r5, 0 - bl sub_8079618 + bl SetChargeStatusTarget movs r6, 0x1 _080598B8: adds r0, r6, 0 @@ -1657,7 +1657,7 @@ _08059FA0: adds r1, r4, 0 movs r2, 0x8 adds r3, r5, 0 - bl sub_8079618 + bl SetChargeStatusTarget movs r0, 0x1 mov r8, r0 _08059FB6: diff --git a/asm/code_806CD90.s b/asm/code_806CD90.s index e98e2a508..b70782faf 100644 --- a/asm/code_806CD90.s +++ b/asm/code_806CD90.s @@ -772,7 +772,7 @@ _0806D62A: cmp r0, 0x7F bne _0806D63A adds r0, r7, 0 - bl sub_807A9B0 + bl WakeUpPokemon _0806D63A: adds r0, r7, 0 movs r1, 0x23 diff --git a/asm/code_806E8B0.s b/asm/code_806E8B0.s index 3596b4d3f..2fa9b9bda 100644 --- a/asm/code_806E8B0.s +++ b/asm/code_806E8B0.s @@ -5,288 +5,6 @@ .text - thumb_func_start sub_806E8B0 -sub_806E8B0: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - adds r6, r0, 0 - mov r9, r1 - adds r0, r2, 0 - str r3, [sp] - lsls r0, 24 - lsrs r0, 24 - movs r7, 0x1 - movs r1, 0x1 - mov r8, r1 - movs r2, 0x1 - str r2, [sp, 0x4] - str r1, [sp, 0x8] - bl sub_8092354 - movs r2, 0 - mov r10, r2 - lsls r0, 24 - cmp r0, 0 - bne _0806E8E6 - movs r0, 0x1 - mov r10, r0 -_0806E8E6: - adds r0, r6, 0 - movs r1, 0x11 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806E92C - ldr r5, [r6, 0x70] - adds r0, r6, 0 - bl HasNegativeStatus - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl SetVisualFlags - lsls r0, 24 - lsrs r0, 24 - cmp r4, 0 - beq _0806E916 - movs r7, 0x2 -_0806E916: - cmp r0, 0 - beq _0806E92C - adds r0, r6, 0 - bl sub_80428B0 - ldr r0, _0806EADC - ldr r2, [r0] - adds r0, r6, 0 - mov r1, r9 - bl sub_80522F4 -_0806E92C: - adds r0, r6, 0 - movs r1, 0x22 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - bne _0806E948 - adds r0, r6, 0 - movs r1, 0x4B - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806E98E -_0806E948: - ldr r2, [r6, 0x70] - movs r4, 0 - ldr r0, [sp, 0x30] - cmp r0, 0x20 - bgt _0806E95A - mov r1, r10 - cmp r1, 0 - bne _0806E95A - movs r4, 0x1 -_0806E95A: - movs r1, 0x80 - lsls r1, 1 - adds r0, r2, 0 - adds r2, r4, 0 - bl SetVisualFlags - lsls r0, 24 - lsrs r1, r0, 24 - cmp r4, 0 - beq _0806E978 - lsls r0, r7, 1 - adds r7, r0, r7 - mov r2, r8 - lsls r2, 1 - mov r8, r2 -_0806E978: - cmp r1, 0 - beq _0806E98E - adds r0, r6, 0 - bl sub_80428C4 - ldr r0, _0806EAE0 - ldr r2, [r0] - adds r0, r6, 0 - mov r1, r9 - bl sub_80522F4 -_0806E98E: - adds r0, r6, 0 - movs r1, 0x30 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806E9AC - mov r0, r10 - cmp r0, 0 - bne _0806E9AC - lsls r0, r7, 1 - adds r7, r0, r7 - mov r1, r8 - lsls r1, 1 - mov r8, r1 -_0806E9AC: - ldr r0, [r6, 0x70] - ldrb r0, [r0, 0x6] - movs r4, 0x1 - cmp r0, 0 - beq _0806E9B8 - movs r4, 0 -_0806E9B8: - adds r0, r6, 0 - movs r1, 0x38 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806E9EA - mov r2, r10 - cmp r2, 0x1 - bne _0806E9EA - ldr r0, _0806EAE4 - ldr r0, [r0] - ldr r1, _0806EAE8 - adds r0, r1 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _0806E9EA - lsls r0, r7, 4 - subs r7, r0, r7 - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 1 - mov r8, r0 -_0806E9EA: - adds r0, r6, 0 - movs r1, 0x3F - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806EA1C - mov r0, r10 - cmp r0, 0x1 - bne _0806EA1C - ldr r0, _0806EAE4 - ldr r0, [r0] - ldr r1, _0806EAEC - adds r0, r1 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _0806EA1C - lsls r0, r7, 4 - subs r7, r0, r7 - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 1 - mov r8, r0 -_0806EA1C: - mov r0, r9 - movs r1, 0x6 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806EA38 - mov r0, r10 - cmp r0, 0 - bne _0806EA38 - lsls r7, 2 - mov r1, r8 - lsls r0, r1, 2 - add r8, r0 -_0806EA38: - mov r0, r9 - movs r1, 0x34 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806EA90 - mov r2, r10 - cmp r2, 0 - bne _0806EA90 - mov r0, r9 - ldr r5, [r0, 0x70] - bl HasNegativeStatus - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x8 - adds r2, r4, 0 - bl SetVisualFlags - lsls r0, 24 - lsrs r1, r0, 24 - cmp r4, 0 - beq _0806EA7A - ldr r2, [sp, 0x4] - lsls r0, r2, 1 - adds r2, r0, r2 - str r2, [sp, 0x4] - ldr r0, [sp, 0x8] - lsls r0, 1 - str r0, [sp, 0x8] -_0806EA7A: - cmp r1, 0 - beq _0806EA90 - mov r0, r9 - bl sub_8042940 - ldr r0, _0806EAF0 - ldr r2, [r0] - adds r0, r6, 0 - mov r1, r9 - bl sub_80522F4 -_0806EA90: - ldr r1, [sp] - ldr r0, [r1] - muls r0, r7 - str r0, [r1] - ldr r2, [sp, 0x2C] - ldr r0, [r2] - ldr r1, [sp, 0x4] - muls r0, r1 - str r0, [r2] - mov r2, r8 - cmp r2, 0x1 - beq _0806EAB6 - ldr r1, [sp] - ldr r0, [r1] - mov r1, r8 - bl __divsi3 - ldr r2, [sp] - str r0, [r2] -_0806EAB6: - ldr r0, [sp, 0x8] - cmp r0, 0x1 - beq _0806EACA - ldr r1, [sp, 0x2C] - ldr r0, [r1] - ldr r1, [sp, 0x8] - bl __divsi3 - ldr r2, [sp, 0x2C] - str r0, [r2] -_0806EACA: - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0806EADC: .4byte gUnknown_80FEE04 -_0806EAE0: .4byte gUnknown_80FEE2C -_0806EAE4: .4byte gDungeonGlobalData -_0806EAE8: .4byte 0x000037fa -_0806EAEC: .4byte 0x000037f8 -_0806EAF0: .4byte gUnknown_80FEE54 - thumb_func_end sub_806E8B0 - thumb_func_start sub_806EAF4 sub_806EAF4: push {r4-r7,lr} diff --git a/asm/code_80701A4.s b/asm/code_80701A4.s deleted file mode 100644 index df0521b9e..000000000 --- a/asm/code_80701A4.s +++ /dev/null @@ -1,214 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start sub_80701A4 -sub_80701A4: - push {r4-r7,lr} - adds r7, r0, 0 - ldr r6, [r7, 0x70] - movs r4, 0 - ldr r0, _080701D4 - adds r1, r7, 0 - movs r2, 0 - bl SetMessageArgument - adds r0, r6, 0 - adds r0, 0x44 - movs r1, 0x1 - bl SetAction - adds r0, r6, 0 - adds r0, 0xA8 - ldrb r0, [r0] - cmp r0, 0x3 - beq _080701DC - cmp r0, 0x3 - bgt _080701D8 - cmp r0, 0x1 - beq _080701DC - b _080701E4 - .align 2, 0 -_080701D4: .4byte gAvailablePokemonNames -_080701D8: - cmp r0, 0x5 - bne _080701E4 -_080701DC: - ldr r0, _080701E0 - b _08070278 - .align 2, 0 -_080701E0: .4byte gUnknown_80F95EC -_080701E4: - adds r0, r6, 0 - adds r0, 0xB0 - ldrb r0, [r0] - cmp r0, 0x3 - beq _0807020C - cmp r0, 0x3 - bgt _080701F8 - cmp r0, 0x1 - beq _08070202 - b _0807021C -_080701F8: - cmp r0, 0x4 - beq _08070214 - cmp r0, 0x6 - beq _08070280 - b _0807021C -_08070202: - ldr r0, _08070208 - b _08070278 - .align 2, 0 -_08070208: .4byte gPtrFrozenMessage -_0807020C: - ldr r0, _08070210 - b _08070278 - .align 2, 0 -_08070210: .4byte gPtrWrappedAroundMessage -_08070214: - ldr r0, _08070218 - b _08070278 - .align 2, 0 -_08070218: .4byte gPtrWrappedByMessage -_0807021C: - adds r0, r6, 0 - adds r0, 0xBC - ldrb r0, [r0] - cmp r0, 0x8 - bhi _0807026C - lsls r0, 2 - ldr r1, _08070230 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08070230: .4byte _08070234 - .align 2, 0 -_08070234: - .4byte _0807026C - .4byte _0807026C - .4byte _08070258 - .4byte _0807025C - .4byte _0807026C - .4byte _0807026C - .4byte _0807026C - .4byte _08070264 - .4byte _0807026C -_08070258: - movs r4, 0x1 - b _0807026C -_0807025C: - ldr r0, _08070260 - b _08070278 - .align 2, 0 -_08070260: .4byte gPtrPausedMessage -_08070264: - ldr r0, _08070268 - b _08070278 - .align 2, 0 -_08070268: .4byte gPtrInfatuatedMessage -_0807026C: - adds r0, r6, 0 - adds r0, 0xC0 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08070288 - ldr r0, _08070284 -_08070278: - ldr r1, [r0] - adds r0, r7, 0 - bl SendMessage -_08070280: - movs r0, 0x1 - b _08070322 - .align 2, 0 -_08070284: .4byte gPtrBideMessage -_08070288: - cmp r0, 0 - beq _08070320 - cmp r0, 0xB - beq _08070320 - cmp r0, 0xC - beq _08070320 - cmp r4, 0 - beq _080702A8 - ldr r0, _080702A4 - ldr r1, [r0] - adds r0, r7, 0 - bl SendMessage - b _0807031A - .align 2, 0 -_080702A4: .4byte gPtrMoveInterruptedMessage -_080702A8: - movs r5, 0 - movs r0, 0x8C - lsls r0, 1 - adds r4, r6, r0 -_080702B0: - ldrb r1, [r4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08070312 - adds r0, r7, 0 - adds r1, r4, 0 - bl MoveMatchesChargingStatus - lsls r0, 24 - cmp r0, 0 - beq _08070312 - adds r0, r6, 0 - adds r0, 0xC2 - ldrb r0, [r0] - cmp r0, r5 - bne _08070312 - adds r0, r6, 0 - adds r0, 0x44 - movs r1, 0x14 - bl SetAction - adds r3, r5, 0 - adds r7, r6, 0 - adds r7, 0x50 - cmp r5, 0 - ble _0807030E - ldrb r1, [r4] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0807030E - movs r4, 0x2 - lsls r0, r5, 3 - movs r1, 0x8C - lsls r1, 1 - adds r0, r1 - adds r2, r0, r6 -_080702FC: - subs r2, 0x8 - subs r3, 0x1 - cmp r3, 0 - ble _0807030E - ldrb r1, [r2] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - bne _080702FC -_0807030E: - strb r3, [r7] - b _08070280 -_08070312: - adds r4, 0x8 - adds r5, 0x1 - cmp r5, 0x3 - ble _080702B0 -_0807031A: - adds r0, r7, 0 - bl sub_8079764 -_08070320: - movs r0, 0 -_08070322: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80701A4 - - .align 2, 0 \ No newline at end of file diff --git a/include/code_8077274_1.h b/include/code_8077274_1.h index 0d8a4fb9b..03984b7bf 100644 --- a/include/code_8077274_1.h +++ b/include/code_8077274_1.h @@ -16,7 +16,7 @@ void sub_8079490(struct DungeonEntity * pokemon,struct DungeonEntity * target, s void sub_8079500(struct DungeonEntity * pokemon,struct DungeonEntity * target, s32 param_3); void LongTossStatusTarget(struct DungeonEntity * pokemon,struct DungeonEntity * target); void PierceStatusTarget(struct DungeonEntity * pokemon,struct DungeonEntity * target); -void sub_8079618(struct DungeonEntity *pokemon, struct DungeonEntity *target, u8 newStatus, struct PokemonMove *move, u8 *message); +void SetChargeStatusTarget(struct DungeonEntity *pokemon, struct DungeonEntity *target, u8 newStatus, struct PokemonMove *move, u8 *message); void sub_8079764(struct DungeonEntity * pokemon); void sub_80797A0(struct DungeonEntity * pokemon, struct DungeonEntity * target, u8 newStatus); void SafeguardStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target); @@ -31,7 +31,6 @@ void EndureStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * t void MirrorMoveStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target); void Conversion2StatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target); void VitalThrowStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target); -void sub_8079618(struct DungeonEntity * pokemon, struct DungeonEntity *target, u8 newStatus, struct PokemonMove *move, u8 *message); void sub_8079F20(struct DungeonEntity * pokemon, struct DungeonEntity * target, u8 param_3, u8 param_4); void sub_807A0CC(struct DungeonEntity * pokemon, struct DungeonEntity * target); void SendSleepEndMessage(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 param_3, bool8 param_4); @@ -46,7 +45,7 @@ void SendTransformEndMessage(struct DungeonEntity * pokemon, struct DungeonEntit void SendEyesightEndMessage(struct DungeonEntity * pokemon,struct DungeonEntity * target); void SendMuzzledEndMessage(struct DungeonEntity * pokemon, struct DungeonEntity * target); void sub_807A96C(struct DungeonEntity *pokemon, struct DungeonEntity *target); -void sub_807A9B0(struct DungeonEntity * pokemon); +void WakeUpPokemon(struct DungeonEntity * pokemon); void SendThawedMessage(struct DungeonEntity *pokemon, struct DungeonEntity *target); void sub_807AA30(void); diff --git a/ld_script.txt b/ld_script.txt index 2ddeeb517..13c486c08 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -229,9 +229,9 @@ SECTIONS { src/code_806CD90.o(.text); asm/code_806CD90.o(.text); src/type_effectiveness.o(.text); + src/code_806E8B0.o(.text); asm/code_806E8B0.o(.text); src/status_checks.o(.text); - asm/code_80701A4.o(.text); src/dungeon_movement.o(.text); asm/code_807034C.o(.text); src/dungeon_movement_1.o(.text); diff --git a/src/code_8057824.c b/src/code_8057824.c index 34a20530d..9a983ea50 100644 --- a/src/code_8057824.c +++ b/src/code_8057824.c @@ -270,7 +270,7 @@ bool8 DigMoveAction(struct DungeonEntity * pokemon, struct DungeonEntity * targe sub_8079764(pokemon); } else { - sub_8079618(pokemon,pokemon,10,move,*gUnknown_80FAD4C); // $m0 burrowed underground! + SetChargeStatusTarget(pokemon,pokemon,CHARGING_STATUS_DIG,move,*gUnknown_80FAD4C); // $m0 burrowed underground! } flag = TRUE; } @@ -335,10 +335,10 @@ bool32 sub_8057948(struct DungeonEntity *pokemon, struct DungeonEntity *target) return TRUE; } -bool32 sub_8057954(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move) +bool32 RageMoveAction(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move) { // {ARG_POKEMON_0} is enraged - sub_8079618(pokemon,target,0xc,move,gUnknown_80FAC88); + SetChargeStatusTarget(pokemon,target,CHARGING_STATUS_RAGE,move,gUnknown_80FAC88); return TRUE; } @@ -861,7 +861,7 @@ bool8 RazorWindMoveAction(struct DungeonEntity * pokemon, struct DungeonEntity * sub_8079764(pokemon); } else { - sub_8079618(pokemon,pokemon,CHARGING_STATUS_RAZOR_WIND,move,*gUnknown_80FAC54); + SetChargeStatusTarget(pokemon,pokemon,CHARGING_STATUS_RAZOR_WIND,move,*gUnknown_80FAC54); flag = TRUE; } return flag; @@ -869,7 +869,7 @@ bool8 RazorWindMoveAction(struct DungeonEntity * pokemon, struct DungeonEntity * bool8 BideMoveAction(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { - sub_8079618(pokemon, target, CHARGING_STATUS_BIDE, move, *gUnknown_80FAC74); + SetChargeStatusTarget(pokemon, target, CHARGING_STATUS_BIDE, move, *gUnknown_80FAC74); return TRUE; } @@ -1012,7 +1012,7 @@ bool8 sub_8058638(struct DungeonEntity *pokemon, struct DungeonEntity *target, s return flag; } -bool8 sub_805867C(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove * move, u32 param_4) +bool8 FocusPunchMoveAction(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove * move, u32 param_4) { bool8 flag; @@ -1021,7 +1021,7 @@ bool8 sub_805867C(struct DungeonEntity * pokemon, struct DungeonEntity * target, sub_8079764(pokemon); } else { - sub_8079618(pokemon,pokemon,CHARGING_STATUS_FOCUS_PUNCH,move,*gUnknown_80FACA4); + SetChargeStatusTarget(pokemon,pokemon,CHARGING_STATUS_FOCUS_PUNCH,move,*gUnknown_80FACA4); flag = TRUE; } return flag; @@ -1244,7 +1244,7 @@ bool8 SkyAttackMoveAction(struct DungeonEntity *pokemon, struct DungeonEntity *t sub_8079764(pokemon); } else { - sub_8079618(pokemon, pokemon, CHARGING_STATUS_SKY_ATTACK, move, *gUnknown_80FACC4); + SetChargeStatusTarget(pokemon, pokemon, CHARGING_STATUS_SKY_ATTACK, move, *gUnknown_80FACC4); flag = TRUE; } return flag; @@ -1532,9 +1532,9 @@ bool8 sub_8059050(struct DungeonEntity *pokemon, struct DungeonEntity *target, s return TRUE; } -bool8 sub_8059060(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) +bool8 ChargeMoveAction(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { - sub_8079618(pokemon, target, CHARGING_STATUS_CHARGE, move, *gUnknown_80FAD6C); + SetChargeStatusTarget(pokemon, target, CHARGING_STATUS_CHARGE, move, *gUnknown_80FAD6C); return TRUE; } diff --git a/src/code_806E8B0.c b/src/code_806E8B0.c new file mode 100644 index 000000000..38b73ba2e --- /dev/null +++ b/src/code_806E8B0.c @@ -0,0 +1,123 @@ +#include "global.h" +#include "constants/ability.h" +#include "dungeon_global_data.h" +#include "dungeon_pokemon_attributes.h" +#include "status_checks_1.h" +#include "text_util.h" + +extern u8 *gUnknown_80FEE04[]; +extern u8 *gUnknown_80FEE2C[]; +extern u8 *gUnknown_80FEE54[]; + +void sub_8042940(struct DungeonEntity *r0); +void sub_80428B0(struct DungeonEntity *r0); +void sub_80428C4(struct DungeonEntity *r0); +void sub_80522F4(struct DungeonEntity *r0, struct DungeonEntity *r1, const char r2[]); + +void sub_806E8B0(struct DungeonEntity * pokemon, struct DungeonEntity * target, u8 param_3, s32 *param_4, s32 *param_5, s32 param_6) +{ + bool8 hasNegStatus_pokemon; + bool8 visFlags_pokemon_1; + bool8 visFlags_pokemon_2; + bool8 hasNegStatus_target; + bool8 visFlags_target; + s32 iVar3; + bool32 isNotEnemy; + struct DungeonEntityData * entityData; + struct DungeonEntityData * entityData_1; + s32 r7; + s32 r8; + s32 r10; + s32 sp_0x4; + s32 sp_0x8; + + r7 = 1; + r8 = 1; + sp_0x4 = 1; + sp_0x8 = 1; + r10 = sub_8092354(param_3) == 0; + + + if (HasAbility(pokemon, ABILITY_GUTS)) { + entityData = pokemon->entityData; + hasNegStatus_pokemon = HasNegativeStatus(pokemon); + visFlags_pokemon_1 = SetVisualFlags(entityData,1,hasNegStatus_pokemon); + if (hasNegStatus_pokemon) { + r7 = 2; + } + if (visFlags_pokemon_1) { + sub_80428B0(pokemon); + sub_80522F4(pokemon,target,*gUnknown_80FEE04); // Guts boosted its power + } + } + + if ((HasAbility(pokemon, ABILITY_HUGE_POWER)) || (HasAbility(pokemon, ABILITY_PURE_POWER))) { + entityData_1 = pokemon->entityData; + iVar3 = 0; + if ((param_6 < 0x21) && (!r10)) { + iVar3 = 1; + } + visFlags_pokemon_2 = SetVisualFlags(entityData_1,0x100,iVar3); + if (iVar3 != 0) { + r7 *= 3; + r8 <<= 1; + } + if (visFlags_pokemon_2) { + sub_80428C4(pokemon); + sub_80522F4(pokemon,target,*gUnknown_80FEE2C); // It's special ability boosted Attack + } + } + + if ((HasAbility(pokemon, ABILITY_HUSTLE)) && (!r10)) { + r7 *= 3; + r8 <<= 1; + } + + if(pokemon->entityData->isEnemy) + { + isNotEnemy = FALSE; + } + else + { + isNotEnemy = TRUE; + } + + if ((HasAbility(pokemon, ABILITY_PLUS)) && (r10 == 1) && gDungeonGlobalData->hasMinus[isNotEnemy]) { + r7 *= 15; + r8 *= 10; + } + + // ABILITY_MINUS + if ((HasAbility(pokemon, ABILITY_MINUS)) && (r10 == 1) && gDungeonGlobalData->hasPlus[isNotEnemy]) { + r7 *= 15; + r8 *= 10; + } + + if (HasAbility(target, ABILITY_INTIMIDATE) && (!r10)) { + r7 <<= 2; + r8 *= 5; + } + + if ((HasAbility(target, ABILITY_MARVEL_SCALE)) && (!r10)) { + entityData = target->entityData; + hasNegStatus_target = HasNegativeStatus(target); + visFlags_target = SetVisualFlags(entityData, 8, hasNegStatus_target); + if (hasNegStatus_target) { + sp_0x4 *= 3; + sp_0x8 <<= 1; + } + if (visFlags_target) { + sub_8042940(target); + sub_80522F4(pokemon,target,*gUnknown_80FEE54); // Its special ability quickened attacks! + } + } + + *param_4 *= r7; + *param_5 *= sp_0x4; + if (r8 != 1) { + *param_4 = *param_4 / r8; + } + if (sp_0x8 != 1) { + *param_5 = *param_5 / sp_0x8; + } +} diff --git a/src/code_8077274_1.c b/src/code_8077274_1.c index 5d58d84a5..0252ccfa4 100644 --- a/src/code_8077274_1.c +++ b/src/code_8077274_1.c @@ -670,7 +670,7 @@ void PierceStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * t DungeonEntityUpdateStatusSprites(target); } -void sub_8079618(struct DungeonEntity *pokemon, struct DungeonEntity *target, u8 newStatus, struct PokemonMove *move, u8 *message) +void SetChargeStatusTarget(struct DungeonEntity *pokemon, struct DungeonEntity *target, u8 newStatus, struct PokemonMove *move, u8 *message) { bool8 bVar2; struct PokemonMove *movePtr; @@ -1634,7 +1634,7 @@ void sub_807A96C(struct DungeonEntity *pokemon, struct DungeonEntity *target) "_0807A9AC: .4byte 0x00007f01"); } -void sub_807A9B0(struct DungeonEntity * pokemon) +void WakeUpPokemon(struct DungeonEntity * pokemon) { struct DungeonEntityData *entityData; @@ -1715,7 +1715,7 @@ void sub_807AA30(void) if (forceWakeup) { _WakeUp: - sub_807A9B0(wildEntity); + WakeUpPokemon(wildEntity); } } } diff --git a/src/status_actions.c b/src/status_actions.c index b537812dd..968a4c83c 100644 --- a/src/status_actions.c +++ b/src/status_actions.c @@ -682,7 +682,7 @@ bool8 SkullBashMoveAction(struct DungeonEntity * pokemon, struct DungeonEntity * sub_8079764(pokemon); } else { - sub_8079618(pokemon,target,6,move,*gUnknown_80FAFF0); + SetChargeStatusTarget(pokemon,target,CHARGING_STATUS_SKULL_BASH,move,*gUnknown_80FAFF0); flag = TRUE; } return flag; diff --git a/src/status_checks.c b/src/status_checks.c index 12889b576..bbd34802f 100644 --- a/src/status_checks.c +++ b/src/status_checks.c @@ -5,6 +5,8 @@ #include "constants/dungeon_action.h" #include "constants/status.h" #include "code_80521D0.h" +#include "code_8077274_1.h" +#include "charge_move.h" #include "dungeon_action.h" #include "dungeon_ai_attack.h" #include "dungeon_capabilities_1.h" @@ -12,13 +14,15 @@ const s16 gConfusedAttackChance = 70; -extern char *gPtrFrozenMessage; -extern char *gPtrWrappedAroundMessage; -extern char *gPtrWrappedByMessage; -extern char *gPtrBideMessage; -extern char *gPtrPausedMessage; -extern char *gPtrInfatuatedMessage; -extern char gAvailablePokemonNames[]; +extern const char *gPtrFrozenMessage[]; +extern const char *gPtrWrappedAroundMessage[]; +extern const char *gPtrWrappedByMessage[]; +extern const char *gPtrBideMessage[]; +extern const char *gPtrPausedMessage[]; +extern const char *gPtrInfatuatedMessage[]; +extern u8 gAvailablePokemonNames[]; +extern u8 *gUnknown_80F95EC[]; +extern char *gPtrMoveInterruptedMessage[]; extern void SetMessageArgument(char[], struct DungeonEntity*, u32); @@ -37,13 +41,13 @@ bool8 HasStatusAffectingActions(struct DungeonEntity *pokemon) switch (pokemonData->immobilizeStatus) { case IMMOBILIZE_STATUS_FROZEN: - SendMessage(pokemon, gPtrFrozenMessage); + SendMessage(pokemon, *gPtrFrozenMessage); return TRUE; case IMMOBILIZE_STATUS_WRAPPED_AROUND_FOE: - SendMessage(pokemon, gPtrWrappedAroundMessage); + SendMessage(pokemon, *gPtrWrappedAroundMessage); return TRUE; case IMMOBILIZE_STATUS_WRAPPED_BY_FOE: - SendMessage(pokemon, gPtrWrappedByMessage); + SendMessage(pokemon, *gPtrWrappedByMessage); return TRUE; case IMMOBILIZE_STATUS_PETRIFIED: return TRUE; @@ -51,15 +55,15 @@ bool8 HasStatusAffectingActions(struct DungeonEntity *pokemon) switch (pokemonData->volatileStatus) { case VOLATILE_STATUS_PAUSED: - SendMessage(pokemon, gPtrPausedMessage); + SendMessage(pokemon, *gPtrPausedMessage); return TRUE; case VOLATILE_STATUS_INFATUATED: - SendMessage(pokemon, gPtrInfatuatedMessage); + SendMessage(pokemon, *gPtrInfatuatedMessage); return TRUE; } if (pokemonData->chargingStatus == CHARGING_STATUS_BIDE) { - SendMessage(pokemon, gPtrBideMessage); + SendMessage(pokemon, *gPtrBideMessage); return TRUE; } if (pokemonData->waitingStatus == WAITING_STATUS_DECOY) @@ -102,3 +106,96 @@ bool8 HasStatusAffectingActions(struct DungeonEntity *pokemon) } return FALSE; } + +bool8 sub_80701A4(struct DungeonEntity *pokemon) +{ + bool8 flag; + struct PokemonMove *move; + struct PokemonMove *move2; + s32 index; + s32 index_1; + struct DungeonEntityData * entityData; + u8 *r7; + + entityData = pokemon->entityData; + flag = FALSE; + SetMessageArgument(gAvailablePokemonNames, pokemon, 0); + SetAction(&entityData->action, DUNGEON_ACTION_WAIT); + switch(entityData->sleepStatus) + { + case SLEEP_STATUS_SLEEP: + case SLEEP_STATUS_NIGHTMARE: + case SLEEP_STATUS_NAPPING: + SendMessage(pokemon,*gUnknown_80F95EC); + return TRUE; + } + + switch(entityData->immobilizeStatus) + { + case IMMOBILIZE_STATUS_FROZEN: + SendMessage(pokemon,*gPtrFrozenMessage); + return TRUE; + case IMMOBILIZE_STATUS_WRAPPED_AROUND_FOE: + SendMessage(pokemon,*gPtrWrappedAroundMessage); + return TRUE; + case IMMOBILIZE_STATUS_WRAPPED_BY_FOE: + SendMessage(pokemon,*gPtrWrappedByMessage); + return TRUE; + case IMMOBILIZE_STATUS_PETRIFIED: + return TRUE; + } + + switch(entityData->volatileStatus) { + case VOLATILE_STATUS_CONFUSED: + flag = TRUE; + goto _0807026C; + case VOLATILE_STATUS_PAUSED: + SendMessage(pokemon,*gPtrPausedMessage); + return TRUE; + case VOLATILE_STATUS_INFATUATED: + SendMessage(pokemon,*gPtrInfatuatedMessage); + return TRUE; + default: + case VOLATILE_STATUS_NONE: + case VOLATILE_STATUS_CRINGING: + case 8: + _0807026C: + if (entityData->chargingStatus == CHARGING_STATUS_BIDE) { + SendMessage(pokemon,*gPtrBideMessage); + return TRUE; + } + else if (((entityData->chargingStatus != CHARGING_STATUS_NONE) && (entityData->chargingStatus != CHARGING_STATUS_CHARGE)) && (entityData->chargingStatus != CHARGING_STATUS_RAGE)) { + if (flag) { + SendMessage(pokemon,*gPtrMoveInterruptedMessage); + } + else { + for(index = 0, move = entityData->moves; index < MAX_MON_MOVES; move++, index++) { + if ((move->moveFlags & MOVE_FLAG_EXISTS) && + (MoveMatchesChargingStatus(pokemon,move)) && + (entityData->chargingStatusMoveIndex == index)) { + SetAction(&entityData->action, DUNGEON_ACTION_USE_MOVE_LEADER); + index_1 = index; + r7 = &entityData->action.unkC; + if((index > 0) && (move->moveFlags & MOVE_FLAG_LINKED)) + { + do { + move2 = &entityData->moves[index_1 + 1]; + move2--, index_1--; + if(index_1 <= 0) break; + if(!(entityData->moves[index_1].moveFlags & MOVE_FLAG_LINKED)) + { + break; + } + } + while(TRUE); + } + *r7 = index_1; + return TRUE; + } + } + } + sub_8079764(pokemon); + } + return FALSE; + } +}