Merge pull request #242 from DizzyEggg/decompile_battle_records

Decompile battle records
This commit is contained in:
Marcus Huderle 2018-05-03 08:42:44 -07:00 committed by GitHub
commit cdb5e9e314
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 659 additions and 1423 deletions

View File

@ -14344,7 +14344,7 @@ sub_81A1C4C: @ 81A1C4C
adds r3, r0, 0
lsls r0, r5, 3
adds r5, r0, 0x1
ldr r0, =gResultsWindowId
ldr r0, =gRecordsWindowId
ldrb r0, [r0]
lsls r3, 24
lsrs r3, 24
@ -14370,7 +14370,7 @@ sub_81A1C90: @ 81A1C90
push {r4,lr}
sub sp, 0x34
adds r2, r0, 0
ldr r3, =gResultsWindowId
ldr r3, =gRecordsWindowId
movs r1, 0xAE
mov r0, sp
adds r0, 0x2F
@ -14425,7 +14425,7 @@ sub_81A1CD8: @ 81A1CD8
lsls r0, 24
lsrs r0, 24
adds r7, r0, 0
ldr r0, =gResultsWindowId
ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r7, [sp]
@ -14644,7 +14644,7 @@ sub_81A1EA8: @ 81A1EA8
sub sp, 0xC
lsls r0, 24
lsrs r7, r0, 24
ldr r4, =gResultsWindowId
ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r4]
@ -14685,7 +14685,7 @@ _081A1F28:
ldr r0, =gStringVar4
movs r1, 0x2
bl sub_81A1C4C
ldr r6, =gResultsWindowId
ldr r6, =gRecordsWindowId
ldrb r0, [r6]
ldr r2, =gText_Lv502
movs r1, 0x31
@ -14798,7 +14798,7 @@ sub_81A2008: @ 81A2008
lsrs r6, 24
lsls r5, 24
lsrs r5, 24
ldr r0, =gResultsWindowId
ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r5, [sp]
@ -14932,7 +14932,7 @@ sub_81A2134: @ 81A2134
sub sp, 0xC
lsls r0, 24
lsrs r7, r0, 24
ldr r4, =gResultsWindowId
ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r4]
@ -14957,7 +14957,7 @@ _081A2184:
ldr r0, =gStringVar4
movs r1, 0
bl sub_81A1C4C
ldr r1, =gResultsWindowId
ldr r1, =gRecordsWindowId
ldrb r0, [r1]
ldr r2, =gText_Lv502
movs r6, 0x21
@ -14969,7 +14969,7 @@ _081A2184:
movs r1, 0x1
movs r3, 0x8
bl PrintTextOnWindow
ldr r1, =gResultsWindowId
ldr r1, =gRecordsWindowId
ldrb r0, [r1]
ldr r2, =gText_OpenLv
movs r1, 0x61
@ -15052,10 +15052,10 @@ _081A2184:
mov r1, r8
movs r3, 0x40
bl sub_81A2008
ldr r1, =gResultsWindowId
ldr r1, =gRecordsWindowId
ldrb r0, [r1]
bl PutWindowTilemap
ldr r1, =gResultsWindowId
ldr r1, =gRecordsWindowId
ldrb r0, [r1]
movs r1, 0x3
bl CopyWindowToVram
@ -15091,7 +15091,7 @@ sub_81A22B8: @ 81A22B8
lsls r0, 24
lsrs r0, 24
adds r7, r0, 0
ldr r0, =gResultsWindowId
ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r7, [sp]
@ -15285,7 +15285,7 @@ sub_81A2460: @ 81A2460
sub sp, 0xC
lsls r0, 24
lsrs r7, r0, 24
ldr r4, =gResultsWindowId
ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r4]
@ -15310,7 +15310,7 @@ _081A24B0:
ldr r0, =gStringVar4
movs r1, 0x2
bl sub_81A1C4C
ldr r6, =gResultsWindowId
ldr r6, =gRecordsWindowId
ldrb r0, [r6]
ldr r2, =gText_Lv502
movs r1, 0x31
@ -15420,7 +15420,7 @@ sub_81A258C: @ 81A258C
lsrs r6, 24
lsls r5, 24
lsrs r5, 24
ldr r0, =gResultsWindowId
ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r5, [sp]
@ -15533,7 +15533,7 @@ sub_81A2698: @ 81A2698
mov r5, r8
push {r5-r7}
sub sp, 0xC
ldr r6, =gResultsWindowId
ldr r6, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r6]
@ -15672,7 +15672,7 @@ sub_81A27E8: @ 81A27E8
lsls r0, 24
lsrs r0, 24
adds r7, r0, 0
ldr r0, =gResultsWindowId
ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r7, [sp]
@ -15836,7 +15836,7 @@ _081A2956:
sub_81A2968: @ 81A2968
push {r4-r6,lr}
sub sp, 0xC
ldr r5, =gResultsWindowId
ldr r5, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r5]
@ -15935,7 +15935,7 @@ sub_81A2A28: @ 81A2A28
lsls r0, 24
lsrs r0, 24
adds r6, r0, 0
ldr r0, =gResultsWindowId
ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r6, [sp]
@ -16211,7 +16211,7 @@ sub_81A2C94: @ 81A2C94
sub sp, 0xC
lsls r0, 24
lsrs r7, r0, 24
ldr r4, =gResultsWindowId
ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r4]
@ -16236,7 +16236,7 @@ _081A2CE0:
ldr r0, =gStringVar4
movs r1, 0
bl sub_81A1C4C
ldr r0, =gResultsWindowId
ldr r0, =gRecordsWindowId
mov r8, r0
ldrb r0, [r0]
ldr r2, =gText_Lv502
@ -16340,7 +16340,7 @@ sub_81A2DB4: @ 81A2DB4
lsls r0, 24
lsrs r0, 24
adds r7, r0, 0
ldr r0, =gResultsWindowId
ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r7, [sp]
@ -16506,7 +16506,7 @@ _081A2F26:
sub_81A2F38: @ 81A2F38
push {r4-r6,lr}
sub sp, 0xC
ldr r5, =gResultsWindowId
ldr r5, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r5]
@ -16584,7 +16584,7 @@ sub_81A2FF8: @ 81A2FF8
mov r6, r8
push {r6,r7}
sub sp, 0xC
ldr r4, =gResultsWindowId
ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C7C
bl AddWindow
strb r0, [r4]
@ -16750,7 +16750,7 @@ _081A315C:
movs r2, 0x1
movs r3, 0x4
bl ConvertIntToDecimalStringN
ldr r6, =gResultsWindowId
ldr r6, =gRecordsWindowId
ldrb r0, [r6]
movs r1, 0x26
adds r3, r5, 0
@ -19026,7 +19026,7 @@ sub_81A4594: @ 81A4594
sub sp, 0x2C
mov r8, r1
adds r6, r3, 0
ldr r1, =gResultsWindowId
ldr r1, =gRecordsWindowId
ldrb r5, [r1]
lsls r4, r0, 1
adds r4, r0
@ -19062,7 +19062,7 @@ sub_81A4594: @ 81A4594
ldrb r2, [r6, 0xE]
add r0, sp, 0xC
bl TVShowConvertInternationalString
ldr r1, =gResultsWindowId
ldr r1, =gRecordsWindowId
ldrb r0, [r1]
mov r3, r8
adds r3, 0x2
@ -19102,7 +19102,7 @@ _081A4618:
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24
ldr r1, =gResultsWindowId
ldr r1, =gRecordsWindowId
ldrb r0, [r1]
str r7, [sp]
mov r1, r10
@ -19136,7 +19136,7 @@ sub_81A4684: @ 81A4684
adds r7, r1, 0
mov r10, r2
adds r5, r3, 0
ldr r1, =gResultsWindowId
ldr r1, =gRecordsWindowId
ldrb r0, [r1]
lsls r2, r6, 1
adds r2, r6
@ -19176,7 +19176,7 @@ sub_81A4684: @ 81A4684
ldrb r2, [r5, 0x1A]
add r0, sp, 0xC
bl TVShowConvertInternationalString
ldr r1, =gResultsWindowId
ldr r1, =gRecordsWindowId
ldrb r0, [r1]
adds r3, r7, 0x2
lsls r3, 27
@ -19211,7 +19211,7 @@ _081A4734:
adds r1, r4, 0
bl StringCopy
_081A473C:
ldr r2, =gResultsWindowId
ldr r2, =gRecordsWindowId
mov r9, r2
ldrb r0, [r2]
adds r3, r7, 0x4
@ -19532,7 +19532,7 @@ sub_81A4998: @ 81A4998
ldr r1, [r5]
adds r0, r6, 0
bl StringExpandPlaceholders
ldr r0, =gResultsWindowId
ldr r0, =gRecordsWindowId
mov r8, r0
ldrb r0, [r0]
movs r1, 0x1
@ -19631,7 +19631,7 @@ _081A4A90:
thumb_func_start sub_81A4AA0
sub_81A4AA0: @ 81A4AA0
push {r4,lr}
ldr r4, =gResultsWindowId
ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C84
bl AddWindow
strb r0, [r4]
@ -19659,7 +19659,7 @@ sub_81A4AA0: @ 81A4AA0
thumb_func_start sub_81A4AE8
sub_81A4AE8: @ 81A4AE8
push {r4,lr}
ldr r4, =gResultsWindowId
ldr r4, =gRecordsWindowId
ldrb r0, [r4]
movs r1, 0x11
bl FillWindowPixelBuffer

