diff --git a/asm/code_8057824.s b/asm/code_8057824.s index ae80cd0f1..96a321b47 100644 --- a/asm/code_8057824.s +++ b/asm/code_8057824.s @@ -5,658 +5,6 @@ .text - thumb_func_start sub_8058E5C -sub_8058E5C: - push {r4-r7,lr} - sub sp, 0x18 - adds r5, r0, 0 - movs r7, 0 - movs r4, 0x80 - lsls r4, 1 - str r3, [sp] - adds r3, r4, 0 - bl sub_8055640 - cmp r0, 0 - beq _08058ED0 - adds r0, r5, 0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - beq _08058ED0 - ldr r0, [r5, 0x70] - movs r1, 0x10 - ldrsh r2, [r0, r1] - cmp r2, 0 - bge _08058E8C - adds r2, 0x7 -_08058E8C: - asrs r6, r2, 3 - cmp r6, 0 - bne _08058E94 - movs r6, 0x1 -_08058E94: - movs r7, 0x1 - adds r0, r5, 0 - movs r1, 0x7 - bl HasAbility - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _08058ED0 - adds r0, r5, 0 - movs r1, 0 - bl sub_8057308 - lsls r0, 24 - cmp r0, 0 - beq _08058ED0 - str r4, [sp] - str r4, [sp, 0x4] - ldr r0, _08058EDC - str r0, [sp, 0x8] - movs r0, 0x14 - str r0, [sp, 0xC] - str r7, [sp, 0x10] - str r4, [sp, 0x14] - adds r0, r5, 0 - adds r1, r5, 0 - adds r2, r6, 0 - movs r3, 0 - bl sub_806F370 -_08058ED0: - adds r0, r7, 0 - add sp, 0x18 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_08058EDC: .4byte 0x000001fd - thumb_func_end sub_8058E5C - - thumb_func_start sub_8058EE0 -sub_8058EE0: - push {lr} - sub sp, 0x4 - ldr r2, [r1, 0x70] - movs r3, 0x10 - ldrsh r2, [r2, r3] - lsrs r3, r2, 31 - adds r2, r3 - asrs r2, 1 - movs r3, 0x1 - str r3, [sp] - movs r3, 0 - bl HealTargetHP - movs r0, 0x1 - add sp, 0x4 - pop {r1} - bx r1 - thumb_func_end sub_8058EE0 - - thumb_func_start sub_8058F04 -sub_8058F04: - push {r4-r7,lr} - sub sp, 0x4 - adds r7, r0, 0 - adds r4, r1, 0 - mov r12, r2 - adds r5, r3, 0 - ldr r3, [r4, 0x70] - movs r6, 0x1 - ldr r0, _08058F50 - ldr r1, [r0] - movs r0, 0xC1 - lsls r0, 9 - adds r2, r1, r0 - movs r0, 0xC - str r0, [r2] - ldr r0, _08058F54 - adds r1, r0 - movs r0, 0 - str r0, [r1] - adds r3, 0xC0 - ldrb r0, [r3] - cmp r0, 0xA - bne _08058F34 - movs r6, 0x2 -_08058F34: - lsls r3, r6, 8 - str r5, [sp] - adds r0, r7, 0 - adds r1, r4, 0 - mov r2, r12 - bl sub_8055640 - cmp r0, 0 - beq _08058F48 - movs r0, 0x1 -_08058F48: - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_08058F50: .4byte gDungeonGlobalData -_08058F54: .4byte 0x00018204 - thumb_func_end sub_8058F04 - - thumb_func_start sub_8058F58 -sub_8058F58: - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - adds r6, r0, 0 - adds r7, r1, 0 - mov r8, r3 - ldr r0, _08058FB0 - ldr r0, [r0] - ldr r1, _08058FB4 - adds r0, r1 - movs r1, 0 - ldrsh r5, [r0, r1] - cmp r5, 0 - bge _08058F78 - movs r5, 0 -_08058F78: - cmp r5, 0x4A - ble _08058F7E - movs r5, 0x4A -_08058F7E: - ldr r4, _08058FB8 - lsls r5, 3 - adds r0, r5, r4 - ldrh r1, [r0] - mov r0, sp - bl InitPokemonMove - adds r4, 0x4 - adds r5, r4 - ldr r4, [r5] - adds r0, r6, 0 - adds r1, r7, 0 - mov r2, sp - mov r3, r8 - bl _call_via_r4 - lsls r0, 24 - lsrs r0, 24 - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_08058FB0: .4byte gDungeonGlobalData -_08058FB4: .4byte 0x00003a0e -_08058FB8: .4byte gNaturePowerMoveTable - thumb_func_end sub_8058F58 - - thumb_func_start sub_8058FBC -sub_8058FBC: - push {r4-r7,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - movs r7, 0 - movs r4, 0x80 - lsls r4, 1 - str r3, [sp] - adds r3, r4, 0 - bl sub_8055640 - cmp r0, 0 - beq _08058FF6 - movs r7, 0x1 - ldr r0, _08059000 - movs r1, 0 - ldrsh r2, [r0, r1] - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_805727C - lsls r0, 24 - cmp r0, 0 - beq _08058FF6 - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0 - bl ParalyzeStatusTarget -_08058FF6: - adds r0, r7, 0 - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_08059000: .4byte gUnknown_80F4DE4 - thumb_func_end sub_8058FBC - - thumb_func_start sub_8059004 -sub_8059004: - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x8 - mov r9, r0 - mov r8, r1 - adds r5, r2, 0 - adds r6, r3, 0 - adds r0, r5, 0 - bl GetMoveType - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_8057600 - lsls r0, 16 - asrs r0, 16 - mov r2, r8 - adds r2, 0x4 - str r4, [sp] - str r0, [sp, 0x4] - mov r0, r9 - mov r1, r8 - movs r3, 0x1 - bl sub_807DF38 - movs r0, 0x1 - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8059004 - - thumb_func_start sub_8059050 -sub_8059050: - push {lr} - movs r2, 0x1 - bl ParalyzeStatusTarget - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end sub_8059050 - - thumb_func_start sub_8059060 -sub_8059060: - push {lr} - sub sp, 0x4 - adds r3, r2, 0 - ldr r2, _0805907C - ldr r2, [r2] - str r2, [sp] - movs r2, 0xB - bl sub_8079618 - movs r0, 0x1 - add sp, 0x4 - pop {r1} - bx r1 - .align 2, 0 -_0805907C: .4byte gUnknown_80FAD6C - thumb_func_end sub_8059060 - - thumb_func_start sub_8059080 -sub_8059080: - push {r4-r7,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - movs r7, 0 - movs r4, 0x80 - lsls r4, 1 - str r3, [sp] - adds r3, r4, 0 - bl sub_8055640 - cmp r0, 0 - beq _080590BA - movs r7, 0x1 - ldr r0, _080590C4 - movs r1, 0 - ldrsh r2, [r0, r1] - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_805727C - lsls r0, 24 - cmp r0, 0 - beq _080590BA - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0 - bl ParalyzeStatusTarget -_080590BA: - adds r0, r7, 0 - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_080590C4: .4byte gUnknown_80F4DE8 - thumb_func_end sub_8059080 - - thumb_func_start sub_80590C8 -sub_80590C8: - push {lr} - bl MistStatusTarget - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end sub_80590C8 - - thumb_func_start sub_80590D4 -sub_80590D4: - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x1C - mov r8, r0 - adds r6, r1, 0 - adds r5, r2, 0 - adds r7, r3, 0 - movs r0, 0 - mov r9, r0 - add r0, sp, 0x18 - mov r1, r9 - strb r1, [r0] - adds r0, r5, 0 - bl GetMoveType - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_806F4A4 - lsls r0, 24 - lsrs r0, 24 - negs r1, r0 - orrs r1, r0 - lsrs r4, r1, 31 - adds r0, r6, 0 - movs r1, 0x37 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0805911C - movs r4, 0 -_0805911C: - cmp r4, 0 - bne _08059134 - ldr r0, _08059130 - ldr r2, [r0] - mov r0, r8 - adds r1, r6, 0 - bl sub_80522F4 - b _0805917A - .align 2, 0 -_08059130: .4byte gUnknown_80FEB88 -_08059134: - adds r0, r5, 0 - bl GetMoveType - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - adds r1, r7, 0 - bl sub_8057600 - lsls r0, 16 - asrs r0, 16 - ldr r2, _0805918C - add r1, sp, 0x18 - str r1, [sp] - str r4, [sp, 0x4] - str r0, [sp, 0x8] - mov r0, r9 - str r0, [sp, 0xC] - movs r0, 0x1 - str r0, [sp, 0x10] - str r0, [sp, 0x14] - mov r0, r8 - adds r1, r6, 0 - movs r3, 0x1 - bl sub_806F370 - add r1, sp, 0x18 - movs r2, 0 - adds r0, r1, 0 - ldrb r0, [r0] - cmp r0, 0 - bne _08059178 - movs r2, 0x1 -_08059178: - strb r2, [r1] -_0805917A: - add r0, sp, 0x18 - ldrb r0, [r0] - add sp, 0x1C - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_0805918C: .4byte 0x0000270f - thumb_func_end sub_80590D4 - - thumb_func_start sub_8059190 -sub_8059190: - push {r4-r7,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - movs r7, 0 - movs r4, 0x80 - lsls r4, 1 - str r3, [sp] - adds r3, r4, 0 - bl sub_8055640 - cmp r0, 0 - beq _080591CA - movs r7, 0x1 - ldr r0, _080591D4 - movs r1, 0 - ldrsh r2, [r0, r1] - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_805727C - lsls r0, 24 - cmp r0, 0 - beq _080591CA - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0 - bl CringeStatusTarget -_080591CA: - adds r0, r7, 0 - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_080591D4: .4byte gUnknown_80F4DEA - thumb_func_end sub_8059190 - - thumb_func_start sub_80591D8 -sub_80591D8: - push {lr} - bl SafeguardStatusTarget - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end sub_80591D8 - - thumb_func_start sub_80591E4 -sub_80591E4: - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - adds r7, r0, 0 - adds r4, r1, 0 - adds r6, r2, 0 - adds r5, r3, 0 - movs r0, 0 - mov r8, r0 - adds r0, r4, 0 - movs r1, 0x3A - bl HasAbility - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r3, 0x80 - lsls r3, 1 - str r5, [sp] - adds r0, r7, 0 - adds r1, r4, 0 - adds r2, r6, 0 - bl sub_8055640 - adds r1, r0, 0 - cmp r1, 0 - beq _0805927E - lsrs r0, r1, 31 - adds r0, r1, r0 - asrs r4, r0, 1 - cmp r4, 0 - bgt _0805922A - movs r4, 0x1 -_0805922A: - adds r0, r7, 0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - beq _0805927E - ldr r0, [r7, 0x70] - movs r1, 0x1 - mov r8, r1 - adds r1, r0, 0 - adds r1, 0xFB - ldrb r0, [r1] - cmp r0, 0 - bne _0805924A - mov r0, r8 - strb r0, [r1] -_0805924A: - adds r0, r7, 0 - movs r1, 0 - bl sub_8057308 - lsls r0, 24 - cmp r0, 0 - beq _0805927E - mov r1, r9 - cmp r1, 0 - beq _0805926E - movs r3, 0xFD - lsls r3, 1 - adds r0, r7, 0 - adds r1, r4, 0 - movs r2, 0xD - bl sub_806F324 - b _0805927E -_0805926E: - mov r0, r8 - str r0, [sp] - adds r0, r7, 0 - adds r1, r7, 0 - adds r2, r4, 0 - movs r3, 0 - bl HealTargetHP -_0805927E: - mov r0, r8 - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80591E4 - - thumb_func_start SkillSwapMoveAction -SkillSwapMoveAction: - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - adds r6, r1, 0 - ldr r7, [r4, 0x70] - ldr r5, [r6, 0x70] - adds r0, r6, 0 - movs r1, 0x35 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - bne _080592BA - adds r0, r4, 0 - movs r1, 0x35 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _080592D0 -_080592BA: - ldr r0, _080592CC - ldr r2, [r0] - adds r0, r4, 0 - adds r1, r6, 0 - bl sub_80522F4 - movs r0, 0 - b _0805932E - .align 2, 0 -_080592CC: .4byte gUnknown_80FC8C0 -_080592D0: - movs r0, 0x5E - adds r0, r5 - mov r12, r0 - ldrb r3, [r0] - mov r8, r3 - adds r1, r5, 0 - adds r1, 0x5F - ldrb r2, [r1] - adds r5, r7, 0 - adds r5, 0x5E - ldrb r0, [r5] - mov r3, r12 - strb r0, [r3] - movs r0, 0x5F - adds r0, r7 - mov r12, r0 - ldrb r0, [r0] - strb r0, [r1] - mov r3, r8 - strb r3, [r5] - mov r0, r12 - strb r2, [r0] - ldr r0, _08059338 - ldr r0, [r0] - movs r5, 0x1 - strb r5, [r0, 0xC] - ldr r0, _0805933C - ldr r2, [r0] - adds r0, r4, 0 - adds r1, r6, 0 - bl sub_80522F4 - adds r1, r7, 0 - adds r1, 0xFB - ldrb r0, [r1] - cmp r0, 0 - bne _0805931C - strb r5, [r1] -_0805931C: - adds r0, r4, 0 - adds r1, r4, 0 - bl sub_806ABAC - adds r0, r4, 0 - adds r1, r6, 0 - bl sub_806ABAC - movs r0, 0x1 -_0805932E: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_08059338: .4byte gDungeonGlobalData -_0805933C: .4byte gUnknown_80FC888 - thumb_func_end SkillSwapMoveAction - thumb_func_start SketchMoveAction SketchMoveAction: push {r4-r7,lr} diff --git a/asm/code_8083654.s b/asm/code_8083654.s index e1996fa57..d3724001a 100644 --- a/asm/code_8083654.s +++ b/asm/code_8083654.s @@ -1086,8 +1086,8 @@ _08083E4E: _08083E54: .4byte 0x000003e5 thumb_func_end PlaySoundEffect - thumb_func_start sub_8083E58 -sub_8083E58: + thumb_func_start StopSoundEffect +StopSoundEffect: push {lr} lsls r0, 16 lsrs r1, r0, 16 @@ -1101,7 +1101,7 @@ _08083E6A: bx r0 .align 2, 0 _08083E70: .4byte 0x000003e5 - thumb_func_end sub_8083E58 + thumb_func_end StopSoundEffect thumb_func_start IsFanfareSEPlaying_2 IsFanfareSEPlaying_2: diff --git a/src/code_8057824.c b/src/code_8057824.c index c1981789b..cc4e7d741 100644 --- a/src/code_8057824.c +++ b/src/code_8057824.c @@ -19,10 +19,28 @@ #include "tile_types.h" #include "weather.h" +typedef bool8 (*MoveCallback)(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4); +struct NaturePowerMove +{ + s16 moveID; + u16 unk2; + MoveCallback move; +}; + +struct NaturePowerMove gNaturePowerMoveTable[10]; + + extern u8 gUnknown_202DE58[]; extern u8 gAvailablePokemonNames[]; extern u8 gUnknown_202DFE8[]; +extern u8 *gUnknown_80FC888[]; +extern u8 *gUnknown_80FC8C0[]; +extern s16 gUnknown_80F4DEA; +extern u8 *gUnknown_80FEB88[]; +extern s16 gUnknown_80F4DE8; +extern u8 *gUnknown_80FAD6C[]; +extern s16 gUnknown_80F4DE4; extern u8 *gUnknown_80FBD58[]; extern u32 gUnknown_80F51B4[]; extern s16 gUnknown_80F4DC0; @@ -97,6 +115,9 @@ struct unkStruct_80928C0 void sub_80928C0(u8 *buffer, struct PokemonMove *move, struct unkStruct_80928C0 *param_3); +extern void sub_806ABAC(struct DungeonEntity *, struct DungeonEntity *); +extern u8 sub_806F4A4(struct DungeonEntity *, u32); +extern void sub_807DF38(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct Position *pos, u32, u8 moveType, s16); extern void nullsub_92(struct DungeonEntity *); extern u32 sub_8055864(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *param_3, s32 param_4, s32 param_5); void sub_8079E34(struct DungeonEntity * pokemon, struct DungeonEntity * target, bool8 param_3); @@ -110,7 +131,7 @@ extern void SetMessageArgument(char[], struct DungeonEntity*, u32); extern u32 sub_8055640(struct DungeonEntity *, struct DungeonEntity *, struct PokemonMove *, u32, u32); u8 sub_8057620(u32 param_1); extern s16 sub_8094828(u16, u8); -extern u8 sub_8057308(struct DungeonEntity *, u32); +extern bool8 sub_8057308(struct DungeonEntity *, u32); extern void sub_806F324(struct DungeonEntity *, s32, u32, u32); extern s16 gUnknown_80F4DB4; @@ -177,30 +198,30 @@ u8 sub_8057620(u32 param_1) bool8 sub_8057634(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4) { - bool8 uVar3; + bool8 flag; - uVar3 = FALSE; + flag = FALSE; if (sub_8055640(pokemon, target, move, 0x100, param_4) != 0) { - uVar3 = TRUE; + flag = TRUE; if (sub_805727C(pokemon, target, gUnknown_80F4DB4)) { LowerDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, FALSE); } } - return uVar3; + return flag; } bool8 sub_805768C(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4) { - bool8 iVar1; + bool8 flag; - iVar1 = FALSE; + flag = FALSE; gUnknown_202F21C++; if (sub_8055640(pokemon, target, move, gUnknown_8106A54[gUnknown_202F21C], param_4) == 0) gUnknown_202F220 = 1; else - iVar1 = TRUE; - return iVar1; + flag = TRUE; + return flag; } bool8 sub_80576D0(struct DungeonEntity * pokemon, struct DungeonEntity *target) @@ -236,9 +257,9 @@ bool8 VitalThrowMoveAction(struct DungeonEntity * pokemon, struct DungeonEntity bool8 sub_8057788(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove *move, s32 param_4) { struct MapTile *tile; - bool8 uVar3; + bool8 flag; - uVar3 = FALSE; + flag = FALSE; tile = GetMapTileForDungeonEntity_2(pokemon); if ((!IsTileGround(tile)) || ((tile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID)) != 1)) { sub_80522F4(pokemon,target,*gUnknown_80FD14C); // It can only be used on land! @@ -251,9 +272,9 @@ bool8 sub_8057788(struct DungeonEntity * pokemon, struct DungeonEntity * target, else { sub_8079618(pokemon,pokemon,10,move,*gUnknown_80FAD4C); // $m0 burrowed underground! } - uVar3 = TRUE; + flag = TRUE; } - return uVar3; + return flag; } bool32 sub_8057824(struct DungeonEntity *pokemon, struct DungeonEntity *target) @@ -290,24 +311,24 @@ bool32 sub_80578A4(struct DungeonEntity *pokemon, struct DungeonEntity *target) return TRUE; } -bool32 sub_80578EC(struct DungeonEntity *r0, struct DungeonEntity *r1) +bool32 sub_80578EC(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - sub_8079F20(r0, r1, 1, 0); + sub_8079F20(pokemon, target, 1, 0); return TRUE; } bool32 sub_80578FC(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove * move, u32 param_4) { - bool32 uVar3; + bool32 flag; - uVar3 = FALSE; + flag = FALSE; if (sub_8055640(pokemon, target, move, 0x100, param_4) != 0) { - uVar3 = TRUE; + flag = TRUE; if (sub_805727C(pokemon,target, gUnknown_80F4DB6)) { LowerMovementSpeedTarget(pokemon, target, 1, FALSE); } } - return uVar3; + return flag; } bool32 sub_8057948(struct DungeonEntity *pokemon, struct DungeonEntity *target) @@ -447,12 +468,12 @@ bool8 sub_8057BC4(struct DungeonEntity *pokemon, struct DungeonEntity *target) bool8 sub_8057BEC(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove * move, u32 param_4) { - bool8 uVar3; + bool8 flag; - uVar3 = FALSE; + flag = FALSE; if (IsSleeping(pokemon)) { if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { - uVar3 = TRUE; + flag = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4E0A)) { CringeStatusTarget(pokemon,target,FALSE); } @@ -461,7 +482,7 @@ bool8 sub_8057BEC(struct DungeonEntity *pokemon, struct DungeonEntity *target, s else { sub_80522F4(pokemon,target,*gUnknown_80FC734); } - return uVar3; + return flag; } bool8 sub_8057C68(struct DungeonEntity *pokemon, struct DungeonEntity *target) @@ -472,16 +493,16 @@ bool8 sub_8057C68(struct DungeonEntity *pokemon, struct DungeonEntity *target) bool8 sub_8057C88(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove * move, u32 param_4) { - u8 uVar3; + bool8 flag; - uVar3 = FALSE; + flag = FALSE; if (sub_8055640(pokemon, target, move, 0x100, param_4) != 0) { - uVar3 = TRUE; + flag = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4DF6)) { CringeStatusTarget(pokemon,target,FALSE); } } - return uVar3; + return flag; } s32 sub_8057CD0(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove * move, u32 param_4) @@ -501,31 +522,31 @@ s32 sub_8057CD0(struct DungeonEntity * pokemon, struct DungeonEntity * target, s bool8 sub_8057D20(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove * move, u32 param_4) { u32 uVar3; - bool8 uVar4; + bool8 flag; u8 chargeStatus; - uVar4 = FALSE; + flag = FALSE; chargeStatus = target->entityData->chargingStatus; uVar3 = 0x100; if (chargeStatus == CHARGING_STATUS_DIVE) { uVar3 = 0x200; } if (sub_8055640(pokemon,target,move,uVar3,param_4) != 0) { - uVar4 = TRUE; + flag = TRUE; if (sub_805727C(pokemon,target,gUnknown_80F4E08)) { SqueezedStatusTarget(pokemon,target,0x3b,FALSE); } } - return uVar4; + return flag; } -bool8 sub_8057D7C(struct DungeonEntity * param_1, struct DungeonEntity * param_2) +bool8 sub_8057D7C(struct DungeonEntity * pokemon, struct DungeonEntity * target) { - LowerDefenseStageTarget(param_1, param_2, gUnknown_8106A50, 2, 1, TRUE); + LowerDefenseStageTarget(pokemon, target, gUnknown_8106A50, 2, 1, TRUE); return TRUE; } -NAKED bool8 sub_8057D9C(struct DungeonEntity * param_1, struct DungeonEntity * param_2) +NAKED bool8 sub_8057D9C(struct DungeonEntity * pokemon, struct DungeonEntity * target) { asm_unified( "\tpush {r4-r7,lr}\n" @@ -616,33 +637,33 @@ bool8 sub_8057E50(struct DungeonEntity *pokemon, struct DungeonEntity *target) bool8 sub_8057E6C(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { struct DungeonEntityData *entityData; - bool32 uVar4; + bool8 flag; - uVar4 = FALSE; + flag = FALSE; entityData = pokemon->entityData; SendThawedMessage(pokemon,target); if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { - uVar4 = TRUE; - if (sub_8057308(pokemon, 0) != 0) { + flag = TRUE; + if (sub_8057308(pokemon, 0)) { entityData->unk155 = 1; } } - return uVar4; + return flag; } bool8 sub_8057ED0(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { - bool8 uVar4; + bool8 flag; - uVar4 = FALSE; + flag = FALSE; if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { - uVar4 = TRUE; + flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4E04)) { ChangeAttackMultiplierTarget(pokemon, target, gUnknown_8106A4C, 0x80, FALSE); } } - return uVar4; + return flag; } bool8 sub_8057F24(struct DungeonEntity *pokemon, struct DungeonEntity *target) @@ -659,17 +680,17 @@ bool8 sub_8057F24(struct DungeonEntity *pokemon, struct DungeonEntity *target) bool8 sub_8057F7C(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { - bool8 uVar4; + bool8 flag; - uVar4 = FALSE; + flag = FALSE; if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { - uVar4 = TRUE; + flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4E02)) { LowerAccuracyStageTarget(pokemon, target, gUnknown_8106A4C, FALSE); } } - return uVar4; + return flag; } bool8 sub_8057FCC(struct DungeonEntity *pokemon, struct DungeonEntity *target) @@ -753,46 +774,46 @@ bool8 GrudgeMoveAction(struct DungeonEntity *pokemon, struct DungeonEntity * tar bool8 sub_805815C(struct DungeonEntity *pokemon, struct DungeonEntity *target) { - sub_80797A0(pokemon, target, 0x4); + sub_80797A0(pokemon, target, PROTECTION_STATUS_COUNTER); return TRUE; } bool8 sub_805816C(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { - bool8 uVar4; + bool8 flag; - uVar4 = FALSE; + flag = FALSE; SendThawedMessage(pokemon, target); if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { - uVar4 = TRUE; + flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DB8)) { BurnedStatusTarget(pokemon, target, 0, FALSE); } } - return uVar4; + return flag; } bool8 sub_80581D0(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { - bool8 uVar4; + bool8 flag; - uVar4 = FALSE; + flag = FALSE; SendThawedMessage(pokemon, target); if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { - uVar4 = TRUE; + flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DBA)) { BurnedStatusTarget(pokemon, target, 0, FALSE); } } - return uVar4; + return flag; } bool8 sub_8058234(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { u16 uVar1; - uVar1 = (move->moveID == 0x13B) ? 0x7A : 0x51; + uVar1 = (move->moveID == MOVE_FORESIGHT) ? 0x7A : 0x51; ExposeStatusTarget(pokemon, target, uVar1); return TRUE; } @@ -872,47 +893,47 @@ bool8 sub_805836C(struct DungeonEntity *pokemon, struct DungeonEntity *target, s bool8 sub_80583D8(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { - bool8 uVar4; + bool8 flag; - uVar4 = FALSE; + flag = FALSE; if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { - uVar4 = TRUE; + flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DC2)) { LowerDefenseStageTarget(pokemon, target, gUnknown_8106A50, 1, 1, FALSE); } } - return uVar4; + return flag; } bool8 sub_8058430(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { - bool8 uVar4; + bool8 flag; - uVar4 = FALSE; + flag = FALSE; if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { - uVar4 = TRUE; + flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DEE)) { CringeStatusTarget(pokemon, target, FALSE); } } - return uVar4; + return flag; } bool8 sub_8058478(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { - bool8 uVar4; + bool8 flag; - uVar4 = FALSE; + flag = FALSE; if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { - uVar4 = TRUE; + flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DE6)) { ParalyzeStatusTarget(pokemon, target, FALSE); } } - return uVar4; + return flag; } bool8 sub_80584C0(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) @@ -950,17 +971,17 @@ bool8 sub_8058548(struct DungeonEntity *pokemon, struct DungeonEntity *target, s bool8 sub_8058580(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { - bool8 uVar4; + bool8 flag; - uVar4 = FALSE; + flag = FALSE; if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { - uVar4 = TRUE; + flag = TRUE; if(sub_805727C(pokemon, target, gUnknown_80F4DD4)) { LowerMovementSpeedTarget(pokemon, target, 1, FALSE); } } - return uVar4; + return flag; } bool8 sub_80585CC(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) @@ -968,7 +989,7 @@ bool8 sub_80585CC(struct DungeonEntity *pokemon, struct DungeonEntity *target, s bool8 flag; flag = FALSE; - if ((target->entityData->protectionStatus == '\x01') || (target->entityData->protectionStatus == '\x03')) { + if ((target->entityData->protectionStatus == PROTECTION_STATUS_REFLECT) || (target->entityData->protectionStatus == PROTECTION_STATUS_LIGHT_SCREEN)) { sub_80522F4(pokemon,target,*gUnknown_80FD104); SendProtectionEndMessage(pokemon,target); flag = TRUE; @@ -980,17 +1001,17 @@ bool8 sub_80585CC(struct DungeonEntity *pokemon, struct DungeonEntity *target, s bool8 sub_8058638(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) { - bool8 uVar4; + bool8 flag; - uVar4 = FALSE; + flag = FALSE; if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { - uVar4 = TRUE; + flag = TRUE; if(sub_805727C(pokemon, target, 0)) { LowerMovementSpeedTarget(pokemon, target, 1, FALSE); } } - return uVar4; + return flag; } bool8 sub_805867C(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove * move, u32 param_4) @@ -1417,3 +1438,243 @@ bool8 PsychUpMoveAction(struct DungeonEntity * pokemon, struct DungeonEntity * t } return TRUE; } + +bool8 sub_8058E5C(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4) +{ + int iVar2; + int iVar3; + bool8 flag; + + flag = FALSE; + if ((sub_8055640(pokemon, target, move, 0x80 << 1, param_4) != 0) && (EntityExists(pokemon))) { + iVar2 = pokemon->entityData->maxHP; + if (iVar2 < 0) { + iVar2 = iVar2 + 7; + } + iVar3 = iVar2 >> 3; + if (iVar3 == 0) { + iVar3 = 1; + } + flag = TRUE; + if ((!HasAbility(pokemon, ABILITY_ROCK_HEAD)) && sub_8057308(pokemon, 0)) { + sub_806F370(pokemon,pokemon,iVar3,0,0,0,0x1fd,0x14,1,0); + } + } + return flag; +} + +bool8 sub_8058EE0(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) +{ + HealTargetHP(pokemon, target, target->entityData->maxHP / 2, 0, TRUE); + return TRUE; +} + +bool32 sub_8058F04(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4) +{ + bool32 flag; + struct DungeonEntityData *entityData; + s32 iVar3; + + entityData = target->entityData; + iVar3 = 1; + gDungeonGlobalData->unk18200 = 0xc; + gDungeonGlobalData->unk18204 = 0; + if (entityData->chargingStatus == CHARGING_STATUS_DIG) { + iVar3 = 2; + } + flag = sub_8055640(pokemon,target,move,iVar3 << 8,param_4); + if (flag != 0) { + flag = TRUE; + } + return flag; +} + +bool8 sub_8058F58(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4) +{ + bool8 flag; + s32 tileset; + struct PokemonMove natureMove; + + tileset = gDungeonGlobalData->tileset; + if (tileset < 0) { + tileset = 0; + } + if (0x4a < tileset) { + tileset = 0x4a; + } + InitPokemonMove(&natureMove, gNaturePowerMoveTable[tileset].moveID); + flag = gNaturePowerMoveTable[tileset].move(pokemon,target,&natureMove,param_4); + return flag; +} + +bool8 sub_8058FBC(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) +{ + bool8 flag; + + flag = FALSE; + if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { + flag = TRUE; + if(sub_805727C(pokemon, target, gUnknown_80F4DE4)) + { + ParalyzeStatusTarget(pokemon, target, FALSE); + } + } + return flag; +} + +bool8 sub_8059004(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) +{ + sub_807DF38(pokemon, target, &target->posWorld, 1, GetMoveType(move), sub_8057600(move, param_4)); + return TRUE; +} + +bool8 sub_8059050(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) +{ + ParalyzeStatusTarget(pokemon, target, TRUE); + return TRUE; +} + +bool8 sub_8059060(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) +{ + sub_8079618(pokemon, target, CHARGING_STATUS_CHARGE, move, *gUnknown_80FAD6C); + return TRUE; +} + +bool8 sub_8059080(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) +{ + bool8 flag; + + flag = FALSE; + if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { + flag = TRUE; + if(sub_805727C(pokemon, target, gUnknown_80F4DE8)) + { + ParalyzeStatusTarget(pokemon, target, FALSE); + } + } + return flag; +} + +bool8 sub_80590C8(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) +{ + MistStatusTarget(pokemon, target); + return TRUE; +} + +bool8 sub_80590D4(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4) +{ + u8 moveType; + bool8 uVar5; + bool8 flag; + + flag = FALSE; + moveType = GetMoveType(move); + + uVar5 = sub_806F4A4(target, moveType) != 0 ? TRUE : FALSE; + + if (HasAbility(target, 0x37)) { + uVar5 = FALSE; + } + if (!uVar5) { + sub_80522F4(pokemon,target,*gUnknown_80FEB88); + } + else { + sub_806F370(pokemon,target,9999,1,&flag,GetMoveType(move),sub_8057600(move,param_4),0,1,1); + flag = flag == 0; + } + return flag; +} + +bool8 sub_8059190(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) +{ + bool8 flag; + + flag = FALSE; + if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { + flag = TRUE; + if(sub_805727C(pokemon, target, gUnknown_80F4DEA)) + { + CringeStatusTarget(pokemon, target, FALSE); + } + } + return flag; +} + +bool8 sub_80591D8(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, u32 param_4) +{ + SafeguardStatusTarget(pokemon, target); + return TRUE; +} + +bool8 sub_80591E4(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4) +{ + bool8 hasLiquidOoze; + s32 iVar3; + s32 iVar4; + bool8 flag; + struct DungeonEntityData *entityData; + + flag = FALSE; + hasLiquidOoze = HasAbility(target, ABILITY_LIQUID_OOZE); + iVar3 = sub_8055640(pokemon,target,move,0x100,param_4); + if (iVar3 != 0) { + iVar4 = iVar3 / 2; + if (iVar4 < 1) { + iVar4 = 1; + } + if (EntityExists(pokemon)) { + entityData = pokemon->entityData; + flag = TRUE; + if (entityData->unkFB == 0) { + entityData->unkFB = 1; + } + if (sub_8057308(pokemon,0)) { + if (hasLiquidOoze) { + sub_806F324(pokemon,iVar4,0xd,0x1fa); + } + else { + HealTargetHP(pokemon,pokemon,iVar4,0,1); + } + } + } + } + return flag; +} + +bool8 SkillSwapMoveAction(struct DungeonEntity *pokemon, struct DungeonEntity *target, struct PokemonMove *move, s32 param_4) +{ + u8 ability_1; + u8 ability_2; + bool8 flag; + u8 *puVar5; + u8 *puVar6; + struct DungeonEntityData * targetEntityData; + struct DungeonEntityData * pokeEntityData; + + pokeEntityData = pokemon->entityData; + targetEntityData = target->entityData; + if ((HasAbility(target, ABILITY_WONDER_GUARD)) || (HasAbility(pokemon, ABILITY_WONDER_GUARD))) { + sub_80522F4(pokemon,target,*gUnknown_80FC8C0); + flag = FALSE; + } + else + { + puVar5 = &targetEntityData->abilities[0]; + ability_1 = *puVar5; + puVar6 = &targetEntityData->abilities[1]; + ability_2 = *puVar6; + *puVar5 = pokeEntityData->abilities[0]; + *puVar6 = pokeEntityData ->abilities[1]; + pokeEntityData->abilities[0] = ability_1; + pokeEntityData->abilities[1] = ability_2; + gDungeonGlobalData->unkC = 1; + sub_80522F4(pokemon,target,*gUnknown_80FC888); + if (pokeEntityData->unkFB == 0) { + pokeEntityData->unkFB = 1; + } + sub_806ABAC(pokemon,pokemon); + sub_806ABAC(pokemon,target); + flag = TRUE; + } + return flag; +} diff --git a/src/code_8057824_1.c b/src/code_8057824_1.c index a78a5f85c..f105baa14 100644 --- a/src/code_8057824_1.c +++ b/src/code_8057824_1.c @@ -411,7 +411,7 @@ extern void sub_803E46C(u32); extern void sub_80866C4(u32 *); extern void sub_808692C(); -extern void sub_8083E58(u32); +extern void StopSoundEffect(u32); extern void sub_80868F4(); extern void sub_8086910(); extern u32 sub_8085EC8(u32, u32, u32, u32 *, u32); @@ -1713,7 +1713,7 @@ void MagmaCavernMidDialogue(void) // Qu-quake! DisplayDungeonDialogue(&MagmaCavernMidDialogue_3); sub_803E708(0x78,0x46); - sub_8083E58(0x1c5); + StopSoundEffect(0x1c5); sub_808682C(); sub_80855E4(sub_8086910); sub_803E708(0x14,0x46); @@ -2894,7 +2894,7 @@ void HoOhPreFightDialogue(void) PlaySoundEffect(0x1c5); sub_803E708(0xfa,70); HoOhDropInEffect(HoOhEntity); - sub_8083E58(0x1c5); + StopSoundEffect(0x1c5); sub_808682C(); sub_80855E4(sub_8086910); sub_8085930(DIRECTION_NORTH); diff --git a/src/ground_main.c b/src/ground_main.c index 3e826ee52..c74648e26 100644 --- a/src/ground_main.c +++ b/src/ground_main.c @@ -333,7 +333,7 @@ const char *sub_8098FB4(void) } -s32 sub_8098FCC(u32 unused) +s16 sub_8098FCC(u32 unused) { s32 iVar4; s32 iVar5;