summaryrefslogtreecommitdiff
path: root/asm/macros
diff options
context:
space:
mode:
Diffstat (limited to 'asm/macros')
-rw-r--r--asm/macros/battle_script.inc12
-rw-r--r--asm/macros/contest_ai_script.inc815
-rw-r--r--asm/macros/event.inc124
-rw-r--r--asm/macros/trainer_hill.inc6
4 files changed, 685 insertions, 272 deletions
diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc
index eda410c5b..37548f410 100644
--- a/asm/macros/battle_script.inc
+++ b/asm/macros/battle_script.inc
@@ -1263,8 +1263,8 @@
various \battler, VARIOUS_GET_MOVE_TARGET
.endm
- .macro various4 battler:req
- various \battler, 4
+ .macro getbattlerfainted battler:req
+ various \battler, VARIOUS_GET_BATTLER_FAINTED
.endm
.macro resetintimidatetracebits battler:req
@@ -1279,8 +1279,8 @@
various \battler, 7
.endm
- .macro various8 battler:req
- various \battler, 8
+ .macro palaceflavortext battler:req
+ various \battler, VARIOUS_PALACE_FLAVOR_TEXT
.endm
.macro arenajudgmentwindow
@@ -1365,11 +1365,11 @@
.endm
.macro chosenstatus1animation battler:req, status:req
- chosenstatusanimation \battler 0x0 \status
+ chosenstatusanimation \battler, 0x0, \status
.endm
.macro chosenstatus2animation battler:req, status:req
- chosenstatusanimation \battler 0x1 \status
+ chosenstatusanimation \battler, 0x1, \status
.endm
.macro sethword dst:req, value:req
diff --git a/asm/macros/contest_ai_script.inc b/asm/macros/contest_ai_script.inc
index 05d70e351..9ab7184c3 100644
--- a/asm/macros/contest_ai_script.inc
+++ b/asm/macros/contest_ai_script.inc
@@ -1,38 +1,46 @@
+@ A large number of the Contest AI commands go unused, so their corresponding macros in this file are similarly unused
+
@ Add a positive/negative value to the score of the move being evaluated.
- .macro score score
+ .macro score score:req
.byte 0x00
.byte \score
.endm
-@ turn (AKA "Appeal No.")
-
- .macro get_turn
+ .macro get_appeal_num
.byte 0x01
.endm
- .macro if_turn_less_than param, addr
+ .macro if_appeal_num_less_than num:req, destination:req
.byte 0x02
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_turn_more_than param, addr
+ .macro if_appeal_num_more_than num:req, destination:req
.byte 0x03
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_turn_eq param, addr
+ .macro if_appeal_num_eq num:req, destination:req
.byte 0x04
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_turn_not_eq param, addr
+ .macro if_appeal_num_not_eq num:req, destination:req
.byte 0x05
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_last_appeal destination:req
+ if_appeal_num_eq CONTEST_LAST_APPEAL, \destination
+ .endm
+
+ .macro if_not_last_appeal destination:req
+ if_appeal_num_not_eq CONTEST_LAST_APPEAL, \destination
.endm
@ audience excitement
@@ -41,58 +49,58 @@
.byte 0x06
.endm
- .macro if_excitement_less_than param, addr
+ .macro if_excitement_less_than num:req, destination:req
.byte 0x07
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_excitement_more_than param, addr
+ .macro if_excitement_more_than num:req, destination:req
.byte 0x08
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_excitement_eq param, addr
+ .macro if_excitement_eq num:req, destination:req
.byte 0x09
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_excitement_not_eq param, addr
+ .macro if_excitement_not_eq num:req, destination:req
.byte 0x0A
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
-@ the order that the user goes in the current turn
+@ the order that the user goes in the current appeal
.macro get_user_order
.byte 0x0B
.endm
- .macro if_user_order_less_than param addr
+ .macro if_user_order_less_than num:req, destination:req
.byte 0x0C
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_user_order_more_than param addr
+ .macro if_user_order_more_than num:req, destination:req
.byte 0x0D
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_user_order_eq param addr
+ .macro if_user_order_eq num:req, destination:req
.byte 0x0E
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_user_order_not_eq param addr
+ .macro if_user_order_not_eq num:req, destination:req
.byte 0x0F
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
@ user condition
@@ -101,40 +109,89 @@
.byte 0x10
.endm
- .macro if_user_condition_less_than param, addr
+ .macro if_user_condition_less_than num:req, destination:req
.byte 0x11
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_user_condition_more_than param, addr
+ .macro if_user_condition_more_than num:req, destination:req
.byte 0x12
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_user_condition_eq param, addr
+ .macro if_user_condition_eq num:req, destination:req
.byte 0x13
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_user_condition_not_eq param, addr
+ .macro if_user_condition_not_eq num:req, destination:req
.byte 0x14
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
+ .endm
+
+@ appeal points
+
+ .macro get_point_total
+ .byte 0x15
+ .endm
+
+ .macro if_points_less_than num:req, destination:req
+ .byte 0x16
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_points_more_than num:req, destination:req
+ .byte 0x17
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_points_eq num:req, destination:req
+ .byte 0x18
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_points_not_eq num:req, destination:req
+ .byte 0x19
+ .byte \num
+ .4byte \destination
+ .endm
+
+@ preliminary (pre-appeal) judging points
+
+ .macro get_preliminary_points
+ .byte 0x1A
+ .endm
+
+ .macro if_preliminary_points_less_than num:req, destination:req
+ .byte 0x1B
+ .byte \num
+ .4byte \destination
.endm
-@ 15
-@ 16
-@ 17
-@ 18
-@ 19
-@ 1A
-@ 1B
-@ 1C
-@ 1D
-@ 1E
+ .macro if_preliminary_points_more_than num:req, destination:req
+ .byte 0x1C
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_preliminary_points_eq num:req, destination:req
+ .byte 0x1D
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_preliminary_points_not_eq num:req, destination:req
+ .byte 0x1E
+ .byte \num
+ .4byte \destination
+ .endm
@ contest type
@@ -142,16 +199,16 @@
.byte 0x1F
.endm
- .macro if_contest_type_eq param, addr
+ .macro if_contest_type_eq type:req, destination:req
.byte 0x20
- .byte \param
- .4byte \addr
+ .byte \type
+ .4byte \destination
.endm
- .macro if_contest_type_not_eq param, addr
+ .macro if_contest_type_not_eq type:req, destination:req
.byte 0x21
- .byte \param
- .4byte \addr
+ .byte \type
+ .4byte \destination
.endm
@ move excitement (change in excitement due to move)
@@ -160,28 +217,28 @@
.byte 0x22
.endm
- .macro if_move_excitement_less_than param, addr
+ .macro if_move_excitement_less_than num:req, destination:req
.byte 0x23
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_move_excitement_more_than param, addr
+ .macro if_move_excitement_more_than num:req, destination:req
.byte 0x24
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_move_excitement_eq param, addr
+ .macro if_move_excitement_eq num:req, destination:req
.byte 0x25
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_move_excitement_not_eq param, addr
+ .macro if_move_excitement_not_eq num:req, destination:req
.byte 0x26
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
@ move effect
@@ -190,16 +247,16 @@
.byte 0x27
.endm
- .macro if_effect_eq param, addr
+ .macro if_effect_eq effect:req, destination:req
.byte 0x28
- .byte \param
- .4byte \addr
+ .byte \effect
+ .4byte \destination
.endm
- .macro if_effect_not_eq param, addr
+ .macro if_effect_not_eq effect:req, destination:req
.byte 0x29
- .byte \param
- .4byte \addr
+ .byte \effect
+ .4byte \destination
.endm
@ move effect type
@@ -208,16 +265,16 @@
.byte 0x2A
.endm
- .macro if_effect_type_eq param, addr
+ .macro if_effect_type_eq type:req, destination:req
.byte 0x2B
- .byte \param
- .4byte \addr
+ .byte \type
+ .4byte \destination
.endm
- .macro if_effect_type_not_eq param, addr
+ .macro if_effect_type_not_eq type:req, destination:req
.byte 0x2C
- .byte \param
- .4byte \addr
+ .byte \type
+ .4byte \destination
.endm
@ whether the current move is the most appealing in the user's moveset
@@ -226,23 +283,81 @@
.byte 0x2D
.endm
- .macro if_most_appealing_move addr
+ .macro if_most_appealing_move destination:req
.byte 0x2E
- .4byte \addr
- .endm
-
-@ 2F
-@ 30
-@ 31
-@ 32
-@ 33
-@ 34
-@ 35
-@ 36
-@ 37
-@ 38
-@ 39
-@ 3A
+ .4byte \destination
+ .endm
+
+@ whether the current move is the most jamming in the user's moveset
+
+ .macro check_most_jamming_move
+ .byte 0x2F
+ .endm
+
+ .macro if_most_jamming_move destination:req
+ .byte 0x30
+ .4bye \destination
+ .endm
+
+@ number of hearts the current move's appeal would provide
+
+ .macro get_num_move_hearts
+ .byte 0x31
+ .endm
+
+ .macro if_num_move_hearts_less_than num:req, destination:req
+ .byte 0x32
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_num_move_hearts_more_than num:req, destination:req
+ .byte 0x33
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_num_move_hearts_eq num:req, destination:req
+ .byte 0x34
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_num_move_hearts_not_eq num:req, destination:req
+ .byte 0x35
+ .byte \num
+ .4byte \destination
+ .endm
+
+@ number of hearts the current move's jam would remove
+
+ .macro get_num_move_jam_hearts
+ .byte 0x36
+ .endm
+
+ .macro if_num_move_jam_hearts_less_than num:req, destination:req
+ .byte 0x37
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_num_move_jam_hearts_more_than num:req, destination:req
+ .byte 0x38
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_num_move_jam_hearts_eq num:req, destination:req
+ .byte 0x39
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_num_move_jam_hearts_not_eq num:req, destination:req
+ .byte 0x3A
+ .byte \num
+ .4byte \destination
+ .endm
@ number of times current move has been used
@@ -250,28 +365,28 @@
.byte 0x3B
.endm
- .macro if_move_used_count_less_than param, addr
+ .macro if_move_used_count_less_than num:req, destination:req
.byte 0x3C
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_move_used_count_more_than param, addr
+ .macro if_move_used_count_more_than num:req, destination:req
.byte 0x3D
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_move_used_count_eq param, addr
+ .macro if_move_used_count_eq num:req, destination:req
.byte 0x3E
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_move_used_count_not_eq param, addr
+ .macro if_move_used_count_not_eq num:req, destination:req
.byte 0x3F
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
@ whether the current move is a combo starter (with another move in the moveset)
@@ -280,14 +395,14 @@
.byte 0x40
.endm
- .macro if_combo_starter addr
+ .macro if_combo_starter destination:req
.byte 0x41
- .4byte \addr
+ .4byte \destination
.endm
- .macro if_not_combo_starter addr
+ .macro if_not_combo_starter destination:req
.byte 0x42
- .4byte \addr
+ .4byte \destination
.endm
@ whether the current move is a combo finisher (with another move in the moveset)
@@ -296,14 +411,14 @@
.byte 0x43
.endm
- .macro if_combo_finisher addr
+ .macro if_combo_finisher destination:req
.byte 0x44
- .4byte \addr
+ .4byte \destination
.endm
- .macro if_not_combo_finisher addr
+ .macro if_not_combo_finisher destination:req
.byte 0x45
- .4byte \addr
+ .4byte \destination
.endm
@ whether the current move would finish a combo
@@ -312,170 +427,411 @@
.byte 0x46
.endm
- .macro if_would_finish_combo addr
+ .macro if_would_finish_combo destination:req
.byte 0x47
- .4byte \addr
+ .4byte \destination
.endm
- .macro if_would_not_finish_combo addr
+ .macro if_would_not_finish_combo destination:req
.byte 0x48
- .4byte \addr
+ .4byte \destination
.endm
@ condition of mon (indexed by order)
- .macro get_condition mon
+ .macro get_condition mon:req
.byte 0x49
.byte \mon
.endm
- .macro if_condition_less_than mon, value, addr
+ .macro if_condition_less_than mon:req, num:req destination:req
.byte 0x4A
.byte \mon
- .byte \value
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_condition_more_than mon, value, addr
+ .macro if_condition_more_than mon:req, num:req, destination:req
.byte 0x4B
.byte \mon
- .byte \value
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_condition_eq mon, value, addr
+ .macro if_condition_eq mon:req, num:req, destination:req
.byte 0x4C
.byte \mon
- .byte \value
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_condition_not_eq mon, value, addr
+ .macro if_condition_not_eq mon:req, num:req, destination:req
.byte 0x4D
.byte \mon
- .byte \value
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
@ whether the mon used a combo starter move
@ Even though this value is always 1 or 0 (i.e. TRUE/FALSE),
@ there are less-than and greater-than comparison operations for some reason.
- .macro get_used_combo_starter mon
+ .macro get_used_combo_starter mon:req
.byte 0x4E
.byte \mon
.endm
- .macro if_used_combo_starter_less_than mon, value, addr
+ .macro if_used_combo_starter_less_than mon:req, num:req, destination:req
.byte 0x4F
.byte \mon
- .byte \value
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_used_combo_starter_more_than mon, value, addr
+ .macro if_used_combo_starter_more_than mon:req, num:req, destination:req
.byte 0x50
.byte \mon
- .byte \value
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_used_combo_starter_eq mon, value, addr
+ .macro if_used_combo_starter_eq mon:req, num:req, destination:req
.byte 0x51
.byte \mon
- .byte \value
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
- .macro if_used_combo_starter_not_eq mon, value, addr
+ .macro if_used_combo_starter_not_eq mon:req, num:req, destination:req
.byte 0x52
.byte \mon
- .byte \value
- .4byte \addr
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_used_combo_starter mon:req, destination:req
+ if_used_combo_starter_eq \mon, TRUE, \destination
+ .endm
+
+ .macro if_not_used_combo_starter mon:req, destination:req
+ if_used_combo_starter_eq \mon, FALSE, \destination
.endm
@ whether the mon can make an appeal
- .macro check_can_participate mon
+ .macro check_can_participate mon:req
.byte 0x53
.byte \mon
.endm
- .macro if_can_participate mon, addr
+ .macro if_can_participate mon:req, destination:req
.byte 0x54
.byte \mon
- .4byte \addr
+ .4byte \destination
.endm
- .macro if_cannot_participate mon, addr
+ .macro if_cannot_participate mon:req, destination:req
.byte 0x55
.byte \mon
- .4byte \addr
+ .4byte \destination
.endm
-@ 56
-@ 57
+@ whether the mon just completed a combo
- .macro contest_58 param addr
+ .macro get_completed_combo mon:req
+ .byte 0x56
+ .byte \mon
+ .4byte \destination
+ .endm
+
+ .macro if_completed_combo mon:req, destination:req
+ .byte 0x57
+ .byte \mon
+ .4byte \destination
+ .endm
+
+ .macro if_not_completed_combo mon:req destination:req
.byte 0x58
- .byte \param
- .4byte \addr
- .endm
-
-@ 59
-@ 5A
-@ 5B
-@ 5C
-@ 5D
-@ 5E
-@ 5F
-@ 60
-@ 61
-@ 62
-@ 63
-@ 64
-@ 65
-@ 66
-@ 67
-@ 68
-@ 69
-@ 6A
-@ 6B
-@ 6C
-@ 6D
-@ 6E
-@ 6F
-@ 70
-@ 71
-@ 72
-@ 73
-@ 74
-@ 75
-@ 76
-@ 77
-@ 78
-@ 79
-@ 7A
-@ 7B
-@ 7C
-
- .macro if_random param addr
+ .byte \mon
+ .4byte \destination
+ .endm
+
+@ comparing appeal points to another mon
+
+ .macro get_points_diff mon:req
+ .byte 0x59
+ .byte \mon
+ .endm
+
+ .macro if_points_more_than_mon mon:req, destination:req
+ .byte 0x5A
+ .byte \mon
+ .4byte \destination
+ .endm
+
+ .macro if_points_less_than_mon mon:req, destination:req
+ .byte 0x5B
+ .byte \mon
+ .4byte \destination
+ .endm
+
+ .macro if_points_eq_mon mon:req, destination:req
+ .byte 0x5C
+ .byte \mon
+ .4byte \destination
+ .endm
+
+ .macro if_points_not_eq_mon mon:req, destination:req
+ .byte 0x5D
+ .byte \mon
+ .4byte \destination
+ .endm
+
+@ comparing preliminary judging points to another mon
+
+ .macro get_preliminary_points_diff mon:req
+ .byte 0x5E
+ .byte \mon
+ .endm
+
+ .macro if_preliminary_points_more_than_mon mon:req, destination:req
+ .byte 0x5F
+ .byte \mon
+ .4byte \destination
+ .endm
+
+ .macro if_preliminary_points_less_than_mon mon:req, destination:req
+ .byte 0x60
+ .byte \mon
+ .4byte \destination
+ .endm
+
+ .macro if_preliminary_points_eq_mon mon:req, destination:req
+ .byte 0x61
+ .byte \mon
+ .4byte \destination
+ .endm
+
+ .macro if_preliminary_points_not_eq_mon mon:req, destination:req
+ .byte 0x62
+ .byte \mon
+ .4byte \destination
+ .endm
+
+@ checking move history for move effect
+
+ .macro get_used_moves_effect mon:req, round:req
+ .byte 0x63
+ .byte \mon
+ .byte \round
+ .endm
+
+ .macro if_used_moves_effect_less_than mon:req, round:req, effect:req, destination:req
+ .byte 0x64
+ .byte \mon
+ .byte \round
+ .byte \effect
+ .4byte \destination
+ .endm
+
+ .macro if_used_moves_effect_more_than mon:req, round:req, effect:req, destination:req
+ .byte 0x65
+ .byte \mon
+ .byte \round
+ .byte \effect
+ .4byte \destination
+ .endm
+
+ .macro if_used_moves_effect_eq mon:req, round:req, effect:req, destination:req
+ .byte 0x66
+ .byte \mon
+ .byte \round
+ .byte \effect
+ .4byte \destination
+ .endm
+
+ .macro if_used_moves_effect_not_eq mon:req, round:req, effect:req, destination:req
+ .byte 0x67
+ .byte \mon
+ .byte \round
+ .byte \effect
+ .4byte \destination
+ .endm
+
+@ checking move history for excitement
+
+ .macro get_used_moves_excitement mon:req, round:req
+ .byte 0x68
+ .byte \mon
+ .byte \round
+ .endm
+
+ .macro if_used_moves_excitement_less_than mon:req, round:req, num:req, destination:req
+ .byte 0x69
+ .byte \mon
+ .byte \round
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_used_moves_excitement_more_than mon:req, round:req, num:req, destination:req
+ .byte 0x6A
+ .byte \mon
+ .byte \round
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_used_moves_excitement_eq mon:req, round:req, num:req, destination:req
+ .byte 0x6B
+ .byte \mon
+ .byte \round
+ .byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_used_moves_excitement_not_eq mon:req, round:req, num:req, destination:req
+ .byte 0x6C
+ .byte \mon
+ .byte \round
+ .byte \num
+ .4byte \destination
+ .endm
+
+@ checking move history for effect type
+
+ .macro get_used_moves_effect_type mon:req, round:req
+ .byte 0x6D
+ .byte \mon
+ .byte \round
+ .endm
+
+ .macro if_used_moves_effect_type_eq mon:req, round:req, type:req, destination:req
+ .byte 0x6E
+ .byte \mon
+ .byte \round
+ .byte \type
+ .4byte \destination
+ .endm
+
+ .macro if_used_moves_effect_type_not_eq mon:req, round:req, type:req, destination:req
+ .byte 0x6F
+ .byte \mon
+ .byte \round
+ .byte \type
+ .4byte \destination
+ .endm
+
+@ generic commands
+
+ .macro save_result varId:req
+ .byte 0x70
+ .byte \varId
+ .endm
+
+ .macro setvar varId:req, num:req
+ .byte 0x71
+ .byte \varId
+ .2byte \num
+ .endm
+
+ .macro add varId:req, num:req
+ .byte 0x72
+ .byte \varId
+ .2byte \num
+ .endm
+
+ .macro addvar varId1:req, varId2:req
+ .byte 0x73
+ .byte \varId1
+ .byte \varId2
+ .endm
+
+ @ Duplicate of above
+ .macro addvar_duplicate varId1:req, varId2:req
+ .byte 0x74
+ .byte \varId1
+ .byte \varId2
+ .endm
+
+ .macro if_less_than varId:req, num:req, destination:req
+ .byte 0x75
+ .byte \varId
+ .2byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_greater_than varId:req, num:req, destination:req
+ .byte 0x76
+ .byte \varId
+ .2byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_eq varId:req, num:req, destination:req
+ .byte 0x77
+ .byte \varId
+ .2byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_not_eq varId:req, num:req, destination:req
+ .byte 0x78
+ .byte \varId
+ .2byte \num
+ .4byte \destination
+ .endm
+
+ .macro if_less_than_var varId1:req, varId2:req, destination:req
+ .byte 0x79
+ .byte \varId1
+ .byte \varId2
+ .4byte \destination
+ .endm
+
+ .macro if_greater_than_var varId1:req, varId2:req, destination:req
+ .byte 0x7A
+ .byte \varId1
+ .byte \varId2
+ .4byte \destination
+ .endm
+
+ .macro if_eq_var varId1:req, varId2:req, destination:req
+ .byte 0x7B
+ .byte \varId1
+ .byte \varId2
+ .4byte \destination
+ .endm
+
+ .macro if_not_eq_var varId1:req, varId2:req, destination:req
+ .byte 0x7C
+ .byte \varId1
+ .byte \varId2
+ .4byte \destination
+ .endm
+
+ @ NOTE: The random commands are broken (see ContestAICmd_if_random_less_than)
+ .macro if_random_less_than num:req, destination:req
.byte 0x7D
- .byte \param
- .4byte \addr
+ .byte \num
+ .4byte \destination
.endm
-@ 7E
+ .macro if_random_greater_than num:req, destination:req
+ .byte 0x7E
+ .byte \num
+ .4byte \destination
+ .endm
- .macro jump addr
+ .macro goto destination:req
.byte 0x7F
- .4byte \addr
+ .4byte \destination
.endm
- .macro call addr
+ .macro call destination:req
.byte 0x80
- .4byte \addr
+ .4byte \destination
.endm
.macro end
@@ -486,21 +842,30 @@
.byte 0x82
.endm
- .macro if_user_has_exciting_move addr
+ .macro if_user_has_exciting_move destination:req
.byte 0x83
- .4byte \addr
+ .4byte \destination
.endm
- .macro if_user_doesnt_have_exciting_move addr
+ .macro if_user_doesnt_have_exciting_move destination:req
.byte 0x84
- .4byte \addr
+ .4byte \destination
.endm
-@ 85
-@ 86
+ @ This is used incorrectly to check for an effect; see ContestAICmd_check_user_has_move
+ .macro check_user_has_move move:req
+ .byte 0x85
+ .2byte \move
+ .endm
+
+ .macro if_user_has_move move:req, destination:req
+ .byte 0x86
+ .2byte \move
+ .4byte \destination
+ .endm
- .macro if_effect_in_user_moveset param addr
+ .macro if_user_doesnt_have_move move:req, destination:req
.byte 0x87
- .2byte \param
- .4byte \addr
+ .2byte \move
+ .4byte \destination
.endm
diff --git a/asm/macros/event.inc b/asm/macros/event.inc
index a4beb3527..5e5a2758d 100644
--- a/asm/macros/event.inc
+++ b/asm/macros/event.inc
@@ -274,15 +274,17 @@
.2byte \functionId
.endm
- @ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock state, the script will remain blocked indefinitely (essentially a hang).
+ @ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific
+ @ commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock
+ @ state, the script will remain blocked indefinitely (essentially a hang).
.macro waitstate
.byte 0x27
.endm
- @ Blocks script execution for time (frames? milliseconds?).
- .macro delay time:req
+ @ Blocks script execution for frames. (Pokemon Emerald runs at just shy of 60 frames per second.)
+ .macro delay frames:req
.byte 0x28
- .2byte \time
+ .2byte \frames
.endm
@ Sets a to 1.
@@ -315,7 +317,8 @@
.byte 0x2d
.endm
- @ Sets the values of variables 0x8000, 0x8001, and 0x8002 to the current hour, minute, and second. In FRLG, this command sets those variables to zero.
+ @ Sets the values of variables 0x8000, 0x8001, and 0x8002 to the current hour, minute, and second. In FRLG,
+ @ this command sets those variables to zero.
.macro gettime
.byte 0x2e
.endm
@@ -378,7 +381,8 @@
.byte \speed
.endm
- @ Sends the player to Warp warp on Map bank.map. If the specified warp is 0xFF, then the player will instead be sent to (X, Y) on the map.
+ @ Sends the player to Warp warp on Map bank.map. If the specified warp is 0xFF,
+ @ then the player will instead be sent to (X, Y) on the map.
.macro warp map:req, warp:req, X:req, Y:req
.byte 0x39
map \map
@@ -429,7 +433,8 @@
.2byte \Y
.endm
- @ Sets the warp destination that a warp to Warp 127 on Map 127.127 will connect to. Useful when a map has warps that need to go to script-controlled locations (i.e. elevators).
+ @ Sets the warp destination that a warp to Warp 127 on Map 127.127 will connect to.
+ @ Useful when a map has warps that need to go to script-controlled locations (i.e. elevators).
.macro setdynamicwarp map:req, warp:req, X:req, Y:req
.byte 0x3f
map \map
@@ -468,7 +473,8 @@
.byte 0x43
.endm
- @ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and VAR_RESULT will be set to TRUE; otherwise, VAR_RESULT is set to FALSE.
+ @ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and
+ @ VAR_RESULT will be set to TRUE; otherwise, VAR_RESULT is set to FALSE.
.macro additem index:req, quantity=1
.byte 0x44
.2byte \index
@@ -482,21 +488,24 @@
.2byte \quantity
.endm
- @ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room.
+ @ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets VAR_RESULT to
+ @ TRUE if there is room, or FALSE is there is no room.
.macro checkitemspace index:req, quantity:req
.byte 0x46
.2byte \index
.2byte \quantity
.endm
- @ Checks if the player has quantity or more of item index in their Bag. Sets VAR_RESULT to TRUE if the player has enough of the item, or FALSE if they have fewer than quantity of the item.
+ @ Checks if the player has quantity or more of item index in their Bag. Sets VAR_RESULT to TRUE if the player has
+ @ enough of the item, or FALSE if they have fewer than quantity of the item.
.macro checkitem index:req, quantity:req
.byte 0x47
.2byte \index
.2byte \quantity
.endm
- @ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT. This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE).
+ @ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT.
+ @ This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE).
.macro checkitemtype index:req
.byte 0x48
.2byte \index
@@ -534,7 +543,8 @@
.2byte \decoration
.endm
- @ Checks if the player has enough space in their PC to hold decoration. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
+ @ Checks if the player has enough space in their PC to hold decoration. Sets VAR_RESULT to TRUE if there is room, or
+ @ FALSE is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
.macro checkdecorspace decoration:req
.byte 0x4e
.2byte \decoration
@@ -556,7 +566,10 @@
.endif
.endm
- @ Blocks script execution until the movements being applied to the specified (index) Object finish. If the specified Object is 0x0000, then the command will block script execution until all Objects affected by applymovement finish their movements. If the specified Object is not currently being manipulated with applymovement, then this command does nothing.
+ @ Blocks script execution until the movements being applied to the specified (index) Object finish.
+ @ If the specified Object is 0x0000, then the command will block script execution until all Objects
+ @ affected by applymovement finish their movements. If the specified Object is not currently being
+ @ manipulated with applymovement, then this command does nothing.
@ If no map is specified, then the current map is used.
.macro waitmovement index:req, map
.ifb \map
@@ -569,7 +582,9 @@
.endif
.endm
- @ Attempts to hide the specified (index) Object on the specified (map_group, map_num) map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
+ @ Attempts to hide the specified (index) Object on the specified (map_group, map_num) map,
+ @ by setting its visibility flag if it has a valid one. If the Object does not have a valid
+ @ visibility flag, this command does nothing.
@ If no map is specified, then the current map is used.
.macro removeobject index:req, map
.ifb \map
@@ -582,7 +597,8 @@
.endif
.endm
- @ Unsets the specified (index) Object's visibility flag on the specified (map_group, map_num) map if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
+ @ Unsets the specified (index) Object's visibility flag on the specified (map_group, map_num) map if it has a valid one.
+ @ If the Object does not have a valid visibility flag, this command does nothing.
@ If no map is specified, then the current map is used.
.macro addobject index:req, map
.ifb \map
@@ -723,7 +739,8 @@
.endm
- @ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this command behind-the-scenes), and blocks script execution until the battle finishes.
+ @ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this
+ @ command behind-the-scenes), and blocks script execution until the battle finishes.
.macro trainerbattlebegin
.byte 0x5d
.endm
@@ -763,7 +780,8 @@
.2byte \y
.endm
- @ Copies a live object event's xy position to its template, so that if the sprite goes off screen, it'll still be there when it comes back on screen.
+ @ Copies a live object event's xy position to its template, so that if the sprite goes off screen,
+ @ it'll still be there when it comes back on screen.
.macro copyobjectxytoperm index:req
.byte 0x64
.2byte \index
@@ -775,12 +793,15 @@
.byte \byte
.endm
- @ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the box and its text have been fully drawn.
+ @ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the
+ @ box and its text have been fully drawn.
.macro waitmessage
.byte 0x66
.endm
- @ Starts displaying a standard message box containing the specified text. If text is a pointer, then the string at that offset will be loaded and used. If text is script bank 0, then the value of script bank 0 will be treated as a pointer to the text. (You can use loadpointer to place a string pointer in a script bank.)
+ @ Starts displaying a standard message box containing the specified text. If text is a pointer, then the string at
+ @ that offset will be loaded and used. If text is script bank 0, then the value of script bank 0 will be treated as
+ @ a pointer to the text. (You can use loadpointer to place a string pointer in a script bank.)
.macro message text:req
.byte 0x67
.4byte \text
@@ -816,14 +837,16 @@
.byte 0x6d
.endm
- @ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection. Their selection is stored in VAR_RESULT as NO (0) or YES (1). Pressing B is equivalent to answering NO
+ @ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection.
+ @ Their selection is stored in VAR_RESULT as NO (0) or YES (1). Pressing B is equivalent to answering NO
.macro yesnobox x:req, y:req
.byte 0x6e
.byte \x
.byte \y
.endm
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
+ @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made.
+ @ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
.macro multichoice x:req, y:req, list:req, b:req
.byte 0x6f
.byte \x
@@ -832,7 +855,10 @@
.byte \b
.endm
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The default argument determines the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
+ @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made.
+ @ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The default argument determines
+ @ the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00.
+ @ If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
.macro multichoicedefault x:req, y:req, list:req, default:req, b:req
.byte 0x70
.byte \x
@@ -842,7 +868,9 @@
.byte \b
.endm
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The per_row argument determines how many list items will be shown on a single row of the box.
+ @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made.
+ @ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list.
+ @ The per_row argument determines how many list items will be shown on a single row of the box.
.macro multichoicegrid x:req, y:req, list:req, per_row:req, B:req
.byte 0x71
.byte \x
@@ -894,7 +922,9 @@
.byte \a
.endm
- @ Displays the string at pointer as braille text in a standard message box. The string must be formatted to use braille characters and needs to provide six extra starting characters that are skipped (in RS, these characters determined the box's size and position, but in Emerald these are calculated automatically).
+ @ Displays the string at pointer as braille text in a standard message box. The string must be formatted to use braille
+ @ characters and needs to provide six extra starting characters that are skipped (in RS, these characters determined the
+ @ box's size and position, but in Emerald these are calculated automatically).
.macro braillemessage text:req
.byte 0x78
.4byte \text
@@ -923,7 +953,9 @@
.2byte \move
.endm
- @ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, VAR_RESULT is set to the (zero-indexed) slot number of the first Pokemon that knows the move. If not, VAR_RESULT is set to PARTY_SIZE. VAR_0x8004 is also set to this Pokemon's species.
+ @ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, VAR_RESULT is set to the
+ @ (zero-indexed) slot number of the first Pokemon that knows the move. If not, VAR_RESULT is set to PARTY_SIZE.
+ @ VAR_0x8004 is also set to this Pokemon's species.
.macro checkpartymove index:req
.byte 0x7c
.2byte \index
@@ -942,14 +974,16 @@
.byte \out
.endm
- @ Writes the nickname of the Pokemon in slot slot (zero-indexed) of the player's party to the specified buffer. If an empty or invalid slot is specified, ten spaces ("") are written to the buffer.
+ @ Writes the nickname of the Pokemon in slot slot (zero-indexed) of the player's party to the specified buffer.
+ @ If an empty or invalid slot is specified, ten spaces ("") are written to the buffer.
.macro bufferpartymonnick out:req, slot:req
.byte 0x7f
.byte \out
.2byte \slot
.endm
- @ Writes the name of the item at index item to the specified buffer. If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
+ @ Writes the name of the item at index item to the specified buffer. If the specified index is larger than
+ @ the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
.macro bufferitemname out:req, item:req
.byte 0x80
.byte \out
@@ -977,7 +1011,8 @@
.2byte \input
.endm
- @ Writes the standard string identified by index to the specified buffer. This command has no protections in place at all, so specifying an invalid standard string (e.x. 0x2B) can and usually will cause data corruption.
+ @ Writes the standard string identified by index to the specified buffer. This command has no protections in place at all,
+ @ so specifying an invalid standard string (e.x. 0x2B) can and usually will cause crashes or garbage characters.
.macro bufferstdstring out:req, index:req
.byte 0x84
.byte \out
@@ -1063,7 +1098,8 @@
.byte \check
.endm
- @ If check is 0x00, this command will check if the player has money >= value; VAR_RESULT is set to TRUE if the player has enough money, or FALSE if they do not.
+ @ If check is 0x00, this command will check if the player has money >= value; VAR_RESULT is set to TRUE if the player
+ @ has enough money, or FALSE if they do not.
.macro checkmoney value:req, check:req
.byte 0x92
.4byte \value
@@ -1291,7 +1327,8 @@
.2byte \count
.endm
- @ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect normal wild battles. You start the prepared battle with dowildbattle.
+ @ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect
+ @ normal wild battles. You start the prepared battle with dowildbattle.
.macro setwildbattle species:req, level:req, item:req
.byte 0xb6
.2byte \species
@@ -1395,19 +1432,22 @@
.2byte \box
.endm
- @ Sets the color of the text in standard message boxes. 0x00 produces blue (male) text, 0x01 produces red (female) text, 0xFF resets the color to the default for the current OW's gender, and all other values produce black text.
+ @ Sets the color of the text in standard message boxes. 0x00 produces blue (male) text, 0x01 produces red (female) text,
+ @ 0xFF resets the color to the default for the current OW's gender, and all other values produce black text.
.macro textcolor color:req
.byte 0xc7
.byte \color
.endm
- @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
+ @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom
+ @ of the screen when the Main Menu is opened.
.macro loadhelp pointer:req
.byte 0xc8
.4byte \pointer
.endm
- @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
+ @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of
+ @ the screen when the Main Menu is opened.
.macro unloadhelp
.byte 0xc9
.endm
@@ -1435,13 +1475,15 @@
.2byte \slot
.endm
- @ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient, VAR_RESULT is TRUE. If the Pokemon is obedient (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
+ @ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient,
+ @ VAR_RESULT is TRUE. If the Pokemon is obedient (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
.macro checkmonobedience slot:req
.byte 0xce
.2byte \slot
.endm
- @ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the offset specified by the pointer at 0x020375C0.
+ @ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the
+ @ offset specified by the pointer at 0x020375C0.
.macro gotoram
.byte 0xcf
.endm
@@ -1468,7 +1510,8 @@
.byte \location
.endm
- @ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Moves the objects on the colored puzzle specified by puzzleNumber one rotation
+ @ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Moves the objects on the colored puzzle
+ @ specified by puzzleNumber one rotation
.macro moverotatingtileobjects puzzleNumber:req
.byte 0xd3
.2byte \puzzleNumber
@@ -1479,7 +1522,9 @@
.byte 0xd4
.endm
- @ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Allocates memory for the puzzle objects. isTrickHouse is needed to determine which of the two maps the puzzle is on, in order to know where in the tileset the puzzle tiles start. In FireRed, this command is a nop.
+ @ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Allocates memory for the puzzle objects.
+ @ isTrickHouse is needed to determine which of the two maps the puzzle is on, in order to know where in the tileset
+ @ the puzzle tiles start. In FireRed, this command is a nop.
.macro initrotatingtilepuzzle isTrickHouse:req
.byte 0xd5
.2byte \isTrickHouse
@@ -1551,7 +1596,10 @@
.2byte \word
.endm
- @ Writes the name of the specified (item) item to the specified buffer. If the specified item is a Berry (0x85 - 0xAE) or Poke Ball (0x4) and if the quantity is 2 or more, the buffered string will be pluralized ("IES" or "S" appended). If the specified item is the Enigma Berry, I have no idea what this command does (but testing showed no pluralization). If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
+ @ Writes the name of the specified (item) item to the specified buffer. If the specified item is a Berry (0x85 - 0xAE) or
+ @ Poke Ball (0x4) and if the quantity is 2 or more, the buffered string will be pluralized ("IES" or "S" appended).
+ @ If the specified item is the Enigma Berry, I have no idea what this command does (but testing showed no pluralization).
+ @ If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
.macro bufferitemnameplural out:req, item:req, quantity:req
.byte 0xe2
.byte \out
diff --git a/asm/macros/trainer_hill.inc b/asm/macros/trainer_hill.inc
index d5c84fd02..65c8c6bef 100644
--- a/asm/macros/trainer_hill.inc
+++ b/asm/macros/trainer_hill.inc
@@ -52,9 +52,9 @@
special CallTrainerHillFunction
.endm
- @ Unknown, dummied. Only side effect is setting VAR_RESULT to 0.
- .macro trainerhill_clearresult
- setvar VAR_0x8004, TRAINER_HILL_FUNC_CLEAR_RESULT
+ @ Unknown, dummied. E-Reader association is assumed. Only side effect is setting VAR_RESULT to 0.
+ .macro trainerhill_getusingereader
+ setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_IN_EREADER_MODE
special CallTrainerHillFunction
.endm