File diff suppressed because it is too large Load Diff

View File

@ -960,7 +960,7 @@ task_map_chg_seq_0807EC34: @ 80B2B94
push {r4,r5,lr}
adds r5, r0, 0
adds r4, r1, 0
ldr r1, =gUnknown_02039B58
ldr r1, =gTrainerCards
ldrh r0, [r5]
cmp r0, 0x1
bne _080B2C10
@ -1044,7 +1044,7 @@ sub_80B2C30: @ 80B2C30
_080B2C5C:
movs r0, 0x64
muls r0, r4
ldr r1, =gUnknown_02039B58
ldr r1, =gTrainerCards
adds r0, r1
lsls r1, r4, 8
ldr r2, =gBlockRecvBuffer
@ -2171,7 +2171,7 @@ sub_80B360C: @ 80B360C
ldrb r0, [r0]
movs r5, 0x1
eors r0, r5
bl sub_813C2A0
bl UpdatePlayerLinkBattleRecords
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0

View File

@ -28718,8 +28718,8 @@ nullsub_2: @ 81D5C88
bx lr
thumb_func_end nullsub_2
thumb_func_start sub_81D5C8C
sub_81D5C8C: @ 81D5C8C
thumb_func_start PrintOnTrainerHillRecordsWindow
PrintOnTrainerHillRecordsWindow: @ 81D5C8C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
@ -28857,7 +28857,7 @@ _081D5CD6:
pop {r0}
bx r0
.pool
thumb_func_end sub_81D5C8C
thumb_func_end PrintOnTrainerHillRecordsWindow
thumb_func_start free_203F458
free_203F458: @ 81D5DF0

View File

