summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/berry.h8
-rwxr-xr-xinclude/berry_crush.h2
-rw-r--r--include/constants/battle_pike.h4
-rw-r--r--include/constants/game_stat.h2
-rw-r--r--include/constants/hold_effects.h2
-rw-r--r--include/constants/vars.h2
-rw-r--r--include/global.h10
-rw-r--r--include/graphics.h6
-rw-r--r--include/link.h29
-rw-r--r--include/strings.h2
-rw-r--r--include/trainer_hill.h1
11 files changed, 38 insertions, 30 deletions
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/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 b1a781fff..9be05f38e 100644
--- a/include/graphics.h
+++ b/include/graphics.h
@@ -5001,9 +5001,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 34710597f..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_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/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);