add meaningful struct field names

This commit is contained in:
DizzyEggg 2018-02-25 00:36:37 +01:00
parent f2052e5d8f
commit c0ea81afc5
2 changed files with 249 additions and 481 deletions

View File

@ -5,310 +5,7 @@
.text
thumb_func_start sub_817E0B8
sub_817E0B8: @ 817E0B8
push {r4-r6,lr}
lsls r0, 16
lsrs r5, r0, 16
movs r3, 0
ldr r4, =gUnknown_0860A8A4
ldr r6, =0x0000ffff
adds r2, r4, 0
adds r1, r4, 0
_0817E0C8:
ldrh r0, [r1]
cmp r0, r5
beq _0817E0DA
adds r2, 0x2
adds r1, 0x2
adds r3, 0x1
ldrh r0, [r2]
cmp r0, r6
bne _0817E0C8
_0817E0DA:
lsls r0, r3, 1
adds r0, r4
ldrh r1, [r0]
ldr r0, =0x0000ffff
cmp r1, r0
beq _0817E0F4
movs r0, 0
b _0817E0F6
.pool
_0817E0F4:
movs r0, 0x1
_0817E0F6:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_817E0B8
thumb_func_start sub_817E0FC
sub_817E0FC: @ 817E0FC
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x14
str r2, [sp, 0x4]
lsls r0, 16
lsrs r7, r0, 16
lsls r1, 16
lsrs r1, 16
str r1, [sp]
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
cmp r0, 0
bne _0817E122
b _0817E310
_0817E122:
ldr r0, =gBattleStruct
ldr r0, [r0]
movs r1, 0x81
lsls r1, 2
adds r1, r0, r1
str r1, [sp, 0x8]
ldr r2, =gBattlerAttacker
mov r10, r2
ldrb r0, [r2]
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
mov r9, r0
ldr r0, =gBattlerTarget
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
lsrs r4, r0, 24
mov r1, r10
ldrb r0, [r1]
adds r1, r7, 0
bl GetBattlerMoveSlotId
lsls r0, 24
lsrs r6, r0, 24
cmp r6, 0x3
bls _0817E184
mov r2, r9
lsls r0, r2, 1
add r0, r9
lsls r0, 2
ldr r1, [sp, 0x8]
adds r0, r1, r0
adds r0, 0x57
ldrb r1, [r0]
movs r2, 0x1E
orrs r1, r2
strb r1, [r0]
b _0817E310
.pool
_0817E184:
mov r2, r10
ldrb r0, [r2]
bl GetBattlerPosition
lsls r0, 24
lsrs r0, 25
lsls r0, 3
lsls r4, 4
adds r0, r4
ldr r1, [sp, 0x8]
adds r0, r1, r0
mov r2, r10
ldrb r1, [r2]
lsls r1, 1
ldr r2, =gBattlerPartyIndexes
adds r1, r2
ldrh r2, [r1]
adds r2, 0x1
adds r0, 0x35
lsls r2, 5
ldrb r3, [r0]
movs r1, 0x1F
ands r1, r3
orrs r1, r2
strb r1, [r0]
mov r1, r10
ldrb r0, [r1]
bl GetBattlerPosition
lsls r0, 24
lsrs r0, 25
lsls r0, 3
adds r0, r4
ldr r2, [sp, 0x8]
adds r0, r2, r0
adds r0, 0x36
movs r1, 0x3
mov r8, r6
mov r2, r8
ands r2, r1
mov r8, r2
ldrb r2, [r0]
movs r1, 0x4
negs r1, r1
ands r1, r2
mov r2, r8
orrs r1, r2
strb r1, [r0]
mov r1, r9
lsls r0, r1, 1
add r0, r9
lsls r0, 2
ldr r2, [sp, 0x8]
adds r0, r2, r0
str r0, [sp, 0xC]
adds r5, r0, 0
adds r5, 0x53
lsls r2, r6, 6
ldrb r1, [r5]
movs r0, 0x3F
ands r0, r1
orrs r0, r2
strb r0, [r5]
ldr r1, =gBattleMoves
lsls r4, r7, 1
adds r0, r4, r7
lsls r0, 2
adds r0, r1
ldrb r2, [r0]
movs r0, 0
adds r1, r6, 0
movs r3, 0
bl sub_817E684
ldr r0, [sp]
adds r1, r7, 0
adds r2, r6, 0
bl sub_817F394
ldr r0, [sp, 0x4]
ldrb r1, [r0, 0x12]
movs r0, 0xF
ands r0, r1
str r4, [sp, 0x10]
cmp r0, 0
beq _0817E23C
movs r0, 0x7
adds r1, r7, 0
adds r2, r6, 0
movs r3, 0
bl sub_817E684
_0817E23C:
ldr r0, =0x00000111
cmp r7, r0
bne _0817E272
mov r1, r10
ldrb r0, [r1]
lsls r0, 1
ldr r2, =gBattlerPartyIndexes
adds r0, r2
ldrh r1, [r0]
adds r1, 0x1
movs r0, 0x7
ands r1, r0
ldrb r2, [r5]
movs r0, 0x8
negs r0, r0
ands r0, r2
orrs r0, r1
strb r0, [r5]
ldr r2, [sp, 0xC]
adds r2, 0x56
ldrb r1, [r2]
movs r0, 0x4
negs r0, r0
ands r0, r1
mov r1, r8
orrs r0, r1
strb r0, [r2]
_0817E272:
cmp r7, 0x78
beq _0817E27A
cmp r7, 0x99
bne _0817E2D2
_0817E27A:
movs r0, 0x1
mov r2, r9
eors r0, r2
lsls r2, r0, 1
adds r2, r0
lsls r2, 2
ldr r0, [sp, 0x8]
adds r2, r0, r2
mov r1, r10
ldrb r0, [r1]
lsls r0, 1
ldr r1, =gBattlerPartyIndexes
adds r0, r1
ldrh r1, [r0]
adds r1, 0x1
adds r4, r2, 0
adds r4, 0x58
movs r0, 0x7
ands r1, r0
lsls r1, 3
ldrb r3, [r4]
movs r0, 0x39
negs r0, r0
ands r0, r3
orrs r0, r1
mov r1, r8
lsls r3, r1, 1
movs r1, 0x7
negs r1, r1
ands r0, r1
orrs r0, r3
strb r0, [r4]
adds r2, 0x57
ldrb r1, [r2]
movs r0, 0x1F
negs r0, r0
ands r0, r1
movs r1, 0x1A
orrs r0, r1
strb r0, [r2]
ldrb r0, [r4]
movs r1, 0x1
orrs r0, r1
strb r0, [r4]
_0817E2D2:
ldr r1, =gBattleMoves
ldr r2, [sp, 0x10]
adds r0, r2, r7
lsls r0, 2
adds r0, r1
ldrb r4, [r0, 0x2]
ldrb r5, [r0, 0x1]
movs r0, 0xD
adds r1, r4, 0
adds r2, r5, 0
movs r3, 0
bl sub_817E684
movs r0, 0xE
adds r1, r4, 0
adds r2, r5, 0
movs r3, 0
bl sub_817E684
movs r0, 0xB
adds r1, r4, 0
movs r2, 0
movs r3, 0
bl sub_817E684
movs r0, 0xC
adds r1, r4, 0
movs r2, 0
movs r3, 0
bl sub_817E684
_0817E310:
add sp, 0x14
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_817E0FC
thumb_func_start sub_817E32C
sub_817E32C: @ 817E32C

