document record mixing

This commit is contained in:
DizzyEggg 2018-05-26 00:25:36 +02:00
parent b051cbaaab
commit 9e7965fab0
17 changed files with 593 additions and 620 deletions

View File

@ -3746,7 +3746,7 @@ _08163FF4:
ldr r0, [r6]
ldr r1, =0x0000064c
adds r0, r1
bl sub_8164F70
bl CalcEmeraldBattleTowerChecksum
bl sub_8163E90
pop {r3,r4}
mov r8, r3
@ -5484,8 +5484,8 @@ _08164F52:
.pool
thumb_func_end sub_8164ED8
thumb_func_start sub_8164F70
sub_8164F70: @ 8164F70
thumb_func_start CalcEmeraldBattleTowerChecksum
CalcEmeraldBattleTowerChecksum: @ 8164F70
push {r4,lr}
adds r2, r0, 0
adds r2, 0xE8
@ -5504,7 +5504,7 @@ _08164F7E:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8164F70
thumb_func_end CalcEmeraldBattleTowerChecksum
thumb_func_start sub_8164F94
sub_8164F94: @ 8164F94
@ -6750,7 +6750,7 @@ _08165988:
ldr r1, [sp, 0x10]
bl CpuSet
adds r0, r5, 0
bl sub_8164F70
bl CalcEmeraldBattleTowerChecksum
movs r0, 0x1
_081659BE:
add sp, 0x14

View File

@ -2431,8 +2431,8 @@ sub_80FAFF8: @ 80FAFF8
.pool
thumb_func_end sub_80FAFF8
thumb_func_start sub_80FB00C
sub_80FB00C: @ 80FB00C
thumb_func_start CreateRecordMixingSprite
CreateRecordMixingSprite: @ 80FB00C
push {r4,r5,lr}
ldr r0, =gUnknown_0858E864
bl LoadSpritePalette
@ -2478,10 +2478,10 @@ _080FB06E:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_80FB00C
thumb_func_end CreateRecordMixingSprite
thumb_func_start sub_80FB074
sub_80FB074: @ 80FB074
thumb_func_start DestroyRecordMixingSprite
DestroyRecordMixingSprite: @ 80FB074
push {r4-r7,lr}
ldr r4, =gSprites
adds r7, r4, 0
@ -2509,6 +2509,6 @@ _080FB098:
pop {r0}
bx r0
.pool
thumb_func_end sub_80FB074
thumb_func_end DestroyRecordMixingSprite
.align 2, 0 @ Don't pad with nop.

View File

@ -1,5 +0,0 @@
.set POCKET_ITEMS, 0x01
.set POCKET_POKE_BALLS, 0x02
.set POCKET_TM_HM, 0x03
.set POCKET_BERRIES, 0x04
.set BAG_KEYITEMS, 0x05

View File