@ -3181,7 +3181,7 @@ _08014138:
adds r3, r1, r0
movs r0, 0x64
muls r0, r4
ldr r1, =gUnknown_02039B58
ldr r1, =gTrainerCards
adds r0, r1
ldrb r2, [r5]
adds r1, r3, 0
@ -10615,7 +10615,7 @@ sub_8018220: @ 8018220
lsrs r0, 24
movs r1, 0x64
muls r1, r0
ldr r0, =gUnknown_02039B58
ldr r0, =gTrainerCards
adds r1, r0
mov r8, r1
bl UnkTextUtil_Reset

View File

@ -3894,7 +3894,7 @@ _080C48F6:
sub_80C4904: @ 80C4904
lsls r0, 24
lsrs r0, 24
ldr r2, =gUnknown_02039B58
ldr r2, =gTrainerCards
movs r1, 0x64
muls r0, r1
adds r0, r2
@ -4578,7 +4578,7 @@ sub_80C4E74: @ 80C4E74
ldr r0, [r5]
ldr r1, =0x00000534
adds r0, r1
ldr r2, =gUnknown_02039B58
ldr r2, =gTrainerCards
movs r1, 0x64
muls r1, r4
adds r1, r2

View File

@ -1,37 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnknown_085B3484:: @ 85B3484
.incbin "graphics/unknown/unknown_5B3484.4bpp"
.align 2
gUnknown_085B3544:: @ 85B3544
.incbin "graphics/unknown/unknown_5B3484.gbapal"
.align 2
gUnknown_085B3564:: @ 85B3564
.incbin "graphics/unknown/unknown_5B3564.bin"
.align 2
gUnknown_085B3D64:: @ 85B3D64
.4byte 0x000001f0, 0x000031e7
.align 2
gUnknown_085B3D6C:: @ 85B3D6C
window_template 0x00, 0x02, 0x01, 0x1a, 0x12, 0x0f, 0x0014
null_window_template
.align 2
gUnknown_085B3D7C:: @ 85B3D7C
window_template 0x00, 0x02, 0x01, 0x1a, 0x11, 0x0f, 0x0001
gUnknown_085B3D84:: @ 85B3D84
.string "-------$"
gUnknown_085B3D8C:: @ 85B3D8C
.string "----$"

View File

@ -787,9 +787,9 @@ MossdeepCity_GameCorner_1F_Movement_277360: @ 8277360
gUnknown_08277365:: @ 8277365
lockall
setvar VAR_0x8004, 0
special sub_813C4BC
special ShowLinkBattleRecords
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end

View File

@ -348,7 +348,7 @@ BattleFrontier_BattleArenaLobby_EventScript_256092:: @ 8256092
setvar VAR_0x8005, 3
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end

View File

@ -415,7 +415,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249D52:: @ 8249D52
setvar VAR_0x8006, 0
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end
@ -426,7 +426,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249D6B:: @ 8249D6B
setvar VAR_0x8006, 1
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end

View File

@ -305,7 +305,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_2587E1:: @ 82587E1
setvar VAR_0x8006, 0
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end
@ -316,7 +316,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_2587FA:: @ 82587FA
setvar VAR_0x8006, 1
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end

View File

@ -366,7 +366,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24DC50:: @ 824DC50
setvar VAR_0x8006, 0
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end
@ -377,7 +377,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24DC69:: @ 824DC69
setvar VAR_0x8006, 1
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end

View File

@ -257,7 +257,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25BA80:: @ 825BA80
setvar VAR_0x8005, 5
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end

View File

@ -428,7 +428,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_250D42:: @ 8250D42
setvar VAR_0x8005, 6
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end

View File

@ -636,7 +636,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EFC7:: @ 823EFC7
setvar VAR_0x8006, 0
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end
@ -647,7 +647,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EFE0:: @ 823EFE0
setvar VAR_0x8006, 1
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end
@ -658,7 +658,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EFF9:: @ 823EFF9
setvar VAR_0x8006, 2
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end
@ -669,7 +669,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23F012:: @ 823F012
setvar VAR_0x8006, 3
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end

View File

@ -66,7 +66,7 @@ BattleFrontier_RankingHall_EventScript_25E522:: @ 825E522
waitbuttonpress
special sub_81A4AE8
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end

View File

@ -554,7 +554,7 @@ LilycoveCity_ContestLobby_EventScript_21A77A:: @ 821A77A
lockall
special ShowBerryBlenderRecordWindow
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end
@ -564,7 +564,7 @@ LilycoveCity_ContestLobby_EventScript_21A784:: @ 821A784
setvar VAR_0x8005, 7
special sub_81A1780
waitbuttonpress
special sub_813C5A0
special RemoveRecordsWindow
releaseall
end

View File

@ -236,7 +236,7 @@ TrainerHill_Entrance_Movement_268385: @ 8268385
TrainerHill_Entrance_EventScript_268388:: @ 8268388
lockall
fadescreen 1
special sub_813C904
special ShowTrainerHillRecords
waitstate
releaseall
end

View File

@ -207,7 +207,7 @@ gSpecials:: @ 81DBA64
def_special ScriptHatchMon
def_special EggHatch
def_special sub_8071614
def_special sub_813C4BC
def_special ShowLinkBattleRecords
def_special IsEnoughForCostInVar0x8005
def_special SubtractMoneyFromVar0x8005
def_special sub_80F972C
@ -526,12 +526,12 @@ gSpecials:: @ 81DBA64
def_special sub_8139ED0
def_special sub_813B968
def_special sub_80F8B94
def_special sub_813C904
def_special ShowTrainerHillRecords
def_special sub_80B4808
def_special sub_813B9A0
def_special sub_81B9918
def_special sub_80722E0
def_special sub_80B45D0
def_special sub_813C5A0
def_special RemoveRecordsWindow
def_special sub_8139C10
def_special sub_80B3BC4

