Merge branch 'master' into unk_0200CF18

This commit is contained in:
Adrienn Tindall 2023-09-30 13:30:37 -05:00 committed by GitHub
commit 135d719def
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 836 additions and 832 deletions

View File

@ -19,7 +19,7 @@
.public ScriptReadHalfword
.public FieldSysGetAttrAddr
.public FieldSystem_VarGet
.public sub_02050AAC
.public CallTask_020509F0
.public sub_020517E8
.public sub_020517FC
.public BattleSetup_New

View File

@ -17,7 +17,7 @@
.public CallApplicationAsTask
.public TaskManager_GetFieldSystem
.public TaskManager_GetEnvironment
.public sub_020514A4
.public CallTask_02050960
.public SetFlag970
.public sub_02078B58
.public sub_02078B78

View File

@ -70,7 +70,7 @@ _0225990E:
add r1, r6, #0
add r2, r4, #0
add r3, r7, #0
bl sub_02050AAC
bl CallTask_020509F0
add sp, #0x184
pop {r4, r5, r6, r7, pc}
.balign 4, 0

View File

@ -218,7 +218,7 @@ _0207899C:
ldrb r3, [r4, #0xd]
ldr r1, [r1, #8]
add r0, r6, #0
bl sub_020514A4
bl CallTask_02050960
ldr r0, [r4, #4]
add r0, r0, #1
str r0, [r4, #4]

View File

@ -531,7 +531,7 @@ struct BattleSystem {
Bag *bag;
BagCursor *bagCursor;
Pokedex *pokedex;
PC_STORAGE *storage;
PCStorage *storage;
Party *trainerParty[4];
SOUND_CHATOT *chatotVoice[4];
u32 *unk88;
@ -542,7 +542,7 @@ struct BattleSystem {
u32 *unk9C;
u16 trainerId[4];
u8 trainerGender[4];
TRAINER trainers[4];
Trainer trainers[4];
UnkBattleSystemSub17C unk17C[2]; //Battle Background..?
u32 *unk19C;
u32 *unk1A0[2];

View File

@ -27,12 +27,12 @@ struct BattleSetup { //declared in trainer_data.h
Party* party[BATTLER_MAX]; // 4
int winFlag; // 14
int trainerId[BATTLER_MAX]; // 18
TRAINER trainer[BATTLER_MAX]; // 28
Trainer trainer[BATTLER_MAX]; // 28
PlayerProfile *profile[BATTLER_MAX]; // f8
Bag* bag; // 108
void* unk_10C;
Pokedex* pokedex; // 110
PC_STORAGE* storagePC; // 114
PCStorage* storagePC; // 114
SOUND_CHATOT* chatot[BATTLER_MAX]; // 118
void* unk_128;
void* unk_12C;

View File

@ -41,7 +41,7 @@ UnkBattleSystemSub1D0 *ov12_0223A99C(BattleSystem *bsys);
u32 *ov12_0223A9A4(BattleSystem *bsys);
String *BattleSystem_GetMessageBuffer(BattleSystem *bsys);
u16 BattleSystem_GetTrainerIndex(BattleSystem *bsys, int battlerId);
TRAINER *BattleSystem_GetTrainer(BattleSystem *bsys, int battlerId);
Trainer *BattleSystem_GetTrainer(BattleSystem *bsys, int battlerId);
PlayerProfile *BattleSystem_GetPlayerProfile(BattleSystem *bsys, int a1);
Bag *BattleSystem_GetBag(BattleSystem *bsys);
BagCursor *BattleSystem_GetBagCursor(BattleSystem *bsys);
@ -52,7 +52,7 @@ int ov12_0223AAD8(BattleSystem *bsys, int a1);
u8 ov12_0223AB0C(BattleSystem *bsys, int battlerId);
u8 BattleSystem_GetFieldSide(BattleSystem *bsys, int battlerId);
void *BattleSystem_GetMessageIcon(BattleSystem *bsys);
PC_STORAGE *BattleSystem_GetPcStorage(BattleSystem *bsys);
PCStorage *BattleSystem_GetPcStorage(BattleSystem *bsys);
Terrain BattleSystem_GetTerrainId(BattleSystem *bsys);
int ov12_0223AB54(BattleSystem *bsys);
int BattleSystem_GetLocation(BattleSystem *bsys);

View File

@ -5,18 +5,18 @@
#include "script.h"
void FieldSystem_StartBugContestTimer(FieldSystem *fieldSystem);
BUGCONTEST *BugContest_New(FieldSystem *fieldSystem, u32 weekday);
void BugContest_Delete(BUGCONTEST *bugContest);
void BugContest_Judge(BUGCONTEST *bugContest);
void BugContest_BufferContestWinnerNames(BUGCONTEST *bugContest, MsgData *msgData, MessageFormat *msgFmt, u8 place);
BOOL BugContest_ContestantIsRegistered(BUGCONTEST *bugContest, u8 id);
BOOL BugContest_BufferCaughtMonNick(BUGCONTEST *bugContest, MessageFormat *msgFmt, u8 slot);
void BugContest_BackUpParty(BUGCONTEST *bugContest);
void BugContest_RestoreParty_RetrieveCaughtPokemon(BUGCONTEST *bugContest);
BOOL BugContest_ContestantIsRegisteredN(BUGCONTEST *bugContest, u8 id, u8 n);
void BugContest_InitOpponents(BUGCONTEST *bugContest);
void BugContest_InitEncounters(BUGCONTEST *bugContest);
u16 BugContest_JudgePlayerMon(BUGCONTEST *bugContest, Pokemon *pokemon);
ENC_SLOT *BugContest_GetEncounterSlot(BUGCONTEST *bugContest, HeapID heapId);
BugContest *BugContest_New(FieldSystem *fieldSystem, u32 weekday);
void BugContest_Delete(BugContest *bugContest);
void BugContest_Judge(BugContest *bugContest);
void BugContest_BufferContestWinnerNames(BugContest *bugContest, MsgData *msgData, MessageFormat *msgFmt, u8 place);
BOOL BugContest_ContestantIsRegistered(BugContest *bugContest, u8 id);
BOOL BugContest_BufferCaughtMonNick(BugContest *bugContest, MessageFormat *msgFmt, u8 slot);
void BugContest_BackUpParty(BugContest *bugContest);
void BugContest_RestoreParty_RetrieveCaughtPokemon(BugContest *bugContest);
BOOL BugContest_ContestantIsRegisteredN(BugContest *bugContest, u8 id, u8 n);
void BugContest_InitOpponents(BugContest *bugContest);
void BugContest_InitEncounters(BugContest *bugContest);
u16 BugContest_JudgePlayerMon(BugContest *bugContest, Pokemon *pokemon);
ENC_SLOT *BugContest_GetEncounterSlot(BugContest *bugContest, HeapID heapId);
#endif //POKEHEARTGOLD_BUG_CONTEST_H

View File

@ -16,25 +16,25 @@ typedef struct BUGMON {
#define BUGMON_COUNT 10
typedef struct BUGCONTESTANT_BIN {
typedef struct BugContestantData {
u8 national;
u8 day;
u16 species;
u16 score;
u16 randmod;
} BUGCONTESTANT_BIN;
} BugContestantData;
typedef struct BUGCONTESTANT {
typedef struct BugContestant {
u8 id;
u16 score;
BUGCONTESTANT_BIN data;
} BUGCONTESTANT;
BugContestantData data;
} BugContestant;
#define BUGCONTESTANT_NPC_COUNT 5
#define BUGCONTESTANT_PLAYER BUGCONTESTANT_NPC_COUNT
#define BUGCONTESTANT_COUNT (BUGCONTESTANT_NPC_COUNT+1)
typedef struct BUGCONTEST {
typedef struct BugContest {
HeapID heapId; // Always set to 3
SaveData *saveData; // Pointer to save data
Party *party_bak; // Player's party is held for the contest
@ -50,8 +50,8 @@ typedef struct BUGCONTEST {
u16 prize; // Item ID
u32 elapsed_time; // Used to determine when the contest ends
BUGMON encounters[BUGMON_COUNT]; // Which wild Pokemon you can find
BUGCONTESTANT contestants[BUGCONTESTANT_COUNT]; // 5 NPCs + player
BugContestant contestants[BUGCONTESTANT_COUNT]; // 5 NPCs + player
u8 ranking[BUGCONTESTANT_COUNT]; // Index sorting by score at the end
} BUGCONTEST;
} BugContest;
#endif //POKEHEARTGOLD_BUG_CONTEST_INTERNAL_H

View File

@ -64,6 +64,7 @@ typedef enum Terrain {
// Battle outcome
// Used with BattleSetup::winFlag
#define BATTLE_OUTCOME_NONE 0
#define BATTLE_OUTCOME_WIN 1
#define BATTLE_OUTCOME_LOSE 2
#define BATTLE_OUTCOME_DRAW 3
@ -72,6 +73,7 @@ typedef enum Terrain {
#define BATTLE_OUTCOME_FOE_FLED 6
//Battle Type
#define BATTLE_TYPE_NONE 0
#define BATTLE_TYPE_TRAINER (1 << 0)
#define BATTLE_TYPE_DOUBLES (1 << 1)
#define BATTLE_TYPE_LINK (1 << 2)

View File

@ -1,10 +1,11 @@
#ifndef POKEHEARTGOLD_CONSTANTS_GAME_STAT_H
#define POKEHEARTGOLD_CONSTANTS_GAME_STAT_H
#ifndef POKEHEARTGOLD_CONSTANTS_GAME_STATS_H
#define POKEHEARTGOLD_CONSTANTS_GAME_STATS_H
#define GAME_STAT_APRICORN_GET 1
#define GAME_STAT_UNK2 2
#define GAME_STAT_UNK6 6
#define GAME_STAT_UNK9 9
#define GAME_STAT_UNK8 8 //wild battles?
#define GAME_STAT_UNK9 9 //trainer battles?
#define GAME_STAT_UNK10 10
#define GAME_STAT_UNK11 11
#define GAME_STAT_UNK12 12
@ -15,4 +16,4 @@
#define GAME_STAT_UNK46 46
#define GAME_STAT_BATTLE_POINTS 69
#endif //POKEHEARTGOLD_CONSTANTS_GAME_STAT_H
#endif //POKEHEARTGOLD_CONSTANTS_GAME_STATS_H

View File

@ -3,6 +3,9 @@
#include "constants/trainers.h"
// TODO: decide whether we want to keep this case
// or whether we want to capitalise this file.
// The _std_XXX constants are group thresholds for
// use in fieldmap.c (sScriptBankMapping).
// The std_XXX constants (no leading underscore)

View File

@ -5,35 +5,34 @@
#include "field_player_avatar.h"
#include "task.h"
typedef struct EncounterWork {
typedef struct Encounter {
u32 *winFlag;
int effect;
int bgm;
int unkC;
s32 effect;
s32 bgm;
s32 unkC;
BattleSetup *setup;
} ENCOUNTER;
} Encounter;
typedef struct WildEncounterWork {
int state;
int effect;
int bgm;
int *winFlag;
typedef struct WildEncounter {
s32 state;
s32 effect;
s32 bgm;
u32 *winFlag;
BattleSetup *setup;
} WILD_ENCOUNTER;
} WildEncounter;
void CallTask_020509F0(TaskManager *taskManager, BattleSetup *battleSetup, s32 effect, s32 bgm, u32 *winFlag);
void sub_02050B08(FieldSystem *fieldSystem, BattleSetup *setup);
void sub_02051428(TaskManager *taskManager, void *a1, int a2);
void SetupAndStartWildBattle(TaskManager *taskManager, u16 species, u8 level, u32 *winFlag, BOOL canRun, BOOL shiny);
void sub_02051090(TaskManager *taskManager, u16 species, u8 level, u32 *winFlag, BOOL canRun);
void sub_02051228(TaskManager *taskManager, u16 species, u8 level);
void sub_02050B90(FieldSystem *fieldSystem, TaskManager *taskManager, BattleSetup *setup);
void SetupAndStartWildBattle(TaskManager *taskManager, u16 species, u8 level, u32 *winFlag, BOOL canFlee, BOOL shiny);
void SetupAndStartFatefulWildBattle(TaskManager *taskManager, u16 species, u8 level, u32 *winFlag, BOOL canRun);
void sub_020511F8(FieldSystem *fieldSystem, BattleSetup *setup);
void SetupAndStartFirstBattle(TaskManager *taskManager, u16 species, u8 level);
void SetupAndStartTutorialBattle(TaskManager *taskManager);
void SetupAndStartTrainerBattle(TaskManager *taskManager, u32 opponentTrainer1, u32 opponentTrainer2, u32 followerTrainerNum, u32 a4, u32 a5, HeapID heapId, u32 *winFlag);
void sub_02050B90(FieldSystem *fieldSystem, TaskManager *taskManager, BattleSetup *setup);
void sub_0205239C(BattleSetup *setup, FieldSystem *fieldSystem);
void sub_02050AAC(TaskManager *man, BattleSetup *setup, int effect, int bgm, u32 *winFlag);
void sub_020511F8(FieldSystem *fieldSystem, BattleSetup *setup);
void sub_020515FC(FieldSystem *fieldSystem, Party *party, int battleFlags);
void sub_02051598(FieldSystem *fieldSystem, void *a1, int battleFlags);
void sub_020514A4(TaskManager *man, int target, int maxLevel, int flag);
void CallTask_020508B8(TaskManager *taskManager, void *param1, u32 battleType);
void CallTask_02050960(TaskManager *taskManager, s32 target, s32 maxLevel, u32 flag);
void sub_02051598(FieldSystem *fieldSystem, void *param1, s32 battleType);
void sub_020515FC(FieldSystem *fieldSystem, Party *party, s32 battleType);
#endif //POKEHEARTGOLD_ENCOUNTER_H

View File

@ -5,8 +5,8 @@
#include "heap.h"
#include "map_object_manager.h"
LocalMapObject *sub_020699F8(MapObjectManager *mapObjectMan, int x, int y, int direction, u32 mapno);
void sub_02069B74(MapObjectManager *mapObjectMan, u32 mapno);
LocalMapObject *sub_020699F8(MapObjectManager *mapObjectManager, int x, int y, int direction, u32 mapno);
void sub_02069B74(MapObjectManager *mapObjectManager, u32 mapno);
LocalMapObject *FollowingPokemon_GetMapObject(FieldSystem *fieldSystem);
u32 FollowingPokemon_GetSpriteID(int species, u16 form, u32 gender);
void sub_02069DC8(LocalMapObject *mapObject, BOOL enable_bit);

View File

@ -160,8 +160,8 @@ void sub_0205E104(MapObjectManager* manager, u32 a1, u32 a2, u32 num_object_even
MapObjectManager* MapObjectManager_New(u32 count);
LocalMapObject* sub_0205E1D0(MapObjectManager* manager, ObjectEvent* object_events, u32 map_no);
LocalMapObject *CreateSpecialFieldObject(MapObjectManager *objectMan, u32 x, u32 z, u32 direction, u32 sprite, u32 movement, u32 mapNo);
LocalMapObject *CreateSpecialFieldObjectEx(MapObjectManager *mapObjectMan, u32 x, u32 y, u32 direction, u32 a4, u32 a5, u32 mapNo, u32 a7, u32 a8, u32 spriteId);
LocalMapObject* CreateMapObjectFromTemplate(MapObjectManager *mapObjectMan, u16 objectId, u32 numObjects, u32 mapId, const ObjectEvent *templates);
LocalMapObject *CreateSpecialFieldObjectEx(MapObjectManager *mapObjectManager, u32 x, u32 y, u32 direction, u32 a4, u32 a5, u32 mapNo, u32 a7, u32 a8, u32 spriteId);
LocalMapObject* CreateMapObjectFromTemplate(MapObjectManager *mapObjectManager, u16 objectId, u32 numObjects, u32 mapId, const ObjectEvent *templates);
void sub_0205E38C(LocalMapObject* object, u32 sprite_id);
void sub_0205E3AC(LocalMapObject* object, u32 sprite_id);
void MapObject_Remove(LocalMapObject *object);
@ -171,8 +171,8 @@ void MapObjectManager_RemoveAllActiveObjects(MapObjectManager *man);
void sub_0205E4C8(MapObjectManager* manager);
void sub_0205E520(MapObjectManager* manager);
void sub_0205E580(MapObjectManager* manager);
void FieldSystem_SyncMapObjectsToSaveEx(FieldSystem *fieldSystem, MapObjectManager *mapObjectMan, struct SavedMapObject *saveObj, int objNum);
void MapObjectManager_RestoreFromSave(MapObjectManager *mapObjectMan, SavedMapObject *list, u32 numObj);
void FieldSystem_SyncMapObjectsToSaveEx(FieldSystem *fieldSystem, MapObjectManager *mapObjectManager, struct SavedMapObject *saveObj, int objNum);
void MapObjectManager_RestoreFromSave(MapObjectManager *mapObjectManager, SavedMapObject *list, u32 numObj);
void sub_0205E680(FieldSystem* fieldSystem, LocalMapObject* local_object, SavedMapObject* saved_object);
void sub_0205E7C4(LocalMapObject* local_object, SavedMapObject* saved_object);
void sub_0205E8EC(MapObjectManager* manager, LocalMapObject* object);

View File

@ -123,7 +123,7 @@ struct FieldSystem {
FieldSystemUnkSub2C *unk2C;
MAPMATRIX *mapMatrix;
u8 filler34[0x8];
MapObjectManager *mapObjectMan;
MapObjectManager *mapObjectManager;
PlayerAvatar *playerAvatar;
void *unk_44;
u8 filler48[0xC];
@ -165,7 +165,7 @@ struct FieldSystem {
u8 unk_110;
u8 unk_111[3];
GearPhoneRingManager *unk114;
BUGCONTEST *bugContest;
BugContest *bugContest;
u8 unk11C[0x8];
u32 judgeStatPosition;
}; // size: 0x128

View File

@ -3,6 +3,6 @@
#include "field_system.h"
FieldSystem *MapObjectManager_GetFieldSysPtr(MapObjectManager *mapObjectMan);
FieldSystem *MapObjectManager_GetFieldSysPtr(MapObjectManager *mapObjectManager);
#endif //POKEHEARTGOLD_MAP_OBJECT_MANAGER_H

View File

@ -57,13 +57,13 @@ void BufferStatusName(MessageFormat *messageFormat, u32 fieldno, u32 statusId);
void BufferFlavorDislikeText(MessageFormat *messageFormat, u32 fieldno, u32 flavorId);
void BufferLandmarkName(MessageFormat *messageFormat, u32 fieldno, u32 landmarkId);
void BufferTrainerClassNameWithArticle(MessageFormat *messageFormat, u32 fieldno, u32 trainerClassId);
void BufferTrainerClassNameFromDataStruct(MessageFormat *messageFormat, u32 fieldno, TRAINER *trainer);
void BufferTrainerClassNameFromDataStruct(MessageFormat *messageFormat, u32 fieldno, Trainer *trainer);
void BufferTrainerName(MessageFormat *messageFormat, u32 fieldno, u32 trainerId);
void BufferFrontierOpponentName(MessageFormat *messageFormat, u32 fieldno, u32 opponentId);
void BufferTrainerNameFromDataStruct(MessageFormat *messageFormat, u32 fieldno, TRAINER *trainer);
void BufferTrainerNameFromDataStruct(MessageFormat *messageFormat, u32 fieldno, Trainer *trainer);
void BufferDecorationName(MessageFormat *messageFormat, u32 fieldno, u32 decorationId);
void BufferGenderSymbol(MessageFormat *messageFormat, u32 fieldno, u8 gender);
void BufferPCBoxName(MessageFormat *messageFormat, u32 fieldno, PC_STORAGE *pcStorage, u32 boxno);
void BufferPCBoxName(MessageFormat *messageFormat, u32 fieldno, PCStorage *pcStorage, u32 boxno);
void BufferCountryName(MessageFormat *messageFormat, u32 fieldno, u32 countryId);
void BufferCityName(MessageFormat *messageFormat, u32 fieldno, u32 countryId, u32 cityId);
void BufferSealName(MessageFormat *messageFormat, u32 fieldno, u32 sealId);

View File

@ -16,4 +16,4 @@ void ov01_021E90DC(u32 x, u32 y, FieldEnvSubUnk18 *a2);
BOOL ov01_021E90E4(FieldSystem *fieldSystem, FieldEnvSubUnk18 *a1);
BOOL ov01_021E9374(FieldSystem *fieldSystem, FieldEnvSubUnk18 *a1);
#endif //POKEHEARTGOLD_OVERLAY_01_021E90C0_H
#endif //POKEHEARTGOLD_OVERLAY_01_021E90C0_H

View File

@ -95,7 +95,7 @@ BOOL ov02_02253134(SaveData *saveData);
int ov02_0225316C(void);
BOOL ov02_02253188(SaveData *saveData);
int ov02_022531B4(SaveData *saveData);
BOOL ov02_022470A0(FieldSystem *fieldSystem, BattleSetup **a1);
BOOL ov02_022470A0(FieldSystem *fieldSystem, BattleSetup **setupPtr);
void ov02_BattleExit_HandleRoamerAction(FieldSystem *fieldSystem, BattleSetup *setup);
BOOL ov02_02247374(FieldSystem *fieldSystem, BattleSetup **setup, void *arg2);
void ov02_02247F30(FieldSystem *fieldSystem, u16 mon, u8 level, BOOL shiny, BattleSetup *setup);

View File

@ -19,6 +19,6 @@ u16 ov03_02256A2C(FieldSystem *fieldSystem, MessageFormat *msgFmt, u16 a2);
void ov03_02256710(FieldSystem *fieldSystem, u16 a1);
void ov03_02258910(FieldSystem *fieldSystem);
void ov03_02258CFC(TaskManager *taskManager, enum PokeathlonData data);
int ov03_02256B40(int);
u32 ov03_02256B40(int);
#endif //POKEHEARTGOLD_OVERLAY_03_H

View File

@ -6,7 +6,7 @@
#include "constants/pokemon.h"
#include "constants/box_wallpaper.h"
typedef struct PokemonStorageSystem PC_STORAGE;
typedef struct PokemonStorageSystem PCStorage;
typedef struct PC_Box {
BoxPokemon mons[MONS_PER_BOX];
@ -25,37 +25,37 @@ struct PokemonStorageSystem {
#define BOX_ALL_MODIFIED_FLAG ((u32)((1<<NUM_BOXES)-1))
void PCStorage_GetBoxName(PC_STORAGE *pcStorage, u32 boxno, String *dest);
BOOL PCStorage_PlaceMonInFirstEmptySlotInAnyBox(PC_STORAGE *storage, BoxPokemon *boxMon);
void PCStorage_Init(PC_STORAGE *storage);
void PCStorage_GetBoxName(PCStorage *pcStorage, u32 boxno, String *dest);
BOOL PCStorage_PlaceMonInFirstEmptySlotInAnyBox(PCStorage *storage, BoxPokemon *boxMon);
void PCStorage_Init(PCStorage *storage);
u32 PCStorage_sizeof(void);
void PCStorage_InitializeBoxes(PC_STORAGE *storage);
BOOL PCStorage_PlaceMonInBoxFirstEmptySlot(PC_STORAGE* storage, u32 boxno, BoxPokemon *boxMon);
BOOL PCStorage_PlaceMonInBoxByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slotno, BoxPokemon *boxMon);
void PCStorage_SwapMonsInBoxByIndexPair(PC_STORAGE* storage, u32 boxno, u32 from, u32 to);
void PCStorage_DeleteBoxMonByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slotno);
int PCStorage_GetActiveBox(PC_STORAGE *storage);
int PCStorage_FindFirstBoxWithEmptySlot(PC_STORAGE *storage);
BOOL PCStorage_FindFirstEmptySlot(PC_STORAGE* storage, int* boxno_p, int* slotno_p);
int PCStorage_CountEmptySpotsInAllBoxes(PC_STORAGE* storage);
int PCStorage_CountEmptySpotsInBox(PC_STORAGE* storage, u32 boxno);
void PCStorage_SetActiveBox(PC_STORAGE* storage, u32 boxno);
u8 PCStorage_GetBoxWallpaper(PC_STORAGE* storage, u32 boxno);
void PCStorage_InitializeBoxes(PCStorage *storage);
BOOL PCStorage_PlaceMonInBoxFirstEmptySlot(PCStorage* storage, u32 boxno, BoxPokemon *boxMon);
BOOL PCStorage_PlaceMonInBoxByIndexPair(PCStorage* storage, u32 boxno, u32 slotno, BoxPokemon *boxMon);
void PCStorage_SwapMonsInBoxByIndexPair(PCStorage* storage, u32 boxno, u32 from, u32 to);
void PCStorage_DeleteBoxMonByIndexPair(PCStorage* storage, u32 boxno, u32 slotno);
int PCStorage_GetActiveBox(PCStorage *storage);
int PCStorage_FindFirstBoxWithEmptySlot(PCStorage *storage);
BOOL PCStorage_FindFirstEmptySlot(PCStorage* storage, int* boxno_p, int* slotno_p);
int PCStorage_CountEmptySpotsInAllBoxes(PCStorage* storage);
int PCStorage_CountEmptySpotsInBox(PCStorage* storage, u32 boxno);
void PCStorage_SetActiveBox(PCStorage* storage, u32 boxno);
u8 PCStorage_GetBoxWallpaper(PCStorage* storage, u32 boxno);
BOOL PCStorage_IsValidWallpaperId(u8 wallpaperno);
void PCStorage_SetBoxWallpaper(PC_STORAGE* storage, u32 boxno, u8 wallpaperno);
void PCStorage_SetBoxName(PC_STORAGE* storage, u32 boxno, const String* src);
int PCStorage_CountMonsAndEggsInBox(PC_STORAGE* storage, u32 boxno);
int PCStorage_CountMonsInBox(PC_STORAGE* storage, u32 boxno);
int PCStorage_CountMonsInAllBoxes(PC_STORAGE* storage);
u32 PCStorage_GetMonDataByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slotno, int attr, void *ptr);
BoxPokemon *PCStorage_GetMonByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slotno);
void PCStorage_UnlockBonusWallpaper(PC_STORAGE* storage, u32 wallpaper);
BOOL PCStorage_IsBonusWallpaperUnlocked(PC_STORAGE* storage, u32 wallpaper);
void PCStorage_SetBoxModified(PC_STORAGE* storage, u8 boxno);
void PCStorage_SetAllBoxesModified(PC_STORAGE* storage);
void PCStorage_ResetBoxModifiedFlags(PC_STORAGE* storage);
u32 PCStorage_GetBoxModifiedFlags(PC_STORAGE* storage);
void PCStorage_SetBoxWallpaper(PCStorage* storage, u32 boxno, u8 wallpaperno);
void PCStorage_SetBoxName(PCStorage* storage, u32 boxno, const String* src);
int PCStorage_CountMonsAndEggsInBox(PCStorage* storage, u32 boxno);
int PCStorage_CountMonsInBox(PCStorage* storage, u32 boxno);
int PCStorage_CountMonsInAllBoxes(PCStorage* storage);
u32 PCStorage_GetMonDataByIndexPair(PCStorage* storage, u32 boxno, u32 slotno, int attr, void *ptr);
BoxPokemon *PCStorage_GetMonByIndexPair(PCStorage* storage, u32 boxno, u32 slotno);
void PCStorage_UnlockBonusWallpaper(PCStorage* storage, u32 wallpaper);
BOOL PCStorage_IsBonusWallpaperUnlocked(PCStorage* storage, u32 wallpaper);
void PCStorage_SetBoxModified(PCStorage* storage, u8 boxno);
void PCStorage_SetAllBoxesModified(PCStorage* storage);
void PCStorage_ResetBoxModifiedFlags(PCStorage* storage);
u32 PCStorage_GetBoxModifiedFlags(PCStorage* storage);
u32 sub_02074120(void);
void sub_02074128(PC_STORAGE* storage);
void sub_02074128(PCStorage* storage);
#endif //POKEHEARTGOLD_POKEMON_STORAGE_SYSTEM_H

View File

@ -33,7 +33,7 @@ extern const struct ExtraSaveChunkHeader gExtraSaveChunkHeaders[];
extern const int gNumExtraSaveChunkHeaders;
struct UnkStruct_0202E474 *sub_020270C4(SaveData *saveData);
PC_STORAGE *SaveArray_PCStorage_Get(SaveData *saveData);
PCStorage *SaveArray_PCStorage_Get(SaveData *saveData);
MYSTERY_GIFT_SAVE *Save_MysteryGift_Get(SaveData *saveData);
struct MigratedPokemonSav *Save_MigratedPokemon_Get(SaveData *saveData);
HALL_OF_FAME *LoadHallOfFame(SaveData *saveData, HeapID heapId, int *ret_p);

View File

@ -90,17 +90,21 @@ typedef struct TrainerData {
/*002*/ u8 unk_2; // unused
/*003*/ u8 npoke;
/*004*/ u16 items[4];
/*00C*/ u32 ai_flags;
/*00C*/ u32 aiFlags;
/*010*/ u32 doubleBattle;
} TrainerData;
typedef struct Trainer {
struct TrainerData data;
/*014*/ u16 name[PLAYER_NAME_LENGTH + 1];
// Used in the Frontier
/*024*/ MAIL_MESSAGE winMessage;
/*02C*/ MAIL_MESSAGE loseMessage;
} TRAINER; // size=0x34
} Trainer; // size=0x34
typedef struct BattleSetup BattleSetup;
void TrainerData_ReadTrData(u32 trno, TRAINER *dest);
void TrainerData_ReadTrData(u32 trno, Trainer *dest);
TrainerGender TrainerClass_GetGenderOrTrainerCount(int trainerClass);
int TrainerData_GetAttr(u32 tr_idx, TrainerAttr attr_no);
void EnemyTrainerSet_Init(BattleSetup *battleSetup, SaveData *saveData, HeapID heapId);

View File

@ -4,7 +4,7 @@
#include "save.h"
BOOL sub_020291A4(SaveData *saveData, int a1);
int sub_02029264(void *a0);
u32 sub_02029264(void *a0);
BOOL sub_020290FC(void*, int);
#endif //POKEHEARTGOLD_UNK_020290B4_H

View File

@ -6,6 +6,6 @@
struct UnkStruct_0205AC88 *sub_0205AC88(struct UnkStruct_02059E1C *a0);
void sub_0205AD0C(struct UnkStruct_0205AC88 *a0);
void sub_0205AD3C(struct UnkStruct_0205AC88 *a0);
void sub_0205B27C(MapObjectManager *mapObjectMan, struct UnkStruct_0205AC88 *a0);
void sub_0205B27C(MapObjectManager *mapObjectManager, struct UnkStruct_0205AC88 *a0);
#endif //POKEHEARTGOLD_UNK_0205AC88_H

View File

@ -7,8 +7,8 @@
BOOL MonIsInGameTradePoke(Pokemon *mon, u8 tradeno);
BOOL sub_0206D8D0(Pokemon *mon, SaveData *saveData);
BUGCONTEST *FieldSystem_BugContest_Get(FieldSystem *fieldSystem);
u16 *BugContest_GetSportBallsAddr(BUGCONTEST *contest);
BugContest *FieldSystem_BugContest_Get(FieldSystem *fieldSystem);
u16 *BugContest_GetSportBallsAddr(BugContest *contest);
void FieldSystem_IncrementBugContestTimer(FieldSystem *fieldSystem, int a1);
void FieldSystem_InitMystriStageGymmick(FieldSystem *fieldSystem);
void sub_0206DB58(TaskManager *taskman, FieldSystem *fieldSystem);

View File

@ -2103,35 +2103,35 @@ u32 CalcPrizeMoney(BattleSystem *bsys, BattleContext *ctx, int trainerIndex) {
u32 prizeMoney;
u8 level = 0;
u8 trainerClass;
TRAINER trainer;
Trainer trainer;
trPoke = AllocFromHeap(HEAP_ID_BATTLE, sizeof(TRPOKE)*6);
TrainerData_ReadTrData(bsys->trainerId[trainerIndex], &trainer);
TrainerData_ReadTrPoke(bsys->trainerId[trainerIndex], trPoke);
switch (trainer.trainerType) {
switch (trainer.data.trainerType) {
default:
case 0:
TRPOKE_NOITEM_DFLTMOVES *pokeDef = (TRPOKE_NOITEM_DFLTMOVES *)trPoke;
level = pokeDef[trainer.npoke-1].level;
level = pokeDef[trainer.data.npoke-1].level;
break;
case 1:
TRPOKE_NOITEM_CUSTMOVES *pokeCust = (TRPOKE_NOITEM_CUSTMOVES *)trPoke;
level = pokeCust[trainer.npoke-1].level;
level = pokeCust[trainer.data.npoke-1].level;
break;
case 2:
TRPOKE_ITEM_DFLTMOVES *pokeItem = (TRPOKE_ITEM_DFLTMOVES *)trPoke;
level = pokeItem[trainer.npoke-1].level;
level = pokeItem[trainer.data.npoke-1].level;
break;
case 3:
TRPOKE_ITEM_CUSTMOVES *pokeCustItem = (TRPOKE_ITEM_CUSTMOVES *)trPoke;
level = pokeCustItem[trainer.npoke-1].level;
level = pokeCustItem[trainer.data.npoke-1].level;
break;
}
i = 0;
trainerClass = trainer.trainerClass;
trainerClass = trainer.data.trainerClass;
do {
if (trainerClass != sPrizeMoneyTbl[i][0]) {

View File

@ -48,7 +48,7 @@ BattleSetup* BattleSetup_New(HeapID heapId, u32 battleTypeFlags) {
setup->weatherType = 0;
for (i = 0; i < BATTLER_MAX; ++i) {
setup->trainerId[i] = 0;
MI_CpuClear32(&setup->trainer[i], sizeof(TRAINER));
MI_CpuClear32(&setup->trainer[i], sizeof(Trainer));
setup->party[i] = SaveArray_Party_Alloc(heapId);
setup->profile[i] = PlayerProfile_New(heapId);
setup->chatot[i] = Chatot_New(heapId);
@ -384,7 +384,7 @@ void sub_020520B0(BattleSetup* setup, FieldSystem *fieldSystem, Party *party, u8
if (sub_0203401C(sub_0203993C())) {
int avatar = PlayerProfile_GetAvatar(profile);
int gender = PlayerProfile_GetTrainerGender(profile);
setup->trainer[BATTLER_PLAYER].trainerClass = GetUnionRoomAvatarAttrBySprite(gender, avatar, 1);
setup->trainer[BATTLER_PLAYER].data.trainerClass = GetUnionRoomAvatarAttrBySprite(gender, avatar, 1);
CopyU16StringArray(setup->trainer[BATTLER_PLAYER].name, PlayerProfile_GetNamePtr(setup->profile[BATTLER_PLAYER]));
setup->trainer[BATTLER_PLAYER2] = setup->trainer[BATTLER_PLAYER];
} else {
@ -569,7 +569,7 @@ BOOL IsBattleResultLatiCaught(u32 result) {
}
void BattleSetup_SetAllySideBattlersToPlayer(BattleSetup* setup) {
setup->trainer[BATTLER_PLAYER].trainerClass = PlayerProfile_GetTrainerGender(setup->profile[BATTLER_PLAYER]);
setup->trainer[BATTLER_PLAYER].data.trainerClass = PlayerProfile_GetTrainerGender(setup->profile[BATTLER_PLAYER]);
CopyU16StringArray(setup->trainer[BATTLER_PLAYER].name, PlayerProfile_GetNamePtr(setup->profile[BATTLER_PLAYER]));
setup->trainer[BATTLER_PLAYER2] = setup->trainer[BATTLER_PLAYER];
}

View File

@ -6,7 +6,7 @@
#include "pokemon_mood.h"
#include "battle/overlay_12_0224E4FC.h"
#include "battle/overlay_12_0226BEC4.h"
#include "constants/game_stat.h"
#include "constants/game_stats.h"
#include "unk_0202FBCC.h"
#include "unk_0200FA24.h"
#include "unk_02005D10.h"
@ -177,7 +177,7 @@ u16 BattleSystem_GetTrainerIndex(BattleSystem *bsys, int battlerId) {
}
}
TRAINER *BattleSystem_GetTrainer(BattleSystem *bsys, int battlerId) {
Trainer *BattleSystem_GetTrainer(BattleSystem *bsys, int battlerId) {
if ((bsys->battleType & BATTLE_TYPE_MULTI) || ((bsys->battleType & BATTLE_TYPE_INGAME_PARTNER) && (ov12_0223AB0C(bsys, battlerId) & 1))) {
return &bsys->trainers[battlerId];
} else if (bsys->battleType & BATTLE_TYPE_DOUBLES) {
@ -246,7 +246,7 @@ void *BattleSystem_GetMessageIcon(BattleSystem *bsys) {
return bsys->msgIcon;
}
PC_STORAGE *BattleSystem_GetPcStorage(BattleSystem *bsys) {
PCStorage *BattleSystem_GetPcStorage(BattleSystem *bsys) {
return bsys->storage;
}
@ -1170,7 +1170,7 @@ int ov12_0223BFCC(BattleSystem *bsys, u16 battlerId) {
}
u16 BattleSystem_GetTrainerItem(BattleSystem *bsys, int battlerId, int index) {
return bsys->trainers[battlerId].items[index];
return bsys->trainers[battlerId].data.items[index];
}
BOOL ov12_0223BFEC(BattleSystem *bsys) {

File diff suppressed because it is too large Load Diff

View File

@ -131,7 +131,7 @@ static BOOL Task_AnimApricornTree(TaskManager *taskman) {
PlayerAvatar_GetCoordsInFront(fieldSystem->playerAvatar, &posX, &posZ);
apricornType = FieldSystem_ApricornTree_TryGetApricorn(fieldSystem, env->tree) - 1;
GF_ASSERT(apricornType >= APRICORN_NONE);
env->apricorn = CreateJumpingApricornObj(fieldSystem->mapObjectMan, SPRITE_BONMI_R + apricornType, posX, posZ);
env->apricorn = CreateJumpingApricornObj(fieldSystem->mapObjectManager, SPRITE_BONMI_R + apricornType, posX, posZ);
MapObject_GetPositionVec(env->apricorn, &pos);
pos.y += 12 * FX32_ONE;
MapObject_SetPositionVec(env->apricorn, &pos);

View File

@ -86,7 +86,7 @@ static void ov01_02201088(struct ListMenu *listMenu, s32 unused1, u8 unused2);
static void ov01_022010CC(SysTask *sysTask, void *work);
static void ov01_0220116C(SCR_648_STRUCT *unkPtr);
static void GetHiddenPowerPowerType(Pokemon *mon, s32 *power, s32 *type);
static LocalMapObject *ov01_02201F98(MapObjectManager *mapObjectMan, u8 unkA, u16 species, u16 form, u32 gender, u32 x, u32 y, u32 mapId);
static LocalMapObject *ov01_02201F98(MapObjectManager *mapObjectManager, u8 unkA, u16 species, u16 form, u32 gender, u32 x, u32 y, u32 mapId);
extern u16 ov01_02209AE0[10];
@ -606,7 +606,7 @@ BOOL ScrCmd_GetPartyMonForm(ScriptContext *ctx) {
BOOL ScrCmd_699(ScriptContext *ctx) {
u32 unkVar;
FieldSystem *fieldSystem;
MapObjectManager *mapObjectMan;
MapObjectManager *mapObjectManager;
LocalMapObject *playerObj;
LocalMapObject *curObj;
Sprite *sprite;
@ -616,14 +616,14 @@ BOOL ScrCmd_699(ScriptContext *ctx) {
unkVar = 0;
fieldSystem = ctx->fieldSystem;
mapObjectMan = fieldSystem->mapObjectMan;
mapObjectManager = fieldSystem->mapObjectManager;
playerObj = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar);
MapObject_GetPositionVec(playerObj, &vec);
height = vec.y;
while (sub_0205EEF4(mapObjectMan, &curObj, &unkVar, 1) == TRUE) {
while (sub_0205EEF4(mapObjectManager, &curObj, &unkVar, 1) == TRUE) {
if (curObj == playerObj) continue;
MapObject_SetFlagsBits(curObj, MAPOBJECTFLAG_UNK13);
if (MapObject_TestFlagsBits(curObj, MAPOBJECTFLAG_UNK12) == TRUE) {
@ -644,16 +644,16 @@ BOOL ScrCmd_699(ScriptContext *ctx) {
BOOL ScrCmd_700(ScriptContext *ctx) {
u32 index = 0;
FieldSystem *fieldSystem;
MapObjectManager *mapObjectMan;
MapObjectManager *mapObjectManager;
LocalMapObject *playerObj;
LocalMapObject *curObj;
fieldSystem = ctx->fieldSystem;
mapObjectMan = fieldSystem->mapObjectMan;
mapObjectManager = fieldSystem->mapObjectManager;
playerObj = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar);
while (sub_0205EEF4(mapObjectMan, &curObj, &index, MAPOBJECTFLAG_ACTIVE) == TRUE) {
while (sub_0205EEF4(mapObjectManager, &curObj, &index, MAPOBJECTFLAG_ACTIVE) == TRUE) {
if (curObj == playerObj) continue;
MapObject_ClearFlagsBits(curObj, MAPOBJECTFLAG_UNK13);
}
@ -714,8 +714,8 @@ BOOL ScrCmd_775(ScriptContext *ctx) {
u32 objIdA = ScriptGetVar(ctx);
u32 objIdB = ScriptGetVar(ctx);
LocalMapObject *objA = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, objIdA);
LocalMapObject *objB = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, objIdB);
LocalMapObject *objA = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objIdA);
LocalMapObject *objB = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objIdB);
ov02_022469B4(ctx->fieldSystem->taskman, objA, objB);
@ -929,7 +929,7 @@ BOOL ScrCmd_CreatePokeathlonFriendshipRoomStatues(ScriptContext *ctx) {
SavePokeathlonFriendshipRecords *unkPtr = sub_02031B00(fieldSystem->saveData);
for (i = 0; i < 3; i++) {
LocalMapObject *mapObj = GetMapObjectByID(fieldSystem->mapObjectMan, 0xf6 + i);
LocalMapObject *mapObj = GetMapObjectByID(fieldSystem->mapObjectManager, 0xf6 + i);
if (mapObj) {
DeleteMapObject(mapObj);
@ -938,13 +938,13 @@ BOOL ScrCmd_CreatePokeathlonFriendshipRoomStatues(ScriptContext *ctx) {
species = unkPtr->friendshipRoomStatues[i].species;
if (species != SPECIES_NONE && species <= SPECIES_ARCEUS) {
ov01_02201F98(fieldSystem->mapObjectMan, (u8) i, species, unkPtr->friendshipRoomStatues[i].form, unkPtr->friendshipRoomStatues[i].gender, sFriendshipRoomStatuesPositions[i][0], sFriendshipRoomStatuesPositions[i][1], fieldSystem->location->mapId);
ov01_02201F98(fieldSystem->mapObjectManager, (u8) i, species, unkPtr->friendshipRoomStatues[i].form, unkPtr->friendshipRoomStatues[i].gender, sFriendshipRoomStatuesPositions[i][0], sFriendshipRoomStatuesPositions[i][1], fieldSystem->location->mapId);
}
}
return TRUE;
}
static LocalMapObject *ov01_02201F98(MapObjectManager *mapObjectMan, u8 unkA, u16 species, u16 form, u32 gender, u32 x, u32 y, u32 mapId) {
static LocalMapObject *ov01_02201F98(MapObjectManager *mapObjectManager, u8 unkA, u16 species, u16 form, u32 gender, u32 x, u32 y, u32 mapId) {
LocalMapObject *mapObj;
u32 spriteId;
u32 size;
@ -952,7 +952,7 @@ static LocalMapObject *ov01_02201F98(MapObjectManager *mapObjectMan, u8 unkA, u1
spriteId = FollowingPokemon_GetSpriteID(species, form, gender) << 1;
size = GetFollowPokeSizeParamBySpecies(species)*3 + unkA;
mapObj = CreateSpecialFieldObjectEx(mapObjectMan, x, y, DIR_SOUTH, size + 0x19f, 0, mapId, 0, 0, spriteId);
mapObj = CreateSpecialFieldObjectEx(mapObjectManager, x, y, DIR_SOUTH, size + 0x19f, 0, mapId, 0, 0, spriteId);
if (!mapObj) {
GF_AssertFail();
@ -1442,7 +1442,7 @@ BOOL ScrCmd_BugContestAction(ScriptContext *ctx) {
BOOL ScrCmd_BufferBugContestWinner(ScriptContext *ctx) {
MessageFormat **msgfmt;
BUGCONTEST *bugContest;
BugContest *bugContest;
msgfmt = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
bugContest = FieldSystem_BugContest_Get(ctx->fieldSystem);
@ -1453,7 +1453,7 @@ BOOL ScrCmd_BufferBugContestWinner(ScriptContext *ctx) {
}
BOOL ScrCmd_JudgeBugContest(ScriptContext *ctx) {
BUGCONTEST *bugContest;
BugContest *bugContest;
u16 *prize;
u16 *placement;
u16 *species;
@ -1479,7 +1479,7 @@ BOOL ScrCmd_JudgeBugContest(ScriptContext *ctx) {
BOOL ScrCmd_BufferBugContestMonNick(ScriptContext *ctx) {
MessageFormat **msgfmt;
BUGCONTEST *bugContest;
BugContest *bugContest;
u32 script_index;
msgfmt = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
@ -1494,7 +1494,7 @@ BOOL ScrCmd_BufferBugContestMonNick(ScriptContext *ctx) {
BOOL ScrCmd_BugContestGetTimeLeft(ScriptContext *ctx) {
MessageFormat **msgfmt;
BUGCONTEST *bugContest;
BugContest *bugContest;
u32 script_index;
u32 timeLeft;
@ -1515,7 +1515,7 @@ BOOL ScrCmd_BugContestGetTimeLeft(ScriptContext *ctx) {
}
BOOL ScrCmd_IsBugContestantRegistered(ScriptContext *ctx) {
BUGCONTEST *bugContest = FieldSystem_BugContest_Get(ctx->fieldSystem);
BugContest *bugContest = FieldSystem_BugContest_Get(ctx->fieldSystem);
u32 id = ScriptGetVar(ctx);
u16 *ptr = ScriptGetVarPointer(ctx);
*ptr = BugContest_ContestantIsRegistered(bugContest, id);

View File

@ -12,7 +12,7 @@ static void FieldSystemFollowMonClear(FollowMon *followMon);
static void FollowingPoke_SetObjectShinyFlag(LocalMapObject *mapObject, BOOL enable);
static BOOL FollowPokePermissionDiglettCheck(int mapno);
static void FollowingPoke_SetObjectFormParam(LocalMapObject *mapObject, int species, u8 form);
static LocalMapObject *CreateFollowingSpriteFieldObject(MapObjectManager *mapObjectMan, int species, u16 form, int gender, int direction, int x, int y, int shiny);
static LocalMapObject *CreateFollowingSpriteFieldObject(MapObjectManager *mapObjectManager, int species, u16 form, int gender, int direction, int x, int y, int shiny);
static const u16 sModelIndexLUT[] = {
FOLLOWER_MON_NONE,
@ -1503,7 +1503,7 @@ static const u16 sFemaleFlagLUT[] = {
FALSE, // SPECIES_ARCEUS
};
LocalMapObject *sub_020699F8(MapObjectManager *mapObjectMan, int x, int y, int direction, u32 mapno) {
LocalMapObject *sub_020699F8(MapObjectManager *mapObjectManager, int x, int y, int direction, u32 mapno) {
FieldSystem *fieldSystem;
Party *party;
int partyCount;
@ -1514,7 +1514,7 @@ LocalMapObject *sub_020699F8(MapObjectManager *mapObjectMan, int x, int y, int d
int shiny;
int player_unk;
fieldSystem = MapObjectManager_GetFieldSysPtr(mapObjectMan);
fieldSystem = MapObjectManager_GetFieldSysPtr(mapObjectManager);
party = SaveArray_Party_Get(fieldSystem->saveData);
partyCount = Party_GetCount(party);
FieldSystemFollowMonClear(&fieldSystem->followMon);
@ -1531,7 +1531,7 @@ LocalMapObject *sub_020699F8(MapObjectManager *mapObjectMan, int x, int y, int d
form = GetMonData(mon, MON_DATA_FORM, NULL);
gender = GetMonData(mon, MON_DATA_GENDER, NULL);
shiny = MonIsShiny(mon);
fieldSystem->followMon.mapObject = CreateFollowingSpriteFieldObject(mapObjectMan, species, form, gender, direction, x, y, shiny);
fieldSystem->followMon.mapObject = CreateFollowingSpriteFieldObject(mapObjectManager, species, form, gender, direction, x, y, shiny);
fieldSystem->followMon.active = TRUE;
FieldSystem_SetFollowerPokeParam(fieldSystem, species, form, shiny, gender);
FieldSystemUnkSub108_Set(fieldSystem->unk108, mon, species, GetMonData(mon, MON_DATA_PERSONALITY, NULL));
@ -1558,7 +1558,7 @@ LocalMapObject *sub_020699F8(MapObjectManager *mapObjectMan, int x, int y, int d
return fieldSystem->followMon.mapObject;
}
void sub_02069B74(MapObjectManager *mapObjectMan, u32 mapno) {
void sub_02069B74(MapObjectManager *mapObjectManager, u32 mapno) {
FieldSystem *fieldSystem;
Party *party;
int partyCount;
@ -1570,7 +1570,7 @@ void sub_02069B74(MapObjectManager *mapObjectMan, u32 mapno) {
int player_unk;
LocalMapObject *followPokeObj;
fieldSystem = MapObjectManager_GetFieldSysPtr(mapObjectMan);
fieldSystem = MapObjectManager_GetFieldSysPtr(mapObjectManager);
party = SaveArray_Party_Get(fieldSystem->saveData);
partyCount = Party_GetCount(party);
FieldSystemFollowMonClear(&fieldSystem->followMon);
@ -1579,7 +1579,7 @@ void sub_02069B74(MapObjectManager *mapObjectMan, u32 mapno) {
species = GetMonData(mon, MON_DATA_SPECIES, NULL);
FieldSystemUnkSub108_Set(fieldSystem->unk108, mon, species, GetMonData(mon, MON_DATA_PERSONALITY, NULL));
if (GetFollowPokePermissionBySpeciesAndMap(species, mapno)) {
followPokeObj = GetMapObjectByID(fieldSystem->mapObjectMan, obj_partner_poke);
followPokeObj = GetMapObjectByID(fieldSystem->mapObjectManager, obj_partner_poke);
if (followPokeObj == NULL) {
fieldSystem->followMon.unk15 = 1;
} else {
@ -1612,7 +1612,7 @@ void sub_02069B74(MapObjectManager *mapObjectMan, u32 mapno) {
MapObject_ClearFlag18(fieldSystem->followMon.mapObject, FALSE);
}
} else {
followPokeObj = GetMapObjectByID(fieldSystem->mapObjectMan, obj_partner_poke);
followPokeObj = GetMapObjectByID(fieldSystem->mapObjectManager, obj_partner_poke);
if (followPokeObj != NULL) {
form = GetMonData(mon, MON_DATA_FORM, NULL);
gender = GetMonGender(mon);
@ -1904,11 +1904,11 @@ static void FollowingPoke_SetObjectFormParam(LocalMapObject *mapObject, int spec
MapObject_SetParam(mapObject, param, 1);
}
static LocalMapObject *CreateFollowingSpriteFieldObject(MapObjectManager *mapObjectMan, int species, u16 form, int gender, int direction, int x, int y, int shiny) {
static LocalMapObject *CreateFollowingSpriteFieldObject(MapObjectManager *mapObjectManager, int species, u16 form, int gender, int direction, int x, int y, int shiny) {
LocalMapObject *ret;
ret = CreateSpecialFieldObject(
mapObjectMan,
mapObjectManager,
x,
y,
direction,

View File

@ -306,7 +306,7 @@ static BOOL Task_MountOrDismountBicycle(TaskManager *taskManager) {
(*state_p)++;
break;
case 2:
MapObjectManager_UnpauseAllMovement(fieldSystem->mapObjectMan);
MapObjectManager_UnpauseAllMovement(fieldSystem->mapObjectManager);
return TRUE;
}
@ -491,7 +491,7 @@ static BOOL Task_PrintRegisteredKeyItemUseMessage(TaskManager *taskManager) {
switch (env->state) {
case 0:
fieldSystem->unkD2_6 = TRUE;
MapObjectManager_PauseAllMovement(fieldSystem->mapObjectMan);
MapObjectManager_PauseAllMovement(fieldSystem->mapObjectManager);
sub_0205B514(fieldSystem->bgConfig, &env->window, 3);
options = Save_PlayerData_GetOptionsAddr(fieldSystem->saveData);
sub_0205B564(&env->window, options);
@ -508,7 +508,7 @@ static BOOL Task_PrintRegisteredKeyItemUseMessage(TaskManager *taskManager) {
}
break;
case 2:
MapObjectManager_UnpauseAllMovement(fieldSystem->mapObjectMan);
MapObjectManager_UnpauseAllMovement(fieldSystem->mapObjectManager);
RemoveWindow(&env->window);
String_Delete(env->strbuf);
FreeToHeap(env);
@ -661,7 +661,7 @@ static BOOL Task_ActivateDowsingMchnUI(TaskManager *taskManager) {
break;
case 1:
if (ov01_021F6B10(fieldSystem) == TRUE) {
MapObjectManager_UnpauseAllMovement(fieldSystem->mapObjectMan);
MapObjectManager_UnpauseAllMovement(fieldSystem->mapObjectManager);
return TRUE;
}
break;
@ -817,7 +817,7 @@ static BOOL Task_RegisteredItem_GoToApp(TaskManager *taskManager) {
switch (env->state) {
case 0:
MapObjectManager_PauseAllMovement(fieldSystem->mapObjectMan);
MapObjectManager_PauseAllMovement(fieldSystem->mapObjectManager);
ov01_021E636C(0);
env->state = 1;
break;
@ -845,14 +845,14 @@ static BOOL Task_RegisteredItem_GoToApp(TaskManager *taskManager) {
break;
case 4:
if (sub_020505C8(fieldSystem)) {
MapObjectManager_PauseAllMovement(fieldSystem->mapObjectMan);
MapObjectManager_PauseAllMovement(fieldSystem->mapObjectManager);
ov01_021E636C(1);
env->state = 5;
}
break;
case 5:
if (IsPaletteFadeFinished()) {
MapObjectManager_UnpauseAllMovement(fieldSystem->mapObjectMan);
MapObjectManager_UnpauseAllMovement(fieldSystem->mapObjectManager);
FreeToHeap(env);
return TRUE;
}

View File

@ -221,15 +221,15 @@ static void sub_0205316C(FieldSystem *fieldSystem) {
if (fieldSystem->unkAC) {
gender = PlayerProfile_GetTrainerGender(Save_PlayerData_GetProfileAddr(fieldSystem->saveData));
playerSaveData = LocalFieldData_GetPlayer(Save_LocalFieldData_Get(fieldSystem->saveData));
fieldSystem->playerAvatar = sub_0205C390(fieldSystem->mapObjectMan, fieldSystem->location->x, fieldSystem->location->y, fieldSystem->location->direction, playerSaveData->unk4, gender, 2, playerSaveData);
fieldSystem->playerAvatar = sub_0205C390(fieldSystem->mapObjectManager, fieldSystem->location->x, fieldSystem->location->y, fieldSystem->location->direction, playerSaveData->unk4, gender, 2, playerSaveData);
} else {
fieldSystem->mapObjectMan = sub_0205E0BC(fieldSystem, 64, HEAP_ID_BATTLE);
fieldSystem->mapObjectManager = sub_0205E0BC(fieldSystem, 64, HEAP_ID_BATTLE);
gender = PlayerProfile_GetTrainerGender(Save_PlayerData_GetProfileAddr(fieldSystem->saveData));
playerSaveData = LocalFieldData_GetPlayer(Save_LocalFieldData_Get(fieldSystem->saveData));
fieldSystem->playerAvatar = sub_0205C390(fieldSystem->mapObjectMan, fieldSystem->location->x, fieldSystem->location->y, fieldSystem->location->direction, playerSaveData->unk4, gender, 2, playerSaveData);
sub_020699F8(fieldSystem->mapObjectMan, fieldSystem->location->x, fieldSystem->location->y, fieldSystem->location->direction, fieldSystem->location->mapId);
fieldSystem->playerAvatar = sub_0205C390(fieldSystem->mapObjectManager, fieldSystem->location->x, fieldSystem->location->y, fieldSystem->location->direction, playerSaveData->unk4, gender, 2, playerSaveData);
sub_020699F8(fieldSystem->mapObjectManager, fieldSystem->location->x, fieldSystem->location->y, fieldSystem->location->direction, fieldSystem->location->mapId);
Field_InitMapObjectsFromZoneEventData(fieldSystem);
sub_0205F55C(fieldSystem->mapObjectMan);
sub_0205F55C(fieldSystem->mapObjectManager);
}
}
@ -239,8 +239,8 @@ static void sub_02053210(FieldSystem *fieldSystem) {
} else {
sub_02056E38();
PlayerAvatar_FreeToHeap(fieldSystem->playerAvatar);
MapObjectManager_RemoveAllActiveObjects(fieldSystem->mapObjectMan);
MapObjectManager_Delete(fieldSystem->mapObjectMan);
MapObjectManager_RemoveAllActiveObjects(fieldSystem->mapObjectManager);
MapObjectManager_Delete(fieldSystem->mapObjectManager);
}
}
@ -248,13 +248,13 @@ static void sub_0205323C(FieldSystem *fieldSystem) {
u32 gender;
struct PlayerSaveData *playerSaveData;
fieldSystem->mapObjectMan = sub_0205E0BC(fieldSystem, 64, HEAP_ID_BATTLE);
fieldSystem->mapObjectManager = sub_0205E0BC(fieldSystem, 64, HEAP_ID_BATTLE);
FieldSystem_RestoreMapObjectsFromSave(fieldSystem);
playerSaveData = LocalFieldData_GetPlayer(Save_LocalFieldData_Get(fieldSystem->saveData));
gender = PlayerProfile_GetTrainerGender(Save_PlayerData_GetProfileAddr(fieldSystem->saveData));
fieldSystem->playerAvatar = sub_0205C408(fieldSystem->mapObjectMan, playerSaveData, gender);
sub_02069B74(fieldSystem->mapObjectMan, fieldSystem->location->mapId);
sub_0205F55C(fieldSystem->mapObjectMan);
fieldSystem->playerAvatar = sub_0205C408(fieldSystem->mapObjectManager, playerSaveData, gender);
sub_02069B74(fieldSystem->mapObjectManager, fieldSystem->location->mapId);
sub_0205F55C(fieldSystem->mapObjectManager);
}
static void sub_02053284(FieldSystem *fieldSystem) {

View File

@ -35,7 +35,7 @@ void Field_InitMapObjectsFromZoneEventData(FieldSystem *fieldSystem) {
u32 obj_count = fieldSystem->mapEvents->num_object_events;
GF_ASSERT(fieldSystem->mapEvents != NULL);
if (obj_count != 0) {
InitMapObjectsFromEventTemplates(fieldSystem->mapObjectMan, fieldSystem->location->mapId, obj_count, fieldSystem->mapEvents->object_events);
InitMapObjectsFromEventTemplates(fieldSystem->mapObjectManager, fieldSystem->location->mapId, obj_count, fieldSystem->mapEvents->object_events);
}
}

View File

@ -290,10 +290,10 @@ void BufferTrainerClassNameWithArticle(MessageFormat *msgFmt, u32 fieldno, u32 t
}
}
void BufferTrainerClassNameFromDataStruct(MessageFormat *msgFmt, u32 fieldno, TRAINER *trainer) {
void BufferTrainerClassNameFromDataStruct(MessageFormat *msgFmt, u32 fieldno, Trainer *trainer) {
MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0730_bin, msgFmt->heapId);
if (msgData != NULL) {
ReadMsgDataIntoString(msgData, trainer->trainerClass, msgFmt->buffer);
ReadMsgDataIntoString(msgData, trainer->data.trainerClass, msgFmt->buffer);
SetStringAsPlaceholder(msgFmt, fieldno, msgFmt->buffer, NULL);
DestroyMsgData(msgData);
}
@ -317,7 +317,7 @@ void BufferFrontierOpponentName(MessageFormat *msgFmt, u32 fieldno, u32 opponent
}
}
void BufferTrainerNameFromDataStruct(MessageFormat *msgFmt, u32 fieldno, TRAINER *trainer) {
void BufferTrainerNameFromDataStruct(MessageFormat *msgFmt, u32 fieldno, Trainer *trainer) {
CopyU16ArrayToString(msgFmt->buffer, trainer->name);
SetStringAsPlaceholder(msgFmt, fieldno, msgFmt->buffer, NULL);
}
@ -349,7 +349,7 @@ void BufferGenderSymbol(MessageFormat *msgFmt, u32 fieldno, u8 gender) {
DestroyMsgData(msgData);
}
void BufferPCBoxName(MessageFormat *msgFmt, u32 fieldno, PC_STORAGE *pcStorage, u32 boxno) {
void BufferPCBoxName(MessageFormat *msgFmt, u32 fieldno, PCStorage *pcStorage, u32 boxno) {
PCStorage_GetBoxName(pcStorage, boxno, msgFmt->buffer);
SetStringAsPlaceholder(msgFmt, fieldno, msgFmt->buffer, NULL);
}

View File

@ -43,7 +43,7 @@ static LocalMapObject* ov26_02259A24(FieldSystem* fieldSystem, LocalMapObject* a
}
for (int i = 0; i < num_events; i++) {
LocalMapObject* object = GetMapObjectByID(fieldSystem->mapObjectMan, i);
LocalMapObject* object = GetMapObjectByID(fieldSystem->mapObjectManager, i);
if (object == NULL) {
continue;
}

View File

@ -1,6 +1,6 @@
#include <nitro/mi/memory.h>
#include "global.h"
#include "constants/game_stat.h"
#include "constants/game_stats.h"
#include "constants/mail.h"
#include "game_stats.h"
#include "overlay_55.h"

View File

@ -25,17 +25,17 @@ const u16 sBugContestOpponentClasses[] = {
TRAINERCLASS_SCHOOL_KID_M, // Kipp
};
void BugContest_BackUpParty(BUGCONTEST *bugContest);
void BugContest_InitOpponents(BUGCONTEST *bugContest);
void BugContest_InitEncounters(BUGCONTEST *bugContest);
void BugContest_RestoreParty_RetrieveCaughtPokemon(BUGCONTEST *bugContest);
u16 BugContest_JudgePlayerMon(BUGCONTEST *bugContest, Pokemon *mon);
void BugContest_BackUpParty(BugContest *bugContest);
void BugContest_InitOpponents(BugContest *bugContest);
void BugContest_InitEncounters(BugContest *bugContest);
void BugContest_RestoreParty_RetrieveCaughtPokemon(BugContest *bugContest);
u16 BugContest_JudgePlayerMon(BugContest *bugContest, Pokemon *mon);
BUGCONTEST *BugContest_New(FieldSystem *fieldSystem, u32 weekday) {
BUGCONTEST *bugContest;
BugContest *BugContest_New(FieldSystem *fieldSystem, u32 weekday) {
BugContest *bugContest;
bugContest = (BUGCONTEST *)AllocFromHeap(HEAP_ID_3, sizeof(BUGCONTEST));
MI_CpuClear8(bugContest, sizeof(BUGCONTEST));
bugContest = (BugContest *)AllocFromHeap(HEAP_ID_3, sizeof(BugContest));
MI_CpuClear8(bugContest, sizeof(BugContest));
bugContest->heapId = HEAP_ID_3;
bugContest->saveData = fieldSystem->saveData;
bugContest->sport_balls = 20;
@ -49,17 +49,17 @@ BUGCONTEST *BugContest_New(FieldSystem *fieldSystem, u32 weekday) {
return bugContest;
}
void BugContest_Delete(BUGCONTEST *bugContest) {
void BugContest_Delete(BugContest *bugContest) {
BugContest_RestoreParty_RetrieveCaughtPokemon(bugContest);
FreeToHeap(bugContest->mon);
FreeToHeap(bugContest);
}
void BugContest_Judge(BUGCONTEST *bugContest) {
void BugContest_Judge(BugContest *bugContest) {
int i, j, cur_max, score, score2;
u8 temp;
u8 rand;
BUGCONTESTANT *player;
BugContestant *player;
// Judge the player's caught Pokemon
player = &bugContest->contestants[BUGCONTESTANT_PLAYER];
@ -123,8 +123,8 @@ void BugContest_Judge(BUGCONTEST *bugContest) {
}
}
void BugContest_BufferContestWinnerNames(BUGCONTEST *bugContest, MsgData *msgData, MessageFormat *msgFmt, u8 place) {
BUGCONTESTANT *contestant;
void BugContest_BufferContestWinnerNames(BugContest *bugContest, MsgData *msgData, MessageFormat *msgFmt, u8 place) {
BugContestant *contestant;
String *string;
contestant = &bugContest->contestants[bugContest->ranking[place]];
@ -140,7 +140,7 @@ void BugContest_BufferContestWinnerNames(BUGCONTEST *bugContest, MsgData *msgDat
BufferIntegerAsString(msgFmt, 3, contestant->score, 3, PRINTING_MODE_LEFT_ALIGN, 1);
}
BOOL BugContest_ContestantIsRegistered(BUGCONTEST *bugContest, u8 id) {
BOOL BugContest_ContestantIsRegistered(BugContest *bugContest, u8 id) {
int i;
for (i = 0; i < BUGCONTESTANT_NPC_COUNT; i++) {
if (id == bugContest->contestants[i].id) {
@ -150,7 +150,7 @@ BOOL BugContest_ContestantIsRegistered(BUGCONTEST *bugContest, u8 id) {
return FALSE;
}
BOOL BugContest_BufferCaughtMonNick(BUGCONTEST *bugContest, MessageFormat *msgFmt, u8 slot) {
BOOL BugContest_BufferCaughtMonNick(BugContest *bugContest, MessageFormat *msgFmt, u8 slot) {
String *string;
if (!bugContest->caught_poke) {
@ -164,7 +164,7 @@ BOOL BugContest_BufferCaughtMonNick(BUGCONTEST *bugContest, MessageFormat *msgFm
return bugContest->party_cur_num >= PARTY_SIZE;
}
ENC_SLOT *BugContest_GetEncounterSlot(BUGCONTEST *bugContest, HeapID heapId) {
ENC_SLOT *BugContest_GetEncounterSlot(BugContest *bugContest, HeapID heapId) {
ENC_SLOT *slot;
u16 roll;
int i;
@ -184,7 +184,7 @@ ENC_SLOT *BugContest_GetEncounterSlot(BUGCONTEST *bugContest, HeapID heapId) {
return slot;
}
void BugContest_BackUpParty(BUGCONTEST *bugContest) {
void BugContest_BackUpParty(BugContest *bugContest) {
int i;
bugContest->party_bak = SaveArray_Party_Alloc(bugContest->heapId);
bugContest->party_cur = SaveArray_Party_Get(bugContest->saveData);
@ -202,7 +202,7 @@ void BugContest_BackUpParty(BUGCONTEST *bugContest) {
}
}
void BugContest_RestoreParty_RetrieveCaughtPokemon(BUGCONTEST *bugContest) {
void BugContest_RestoreParty_RetrieveCaughtPokemon(BugContest *bugContest) {
Pokemon *mon;
PartyExtraSub sub;
@ -227,7 +227,7 @@ void BugContest_RestoreParty_RetrieveCaughtPokemon(BUGCONTEST *bugContest) {
}
}
BOOL BugContest_ContestantIsRegisteredN(BUGCONTEST *bugContest, u8 id, u8 n) {
BOOL BugContest_ContestantIsRegisteredN(BugContest *bugContest, u8 id, u8 n) {
int i;
for (i = 0; i < n; i++) {
if (id == bugContest->contestants[i].id) {
@ -237,10 +237,10 @@ BOOL BugContest_ContestantIsRegisteredN(BUGCONTEST *bugContest, u8 id, u8 n) {
return FALSE;
}
void BugContest_InitOpponents(BUGCONTEST *bugContest) {
void BugContest_InitOpponents(BugContest *bugContest) {
FSFile file;
u32 flen;
BUGCONTESTANT_BIN *bin, *curbin;
BugContestantData *bin, *curbin;
u8 *idxs;
int i, j, k;
u8 rand;
@ -274,7 +274,7 @@ void BugContest_InitOpponents(BUGCONTEST *bugContest) {
}
idxs[k++] = j;
}
MI_CpuCopy8(&curbin[idxs[LCRandom() % k]], &bugContest->contestants[i].data, sizeof(BUGCONTESTANT_BIN));
MI_CpuCopy8(&curbin[idxs[LCRandom() % k]], &bugContest->contestants[i].data, sizeof(BugContestantData));
score = (LCRandom() % (2 * bugContest->contestants[i].data.randmod)) - bugContest->contestants[i].data.randmod;
bugContest->contestants[i].score = score + bugContest->contestants[i].data.score;
}
@ -283,7 +283,7 @@ void BugContest_InitOpponents(BUGCONTEST *bugContest) {
FS_CloseFile(&file);
}
void BugContest_InitEncounters(BUGCONTEST *bugContest) {
void BugContest_InitEncounters(BugContest *bugContest) {
FSFile file;
u32 flen;
BUGMON *bugmon;
@ -307,7 +307,7 @@ void BugContest_InitEncounters(BUGCONTEST *bugContest) {
FS_CloseFile(&file);
}
u16 BugContest_JudgePlayerMon(BUGCONTEST *bugContest, Pokemon *mon) {
u16 BugContest_JudgePlayerMon(BugContest *bugContest, Pokemon *mon) {
u16 score = 0;
int i;
u16 species;

View File

@ -8,7 +8,7 @@
#include "unk_02054648.h"
#include "metatile_behavior.h"
#include "battle/battle_setup.h"
#include "constants/game_stat.h"
#include "constants/game_stats.h"
#include "constants/battle.h"
#include "arc/ppark.naix"

View File

@ -5,19 +5,19 @@
#include "msgdata/msg.naix"
#include "msgdata/msg/msg_0024.h"
void PCStorage_InitializeBoxes(PC_STORAGE *storage);
BOOL PCStorage_PlaceMonInBoxFirstEmptySlot(PC_STORAGE *storage, u32 boxno, BoxPokemon *boxMon);
void PCStorage_SetBoxModified(PC_STORAGE *storage, u8 boxno);
void PCStorage_InitializeBoxes(PCStorage *storage);
BOOL PCStorage_PlaceMonInBoxFirstEmptySlot(PCStorage *storage, u32 boxno, BoxPokemon *boxMon);
void PCStorage_SetBoxModified(PCStorage *storage, u8 boxno);
void PCStorage_Init(PC_STORAGE *storage) {
void PCStorage_Init(PCStorage *storage) {
PCStorage_InitializeBoxes(storage);
}
u32 PCStorage_sizeof(void) {
return sizeof(PC_STORAGE);
return sizeof(PCStorage);
}
void PCStorage_InitializeBoxes(PC_STORAGE *storage) {
void PCStorage_InitializeBoxes(PCStorage *storage) {
u32 i, j;
MsgData *msgData;
@ -48,7 +48,7 @@ void PCStorage_InitializeBoxes(PC_STORAGE *storage) {
storage->curBox = 0;
}
BOOL PCStorage_PlaceMonInFirstEmptySlotInAnyBox(PC_STORAGE *storage, BoxPokemon *boxMon) {
BOOL PCStorage_PlaceMonInFirstEmptySlotInAnyBox(PCStorage *storage, BoxPokemon *boxMon) {
u32 i = storage->curBox;
do {
RestoreBoxMonPP(boxMon);
@ -64,7 +64,7 @@ BOOL PCStorage_PlaceMonInFirstEmptySlotInAnyBox(PC_STORAGE *storage, BoxPokemon
return FALSE;
}
BOOL PCStorage_PlaceMonInBoxFirstEmptySlot(PC_STORAGE* storage, u32 boxno, BoxPokemon *boxMon) {
BOOL PCStorage_PlaceMonInBoxFirstEmptySlot(PCStorage* storage, u32 boxno, BoxPokemon *boxMon) {
u32 i;
RestoreBoxMonPP(boxMon);
if (boxno == -1u) {
@ -80,7 +80,7 @@ BOOL PCStorage_PlaceMonInBoxFirstEmptySlot(PC_STORAGE* storage, u32 boxno, BoxPo
return FALSE;
}
BOOL PCStorage_PlaceMonInBoxByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slotno, BoxPokemon *boxMon) {
BOOL PCStorage_PlaceMonInBoxByIndexPair(PCStorage* storage, u32 boxno, u32 slotno, BoxPokemon *boxMon) {
RestoreBoxMonPP(boxMon);
if (boxno == -1u) {
boxno = storage->curBox;
@ -94,7 +94,7 @@ BOOL PCStorage_PlaceMonInBoxByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slot
return FALSE;
}
void PCStorage_SwapMonsInBoxByIndexPair(PC_STORAGE* storage, u32 boxno, u32 from, u32 to) {
void PCStorage_SwapMonsInBoxByIndexPair(PCStorage* storage, u32 boxno, u32 from, u32 to) {
BoxPokemon temp;
temp = storage->boxes[boxno].mons[from];
@ -103,7 +103,7 @@ void PCStorage_SwapMonsInBoxByIndexPair(PC_STORAGE* storage, u32 boxno, u32 from
PCStorage_SetBoxModified(storage, boxno);
}
void PCStorage_DeleteBoxMonByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slotno) {
void PCStorage_DeleteBoxMonByIndexPair(PCStorage* storage, u32 boxno, u32 slotno) {
if (boxno == -1u) {
boxno = storage->curBox;
}
@ -116,11 +116,11 @@ void PCStorage_DeleteBoxMonByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slotn
GF_ASSERT(0);
}
int PCStorage_GetActiveBox(PC_STORAGE *storage) {
int PCStorage_GetActiveBox(PCStorage *storage) {
return storage->curBox;
}
int PCStorage_FindFirstBoxWithEmptySlot(PC_STORAGE *storage) {
int PCStorage_FindFirstBoxWithEmptySlot(PCStorage *storage) {
int boxno = storage->curBox;
int i;
@ -138,7 +138,7 @@ int PCStorage_FindFirstBoxWithEmptySlot(PC_STORAGE *storage) {
return NUM_BOXES;
}
BOOL PCStorage_FindFirstEmptySlot(PC_STORAGE* storage, int* boxno_p, int* slotno_p) {
BOOL PCStorage_FindFirstEmptySlot(PCStorage* storage, int* boxno_p, int* slotno_p) {
int i, j;
if (*boxno_p == -1) {
@ -173,7 +173,7 @@ BOOL PCStorage_FindFirstEmptySlot(PC_STORAGE* storage, int* boxno_p, int* slotno
return NUM_BOXES;
}
int PCStorage_CountEmptySpotsInAllBoxes(PC_STORAGE* storage) {
int PCStorage_CountEmptySpotsInAllBoxes(PCStorage* storage) {
int i, j, count = 0;
for (i = 0; i < NUM_BOXES; i++) {
for (j = 0; j < MONS_PER_BOX; j++) {
@ -185,7 +185,7 @@ int PCStorage_CountEmptySpotsInAllBoxes(PC_STORAGE* storage) {
return count;
}
int PCStorage_CountEmptySpotsInBox(PC_STORAGE* storage, u32 boxno) {
int PCStorage_CountEmptySpotsInBox(PCStorage* storage, u32 boxno) {
int i, count;
if (boxno == -1u) {
@ -201,7 +201,7 @@ int PCStorage_CountEmptySpotsInBox(PC_STORAGE* storage, u32 boxno) {
return count;
}
void PCStorage_SetActiveBox(PC_STORAGE* storage, u32 boxno) {
void PCStorage_SetActiveBox(PCStorage* storage, u32 boxno) {
if (boxno < NUM_BOXES) {
storage->curBox = boxno;
return;
@ -209,7 +209,7 @@ void PCStorage_SetActiveBox(PC_STORAGE* storage, u32 boxno) {
GF_ASSERT(0);
}
u8 PCStorage_GetBoxWallpaper(PC_STORAGE* storage, u32 boxno) {
u8 PCStorage_GetBoxWallpaper(PCStorage* storage, u32 boxno) {
if (boxno < NUM_BOXES) {
return storage->wallpapers[boxno];
}
@ -222,7 +222,7 @@ BOOL PCStorage_IsValidWallpaperId(u8 wallpaperno) {
|| (wallpaperno >= BONUS_WALLPAPER_MIN && wallpaperno < BONUS_WALLPAPER_MAX);
}
void PCStorage_SetBoxWallpaper(PC_STORAGE* storage, u32 boxno, u8 wallpaperno) {
void PCStorage_SetBoxWallpaper(PCStorage* storage, u32 boxno, u8 wallpaperno) {
if (boxno == -1u) {
boxno = storage->curBox;
}
@ -233,7 +233,7 @@ void PCStorage_SetBoxWallpaper(PC_STORAGE* storage, u32 boxno, u8 wallpaperno) {
GF_ASSERT(0);
}
void PCStorage_GetBoxName(PC_STORAGE* storage, u32 boxno, String* dest) {
void PCStorage_GetBoxName(PCStorage* storage, u32 boxno, String* dest) {
if (boxno == -1u) {
boxno = storage->curBox;
}
@ -244,7 +244,7 @@ void PCStorage_GetBoxName(PC_STORAGE* storage, u32 boxno, String* dest) {
GF_ASSERT(0);
}
void PCStorage_SetBoxName(PC_STORAGE* storage, u32 boxno, const String* src) {
void PCStorage_SetBoxName(PCStorage* storage, u32 boxno, const String* src) {
if (boxno == -1u) {
boxno = storage->curBox;
}
@ -253,7 +253,7 @@ void PCStorage_SetBoxName(PC_STORAGE* storage, u32 boxno, const String* src) {
}
}
int PCStorage_CountMonsAndEggsInBox(PC_STORAGE* storage, u32 boxno) {
int PCStorage_CountMonsAndEggsInBox(PCStorage* storage, u32 boxno) {
int i, count;
if (boxno == -1u) {
boxno = storage->curBox;
@ -272,7 +272,7 @@ int PCStorage_CountMonsAndEggsInBox(PC_STORAGE* storage, u32 boxno) {
return 0;
}
int PCStorage_CountMonsInBox(PC_STORAGE* storage, u32 boxno) {
int PCStorage_CountMonsInBox(PCStorage* storage, u32 boxno) {
int i, count;
if (boxno == -1u) {
boxno = storage->curBox;
@ -292,7 +292,7 @@ int PCStorage_CountMonsInBox(PC_STORAGE* storage, u32 boxno) {
return 0;
}
int PCStorage_CountMonsInAllBoxes(PC_STORAGE* storage) {
int PCStorage_CountMonsInAllBoxes(PCStorage* storage) {
int count;
u32 i;
@ -302,7 +302,7 @@ int PCStorage_CountMonsInAllBoxes(PC_STORAGE* storage) {
return count;
}
u32 PCStorage_GetMonDataByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slotno, int attr, void *ptr) {
u32 PCStorage_GetMonDataByIndexPair(PCStorage* storage, u32 boxno, u32 slotno, int attr, void *ptr) {
GF_ASSERT(boxno < NUM_BOXES || boxno == -1u);
GF_ASSERT(slotno < MONS_PER_BOX);
if (boxno == -1u) {
@ -311,7 +311,7 @@ u32 PCStorage_GetMonDataByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slotno,
return GetBoxMonData(&storage->boxes[boxno].mons[slotno], attr, ptr);
}
BoxPokemon *PCStorage_GetMonByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slotno) {
BoxPokemon *PCStorage_GetMonByIndexPair(PCStorage* storage, u32 boxno, u32 slotno) {
GF_ASSERT(boxno < NUM_BOXES || boxno == -1u);
GF_ASSERT(slotno < MONS_PER_BOX);
if (boxno == -1u) {
@ -320,17 +320,17 @@ BoxPokemon *PCStorage_GetMonByIndexPair(PC_STORAGE* storage, u32 boxno, u32 slot
return &storage->boxes[boxno].mons[slotno];
}
void PCStorage_UnlockBonusWallpaper(PC_STORAGE* storage, u32 wallpaper) {
void PCStorage_UnlockBonusWallpaper(PCStorage* storage, u32 wallpaper) {
GF_ASSERT(wallpaper < NUM_BONUS_WALLPAPER);
storage->unlockedWallpapers |= (1 << wallpaper);
}
BOOL PCStorage_IsBonusWallpaperUnlocked(PC_STORAGE* storage, u32 wallpaper) {
BOOL PCStorage_IsBonusWallpaperUnlocked(PCStorage* storage, u32 wallpaper) {
GF_ASSERT(wallpaper < NUM_BONUS_WALLPAPER);
return (storage->unlockedWallpapers & (1 << wallpaper)) != 0;
}
void PCStorage_SetBoxModified(PC_STORAGE* storage, u8 boxno) {
void PCStorage_SetBoxModified(PCStorage* storage, u8 boxno) {
if (boxno >= NUM_BOXES) {
GF_ASSERT(0);
return;
@ -338,15 +338,15 @@ void PCStorage_SetBoxModified(PC_STORAGE* storage, u8 boxno) {
storage->boxModifiedFlag |= 1 << boxno;
}
void PCStorage_SetAllBoxesModified(PC_STORAGE* storage) {
void PCStorage_SetAllBoxesModified(PCStorage* storage) {
storage->boxModifiedFlag = BOX_ALL_MODIFIED_FLAG;
}
void PCStorage_ResetBoxModifiedFlags(PC_STORAGE* storage) {
void PCStorage_ResetBoxModifiedFlags(PCStorage* storage) {
storage->boxModifiedFlag = 0;
}
u32 PCStorage_GetBoxModifiedFlags(PC_STORAGE* storage) {
u32 PCStorage_GetBoxModifiedFlags(PCStorage* storage) {
return storage->boxModifiedFlag;
}
@ -354,7 +354,7 @@ u32 sub_02074120(void) {
return sizeof(PC_BOX);
}
void sub_02074128(PC_STORAGE* storage) {
void sub_02074128(PCStorage* storage) {
u8 i, j;
for (i = 0; i < NUM_BOXES; i++) {

View File

@ -262,12 +262,12 @@ const struct SaveChunkHeader gSaveChunkHeaders[] = {
};
const int gNumSaveChunkHeaders = NELEMS(gSaveChunkHeaders);
struct UnkStruct_0202E474 *sub_020270C4(SaveData *saveData) {
struct UnkStruct_0202E474 *sub_020270C4(SaveData *saveData) { //Save_SafariZone_Get? conflicts with other one
SaveSubstruct_AssertCRC(SAVE_UNK_23);
return SaveArray_Get(saveData, SAVE_UNK_23);
}
PC_STORAGE *SaveArray_PCStorage_Get(SaveData *saveData) {
PCStorage *SaveArray_PCStorage_Get(SaveData *saveData) {
return SaveArray_Get(saveData, SAVE_PCSTORAGE);
}
@ -329,21 +329,21 @@ u32 PCStorage_GetNumBoxes(void) {
}
u32 Save_GetPCBoxModifiedFlags(SaveData *saveData) {
PC_STORAGE *pcStorage = SaveArray_Get(saveData, SAVE_PCSTORAGE);
PCStorage *pcStorage = SaveArray_Get(saveData, SAVE_PCSTORAGE);
return PCStorage_GetBoxModifiedFlags(pcStorage);
}
void Save_ResetPCBoxModifiedFlags(SaveData *saveData) {
PC_STORAGE *pcStorage = SaveArray_Get(saveData, SAVE_PCSTORAGE);
PCStorage *pcStorage = SaveArray_Get(saveData, SAVE_PCSTORAGE);
PCStorage_ResetBoxModifiedFlags(pcStorage);
}
void Save_SetAllPCBoxesModified(SaveData *saveData) {
PC_STORAGE *pcStorage = SaveArray_Get(saveData, SAVE_PCSTORAGE);
PCStorage *pcStorage = SaveArray_Get(saveData, SAVE_PCSTORAGE);
PCStorage_SetAllBoxesModified(pcStorage);
}
void sub_020271A0(SaveData *saveData) {
PC_STORAGE *pcStorage = SaveArray_Get(saveData, SAVE_PCSTORAGE);
PCStorage *pcStorage = SaveArray_Get(saveData, SAVE_PCSTORAGE);
sub_02074128(pcStorage);
}

View File

@ -123,7 +123,7 @@ struct SavedMapObjectList *Save_MapObjects_Get(SaveData *saveData) {
void FieldSystem_SyncMapObjectsToSave(FieldSystem *fieldSystem) {
struct SavedMapObjectList *unk = Save_MapObjects_Get(fieldSystem->saveData);
FieldSystem_SyncMapObjectsToSaveEx(fieldSystem, fieldSystem->mapObjectMan, unk->subs, 64);
FieldSystem_SyncMapObjectsToSaveEx(fieldSystem, fieldSystem->mapObjectManager, unk->subs, 64);
}
void FieldSystem_RestoreMapObjectsFromSave(FieldSystem *fieldSystem) {
@ -143,5 +143,5 @@ void FieldSystem_RestoreMapObjectsFromSave(FieldSystem *fieldSystem) {
follower->gfxId = SPRITE_FOLLOWER_MON_SHAYMIN;
}
}
MapObjectManager_RestoreFromSave(fieldSystem->mapObjectMan, unk->subs, 64);
MapObjectManager_RestoreFromSave(fieldSystem->mapObjectManager, unk->subs, 64);
}

View File

@ -54,7 +54,7 @@ BOOL ScrCmd_509(ScriptContext *ctx) {
BOOL ScrCmd_510(ScriptContext *ctx) {
struct MigratedPokemonSav *unkStruct = Save_MigratedPokemon_Get(ctx->fieldSystem->saveData);
PC_STORAGE *storage = SaveArray_PCStorage_Get(ctx->fieldSystem->saveData);
PCStorage *storage = SaveArray_PCStorage_Get(ctx->fieldSystem->saveData);
Pokemon *mon = AllocMonZeroed(HEAP_ID_32);
PlayerProfile *profile = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData);
Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData);

View File

@ -27,7 +27,7 @@
#include "unk_02078E30.h"
#include "unk_02088288.h"
#include "unk_02091564.h"
#include "constants/game_stat.h"
#include "constants/game_stats.h"
typedef enum BattleHallChallengeType {
BATTLE_HALL_CHALLENGE_TYPE_SINGLE,

View File

@ -1182,12 +1182,12 @@ BOOL ScrCmd_563(ScriptContext *ctx) {
LocalMapObject *sub_02041C70(FieldSystem *fieldSystem, u16 person) {
if (person == 0xF2) {
return sub_0205EEB4(fieldSystem->mapObjectMan, 0x30);
return sub_0205EEB4(fieldSystem->mapObjectManager, 0x30);
} else if (person == 0xF1) {
LocalMapObject **attr = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_CAMERA_TARGET);
return *attr;
} else {
return GetMapObjectByID(fieldSystem->mapObjectMan, person);
return GetMapObjectByID(fieldSystem->mapObjectManager, person);
}
}
@ -1250,7 +1250,7 @@ BOOL ScrCmd_LockAll(ScriptContext *ctx) {
p_lastInteracted = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LAST_INTERACTED);
if (*p_lastInteracted == NULL) {
MapObjectManager_PauseAllMovement(fieldSystem->mapObjectMan);
MapObjectManager_PauseAllMovement(fieldSystem->mapObjectManager);
followingPoke = FollowingPokemon_GetMapObject(fieldSystem);
if (FollowingPokemon_IsActive(fieldSystem) && MapObject_IsSingleMovementActive(followingPoke)) {
MapObject_UnpauseMovement(followingPoke);
@ -1304,7 +1304,7 @@ static BOOL _WaitMovementPauseBeforeMsg(ScriptContext *ctx) {
}
if (_CheckMovementPauseWaitFlag(2)) {
unk = sub_0205EEB4(fieldSystem->mapObjectMan, 0x30);
unk = sub_0205EEB4(fieldSystem->mapObjectManager, 0x30);
if (MapObject_IsSingleMovementActive(unk) == FALSE) {
MapObject_PauseMovement(unk);
_ClearMovementPauseWaitFlag(2);
@ -1336,13 +1336,13 @@ BOOL ScrCmd_LockLastTalked(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
LocalMapObject **p_lastInteracted = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LAST_INTERACTED);
LocalMapObject *playerObject = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar);
LocalMapObject *unk = sub_0205EEB4(fieldSystem->mapObjectMan, 0x30);
LocalMapObject *unk = sub_0205EEB4(fieldSystem->mapObjectManager, 0x30);
LocalMapObject *unk2 = sub_020660C0(*p_lastInteracted);
MapObjectManager *mapObjectMan = fieldSystem->mapObjectMan;
MapObjectManager *mapObjectManager = fieldSystem->mapObjectManager;
_ResetMovementPauseWaitFlags();
MapObjectManager_PauseAllMovement(mapObjectMan);
MapObjectManager_PauseAllMovement(mapObjectManager);
if (MapObject_IsMovementPaused(playerObject) == FALSE) {
_SetMovementPauseWaitFlag(1);
@ -1369,14 +1369,14 @@ BOOL ScrCmd_LockLastTalked(ScriptContext *ctx) {
}
BOOL ScrCmd_ReleaseAll(ScriptContext *ctx) {
MapObjectManager_UnpauseAllMovement(ctx->fieldSystem->mapObjectMan);
MapObjectManager_UnpauseAllMovement(ctx->fieldSystem->mapObjectManager);
return TRUE;
}
BOOL ScrCmd_098(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
u16 objectId = ScriptReadHalfword(ctx);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectManager, objectId);
if (object != NULL) {
MapObject_PauseMovement(object);
} else {
@ -1388,7 +1388,7 @@ BOOL ScrCmd_098(ScriptContext *ctx) {
BOOL ScrCmd_099(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
u16 objectId = ScriptReadHalfword(ctx);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectManager, objectId);
if (object != NULL) {
MapObject_UnpauseMovement(object);
} else {
@ -1402,14 +1402,14 @@ BOOL ScrCmd_ShowPerson(ScriptContext *ctx) {
u16 objectId = ScriptGetVar(ctx);
u32 nobjs = Field_GetNumObjectEvents(fieldSystem);
const ObjectEvent *objectEvents = Field_GetObjectEvents(fieldSystem);
GF_ASSERT(CreateMapObjectFromTemplate(fieldSystem->mapObjectMan, objectId, nobjs, fieldSystem->location->mapId, objectEvents));
GF_ASSERT(CreateMapObjectFromTemplate(fieldSystem->mapObjectManager, objectId, nobjs, fieldSystem->location->mapId, objectEvents));
return FALSE;
}
BOOL ScrCmd_HidePerson(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
u16 objectId = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectManager, objectId);
if (object == NULL) {
GF_ASSERT(0);
} else {
@ -1423,7 +1423,7 @@ BOOL ScrCmd_102(ScriptContext *ctx) {
u16 y = ScriptGetVar(ctx);
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_CAMERA_TARGET);
VecFx32 *pos;
*p_cameraObj = CreateSpecialFieldObject(ctx->fieldSystem->mapObjectMan, x, y, 0, SPRITE_CAMERA_FOCUS, 0, ctx->fieldSystem->location->mapId);
*p_cameraObj = CreateSpecialFieldObject(ctx->fieldSystem->mapObjectManager, x, y, 0, SPRITE_CAMERA_FOCUS, 0, ctx->fieldSystem->location->mapId);
sub_02061070(*p_cameraObj);
MapObject_SetVisible(*p_cameraObj, TRUE);
MapObject_ClearFlag18(*p_cameraObj, FALSE);
@ -1437,7 +1437,7 @@ BOOL ScrCmd_103(ScriptContext *ctx) {
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_CAMERA_TARGET);
VecFx32 *pos;
MapObject_Remove(*p_cameraObj);
pos = MapObject_GetPositionVecPtr(GetMapObjectByID(ctx->fieldSystem->mapObjectMan, obj_player));
pos = MapObject_GetPositionVecPtr(GetMapObjectByID(ctx->fieldSystem->mapObjectManager, obj_player));
ov01_021F62E8(pos, ctx->fieldSystem->unk2C);
Camera_SetFixedTarget(pos, ctx->fieldSystem->camera);
return FALSE;
@ -1447,7 +1447,7 @@ BOOL ScrCmd_678(ScriptContext *ctx) {
u16 x = ScriptGetVar(ctx);
u16 y = ScriptGetVar(ctx);
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_CAMERA_TARGET);
*p_cameraObj = CreateSpecialFieldObject(ctx->fieldSystem->mapObjectMan, x, y, 0, SPRITE_CAMERA_FOCUS, 0, ctx->fieldSystem->location->mapId);
*p_cameraObj = CreateSpecialFieldObject(ctx->fieldSystem->mapObjectManager, x, y, 0, SPRITE_CAMERA_FOCUS, 0, ctx->fieldSystem->location->mapId);
sub_02061070(*p_cameraObj);
MapObject_SetVisible(*p_cameraObj, TRUE);
MapObject_ClearFlag18(*p_cameraObj, FALSE);
@ -1513,7 +1513,7 @@ BOOL ScrCmd_GetPlayerCoords(ScriptContext *ctx) {
BOOL ScrCmd_GetPersonCoords(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
u16 personId = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectMan, personId);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectManager, personId);
u16 *p_x = ScriptGetVarPointer(ctx);
u16 *p_y = ScriptGetVarPointer(ctx);
@ -1552,7 +1552,7 @@ BOOL ScrCmd_107(ScriptContext *ctx) {
BOOL ScrCmd_108(ScriptContext *ctx) {
u16 objectId = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objectId);
u8 arg = ScriptReadByte(ctx);
MapObject_SetFlag10(object, arg);
return FALSE;
@ -1560,7 +1560,7 @@ BOOL ScrCmd_108(ScriptContext *ctx) {
BOOL ScrCmd_109(ScriptContext *ctx) {
u16 objectId = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objectId);
u16 arg = ScriptReadHalfword(ctx);
if (object != NULL) {
sub_0205FC94(object, arg);
@ -1572,7 +1572,7 @@ BOOL ScrCmd_574(ScriptContext *ctx) {
u16 *p_dest = ScriptGetVarPointer(ctx);
*p_dest = 0;
u16 objectId = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objectId);
if (object != NULL) {
*p_dest = MapObject_GetMovement(object);
}
@ -2099,7 +2099,7 @@ BOOL ScrCmd_NameRival(ScriptContext *ctx) {
BOOL ScrCmd_NicknameInput(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
u16 partyPos = ScriptGetVar(ctx);
BUGCONTEST *contest;
BugContest *contest;
Pokemon *mon;
u16 nickname[20];
u16 *var_ret;
@ -2466,7 +2466,7 @@ BOOL ScrCmd_229(ScriptContext *ctx) {
BOOL ScrCmd_230(ScriptContext *ctx) {
struct UnkStruct_ScrCmd230 **p_work = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA);
struct UnkStruct_ScrCmd230 *work = *p_work;
sub_02051428(ctx->fieldSystem->taskman, &work->unk_30, 5);
CallTask_020508B8(ctx->fieldSystem->taskman, &work->unk_30, 5);
FreeToHeap(work);
*p_work = NULL;
return TRUE;
@ -2575,14 +2575,14 @@ BOOL ScrCmd_686(ScriptContext *ctx) {
u32 *winFlag = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_BATTLE_WIN_FLAG);
u16 species = ScriptGetVar(ctx);
u16 level = ScriptGetVar(ctx);
sub_02051090(ctx->taskman, species, level, winFlag, TRUE);
SetupAndStartFatefulWildBattle(ctx->taskman, species, level, winFlag, TRUE);
return TRUE;
}
BOOL ScrCmd_250(ScriptContext *ctx) {
u16 species = ScriptGetVar(ctx);
u16 level = ScriptGetVar(ctx);
sub_02051228(ctx->taskman, species, level);
SetupAndStartFirstBattle(ctx->taskman, species, level);
return TRUE;
}
@ -2777,7 +2777,7 @@ BOOL sub_02044318(ScriptContext *ctx) {
}
BOOL ScrCmd_270(ScriptContext *ctx) {
sub_0205B27C(ctx->fieldSystem->mapObjectMan, ctx->fieldSystem->unk84);
sub_0205B27C(ctx->fieldSystem->mapObjectManager, ctx->fieldSystem->unk84);
return FALSE;
}
@ -2978,7 +2978,7 @@ BOOL ScrCmd_MovePersonFacing(ScriptContext *ctx) {
u16 height = ScriptGetVar(ctx);
u16 y = ScriptGetVar(ctx);
u16 direction = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objectId);
sub_0205FC2C(object, x, height, y, direction);
sub_02061070(object);
return FALSE;
@ -3017,7 +3017,7 @@ BOOL ScrCmd_MoveBgEvent(ScriptContext *ctx) {
BOOL ScrCmd_344(ScriptContext *ctx) {
u16 objectId = ScriptGetVar(ctx);
u16 dir = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objectId);
GF_ASSERT(object != NULL);
ov01_021F9408(object, dir);
return FALSE;
@ -3201,7 +3201,7 @@ BOOL ScrCmd_EggHatchAnim(ScriptContext *ctx) {
BOOL ScrCmd_374(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
u16 objId = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectMan, objId);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectManager, objId);
GF_ASSERT(object != NULL);
MapObject_SetVisible(object, FALSE);
return FALSE;
@ -3210,7 +3210,7 @@ BOOL ScrCmd_374(ScriptContext *ctx) {
BOOL ScrCmd_375(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
u16 objId = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectMan, objId);
LocalMapObject *object = GetMapObjectByID(fieldSystem->mapObjectManager, objId);
GF_ASSERT(object != NULL);
MapObject_SetVisible(object, TRUE);
return FALSE;
@ -3575,7 +3575,7 @@ BOOL ScrCmd_PrimoPasswordCheck1(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
PlayerProfile *profile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(fieldSystem));
u16 *p_ret = ScriptGetVarPointer(ctx);
PC_STORAGE *pcStorage = SaveArray_PCStorage_Get(fieldSystem->saveData);
PCStorage *pcStorage = SaveArray_PCStorage_Get(fieldSystem->saveData);
u16 a = ScriptGetVar(ctx);
u16 b = ScriptGetVar(ctx);
u16 c = ScriptGetVar(ctx);
@ -3597,7 +3597,7 @@ BOOL ScrCmd_PrimoPasswordCheck2(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
PlayerProfile *profile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(fieldSystem));
u16 *p_ret = ScriptGetVarPointer(ctx);
PC_STORAGE *pcStorage = SaveArray_PCStorage_Get(fieldSystem->saveData);
PCStorage *pcStorage = SaveArray_PCStorage_Get(fieldSystem->saveData);
u16 a = ScriptGetVar(ctx);
u16 b = ScriptGetVar(ctx);
u16 c = ScriptGetVar(ctx);
@ -3764,7 +3764,7 @@ BOOL ScrCmd_523(ScriptContext *ctx) {
u16 sp8 = ScriptGetVar(ctx);
u16 r6 = ScriptGetVar(ctx);
u16 r4 = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objectId);
GF_ASSERT(object != NULL);
sub_0205BED8(ctx->taskman, object, spC, sp8, r6, r4);
return TRUE;
@ -3774,7 +3774,7 @@ BOOL ScrCmd_524(ScriptContext *ctx) {
u16 objectId = ScriptGetVar(ctx);
u16 r7 = ScriptGetVar(ctx);
u16 r6 = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objectId);
GF_ASSERT(object != NULL);
sub_0205BFB4(ctx->taskman, object, r7, r6);
return TRUE;
@ -4100,7 +4100,7 @@ BOOL ScrCmd_582(ScriptContext *ctx) {
BOOL ScrCmd_583(ScriptContext *ctx) {
u16 objectId = ScriptGetVar(ctx);
u8 r4 = ScriptReadByte(ctx);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objectId);
GF_ASSERT(object != NULL);
MapObject_ClearFlag18(object, r4);
return FALSE;
@ -4287,7 +4287,7 @@ u32 sub_020467A8(SaveData *saveData) {
}
}
PC_STORAGE *pcStorage = SaveArray_PCStorage_Get(saveData);
PCStorage *pcStorage = SaveArray_PCStorage_Get(saveData);
for (i = 0; i < (u32)NUM_BOXES; i++) {
for (j = 0; j < MONS_PER_BOX; j++) {
BoxPokemon *boxMon = PCStorage_GetMonByIndexPair(pcStorage, i, j);
@ -4413,13 +4413,13 @@ BOOL ScrCmd_FollowerPokeIsEventTrigger(ScriptContext *ctx) {
BOOL ScrCmd_596(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
u16 *p_ret = ScriptGetVarPointer(ctx);
*p_ret = ov01_022055DC(GetMapObjectByID(fieldSystem->mapObjectMan, obj_partner_poke));
*p_ret = ov01_022055DC(GetMapObjectByID(fieldSystem->mapObjectManager, obj_partner_poke));
return FALSE;
}
BOOL ScrCmd_597(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
ov01_02203AB4(fieldSystem, GetMapObjectByID(fieldSystem->mapObjectMan, obj_partner_poke), 0);
ov01_02203AB4(fieldSystem, GetMapObjectByID(fieldSystem->mapObjectManager, obj_partner_poke), 0);
return TRUE;
}
@ -4503,7 +4503,7 @@ BOOL ScrCmd_WaitFollowingPokemonMovement(ScriptContext *ctx) {
BOOL ScrCmd_FollowingPokemonMovement(ScriptContext *ctx) {
u16 movement = ScriptReadHalfword(ctx);
if (FollowingPokemon_IsActive(ctx->fieldSystem)) {
sub_0205FC94(GetMapObjectByID(ctx->fieldSystem->mapObjectMan, obj_partner_poke), movement);
sub_0205FC94(GetMapObjectByID(ctx->fieldSystem->mapObjectManager, obj_partner_poke), movement);
}
return TRUE;
}
@ -4521,7 +4521,7 @@ BOOL ScrCmd_605(ScriptContext *ctx) {
u8 r4 = ScriptReadByte(ctx);
if (FollowingPokemon_IsActive(ctx->fieldSystem)) {
LocalMapObject *playerObj = PlayerAvatar_GetMapObject(ctx->fieldSystem->playerAvatar);
LocalMapObject *tsurePokeObj = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, obj_partner_poke);
LocalMapObject *tsurePokeObj = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, obj_partner_poke);
ov01_02205720(playerObj, tsurePokeObj, r6, r4);
}
return FALSE;
@ -4551,7 +4551,7 @@ BOOL ScrCmd_607(ScriptContext *ctx) {
BOOL ScrCmd_608(ScriptContext *ctx) {
if (FollowingPokemon_IsActive(ctx->fieldSystem)) {
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, obj_partner_poke);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, obj_partner_poke);
ov01_02205784(object);
}
return FALSE;
@ -4559,7 +4559,7 @@ BOOL ScrCmd_608(ScriptContext *ctx) {
BOOL ScrCmd_609(ScriptContext *ctx) {
if (FollowingPokemon_IsActive(ctx->fieldSystem)) {
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, obj_partner_poke);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, obj_partner_poke);
sub_020659CC(object);
}
return TRUE;
@ -4778,7 +4778,7 @@ BOOL ScrCmd_621(ScriptContext *ctx) {
BOOL ScrCmd_622(ScriptContext *ctx) {
u16 objectId = ScriptReadHalfword(ctx);
u16 *p_ret = ScriptGetVarPointer(ctx);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectMan, objectId);
LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objectId);
if (object != NULL) {
*p_ret = MapObject_GetFacingDirection(object);
} else {

View File

@ -157,7 +157,7 @@ BOOL ScrCmd_UpdateDaycareMonObjects(ScriptContext* ctx) {
daycare = Save_Daycare_Get(fieldSystem->saveData);
for (s32 dc_mon_idx = 0, y = 5, x = 8; dc_mon_idx < 2; dc_mon_idx++, y += 4, x += 2) {
LocalMapObject* mon_map_object = GetMapObjectByID(fieldSystem->mapObjectMan, obj_daycare_poke_1 + dc_mon_idx);
LocalMapObject* mon_map_object = GetMapObjectByID(fieldSystem->mapObjectManager, obj_daycare_poke_1 + dc_mon_idx);
if (mon_map_object) {
DeleteMapObject(mon_map_object);
}
@ -172,7 +172,7 @@ BOOL ScrCmd_UpdateDaycareMonObjects(ScriptContext* ctx) {
u32 gender = GetBoxMonData(boxMon, MON_DATA_GENDER, NULL);
BOOL shiny = BoxMonIsShiny(boxMon);
CreateDaycareMonSpriteInternal(fieldSystem->mapObjectMan, (u8)dc_mon_idx, species, form, gender, 1, x, y, fieldSystem->location->mapId, shiny);
CreateDaycareMonSpriteInternal(fieldSystem->mapObjectManager, (u8)dc_mon_idx, species, form, gender, 1, x, y, fieldSystem->location->mapId, shiny);
}
return FALSE;

View File

@ -23,7 +23,7 @@ BOOL ScrCmd_LotoIdGet(ScriptContext *ctx) {
BOOL ScrCmd_LotoIdSearch(ScriptContext *ctx) {
FieldSystem *fieldSystem = ctx->fieldSystem;
PC_STORAGE *storage = SaveArray_PCStorage_Get(fieldSystem->saveData);
PCStorage *storage = SaveArray_PCStorage_Get(fieldSystem->saveData);
u16 *retPtr0 = ScriptGetVarPointer(ctx);
u16 *retPtr1 = ScriptGetVarPointer(ctx);
u16 *retPtr2 = ScriptGetVarPointer(ctx);

View File

@ -375,7 +375,7 @@ BOOL ScrCmd_CountAliveMonsAndPC(ScriptContext *ctx) {
int partyCount, count, i;
FieldSystem *fieldSystem = ctx->fieldSystem;
u16 *pokemonCount = ScriptGetVarPointer(ctx);
PC_STORAGE *pc = SaveArray_PCStorage_Get(fieldSystem->saveData);
PCStorage *pc = SaveArray_PCStorage_Get(fieldSystem->saveData);
partyCount = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
for (i = 0, count = 0; i < partyCount; i++) {

View File

@ -179,7 +179,7 @@ BOOL ScrCmd_BufferPartyMonNick(ScriptContext* ctx) {
BOOL ScrCmd_BufferBoxMonNick(ScriptContext* ctx) {
FieldSystem* fieldSystem = ctx->fieldSystem;
PC_STORAGE* pc = SaveArray_PCStorage_Get(fieldSystem->saveData);
PCStorage* pc = SaveArray_PCStorage_Get(fieldSystem->saveData);
MessageFormat** msg_fmt = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
u8 idx = ScriptReadByte(ctx);
u16 box_mon_slot = ScriptGetVar(ctx);

View File

@ -13,7 +13,7 @@
void CreateNPCTrainerParty(BattleSetup *battleSetup, int trainerIndex, HeapID heapId);
void EnemyTrainerSet_Init(BattleSetup *battleSetup, SaveData *saveData, HeapID heapId) {
TRAINER trainer;
Trainer trainer;
MsgData *msgData;
const u16 *rivalName;
int i;
@ -25,7 +25,7 @@ void EnemyTrainerSet_Init(BattleSetup *battleSetup, SaveData *saveData, HeapID h
if (battleSetup->trainerId[i] != 0) {
TrainerData_ReadTrData(battleSetup->trainerId[i], &trainer);
battleSetup->trainer[i] = trainer;
if (trainer.trainerClass == TRAINERCLASS_RIVAL) {
if (trainer.data.trainerClass == TRAINERCLASS_RIVAL) {
CopyU16StringArray(battleSetup->trainer[i].name, rivalName);
} else {
string = NewString_ReadMsgData(msgData, battleSetup->trainerId[i]);
@ -35,38 +35,38 @@ void EnemyTrainerSet_Init(BattleSetup *battleSetup, SaveData *saveData, HeapID h
CreateNPCTrainerParty(battleSetup, i, heapId);
}
}
battleSetup->flags |= trainer.doubleBattle;
battleSetup->flags |= trainer.data.doubleBattle;
DestroyMsgData(msgData);
}
int TrainerData_GetAttr(u32 trainerIndex, TrainerAttr attr) {
TRAINER trainer;
Trainer trainer;
int result;
TrainerData_ReadTrData(trainerIndex, &trainer);
switch (attr) {
case TRATTR_TYPE:
result = trainer.trainerType;
result = trainer.data.trainerType;
break;
case TRATTR_CLASS:
result = trainer.trainerClass;
result = trainer.data.trainerClass;
break;
case TRATTR_UNK2:
result = trainer.unk_2;
result = trainer.data.unk_2;
break;
case TRATTR_NPOKE:
result = trainer.npoke;
result = trainer.data.npoke;
break;
case TRATTR_ITEM1:
case TRATTR_ITEM2:
case TRATTR_ITEM3:
case TRATTR_ITEM4:
result = trainer.items[attr - TRATTR_ITEM1];
result = trainer.data.items[attr - TRATTR_ITEM1];
break;
case TRATTR_AIFLAGS:
result = trainer.ai_flags;
result = trainer.data.aiFlags;
break;
case TRATTR_DOUBLEBTL:
result = trainer.doubleBattle;
result = trainer.data.doubleBattle;
break;
}
return result;
@ -117,7 +117,7 @@ void GetTrainerMessageByIdPair(u32 trainerIndex, u32 msg_id, String * str, HeapI
}
}
void TrainerData_ReadTrData(u32 idx, TRAINER * dest) {
void TrainerData_ReadTrData(u32 idx, Trainer * dest) {
ReadWholeNarcMemberByIdPair(dest, NARC_poketool_trainer_trdata, (s32)idx);
}
@ -285,7 +285,7 @@ void CreateNPCTrainerParty(BattleSetup *enemies, int partyIndex, HeapID heapId)
// gender as its trainer. Otherwise, it will assume the more abundant gender
// according to its species gender ratio. In double battles, the behavior is
// identical to that of a solitary male opponent.
if (TrainerClass_GetGenderOrTrainerCount(enemies->trainer[partyIndex].trainerClass) == TRAINER_FEMALE) {
if (TrainerClass_GetGenderOrTrainerCount(enemies->trainer[partyIndex].data.trainerClass) == TRAINER_FEMALE) {
pidGender = 0x78;
} else {
pidGender = 0x88;
@ -295,13 +295,13 @@ void CreateNPCTrainerParty(BattleSetup *enemies, int partyIndex, HeapID heapId)
// array, with bit 0 being custom moveset and bit 1 being held item.
// Game Freak didn't do it that way, instead using a switch statement and a lot
// of code duplication. This has been the case since the 2nd generation games.
switch (enemies->trainer[partyIndex].trainerType) {
switch (enemies->trainer[partyIndex].data.trainerType) {
case TRTYPE_MON: {
TRPOKE_NOITEM_DFLTMOVES *monSpecies;
u16 species;
u8 form;
monSpecies = &data->species;
for (i = 0; i < enemies->trainer[partyIndex].npoke; i++) {
for (i = 0; i < enemies->trainer[partyIndex].data.npoke; i++) {
// Starting in Platinum, the Pokemon's form was encoded
// in the upper 6 bits of the species.
species = monSpecies[i].species & 0x3FF;
@ -318,7 +318,7 @@ void CreateNPCTrainerParty(BattleSetup *enemies, int partyIndex, HeapID heapId)
// This procedure results in only a 24-bit peersonality value.
personality = monSpecies[i].difficulty + monSpecies[i].level + species + enemies->trainerId[partyIndex];
SetLCRNGSeed(personality);
for (j = 0; j < enemies->trainer[partyIndex].trainerClass; j++) {
for (j = 0; j < enemies->trainer[partyIndex].data.trainerClass; j++) {
personality = LCRandom();
}
personality = (personality << 8) + pidGender;
@ -348,13 +348,13 @@ void CreateNPCTrainerParty(BattleSetup *enemies, int partyIndex, HeapID heapId)
u16 species;
u8 form;
monSpeciesMoves = &data->species_moves;
for (i = 0; i < enemies->trainer[partyIndex].npoke; i++) {
for (i = 0; i < enemies->trainer[partyIndex].data.npoke; i++) {
species = monSpeciesMoves[i].species & 0x3FF;
form = (monSpeciesMoves[i].species & 0xFC00) >> 10;
TrMon_OverridePidGender(species, form, monSpeciesMoves[i].genderAbilityOverride, &pidGender);
personality = monSpeciesMoves[i].difficulty + monSpeciesMoves[i].level + species + enemies->trainerId[partyIndex];
SetLCRNGSeed(personality);
for (j = 0; j < enemies->trainer[partyIndex].trainerClass; j++) {
for (j = 0; j < enemies->trainer[partyIndex].data.trainerClass; j++) {
personality = LCRandom();
}
personality = (personality << 8) + pidGender;
@ -375,13 +375,13 @@ void CreateNPCTrainerParty(BattleSetup *enemies, int partyIndex, HeapID heapId)
u16 species;
u8 form;
monSpeciesItem = &data->species_item;
for (i = 0; i < enemies->trainer[partyIndex].npoke; i++) {
for (i = 0; i < enemies->trainer[partyIndex].data.npoke; i++) {
species = monSpeciesItem[i].species & 0x3FF;
form = (monSpeciesItem[i].species & 0xFC00) >> 10;
TrMon_OverridePidGender(species, form, monSpeciesItem[i].genderAbilityOverride, &pidGender);
personality = monSpeciesItem[i].difficulty + monSpeciesItem[i].level + species + enemies->trainerId[partyIndex];
SetLCRNGSeed(personality);
for (j = 0; j < enemies->trainer[partyIndex].trainerClass; j++) {
for (j = 0; j < enemies->trainer[partyIndex].data.trainerClass; j++) {
personality = LCRandom();
}
personality = (personality << 8) + pidGender;
@ -400,13 +400,13 @@ void CreateNPCTrainerParty(BattleSetup *enemies, int partyIndex, HeapID heapId)
u16 species;
u8 form;
monSpeciesItemMoves = &data->species_item_moves;
for (i = 0; i < enemies->trainer[partyIndex].npoke; i++) {
for (i = 0; i < enemies->trainer[partyIndex].data.npoke; i++) {
species = monSpeciesItemMoves[i].species & 0x3FF;
form = (monSpeciesItemMoves[i].species & 0xFC00) >> 10;
TrMon_OverridePidGender(species, form, monSpeciesItemMoves[i].genderAbilityOverride, &pidGender);
personality = monSpeciesItemMoves[i].difficulty + monSpeciesItemMoves[i].level + species + enemies->trainerId[partyIndex];
SetLCRNGSeed(personality);
for (j = 0; j < enemies->trainer[partyIndex].trainerClass; j++) {
for (j = 0; j < enemies->trainer[partyIndex].data.trainerClass; j++) {
personality = LCRandom();
}
personality = (personality << 8) + pidGender;

View File

@ -26,7 +26,7 @@
#include "unk_02025154.h"
#include "bg_window.h"
#include "constants/sndseq.h"
#include "constants/game_stat.h"
#include "constants/game_stats.h"
#include "msgdata/msg/msg_0039.h"
#include "voltorb_flip/voltorb_flip.h"
#include "voltorb_flip/voltorb_flip_data.h"

BIN
tmp.NCLR

Binary file not shown.