mirror of
https://github.com/pret/pokeheartgold.git
synced 2024-11-23 05:09:45 +00:00
documentation, 2
This commit is contained in:
parent
e6c4ce1960
commit
4bce7af2bd
@ -135,7 +135,7 @@
|
||||
.public sub_0203FC68
|
||||
.public sub_0203FC90
|
||||
.public LegendaryCinematic_LaunchApp
|
||||
.public sub_0203FD08
|
||||
.public LaunchApp_ViewFriendRecords
|
||||
.public Save_VarsFlags_Get
|
||||
.public Save_VarsFlags_CheckFlagInArray
|
||||
.public TaskManager_Call
|
||||
@ -352,9 +352,9 @@
|
||||
.public UnownReport_Init
|
||||
.public UnownReport_Main
|
||||
.public UnownReport_Exit
|
||||
.public ov121_021E5900
|
||||
.public ov121_021E590C
|
||||
.public ov121_021E59BC
|
||||
.public ViewFriendRecordsApp_Init
|
||||
.public ViewFriendRecordsApp_Main
|
||||
.public ViewFriendRecordsApp_Exit
|
||||
.public VoltorbFlip_Init
|
||||
.public VoltorbFlip_Exit
|
||||
.public VoltorbFlip_Main
|
||||
|
@ -163,7 +163,7 @@
|
||||
.public sub_0202E474
|
||||
.public sub_0202E530
|
||||
.public sub_0202E58C
|
||||
.public sub_0202E66C
|
||||
.public Save_GetPlayerRankingEntry
|
||||
.public sub_0202E97C
|
||||
.public sub_0203189C
|
||||
.public sub_02033250
|
||||
|
@ -8,7 +8,7 @@
|
||||
.public sub_0202C738
|
||||
.public Save_FriendGroup_Init
|
||||
.public sub_0202C78C
|
||||
.public sub_0202C7B4
|
||||
.public Save_FriendGroup_GetGroupId
|
||||
.public sub_0202C7C0
|
||||
.public sub_0202C7DC
|
||||
.public sub_0202C7E0
|
||||
|
@ -2134,10 +2134,10 @@
|
||||
.short \arg0
|
||||
.endm
|
||||
|
||||
.macro scrcmd_378 arg0, arg1
|
||||
.macro view_rankings scope, page, record
|
||||
.short 378
|
||||
.short \arg0
|
||||
.short \arg1
|
||||
.short \scope * 3 + \page
|
||||
.short \record
|
||||
.endm
|
||||
|
||||
.macro scrcmd_379 arg0
|
||||
|
@ -9476,10 +9476,10 @@ ov73_021EA2FC: ; 0x021EA2FC
|
||||
|
||||
thumb_func_start ov73_021EA31C
|
||||
ov73_021EA31C: ; 0x021EA31C
|
||||
ldr r3, _021EA320 ; =sub_0202E66C
|
||||
ldr r3, _021EA320 ; =Save_GetPlayerRankingEntry
|
||||
bx r3
|
||||
.balign 4, 0
|
||||
_021EA320: .word sub_0202E66C
|
||||
_021EA320: .word Save_GetPlayerRankingEntry
|
||||
thumb_func_end ov73_021EA31C
|
||||
|
||||
thumb_func_start ov73_021EA324
|
||||
|
@ -93,15 +93,15 @@ _0202C7A8:
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_0202C78C
|
||||
|
||||
thumb_func_start sub_0202C7B4
|
||||
sub_0202C7B4: ; 0x0202C7B4
|
||||
thumb_func_start Save_FriendGroup_GetGroupId
|
||||
Save_FriendGroup_GetGroupId: ; 0x0202C7B4
|
||||
mov r2, #0x2c
|
||||
mul r2, r1
|
||||
add r0, r0, r2
|
||||
ldr r0, [r0, #0x24]
|
||||
bx lr
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_0202C7B4
|
||||
thumb_func_end Save_FriendGroup_GetGroupId
|
||||
|
||||
thumb_func_start sub_0202C7C0
|
||||
sub_0202C7C0: ; 0x0202C7C0
|
||||
|
@ -232,9 +232,9 @@ scr_seq_T10R0101_007:
|
||||
touchscreen_menu_hide
|
||||
_02CD:
|
||||
menu_init 1, 1, 0, 1, VAR_SPECIAL_RESULT
|
||||
menu_item_add 8, 255, 0
|
||||
menu_item_add 9, 255, 1
|
||||
menu_item_add 10, 255, 2
|
||||
menu_item_add msg_0522_T10R0101_00008, 255, 0
|
||||
menu_item_add msg_0522_T10R0101_00009, 255, 1
|
||||
menu_item_add msg_0522_T10R0101_00010, 255, 2
|
||||
menu_exec
|
||||
switch VAR_SPECIAL_RESULT
|
||||
case 0, _0317
|
||||
@ -247,9 +247,9 @@ _0317:
|
||||
goto_if_eq _037A
|
||||
npc_msg msg_0522_T10R0101_00011
|
||||
menu_init 1, 1, 0, 1, VAR_SPECIAL_RESULT
|
||||
menu_item_add 12, 255, 0
|
||||
menu_item_add 13, 255, 1
|
||||
menu_item_add 14, 255, 2
|
||||
menu_item_add msg_0522_T10R0101_00012, 255, 0
|
||||
menu_item_add msg_0522_T10R0101_00013, 255, 1
|
||||
menu_item_add msg_0522_T10R0101_00014, 255, 2
|
||||
menu_exec
|
||||
switch VAR_SPECIAL_RESULT
|
||||
case 0, _037A
|
||||
@ -264,16 +264,16 @@ _0371:
|
||||
_037A:
|
||||
npc_msg msg_0522_T10R0101_00015
|
||||
menu_init 1, 1, 0, 1, VAR_SPECIAL_RESULT
|
||||
menu_item_add 16, 255, 0
|
||||
menu_item_add 17, 255, 1
|
||||
menu_item_add 18, 255, 2
|
||||
menu_item_add 19, 255, 3
|
||||
menu_item_add 26, 255, 4
|
||||
menu_item_add msg_0522_T10R0101_00016, 255, 0
|
||||
menu_item_add msg_0522_T10R0101_00017, 255, 1
|
||||
menu_item_add msg_0522_T10R0101_00018, 255, 2
|
||||
menu_item_add msg_0522_T10R0101_00019, 255, 3
|
||||
menu_item_add msg_0522_T10R0101_00026, 255, 4
|
||||
menu_exec
|
||||
compare VAR_SPECIAL_RESULT, 4
|
||||
goto_if_eq _03CF
|
||||
closemsg
|
||||
scrcmd_378 4, VAR_SPECIAL_RESULT
|
||||
view_rankings RANKINGS_SCOPE_GROUP, RANKINGS_PAGE_POKEMON, VAR_SPECIAL_RESULT
|
||||
npc_msg msg_0522_T10R0101_00007
|
||||
touchscreen_menu_hide
|
||||
goto _02CD
|
||||
@ -293,18 +293,18 @@ _03EB:
|
||||
_03F1:
|
||||
npc_msg msg_0522_T10R0101_00015
|
||||
menu_init 1, 1, 0, 1, VAR_SPECIAL_RESULT
|
||||
menu_item_add 20, 255, 0
|
||||
menu_item_add 21, 255, 1
|
||||
menu_item_add 22, 255, 2
|
||||
menu_item_add 23, 255, 3
|
||||
menu_item_add 24, 255, 4
|
||||
menu_item_add 25, 255, 5
|
||||
menu_item_add 26, 255, 6
|
||||
menu_item_add msg_0522_T10R0101_00020, 255, 0
|
||||
menu_item_add msg_0522_T10R0101_00021, 255, 1
|
||||
menu_item_add msg_0522_T10R0101_00022, 255, 2
|
||||
menu_item_add msg_0522_T10R0101_00023, 255, 3
|
||||
menu_item_add msg_0522_T10R0101_00024, 255, 4
|
||||
menu_item_add msg_0522_T10R0101_00025, 255, 5
|
||||
menu_item_add msg_0522_T10R0101_00026, 255, 6
|
||||
menu_exec
|
||||
compare VAR_SPECIAL_RESULT, 6
|
||||
goto_if_eq _03CF
|
||||
closemsg
|
||||
scrcmd_378 3, VAR_SPECIAL_RESULT
|
||||
view_rankings RANKINGS_SCOPE_GROUP, RANKINGS_PAGE_BATTLE_TOWER, VAR_SPECIAL_RESULT
|
||||
npc_msg msg_0522_T10R0101_00007
|
||||
touchscreen_menu_hide
|
||||
goto _02CD
|
||||
@ -314,9 +314,9 @@ _0456:
|
||||
goto_if_eq _04B0
|
||||
npc_msg msg_0522_T10R0101_00011
|
||||
menu_init 1, 1, 0, 1, VAR_SPECIAL_RESULT
|
||||
menu_item_add 12, 255, 0
|
||||
menu_item_add 13, 255, 1
|
||||
menu_item_add 14, 255, 2
|
||||
menu_item_add msg_0522_T10R0101_00012, 255, 0
|
||||
menu_item_add msg_0522_T10R0101_00013, 255, 1
|
||||
menu_item_add msg_0522_T10R0101_00014, 255, 2
|
||||
menu_exec
|
||||
switch VAR_SPECIAL_RESULT
|
||||
case 0, _04B0
|
||||
@ -327,16 +327,16 @@ _0456:
|
||||
_04B0:
|
||||
npc_msg msg_0522_T10R0101_00015
|
||||
menu_init 1, 1, 0, 1, VAR_SPECIAL_RESULT
|
||||
menu_item_add 16, 255, 0
|
||||
menu_item_add 17, 255, 1
|
||||
menu_item_add 18, 255, 2
|
||||
menu_item_add 19, 255, 3
|
||||
menu_item_add 26, 255, 4
|
||||
menu_item_add msg_0522_T10R0101_00016, 255, 0
|
||||
menu_item_add msg_0522_T10R0101_00017, 255, 1
|
||||
menu_item_add msg_0522_T10R0101_00018, 255, 2
|
||||
menu_item_add msg_0522_T10R0101_00019, 255, 3
|
||||
menu_item_add msg_0522_T10R0101_00026, 255, 4
|
||||
menu_exec
|
||||
compare VAR_SPECIAL_RESULT, 4
|
||||
goto_if_eq _0505
|
||||
closemsg
|
||||
scrcmd_378 1, VAR_SPECIAL_RESULT
|
||||
view_rankings RANKINGS_SCOPE_GLOBAL, RANKINGS_PAGE_POKEMON, VAR_SPECIAL_RESULT
|
||||
npc_msg msg_0522_T10R0101_00007
|
||||
touchscreen_menu_hide
|
||||
goto _02CD
|
||||
@ -356,18 +356,18 @@ _0521:
|
||||
_0527:
|
||||
npc_msg msg_0522_T10R0101_00015
|
||||
menu_init 1, 1, 0, 1, VAR_SPECIAL_RESULT
|
||||
menu_item_add 20, 255, 0
|
||||
menu_item_add 21, 255, 1
|
||||
menu_item_add 22, 255, 2
|
||||
menu_item_add 23, 255, 3
|
||||
menu_item_add 24, 255, 4
|
||||
menu_item_add 25, 255, 5
|
||||
menu_item_add 26, 255, 6
|
||||
menu_item_add msg_0522_T10R0101_00020, 255, 0
|
||||
menu_item_add msg_0522_T10R0101_00021, 255, 1
|
||||
menu_item_add msg_0522_T10R0101_00022, 255, 2
|
||||
menu_item_add msg_0522_T10R0101_00023, 255, 3
|
||||
menu_item_add msg_0522_T10R0101_00024, 255, 4
|
||||
menu_item_add msg_0522_T10R0101_00025, 255, 5
|
||||
menu_item_add msg_0522_T10R0101_00026, 255, 6
|
||||
menu_exec
|
||||
compare VAR_SPECIAL_RESULT, 6
|
||||
goto_if_eq _0505
|
||||
closemsg
|
||||
scrcmd_378 0, VAR_SPECIAL_RESULT
|
||||
view_rankings RANKINGS_SCOPE_GLOBAL, RANKINGS_PAGE_BATTLE_TOWER, VAR_SPECIAL_RESULT
|
||||
npc_msg msg_0522_T10R0101_00007
|
||||
touchscreen_menu_hide
|
||||
goto _02CD
|
||||
|
@ -8,9 +8,9 @@
|
||||
#define GAME_STAT_UNK6 6
|
||||
#define GAME_STAT_UNK8 8 //wild battles?
|
||||
#define GAME_STAT_UNK9 9 //trainer battles?
|
||||
#define GAME_STAT_UNK10 10
|
||||
#define GAME_STAT_UNK11 11
|
||||
#define GAME_STAT_UNK12 12
|
||||
#define GAME_STAT_CAUGHT_MON 10
|
||||
#define GAME_STAT_FISHING_LANDED_MON 11
|
||||
#define GAME_STAT_HATCHED_EGG 12
|
||||
#define GAME_STAT_UNK14 14
|
||||
#define GAME_STAT_UNK16 16
|
||||
#define GAME_STAT_UNK17 17
|
||||
@ -23,14 +23,15 @@
|
||||
#define GAME_STAT_UNK46 46
|
||||
#define GAME_STAT_BATTLE_POINTS 69
|
||||
#define GAME_STAT_UNK70 70
|
||||
#define GAME_STAT_UNK74 74
|
||||
#define GAME_STAT_UNK77 77
|
||||
#define GAME_STAT_UNK79 79
|
||||
#define GAME_STAT_UNK80 80
|
||||
#define GAME_STAT_UNK91 91
|
||||
#define GAME_STAT_UNK92 92
|
||||
#define GAME_STAT_UNK93 93
|
||||
#define GAME_STAT_UNK94 94
|
||||
#define GAME_STAT_UNK95 95
|
||||
#define GAME_STAT_LOCAL_CONTEST_ENTRIES 91
|
||||
#define GAME_STAT_COMM_CONTEST_ENTRIES 92
|
||||
#define GAME_STAT_LOCAL_CONTEST_WINS 93
|
||||
#define GAME_STAT_COMM_CONTEST_WINS 94
|
||||
#define GAME_STAT_RIBBONS_EARNED 95
|
||||
#define GAME_STAT_UNK96 96
|
||||
#define GAME_STAT_PLAYER_MON_FAINTED 97
|
||||
#define GAME_STAT_UNK98 98
|
||||
|
35
include/constants/ranking.h
Normal file
35
include/constants/ranking.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef POKEHEARTGOLD_CONSTANTS_RANKING_H
|
||||
#define POKEHEARTGOLD_CONSTANTS_RANKING_H
|
||||
|
||||
#define RANKINGS_SCOPE_GLOBAL 0
|
||||
#define RANKINGS_SCOPE_GROUP 1
|
||||
|
||||
#define RANKINGS_PAGE_BATTLE_TOWER 0
|
||||
#define RANKINGS_PAGE_POKEMON 1
|
||||
#define RANKINGS_PAGE_CONTEST 2
|
||||
|
||||
#define RANKINGS_RECORD_BATTLE_TOWER_BEGIN 0
|
||||
#define RANKINGS_RECORD_BATTLE_TOWER_SINGLE_WINS 0
|
||||
#define RANKINGS_RECORD_BATTLE_TOWER_DOUBLE_WINS 1
|
||||
#define RANKINGS_RECORD_BATTLE_TOWER_MULTI_NPC_WINS 2
|
||||
#define RANKINGS_RECORD_BATTLE_TOWER_MULTI_COMM_WINS 3
|
||||
#define RANKINGS_RECORD_BATTLE_TOWER_WIFI_WINS 4
|
||||
#define RANKINGS_RECORD_BATTLE_TOWER_AVG_WIN_STREAK 5
|
||||
#define RANKINGS_RECORD_BATTLE_TOWER_COUNT 6
|
||||
|
||||
#define RANKINGS_RECORD_POKEMON_BEGIN 6
|
||||
#define RANKINGS_RECORD_POKEMON_MONS_DEFEATED 6
|
||||
#define RANKINGS_RECORD_POKEMON_MONS_CAUGHT 7
|
||||
#define RANKINGS_RECORD_POKEMON_MONS_HATCHED 8
|
||||
#define RANKINGS_RECORD_POKEMON_MONS_FISHED 9
|
||||
#define RANKINGS_RECORD_POKEMON_COUNT 4
|
||||
|
||||
#define RANKINGS_RECORD_CONTEST_BEGIN 10
|
||||
#define RANKINGS_RECORD_CONTEST_WIN 10
|
||||
#define RANKINGS_RECORD_CONTEST_ENTRY 11
|
||||
#define RANKINGS_RECORD_CONTEST_RIBBONS 12
|
||||
#define RANKINGS_RECORD_CONTEST_COUNT 3
|
||||
|
||||
#define RANKINGS_COUNT 13
|
||||
|
||||
#endif //POKEHEARTGOLD_CONSTANTS_RANKING_H
|
@ -27,7 +27,7 @@
|
||||
#define SAVE_ROAMER 21
|
||||
#define SAVE_UNK_22 22
|
||||
#define SAVE_UNK_23 23
|
||||
#define SAVE_UNK_24 24
|
||||
#define SAVE_RANKINGS 24
|
||||
#define SAVE_UNK_25 25
|
||||
#define SAVE_UNK_26 26
|
||||
#define SAVE_MYSTERY_GIFT 27
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "constants/badge.h"
|
||||
#include "constants/global.fieldmap.h"
|
||||
#include "constants/game_stats.h"
|
||||
#include "constants/ranking.h"
|
||||
|
||||
#define lt 0
|
||||
#define eq 1
|
||||
|
@ -146,7 +146,7 @@ void PokeathlonCourse_LaunchApp(FieldSystem *fieldSystem, PokeathlonCourseArgs *
|
||||
void sub_0203FC68(FieldSystem *fieldSystem, void *args);
|
||||
void sub_0203FC90(FieldSystem *fieldSystem, void *args);
|
||||
LegendaryCinematicArgs *LegendaryCinematic_LaunchApp(FieldSystem *fieldSystem, UnkStruct_0203FCC4 *a1, u16 a2, u16 a3, HeapID heapId);
|
||||
void sub_0203FD08(FieldSystem *fieldSystem, UnkStruct_02097D56 *args);
|
||||
void LaunchApp_ViewFriendRecords(FieldSystem *fieldSystem, ViewFriendRecordsArgs *args);
|
||||
PartyMenuArgs *PartyMenu_LaunchApp_Unk1(FieldSystem *fieldSystem, FieldMoveCheckData *fieldMoveCheckData, u8 partySlot);
|
||||
void CallTask_NamingScreen(TaskManager *taskManager, NameScreenType type, int species, int maxLen, int initPos, const u16 *defaultStr, u16 *retVar);
|
||||
void sub_0203E960(TaskManager *a0, int a1, UnkStruct_0203E8C8 *a2, u16 *a3, u16 *a4);
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#include "overlay_manager.h"
|
||||
|
||||
BOOL ov121_021E5900(OVY_MANAGER *man, int *state);
|
||||
BOOL ov121_021E590C(OVY_MANAGER *man, int *state);
|
||||
BOOL ov121_021E59BC(OVY_MANAGER *man, int *state);
|
||||
BOOL ViewFriendRecordsApp_Init(OVY_MANAGER *man, int *state);
|
||||
BOOL ViewFriendRecordsApp_Main(OVY_MANAGER *man, int *state);
|
||||
BOOL ViewFriendRecordsApp_Exit(OVY_MANAGER *man, int *state);
|
||||
|
||||
#endif //POKEHEARTGOLD_OVY_121_H
|
||||
|
@ -412,7 +412,7 @@ BOOL ScrCmd_374(ScriptContext* ctx);
|
||||
BOOL ScrCmd_MakeObjectVisible(ScriptContext* ctx);
|
||||
BOOL ScrCmd_376(ScriptContext* ctx);
|
||||
BOOL ScrCmd_377(ScriptContext* ctx);
|
||||
BOOL ScrCmd_378(ScriptContext* ctx);
|
||||
BOOL ScrCmd_ViewFriendRecords(ScriptContext* ctx);
|
||||
BOOL ScrCmd_379(ScriptContext* ctx);
|
||||
BOOL ScrCmd_Random(ScriptContext* ctx);
|
||||
BOOL ScrCmd_381(ScriptContext* ctx);
|
||||
|
@ -10,7 +10,7 @@ BOOL sub_0202C878(SAV_FRIEND_GRP *group, u16 a1);
|
||||
void sub_0202C738(SAV_FRIEND_GRP *group, u16 a1, int a2);
|
||||
|
||||
// return group->groups[a1].unk_24;
|
||||
u8 sub_0202C7B4(SAV_FRIEND_GRP *group, int a1);
|
||||
u8 Save_FriendGroup_GetGroupId(SAV_FRIEND_GRP *group, int a1);
|
||||
void sub_0202C7F8(SAV_FRIEND_GRP *group, int a1, int a2, String *str);
|
||||
void sub_0202C824(SAV_FRIEND_GRP *group, int a1, u32 gender);
|
||||
void sub_0202C848(SAV_FRIEND_GRP *group, int a1, int a2);
|
||||
|
@ -4,12 +4,12 @@
|
||||
#include "pm_string.h"
|
||||
#include "save.h"
|
||||
|
||||
typedef struct UnkStruct_0202E4B0_sub UnkStruct_0202E4B0_sub;
|
||||
typedef struct UnkStruct_0202E4B0 UnkStruct_0202E4B0;
|
||||
typedef struct SaveRankingsEntry SaveRankingsEntry;
|
||||
typedef struct SaveRankings SaveRankings;
|
||||
|
||||
typedef struct UnkStruct_0202E9FC_sub {
|
||||
int unk_0;
|
||||
u32 unk_4;
|
||||
int groupId;
|
||||
u32 stat;
|
||||
String *playerName;
|
||||
} UnkStruct_0202E9FC_sub;
|
||||
|
||||
@ -18,17 +18,17 @@ typedef struct UnkStruct_0202E9FC {
|
||||
UnkStruct_0202E9FC_sub unk_04[6];
|
||||
} UnkStruct_0202E9FC;
|
||||
|
||||
u8 sub_0202E4B0(int a0);
|
||||
u8 sub_0202E4BC(int a0);
|
||||
u32 sub_0202E4F4(void); // ???_sizeof
|
||||
void sub_0202E4FC(UnkStruct_0202E4B0 *a0); // ???_Init
|
||||
UnkStruct_0202E4B0 *sub_0202E530(SaveData *saveData); // ???_Get
|
||||
void sub_0202E544(UnkStruct_0202E4B0 *a0, int a1, u8 a2);
|
||||
u8 RankingsViewSys_GetNumRecordsPerPage(int a0);
|
||||
u8 RankingsViewSys_GetFirstRecordIndexOnPage(int a0);
|
||||
u32 Save_Rankings_sizeof(void); // ???_sizeof
|
||||
void Save_Rankings_Init(SaveRankings *a0); // ???_Init
|
||||
SaveRankings *sub_0202E530(SaveData *saveData); // ???_Get
|
||||
void sub_0202E544(SaveRankings *a0, int a1, u8 a2);
|
||||
u32 sub_0202E58C(void);
|
||||
UnkStruct_0202E4B0_sub *sub_0202E66C(SaveData *saveData, HeapID heapId);
|
||||
void sub_0202E97C(SaveData *saveData, u8 a1, u8 a2, UnkStruct_0202E4B0_sub **a3, HeapID heapId);
|
||||
SaveRankingsEntry *Save_GetPlayerRankingEntry(SaveData *saveData, HeapID heapId);
|
||||
void sub_0202E97C(SaveData *saveData, u8 a1, u8 a2, SaveRankingsEntry **a3, HeapID heapId);
|
||||
UnkStruct_0202E9FC *sub_0202E9FC(SaveData *saveData, int a1, HeapID heapId);
|
||||
UnkStruct_0202E9FC *sub_0202EA80(UnkStruct_0202E4B0 *a0, int a1, HeapID heapId);
|
||||
UnkStruct_0202E9FC *sub_0202EA80(SaveRankings *a0, int a1, HeapID heapId);
|
||||
void sub_0202EAFC(UnkStruct_0202E9FC *a0);
|
||||
|
||||
#endif //GUARD_POKEHEARTGOLD_UNK_0202E4B0_H
|
||||
|
@ -4,17 +4,18 @@
|
||||
#include "field_types_def.h"
|
||||
#include "save.h"
|
||||
|
||||
typedef struct UnkStruct_02097D56 {
|
||||
u16 unk_0;
|
||||
u16 unk_2;
|
||||
typedef struct ViewFriendRecordsArgs {
|
||||
u16 page_scroll;
|
||||
u16 cursorPos;
|
||||
SaveData *saveData;
|
||||
} UnkStruct_02097D56;
|
||||
} ViewFriendRecordsArgs;
|
||||
|
||||
typedef struct UnkStruct_02097D48 {
|
||||
u32 state;
|
||||
UnkStruct_02097D56 *args;
|
||||
ViewFriendRecordsArgs *args;
|
||||
} UnkStruct_02097D48;
|
||||
|
||||
void sub_02097D3C(FieldSystem *fieldSystem, u8 a1, u8 a2);
|
||||
// pageScrollParam = 3 * scroll + page
|
||||
void FieldSystem_LaunchTask_ViewFriendRecordsApp(FieldSystem *fieldSystem, u8 pageScrollParam, u8 cursorPos);
|
||||
|
||||
#endif //POKEHEARTGOLD_UNK_02097D3C_H
|
||||
|
@ -377,7 +377,7 @@ BOOL ScrCmd_374(ScriptContext *ctx);
|
||||
BOOL ScrCmd_MakeObjectVisible(ScriptContext *ctx);
|
||||
BOOL ScrCmd_376(ScriptContext *ctx);
|
||||
BOOL ScrCmd_377(ScriptContext *ctx);
|
||||
BOOL ScrCmd_378(ScriptContext *ctx);
|
||||
BOOL ScrCmd_ViewFriendRecords(ScriptContext *ctx);
|
||||
BOOL ScrCmd_379(ScriptContext *ctx);
|
||||
BOOL ScrCmd_Random(ScriptContext *ctx);
|
||||
BOOL ScrCmd_381(ScriptContext *ctx);
|
||||
@ -1232,7 +1232,7 @@ const ScrCmdFunc gScriptCmdTable[] = {
|
||||
ScrCmd_MakeObjectVisible,
|
||||
ScrCmd_376,
|
||||
ScrCmd_377,
|
||||
ScrCmd_378,
|
||||
ScrCmd_ViewFriendRecords,
|
||||
ScrCmd_379,
|
||||
ScrCmd_Random,
|
||||
ScrCmd_381,
|
||||
|
@ -290,7 +290,7 @@ void CallTask_GameClear(TaskManager *taskman, u16 vsTrainerRed) {
|
||||
PlayerProfile_SetGameClearFlag(profile);
|
||||
|
||||
if (!env->vsTrainerRed) {
|
||||
GameStats_Inc(Save_GameStats_Get(fieldSystem->saveData), 74);
|
||||
GameStats_Inc(Save_GameStats_Get(fieldSystem->saveData), GAME_STAT_UNK74);
|
||||
}
|
||||
TaskManager_Call(taskman, Task_GameClear, env);
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ u32 GameStats_sizeof(void) {
|
||||
void GameStats_Init(GAME_STATS *gameStats) {
|
||||
MI_CpuClear32(gameStats, sizeof(GAME_STATS));
|
||||
gameStats->unk_1BE = OS_GetVBlankCount() | (OS_GetVBlankCount() << 8);
|
||||
GameStats_Release(gameStats, 2);
|
||||
GameStats_Release(gameStats, GAME_STAT_SCORE);
|
||||
}
|
||||
|
||||
GAME_STATS *Save_GameStats_Get(SaveData *saveData) {
|
||||
|
@ -1397,7 +1397,7 @@ LegendaryCinematicArgs *LegendaryCinematic_LaunchApp(FieldSystem *fieldSystem, U
|
||||
return args;
|
||||
}
|
||||
|
||||
void sub_0203FD08(FieldSystem *fieldSystem, UnkStruct_02097D56 *args) {
|
||||
static const OVY_MGR_TEMPLATE _020FA494 = { ov121_021E5900, ov121_021E590C, ov121_021E59BC, FS_OVERLAY_ID(OVY_121) };
|
||||
FieldSystem_LaunchApplication(fieldSystem, &_020FA494, args);
|
||||
void LaunchApp_ViewFriendRecords(FieldSystem *fieldSystem, ViewFriendRecordsArgs *args) {
|
||||
static const OVY_MGR_TEMPLATE sViewFriendRecordsAppTemplate = { ViewFriendRecordsApp_Init, ViewFriendRecordsApp_Main, ViewFriendRecordsApp_Exit, FS_OVERLAY_ID(OVY_121) };
|
||||
FieldSystem_LaunchApplication(fieldSystem, &sViewFriendRecordsAppTemplate, args);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -169,10 +169,10 @@ const struct SaveChunkHeader gSaveChunkHeaders[] = {
|
||||
(SAVESIZEFN)sub_0202E41C,
|
||||
(SAVEINITFN)sub_0202E424
|
||||
}, {
|
||||
SAVE_UNK_24,
|
||||
SAVE_RANKINGS,
|
||||
0,
|
||||
(SAVESIZEFN)sub_0202E4F4,
|
||||
(SAVEINITFN)sub_0202E4FC
|
||||
(SAVESIZEFN)Save_Rankings_sizeof,
|
||||
(SAVEINITFN)Save_Rankings_Init
|
||||
}, {
|
||||
SAVE_UNK_25,
|
||||
0,
|
||||
|
@ -3239,10 +3239,10 @@ BOOL ScrCmd_377(ScriptContext *ctx) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_378(ScriptContext *ctx) {
|
||||
u16 r4 = ScriptGetVar(ctx);
|
||||
u16 r2 = ScriptGetVar(ctx);
|
||||
sub_02097D3C(ctx->fieldSystem, r4, r2);
|
||||
BOOL ScrCmd_ViewFriendRecords(ScriptContext *ctx) {
|
||||
u16 pageScrollParam = ScriptGetVar(ctx);
|
||||
u16 cursorPos = ScriptGetVar(ctx);
|
||||
FieldSystem_LaunchTask_ViewFriendRecordsApp(ctx->fieldSystem, pageScrollParam, cursorPos);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -9,15 +9,16 @@
|
||||
#include "unk_02030A98.h"
|
||||
#include "unk_0202E4B0.h"
|
||||
#include "constants/game_stats.h"
|
||||
#include "constants/ranking.h"
|
||||
|
||||
struct UnkStruct_0202E4B0_sub {
|
||||
int unk_00;
|
||||
u32 unk_04;
|
||||
struct SaveRankingsEntry {
|
||||
int groupId;
|
||||
u32 stat;
|
||||
u16 playerName[PLAYER_NAME_LENGTH + 1];
|
||||
};
|
||||
|
||||
struct UnkStruct_0202E4B0 {
|
||||
UnkStruct_0202E4B0_sub unk_000[26][6];
|
||||
struct SaveRankings {
|
||||
SaveRankingsEntry array[26][6];
|
||||
};
|
||||
|
||||
typedef struct UnkStruct_0202E920_sub {
|
||||
@ -25,101 +26,106 @@ typedef struct UnkStruct_0202E920_sub {
|
||||
} UnkStruct_0202E920_sub;
|
||||
|
||||
typedef struct UnkStruct_0202E920 {
|
||||
int unk_00;
|
||||
int unk_04;
|
||||
int unk_08;
|
||||
UnkStruct_0202E4B0_sub *unk_0C[11];
|
||||
UnkStruct_0202E4B0_sub *unk_38[6];
|
||||
UnkStruct_0202E4B0_sub unk_50[6];
|
||||
int count_sub2;
|
||||
int count_sub1;
|
||||
int count_total;
|
||||
SaveRankingsEntry *rankings[11];
|
||||
SaveRankingsEntry *unk_38[6];
|
||||
SaveRankingsEntry unk_50[6];
|
||||
} UnkStruct_0202E920;
|
||||
|
||||
static void sub_0202E4C8(UnkStruct_0202E4B0_sub *a0);
|
||||
static BOOL sub_0202E4E0(UnkStruct_0202E4B0_sub *a0);
|
||||
static u32 *sub_0202E594(SaveData *saveData, HeapID heapId);
|
||||
static void sub_0202E6F0(UnkStruct_0202E4B0_sub *a0);
|
||||
static BOOL sub_0202E708(const UnkStruct_0202E4B0_sub *a0, const UnkStruct_0202E4B0_sub *a1);
|
||||
static BOOL sub_0202E72C(const UnkStruct_0202E920 *a0, const UnkStruct_0202E4B0_sub *a1);
|
||||
static void sub_0202E75C(UnkStruct_0202E4B0 *a0, UnkStruct_0202E920 *a1, int a2, u8 a3, u8 a4, UnkStruct_0202E4B0_sub **a5, u8 a6, HeapID heapId);
|
||||
static void sub_0202E920(UnkStruct_0202E4B0 *a0, int a1, u8 a2, UnkStruct_0202E4B0_sub **a3, u8 a4, HeapID heapId);
|
||||
static void RankingEntry_Init(SaveRankingsEntry *a0);
|
||||
static BOOL sub_0202E4E0(SaveRankingsEntry *a0);
|
||||
static u32 *Save_RankingSys_GetPlayerStats(SaveData *saveData, HeapID heapId);
|
||||
static void SaveRankingsEntry_InitArrayOf6(SaveRankingsEntry *a0);
|
||||
static BOOL SaveRankingsEntry_TestEqual(const SaveRankingsEntry *a0, const SaveRankingsEntry *a1);
|
||||
static BOOL sub_0202E72C(const UnkStruct_0202E920 *a0, const SaveRankingsEntry *a1);
|
||||
static void sub_0202E75C(SaveRankings *a0, UnkStruct_0202E920 *a1, int a2, u8 a3, u8 a4, SaveRankingsEntry **a5, u8 a6, HeapID heapId);
|
||||
static void sub_0202E920(SaveRankings *a0, int a1, u8 a2, SaveRankingsEntry **a3, u8 a4, HeapID heapId);
|
||||
|
||||
static const u8 sPageOffsets[][2] = {
|
||||
{ 6, 0 },
|
||||
{ 4, 6 },
|
||||
{ 3, 10 },
|
||||
{ RANKINGS_RECORD_BATTLE_TOWER_COUNT, RANKINGS_RECORD_BATTLE_TOWER_BEGIN },
|
||||
{ RANKINGS_RECORD_POKEMON_COUNT, RANKINGS_RECORD_POKEMON_BEGIN },
|
||||
{ RANKINGS_RECORD_CONTEST_COUNT, RANKINGS_RECORD_CONTEST_BEGIN },
|
||||
};
|
||||
|
||||
static const int sStatIDs[] = {
|
||||
0,
|
||||
2,
|
||||
4,
|
||||
6,
|
||||
8,
|
||||
// Battle Tower
|
||||
0, // Battle Tower singles
|
||||
2, // Battle Tower doubles
|
||||
4, // Battle Tower multi with NPC partner
|
||||
6, // Battle Tower multi with friend
|
||||
8, // Battle Tower WiFi
|
||||
GAME_STAT_BATTLE_TOWER_WIN_COUNT,
|
||||
|
||||
// Adventure
|
||||
GAME_STAT_OPPONENT_MON_FAINTED,
|
||||
GAME_STAT_UNK10,
|
||||
GAME_STAT_UNK12,
|
||||
GAME_STAT_UNK11,
|
||||
GAME_STAT_UNK93,
|
||||
GAME_STAT_UNK91,
|
||||
GAME_STAT_UNK95,
|
||||
GAME_STAT_CAUGHT_MON,
|
||||
GAME_STAT_HATCHED_EGG,
|
||||
GAME_STAT_FISHING_LANDED_MON,
|
||||
|
||||
// Contest (unused in HGSS)
|
||||
GAME_STAT_LOCAL_CONTEST_WINS,
|
||||
GAME_STAT_LOCAL_CONTEST_ENTRIES,
|
||||
GAME_STAT_RIBBONS_EARNED,
|
||||
};
|
||||
|
||||
u8 sub_0202E4B0(int page) {
|
||||
u8 RankingsViewSys_GetNumRecordsPerPage(int page) {
|
||||
return sPageOffsets[page][0];
|
||||
}
|
||||
|
||||
u8 sub_0202E4BC(int page) {
|
||||
u8 RankingsViewSys_GetFirstRecordIndexOnPage(int page) {
|
||||
return sPageOffsets[page][1];
|
||||
}
|
||||
|
||||
static void sub_0202E4C8(UnkStruct_0202E4B0_sub *a0) {
|
||||
a0->unk_00 = 0;
|
||||
a0->unk_04 = 0;
|
||||
static void RankingEntry_Init(SaveRankingsEntry *a0) {
|
||||
a0->groupId = 0;
|
||||
a0->stat = 0;
|
||||
StringFillEOS(a0->playerName, PLAYER_NAME_LENGTH + 1);
|
||||
SaveSubstruct_UpdateCRC(SAVE_UNK_24);
|
||||
SaveSubstruct_UpdateCRC(SAVE_RANKINGS);
|
||||
}
|
||||
|
||||
static BOOL sub_0202E4E0(UnkStruct_0202E4B0_sub *a0) {
|
||||
static BOOL sub_0202E4E0(SaveRankingsEntry *a0) {
|
||||
return StringLength(a0->playerName) != 0;
|
||||
}
|
||||
|
||||
u32 sub_0202E4F4(void) {
|
||||
return sizeof(UnkStruct_0202E4B0);
|
||||
u32 Save_Rankings_sizeof(void) {
|
||||
return sizeof(SaveRankings);
|
||||
}
|
||||
|
||||
void sub_0202E4FC(UnkStruct_0202E4B0 *a0) {
|
||||
MI_CpuClear8(a0, sizeof(UnkStruct_0202E4B0));
|
||||
void Save_Rankings_Init(SaveRankings *a0) {
|
||||
MI_CpuClear8(a0, sizeof(SaveRankings));
|
||||
for (int i = 0; i < 26; ++i) {
|
||||
for (int j = 0; j < 6; ++j) {
|
||||
sub_0202E4C8(&a0->unk_000[i][j]);
|
||||
RankingEntry_Init(&a0->array[i][j]);
|
||||
}
|
||||
}
|
||||
SaveSubstruct_UpdateCRC(SAVE_UNK_24);
|
||||
SaveSubstruct_UpdateCRC(SAVE_RANKINGS);
|
||||
}
|
||||
|
||||
UnkStruct_0202E4B0 *sub_0202E530(SaveData *saveData) {
|
||||
SaveSubstruct_AssertCRC(SAVE_UNK_24);
|
||||
return SaveArray_Get(saveData, SAVE_UNK_24);
|
||||
SaveRankings *sub_0202E530(SaveData *saveData) {
|
||||
SaveSubstruct_AssertCRC(SAVE_RANKINGS);
|
||||
return SaveArray_Get(saveData, SAVE_RANKINGS);
|
||||
}
|
||||
|
||||
void sub_0202E544(UnkStruct_0202E4B0 *a0, int a1, u8 a2) {
|
||||
void sub_0202E544(SaveRankings *a0, int a1, u8 a2) {
|
||||
if (a2 >= 6) {
|
||||
GF_ASSERT(a2 < 6);
|
||||
return;
|
||||
}
|
||||
UnkStruct_0202E4B0_sub *r6 = a0->unk_000[a1];
|
||||
SaveRankingsEntry *r6 = a0->array[a1];
|
||||
for (int i = a2; i < 5; ++i) {
|
||||
r6[i] = r6[i + 1];
|
||||
}
|
||||
sub_0202E4C8(&r6[5]);
|
||||
SaveSubstruct_UpdateCRC(SAVE_UNK_24);
|
||||
RankingEntry_Init(&r6[5]);
|
||||
SaveSubstruct_UpdateCRC(SAVE_RANKINGS);
|
||||
}
|
||||
|
||||
u32 sub_0202E58C(void) {
|
||||
return 0x138; // TODO: what is this?
|
||||
}
|
||||
|
||||
static u32 *sub_0202E594(SaveData *saveData, HeapID heapId) {
|
||||
static u32 *Save_RankingSys_GetPlayerStats(SaveData *saveData, HeapID heapId) {
|
||||
int i;
|
||||
u32 val;
|
||||
GAME_STATS *gameStats;
|
||||
@ -130,9 +136,9 @@ static u32 *sub_0202E594(SaveData *saveData, HeapID heapId) {
|
||||
frontierSave = Save_Frontier_GetStatic(saveData);
|
||||
ret = AllocFromHeapAtEnd(heapId, 13 * sizeof(u32));
|
||||
|
||||
for (i = 0; i < 13; ++i) {
|
||||
for (i = 0; i < RANKINGS_COUNT; ++i) {
|
||||
switch (i) {
|
||||
case 5: {
|
||||
case RANKINGS_RECORD_BATTLE_TOWER_AVG_WIN_STREAK: {
|
||||
val = GameStats_GetCapped(gameStats, GAME_STAT_UNK16);
|
||||
if (val != 0) {
|
||||
val = GameStats_GetCapped(gameStats, GAME_STAT_BATTLE_TOWER_WIN_COUNT) / val;
|
||||
@ -140,15 +146,15 @@ static u32 *sub_0202E594(SaveData *saveData, HeapID heapId) {
|
||||
ret[i] = val;
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
val = GameStats_GetCapped(gameStats, GAME_STAT_UNK93);
|
||||
val += GameStats_GetCapped(gameStats, GAME_STAT_UNK94);
|
||||
case RANKINGS_RECORD_CONTEST_WIN: {
|
||||
val = GameStats_GetCapped(gameStats, GAME_STAT_LOCAL_CONTEST_WINS);
|
||||
val += GameStats_GetCapped(gameStats, GAME_STAT_COMM_CONTEST_WINS);
|
||||
ret[i] = val;
|
||||
break;
|
||||
}
|
||||
case 11: {
|
||||
val = GameStats_GetCapped(gameStats, GAME_STAT_UNK91);
|
||||
val += GameStats_GetCapped(gameStats, GAME_STAT_UNK92);
|
||||
case RANKINGS_RECORD_CONTEST_ENTRY: {
|
||||
val = GameStats_GetCapped(gameStats, GAME_STAT_LOCAL_CONTEST_ENTRIES);
|
||||
val += GameStats_GetCapped(gameStats, GAME_STAT_COMM_CONTEST_ENTRIES);
|
||||
if (val != 0) {
|
||||
val = ret[10] * 100 / val;
|
||||
}
|
||||
@ -164,53 +170,53 @@ static u32 *sub_0202E594(SaveData *saveData, HeapID heapId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
SaveSubstruct_UpdateCRC(SAVE_UNK_24);
|
||||
SaveSubstruct_UpdateCRC(SAVE_RANKINGS);
|
||||
return ret;
|
||||
}
|
||||
|
||||
UnkStruct_0202E4B0_sub *sub_0202E66C(SaveData *saveData, HeapID heapId) {
|
||||
SaveRankingsEntry *Save_GetPlayerRankingEntry(SaveData *saveData, HeapID heapId) {
|
||||
int i;
|
||||
int sp8;
|
||||
UnkStruct_0202E4B0_sub *ret;
|
||||
int groupId;
|
||||
SaveRankingsEntry *ret;
|
||||
u32 *tmp;
|
||||
String *name;
|
||||
PlayerProfile *profile;
|
||||
|
||||
profile = Save_PlayerData_GetProfileAddr(saveData);
|
||||
ret = AllocFromHeapAtEnd(heapId, 13 * sizeof(UnkStruct_0202E4B0_sub));
|
||||
MI_CpuClear8(ret, 13 * sizeof(UnkStruct_0202E4B0_sub));
|
||||
sp8 = sub_0202C7B4(Save_FriendGroup_Get(saveData), 1);
|
||||
ret = AllocFromHeapAtEnd(heapId, 13 * sizeof(SaveRankingsEntry));
|
||||
MI_CpuClear8(ret, 13 * sizeof(SaveRankingsEntry));
|
||||
groupId = Save_FriendGroup_GetGroupId(Save_FriendGroup_Get(saveData), 1);
|
||||
name = PlayerProfile_GetPlayerName_NewString(profile, heapId);
|
||||
tmp = sub_0202E594(saveData, heapId);
|
||||
tmp = Save_RankingSys_GetPlayerStats(saveData, heapId);
|
||||
|
||||
for (i = 0; i < 13; ++i) {
|
||||
ret[i].unk_00 = sp8;
|
||||
for (i = 0; i < RANKINGS_COUNT; ++i) {
|
||||
ret[i].groupId = groupId;
|
||||
CopyStringToU16Array(name, ret[i].playerName, PLAYER_NAME_LENGTH + 1);
|
||||
ret[i].unk_04 = tmp[i];
|
||||
ret[i].stat = tmp[i];
|
||||
}
|
||||
|
||||
FreeToHeap(tmp);
|
||||
String_Delete(name);
|
||||
SaveSubstruct_UpdateCRC(SAVE_UNK_24);
|
||||
SaveSubstruct_UpdateCRC(SAVE_RANKINGS);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sub_0202E6F0(UnkStruct_0202E4B0_sub *a0) {
|
||||
static void SaveRankingsEntry_InitArrayOf6(SaveRankingsEntry *entries) {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
sub_0202E4C8(&a0[i]);
|
||||
RankingEntry_Init(&entries[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL sub_0202E708(const UnkStruct_0202E4B0_sub *a0, const UnkStruct_0202E4B0_sub *a1) {
|
||||
if (a0->unk_00 != a1->unk_00) {
|
||||
static BOOL SaveRankingsEntry_TestEqual(const SaveRankingsEntry *lhs, const SaveRankingsEntry *rhs) {
|
||||
if (lhs->groupId != rhs->groupId) {
|
||||
return FALSE;
|
||||
}
|
||||
return !StringNotEqual(a0->playerName, a1->playerName);
|
||||
return !StringNotEqual(lhs->playerName, rhs->playerName);
|
||||
}
|
||||
|
||||
static BOOL sub_0202E72C(const UnkStruct_0202E920 *a0, const UnkStruct_0202E4B0_sub *a1) {
|
||||
for (int i = 0; i < a0->unk_04; ++i) {
|
||||
if (sub_0202E708(a0->unk_0C[i], a1)) {
|
||||
static BOOL sub_0202E72C(const UnkStruct_0202E920 *a0, const SaveRankingsEntry *a1) {
|
||||
for (int i = 0; i < a0->count_sub1; ++i) {
|
||||
if (SaveRankingsEntry_TestEqual(a0->rankings[i], a1)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -218,74 +224,74 @@ static BOOL sub_0202E72C(const UnkStruct_0202E920 *a0, const UnkStruct_0202E4B0_
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void sub_0202E75C(UnkStruct_0202E4B0 *a0, UnkStruct_0202E920 *a1, int a2, u8 a3, u8 a4, UnkStruct_0202E4B0_sub **a5, u8 a6, HeapID unused) {
|
||||
UnkStruct_0202E4B0_sub *sp8;
|
||||
static void sub_0202E75C(SaveRankings *saveRankings, UnkStruct_0202E920 *a1, int a2, u8 statIdx, u8 scope, SaveRankingsEntry **a5, u8 a6, HeapID unused) {
|
||||
SaveRankingsEntry *saveRecordsPtr;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
MI_CpuClear8(a1, sizeof(UnkStruct_0202E920));
|
||||
if (a4 == 0) {
|
||||
sp8 = a0->unk_000[a3];
|
||||
MI_CpuCopy8(sp8, a1->unk_50, 6 * sizeof(UnkStruct_0202E4B0_sub));
|
||||
if (scope == RANKINGS_SCOPE_GLOBAL) {
|
||||
saveRecordsPtr = saveRankings->array[statIdx];
|
||||
MI_CpuCopy8(saveRecordsPtr, a1->unk_50, 6 * sizeof(SaveRankingsEntry));
|
||||
for (i = 0; i < a6; ++i) {
|
||||
a1->unk_0C[a1->unk_04++] = &a5[i][a3];
|
||||
a1->rankings[a1->count_sub1++] = &a5[i][statIdx];
|
||||
}
|
||||
for (i = 0; i < 6; ++i) {
|
||||
if (sub_0202E4E0(&a1->unk_50[i]) && !sub_0202E72C(a1, &a1->unk_50[i])) {
|
||||
a1->unk_38[a1->unk_00++] = &a1->unk_50[i];
|
||||
a1->unk_38[a1->count_sub2++] = &a1->unk_50[i];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sp8 = a0->unk_000[a3 + 13];
|
||||
MI_CpuCopy8(sp8, a1->unk_50, 6 * sizeof(UnkStruct_0202E4B0_sub));
|
||||
saveRecordsPtr = saveRankings->array[statIdx + RANKINGS_COUNT];
|
||||
MI_CpuCopy8(saveRecordsPtr, a1->unk_50, 6 * sizeof(SaveRankingsEntry));
|
||||
for (i = 0; i < a6; ++i) {
|
||||
if (a5[i][a3].unk_00 != 0 && a2 == a5[i][a3].unk_00) {
|
||||
a1->unk_0C[a1->unk_04++] = &a5[i][a3];
|
||||
if (a5[i][statIdx].groupId != 0 && a2 == a5[i][statIdx].groupId) {
|
||||
a1->rankings[a1->count_sub1++] = &a5[i][statIdx];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 6; ++i) {
|
||||
if (sub_0202E4E0(&a1->unk_50[i]) && a1->unk_50[i].unk_00 == a2 && !sub_0202E72C(a1, &a1->unk_50[i])) {
|
||||
a1->unk_38[a1->unk_00++] = &a1->unk_50[i];
|
||||
if (sub_0202E4E0(&a1->unk_50[i]) && a1->unk_50[i].groupId == a2 && !sub_0202E72C(a1, &a1->unk_50[i])) {
|
||||
a1->unk_38[a1->count_sub2++] = &a1->unk_50[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
a1->unk_08 = a1->unk_04 + a1->unk_00;
|
||||
for (i = 0; i < a1->unk_00; ++i) {
|
||||
a1->unk_0C[i + a1->unk_04] = a1->unk_38[i];
|
||||
a1->count_total = a1->count_sub1 + a1->count_sub2;
|
||||
for (i = 0; i < a1->count_sub2; ++i) {
|
||||
a1->rankings[i + a1->count_sub1] = a1->unk_38[i];
|
||||
}
|
||||
for (i = 0; i < a1->unk_08 - 1; ++i) {
|
||||
for (j = a1->unk_08 - 1; j > i; --j) {
|
||||
if (a1->unk_0C[i]->unk_04 < a1->unk_0C[j]->unk_04) {
|
||||
UnkStruct_0202E4B0_sub *tmp = a1->unk_0C[i];
|
||||
a1->unk_0C[i] = a1->unk_0C[j];
|
||||
a1->unk_0C[j] = tmp;
|
||||
for (i = 0; i < a1->count_total - 1; ++i) {
|
||||
for (j = a1->count_total - 1; j > i; --j) {
|
||||
if (a1->rankings[i]->stat < a1->rankings[j]->stat) {
|
||||
SaveRankingsEntry *tmp = a1->rankings[i];
|
||||
a1->rankings[i] = a1->rankings[j];
|
||||
a1->rankings[j] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
sub_0202E6F0(sp8);
|
||||
for (i = 0; i < 6 && i < a1->unk_08; ++i) {
|
||||
sp8[i] = *a1->unk_0C[i];
|
||||
SaveRankingsEntry_InitArrayOf6(saveRecordsPtr);
|
||||
for (i = 0; i < 6 && i < a1->count_total; ++i) {
|
||||
saveRecordsPtr[i] = *a1->rankings[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_0202E920(UnkStruct_0202E4B0 *a0, int a1, u8 a2, UnkStruct_0202E4B0_sub **a3, u8 a4, HeapID heapId) {
|
||||
UnkStruct_0202E920 *r6 = AllocFromHeapAtEnd(heapId, sizeof(UnkStruct_0202E920));
|
||||
sub_0202E75C(a0, r6, a1, a2, 0, a3, a4, heapId);
|
||||
static void sub_0202E920(SaveRankings *a0, int a1, u8 a2, SaveRankingsEntry **a3, u8 a4, HeapID heapId) {
|
||||
UnkStruct_0202E920 *temp = AllocFromHeapAtEnd(heapId, sizeof(UnkStruct_0202E920));
|
||||
sub_0202E75C(a0, temp, a1, a2, 0, a3, a4, heapId);
|
||||
if (a1 != 0) {
|
||||
sub_0202E75C(a0, r6, a1, a2, 1, a3, a4, heapId);
|
||||
sub_0202E75C(a0, temp, a1, a2, 1, a3, a4, heapId);
|
||||
}
|
||||
FreeToHeap(r6);
|
||||
FreeToHeap(temp);
|
||||
}
|
||||
|
||||
void sub_0202E97C(SaveData *saveData, u8 a1, u8 a2, UnkStruct_0202E4B0_sub **a3, HeapID heapId) {
|
||||
void sub_0202E97C(SaveData *saveData, u8 a1, u8 a2, SaveRankingsEntry **a3, HeapID heapId) {
|
||||
u8 i;
|
||||
u8 cnt;
|
||||
UnkStruct_0202E4B0_sub *sp10[5];
|
||||
int spC;
|
||||
UnkStruct_0202E4B0 *sp8;
|
||||
SaveRankingsEntry *sp10[5];
|
||||
int groupId;
|
||||
SaveRankings *sp8;
|
||||
|
||||
sp8 = sub_0202E530(saveData);
|
||||
spC = sub_0202C7B4(Save_FriendGroup_Get(saveData), 1);
|
||||
groupId = Save_FriendGroup_GetGroupId(Save_FriendGroup_Get(saveData), 1);
|
||||
cnt = 0;
|
||||
for (i = 0; i < a2; ++i) {
|
||||
if (i != a1 && a3[i] != NULL) {
|
||||
@ -294,48 +300,48 @@ void sub_0202E97C(SaveData *saveData, u8 a1, u8 a2, UnkStruct_0202E4B0_sub **a3,
|
||||
}
|
||||
if (cnt != 0) {
|
||||
for (i = 0; i < 13; ++i) {
|
||||
sub_0202E920(sp8, spC, i, sp10, cnt, heapId);
|
||||
sub_0202E920(sp8, groupId, i, sp10, cnt, heapId);
|
||||
}
|
||||
SaveSubstruct_UpdateCRC(SAVE_UNK_24);
|
||||
SaveSubstruct_UpdateCRC(SAVE_RANKINGS);
|
||||
}
|
||||
}
|
||||
|
||||
UnkStruct_0202E9FC *sub_0202E9FC(SaveData *saveData, int page, HeapID heapId) {
|
||||
int i;
|
||||
int r0;
|
||||
int pageOffset;
|
||||
UnkStruct_0202E9FC *ret;
|
||||
int spC;
|
||||
int groupId;
|
||||
u32 *tmp;
|
||||
PlayerProfile *profile;
|
||||
|
||||
profile = Save_PlayerData_GetProfileAddr(saveData);
|
||||
ret = AllocFromHeap(heapId, sizeof(UnkStruct_0202E9FC));
|
||||
MI_CpuClear8(ret, sizeof(UnkStruct_0202E9FC));
|
||||
spC = sub_0202C7B4(Save_FriendGroup_Get(saveData), 1);
|
||||
tmp = sub_0202E594(saveData, heapId);
|
||||
ret->count = sub_0202E4B0(page);
|
||||
r0 = sub_0202E4BC(page);
|
||||
groupId = Save_FriendGroup_GetGroupId(Save_FriendGroup_Get(saveData), 1);
|
||||
tmp = Save_RankingSys_GetPlayerStats(saveData, heapId);
|
||||
ret->count = RankingsViewSys_GetNumRecordsPerPage(page);
|
||||
pageOffset = RankingsViewSys_GetFirstRecordIndexOnPage(page);
|
||||
for (i = 0; i < ret->count; ++i) {
|
||||
ret->unk_04[i].unk_0 = spC;
|
||||
ret->unk_04[i].unk_4 = tmp[i + r0];
|
||||
ret->unk_04[i].groupId = groupId;
|
||||
ret->unk_04[i].stat = tmp[i + pageOffset];
|
||||
ret->unk_04[i].playerName = PlayerProfile_GetPlayerName_NewString(profile, heapId);
|
||||
}
|
||||
FreeToHeap(tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
UnkStruct_0202E9FC *sub_0202EA80(UnkStruct_0202E4B0 *a0, int a1, HeapID heapId) {
|
||||
UnkStruct_0202E9FC *sub_0202EA80(SaveRankings *saveRankings, int a1, HeapID heapId) {
|
||||
int i;
|
||||
UnkStruct_0202E9FC *ret;
|
||||
|
||||
ret = AllocFromHeap(heapId, sizeof(UnkStruct_0202E9FC));
|
||||
MI_CpuClear8(ret, sizeof(UnkStruct_0202E9FC));
|
||||
for (i = 0; i < 6; ++i) {
|
||||
if (sub_0202E4E0(&a0->unk_000[a1][i])) {
|
||||
ret->unk_04[ret->count].unk_0 = a0->unk_000[a1][i].unk_00;
|
||||
ret->unk_04[ret->count].unk_4 = a0->unk_000[a1][i].unk_04;
|
||||
if (sub_0202E4E0(&saveRankings->array[a1][i])) {
|
||||
ret->unk_04[ret->count].groupId = saveRankings->array[a1][i].groupId;
|
||||
ret->unk_04[ret->count].stat = saveRankings->array[a1][i].stat;
|
||||
ret->unk_04[ret->count].playerName = String_New(PLAYER_NAME_LENGTH + 1, heapId);
|
||||
CopyU16ArrayToString(ret->unk_04[ret->count].playerName, a0->unk_000[a1][i].playerName);
|
||||
CopyU16ArrayToString(ret->unk_04[ret->count].playerName, saveRankings->array[a1][i].playerName);
|
||||
++ret->count;
|
||||
}
|
||||
}
|
||||
@ -352,5 +358,5 @@ void sub_0202EAFC(UnkStruct_0202E9FC *a0) {
|
||||
}
|
||||
MI_CpuClear8(a0, sizeof(UnkStruct_0202E9FC));
|
||||
FreeToHeap(a0);
|
||||
SaveSubstruct_UpdateCRC(SAVE_UNK_24);
|
||||
SaveSubstruct_UpdateCRC(SAVE_RANKINGS);
|
||||
}
|
||||
|
@ -5,19 +5,19 @@
|
||||
#include "unk_0200FA24.h"
|
||||
#include "unk_02097D3C.h"
|
||||
|
||||
static BOOL sub_02097D80(TaskManager *taskManager);
|
||||
static BOOL Task_ViewFriendRecordsApp(TaskManager *taskManager);
|
||||
|
||||
void sub_02097D3C(FieldSystem *fieldSystem, u8 a1, u8 a2) {
|
||||
void FieldSystem_LaunchTask_ViewFriendRecordsApp(FieldSystem *fieldSystem, u8 pageScrollParam, u8 cursorPos) {
|
||||
UnkStruct_02097D48 *taskData = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(UnkStruct_02097D48));
|
||||
taskData->state = 0;
|
||||
taskData->args = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(UnkStruct_02097D56));
|
||||
taskData->args = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(ViewFriendRecordsArgs));
|
||||
taskData->args->saveData = FieldSystem_GetSaveData(fieldSystem);
|
||||
taskData->args->unk_0 = a1;
|
||||
taskData->args->unk_2 = a2;
|
||||
TaskManager_Call(fieldSystem->taskman, sub_02097D80, taskData);
|
||||
taskData->args->page_scroll = pageScrollParam;
|
||||
taskData->args->cursorPos = cursorPos;
|
||||
TaskManager_Call(fieldSystem->taskman, Task_ViewFriendRecordsApp, taskData);
|
||||
}
|
||||
|
||||
static BOOL sub_02097D80(TaskManager *taskManager) {
|
||||
static BOOL Task_ViewFriendRecordsApp(TaskManager *taskManager) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
UnkStruct_02097D48 *taskData = TaskManager_GetEnvironment(taskManager);
|
||||
|
||||
@ -32,7 +32,7 @@ static BOOL sub_02097D80(TaskManager *taskManager) {
|
||||
break;
|
||||
}
|
||||
|
||||
sub_0203FD08(fieldSystem, taskData->args);
|
||||
LaunchApp_ViewFriendRecords(fieldSystem, taskData->args);
|
||||
sub_0203E30C();
|
||||
taskData->state++;
|
||||
break;
|
||||
|
@ -2296,7 +2296,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "scrcmd_378",
|
||||
"name": "view_rankings",
|
||||
"args": [
|
||||
2,
|
||||
"var"
|
||||
|
Loading…
Reference in New Issue
Block a user