12
include/battle_records.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef GUARD_BATTLE_RECORDS_H
#define GUARD_BATTLE_RECORDS_H
extern u8 gRecordsWindowId;
void ClearPlayerLinkBattleRecords(void);
void UpdatePlayerLinkBattleRecords(s32 battlerId);
void ShowLinkBattleRecords(void);
void RemoveRecordsWindow(void);
void ShowTrainerHillRecords(void);
#endif // GUARD_BATTLE_RECORDS_H

View File

@ -68,7 +68,7 @@ void UnsetBgTilemapBuffer(u8 bg);
void* GetBgTilemapBuffer(u8 bg);
void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset);
void CopyBgTilemapBufferToVram(u8 bg);
void CopyToBgTilemapBufferRect(u8 bg, void* src, u8 destX, u8 destY, u8 width, u8 height);
void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height);
void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, void *src, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette);
void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2);
void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height);

View File

@ -489,6 +489,8 @@ struct RecordMixing_UnknownStruct
u16 unk74[0x2];
};
#define LINK_B_RECORDS_COUNT 5
struct LinkBattleRecord
{
u8 name[8];
@ -498,6 +500,12 @@ struct LinkBattleRecord
u16 draws;
};
struct LinkBattleRecords
{
struct LinkBattleRecord entries[LINK_B_RECORDS_COUNT];
u8 languages[LINK_B_RECORDS_COUNT];
};
struct RecordMixingGiftData
{
u8 unk0;
@ -703,9 +711,7 @@ struct SaveBlock1
/*0x2e64*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff
/*0x2e90*/ struct ContestWinner contestWinners[13]; // 0 - 5 used in contest hall, 6 - 7 unused?, 8 - 12 museum
/*0x3030*/ struct DayCare daycare;
/*0x3150*/ struct LinkBattleRecord linkBattleRecords[5];
/*0x31A0*/ u8 unk_31A0;
/*0x31A1*/ u8 filler_31A1[7];
/*0x3150*/ struct LinkBattleRecords linkBattleRecords;
/*0x31A8*/ u8 giftRibbons[52];
/*0x31DC*/ struct Roamer roamer;
/*0x31F8*/ struct EnigmaBerry enigmaBerry;

View File

@ -1,8 +1,6 @@
#ifndef GUARD_PALETTE_H
#define GUARD_PALETTE_H
#include "global.h"
#define gPaletteFade_selectedPalettes (gPaletteFade.multipurpose1) // normal and fast fade
#define gPaletteFade_blendCnt (gPaletteFade.multipurpose1) // hardware fade
#define gPaletteFade_delay (gPaletteFade.multipurpose2) // normal and hardware fade

View File

@ -433,5 +433,8 @@ extern const u8 gText_TooImportantToToss[];
extern const u8 gText_ConfirmTossItems[];
extern const u8 gText_MoveVar1Where[];
extern const u8 gText_TotalRecordWLD[];
extern const u8 gText_PlayersBattleResults[];
extern const u8 gText_WinLoseDraw[];
#endif //GUARD_STRINGS_H

35
include/trainer_card.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef GUARD_TRAINER_CARD_H
#define GUARD_TRAINER_CARD_H
struct TrainerCard
{
/*0x00*/ u8 gender;
/*0x01*/ u8 stars;
/*0x02*/ bool8 hasPokedex;
/*0x03*/ bool8 var_3;
/*0x04*/ bool8 var_4;
/*0x05*/ u8 var_5;
/*0x06*/ u16 firstHallOfFameA;
/*0x08*/ u16 firstHallOfFameB;
/*0x0A*/ u16 firstHallOfFameC;
/*0x0C*/ u16 pokedexSeen;
/*0x0E*/ u16 trainerId;
/*0x10*/ u16 playTimeHours;
/*0x12*/ u16 playTimeMinutes;
/*0x14*/ u16 linkBattleWins;
/*0x16*/ u16 linkBattleLosses;
/*0x18*/ u16 battleTowerWins;
/*0x1A*/ u16 battleTowerLosses;
/*0x1C*/ u16 contestsWithFriends;
/*0x1E*/ u16 pokeblocksWithFriends;
/*0x20*/ u16 pokemonTrades;
/*0x22*/ u16 var_22;
/*0x24*/ u32 money;
/*0x28*/ u16 var_28[4];
/*0x30*/ u8 playerName[8];
/*0x38*/ u8 emeraldAddedUnknownFields[0x64-0x38];
};
extern struct TrainerCard gTrainerCards[4];
#endif // GUARD_TRAINER_CARD_H

View File

@ -183,7 +183,7 @@ SECTIONS {
src/birch_pc.o(.text);
src/hof_pc.o(.text);
asm/field_specials.o(.text);
asm/battle_records.o(.text);
src/battle_records.o(.text);
asm/pokedex_area_screen.o(.text);
src/evolution_scene.o(.text);
asm/roulette.o(.text);
@ -472,7 +472,7 @@ SECTIONS {
src/fldeff_flash.o(.rodata);
src/time_events.o(.rodata);
data/field_specials.o(.rodata);
data/battle_records.o(.rodata);
src/battle_records.o(.rodata);
data/pokedex_area_screen.o(.rodata);
src/evolution_scene.o(.rodata);
data/roulette.o(.rodata);

510
src/battle_records.c Normal file
View File

@ -0,0 +1,510 @@
#include "global.h"
#include "battle_records.h"
#include "bg.h"
#include "window.h"
#include "link.h"
#include "battle.h"
#include "overworld.h"
#include "text.h"
#include "text_window.h"
#include "strings.h"
#include "string_util.h"
#include "trainer_card.h"
#include "menu.h"
#include "menu_helpers.h"
#include "palette.h"
#include "main.h"
#include "scanline_effect.h"
#include "international_string_util.h"
#include "sound.h"
#include "constants/songs.h"
#include "malloc.h"
#include "gpu_regs.h"
#include "constants/game_stat.h"
extern void PrintOnTrainerHillRecordsWindow(void); // pokenav.s
// this file's functions
static void Task_CloseTrainerHillRecordsOnButton(u8 taskId);
static void Task_BeginPaletteFade(u8 taskId);
static void Task_ExitTrainerHillRecords(u8 taskId);
static void RemoveTrainerHillRecordsWindow(u8 windowId);
static void CB2_ShowTrainerHillRecords(void);
// EWRAM variables
EWRAM_DATA u8 gRecordsWindowId = 0;
EWRAM_DATA static u8 *sTilemapBuffer = NULL;
// const rom data
static const u32 sTrainerHillWindowTileset[] = INCBIN_U32("graphics/unknown/unknown_5B3484.4bpp");
static const u16 sTrainerHillWindowPalette[] = INCBIN_U16("graphics/unknown/unknown_5B3484.gbapal");
static const u32 sTrainerHillWindowTilemap[] = INCBIN_U32("graphics/unknown/unknown_5B3564.bin");
static const struct BgTemplate sTrainerHillRecordsBgTemplates[] =
{
{
.bg = 0,
.charBaseIndex = 0,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0
},
{
.bg = 3,
.charBaseIndex = 1,
.mapBaseIndex = 30,
.screenSize = 0,
.paletteMode = 0,
.priority = 3,
.baseTile = 0
}
};
static const struct WindowTemplate sTrainerHillRecordsWindowTemplates[] =
{
{0x0, 0x2, 0x1, 0x1A, 0x12, 0xF, 0x14},
DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate sLinkBattleRecordsWindow = {0x0, 0x2, 0x1, 0x1A, 0x11, 0xF, 0x1};
static const u8 sText_DashesNoPlayer[] = _("-------");
static const u8 sText_DashesNoScore[] = _("----");
// code
static void ClearLinkBattleRecord(struct LinkBattleRecord *record)
{
CpuFill16(0, record, sizeof(struct LinkBattleRecord));
record->name[0] = EOS;
record->trainerId = 0;
record->wins = 0;
record->losses = 0;
record->draws = 0;
}
static void ClearLinkBattleRecords(struct LinkBattleRecord *records)
{
s32 i;
for (i = 0; i < LINK_B_RECORDS_COUNT; i++)
{
ClearLinkBattleRecord(records + i);
}
SetGameStat(GAME_STAT_LINK_BATTLE_WINS, 0);
SetGameStat(GAME_STAT_LINK_BATTLE_LOSSES, 0);
SetGameStat(GAME_STAT_LINK_BATTLE_DRAWS, 0);
}
static s32 GetLinkBattleRecordTotalBattles(struct LinkBattleRecord *record)
{
return record->wins + record->losses + record->draws;
}
static s32 FindLinkBattleRecord(struct LinkBattleRecord *records, const u8 *name, u16 trainerId)
{
s32 i;
for (i = 0; i < LINK_B_RECORDS_COUNT; i++)
{
if (!StringCompareN(records[i].name, name, OT_NAME_LENGTH) && records[i].trainerId == trainerId)
return i;
}
return LINK_B_RECORDS_COUNT;
}
static void SortLinkBattleRecords(struct LinkBattleRecords *records)
{
s32 i, j;
for (i = LINK_B_RECORDS_COUNT - 1; i > 0; i--)
{
for (j = i - 1; j >= 0; j--)
{
s32 totalBattlesI = GetLinkBattleRecordTotalBattles(&records->entries[i]);
s32 totalBattlesJ = GetLinkBattleRecordTotalBattles(&records->entries[j]);
if (totalBattlesI > totalBattlesJ)
{
struct LinkBattleRecord temp1;
u8 temp2;
temp1 = records->entries[i];
records->entries[i] = records->entries[j];
records->entries[j] = temp1;
temp2 = records->languages[i];
records->languages[i] = records->languages[j];
records->languages[j] = temp2;
}
}
}
}
static void UpdateLinkBattleRecord(struct LinkBattleRecord *record, s32 battleOutcome)
{
switch (battleOutcome)
{
case B_OUTCOME_WON:
record->wins++;
if (record->wins > 9999)
record->wins = 9999;
break;
case B_OUTCOME_LOST:
record->losses++;
if (record->losses > 9999)
record->losses = 9999;
break;
case B_OUTCOME_DREW:
record->draws++;
if (record->draws > 9999)
record->draws = 9999;
break;
}
}
static void UpdateLinkBattleGameStats(s32 battleOutcome)
{
u8 stat;
switch (battleOutcome)
{
case B_OUTCOME_WON:
stat = GAME_STAT_LINK_BATTLE_WINS;
break;
case B_OUTCOME_LOST:
stat = GAME_STAT_LINK_BATTLE_LOSSES;
break;
case B_OUTCOME_DREW:
stat = GAME_STAT_LINK_BATTLE_DRAWS;
break;
default:
return;
}
if (GetGameStat(stat) < 9999)
IncrementGameStat(stat);
}
static void UpdateLinkBattleRecords(struct LinkBattleRecords *records, const u8 *name, u16 trainerId, s32 battleOutcome, u8 battlerId)
{
s32 index;
UpdateLinkBattleGameStats(battleOutcome);
SortLinkBattleRecords(records);
index = FindLinkBattleRecord(records->entries, name, trainerId);
if (index == LINK_B_RECORDS_COUNT)
{
index = LINK_B_RECORDS_COUNT - 1;
ClearLinkBattleRecord(&records->entries[index]);
StringCopyN(records->entries[index].name, name, OT_NAME_LENGTH);
records->entries[index].trainerId = trainerId;
records->languages[index] = gLinkPlayers[battlerId].language;
}
UpdateLinkBattleRecord(&records->entries[index], battleOutcome);
SortLinkBattleRecords(records);
}
void ClearPlayerLinkBattleRecords(void)
{
ClearLinkBattleRecords(gSaveBlock1Ptr->linkBattleRecords.entries);
}
static void IncTrainerCardWins(s32 battlerId)
{
u16 *wins = &gTrainerCards[battlerId].linkBattleWins;
(*wins)++;
if (*wins > 9999)
*wins = 9999;
}
static void IncTrainerCardLosses(s32 battlerId)
{
u16 *losses = &gTrainerCards[battlerId].linkBattleLosses;
(*losses)++;
if (*losses > 9999)
*losses = 9999;
}
static void UpdateTrainerCardWinsLosses(s32 battlerId)
{
switch (gBattleOutcome)
{
case B_OUTCOME_WON:
IncTrainerCardWins(BATTLE_OPPOSITE(battlerId));
IncTrainerCardLosses(battlerId);
break;
case B_OUTCOME_LOST:
IncTrainerCardLosses(BATTLE_OPPOSITE(battlerId));
IncTrainerCardWins(battlerId);
break;
}
}
void UpdatePlayerLinkBattleRecords(s32 battlerId)
{
if (InUnionRoom() != TRUE)
{
UpdateTrainerCardWinsLosses(battlerId);
UpdateLinkBattleRecords(
&gSaveBlock1Ptr->linkBattleRecords,
gTrainerCards[battlerId].playerName,
gTrainerCards[battlerId].trainerId,
gBattleOutcome,
battlerId);
}
}
static void PrintLinkBattleWinsLossesDraws(struct LinkBattleRecord *records)
{
s32 x;
ConvertIntToDecimalStringN(gStringVar1, GetGameStat(GAME_STAT_LINK_BATTLE_WINS), STR_CONV_MODE_LEFT_ALIGN, 4);
ConvertIntToDecimalStringN(gStringVar2, GetGameStat(GAME_STAT_LINK_BATTLE_LOSSES), STR_CONV_MODE_LEFT_ALIGN, 4);
ConvertIntToDecimalStringN(gStringVar3, GetGameStat(GAME_STAT_LINK_BATTLE_DRAWS), STR_CONV_MODE_LEFT_ALIGN, 4);
StringExpandPlaceholders(gStringVar4, gText_TotalRecordWLD);
x = GetStringCenterAlignXOffset(1, gStringVar4, 0xD0);
PrintTextOnWindow(gRecordsWindowId, 1, gStringVar4, x, 0x11, 0, NULL);
}
static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 language)
{
if (record->wins == 0 && record->losses == 0 && record->draws == 0)
{
// empty slot
PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoPlayer, 8, (y * 8) + 1, 0, NULL);
PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoScore, 80, (y * 8) + 1, 0, NULL);
PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoScore, 128, (y * 8) + 1, 0, NULL);
PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoScore, 176, (y * 8) + 1, 0, NULL);
}
else
{
StringFillWithTerminator(gStringVar1, 8);
StringCopyN(gStringVar1, record->name, 7);
ConvertInternationalString(gStringVar1, language);
PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 8, (y * 8) + 1, 0, NULL);
ConvertIntToDecimalStringN(gStringVar1, record->wins, STR_CONV_MODE_RIGHT_ALIGN, 4);
PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 80, (y * 8) + 1, 0, NULL);
ConvertIntToDecimalStringN(gStringVar1, record->losses, STR_CONV_MODE_RIGHT_ALIGN, 4);
PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 128, (y * 8) + 1, 0, NULL);
ConvertIntToDecimalStringN(gStringVar1, record->draws, STR_CONV_MODE_RIGHT_ALIGN, 4);
PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 176, (y * 8) + 1, 0, NULL);
}
}
void ShowLinkBattleRecords(void)
{
s32 i, x;
gRecordsWindowId = AddWindow(&sLinkBattleRecordsWindow);
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
FillWindowPixelBuffer(gRecordsWindowId, 0x11);
StringExpandPlaceholders(gStringVar4, gText_PlayersBattleResults);
x = GetStringCenterAlignXOffset(1, gStringVar4, 208);
PrintTextOnWindow(gRecordsWindowId, 1, gStringVar4, x, 1, 0, NULL);
PrintLinkBattleWinsLossesDraws(gSaveBlock1Ptr->linkBattleRecords.entries);
StringExpandPlaceholders(gStringVar4, gText_WinLoseDraw);
PrintTextOnWindow(gRecordsWindowId, 1, gStringVar4, 0, 41, 0, NULL);
for (i = 0; i < LINK_B_RECORDS_COUNT; i++)
{
PrintLinkBattleRecord(&gSaveBlock1Ptr->linkBattleRecords.entries[i], 7 + (i * 2), gSaveBlock1Ptr->linkBattleRecords.languages[i]);
}
PutWindowTilemap(gRecordsWindowId);
CopyWindowToVram(gRecordsWindowId, 3);
}
void RemoveRecordsWindow(void)
{
sub_819746C(gRecordsWindowId, FALSE);
RemoveWindow(gRecordsWindowId);
}
static void Task_TrainerHillWaitForPaletteFade(u8 taskId)
{
if (!gPaletteFade.active)
gTasks[taskId].func = Task_CloseTrainerHillRecordsOnButton;
}
static void Task_CloseTrainerHillRecordsOnButton(u8 taskId)
{
struct Task *task = &gTasks[taskId];
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
{
PlaySE(SE_SELECT);
task->func = Task_BeginPaletteFade;
}
}
static void Task_BeginPaletteFade(u8 taskId)
{
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
gTasks[taskId].func = Task_ExitTrainerHillRecords;
}
static void Task_ExitTrainerHillRecords(u8 taskId)
{
if (!gPaletteFade.active)
{
SetMainCallback2(CB2_ReturnToFieldContinueScript);
Free(sTilemapBuffer);
RemoveTrainerHillRecordsWindow(0);
FreeAllWindowBuffers();
DestroyTask(taskId);
}
}
static void RemoveTrainerHillRecordsWindow(u8 windowId)
{
FillWindowPixelBuffer(windowId, 0);
ClearWindowTilemap(windowId);
CopyWindowToVram(windowId, 2);
RemoveWindow(windowId);
}
static void ClearVramOamPlttRegs(void)
{
DmaClearLarge16(3, (void*)(VRAM), VRAM_SIZE, 0x1000);
DmaClear32(3, OAM, OAM_SIZE);
DmaClear16(3, PLTT, PLTT_SIZE);
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
SetGpuReg(REG_OFFSET_BG1CNT, 0);
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
SetGpuReg(REG_OFFSET_BG2CNT, 0);
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
SetGpuReg(REG_OFFSET_BG3CNT, 0);
SetGpuReg(REG_OFFSET_BG3HOFS, 0);
SetGpuReg(REG_OFFSET_BG3VOFS, 0);
SetGpuReg(REG_OFFSET_WIN0H, 0);
SetGpuReg(REG_OFFSET_WIN0V, 0);
SetGpuReg(REG_OFFSET_WININ, 0);
SetGpuReg(REG_OFFSET_WINOUT, 0);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
}
static void ClearTasksAndGraphicalStructs(void)
{
ScanlineEffect_Stop();
ResetTasks();
ResetSpriteData();
ResetPaletteFade();
FreeAllSpritePalettes();
}
static void ResetBgCoordinates(void)
{
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
}
static void SetDispcntReg(void)
{
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_1D_MAP);
}
static void LoadTrainerHillRecordsWindowGfx(u8 bgId)
{
LoadBgTiles(bgId, sTrainerHillWindowTileset, sizeof(sTrainerHillWindowTileset), 0);
CopyToBgTilemapBufferRect(bgId, sTrainerHillWindowTilemap, 0, 0, 0x20, 0x20);
LoadPalette(sTrainerHillWindowPalette, 0, 0x20);
}
static void VblankCB_TrainerHillRecords(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
static void MainCB2_TrainerHillRecords(void)
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
void ShowTrainerHillRecords(void)
{
SetVBlankCallback(NULL);
SetMainCallback2(CB2_ShowTrainerHillRecords);
}
static void CB2_ShowTrainerHillRecords(void)
{
switch (gMain.state)
{
case 0:
SetVBlankCallback(NULL);
ClearVramOamPlttRegs();
gMain.state++;
break;
case 1:
ClearTasksAndGraphicalStructs();
gMain.state++;
break;
case 2:
sTilemapBuffer = AllocZeroed(0x800);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sTrainerHillRecordsBgTemplates, ARRAY_COUNT(sTrainerHillRecordsBgTemplates));
SetBgTilemapBuffer(3, sTilemapBuffer);
ResetBgCoordinates();
gMain.state++;
break;
case 3:
LoadTrainerHillRecordsWindowGfx(3);
LoadPalette(stdpal_get(0), 0xF0, 0x20);
gMain.state++;
break;
case 4:
if (IsDma3ManagerBusyWithBgCopy() != TRUE)
{
ShowBg(0);
ShowBg(3);
CopyBgTilemapBufferToVram(3);
gMain.state++;
}
break;
case 5:
InitWindows(sTrainerHillRecordsWindowTemplates);
DeactivateAllTextPrinters();
gMain.state++;
break;
case 6:
BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
gMain.state++;
break;
case 7:
SetDispcntReg();
SetVBlankCallback(VblankCB_TrainerHillRecords);
PrintOnTrainerHillRecordsWindow();
CreateTask(Task_TrainerHillWaitForPaletteFade, 8);
SetMainCallback2(MainCB2_TrainerHillRecords);
gMain.state = 0;
break;
}
}

