one more function in pokemon1

This commit is contained in:
DizzyEggg 2017-09-12 15:36:04 +02:00
parent 0fe7030230
commit 8731a8caa5
4 changed files with 76 additions and 238 deletions

View File

@ -7,235 +7,6 @@
thumb_func_start sub_8068338
sub_8068338: @ 8068338
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x58
adds r7, r0, 0
adds r6, r1, 0
lsls r2, 24
lsrs r2, 24
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldr r1, =0x00000ca9
adds r0, r1
ldrb r1, [r0]
movs r0, 0x3
ands r0, r1
cmp r0, 0
beq _08068374
lsls r0, r1, 30
lsrs r0, 30
bl sub_8165C90
lsls r0, 24
lsrs r3, r0, 24
b _0806837C
.pool
_08068374:
movs r3, 0x32
cmp r2, 0
bne _0806837C
ldrb r3, [r6, 0xC]
_0806837C:
ldrh r1, [r6]
movs r2, 0x1
str r2, [sp]
ldr r0, [r6, 0x1C]
str r0, [sp, 0x4]
str r2, [sp, 0x8]
ldr r0, [r6, 0x14]
str r0, [sp, 0xC]
adds r0, r7, 0
adds r2, r3, 0
movs r3, 0
bl CreateMon
movs r5, 0
movs r0, 0xD
adds r0, r6
mov r10, r0
adds r1, r6, 0x2
str r1, [sp, 0x38]
adds r0, r6, 0
adds r0, 0x2B
str r0, [sp, 0x34]
adds r1, 0x1E
str r1, [sp, 0x54]
add r0, sp, 0x30
mov r9, r0
subs r1, 0x12
str r1, [sp, 0x3C]
adds r0, r6, 0
adds r0, 0xF
str r0, [sp, 0x40]
adds r1, 0x2
str r1, [sp, 0x44]
adds r0, 0x2
str r0, [sp, 0x48]
adds r1, 0x2
str r1, [sp, 0x4C]
adds r0, 0x2
str r0, [sp, 0x50]
movs r1, 0x31
add r1, sp
mov r8, r1
adds r4, r6, 0x4
_080683D2:
ldrh r1, [r4]
lsls r2, r5, 24
lsrs r2, 24
adds r0, r7, 0
bl SetMonMoveSlot
adds r4, 0x2
adds r5, 0x1
cmp r5, 0x3
ble _080683D2
adds r0, r7, 0
movs r1, 0x15
mov r2, r10
bl SetMonData
adds r0, r7, 0
movs r1, 0xC
ldr r2, [sp, 0x38]
bl SetMonData
adds r0, r7, 0
movs r1, 0x20
ldr r2, [sp, 0x34]
bl SetMonData
add r0, sp, 0x10
ldr r1, [sp, 0x54]
bl StringCopy
add r0, sp, 0x10
ldrb r0, [r0]
cmp r0, 0xFC
bne _0806842A
add r0, sp, 0x10
ldrb r0, [r0, 0x1]
cmp r0, 0x15
bne _0806842A
movs r0, 0x1
mov r1, r9
strb r0, [r1]
add r0, sp, 0x10
bl StripExtCtrlCodes
b _08068430
_0806842A:
movs r0, 0x2
mov r1, r9
strb r0, [r1]
_08068430:
adds r0, r7, 0
movs r1, 0x3
mov r2, r9
bl SetMonData
adds r0, r7, 0
movs r1, 0x2
add r2, sp, 0x10
bl SetMonData
adds r0, r7, 0
movs r1, 0x1A
ldr r2, [sp, 0x3C]
bl SetMonData
adds r0, r7, 0
movs r1, 0x1B
ldr r2, [sp, 0x40]
bl SetMonData
adds r0, r7, 0
movs r1, 0x1C
ldr r2, [sp, 0x44]
bl SetMonData
adds r0, r7, 0
movs r1, 0x1D
ldr r2, [sp, 0x48]
bl SetMonData
adds r0, r7, 0
movs r1, 0x1E
ldr r2, [sp, 0x4C]
bl SetMonData
adds r0, r7, 0
movs r1, 0x1F
ldr r2, [sp, 0x50]
bl SetMonData
ldrb r0, [r6, 0x1B]
lsrs r0, 7
mov r1, r8
strb r0, [r1]
adds r0, r7, 0
movs r1, 0x2E
mov r2, r8
bl SetMonData
ldrb r0, [r6, 0x18]
lsls r0, 27
lsrs r0, 27
mov r1, r8
strb r0, [r1]
adds r0, r7, 0
movs r1, 0x27
mov r2, r8
bl SetMonData
ldrh r0, [r6, 0x18]
lsls r0, 22
lsrs r0, 27
mov r1, r8
strb r0, [r1]
adds r0, r7, 0
movs r1, 0x28
mov r2, r8
bl SetMonData
ldrb r0, [r6, 0x19]
lsls r0, 25
lsrs r0, 27
mov r1, r8
strb r0, [r1]
adds r0, r7, 0
movs r1, 0x29
mov r2, r8
bl SetMonData
ldr r0, [r6, 0x18]
lsls r0, 12
lsrs r0, 27
mov r1, r8
strb r0, [r1]
adds r0, r7, 0
movs r1, 0x2A
mov r2, r8
bl SetMonData
ldrh r0, [r6, 0x1A]
lsls r0, 23
lsrs r0, 27
mov r1, r8
strb r0, [r1]
adds r0, r7, 0
movs r1, 0x2B
mov r2, r8
bl SetMonData
ldrb r0, [r6, 0x1B]
lsls r0, 26
lsrs r0, 27
mov r1, r8
strb r0, [r1]
adds r0, r7, 0
movs r1, 0x2C
mov r2, r8
bl SetMonData
adds r0, r7, 0
bl MonRestorePP
adds r0, r7, 0
bl CalculateMonStats
add sp, 0x58
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_8068338
thumb_func_start sub_8068528 thumb_func_start sub_8068528
sub_8068528: @ 8068528 sub_8068528: @ 8068528
push {r4-r7,lr} push {r4-r7,lr}
@ -284,7 +55,7 @@ sub_8068528: @ 8068528
subs r0, 0x1 subs r0, 0x1
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
bl sub_8165C90 bl BattleFrontierGetOpponentLvl
adds r2, r0, 0 adds r2, r0, 0
lsls r2, 24 lsls r2, 24
lsrs r2, 24 lsrs r2, 24

