mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-04-24 06:57:36 -05:00
Merge pull request #221 from tillgeissler/wild-encounter-data
WIP: Document wild encounter data structure
This commit is contained in:
commit
d73c2ecef1
|
|
@ -19,6 +19,8 @@ this is some code
|
|||
- [Acid Rain](#acid-rain)
|
||||
- [Fire Fang Always Bypasses Wonder Guard](#fire-fang-always-bypasses-wonder-guard)
|
||||
- [Post-KO Switch-In AI Scoring Overflow](#post-ko-switch-in-ai-scoring-overflow)
|
||||
- [Wild Encounters](#wild-encounters)
|
||||
- [Fishing Encounters ignore Sticky Hold and Suction Cups](#fishing-encounters-ignore-sticky-hold-and-suction-cups)
|
||||
|
||||
## Battle Engine
|
||||
|
||||
|
|
@ -135,3 +137,17 @@ as having a score equivalent to 65 rather than 320.
|
|||
- u8 score, maxScore;
|
||||
+ u32 score, maxScore;
|
||||
```
|
||||
|
||||
## Wild Encounters
|
||||
### Fishing Encounters ignore Sticky Hold and Suction Cups
|
||||
|
||||
When calculating the encounter rate for fishing encounters the abilities Sticky
|
||||
Hold and Suction Cups are supposed to double the encounter rate. However, due to
|
||||
a typo, the encounter rate stays unmodified.
|
||||
|
||||
**Fix:** Edit the routine `ov6_0224226C` in [`src/overlay006/ov6_02240C9C.c`](https://github.com/pret/pokeplatinum/blob/4fb8a8f567ebbfc99a1d7f2e5f1e8edd9beb4aa7/src/overlay006/ov6_02240C9C.c#L1390)
|
||||
|
||||
```diff
|
||||
- v0 * 2; // BUG: Abilities do not Increase Fishing Encounter Rate (see docs/bugs_and_glitches.md)
|
||||
+ v0 *= 2;
|
||||
```
|
||||
|
|
@ -18,4 +18,35 @@
|
|||
|
||||
#define MOVESET_MAX MOVESET_FORM_ROTOM_MOW
|
||||
|
||||
enum UnownForms {
|
||||
UNOWN_FORM_A = 0,
|
||||
UNOWN_FORM_B,
|
||||
UNOWN_FORM_C,
|
||||
UNOWN_FORM_D,
|
||||
UNOWN_FORM_E,
|
||||
UNOWN_FORM_F,
|
||||
UNOWN_FORM_G,
|
||||
UNOWN_FORM_H,
|
||||
UNOWN_FORM_I,
|
||||
UNOWN_FORM_J,
|
||||
UNOWN_FORM_K,
|
||||
UNOWN_FORM_L,
|
||||
UNOWN_FORM_M,
|
||||
UNOWN_FORM_N,
|
||||
UNOWN_FORM_O,
|
||||
UNOWN_FORM_P,
|
||||
UNOWN_FORM_Q,
|
||||
UNOWN_FORM_R,
|
||||
UNOWN_FORM_S,
|
||||
UNOWN_FORM_T,
|
||||
UNOWN_FORM_U,
|
||||
UNOWN_FORM_V,
|
||||
UNOWN_FORM_W,
|
||||
UNOWN_FORM_X,
|
||||
UNOWN_FORM_Y,
|
||||
UNOWN_FORM_Z,
|
||||
UNOWN_FORM_EXC,
|
||||
UNOWN_FORM_QUE
|
||||
};
|
||||
|
||||
#endif
|
||||
23
include/constants/wild_encounters.h
Normal file
23
include/constants/wild_encounters.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef POKEPLATIUM_CONSTANTS_WILD_ENCOUNTERS_H
|
||||
#define POKEPLATIUM_CONSTANTS_WILD_ENCOUNTERS_H
|
||||
|
||||
#define MAX_GRASS_ENCOUNTERS 12
|
||||
#define MAX_SWARM_ENCOUNTERS 2
|
||||
#define MAX_TIMED_ENCOUNTERS 2
|
||||
#define MAX_RADAR_ENCOUNTERS 4
|
||||
#define MAX_DUAL_SLOT_ENCOUNTERS 2
|
||||
#define MAX_WATER_ENCOUNTERS 5
|
||||
|
||||
enum ENCOUNTER_TYPE {
|
||||
ENCOUNTER_TYPE_GRASS = 0,
|
||||
ENCOUNTER_TYPE_SURF,
|
||||
ENCOUNTER_TYPE_FISHING
|
||||
};
|
||||
|
||||
enum ENCOUNTER_FISHING_ROD_TYPE {
|
||||
FISHING_TYPE_OLD_ROD = 0,
|
||||
FISHING_TYPE_GOOD_ROD,
|
||||
FISHING_TYPE_SUPER_ROD
|
||||
};
|
||||
|
||||
#endif // POKEPLATIUM_CONSTANTS_WILD_ENCOUNTERS_H
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "constants/heap.h"
|
||||
#include "field/field_system_decl.h"
|
||||
#include "overlay006/struct_ov6_02242634.h"
|
||||
#include "overlay006/wild_encounters.h"
|
||||
|
||||
typedef struct BgEvent {
|
||||
u16 script;
|
||||
|
|
@ -61,7 +61,7 @@ typedef struct MapHeaderData {
|
|||
const CoordEvent * coordEvents;
|
||||
u32 tmpEventsBuf[512];
|
||||
u32 scripts[64];
|
||||
UnkStruct_ov6_02242634 wildEncounters;
|
||||
WildEncounters wildEncounters;
|
||||
} MapHeaderData;
|
||||
|
||||
void MapHeaderData_Init(FieldSystem * fieldSystem, enum HeapId heapID);
|
||||
|
|
@ -83,8 +83,8 @@ BOOL MapHeaderData_SetWarpEventPos(FieldSystem * fieldSystem, u16 index, u16 x,
|
|||
BOOL MapHeaderData_SetWarpEventDestHeaderID(FieldSystem * fieldSystem, u16 index, u16 destHeaderID);
|
||||
BOOL MapHeaderData_SetWarpEventDestWarpID(FieldSystem * fieldSystem, u16 index, u16 destWarpID);
|
||||
BOOL MapHeaderData_SetBgEventPos(FieldSystem * fieldSystem, u16 index, u16 x, u16 z);
|
||||
void MapHeaderData_LoadWildEncounters(UnkStruct_ov6_02242634 * param0, int headerID);
|
||||
const UnkStruct_ov6_02242634 * MapHeaderData_GetWildEncounters(const FieldSystem * fieldSystem);
|
||||
void MapHeaderData_LoadWildEncounters(WildEncounters * encounterData, int headerID);
|
||||
const WildEncounters * MapHeaderData_GetWildEncounters(const FieldSystem * fieldSystem);
|
||||
const u8 * MapHeaderData_GetScripts(const FieldSystem * fieldSystem);
|
||||
BOOL MapHeaderData_IsAnyObjectEventAtPos(const FieldSystem * fieldSystem, u16 x, u16 z);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
#include "field/field_system_decl.h"
|
||||
#include "struct_decls/struct_020508D4_decl.h"
|
||||
#include "overlay006/battle_params.h"
|
||||
#include "overlay006/struct_ov6_02242634.h"
|
||||
#include "overlay006/wild_encounters.h"
|
||||
|
||||
void ov6_02240C9C(const UnkStruct_ov6_02242634 * param0, int * param1, int * param2);
|
||||
void WildEncounters_ReplaceTimedEncounters(const WildEncounters * encounterData, int * param1, int * param2);
|
||||
BOOL ov6_02240D5C(FieldSystem * fieldSystem);
|
||||
BOOL ov6_0224106C(FieldSystem * fieldSystem, const int param1, BattleParams ** param2);
|
||||
BOOL ov6_022411C8(FieldSystem * fieldSystem, TaskManager * param1);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef POKEPLATINUM_OV6_022477B8_H
|
||||
#define POKEPLATINUM_OV6_022477B8_H
|
||||
|
||||
#include "overlay006/struct_ov6_02242634.h"
|
||||
#include "overlay006/wild_encounters.h"
|
||||
|
||||
void ov6_022477B8(const UnkStruct_ov6_02242634 * param0, const BOOL param1, int * param2, int * param3);
|
||||
void WildEncounters_ReplaceDualSlotEncounters(const WildEncounters * encounterData, const BOOL param1, int * param2, int * param3);
|
||||
|
||||
#endif // POKEPLATINUM_OV6_022477B8_H
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
#ifndef POKEPLATINUM_STRUCT_OV6_02242634_H
|
||||
#define POKEPLATINUM_STRUCT_OV6_02242634_H
|
||||
|
||||
#include "overlay006/struct_ov6_02242634_sub1.h"
|
||||
#include "overlay006/struct_ov6_02242634_sub2.h"
|
||||
|
||||
typedef struct {
|
||||
int unk_00;
|
||||
UnkStruct_ov6_02242634_sub1 unk_04[12];
|
||||
int unk_40[2];
|
||||
int unk_48[2];
|
||||
int unk_50[2];
|
||||
int unk_58[4];
|
||||
int unk_60[5];
|
||||
int unk_7C;
|
||||
int unk_80[2];
|
||||
int unk_88[2];
|
||||
int unk_90[2];
|
||||
int unk_98[2];
|
||||
int unk_A0[2];
|
||||
int unk_A8;
|
||||
UnkStruct_ov6_02242634_sub2 unk_AC[5];
|
||||
int unk_CC;
|
||||
UnkStruct_ov6_02242634_sub2 unk_D0[5];
|
||||
int unk_F0;
|
||||
UnkStruct_ov6_02242634_sub2 unk_F4[5];
|
||||
int unk_114;
|
||||
UnkStruct_ov6_02242634_sub2 unk_118[5];
|
||||
int unk_138;
|
||||
UnkStruct_ov6_02242634_sub2 unk_13C[5];
|
||||
} UnkStruct_ov6_02242634;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_OV6_02242634_H
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef POKEPLATINUM_STRUCT_OV6_02242634_SUB1_H
|
||||
#define POKEPLATINUM_STRUCT_OV6_02242634_SUB1_H
|
||||
|
||||
typedef struct {
|
||||
char unk_00;
|
||||
u8 padding_01[3];
|
||||
int unk_04;
|
||||
} UnkStruct_ov6_02242634_sub1;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_OV6_02242634_SUB1_H
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef POKEPLATINUM_STRUCT_OV6_02242634_SUB2_H
|
||||
#define POKEPLATINUM_STRUCT_OV6_02242634_SUB2_H
|
||||
|
||||
typedef struct {
|
||||
char unk_00;
|
||||
char unk_01;
|
||||
u8 padding_02[2];
|
||||
int unk_04;
|
||||
} UnkStruct_ov6_02242634_sub2;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_OV6_02242634_SUB2_H
|
||||
49
include/overlay006/wild_encounters.h
Normal file
49
include/overlay006/wild_encounters.h
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#ifndef POKEPLATINUM_WILD_ENCOUNTERS_H
|
||||
#define POKEPLATINUM_WILD_ENCOUNTERS_H
|
||||
|
||||
#include "constants/wild_encounters.h"
|
||||
|
||||
typedef struct GrassEncounter {
|
||||
s8 level;
|
||||
u8 padding_01[3];
|
||||
int species;
|
||||
} GrassEncounter;
|
||||
|
||||
typedef struct GrassEncounters {
|
||||
int encounterRate;
|
||||
GrassEncounter encounters[MAX_GRASS_ENCOUNTERS];
|
||||
} GrassEncounters;
|
||||
|
||||
typedef struct WaterEncounter {
|
||||
s8 maxLevel;
|
||||
s8 minLevel;
|
||||
u8 padding_02[2];
|
||||
int species;
|
||||
|
||||
} WaterEncounter;
|
||||
typedef struct WaterEncounters {
|
||||
int encounterRate;
|
||||
WaterEncounter encounters[MAX_WATER_ENCOUNTERS];
|
||||
} WaterEncounters;
|
||||
|
||||
typedef struct WildEncounters {
|
||||
GrassEncounters grassEncounters;
|
||||
int swarmEncounters[MAX_SWARM_ENCOUNTERS];
|
||||
int dayEncounters[MAX_TIMED_ENCOUNTERS];
|
||||
int nightEncounters[MAX_TIMED_ENCOUNTERS];
|
||||
int radarEncounters[MAX_RADAR_ENCOUNTERS];
|
||||
int encounterRatesForms[5];
|
||||
int unownTableID;
|
||||
int dualSlotRubyEncounters[MAX_DUAL_SLOT_ENCOUNTERS];
|
||||
int dualSlotSapphireEncounters[MAX_DUAL_SLOT_ENCOUNTERS];
|
||||
int dualSlotEmeraldEncouters[MAX_DUAL_SLOT_ENCOUNTERS];
|
||||
int dualSlotFireredEncounters[MAX_DUAL_SLOT_ENCOUNTERS];
|
||||
int dualSlotLeafgreenEncounters[MAX_DUAL_SLOT_ENCOUNTERS];
|
||||
WaterEncounters surfEncounters;
|
||||
WaterEncounters unused;
|
||||
WaterEncounters oldRodEncounters;
|
||||
WaterEncounters goodRodEncounters;
|
||||
WaterEncounters superRodEncounters;
|
||||
} WildEncounters;
|
||||
|
||||
#endif // POKEPLATINUM_WILD_ENCOUNTERS_H
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "field/field_system.h"
|
||||
#include "overlay006/struct_ov6_02242634.h"
|
||||
#include "overlay006/wild_encounters.h"
|
||||
|
||||
#include "narc.h"
|
||||
#include "heap.h"
|
||||
|
|
@ -243,9 +243,9 @@ static void MapHeaderData_ParseEvents (MapHeaderData * data)
|
|||
}
|
||||
}
|
||||
|
||||
void MapHeaderData_LoadWildEncounters (UnkStruct_ov6_02242634 * data, int headerID)
|
||||
void MapHeaderData_LoadWildEncounters (WildEncounters * data, int headerID)
|
||||
{
|
||||
memset(data, 0, sizeof(UnkStruct_ov6_02242634));
|
||||
memset(data, 0, sizeof(WildEncounters));
|
||||
if (MapHeader_HasWildEncounters(headerID)) {
|
||||
int narcIndex = (GAME_VERSION == DIAMOND || GAME_VERSION == PLATINUM)
|
||||
? NARC_INDEX_FIELDDATA__ENCOUNTDATA__PL_ENC_DATA
|
||||
|
|
@ -254,7 +254,7 @@ void MapHeaderData_LoadWildEncounters (UnkStruct_ov6_02242634 * data, int header
|
|||
}
|
||||
}
|
||||
|
||||
const UnkStruct_ov6_02242634 * MapHeaderData_GetWildEncounters (const FieldSystem * fieldSystem)
|
||||
const WildEncounters * MapHeaderData_GetWildEncounters (const FieldSystem * fieldSystem)
|
||||
{
|
||||
return &fieldSystem->mapHeaderData->wildEncounters;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "field/field_system.h"
|
||||
#include "struct_defs/struct_02049FA8.h"
|
||||
#include "overlay006/struct_ov6_02242634.h"
|
||||
#include "overlay006/wild_encounters.h"
|
||||
|
||||
#include "narc.h"
|
||||
#include "heap.h"
|
||||
|
|
@ -34,24 +34,21 @@ typedef struct UnkStruct_ov6_02242A8C_t {
|
|||
|
||||
int ov6_02242984 (FieldSystem * fieldSystem)
|
||||
{
|
||||
u8 v0;
|
||||
BOOL v1;
|
||||
int v2[12];
|
||||
UnkStruct_ov6_02242634 * v3;
|
||||
int v2[MAX_GRASS_ENCOUNTERS];
|
||||
|
||||
v3 = (UnkStruct_ov6_02242634 *)MapHeaderData_GetWildEncounters(fieldSystem);
|
||||
WildEncounters * encounterData = MapHeaderData_GetWildEncounters(fieldSystem);
|
||||
|
||||
for (v0 = 0; v0 < 12; v0++) {
|
||||
v2[v0] = v3->unk_04[v0].unk_04;
|
||||
for (u8 i = 0; i < MAX_GRASS_ENCOUNTERS; i++) {
|
||||
v2[i] = encounterData->grassEncounters.encounters[i].species;
|
||||
}
|
||||
|
||||
v1 = sub_02027474(SaveData_Pokedex(FieldSystem_SaveData(fieldSystem)));
|
||||
BOOL v1 = sub_02027474(SaveData_Pokedex(FieldSystem_SaveData(fieldSystem)));
|
||||
|
||||
ov6_02242F74(sub_0202D814(sub_0202D834(fieldSystem->saveData), 1), v1, fieldSystem->location->mapId, &v2[6], &v2[7]);
|
||||
ov6_02240C9C(v3, &v2[2], &v2[3]);
|
||||
ov6_022477B8(v3, v1, &v2[8], &v2[9]);
|
||||
WildEncounters_ReplaceTimedEncounters(encounterData, &v2[2], &v2[3]);
|
||||
WildEncounters_ReplaceDualSlotEncounters(encounterData, v1, &v2[8], &v2[9]);
|
||||
|
||||
return v2[inline_020564D0(12)];
|
||||
return v2[inline_020564D0(MAX_GRASS_ENCOUNTERS)];
|
||||
}
|
||||
|
||||
UnkStruct_ov6_02242A8C * ov6_02242A10 (const int param0, FieldSystem * fieldSystem)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "overlay006/struct_ov6_02242634.h"
|
||||
#include "overlay006/wild_encounters.h"
|
||||
|
||||
#include "map_header_data.h"
|
||||
#include "overlay006/ov6_02243218.h"
|
||||
|
|
@ -38,12 +38,12 @@ u32 ov6_02243218 (const u32 param0)
|
|||
|
||||
void ov6_0224322C (const u32 param0, u16 * param1, u16 * param2)
|
||||
{
|
||||
UnkStruct_ov6_02242634 v0;
|
||||
WildEncounters encounterData;
|
||||
u32 v1;
|
||||
|
||||
v1 = Unk_ov6_02249090[(param0 % 22)];
|
||||
MapHeaderData_LoadWildEncounters(&v0, v1);
|
||||
MapHeaderData_LoadWildEncounters(&encounterData, v1);
|
||||
|
||||
(*param2) = v0.unk_40[0];
|
||||
(*param2) = encounterData.swarmEncounters[0];
|
||||
(*param1) = v1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,36 +3,36 @@
|
|||
|
||||
#include "core_sys.h"
|
||||
|
||||
#include "overlay006/struct_ov6_02242634.h"
|
||||
#include "overlay006/wild_encounters.h"
|
||||
|
||||
#include "overlay006/ov6_022477B8.h"
|
||||
|
||||
void ov6_022477B8 (const UnkStruct_ov6_02242634 * param0, const BOOL param1, int * param2, int * param3)
|
||||
void WildEncounters_ReplaceDualSlotEncounters (const WildEncounters * encounterData, const BOOL nationalDexObtained, int * param2, int * param3)
|
||||
{
|
||||
if (!param1) {
|
||||
if (!nationalDexObtained) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (gCoreSys.unk_66) {
|
||||
case 1:
|
||||
(*param2) = param0->unk_88[0];
|
||||
(*param3) = param0->unk_88[1];
|
||||
(*param2) = encounterData->dualSlotSapphireEncounters[0];
|
||||
(*param3) = encounterData->dualSlotSapphireEncounters[1];
|
||||
break;
|
||||
case 2:
|
||||
(*param2) = param0->unk_80[0];
|
||||
(*param3) = param0->unk_80[1];
|
||||
(*param2) = encounterData->dualSlotRubyEncounters[0];
|
||||
(*param3) = encounterData->dualSlotRubyEncounters[1];
|
||||
break;
|
||||
case 3:
|
||||
(*param2) = param0->unk_90[0];
|
||||
(*param3) = param0->unk_90[1];
|
||||
(*param2) = encounterData->dualSlotEmeraldEncouters[0];
|
||||
(*param3) = encounterData->dualSlotEmeraldEncouters[1];
|
||||
break;
|
||||
case 4:
|
||||
(*param2) = param0->unk_98[0];
|
||||
(*param3) = param0->unk_98[1];
|
||||
(*param2) = encounterData->dualSlotFireredEncounters[0];
|
||||
(*param3) = encounterData->dualSlotFireredEncounters[1];
|
||||
break;
|
||||
case 5:
|
||||
(*param2) = param0->unk_A0[0];
|
||||
(*param3) = param0->unk_A0[1];
|
||||
(*param2) = encounterData->dualSlotLeafgreenEncounters[0];
|
||||
(*param3) = encounterData->dualSlotLeafgreenEncounters[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,10 +294,10 @@ void sub_020521B8 (BattleParams * param0, const FieldSystem * fieldSystem, SaveD
|
|||
param0->unk_198 = param2;
|
||||
}
|
||||
|
||||
void sub_02052314 (BattleParams * param0, const FieldSystem * fieldSystem)
|
||||
void sub_02052314 (BattleParams * battleParams, const FieldSystem * fieldSystem)
|
||||
{
|
||||
sub_020521B8(param0, fieldSystem, fieldSystem->saveData, fieldSystem->location->mapId, fieldSystem->unk_9C, fieldSystem->unk_98, fieldSystem->unk_BC);
|
||||
sub_02052894(param0);
|
||||
sub_020521B8(battleParams, fieldSystem, fieldSystem->saveData, fieldSystem->location->mapId, fieldSystem->unk_9C, fieldSystem->unk_98, fieldSystem->unk_BC);
|
||||
sub_02052894(battleParams);
|
||||
}
|
||||
|
||||
void sub_02052348 (BattleParams * param0, const FieldSystem * fieldSystem, int param2)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user