View File

@ -30,6 +30,7 @@
#include "trig.h"
#include "tv.h"
#include "item_menu.h"
#include "battle_records.h"
#define BLENDER_SCORE_BEST 0
#define BLENDER_SCORE_GOOD 1
@ -131,7 +132,6 @@ extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern u8 gInGameOpponentsNo;
extern u8 gUnknown_020322D5;
extern u8 gResultsWindowId;
// graphics
extern const u8 gBerryBlenderArrowTiles[];
@ -3485,13 +3485,13 @@ void ShowBerryBlenderRecordWindow(void)
u8 text[32];
winTemplate = sBlenderRecordWindowTemplate;
gResultsWindowId = AddWindow(&winTemplate);
NewMenuHelpers_DrawStdWindowFrame(gResultsWindowId, 0);
FillWindowPixelBuffer(gResultsWindowId, 0x11);
gRecordsWindowId = AddWindow(&winTemplate);
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, 0);
FillWindowPixelBuffer(gRecordsWindowId, 0x11);
xPos = GetStringCenterAlignXOffset(1, gText_BlenderMaxSpeedRecord, 0x90);
PrintTextOnWindow(gResultsWindowId, 1, gText_BlenderMaxSpeedRecord, xPos, 1, 0, NULL);
PrintTextOnWindow(gResultsWindowId, 1, gText_234Players, 4, 0x29, 0, NULL);
PrintTextOnWindow(gRecordsWindowId, 1, gText_BlenderMaxSpeedRecord, xPos, 1, 0, NULL);
PrintTextOnWindow(gRecordsWindowId, 1, gText_234Players, 4, 0x29, 0, NULL);
for (i = 0, yPos = 0x29; i < BLENDER_SCORES_NO; i++)
{
@ -3506,11 +3506,11 @@ void ShowBerryBlenderRecordWindow(void)
txtPtr = StringAppend(txtPtr, sText_RPM);
xPos = GetStringRightAlignXOffset(1, text, 0x8C);
PrintTextOnWindow(gResultsWindowId, 1, text, xPos, yPos + (i * 16), 0, NULL);
PrintTextOnWindow(gRecordsWindowId, 1, text, xPos, yPos + (i * 16), 0, NULL);
}
PutWindowTilemap(gResultsWindowId);
CopyWindowToVram(gResultsWindowId, 3);
PutWindowTilemap(gRecordsWindowId);
CopyWindowToVram(gRecordsWindowId, 3);
}
static void sub_8083F3C(u8 taskId)

