From ef1f9ead0ba44c67185dccc616846646d7ce9257 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 23 Jan 2020 14:46:03 -0500 Subject: Document Trainer Tower scripts --- asm/macros/trainer_tower.inc | 133 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 asm/macros/trainer_tower.inc (limited to 'asm/macros') diff --git a/asm/macros/trainer_tower.inc b/asm/macros/trainer_tower.inc new file mode 100644 index 000000000..3a97b3ffd --- /dev/null +++ b/asm/macros/trainer_tower.inc @@ -0,0 +1,133 @@ + @ Sets NPC gfx and the floor layout depending on current challenge and floor + .macro ttower_initfloor + setvar VAR_0x8004, TRAINER_TOWER_FUNC_INIT_FLOOR + special CallTrainerTowerFunc + .endm + + @ Buffers the opponents battle speech to gStringVar4. speech is any TRAINER_TOWER_TEXT_*. + .macro ttower_getspeech speech:req, trainer=0xFF + setvar VAR_0x8004, TRAINER_TOWER_FUNC_GET_SPEECH + setvar VAR_0x8005, \speech + .if \trainer >= VARS_START && \trainer != 0xFF + copyvar VAR_0x8006, \trainer + .elseif \trainer != 0xFF + setvar VAR_0x8006, \trainer + .endif + special CallTrainerTowerFunc + .endm + + @ Starts a trainer tower battle. VAR_0x8005 is unused + .macro ttower_dobattle + setvar VAR_0x8004, TRAINER_TOWER_FUNC_DO_BATTLE + setvar VAR_0x8005, 0 + special CallTrainerTowerFunc + .endm + + @ Returns the current challenge type (CHALLENGE_TYPE_*). Mixed challenges use different types for each floor. If VAR_0x8005 is != FALSE, does nothing + .macro ttower_getchallengetype + setvar VAR_0x8004, TRAINER_TOWER_FUNC_GET_CHALLENGE_TYPE + setvar VAR_0x8005, FALSE + special CallTrainerTowerFunc + .endm + + @ Adds 1 to the number of floors cleared (all trainers on floor defeated) + .macro ttower_clearedfloor + setvar VAR_0x8004, TRAINER_TOWER_FUNC_CLEARED_FLOOR + special CallTrainerTowerFunc + .endm + + @ TRUE if the trainers on this floor were already beaten, FALSE otherwise + .macro ttower_isfloorbeaten + setvar VAR_0x8004, TRAINER_TOWER_FUNC_GET_FLOOR_BEATEN + special CallTrainerTowerFunc + .endm + + @ Initializes the Trainer Tower challenge and starts the timer + .macro ttower_startchallenge + setvar VAR_0x8004, TRAINER_TOWER_FUNC_START_CHALLENGE + special CallTrainerTowerFunc + .endm + + @ 0 if not spoken to yet, 1 if spoken to but not received prize, 2 if received prize + .macro ttower_getownerstate + setvar VAR_0x8004, TRAINER_TOWER_FUNC_GET_OWNER_STATE + special CallTrainerTowerFunc + .endm + + @ Tries to give prize. 0 if given successfully, 1 if no room for prize, 2 if giving prize should be skipped + .macro ttower_giveprize + setvar VAR_0x8004, TRAINER_TOWER_FUNC_GIVE_PRIZE + special CallTrainerTowerFunc + .endm + + @ Checks the final challenge time. 0 if new record, 1 if not, 2 if time has already been checked + .macro ttower_checkfinaltime + setvar VAR_0x8004, TRAINER_TOWER_FUNC_CHECK_FINAL_TIME + special CallTrainerTowerFunc + .endm + + @ Resumes the challenge timer (or starts, if the timer is 0) + .macro ttower_resumetimer + setvar VAR_0x8004, TRAINER_TOWER_FUNC_RESUME_TIMER + special CallTrainerTowerFunc + .endm + + @ Sets that the player lost the challenge + .macro ttower_setlost + setvar VAR_0x8004, TRAINER_TOWER_FUNC_SET_LOST + special CallTrainerTowerFunc + .endm + + @ Returns the status of the current Trainer Tower challenge (CHALLENGE_STATUS_*) + .macro ttower_getchallengestatus + setvar VAR_0x8004, TRAINER_TOWER_FUNC_GET_CHALLENGE_STATUS + special CallTrainerTowerFunc + .endm + + @ Buffers the current challenge time (min in gStringVar1, sec in gStringVar2, fraction sec in gStringVar3) + .macro ttower_gettime + setvar VAR_0x8004, TRAINER_TOWER_FUNC_GET_TIME + special CallTrainerTowerFunc + .endm + + @ Unused. Displays Trainer Tower results. Handled by Special_BattleRecords instead + .macro ttower_showresults + setvar VAR_0x8004, TRAINER_TOWER_FUNC_SHOW_RESULTS + special CallTrainerTowerFunc + .endm + + @ Unused. See above + .macro ttower_closeresults + setvar VAR_0x8004, TRAINER_TOWER_FUNC_CLOSE_RESULTS + special CallTrainerTowerFunc + .endm + + @ Returns the eligibility of the players party for a double battle (using GetMonsStateToDoubles) + .macro ttower_checkdoubles + setvar VAR_0x8004, TRAINER_TOWER_FUNC_CHECK_DOUBLES + special CallTrainerTowerFunc + .endm + + @ For the unused E-Reader challenges, gets the number of floors used. Otherwise returns FALSE (all floors used) + .macro ttower_getnumfloors + setvar VAR_0x8004, TRAINER_TOWER_FUNC_GET_NUM_FLOORS + special CallTrainerTowerFunc + .endm + + @ Dummied, always returns FALSE + .macro ttower_shouldexit + setvar VAR_0x8004, TRAINER_TOWER_FUNC_SHOULD_WARP_TO_COUNTER + special CallTrainerTowerFunc + .endm + + @ Plays the encounter music for the trainer number in VAR_TEMP_1 + .macro ttower_encountermusic + setvar VAR_0x8004, TRAINER_TOWER_FUNC_ENCOUNTER_MUSIC + special CallTrainerTowerFunc + .endm + + @ TRUE if the player reached the Battle Tower owner, FALSE otherwise + .macro ttower_getbeatchallenge + setvar VAR_0x8004, TRAINER_TOWER_FUNC_GET_BEAT_CHALLENGE + special CallTrainerTowerFunc + .endm -- cgit v1.2.3 From c63a889bf45d9cd6da0668703fad55941e531fa2 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 24 Jan 2020 05:09:50 -0500 Subject: Floor beaten --> floor cleared --- asm/macros/trainer_tower.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'asm/macros') diff --git a/asm/macros/trainer_tower.inc b/asm/macros/trainer_tower.inc index 3a97b3ffd..8e5f606ee 100644 --- a/asm/macros/trainer_tower.inc +++ b/asm/macros/trainer_tower.inc @@ -37,8 +37,8 @@ .endm @ TRUE if the trainers on this floor were already beaten, FALSE otherwise - .macro ttower_isfloorbeaten - setvar VAR_0x8004, TRAINER_TOWER_FUNC_GET_FLOOR_BEATEN + .macro ttower_isfloorcleared + setvar VAR_0x8004, TRAINER_TOWER_FUNC_GET_FLOOR_CLEARED special CallTrainerTowerFunc .endm -- cgit v1.2.3 From e94f9c148358f2e25e6ebbd58d39eb9ddd27f7c3 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 18 Feb 2020 14:52:42 -0500 Subject: Name allow_escaping, allow_running, show_map_name header properties --- asm/macros/map.inc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'asm/macros') diff --git a/asm/macros/map.inc b/asm/macros/map.inc index d903899fe..0f35bf959 100644 --- a/asm/macros/map.inc +++ b/asm/macros/map.inc @@ -88,3 +88,8 @@ map \map .space 2 .endm + + .macro map_header_flags allow_cycling:req, allow_escaping:req, allow_running:req, show_map_name:req + .byte \allow_cycling + .byte ((\show_map_name & 1) << 2) | ((\allow_running & 1) << 1) | ((\allow_escaping & 1) << 0) + .endm -- cgit v1.2.3 From 2a2db28e57e78eb8861997422f998378d91bf9dc Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 18 Feb 2020 18:13:31 -0500 Subject: Split connection field from graphics id in object events --- asm/macros/map.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'asm/macros') diff --git a/asm/macros/map.inc b/asm/macros/map.inc index 0f35bf959..881ffdbb4 100644 --- a/asm/macros/map.inc +++ b/asm/macros/map.inc @@ -14,9 +14,10 @@ .4byte \address .endm - .macro object_event index:req, gfx:req, x:req, y:req, elevation:req, movement_type:req, x_radius:req, y_radius:req, trainer_type:req, sight_radius_tree_etc:req, script:req, event_flag:req + .macro object_event index:req, gfx:req, in_connection:req x:req, y:req, elevation:req, movement_type:req, x_radius:req, y_radius:req, trainer_type:req, sight_radius_tree_etc:req, script:req, event_flag:req .byte \index - .2byte \gfx + .byte \gfx + .byte \in_connection .byte 0 .2byte \x, \y .byte \elevation, \movement_type, ((\y_radius << 4) | \x_radius), 0 -- cgit v1.2.3 From 1aa1f189721ba9c21597bae047282c4a785ab400 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 3 Mar 2020 14:42:15 -0500 Subject: Sync trainer_battle.inc --- asm/macros/movement.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'asm/macros') diff --git a/asm/macros/movement.inc b/asm/macros/movement.inc index c4ca78010..9f11f4460 100644 --- a/asm/macros/movement.inc +++ b/asm/macros/movement.inc @@ -109,7 +109,7 @@ create_movement emote_x create_movement emote_double_exclamation_mark create_movement emote_smile - create_movement step_67 + create_movement reveal_trainer create_movement rock_smash_break create_movement cut_tree -- cgit v1.2.3 From 7af1b35d17b7077b13e04c2717b48a55960fa8ce Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 3 Mar 2020 16:18:45 -0500 Subject: Sync some specials/drop unnecessary prefixes --- asm/macros/event.inc | 2 +- asm/macros/trainer_tower.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'asm/macros') diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 51f8e7330..35314ac3f 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -1629,7 +1629,7 @@ @ Jumps to dest if the Quest Log is currently showing playback scenes (dest is usually a release/end) .macro goto_if_questlog dest:req - special Special_GetQuestLogState + special GetQuestLogState compare VAR_RESULT, 2 goto_if_eq \dest .endm diff --git a/asm/macros/trainer_tower.inc b/asm/macros/trainer_tower.inc index 8e5f606ee..94d9efe77 100644 --- a/asm/macros/trainer_tower.inc +++ b/asm/macros/trainer_tower.inc @@ -90,7 +90,7 @@ special CallTrainerTowerFunc .endm - @ Unused. Displays Trainer Tower results. Handled by Special_BattleRecords instead + @ Unused. Displays Trainer Tower results. Handled by ShowBattleRecords instead .macro ttower_showresults setvar VAR_0x8004, TRAINER_TOWER_FUNC_SHOW_RESULTS special CallTrainerTowerFunc -- cgit v1.2.3