mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
sub_80E7A14
This commit is contained in:
parent
f2e723660b
commit
8d05aeccec
@ -5,68 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_80E7A14
|
||||
sub_80E7A14: @ 80E7A14
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x10
|
||||
mov r8, r0
|
||||
adds r7, r1, 0
|
||||
lsls r2, 24
|
||||
lsrs r5, r2, 24
|
||||
mov r0, sp
|
||||
bl sub_80E7830
|
||||
adds r0, r7, 0
|
||||
muls r0, r5
|
||||
add r0, r8
|
||||
ldr r6, =gUnknown_03001150
|
||||
ldr r1, [r6]
|
||||
movs r2, 0x40
|
||||
bl memcpy
|
||||
bl GetLilycoveLadyId
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080E7A60
|
||||
movs r0, 0x40
|
||||
bl Alloc
|
||||
adds r4, r0, 0
|
||||
cmp r4, 0
|
||||
beq _080E7A8A
|
||||
ldr r1, [r6]
|
||||
movs r2, 0x40
|
||||
bl memcpy
|
||||
b _080E7A62
|
||||
.pool
|
||||
_080E7A60:
|
||||
movs r4, 0
|
||||
_080E7A62:
|
||||
ldr r0, =gUnknown_03001150
|
||||
ldr r0, [r0]
|
||||
lsls r1, r5, 2
|
||||
add r1, sp
|
||||
ldr r1, [r1]
|
||||
muls r1, r7
|
||||
add r1, r8
|
||||
movs r2, 0x40
|
||||
bl memcpy
|
||||
bl sub_818DA78
|
||||
cmp r4, 0
|
||||
beq _080E7A8A
|
||||
adds r0, r4, 0
|
||||
bl sub_818E570
|
||||
adds r0, r4, 0
|
||||
bl Free
|
||||
_080E7A8A:
|
||||
add sp, 0x10
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80E7A14
|
||||
|
||||
thumb_func_start sub_80E7A9C
|
||||
sub_80E7A9C: @ 80E7A9C
|
||||
ldrh r0, [r0, 0x20]
|
||||
|
@ -6,7 +6,7 @@ void SetLilycoveLady(void);
|
||||
void sub_818DA78(void);
|
||||
void sub_818DEF4(void);
|
||||
void sub_818E564(void);
|
||||
void sub_818E570(const struct LilycoveLadyQuiz *quiz);
|
||||
void sub_818E570(const LilycoveLady *lilycoveLady);
|
||||
bool8 sub_818E704(struct Pokeblock *pokeblock);
|
||||
void sub_818E7E0(u8 *dest1, u8 *dest2);
|
||||
void sub_818E81C(u8 *dest);
|
||||
|
@ -879,26 +879,26 @@ void sub_818E564(void)
|
||||
EnableBothScriptContexts();
|
||||
}
|
||||
|
||||
void sub_818E570(const struct LilycoveLadyQuiz *quiz)
|
||||
void sub_818E570(const LilycoveLady *lilycoveLady)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
gUnknown_0203CD68 = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
||||
if (quiz->unk_02c < 16 && gUnknown_0203CD68->id == LILYCOVE_LADY_QUIZ)
|
||||
if (lilycoveLady->quiz.unk_02c < 16 && gUnknown_0203CD68->id == LILYCOVE_LADY_QUIZ)
|
||||
{
|
||||
for (i = 0; i < 4; i ++)
|
||||
{
|
||||
if (quiz->unk_02c != gUnknown_0203CD68->unk_02b)
|
||||
if (lilycoveLady->quiz.unk_02c != gUnknown_0203CD68->unk_02b)
|
||||
{
|
||||
break;
|
||||
}
|
||||
gUnknown_0203CD68->unk_02b = Random() % 16;
|
||||
}
|
||||
if (quiz->unk_02c == gUnknown_0203CD68->unk_02b)
|
||||
if (lilycoveLady->quiz.unk_02c == gUnknown_0203CD68->unk_02b)
|
||||
{
|
||||
gUnknown_0203CD68->unk_02b = (gUnknown_0203CD68->unk_02b + 1) % 16;
|
||||
}
|
||||
gUnknown_0203CD68->unk_02c = quiz->unk_02c;
|
||||
gUnknown_0203CD68->unk_02c = lilycoveLady->quiz.unk_02c;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "fldeff_80F9BCC.h"
|
||||
#include "script.h"
|
||||
#include "event_data.h"
|
||||
#include "lilycove_lady.h"
|
||||
#include "strings.h"
|
||||
#include "string_util.h"
|
||||
#include "record_mixing.h"
|
||||
@ -75,7 +76,7 @@ static u8 sub_80E7810(void);
|
||||
static void *sub_80E7820(u8);
|
||||
static void sub_80E78C4(OldMan *, size_t, u8);
|
||||
static void sub_80E7948(union BattleTowerRecord *, size_t, u8);
|
||||
void sub_80E7A14(LilycoveLady *, size_t, u8);
|
||||
static void sub_80E7A14(LilycoveLady *, size_t, u8);
|
||||
void sub_80E7B2C(TVShow *);
|
||||
void sub_80E7B60(void *, size_t, u8, TVShow *);
|
||||
void sub_80E7F68(void *, u8);
|
||||
@ -584,7 +585,7 @@ static void sub_80E78C4(OldMan *oldMan, size_t recordSize, u8 which)
|
||||
u32 mixIndices[4];
|
||||
|
||||
sub_80E7830(mixIndices);
|
||||
dest = (OldMan *)((void *)oldMan + recordSize * mixIndices[which]);
|
||||
dest = (void *)oldMan + recordSize * mixIndices[which];
|
||||
version = gLinkPlayers[mixIndices[which]].version;
|
||||
language = gLinkPlayers[mixIndices[which]].language;
|
||||
if (Link_AnyPartnersPlayingRubyOrSapphire())
|
||||
@ -595,13 +596,13 @@ static void sub_80E78C4(OldMan *oldMan, size_t recordSize, u8 which)
|
||||
{
|
||||
sub_8120CD0(dest, version, language);
|
||||
}
|
||||
memcpy(gUnknown_03001140, (OldMan *)((void *)oldMan + recordSize * mixIndices[which]), sizeof(OldMan));
|
||||
memcpy(gUnknown_03001140, (void *)oldMan + recordSize * mixIndices[which], sizeof(OldMan));
|
||||
sub_8120670();
|
||||
}
|
||||
|
||||
static void sub_80E7948(union BattleTowerRecord *battleTowerRecord, size_t recordSize, u8 which)
|
||||
{
|
||||
union BattleTowerRecord *r6;
|
||||
union BattleTowerRecord *dest;
|
||||
struct UnknownPokemonStruct *btPokemon;
|
||||
u32 mixIndices[4];
|
||||
s32 i;
|
||||
@ -609,26 +610,55 @@ static void sub_80E7948(union BattleTowerRecord *battleTowerRecord, size_t recor
|
||||
sub_80E7830(mixIndices);
|
||||
if (Link_AnyPartnersPlayingRubyOrSapphire())
|
||||
{
|
||||
if (sub_816587C((union BattleTowerRecord *)((void *)battleTowerRecord + recordSize * mixIndices[which]), (union BattleTowerRecord *)((void *)battleTowerRecord + recordSize * which)) == TRUE)
|
||||
if (sub_816587C((void *)battleTowerRecord + recordSize * mixIndices[which], (void *)battleTowerRecord + recordSize * which) == TRUE)
|
||||
{
|
||||
r6 = (union BattleTowerRecord *)((void *)battleTowerRecord + recordSize * which);
|
||||
r6->emerald.language = gLinkPlayers[mixIndices[which]].language;
|
||||
sub_8164F70(r6);
|
||||
dest = (void *)battleTowerRecord + recordSize * which;
|
||||
dest->emerald.language = gLinkPlayers[mixIndices[which]].language;
|
||||
sub_8164F70(dest);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy((union BattleTowerRecord *)((void *)battleTowerRecord + recordSize * which), (union BattleTowerRecord *)((void *)battleTowerRecord + recordSize * mixIndices[which]), sizeof(union BattleTowerRecord));
|
||||
r6 = (union BattleTowerRecord *)((void *)battleTowerRecord + recordSize * which);
|
||||
memcpy((void *)battleTowerRecord + recordSize * which, (void *)battleTowerRecord + recordSize * mixIndices[which], sizeof(union BattleTowerRecord));
|
||||
dest = (void *)battleTowerRecord + recordSize * which;
|
||||
for (i = 0; i < 4; i ++)
|
||||
{
|
||||
btPokemon = &r6->emerald.party[i];
|
||||
btPokemon = &dest->emerald.party[i];
|
||||
if (btPokemon->species != SPECIES_NONE && IsStringJapanese(btPokemon->nickname))
|
||||
{
|
||||
ConvertInternationalString(btPokemon->nickname, LANGUAGE_JAPANESE);
|
||||
}
|
||||
}
|
||||
sub_8164F70(r6);
|
||||
sub_8164F70(dest);
|
||||
}
|
||||
sub_81628A0((void *)battleTowerRecord + recordSize * which);
|
||||
}
|
||||
|
||||
static void sub_80E7A14(LilycoveLady *lilycoveLady, size_t recordSize, u8 which)
|
||||
{
|
||||
LilycoveLady *dest;
|
||||
u32 mixIndices[4];
|
||||
|
||||
sub_80E7830(mixIndices);
|
||||
memcpy((void *)lilycoveLady + recordSize * which, gUnknown_03001150, sizeof(LilycoveLady));
|
||||
if (GetLilycoveLadyId() == 0)
|
||||
{
|
||||
dest = malloc(sizeof(LilycoveLady));
|
||||
if (dest == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
memcpy(dest, gUnknown_03001150, sizeof(LilycoveLady));
|
||||
}
|
||||
else
|
||||
{
|
||||
dest = NULL;
|
||||
}
|
||||
memcpy(gUnknown_03001150, (void *)lilycoveLady + recordSize * mixIndices[which], sizeof(LilycoveLady));
|
||||
sub_818DA78();
|
||||
if (dest != NULL)
|
||||
{
|
||||
sub_818E570(dest);
|
||||
free(dest);
|
||||
}
|
||||
sub_81628A0((union BattleTowerRecord *)((void *)battleTowerRecord + recordSize * which));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user