diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2021-03-29 20:56:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-29 20:56:15 -0400 |
commit | 50e9666e1637b15bd57fd7ee88180e50d2eb5e8c (patch) | |
tree | b1543b6d79695862cb60d686548dd1a996b69e8c /include | |
parent | dea07dc8656c8fb32f5b389b9f4f9a30fe26e555 (diff) | |
parent | e8b6b4b65e3b53f5fcf83035b9f848c5ef6378bd (diff) |
Merge branch 'master' into doc-introcred
Diffstat (limited to 'include')
-rw-r--r-- | include/battle.h | 18 | ||||
-rw-r--r-- | include/berry.h | 8 | ||||
-rwxr-xr-x | include/berry_crush.h | 2 | ||||
-rw-r--r-- | include/constants/battle_pike.h | 4 | ||||
-rw-r--r-- | include/constants/game_stat.h | 2 | ||||
-rw-r--r-- | include/constants/hold_effects.h | 2 | ||||
-rw-r--r-- | include/constants/vars.h | 2 | ||||
-rw-r--r-- | include/dodrio_berry_picking.h | 2 | ||||
-rw-r--r-- | include/global.h | 10 | ||||
-rw-r--r-- | include/graphics.h | 6 | ||||
-rw-r--r-- | include/link.h | 31 | ||||
-rw-r--r-- | include/link_rfu.h | 2 | ||||
-rw-r--r-- | include/main.h | 2 | ||||
-rw-r--r-- | include/overworld.h | 8 | ||||
-rw-r--r-- | include/recorded_battle.h | 6 | ||||
-rw-r--r-- | include/sound.h | 21 | ||||
-rw-r--r-- | include/strings.h | 2 | ||||
-rw-r--r-- | include/trainer_hill.h | 1 |
18 files changed, 83 insertions, 46 deletions
diff --git a/include/battle.h b/include/battle.h index c0baaf313..954d33b07 100644 --- a/include/battle.h +++ b/include/battle.h @@ -344,6 +344,15 @@ struct BattleTvMovePoints s16 points[2][PARTY_SIZE * 4]; }; +struct LinkBattlerHeader +{ + u8 versionSignatureLo; + u8 versionSignatureHi; + u8 vsScreenHealthFlagsLo; + u8 vsScreenHealthFlagsHi; + struct BattleEnigmaBerry battleEnigmaBerry; +}; + struct BattleStruct { u8 turnEffectsTracker; @@ -419,11 +428,10 @@ struct BattleStruct u8 givenExpMons; // Bits for enemy party's pokemon that gave exp to player's party. u8 lastTakenMoveFrom[MAX_BATTLERS_COUNT * MAX_BATTLERS_COUNT * 2]; // a 3-D array [target][attacker][byte] u16 castformPalette[MAX_BATTLERS_COUNT][16]; - u8 field_180; // weird field, used in battle_main.c, once accessed as an array of u32 overwriting the field below - u8 field_181; - u8 vsScreenHealthFlagsLo; - u8 vsScreenHealthFlagsHi; // Last bit is 'has frontier pass' - struct BattleEnigmaBerry battleEnigmaBerry; + union { + struct LinkBattlerHeader linkBattlerHeader; + u32 battleVideo[2]; + } multiBuffer; u8 wishPerishSongState; u8 wishPerishSongBattlerId; bool8 overworldWeatherDone; diff --git a/include/berry.h b/include/berry.h index 4a5a46615..22b9158ee 100644 --- a/include/berry.h +++ b/include/berry.h @@ -28,11 +28,11 @@ void SetBerryTreesSeen(void); extern const struct Berry gBerries[]; -struct UnkStruct_0858AB24 { - u8 unk0; - u16 unk1; +struct BerryCrushBerryData { + u8 difficulty; // The number of A presses required to crush it + u16 powder; }; -extern const struct UnkStruct_0858AB24 gUnknown_0858AB24[]; +extern const struct BerryCrushBerryData gBerryCrush_BerryData[]; #endif // GUARD_BERRY_H diff --git a/include/berry_crush.h b/include/berry_crush.h index a08f1f699..02dcce506 100755 --- a/include/berry_crush.h +++ b/include/berry_crush.h @@ -3,6 +3,6 @@ #include "main.h" -void StartBerryCrush(MainCallback callback); +void StartBerryCrush(MainCallback exitCallback); #endif // GUARD_BERRY_CRUSH_H diff --git a/include/constants/battle_pike.h b/include/constants/battle_pike.h index 9187ae28c..76309436e 100644 --- a/include/constants/battle_pike.h +++ b/include/constants/battle_pike.h @@ -42,8 +42,8 @@ #define BATTLE_PIKE_FUNC_SET_IN_WILD_MON_ROOM 6 #define BATTLE_PIKE_FUNC_CLEAR_IN_WILD_MON_ROOM 7 #define BATTLE_PIKE_FUNC_SAVE 8 -#define BATTLE_PIKE_FUNC_NULL_9 9 -#define BATTLE_PIKE_FUNC_NULL_10 10 +#define BATTLE_PIKE_FUNC_DUMMY_1 9 +#define BATTLE_PIKE_FUNC_DUMMY_2 10 #define BATTLE_PIKE_FUNC_GET_ROOM_STATUS 11 #define BATTLE_PIKE_FUNC_GET_ROOM_STATUS_MON 12 #define BATTLE_PIKE_FUNC_HEAL_ONE_TWO_MONS 13 diff --git a/include/constants/game_stat.h b/include/constants/game_stat.h index e302f1345..2acdfd8a3 100644 --- a/include/constants/game_stat.h +++ b/include/constants/game_stat.h @@ -52,7 +52,7 @@ #define GAME_STAT_RODE_CABLE_CAR 48 #define GAME_STAT_ENTERED_HOT_SPRINGS 49 #define GAME_STAT_NUM_UNION_ROOM_BATTLES 50 -#define GAME_STAT_51 51 +#define GAME_STAT_PLAYED_BERRY_CRUSH 51 #define NUM_USED_GAME_STATS 52 #define NUM_GAME_STATS 64 diff --git a/include/constants/hold_effects.h b/include/constants/hold_effects.h index b653f5a92..5853f1708 100644 --- a/include/constants/hold_effects.h +++ b/include/constants/hold_effects.h @@ -28,7 +28,7 @@ #define HOLD_EFFECT_MACHO_BRACE 24 #define HOLD_EFFECT_EXP_SHARE 25 #define HOLD_EFFECT_QUICK_CLAW 26 -#define HOLD_EFFECT_HAPPINESS_UP 27 +#define HOLD_EFFECT_FRIENDSHIP_UP 27 #define HOLD_EFFECT_CURE_ATTRACT 28 #define HOLD_EFFECT_CHOICE_BAND 29 #define HOLD_EFFECT_FLINCH 30 diff --git a/include/constants/vars.h b/include/constants/vars.h index 625c37aa9..d3d1aba87 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -56,7 +56,7 @@ #define VAR_CYCLING_ROAD_RECORD_COLLISIONS 0x4027 #define VAR_CYCLING_ROAD_RECORD_TIME_L 0x4028 #define VAR_CYCLING_ROAD_RECORD_TIME_H 0x4029 -#define VAR_HAPPINESS_STEP_COUNTER 0x402A +#define VAR_FRIENDSHIP_STEP_COUNTER 0x402A #define VAR_POISON_STEP_COUNTER 0x402B #define VAR_RESET_RTC_ENABLE 0x402C #define VAR_ENIGMA_BERRY_AVAILABLE 0x402D diff --git a/include/dodrio_berry_picking.h b/include/dodrio_berry_picking.h index 5decbeccb..a93fb27cd 100644 --- a/include/dodrio_berry_picking.h +++ b/include/dodrio_berry_picking.h @@ -1,7 +1,7 @@ #ifndef GUARD_DODRIO_BERRY_PICKING_H #define GUARD_DODRIO_BERRY_PICKING_H -void StartDodrioBerryPicking(u16 a0, void (*callback)(void)); +void StartDodrioBerryPicking(u16 partyId, void (*exitCallback)(void)); void IsDodrioInParty(void); void ShowDodrioBerryPickingRecords(void); diff --git a/include/global.h b/include/global.h index 1992ff819..7806c0b59 100644 --- a/include/global.h +++ b/include/global.h @@ -74,6 +74,14 @@ #define abs(x) (((x) < 0) ? -(x) : (x)) #endif +// Used in cases where division by 0 can occur in the retail version. +// Avoids invalid opcodes on some emulators, and the otherwise UB. +#ifdef UBFIX +#define SAFE_DIV(a, b) ((b) ? (a) / (b) : 0) +#else +#define SAFE_DIV(a, b) ((a) / (b)) +#endif + // Extracts the upper 16 bits of a 32-bit number #define HIHALF(n) (((n) & 0xFFFF0000) >> 16) @@ -209,7 +217,7 @@ struct PyramidBag struct BerryCrush { - u16 berryCrushResults[4]; + u16 pressingSpeeds[4]; // For the record with each possible group size, 2-5 players u32 berryPowderAmount; u32 unk; }; diff --git a/include/graphics.h b/include/graphics.h index 1d39eb1f5..7c36b9cf5 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4998,9 +4998,9 @@ extern const u16 gUsePokeblockUpDown_Pal[]; extern const u16 gUsePokeblockCondition_Pal[]; // Berry Crush -extern const u32 gUnknown_08DE34B8[]; -extern const u16 gUnknown_08DE3398[]; -extern const u32 gUnknown_08DE3FD4[]; +extern const u32 gBerryCrush_Crusher_Gfx[]; +extern const u16 gBerryCrush_Crusher_Pal[]; +extern const u32 gBerryCrush_Crusher_Tilemap[]; // Pokenav extern const u32 gPokenavMessageBox_Gfx[]; diff --git a/include/link.h b/include/link.h index 086bf787b..3b621e6c1 100644 --- a/include/link.h +++ b/include/link.h @@ -56,17 +56,17 @@ #define LINKCMD_BLENDER_SEND_KEYS 0x4444 #define LINKCMD_BLENDER_SCORE_BEST 0x4523 #define LINKCMD_BLENDER_SCORE_GOOD 0x5432 -#define LINKCMD_0x5555 0x5555 -#define LINKCMD_0x5566 0x5566 +#define LINKCMD_DUMMY_1 0x5555 +#define LINKCMD_DUMMY_2 0x5566 #define LINKCMD_READY_CLOSE_LINK 0x5FFF -#define LINKCMD_0x6666 0x6666 -#define LINKCMD_0x7777 0x7777 +#define LINKCMD_SEND_EMPTY 0x6666 +#define LINKCMD_SEND_0xEE 0x7777 #define LINKCMD_BLENDER_PLAY_AGAIN 0x7779 -#define LINKCMD_0x7FFF 0x7FFF +#define LINKCMD_COUNTDOWN 0x7FFF #define LINKCMD_CONT_BLOCK 0x8888 #define LINKCMD_BLENDER_NO_BERRIES 0x9999 #define LINKCMD_BLENDER_NO_PBLOCK_SPACE 0xAAAA -#define LINKCMD_0xAAAB 0xAAAB +#define LINKCMD_SEND_ITEM 0xAAAB #define LINKCMD_READY_TO_TRADE 0xAABB #define LINKCMD_READY_FINISH_TRADE 0xABCD #define LINKCMD_INIT_BLOCK 0xBBBB @@ -76,17 +76,18 @@ #define LINKCMD_START_TRADE 0xCCDD #define LINKCMD_CONFIRM_FINISH_TRADE 0xDCBA #define LINKCMD_SET_MONS_TO_TRADE 0xDDDD -#define LINKCMD_0xDDEE 0xDDEE +#define LINKCMD_PLAYER_CANCEL_TRADE 0xDDEE #define LINKCMD_REQUEST_CANCEL 0xEEAA -#define LINKCMD_CANCEL_TRADE 0xEEBB -#define LINKCMD_0xEECC 0xEECC +#define LINKCMD_BOTH_CANCEL_TRADE 0xEEBB +#define LINKCMD_PARTNER_CANCEL_TRADE 0xEECC +#define LINKCMD_NONE 0xEFFF #define LINKTYPE_TRADE 0x1111 #define LINKTYPE_TRADE_CONNECTING 0x1122 #define LINKTYPE_TRADE_SETUP 0x1133 #define LINKTYPE_TRADE_DISCONNECTED 0x1144 #define LINKTYPE_BATTLE 0x2211 -#define LINKTYPE_0x2222 0x2222 // unused battle? +#define LINKTYPE_UNUSED_BATTLE 0x2222 // Unused, inferred from gap #define LINKTYPE_SINGLE_BATTLE 0x2233 #define LINKTYPE_DOUBLE_BATTLE 0x2244 #define LINKTYPE_MULTI_BATTLE 0x2255 @@ -98,7 +99,7 @@ #define LINKTYPE_BERRY_BLENDER_SETUP 0x4411 #define LINKTYPE_BERRY_BLENDER 0x4422 #define LINKTYPE_MYSTERY_EVENT 0x5501 -#define LINKTYPE_0x5502 0x5502 // unused? +#define LINKTYPE_UNUSED_EREADER 0x5502 // Unused, inferred from gap #define LINKTYPE_EREADER 0x5503 #define LINKTYPE_CONTEST_GMODE 0x6601 #define LINKTYPE_CONTEST_EMODE 0x6602 @@ -290,17 +291,17 @@ bool8 HandleLinkConnection(void); void SetLinkDebugValues(u32 seed, u32 flags); void SetBerryBlenderLinkCallback(void); void SetSuppressLinkErrorMessage(bool8 flag); -void sub_800B524(struct LinkPlayer *linkPlayer); +void ConvertLinkPlayerName(struct LinkPlayer *linkPlayer); u8 GetSioMultiSI(void); void ClearSavedLinkPlayers(void); -void BufferLinkErrorInfo(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06); -void sub_800B348(void); +void BufferLinkErrorInfo(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, bool8 disconnected); +void LocalLinkPlayerToBlock(void); void LinkPlayerFromBlock(u32 who); bool32 Link_AnyPartnersPlayingFRLG_JP(void); void ResetLinkPlayerCount(void); void SaveLinkPlayers(u8 a0); void SetWirelessCommType0(void); -bool32 sub_800B504(void); +bool32 IsLinkRecvQueueLengthAtLeast3(void); extern u16 gLinkPartnersHeldKeys[6]; extern u32 gLinkDebugSeed; diff --git a/include/link_rfu.h b/include/link_rfu.h index 9476da6b7..e1c3a6fba 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -262,7 +262,7 @@ bool8 LinkRfu_GetNameIfSerial7F7D(struct GFtgtGname *buff1, u8 *buff2, u8 idx); s32 sub_800E87C(u8 idx); void CreateTask_RfuIdle(void); void DestroyTask_RfuIdle(void); -void sub_8011AC8(void); +void ClearRecvCommands(void); void LinkRfu_FatalError(void); bool32 sub_8011A9C(void); void sub_80104B0(void); diff --git a/include/main.h b/include/main.h index 16ac31df2..cad5c0ef9 100644 --- a/include/main.h +++ b/include/main.h @@ -37,7 +37,7 @@ struct Main /*0x439*/ u8 oamLoadDisabled:1; /*0x439*/ u8 inBattle:1; - /*0x439*/ u8 field_439_x4:1; + /*0x439*/ u8 anyLinkBattlerHasFrontierPass:1; }; extern const u8 gGameVersion; diff --git a/include/overworld.h b/include/overworld.h index a2eac7e29..6efaa6ccb 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -152,10 +152,10 @@ u16 sub_8087288(void); u16 sub_808729C(void); u16 QueueExitLinkRoomKey(void); u16 sub_80872C4(void); -bool32 sub_8087598(void); -bool32 sub_80875C8(void); -bool32 sub_8087634(void); -bool32 sub_808766C(void); +bool32 Overworld_LinkRecvQueueLengthMoreThan2(void); +bool32 Overworld_RecvKeysFromLinkIsRunning(void); +bool32 Overworld_SendKeysToLinkIsRunning(void); +bool32 IsSendingKeysOverCable(void); void ClearLinkPlayerObjectEvents(void); #endif // GUARD_OVERWORLD_H diff --git a/include/recorded_battle.h b/include/recorded_battle.h index 3a6a8129a..5ae4ac12d 100644 --- a/include/recorded_battle.h +++ b/include/recorded_battle.h @@ -22,9 +22,9 @@ u8 GetRecordedBattleFrontierFacility(void); u8 GetRecordedBattleFronterBrainSymbol(void); void RecordedBattle_SaveParties(void); u8 GetActiveBattlerLinkPlayerGender(void); -void sub_8185F84(void); -void sub_8185F90(u16 arg0); -u8 sub_8185FAC(void); +void RecordedBattle_ClearFrontierPassFlag(void); +void RecordedBattle_SetFrontierPassFlagFromHword(u16 arg0); +u8 RecordedBattle_GetFrontierPassFlag(void); u8 GetBattleSceneInRecordedBattle(void); u8 GetTextSpeedInRecordedBattle(void); void RecordedBattle_CopyBattlerMoves(void); diff --git a/include/sound.h b/include/sound.h index 7d47b7456..25ffa2d6e 100644 --- a/include/sound.h +++ b/include/sound.h @@ -1,6 +1,27 @@ #ifndef GUARD_SOUND_H #define GUARD_SOUND_H +enum { + FANFARE_LEVEL_UP, + FANFARE_OBTAIN_ITEM, + FANFARE_EVOLVED, + FANFARE_OBTAIN_TMHM, + FANFARE_HEAL, + FANFARE_OBTAIN_BADGE, + FANFARE_MOVE_DELETED, + FANFARE_OBTAIN_BERRY, + FANFARE_AWAKEN_LEGEND, + FANFARE_SLOTS_JACKPOT, + FANFARE_SLOTS_WIN, + FANFARE_TOO_BAD, + FANFARE_RG_POKE_FLUTE, + FANFARE_RG_OBTAIN_KEY_ITEM, + FANFARE_RG_DEX_RATING, + FANFARE_OBTAIN_B_POINTS, + FANFARE_OBTAIN_SYMBOL, + FANFARE_REGISTER_MATCH_CALL, +}; + void InitMapMusic(void); void MapMusicMain(void); void ResetMapMusic(void); diff --git a/include/strings.h b/include/strings.h index 294ab8aa6..8880f3a5c 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2904,7 +2904,7 @@ extern const u8 gText_CrushingResults[]; extern const u8 gText_BerryCrush2[]; extern const u8 gText_PressingSpeedRankings[]; extern const u8 gText_Var1Players[]; -extern const u8 gText_ReadyToBerryCrush[]; +extern const u8 gText_ReadyPickBerry[]; extern const u8 gText_WaitForAllChooseBerry[]; extern const u8 gText_EndedWithXUnitsPowder[]; extern const u8 gText_RecordingGameResults[]; diff --git a/include/trainer_hill.h b/include/trainer_hill.h index 94d29a7ca..acf8facca 100644 --- a/include/trainer_hill.h +++ b/include/trainer_hill.h @@ -66,7 +66,6 @@ void InitTrainerHillBattleStruct(void); void FreeTrainerHillBattleStruct(void); void CopyTrainerHillTrainerText(u8 which, u16 trainerId); bool8 InTrainerHillChallenge(void); -void nullsub_129(void); void PrintOnTrainerHillRecordsWindow(void); void LoadTrainerHillObjectEventTemplates(void); bool32 LoadTrainerHillFloorObjectEventScripts(void); |