View File

@ -965,9 +965,9 @@ void CopyBgTilemapBufferToVram(u8 bg)
}
}
void CopyToBgTilemapBufferRect(u8 bg, void* src, u8 destX, u8 destY, u8 width, u8 height)
void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height)
{
void* srcCopy;
const void* srcCopy;
u16 destX16;
u16 destY16;
u16 mode;

View File

@ -20,8 +20,10 @@
#include "tv.h"
#include "coins.h"
#include "text.h"
#include "overworld.h"
#include "mail.h"
#include "battle_records.h"
extern u8 gPlayerPartyCount;
extern u8 gDifferentSaveFile;
extern u16 gSaveFileStatus;
extern u8 gUnknown_030060B0;
@ -29,19 +31,15 @@ extern u8 gUnknown_030060B0;
// TODO: replace those declarations with file headers
extern u16 GetGeneratedTrainerIdLower(void);
extern void ClearContestWinnerPicsInContestHall(void);
extern void Overworld_SetWarpDestination(s8 mapBank, s8 mapNo, s8 warpNo, s8 xPos, s8 yPos);
extern void warp_in(void);
extern void sub_80BB358(void);
extern void ResetBagScrollPositions(void);
extern void ResetPokedex(void);
extern void sub_8084400(void);
extern void ClearMailData(void);
extern void ResetGabbyAndTy(void);
extern void ResetSecretBases(void);
extern void ResetLinkContestBoolean(void);
extern void ResetGameStats(void);
extern void sub_8052DA8(void);
extern void InitLinkBattleRecords(void);
extern void ResetPokemonStorageSystem(void);
extern void ClearBag(void);
extern void NewGameInitPCItems(void);
@ -58,7 +56,7 @@ extern void ResetContestLinkResults(void);
extern void ResetPokeJumpResults(void);
extern void SetBerryPowder(u32* powder, u32 newValue);
extern u8 EventScript_2715DE[];
extern const u8 EventScript_2715DE[];
void WriteUnalignedWord(u32 var, u8 *dataPtr)
{
@ -178,7 +176,7 @@ void NewGameInitData(void)
ResetLinkContestBoolean();
ResetGameStats();
ClearAllContestWinnerPics();
InitLinkBattleRecords();
ClearPlayerLinkBattleRecords();
InitSeedotSizeRecord();
InitLotadSizeRecord();
gPlayerPartyCount = 0;

View File

@ -1380,13 +1380,13 @@ void PutFanClubSpecialOnTheAir(void)
StringCopy(show->fanClubSpecial.idolName, name);
tv_store_id_2x(show);
show->fanClubSpecial.language = gGameLanguage;
if (show->fanClubSpecial.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->unk_31A0 == LANGUAGE_JAPANESE)
if (show->fanClubSpecial.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->linkBattleRecords.languages[0] == LANGUAGE_JAPANESE)
{
show->fanClubSpecial.idolNameLanguage = LANGUAGE_JAPANESE;
}
else
{
show->fanClubSpecial.idolNameLanguage = gSaveBlock1Ptr->unk_31A0;
show->fanClubSpecial.idolNameLanguage = gSaveBlock1Ptr->linkBattleRecords.languages[0];
}
}
@ -2465,7 +2465,7 @@ bool8 sub_80EE7C0(void)
{
return TRUE;
}
if (gSaveBlock1Ptr->linkBattleRecords[0].name[0] == EOS)
if (gSaveBlock1Ptr->linkBattleRecords.entries[0].name[0] == EOS)
{
return TRUE;
}

View File

@ -318,7 +318,7 @@ gUnknown_02039B52: @ 2039B52
gUnknown_02039B54: @ 2039B54
.space 0x4
gUnknown_02039B58: @ 2039B58
gTrainerCards: @ 2039B58
.space 0x14
gUnknown_02039B6C: @ 2039B6C
@ -710,11 +710,7 @@ gUnknown_0203AB6F: @ 203AB6F
gUnknown_0203AB70: @ 203AB70
.space 0x4
gResultsWindowId: @ 203AB74
.space 0x4
gUnknown_0203AB78: @ 203AB78
.space 0x4
.include "src/battle_records.o"
gUnknown_0203AB7C: @ 203AB7C
.space 0x4