summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/constants/battle_pike.h4
-rw-r--r--include/constants/hold_effects.h2
-rw-r--r--include/constants/vars.h2
-rw-r--r--include/global.h8
-rw-r--r--include/link.h29
-rw-r--r--include/trainer_hill.h1
6 files changed, 27 insertions, 19 deletions
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/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 7daed8621..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)
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/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);