-
Notifications
You must be signed in to change notification settings - Fork 211
Document most of the Battle Hall logic #1220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| #ifndef POKEPLATINUM_BATTLE_HALL_H | ||
| #define POKEPLATINUM_BATTLE_HALL_H | ||
|
|
||
| #include "constants/battle_frontier.h" | ||
|
|
||
| #include "struct_defs/pokemon.h" | ||
|
|
||
| #include "overlay104/frontier_data_transfer.h" | ||
|
|
||
| #include "battle_hall_save.h" | ||
| #include "field_battle_data_transfer.h" | ||
| #include "party.h" | ||
| #include "savedata.h" | ||
|
|
||
| typedef struct BattleHall { | ||
| int unused; | ||
| u8 challengeType; | ||
| u8 currentBattle; | ||
| u8 saveStreak; | ||
| u8 opponentsLevel; | ||
| u16 currentStreak; | ||
| u16 currentRound; | ||
| fx32 playerLevelSqrt; | ||
| u32 unk_10; | ||
| int wonBattle; | ||
| u16 trainerIDs[HALL_BATTLES_PER_ROUND * 2]; | ||
| FrontierDataDTO opponents[2]; | ||
| u8 partySlots[2]; | ||
| Party *party; | ||
| u16 monIndices[HALL_BATTLES_PER_ROUND * 2]; | ||
| FrontierPokemonDataDTO opponentMons[HALL_BATTLES_PER_ROUND * 2]; | ||
| u16 unk_6F0; | ||
| u16 selectedTypeIdx2; | ||
| u8 selectedType; | ||
| u8 selectedTypeIdx; | ||
| BattleHallSave *hallSave; | ||
| SaveData *saveData; | ||
| FieldBattleDTO *dto; | ||
| u8 typeRanks[4][9]; | ||
| u16 heldItems[2]; | ||
| u16 unk_72C[44]; | ||
| u8 unk_784[512]; | ||
| u8 unk_984[2][512]; | ||
| u16 unk_D84[2]; | ||
| u8 unk_D88; | ||
| Pokemon *partnersMon; | ||
| u8 unk_D90; | ||
| u32 unk_D94; | ||
| } BattleHall; | ||
|
|
||
| BattleHall *BattleHall_Init(SaveData *saveData, u16 resumingFromSave, u8 challengeType, u8 partySlot1, u8 partySlot2); | ||
| void BattleHall_SetupNextOpponent(BattleHall *battleHall, u16 unused); | ||
| void BattleHall_Free(BattleHall *battleHall); | ||
| void BattleHall_GetTypeSelectionAppResult(BattleHall *battleHall, void *args); | ||
| void BattleHall_UpdateWinRecordForCurrentMon(BattleHall *battleHall, u16 *updated); | ||
| void BattleHall_Save(BattleHall *battleHall, u8 saveType); | ||
| u16 BattleHall_IncrementCurrentBattle(BattleHall *battleHall); | ||
| u16 BattleHall_GetCurrentBattle(BattleHall *battleHall); | ||
| u16 BattleHall_GetNextOpponentObjectID(BattleHall *battleHall, u8 trainerSlot); | ||
| void BattleHall_SaveOnLoss(BattleHall *battleHall); | ||
| void BattleHall_SaveOnCompletingRound(BattleHall *battleHall); | ||
| BOOL BattleHall_SendCommMessage(BattleHall *battleHall, u16 command, u16 arg); | ||
| u16 BattleHall_GetEarnedBP(BattleHall *battleHall); | ||
| void BattleHall_CapTypeRanks(BattleHall *battleHall); | ||
| void BattleHall_CalcPlayerLevelSqrt(BattleHall *battleHall); | ||
|
|
||
| #endif // POKEPLATINUM_BATTLE_HALL_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #ifndef POKEPLATINUM_BATTLE_HALL_HELPERS_H | ||
| #define POKEPLATINUM_BATTLE_HALL_HELPERS_H | ||
|
|
||
| #include "overlay104/battle_hall.h" | ||
| #include "overlay104/struct_ov104_02230BE4.h" | ||
|
|
||
| #include "field_battle_data_transfer.h" | ||
|
|
||
| #define BATTLE_HALL_MON_SUMMARY 0xfe | ||
|
|
||
| void BattleHall_PickOpponentTrainerClasses(u8 selectedTypeIdx, u8 numTrainers, u8 typeRank, u8 currentBattle, u16 trainerIDs[]); | ||
| void BattleHall_PickOpponentTrainers(u8 challengeType, u8 numTrainers, int currentRound, u8 rank, u8 currentBattle, u16 trainerIDs[]); | ||
| void BattleHall_PickNextOpponentPokemon(u8 numOpponentsToPick, u8 selectedType, u8 typeRank, u8 currentBattle, u16 playersSpecies, u16 opponentIndices[], u8 battleType); | ||
| FieldBattleDTO *BattleHall_SetupBattle(BattleHall *battleHall, FieldFrontierDTO *fieldData); | ||
| u8 BattleHall_GetPlayerPartySize(u8 challengeType); | ||
| u8 BattleHall_GetOpponentPartySize(u8 challengeType); | ||
| u8 BattleHall_CursorPosToType(u8 cursorPos); | ||
| BOOL BattleHall_IsMultiPlayerChallenge(u8 challengeType); | ||
| u8 BattleHall_GetHallMatronTypeRank(BattleHall *battleHall); | ||
| u16 BattleHall_GetHighestLevelInParty(BattleHall *battleHall); | ||
| fx32 BattleHall_GetLevelSquareRoot(u32 level); | ||
|
|
||
| #endif // POKEPLATINUM_BATTLE_HALL_HELPERS_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I would like to annotate the arguments to script-commands with
:reqto denote that they are required. Otherwise, it's a pretty big foot-gun for an end-user. That can be a separate PR, but we should definitely do it.I have a basic
awk-script for this, if that interests you:Stick this in a file, make it executable, and run it against the input file:
./annotate.awk asm/macros/frscrcmd.inc > asm/macros/frscrcmd.inc.newThen you can check the output and replace the old file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, but as you say, I think this should be in a separate PR.