diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/battle.h | 16 | ||||
| -rw-r--r-- | include/battle_anim.h | 20 | ||||
| -rw-r--r-- | include/constants/moves.h | 2 | ||||
| -rw-r--r-- | include/contest.h | 96 | ||||
| -rw-r--r-- | include/contest_link_80C857C.h | 1 | ||||
| -rw-r--r-- | include/data2.h | 2 | ||||
| -rw-r--r-- | include/event_data.h | 6 | ||||
| -rw-r--r-- | include/gba/macro.h | 31 | ||||
| -rw-r--r-- | include/gba/types.h | 11 | ||||
| -rw-r--r-- | include/global.h | 50 | ||||
| -rw-r--r-- | include/graphics.h | 30 | ||||
| -rw-r--r-- | include/item_use.h | 2 | ||||
| -rw-r--r-- | include/learn_move.h | 15 | ||||
| -rw-r--r-- | include/new_game.h | 2 | ||||
| -rw-r--r-- | include/rom_8077ABC.h | 8 | ||||
| -rw-r--r-- | include/sprite.h | 9 | ||||
| -rw-r--r-- | include/tv.h | 1 | ||||
| -rw-r--r-- | include/util.h | 1 | 
18 files changed, 201 insertions, 102 deletions
| diff --git a/include/battle.h b/include/battle.h index 3b37c0853..dda71e562 100644 --- a/include/battle.h +++ b/include/battle.h @@ -3,6 +3,22 @@  #include "sprite.h" +#define F_TARGET_SELECTED_POKEMON 0 +#define F_TARGET_SPECIAL          (1 << 0) +#define F_TARGET_UNK2             (1 << 1) +#define F_TARGET_RANDOM           (1 << 2) +#define F_TARGET_BOTH_ENEMIES     (1 << 3) +#define F_TARGET_USER             (1 << 4) +#define F_TARGET_ALL_EXCEPT_USER  (1 << 5) +#define F_TARGET_ENEMY_SIDE       (1 << 6) + +#define F_MAKES_CONTACT           (1 << 0) +#define F_AFFECTED_BY_PROTECT     (1 << 1) +#define F_AFFECTED_BY_MAGIC_COAT  (1 << 2) +#define F_AFFECTED_BY_SNATCH      (1 << 3) +#define F_MIRROR_MOVE_COMPATIBLE  (1 << 4) +#define F_AFFECTED_BY_KINGS_ROCK  (1 << 5) +  #define BATTLE_TYPE_DOUBLE          0x0001  #define BATTLE_TYPE_LINK            0x0002  #define BATTLE_TYPE_WILD            0x0004 diff --git a/include/battle_anim.h b/include/battle_anim.h index 9598c5e5f..9decb8f95 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -3,19 +3,11 @@  #include "sprite.h" -#define REG_BGnCNT_BITFIELD(n) (*(struct BGCntrlBitfield *)REG_ADDR_BG##n##CNT) +#define REG_BGnCNT_BITFIELD(n) (*(vBgCnt *)REG_ADDR_BG##n##CNT) +#define REG_BG0CNT_BITFIELD REG_BGnCNT_BITFIELD(0)  #define REG_BG1CNT_BITFIELD REG_BGnCNT_BITFIELD(1)  #define REG_BG2CNT_BITFIELD REG_BGnCNT_BITFIELD(2) - -struct BGCntrlBitfield -{ -    volatile u16 priority:2; -    volatile u16 charBaseBlock:2; -    volatile u16 field_0_2:4; -    volatile u16 field_1_0:5; -    volatile u16 areaOverflowMode:1; -    volatile u16 screenSize:2; -}; +#define REG_BG3CNT_BITFIELD REG_BGnCNT_BITFIELD(3)  struct BattleAnimBackground  { @@ -42,6 +34,12 @@ struct UnknownStruct3      u8 filler1[0xB];  }; +extern void (*gAnimScriptCallback)(void); +extern u8 gAnimScriptActive; +extern u8 gHappinessMoveAnim; +extern u8 gUnknown_0202F7C4; + +void ExecuteMoveAnim(u16 move);  void DoMoveAnim(const u8 *const moveAnims[], u16 b, u8 c);  bool8 IsAnimBankSpriteVisible(u8 a);  void sub_8076034(u8, u8); diff --git a/include/constants/moves.h b/include/constants/moves.h index ceec76c13..5fe1da004 100644 --- a/include/constants/moves.h +++ b/include/constants/moves.h @@ -357,4 +357,6 @@  #define MOVE_DOOM_DESIRE 353  #define MOVE_PSYCHO_BOOST 354 +#define NUM_MOVES 355 +  #endif  // GUARD_CONSTANTS_MOVES_H diff --git a/include/contest.h b/include/contest.h index 983f9bc6a..ae2767aef 100644 --- a/include/contest.h +++ b/include/contest.h @@ -1,40 +1,90 @@  #ifndef GUARD_CONTEST_H  #define GUARD_CONTEST_H +enum +{ +    CONTEST_CATEGORY_COOL, +    CONTEST_CATEGORY_BEAUTY, +    CONTEST_CATEGORY_CUTE, +    CONTEST_CATEGORY_SMART, +    CONTEST_CATEGORY_TOUGH, +}; + +enum +{ +    CONTEST_EFFECT_HIGHLY_APPEALING, +    CONTEST_EFFECT_USER_MORE_STARTLED, +    CONTEST_EFFECT_APPEAL_ONLY_ONCE, +    CONTEST_EFFECT_REPEATABLE, +    CONTEST_EFFECT_AVOID_STARTLE_ONCE, +    CONTEST_EFFECT_AVOID_STARTLE, +    CONTEST_EFFECT_AVOID_STARTLE_LITTLE, +    //... +}; + +struct ContestMove +{ +    u8 effect; +    u8 contestCategory:3; +    u8 comboStarterId; +    u8 comboMoves[4]; +}; + +struct ContestEffect +{ +    u8 effectType; +    u8 appeal; +    u8 jam; +}; +  struct ContestPokemon  { - /* 0x00 */ u16 species; - /* 0x02 */ u8 nickname[POKEMON_NAME_LENGTH]; - /* 0x0D */ u8 trainerName[8]; - /* 0x15 */ u8 unk15; - /* 0x16 */ u8 unk16; - /* 0x17 */ u8 filler17[7]; - /* 0x1E */ u16 moves[4]; // moves - /* 0x26 */ u8 cool; // cool - /* 0x27 */ u8 beauty; // beauty - /* 0x28 */ u8 cute; // cute - /* 0x29 */ u8 smart; // smart - /* 0x2A */ u8 tough; // tough - /* 0x2B */ u8 sheen; // sheen - /* 0x2C */ u8 filler2C[12]; - /* 0x38 */ u32 unk38; - /* 0x3C */ u32 unk3C; +    /*0x00*/ u16 species; +    /*0x02*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; +    /*0x0D*/ u8 trainerName[8]; +    /*0x15*/ u8 trainerGfxId; +    /*0x16*/ u8 unk16; +    /*0x17*/ u8 filler17; +    /*0x18*/ u32 flags; +    /*0x1C*/ u8 unk1C_0:2; +             u8 unk1C_2:1; +             u8 unk1C_3:1; +             u8 unk1C_4:1; +             u8 unk1C_5:1; +             u8 unk1C_6:1; +             u8 unk1C_7:1; +             u8 filler1D; +    /*0x1E*/ u16 moves[4]; // moves +    /*0x26*/ u8 cool; // cool +    /*0x27*/ u8 beauty; // beauty +    /*0x28*/ u8 cute; // cute +    /*0x29*/ u8 smart; // smart +    /*0x2A*/ u8 tough; // tough +    /*0x2B*/ u8 sheen; // sheen +    /*0x2C*/ u8 unk2C; +    /*0x2D*/ u8 unk2D[11]; +    /*0x38*/ u32 personality;  // personality +    /*0x3C*/ u32 otId;  // otId  }; // wow  extern struct ContestPokemon gContestMons[]; +extern const struct ContestMove gContestMoves[]; +extern const struct ContestEffect gContestEffects[]; +extern const u8 *const gContestEffectStrings[]; +  void ResetLinkContestBoolean(void);  void sub_80AB2AC(void); -void sub_80AB47C(void); -void sub_80AE098(u8); -void sub_80AE398(u8, u8); +void CB2_StartContest(void); +void Contest_CreatePlayerMon(u8); +void Contest_InitAllPokemon(u8, u8);  u8 sub_80AE47C(struct Pokemon *party); -u32 sub_80AE770(u8, u8); +u16 sub_80AE770(u8, u8);  void sub_80AE82C(u8); -u8 sub_80AEB1C(); +u8 sub_80AEB1C(u16);  void sub_80AF668(void);  void sub_80B0F28(u8); -int sub_80B2A7C(u8);  //Don't know return type size +bool8 Contest_SaveWinner(u8);  u8 sub_80B2C4C(u8, u8); -void sub_80B2D1C(void); +void Contest_ResetWinners(void);  #endif // GUARD_CONTEST_H diff --git a/include/contest_link_80C857C.h b/include/contest_link_80C857C.h index 9135ba2e7..c0f7088b0 100644 --- a/include/contest_link_80C857C.h +++ b/include/contest_link_80C857C.h @@ -3,6 +3,7 @@  void sub_80C8734(u8);  void sub_80C88AC(u8); +void sub_80C89DC(u8);  void sub_80C8E1C(u8);  void sub_80C8EBC(u8);  void sub_80C8F34(u8); diff --git a/include/data2.h b/include/data2.h index 53a90944d..97cb4fd7a 100644 --- a/include/data2.h +++ b/include/data2.h @@ -22,7 +22,7 @@ extern const struct SpriteFrameImage gSpriteImageTable_81E7A70[];  extern const union AffineAnimCmd *const gSpriteAffineAnimTable_81E7B70[];  extern const union AffineAnimCmd *const gSpriteAffineAnimTable_81E7BEC[]; -extern const union AffineAnimCmd *const gSpriteAffineAnimTable_81E7C18; +extern const union AffineAnimCmd *const gSpriteAffineAnimTable_81E7C18[];  extern const union AnimCmd *const gSpriteAnimTable_81E7C64[];  extern struct MonCoords gMonFrontPicCoords[];  extern struct MonCoords gMonBackPicCoords[]; diff --git a/include/event_data.h b/include/event_data.h index 80c6b9478..5656ab8dc 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -37,8 +37,8 @@ extern u16 gSpecialVar_0x8008;  extern u16 gSpecialVar_0x8009;  extern u16 gSpecialVar_0x800A;  extern u16 gSpecialVar_0x800B; -extern u16 gScriptResult; -extern u16 gScriptLastTalked; -extern u16 gScriptFacing; +extern u16 gSpecialVar_Result; +extern u16 gSpecialVar_LastTalked; +extern u16 gSpecialVar_Facing;  #endif // GUARD_EVENT_DATA_H diff --git a/include/gba/macro.h b/include/gba/macro.h index a0edf2a49..d9e6739b3 100644 --- a/include/gba/macro.h +++ b/include/gba/macro.h @@ -104,25 +104,28 @@  }  #define DmaClearLarge(dmaNum, dest, size, block, bit) \ -{                                                         \ -    u32 _size = size;                                     \ -    while (1)                                             \ -    {                                                     \ -        DmaFill##bit(dmaNum, 0, dest, (block));       \ -        dest += (block);                                 \ -        _size -= (block);                                 \ -        if (_size <= (block))                             \ -        {                                                 \ -            DmaFill##bit(dmaNum, 0, dest, _size);     \ -            break;                                        \ -        }                                                 \ -    }                                                     \ +{                                                     \ +	const void *_dest = dest;                         \ +    u32 _size = size;                                 \ +    while (1)                                         \ +    {                                                 \ +        DmaFill##bit(dmaNum, 0, _dest, (block));      \ +        _dest += (block);                             \ +        _size -= (block);                             \ +        if (_size <= (block))                         \ +        {                                             \ +            DmaFill##bit(dmaNum, 0, _dest, _size);    \ +            break;                                    \ +        }                                             \ +    }                                                 \  }  #define DmaCopyLarge16(dmaNum, src, dest, size, block) DmaCopyLarge(dmaNum, src, dest, size, block, 16) -  #define DmaCopyLarge32(dmaNum, src, dest, size, block) DmaCopyLarge(dmaNum, src, dest, size, block, 32) +#define DmaClearLarge16(dmaNum, dest, size, block) DmaClearLarge(dmaNum, dest, size, block, 16) +#define DmaClearLarge32(dmaNum, dest, size, block) DmaClearLarge(dmaNum, dest, size, block, 32) +  #define DmaCopyDefvars(dmaNum, src, dest, size, bit) \  {                                                    \      const void *_src = src;                          \ diff --git a/include/gba/types.h b/include/gba/types.h index 480619d21..33ae7df9a 100644 --- a/include/gba/types.h +++ b/include/gba/types.h @@ -28,6 +28,17 @@ typedef u8  bool8;  typedef u16 bool16;  typedef u32 bool32; +struct BgCnt +{ +    u16 priority:2; +    u16 charBaseBlock:2; +    u16 dummy:4; +    u16 screenBaseBlock:5; +    u16 areaOverflowMode:1; +    u16 screenSize:2; +}; +typedef volatile struct BgCnt vBgCnt; +  struct PlttData  {      u16 r:5; // red diff --git a/include/global.h b/include/global.h index 6670f3837..a4e71852c 100644 --- a/include/global.h +++ b/include/global.h @@ -41,8 +41,8 @@ fndec\  #define POKEMON_NAME_LENGTH 10  #define OT_NAME_LENGTH 7 -#define min(a, b) (a >= b ? a : b) -#define max(a, b) (a <= b ? a : b) +#define min(a, b) ((a) <= (b) ? (a) : (b)) +#define max(a, b) ((a) >= (b) ? (a) : (b))  // why does GF hate 2d arrays  #define MULTI_DIM_ARR(x, dim, y) ((x) * dim + (y)) @@ -50,9 +50,9 @@ fndec\  // dim access enums  enum  { -	B_8 = 1, -	B_16 = 2, -	B_32 = 4 +    B_8 = 1, +    B_16 = 2, +    B_32 = 4  };  // There are many quirks in the source code which have overarching behavioral differences from @@ -230,12 +230,6 @@ struct RamScript      struct RamScriptData data;  }; -struct SB1_2EFC_Struct -{ -    u16 var; -    u8 unknown[0x1E]; -}; -  struct EasyChatPair  {      u16 unk0_0:7; @@ -530,26 +524,6 @@ union MauvilleMan      u8 filler[0x40];  // needed to pad out the struct  }; -struct Unk_SB_Access_Struct1 -{ -    u8 filler0[0xF8]; -    struct SB1_2EFC_Struct sb1_2EFC_struct[5]; -}; - -struct Unk_SB_Access_Struct2 -{ -    /*0x0000*/ struct SB1_2EFC_Struct sb1_2EFC_struct2[12]; // each is 0x20 -    /*0x2F84*/ u8 filler[0x18]; -}; - -/*0x2E04*/ -typedef union SB_Struct -{ -    struct Unk_SB_Access_Struct1 unkSB1; -    struct Unk_SB_Access_Struct2 unkSB2; -} SB_Struct; -// size is 0x198 -  struct UnknownSaveStruct2ABC  {      u8 val0; @@ -632,6 +606,16 @@ struct RecordMixingGift      struct RecordMixingGiftData data;  }; +struct ContestWinner +{ +    /*0x00*/ u32 personality;  // personality +    /*0x04*/ u32 otId;  // otId +    /*0x08*/ u16 species;  // species +    /*0x0A*/ u8 contestCategory; +    /*0x0B*/ u8 nickname[0x16-0xB]; +    /*0x16*/ u8 trainerName[0x20-0x16]; +}; +  // there should be enough flags for all 412 slots  // each slot takes up 8 flags  // if the value is not divisible by 8, we need to account for the reminder as well @@ -710,8 +694,8 @@ struct SaveBlock1 /* 0x02025734 */      /*0x2D90*/ u8 filler_2D90[0x4];      /*0x2D94*/ union MauvilleMan mauvilleMan;      /*0x2DD4*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff -    /*0x2DFC*/ u8 filler_2DFC[0x8]; -    /*0x2E04*/ SB_Struct sbStruct; +    /*0x2DFC*/ struct ContestWinner contestWinners[8]; +    /*0x2EFC*/ struct ContestWinner museumPortraits[5];      /*0x2F9C*/ struct DayCare daycare;      /*0x30B8*/ struct LinkBattleRecord linkBattleRecords[5];      /*0x3108*/ u8 filler_3108[8]; diff --git a/include/graphics.h b/include/graphics.h index 07ee1f76c..488de07c0 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -28,8 +28,38 @@ extern const u8 gInterfaceGfx_PremierBall[];  extern const u8 gInterfacePal_PremierBall[];  extern const u8 gUnknown_08D030D0[]; +extern const u8 gUnknown_08D17144[]; +extern const u8 gUnknown_08D1725C[]; +extern const u8 gUnknown_08D17424[]; +extern const u8 gUnknown_08D17C3C[]; +extern const u8 gContestMiscGfx[]; +extern const u8 gContestAudienceGfx[]; +extern const u8 gContestJudgeSymbolsGfx[]; +extern const u8 gContest3Pal[]; +extern const u8 gTiles_8D1975C[]; +extern const u8 gUnknown_08D1977C[]; +extern const u8 gUnknown_08D1A250[]; +extern const u8 gUnknown_08D1A364[]; +extern const u8 gUnknown_08D1A490[]; +extern const u8 gUnknown_08D1A618[]; + +extern const u8 gContestJudgeGfx[]; +extern const u8 gContest2Pal[]; +  extern const u8 gMonFootprint_QuestionMark[]; +extern const u8 gContestNextTurnGfx[]; +extern const u8 gContestNextTurnNumbersGfx[]; +extern const u8 gContestNextTurnRandomGfx[]; +extern const u8 gBattleAnimSpriteSheet_264[]; +extern const u8 gBattleAnimSpritePalette_264[]; +extern const u8 gBattleAnimSpritePalette_265[]; +extern const u8 gBattleAnimSpritePalette_067[]; +extern const u8 gBattleAnimSpritePalette_068[]; +extern const u8 gContestApplauseGfx[]; +extern const u8 gContestApplauseMeterGfx[]; +extern const u16 gContestPal[]; +  // data/graphics/pokemon/graphics.inc  extern const u8 gMonFrontPic_Bulbasaur[];  extern const u8 gMonPalette_Bulbasaur[]; diff --git a/include/item_use.h b/include/item_use.h index 227c0c9ee..ee7939824 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -1,7 +1,7 @@  #ifndef GUARD_ITEM_USE_H  #define GUARD_ITEM_USE_H -extern u16 gScriptItemId; +extern u16 gSpecialVar_ItemId;  void ItemUseOutOfBattle_Mail(u8);  void ItemUseOutOfBattle_Bike(u8); diff --git a/include/learn_move.h b/include/learn_move.h index 7a05ea60b..85fbf046e 100644 --- a/include/learn_move.h +++ b/include/learn_move.h @@ -1,21 +1,6 @@  #ifndef GUARD_LEARN_MOVE_H  #define GUARD_LEARN_MOVE_H -struct ContestMove -{ -    u8 effect; -    u8 contestCategory:3; -    u8 comboStarterId; -    u8 comboMoves[4]; -}; - -struct ContestEffect -{ -    u8 effectType; -    u8 appeal; -    u8 jam; -}; -  void sub_8132670(void);  #endif // GUARD_LEARN_MOVE_H diff --git a/include/new_game.h b/include/new_game.h index f59154af4..5be7f6265 100644 --- a/include/new_game.h +++ b/include/new_game.h @@ -6,7 +6,7 @@ void copy_word_to_mem(u8 *copyTo, u8 *copyFrom);  void InitPlayerTrainerId(void);  void SetDefaultOptions(void);  void ClearPokedexFlags(void); -void sub_8052DA8(void); +void ResetContestAndMuseumWinners(void);  void sub_8052DE4(void);  void WarpToTruck(void);  void ClearSav2(void); diff --git a/include/rom_8077ABC.h b/include/rom_8077ABC.h index 2a2947968..70bd6fe5a 100644 --- a/include/rom_8077ABC.h +++ b/include/rom_8077ABC.h @@ -12,6 +12,12 @@ enum      ANIM_BANK_DEF_PARTNER  }; +struct Struct_sub_8078914 { +    u8 *field_0; +    u8 *field_4; +    u8 field_8; +}; +  u8 sub_8077ABC(u8, u8);  u8 sub_8077E44(u8 slot, u16 species, u8 a3);  u8 GetAnimBankSpriteId(u8 side); @@ -99,5 +105,7 @@ u8 sub_8077FC0(u8 slot);  void move_anim_8074EE0(struct Sprite *sprite);  bool8 sub_8078718(struct Sprite *sprite);  bool8 sub_8078CE8(struct Sprite *sprite); +void oamt_add_pos2_onto_pos1(struct Sprite *sprite); +void sub_8078BD4(struct Sprite *sprite);  #endif // GUARD_ROM_8077ABC_H diff --git a/include/sprite.h b/include/sprite.h index a87260ec0..9937a0797 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -222,12 +222,21 @@ struct Sprite      /*0x43*/ u8 subpriority;  }; +struct OamMatrix +{ +    s16 a; +    s16 b; +    s16 c; +    s16 d; +}; +  extern const struct OamData gDummyOamData;  extern const union AnimCmd *const gDummySpriteAnimTable[];  extern const union AffineAnimCmd *const gDummySpriteAffineAnimTable[];  extern s16 gSpriteCoordOffsetX;  extern s16 gSpriteCoordOffsetY; +extern u8 gReservedSpritePaletteCount;  extern struct Sprite gSprites[]; diff --git a/include/tv.h b/include/tv.h index 0f355043c..c2158ece0 100644 --- a/include/tv.h +++ b/include/tv.h @@ -26,6 +26,7 @@ void sub_80BE138(TVShow *show);  void sub_80BE160(TVShow *show);  void sub_80BE160(TVShow *);  void sub_80BE188(void); +void sub_80BE23C(u16);  void sub_80BE320(void);  void StartMassOutbreak(void);  void sub_80BE5FC(void); diff --git a/include/util.h b/include/util.h index 87fa4aecc..676c3bd9b 100644 --- a/include/util.h +++ b/include/util.h @@ -11,5 +11,6 @@ void StoreWordInTwoHalfwords(u16 *, u32);  void LoadWordFromTwoHalfwords(u16 *, u32 *);  u16 CalcCRC16(u8 *data, int length);  void DoBgAffineSet(struct BgAffineDstData *dest, u32 texX, u32 texY, s16 scrX, s16 scrY, s16 sx, s16 sy, u16 alpha); +void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output);  #endif // GUARD_UTIL_H | 
