Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start Syncing HGSS Battle Loading - Preliminary cleanup #314

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions asm/macros/scrcmd.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4475,10 +4475,10 @@
.short \arg0
.endm

.macro ScrCmd_337 arg0, arg1
.macro has_seen_species species, ret
.short 823
.short \arg0
.short \arg1
.short \species
.short \ret
.endm

.macro ScrCmd_338
Expand Down
2 changes: 1 addition & 1 deletion docs/bugs_and_glitches.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ or Uproar is in effect.
**Fix:** Edit [`res/battle/res/scripts/subscript_pursuit.s`](https://github.com/pret/pokeplatinum/blob/main/res/battle/scripts/subscripts/subscript_pursuit.s)

```diff
UpdateVar OPCODE_ADD, BTLVAR_FAINTED_MON, BATTLER_ENEMY_SLOT_1
UpdateVar OPCODE_ADD, BTLVAR_FAINTED_MON, BATTLER_ENEMY_1
UpdateVar OPCODE_RIGHT_SHIFT, BTLVAR_CALC_TEMP, 0x00000001
CompareVarToValue OPCODE_NEQ, BTLVAR_CALC_TEMP, 0x00000000, _208
- // BUG: Acid Rain (see docs/bugs_and_glitches.md)
Expand Down
228 changes: 114 additions & 114 deletions include/battle/ov16_0223DF00.h

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ enum BattlerBootState {
*
* PLAYER_SLOT_1 PLAYER_SLOT_2
*/
#define BATTLER_PLAYER_SLOT_1 0
#define BATTLER_ENEMY_SLOT_1 1
#define BATTLER_PLAYER_SLOT_2 2
#define BATTLER_ENEMY_SLOT_2 3
#define BATTLER_NONE 0xFF
#define BATTLER_PLAYER_1 0
#define BATTLER_ENEMY_1 1
#define BATTLER_PLAYER_2 2
#define BATTLER_ENEMY_2 3
#define BATTLER_NONE 0xFF

#define BATTLER_TYPE_SOLO_PLAYER 0
#define BATTLER_TYPE_SOLO_ENEMY 1
Expand Down
8 changes: 4 additions & 4 deletions include/field_battle_data_transfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "game_options.h"
#include "game_records.h"
#include "journal.h"
#include "poketch_data.h"
#include "poketch.h"
#include "rtc.h"
#include "savedata.h"
#include "trainer_info.h"
Expand All @@ -35,14 +35,14 @@ typedef struct FieldBattleDTO {
Party *parties[MAX_BATTLERS];
int resultMask;
int trainerIDs[MAX_BATTLERS];
TrainerData trainerData[MAX_BATTLERS];
Trainer trainer[MAX_BATTLERS];
TrainerInfo *trainerInfo[MAX_BATTLERS];
Bag *bag;
BagCursor *bagCursor;
PokedexData *pokedex;
Pokedex *pokedex;
PCBoxes *pcBoxes;
ChatotCry *chatotCries[MAX_BATTLERS];
PoketchData *poketchData;
Poketch *poketch;
UnkStruct_0202C878 *unk_104;
Options *options;
UnkStruct_0206D140 *unk_10C;
Expand Down
2 changes: 1 addition & 1 deletion include/game_records.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ u32 GameRecords_AddToRecordValue(GameRecords *records, int id, u32 toAdd);
u32 GameRecords_GetRecordValue(GameRecords *records, int id);
void GameRecords_IncrementTrainerScore(GameRecords *records, int scoreID);
u32 GameRecords_GetTrainerScore(GameRecords *records);
void GameRecords_IncrementTrainerScoreOnCatch(GameRecords *records, const PokedexData *pokedex, const u16 species);
void GameRecords_IncrementTrainerScoreOnCatch(GameRecords *records, const Pokedex *pokedex, const u16 species);

#endif // POKEPLATINUM_GAME_RECORDS_H
16 changes: 8 additions & 8 deletions include/overlay005/ov5_021F77A8.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

#include "field_script_context.h"

BOOL ScrCmd_337(ScriptContext *param0);
BOOL ScrCmd_2E5(ScriptContext *param0);
BOOL ScrCmd_2E9(ScriptContext *param0);
BOOL ScrCmd_2EA(ScriptContext *param0);
BOOL ScrCmd_2EB(ScriptContext *param0);
BOOL ScrCmd_2E6(ScriptContext *param0);
BOOL ScrCmd_2EC(ScriptContext *param0);
BOOL ScrCmd_2ED(ScriptContext *param0);
BOOL ScrCmd_HasSeenSpecies(ScriptContext *ctx);
BOOL ScrCmd_2E5(ScriptContext *ctx);
BOOL ScrCmd_2E9(ScriptContext *ctx);
BOOL ScrCmd_2EA(ScriptContext *ctx);
BOOL ScrCmd_2EB(ScriptContext *ctx);
BOOL ScrCmd_2E6(ScriptContext *ctx);
BOOL ScrCmd_2EC(ScriptContext *ctx);
BOOL ScrCmd_2ED(ScriptContext *ctx);

#endif // POKEPLATINUM_OV5_021F77A8_H
4 changes: 2 additions & 2 deletions include/overlay021/struct_ov21_021D0D80.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "trainer_info.h"

typedef struct {
const PokedexData *unk_00;
const TrainerInfo *unk_04;
const Pokedex *pokedex;
const TrainerInfo *trainerInfo;
int timeOfDay;
BOOL fullmoonIslandVisible;
BOOL newmoonIslandVisible;
Expand Down
2 changes: 1 addition & 1 deletion include/overlay021/struct_ov21_021D3208.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "trainer_info.h"

typedef struct {
const PokedexData *dexData;
const Pokedex *pokedex;
const TrainerInfo *unk_04;
int timeOfDay;
BOOL fullmoonIslandVisible;
Expand Down
2 changes: 1 addition & 1 deletion include/overlay021/struct_ov21_021D3320.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "strbuf.h"

typedef struct {
const PokedexData *dexData;
const Pokedex *pokedex;
SortedPokedex sortedPokedex;
int isNationalDex;
BOOL isNationalDexUnlocked;
Expand Down
6 changes: 3 additions & 3 deletions include/overlay025/poketch_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "overlay025/struct_ov25_02254560_decl.h"

#include "bg_window.h"
#include "poketch_data.h"
#include "poketch.h"
#include "savedata.h"
#include "sys_task_manager.h"

Expand Down Expand Up @@ -110,7 +110,7 @@ struct PoketchSystem {
NNSG2dOamManagerInstance *oamManager;

SaveData *saveData;
PoketchData *poketchData;
Poketch *poketch;
FieldSystem *fieldSystem;
enum ButtonDir buttonDir;
};
Expand All @@ -135,7 +135,7 @@ void ov25_02254518(const PoketchSystem *poketchSys, PoketchButtonManager *button
BOOL PoketchSystem_IsPlayerMoving(const PoketchSystem *poketchSys);
BOOL PoketchSystem_PedometerUpdated(const PoketchSystem *poketchSys);
FieldSystem *PoketchSystem_GetFieldSystem(const PoketchSystem *poketchSys);
PoketchData *PoketchSystem_GetPoketchData(const PoketchSystem *poketchSys);
Poketch *PoketchSystem_GetPoketchData(const PoketchSystem *poketchSys);
SaveData *PoketchSystem_GetSaveData(const PoketchSystem *poketchSys);
int PoketchSystem_GetBorderColor(const PoketchSystem *poketchSys);

Expand Down
2 changes: 1 addition & 1 deletion include/overlay088/struct_ov88_0223C370.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ typedef struct {
Options *unk_18;
JournalEntry *unk_1C;
GameRecords *records;
PokedexData *unk_24;
Pokedex *unk_24;
int unk_28;
int unk_2C;
int unk_30;
Expand Down
2 changes: 1 addition & 1 deletion include/overlay094/ov94_022414B8.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ u16 *ov94_Pokedex_Alphabetical(int heapID, int unused, int *pokedexLength);
u8 *ov94_02242548(int param0);
void ov94_022425A8(UnkStruct_ov94_0223BA88 *param0, UnkStruct_ov94_0223FD4C *param1);
ListMenu *ov94_022426A8(UnkStruct_ov94_0223FD4C *param0, StringList **param1, Window *param2, MessageLoader *param3);
ListMenu *ov94_022427C0(UnkStruct_ov94_0223FD4C *param0, StringList **param1, Window *param2, MessageLoader *param3, MessageLoader *param4, UnkStruct_ov94_0223FD4C_sub3 *param5, PokedexData *param6);
ListMenu *ov94_022427C0(UnkStruct_ov94_0223FD4C *param0, StringList **param1, Window *param2, MessageLoader *param3, MessageLoader *param4, UnkStruct_ov94_0223FD4C_sub3 *param5, Pokedex *param6);
ListMenu *ov94_02242840(StringList **param0, Window *param1, MessageLoader *param2);
ListMenu *ov94_022428B0(StringList **param0, Window *param1, MessageLoader *param2, int param3);
void ov94_02242934(UnkStruct_ov94_0223BA88_sub3 *param0, int param1, int param2);
Expand Down
2 changes: 1 addition & 1 deletion include/party.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int Party_GetCurrentCount(const Party *party);
Pokemon *Party_GetPokemonBySlotIndex(const Party *party, int slot);
void sub_0207A128(Party *party, int slot, Pokemon *param2);
BOOL Party_SwapSlots(Party *party, int slotA, int slotB);
void Party_cpy(const Party *src, Party *dest);
void Party_Copy(const Party *src, Party *dest);
BOOL Party_HasSpecies(const Party *party, int species);
Party *Party_GetFromSavedata(SaveData *party);

Expand Down
53 changes: 53 additions & 0 deletions include/pokedex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#ifndef POKEPLATINUM_POKEDEX_H
#define POKEPLATINUM_POKEDEX_H

#include "struct_decls/pokedexdata_decl.h"

#include "pokemon.h"
#include "savedata.h"

int Pokedex_SaveSize(void);
Pokedex *Pokedex_New(u32 heapID);
void Pokedex_Copy(const Pokedex *src, Pokedex *dest);
void Pokedex_Init(Pokedex *pokedex);
u16 Pokedex_CountCaught_National(const Pokedex *pokedex);
u16 Pokedex_CountSeen_National(const Pokedex *pokedex);
u16 Pokedex_CountSeen(const Pokedex *pokedex);
u16 Pokedex_CountCaught_Local(const Pokedex *pokedex);
u16 Pokedex_CountSeen_Local(const Pokedex *pokedex);
BOOL Pokedex_NationalDexCompleted(const Pokedex *pokedex);
BOOL Pokedex_LocalDexCompleted(const Pokedex *pokedex);
u16 Pokedex_NumCaught_National(const Pokedex *pokedex);
u16 Pokedex_NumCaught_Local(const Pokedex *pokedex);
BOOL Pokedex_HasCaughtSpecies(const Pokedex *pokedex, u16 species);
BOOL Pokedex_HasSeenSpecies(const Pokedex *pokedex, u16 species);
u32 Pokedex_GetForm_Spinda(const Pokedex *pokedex, u8 formIndex);
u32 Pokedex_DisplayedGender(const Pokedex *pokedex, u16 species, int displaySecondary);
u32 Pokedex_GetForm_Unown(const Pokedex *pokedex, int formIndex);
u32 Pokedex_NumFormsSeen_Unown(const Pokedex *pokedex);
u32 Pokedex_GetForm_Shellos(const Pokedex *pokedex, int formIndex);
u32 Pokedex_NumFormsSeen_Shellos(const Pokedex *pokedex);
u32 Pokedex_GetForm_Gastrodon(const Pokedex *pokedex, int formIndex);
u32 Pokedex_NumFormsSeen_Gastrodon(const Pokedex *pokedex);
u32 Pokedex_GetForm_Burmy(const Pokedex *pokedex, int formIndex);
u32 Pokedex_NumFormsSeen_Burmy(const Pokedex *pokedex);
u32 Pokedex_GetForm_Wormadam(const Pokedex *pokedex, int formIndex);
u32 Pokedex_NumFormsSeen_Wormadam(const Pokedex *pokedex);
u32 Pokedex_GetForm_Deoxys(const Pokedex *pokedex, int formIndex);
u32 Pokedex_NumFormsSeen_Deoxys(const Pokedex *pokedex);
void Pokedex_Encounter(Pokedex *pokedex, Pokemon *pokemon);
void Pokedex_Capture(Pokedex *pokedex, Pokemon *pokemon);
void Pokedex_ObtainNationalDex(Pokedex *pokedex);
BOOL Pokedex_IsNationalDexObtained(const Pokedex *pokedex);
BOOL Pokedex_CanDetectForms(const Pokedex *pokedex);
void Pokedex_TurnOnFormDetection(Pokedex *pokedex);
BOOL Pokedex_IsLanguageObtained(const Pokedex *pokedex, u16 species, u32 languageIndex);
void Pokedex_TurnOnLanguageDetection(Pokedex *pokedex);
BOOL Pokedex_CanDetectLanguages(const Pokedex *pokedex);
BOOL Pokedex_IsObtained(const Pokedex *pokedex);
void Pokedex_ObtainPokedex(Pokedex *pokedex);
Pokedex *SaveData_GetPokedex(SaveData *saveData);
u32 Pokedex_GetDisplayForm(const Pokedex *pokedex, int species, int formIndex);
u32 Pokedex_NumFormsSeen(const Pokedex *pokedex, int species);

#endif // POKEPLATINUM_POKEDEX_H
53 changes: 0 additions & 53 deletions include/pokedex_data.h

This file was deleted.

Loading
Loading