View File

@ -8,81 +8,78 @@
struct BattleLinkStringSide
{
u32 field_8_0:3; // correct
u32 field_8_0_b:3; // correct
u32 field_8_0_c:3; // correct
u32 field_8_0_d:3;
u32 field_8_0_e:3;
u32 field_8_1:3; // correct
u32 field_8_2:3; // correct
u32 field_8_3:3; // correct
u32 field_8_4:3; // correct
u32 field_8_5:3; // correct
u32 spikesMonId:3;
u32 reflectMoveId:3;
u32 lightScreenMonId:3;
u32 safeguardMonId:3;
u32 mistMonId:3;
u32 futureSightMonId:3;
u32 doomDesireMonId:3;
u32 perishSongMonId:3;
u32 wishMonId:3;
u32 grudgeMonId:3;
u32 field_8_6:2;
u32 field_0_0a:2; // correct
u32 field_0_0b:2; // correct
u32 field_0_0c:2; // correct
u32 field_0_0d:2;
u32 field_0_0e:2;
u32 field_0_1:2; // correct
u32 field_0_2:2; // correct
u32 field_0_3:2; // correct
u32 field_0_4:2; // correct
u32 field_0_5:2; // correct
u32 field_0_6:3; // correct
u32 field_0_7:2; // correct
u32 field_3_0:4; // correct
u32 field_3_1:3; // correct
u32 field_4_0:6;
u32 spikesMoveSlot:2;
u32 reflectMoveSlot:2;
u32 lightScreenMoveSlot:2;
u32 safeguardMoveSlot:2;
u32 mistMoveSlot:2;
u32 futureSightMoveSlot:2;
u32 doomDesireMoveSlot:2;
u32 perishSongMoveSlot:2;
u32 wishMoveSlot:2;
u32 grudgeMoveSlot:2;
u32 destinyBondMonId:3;
u32 destinyBondMoveSlot:2;
u32 field_3_0:4;
u32 field_3_1:3;
u32 field_4_0_0:1;
u32 field_4_0:2;
u32 field_4_0_b:3;
u32 field_4_1:1;
u32 field_4_2:1;
u32 field_5_0:3; // correct
u32 field_5_1:2; // correct
u32 field_5_0:3;
u32 field_5_1:2;
};
struct BattleLinkStringPosition
{
u32 field_0_0:3; // correct
u32 field_0_3:3; // correct
u32 field_0_6:3; // correct
u32 field_1_1:3; // correct
u32 field_1_4:3; // correct
u32 field_2_0:3;
u32 field_2_3:2; // correct
u32 field_2_5:2; // correct
u32 field_2_7:2; // correct
u32 field_3_0:2; // correct
u32 field_3_2:2; // correct
u32 field_3_4:2;
u32 field_3_6:2;
u32 field_4_0:3;
u32 field_4_3:3;
u32 field_4_6:2;
u32 field_5_0:3; // correct
u32 field_5_3:2; // correct
u32 field_5_5:3; // correct
u32 curseMonId:3;
u32 leechSeedMonId:3;
u32 nightmareMonId:3;
u32 wrapMonId:3;
u32 attractMonId:3;
u32 confusionMonId:3;
u32 curseMoveSlot:2;
u32 leechSeedMoveSlot:2;
u32 nightmareMoveSlot:2;
u32 wrapMoveSlot:2;
u32 attractMoveSlot:2;
u32 confusionMoveSlot:2;
u32 waterSportMoveSlot:2;
u32 waterSportMonId:3;
u32 mudSportMonId:3;
u32 mudSportMoveSlot:2;
u32 ingrainMonId:3;
u32 ingrainMoveSlot:2;
u32 field_5_5:3;
u32 field_6_0:2;
};
struct BattleLinkStringMon
{
u32 field_0_0:3; // correct
u32 field_0_3:3; // correct
u32 field_0_6:3; // correct
u32 field_1_1:3; // correct
u32 field_1_4:3; // correct
u32 field_1_7:3;
u32 field_2_2:2;
u32 field_2_4:2; // correct
u32 field_2_6:2; // correct
u32 field_3_0:2; // correct
u32 field_3_2:2; // correct
u32 field_3_4:2;
u32 field_3_6:2;
u32 psnMonId:3;
u32 badPsnMonId:3;
u32 brnMonId:3;
u32 prlzMonId:3;
u32 slpMonId:3;
u32 frzMonId:3;
u32 psnMoveSlot:2;
u32 badPsnMoveSlot:2;
u32 brnMoveSlot:2;
u32 prlzMoveSlot:2;
u32 slpMoveSlot:2;
u32 frzMoveSlot:2;
};
struct UnknownBattleLinkStruct
@ -94,12 +91,19 @@ struct UnknownBattleLinkStruct
extern struct StringInfoBattle *gStringInfo;
extern const struct BattleMove gBattleMoves[];
// this file's functions
bool8 sub_817E0B8(u16 stringId);
void sub_817E684(u8 arg0, u16 arg1, u8 arg2, u8 arg3);
void sub_817EECC(void);
void sub_817EA80(u8 arg0);
void sub_817F394(u16 weatherFlags, u16 moveId, u8 moveSlot);
// const rom data
extern const u16 gUnknown_0860A8A4[];
// code
void sub_817C95C(u16 stringId)
{
struct UnknownBattleLinkStruct *structPtr;
@ -162,16 +166,16 @@ void sub_817C95C(u16 stringId)
sub_817E684(1, moveSlot, 0, 0);
break;
case STRINGID_PKMNFORESAWATTACK:
structPtr->side[atkSide].field_8_1 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].field_0_1 = moveSlot;
structPtr->side[atkSide].futureSightMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].futureSightMoveSlot = moveSlot;
break;
case STRINGID_PKMNCHOSEXASDESTINY:
structPtr->side[atkSide].field_8_2 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].field_0_2 = moveSlot;
structPtr->side[atkSide].doomDesireMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].doomDesireMoveSlot = moveSlot;
break;
case STRINGID_FAINTINTHREE:
structPtr->side[atkSide].field_8_3 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].field_0_3 = moveSlot;
structPtr->side[atkSide].perishSongMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].perishSongMoveSlot = moveSlot;
structPtr->side[atkSide].field_4_1 = 1;
break;
case STRINGID_PKMNPERISHCOUNTFELL:
@ -179,47 +183,47 @@ void sub_817C95C(u16 stringId)
structPtr->side[atkSide].field_3_0 = 10;
break;
case STRINGID_PKMNWISHCAMETRUE:
if (structPtr->side[defSide].field_8_4 != 0)
if (structPtr->side[defSide].wishMonId != 0)
{
sub_817E684(2, 3, defSide,
(structPtr->side[defSide].field_8_4 - 1) * 4 + structPtr->side[defSide].field_0_4);
(structPtr->side[defSide].wishMonId - 1) * 4 + structPtr->side[defSide].wishMoveSlot);
}
break;
case STRINGID_PKMNWANTSGRUDGE:
structPtr->side[atkSide].field_8_5 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].field_0_5 = moveSlot;
structPtr->side[atkSide].grudgeMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].grudgeMoveSlot = moveSlot;
break;
case STRINGID_PKMNLOSTPPGRUDGE:
if (structPtr->side[defSide].field_8_5 != 0)
if (structPtr->side[defSide].grudgeMonId != 0)
{
sub_817E684(2, 4, defSide,
(structPtr->side[defSide].field_8_5 - 1) * 4 + structPtr->side[defSide].field_0_5);
(structPtr->side[defSide].grudgeMonId - 1) * 4 + structPtr->side[defSide].grudgeMoveSlot);
}
break;
case STRINGID_PKMNTRYINGTOTAKEFOE:
structPtr->side[atkSide].field_0_6 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].field_0_7 = moveSlot;
structPtr->side[atkSide].destinyBondMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].destinyBondMoveSlot = moveSlot;
break;
case STRINGID_PKMNTOOKFOE:
if (structPtr->side[defSide].field_0_6 != 0)
if (structPtr->side[defSide].destinyBondMonId != 0)
structPtr->side[atkSide].field_3_0 = 11;
break;
case STRINGID_PKMNPLANTEDROOTS:
structPtr->pos[atkSide][atkFlank].field_5_0 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[atkSide][atkFlank].field_5_3 = moveSlot;
structPtr->pos[atkSide][atkFlank].ingrainMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[atkSide][atkFlank].ingrainMoveSlot = moveSlot;
break;
case STRINGID_PKMNABSORBEDNUTRIENTS:
if (structPtr->pos[atkSide][atkFlank].field_5_0 != 0)
if (structPtr->pos[atkSide][atkFlank].ingrainMonId != 0)
{
sub_817E684(2, 6, atkSide,
(structPtr->pos[atkSide][atkFlank].field_5_0 - 1) * 4 + structPtr->pos[atkSide][atkFlank].field_5_3);
(structPtr->pos[atkSide][atkFlank].ingrainMonId - 1) * 4 + structPtr->pos[atkSide][atkFlank].ingrainMoveSlot);
}
break;
case STRINGID_PKMNANCHOREDITSELF:
if (structPtr->pos[defSide][defFlank].field_5_0 != 0)
if (structPtr->pos[defSide][defFlank].ingrainMonId != 0)
{
sub_817E684(2, 6, defSide,
(structPtr->pos[defSide][defFlank].field_5_0 - 1) * 4 + structPtr->pos[defSide][defFlank].field_5_3);
(structPtr->pos[defSide][defFlank].ingrainMonId - 1) * 4 + structPtr->pos[defSide][defFlank].ingrainMoveSlot);
}
break;
case STRINGID_PKMNTRANSFORMEDINTO:
@ -267,39 +271,39 @@ void sub_817C95C(u16 stringId)
}
break;
case STRINGID_PKMNLAIDCURSE:
structPtr->pos[defSide][defFlank].field_0_0 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[defSide][defFlank].field_2_3 = moveSlot;
structPtr->pos[defSide][defFlank].curseMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[defSide][defFlank].curseMoveSlot = moveSlot;
break;
case STRINGID_PKMNAFFLICTEDBYCURSE:
if (GetMonData(atkMon, MON_DATA_HP, NULL)
&& structPtr->pos[atkSide][atkFlank].field_0_0 != 0)
&& structPtr->pos[atkSide][atkFlank].curseMonId != 0)
{
sub_817E684(8, 0, structPtr->pos[atkSide][atkFlank].field_0_0 - 1, structPtr->pos[atkSide][atkFlank].field_2_3);
sub_817E684(8, 0, structPtr->pos[atkSide][atkFlank].curseMonId - 1, structPtr->pos[atkSide][atkFlank].curseMoveSlot);
structPtr->side[atkSide].field_3_0 = 1;
structPtr->side[atkSide].field_3_1 = atkFlank;
}
break;
case STRINGID_PKMNSEEDED:
structPtr->pos[defSide][defFlank].field_0_3 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[defSide][defFlank].field_2_5 = moveSlot;
structPtr->pos[defSide][defFlank].leechSeedMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[defSide][defFlank].leechSeedMoveSlot = moveSlot;
break;
case STRINGID_PKMNSAPPEDBYLEECHSEED:
if (structPtr->pos[atkSide][atkFlank].field_0_3 != 0)
if (structPtr->pos[atkSide][atkFlank].leechSeedMonId != 0)
{
sub_817E684(8, 1, structPtr->pos[atkSide][atkFlank].field_0_3 - 1, structPtr->pos[atkSide][atkFlank].field_2_5);
sub_817E684(8, 1, structPtr->pos[atkSide][atkFlank].leechSeedMonId - 1, structPtr->pos[atkSide][atkFlank].leechSeedMoveSlot);
structPtr->side[atkSide].field_3_0 = 2;
structPtr->side[atkSide].field_3_1 = atkFlank;
}
break;
case STRINGID_PKMNFELLINTONIGHTMARE:
structPtr->pos[defSide][defFlank].field_0_6 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[defSide][defFlank].field_2_7 = moveSlot;
structPtr->pos[defSide][defFlank].nightmareMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[defSide][defFlank].nightmareMoveSlot = moveSlot;
break;
case STRINGID_PKMNLOCKEDINNIGHTMARE:
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0
&& structPtr->pos[atkSide][atkFlank].field_0_6 != 0)
&& structPtr->pos[atkSide][atkFlank].nightmareMonId != 0)
{
sub_817E684(8, 5, structPtr->pos[atkSide][atkFlank].field_0_6 - 1, structPtr->pos[atkSide][atkFlank].field_2_7);
sub_817E684(8, 5, structPtr->pos[atkSide][atkFlank].nightmareMonId - 1, structPtr->pos[atkSide][atkFlank].nightmareMoveSlot);
structPtr->side[atkSide].field_3_0 = 5;
structPtr->side[atkSide].field_3_1 = atkFlank;
}
@ -309,195 +313,195 @@ void sub_817C95C(u16 stringId)
case STRINGID_PKMNWRAPPEDBY:
case STRINGID_PKMNCLAMPED:
case STRINGID_PKMNTRAPPEDBYSANDTOMB:
structPtr->pos[defSide][defFlank].field_1_1 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[defSide][defFlank].field_3_0 = moveSlot;
structPtr->pos[defSide][defFlank].wrapMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[defSide][defFlank].wrapMoveSlot = moveSlot;
break;
case STRINGID_PKMNHURTBY:
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0
&& structPtr->pos[atkSide][atkFlank].field_1_1 != 0)
&& structPtr->pos[atkSide][atkFlank].wrapMonId != 0)
{
sub_817E684(8, 6, structPtr->pos[atkSide][atkFlank].field_1_1 - 1, structPtr->pos[atkSide][atkFlank].field_3_0);
sub_817E684(8, 6, structPtr->pos[atkSide][atkFlank].wrapMonId - 1, structPtr->pos[atkSide][atkFlank].wrapMoveSlot);
structPtr->side[atkSide].field_3_0 = 6;
structPtr->side[atkSide].field_3_1 = atkFlank;
}
break;
case STRINGID_PKMNWASBURNED:
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_0_6 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_2_6 = moveSlot;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].brnMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].brnMoveSlot = moveSlot;
break;
case STRINGID_PKMNHURTBYBURN:
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0)
{
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_6 != 0)
sub_817E684(8, 4, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_6 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_2_6);
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMonId != 0)
sub_817E684(8, 4, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMonId - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMoveSlot);
structPtr->side[atkSide].field_3_0 = 4;
structPtr->side[atkSide].field_3_1 = gBattlerPartyIndexes[gBattlerAttacker];
}
break;
case STRINGID_PKMNWASPOISONED:
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_0_0 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_2_2 = moveSlot;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].psnMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].psnMoveSlot = moveSlot;
break;
case STRINGID_PKMNBADLYPOISONED:
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_0_3 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_2_4 = moveSlot;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].badPsnMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].badPsnMoveSlot = moveSlot;
break;
case STRINGID_PKMNHURTBYPOISON:
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0)
{
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_0 != 0)
sub_817E684(8, 2, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_0 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_2_2);
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_3 != 0)
sub_817E684(8, 3, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_3 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_2_4);
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMonId != 0)
sub_817E684(8, 2, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMonId - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMoveSlot);
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].badPsnMonId != 0)
sub_817E684(8, 3, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].badPsnMonId - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].badPsnMoveSlot);
structPtr->side[atkSide].field_3_0 = 3;
structPtr->side[atkSide].field_3_1 = gBattlerPartyIndexes[gBattlerAttacker];
}
break;
case STRINGID_PKMNFELLINLOVE:
structPtr->pos[defSide][defFlank].field_1_4 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[defSide][defFlank].field_3_2 = moveSlot;
structPtr->pos[defSide][defFlank].attractMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[defSide][defFlank].attractMoveSlot = moveSlot;
break;
case STRINGID_PKMNIMMOBILIZEDBYLOVE:
if (structPtr->pos[atkSide][atkFlank].field_1_4 != 0)
sub_817E684(9, 0, structPtr->pos[atkSide][atkFlank].field_1_4 - 1, structPtr->pos[atkSide][atkFlank].field_3_2);
if (structPtr->pos[atkSide][atkFlank].attractMonId != 0)
sub_817E684(9, 0, structPtr->pos[atkSide][atkFlank].attractMonId - 1, structPtr->pos[atkSide][atkFlank].attractMoveSlot);
break;
case STRINGID_PKMNWASPARALYZED:
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_1_1 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_3_0 = moveSlot;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].prlzMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].prlzMoveSlot = moveSlot;
break;
case STRINGID_PKMNISPARALYZED:
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_1 != 0)
sub_817E684(9, 2, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_1 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_3_0);
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].prlzMonId != 0)
sub_817E684(9, 2, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].prlzMonId - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].prlzMoveSlot);
break;
case STRINGID_PKMNFELLASLEEP:
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_1_4 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_3_2 = moveSlot;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].slpMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].slpMoveSlot = moveSlot;
break;
case STRINGID_PKMNFASTASLEEP:
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_4 != 0
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMonId != 0
&& gStringInfo->currentMove != MOVE_SNORE
&& gStringInfo->currentMove != MOVE_SLEEP_TALK)
sub_817E684(9, 3, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_4 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_3_2);
sub_817E684(9, 3, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMonId - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMoveSlot);
break;
case STRINGID_PKMNWASFROZEN:
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_1_7 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_3_4 = moveSlot;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].frzMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].frzMoveSlot = moveSlot;
break;
case STRINGID_PKMNISFROZEN:
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_7 != 0)
sub_817E684(9, 4, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_7 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_3_4);
if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].frzMonId != 0)
sub_817E684(9, 4, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].frzMonId - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].frzMoveSlot);
break;
case STRINGID_PKMNWASCONFUSED:
structPtr->pos[effSide][effFlank].field_2_0 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[effSide][effFlank].field_3_4 = moveSlot;
structPtr->pos[effSide][effFlank].confusionMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[effSide][effFlank].confusionMoveSlot = moveSlot;
break;
case STRINGID_ITHURTCONFUSION:
if (structPtr->pos[atkSide][atkFlank].field_2_0 != 0)
sub_817E684(9, 1, structPtr->pos[atkSide][atkFlank].field_2_0 - 1, structPtr->pos[atkSide][atkFlank].field_3_4);
if (structPtr->pos[atkSide][atkFlank].confusionMonId != 0)
sub_817E684(9, 1, structPtr->pos[atkSide][atkFlank].confusionMonId - 1, structPtr->pos[atkSide][atkFlank].confusionMoveSlot);
structPtr->side[atkSide].field_3_0 = 12;
break;
case STRINGID_SPIKESSCATTERED:
structPtr->side[defSide].field_8_0 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[defSide].field_0_0a = moveSlot;
structPtr->side[defSide].spikesMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[defSide].spikesMoveSlot = moveSlot;
break;
case STRINGID_PKMNHURTBYSPIKES:
if (structPtr->side[scriptingSide].field_8_0 != 0)
if (structPtr->side[scriptingSide].spikesMonId != 0)
{
sub_817E684(10, scriptingSide ^ BIT_SIDE, structPtr->side[scriptingSide].field_8_0 - 1, structPtr->side[scriptingSide].field_0_0a);
sub_817E684(10, scriptingSide ^ BIT_SIDE, structPtr->side[scriptingSide].spikesMonId - 1, structPtr->side[scriptingSide].spikesMoveSlot);
structPtr->side[scriptingSide].field_3_0 = 7;
}
break;
case STRINGID_PKMNBLEWAWAYSPIKES:
structPtr->side[atkSide].field_8_0 = 0;
structPtr->side[atkSide].field_0_0a = 0;
structPtr->side[atkSide].spikesMonId = 0;
structPtr->side[atkSide].spikesMoveSlot = 0;
break;
case STRINGID_FIREWEAKENED:
structPtr->pos[atkSide][atkFlank].field_4_0 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[atkSide][atkFlank].field_3_6 = moveSlot;
structPtr->pos[atkSide][atkFlank].waterSportMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[atkSide][atkFlank].waterSportMoveSlot = moveSlot;
break;
case STRINGID_ELECTRICITYWEAKENED:
structPtr->pos[atkSide][atkFlank].field_4_3 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[atkSide][atkFlank].field_4_6 = moveSlot;
structPtr->pos[atkSide][atkFlank].mudSportMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[atkSide][atkFlank].mudSportMoveSlot = moveSlot;
break;
case STRINGID_ATTACKERFAINTED:
sub_817EA80(0);
case STRINGID_RETURNMON:
if (structPtr->pos[atkSide][atkFlank].field_4_0 != 0)
if (structPtr->pos[atkSide][atkFlank].waterSportMonId != 0)
{
structPtr->pos[atkSide][atkFlank].field_4_0 = 0;
structPtr->pos[atkSide][atkFlank].field_3_6 = 0;
structPtr->pos[atkSide][atkFlank].waterSportMonId = 0;
structPtr->pos[atkSide][atkFlank].waterSportMoveSlot = 0;
}
if (structPtr->pos[atkSide][atkFlank].field_4_3 != 0)
if (structPtr->pos[atkSide][atkFlank].mudSportMonId != 0)
{
structPtr->pos[atkSide][atkFlank].field_4_3 = 0;
structPtr->pos[atkSide][atkFlank].field_4_6 = 0;
structPtr->pos[atkSide][atkFlank].mudSportMonId = 0;
structPtr->pos[atkSide][atkFlank].mudSportMoveSlot = 0;
}
break;
case STRINGID_TARGETFAINTED:
sub_817EA80(1);
if (structPtr->pos[atkSide][defFlank].field_4_0 != 0)
if (structPtr->pos[atkSide][defFlank].waterSportMonId != 0)
{
structPtr->pos[atkSide][defFlank].field_4_0 = 0;
structPtr->pos[atkSide][defFlank].field_3_6 = 0;
structPtr->pos[atkSide][defFlank].waterSportMonId = 0;
structPtr->pos[atkSide][defFlank].waterSportMoveSlot = 0;
}
if (structPtr->pos[atkSide][defFlank].field_4_3 != 0)
if (structPtr->pos[atkSide][defFlank].mudSportMonId != 0)
{
structPtr->pos[atkSide][defFlank].field_4_3 = 0;
structPtr->pos[atkSide][defFlank].field_4_6 = 0;
structPtr->pos[atkSide][defFlank].mudSportMonId = 0;
structPtr->pos[atkSide][defFlank].mudSportMoveSlot = 0;
}
break;
case STRINGID_PKMNRAISEDDEF:
case STRINGID_PKMNRAISEDDEFALITTLE:
structPtr->side[atkSide].field_8_0_b = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].field_0_0b = moveSlot;
structPtr->side[atkSide].reflectMoveId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].reflectMoveSlot = moveSlot;
break;
case STRINGID_PKMNRAISEDSPDEF:
case STRINGID_PKMNRAISEDSPDEFALITTLE:
structPtr->side[atkSide].field_8_0_c = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].field_0_0c = moveSlot;
structPtr->side[atkSide].lightScreenMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].lightScreenMoveSlot = moveSlot;
break;
case STRINGID_PKMNSXWOREOFF:
if (*finishedMoveId == MOVE_REFLECT)
{
structPtr->side[atkSide].field_8_0_b = 0;
structPtr->side[atkSide].field_0_0b = 0;
structPtr->side[atkSide].reflectMoveId = 0;
structPtr->side[atkSide].reflectMoveSlot = 0;
}
if (*finishedMoveId == MOVE_LIGHT_SCREEN)
{
structPtr->side[atkSide].field_8_0_c = 0;
structPtr->side[atkSide].field_0_0c = 0;
structPtr->side[atkSide].lightScreenMonId = 0;
structPtr->side[atkSide].lightScreenMoveSlot = 0;
}
if (*finishedMoveId == MOVE_MIST)
{
structPtr->side[atkSide].field_8_0_e = 0;
structPtr->side[atkSide].field_0_0e = 0;
structPtr->side[atkSide].mistMonId = 0;
structPtr->side[atkSide].mistMoveSlot = 0;
}
break;
case STRINGID_PKMNCOVEREDBYVEIL:
structPtr->side[atkSide].field_8_0_d = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].field_0_0d = moveSlot;
structPtr->side[atkSide].safeguardMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].safeguardMoveSlot = moveSlot;
break;
case STRINGID_PKMNUSEDSAFEGUARD:
if (structPtr->side[defSide].field_8_0_d != 0)
sub_817E684(15, 0, structPtr->side[defSide].field_8_0_d - 1, structPtr->side[defSide].field_0_0d);
if (structPtr->side[defSide].safeguardMonId != 0)
sub_817E684(15, 0, structPtr->side[defSide].safeguardMonId - 1, structPtr->side[defSide].safeguardMoveSlot);
break;
case STRINGID_PKMNSAFEGUARDEXPIRED:
structPtr->side[atkSide].field_8_0_d = 0;
structPtr->side[atkSide].field_0_0d = 0;
structPtr->side[atkSide].safeguardMonId = 0;
structPtr->side[atkSide].safeguardMoveSlot = 0;
break;
case STRINGID_PKMNSHROUDEDINMIST:
structPtr->side[atkSide].field_8_0_e = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].field_0_0e = moveSlot;
structPtr->side[atkSide].mistMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].mistMoveSlot = moveSlot;
break;
case STRINGID_PKMNPROTECTEDBYMIST:
if (structPtr->side[defSide].field_8_0_e != 0)
sub_817E684(16, 0, structPtr->side[defSide].field_8_0_e - 1, structPtr->side[defSide].field_0_0e);
if (structPtr->side[defSide].mistMonId != 0)
sub_817E684(16, 0, structPtr->side[defSide].mistMonId - 1, structPtr->side[defSide].mistMoveSlot);
break;
case STRINGID_THEWALLSHATTERED:
structPtr->side[defSide].field_8_0_b = 0;
structPtr->side[defSide].field_0_0b = 0;
structPtr->side[defSide].field_8_0_c = 0;
structPtr->side[defSide].field_0_0c = 0;
structPtr->side[defSide].reflectMoveId = 0;
structPtr->side[defSide].reflectMoveSlot = 0;
structPtr->side[defSide].lightScreenMonId = 0;
structPtr->side[defSide].lightScreenMoveSlot = 0;
sub_817E684(17, 0, gBattlerPartyIndexes[gBattlerAttacker], moveSlot);
break;
case STRINGID_PKMNFLINCHED:
@ -512,3 +516,70 @@ void sub_817C95C(u16 stringId)
break;
}
}
bool8 sub_817E0B8(u16 stringId)
{
s32 i = 0;
while (1)
{
if (gUnknown_0860A8A4[i] == stringId)
break;
i++;
if (gUnknown_0860A8A4[i] == 0xFFFF)
break;
}
if (gUnknown_0860A8A4[i] == 0xFFFF)
return TRUE;
else
return FALSE;
}
void sub_817E0FC(u16 move, u16 weatherFlags, struct DisableStruct *disableStructPtr)
{
struct UnknownBattleLinkStruct *structPtr;
u32 atkSide, defSide;
u8 moveSlot;
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK))
return;
structPtr = (struct UnknownBattleLinkStruct*)(&gBattleStruct->field_204);
atkSide = GetBattlerSide(gBattlerAttacker);
defSide = GetBattlerSide(gBattlerTarget);
moveSlot = GetBattlerMoveSlotId(gBattlerAttacker, move);
if (moveSlot >= 4)
{
structPtr->side[atkSide].field_3_0 = 15;
return;
}
structPtr->pos[defSide][GetBattlerPosition(gBattlerAttacker) / 2].field_5_5 = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->pos[defSide][GetBattlerPosition(gBattlerAttacker) / 2].field_6_0 = moveSlot;
structPtr->side[atkSide].field_8_6 = moveSlot;
sub_817E684(0, moveSlot, gBattleMoves[move].effect, 0);
sub_817F394(weatherFlags, move, moveSlot);
if (disableStructPtr->chargeTimer1 != 0)
sub_817E684(7, move, moveSlot, 0);
if (move == MOVE_WISH)
{
structPtr->side[atkSide].wishMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide].wishMoveSlot = moveSlot;
}
if (move == MOVE_SELF_DESTRUCT || move == MOVE_EXPLOSION)
{
structPtr->side[atkSide ^ BIT_SIDE].field_4_0_b = gBattlerPartyIndexes[gBattlerAttacker] + 1;
structPtr->side[atkSide ^ BIT_SIDE].field_4_0 = moveSlot;
structPtr->side[atkSide ^ BIT_SIDE].field_3_0 = 13;
structPtr->side[atkSide ^ BIT_SIDE].field_4_0_0 = 1;
}
sub_817E684(13, gBattleMoves[move].type, gBattleMoves[move].power, 0);
sub_817E684(14, gBattleMoves[move].type, gBattleMoves[move].power, 0);
sub_817E684(11, gBattleMoves[move].type, 0, 0);
sub_817E684(12, gBattleMoves[move].type, 0, 0);
}