diff options
author | Marcus Huderle <huderlem@gmail.com> | 2020-01-13 20:26:20 -0600 |
---|---|---|
committer | Marcus Huderle <huderlem@gmail.com> | 2020-01-13 20:26:20 -0600 |
commit | 5a2d676e71b720e752ca8a624a5795b3b1d7eb6c (patch) | |
tree | 6ef755064008dfae8ce2942dc2762670cdabe815 /asm/macros/battle_frontier | |
parent | 5007d279fea5326b41b877703c74fcaa56223364 (diff) | |
parent | 22931846d680de2bc585093678db3f5721aab891 (diff) |
Merge remote-tracking branch 'upstream' into tustin2121-patch-5
Diffstat (limited to 'asm/macros/battle_frontier')
-rw-r--r-- | asm/macros/battle_frontier/apprentice.inc | 154 | ||||
-rw-r--r-- | asm/macros/battle_frontier/battle_arena.inc | 49 | ||||
-rw-r--r-- | asm/macros/battle_frontier/battle_dome.inc | 144 | ||||
-rw-r--r-- | asm/macros/battle_frontier/battle_factory.inc | 101 | ||||
-rw-r--r-- | asm/macros/battle_frontier/battle_palace.inc | 63 | ||||
-rw-r--r-- | asm/macros/battle_frontier/battle_pike.inc | 171 | ||||
-rw-r--r-- | asm/macros/battle_frontier/battle_pyramid.inc | 104 | ||||
-rw-r--r-- | asm/macros/battle_frontier/battle_tower.inc | 91 | ||||
-rw-r--r-- | asm/macros/battle_frontier/frontier_util.inc | 153 |
9 files changed, 1030 insertions, 0 deletions
diff --git a/asm/macros/battle_frontier/apprentice.inc b/asm/macros/battle_frontier/apprentice.inc new file mode 100644 index 000000000..5d9ab8e3b --- /dev/null +++ b/asm/macros/battle_frontier/apprentice.inc @@ -0,0 +1,154 @@ + @ TRUE if the player has talked to the Apprentice and answered their level mode question + .macro apprentice_gavelvlmode + setvar VAR_0x8004, APPRENTICE_FUNC_GAVE_LVLMODE + special CallApprenticeFunction + .endm + + @ Set the level mode the Apprentice should battle in + .macro apprentice_setlvlmode lvlmode:req + setvar VAR_0x8004, APPRENTICE_FUNC_SET_LVLMODE + setorcopyvar VAR_0x8005, \lvlmode + addvar VAR_0x8005, 1 @ Apprentice lvl mode is +1 from regular lvl mode value + special CallApprenticeFunction + .endm + + @ Question was answered, increment the number of questions answered + .macro apprentice_answeredquestion + setvar VAR_0x8004, APPRENTICE_FUNC_ANSWERED_QUESTION + special CallApprenticeFunction + .endm + + @ Show the response selection box to answer the Apprentice question. Menus are defined as APPRENTICE_ASK_* + .macro apprentice_menu which:req + setvar VAR_0x8004, APPRENTICE_FUNC_MENU + setvar VAR_0x8005, \which + special CallApprenticeFunction + waitstate + .endm + + @ Shuffle and set the Apprentice party mons to pick between from their list of possible party species + .macro apprentice_shufflespecies + setvar VAR_0x8004, APPRENTICE_FUNC_SHUFFLE_SPECIES + special CallApprenticeFunction + .endm + + @ Randomize the question data (e.g. moves to pick between) and shuffle the order to ask them in + .macro apprentice_randomizequestions + setvar VAR_0x8004, APPRENTICE_FUNC_RANDOMIZE_QUESTIONS + special CallApprenticeFunction + .endm + + @ Print the APPRENTICE_MSG_* text for the current Apprentice + .macro apprentice_msg waitbuttonpress:req, which:req + setvar VAR_0x8004, APPRENTICE_FUNC_PRINT_MSG + setvar VAR_0x8005, \waitbuttonpress + setvar VAR_0x8006, \which + special CallApprenticeFunction + waitstate + .endm + + @ Clear the data for the current Player Apprentice + .macro apprentice_reset + setvar VAR_0x8004, APPRENTICE_FUNC_RESET + special CallApprenticeFunction + .endm + + @ Always returns TRUE. No side effect. May have been for debug or dummied for some other reason + .macro apprentice_shouldcheckgone + setvar VAR_0x8004, APPRENTICE_FUNC_CHECK_GONE + special CallApprenticeFunction + .endm + + @ Return the APPRENTICE_QUESTION_* value for the current question to ask + .macro apprentice_getquestion + setvar VAR_0x8004, APPRENTICE_FUNC_GET_QUESTION + special CallApprenticeFunction + .endm + + @ Get the number of mons that have been chosen for the Apprentice's party so far + .macro apprentice_getnumpartymons + setvar VAR_0x8004, APPRENTICE_FUNC_GET_NUM_PARTY_MONS + special CallApprenticeFunction + .endm + + @ Set the Apprentice party mon at the given slot. VAR_0x8005 is used implicitly as which of the 2 mons was selected + .macro apprentice_setpartymon slot:req + copyvar VAR_0x8006, \slot + setvar VAR_0x8004, APPRENTICE_FUNC_SET_PARTY_MON + special CallApprenticeFunction + .endm + + @ Allocate and set up data to track about the question + .macro apprentice_initquestion which:req + setvar VAR_0x8004, APPRENTICE_FUNC_INIT_QUESTION_DATA + setvar VAR_0x8005, \which + special CallApprenticeFunction + .endm + + @ Free allocated question data + .macro apprentice_freequestion + setvar VAR_0x8004, APPRENTICE_FUNC_FREE_QUESTION_DATA + special CallApprenticeFunction + .endm + + @ Buffer some APPRENTICE_BUFF_* string to the given stringvar (0 for STR_VAR_1, 1 for STR_VAR_2, 2 for STR_VAR_3) + .macro apprentice_buff stringvar:req, tobuff:req + setvar VAR_0x8004, APPRENTICE_FUNC_BUFFER_STRING + setvar VAR_0x8005, \stringvar + .if \tobuff >= VARS_START + copyvar VAR_0x8006, \tobuff + .else + setvar VAR_0x8006, \tobuff + .endif + special CallApprenticeFunction + .endm + + @ Set which move to use that the player chose (implicitly VAR_0x8005) + .macro apprentice_setmove + setvar VAR_0x8004, APPRENTICE_FUNC_SET_MOVE + special CallApprenticeFunction + .endm + + @ Set which mon the Apprentice should lead with + .macro apprentice_setleadmon monId:req + copyvar VAR_0x8005, \monId + setvar VAR_0x8004, APPRENTICE_FUNC_SET_LEAD_MON + special CallApprenticeFunction + .endm + + @ Open the Bag Menu for the player to choose an item to recommend as a held item + .macro apprentice_openbag + setvar VAR_0x8004, APPRENTICE_FUNC_OPEN_BAG + special CallApprenticeFunction + waitstate + .endm + + @ Try and set the recommended held item. FALSE if the item has been recommended before, as Battle Frontier forbids using the same held item for multiple party mons + .macro apprentice_trysetitem + setvar VAR_0x8004, APPRENTICE_FUNC_TRY_SET_HELD_ITEM + special CallApprenticeFunction + .endm + + @ Save the current Player Apprentice to the saveblock to make room for a new Apprentice + .macro apprentice_save + setvar VAR_0x8004, APPRENTICE_FUNC_SAVE + special CallApprenticeFunction + .endm + + @ Set the object event gfx for the Apprentice based on their trainer class + .macro apprentice_setgfx + setvar VAR_0x8004, APPRENTICE_FUNC_SET_GFX + special CallApprenticeFunction + .endm + + @ Always returns TRUE. No side effect. May have been for debug or dummied for some other reason + .macro apprentice_shouldleave + setvar VAR_0x8004, APPRENTICE_FUNC_SHOULD_LEAVE + special CallApprenticeFunction + .endm + + @ Shift the other saved Apprentices over to make room for saving a new Apprentice + .macro apprentice_shiftsaved + setvar VAR_0x8004, APPRENTICE_FUNC_SHIFT_SAVED + special CallApprenticeFunction + .endm diff --git a/asm/macros/battle_frontier/battle_arena.inc b/asm/macros/battle_frontier/battle_arena.inc new file mode 100644 index 000000000..8280f5845 --- /dev/null +++ b/asm/macros/battle_frontier/battle_arena.inc @@ -0,0 +1,49 @@ + @ Initialize the Battle Arena challenge + .macro arena_init + setvar VAR_0x8004, BATTLE_ARENA_FUNC_INIT + special CallBattleArenaFunction + .endm + + @ Unused. Get the value of some ARENA_DATA_*. See GetArenaData for the data types that can be retrieved + .macro arena_get data:req + setvar VAR_0x8004, BATTLE_ARENA_FUNC_GET_DATA + setvar VAR_0x8005, \data + special CallBattleArenaFunction + .endm + + @ Set some ARENA_DATA_* to val. See SetArenaData for the data types that can be set + .macro arena_set data:req, val:req + setvar VAR_0x8004, BATTLE_ARENA_FUNC_SET_DATA + setvar VAR_0x8005, \data + .if \val >= VARS_START + copyvar VAR_0x8006, \val + .else + setvar VAR_0x8006, \val + .endif + special CallBattleArenaFunction + .endm + + @ Save the game and set the challenge status + .macro arena_save challengeStatus:req + setvar VAR_0x8004, BATTLE_ARENA_FUNC_SAVE + setvar VAR_0x8005, \challengeStatus + special CallBattleArenaFunction + .endm + + @ Unused. Set the prize item to give from one of two lists of possible prizes, depending on streak. + .macro arena_setprize + setvar VAR_0x8004, BATTLE_ARENA_FUNC_SET_PRIZE + special CallBattleArenaFunction + .endm + + @ Unused. Give the set prize item to the player. TRUE if room in Bag for prize, FALSE otherwise + .macro arena_giveprize + setvar VAR_0x8004, BATTLE_ARENA_FUNC_GIVE_PRIZE + special CallBattleArenaFunction + .endm + + @ Buffer the opponents name to STR_VAR_1 + .macro arena_gettrainername + setvar VAR_0x8004, BATTLE_ARENA_FUNC_GET_TRAINER_NAME + special CallBattleArenaFunction + .endm diff --git a/asm/macros/battle_frontier/battle_dome.inc b/asm/macros/battle_frontier/battle_dome.inc new file mode 100644 index 000000000..9adbcc54e --- /dev/null +++ b/asm/macros/battle_frontier/battle_dome.inc @@ -0,0 +1,144 @@ + @ Initialize the Battle Dome challenge + .macro dome_init + setvar VAR_0x8004, BATTLE_DOME_FUNC_INIT + special CallBattleDomeFunction + .endm + + @ Get the value of some DOME_DATA_*. See GetDomeData for the data types that can be retrieved + .macro dome_get data:req + setvar VAR_0x8004, BATTLE_DOME_FUNC_GET_DATA + setvar VAR_0x8005, \data + special CallBattleDomeFunction + .endm + + @ Set some DOME_DATA_* to val. See SetDomeData for the data types that can be set + .macro dome_set data:req, val=0xFFFF + setvar VAR_0x8004, BATTLE_DOME_FUNC_SET_DATA + setvar VAR_0x8005, \data + .if \val != 0xFFFF + setvar VAR_0x8006, \val + .endif + special CallBattleDomeFunction + .endm + + @ Buffer the name of the current round to gStringVar1 + .macro dome_getroundtext + setvar VAR_0x8004, BATTLE_DOME_FUNC_GET_ROUND_TEXT + special CallBattleDomeFunction + .endm + + @ Buffer the name of the opponent to gStringVar2 and the name of the round to gStringVar1 + .macro dome_getopponentname + setvar VAR_0x8004, BATTLE_DOME_FUNC_GET_OPPONENT_NAME + special CallBattleDomeFunction + .endm + + @ Choose which of the opponents mons to use in battle and load them into the enemy party + .macro dome_initopponentparty + setvar VAR_0x8004, BATTLE_DOME_FUNC_INIT_OPPONENT_PARTY + special CallBattleDomeFunction + .endm + + @ Show the page that gives information on the next opponent + .macro dome_showopponentinfo + setvar VAR_0x8004, BATTLE_DOME_FUNC_SHOW_OPPONENT_INFO + special CallBattleDomeFunction + .endm + + @ Displays the tourney tree for the current tourney + .macro dome_showtourneytree + setvar VAR_0x8004, BATTLE_DOME_FUNC_SHOW_TOURNEY_TREE + special CallBattleDomeFunction + .endm + + @ Displays the tourney tree for the results of the previous tourney. Before the player enters their first tourney this is a random tourney generated by dome_initresultstree + .macro dome_showprevtourneytree + setvar VAR_0x8004, BATTLE_DOME_FUNC_SHOW_PREV_TOURNEY_TREE + special CallBattleDomeFunction + .endm + + @ Sets gTrainerBattleOpponent_A to the trainer ID of the next opponent + .macro dome_setopponent + setvar VAR_0x8004, BATTLE_DOME_FUNC_SET_OPPONENT_ID + special CallBattleDomeFunction + .endm + + @ Set the object event gfx id for the opponent + .macro dome_setopponentgfx + setvar VAR_0x8004, BATTLE_DOME_FUNC_SET_OPPONENT_GFX + special CallBattleDomeFunction + .endm + + @ A non-interactive version of the tourney tree shown when a round is completed + .macro dome_showstatictourneytree + setvar VAR_0x8004, BATTLE_DOME_FUNC_SHOW_STATIC_TOURNEY_TREE + special CallBattleDomeFunction + .endm + + @ Decides the winners of NPC vs NPC matches, and eliminates either the player or their opponent depending on the playerStatus (DOME_PLAYER_*) + .macro dome_resolvewinners playerStatus:req + setvar VAR_0x8004, BATTLE_DOME_FUNC_RESOLVE_WINNERS + setvar VAR_0x8005, \playerStatus + special CallBattleDomeFunction + .endm + + @ Save the game and set the challenge status + .macro dome_save challengeStatus:req + setvar VAR_0x8004, BATTLE_DOME_FUNC_SAVE + setvar VAR_0x8005, \challengeStatus + special CallBattleDomeFunction + .endm + + @ Unused. Increment the win streaks for the current challenge by one + .macro dome_incrementstreaks + setvar VAR_0x8004, BATTLE_DOME_FUNC_INCREMENT_STREAK + special CallBattleDomeFunction + .endm + + @ Sets the facility trainer/mon set pointers + .macro dome_settrainers + setvar VAR_0x8004, BATTLE_DOME_FUNC_SET_TRAINERS + special CallBattleDomeFunction + .endm + + @ If any moves were copied using Sketch during the challenge then restore them to Sketch + .macro dome_resetsketch + setvar VAR_0x8004, BATTLE_DOME_FUNC_RESET_SKETCH + special CallBattleDomeFunction + .endm + + @ Reset the held items of the mons that just battled to what they were prior to battling + .macro dome_restorehelditems + setvar VAR_0x8004, BATTLE_DOME_FUNC_RESTORE_HELD_ITEMS + special CallBattleDomeFunction + .endm + + @ Reduce the players party to the selected mons, used to reduce down to the 2 selected for battle + .macro dome_reduceparty + setvar VAR_0x8004, BATTLE_DOME_FUNC_REDUCE_PARTY + special CallBattleDomeFunction + .endm + + @ Compares the initial tournament ranking (seed) of the player to opponent A. Returns 1 if the player's seed is better, 2 if the opponent's seed is better. + .macro dome_compareseeds + setvar VAR_0x8004, BATTLE_DOME_FUNC_COMPARE_SEEDS + special CallBattleDomeFunction + .endm + + @ Buffer the name of the winner for the last Dome challenge to STR_VAR_1 + .macro dome_getwinnersname + setvar VAR_0x8004, BATTLE_DOME_FUNC_GET_WINNER_NAME + special CallBattleDomeFunction + .endm + + @ Performs a random tourney to initialize the results board before the player has entered a challenge + .macro dome_initresultstree + setvar VAR_0x8004, BATTLE_DOME_FUNC_INIT_RESULTS_TREE + special CallBattleDomeFunction + .endm + + @ Generates the tourney trainers and their parties, and seeds them in the tourney tree + .macro dome_inittrainers + setvar VAR_0x8004, BATTLE_DOME_FUNC_INIT_TRAINERS + special CallBattleDomeFunction + .endm diff --git a/asm/macros/battle_frontier/battle_factory.inc b/asm/macros/battle_frontier/battle_factory.inc new file mode 100644 index 000000000..684eeb98d --- /dev/null +++ b/asm/macros/battle_frontier/battle_factory.inc @@ -0,0 +1,101 @@ + @ Initialize the Battle Factory challenge + .macro factory_init + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_INIT + special CallBattleFactoryFunction + .endm + + @ Get the value of some FACTORY_DATA_*. See GetBattleFactoryData for the data types that can be retrieved + .macro factory_get data:req + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_GET_DATA + setvar VAR_0x8005, \data + special CallBattleFactoryFunction + .endm + + @ Set some FACTORY_DATA_* to val. See SetBattleFactoryData for the data types that can be set + .macro factory_set data:req, val=0xFFFF + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_SET_DATA + setvar VAR_0x8005, \data + .if \val == 0xFFFF + @ argument not provided + .elseif \val >= VARS_START + copyvar VAR_0x8006, \val + .else + setvar VAR_0x8006, \val + .endif + special CallBattleFactoryFunction + .endm + + @ Save the game and set the challenge status + .macro factory_save challengeStatus:req + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_SAVE + setvar VAR_0x8005, \challengeStatus + special CallBattleFactoryFunction + .endm + + @ Select the initial rental mons for the challenge + .macro factory_rentmons + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_SELECT_RENT_MONS + special CallBattleFactoryFunction + .endm + + @ Select a mon to swap for from the previously defeated team + .macro factory_swapmons + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_SWAP_RENT_MONS + special CallBattleFactoryFunction + .endm + + @ Allows FACTORY_DATA_WIN_STREAK_SWAPS to be incremented once + .macro factory_setswapped + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_SET_SWAPPED + special CallBattleFactoryFunction + .endm + + @ Update gEnemyParty with the next set of rental mons + .macro factory_setopponentmons + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_SET_OPPONENT_MONS + special CallBattleFactoryFunction + .endm + + @ Populate gPlayerParty and gEnemyParty with the rental mons. Only needed when resuming a challenge, otherwise only factory_setopponentmons and factory_rentmons/factory_swapmons are needed + .macro factory_setparties arg:req + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_SET_PARTIES + setvar VAR_0x8005, \arg + special CallBattleFactoryFunction + .endm + + @ Set the object event gfx for the opponent trainer + .macro factory_setopponentgfx + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_SET_OPPONENT_GFX + special CallBattleFactoryFunction + .endm + + @ Generate the mons for the opponents team + .macro factory_generateopponentmons + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_GENERATE_OPPONENT_MONS + special CallBattleFactoryFunction + .endm + + @ Generate the random 6 mons to choose from for the initial rental + .macro factory_generaterentalmons + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_GENERATE_RENTAL_MONS + special CallBattleFactoryFunction + .endm + + @ Return the pokemon type most common in the opponents team, or NUMBER_OF_MON_TYPES if there is no standout type + .macro factory_getopponentmontype + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_GET_OPPONENT_MON_TYPE + special CallBattleFactoryFunction + .endm + + @ Return the FACTORY_STYLE_* dependent on what types of moves the opponents team has, or FACTORY_NUM_STYLES if multiple styles tie for the same amount of moves + .macro factory_getopponentstyle + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_GET_OPPONENT_STYLE + special CallBattleFactoryFunction + .endm + + @ Restore the held items for the players party to what they were pre-battle + .macro factory_resethelditems + setvar VAR_0x8004, BATTLE_FACTORY_FUNC_RESET_HELD_ITEMS + special CallBattleFactoryFunction + .endm + diff --git a/asm/macros/battle_frontier/battle_palace.inc b/asm/macros/battle_frontier/battle_palace.inc new file mode 100644 index 000000000..f326c1154 --- /dev/null +++ b/asm/macros/battle_frontier/battle_palace.inc @@ -0,0 +1,63 @@ + @ Initialize the Battle Palace challenge + .macro palace_init + setvar VAR_0x8004, BATTLE_PALACE_FUNC_INIT + special CallBattlePalaceFunction + .endm + + @ Get the value of some PALACE_DATA_*. See GetPalaceData for the data types that can be retrieved + .macro palace_get data:req + setvar VAR_0x8004, BATTLE_PALACE_FUNC_GET_DATA + setvar VAR_0x8005, \data + special CallBattlePalaceFunction + .endm + + @ Set some PALACE_DATA_* to val. See SetPalaceData for the data types that can be set + .macro palace_set data:req, val:req + setvar VAR_0x8004, BATTLE_PALACE_FUNC_SET_DATA + setvar VAR_0x8005, \data + setvar VAR_0x8006, \val + special CallBattlePalaceFunction + .endm + + @ Get the id of the comment to be made while being led through the corridor + .macro palace_getcomment + setvar VAR_0x8004, BATTLE_PALACE_FUNC_GET_COMMENT_ID + special CallBattlePalaceFunction + .endm + + @ Unused. Choose and set the opponent gfx id. The equivalent macro from Battle Tower is used instead + .macro palace_setopponent + setvar VAR_0x8004, BATTLE_PALACE_FUNC_SET_OPPONENT + special CallBattlePalaceFunction + .endm + + @ Buffer the opponents intro speech to gStringVar4. Also used by Battle Arena and Factory + .macro palace_getopponentintro + setvar VAR_0x8004, BATTLE_PALACE_FUNC_GET_OPPONENT_INTRO + special CallBattlePalaceFunction + .endm + + @ Increments the current win streak by 1 + .macro palace_incrementstreak + setvar VAR_0x8004, BATTLE_PALACE_FUNC_INCREMENT_STREAK + special CallBattlePalaceFunction + .endm + + @ Save the game and set the challenge status + .macro palace_save challengeStatus:req + setvar VAR_0x8004, BATTLE_PALACE_FUNC_SAVE + setvar VAR_0x8005, \challengeStatus + special CallBattlePalaceFunction + .endm + + @ Unused. Set the prize item to give from one of two lists of possible prizes, depending on streak. + .macro palace_setprize + setvar VAR_0x8004, BATTLE_PALACE_FUNC_SET_PRIZE + special CallBattleArenaFunction + .endm + + @ Unused. Give the set prize item to the player. TRUE if room in Bag for prize, FALSE otherwise + .macro palace_giveprize + setvar VAR_0x8004, BATTLE_PALACE_FUNC_GIVE_PRIZE + special CallBattleArenaFunction + .endm diff --git a/asm/macros/battle_frontier/battle_pike.inc b/asm/macros/battle_frontier/battle_pike.inc new file mode 100644 index 000000000..30f5c88d8 --- /dev/null +++ b/asm/macros/battle_frontier/battle_pike.inc @@ -0,0 +1,171 @@ + @ Set sRoomType to the next PIKE_ROOM_* id + .macro pike_setnextroom + setvar VAR_0x8004, BATTLE_PIKE_FUNC_SET_ROOM_TYPE + special CallBattlePikeFunction + .endm + + @ Get the value of some PIKE_DATA_*. See GetBattlePikeData for the data types that can be retrieved + .macro pike_get data:req + setvar VAR_0x8004, BATTLE_PIKE_FUNC_GET_DATA + setvar VAR_0x8005, \data + special CallBattlePikeFunction + .endm + + @ Set some PIKE_DATA_* to val. See SetBattlePikeData for the data types that can be set + .macro pike_set data:req, val:req + setvar VAR_0x8004, BATTLE_PIKE_FUNC_SET_DATA + setvar VAR_0x8005, \data + .if \val >= VARS_START + copyvar VAR_0x8006, \val + .else + setvar VAR_0x8006, \val + .endif + special CallBattlePikeFunction + .endm + + @ TRUE if the next room is the last (15th) room, FALSE otherwise + .macro pike_isfinalroom + setvar VAR_0x8004, BATTLE_PIKE_FUNC_IS_FINAL_ROOM + special CallBattlePikeFunction + .endm + + @ Set the object event gfx for the room being entered + .macro pike_setroomobjects + setvar VAR_0x8004, BATTLE_PIKE_FUNC_SET_ROOM_OBJECTS + special CallBattlePikeFunction + .endm + + @ Get the current room type (sRoomType) + .macro pike_getroomtype + setvar VAR_0x8004, BATTLE_PIKE_FUNC_GET_ROOM_TYPE + special CallBattlePikeFunction + .endm + + @ Sets a bool that's never read + .macro pike_inwildmonroom + setvar VAR_0x8004, BATTLE_PIKE_FUNC_SET_IN_WILD_MON_ROOM + special CallBattlePikeFunction + .endm + + @ Clears a bool that's never read + .macro pike_exitwildmonroom + setvar VAR_0x8004, BATTLE_PIKE_FUNC_CLEAR_IN_WILD_MON_ROOM + special CallBattlePikeFunction + .endm + + @ Save the game and set the challenge status + .macro pike_save challengeStatus:req + setvar VAR_0x8004, BATTLE_PIKE_FUNC_SAVE + setvar VAR_0x8005, \challengeStatus + special CallBattlePikeFunction + .endm + + @ Returns the PIKE_STATUS_* to be afflicted for the status room + .macro pike_getstatus + setvar VAR_0x8004, BATTLE_PIKE_FUNC_GET_ROOM_STATUS + special CallBattlePikeFunction + .endm + + @ Returns the PIKE_STATUSMON_* that attacks the player for the status room + .macro pike_getstatusmon + setvar VAR_0x8004, BATTLE_PIKE_FUNC_GET_ROOM_STATUS_MON + special CallBattlePikeFunction + .endm + + @ Randomly heals either one or two party mons and returns the number of mons healed + .macro pike_healonetwomons + setvar VAR_0x8004, BATTLE_PIKE_FUNC_HEAL_ONE_TWO_MONS + special CallBattlePikeFunction + .endm + + @ Buffers a message for the lone NPC in the NPC room to gStringVar4 + .macro pike_getnpcmsg + setvar VAR_0x8004, BATTLE_PIKE_FUNC_BUFFER_NPC_MSG + special CallBattlePikeFunction + .endm + + @ Flashes the screen 3 times for when the Dusclops/Kirlia attacks the player + .macro pike_flashscreen + setvar VAR_0x8004, BATTLE_PIKE_FUNC_STATUS_SCREEN_FLASH + special CallBattlePikeFunction + .endm + + @ TRUE if the player is currently in a Battle Pike challenge map + .macro pike_inchallenge + setvar VAR_0x8004, BATTLE_PIKE_FUNC_IS_IN + special CallBattlePikeFunction + .endm + + @ Set which room to give a hint about. TRUE if its the Pike Queens room next + .macro pike_sethintroom + setvar VAR_0x8004, BATTLE_PIKE_FUNC_SET_HINT_ROOM + special CallBattlePikeFunction + .endm + + @ Get PIKE_ROOM_(LEFT/CENTER/RIGHT) for which room to give a hint about + .macro pike_gethintroomid + setvar VAR_0x8004, BATTLE_PIKE_FUNC_GET_HINT_ROOM_ID + special CallBattlePikeFunction + .endm + + @ Get the PIKE_HINT_* to give about the next room + .macro pike_gethint + setvar VAR_0x8004, BATTLE_PIKE_FUNC_GET_ROOM_TYPE_HINT + special CallBattlePikeFunction + .endm + + @ Reset the frontier trainer ids for the start of the challenge + .macro pike_cleartrainerids + setvar VAR_0x8004, BATTLE_PIKE_FUNC_CLEAR_TRAINER_IDS + special CallBattlePikeFunction + .endm + + @ Buffer the opponents battle intro speech to gStringVar4. \trainer 0 for Trainer A, 1 for Trainer B + .macro pike_gettrainerintro trainer:req + setvar VAR_0x8004, BATTLE_PIKE_FUNC_GET_TRAINER_INTRO + setvar VAR_0x8005, \trainer + special CallBattlePikeFunction + .endm + + @ Get the status of the Pike Queen (Not ready, Silver/Gold streak before symbols, Silver/Gold streak after symbols) + .macro pike_getbrainstatus + setvar VAR_0x8004, BATTLE_PIKE_FUNC_GET_QUEEN_FIGHT_TYPE + special CallBattlePikeFunction + .endm + + @ Heal 0-2 party mons depending on which room was chosen for the Pike Queen battle. Return the number healed + .macro pike_prequeenheal + setvar VAR_0x8004, BATTLE_PIKE_FUNC_HEAL_MONS_BEFORE_QUEEN + special CallBattlePikeFunction + .endm + + @ When \set is TRUE, prevent healing rooms from appearing (for 1st room or when party is full health). \set FALSE to re-enable healing rooms + .macro pike_nohealing set:req + setvar VAR_0x8004, BATTLE_PIKE_FUNC_SET_HEAL_ROOMS_DISABLED + setvar VAR_0x8005, \set + special CallBattlePikeFunction + .endm + + @ TRUE if the party is full health (full HP, PP, and no status), FALSE otherwise + .macro pike_ispartyfullhealth + setvar VAR_0x8004, BATTLE_PIKE_FUNC_IS_PARTY_FULL_HEALTH + special CallBattlePikeFunction + .endm + + @ Save the party held items in pikeHeldItemsBackup + .macro pike_savehelditems + setvar VAR_0x8004, BATTLE_PIKE_FUNC_SAVE_HELD_ITEMS + special CallBattlePikeFunction + .endm + + @ Restore the party held items from pikeHeldItemsBackup + .macro pike_resethelditems + setvar VAR_0x8004, BATTLE_PIKE_FUNC_RESET_HELD_ITEMS + special CallBattlePikeFunction + .endm + + @ Initialize the Battle Pike challenge + .macro pike_init + setvar VAR_0x8004, BATTLE_PIKE_FUNC_INIT + special CallBattlePikeFunction + .endm diff --git a/asm/macros/battle_frontier/battle_pyramid.inc b/asm/macros/battle_frontier/battle_pyramid.inc new file mode 100644 index 000000000..f8141e2dd --- /dev/null +++ b/asm/macros/battle_frontier/battle_pyramid.inc @@ -0,0 +1,104 @@ + @ Initialize the Battle Pyramid challenge + .macro pyramid_init + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_INIT + special CallBattlePyramidFunction + .endm + + @ Get the value of some PYRAMID_DATA_*. See GetBattlePyramidData for the data types that can be retrieved + .macro pyramid_get data:req + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_GET_DATA + setvar VAR_0x8005, \data + special CallBattlePyramidFunction + .endm + + @ Set some PYRAMID_DATA_* to val. See SetBattlePyramidData for the data types that can be set + .macro pyramid_set data:req, val:req + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_SET_DATA + setvar VAR_0x8005, \data + setvar VAR_0x8006, \val + special CallBattlePyramidFunction + .endm + + @ Save the game and set the challenge status + .macro pyramid_save challengeStatus:req + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_SAVE + setvar VAR_0x8005, \challengeStatus + special CallBattlePyramidFunction + .endm + + @ Set the prize item to give from one of two lists of possible prizes, depending on streak. + .macro pyramid_setprize + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_SET_PRIZE + special CallBattlePyramidFunction + .endm + + @ Unused. Give the set prize item to the player. TRUE if room in Bag for prize, FALSE otherwise + .macro pyramid_giveprize + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_GIVE_PRIZE + special CallBattlePyramidFunction + .endm + + @ Set the random values for the floor (used to determine object positions, e.g.), and clear trainer flags + .macro pyramid_seedfloor + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_SEED_FLOOR + special CallBattlePyramidFunction + .endm + + @ Set the item to pick up depending on the random seed and quantity (always 1) to the arguments for STD_FIND_ITEM + .macro pyramid_setitem + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_SET_ITEM + special CallBattlePyramidFunction + .endm + + @ Hide the picked-up item (technically it moves the item far offscreen) + .macro pyramid_hideitem + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_HIDE_ITEM + special CallBattlePyramidFunction + .endm + + @ Set the facility trainers to gBattleFrontierTrainers + .macro pyramid_settrainers + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_SET_TRAINERS + special CallBattlePyramidFunction + .endm + + @ Show the post-battle hint text + .macro pyramid_showhint + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_SHOW_HINT_TEXT + special CallBattlePyramidFunction + .endm + + @ VAR_RESULT is 1 if player is on a Pyramid floor, 2 if on the Pyramid peak, 0 otherwise + .macro pyramid_inchallenge + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_IS_IN + special CallBattlePyramidFunction + .endm + + @ Update the light around the player. 2 different modes, for setting or incrementing light. See PYRAMID_LIGHT_* + .macro pyramid_updatelight radius:req, mode:req, sound=0xFFFF + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_UPDATE_LIGHT + setvar VAR_0x8005, \radius + setvar VAR_0x8006, \mode + .if \sound != 0xFFFF + setvar VAR_0x8007, \sound + .endif + special CallBattlePyramidFunction + .endm + + @ Reset the held items to what they were at the start of the challenge + .macro pyramid_clearhelditems + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_CLEAR_HELD_ITEMS + special CallBattlePyramidFunction + .endm + + @ Set the palette depending on current floor number + .macro pyramid_setfloorpal + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_SET_FLOOR_PALETTE + special CallBattlePyramidFunction + .endm + + @ Reset sketched moves and update the party order in the saveblock + .macro pyramid_resetparty + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_RESTORE_PARTY + special CallBattlePyramidFunction + .endm diff --git a/asm/macros/battle_frontier/battle_tower.inc b/asm/macros/battle_frontier/battle_tower.inc new file mode 100644 index 000000000..71e795b1d --- /dev/null +++ b/asm/macros/battle_frontier/battle_tower.inc @@ -0,0 +1,91 @@ + @ Initialize the Battle Tower challenge + .macro tower_init + setvar VAR_0x8004, BATTLE_TOWER_FUNC_INIT + special CallBattleTowerFunc + .endm + + @ Get the value of some TOWER_DATA_*. See GetTowerData for the data types that can be retrieved + .macro tower_get data:req + setvar VAR_0x8004, BATTLE_TOWER_FUNC_GET_DATA + setvar VAR_0x8005, \data + special CallBattleTowerFunc + .endm + + @ Set some TOWER_DATA_* to val. See SetTowerData for the data types that can be set + .macro tower_set data:req, val=0xFFFF + setvar VAR_0x8004, BATTLE_TOWER_FUNC_SET_DATA + setvar VAR_0x8005, \data + .if \val != 0xFFFF + setvar VAR_0x8006, \val + .endif + special CallBattleTowerFunc + .endm + + @ Choose and set the gfx for the next opponent. Also used by Battle Tents + .macro tower_setopponent + setvar VAR_0x8004, BATTLE_TOWER_FUNC_SET_OPPONENT + special CallBattleTowerFunc + .endm + + @ Increments the battle number and returns the new one. Also clears E-Reader trainer if defeated, and saves the current win streak + .macro tower_setbattlewon + setvar VAR_0x8004, BATTLE_TOWER_FUNC_SET_BATTLE_WON + special CallBattleTowerFunc + .endm + + @ Try to award ribbons for completing 56th straight Battle Tower win. VAR_RESULT is TRUE if ribbons were awarded. + .macro tower_giveribbons + setvar VAR_0x8004, BATTLE_TOWER_FUNC_GIVE_RIBBONS + special CallBattleTowerFunc + .endm + + @ Save the game and set the challenge status + .macro tower_save challengeStatus:req + setvar VAR_0x8004, BATTLE_TOWER_FUNC_SAVE + setvar VAR_0x8005, \challengeStatus + special CallBattleTowerFunc + .endm + + @ Buffer the opponent's easy chat intro speech to STR_VAR_4 + .macro tower_getopponentintro opponent:req + setvar VAR_0x8004, BATTLE_TOWER_FUNC_GET_OPPONENT_INTRO + setvar VAR_0x8005, \opponent + special CallBattleTowerFunc + .endm + + @ Load the parties, gfx, and other data (like Apprentice id) for the multi partner candidates + .macro tower_loadpartners + setvar VAR_0x8004, BATTLE_TOWER_FUNC_LOAD_PARTNERS + special CallBattleTowerFunc + .endm + + @ Print message from potential multi partner. msgId is any PARTNER_MSGID_* + .macro tower_dopartnermsg msgId:req + setvar VAR_0x8004, BATTLE_TOWER_FUNC_PARTNER_MSG + setvar VAR_0x8005, \msgId + special CallBattleTowerFunc + .endm + + @ Receives/loads the opponent data for a link multi challenge. Returns 6 when finished, and finishes immediately if not doing a link multi battle. + .macro tower_loadlinkopponents + setvar VAR_0x8004, BATTLE_TOWER_FUNC_LOAD_LINK_OPPONENTS + special CallBattleTowerFunc + .endm + + @ Unknown. Destroys some link task if using wireless link. Wait for link? + .macro tower_unklink + setvar VAR_0x8004, BATTLE_TOWER_FUNC_13 + special CallBattleTowerFunc + .endm + + @ Set VAR_OBJ_GFX_ID_E to the gfx id of the selected multi partner + .macro tower_setpartnergfx + setvar VAR_0x8004, BATTLE_TOWER_FUNC_SET_PARTNER_GFX + special CallBattleTowerFunc + .endm + + @ Set the data used for the post-challenge Battle Tower interview + .macro tower_setinterviewdata + setvar VAR_0x8004, BATTLE_TOWER_FUNC_SET_INTERVIEW_DATA + special CallBattleTowerFunc + .endm diff --git a/asm/macros/battle_frontier/frontier_util.inc b/asm/macros/battle_frontier/frontier_util.inc new file mode 100644 index 000000000..def5b4d1c --- /dev/null +++ b/asm/macros/battle_frontier/frontier_util.inc @@ -0,0 +1,153 @@ + @ Get the status (CHALLENGE_STATUS_*) of the current challenge and store the result in VAR_TEMP_0 + .macro frontier_getstatus + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_GET_STATUS + special CallFrontierUtilFunc + .endm + + @ Get the value of some FRONTIER_DATA_*. See GetFrontierData for the data types that can be retrieved + .macro frontier_get data:req + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_GET_DATA + setvar VAR_0x8005, \data + special CallFrontierUtilFunc + .endm + + @ Set the value of some FRONTIER_DATA_*. Some data types do not need a val argument because the value is set directly from somewhere else. See SetFrontierData for the data types that can be set + .macro frontier_set data:req, val=0xFFFF + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SET_DATA + setvar VAR_0x8005, \data + .if \val == 0xFFFF + @ no value provided + .elseif \val >= VARS_START + copyvar VAR_0x8006, \val + .else + setvar VAR_0x8006, \val + .endif + special CallFrontierUtilFunc + .endm + + @ Load the selected mons into gSelectedOrderFromParty and reduce the players party to these mons + .macro frontier_setpartyorder partySize:req + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SET_PARTY_ORDER + setvar VAR_0x8005, \partySize + special CallFrontierUtilFunc + .endm + + @ Performs a soft reset + .macro frontier_reset + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SOFT_RESET + special CallFrontierUtilFunc + .endm + + @ Loads gBattleFrontierTrainers into gFacilityTrainers + .macro frontier_settrainers + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SET_TRAINERS + special CallFrontierUtilFunc + .endm + + @ Sets the selected party mons in the saveblock + .macro frontier_saveparty + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SAVE_PARTY + special CallFrontierUtilFunc + .endm + + @ Shows the results window for the given facility and mode. Facilities with only 1 mode dont provide the mode argument + .macro frontier_results facility:req, mode=0xFF + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_RESULTS_WINDOW + setvar VAR_0x8005, \facility + .if \mode != 0xFF + setvar VAR_0x8006, \mode + .endif + special CallFrontierUtilFunc + .endm + + @ Checks if the Battle Frontier TV special should air, and if so attempts to set it up + .macro frontier_checkairshow + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_CHECK_AIR_TV_SHOW + special CallFrontierUtilFunc + .endm + + @ Get the status of the Frontier Brain (Not ready, Silver/Gold streak before symbols, Silver/Gold streak after symbols) + .macro frontier_getbrainstatus + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_GET_BRAIN_STATUS + special CallFrontierUtilFunc + .endm + + @ TRUE if the opponent is a Frontier Brain, FALSE otherwise + .macro frontier_isbrain + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_IS_BRAIN + special CallFrontierUtilFunc + .endm + + @ Awards battle points depending on the current challenge + .macro frontier_givepoints + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_GIVE_BATTLE_POINTS + special CallFrontierUtilFunc + .endm + + @ Returns 0-2 for the number of facility symbols the player has + .macro frontier_getsymbols + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_GET_FACILITY_SYMBOLS + special CallFrontierUtilFunc + .endm + + @ Awards a frontier symbol depending on the current challenge + .macro frontier_givesymbol + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_GIVE_FACILITY_SYMBOL + special CallFrontierUtilFunc + .endm + + @ TRUE if the given battleType is set in gBattleTypeFlags, FALSE otherwise + .macro frontier_isbattletype battleType:req + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_CHECK_BATTLE_TYPE + setvar VAR_0x8005, \battleType + special CallFrontierUtilFunc + .endm + + @ TRUE if there are insufficient eligible party mons to participate in the challenge, and buffers caught ineligible species to STR_VAR_1. FALSE otherwise. The return value is stored in VAR_0x8004 instead, and the current level mode is expected to be in VAR_RESULT + .macro frontier_checkineligible + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_CHECK_INELIGIBLE + special CallFrontierUtilFunc + .endm + + @ Validates the visiting E-Reader trainer. 0 if valid, 1 if not + .macro frontier_checkvisittrainer + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_CHECK_VISIT_TRAINER + special CallFrontierUtilFunc + .endm + + @ Increments the current win streak by 1 + .macro frontier_incrementstreak + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_INCREMENT_STREAK + special CallFrontierUtilFunc + .endm + + @ Resets the party held items to what they were upon entering the challenge + .macro frontier_restorehelditems + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_RESTORE_HELD_ITEMS + special CallFrontierUtilFunc + .endm + + @ Move the recorded battle to save data + .macro frontier_savebattle + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SAVE_BATTLE + special CallFrontierUtilFunc + .endm + + @ Buffer the name of gTrainerBattleOpponent_A in STR_VAR_1 (0) or STR_VAR_2 (1) + .macro frontier_gettrainername stringVar:req + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_BUFFER_TRAINER_NAME + setvar VAR_0x8005, \stringVar + special CallFrontierUtilFunc + .endm + + @ If any moves were copied using Sketch during the challenge then restore them to Sketch + .macro frontier_resetsketch + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_RESET_SKETCH_MOVES + special CallFrontierUtilFunc + .endm + + @ Set the object event gfx of the Frontier Brain for the current facility + .macro frontier_setbrainobj + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SET_BRAIN_OBJECT + special CallFrontierUtilFunc + .endm |