View File

@ -391,7 +391,7 @@ _081622B2:
adds r4, r1, r0 adds r4, r1, r0
mov r0, r10 mov r0, r10
str r2, [sp, 0x38] str r2, [sp, 0x38]
bl sub_8165C90 bl BattleFrontierGetOpponentLvl
ldrb r1, [r4] ldrb r1, [r4]
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
@ -3979,7 +3979,7 @@ _081641E6:
lsls r0, r1, 24 lsls r0, r1, 24
lsrs r0, 24 lsrs r0, 24
str r2, [sp, 0x18] str r2, [sp, 0x18]
bl sub_8165C90 bl BattleFrontierGetOpponentLvl
ldrb r1, [r4] ldrb r1, [r4]
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
@ -4464,7 +4464,7 @@ _081645B8:
lsls r0, r1, 24 lsls r0, r1, 24
lsrs r0, 24 lsrs r0, 24
str r3, [sp, 0x48] str r3, [sp, 0x48]
bl sub_8165C90 bl BattleFrontierGetOpponentLvl
ldrb r1, [r4] ldrb r1, [r4]
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
@ -7104,7 +7104,7 @@ sub_8165C40: @ 8165C40
ldrb r0, [r2] ldrb r0, [r2]
lsls r0, 30 lsls r0, 30
lsrs r0, 30 lsrs r0, 30
bl sub_8165C90 bl BattleFrontierGetOpponentLvl
b _08165C88 b _08165C88
.pool .pool
_08165C84: _08165C84:
@ -7116,8 +7116,8 @@ _08165C88:
bx r1 bx r1
thumb_func_end sub_8165C40 thumb_func_end sub_8165C40
thumb_func_start sub_8165C90 thumb_func_start BattleFrontierGetOpponentLvl
sub_8165C90: @ 8165C90 BattleFrontierGetOpponentLvl: @ 8165C90
push {lr} push {lr}
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
@ -7138,7 +7138,7 @@ _08165CA2:
_08165CB0: _08165CB0:
pop {r1} pop {r1}
bx r1 bx r1
thumb_func_end sub_8165C90 thumb_func_end BattleFrontierGetOpponentLvl
thumb_func_start sub_8165CB4 thumb_func_start sub_8165CB4
sub_8165CB4: @ 8165CB4 sub_8165CB4: @ 8165CB4