@ -1,7 +1,8 @@
#ifndef GUARD_BATTLE_TOWER_H
#define GUARD_BATTLE_TOWER_H
struct RSBattleTowerRecord {
struct RSBattleTowerRecord
{
/*0x00*/ u8 battleTowerLevelType; // 0 = level 50, 1 = level 100
/*0x01*/ u8 trainerClass;
/*0x02*/ u16 winStreak;
@ -15,30 +16,16 @@ struct RSBattleTowerRecord {
/*0xA4*/ u16 unk_11c8;
};
struct EmeraldBattleTowerRecord {
/*0x00*/ u8 battleTowerLevelType; // 0 = level 50, 1 = level 100
/*0x01*/ u8 trainerClass;
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[8];
/*0x0C*/ u8 trainerId[4];
/*0x10*/ struct {
u16 easyChat[6];
} greeting;
/*0x1C*/ u8 filler_1c[0x18];
/*0x34*/ struct UnknownPokemonStruct party[4];
/*0xe4*/ u8 language;
u8 filler_e5[7];
};
union BattleTowerRecord {
union BattleTowerRecord
{
struct RSBattleTowerRecord ruby_sapphire;
struct EmeraldBattleTowerRecord emerald;
};
u16 sub_8164FCC(u8, u8);
void sub_81659DC(union BattleTowerRecord *a0, union BattleTowerRecord *a1);
void sub_81659DC(struct RSBattleTowerRecord *a0, struct RSBattleTowerRecord *a1);
bool32 sub_816587C(union BattleTowerRecord *, union BattleTowerRecord *);
bool32 sub_8164F70(union BattleTowerRecord *);
void CalcEmeraldBattleTowerChecksum(struct EmeraldBattleTowerRecord *);
void sub_81628A0(union BattleTowerRecord *);
#endif //GUARD_BATTLE_TOWER_H

View File

@ -9,8 +9,8 @@
void sub_80FA5E4(s16 id, s16 x, s16 y);
void sub_80FA794(s16 x, s16 y);
void sub_80FB00C(void);
void sub_80FB074(void);
void CreateRecordMixingSprite(void);
void DestroyRecordMixingSprite(void);
void overworld_poison_effect(void);
bool8 sub_80FADE4(u16, u8);

View File

@ -103,6 +103,8 @@ enum LanguageId
#define VARS_COUNT 256
#define MAIL_COUNT 16
#define SECRET_BASES_COUNT 20
#define TV_SHOWS_COUNT 25
#define POKE_NEWS_COUNT 16
#define PC_ITEMS_COUNT 50
#define BAG_ITEMS_COUNT 30
#define BAG_KEYITEMS_COUNT 30
@ -263,6 +265,49 @@ struct UnkRecordMixingStruct
u8 field_38[10];
};
struct UnknownPokemonStruct
{
u16 species;
u16 heldItem;
u16 moves[4];
u8 level;
u8 ppBonuses;
u8 hpEV;
u8 attackEV;
u8 defenseEV;
u8 speedEV;
u8 spAttackEV;
u8 spDefenseEV;
u32 otId;
u32 hpIV:5;
u32 attackIV:5;
u32 defenseIV:5;
u32 speedIV:5;
u32 spAttackIV:5;
u32 spDefenseIV:5;
u32 gap:1;
u32 altAbility:1;
u32 personality;
u8 nickname[POKEMON_NAME_LENGTH + 1];
u8 friendship;
};
struct EmeraldBattleTowerRecord
{
/*0x00*/ u8 battleTowerLevelType; // 0 = level 50, 1 = level 100
/*0x01*/ u8 trainerClass;
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[8];
/*0x0C*/ u8 trainerId[4];
/*0x10*/ struct {
u16 easyChat[6];
} greeting;
/*0x1C*/ u8 filler_1c[0x18];
/*0x34*/ struct UnknownPokemonStruct party[4];
/*0xE4*/ u8 language;
/*0xE8*/ u32 checksum;
};
struct SaveBlock2
{
/*0x00*/ u8 playerName[PLAYER_NAME_LENGTH];
@ -302,7 +347,7 @@ struct SaveBlock2
// All below could be a one giant struct
/*0x64C*/ u8 field_64C[236];
/*0x64C*/ struct EmeraldBattleTowerRecord battleTower;
/*0x738*/ struct UnknownSaveBlock2Struct field_738[5]; // No idea here, it's probably wrong, no clue.
/*0xBD4*/ u16 field_BD4;
/*0xBD6*/ u16 field_BD6;
@ -763,8 +808,8 @@ struct SaveBlock1
/*0x????*/ u8 decorDoll[40];
/*0x????*/ u8 decorCushion[10];
/*0x27CA*/ u8 padding_27CA[2];
/*0x27CC*/ TVShow tvShows[25];
/*0x2B50*/ PokeNews pokeNews[16];
/*0x27CC*/ TVShow tvShows[TV_SHOWS_COUNT];
/*0x2B50*/ PokeNews pokeNews[POKE_NEWS_COUNT];
/*0x2B90*/ u16 outbreakPokemonSpecies;
/*0x2B92*/ u8 outbreakLocationMapNum;
/*0x2B93*/ u8 outbreakLocationMapGroup;

View File

@ -19,8 +19,8 @@ void ScrSpecial_SetMauvilleOldManMapObjGfx(void);
u8 sub_81201C8(void);
void sub_8120B70(OldMan *dest);
void sub_8120670(void);
void sub_8120D34(union OldMan * oldMan, u32 r1, u32 r6);
void sub_8120CD0(union OldMan * oldMan, u32 unused, u32 a2);
void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 r1, u32 r6);
void SanitizeReceivedEmeraldOldMan(union OldMan * oldMan, u32 unused, u32 a2);
void ResetMauvilleOldManFlag(void);
#endif // GUARD_MAUVILLE_OLD_MAN_H

View File

@ -6,6 +6,5 @@ bool32 sub_8153884(u32 *a0);
u32 RunMysteryEventScript(u8 *script);
void SetMysteryEventScriptStatus(u32 val);
u16 GetRecordMixingGift(void);
u16 GetRecordMixingGift(void);
#endif // GUARD_MYSTERY_EVENT_SCRIPT_H

View File

@ -240,33 +240,6 @@ struct PokemonStorage
/*0x83C2*/ u8 boxWallpapers[14];
};
struct UnknownPokemonStruct
{
u16 species;
u16 heldItem;
u16 moves[4];
u8 level;
u8 ppBonuses;
u8 hpEV;
u8 attackEV;
u8 defenseEV;
u8 speedEV;
u8 spAttackEV;
u8 spDefenseEV;
u32 otId;
u32 hpIV:5;
u32 attackIV:5;
u32 defenseIV:5;
u32 speedIV:5;
u32 spAttackIV:5;
u32 spDefenseIV:5;
u32 gap:1;
u32 altAbility:1;
u32 personality;
u8 nickname[POKEMON_NAME_LENGTH + 1];
u8 friendship;
};
struct UnknownPokemonSubStruct2
{
u16 species;

View File

@ -26,12 +26,10 @@ struct UnkRecordMixingStruct2
struct UnkRecordMixingStruct2b field_120[2];
};
// Exported RAM declarations
// Exported ROM declarations
void sub_80E6BE8(void);
void sub_80E8260(struct UnkRecordMixingStruct2 *arg0);
#endif //GUARD_RECORD_MIXING_H

View File

@ -16,7 +16,7 @@ void sub_80EED10(void);
void sub_80EED34(void);
void sub_80EED60(u16 delta);
void sub_80F01B8(void);
void sub_80F01E8(void *src, u32 size, u8 masterIdx);
void ReceiveTvShowsData(void *src, u32 size, u8 masterIdx);
void sub_80EE4DC(struct Pokemon *pokemon, u8 ribbonMonDataIdx);
u32 GetPlayerIDAsU32(void);
bool8 GetPriceReduction(u8 newsKind);
@ -30,7 +30,7 @@ void sub_80EEA70(void);
void sub_80EDB44(void);
void sub_80EDC60(const u16 *words);
void sub_80EDA80(void);
void sub_80F0C7C(void *src, u32 size, u8 masterIdx);
void ReceivePokeNewsData(void *src, u32 size, u8 masterIdx);
void sub_80F0BB8(void);
void sub_80ED950(bool8 flag);
void sub_80EEC80(void);

View File

@ -47,7 +47,7 @@ extern void sub_81B9328(void);
extern void CB2_ReturnToField(void);
// this file's functions
static void ClearDaycareMonMisc(struct DaycareMiscMon *misc);
static void ClearDaycareMonMail(struct DayCareMail *mail);
static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare *daycare);
static u8 GetDaycareCompatibilityScore(struct DayCare *daycare);
static void DaycarePrintMonInfo(u8 windowId, s32 daycareSlotId, u8 y);
@ -179,13 +179,13 @@ static void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycar
{
u8 mailId;
StringCopy(daycareMon->misc.OT_name, gSaveBlock2Ptr->playerName);
GetMonNick(mon, daycareMon->misc.monName);
StripExtCtrlCodes(daycareMon->misc.monName);
daycareMon->misc.gameLanguage = LANGUAGE_ENGLISH;
daycareMon->misc.monLanguage = GetMonData(mon, MON_DATA_LANGUAGE);
StringCopy(daycareMon->mail.OT_name, gSaveBlock2Ptr->playerName);
GetMonNick(mon, daycareMon->mail.monName);
StripExtCtrlCodes(daycareMon->mail.monName);
daycareMon->mail.gameLanguage = LANGUAGE_ENGLISH;
daycareMon->mail.monLanguage = GetMonData(mon, MON_DATA_LANGUAGE);
mailId = GetMonData(mon, MON_DATA_MAIL);
daycareMon->misc.mail = gSaveBlock1Ptr->mail[mailId];
daycareMon->mail.message = gSaveBlock1Ptr->mail[mailId];
TakeMailFromMon(mon);
}
@ -219,10 +219,10 @@ static void ShiftDaycareSlots(struct DayCare *daycare)
daycare->mons[0].mon = daycare->mons[1].mon;
ZeroBoxMonData(&daycare->mons[1].mon);
daycare->mons[0].misc = daycare->mons[1].misc;
daycare->mons[0].mail = daycare->mons[1].mail;
daycare->mons[0].steps = daycare->mons[1].steps;
daycare->mons[1].steps = 0;
ClearDaycareMonMisc(&daycare->mons[1].misc);
ClearDaycareMonMail(&daycare->mons[1].mail);
}
}
@ -277,10 +277,10 @@ static u16 TakeSelectedPokemonFromDaycare(struct DaycareMon *daycareMon)
}
gPlayerParty[PARTY_SIZE - 1] = pokemon;
if (daycareMon->misc.mail.itemId)
if (daycareMon->mail.message.itemId)
{
GiveMailToMon2(&gPlayerParty[PARTY_SIZE - 1], &daycareMon->misc.mail);
ClearDaycareMonMisc(&daycareMon->misc);
GiveMailToMon2(&gPlayerParty[PARTY_SIZE - 1], &daycareMon->mail.message);
ClearDaycareMonMail(&daycareMon->mail);
}
ZeroBoxMonData(&daycareMon->mon);
@ -364,23 +364,23 @@ u8 GetNumLevelsGainedFromDaycare(void)
return 0;
}
static void ClearDaycareMonMisc(struct DaycareMiscMon *misc)
static void ClearDaycareMonMail(struct DayCareMail *mail)
{
s32 i;
for (i = 0; i < OT_NAME_LENGTH + 1; i++)
misc->OT_name[i] = 0;
mail->OT_name[i] = 0;
for (i = 0; i < POKEMON_NAME_LENGTH + 1; i++)
misc->monName[i] = 0;
mail->monName[i] = 0;
ClearMailStruct(&misc->mail);
ClearMailStruct(&mail->message);
}
static void ClearDaycareMon(struct DaycareMon *daycareMon)
{
ZeroBoxMonData(&daycareMon->mon);
daycareMon->steps = 0;
ClearDaycareMonMisc(&daycareMon->misc);
ClearDaycareMonMail(&daycareMon->mail);
}
static void ClearAllDaycareData(struct DayCare *daycare)

