summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/battle.h17
-rw-r--r--include/battle_util.h2
-rw-r--r--include/constants/map_scripts.h4
-rw-r--r--include/constants/pokemon.h6
-rw-r--r--include/constants/trainers.h3
-rw-r--r--include/data.h4
-rw-r--r--include/pokemon.h55
7 files changed, 52 insertions, 39 deletions
diff --git a/include/battle.h b/include/battle.h
index 14ecfbdd3..e32e621cc 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -37,8 +37,6 @@
#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
#define B_ACTION_NONE 0xFF
-#define MAX_TRAINER_ITEMS 4
-
// array entries for battle communication
#define MULTIUSE_STATE 0
#define CURSOR_POSITION 1
@@ -594,16 +592,15 @@ struct BattleSpriteData
struct MonSpritesGfx
{
void* firstDecompressed; // ptr to the decompressed sprite of the first pokemon
- union
- {
- void* ptr[4];
- u8* byte[4];
+ union {
+ void* ptr[MAX_BATTLERS_COUNT];
+ u8* byte[MAX_BATTLERS_COUNT];
} sprites;
- struct SpriteTemplate templates[4];
- struct SpriteFrameImage field_74[4][4];
- u8 field_F4[0x80];
+ struct SpriteTemplate templates[MAX_BATTLERS_COUNT];
+ struct SpriteFrameImage frameImages[MAX_BATTLERS_COUNT][4];
+ u8 unusedArr[0x80];
u8 *barFontGfx;
- void *field_178;
+ void *unusedPtr;
u16 *buffer;
};
diff --git a/include/battle_util.h b/include/battle_util.h
index e4ef99e0b..d4e2a23f8 100644
--- a/include/battle_util.h
+++ b/include/battle_util.h
@@ -28,6 +28,8 @@
#define ABILITYEFFECT_COUNT_BATTLER_SIDE 0x11
#define ABILITYEFFECT_COUNT_ON_FIELD 0x12
#define ABILITYEFFECT_CHECK_ON_FIELD 0x13
+#define ABILITYEFFECT_MUD_SPORT 0xFD
+#define ABILITYEFFECT_WATER_SPORT 0xFE
#define ABILITYEFFECT_SWITCH_IN_WEATHER 0xFF
#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0))
diff --git a/include/constants/map_scripts.h b/include/constants/map_scripts.h
index 7a56cc908..c89df3948 100644
--- a/include/constants/map_scripts.h
+++ b/include/constants/map_scripts.h
@@ -13,14 +13,14 @@
Almost exclusively used to set metatiles on the map before it's first drawn
6. ON_FRAME_TABLE: Run every frame after the map has faded in, before player input is processed.
- This is a table of scripts that each run if their condition is satisfied.
+ This is a table of scripts; only the first script whose condition is satisfied is run.
Used to trigger an event, such as the player exiting the cable car or the SS Tidal sailor announcing progress
2. ON_TRANSITION: Run during the transition to the map
Used to set map-specific flags/vars, update object positions/movement types, set weather, etc
5. ON_WARP_INTO_MAP_TABLE: Run after the map's objects are loaded.
- This is a table of scripts that each run if their condition is satisfied.
+ This is a table of scripts; only the first script whose condition is satisfied is run.
Used to add objects to the scene or update something about the player as they warp in (e.g. their facing dir or visibility)
Note that ON_TRANSITION may also handle object visibility, but would do so by modifying a flag or var
diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h
index 9bafa0a0b..827725fc2 100644
--- a/include/constants/pokemon.h
+++ b/include/constants/pokemon.h
@@ -339,4 +339,10 @@
#define MON_PIC_SIZE (64 * 64 / 2)
+#define BATTLE_ALIVE_EXCEPT_ACTIVE 0
+#define BATTLE_ALIVE_ATK_SIDE 1
+#define BATTLE_ALIVE_DEF_SIDE 2
+
+#define SKIP_FRONT_ANIM (1 << 7)
+
#endif // GUARD_CONSTANTS_POKEMON_H
diff --git a/include/constants/trainers.h b/include/constants/trainers.h
index 3f22c7cef..31bad25df 100644
--- a/include/constants/trainers.h
+++ b/include/constants/trainers.h
@@ -110,6 +110,7 @@
#define TRAINER_PIC_RS_BRENDAN 91
#define TRAINER_PIC_RS_MAY 92
+// The player back pics are assumed to alternate according to the gender values (MALE/FEMALE)
#define TRAINER_BACK_PIC_BRENDAN 0
#define TRAINER_BACK_PIC_MAY 1
#define TRAINER_BACK_PIC_RED 2
@@ -334,7 +335,7 @@
#define TRAINER_CLASS_SAILOR 0x2f
#define TRAINER_CLASS_COOLTRAINER_2 0x30 // Used for only one trainer.
#define TRAINER_CLASS_MAGMA_ADMIN 0x31
-#define TRAINER_CLASS_PKMN_TRAINER_3 0x32
+#define TRAINER_CLASS_RIVAL 0x32
#define TRAINER_CLASS_BUG_CATCHER 0x33
#define TRAINER_CLASS_PKMN_RANGER 0x34
#define TRAINER_CLASS_MAGMA_LEADER 0x35
diff --git a/include/data.h b/include/data.h
index f94f55a8f..374435cba 100644
--- a/include/data.h
+++ b/include/data.h
@@ -5,6 +5,8 @@
#define SPECIES_SHINY_TAG 500
+#define MAX_TRAINER_ITEMS 4
+
enum {
BATTLER_AFFINE_NORMAL,
BATTLER_AFFINE_EMERGE,
@@ -66,7 +68,7 @@ struct Trainer
/*0x02*/ u8 encounterMusic_gender; // last bit is gender
/*0x03*/ u8 trainerPic;
/*0x04*/ u8 trainerName[12];
- /*0x10*/ u16 items[4];
+ /*0x10*/ u16 items[MAX_TRAINER_ITEMS];
/*0x18*/ bool8 doubleBattle;
/*0x1C*/ u32 aiFlags;
/*0x20*/ u8 partySize;
diff --git a/include/pokemon.h b/include/pokemon.h
index 3565bd966..229898d71 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -122,20 +122,32 @@ struct Pokemon
u16 spDefense;
};
-struct Unknown_806F160_Struct
+struct MonSpritesGfxManager
{
- u32 field_0_0:4;
- u32 field_0_1:4;
- u32 field_1:8;
- u16 magic:8;
- u32 field_3_0:4;
- u32 field_3_1:4;
- void *bytes;
- u8 **byteArrays;
+ u32 numSprites:4;
+ u32 numSprites2:4; // Never read
+ u32 numFrames:8;
+ u32 active:8;
+ u32 dataSize:4;
+ u32 mode:4; // MON_SPR_GFX_MODE_*
+ void *spriteBuffer;
+ u8 **spritePointers;
struct SpriteTemplate *templates;
struct SpriteFrameImage *frameImages;
};
+enum {
+ MON_SPR_GFX_MODE_NORMAL,
+ MON_SPR_GFX_MODE_BATTLE,
+ MON_SPR_GFX_MODE_FULL_PARTY,
+};
+
+enum {
+ MON_SPR_GFX_MANAGER_A,
+ MON_SPR_GFX_MANAGER_B, // Nothing ever sets up this manager.
+ MON_SPR_GFX_MANAGERS_COUNT
+};
+
struct BattlePokemon
{
/*0x00*/ u16 species;
@@ -247,6 +259,8 @@ struct Evolution
| (((personality) & 0x00000003) >> 0) \
) % NUM_UNOWN_FORMS)
+#define GET_SHINY_VALUE(otId, personality)HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality)
+
extern u8 gPlayerPartyCount;
extern struct Pokemon gPlayerParty[PARTY_SIZE];
extern u8 gEnemyPartyCount;
@@ -261,8 +275,8 @@ extern const u8 *const gItemEffectTable[];
extern const u32 gExperienceTables[][MAX_LEVEL + 1];
extern const u16 *const gLevelUpLearnsets[];
extern const u8 gPPUpGetMask[];
-extern const u8 gPPUpSetMask[];
-extern const u8 gPPUpAddMask[];
+extern const u8 gPPUpClearMask[];
+extern const u8 gPPUpAddValues[];
extern const u8 gStatStageRatios[MAX_STAT_STAGE + 1][2];
extern const u16 gLinkPlayerFacilityClasses[];
extern const struct SpriteTemplate gBattlerSpriteTemplates[];
@@ -281,7 +295,7 @@ void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32
void CreateMonWithIVsOTID(struct Pokemon *mon, u16 species, u8 level, u8 *ivs, u32 otId);
void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 evSpread);
void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src);
-void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50);
+void CreateBattleTowerMon_HandleLevel(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50);
void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId);
void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId);
void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest);
@@ -305,12 +319,7 @@ u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove);
void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move);
void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 bankAtk, u8 bankDef);
-
u8 CountAliveMonsInBattle(u8 caseId);
-#define BATTLE_ALIVE_EXCEPT_ACTIVE 0
-#define BATTLE_ALIVE_ATK_SIDE 1
-#define BATTLE_ALIVE_DEF_SIDE 2
-
u8 GetDefaultMoveTarget(u8 battlerId);
u8 GetMonGender(struct Pokemon *mon);
u8 GetBoxMonGender(struct BoxPokemon *boxMon);
@@ -330,7 +339,6 @@ void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg);
void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg);
void CopyMon(void *dest, void *src, size_t size);
u8 GiveMonToPlayer(struct Pokemon *mon);
-u8 SendMonToPC(struct Pokemon* mon);
u8 CalculatePlayerPartyCount(void);
u8 CalculateEnemyPartyCount(void);
u8 GetMonsStateToDoubles(void);
@@ -362,7 +370,6 @@ u16 SpeciesToNationalPokedexNum(u16 species);
u16 SpeciesToHoennPokedexNum(u16 species);
u16 HoennToNationalOrder(u16 hoennNum);
u16 SpeciesToCryId(u16 species);
-void sub_806D544(u16 species, u32 personality, u8 *dest);
void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, u8 a4);
void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies);
u8 GetPlayerFlankId(void);
@@ -413,17 +420,15 @@ void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry,
void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneFrame);
void StopPokemonAnimationDelayTask(void);
void BattleAnimateBackSprite(struct Sprite* sprite, u16 species);
-u8 sub_806EF08(u8 arg0);
-u8 sub_806EF84(u8 arg0, u8 arg1);
-u16 sub_806EFF0(u16 arg0);
+u8 GetOpposingLinkMultiBattlerId(bool8 rightSide, u8 multiplayerId);
u16 FacilityClassToPicIndex(u16 facilityClass);
u16 PlayerGenderToFrontTrainerPicId(u8 playerGender);
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
const u8 *GetTrainerClassNameFromId(u16 trainerId);
const u8 *GetTrainerNameFromId(u16 trainerId);
bool8 HasTwoFramesAnimation(u16 species);
-struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1);
-void sub_806F47C(u8 id);
-u8 *sub_806F4F8(u8 id, u8 arg1);
+struct MonSpritesGfxManager *CreateMonSpritesGfxManager(u8 managerId, u8 mode);
+void DestroyMonSpritesGfxManager(u8 managerId);
+u8 *MonSpritesGfxManager_GetSpritePtr(u8 managerId, u8 spriteNum);
#endif // GUARD_POKEMON_H