View File

@ -184,7 +184,8 @@ struct SaveBlock2
// All below could be a one giant struct // All below could be a one giant struct
/*0x64C*/ u8 field_64C[1629]; /*0x64C*/ u8 field_64C[1629];
/*0xCA9*/ u8 frontierChosenLvl; /*0xCA9*/ u8 frontierChosenLvl : 2;
/*0xCA9*/ u8 field_CA9_a : 6;
/*0xCAA*/ u8 field_CAA[368]; /*0xCAA*/ u8 field_CAA[368];
/*0xE1A*/ u16 battlePyramidFloor; // possibly? /*0xE1A*/ u16 battlePyramidFloor; // possibly?
/*0xE1C*/ u8 field_E1C[16]; /*0xE1C*/ u8 field_E1C[16];

View File

@ -296,7 +296,73 @@ void sub_806819C(struct Pokemon *mon, struct UnknownPokemonStruct *src)
StripExtCtrlCodes(nickname); StripExtCtrlCodes(nickname);
} }
else else
{
language = GAME_LANGUAGE; language = GAME_LANGUAGE;
}
SetMonData(mon, MON_DATA_LANGUAGE, &language);
SetMonData(mon, MON_DATA_NICKNAME, nickname);
SetMonData(mon, MON_DATA_HP_EV, &src->hpEV);
SetMonData(mon, MON_DATA_ATK_EV, &src->attackEV);
SetMonData(mon, MON_DATA_DEF_EV, &src->defenseEV);
SetMonData(mon, MON_DATA_SPD_EV, &src->speedEV);
SetMonData(mon, MON_DATA_SPATK_EV, &src->spAttackEV);
SetMonData(mon, MON_DATA_SPDEF_EV, &src->spDefenseEV);
value = src->altAbility;
SetMonData(mon, MON_DATA_ALT_ABILITY, &value);
value = src->hpIV;
SetMonData(mon, MON_DATA_HP_IV, &value);
value = src->attackIV;
SetMonData(mon, MON_DATA_ATK_IV, &value);
value = src->defenseIV;
SetMonData(mon, MON_DATA_DEF_IV, &value);
value = src->speedIV;
SetMonData(mon, MON_DATA_SPD_IV, &value);
value = src->spAttackIV;
SetMonData(mon, MON_DATA_SPATK_IV, &value);
value = src->spDefenseIV;
SetMonData(mon, MON_DATA_SPDEF_IV, &value);
MonRestorePP(mon);
CalculateMonStats(mon);
}
u8 BattleFrontierGetOpponentLvl(u8);
void sub_8068338(struct Pokemon *mon, struct UnknownPokemonStruct *src, bool8 lvl50)
{
s32 i;
u8 nickname[30];
u8 level;
u8 language;
u8 value;
if (gSaveBlock2Ptr->frontierChosenLvl != 0)
level = BattleFrontierGetOpponentLvl(gSaveBlock2Ptr->frontierChosenLvl);
else if (lvl50)
level = 50;
else
level = src->level;
CreateMon(mon, src->species, level, 0, 1, src->personality, 1, src->otId);
for (i = 0; i < 4; i++)
SetMonMoveSlot(mon, src->moves[i], i);
SetMonData(mon, MON_DATA_PP_BONUSES, &src->ppBonuses);
SetMonData(mon, MON_DATA_HELD_ITEM, &src->heldItem);
SetMonData(mon, MON_DATA_FRIENDSHIP, &src->friendship);
StringCopy(nickname, src->nickname);
if (nickname[0] == EXT_CTRL_CODE_BEGIN && nickname[1] == EXT_CTRL_CODE_JPN)
{
language = LANGUAGE_JAPANESE;
StripExtCtrlCodes(nickname);
}
else
{
language = GAME_LANGUAGE;
}
SetMonData(mon, MON_DATA_LANGUAGE, &language); SetMonData(mon, MON_DATA_LANGUAGE, &language);
SetMonData(mon, MON_DATA_NICKNAME, nickname); SetMonData(mon, MON_DATA_NICKNAME, nickname);