View File

@ -158,7 +158,7 @@ static void sub_8122804(struct EasyChatPair *s, u16 b, u8 c)
}
}
void sub_812287C(void *a, u32 b, u8 unused)
void ReceiveEasyChatPairsData(void *a, u32 b, u8 unused)
{
u16 i, j, r3, players;
struct EasyChatPair *buffer1, *buffer2, *src, *dst, *foo_of_buffer2;

View File

@ -793,11 +793,11 @@ void sub_8120C0C(union OldMan * oldMan, u32 r8, u32 r7, u32 r3)
}
}
void sub_8120CD0(union OldMan * oldMan, u32 unused, u32 a2)
void SanitizeReceivedEmeraldOldMan(union OldMan * oldMan, u32 version, u32 language)
{
u8 sp00[8];
s32 i;
if (oldMan->common.id == MAUVILLE_MAN_STORYTELLER && a2 == LANGUAGE_JAPANESE)
if (oldMan->common.id == MAUVILLE_MAN_STORYTELLER && language == LANGUAGE_JAPANESE)
{
struct MauvilleManStoryteller * storyteller = &oldMan->storyteller;
@ -816,9 +816,10 @@ void sub_8120CD0(union OldMan * oldMan, u32 unused, u32 a2)
}
}
void sub_8120D34(union OldMan * oldMan, u32 r1, u32 r6)
void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language)
{
u32 r2 = (r1 == LANGUAGE_JAPANESE || r1 == LANGUAGE_ENGLISH) ? 1 : 0;
bool32 isRuby = (version == VERSION_SAPPHIRE || version == VERSION_RUBY);
switch (oldMan->common.id)
{
case MAUVILLE_MAN_TRADER:
@ -826,7 +827,7 @@ void sub_8120D34(union OldMan * oldMan, u32 r1, u32 r6)
struct MauvilleOldManTrader * trader = &oldMan->trader;
s32 i;
if (r2)
if (isRuby)
{
for (i = 0; i < 4; i++)
{
@ -837,7 +838,7 @@ void sub_8120D34(union OldMan * oldMan, u32 r1, u32 r6)
trader->language[i] = LANGUAGE_JAPANESE;
}
else
trader->language[i] = r6;
trader->language[i] = language;
}
}
else
@ -858,12 +859,12 @@ void sub_8120D34(union OldMan * oldMan, u32 r1, u32 r6)
struct MauvilleManStoryteller * storyteller = &oldMan->storyteller;
s32 i;
if (r2)
if (isRuby)
{
for (i = 0; i < 4; i++)
{
if (storyteller->gameStatIDs[i] != 0)
storyteller->language[i] = r6;
storyteller->language[i] = language;
}
}
}
@ -872,9 +873,9 @@ void sub_8120D34(union OldMan * oldMan, u32 r1, u32 r6)
{
struct MauvilleManBard * bard = &oldMan->bard;
if (r2)
if (isRuby)
{
bard->language = r6;
bard->language = language;
}
}
break;
@ -882,9 +883,9 @@ void sub_8120D34(union OldMan * oldMan, u32 r1, u32 r6)
{
struct MauvilleManHipster * hipster = &oldMan->hipster;
if (r2)
if (isRuby)
{
hipster->language = r6;
hipster->language = language;
}
}
break;
@ -892,9 +893,9 @@ void sub_8120D34(union OldMan * oldMan, u32 r1, u32 r6)
{
struct MauvilleManGiddy * giddy = &oldMan->giddy;
if (r2)
if (isRuby)
{
giddy->language = r6;
giddy->language = language;
}
}
break;

File diff suppressed because it is too large Load Diff

View File

@ -1673,7 +1673,7 @@ void sub_80EAEF4(struct SecretBaseRecordMixer *mixers)
sub_80EABA4(&mixers[2], 0);
}
void sub_80EAF80(void *records, size_t recordSize, u8 linkIdx)
void ReceiveSecretBasesData(void *records, size_t recordSize, u8 linkIdx)
{
struct SecretBaseRecordMixer mixers[3];
u16 i;

View File

@ -3606,7 +3606,7 @@ void sub_80F01B8(void)
FlagSet(0x396);
}
void sub_80F01E8(void *src, u32 size, u8 masterIdx)
void ReceiveTvShowsData(void *src, u32 size, u8 masterIdx)
{
u8 i;
u16 version;
@ -4434,7 +4434,7 @@ static void sub_80F0C04(void)
}
}
void sub_80F0C7C(void *src, u32 size, u8 masterIdx)
void ReceivePokeNewsData(void *src, u32 size, u8 masterIdx)
{
u8 i;
PokeNews (*rmBuffer2)[4][16];