mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-03-21 17:55:13 -05:00
Document record_mixed_rng.c
This commit is contained in:
parent
81b9a3c9c9
commit
a94d1747a3
|
|
@ -26,7 +26,7 @@ enum SaveTableEntryID {
|
|||
SAVE_TABLE_ENTRY_IMAGE_CLIPS,
|
||||
SAVE_TABLE_ENTRY_MAIL,
|
||||
SAVE_TABLE_ENTRY_POFFINS,
|
||||
SAVE_TABLE_ENTRY_RANDOM_GROUP,
|
||||
SAVE_TABLE_ENTRY_RECORD_MIXED_RNG,
|
||||
SAVE_TABLE_ENTRY_JOURNAL,
|
||||
SAVE_TABLE_ENTRY_TRAINER_CARD,
|
||||
SAVE_TABLE_ENTRY_GAME_RECORDS,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
#ifndef POKEPLATINUM_CONSTANTS_STRING_H
|
||||
#define POKEPLATINUM_CONSTANTS_STRING_H
|
||||
|
||||
#define MON_NAME_LEN 10
|
||||
#define TRAINER_NAME_LEN 7
|
||||
#define TABLET_NAME_LEN 10
|
||||
#define MOVE_NAME_LEN 16
|
||||
#define MON_NAME_LEN 10
|
||||
#define TRAINER_NAME_LEN 7
|
||||
#define TABLET_NAME_LEN 10
|
||||
#define MOVE_NAME_LEN 16
|
||||
#define UNION_GROUP_NAME_LEN 7
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef POKEPLATINUM_OV59_021D2A2C_H
|
||||
#define POKEPLATINUM_OV59_021D2A2C_H
|
||||
|
||||
#include "struct_decls/struct_0202B4A0_decl.h"
|
||||
#include "record_mixed_rng.h"
|
||||
|
||||
u32 ov59_021D2A2C(UnkStruct_0202B4A0 *param0);
|
||||
void *ov59_021D2A30(UnkStruct_0202B4A0 *param0);
|
||||
void ov59_021D2AC4(int param0, int param1, UnkStruct_0202B4A0 *param2, const void **param3);
|
||||
u32 ov59_021D2A2C(RecordMixedRNG *param0);
|
||||
void *ov59_021D2A30(RecordMixedRNG *param0);
|
||||
void ov59_021D2AC4(int param0, int param1, RecordMixedRNG *param2, const void **param3);
|
||||
|
||||
#endif // POKEPLATINUM_OV59_021D2A2C_H
|
||||
|
|
|
|||
57
include/record_mixed_rng.h
Normal file
57
include/record_mixed_rng.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#ifndef POKEPLATINUM_RECORD_MIXED_RNG_H
|
||||
#define POKEPLATINUM_RECORD_MIXED_RNG_H
|
||||
|
||||
#include "constants/string.h"
|
||||
|
||||
#include "charcode.h"
|
||||
#include "savedata.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
enum RecordMixedRNGEntry {
|
||||
RECORD_MIXED_RNG_PLAYER_ORIGINAL,
|
||||
RECORD_MIXED_RNG_PLAYER_OVERRIDE,
|
||||
RECORD_MIXED_RNG_QUEUE_0,
|
||||
RECORD_MIXED_RNG_QUEUE_1,
|
||||
RECORD_MIXED_RNG_QUEUE_2,
|
||||
RECORD_MIXED_RNG_QUEUE_3,
|
||||
|
||||
RECORD_MIXED_RNG_MAX,
|
||||
};
|
||||
|
||||
enum RecordMixedRNGName {
|
||||
RECORD_MIXED_RNG_GROUP_NAME,
|
||||
RECORD_MIXED_RNG_PLAYER_NAME,
|
||||
};
|
||||
|
||||
typedef struct RecordMixedRNG {
|
||||
charcode_t groupName[UNION_GROUP_NAME_LEN + 1];
|
||||
charcode_t playerName[TRAINER_NAME_LEN + 1];
|
||||
u8 gender;
|
||||
u8 countryCode;
|
||||
u16 dummy;
|
||||
u32 seed;
|
||||
u32 rand;
|
||||
} RecordMixedRNG;
|
||||
|
||||
int RecordMixedRNG_SaveSize();
|
||||
RecordMixedRNG *SaveData_GetRecordMixedRNG(SaveData *saveData);
|
||||
|
||||
void RecordMixedRNG_CopyEntry(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry srcEntry, enum RecordMixedRNGEntry destEntry);
|
||||
void RecordMixedRNG_Init(RecordMixedRNG *rngCollection);
|
||||
void RecordMixedRNG_AdvanceEntries(RecordMixedRNG *rngCollection, u32 stepCount);
|
||||
u32 RecordMixedRNG_GetEntrySeed(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry);
|
||||
void RecordMixedRNG_SetEntrySeed(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry, u32 seed);
|
||||
u32 RecordMixedRNG_GetRand(RecordMixedRNG *rngCollection);
|
||||
const charcode_t *RecordMixedRNG_GetEntryName(const RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry, enum RecordMixedRNGName nameChoice);
|
||||
void RecordMixedRNG_GetEntryNameAsStrbuf(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry, enum RecordMixedRNGName nameChoice, Strbuf *outStrbuf);
|
||||
void RecordMixedRNG_SetEntryGender(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry, int gender);
|
||||
int RecordMixedRNG_GetEntryGender(const RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry);
|
||||
int RecordMixedRNG_GetEntryCountryCode(const RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry);
|
||||
void RecordMixedRNG_SetEntryCountryCode(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry, int countryCode);
|
||||
BOOL RecordMixedRNG_IsEntryValid(const RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry);
|
||||
BOOL RecordMixedRNG_IsEntryEqualToOverride(const RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry);
|
||||
BOOL RecordMixedRNG_DoesCollectionContainGroup(const RecordMixedRNG *rngCollection, const charcode_t *groupName);
|
||||
BOOL RecordMixedRNG_IsEntryEmpty(const RecordMixedRNG *entry);
|
||||
BOOL RecordMixedRNG_AreEntriesEqual(const RecordMixedRNG *entry1, const RecordMixedRNG *entry2);
|
||||
|
||||
#endif // POKEPLATINUM_RECORD_MIXED_RNG_H
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef POKEPLATINUM_STRUCT_0202B4A0_DECL_H
|
||||
#define POKEPLATINUM_STRUCT_0202B4A0_DECL_H
|
||||
|
||||
typedef struct UnkStruct_0202B4A0_t UnkStruct_0202B4A0;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_0202B4A0_DECL_H
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef POKEPLATINUM_STRUCT_0202B4A0_H
|
||||
#define POKEPLATINUM_STRUCT_0202B4A0_H
|
||||
|
||||
#include "struct_defs/struct_0202B510.h"
|
||||
|
||||
typedef struct UnkStruct_0202B4A0_t {
|
||||
UnkStruct_0202B510 unk_00[6];
|
||||
} UnkStruct_0202B4A0;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_0202B4A0_H
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#ifndef POKEPLATINUM_STRUCT_0202B510_H
|
||||
#define POKEPLATINUM_STRUCT_0202B510_H
|
||||
|
||||
typedef struct {
|
||||
u16 unk_00[8];
|
||||
u16 unk_10[8];
|
||||
u8 unk_20;
|
||||
u8 unk_21;
|
||||
u16 unk_22;
|
||||
u32 unk_24;
|
||||
u32 unk_28;
|
||||
} UnkStruct_0202B510;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_0202B510_H
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
#ifndef POKEPLATINUM_UNK_0202B37C_H
|
||||
#define POKEPLATINUM_UNK_0202B37C_H
|
||||
|
||||
#include "struct_decls/struct_0202B4A0_decl.h"
|
||||
#include "struct_defs/struct_0202B510.h"
|
||||
|
||||
#include "savedata.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
int RandomGroup_SaveSize(void);
|
||||
void sub_0202B384(UnkStruct_0202B4A0 *param0, int param1, int param2);
|
||||
void RandomGroup_Init(UnkStruct_0202B4A0 *param0);
|
||||
void sub_0202B3D8(UnkStruct_0202B4A0 *param0, u32 param1);
|
||||
u32 sub_0202B400(UnkStruct_0202B4A0 *param0, int param1);
|
||||
void sub_0202B40C(UnkStruct_0202B4A0 *param0, int param1, u32 param2);
|
||||
u32 sub_0202B428(UnkStruct_0202B4A0 *param0);
|
||||
const u16 *sub_0202B42C(const UnkStruct_0202B4A0 *param0, int param1, int param2);
|
||||
void sub_0202B444(UnkStruct_0202B4A0 *param0, int param1, int param2, Strbuf *param3);
|
||||
void sub_0202B470(UnkStruct_0202B4A0 *param0, int param1, int param2);
|
||||
int sub_0202B47C(const UnkStruct_0202B4A0 *param0, int param1);
|
||||
int sub_0202B488(const UnkStruct_0202B4A0 *param0, int param1);
|
||||
void sub_0202B494(UnkStruct_0202B4A0 *param0, int param1, int param2);
|
||||
UnkStruct_0202B4A0 *sub_0202B4A0(SaveData *param0);
|
||||
BOOL sub_0202B4AC(const UnkStruct_0202B4A0 *param0, int param1);
|
||||
BOOL sub_0202B4C4(const UnkStruct_0202B4A0 *param0, int param1);
|
||||
BOOL sub_0202B4D8(const UnkStruct_0202B4A0 *param0, const u16 *param1);
|
||||
BOOL sub_0202B510(const UnkStruct_0202B510 *param0);
|
||||
BOOL sub_0202B530(const UnkStruct_0202B510 *param0, const UnkStruct_0202B510 *param1);
|
||||
|
||||
#endif // POKEPLATINUM_UNK_0202B37C_H
|
||||
|
|
@ -120,7 +120,7 @@ Static main
|
|||
Object main.nef.p/src_unk_020298BC.c.o
|
||||
Object main.nef.p/src_poffin.c.o
|
||||
Object main.nef.p/src_unk_0202ACE0.c.o
|
||||
Object main.nef.p/src_unk_0202B37C.c.o
|
||||
Object main.nef.p/src_record_mixed_rng.c.o
|
||||
Object main.nef.p/src_coins.c.o
|
||||
Object main.nef.p/src_journal.c.o
|
||||
Object main.nef.p/src_unk_0202C7FC.c.o
|
||||
|
|
|
|||
|
|
@ -7,19 +7,18 @@
|
|||
#include "constants/heap.h"
|
||||
|
||||
#include "struct_decls/struct_0202B370_decl.h"
|
||||
#include "struct_decls/struct_0202B4A0_decl.h"
|
||||
#include "struct_decls/struct_0202C878_decl.h"
|
||||
#include "struct_defs/struct_0202610C.h"
|
||||
|
||||
#include "communication_system.h"
|
||||
#include "heap.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "save_player.h"
|
||||
#include "savedata.h"
|
||||
#include "trainer_info.h"
|
||||
#include "unk_0202602C.h"
|
||||
#include "unk_0202854C.h"
|
||||
#include "unk_0202ACE0.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_0202C858.h"
|
||||
#include "unk_02033200.h"
|
||||
#include "unk_0203909C.h"
|
||||
|
|
@ -118,7 +117,7 @@ void CommInfo_SendBattleRegulation(void)
|
|||
u16 netId = CommSys_CurNetId();
|
||||
TrainerInfo *trainerInfo;
|
||||
const u16 *v2;
|
||||
UnkStruct_0202B4A0 *v3 = sub_0202B4A0(sCommInfo->saveData);
|
||||
RecordMixedRNG *v3 = SaveData_GetRecordMixedRNG(sCommInfo->saveData);
|
||||
UnkStruct_0202B370 *v4 = sub_0202B370(sCommInfo->saveData);
|
||||
UnkStruct_0202C878 *v5 = sub_0202C878(sCommInfo->saveData);
|
||||
|
||||
|
|
@ -131,7 +130,7 @@ void CommInfo_SendBattleRegulation(void)
|
|||
TrainerInfo_Copy(trainerInfo, sCommInfo->trainerInfo[netId]);
|
||||
OS_GetMacAddress(&sCommInfo->playerInfo[netId].macAddress[0]);
|
||||
|
||||
v2 = sub_0202B42C(v3, 1, 0);
|
||||
v2 = RecordMixedRNG_GetEntryName(v3, 1, 0);
|
||||
|
||||
MI_CpuCopy8(v2, sCommInfo->playerInfo[netId].unk_4C, sizeof(sCommInfo->playerInfo[netId].unk_4C));
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include "constants/game_options.h"
|
||||
|
||||
#include "struct_decls/struct_02027854_decl.h"
|
||||
#include "struct_decls/struct_0202B4A0_decl.h"
|
||||
|
||||
#include "game_options.h"
|
||||
#include "heap.h"
|
||||
|
|
@ -15,6 +14,7 @@
|
|||
#include "overlay_manager.h"
|
||||
#include "party.h"
|
||||
#include "pokemon.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "save_player.h"
|
||||
#include "savedata.h"
|
||||
#include "savedata_misc.h"
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
#include "unk_02017428.h"
|
||||
#include "unk_0201D15C.h"
|
||||
#include "unk_02027B70.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_0205C980.h"
|
||||
#include "unk_0206A8DC.h"
|
||||
#include "unk_0206B9D8.h"
|
||||
|
|
@ -157,15 +156,15 @@ static void ov57_021D0EAC(int param0, SaveData *param1, BOOL param2)
|
|||
UnkStruct_02027854 *v1;
|
||||
TrainerInfo *v2;
|
||||
GameTime *v3;
|
||||
UnkStruct_0202B4A0 *v4;
|
||||
RecordMixedRNG *v4;
|
||||
|
||||
SystemData_Init(SaveData_GetSystemData(param1));
|
||||
|
||||
v3 = SaveData_GetGameTime(param1);
|
||||
GameTime_Clear(v3);
|
||||
|
||||
v4 = sub_0202B4A0(param1);
|
||||
sub_0202B40C(v4, 1, MTRNG_Next());
|
||||
v4 = SaveData_GetRecordMixedRNG(param1);
|
||||
RecordMixedRNG_SetEntrySeed(v4, 1, MTRNG_Next());
|
||||
sub_0206C008(param1);
|
||||
|
||||
v2 = SaveData_GetTrainerInfo(param1);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ pokeplatinum_c = files(
|
|||
'unk_0202854C.c',
|
||||
'unk_020298BC.c',
|
||||
'unk_0202ACE0.c',
|
||||
'unk_0202B37C.c',
|
||||
'record_mixed_rng.c',
|
||||
'journal.c',
|
||||
'unk_0202C7FC.c',
|
||||
'unk_0202C858.c',
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "heap.h"
|
||||
#include "inlines.h"
|
||||
#include "narc.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "unk_02039C80.h"
|
||||
#include "unk_0205F180.h"
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ BOOL ov6_02247660(FieldSystem *fieldSystem)
|
|||
return 0;
|
||||
}
|
||||
|
||||
v13 = sub_0202B428(sub_0202B4A0(fieldSystem->saveData));
|
||||
v13 = RecordMixedRNG_GetRand(SaveData_GetRecordMixedRNG(fieldSystem->saveData));
|
||||
|
||||
sub_020615AC(fieldSystem->playerAvatar, &v15, &v16);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,59 +3,56 @@
|
|||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "struct_defs/struct_0202B4A0.h"
|
||||
#include "struct_defs/struct_0202B510.h"
|
||||
#include "record_mixed_rng.h"
|
||||
|
||||
#include "unk_0202B37C.h"
|
||||
static void ov59_021D2A78(RecordMixedRNG *param0, int param1);
|
||||
static void ov59_021D2A34(RecordMixedRNG *param0, const RecordMixedRNG *param1);
|
||||
|
||||
static void ov59_021D2A78(UnkStruct_0202B4A0 *param0, int param1);
|
||||
static void ov59_021D2A34(UnkStruct_0202B4A0 *param0, const UnkStruct_0202B510 *param1);
|
||||
|
||||
u32 ov59_021D2A2C(UnkStruct_0202B4A0 *param0)
|
||||
u32 ov59_021D2A2C(RecordMixedRNG *param0)
|
||||
{
|
||||
return sizeof(UnkStruct_0202B510);
|
||||
return sizeof(RecordMixedRNG);
|
||||
}
|
||||
|
||||
void *ov59_021D2A30(UnkStruct_0202B4A0 *param0)
|
||||
void *ov59_021D2A30(RecordMixedRNG *param0)
|
||||
{
|
||||
return ¶m0->unk_00[1];
|
||||
return ¶m0[1];
|
||||
}
|
||||
|
||||
static void ov59_021D2A34(UnkStruct_0202B4A0 *param0, const UnkStruct_0202B510 *param1)
|
||||
static void ov59_021D2A34(RecordMixedRNG *param0, const RecordMixedRNG *param1)
|
||||
{
|
||||
int v0;
|
||||
|
||||
for (v0 = 5; v0 > 2; v0--) {
|
||||
param0->unk_00[v0] = param0->unk_00[v0 - 1];
|
||||
param0[v0] = param0[v0 - 1];
|
||||
}
|
||||
|
||||
param0->unk_00[2] = *param1;
|
||||
param0[2] = *param1;
|
||||
}
|
||||
|
||||
static void ov59_021D2A78(UnkStruct_0202B4A0 *param0, int param1)
|
||||
static void ov59_021D2A78(RecordMixedRNG *param0, int param1)
|
||||
{
|
||||
int v0;
|
||||
UnkStruct_0202B510 *v1;
|
||||
RecordMixedRNG *v1;
|
||||
|
||||
GF_ASSERT(2 <= param1 && param1 <= 5);
|
||||
|
||||
for (v0 = param1 + 1; v0 <= 5; v0++) {
|
||||
param0->unk_00[v0 - 1] = param0->unk_00[v0];
|
||||
param0[v0 - 1] = param0[v0];
|
||||
}
|
||||
|
||||
v1 = ¶m0->unk_00[5];
|
||||
v1 = ¶m0[5];
|
||||
|
||||
v1->unk_00[0] = 0xffff;
|
||||
v1->unk_10[0] = 0xffff;
|
||||
v1->groupName[0] = 0xffff;
|
||||
v1->playerName[0] = 0xffff;
|
||||
}
|
||||
|
||||
void ov59_021D2AC4(int param0, int param1, UnkStruct_0202B4A0 *param2, const void **param3)
|
||||
void ov59_021D2AC4(int param0, int param1, RecordMixedRNG *param2, const void **param3)
|
||||
{
|
||||
int v0, v1;
|
||||
UnkStruct_0202B510 *v2;
|
||||
RecordMixedRNG *v2;
|
||||
|
||||
for (v0 = 0; v0 < param0; v0++) {
|
||||
v2 = (UnkStruct_0202B510 *)param3[v0];
|
||||
v2 = (RecordMixedRNG *)param3[v0];
|
||||
|
||||
if (v0 == param1) {
|
||||
continue;
|
||||
|
|
@ -65,16 +62,16 @@ void ov59_021D2AC4(int param0, int param1, UnkStruct_0202B4A0 *param2, const voi
|
|||
continue;
|
||||
}
|
||||
|
||||
if (sub_0202B510(v2) == 1) {
|
||||
if (RecordMixedRNG_IsEntryEmpty(v2) == 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sub_0202B530(v2, ¶m2->unk_00[0])) {
|
||||
if (RecordMixedRNG_AreEntriesEqual(v2, ¶m2[0])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (v1 = 0; v1 < 4; v1++) {
|
||||
if (sub_0202B530(v2, ¶m2->unk_00[2 + v1])) {
|
||||
if (RecordMixedRNG_AreEntriesEqual(v2, ¶m2[2 + v1])) {
|
||||
ov59_021D2A78(param2, 2 + v1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include "struct_decls/struct_0202440C_decl.h"
|
||||
#include "struct_decls/struct_02029C68_decl.h"
|
||||
#include "struct_decls/struct_0202A750_decl.h"
|
||||
#include "struct_decls/struct_0202B4A0_decl.h"
|
||||
#include "struct_decls/struct_0202E8C0_decl.h"
|
||||
|
||||
#include "overlay059/ov59_021D2A2C.h"
|
||||
|
|
@ -18,9 +17,9 @@
|
|||
#include "communication_information.h"
|
||||
#include "communication_system.h"
|
||||
#include "heap.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "savedata.h"
|
||||
#include "unk_020298BC.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_0202D05C.h"
|
||||
#include "unk_0202E2CC.h"
|
||||
#include "unk_0202E840.h"
|
||||
|
|
@ -47,13 +46,13 @@ typedef struct {
|
|||
|
||||
static u32 ov59_021D2F88(SaveData *param0)
|
||||
{
|
||||
UnkStruct_0202B4A0 *v0 = sub_0202B4A0(param0);
|
||||
RecordMixedRNG *v0 = SaveData_GetRecordMixedRNG(param0);
|
||||
return ov59_021D2A2C(v0);
|
||||
}
|
||||
|
||||
static void *ov59_021D2F94(SaveData *param0, int param1, u32 param2)
|
||||
{
|
||||
UnkStruct_0202B4A0 *v0 = sub_0202B4A0(param0);
|
||||
RecordMixedRNG *v0 = SaveData_GetRecordMixedRNG(param0);
|
||||
void *v1 = Heap_AllocFromHeapAtEnd(param1, param2);
|
||||
|
||||
MI_CpuCopyFast(ov59_021D2A30(v0), v1, param2);
|
||||
|
|
@ -63,7 +62,7 @@ static void *ov59_021D2F94(SaveData *param0, int param1, u32 param2)
|
|||
|
||||
static void ov59_021D2FBC(const UnkStruct_ov59_021D2FBC *param0)
|
||||
{
|
||||
UnkStruct_0202B4A0 *v0 = sub_0202B4A0(param0->unk_04);
|
||||
RecordMixedRNG *v0 = SaveData_GetRecordMixedRNG(param0->unk_04);
|
||||
ov59_021D2AC4(param0->unk_08, param0->unk_0C, v0, param0->unk_10);
|
||||
}
|
||||
|
||||
|
|
|
|||
169
src/record_mixed_rng.c
Normal file
169
src/record_mixed_rng.c
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
#include "record_mixed_rng.h"
|
||||
|
||||
#include "constants/charcode.h"
|
||||
#include "constants/savedata/save_table.h"
|
||||
#include "constants/string.h"
|
||||
|
||||
#include "charcode.h"
|
||||
#include "charcode_util.h"
|
||||
#include "savedata.h"
|
||||
#include "strbuf.h"
|
||||
#include "unk_0201D15C.h"
|
||||
|
||||
RecordMixedRNG *sRNGCollection;
|
||||
|
||||
int RecordMixedRNG_SaveSize()
|
||||
{
|
||||
return sizeof(RecordMixedRNG) * RECORD_MIXED_RNG_MAX;
|
||||
}
|
||||
|
||||
void RecordMixedRNG_CopyEntry(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry srcEntry, enum RecordMixedRNGEntry destEntry)
|
||||
{
|
||||
rngCollection[destEntry] = rngCollection[srcEntry];
|
||||
}
|
||||
|
||||
void RecordMixedRNG_Init(RecordMixedRNG *rngCollection)
|
||||
{
|
||||
MI_CpuClearFast(rngCollection, sizeof(RecordMixedRNG) * RECORD_MIXED_RNG_MAX);
|
||||
|
||||
for (int entry = 0; entry < RECORD_MIXED_RNG_MAX; entry++) {
|
||||
rngCollection[entry].groupName[0] = CHAR_EOS;
|
||||
rngCollection[entry].playerName[0] = CHAR_EOS;
|
||||
}
|
||||
|
||||
sRNGCollection = rngCollection;
|
||||
}
|
||||
|
||||
void RecordMixedRNG_AdvanceEntries(RecordMixedRNG *rngCollection, u32 stepCount)
|
||||
{
|
||||
for (u32 i = 0; i < RECORD_MIXED_RNG_MAX; i++) {
|
||||
for (u32 j = 0; j < stepCount; j++) {
|
||||
rngCollection[i].rand = ARNG_Next(rngCollection[i].rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 RecordMixedRNG_GetEntrySeed(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry)
|
||||
{
|
||||
return rngCollection[entry].seed;
|
||||
}
|
||||
|
||||
void RecordMixedRNG_SetEntrySeed(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry, u32 seed)
|
||||
{
|
||||
rngCollection[entry].seed = seed;
|
||||
rngCollection[entry].rand = ARNG_Next(seed);
|
||||
}
|
||||
|
||||
u32 RecordMixedRNG_GetRand(RecordMixedRNG *rngCollection)
|
||||
{
|
||||
return rngCollection[RECORD_MIXED_RNG_PLAYER_OVERRIDE].rand;
|
||||
}
|
||||
|
||||
const charcode_t *RecordMixedRNG_GetEntryName(const RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry, enum RecordMixedRNGName nameChoice)
|
||||
{
|
||||
if (nameChoice == RECORD_MIXED_RNG_GROUP_NAME) {
|
||||
return rngCollection[entry].groupName;
|
||||
}
|
||||
|
||||
return rngCollection[entry].playerName;
|
||||
}
|
||||
|
||||
void RecordMixedRNG_GetEntryNameAsStrbuf(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry, enum RecordMixedRNGName nameChoice, Strbuf *outStrbuf)
|
||||
{
|
||||
charcode_t *name;
|
||||
if (nameChoice == RECORD_MIXED_RNG_GROUP_NAME) {
|
||||
name = rngCollection[entry].groupName;
|
||||
Strbuf_ToChars(outStrbuf, name, UNION_GROUP_NAME_LEN + 1);
|
||||
} else {
|
||||
name = rngCollection[entry].playerName;
|
||||
Strbuf_ToChars(outStrbuf, name, TRAINER_NAME_LEN + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void RecordMixedRNG_SetEntryGender(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry, int gender)
|
||||
{
|
||||
rngCollection[entry].gender = gender;
|
||||
}
|
||||
|
||||
int RecordMixedRNG_GetEntryGender(const RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry)
|
||||
{
|
||||
return rngCollection[entry].gender;
|
||||
}
|
||||
|
||||
int RecordMixedRNG_GetEntryCountryCode(const RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry)
|
||||
{
|
||||
return rngCollection[entry].countryCode;
|
||||
}
|
||||
|
||||
void RecordMixedRNG_SetEntryCountryCode(RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry, int countryCode)
|
||||
{
|
||||
rngCollection[entry].countryCode = countryCode;
|
||||
}
|
||||
|
||||
RecordMixedRNG *SaveData_GetRecordMixedRNG(SaveData *saveData)
|
||||
{
|
||||
return SaveData_SaveTable(saveData, SAVE_TABLE_ENTRY_RECORD_MIXED_RNG);
|
||||
}
|
||||
|
||||
BOOL RecordMixedRNG_IsEntryValid(const RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry)
|
||||
{
|
||||
return !RecordMixedRNG_IsEntryEmpty(&rngCollection[entry]);
|
||||
}
|
||||
|
||||
BOOL RecordMixedRNG_IsEntryEqualToOverride(const RecordMixedRNG *rngCollection, enum RecordMixedRNGEntry entry)
|
||||
{
|
||||
return RecordMixedRNG_AreEntriesEqual(&rngCollection[RECORD_MIXED_RNG_PLAYER_OVERRIDE], &rngCollection[entry]);
|
||||
}
|
||||
|
||||
BOOL RecordMixedRNG_DoesCollectionContainGroup(const RecordMixedRNG *rngCollection, const charcode_t *groupName)
|
||||
{
|
||||
if (*groupName == CHAR_EOS) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (int entry = 0; entry < RECORD_MIXED_RNG_MAX; entry++) {
|
||||
if (!CharCode_CompareNumChars(groupName, rngCollection[entry].groupName, UNION_GROUP_NAME_LEN + 1)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL RecordMixedRNG_IsEntryEmpty(const RecordMixedRNG *entry)
|
||||
{
|
||||
if (entry->groupName[0] == CHAR_EOS) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (entry->playerName[0] == CHAR_EOS) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL RecordMixedRNG_AreEntriesEqual(const RecordMixedRNG *entry1, const RecordMixedRNG *entry2)
|
||||
{
|
||||
if (CharCode_CompareNumChars(entry1->playerName, entry2->playerName, TRAINER_NAME_LEN + 1)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (CharCode_CompareNumChars(entry1->groupName, entry2->groupName, UNION_GROUP_NAME_LEN + 1)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (entry1->gender != entry2->gender) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (entry1->countryCode != entry2->countryCode) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (entry1->seed != entry2->seed) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
#include "party.h"
|
||||
#include "poffin.h"
|
||||
#include "poketch_data.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "save_player.h"
|
||||
#include "savedata.h"
|
||||
#include "savedata_misc.h"
|
||||
|
|
@ -23,7 +24,6 @@
|
|||
#include "unk_0202854C.h"
|
||||
#include "unk_020298BC.h"
|
||||
#include "unk_0202ACE0.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_0202C7FC.h"
|
||||
#include "unk_0202C858.h"
|
||||
#include "unk_0202C9F4.h"
|
||||
|
|
@ -63,7 +63,7 @@ const SaveTableEntry gSaveTable[] = {
|
|||
{ SAVE_TABLE_ENTRY_IMAGE_CLIPS, SAVE_BLOCK_ID_NORMAL, (SaveEntrySizeFunc)ImageClip_SaveSize, (SaveEntryInitFunc)ImageClip_Init },
|
||||
{ SAVE_TABLE_ENTRY_MAIL, SAVE_BLOCK_ID_NORMAL, (SaveEntrySizeFunc)Mail_SaveSize, (SaveEntryInitFunc)Mail_Init },
|
||||
{ SAVE_TABLE_ENTRY_POFFINS, SAVE_BLOCK_ID_NORMAL, (SaveEntrySizeFunc)Poffin_SaveSize, (SaveEntryInitFunc)Poffin_Init },
|
||||
{ SAVE_TABLE_ENTRY_RANDOM_GROUP, SAVE_BLOCK_ID_NORMAL, (SaveEntrySizeFunc)RandomGroup_SaveSize, (SaveEntryInitFunc)RandomGroup_Init },
|
||||
{ SAVE_TABLE_ENTRY_RECORD_MIXED_RNG, SAVE_BLOCK_ID_NORMAL, (SaveEntrySizeFunc)RecordMixedRNG_SaveSize, (SaveEntryInitFunc)RecordMixedRNG_Init },
|
||||
{ SAVE_TABLE_ENTRY_JOURNAL, SAVE_BLOCK_ID_NORMAL, (SaveEntrySizeFunc)Journal_SaveSize, (SaveEntryInitFunc)Journal_Init10 },
|
||||
{ SAVE_TABLE_ENTRY_TRAINER_CARD, SAVE_BLOCK_ID_NORMAL, (SaveEntrySizeFunc)TrainerCard_SaveSize, (SaveEntryInitFunc)TrainerCard_Init },
|
||||
{ SAVE_TABLE_ENTRY_GAME_RECORDS, SAVE_BLOCK_ID_NORMAL, (SaveEntrySizeFunc)GameRecords_SaveSize, (SaveEntryInitFunc)GameRecords_Init },
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
#include "consts/gender.h"
|
||||
#include "consts/moves.h"
|
||||
|
||||
#include "struct_decls/struct_0202B4A0_decl.h"
|
||||
#include "struct_decls/struct_020797DC_decl.h"
|
||||
#include "struct_defs/trainer_data.h"
|
||||
|
||||
|
|
@ -26,6 +25,7 @@
|
|||
#include "heap.h"
|
||||
#include "message.h"
|
||||
#include "pokemon.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "save_player.h"
|
||||
#include "savedata.h"
|
||||
#include "savedata_misc.h"
|
||||
|
|
@ -33,7 +33,6 @@
|
|||
#include "trainer_info.h"
|
||||
#include "unk_02014D38.h"
|
||||
#include "unk_02017038.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_020797C8.h"
|
||||
#include "unk_020996D0.h"
|
||||
|
||||
|
|
@ -526,13 +525,13 @@ void StringTemplate_SetUnionGroupName(StringTemplate *template, SaveData *save,
|
|||
{
|
||||
int gender, countryCode;
|
||||
Strbuf *groupName;
|
||||
UnkStruct_0202B4A0 *group = sub_0202B4A0(save);
|
||||
RecordMixedRNG *group = SaveData_GetRecordMixedRNG(save);
|
||||
|
||||
gender = sub_0202B47C(group, groupID);
|
||||
countryCode = sub_0202B488(group, groupID);
|
||||
gender = RecordMixedRNG_GetEntryGender(group, groupID);
|
||||
countryCode = RecordMixedRNG_GetEntryCountryCode(group, groupID);
|
||||
groupName = Strbuf_Init(64, HEAP_ID_FIELD);
|
||||
|
||||
Strbuf_CopyChars(groupName, sub_0202B42C(group, groupID, nameType));
|
||||
Strbuf_CopyChars(groupName, RecordMixedRNG_GetEntryName(group, groupID, nameType));
|
||||
StringTemplate_SetStrbuf(template, idx, groupName, gender, 1, countryCode);
|
||||
Strbuf_Free(groupName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,188 +0,0 @@
|
|||
#include "unk_0202B37C.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "struct_defs/struct_0202B4A0.h"
|
||||
#include "struct_defs/struct_0202B510.h"
|
||||
|
||||
#include "charcode_util.h"
|
||||
#include "savedata.h"
|
||||
#include "strbuf.h"
|
||||
#include "unk_0201D15C.h"
|
||||
|
||||
UnkStruct_0202B4A0 *Unk_021C079C;
|
||||
|
||||
int RandomGroup_SaveSize(void)
|
||||
{
|
||||
return sizeof(UnkStruct_0202B4A0);
|
||||
}
|
||||
|
||||
void sub_0202B384(UnkStruct_0202B4A0 *param0, int param1, int param2)
|
||||
{
|
||||
param0->unk_00[param2] = param0->unk_00[param1];
|
||||
}
|
||||
|
||||
void RandomGroup_Init(UnkStruct_0202B4A0 *param0)
|
||||
{
|
||||
int v0;
|
||||
|
||||
MI_CpuClearFast(param0, sizeof(UnkStruct_0202B4A0));
|
||||
|
||||
for (v0 = 0; v0 < 6; v0++) {
|
||||
param0->unk_00[v0].unk_00[0] = 0xffff;
|
||||
param0->unk_00[v0].unk_10[0] = 0xffff;
|
||||
}
|
||||
|
||||
Unk_021C079C = param0;
|
||||
}
|
||||
|
||||
void sub_0202B3D8(UnkStruct_0202B4A0 *param0, u32 param1)
|
||||
{
|
||||
u32 v0, v1;
|
||||
|
||||
for (v0 = 0; v0 < 6; v0++) {
|
||||
for (v1 = 0; v1 < param1; v1++) {
|
||||
param0->unk_00[v0].unk_28 = ARNG_Next(param0->unk_00[v0].unk_28);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0202B400(UnkStruct_0202B4A0 *param0, int param1)
|
||||
{
|
||||
return param0->unk_00[param1].unk_24;
|
||||
}
|
||||
|
||||
void sub_0202B40C(UnkStruct_0202B4A0 *param0, int param1, u32 param2)
|
||||
{
|
||||
param0->unk_00[param1].unk_24 = param2;
|
||||
param0->unk_00[param1].unk_28 = ARNG_Next(param2);
|
||||
}
|
||||
|
||||
u32 sub_0202B428(UnkStruct_0202B4A0 *param0)
|
||||
{
|
||||
return param0->unk_00[1].unk_28;
|
||||
}
|
||||
|
||||
const u16 *sub_0202B42C(const UnkStruct_0202B4A0 *param0, int param1, int param2)
|
||||
{
|
||||
if (param2 == 0) {
|
||||
return param0->unk_00[param1].unk_00;
|
||||
}
|
||||
|
||||
return param0->unk_00[param1].unk_10;
|
||||
}
|
||||
|
||||
void sub_0202B444(UnkStruct_0202B4A0 *param0, int param1, int param2, Strbuf *param3)
|
||||
{
|
||||
u16 *v0;
|
||||
|
||||
if (param2 == 0) {
|
||||
v0 = param0->unk_00[param1].unk_00;
|
||||
Strbuf_ToChars(param3, v0, 7 + 1);
|
||||
} else {
|
||||
v0 = param0->unk_00[param1].unk_10;
|
||||
Strbuf_ToChars(param3, v0, 7 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0202B470(UnkStruct_0202B4A0 *param0, int param1, int param2)
|
||||
{
|
||||
param0->unk_00[param1].unk_20 = param2;
|
||||
}
|
||||
|
||||
int sub_0202B47C(const UnkStruct_0202B4A0 *param0, int param1)
|
||||
{
|
||||
return param0->unk_00[param1].unk_20;
|
||||
}
|
||||
|
||||
int sub_0202B488(const UnkStruct_0202B4A0 *param0, int param1)
|
||||
{
|
||||
return param0->unk_00[param1].unk_21;
|
||||
}
|
||||
|
||||
void sub_0202B494(UnkStruct_0202B4A0 *param0, int param1, int param2)
|
||||
{
|
||||
param0->unk_00[param1].unk_21 = param2;
|
||||
}
|
||||
|
||||
UnkStruct_0202B4A0 *sub_0202B4A0(SaveData *param0)
|
||||
{
|
||||
return (UnkStruct_0202B4A0 *)SaveData_SaveTable(param0, 17);
|
||||
}
|
||||
|
||||
BOOL sub_0202B4AC(const UnkStruct_0202B4A0 *param0, int param1)
|
||||
{
|
||||
const UnkStruct_0202B510 *v0 = ¶m0->unk_00[param1];
|
||||
return !(sub_0202B510(v0));
|
||||
}
|
||||
|
||||
BOOL sub_0202B4C4(const UnkStruct_0202B4A0 *param0, int param1)
|
||||
{
|
||||
const UnkStruct_0202B510 *v0, *v1;
|
||||
|
||||
v0 = ¶m0->unk_00[1];
|
||||
v1 = ¶m0->unk_00[param1];
|
||||
|
||||
return sub_0202B530(v0, v1);
|
||||
}
|
||||
|
||||
BOOL sub_0202B4D8(const UnkStruct_0202B4A0 *param0, const u16 *param1)
|
||||
{
|
||||
int v0;
|
||||
const UnkStruct_0202B510 *v1;
|
||||
|
||||
if (*param1 == 0xffff) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (v0 = 0; v0 < 6; v0++) {
|
||||
v1 = ¶m0->unk_00[v0];
|
||||
|
||||
if (!CharCode_CompareNumChars(param1, v1->unk_00, 7 + 1)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL sub_0202B510(const UnkStruct_0202B510 *param0)
|
||||
{
|
||||
if (param0->unk_00[0] == 0xffff) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (param0->unk_10[0] == 0xffff) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL sub_0202B530(const UnkStruct_0202B510 *param0, const UnkStruct_0202B510 *param1)
|
||||
{
|
||||
int v0;
|
||||
|
||||
if (CharCode_CompareNumChars(param0->unk_10, param1->unk_10, 7 + 1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (CharCode_CompareNumChars(param0->unk_00, param1->unk_00, 7 + 1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (param0->unk_20 != param1->unk_20) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (param0->unk_21 != param1->unk_21) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (param0->unk_24 != param1->unk_24) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -15,11 +15,11 @@
|
|||
#include "charcode_util.h"
|
||||
#include "game_records.h"
|
||||
#include "heap.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "save_player.h"
|
||||
#include "savedata.h"
|
||||
#include "strbuf.h"
|
||||
#include "trainer_info.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_0203061C.h"
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -195,7 +195,7 @@ void *sub_0202E9FC(SaveData *param0, int param1)
|
|||
v3 = Heap_AllocFromHeapAtEnd(param1, sizeof(UnkStruct_0202E91C));
|
||||
MI_CpuClear8(v3, sizeof(UnkStruct_0202E91C));
|
||||
|
||||
v1 = sub_0202B400(sub_0202B4A0(param0), 1);
|
||||
v1 = RecordMixedRNG_GetEntrySeed(SaveData_GetRecordMixedRNG(param0), 1);
|
||||
v4 = TrainerInfo_NameNewStrbuf(v5, param1);
|
||||
v6 = sub_0202E924(param0, param1);
|
||||
|
||||
|
|
@ -357,7 +357,7 @@ void sub_0202ED0C(SaveData *param0, int param1, u8 param2, const void **param3,
|
|||
UnkStruct_0202EE10 *v5;
|
||||
|
||||
v4 = sub_0202E8C0(param0);
|
||||
v2 = sub_0202B400(sub_0202B4A0(param0), 1);
|
||||
v2 = RecordMixedRNG_GetEntrySeed(SaveData_GetRecordMixedRNG(param0), 1);
|
||||
v1 = 0;
|
||||
|
||||
for (v0 = 0; v0 < param2; v0++) {
|
||||
|
|
@ -398,7 +398,7 @@ UnkStruct_0202EE10 *sub_0202ED8C(SaveData *param0, int param1, int param2)
|
|||
|
||||
MI_CpuClear8(v3, sizeof(UnkStruct_0202EE10));
|
||||
|
||||
v2 = sub_0202B400(sub_0202B4A0(param0), 1);
|
||||
v2 = RecordMixedRNG_GetEntrySeed(SaveData_GetRecordMixedRNG(param0), 1);
|
||||
v4 = sub_0202E924(param0, param2);
|
||||
v3->unk_00 = sub_0202E840(param1);
|
||||
v1 = sub_0202E84C(param1);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
#include "struct_decls/struct_02029C68_decl.h"
|
||||
#include "struct_decls/struct_02029D04_decl.h"
|
||||
#include "struct_decls/struct_0202A750_decl.h"
|
||||
#include "struct_decls/struct_0202B4A0_decl.h"
|
||||
#include "struct_decls/struct_0202C834_decl.h"
|
||||
#include "struct_decls/struct_020508D4_decl.h"
|
||||
#include "struct_decls/struct_0207AE68_decl.h"
|
||||
|
|
@ -101,6 +100,7 @@
|
|||
#include "pokemon.h"
|
||||
#include "pokemon_summary_app.h"
|
||||
#include "poketch_data.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "rtc.h"
|
||||
#include "save_player.h"
|
||||
#include "savedata.h"
|
||||
|
|
@ -114,7 +114,6 @@
|
|||
#include "unk_02028124.h"
|
||||
#include "unk_020298BC.h"
|
||||
#include "unk_0202ACE0.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_0202C7FC.h"
|
||||
#include "unk_0202C858.h"
|
||||
#include "unk_0202D05C.h"
|
||||
|
|
@ -1201,9 +1200,9 @@ static BOOL sub_0203DE98(TaskManager *param0)
|
|||
}
|
||||
} else if (v2->unk_0C->unk_00 == 5) {
|
||||
const u16 *v3 = Strbuf_GetData(v2->unk_0C->unk_18);
|
||||
UnkStruct_0202B4A0 *v4 = sub_0202B4A0(fieldSystem->saveData);
|
||||
RecordMixedRNG *v4 = SaveData_GetRecordMixedRNG(fieldSystem->saveData);
|
||||
|
||||
if (sub_0202B4D8(v4, v3)) {
|
||||
if (RecordMixedRNG_DoesCollectionContainGroup(v4, v3)) {
|
||||
v2->unk_0C->unk_14 = 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -1244,8 +1243,8 @@ static void sub_0203DF68(TaskManager *param0)
|
|||
Pokemon_SetValue(v3, MON_DATA_NICKNAME_AND_FLAG, (u8 *)&v1->unk_0C->unk_1C);
|
||||
} break;
|
||||
case 5: {
|
||||
UnkStruct_0202B4A0 *v5 = sub_0202B4A0(fieldSystem->saveData);
|
||||
sub_0202B444(v5, 0, 0, v1->unk_0C->unk_18);
|
||||
RecordMixedRNG *v5 = SaveData_GetRecordMixedRNG(fieldSystem->saveData);
|
||||
RecordMixedRNG_GetEntryNameAsStrbuf(v5, 0, 0, v1->unk_0C->unk_18);
|
||||
} break;
|
||||
case 6: {
|
||||
MiscSaveBlock *v6 = SaveData_MiscSaveBlock(fieldSystem->saveData);
|
||||
|
|
@ -1620,14 +1619,14 @@ static u8 sub_0203E484(SaveData *param0, u8 param1)
|
|||
3,
|
||||
3,
|
||||
};
|
||||
UnkStruct_0202B4A0 *v1 = sub_0202B4A0(param0);
|
||||
RecordMixedRNG *v1 = SaveData_GetRecordMixedRNG(param0);
|
||||
u32 v2;
|
||||
u8 v3[12];
|
||||
u8 v4, v5, v6, v7;
|
||||
|
||||
v2 = LCRNG_GetSeed();
|
||||
|
||||
LCRNG_SetSeed(sub_0202B428(v1));
|
||||
LCRNG_SetSeed(RecordMixedRNG_GetRand(v1));
|
||||
MI_CpuCopy8(v0, v3, sizeof(v3));
|
||||
|
||||
for (v4 = 0; v4 < 12; v4++) {
|
||||
|
|
|
|||
|
|
@ -3,10 +3,9 @@
|
|||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "struct_decls/struct_0202B4A0_decl.h"
|
||||
|
||||
#include "field_script_context.h"
|
||||
#include "inlines.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "save_player.h"
|
||||
#include "savedata.h"
|
||||
#include "script_manager.h"
|
||||
|
|
@ -14,14 +13,13 @@
|
|||
#include "string_template.h"
|
||||
#include "trainer_info.h"
|
||||
#include "unk_0201D15C.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_0203D1B8.h"
|
||||
#include "unk_0206CCB0.h"
|
||||
|
||||
BOOL ScrCmd_21D(ScriptContext *param0)
|
||||
{
|
||||
StringTemplate **v0 = FieldSystem_GetScriptMemberPtr(param0->fieldSystem, SCRIPT_MANAGER_STR_TEMPLATE);
|
||||
UnkStruct_0202B4A0 *v1 = sub_0202B4A0(param0->fieldSystem->saveData);
|
||||
RecordMixedRNG *v1 = SaveData_GetRecordMixedRNG(param0->fieldSystem->saveData);
|
||||
SaveData *v2 = param0->fieldSystem->saveData;
|
||||
|
||||
switch (ScriptContext_ReadHalfWord(param0)) {
|
||||
|
|
@ -31,7 +29,7 @@ BOOL ScrCmd_21D(ScriptContext *param0)
|
|||
|
||||
v3 = ScriptContext_GetVar(param0);
|
||||
v4 = ScriptContext_GetVarPointer(param0);
|
||||
*v4 = sub_0202B4AC(v1, v3);
|
||||
*v4 = RecordMixedRNG_IsEntryValid(v1, v3);
|
||||
|
||||
return 0;
|
||||
} break;
|
||||
|
|
@ -41,7 +39,7 @@ BOOL ScrCmd_21D(ScriptContext *param0)
|
|||
|
||||
v5 = ScriptContext_GetVar(param0);
|
||||
v6 = ScriptContext_GetVarPointer(param0);
|
||||
*v6 = sub_0202B4C4(v1, v5);
|
||||
*v6 = RecordMixedRNG_IsEntryEqualToOverride(v1, v5);
|
||||
|
||||
return 0;
|
||||
} break;
|
||||
|
|
@ -64,15 +62,15 @@ BOOL ScrCmd_21D(ScriptContext *param0)
|
|||
case 4: {
|
||||
const u16 *v11;
|
||||
|
||||
v11 = sub_0202B42C(v1, 0, 0);
|
||||
v11 = RecordMixedRNG_GetEntryName(v1, 0, 0);
|
||||
sub_0203DFE8(param0->taskManager, 5, 0, 7, 0, v11, ScriptContext_GetVarPointer(param0));
|
||||
}
|
||||
return 1;
|
||||
case 5: {
|
||||
u16 v12 = ScriptContext_GetVar(param0);
|
||||
BOOL v13 = sub_0202B4AC(v1, 1);
|
||||
BOOL v13 = RecordMixedRNG_IsEntryValid(v1, 1);
|
||||
|
||||
sub_0202B384(v1, v12, 1);
|
||||
RecordMixedRNG_CopyEntry(v1, v12, 1);
|
||||
|
||||
if (v13) {
|
||||
sub_0206D430(param0->fieldSystem);
|
||||
|
|
@ -84,12 +82,12 @@ BOOL ScrCmd_21D(ScriptContext *param0)
|
|||
TrainerInfo *v15 = SaveData_GetTrainerInfo(param0->fieldSystem->saveData);
|
||||
|
||||
TrainerInfo_NameStrbuf(v15, v14);
|
||||
sub_0202B444(v1, 0, 1, v14);
|
||||
sub_0202B470(v1, 0, TrainerInfo_Gender(v15));
|
||||
sub_0202B494(v1, 0, GAME_LANGUAGE);
|
||||
sub_0202B40C(v1, 0, MTRNG_Next());
|
||||
RecordMixedRNG_GetEntryNameAsStrbuf(v1, 0, 1, v14);
|
||||
RecordMixedRNG_SetEntryGender(v1, 0, TrainerInfo_Gender(v15));
|
||||
RecordMixedRNG_SetEntryCountryCode(v1, 0, GAME_LANGUAGE);
|
||||
RecordMixedRNG_SetEntrySeed(v1, 0, MTRNG_Next());
|
||||
Strbuf_Free(v14);
|
||||
sub_0202B384(v1, 0, 1);
|
||||
RecordMixedRNG_CopyEntry(v1, 0, 1);
|
||||
sub_0206D424(param0->fieldSystem);
|
||||
} break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
#include "inlines.h"
|
||||
#include "party.h"
|
||||
#include "pokemon.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "rtc.h"
|
||||
#include "script_manager.h"
|
||||
#include "system_data.h"
|
||||
#include "unk_0202854C.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_0202C858.h"
|
||||
#include "unk_0202D7A8.h"
|
||||
#include "unk_0202E2CC.h"
|
||||
|
|
@ -92,8 +92,8 @@ static void sub_02055AC0(FieldSystem *fieldSystem, s32 param1)
|
|||
sub_02028658(FieldSystem_GetSaveData(fieldSystem), param1);
|
||||
sub_0203F1FC(fieldSystem);
|
||||
sub_0206C2D0(fieldSystem->saveData, param1);
|
||||
sub_0202B3D8(sub_0202B4A0(fieldSystem->saveData), param1);
|
||||
sub_0202D80C(sub_0202D834(fieldSystem->saveData), sub_0202B428(sub_0202B4A0(fieldSystem->saveData)));
|
||||
RecordMixedRNG_AdvanceEntries(SaveData_GetRecordMixedRNG(fieldSystem->saveData), param1);
|
||||
sub_0202D80C(sub_0202D834(fieldSystem->saveData), RecordMixedRNG_GetRand(SaveData_GetRecordMixedRNG(fieldSystem->saveData)));
|
||||
|
||||
{
|
||||
Party *v0;
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
#include "field_overworld_state.h"
|
||||
#include "location.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "savedata.h"
|
||||
#include "unk_0201D15C.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_0206A8DC.h"
|
||||
#include "vars_flags.h"
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ void sub_0206B2E4(SaveData *param0, u16 param1)
|
|||
VarsFlags *v0 = SaveData_GetVarsFlags(param0);
|
||||
u32 v1;
|
||||
|
||||
v1 = sub_0202B428(sub_0202B4A0(param0));
|
||||
v1 = RecordMixedRNG_GetRand(SaveData_GetRecordMixedRNG(param0));
|
||||
v1 = v1 * 1103515245L + 12345;
|
||||
|
||||
sub_0206B280(v0, v1);
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@
|
|||
#include "heap.h"
|
||||
#include "party.h"
|
||||
#include "pokemon_summary_app.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "save_player.h"
|
||||
#include "savedata.h"
|
||||
#include "script_manager.h"
|
||||
#include "unk_0202854C.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_0202D05C.h"
|
||||
#include "unk_0202D778.h"
|
||||
#include "unk_0203061C.h"
|
||||
|
|
@ -476,7 +476,7 @@ u32 sub_0206C008(SaveData *param0)
|
|||
{
|
||||
u32 v0;
|
||||
|
||||
v0 = sub_0202B428(sub_0202B4A0(param0));
|
||||
v0 = RecordMixedRNG_GetRand(SaveData_GetRecordMixedRNG(param0));
|
||||
v0 = sub_0206BFFC(v0);
|
||||
|
||||
sub_0202D470(sub_0202D750(param0), v0);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
#include "struct_decls/struct_02027854_decl.h"
|
||||
#include "struct_decls/struct_02029C68_decl.h"
|
||||
#include "struct_decls/struct_0202A750_decl.h"
|
||||
#include "struct_decls/struct_0202B4A0_decl.h"
|
||||
#include "struct_decls/struct_party_decl.h"
|
||||
#include "struct_defs/struct_0202D7B0.h"
|
||||
#include "struct_defs/struct_0202E7D8.h"
|
||||
|
|
@ -42,6 +41,7 @@
|
|||
#include "message.h"
|
||||
#include "party.h"
|
||||
#include "pokemon.h"
|
||||
#include "record_mixed_rng.h"
|
||||
#include "roaming_pokemon.h"
|
||||
#include "save_player.h"
|
||||
#include "savedata.h"
|
||||
|
|
@ -53,7 +53,6 @@
|
|||
#include "unk_0202631C.h"
|
||||
#include "unk_02027B70.h"
|
||||
#include "unk_020298BC.h"
|
||||
#include "unk_0202B37C.h"
|
||||
#include "unk_0202D7A8.h"
|
||||
#include "unk_0202E2CC.h"
|
||||
#include "unk_0203A944.h"
|
||||
|
|
@ -822,12 +821,12 @@ static void sub_0206D3E4(FieldSystem *fieldSystem, int param1)
|
|||
{
|
||||
UnkUnion_0206D1B8 v0;
|
||||
UnkStruct_0206D43C *v1 = &v0.val4;
|
||||
UnkStruct_0202B4A0 *v2 = sub_0202B4A0(fieldSystem->saveData);
|
||||
RecordMixedRNG *v2 = SaveData_GetRecordMixedRNG(fieldSystem->saveData);
|
||||
|
||||
GF_ASSERT(sizeof(UnkUnion_0206D1B8) == 40);
|
||||
MI_CpuClearFast(&v0, 40);
|
||||
|
||||
CharCode_CopyNumChars(v1->unk_00, sub_0202B42C(v2, 1, 0), 10 + 1);
|
||||
CharCode_CopyNumChars(v1->unk_00, RecordMixedRNG_GetEntryName(v2, 1, 0), 10 + 1);
|
||||
sub_0206CD70(fieldSystem, 2, param1, v1);
|
||||
}
|
||||
|
||||
|
|
@ -2044,12 +2043,12 @@ static const u8 Unk_020EFD34[] = {
|
|||
0x5
|
||||
};
|
||||
|
||||
static int sub_0206E848(UnkStruct_0202B4A0 *param0)
|
||||
static int sub_0206E848(RecordMixedRNG *param0)
|
||||
{
|
||||
int v0, v1;
|
||||
|
||||
for (v0 = 0, v1 = 0; v0 < NELEMS(Unk_020EFD34); v0++) {
|
||||
if (sub_0202B4AC(param0, Unk_020EFD34[v0])) {
|
||||
if (RecordMixedRNG_IsEntryValid(param0, Unk_020EFD34[v0])) {
|
||||
v1++;
|
||||
}
|
||||
}
|
||||
|
|
@ -2061,7 +2060,7 @@ static int sub_0206E870(FieldSystem *fieldSystem, StringTemplate *param1, UnkStr
|
|||
{
|
||||
int v0, v1, v2;
|
||||
int v3;
|
||||
UnkStruct_0202B4A0 *v4 = sub_0202B4A0(fieldSystem->saveData);
|
||||
RecordMixedRNG *v4 = SaveData_GetRecordMixedRNG(fieldSystem->saveData);
|
||||
|
||||
v1 = sub_0206E848(v4);
|
||||
GF_ASSERT(v1 > 0);
|
||||
|
|
@ -2073,7 +2072,7 @@ static int sub_0206E870(FieldSystem *fieldSystem, StringTemplate *param1, UnkStr
|
|||
}
|
||||
|
||||
for (v0 = 0; v0 < NELEMS(Unk_020EFD34); v0++) {
|
||||
if (sub_0202B4AC(v4, Unk_020EFD34[v0])) {
|
||||
if (RecordMixedRNG_IsEntryValid(v4, Unk_020EFD34[v0])) {
|
||||
if (v1 == 0) {
|
||||
v2 = Unk_020EFD34[v0];
|
||||
break;
|
||||
|
|
@ -2100,7 +2099,7 @@ static int sub_0206E870(FieldSystem *fieldSystem, StringTemplate *param1, UnkStr
|
|||
|
||||
static BOOL sub_0206E928(FieldSystem *fieldSystem, UnkStruct_ov6_022465F4 *param1)
|
||||
{
|
||||
UnkStruct_0202B4A0 *v0 = sub_0202B4A0(fieldSystem->saveData);
|
||||
RecordMixedRNG *v0 = SaveData_GetRecordMixedRNG(fieldSystem->saveData);
|
||||
|
||||
if (sub_0206E848(v0) != 0) {
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user