mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-09-13 04:06:04 -05:00
Merge pull request #345 from TheSylphIsIn/main
Some checks are pending
build / build (push) Waiting to run
Some checks are pending
build / build (push) Waiting to run
Great Marsh lookout documentation
This commit is contained in:
2
.github/workflows/pr-lint.yml
vendored
2
.github/workflows/pr-lint.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
with:
|
||||
style: 'file' # Use repository .clang-format file
|
||||
tidy-checks: '-*' # Disable clang-tidy checks
|
||||
version: '18'
|
||||
version: '19'
|
||||
files-changed-only: false # Github returns error code 406 if more than 300 files are changed in a PR
|
||||
ignore: '.github|lib|subprojects|tools'
|
||||
file-annotations: false
|
||||
|
||||
@@ -2797,7 +2797,7 @@
|
||||
.short 517
|
||||
.endm
|
||||
|
||||
.macro ScrCmd_206
|
||||
.macro StartGreatMarshLookout
|
||||
.short 518
|
||||
.endm
|
||||
|
||||
|
||||
10
include/great_marsh_lookout.h
Normal file
10
include/great_marsh_lookout.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef POKEPLATINUM_GREAT_MARSH_LOOKOUT_H
|
||||
#define POKEPLATINUM_GREAT_MARSH_LOOKOUT_H
|
||||
|
||||
#include "field/field_system_decl.h"
|
||||
|
||||
#define BINOCULARS_CYCLE_COUNT 5
|
||||
|
||||
void GreatMarshLookout_Init(FieldSystem *fieldSystem);
|
||||
|
||||
#endif // POKEPLATINUM_GREAT_MARSH_LOOKOUT_H
|
||||
@@ -158,19 +158,18 @@ static inline u16 ScriptContext_GetVar(ScriptContext *ctx)
|
||||
return FieldSystem_TryGetVar(ctx->fieldSystem, ScriptContext_ReadHalfWord(ctx));
|
||||
}
|
||||
|
||||
inline u16 inline_020564D0(const u16 param0)
|
||||
// Functionally equivalent to LCRNG_Next() % param
|
||||
inline u16 LCRNG_RandMod(const u16 param)
|
||||
{
|
||||
GF_ASSERT(param0 != 0);
|
||||
GF_ASSERT(param != 0);
|
||||
|
||||
if (param0 <= 1) {
|
||||
if (param <= 1) {
|
||||
return 0;
|
||||
} else {
|
||||
u16 v0;
|
||||
u16 v1;
|
||||
v0 = (0xffff / param0) + 1;
|
||||
v1 = LCRNG_Next() / v0;
|
||||
u16 v0 = (0xffff / param) + 1;
|
||||
u16 v1 = LCRNG_Next() / v0;
|
||||
|
||||
GF_ASSERT(v1 < param0);
|
||||
GF_ASSERT(v1 < param);
|
||||
return v1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef POKEPLATINUM_OV6_022477B8_H
|
||||
#define POKEPLATINUM_OV6_022477B8_H
|
||||
#ifndef POKEPLATINUM_DUAL_SLOT_ENCOUNTERS_H
|
||||
#define POKEPLATINUM_DUAL_SLOT_ENCOUNTERS_H
|
||||
|
||||
#include "overlay006/wild_encounters.h"
|
||||
|
||||
void WildEncounters_ReplaceDualSlotEncounters(const WildEncounters *encounterData, const BOOL param1, int *param2, int *param3);
|
||||
|
||||
#endif // POKEPLATINUM_OV6_022477B8_H
|
||||
#endif // POKEPLATINUM_DUAL_SLOT_ENCOUNTERS_H
|
||||
28
include/overlay006/great_marsh_binoculars.h
Normal file
28
include/overlay006/great_marsh_binoculars.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef POKEPLATINUM_GREAT_MARSH_BINOCULARS_H
|
||||
#define POKEPLATINUM_GREAT_MARSH_BINOCULARS_H
|
||||
|
||||
#include "field/field_system_decl.h"
|
||||
|
||||
#include "great_marsh_lookout.h"
|
||||
#include "location.h"
|
||||
|
||||
typedef struct BinocularCoords {
|
||||
u16 x;
|
||||
u16 z;
|
||||
} BinocularCoords;
|
||||
|
||||
// Data used to control the map view displayed while using the Great Marsh lookout binoculars.
|
||||
typedef struct GreatMarshBinoculars {
|
||||
BinocularCoords coordsList[BINOCULARS_CYCLE_COUNT + 1];
|
||||
Location viewLocation;
|
||||
FieldSystem *fieldSystem;
|
||||
int lookoutMapId;
|
||||
} GreatMarshBinoculars;
|
||||
|
||||
int GreatMarshBinoculars_GetMonSpecies(FieldSystem *fieldSystem);
|
||||
GreatMarshBinoculars *GreatMarshBinoculars_InitData(const int heapId, FieldSystem *fieldSystem);
|
||||
void GreatMarshBinoculars_FreeData(GreatMarshBinoculars *data);
|
||||
void GreatMarshBinoculars_SetNextLocationWithCoords(const u8 cycleNum, GreatMarshBinoculars *binocularsData);
|
||||
Location *GreatMarshBinoculars_GetLocation(GreatMarshBinoculars *binocData);
|
||||
|
||||
#endif // POKEPLATINUM_GREAT_MARSH_BINOCULARS_H
|
||||
6
include/overlay006/great_marsh_daily_encounters.h
Normal file
6
include/overlay006/great_marsh_daily_encounters.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef POKEPLATINUM_MARSH_DAILY_ENCOUNTERS_H
|
||||
#define POKEPLATINUM_MARSH_DAILY_ENCOUNTERS_H
|
||||
|
||||
void ReplaceGreatMarshDailyEncounters(const int dailyMon, const BOOL nationalDexObtained, const int mapId, int *encounterSlot1, int *encounterSlot2);
|
||||
|
||||
#endif // POKEPLATINUM_MARSH_DAILY_ENCOUNTERS_H
|
||||
@@ -1,14 +1,31 @@
|
||||
#ifndef POKEPLATINUM_OV6_022426AC_H
|
||||
#define POKEPLATINUM_OV6_022426AC_H
|
||||
|
||||
#include "overlay006/struct_ov6_022426B8_decl.h"
|
||||
#include "struct_defs/archived_sprite.h"
|
||||
#include "struct_defs/struct_0200C738.h"
|
||||
|
||||
UnkStruct_ov6_022426B8 *ov6_022426AC(const int param0);
|
||||
void ov6_022426B8(UnkStruct_ov6_022426B8 *param0);
|
||||
void ov6_022426C0(UnkStruct_ov6_022426B8 *param0, const int param1);
|
||||
void ov6_022427F4(UnkStruct_ov6_022426B8 *param0);
|
||||
void ov6_02242814(UnkStruct_ov6_022426B8 *param0);
|
||||
BOOL ov6_02242820(UnkStruct_ov6_022426B8 *param0);
|
||||
void ov6_02242828(UnkStruct_ov6_022426B8 *param0);
|
||||
#include "cell_actor.h"
|
||||
#include "sprite_resource.h"
|
||||
|
||||
typedef struct GreatMarshLookout_SpriteResources {
|
||||
SpriteResourceCollection *unk_00[4];
|
||||
SpriteResource *unk_10[4];
|
||||
void *unk_20;
|
||||
void *unk_24;
|
||||
ArchivedSprite unk_28;
|
||||
CellActorCollection *unk_38;
|
||||
UnkStruct_0200C738 unk_3C;
|
||||
CellActor *unk_1C8;
|
||||
BOOL unk_1CC;
|
||||
BOOL unk_1D0;
|
||||
} GreatMarshLookout_SpriteResources;
|
||||
|
||||
GreatMarshLookout_SpriteResources *GreatMarshLookout_AllocSpriteResources(const int heapId);
|
||||
void GreatMarshLookout_FreeSpriteResources(GreatMarshLookout_SpriteResources *resources);
|
||||
void GreatMarshLookout_CreateLookoutMonSprite(GreatMarshLookout_SpriteResources *resources, const int species);
|
||||
void ov6_022427F4(GreatMarshLookout_SpriteResources *param0);
|
||||
void ov6_02242814(GreatMarshLookout_SpriteResources *param0);
|
||||
BOOL ov6_02242820(GreatMarshLookout_SpriteResources *param0);
|
||||
void ov6_02242828(GreatMarshLookout_SpriteResources *param0);
|
||||
|
||||
#endif // POKEPLATINUM_OV6_022426AC_H
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef POKEPLATINUM_OV6_02242984_H
|
||||
#define POKEPLATINUM_OV6_02242984_H
|
||||
|
||||
#include "field/field_system_decl.h"
|
||||
#include "overlay006/struct_ov6_02242A8C_decl.h"
|
||||
|
||||
#include "location.h"
|
||||
|
||||
int ov6_02242984(FieldSystem *fieldSystem);
|
||||
UnkStruct_ov6_02242A8C *ov6_02242A10(const int param0, FieldSystem *fieldSystem);
|
||||
void ov6_02242A8C(UnkStruct_ov6_02242A8C *param0);
|
||||
void ov6_02242A94(const u8 param0, UnkStruct_ov6_02242A8C *param1);
|
||||
Location *ov6_02242AEC(UnkStruct_ov6_02242A8C *param0);
|
||||
|
||||
#endif // POKEPLATINUM_OV6_02242984_H
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef POKEPLATINUM_OV6_02242F74_H
|
||||
#define POKEPLATINUM_OV6_02242F74_H
|
||||
|
||||
void ov6_02242F74(const int param0, const BOOL param1, const int param2, int *param3, int *param4);
|
||||
|
||||
#endif // POKEPLATINUM_OV6_02242F74_H
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef POKEPLATINUM_STRUCT_OV6_022426B8_DECL_H
|
||||
#define POKEPLATINUM_STRUCT_OV6_022426B8_DECL_H
|
||||
|
||||
typedef struct UnkStruct_ov6_022426B8_t UnkStruct_ov6_022426B8;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_OV6_022426B8_DECL_H
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef POKEPLATINUM_STRUCT_OV6_02242A8C_DECL_H
|
||||
#define POKEPLATINUM_STRUCT_OV6_02242A8C_DECL_H
|
||||
|
||||
typedef struct UnkStruct_ov6_02242A8C_t UnkStruct_ov6_02242A8C;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_OV6_02242A8C_DECL_H
|
||||
@@ -13,12 +13,12 @@
|
||||
#define ROAMING_SLOT_ARTICUNO (5)
|
||||
#define ROAMING_SLOT_MAX (6)
|
||||
|
||||
void sub_0206C33C(UnkStruct_0202D7B0 *param0, const u8 param1);
|
||||
void sub_0206C354(UnkStruct_0202D7B0 *param0);
|
||||
void sub_0206C37C(UnkStruct_0202D7B0 *param0);
|
||||
void sub_0206C33C(SpecialEncounter *param0, const u8 param1);
|
||||
void sub_0206C354(SpecialEncounter *param0);
|
||||
void sub_0206C37C(SpecialEncounter *param0);
|
||||
int sub_0206C3C8(const u8 param0);
|
||||
BOOL sub_0206C3E0(UnkStruct_0202D7B0 *param0);
|
||||
void sub_0206C404(UnkStruct_0202D7B0 *param0, const int param1);
|
||||
BOOL sub_0206C3E0(SpecialEncounter *param0);
|
||||
void sub_0206C404(SpecialEncounter *param0, const int param1);
|
||||
void RoamingPokemon_ActivateSlot(SaveData *saveData, const u8 speciesID);
|
||||
|
||||
#endif // POKEPLATINUM_ROAMING_POKEMON_H
|
||||
|
||||
@@ -7,19 +7,19 @@
|
||||
#include "struct_defs/struct_020698E4.h"
|
||||
#include "struct_defs/struct_0206C638.h"
|
||||
|
||||
typedef struct {
|
||||
int unk_00;
|
||||
int unk_04;
|
||||
UnkStruct_0202D7B0_sub1 unk_08;
|
||||
typedef struct SpecialEncounter {
|
||||
int marshDaily;
|
||||
int swarmDaily;
|
||||
SpecialEncounter_sub1 unk_08;
|
||||
UnkStruct_0202D844 unk_10;
|
||||
UnkStruct_020698E4 unk_BC;
|
||||
UnkStruct_0202D7B0_sub2 unk_C8;
|
||||
UnkStruct_0206C638 unk_D0[6];
|
||||
SpecialEncounter_sub2 unk_C8;
|
||||
Roamer unk_D0[6];
|
||||
u8 unk_148[6];
|
||||
u8 unk_14E;
|
||||
u8 unk_14F;
|
||||
u8 unk_150;
|
||||
u8 unk_151;
|
||||
} UnkStruct_0202D7B0;
|
||||
} SpecialEncounter;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_0202D7B0_H
|
||||
|
||||
@@ -5,6 +5,6 @@ typedef struct {
|
||||
BOOL unk_00;
|
||||
u16 unk_04;
|
||||
u16 unk_06;
|
||||
} UnkStruct_0202D7B0_sub1;
|
||||
} SpecialEncounter_sub1;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_0202D7B0_SUB1_H
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
typedef struct {
|
||||
int unk_00;
|
||||
int unk_04;
|
||||
} UnkStruct_0202D7B0_sub2;
|
||||
} SpecialEncounter_sub2;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_0202D7B0_SUB2_H
|
||||
|
||||
@@ -10,6 +10,6 @@ typedef struct {
|
||||
u8 unk_10;
|
||||
u8 unk_11;
|
||||
u8 unk_12;
|
||||
} UnkStruct_0206C638;
|
||||
} Roamer;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_0206C638_H
|
||||
|
||||
@@ -9,33 +9,37 @@
|
||||
|
||||
#include "savedata.h"
|
||||
|
||||
// for SpecialEncounter_GetDailyMon
|
||||
#define DAILY_MARSH 1
|
||||
#define DAILY_SWARM 2
|
||||
|
||||
int SpecialEncounter_SaveSize(void);
|
||||
void SpecialEncounter_Init(UnkStruct_0202D7B0 *param0);
|
||||
void sub_0202D80C(UnkStruct_0202D7B0 *param0, const u32 param1);
|
||||
u32 sub_0202D814(UnkStruct_0202D7B0 *param0, const u8 param1);
|
||||
UnkStruct_020698E4 *sub_0202D830(UnkStruct_0202D7B0 *param0);
|
||||
UnkStruct_0202D7B0 *sub_0202D834(SaveData *param0);
|
||||
UnkStruct_0202D844 *sub_0202D840(UnkStruct_0202D7B0 *param0);
|
||||
void SpecialEncounter_Init(SpecialEncounter *param0);
|
||||
void SpecialEncounter_SetMixedRecordDailies(SpecialEncounter *speEnc, const u32 mixedRecord);
|
||||
u32 SpecialEncounter_GetDailyMon(SpecialEncounter *param0, const u8 dailyType);
|
||||
UnkStruct_020698E4 *sub_0202D830(SpecialEncounter *param0);
|
||||
SpecialEncounter *SaveData_GetSpecialEncounters(SaveData *param0);
|
||||
UnkStruct_0202D844 *sub_0202D840(SpecialEncounter *param0);
|
||||
const int sub_0202D844(UnkStruct_0202D844 *param0);
|
||||
void sub_0202D848(const u8 param0, UnkStruct_0202D844 *param1);
|
||||
UnkStruct_0202D84C *sub_0202D84C(const u8 param0, UnkStruct_0202D844 *param1);
|
||||
void sub_0202D854(SaveData *param0, const int param1);
|
||||
void sub_0202D884(SaveData *param0);
|
||||
u8 sub_0202D898(UnkStruct_0202D7B0 *param0);
|
||||
void sub_0202D8A4(UnkStruct_0202D7B0 *param0, const int param1);
|
||||
int sub_0202D8BC(UnkStruct_0202D7B0 *param0);
|
||||
u8 sub_0202D8C4(UnkStruct_0202D7B0 *param0, const u8 param1);
|
||||
void sub_0202D8DC(UnkStruct_0202D7B0 *param0, const u8 param1, const u8 param2);
|
||||
u8 sub_0202D8F8(UnkStruct_0202D7B0 *param0, const u8 param1);
|
||||
void sub_0202D914(UnkStruct_0206C638 **param0);
|
||||
UnkStruct_0206C638 *sub_0202D924(UnkStruct_0202D7B0 *param0, const u8 param1);
|
||||
u32 sub_0202D93C(const UnkStruct_0206C638 *param0, const u8 param1);
|
||||
void sub_0202D980(UnkStruct_0206C638 *param0, const u8 param1, const u32 param2);
|
||||
u8 *sub_0202D9C4(UnkStruct_0202D7B0 *param0);
|
||||
u8 *sub_0202D9CC(UnkStruct_0202D7B0 *param0);
|
||||
BOOL sub_0202D9D8(UnkStruct_0202D7B0 *param0);
|
||||
void sub_0202D9EC(UnkStruct_0202D7B0 *param0, const u8 param1);
|
||||
u8 sub_0202DA04(UnkStruct_0202D7B0 *param0);
|
||||
u8 sub_0202D898(SpecialEncounter *param0);
|
||||
void sub_0202D8A4(SpecialEncounter *param0, const int param1);
|
||||
int sub_0202D8BC(SpecialEncounter *param0);
|
||||
u8 sub_0202D8C4(SpecialEncounter *param0, const u8 param1);
|
||||
void sub_0202D8DC(SpecialEncounter *param0, const u8 param1, const u8 param2);
|
||||
u8 sub_0202D8F8(SpecialEncounter *param0, const u8 param1);
|
||||
void sub_0202D914(Roamer **param0);
|
||||
Roamer *sub_0202D924(SpecialEncounter *param0, const u8 param1);
|
||||
u32 sub_0202D93C(const Roamer *param0, const u8 param1);
|
||||
void sub_0202D980(Roamer *param0, const u8 param1, const u32 param2);
|
||||
u8 *sub_0202D9C4(SpecialEncounter *param0);
|
||||
u8 *sub_0202D9CC(SpecialEncounter *param0);
|
||||
BOOL sub_0202D9D8(SpecialEncounter *param0);
|
||||
void sub_0202D9EC(SpecialEncounter *param0, const u8 param1);
|
||||
u8 sub_0202DA04(SpecialEncounter *param0);
|
||||
void sub_0202DA10(SaveData *param0, u16 *param1, u16 *param2);
|
||||
void sub_0202DA24(SaveData *param0, const u16 param1);
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef POKEPLATINUM_UNK_0206C0E8_H
|
||||
#define POKEPLATINUM_UNK_0206C0E8_H
|
||||
|
||||
#include "field/field_system_decl.h"
|
||||
|
||||
void sub_0206C0E8(FieldSystem *fieldSystem);
|
||||
|
||||
#endif // POKEPLATINUM_UNK_0206C0E8_H
|
||||
@@ -266,7 +266,7 @@ Static main
|
||||
Object main.nef.p/src_unk_0206AFE0.c.o
|
||||
Object main.nef.p/src_unk_0206B70C.c.o
|
||||
Object main.nef.p/src_unk_0206B9D8.c.o
|
||||
Object main.nef.p/src_unk_0206C0E8.c.o
|
||||
Object main.nef.p/src_great_marsh_lookout.c.o
|
||||
Object main.nef.p/src_unk_0206C2D0.c.o
|
||||
Object main.nef.p/src_roaming_pokemon.c.o
|
||||
Object main.nef.p/src_unk_0206C660.c.o
|
||||
@@ -566,9 +566,9 @@ Overlay overlay6
|
||||
Object main.nef.p/src_overlay006_ov6_0223E140.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_02240C9C.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_022426AC.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_02242984.c.o
|
||||
Object main.nef.p/src_overlay006_great_marsh_binoculars.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_02242AF0.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_02242F74.c.o
|
||||
Object main.nef.p/src_overlay006_great_marsh_daily_encounters.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_02243004.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_022430C4.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_02243218.c.o
|
||||
@@ -586,7 +586,7 @@ Overlay overlay6
|
||||
Object main.nef.p/src_overlay006_ov6_02247100.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_022475B0.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_02247660.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_022477B8.c.o
|
||||
Object main.nef.p/src_overlay006_dual_slot_encounters.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_02247830.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_02247A0C.c.o
|
||||
Object main.nef.p/src_overlay006_ov6_02247D30.c.o
|
||||
|
||||
@@ -29,7 +29,7 @@ _003E:
|
||||
PlayFanfare SEQ_SE_DP_REGI
|
||||
WaitFanfare SEQ_SE_DP_REGI
|
||||
ScrCmd_073
|
||||
ScrCmd_206
|
||||
StartGreatMarshLookout
|
||||
ReleaseAll
|
||||
End
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ static int NumMonsCaptured(CatchingShow *catchingShow)
|
||||
|
||||
static void ResetStepCount(CatchingShow *catchingShow)
|
||||
{
|
||||
catchingShow->steps = inline_020564D0(10) + 5;
|
||||
catchingShow->steps = LCRNG_RandMod(10) + 5;
|
||||
}
|
||||
|
||||
static BOOL IsStepCountZero(CatchingShow *catchingShow)
|
||||
@@ -226,7 +226,7 @@ static BOOL TryStartEncounter(FieldSystem *fieldSystem, CatchingShow *catchingSh
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
encounterChance = inline_020564D0(totalRarity + WEIGHT_NO_ENCOUNTER);
|
||||
encounterChance = LCRNG_RandMod(totalRarity + WEIGHT_NO_ENCOUNTER);
|
||||
|
||||
if (encounterChance < WEIGHT_NO_ENCOUNTER) {
|
||||
return FALSE;
|
||||
|
||||
140
src/great_marsh_lookout.c
Normal file
140
src/great_marsh_lookout.c
Normal file
@@ -0,0 +1,140 @@
|
||||
#include "great_marsh_lookout.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "consts/sdat.h"
|
||||
|
||||
#include "struct_decls/struct_02061AB4_decl.h"
|
||||
|
||||
#include "field/field_system.h"
|
||||
#include "field/field_system_sub2_t.h"
|
||||
#include "overlay006/great_marsh_binoculars.h"
|
||||
#include "overlay006/ov6_022426AC.h"
|
||||
|
||||
#include "core_sys.h"
|
||||
#include "field_map_change.h"
|
||||
#include "field_task.h"
|
||||
#include "field_transition.h"
|
||||
#include "heap.h"
|
||||
#include "location.h"
|
||||
#include "map_object.h"
|
||||
#include "player_avatar.h"
|
||||
#include "system_flags.h"
|
||||
#include "unk_02005474.h"
|
||||
#include "unk_02056B30.h"
|
||||
#include "unk_02070428.h"
|
||||
#include "vars_flags.h"
|
||||
|
||||
// Data used for the Great Marsh lookout binoculars scene.
|
||||
typedef struct LookoutData {
|
||||
GreatMarshLookout_SpriteResources *spriteResources;
|
||||
GreatMarshBinoculars *binocularsData;
|
||||
Location *nextLocation;
|
||||
u8 state;
|
||||
u8 numCycles;
|
||||
u8 timer;
|
||||
} LookoutData;
|
||||
|
||||
static BOOL Task_GreatMarshLookout(FieldTask *taskMan);
|
||||
|
||||
void GreatMarshLookout_Init(FieldSystem *fieldSystem)
|
||||
{
|
||||
LookoutData *lookout = Heap_AllocFromHeapAtEnd(HEAP_ID_FIELDMAP, sizeof(LookoutData));
|
||||
|
||||
lookout->spriteResources = GreatMarshLookout_AllocSpriteResources(HEAP_ID_FIELDMAP);
|
||||
lookout->binocularsData = GreatMarshBinoculars_InitData(HEAP_ID_FIELDMAP, fieldSystem);
|
||||
lookout->state = 0;
|
||||
lookout->numCycles = 0;
|
||||
|
||||
FieldTask_InitCall(fieldSystem->task, Task_GreatMarshLookout, lookout);
|
||||
}
|
||||
|
||||
static BOOL Task_GreatMarshLookout(FieldTask *taskMan)
|
||||
{
|
||||
FieldSystem *fieldSystem = FieldTask_GetFieldSystem(taskMan);
|
||||
LookoutData *lookout = FieldTask_GetEnv(taskMan);
|
||||
|
||||
switch (lookout->state) {
|
||||
case 0:
|
||||
sub_02070428(fieldSystem, 1);
|
||||
GreatMarshBinoculars_SetNextLocationWithCoords(lookout->numCycles, lookout->binocularsData);
|
||||
lookout->nextLocation = GreatMarshBinoculars_GetLocation(lookout->binocularsData);
|
||||
FieldTransition_FadeOut(taskMan);
|
||||
lookout->state = 1;
|
||||
break;
|
||||
case 1:
|
||||
FieldTransition_FinishMap(taskMan);
|
||||
lookout->state = 2;
|
||||
break;
|
||||
case 2: {
|
||||
VarsFlags *flags = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
|
||||
if (lookout->numCycles == 0) {
|
||||
SystemFlag_SetPoketchHidden(flags);
|
||||
} else if (lookout->numCycles == BINOCULARS_CYCLE_COUNT) {
|
||||
SystemFlag_ClearPoketchHidden(flags);
|
||||
}
|
||||
}
|
||||
|
||||
FieldTask_ChangeMapByLocation(taskMan, lookout->nextLocation);
|
||||
lookout->state = 3;
|
||||
break;
|
||||
case 3:
|
||||
FieldTransition_StartMap(taskMan);
|
||||
lookout->state = 4;
|
||||
break;
|
||||
case 4: {
|
||||
MapObject *playerAvatar = Player_MapObject(fieldSystem->playerAvatar);
|
||||
|
||||
lookout->numCycles++;
|
||||
|
||||
if (lookout->numCycles <= BINOCULARS_CYCLE_COUNT) {
|
||||
int species;
|
||||
|
||||
species = GreatMarshBinoculars_GetMonSpecies(fieldSystem);
|
||||
MapObject_SetHidden(playerAvatar, 1);
|
||||
GreatMarshLookout_CreateLookoutMonSprite(lookout->spriteResources, species);
|
||||
ov6_022427F4(lookout->spriteResources);
|
||||
lookout->timer = 0;
|
||||
Sound_PlayEffect(SEQ_SE_DP_KASYA); // binoculars switch
|
||||
sub_02056B30(taskMan, 3, 17, 0xffff, 0x0, 6, 1, HEAP_ID_FIELDMAP);
|
||||
lookout->state = 5;
|
||||
} else {
|
||||
MapObject_SetHidden(playerAvatar, 0);
|
||||
FieldTransition_FadeIn(taskMan);
|
||||
lookout->state = 8;
|
||||
}
|
||||
} break;
|
||||
case 5:
|
||||
lookout->timer++;
|
||||
|
||||
if ((lookout->timer >= 60) || (gCoreSys.pressedKeys & PAD_BUTTON_A)) {
|
||||
GreatMarshBinoculars_SetNextLocationWithCoords(lookout->numCycles, lookout->binocularsData);
|
||||
lookout->nextLocation = GreatMarshBinoculars_GetLocation(lookout->binocularsData);
|
||||
Sound_PlayEffect(SEQ_SE_DP_KASYA);
|
||||
sub_02056B30(taskMan, 3, 16, 0xffff, 0x0, 6, 1, HEAP_ID_FIELDMAP);
|
||||
lookout->state = 6;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
ov6_02242814(lookout->spriteResources);
|
||||
lookout->state = 7;
|
||||
break;
|
||||
case 7:
|
||||
if (ov6_02242820(lookout->spriteResources)) {
|
||||
ov6_02242828(lookout->spriteResources);
|
||||
lookout->state = 1;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
sub_02070428(fieldSystem, 0);
|
||||
GreatMarshBinoculars_FreeData(lookout->binocularsData);
|
||||
GreatMarshLookout_FreeSpriteResources(lookout->spriteResources);
|
||||
Heap_FreeToHeap(lookout);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -253,7 +253,7 @@ pokeplatinum_c = files(
|
||||
'unk_0206AFE0.c',
|
||||
'unk_0206B70C.c',
|
||||
'unk_0206B9D8.c',
|
||||
'unk_0206C0E8.c',
|
||||
'great_marsh_lookout.c',
|
||||
'unk_0206C2D0.c',
|
||||
'roaming_pokemon.c',
|
||||
'unk_0206C660.c',
|
||||
@@ -455,9 +455,9 @@ pokeplatinum_c = files(
|
||||
'overlay006/ov6_0223E140.c',
|
||||
'overlay006/ov6_02240C9C.c',
|
||||
'overlay006/ov6_022426AC.c',
|
||||
'overlay006/ov6_02242984.c',
|
||||
'overlay006/great_marsh_binoculars.c',
|
||||
'overlay006/ov6_02242AF0.c',
|
||||
'overlay006/ov6_02242F74.c',
|
||||
'overlay006/great_marsh_daily_encounters.c',
|
||||
'overlay006/ov6_02243004.c',
|
||||
'overlay006/ov6_022430C4.c',
|
||||
'overlay006/ov6_02243218.c',
|
||||
@@ -475,7 +475,7 @@ pokeplatinum_c = files(
|
||||
'overlay006/ov6_02247100.c',
|
||||
'overlay006/ov6_022475B0.c',
|
||||
'overlay006/ov6_02247660.c',
|
||||
'overlay006/ov6_022477B8.c',
|
||||
'overlay006/dual_slot_encounters.c',
|
||||
'overlay006/ov6_02247830.c',
|
||||
'overlay006/ov6_02247A0C.c',
|
||||
'overlay006/ov6_02247D30.c',
|
||||
|
||||
@@ -133,7 +133,7 @@ u16 ov5_021EFB94(FieldSystem *fieldSystem)
|
||||
v0 = ov5_021EFF10(fieldSystem->location->mapId);
|
||||
GF_ASSERT(v0 != 21);
|
||||
|
||||
v1 = sub_0202D840(sub_0202D834(fieldSystem->saveData));
|
||||
v1 = sub_0202D840(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
v2 = sub_0202D84C(v0, v1);
|
||||
|
||||
if (ov5_021EFF34(v2->unk_00)) {
|
||||
@@ -157,7 +157,7 @@ void ov5_021EFBDC(FieldSystem *fieldSystem)
|
||||
v0 = ov5_021EFF10(fieldSystem->location->mapId);
|
||||
GF_ASSERT(v0 != 21);
|
||||
|
||||
v1 = sub_0202D840(sub_0202D834(fieldSystem->saveData));
|
||||
v1 = sub_0202D840(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
v2 = sub_0202D84C(v0, v1);
|
||||
|
||||
v2->unk_00 = (24 * 60);
|
||||
@@ -168,7 +168,7 @@ void ov5_021EFBDC(FieldSystem *fieldSystem)
|
||||
}
|
||||
|
||||
if (sub_0202D844(v1) == v0) {
|
||||
if ((inline_020564D0(100)) < 90) {
|
||||
if ((LCRNG_RandMod(100)) < 90) {
|
||||
ov5_021EFD58(&v2->unk_04);
|
||||
v2->unk_07 = ov5_021EFDC0(v2->unk_06);
|
||||
return;
|
||||
@@ -226,7 +226,7 @@ static void ov5_021EFCF8(const BOOL param0, u8 *param1)
|
||||
{
|
||||
int v0;
|
||||
|
||||
v0 = inline_020564D0(100);
|
||||
v0 = LCRNG_RandMod(100);
|
||||
|
||||
if (param0) {
|
||||
if (v0 < 1) {
|
||||
@@ -253,7 +253,7 @@ static void ov5_021EFD58(u8 *param0)
|
||||
{
|
||||
int v0;
|
||||
|
||||
v0 = inline_020564D0(100);
|
||||
v0 = LCRNG_RandMod(100);
|
||||
|
||||
if (v0 < 5) {
|
||||
*param0 = 5;
|
||||
@@ -290,7 +290,7 @@ static const int ov5_021EFDC0(const u8 param0)
|
||||
int v0;
|
||||
int v1;
|
||||
|
||||
v1 = inline_020564D0(100);
|
||||
v1 = LCRNG_RandMod(100);
|
||||
|
||||
if (param0 == 3) {
|
||||
if (v1 < 5) {
|
||||
@@ -370,7 +370,7 @@ static void ov5_021EFE7C(FieldSystem *fieldSystem, UnkStruct_ov5_021E1608 *param
|
||||
UnkStruct_0202D84C *v3;
|
||||
UnkStruct_ov5_021E1890 *v4;
|
||||
|
||||
v2 = sub_0202D840(sub_0202D834(fieldSystem->saveData));
|
||||
v2 = sub_0202D840(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
v3 = sub_0202D84C(v1, v2);
|
||||
|
||||
if (ov5_021EFF34(v3->unk_00)) {
|
||||
@@ -472,7 +472,7 @@ int ov5_021EFFE4(FieldSystem *fieldSystem)
|
||||
UnkStruct_0202D844 *v3;
|
||||
UnkStruct_0202D84C *v4;
|
||||
|
||||
v3 = sub_0202D840(sub_0202D834(fieldSystem->saveData));
|
||||
v3 = sub_0202D840(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
v4 = sub_0202D84C(v0, v3);
|
||||
|
||||
if ((GAME_VERSION == DIAMOND) || (GAME_VERSION == PLATINUM)) {
|
||||
@@ -512,7 +512,7 @@ void ov5_021F0040(FieldSystem *fieldSystem)
|
||||
|
||||
fieldSystem->unk_A8->unk_00[v2].unk_04 = 0;
|
||||
|
||||
v0 = sub_0202D840(sub_0202D834(fieldSystem->saveData));
|
||||
v0 = sub_0202D840(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
v1 = sub_0202D84C(v2, v0);
|
||||
|
||||
v1->unk_00 = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "overlay006/ov6_022477B8.h"
|
||||
#include "overlay006/dual_slot_encounters.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
99
src/overlay006/great_marsh_binoculars.c
Normal file
99
src/overlay006/great_marsh_binoculars.c
Normal file
@@ -0,0 +1,99 @@
|
||||
#include "overlay006/great_marsh_binoculars.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "field/field_system.h"
|
||||
#include "overlay006/dual_slot_encounters.h"
|
||||
#include "overlay006/great_marsh_daily_encounters.h"
|
||||
#include "overlay006/ov6_02240C9C.h"
|
||||
#include "overlay006/wild_encounters.h"
|
||||
|
||||
#include "field_system.h"
|
||||
#include "great_marsh_lookout.h"
|
||||
#include "heap.h"
|
||||
#include "inlines.h"
|
||||
#include "location.h"
|
||||
#include "map_header_data.h"
|
||||
#include "narc.h"
|
||||
#include "player_avatar.h"
|
||||
#include "pokedex.h"
|
||||
#include "unk_0202D7A8.h"
|
||||
#include "unk_02039C80.h"
|
||||
|
||||
int GreatMarshBinoculars_GetMonSpecies(FieldSystem *fieldSystem)
|
||||
{
|
||||
int encounterTable[MAX_GRASS_ENCOUNTERS];
|
||||
|
||||
WildEncounters *encounterData = MapHeaderData_GetWildEncounters(fieldSystem);
|
||||
|
||||
for (u8 i = 0; i < MAX_GRASS_ENCOUNTERS; i++) {
|
||||
encounterTable[i] = encounterData->grassEncounters.encounters[i].species;
|
||||
}
|
||||
|
||||
BOOL natDexObtained = Pokedex_IsNationalDexObtained(SaveData_GetPokedex(FieldSystem_GetSaveData(fieldSystem)));
|
||||
|
||||
ReplaceGreatMarshDailyEncounters(SpecialEncounter_GetDailyMon(SaveData_GetSpecialEncounters(fieldSystem->saveData), DAILY_MARSH), natDexObtained, fieldSystem->location->mapId, &encounterTable[6], &encounterTable[7]);
|
||||
WildEncounters_ReplaceTimedEncounters(encounterData, &encounterTable[2], &encounterTable[3]);
|
||||
WildEncounters_ReplaceDualSlotEncounters(encounterData, natDexObtained, &encounterTable[8], &encounterTable[9]);
|
||||
|
||||
return encounterTable[LCRNG_RandMod(MAX_GRASS_ENCOUNTERS)];
|
||||
}
|
||||
|
||||
GreatMarshBinoculars *GreatMarshBinoculars_InitData(const int heapId, FieldSystem *fieldSystem)
|
||||
{
|
||||
u8 i;
|
||||
GreatMarshBinoculars *binocularsData;
|
||||
|
||||
binocularsData = Heap_AllocFromHeapAtEnd(heapId, sizeof(GreatMarshBinoculars));
|
||||
binocularsData->fieldSystem = fieldSystem;
|
||||
|
||||
u8 randIndex;
|
||||
BinocularCoords *coordData;
|
||||
|
||||
coordData = NARC_AllocAtEndAndReadWholeMemberByIndexPair(NARC_INDEX_ARC__ENCDATA_EX, 11, HEAP_ID_FIELD);
|
||||
|
||||
for (i = 0; i < BINOCULARS_CYCLE_COUNT; i++) {
|
||||
randIndex = LCRNG_RandMod(36);
|
||||
binocularsData->coordsList[i].x = coordData[randIndex].x;
|
||||
binocularsData->coordsList[i].z = coordData[randIndex].z;
|
||||
}
|
||||
|
||||
binocularsData->coordsList[BINOCULARS_CYCLE_COUNT].x = Player_GetXPos(fieldSystem->playerAvatar);
|
||||
binocularsData->coordsList[BINOCULARS_CYCLE_COUNT].z = Player_GetZPos(fieldSystem->playerAvatar);
|
||||
binocularsData->lookoutMapId = fieldSystem->location->mapId;
|
||||
Heap_FreeToHeap(coordData);
|
||||
|
||||
return binocularsData;
|
||||
}
|
||||
|
||||
void GreatMarshBinoculars_FreeData(GreatMarshBinoculars *data)
|
||||
{
|
||||
Heap_FreeToHeap(data);
|
||||
}
|
||||
|
||||
void GreatMarshBinoculars_SetNextLocationWithCoords(const u8 cycleNum, GreatMarshBinoculars *binocularsData)
|
||||
{
|
||||
int nextMapId;
|
||||
int nextX, nextZ;
|
||||
|
||||
if (cycleNum == 0) {
|
||||
int v3 = 240; // member number for NARC_INDEX_FIELDDATA__MAPMATRIX__MAP_MATRIX. Not sure what it represents exactly.
|
||||
nextX = binocularsData->coordsList[cycleNum].x / 32;
|
||||
nextZ = binocularsData->coordsList[cycleNum].z / 32;
|
||||
nextMapId = sub_02039F10(v3, nextX, nextZ);
|
||||
} else if (cycleNum == BINOCULARS_CYCLE_COUNT) {
|
||||
nextMapId = binocularsData->lookoutMapId;
|
||||
} else {
|
||||
nextX = binocularsData->coordsList[cycleNum].x / 32;
|
||||
nextZ = binocularsData->coordsList[cycleNum].z / 32;
|
||||
nextMapId = sub_02039E30(binocularsData->fieldSystem->unk_2C, nextX, nextZ);
|
||||
}
|
||||
|
||||
Location_Set(&binocularsData->viewLocation, nextMapId, -1, binocularsData->coordsList[cycleNum].x, binocularsData->coordsList[cycleNum].z, 0);
|
||||
}
|
||||
|
||||
Location *GreatMarshBinoculars_GetLocation(GreatMarshBinoculars *binocData)
|
||||
{
|
||||
return &binocData->viewLocation;
|
||||
}
|
||||
64
src/overlay006/great_marsh_daily_encounters.c
Normal file
64
src/overlay006/great_marsh_daily_encounters.c
Normal file
@@ -0,0 +1,64 @@
|
||||
#include "overlay006/great_marsh_daily_encounters.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "consts/map.h"
|
||||
|
||||
#include "heap.h"
|
||||
#include "narc.h"
|
||||
|
||||
static u8 GreatMarsh_GetAreaNumFromMapId(const int mapId);
|
||||
|
||||
void ReplaceGreatMarshDailyEncounters(const int dailyMon, const BOOL nationalDexObtained, const int mapId, int *encounterSlot1, int *encounterSlot2)
|
||||
{
|
||||
int *narc;
|
||||
int encDataGroup;
|
||||
u8 encounterIndex;
|
||||
u8 areaNum = GreatMarsh_GetAreaNumFromMapId(mapId);
|
||||
|
||||
if (nationalDexObtained) {
|
||||
encDataGroup = 9;
|
||||
} else {
|
||||
encDataGroup = 10;
|
||||
}
|
||||
|
||||
narc = NARC_AllocAtEndAndReadWholeMemberByIndexPair(NARC_INDEX_ARC__ENCDATA_EX, encDataGroup, HEAP_ID_FIELD);
|
||||
encounterIndex = ((dailyMon >> (5 * areaNum)) & 0x1f);
|
||||
encounterIndex %= 32;
|
||||
|
||||
(*encounterSlot1) = narc[encounterIndex];
|
||||
(*encounterSlot2) = narc[encounterIndex];
|
||||
|
||||
Heap_FreeToHeap(narc);
|
||||
}
|
||||
|
||||
static u8 GreatMarsh_GetAreaNumFromMapId(const int mapId)
|
||||
{
|
||||
u8 areaNum = 0;
|
||||
|
||||
switch (mapId) {
|
||||
case MAP_HEADER_GREAT_MARSH_1:
|
||||
areaNum = 0;
|
||||
break;
|
||||
case MAP_HEADER_GREAT_MARSH_2:
|
||||
areaNum = 1;
|
||||
break;
|
||||
case MAP_HEADER_GREAT_MARSH_3:
|
||||
areaNum = 2;
|
||||
break;
|
||||
case MAP_HEADER_GREAT_MARSH_4:
|
||||
areaNum = 3;
|
||||
break;
|
||||
case MAP_HEADER_GREAT_MARSH_5:
|
||||
areaNum = 4;
|
||||
break;
|
||||
case MAP_HEADER_GREAT_MARSH_6:
|
||||
areaNum = 5;
|
||||
break;
|
||||
default:
|
||||
GF_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
return areaNum;
|
||||
}
|
||||
@@ -18,11 +18,11 @@
|
||||
#include "field/field_system.h"
|
||||
#include "field/field_system_sub2_t.h"
|
||||
#include "overlay005/ov5_021EFB0C.h"
|
||||
#include "overlay006/ov6_02242F74.h"
|
||||
#include "overlay006/dual_slot_encounters.h"
|
||||
#include "overlay006/great_marsh_daily_encounters.h"
|
||||
#include "overlay006/ov6_02243218.h"
|
||||
#include "overlay006/ov6_02246B74.h"
|
||||
#include "overlay006/ov6_02247660.h"
|
||||
#include "overlay006/ov6_022477B8.h"
|
||||
#include "overlay006/wild_encounters.h"
|
||||
|
||||
#include "encounter.h"
|
||||
@@ -62,11 +62,11 @@ typedef struct {
|
||||
BOOL unk_0C;
|
||||
} UnkStruct_ov6_02241674;
|
||||
|
||||
typedef struct UnkStruct_ov6_0224222C {
|
||||
typedef struct EncounterSlot {
|
||||
int species;
|
||||
u16 maxLevel;
|
||||
u16 minLevel;
|
||||
} UnkStruct_ov6_0224222C;
|
||||
} EncounterSlot;
|
||||
|
||||
typedef struct WildEncounters_FieldParams {
|
||||
u32 trainerID;
|
||||
@@ -88,26 +88,26 @@ static BOOL ov6_022417C8(FieldSystem *fieldSystem, const u32 param1, const u8 pa
|
||||
static u8 ov6_02241874(FieldSystem *fieldSystem, u8 param1, u8 *encounterType);
|
||||
static BOOL ov6_022418B4(FieldSystem *fieldSystem, u32 param1);
|
||||
static BOOL ov6_022418DC(FieldSystem *fieldSystem, u32 param1);
|
||||
static BOOL ov6_0224222C(Pokemon *param0, const WildEncounters_FieldParams *param1, const UnkStruct_ov6_0224222C *param2, const u8 param3, const u8 param4, const u8 param5, u8 *param6);
|
||||
static BOOL ov6_0224222C(Pokemon *param0, const WildEncounters_FieldParams *param1, const EncounterSlot *param2, const u8 param3, const u8 param4, const u8 param5, u8 *param6);
|
||||
static BOOL ov6_022422D0(const WildEncounters_FieldParams *param0, Pokemon *param1, const u8 param2);
|
||||
static int GetGrassEncounterRate(FieldSystem *fieldSystem);
|
||||
static int GetSurfEncounterRate(FieldSystem *fieldSystem);
|
||||
static int GetFishingEncounterRate(FieldSystem *fieldSystem, const int param1);
|
||||
static BOOL ov6_02241674(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, WildEncounters *encounterData, UnkStruct_ov6_0224222C *param4, const WildEncounters_FieldParams *param5, const UnkStruct_ov6_02241674 *param6);
|
||||
static BOOL ov6_0224174C(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, UnkStruct_ov6_0224222C *param3, const WildEncounters_FieldParams *param4);
|
||||
static BOOL ov6_02241790(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, UnkStruct_ov6_0224222C *param3, const WildEncounters_FieldParams *param4);
|
||||
static BOOL ov6_022417AC(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, UnkStruct_ov6_0224222C *param3, const WildEncounters_FieldParams *param4, const int param5);
|
||||
static BOOL ov6_02241DC4(Pokemon *param0, const int param1, const WildEncounters_FieldParams *param2, const UnkStruct_ov6_0224222C *param3, const u8 encounterType, const int param5, FieldBattleDTO *param6);
|
||||
static BOOL ov6_02241F7C(FieldSystem *fieldSystem, Pokemon *param1, const WildEncounters_FieldParams *param2, const UnkStruct_ov6_0224222C *param3, const int param4, FieldBattleDTO *param5, const int param6, const int param7);
|
||||
static BOOL ov6_02241674(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, WildEncounters *encounterData, EncounterSlot *param4, const WildEncounters_FieldParams *param5, const UnkStruct_ov6_02241674 *param6);
|
||||
static BOOL ov6_0224174C(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, EncounterSlot *param3, const WildEncounters_FieldParams *param4);
|
||||
static BOOL ov6_02241790(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, EncounterSlot *param3, const WildEncounters_FieldParams *param4);
|
||||
static BOOL ov6_022417AC(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, EncounterSlot *param3, const WildEncounters_FieldParams *param4, const int param5);
|
||||
static BOOL ov6_02241DC4(Pokemon *param0, const int param1, const WildEncounters_FieldParams *param2, const EncounterSlot *param3, const u8 encounterType, const int param5, FieldBattleDTO *param6);
|
||||
static BOOL ov6_02241F7C(FieldSystem *fieldSystem, Pokemon *param1, const WildEncounters_FieldParams *param2, const EncounterSlot *param3, const int param4, FieldBattleDTO *param5, const int param6, const int param7);
|
||||
static BOOL ov6_02241F2C(const int param0, const int param1, const int param2, const BOOL param3, const u32 param4, const WildEncounters_FieldParams *param5, Pokemon *param6, FieldBattleDTO *param7);
|
||||
static u8 ov6_0224226C(const BOOL param0, const u8 param1, const WildEncounters_FieldParams *param2, const u32 param3, Pokemon *param4);
|
||||
static void ov6_02242328(FieldSystem *fieldSystem, const BOOL param1, FieldBattleDTO **param2);
|
||||
static void ov6_02242354(FieldSystem *fieldSystem, const BOOL param1, const BOOL param2, UnkStruct_ov6_0224222C *param3);
|
||||
static void WildEncounters_ReplaceGreatMarshDailyEncounters(FieldSystem *fieldSystem, const BOOL safariGameActive, const BOOL param2, EncounterSlot *encTable);
|
||||
static BOOL ov6_02242388(const u8 param0, const WildEncounters_FieldParams *param1);
|
||||
static void ov6_0224239C(const u32 param0, UnkStruct_0206C638 *param1, FieldBattleDTO *param2);
|
||||
static BOOL ov6_02242440(FieldSystem *fieldSystem, UnkStruct_0206C638 **param1);
|
||||
static void ov6_0224239C(const u32 param0, Roamer *param1, FieldBattleDTO *param2);
|
||||
static BOOL ov6_02242440(FieldSystem *fieldSystem, Roamer **param1);
|
||||
static BOOL ov6_02242514(const int param0, const WildEncounters_FieldParams *param1, Pokemon *param2, FieldBattleDTO *param3);
|
||||
static u8 ov6_022425D4(const UnkStruct_ov6_0224222C *param0, const WildEncounters_FieldParams *param1, const u8 param2);
|
||||
static u8 ov6_022425D4(const EncounterSlot *param0, const WildEncounters_FieldParams *param1, const u8 param2);
|
||||
static void ov6_02242634(FieldSystem *fieldSystem, Pokemon *param1, WildEncounters *encounterData, WildEncounters_FieldParams *param3);
|
||||
static void ov6_02241A90(Pokemon *param0, u8 *param1);
|
||||
static void ov6_02241ABC(FieldSystem *fieldSystem, u8 *param1);
|
||||
@@ -190,10 +190,10 @@ void WildEncounters_ReplaceTimedEncounters(const WildEncounters *encounterData,
|
||||
|
||||
static void WildEncounters_ReplaceRadarEncounters(FieldSystem *fieldSystem, const WildEncounters *encounterData, int *radarSlot1, int *radarSlot2)
|
||||
{
|
||||
UnkStruct_0202D7B0 *v1 = sub_0202D834(fieldSystem->saveData);
|
||||
SpecialEncounter *v1 = SaveData_GetSpecialEncounters(fieldSystem->saveData);
|
||||
|
||||
if (sub_0202D898(v1)) {
|
||||
u32 v0 = sub_0202D814(v1, 2);
|
||||
u32 v0 = SpecialEncounter_GetDailyMon(v1, DAILY_SWARM);
|
||||
|
||||
if (fieldSystem->location->mapId == ov6_02243218(v0)) {
|
||||
*radarSlot1 = encounterData->swarmEncounters[0];
|
||||
@@ -233,9 +233,9 @@ BOOL ov6_02240D5C(FieldSystem *fieldSystem)
|
||||
BOOL v6;
|
||||
BOOL v7;
|
||||
BOOL v8;
|
||||
BOOL v9;
|
||||
BOOL safariGameActive;
|
||||
UnkStruct_ov6_02241674 v10;
|
||||
UnkStruct_ov6_0224222C v13[MAX_GRASS_ENCOUNTERS];
|
||||
EncounterSlot v13[MAX_GRASS_ENCOUNTERS];
|
||||
WildEncounters_FieldParams encounterFieldParams;
|
||||
|
||||
int playerX = Player_GetXPos(fieldSystem->playerAvatar);
|
||||
@@ -254,7 +254,7 @@ BOOL ov6_02240D5C(FieldSystem *fieldSystem)
|
||||
|
||||
ov6_02242634(fieldSystem, firstPartyMon, encounterData, &encounterFieldParams);
|
||||
|
||||
if (!sub_0202D9D8(sub_0202D834(fieldSystem->saveData))) {
|
||||
if (!sub_0202D9D8(SaveData_GetSpecialEncounters(fieldSystem->saveData))) {
|
||||
Pokemon *v16 = Party_FindFirstEligibleBattler(party);
|
||||
encounterFieldParams.unk_04 = TRUE;
|
||||
encounterFieldParams.firstBattlerLevel = Pokemon_GetValue(v16, MON_DATA_LEVEL, NULL);
|
||||
@@ -291,7 +291,7 @@ BOOL ov6_02240D5C(FieldSystem *fieldSystem)
|
||||
}
|
||||
|
||||
if (!v8 && !v10.unk_0C) {
|
||||
UnkStruct_0206C638 *v17;
|
||||
Roamer *v17;
|
||||
|
||||
if (ov6_02242440(fieldSystem, &v17)) {
|
||||
if (!ov6_02242388(sub_0202D93C(v17, 6), &encounterFieldParams)) {
|
||||
@@ -309,8 +309,8 @@ BOOL ov6_02240D5C(FieldSystem *fieldSystem)
|
||||
}
|
||||
|
||||
if (!v8) {
|
||||
v9 = SystemFlag_CheckSafariGameActive(SaveData_GetVarsFlags(fieldSystem->saveData));
|
||||
ov6_02242328(fieldSystem, v9, &battleParams);
|
||||
safariGameActive = SystemFlag_CheckSafariGameActive(SaveData_GetVarsFlags(fieldSystem->saveData));
|
||||
ov6_02242328(fieldSystem, safariGameActive, &battleParams);
|
||||
} else {
|
||||
battleParams = FieldBattleDTO_New(11, BATTLE_TYPE_AI_PARTNER);
|
||||
}
|
||||
@@ -332,7 +332,7 @@ BOOL ov6_02240D5C(FieldSystem *fieldSystem)
|
||||
WildEncounters_ReplaceDualSlotEncounters(encounterData, nationalDexObtained, &v13[8].species, &v13[9].species);
|
||||
|
||||
if (!v8) {
|
||||
ov6_02242354(fieldSystem, v9, nationalDexObtained, v13);
|
||||
WildEncounters_ReplaceGreatMarshDailyEncounters(fieldSystem, safariGameActive, nationalDexObtained, v13);
|
||||
|
||||
v7 = ov6_02241674(fieldSystem, firstPartyMon, battleParams, encounterData, v13, &encounterFieldParams, &v10);
|
||||
} else {
|
||||
@@ -376,7 +376,7 @@ BOOL ov6_02240D5C(FieldSystem *fieldSystem)
|
||||
|
||||
BOOL ov6_0224106C(FieldSystem *fieldSystem, const int fishingRodType, FieldBattleDTO **battleParams)
|
||||
{
|
||||
UnkStruct_ov6_0224222C v3[MAX_GRASS_ENCOUNTERS];
|
||||
EncounterSlot v3[MAX_GRASS_ENCOUNTERS];
|
||||
|
||||
u8 encounterRate = GetFishingEncounterRate(fieldSystem, fishingRodType);
|
||||
|
||||
@@ -390,7 +390,7 @@ BOOL ov6_0224106C(FieldSystem *fieldSystem, const int fishingRodType, FieldBattl
|
||||
ov6_02242634(fieldSystem, firstPartyMon, NULL, &encounterFieldParams);
|
||||
encounterRate = ov6_0224226C(TRUE, encounterRate, &encounterFieldParams, FieldOverworldState_GetWeather(SaveData_GetFieldOverworldState(fieldSystem->saveData)), firstPartyMon);
|
||||
|
||||
if (inline_020564D0(100) >= encounterRate) {
|
||||
if (LCRNG_RandMod(100) >= encounterRate) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -449,10 +449,10 @@ BOOL ov6_022411C8(FieldSystem *fieldSystem, FieldTask *param1)
|
||||
Pokemon *firstPartyMon;
|
||||
u8 encounterType;
|
||||
BOOL v6;
|
||||
BOOL v7;
|
||||
BOOL safariGameActive;
|
||||
BOOL v8;
|
||||
UnkStruct_ov6_02241674 v9;
|
||||
UnkStruct_ov6_0224222C v12[MAX_GRASS_ENCOUNTERS];
|
||||
EncounterSlot v12[MAX_GRASS_ENCOUNTERS];
|
||||
WildEncounters_FieldParams encounterFieldParams;
|
||||
|
||||
int playerX = Player_GetXPos(fieldSystem->playerAvatar);
|
||||
@@ -483,7 +483,7 @@ BOOL ov6_022411C8(FieldSystem *fieldSystem, FieldTask *param1)
|
||||
}
|
||||
|
||||
if (!v6) {
|
||||
UnkStruct_0206C638 *v15;
|
||||
Roamer *v15;
|
||||
|
||||
if (ov6_02242440(fieldSystem, &v15)) {
|
||||
battleParams = FieldBattleDTO_New(11, BATTLE_TYPE_ROAMER);
|
||||
@@ -497,8 +497,8 @@ BOOL ov6_022411C8(FieldSystem *fieldSystem, FieldTask *param1)
|
||||
}
|
||||
|
||||
if (!v6) {
|
||||
v7 = SystemFlag_CheckSafariGameActive(SaveData_GetVarsFlags(fieldSystem->saveData));
|
||||
ov6_02242328(fieldSystem, v7, &battleParams);
|
||||
safariGameActive = SystemFlag_CheckSafariGameActive(SaveData_GetVarsFlags(fieldSystem->saveData));
|
||||
ov6_02242328(fieldSystem, safariGameActive, &battleParams);
|
||||
} else {
|
||||
battleParams = FieldBattleDTO_New(11, BATTLE_TYPE_AI_PARTNER);
|
||||
}
|
||||
@@ -520,7 +520,7 @@ BOOL ov6_022411C8(FieldSystem *fieldSystem, FieldTask *param1)
|
||||
WildEncounters_ReplaceDualSlotEncounters(encounterData, nationalDexObtained, &v12[8].species, &v12[9].species);
|
||||
|
||||
if (!v6) {
|
||||
ov6_02242354(fieldSystem, v7, nationalDexObtained, v12);
|
||||
WildEncounters_ReplaceGreatMarshDailyEncounters(fieldSystem, safariGameActive, nationalDexObtained, v12);
|
||||
|
||||
v8 = ov6_02241674(fieldSystem, firstPartyMon, battleParams, encounterData, v12, &encounterFieldParams, &v9);
|
||||
} else {
|
||||
@@ -558,9 +558,9 @@ BOOL ov6_022413E4(FieldSystem *fieldSystem, FieldBattleDTO **battleParams)
|
||||
BOOL v5;
|
||||
BOOL v6;
|
||||
BOOL v7;
|
||||
BOOL v8;
|
||||
BOOL safariGameActive;
|
||||
UnkStruct_ov6_02241674 v9;
|
||||
UnkStruct_ov6_0224222C v12[MAX_GRASS_ENCOUNTERS];
|
||||
EncounterSlot v12[MAX_GRASS_ENCOUNTERS];
|
||||
WildEncounters_FieldParams encounterFieldParams;
|
||||
|
||||
*battleParams = NULL;
|
||||
@@ -581,7 +581,7 @@ BOOL ov6_022413E4(FieldSystem *fieldSystem, FieldBattleDTO **battleParams)
|
||||
|
||||
ov6_02242634(fieldSystem, firstPartyMon, encounterData, &encounterFieldParams);
|
||||
|
||||
if (!sub_0202D9D8(sub_0202D834(fieldSystem->saveData))) {
|
||||
if (!sub_0202D9D8(SaveData_GetSpecialEncounters(fieldSystem->saveData))) {
|
||||
Pokemon *v15 = Party_FindFirstEligibleBattler(party);
|
||||
|
||||
encounterFieldParams.unk_04 = TRUE;
|
||||
@@ -609,7 +609,7 @@ BOOL ov6_022413E4(FieldSystem *fieldSystem, FieldBattleDTO **battleParams)
|
||||
}
|
||||
|
||||
if (!v7) {
|
||||
UnkStruct_0206C638 *v16;
|
||||
Roamer *v16;
|
||||
|
||||
if (ov6_02242440(fieldSystem, &v16)) {
|
||||
if (!ov6_02242388(sub_0202D93C(v16, 6), &encounterFieldParams)) {
|
||||
@@ -626,8 +626,8 @@ BOOL ov6_022413E4(FieldSystem *fieldSystem, FieldBattleDTO **battleParams)
|
||||
}
|
||||
|
||||
if (!v7) {
|
||||
v8 = SystemFlag_CheckSafariGameActive(SaveData_GetVarsFlags(fieldSystem->saveData));
|
||||
ov6_02242328(fieldSystem, v8, battleParams);
|
||||
safariGameActive = SystemFlag_CheckSafariGameActive(SaveData_GetVarsFlags(fieldSystem->saveData));
|
||||
ov6_02242328(fieldSystem, safariGameActive, battleParams);
|
||||
} else {
|
||||
*battleParams = FieldBattleDTO_New(11, BATTLE_TYPE_AI_PARTNER);
|
||||
}
|
||||
@@ -649,7 +649,7 @@ BOOL ov6_022413E4(FieldSystem *fieldSystem, FieldBattleDTO **battleParams)
|
||||
WildEncounters_ReplaceDualSlotEncounters(encounterData, nationalDexObtained, &v12[8].species, &v12[9].species);
|
||||
|
||||
if (!v7) {
|
||||
ov6_02242354(fieldSystem, v8, nationalDexObtained, v12);
|
||||
WildEncounters_ReplaceGreatMarshDailyEncounters(fieldSystem, safariGameActive, nationalDexObtained, v12);
|
||||
|
||||
v6 = ov6_02241674(fieldSystem, firstPartyMon, *battleParams, encounterData, v12, &encounterFieldParams, &v9);
|
||||
} else {
|
||||
@@ -681,7 +681,7 @@ BOOL ov6_022413E4(FieldSystem *fieldSystem, FieldBattleDTO **battleParams)
|
||||
return v5;
|
||||
}
|
||||
|
||||
static BOOL ov6_02241674(FieldSystem *fieldSystem, Pokemon *firstPartyMon, FieldBattleDTO *battleParams, WildEncounters *encounterData, UnkStruct_ov6_0224222C *param4, const WildEncounters_FieldParams *encounterFieldParams, const UnkStruct_ov6_02241674 *param6)
|
||||
static BOOL ov6_02241674(FieldSystem *fieldSystem, Pokemon *firstPartyMon, FieldBattleDTO *battleParams, WildEncounters *encounterData, EncounterSlot *param4, const WildEncounters_FieldParams *encounterFieldParams, const UnkStruct_ov6_02241674 *param6)
|
||||
{
|
||||
BOOL v0;
|
||||
|
||||
@@ -723,7 +723,7 @@ static BOOL ov6_02241674(FieldSystem *fieldSystem, Pokemon *firstPartyMon, Field
|
||||
return v0;
|
||||
}
|
||||
|
||||
static BOOL ov6_0224174C(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, UnkStruct_ov6_0224222C *param3, const WildEncounters_FieldParams *param4)
|
||||
static BOOL ov6_0224174C(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, EncounterSlot *param3, const WildEncounters_FieldParams *param4)
|
||||
{
|
||||
if (!ov6_02241DC4(param1, 0xff, param4, param3, ENCOUNTER_TYPE_GRASS, 1, param2)) {
|
||||
return FALSE;
|
||||
@@ -733,12 +733,12 @@ static BOOL ov6_0224174C(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleD
|
||||
return v0;
|
||||
}
|
||||
|
||||
static BOOL ov6_02241790(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, UnkStruct_ov6_0224222C *param3, const WildEncounters_FieldParams *param4)
|
||||
static BOOL ov6_02241790(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, EncounterSlot *param3, const WildEncounters_FieldParams *param4)
|
||||
{
|
||||
return ov6_02241DC4(param1, 0xff, param4, param3, ENCOUNTER_TYPE_SURF, 1, param2);
|
||||
}
|
||||
|
||||
static BOOL ov6_022417AC(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, UnkStruct_ov6_0224222C *param3, const WildEncounters_FieldParams *param4, const int fishingRodType)
|
||||
static BOOL ov6_022417AC(FieldSystem *fieldSystem, Pokemon *param1, FieldBattleDTO *param2, EncounterSlot *param3, const WildEncounters_FieldParams *param4, const int fishingRodType)
|
||||
{
|
||||
return ov6_02241DC4(param1, fishingRodType, param4, param3, ENCOUNTER_TYPE_FISHING, 1, param2);
|
||||
}
|
||||
@@ -750,7 +750,7 @@ static BOOL ov6_022417C8(FieldSystem *fieldSystem, const u32 encounterRate, cons
|
||||
if (!ov6_022418B4(fieldSystem, v1)) {
|
||||
fieldSystem->unk_78.unk_00++;
|
||||
|
||||
if (inline_020564D0(100) >= 5) {
|
||||
if (LCRNG_RandMod(100) >= 5) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -769,7 +769,7 @@ static BOOL ov6_022417C8(FieldSystem *fieldSystem, const u32 encounterRate, cons
|
||||
v0 = 100;
|
||||
}
|
||||
|
||||
return inline_020564D0(100) < v0 && ov6_022418DC(fieldSystem, encounterRate);
|
||||
return LCRNG_RandMod(100) < v0 && ov6_022418DC(fieldSystem, encounterRate);
|
||||
}
|
||||
|
||||
static u8 ov6_02241874(FieldSystem *fieldSystem, u8 param1, u8 *encounterType)
|
||||
@@ -802,7 +802,7 @@ static BOOL ov6_022418B4(FieldSystem *fieldSystem, u32 param1)
|
||||
|
||||
static BOOL ov6_022418DC(FieldSystem *fieldSystem, u32 encounterRate)
|
||||
{
|
||||
if (inline_020564D0(100) >= encounterRate) {
|
||||
if (LCRNG_RandMod(100) >= encounterRate) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return TRUE;
|
||||
@@ -811,7 +811,7 @@ static BOOL ov6_022418DC(FieldSystem *fieldSystem, u32 encounterRate)
|
||||
|
||||
static u8 GetGroundEncounterSlot(void)
|
||||
{
|
||||
u8 roll = inline_020564D0(100); // a common rng function
|
||||
u8 roll = LCRNG_RandMod(100);
|
||||
|
||||
if (roll < 20) {
|
||||
return 0;
|
||||
@@ -842,7 +842,7 @@ static u8 GetGroundEncounterSlot(void)
|
||||
|
||||
static u8 GetWaterEncounterSlot(void)
|
||||
{
|
||||
u8 roll = inline_020564D0(100); // a common rng function
|
||||
u8 roll = LCRNG_RandMod(100);
|
||||
|
||||
if (roll < 60) {
|
||||
return 0;
|
||||
@@ -861,7 +861,7 @@ static u8 GetRodEncounterSlot(const int fishingRodType)
|
||||
{
|
||||
u8 encSlot = 0;
|
||||
|
||||
u8 roll = inline_020564D0(100); // a common rng function
|
||||
u8 roll = LCRNG_RandMod(100);
|
||||
|
||||
switch (fishingRodType) {
|
||||
case FISHING_TYPE_OLD_ROD:
|
||||
@@ -921,7 +921,7 @@ static void ov6_02241A90(Pokemon *mon, u8 *encounterRate)
|
||||
|
||||
static void ov6_02241ABC(FieldSystem *fieldSystem, u8 *encounterRate)
|
||||
{
|
||||
u8 v0 = sub_0202DA04(sub_0202D834(fieldSystem->saveData));
|
||||
u8 v0 = sub_0202DA04(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
|
||||
if (v0 == 1) {
|
||||
*encounterRate /= 2;
|
||||
@@ -932,15 +932,15 @@ static void ov6_02241ABC(FieldSystem *fieldSystem, u8 *encounterRate)
|
||||
|
||||
static u8 ov6_02241AE4(Pokemon *param0, const WildEncounters_FieldParams *encounterFieldParams)
|
||||
{
|
||||
if (!encounterFieldParams->isFirstMonEgg && encounterFieldParams->firstMonAbility == ABILITY_SYNCHRONIZE && inline_020564D0(2) == 0) {
|
||||
if (!encounterFieldParams->isFirstMonEgg && encounterFieldParams->firstMonAbility == ABILITY_SYNCHRONIZE && LCRNG_RandMod(2) == 0) {
|
||||
u32 v0 = Pokemon_GetValue(param0, MON_DATA_PERSONALITY, NULL);
|
||||
return (u8)(v0 % 25);
|
||||
}
|
||||
|
||||
return inline_020564D0(25);
|
||||
return LCRNG_RandMod(25);
|
||||
}
|
||||
|
||||
static u8 ov6_02241B40(const UnkStruct_ov6_0224222C *param0, const WildEncounters_FieldParams *encounterFieldParams)
|
||||
static u8 ov6_02241B40(const EncounterSlot *param0, const WildEncounters_FieldParams *encounterFieldParams)
|
||||
{
|
||||
u8 v1;
|
||||
u8 minLevel, maxLevel;
|
||||
@@ -957,7 +957,7 @@ static u8 ov6_02241B40(const UnkStruct_ov6_0224222C *param0, const WildEncounter
|
||||
v1 = LCRNG_Next() % levelRange;
|
||||
|
||||
if (!encounterFieldParams->isFirstMonEgg && (encounterFieldParams->firstMonAbility == ABILITY_HUSTLE || encounterFieldParams->firstMonAbility == ABILITY_VITAL_SPIRIT || encounterFieldParams->firstMonAbility == ABILITY_PRESSURE)) {
|
||||
if (inline_020564D0(2) == 0) {
|
||||
if (LCRNG_RandMod(2) == 0) {
|
||||
return minLevel + v1;
|
||||
}
|
||||
|
||||
@@ -987,13 +987,13 @@ static void ov6_02241BAC(const u16 species, const u8 level, const int param2, co
|
||||
case GENDER_RATIO_NO_GENDER:
|
||||
break;
|
||||
default:
|
||||
if (inline_020564D0(3) > 0) {
|
||||
if (LCRNG_RandMod(3) > 0) {
|
||||
firstMonGender = Pokemon_GetValue(firstPartyMon, MON_DATA_GENDER, NULL);
|
||||
abilityInEffect = TRUE;
|
||||
}
|
||||
}
|
||||
} else if (encounterFieldParams->firstMonAbility == ABILITY_SYNCHRONIZE) {
|
||||
if (inline_020564D0(2) == 0) {
|
||||
if (LCRNG_RandMod(2) == 0) {
|
||||
firstMonNature = Pokemon_GetNature(firstPartyMon);
|
||||
abilityInEffect = TRUE;
|
||||
}
|
||||
@@ -1046,7 +1046,7 @@ static void ov6_02241CC0(u16 species, u8 level, const int param2, const WildEnco
|
||||
v0 = FALSE;
|
||||
}
|
||||
|
||||
if (v0 && !encounterFieldParams->isFirstMonEgg && encounterFieldParams->firstMonAbility == ABILITY_CUTE_CHARM && inline_020564D0(3) > 0) {
|
||||
if (v0 && !encounterFieldParams->isFirstMonEgg && encounterFieldParams->firstMonAbility == ABILITY_CUTE_CHARM && LCRNG_RandMod(3) > 0) {
|
||||
u8 gender = Pokemon_GetValue(firstPartyMon, MON_DATA_GENDER, NULL);
|
||||
|
||||
if (gender == GENDER_FEMALE) {
|
||||
@@ -1072,7 +1072,7 @@ static void ov6_02241CC0(u16 species, u8 level, const int param2, const WildEnco
|
||||
Heap_FreeToHeap(newEncounter);
|
||||
}
|
||||
|
||||
static BOOL ov6_02241DC4(Pokemon *firstPartyMon, const int fishingRodType, const WildEncounters_FieldParams *encounterFieldParams, const UnkStruct_ov6_0224222C *param3, const u8 encounterType, const int param5, FieldBattleDTO *battleParams)
|
||||
static BOOL ov6_02241DC4(Pokemon *firstPartyMon, const int fishingRodType, const WildEncounters_FieldParams *encounterFieldParams, const EncounterSlot *param3, const u8 encounterType, const int param5, FieldBattleDTO *battleParams)
|
||||
{
|
||||
BOOL v0;
|
||||
u8 encounterSlot = 0;
|
||||
@@ -1143,7 +1143,7 @@ static BOOL ov6_02241F2C(const int param0, const int param1, const int param2, c
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL ov6_02241F7C(FieldSystem *fieldSystem, Pokemon *param1, const WildEncounters_FieldParams *encounterFieldParams, const UnkStruct_ov6_0224222C *param3, const int param4, FieldBattleDTO *battleParams, const int species, const int level)
|
||||
static BOOL ov6_02241F7C(FieldSystem *fieldSystem, Pokemon *param1, const WildEncounters_FieldParams *encounterFieldParams, const EncounterSlot *param3, const int param4, FieldBattleDTO *battleParams, const int species, const int level)
|
||||
{
|
||||
u8 encounterSlot = 0;
|
||||
|
||||
@@ -1189,10 +1189,10 @@ void ov6_02242034(FieldSystem *fieldSystem, FieldBattleDTO *battleParams)
|
||||
|
||||
u8 v5 = 15 - 5 + 1;
|
||||
|
||||
u8 v3 = 5 + inline_020564D0(v5);
|
||||
u8 v3 = 5 + LCRNG_RandMod(v5);
|
||||
|
||||
if (!encounterFieldParams.isFirstMonEgg && (encounterFieldParams.firstMonAbility == ABILITY_HUSTLE || encounterFieldParams.firstMonAbility == ABILITY_VITAL_SPIRIT || encounterFieldParams.firstMonAbility == ABILITY_PRESSURE)) {
|
||||
if (inline_020564D0(2) == 0) {
|
||||
if (LCRNG_RandMod(2) == 0) {
|
||||
(void)0;
|
||||
} else {
|
||||
v3 = 15;
|
||||
@@ -1266,7 +1266,7 @@ static int GetFishingEncounterRate(FieldSystem *fieldSystem, const int fishingRo
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL ov6_0224219C(const UnkStruct_ov6_0224222C *param0, const u8 maxEncounters, const u8 type, u8 *encounterSlot)
|
||||
static BOOL ov6_0224219C(const EncounterSlot *param0, const u8 maxEncounters, const u8 type, u8 *encounterSlot)
|
||||
{
|
||||
u8 v0[MAX_GRASS_ENCOUNTERS];
|
||||
u8 v2;
|
||||
@@ -1294,9 +1294,9 @@ static BOOL ov6_0224219C(const UnkStruct_ov6_0224222C *param0, const u8 maxEncou
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL ov6_0224222C(Pokemon *param0, const WildEncounters_FieldParams *encounterFieldParams, const UnkStruct_ov6_0224222C *param2, const u8 maxEncounters, const u8 type, const u8 ability, u8 *encounterSlot)
|
||||
static BOOL ov6_0224222C(Pokemon *param0, const WildEncounters_FieldParams *encounterFieldParams, const EncounterSlot *param2, const u8 maxEncounters, const u8 type, const u8 ability, u8 *encounterSlot)
|
||||
{
|
||||
if (!encounterFieldParams->isFirstMonEgg && encounterFieldParams->firstMonAbility == ability && inline_020564D0(2) == 0) {
|
||||
if (!encounterFieldParams->isFirstMonEgg && encounterFieldParams->firstMonAbility == ability && LCRNG_RandMod(2) == 0) {
|
||||
return ov6_0224219C(param2, maxEncounters, type, encounterSlot);
|
||||
}
|
||||
|
||||
@@ -1349,7 +1349,7 @@ static BOOL ov6_022422D0(const WildEncounters_FieldParams *encounterFieldParams,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (param2 <= v0 - 5 && inline_020564D0(2) == 0) {
|
||||
if (param2 <= v0 - 5 && LCRNG_RandMod(2) == 0) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1367,10 +1367,10 @@ static void ov6_02242328(FieldSystem *fieldSystem, const BOOL param1, FieldBattl
|
||||
}
|
||||
}
|
||||
|
||||
static void ov6_02242354(FieldSystem *fieldSystem, const BOOL param1, const BOOL nationalDexObtained, UnkStruct_ov6_0224222C *param3)
|
||||
static void WildEncounters_ReplaceGreatMarshDailyEncounters(FieldSystem *fieldSystem, const BOOL safariGameActive, const BOOL nationalDexObtained, EncounterSlot *encTable)
|
||||
{
|
||||
if (param1) {
|
||||
ov6_02242F74(sub_0202D814(sub_0202D834(fieldSystem->saveData), 1), nationalDexObtained, fieldSystem->location->mapId, ¶m3[6].species, ¶m3[7].species);
|
||||
if (safariGameActive) {
|
||||
ReplaceGreatMarshDailyEncounters(SpecialEncounter_GetDailyMon(SaveData_GetSpecialEncounters(fieldSystem->saveData), DAILY_MARSH), nationalDexObtained, fieldSystem->location->mapId, &encTable[6].species, &encTable[7].species);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1379,7 +1379,7 @@ static BOOL ov6_02242388(const u8 roamerLevel, const WildEncounters_FieldParams
|
||||
return encounterFieldParams->unk_04 && encounterFieldParams->firstBattlerLevel > roamerLevel;
|
||||
}
|
||||
|
||||
static void ov6_0224239C(const u32 trainerID, UnkStruct_0206C638 *param1, FieldBattleDTO *param2)
|
||||
static void ov6_0224239C(const u32 trainerID, Roamer *param1, FieldBattleDTO *param2)
|
||||
{
|
||||
Pokemon *mon = Pokemon_New(4);
|
||||
int roamerSpecies = sub_0202D93C(param1, 4);
|
||||
@@ -1398,12 +1398,12 @@ static void ov6_0224239C(const u32 trainerID, UnkStruct_0206C638 *param1, FieldB
|
||||
Heap_FreeToHeap(mon);
|
||||
}
|
||||
|
||||
static BOOL ov6_02242440(FieldSystem *fieldSystem, UnkStruct_0206C638 **param1)
|
||||
static BOOL ov6_02242440(FieldSystem *fieldSystem, Roamer **param1)
|
||||
{
|
||||
UnkStruct_0206C638 *v1[6];
|
||||
Roamer *v1[6];
|
||||
|
||||
u8 v2 = 0;
|
||||
UnkStruct_0202D7B0 *v0 = sub_0202D834(fieldSystem->saveData);
|
||||
SpecialEncounter *v0 = SaveData_GetSpecialEncounters(fieldSystem->saveData);
|
||||
|
||||
for (u8 v3 = 0; v3 < 6; v3++) {
|
||||
int v4 = sub_0206C3C8(sub_0202D8C4(v0, v3));
|
||||
@@ -1416,12 +1416,12 @@ static BOOL ov6_02242440(FieldSystem *fieldSystem, UnkStruct_0206C638 **param1)
|
||||
|
||||
if (v2 == 0) {
|
||||
return FALSE;
|
||||
} else if (inline_020564D0(2) == 0) {
|
||||
} else if (LCRNG_RandMod(2) == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (v2 > 1) {
|
||||
*param1 = v1[inline_020564D0(v2)];
|
||||
*param1 = v1[LCRNG_RandMod(v2)];
|
||||
} else {
|
||||
*param1 = v1[0];
|
||||
}
|
||||
@@ -1474,10 +1474,10 @@ static BOOL ov6_02242514(const int param0, const WildEncounters_FieldParams *enc
|
||||
return Party_AddPokemon(battleParams->parties[param0], mon);
|
||||
}
|
||||
|
||||
static u8 ov6_022425D4(const UnkStruct_ov6_0224222C *param0, const WildEncounters_FieldParams *encounterFieldParams, const u8 encounterSlot)
|
||||
static u8 ov6_022425D4(const EncounterSlot *param0, const WildEncounters_FieldParams *encounterFieldParams, const u8 encounterSlot)
|
||||
{
|
||||
if (!encounterFieldParams->isFirstMonEgg && (encounterFieldParams->firstMonAbility == ABILITY_VITAL_SPIRIT || encounterFieldParams->firstMonAbility == ABILITY_HUSTLE || encounterFieldParams->firstMonAbility == ABILITY_PRESSURE)) {
|
||||
if (inline_020564D0(2) == 0) {
|
||||
if (LCRNG_RandMod(2) == 0) {
|
||||
return encounterSlot;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "consts/gender.h"
|
||||
|
||||
#include "struct_defs/archived_sprite.h"
|
||||
#include "struct_defs/struct_0200C738.h"
|
||||
|
||||
@@ -18,20 +20,7 @@
|
||||
#include "unk_0200A328.h"
|
||||
#include "unk_020131EC.h"
|
||||
|
||||
typedef struct UnkStruct_ov6_022426B8_t {
|
||||
SpriteResourceCollection *unk_00[4];
|
||||
SpriteResource *unk_10[4];
|
||||
void *unk_20;
|
||||
void *unk_24;
|
||||
ArchivedSprite unk_28;
|
||||
CellActorCollection *unk_38;
|
||||
UnkStruct_0200C738 unk_3C;
|
||||
CellActor *unk_1C8;
|
||||
BOOL unk_1CC;
|
||||
BOOL unk_1D0;
|
||||
} UnkStruct_ov6_022426B8;
|
||||
|
||||
static void ov6_022428F8(UnkStruct_ov6_022426B8 *param0);
|
||||
static void ov6_022428F8(GreatMarshLookout_SpriteResources *param0);
|
||||
static void ov6_02242860(SysTask *param0, void *param1);
|
||||
static void ov6_02242880(SpriteResourceCollection *param0, SpriteResourceCollection *param1, void *param2, void *param3);
|
||||
|
||||
@@ -42,77 +31,67 @@ static const u8 Unk_ov6_02249030[] = {
|
||||
0x1
|
||||
};
|
||||
|
||||
UnkStruct_ov6_022426B8 *ov6_022426AC(const int param0)
|
||||
GreatMarshLookout_SpriteResources *GreatMarshLookout_AllocSpriteResources(const int heapId)
|
||||
{
|
||||
UnkStruct_ov6_022426B8 *v0;
|
||||
|
||||
v0 = Heap_AllocFromHeapAtEnd(param0, sizeof(UnkStruct_ov6_022426B8));
|
||||
return v0;
|
||||
return Heap_AllocFromHeapAtEnd(heapId, sizeof(GreatMarshLookout_SpriteResources));
|
||||
}
|
||||
|
||||
void ov6_022426B8(UnkStruct_ov6_022426B8 *param0)
|
||||
void GreatMarshLookout_FreeSpriteResources(GreatMarshLookout_SpriteResources *resources)
|
||||
{
|
||||
Heap_FreeToHeap(param0);
|
||||
Heap_FreeToHeap(resources);
|
||||
}
|
||||
|
||||
void ov6_022426C0(UnkStruct_ov6_022426B8 *param0, const int param1)
|
||||
void GreatMarshLookout_CreateLookoutMonSprite(GreatMarshLookout_SpriteResources *resources, const int species)
|
||||
{
|
||||
int v0;
|
||||
int i;
|
||||
NARC *v1;
|
||||
|
||||
param0->unk_1CC = 0;
|
||||
resources->unk_1CC = 0;
|
||||
|
||||
{
|
||||
int v2;
|
||||
u8 v3;
|
||||
int gender;
|
||||
u8 genderRatio = PokemonPersonalData_GetSpeciesValue(species, MON_DATA_PERSONAL_GENDER);
|
||||
|
||||
v3 = PokemonPersonalData_GetSpeciesValue(param1, 18);
|
||||
|
||||
switch (v3) {
|
||||
case 0:
|
||||
v2 = 0;
|
||||
break;
|
||||
case 254:
|
||||
v2 = 1;
|
||||
break;
|
||||
case 255:
|
||||
v2 = 2;
|
||||
break;
|
||||
default:
|
||||
if (LCRNG_Next() % 2) {
|
||||
v2 = 0;
|
||||
} else {
|
||||
v2 = 1;
|
||||
}
|
||||
switch (genderRatio) {
|
||||
case GENDER_RATIO_MALE_ONLY:
|
||||
gender = GENDER_MALE;
|
||||
break;
|
||||
case GENDER_RATIO_FEMALE_ONLY:
|
||||
gender = GENDER_FEMALE;
|
||||
break;
|
||||
case GENDER_RATIO_NO_GENDER:
|
||||
gender = GENDER_NONE;
|
||||
break;
|
||||
default:
|
||||
if (LCRNG_Next() % 2) {
|
||||
gender = GENDER_MALE;
|
||||
} else {
|
||||
gender = GENDER_FEMALE;
|
||||
}
|
||||
|
||||
BuildArchivedPokemonSprite(¶m0->unk_28, param1, v2, 2, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
param0->unk_38 = sub_020095C4(1, ¶m0->unk_3C, 4);
|
||||
v1 = NARC_ctor(NARC_INDEX_DATA__FIELD_CUTIN, 4);
|
||||
BuildArchivedPokemonSprite(&resources->unk_28, species, gender, 2, 0, NULL, NULL);
|
||||
|
||||
for (v0 = 0; v0 < 4; v0++) {
|
||||
param0->unk_00[v0] = SpriteResourceCollection_New(Unk_ov6_02249030[v0], v0, 4);
|
||||
resources->unk_38 = sub_020095C4(1, &resources->unk_3C, HEAP_ID_FIELD);
|
||||
v1 = NARC_ctor(NARC_INDEX_DATA__FIELD_CUTIN, HEAP_ID_FIELD);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
resources->unk_00[i] = SpriteResourceCollection_New(Unk_ov6_02249030[i], i, HEAP_ID_FIELD);
|
||||
}
|
||||
|
||||
{
|
||||
param0->unk_10[0] = SpriteResourceCollection_AddTilesFrom(param0->unk_00[0], v1, 5, 0, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 4);
|
||||
param0->unk_10[1] = SpriteResourceCollection_AddPaletteFrom(param0->unk_00[1], v1, 3, 0, 1, NNS_G2D_VRAM_TYPE_2DMAIN, 1, 4);
|
||||
param0->unk_10[2] = SpriteResourceCollection_AddFrom(param0->unk_00[2], v1, 6, 0, 2, 2, 4);
|
||||
param0->unk_10[3] = SpriteResourceCollection_AddFrom(param0->unk_00[3], v1, 12, 0, 3, 3, 4);
|
||||
}
|
||||
resources->unk_10[0] = SpriteResourceCollection_AddTilesFrom(resources->unk_00[0], v1, 5, 0, 0, NNS_G2D_VRAM_TYPE_2DMAIN, HEAP_ID_FIELD);
|
||||
resources->unk_10[1] = SpriteResourceCollection_AddPaletteFrom(resources->unk_00[1], v1, 3, 0, 1, NNS_G2D_VRAM_TYPE_2DMAIN, 1, HEAP_ID_FIELD);
|
||||
resources->unk_10[2] = SpriteResourceCollection_AddFrom(resources->unk_00[2], v1, 6, 0, 2, 2, HEAP_ID_FIELD);
|
||||
resources->unk_10[3] = SpriteResourceCollection_AddFrom(resources->unk_00[3], v1, 12, 0, 3, 3, HEAP_ID_FIELD);
|
||||
resources->unk_20 = sub_0201363C(resources->unk_28.archive, resources->unk_28.character, HEAP_ID_FIELD);
|
||||
resources->unk_24 = sub_02013660(resources->unk_28.archive, resources->unk_28.palette, HEAP_ID_FIELD);
|
||||
|
||||
param0->unk_20 = sub_0201363C(param0->unk_28.archive, param0->unk_28.character, 4);
|
||||
param0->unk_24 = sub_02013660(param0->unk_28.archive, param0->unk_28.palette, 4);
|
||||
|
||||
ov6_02242880(param0->unk_00[0], param0->unk_00[1], param0->unk_20, param0->unk_24);
|
||||
ov6_02242880(resources->unk_00[0], resources->unk_00[1], resources->unk_20, resources->unk_24);
|
||||
|
||||
NARC_dtor(v1);
|
||||
ov6_022428F8(param0);
|
||||
ov6_022428F8(resources);
|
||||
}
|
||||
|
||||
void ov6_022427F4(UnkStruct_ov6_022426B8 *param0)
|
||||
void ov6_022427F4(GreatMarshLookout_SpriteResources *param0)
|
||||
{
|
||||
param0->unk_1CC = 1;
|
||||
param0->unk_1D0 = 0;
|
||||
@@ -120,17 +99,17 @@ void ov6_022427F4(UnkStruct_ov6_022426B8 *param0)
|
||||
SysTask_Start(ov6_02242860, param0, 0);
|
||||
}
|
||||
|
||||
void ov6_02242814(UnkStruct_ov6_022426B8 *param0)
|
||||
void ov6_02242814(GreatMarshLookout_SpriteResources *param0)
|
||||
{
|
||||
param0->unk_1CC = 0;
|
||||
}
|
||||
|
||||
BOOL ov6_02242820(UnkStruct_ov6_022426B8 *param0)
|
||||
BOOL ov6_02242820(GreatMarshLookout_SpriteResources *param0)
|
||||
{
|
||||
return param0->unk_1D0;
|
||||
}
|
||||
|
||||
void ov6_02242828(UnkStruct_ov6_022426B8 *param0)
|
||||
void ov6_02242828(GreatMarshLookout_SpriteResources *param0)
|
||||
{
|
||||
u8 v0;
|
||||
|
||||
@@ -148,7 +127,7 @@ void ov6_02242828(UnkStruct_ov6_022426B8 *param0)
|
||||
|
||||
static void ov6_02242860(SysTask *param0, void *param1)
|
||||
{
|
||||
UnkStruct_ov6_022426B8 *v0 = param1;
|
||||
GreatMarshLookout_SpriteResources *v0 = param1;
|
||||
|
||||
if (v0->unk_1CC) {
|
||||
CellActorCollection_Update(v0->unk_38);
|
||||
@@ -188,7 +167,7 @@ static void ov6_02242880(SpriteResourceCollection *param0, SpriteResourceCollect
|
||||
GX_LoadOBJPltt(param3, v2, v0);
|
||||
}
|
||||
|
||||
static void ov6_022428F8(UnkStruct_ov6_022426B8 *param0)
|
||||
static void ov6_022428F8(GreatMarshLookout_SpriteResources *param0)
|
||||
{
|
||||
int v0;
|
||||
CellActorResourceData v1;
|
||||
@@ -209,7 +188,7 @@ static void ov6_022428F8(UnkStruct_ov6_022426B8 *param0)
|
||||
v2.affineZRotation = 0;
|
||||
v2.priority = 0;
|
||||
v2.vramType = NNS_G2D_VRAM_TYPE_2DMAIN;
|
||||
v2.heapID = 4;
|
||||
v2.heapID = HEAP_ID_FIELD;
|
||||
v2.position.x = FX32_ONE * (256 / 2);
|
||||
v2.position.y = FX32_ONE * (192 / 2);
|
||||
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
#include "overlay006/ov6_02242984.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "field/field_system.h"
|
||||
#include "overlay006/ov6_02240C9C.h"
|
||||
#include "overlay006/ov6_02242F74.h"
|
||||
#include "overlay006/ov6_022477B8.h"
|
||||
#include "overlay006/wild_encounters.h"
|
||||
|
||||
#include "field_system.h"
|
||||
#include "heap.h"
|
||||
#include "inlines.h"
|
||||
#include "location.h"
|
||||
#include "map_header_data.h"
|
||||
#include "narc.h"
|
||||
#include "player_avatar.h"
|
||||
#include "pokedex.h"
|
||||
#include "unk_0202D7A8.h"
|
||||
#include "unk_02039C80.h"
|
||||
|
||||
typedef struct {
|
||||
u16 unk_00;
|
||||
u16 unk_02;
|
||||
} UnkStruct_ov6_02242A10;
|
||||
|
||||
typedef struct UnkStruct_ov6_02242A8C_t {
|
||||
UnkStruct_ov6_02242A10 unk_00[6];
|
||||
Location unk_18;
|
||||
FieldSystem *fieldSystem;
|
||||
int unk_30;
|
||||
} UnkStruct_ov6_02242A8C;
|
||||
|
||||
int ov6_02242984(FieldSystem *fieldSystem)
|
||||
{
|
||||
int v2[MAX_GRASS_ENCOUNTERS];
|
||||
|
||||
WildEncounters *encounterData = MapHeaderData_GetWildEncounters(fieldSystem);
|
||||
|
||||
for (u8 i = 0; i < MAX_GRASS_ENCOUNTERS; i++) {
|
||||
v2[i] = encounterData->grassEncounters.encounters[i].species;
|
||||
}
|
||||
|
||||
BOOL v1 = Pokedex_IsNationalDexObtained(SaveData_GetPokedex(FieldSystem_GetSaveData(fieldSystem)));
|
||||
|
||||
ov6_02242F74(sub_0202D814(sub_0202D834(fieldSystem->saveData), 1), v1, fieldSystem->location->mapId, &v2[6], &v2[7]);
|
||||
WildEncounters_ReplaceTimedEncounters(encounterData, &v2[2], &v2[3]);
|
||||
WildEncounters_ReplaceDualSlotEncounters(encounterData, v1, &v2[8], &v2[9]);
|
||||
|
||||
return v2[inline_020564D0(MAX_GRASS_ENCOUNTERS)];
|
||||
}
|
||||
|
||||
UnkStruct_ov6_02242A8C *ov6_02242A10(const int param0, FieldSystem *fieldSystem)
|
||||
{
|
||||
u8 v0;
|
||||
UnkStruct_ov6_02242A8C *v1;
|
||||
|
||||
v1 = Heap_AllocFromHeapAtEnd(param0, sizeof(UnkStruct_ov6_02242A8C));
|
||||
v1->fieldSystem = fieldSystem;
|
||||
|
||||
{
|
||||
u8 v2;
|
||||
UnkStruct_ov6_02242A10 *v3;
|
||||
|
||||
v3 = NARC_AllocAtEndAndReadWholeMemberByIndexPair(NARC_INDEX_ARC__ENCDATA_EX, 11, 4);
|
||||
|
||||
for (v0 = 0; v0 < 5; v0++) {
|
||||
v2 = inline_020564D0(36);
|
||||
v1->unk_00[v0].unk_00 = v3[v2].unk_00;
|
||||
v1->unk_00[v0].unk_02 = v3[v2].unk_02;
|
||||
}
|
||||
|
||||
{
|
||||
v1->unk_00[5].unk_00 = Player_GetXPos(fieldSystem->playerAvatar);
|
||||
v1->unk_00[5].unk_02 = Player_GetZPos(fieldSystem->playerAvatar);
|
||||
v1->unk_30 = fieldSystem->location->mapId;
|
||||
}
|
||||
|
||||
Heap_FreeToHeap(v3);
|
||||
}
|
||||
|
||||
return v1;
|
||||
}
|
||||
|
||||
void ov6_02242A8C(UnkStruct_ov6_02242A8C *param0)
|
||||
{
|
||||
Heap_FreeToHeap(param0);
|
||||
}
|
||||
|
||||
void ov6_02242A94(const u8 param0, UnkStruct_ov6_02242A8C *param1)
|
||||
{
|
||||
int v0;
|
||||
int v1, v2;
|
||||
|
||||
if (param0 == 0) {
|
||||
int v3;
|
||||
|
||||
v3 = 240;
|
||||
v1 = param1->unk_00[param0].unk_00 / 32;
|
||||
v2 = param1->unk_00[param0].unk_02 / 32;
|
||||
v0 = sub_02039F10(v3, v1, v2);
|
||||
} else if (param0 == 5) {
|
||||
v0 = param1->unk_30;
|
||||
} else {
|
||||
v1 = param1->unk_00[param0].unk_00 / 32;
|
||||
v2 = param1->unk_00[param0].unk_02 / 32;
|
||||
v0 = sub_02039E30(param1->fieldSystem->unk_2C, v1, v2);
|
||||
}
|
||||
|
||||
Location_Set(¶m1->unk_18, v0, -1, param1->unk_00[param0].unk_00, param1->unk_00[param0].unk_02, 0);
|
||||
}
|
||||
|
||||
Location *ov6_02242AEC(UnkStruct_ov6_02242A8C *param0)
|
||||
{
|
||||
return ¶m0->unk_18;
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
#include "overlay006/ov6_02242F74.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "heap.h"
|
||||
#include "narc.h"
|
||||
|
||||
static u8 ov6_02242FC0(const int param0);
|
||||
|
||||
void ov6_02242F74(const int param0, const BOOL param1, const int param2, int *param3, int *param4)
|
||||
{
|
||||
int *v0;
|
||||
int v1;
|
||||
u8 v2;
|
||||
u8 v3 = ov6_02242FC0(param2);
|
||||
|
||||
if (param1) {
|
||||
v1 = 9;
|
||||
} else {
|
||||
v1 = 10;
|
||||
}
|
||||
|
||||
v0 = NARC_AllocAtEndAndReadWholeMemberByIndexPair(NARC_INDEX_ARC__ENCDATA_EX, v1, 4);
|
||||
v2 = ((param0 >> (5 * v3)) & 0x1f);
|
||||
v2 %= 32;
|
||||
|
||||
(*param3) = v0[v2];
|
||||
(*param4) = v0[v2];
|
||||
|
||||
Heap_FreeToHeap(v0);
|
||||
}
|
||||
|
||||
static u8 ov6_02242FC0(const int param0)
|
||||
{
|
||||
u8 v0 = 0;
|
||||
|
||||
switch (param0) {
|
||||
case 504:
|
||||
v0 = 0;
|
||||
break;
|
||||
case 505:
|
||||
v0 = 1;
|
||||
break;
|
||||
case 506:
|
||||
v0 = 2;
|
||||
break;
|
||||
case 507:
|
||||
v0 = 3;
|
||||
break;
|
||||
case 508:
|
||||
v0 = 4;
|
||||
break;
|
||||
case 509:
|
||||
v0 = 5;
|
||||
break;
|
||||
default:
|
||||
GF_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
return v0;
|
||||
}
|
||||
@@ -19,7 +19,7 @@ int ov6_022430C4(FieldSystem *fieldSystem)
|
||||
int v1;
|
||||
UnkStruct_020698E4 *v2;
|
||||
|
||||
v2 = sub_0202D830(sub_0202D834(fieldSystem->saveData));
|
||||
v2 = sub_0202D830(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
v1 = 0;
|
||||
|
||||
for (v0 = 0; v0 < 3; v0++) {
|
||||
@@ -38,7 +38,7 @@ int ov6_022430E8(FieldSystem *fieldSystem, const u8 param1)
|
||||
|
||||
GF_ASSERT(param1 < 3);
|
||||
|
||||
v0 = sub_0202D830(sub_0202D834(fieldSystem->saveData));
|
||||
v0 = sub_0202D830(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
ov6_022431A0(v0, v1);
|
||||
|
||||
return v1[param1]->unk_00;
|
||||
@@ -50,7 +50,7 @@ int ov6_02243114(FieldSystem *fieldSystem, const u8 param1)
|
||||
UnkStruct_ov6_022430E8 *v1[3];
|
||||
|
||||
GF_ASSERT(param1 < 3);
|
||||
v0 = sub_0202D830(sub_0202D834(fieldSystem->saveData));
|
||||
v0 = sub_0202D830(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
|
||||
ov6_022431A0(v0, v1);
|
||||
return v1[param1]->unk_02;
|
||||
|
||||
@@ -19,22 +19,22 @@
|
||||
#include "unk_0206AFE0.h"
|
||||
#include "vars_flags.h"
|
||||
|
||||
static void ov6_02246110(UnkStruct_0202D7B0 *param0, const int param1);
|
||||
static UnkStruct_0206C638 *ov6_02246148(UnkStruct_0202D7B0 *param0, const int param1);
|
||||
static void ov6_02246110(SpecialEncounter *param0, const int param1);
|
||||
static Roamer *ov6_02246148(SpecialEncounter *param0, const int param1);
|
||||
|
||||
void ov6_02246034(FieldSystem *fieldSystem, FieldBattleDTO *param1)
|
||||
{
|
||||
u16 v0;
|
||||
u8 v1;
|
||||
int v2;
|
||||
UnkStruct_0202D7B0 *v3;
|
||||
UnkStruct_0206C638 *v4;
|
||||
SpecialEncounter *v3;
|
||||
Roamer *v4;
|
||||
Party *v5;
|
||||
Pokemon *v6;
|
||||
|
||||
v5 = param1->parties[1];
|
||||
v6 = Party_GetPokemonBySlotIndex(v5, 0);
|
||||
v3 = sub_0202D834(fieldSystem->saveData);
|
||||
v3 = SaveData_GetSpecialEncounters(fieldSystem->saveData);
|
||||
v2 = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL);
|
||||
v4 = ov6_02246148(v3, v2);
|
||||
|
||||
@@ -55,13 +55,13 @@ void ov6_02246034(FieldSystem *fieldSystem, FieldBattleDTO *param1)
|
||||
|
||||
ov6_02246110(v3, fieldSystem->location->mapId);
|
||||
} else {
|
||||
if (inline_020564D0(100) < 30) {
|
||||
if (LCRNG_RandMod(100) < 30) {
|
||||
ov6_02246110(v3, fieldSystem->location->mapId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ov6_02246110(UnkStruct_0202D7B0 *param0, const int param1)
|
||||
static void ov6_02246110(SpecialEncounter *param0, const int param1)
|
||||
{
|
||||
int v0;
|
||||
u8 v1;
|
||||
@@ -77,10 +77,10 @@ static void ov6_02246110(UnkStruct_0202D7B0 *param0, const int param1)
|
||||
}
|
||||
}
|
||||
|
||||
static UnkStruct_0206C638 *ov6_02246148(UnkStruct_0202D7B0 *param0, const int param1)
|
||||
static Roamer *ov6_02246148(SpecialEncounter *param0, const int param1)
|
||||
{
|
||||
u8 v0;
|
||||
UnkStruct_0206C638 *v1;
|
||||
Roamer *v1;
|
||||
|
||||
for (v0 = 0; v0 < 6; v0++) {
|
||||
if (sub_0202D8F8(param0, v0)) {
|
||||
|
||||
@@ -13,7 +13,7 @@ BOOL ov6_02246BF4(SaveData *param0, FieldSystem *fieldSystem)
|
||||
{
|
||||
u8 *v0;
|
||||
|
||||
v0 = sub_0202D9CC(sub_0202D834(param0));
|
||||
v0 = sub_0202D9CC(SaveData_GetSpecialEncounters(param0));
|
||||
|
||||
if ((*v0) > 0) {
|
||||
(*v0)--;
|
||||
|
||||
@@ -33,7 +33,7 @@ void ov6_022475B0(SaveData *param0)
|
||||
}
|
||||
|
||||
while (TRUE) {
|
||||
v0 = inline_020564D0(16);
|
||||
v0 = LCRNG_RandMod(16);
|
||||
|
||||
if ((v3[0] != v4[v0]) && (v3[1] != v4[v0])) {
|
||||
sub_0202DA24(param0, v0);
|
||||
|
||||
@@ -31,7 +31,7 @@ BOOL ov6_02247660(FieldSystem *fieldSystem)
|
||||
int v14;
|
||||
int v15, v16;
|
||||
|
||||
if (inline_020564D0(2) == 0) {
|
||||
if (LCRNG_RandMod(2) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1700,7 +1700,7 @@ int ov17_02243174(int param0)
|
||||
v0 = param0 / 50;
|
||||
|
||||
if (v0 >= (NELEMS(Unk_ov17_022536FC))) {
|
||||
v0 = (NELEMS(Unk_ov17_022536FC)) - 1;
|
||||
v0 = NELEMS(Unk_ov17_022536FC) - 1;
|
||||
}
|
||||
|
||||
v1 = Unk_ov17_022536FC[v0];
|
||||
|
||||
@@ -28,7 +28,7 @@ typedef struct {
|
||||
UnkStruct_ov47_02256634 *unk_70;
|
||||
PoketchSystem *poketchSys;
|
||||
Poketch *poketch;
|
||||
UnkStruct_0206C638 *unk_7C[6];
|
||||
Roamer *unk_7C[6];
|
||||
u8 unk_94[6];
|
||||
u8 unk_9A;
|
||||
} UnkStruct_ov47_0225621C;
|
||||
@@ -102,7 +102,7 @@ static BOOL ov47_0225621C(UnkStruct_ov47_0225621C *param0, PoketchSystem *poketc
|
||||
}
|
||||
|
||||
{
|
||||
UnkStruct_0202D7B0 *v2 = sub_0202D834(PoketchSystem_GetSaveData(poketchSys));
|
||||
SpecialEncounter *v2 = SaveData_GetSpecialEncounters(PoketchSystem_GetSaveData(poketchSys));
|
||||
|
||||
for (v0 = 0; v0 < 6; v0++) {
|
||||
param0->unk_7C[v0] = sub_0202D924(v2, v0);
|
||||
|
||||
@@ -602,9 +602,9 @@ static void ov84_0223B9AC(UnkStruct_ov84_0223B5A0 *param0)
|
||||
param0->unk_D0 = SaveData_Options(param0->unk_C4->unk_00);
|
||||
}
|
||||
|
||||
static UnkStruct_0202D7B0 *ov84_0223B9E4(UnkStruct_ov84_0223B5A0 *param0)
|
||||
static SpecialEncounter *ov84_0223B9E4(UnkStruct_ov84_0223B5A0 *param0)
|
||||
{
|
||||
return sub_0202D834(param0->unk_C4->unk_00);
|
||||
return SaveData_GetSpecialEncounters(param0->unk_C4->unk_00);
|
||||
}
|
||||
|
||||
static void ov84_0223B9F4(UnkStruct_ov84_0223B5A0 *param0, u8 param1)
|
||||
|
||||
@@ -594,7 +594,7 @@ static int ov88_0223B914(UnkStruct_02095E80 *param0)
|
||||
}
|
||||
|
||||
if (CommSys_CurNetId() == 0) {
|
||||
ov88_0223D044(CommSys_CurNetId(), 31, inline_020564D0(60) + 3);
|
||||
ov88_0223D044(CommSys_CurNetId(), 31, LCRNG_RandMod(60) + 3);
|
||||
}
|
||||
|
||||
ov88_0223D0C0(param0->unk_04);
|
||||
|
||||
@@ -1255,7 +1255,7 @@ void ov94_02242934(UnkStruct_ov94_0223BA88_sub3 *param0, int param1, int param2)
|
||||
GF_ASSERT(param1 < (13 - 1));
|
||||
} else {
|
||||
v0 = Unk_ov94_022460AC;
|
||||
GF_ASSERT(param1 < ((NELEMS(Unk_ov94_022460AC)) - 1));
|
||||
GF_ASSERT(param1 < (NELEMS(Unk_ov94_022460AC) - 1));
|
||||
}
|
||||
|
||||
param0->unk_03 = v0[param1].unk_04;
|
||||
|
||||
@@ -1162,7 +1162,7 @@ static int ov94_02243990(UnkStruct_ov94_0223FD4C *param0)
|
||||
SaveData_SaveStateInit(param0->unk_00->unk_20, 2);
|
||||
|
||||
param0->unk_2C = 31;
|
||||
param0->unk_10E0 = inline_020564D0(60) + 2;
|
||||
param0->unk_10E0 = LCRNG_RandMod(60) + 2;
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -1495,7 +1495,7 @@ void ov104_0223B0C8(u8 param0, u8 param1, u8 param2, u8 param3, u16 param4, u16
|
||||
}
|
||||
|
||||
if (v7 == (NELEMS(Unk_ov104_02240714))) {
|
||||
v9 = Unk_ov104_0224032C[(NELEMS(Unk_ov104_0224032C)) - 1].unk_00;
|
||||
v9 = Unk_ov104_0224032C[NELEMS(Unk_ov104_0224032C) - 1].unk_00;
|
||||
}
|
||||
|
||||
for (v7 = 0; v7 < (NELEMS(Unk_ov104_0224032C)); v7++) {
|
||||
@@ -1505,11 +1505,11 @@ void ov104_0223B0C8(u8 param0, u8 param1, u8 param2, u8 param3, u16 param4, u16
|
||||
}
|
||||
|
||||
if (v7 == (NELEMS(Unk_ov104_0224032C))) {
|
||||
v7 = ((NELEMS(Unk_ov104_0224032C)) - 1);
|
||||
v7 = (NELEMS(Unk_ov104_0224032C) - 1);
|
||||
}
|
||||
|
||||
if (param6 == 2) {
|
||||
v0 = &Unk_ov104_0224032C[((NELEMS(Unk_ov104_0224032C)) - 1)];
|
||||
v0 = &Unk_ov104_0224032C[(NELEMS(Unk_ov104_0224032C) - 1)];
|
||||
} else {
|
||||
v0 = &Unk_ov104_0224032C[v7];
|
||||
}
|
||||
|
||||
@@ -811,9 +811,9 @@ static void ov105_022424CC(UnkStruct_ov105_02241FF4 *param0)
|
||||
ov105_0224628C(¶m0->unk_50[5], Options_Frame(param0->unk_138));
|
||||
|
||||
if (ov104_0223AED4(param0->unk_09) == 0) {
|
||||
param0->unk_30C = ov105_02245FB8(¶m0->unk_144, param0->unk_1A, ((NELEMS(Unk_ov105_02246340)) - 1), 2, param0->unk_334, Unk_ov105_02246340, Unk_ov105_022462D0);
|
||||
param0->unk_30C = ov105_02245FB8(¶m0->unk_144, param0->unk_1A, (NELEMS(Unk_ov105_02246340) - 1), 2, param0->unk_334, Unk_ov105_02246340, Unk_ov105_022462D0);
|
||||
} else {
|
||||
param0->unk_30C = ov105_02245FB8(¶m0->unk_144, param0->unk_1A, ((NELEMS(Unk_ov105_022462FC)) - 1), 2, param0->unk_334, Unk_ov105_022462FC, Unk_ov105_022462CC);
|
||||
param0->unk_30C = ov105_02245FB8(¶m0->unk_144, param0->unk_1A, (NELEMS(Unk_ov105_022462FC) - 1), 2, param0->unk_334, Unk_ov105_022462FC, Unk_ov105_022462CC);
|
||||
}
|
||||
|
||||
ov105_02244F0C(param0, ¶m0->unk_50[0], 0, 0, 0);
|
||||
@@ -1624,9 +1624,9 @@ static BOOL ov105_02243A3C(UnkStruct_ov105_02241FF4 *param0)
|
||||
Window_ScheduleCopyToVRAM(¶m0->unk_50[7]);
|
||||
|
||||
if (ov104_0223AED4(param0->unk_09) == 0) {
|
||||
param0->unk_30C = ov105_02245FB8(¶m0->unk_144, param0->unk_1B, ((NELEMS(Unk_ov105_02246350)) - 2), 2, 0, Unk_ov105_02246350, Unk_ov105_022462D4);
|
||||
param0->unk_30C = ov105_02245FB8(¶m0->unk_144, param0->unk_1B, (NELEMS(Unk_ov105_02246350) - 2), 2, 0, Unk_ov105_02246350, Unk_ov105_022462D4);
|
||||
} else {
|
||||
param0->unk_30C = ov105_02245FB8(¶m0->unk_144, param0->unk_1B, ((NELEMS(Unk_ov105_0224637C)) - 2), 2, 0, Unk_ov105_0224637C, Unk_ov105_022462E4);
|
||||
param0->unk_30C = ov105_02245FB8(¶m0->unk_144, param0->unk_1B, (NELEMS(Unk_ov105_0224637C) - 2), 2, 0, Unk_ov105_0224637C, Unk_ov105_022462E4);
|
||||
}
|
||||
|
||||
v3 = ov105_022461A0(param0->unk_30C);
|
||||
|
||||
@@ -3484,7 +3484,7 @@ static void ov115_0226414C(UnkStruct_ov115_02263DF8 *param0, u32 param1)
|
||||
param1 -= ((20 * 0xffff) / 360);
|
||||
v0 = (param1 * 90) / CalcAngleRotationIdx_Wraparound(90 - ((20 * 0xffff) / 360));
|
||||
v0 = (v0 * (FX32_CONST(180))) / 90;
|
||||
v0 = (FX32_CONST(180)) - v0;
|
||||
v0 = FX32_CONST(180) - v0;
|
||||
|
||||
Easy3DAnim_SetFrame(¶m0->unk_198[1], v0);
|
||||
}
|
||||
@@ -3799,7 +3799,7 @@ static void ov115_02264848(UnkStruct_ov115_022647A0 *param0)
|
||||
v0 = ov115_02262888(param0->unk_F8);
|
||||
|
||||
if (v0 == 0) {
|
||||
v2 = ((FX32_CONST(-50)) - FX32_CONST(1));
|
||||
v2 = (FX32_CONST(-50) - FX32_CONST(1));
|
||||
} else {
|
||||
v2 = (FX32_CONST(-300));
|
||||
}
|
||||
@@ -4138,7 +4138,7 @@ static void ov115_02264E48(UnkStruct_ov115_02264FA0 *param0, UnkStruct_ov115_022
|
||||
|
||||
Easy3DModel_LoadFrom(¶m0->unk_168[v4], param2, v3, param5);
|
||||
Easy3DObject_Init(¶m0->unk_00[v4], ¶m0->unk_168[v4]);
|
||||
Easy3DObject_SetPosition(¶m0->unk_00[v4], 0, ((FX32_CONST(-90)) - FX32_CONST(8)), 0);
|
||||
Easy3DObject_SetPosition(¶m0->unk_00[v4], 0, (FX32_CONST(-90) - FX32_CONST(8)), 0);
|
||||
Easy3DObject_SetScale(¶m0->unk_00[v4], (FX32_CONST(1.50f)), (FX32_CONST(1.50f)), (FX32_CONST(1.50f)));
|
||||
|
||||
if (v4 == 1) {
|
||||
|
||||
@@ -109,7 +109,7 @@ BOOL RadarSpawnPatches(FieldSystem *fieldSystem, const int param1, const int par
|
||||
v7 = 0;
|
||||
|
||||
for (u8 patchRing = 0; patchRing < NUM_GRASS_PATCHES; patchRing++) {
|
||||
v3 = inline_020564D0(ringTileCount[patchRing]);
|
||||
v3 = LCRNG_RandMod(ringTileCount[patchRing]);
|
||||
v1 = 9 - (patchRing * 2);
|
||||
v2 = 9 - (patchRing * 2);
|
||||
v4 = v3 / v1;
|
||||
@@ -153,7 +153,7 @@ void SetupGrassPatches(FieldSystem *fieldSystem, const int param1, RadarChain *c
|
||||
if (chain->patch[patchRing].active) {
|
||||
chain->patch[patchRing].continueChain = CheckPatchContinueChain(patchRing, param1);
|
||||
if (!chain->patch[patchRing].continueChain) {
|
||||
if (inline_020564D0(100) < 50) { // If the patch will break the chain, it has a 50/50 chance of shaking the other type
|
||||
if (LCRNG_RandMod(100) < 50) { // If the patch will break the chain, it has a 50/50 chance of shaking the other type
|
||||
chain->patch[patchRing].shakeType = PATCH_SHAKE_SOFT;
|
||||
} else {
|
||||
chain->patch[patchRing].shakeType = PATCH_SHAKE_HARD;
|
||||
@@ -350,7 +350,7 @@ static BOOL sub_020698AC(const RadarChain *chain, const int param1, const int pa
|
||||
|
||||
static void sub_020698E4(FieldSystem *fieldSystem, RadarChain *chain)
|
||||
{
|
||||
UnkStruct_020698E4 *v0 = sub_0202D830(sub_0202D834(fieldSystem->saveData));
|
||||
UnkStruct_020698E4 *v0 = sub_0202D830(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
int v1 = v0->unk_00[chain->unk_D0].unk_02;
|
||||
|
||||
if (v1 < chain->count) {
|
||||
@@ -373,7 +373,7 @@ static u8 sub_0206994C(FieldSystem *fieldSystem)
|
||||
{
|
||||
u8 v1;
|
||||
BOOL v2;
|
||||
UnkStruct_020698E4 *v0 = sub_0202D830(sub_0202D834(fieldSystem->saveData));
|
||||
UnkStruct_020698E4 *v0 = sub_0202D830(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
|
||||
for (v1 = 0; v1 < 3; v1++) {
|
||||
if (v0->unk_00[v1].unk_00 == 0) {
|
||||
@@ -408,7 +408,7 @@ static BOOL CheckPatchContinueChain(const u8 patchRing, const int battleResult)
|
||||
rates = ratesBoosted;
|
||||
}
|
||||
|
||||
if (inline_020564D0(100) < rates[patchRing]) { // Check if random number falls within the rates
|
||||
if (LCRNG_RandMod(100) < rates[patchRing]) { // Check if random number falls within the rates
|
||||
return TRUE; // Patch will continue the chain
|
||||
} else {
|
||||
return FALSE; // Patch will break the chain
|
||||
@@ -423,7 +423,7 @@ BOOL RefreshRadarChain(FieldTask *taskMan)
|
||||
switch (*v1) {
|
||||
case 0:
|
||||
MapObjectMan_PauseAllMovement(fieldSystem->mapObjMan);
|
||||
u8 *v2 = sub_0202D9C4(sub_0202D834(fieldSystem->saveData));
|
||||
u8 *v2 = sub_0202D9C4(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
|
||||
if (*v2 < RADAR_BATTERY_STEPS) {
|
||||
ScriptManager_Start(taskMan, 8970, NULL, NULL);
|
||||
@@ -477,7 +477,7 @@ static BOOL CheckPatchShiny(const int chainCount)
|
||||
rate = 200;
|
||||
}
|
||||
|
||||
if (!inline_020564D0(rate)) {
|
||||
if (!LCRNG_RandMod(rate)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
@@ -500,7 +500,7 @@ void RadarChargeStep(FieldSystem *fieldSystem)
|
||||
u8 *v0;
|
||||
|
||||
if (Bag_CanRemoveItem(SaveData_GetBag(fieldSystem->saveData), 431, 1, 4) == 1) {
|
||||
v0 = sub_0202D9C4(sub_0202D834(fieldSystem->saveData));
|
||||
v0 = sub_0202D9C4(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
if ((*v0) < RADAR_BATTERY_STEPS) {
|
||||
(*v0)++;
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ typedef struct {
|
||||
u16 unk_02[5];
|
||||
} UnkStruct_020EFBB8;
|
||||
|
||||
static void sub_0206C538(UnkStruct_0202D7B0 *param0, const u8 param1, const int param2);
|
||||
static void sub_0206C588(UnkStruct_0202D7B0 *param0, const u8 param1, const int param2);
|
||||
static void sub_0206C638(UnkStruct_0202D7B0 *param0, const u8 param1, const u8 param2, const int param3);
|
||||
static void sub_0206C538(SpecialEncounter *param0, const u8 param1, const int param2);
|
||||
static void sub_0206C588(SpecialEncounter *param0, const u8 param1, const int param2);
|
||||
static void sub_0206C638(SpecialEncounter *param0, const u8 param1, const u8 param2, const int param3);
|
||||
|
||||
static const UnkStruct_020EFBB8 Unk_020EFBB8[29] = {
|
||||
{
|
||||
@@ -176,7 +176,7 @@ static const int RoamingPokemonRoutes[29] = {
|
||||
0xCC,
|
||||
};
|
||||
|
||||
void sub_0206C33C(UnkStruct_0202D7B0 *param0, const u8 param1)
|
||||
void sub_0206C33C(SpecialEncounter *param0, const u8 param1)
|
||||
{
|
||||
int v0;
|
||||
|
||||
@@ -184,7 +184,7 @@ void sub_0206C33C(UnkStruct_0202D7B0 *param0, const u8 param1)
|
||||
sub_0206C538(param0, param1, v0);
|
||||
}
|
||||
|
||||
void sub_0206C354(UnkStruct_0202D7B0 *param0)
|
||||
void sub_0206C354(SpecialEncounter *param0)
|
||||
{
|
||||
u8 v0;
|
||||
|
||||
@@ -195,13 +195,13 @@ void sub_0206C354(UnkStruct_0202D7B0 *param0)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0206C37C(UnkStruct_0202D7B0 *param0)
|
||||
void sub_0206C37C(SpecialEncounter *param0)
|
||||
{
|
||||
u8 v0;
|
||||
|
||||
for (v0 = 0; v0 < 6; v0++) {
|
||||
if (sub_0202D8F8(param0, v0)) {
|
||||
if (inline_020564D0(16) == 0) {
|
||||
if (LCRNG_RandMod(16) == 0) {
|
||||
sub_0206C33C(param0, v0);
|
||||
} else {
|
||||
{
|
||||
@@ -221,7 +221,7 @@ int sub_0206C3C8(const u8 param0)
|
||||
return RoamingPokemonRoutes[param0];
|
||||
}
|
||||
|
||||
BOOL sub_0206C3E0(UnkStruct_0202D7B0 *param0)
|
||||
BOOL sub_0206C3E0(SpecialEncounter *param0)
|
||||
{
|
||||
u8 v0;
|
||||
|
||||
@@ -234,7 +234,7 @@ BOOL sub_0206C3E0(UnkStruct_0202D7B0 *param0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_0206C404(UnkStruct_0202D7B0 *param0, const int param1)
|
||||
void sub_0206C404(SpecialEncounter *param0, const int param1)
|
||||
{
|
||||
if (sub_0206C3E0(param0)) {
|
||||
sub_0202D8A4(param0, param1);
|
||||
@@ -244,14 +244,14 @@ void sub_0206C404(UnkStruct_0202D7B0 *param0, const int param1)
|
||||
void RoamingPokemon_ActivateSlot(SaveData *saveData, const u8 slot)
|
||||
{
|
||||
Pokemon *v0;
|
||||
UnkStruct_0206C638 *v1;
|
||||
UnkStruct_0202D7B0 *v2;
|
||||
Roamer *v1;
|
||||
SpecialEncounter *v2;
|
||||
int previouslyVisitedMap;
|
||||
TrainerInfo *v4;
|
||||
int species;
|
||||
u8 level;
|
||||
|
||||
v2 = sub_0202D834(saveData);
|
||||
v2 = SaveData_GetSpecialEncounters(saveData);
|
||||
v1 = sub_0202D924(v2, slot);
|
||||
|
||||
switch (slot) {
|
||||
@@ -303,7 +303,7 @@ void RoamingPokemon_ActivateSlot(SaveData *saveData, const u8 slot)
|
||||
sub_0206C538(v2, slot, previouslyVisitedMap);
|
||||
}
|
||||
|
||||
static void sub_0206C538(UnkStruct_0202D7B0 *param0, const u8 param1, const int param2)
|
||||
static void sub_0206C538(SpecialEncounter *param0, const u8 param1, const int param2)
|
||||
{
|
||||
u8 v0;
|
||||
int v1;
|
||||
@@ -312,7 +312,7 @@ static void sub_0206C538(UnkStruct_0202D7B0 *param0, const u8 param1, const int
|
||||
v1 = RoamingPokemonRoutes[sub_0202D8C4(param0, param1)];
|
||||
|
||||
while (TRUE) {
|
||||
v0 = inline_020564D0(29);
|
||||
v0 = LCRNG_RandMod(29);
|
||||
v2 = RoamingPokemonRoutes[v0];
|
||||
|
||||
if ((v2 != param2) && (v2 != v1)) {
|
||||
@@ -322,7 +322,7 @@ static void sub_0206C538(UnkStruct_0202D7B0 *param0, const u8 param1, const int
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_0206C588(UnkStruct_0202D7B0 *param0, const u8 param1, const int param2)
|
||||
static void sub_0206C588(SpecialEncounter *param0, const u8 param1, const int param2)
|
||||
{
|
||||
const UnkStruct_020EFBB8 *v0;
|
||||
u8 v1;
|
||||
@@ -343,7 +343,7 @@ static void sub_0206C588(UnkStruct_0202D7B0 *param0, const u8 param1, const int
|
||||
u8 v3;
|
||||
|
||||
while (TRUE) {
|
||||
v3 = inline_020564D0(v0->unk_00);
|
||||
v3 = LCRNG_RandMod(v0->unk_00);
|
||||
v1 = v0->unk_02[v3];
|
||||
v2 = RoamingPokemonRoutes[v1];
|
||||
|
||||
@@ -355,9 +355,9 @@ static void sub_0206C588(UnkStruct_0202D7B0 *param0, const u8 param1, const int
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_0206C638(UnkStruct_0202D7B0 *param0, const u8 param1, const u8 param2, const int param3)
|
||||
static void sub_0206C638(SpecialEncounter *param0, const u8 param1, const u8 param2, const int param3)
|
||||
{
|
||||
UnkStruct_0206C638 *v0;
|
||||
Roamer *v0;
|
||||
|
||||
v0 = sub_0202D924(param0, param1);
|
||||
|
||||
|
||||
16
src/scrcmd.c
16
src/scrcmd.c
@@ -105,6 +105,7 @@
|
||||
#include "field_task.h"
|
||||
#include "field_transition.h"
|
||||
#include "game_records.h"
|
||||
#include "great_marsh_lookout.h"
|
||||
#include "heap.h"
|
||||
#include "inlines.h"
|
||||
#include "journal.h"
|
||||
@@ -198,7 +199,6 @@
|
||||
#include "unk_02069BE0.h"
|
||||
#include "unk_0206AFE0.h"
|
||||
#include "unk_0206B70C.h"
|
||||
#include "unk_0206C0E8.h"
|
||||
#include "unk_0206C660.h"
|
||||
#include "unk_0206C784.h"
|
||||
#include "unk_0206CCB0.h"
|
||||
@@ -587,7 +587,7 @@ static BOOL ScrCmd_203(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_204(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_205(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_310(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_206(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_StartGreatMarshLookout(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_20C(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_20D(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_20E(ScriptContext *ctx);
|
||||
@@ -1281,7 +1281,7 @@ const ScrCmdFunc Unk_020EAC58[] = {
|
||||
ScrCmd_203,
|
||||
ScrCmd_204,
|
||||
ScrCmd_205,
|
||||
ScrCmd_206,
|
||||
ScrCmd_StartGreatMarshLookout,
|
||||
ScrCmd_207,
|
||||
ScrCmd_208,
|
||||
ScrCmd_209,
|
||||
@@ -4801,11 +4801,11 @@ static BOOL ScrCmd_ChangePlayerState(ScriptContext *ctx)
|
||||
|
||||
static BOOL ScrCmd_0E3(ScriptContext *ctx)
|
||||
{
|
||||
UnkStruct_0202D7B0 *v0 = sub_0202D834(ctx->fieldSystem->saveData);
|
||||
SpecialEncounter *v0 = SaveData_GetSpecialEncounters(ctx->fieldSystem->saveData);
|
||||
u16 *v1 = ScriptContext_GetVarPointer(ctx);
|
||||
u16 *v2 = ScriptContext_GetVarPointer(ctx);
|
||||
|
||||
ov6_0224322C(sub_0202D814(v0, 2), v1, v2);
|
||||
ov6_0224322C(SpecialEncounter_GetDailyMon(v0, DAILY_SWARM), v1, v2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6403,10 +6403,10 @@ static BOOL ScrCmd_202(ScriptContext *ctx)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL ScrCmd_206(ScriptContext *ctx)
|
||||
static BOOL ScrCmd_StartGreatMarshLookout(ScriptContext *ctx)
|
||||
{
|
||||
sub_0206C0E8(ctx->fieldSystem);
|
||||
return 1;
|
||||
GreatMarshLookout_Init(ctx->fieldSystem);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL ScrCmd_20D(ScriptContext *ctx)
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
|
||||
int SpecialEncounter_SaveSize(void)
|
||||
{
|
||||
return sizeof(UnkStruct_0202D7B0);
|
||||
return sizeof(SpecialEncounter);
|
||||
}
|
||||
|
||||
void SpecialEncounter_Init(UnkStruct_0202D7B0 *param0)
|
||||
void SpecialEncounter_Init(SpecialEncounter *param0)
|
||||
{
|
||||
memset(param0, 0, sizeof(UnkStruct_0202D7B0));
|
||||
memset(param0, 0, sizeof(SpecialEncounter));
|
||||
|
||||
param0->unk_00 = MTRNG_Next();
|
||||
param0->unk_04 = MTRNG_Next();
|
||||
param0->marshDaily = MTRNG_Next();
|
||||
param0->swarmDaily = MTRNG_Next();
|
||||
param0->unk_08.unk_00 = 0;
|
||||
param0->unk_08.unk_04 = 0xffff;
|
||||
param0->unk_08.unk_06 = 0xffff;
|
||||
@@ -48,36 +48,36 @@ void SpecialEncounter_Init(UnkStruct_0202D7B0 *param0)
|
||||
param0->unk_151 = 0;
|
||||
}
|
||||
|
||||
void sub_0202D80C(UnkStruct_0202D7B0 *param0, const u32 param1)
|
||||
void SpecialEncounter_SetMixedRecordDailies(SpecialEncounter *speEnc, const u32 mixedRecord)
|
||||
{
|
||||
param0->unk_00 = param1;
|
||||
param0->unk_04 = param1;
|
||||
speEnc->marshDaily = mixedRecord;
|
||||
speEnc->swarmDaily = mixedRecord;
|
||||
}
|
||||
|
||||
u32 sub_0202D814(UnkStruct_0202D7B0 *param0, const u8 param1)
|
||||
u32 SpecialEncounter_GetDailyMon(SpecialEncounter *param0, const u8 dailyType)
|
||||
{
|
||||
switch (param1) {
|
||||
case 1:
|
||||
return param0->unk_00;
|
||||
case 2:
|
||||
return param0->unk_04;
|
||||
switch (dailyType) {
|
||||
case DAILY_MARSH:
|
||||
return param0->marshDaily;
|
||||
case DAILY_SWARM:
|
||||
return param0->swarmDaily;
|
||||
default:
|
||||
GF_ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
UnkStruct_020698E4 *sub_0202D830(UnkStruct_0202D7B0 *param0)
|
||||
UnkStruct_020698E4 *sub_0202D830(SpecialEncounter *param0)
|
||||
{
|
||||
return &(param0->unk_BC);
|
||||
}
|
||||
|
||||
UnkStruct_0202D7B0 *sub_0202D834(SaveData *param0)
|
||||
SpecialEncounter *SaveData_GetSpecialEncounters(SaveData *param0)
|
||||
{
|
||||
return SaveData_SaveTable(param0, 25);
|
||||
return SaveData_SaveTable(param0, SAVE_TABLE_ENTRY_ENCOUNTERS);
|
||||
}
|
||||
|
||||
UnkStruct_0202D844 *sub_0202D840(UnkStruct_0202D7B0 *param0)
|
||||
UnkStruct_0202D844 *sub_0202D840(SpecialEncounter *param0)
|
||||
{
|
||||
return &(param0->unk_10);
|
||||
}
|
||||
@@ -104,10 +104,10 @@ void sub_0202D854(SaveData *param0, const int param1)
|
||||
{
|
||||
int v0;
|
||||
UnkStruct_0202D844 *v1;
|
||||
UnkStruct_0202D7B0 *v2;
|
||||
SpecialEncounter *v2;
|
||||
UnkStruct_0202D84C *v3;
|
||||
|
||||
v2 = sub_0202D834(param0);
|
||||
v2 = SaveData_GetSpecialEncounters(param0);
|
||||
v1 = &(v2->unk_10);
|
||||
|
||||
for (v0 = 0; v0 < 21; v0++) {
|
||||
@@ -125,18 +125,18 @@ void sub_0202D854(SaveData *param0, const int param1)
|
||||
|
||||
void sub_0202D884(SaveData *param0)
|
||||
{
|
||||
UnkStruct_0202D7B0 *v0;
|
||||
SpecialEncounter *v0;
|
||||
|
||||
v0 = sub_0202D834(param0);
|
||||
v0 = SaveData_GetSpecialEncounters(param0);
|
||||
v0->unk_14E = 1;
|
||||
}
|
||||
|
||||
u8 sub_0202D898(UnkStruct_0202D7B0 *param0)
|
||||
u8 sub_0202D898(SpecialEncounter *param0)
|
||||
{
|
||||
return param0->unk_14E;
|
||||
}
|
||||
|
||||
void sub_0202D8A4(UnkStruct_0202D7B0 *param0, const int param1)
|
||||
void sub_0202D8A4(SpecialEncounter *param0, const int param1)
|
||||
{
|
||||
if (param0->unk_C8.unk_00 != param1) {
|
||||
param0->unk_C8.unk_04 = param0->unk_C8.unk_00;
|
||||
@@ -144,41 +144,41 @@ void sub_0202D8A4(UnkStruct_0202D7B0 *param0, const int param1)
|
||||
}
|
||||
}
|
||||
|
||||
int sub_0202D8BC(UnkStruct_0202D7B0 *param0)
|
||||
int sub_0202D8BC(SpecialEncounter *param0)
|
||||
{
|
||||
return param0->unk_C8.unk_04;
|
||||
}
|
||||
|
||||
u8 sub_0202D8C4(UnkStruct_0202D7B0 *param0, const u8 param1)
|
||||
u8 sub_0202D8C4(SpecialEncounter *param0, const u8 param1)
|
||||
{
|
||||
GF_ASSERT(param1 < 6);
|
||||
return param0->unk_148[param1];
|
||||
}
|
||||
|
||||
void sub_0202D8DC(UnkStruct_0202D7B0 *param0, const u8 param1, const u8 param2)
|
||||
void sub_0202D8DC(SpecialEncounter *param0, const u8 param1, const u8 param2)
|
||||
{
|
||||
GF_ASSERT(param1 < 6);
|
||||
param0->unk_148[param1] = param2;
|
||||
}
|
||||
|
||||
u8 sub_0202D8F8(UnkStruct_0202D7B0 *param0, const u8 param1)
|
||||
u8 sub_0202D8F8(SpecialEncounter *param0, const u8 param1)
|
||||
{
|
||||
GF_ASSERT(param1 < 6);
|
||||
return param0->unk_D0[param1].unk_12;
|
||||
}
|
||||
|
||||
void sub_0202D914(UnkStruct_0206C638 **param0)
|
||||
void sub_0202D914(Roamer **param0)
|
||||
{
|
||||
memset((*param0), 0, sizeof(UnkStruct_0206C638));
|
||||
memset((*param0), 0, sizeof(Roamer));
|
||||
}
|
||||
|
||||
UnkStruct_0206C638 *sub_0202D924(UnkStruct_0202D7B0 *param0, const u8 param1)
|
||||
Roamer *sub_0202D924(SpecialEncounter *param0, const u8 param1)
|
||||
{
|
||||
GF_ASSERT(param1 < 6);
|
||||
return &(param0->unk_D0[param1]);
|
||||
}
|
||||
|
||||
u32 sub_0202D93C(const UnkStruct_0206C638 *param0, const u8 param1)
|
||||
u32 sub_0202D93C(const Roamer *param0, const u8 param1)
|
||||
{
|
||||
u32 v0;
|
||||
|
||||
@@ -212,7 +212,7 @@ u32 sub_0202D93C(const UnkStruct_0206C638 *param0, const u8 param1)
|
||||
return v0;
|
||||
}
|
||||
|
||||
void sub_0202D980(UnkStruct_0206C638 *param0, const u8 param1, const u32 param2)
|
||||
void sub_0202D980(Roamer *param0, const u8 param1, const u32 param2)
|
||||
{
|
||||
u32 v0;
|
||||
|
||||
@@ -244,17 +244,17 @@ void sub_0202D980(UnkStruct_0206C638 *param0, const u8 param1, const u32 param2)
|
||||
}
|
||||
}
|
||||
|
||||
u8 *sub_0202D9C4(UnkStruct_0202D7B0 *param0)
|
||||
u8 *sub_0202D9C4(SpecialEncounter *param0)
|
||||
{
|
||||
return &(param0->unk_150);
|
||||
}
|
||||
|
||||
u8 *sub_0202D9CC(UnkStruct_0202D7B0 *param0)
|
||||
u8 *sub_0202D9CC(SpecialEncounter *param0)
|
||||
{
|
||||
return &(param0->unk_14F);
|
||||
}
|
||||
|
||||
BOOL sub_0202D9D8(UnkStruct_0202D7B0 *param0)
|
||||
BOOL sub_0202D9D8(SpecialEncounter *param0)
|
||||
{
|
||||
if (!param0->unk_14F) {
|
||||
return 1;
|
||||
@@ -263,20 +263,20 @@ BOOL sub_0202D9D8(UnkStruct_0202D7B0 *param0)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0202D9EC(UnkStruct_0202D7B0 *param0, const u8 param1)
|
||||
void sub_0202D9EC(SpecialEncounter *param0, const u8 param1)
|
||||
{
|
||||
GF_ASSERT((param1 == 1) || (param1 == 2) || (param1 == 0));
|
||||
param0->unk_151 = param1;
|
||||
}
|
||||
|
||||
u8 sub_0202DA04(UnkStruct_0202D7B0 *param0)
|
||||
u8 sub_0202DA04(SpecialEncounter *param0)
|
||||
{
|
||||
return param0->unk_151;
|
||||
}
|
||||
|
||||
void sub_0202DA10(SaveData *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
UnkStruct_0202D7B0 *v0 = sub_0202D834(param0);
|
||||
SpecialEncounter *v0 = SaveData_GetSpecialEncounters(param0);
|
||||
|
||||
(*param1) = v0->unk_08.unk_04;
|
||||
(*param2) = v0->unk_08.unk_06;
|
||||
@@ -284,7 +284,7 @@ void sub_0202DA10(SaveData *param0, u16 *param1, u16 *param2)
|
||||
|
||||
void sub_0202DA24(SaveData *param0, const u16 param1)
|
||||
{
|
||||
UnkStruct_0202D7B0 *v0 = sub_0202D834(param0);
|
||||
SpecialEncounter *v0 = SaveData_GetSpecialEncounters(param0);
|
||||
|
||||
GF_ASSERT(param1 < 16);
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ static void sub_02055AC0(FieldSystem *fieldSystem, s32 param1)
|
||||
sub_0203F1FC(fieldSystem);
|
||||
sub_0206C2D0(fieldSystem->saveData, param1);
|
||||
RecordMixedRNG_AdvanceEntries(SaveData_GetRecordMixedRNG(fieldSystem->saveData), param1);
|
||||
sub_0202D80C(sub_0202D834(fieldSystem->saveData), RecordMixedRNG_GetRand(SaveData_GetRecordMixedRNG(fieldSystem->saveData)));
|
||||
SpecialEncounter_SetMixedRecordDailies(SaveData_GetSpecialEncounters(fieldSystem->saveData), RecordMixedRNG_GetRand(SaveData_GetRecordMixedRNG(fieldSystem->saveData)));
|
||||
|
||||
{
|
||||
Party *v0;
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
#include "unk_0206C0E8.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "struct_decls/struct_02061AB4_decl.h"
|
||||
|
||||
#include "field/field_system.h"
|
||||
#include "field/field_system_sub2_t.h"
|
||||
#include "overlay006/ov6_022426AC.h"
|
||||
#include "overlay006/ov6_02242984.h"
|
||||
#include "overlay006/struct_ov6_022426B8_decl.h"
|
||||
#include "overlay006/struct_ov6_02242A8C_decl.h"
|
||||
|
||||
#include "core_sys.h"
|
||||
#include "field_map_change.h"
|
||||
#include "field_task.h"
|
||||
#include "field_transition.h"
|
||||
#include "heap.h"
|
||||
#include "location.h"
|
||||
#include "map_object.h"
|
||||
#include "player_avatar.h"
|
||||
#include "system_flags.h"
|
||||
#include "unk_02005474.h"
|
||||
#include "unk_02056B30.h"
|
||||
#include "unk_02070428.h"
|
||||
#include "vars_flags.h"
|
||||
|
||||
typedef struct {
|
||||
UnkStruct_ov6_022426B8 *unk_00;
|
||||
UnkStruct_ov6_02242A8C *unk_04;
|
||||
Location *unk_08;
|
||||
u8 unk_0C;
|
||||
u8 unk_0D;
|
||||
u8 unk_0E;
|
||||
} UnkStruct_0206C0E8;
|
||||
|
||||
static BOOL sub_0206C120(FieldTask *taskMan);
|
||||
|
||||
void sub_0206C0E8(FieldSystem *fieldSystem)
|
||||
{
|
||||
UnkStruct_0206C0E8 *v0 = Heap_AllocFromHeapAtEnd(11, sizeof(UnkStruct_0206C0E8));
|
||||
|
||||
v0->unk_00 = ov6_022426AC(11);
|
||||
v0->unk_04 = ov6_02242A10(11, fieldSystem);
|
||||
v0->unk_0C = 0;
|
||||
v0->unk_0D = 0;
|
||||
|
||||
FieldTask_InitCall(fieldSystem->task, sub_0206C120, v0);
|
||||
}
|
||||
|
||||
static BOOL sub_0206C120(FieldTask *taskMan)
|
||||
{
|
||||
FieldSystem *fieldSystem = FieldTask_GetFieldSystem(taskMan);
|
||||
UnkStruct_0206C0E8 *v1 = FieldTask_GetEnv(taskMan);
|
||||
|
||||
switch (v1->unk_0C) {
|
||||
case 0:
|
||||
sub_02070428(fieldSystem, 1);
|
||||
ov6_02242A94(v1->unk_0D, v1->unk_04);
|
||||
v1->unk_08 = ov6_02242AEC(v1->unk_04);
|
||||
FieldTransition_FadeOut(taskMan);
|
||||
v1->unk_0C = 1;
|
||||
break;
|
||||
case 1:
|
||||
FieldTransition_FinishMap(taskMan);
|
||||
v1->unk_0C = 2;
|
||||
break;
|
||||
case 2: {
|
||||
VarsFlags *v2 = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
|
||||
if (v1->unk_0D == 0) {
|
||||
SystemFlag_SetPoketchHidden(v2);
|
||||
} else if (v1->unk_0D == 5) {
|
||||
SystemFlag_ClearPoketchHidden(v2);
|
||||
}
|
||||
}
|
||||
|
||||
FieldTask_ChangeMapByLocation(taskMan, v1->unk_08);
|
||||
v1->unk_0C = 3;
|
||||
break;
|
||||
case 3:
|
||||
FieldTransition_StartMap(taskMan);
|
||||
v1->unk_0C = 4;
|
||||
break;
|
||||
case 4: {
|
||||
MapObject *v3 = Player_MapObject(fieldSystem->playerAvatar);
|
||||
|
||||
v1->unk_0D++;
|
||||
|
||||
if (v1->unk_0D <= 5) {
|
||||
int v4;
|
||||
|
||||
v4 = ov6_02242984(fieldSystem);
|
||||
MapObject_SetHidden(v3, 1);
|
||||
ov6_022426C0(v1->unk_00, v4);
|
||||
ov6_022427F4(v1->unk_00);
|
||||
v1->unk_0E = 0;
|
||||
Sound_PlayEffect(1657);
|
||||
sub_02056B30(taskMan, 3, 17, 0xffff, 0x0, 6, 1, 11);
|
||||
v1->unk_0C = 5;
|
||||
} else {
|
||||
MapObject_SetHidden(v3, 0);
|
||||
FieldTransition_FadeIn(taskMan);
|
||||
v1->unk_0C = 8;
|
||||
}
|
||||
} break;
|
||||
case 5:
|
||||
v1->unk_0E++;
|
||||
|
||||
if ((v1->unk_0E >= 60) || (gCoreSys.pressedKeys & PAD_BUTTON_A)) {
|
||||
ov6_02242A94(v1->unk_0D, v1->unk_04);
|
||||
v1->unk_08 = ov6_02242AEC(v1->unk_04);
|
||||
Sound_PlayEffect(1657);
|
||||
sub_02056B30(taskMan, 3, 16, 0xffff, 0x0, 6, 1, 11);
|
||||
v1->unk_0C = 6;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
ov6_02242814(v1->unk_00);
|
||||
v1->unk_0C = 7;
|
||||
break;
|
||||
case 7:
|
||||
if (ov6_02242820(v1->unk_00)) {
|
||||
ov6_02242828(v1->unk_00);
|
||||
v1->unk_0C = 1;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
sub_02070428(fieldSystem, 0);
|
||||
ov6_02242A8C(v1->unk_04);
|
||||
ov6_022426B8(v1->unk_00);
|
||||
Heap_FreeToHeap(v1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -955,7 +955,7 @@ static int sub_0206D644(FieldSystem *fieldSystem, StringTemplate *param1, UnkStr
|
||||
sub_0206CE74(param1, 1, v0->unk_00, v0->unk_02, v0->unk_03, v0->unk_04);
|
||||
sub_0206CD94(param1, 2, v0->unk_06, v0->unk_02, v0->unk_03, 1);
|
||||
|
||||
return 17 + inline_020564D0(5);
|
||||
return 17 + LCRNG_RandMod(5);
|
||||
}
|
||||
|
||||
static BOOL sub_0206D6A8(FieldSystem *fieldSystem, UnkStruct_ov6_022465F4 *param1)
|
||||
@@ -1163,7 +1163,7 @@ static int sub_0206D9F4(FieldSystem *fieldSystem, StringTemplate *param1, UnkStr
|
||||
StringTemplate_SetBallSealName(param1, 1, v0->unk_06);
|
||||
sub_0206CE74(param1, 2, v0->unk_00, v0->unk_02, v0->unk_03, v0->unk_04);
|
||||
|
||||
return 33 + inline_020564D0(3);
|
||||
return 33 + LCRNG_RandMod(3);
|
||||
}
|
||||
|
||||
static BOOL sub_0206DA50(FieldSystem *fieldSystem, UnkStruct_ov6_022465F4 *param1)
|
||||
@@ -2083,7 +2083,7 @@ static int sub_0206E870(FieldSystem *fieldSystem, StringTemplate *param1, UnkStr
|
||||
|
||||
GF_ASSERT(v1 == 0);
|
||||
|
||||
v3 = inline_020564D0(17);
|
||||
v3 = LCRNG_RandMod(17);
|
||||
|
||||
if (v3 >= 9) {
|
||||
v3++;
|
||||
@@ -2119,13 +2119,13 @@ static int sub_0206E940(FieldSystem *fieldSystem, StringTemplate *param1, UnkStr
|
||||
{
|
||||
int v0, weather;
|
||||
|
||||
v0 = Unk_02100BA4[inline_020564D0(NELEMS(Unk_02100BA4))];
|
||||
v0 = Unk_02100BA4[LCRNG_RandMod(NELEMS(Unk_02100BA4))];
|
||||
weather = FieldSystem_GetWeather(fieldSystem, v0);
|
||||
StringTemplate_SetLocationName(param1, 0, MapHeader_GetMapLabelTextID(v0));
|
||||
|
||||
switch (weather) {
|
||||
case OVERWORLD_WEATHER_CLEAR:
|
||||
switch (inline_020564D0(4)) {
|
||||
switch (LCRNG_RandMod(4)) {
|
||||
case 0:
|
||||
return 1;
|
||||
case 1:
|
||||
@@ -2236,9 +2236,9 @@ static int sub_0206EA10(FieldSystem *fieldSystem, StringTemplate *param1, UnkStr
|
||||
static int sub_0206EB94(FieldSystem *fieldSystem, StringTemplate *param1, UnkStruct_ov6_022465F4 *param2)
|
||||
{
|
||||
u16 v0, v1;
|
||||
UnkStruct_0202D7B0 *v2 = sub_0202D834(fieldSystem->saveData);
|
||||
SpecialEncounter *v2 = SaveData_GetSpecialEncounters(fieldSystem->saveData);
|
||||
|
||||
ov6_0224322C(sub_0202D814(v2, 2), &v0, &v1);
|
||||
ov6_0224322C(SpecialEncounter_GetDailyMon(v2, DAILY_SWARM), &v0, &v1);
|
||||
StringTemplate_SetLocationName(param1, 0, MapHeader_GetMapLabelTextID(v0));
|
||||
sub_0206CEA4(param1, 1, v1);
|
||||
|
||||
@@ -2247,7 +2247,7 @@ static int sub_0206EB94(FieldSystem *fieldSystem, StringTemplate *param1, UnkStr
|
||||
|
||||
static BOOL sub_0206EBD4(FieldSystem *fieldSystem, UnkStruct_ov6_022465F4 *param1)
|
||||
{
|
||||
UnkStruct_0202D7B0 *v0 = sub_0202D834(fieldSystem->saveData);
|
||||
SpecialEncounter *v0 = SaveData_GetSpecialEncounters(fieldSystem->saveData);
|
||||
return sub_0202D898(v0);
|
||||
}
|
||||
|
||||
@@ -2534,7 +2534,7 @@ static int sub_0206EBE8(FieldSystem *fieldSystem)
|
||||
}
|
||||
}
|
||||
|
||||
return v1[inline_020564D0(v3)];
|
||||
return v1[LCRNG_RandMod(v3)];
|
||||
}
|
||||
|
||||
static int sub_0206EC90(FieldSystem *fieldSystem, StringTemplate *param1, UnkStruct_ov6_022465F4 *param2)
|
||||
@@ -2617,14 +2617,14 @@ static int sub_0206ED14(FieldSystem *fieldSystem, StringTemplate *param1, UnkStr
|
||||
|
||||
static int sub_0206EDAC(FieldSystem *fieldSystem, StringTemplate *param1, UnkStruct_ov6_022465F4 *param2)
|
||||
{
|
||||
UnkStruct_0206C638 *v0;
|
||||
UnkStruct_0202D7B0 *v1;
|
||||
Roamer *v0;
|
||||
SpecialEncounter *v1;
|
||||
u16 v2, v3;
|
||||
u32 v4, v5;
|
||||
Strbuf *v6 = Strbuf_Init(22, 4);
|
||||
TrainerInfo *v7 = SaveData_GetTrainerInfo(FieldSystem_GetSaveData(fieldSystem));
|
||||
|
||||
v1 = sub_0202D834(fieldSystem->saveData);
|
||||
v1 = SaveData_GetSpecialEncounters(fieldSystem->saveData);
|
||||
v2 = (LCRNG_Next() % 29);
|
||||
|
||||
sub_02071D10(sub_0206C3C8(v2), 4, v6);
|
||||
@@ -2649,9 +2649,9 @@ static int sub_0206EDAC(FieldSystem *fieldSystem, StringTemplate *param1, UnkStr
|
||||
static BOOL sub_0206EE74(FieldSystem *fieldSystem, UnkStruct_ov6_022465F4 *param1)
|
||||
{
|
||||
int v0;
|
||||
UnkStruct_0202D7B0 *v1;
|
||||
SpecialEncounter *v1;
|
||||
|
||||
v1 = sub_0202D834(fieldSystem->saveData);
|
||||
v1 = SaveData_GetSpecialEncounters(fieldSystem->saveData);
|
||||
|
||||
for (v0 = 0; v0 < 6; v0++) {
|
||||
if (sub_0202D8F8(v1, v0)) {
|
||||
|
||||
@@ -40,14 +40,14 @@ void FieldSystem_InitFlagsOnMapChange(FieldSystem *fieldSystem)
|
||||
SystemFlag_HandleStrengthActive(SaveData_GetVarsFlags(fieldSystem->saveData), HANDLE_FLAG_CLEAR);
|
||||
|
||||
sub_0203A8E8(fieldSystem, fieldSystem->location->mapId);
|
||||
sub_0202D9EC(sub_0202D834(fieldSystem->saveData), 0);
|
||||
sub_0202D9EC(SaveData_GetSpecialEncounters(fieldSystem->saveData), 0);
|
||||
|
||||
fieldSystem->unk_78.unk_00 = 0;
|
||||
|
||||
if (!SystemFlag_CheckSafariGameActive(SaveData_GetVarsFlags(fieldSystem->saveData))) {
|
||||
UnkStruct_0202D7B0 *v0;
|
||||
SpecialEncounter *v0;
|
||||
|
||||
v0 = sub_0202D834(fieldSystem->saveData);
|
||||
v0 = SaveData_GetSpecialEncounters(fieldSystem->saveData);
|
||||
sub_0206C404(v0, fieldSystem->location->mapId);
|
||||
sub_0206C37C(v0);
|
||||
}
|
||||
@@ -69,14 +69,14 @@ void FieldSystem_InitFlagsWarp(FieldSystem *fieldSystem)
|
||||
SystemFlag_HandleStrengthActive(SaveData_GetVarsFlags(fieldSystem->saveData), HANDLE_FLAG_CLEAR);
|
||||
|
||||
sub_0203A8E8(fieldSystem, fieldSystem->location->mapId);
|
||||
sub_0202D9EC(sub_0202D834(fieldSystem->saveData), 0);
|
||||
sub_0202D9EC(SaveData_GetSpecialEncounters(fieldSystem->saveData), 0);
|
||||
|
||||
fieldSystem->unk_78.unk_00 = 0;
|
||||
|
||||
{
|
||||
UnkStruct_0202D7B0 *v0;
|
||||
SpecialEncounter *v0;
|
||||
|
||||
v0 = sub_0202D834(fieldSystem->saveData);
|
||||
v0 = SaveData_GetSpecialEncounters(fieldSystem->saveData);
|
||||
sub_0206C404(v0, fieldSystem->location->mapId);
|
||||
}
|
||||
|
||||
@@ -108,13 +108,13 @@ void FieldSystem_InitFlagsWarp(FieldSystem *fieldSystem)
|
||||
void sub_0207056C(FieldSystem *fieldSystem)
|
||||
{
|
||||
SystemFlag_ClearSafariGameActive(SaveData_GetVarsFlags(fieldSystem->saveData));
|
||||
sub_0206C354(sub_0202D834(fieldSystem->saveData));
|
||||
sub_0206C354(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
}
|
||||
|
||||
void FieldSystem_SetTeleportFlags(FieldSystem *fieldSystem)
|
||||
{
|
||||
SystemFlag_ClearSafariGameActive(SaveData_GetVarsFlags(fieldSystem->saveData));
|
||||
sub_0206C354(sub_0202D834(fieldSystem->saveData));
|
||||
sub_0206C354(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
}
|
||||
|
||||
void FieldSystem_SetEscapeFlags(FieldSystem *fieldSystem)
|
||||
@@ -132,7 +132,7 @@ void sub_020705B4(FieldSystem *fieldSystem)
|
||||
|
||||
void sub_020705CC(FieldSystem *fieldSystem)
|
||||
{
|
||||
sub_0206C354(sub_0202D834(fieldSystem->saveData));
|
||||
sub_0206C354(SaveData_GetSpecialEncounters(fieldSystem->saveData));
|
||||
}
|
||||
|
||||
static BOOL sub_020705DC(FieldSystem *fieldSystem)
|
||||
|
||||
Reference in New Issue
Block a user