Document record mixing mail swap

This commit is contained in:
GriffinR 2021-10-23 10:55:46 -04:00
parent 0fbf5f59b3
commit 7f3c529935
28 changed files with 610 additions and 585 deletions

View File

@ -3,61 +3,61 @@ BattleFrontier_RankingHall_MapScripts::
BattleFrontier_RankingHall_EventScript_TowerSinglesRecords:: BattleFrontier_RankingHall_EventScript_TowerSinglesRecords::
lockall lockall
setvar VAR_0x8005, RANKING_HALL_BATTLE_TOWER_SINGLES setvar VAR_0x8005, RANKING_HALL_TOWER_SINGLES
goto BattleFrontier_RankingHall_EventScript_ShowRecords goto BattleFrontier_RankingHall_EventScript_ShowRecords
end end
BattleFrontier_RankingHall_EventScript_TowerDoublesRecords:: BattleFrontier_RankingHall_EventScript_TowerDoublesRecords::
lockall lockall
setvar VAR_0x8005, RANKING_HALL_BATTLE_TOWER_DOUBLES setvar VAR_0x8005, RANKING_HALL_TOWER_DOUBLES
goto BattleFrontier_RankingHall_EventScript_ShowRecords goto BattleFrontier_RankingHall_EventScript_ShowRecords
end end
BattleFrontier_RankingHall_EventScript_TowerMultisRecords:: BattleFrontier_RankingHall_EventScript_TowerMultisRecords::
lockall lockall
setvar VAR_0x8005, RANKING_HALL_BATTLE_TOWER_MULTIS setvar VAR_0x8005, RANKING_HALL_TOWER_MULTIS
goto BattleFrontier_RankingHall_EventScript_ShowRecords goto BattleFrontier_RankingHall_EventScript_ShowRecords
end end
BattleFrontier_RankingHall_EventScript_TowerLinkRecords:: BattleFrontier_RankingHall_EventScript_TowerLinkRecords::
lockall lockall
setvar VAR_0x8005, RANKING_HALL_BATTLE_TOWER_LINK setvar VAR_0x8005, RANKING_HALL_TOWER_LINK
goto BattleFrontier_RankingHall_EventScript_ShowRecords goto BattleFrontier_RankingHall_EventScript_ShowRecords
end end
BattleFrontier_RankingHall_EventScript_ArenaRecords:: BattleFrontier_RankingHall_EventScript_ArenaRecords::
lockall lockall
setvar VAR_0x8005, RANKING_HALL_BATTLE_ARENA setvar VAR_0x8005, RANKING_HALL_ARENA
goto BattleFrontier_RankingHall_EventScript_ShowRecords goto BattleFrontier_RankingHall_EventScript_ShowRecords
end end
BattleFrontier_RankingHall_EventScript_PalaceRecords:: BattleFrontier_RankingHall_EventScript_PalaceRecords::
lockall lockall
setvar VAR_0x8005, RANKING_HALL_BATTLE_PALACE setvar VAR_0x8005, RANKING_HALL_PALACE
goto BattleFrontier_RankingHall_EventScript_ShowRecords goto BattleFrontier_RankingHall_EventScript_ShowRecords
end end
BattleFrontier_RankingHall_EventScript_FactoryRecords:: BattleFrontier_RankingHall_EventScript_FactoryRecords::
lockall lockall
setvar VAR_0x8005, RANKING_HALL_BATTLE_FACTORY setvar VAR_0x8005, RANKING_HALL_FACTORY
goto BattleFrontier_RankingHall_EventScript_ShowRecords goto BattleFrontier_RankingHall_EventScript_ShowRecords
end end
BattleFrontier_RankingHall_EventScript_DomeRecords:: BattleFrontier_RankingHall_EventScript_DomeRecords::
lockall lockall
setvar VAR_0x8005, RANKING_HALL_BATTLE_DOME setvar VAR_0x8005, RANKING_HALL_DOME
goto BattleFrontier_RankingHall_EventScript_ShowRecords goto BattleFrontier_RankingHall_EventScript_ShowRecords
end end
BattleFrontier_RankingHall_EventScript_PikeRecords:: BattleFrontier_RankingHall_EventScript_PikeRecords::
lockall lockall
setvar VAR_0x8005, RANKING_HALL_BATTLE_PIKE setvar VAR_0x8005, RANKING_HALL_PIKE
goto BattleFrontier_RankingHall_EventScript_ShowRecords goto BattleFrontier_RankingHall_EventScript_ShowRecords
end end
BattleFrontier_RankingHall_EventScript_PyramidRecords:: BattleFrontier_RankingHall_EventScript_PyramidRecords::
lockall lockall
setvar VAR_0x8005, RANKING_HALL_BATTLE_PYRAMID setvar VAR_0x8005, RANKING_HALL_PYRAMID
goto BattleFrontier_RankingHall_EventScript_ShowRecords goto BattleFrontier_RankingHall_EventScript_ShowRecords
end end

View File

@ -17,11 +17,6 @@
#define FACILITY_UNION_ROOM 8 #define FACILITY_UNION_ROOM 8
#define FACILITY_MULTI_OR_EREADER 9 // Direct Corner multi battles, multi battle with Steven, and e-Reader battles #define FACILITY_MULTI_OR_EREADER 9 // Direct Corner multi battles, multi battle with Steven, and e-Reader battles
// Battle Frontier lvl modes.
#define FRONTIER_LVL_50 0
#define FRONTIER_LVL_OPEN 1
#define FRONTIER_LVL_TENT 2
// Battle Frontier battle modes. // Battle Frontier battle modes.
#define FRONTIER_MODE_SINGLES 0 #define FRONTIER_MODE_SINGLES 0
#define FRONTIER_MODE_DOUBLES 1 #define FRONTIER_MODE_DOUBLES 1
@ -53,27 +48,27 @@
// These sets of facility ids would be redundant if the order was consistent // These sets of facility ids would be redundant if the order was consistent
// The order is important for this set so that all the non-link records can be continuous // The order is important for this set so that all the non-link records can be continuous
#define RANKING_HALL_BATTLE_TOWER_SINGLES 0 #define RANKING_HALL_TOWER_SINGLES 0
#define RANKING_HALL_BATTLE_TOWER_DOUBLES 1 #define RANKING_HALL_TOWER_DOUBLES 1
#define RANKING_HALL_BATTLE_TOWER_MULTIS 2 #define RANKING_HALL_TOWER_MULTIS 2
#define RANKING_HALL_BATTLE_DOME 3 #define RANKING_HALL_DOME 3
#define RANKING_HALL_BATTLE_PALACE 4 #define RANKING_HALL_PALACE 4
#define RANKING_HALL_BATTLE_ARENA 5 #define RANKING_HALL_ARENA 5
#define RANKING_HALL_BATTLE_FACTORY 6 #define RANKING_HALL_FACTORY 6
#define RANKING_HALL_BATTLE_PIKE 7 #define RANKING_HALL_PIKE 7
#define RANKING_HALL_BATTLE_PYRAMID 8 #define RANKING_HALL_PYRAMID 8
#define RANKING_HALL_BATTLE_TOWER_LINK 9 #define RANKING_HALL_TOWER_LINK 9
#define FRONTIER_MANIAC_BATTLE_TOWER_SINGLES 0 #define FRONTIER_MANIAC_TOWER_SINGLES 0
#define FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES 1 #define FRONTIER_MANIAC_TOWER_DOUBLES 1
#define FRONTIER_MANIAC_BATTLE_TOWER_MULTIS 2 #define FRONTIER_MANIAC_TOWER_MULTIS 2
#define FRONTIER_MANIAC_BATTLE_TOWER_LINK 3 #define FRONTIER_MANIAC_TOWER_LINK 3
#define FRONTIER_MANIAC_BATTLE_DOME 4 #define FRONTIER_MANIAC_DOME 4
#define FRONTIER_MANIAC_BATTLE_FACTORY 5 #define FRONTIER_MANIAC_FACTORY 5
#define FRONTIER_MANIAC_BATTLE_PALACE 6 #define FRONTIER_MANIAC_PALACE 6
#define FRONTIER_MANIAC_BATTLE_ARENA 7 #define FRONTIER_MANIAC_ARENA 7
#define FRONTIER_MANIAC_BATTLE_PIKE 8 #define FRONTIER_MANIAC_PIKE 8
#define FRONTIER_MANIAC_BATTLE_PYRAMID 9 #define FRONTIER_MANIAC_PYRAMID 9
#define FRONTIER_MANIAC_FACILITY_COUNT 10 #define FRONTIER_MANIAC_FACILITY_COUNT 10
#define FRONTIER_MANIAC_MESSAGE_COUNT 3 #define FRONTIER_MANIAC_MESSAGE_COUNT 3

View File

@ -53,9 +53,19 @@
#define UNION_ROOM_KB_ROW_COUNT 10 #define UNION_ROOM_KB_ROW_COUNT 10
#define GIFT_RIBBONS_COUNT 11 #define GIFT_RIBBONS_COUNT 11
#define SAVED_TRENDS_COUNT 5 #define SAVED_TRENDS_COUNT 5
#define PYRAMID_BAG_ITEMS_COUNT 10 #define PYRAMID_BAG_ITEMS_COUNT 10
#define HALL_FACILITIES_COUNT 9 // 7 facilities for single mode + tower double mode + tower multi mode.
// Number of facilities for Ranking Hall.
// 7 facilities for single mode + tower double mode + tower multi mode.
// Excludes link modes. See RANKING_HALL_* in include/constants/battle_frontier.h
#define HALL_FACILITIES_COUNT 9
#define HALL_RECORDS_COUNT 3
// Battle Frontier level modes.
#define FRONTIER_LVL_50 0
#define FRONTIER_LVL_OPEN 1
#define FRONTIER_LVL_MODE_COUNT 2
#define FRONTIER_LVL_TENT FRONTIER_LVL_MODE_COUNT // Special usage for indicating Battle Tent
#define TRAINER_ID_LENGTH 4 #define TRAINER_ID_LENGTH 4
#define MAX_MON_MOVES 4 #define MAX_MON_MOVES 4

View File

@ -3,10 +3,17 @@
#include "constants/daycare.h" #include "constants/daycare.h"
struct RecordMixingDaycareMail
{
struct DaycareMail mail[DAYCARE_MON_COUNT];
u32 numDaycareMons;
bool16 cantHoldItem[DAYCARE_MON_COUNT];
};
u8 *GetMonNickname2(struct Pokemon *mon, u8 *dest); u8 *GetMonNickname2(struct Pokemon *mon, u8 *dest);
u8 *GetBoxMonNickname(struct BoxPokemon *mon, u8 *dest); u8 *GetBoxMonNickname(struct BoxPokemon *mon, u8 *dest);
u8 CountPokemonInDaycare(struct DayCare *daycare); u8 CountPokemonInDaycare(struct DayCare *daycare);
void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDaycareMail *daycareMail); void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDaycareMail *mixMail);
void StoreSelectedPokemonInDaycare(void); void StoreSelectedPokemonInDaycare(void);
u16 TakePokemonFromDaycare(void); u16 TakePokemonFromDaycare(void);
void GetDaycareCost(void); void GetDaycareCost(void);

View File

@ -208,11 +208,10 @@ struct BerryPickingResults
u8 field_F; u8 field_F;
}; };
// two arrays for lvl50 and open level
struct PyramidBag struct PyramidBag
{ {
u16 itemId[2][PYRAMID_BAG_ITEMS_COUNT]; u16 itemId[FRONTIER_LVL_MODE_COUNT][PYRAMID_BAG_ITEMS_COUNT];
u8 quantity[2][PYRAMID_BAG_ITEMS_COUNT]; u8 quantity[FRONTIER_LVL_MODE_COUNT][PYRAMID_BAG_ITEMS_COUNT];
}; };
struct BerryCrush struct BerryCrush
@ -353,8 +352,8 @@ struct BattleFrontier
/*0xCB2*/ u16 curChallengeBattleNum; // Battle number / room number (Pike) / floor number (Pyramid) /*0xCB2*/ u16 curChallengeBattleNum; // Battle number / room number (Pike) / floor number (Pyramid)
/*0xCB4*/ u16 trainerIds[20]; /*0xCB4*/ u16 trainerIds[20];
/*0xCDC*/ u32 winStreakActiveFlags; /*0xCDC*/ u32 winStreakActiveFlags;
/*0xCE0*/ u16 towerWinStreaks[4][2]; /*0xCE0*/ u16 towerWinStreaks[4][FRONTIER_LVL_MODE_COUNT];
/*0xCF0*/ u16 towerRecordWinStreaks[4][2]; /*0xCF0*/ u16 towerRecordWinStreaks[4][FRONTIER_LVL_MODE_COUNT];
/*0xD00*/ u16 battledBrainFlags; /*0xD00*/ u16 battledBrainFlags;
/*0xD02*/ u16 towerSinglesStreak; // Never read /*0xD02*/ u16 towerSinglesStreak; // Never read
/*0xD04*/ u16 towerNumWins; // Increments to MAX_STREAK but never read otherwise /*0xD04*/ u16 towerNumWins; // Increments to MAX_STREAK but never read otherwise
@ -371,33 +370,33 @@ struct BattleFrontier
/*0xD09*/ u8 domeUnused; /*0xD09*/ u8 domeUnused;
/*0xD0A*/ u8 domeLvlMode; /*0xD0A*/ u8 domeLvlMode;
/*0xD0B*/ u8 domeBattleMode; /*0xD0B*/ u8 domeBattleMode;
/*0xD0C*/ u16 domeWinStreaks[2][2]; /*0xD0C*/ u16 domeWinStreaks[2][FRONTIER_LVL_MODE_COUNT];
/*0xD14*/ u16 domeRecordWinStreaks[2][2]; /*0xD14*/ u16 domeRecordWinStreaks[2][FRONTIER_LVL_MODE_COUNT];
/*0xD1C*/ u16 domeTotalChampionships[2][2]; /*0xD1C*/ u16 domeTotalChampionships[2][FRONTIER_LVL_MODE_COUNT];
/*0xD24*/ struct BattleDomeTrainer domeTrainers[DOME_TOURNAMENT_TRAINERS_COUNT]; /*0xD24*/ struct BattleDomeTrainer domeTrainers[DOME_TOURNAMENT_TRAINERS_COUNT];
/*0xD64*/ u16 domeMonIds[DOME_TOURNAMENT_TRAINERS_COUNT][FRONTIER_PARTY_SIZE]; /*0xD64*/ u16 domeMonIds[DOME_TOURNAMENT_TRAINERS_COUNT][FRONTIER_PARTY_SIZE];
/*0xDC4*/ u16 unused_DC4; /*0xDC4*/ u16 unused_DC4;
/*0xDC6*/ u16 palacePrize; /*0xDC6*/ u16 palacePrize;
/*0xDC8*/ u16 palaceWinStreaks[2][2]; /*0xDC8*/ u16 palaceWinStreaks[2][FRONTIER_LVL_MODE_COUNT];
/*0xDD0*/ u16 palaceRecordWinStreaks[2][2]; /*0xDD0*/ u16 palaceRecordWinStreaks[2][FRONTIER_LVL_MODE_COUNT];
/*0xDD8*/ u16 arenaPrize; /*0xDD8*/ u16 arenaPrize;
/*0xDDA*/ u16 arenaWinStreaks[2]; /*0xDDA*/ u16 arenaWinStreaks[FRONTIER_LVL_MODE_COUNT];
/*0xDDE*/ u16 arenaRecordStreaks[2]; /*0xDDE*/ u16 arenaRecordStreaks[FRONTIER_LVL_MODE_COUNT];
/*0xDE2*/ u16 factoryWinStreaks[2][2]; /*0xDE2*/ u16 factoryWinStreaks[2][FRONTIER_LVL_MODE_COUNT];
/*0xDEA*/ u16 factoryRecordWinStreaks[2][2]; /*0xDEA*/ u16 factoryRecordWinStreaks[2][FRONTIER_LVL_MODE_COUNT];
/*0xDF6*/ u16 factoryRentsCount[2][2]; /*0xDF6*/ u16 factoryRentsCount[2][FRONTIER_LVL_MODE_COUNT];
/*0xDFA*/ u16 factoryRecordRentsCount[2][2]; /*0xDFA*/ u16 factoryRecordRentsCount[2][FRONTIER_LVL_MODE_COUNT];
/*0xE02*/ u16 pikePrize; /*0xE02*/ u16 pikePrize;
/*0xE04*/ u16 pikeWinStreaks[2]; /*0xE04*/ u16 pikeWinStreaks[FRONTIER_LVL_MODE_COUNT];
/*0xE08*/ u16 pikeRecordStreaks[2]; /*0xE08*/ u16 pikeRecordStreaks[FRONTIER_LVL_MODE_COUNT];
/*0xE0C*/ u16 pikeTotalStreaks[2]; /*0xE0C*/ u16 pikeTotalStreaks[FRONTIER_LVL_MODE_COUNT];
/*0xE10*/ u8 pikeHintedRoomIndex:3; /*0xE10*/ u8 pikeHintedRoomIndex:3;
/*0xE10*/ u8 pikeHintedRoomType:4; /*0xE10*/ u8 pikeHintedRoomType:4;
/*0xE10*/ u8 pikeHealingRoomsDisabled:1; /*0xE10*/ u8 pikeHealingRoomsDisabled:1;
/*0xE12*/ u16 pikeHeldItemsBackup[FRONTIER_PARTY_SIZE]; /*0xE12*/ u16 pikeHeldItemsBackup[FRONTIER_PARTY_SIZE];
/*0xE18*/ u16 pyramidPrize; /*0xE18*/ u16 pyramidPrize;
/*0xE1A*/ u16 pyramidWinStreaks[2]; /*0xE1A*/ u16 pyramidWinStreaks[FRONTIER_LVL_MODE_COUNT];
/*0xE1E*/ u16 pyramidRecordStreaks[2]; /*0xE1E*/ u16 pyramidRecordStreaks[FRONTIER_LVL_MODE_COUNT];
/*0xE22*/ u16 pyramidRandoms[4]; /*0xE22*/ u16 pyramidRandoms[4];
/*0xE2A*/ u8 pyramidTrainerFlags; /*0xE2A*/ u8 pyramidTrainerFlags;
/*0xE2C*/ struct PyramidBag pyramidBag; /*0xE2C*/ struct PyramidBag pyramidBag;
@ -411,8 +410,8 @@ struct BattleFrontier
/*0xEBC*/ u32 battlesCount; /*0xEBC*/ u32 battlesCount;
/*0xEC0*/ u16 domeWinningMoves[DOME_TOURNAMENT_TRAINERS_COUNT]; /*0xEC0*/ u16 domeWinningMoves[DOME_TOURNAMENT_TRAINERS_COUNT];
/*0xEE0*/ u8 trainerFlags; /*0xEE0*/ u8 trainerFlags;
/*0xEE1*/ u8 opponentNames[2][PLAYER_NAME_LENGTH + 1]; /*0xEE1*/ u8 opponentNames[FRONTIER_LVL_MODE_COUNT][PLAYER_NAME_LENGTH + 1];
/*0xEF1*/ u8 opponentTrainerIds[2][TRAINER_ID_LENGTH]; /*0xEF1*/ u8 opponentTrainerIds[FRONTIER_LVL_MODE_COUNT][TRAINER_ID_LENGTH];
/*0xEF9*/ u8 unk_EF9:7; // Never read /*0xEF9*/ u8 unk_EF9:7; // Never read
/*0xEF9*/ u8 savedGame:1; /*0xEF9*/ u8 savedGame:1;
/*0xEFA*/ u8 unused_EFA; /*0xEFA*/ u8 unused_EFA;
@ -488,8 +487,8 @@ struct SaveBlock2
/*0x1EC*/ struct BerryCrush berryCrush; /*0x1EC*/ struct BerryCrush berryCrush;
/*0x1FC*/ struct PokemonJumpRecords pokeJump; /*0x1FC*/ struct PokemonJumpRecords pokeJump;
/*0x20C*/ struct BerryPickingResults berryPick; /*0x20C*/ struct BerryPickingResults berryPick;
/*0x21C*/ struct RankingHall1P hallRecords1P[HALL_FACILITIES_COUNT][2][3]; // From record mixing. /*0x21C*/ struct RankingHall1P hallRecords1P[HALL_FACILITIES_COUNT][FRONTIER_LVL_MODE_COUNT][HALL_RECORDS_COUNT]; // From record mixing.
/*0x57C*/ struct RankingHall2P hallRecords2P[2][3]; // From record mixing. /*0x57C*/ struct RankingHall2P hallRecords2P[FRONTIER_LVL_MODE_COUNT][HALL_RECORDS_COUNT]; // From record mixing.
/*0x624*/ u16 contestLinkResults[CONTEST_CATEGORIES_COUNT][CONTESTANT_COUNT]; /*0x624*/ u16 contestLinkResults[CONTEST_CATEGORIES_COUNT][CONTESTANT_COUNT];
/*0x64C*/ struct BattleFrontier frontier; /*0x64C*/ struct BattleFrontier frontier;
}; // sizeof=0xF2C }; // sizeof=0xF2C
@ -597,15 +596,6 @@ struct DewfordTrend
u16 words[2]; u16 words[2];
}; /*size = 0x8*/ }; /*size = 0x8*/
struct MailStruct
{
/*0x00*/ u16 words[MAIL_WORDS_COUNT];
/*0x12*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x1A*/ u8 trainerId[TRAINER_ID_LENGTH];
/*0x1E*/ u16 species;
/*0x20*/ u16 itemId;
};
struct MauvilleManCommon struct MauvilleManCommon
{ {
u8 id; u8 id;
@ -671,20 +661,6 @@ typedef union OldMan
u8 filler[0x40]; u8 filler[0x40];
} OldMan; } OldMan;
struct RecordMixing_UnknownStructSub
{
u32 unk0;
u8 data[0x34];
//u8 data[0x38];
};
struct RecordMixing_UnknownStruct
{
struct RecordMixing_UnknownStructSub data[2];
u32 unk70;
u16 unk74[0x2];
};
#define LINK_B_RECORDS_COUNT 5 #define LINK_B_RECORDS_COUNT 5
struct LinkBattleRecord struct LinkBattleRecord
@ -727,10 +703,19 @@ struct ContestWinner
u8 contestRank; u8 contestRank;
}; };
struct Mail
{
/*0x00*/ u16 words[MAIL_WORDS_COUNT];
/*0x12*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x1A*/ u8 trainerId[TRAINER_ID_LENGTH];
/*0x1E*/ u16 species;
/*0x20*/ u16 itemId;
};
struct DaycareMail struct DaycareMail
{ {
struct MailStruct message; struct Mail message;
u8 OT_name[PLAYER_NAME_LENGTH + 1]; u8 otName[PLAYER_NAME_LENGTH + 1];
u8 monName[POKEMON_NAME_LENGTH + 1]; u8 monName[POKEMON_NAME_LENGTH + 1];
u8 gameLanguage:4; u8 gameLanguage:4;
u8 monLanguage:4; u8 monLanguage:4;
@ -750,13 +735,6 @@ struct DayCare
u8 stepCounter; u8 stepCounter;
}; };
struct RecordMixingDaycareMail
{
struct DaycareMail mail[DAYCARE_MON_COUNT];
u32 numDaycareMons;
bool16 holdsItem[DAYCARE_MON_COUNT];
};
struct LilycoveLadyQuiz struct LilycoveLadyQuiz
{ {
/*0x000*/ u8 id; /*0x000*/ u8 id;
@ -1019,7 +997,7 @@ struct SaveBlock1
/*0x2BBC*/ u16 easyChatBattleStart[EASY_CHAT_BATTLE_WORDS_COUNT]; /*0x2BBC*/ u16 easyChatBattleStart[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x2BC8*/ u16 easyChatBattleWon[EASY_CHAT_BATTLE_WORDS_COUNT]; /*0x2BC8*/ u16 easyChatBattleWon[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x2BD4*/ u16 easyChatBattleLost[EASY_CHAT_BATTLE_WORDS_COUNT]; /*0x2BD4*/ u16 easyChatBattleLost[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x2BE0*/ struct MailStruct mail[MAIL_COUNT]; /*0x2BE0*/ struct Mail mail[MAIL_COUNT];
/*0x2E20*/ u8 additionalPhrases[8]; // bitfield for 33 additional phrases in easy chat system /*0x2E20*/ u8 additionalPhrases[8]; // bitfield for 33 additional phrases in easy chat system
/*0x2E28*/ OldMan oldMan; /*0x2E28*/ OldMan oldMan;
/*0x2e64*/ struct DewfordTrend dewfordTrends[SAVED_TRENDS_COUNT]; /*0x2e64*/ struct DewfordTrend dewfordTrends[SAVED_TRENDS_COUNT];

View File

@ -15,16 +15,16 @@
|| itemId == ITEM_RETRO_MAIL)) || itemId == ITEM_RETRO_MAIL))
// mail.h // mail.h
void ReadMail(struct MailStruct *mail, void (*callback)(void), bool8 flag); void ReadMail(struct Mail *mail, void (*callback)(void), bool8 flag);
// mail_data.h // mail_data.h
void ClearMailData(void); void ClearAllMail(void);
void ClearMailStruct(struct MailStruct *mail); void ClearMail(struct Mail *mail);
bool8 MonHasMail(struct Pokemon *mon); bool8 MonHasMail(struct Pokemon *mon);
u8 GiveMailToMon(struct Pokemon *mon, u16 itemId); u8 GiveMailToMonByItemId(struct Pokemon *mon, u16 itemId);
u16 SpeciesToMailSpecies(u16 species, u32 personality); u16 SpeciesToMailSpecies(u16 species, u32 personality);
u16 MailSpeciesToSpecies(u16 mailSpecies, u16 *buffer); u16 MailSpeciesToSpecies(u16 mailSpecies, u16 *buffer);
u8 GiveMailToMon2(struct Pokemon *mon, struct MailStruct *mail); u8 GiveMailToMon(struct Pokemon *mon, struct Mail *mail);
void TakeMailFromMon(struct Pokemon *mon); void TakeMailFromMon(struct Pokemon *mon);
void ClearMailItemId(u8 mailId); void ClearMailItemId(u8 mailId);
u8 TakeMailFromMon2(struct Pokemon *mon); u8 TakeMailFromMon2(struct Pokemon *mon);

View File

@ -3,8 +3,8 @@
struct PlayerHallRecords struct PlayerHallRecords
{ {
struct RankingHall1P onePlayer[9][2]; struct RankingHall1P onePlayer[HALL_FACILITIES_COUNT][FRONTIER_LVL_MODE_COUNT];
struct RankingHall2P twoPlayers[2]; struct RankingHall2P twoPlayers[FRONTIER_LVL_MODE_COUNT];
}; };
void RecordMixingPlayerSpotTriggered(void); void RecordMixingPlayerSpotTriggered(void);

View File

@ -4,13 +4,9 @@
#include "link_rfu.h" #include "link_rfu.h"
#include "constants/trade.h" #include "constants/trade.h"
// Exported type declarations extern struct Mail gTradeMail[PARTY_SIZE];
// Exported RAM declarations
extern struct MailStruct gTradeMail[PARTY_SIZE];
extern u8 gSelectedTradeMonPositions[2]; extern u8 gSelectedTradeMonPositions[2];
// Exported ROM declarations
extern const struct WindowTemplate gTradeEvolutionSceneYesNoWindowTemplate; extern const struct WindowTemplate gTradeEvolutionSceneYesNoWindowTemplate;
s32 GetGameProgressForLinkTrade(void); s32 GetGameProgressForLinkTrade(void);

View File

@ -1830,7 +1830,7 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId)
{ {
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; // Unused variable. u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; // Unused variable.
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
u8 challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][0] / 7; u8 challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][FRONTIER_LVL_50] / 7;
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 6) if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 6)
fixedIV = GetFactoryMonFixedIV(challengeNum, 0); fixedIV = GetFactoryMonFixedIV(challengeNum, 0);
else else

View File

@ -19,7 +19,7 @@ static const u32 sUnusedStructSizes[] =
sizeof(struct SaveBlock1), sizeof(struct SaveBlock1),
sizeof(struct MapHeader), sizeof(struct MapHeader),
// 0x00000530, in RS // 0x00000530, in RS
sizeof(struct MailStruct), //or ObjectEvent / ObjectEventGraphicsInfo sizeof(struct Mail), //or ObjectEvent / ObjectEventGraphicsInfo
sizeof(struct Pokemon), //or TrainerCard sizeof(struct Pokemon), //or TrainerCard
0x00000528 // 0x000004D8, in RS 0x00000528 // 0x000004D8, in RS
}; };

View File

@ -25,7 +25,6 @@
extern const struct Evolution gEvolutionTable[][EVOS_PER_MON]; extern const struct Evolution gEvolutionTable[][EVOS_PER_MON];
// this file's functions
static void ClearDaycareMonMail(struct DaycareMail *mail); static void ClearDaycareMonMail(struct DaycareMail *mail);
static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare *daycare); static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare *daycare);
static u8 GetDaycareCompatibilityScore(struct DayCare *daycare); static u8 GetDaycareCompatibilityScore(struct DayCare *daycare);
@ -122,7 +121,7 @@ u8 CountPokemonInDaycare(struct DayCare *daycare)
return count; return count;
} }
void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDaycareMail *daycareMail) void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDaycareMail *mixMail)
{ {
u8 i; u8 i;
u8 numDaycareMons = 0; u8 numDaycareMons = 0;
@ -133,17 +132,18 @@ void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDay
{ {
numDaycareMons++; numDaycareMons++;
if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_HELD_ITEM) == ITEM_NONE) if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_HELD_ITEM) == ITEM_NONE)
daycareMail->holdsItem[i] = FALSE; mixMail->cantHoldItem[i] = FALSE;
else else
daycareMail->holdsItem[i] = TRUE; mixMail->cantHoldItem[i] = TRUE;
} }
else else
{ {
daycareMail->holdsItem[i] = TRUE; // Daycare slot empty
mixMail->cantHoldItem[i] = TRUE;
} }
} }
daycareMail->numDaycareMons = numDaycareMons; mixMail->numDaycareMons = numDaycareMons;
} }
static s8 Daycare_FindEmptySpot(struct DayCare *daycare) static s8 Daycare_FindEmptySpot(struct DayCare *daycare)
@ -165,7 +165,7 @@ static void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycar
{ {
u8 mailId; u8 mailId;
StringCopy(daycareMon->mail.OT_name, gSaveBlock2Ptr->playerName); StringCopy(daycareMon->mail.otName, gSaveBlock2Ptr->playerName);
GetMonNickname2(mon, daycareMon->mail.monName); GetMonNickname2(mon, daycareMon->mail.monName);
StripExtCtrlCodes(daycareMon->mail.monName); StripExtCtrlCodes(daycareMon->mail.monName);
daycareMon->mail.gameLanguage = GAME_LANGUAGE; daycareMon->mail.gameLanguage = GAME_LANGUAGE;
@ -262,7 +262,7 @@ static u16 TakeSelectedPokemonFromDaycare(struct DaycareMon *daycareMon)
gPlayerParty[PARTY_SIZE - 1] = pokemon; gPlayerParty[PARTY_SIZE - 1] = pokemon;
if (daycareMon->mail.message.itemId) if (daycareMon->mail.message.itemId)
{ {
GiveMailToMon2(&gPlayerParty[PARTY_SIZE - 1], &daycareMon->mail.message); GiveMailToMon(&gPlayerParty[PARTY_SIZE - 1], &daycareMon->mail.message);
ClearDaycareMonMail(&daycareMon->mail); ClearDaycareMonMail(&daycareMon->mail);
} }
@ -352,11 +352,11 @@ static void ClearDaycareMonMail(struct DaycareMail *mail)
s32 i; s32 i;
for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++)
mail->OT_name[i] = 0; mail->otName[i] = 0;
for (i = 0; i < POKEMON_NAME_LENGTH + 1; i++) for (i = 0; i < POKEMON_NAME_LENGTH + 1; i++)
mail->monName[i] = 0; mail->monName[i] = 0;
ClearMailStruct(&mail->message); ClearMail(&mail->message);
} }
static void ClearDaycareMon(struct DaycareMon *daycareMon) static void ClearDaycareMon(struct DaycareMon *daycareMon)

View File

@ -271,10 +271,8 @@ void ReceiveDewfordTrendData(struct DewfordTrend *linkedTrends, size_t size, u8
// Only overwrrite it if it's "trendier" // Only overwrrite it if it's "trendier"
temp = &savedTrendsBuffer[idx]; temp = &savedTrendsBuffer[idx];
if (temp->trendiness < src->trendiness) if (temp->trendiness < src->trendiness)
{
*temp = *src; *temp = *src;
} }
}
src++; src++;
} }
} }

View File

@ -396,10 +396,10 @@ static bool8 _CheckDaycareMonReceivedMail(struct DayCare *daycare, u8 daycareId)
GetBoxMonNickname(&daycareMon->mon, nickname); GetBoxMonNickname(&daycareMon->mon, nickname);
if (daycareMon->mail.message.itemId != ITEM_NONE if (daycareMon->mail.message.itemId != ITEM_NONE
&& (StringCompareWithoutExtCtrlCodes(nickname, daycareMon->mail.monName) != 0 && (StringCompareWithoutExtCtrlCodes(nickname, daycareMon->mail.monName) != 0
|| StringCompareWithoutExtCtrlCodes(gSaveBlock2Ptr->playerName, daycareMon->mail.OT_name) != 0)) || StringCompareWithoutExtCtrlCodes(gSaveBlock2Ptr->playerName, daycareMon->mail.otName) != 0))
{ {
StringCopy(gStringVar1, nickname); StringCopy(gStringVar1, nickname);
TVShowConvertInternationalString(gStringVar2, daycareMon->mail.OT_name, daycareMon->mail.gameLanguage); TVShowConvertInternationalString(gStringVar2, daycareMon->mail.otName, daycareMon->mail.gameLanguage);
TVShowConvertInternationalString(gStringVar3, daycareMon->mail.monName, daycareMon->mail.monLanguage); TVShowConvertInternationalString(gStringVar3, daycareMon->mail.monName, daycareMon->mail.monLanguage);
return TRUE; return TRUE;
} }

View File

@ -235,9 +235,7 @@ void Task_ReturnToFieldRecordMixing(u8 taskId)
break; break;
case 1: case 1:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{
task->tState++; task->tState++;
}
break; break;
case 2: case 2:
StartSendingKeysToLink(); StartSendingKeysToLink();

View File

@ -2071,61 +2071,61 @@ void ShowFrontierManiacMessage(void)
{ {
static const u8 *const sFrontierManiacMessages[][FRONTIER_MANIAC_MESSAGE_COUNT] = static const u8 *const sFrontierManiacMessages[][FRONTIER_MANIAC_MESSAGE_COUNT] =
{ {
[FRONTIER_MANIAC_BATTLE_TOWER_SINGLES] = [FRONTIER_MANIAC_TOWER_SINGLES] =
{ {
BattleFrontier_Lounge2_Text_SalonMaidenIsThere, BattleFrontier_Lounge2_Text_SalonMaidenIsThere,
BattleFrontier_Lounge2_Text_SalonMaidenSilverMons, BattleFrontier_Lounge2_Text_SalonMaidenSilverMons,
BattleFrontier_Lounge2_Text_SalonMaidenGoldMons BattleFrontier_Lounge2_Text_SalonMaidenGoldMons
}, },
[FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES] = [FRONTIER_MANIAC_TOWER_DOUBLES] =
{ {
BattleFrontier_Lounge2_Text_DoubleBattleAdvice1, BattleFrontier_Lounge2_Text_DoubleBattleAdvice1,
BattleFrontier_Lounge2_Text_DoubleBattleAdvice2, BattleFrontier_Lounge2_Text_DoubleBattleAdvice2,
BattleFrontier_Lounge2_Text_DoubleBattleAdvice3 BattleFrontier_Lounge2_Text_DoubleBattleAdvice3
}, },
[FRONTIER_MANIAC_BATTLE_TOWER_MULTIS] = [FRONTIER_MANIAC_TOWER_MULTIS] =
{ {
BattleFrontier_Lounge2_Text_MultiBattleAdvice, BattleFrontier_Lounge2_Text_MultiBattleAdvice,
BattleFrontier_Lounge2_Text_MultiBattleAdvice, BattleFrontier_Lounge2_Text_MultiBattleAdvice,
BattleFrontier_Lounge2_Text_MultiBattleAdvice BattleFrontier_Lounge2_Text_MultiBattleAdvice
}, },
[FRONTIER_MANIAC_BATTLE_TOWER_LINK] = [FRONTIER_MANIAC_TOWER_LINK] =
{ {
BattleFrontier_Lounge2_Text_LinkMultiBattleAdvice, BattleFrontier_Lounge2_Text_LinkMultiBattleAdvice,
BattleFrontier_Lounge2_Text_LinkMultiBattleAdvice, BattleFrontier_Lounge2_Text_LinkMultiBattleAdvice,
BattleFrontier_Lounge2_Text_LinkMultiBattleAdvice BattleFrontier_Lounge2_Text_LinkMultiBattleAdvice
}, },
[FRONTIER_MANIAC_BATTLE_DOME] = [FRONTIER_MANIAC_DOME] =
{ {
BattleFrontier_Lounge2_Text_DomeAceIsThere, BattleFrontier_Lounge2_Text_DomeAceIsThere,
BattleFrontier_Lounge2_Text_DomeAceSilverMons, BattleFrontier_Lounge2_Text_DomeAceSilverMons,
BattleFrontier_Lounge2_Text_DomeAceGoldMons BattleFrontier_Lounge2_Text_DomeAceGoldMons
}, },
[FRONTIER_MANIAC_BATTLE_FACTORY] = [FRONTIER_MANIAC_FACTORY] =
{ {
BattleFrontier_Lounge2_Text_FactoryHeadIsThere, BattleFrontier_Lounge2_Text_FactoryHeadIsThere,
BattleFrontier_Lounge2_Text_FactoryHeadSilverMons, BattleFrontier_Lounge2_Text_FactoryHeadSilverMons,
BattleFrontier_Lounge2_Text_FactoryHeadGoldMons BattleFrontier_Lounge2_Text_FactoryHeadGoldMons
}, },
[FRONTIER_MANIAC_BATTLE_PALACE] = [FRONTIER_MANIAC_PALACE] =
{ {
BattleFrontier_Lounge2_Text_PalaceMavenIsThere, BattleFrontier_Lounge2_Text_PalaceMavenIsThere,
BattleFrontier_Lounge2_Text_PalaceMavenSilverMons, BattleFrontier_Lounge2_Text_PalaceMavenSilverMons,
BattleFrontier_Lounge2_Text_PalaceMavenGoldMons BattleFrontier_Lounge2_Text_PalaceMavenGoldMons
}, },
[FRONTIER_MANIAC_BATTLE_ARENA] = [FRONTIER_MANIAC_ARENA] =
{ {
BattleFrontier_Lounge2_Text_ArenaTycoonIsThere, BattleFrontier_Lounge2_Text_ArenaTycoonIsThere,
BattleFrontier_Lounge2_Text_ArenaTycoonSilverMons, BattleFrontier_Lounge2_Text_ArenaTycoonSilverMons,
BattleFrontier_Lounge2_Text_ArenaTycoonGoldMons BattleFrontier_Lounge2_Text_ArenaTycoonGoldMons
}, },
[FRONTIER_MANIAC_BATTLE_PIKE] = [FRONTIER_MANIAC_PIKE] =
{ {
BattleFrontier_Lounge2_Text_PikeQueenIsThere, BattleFrontier_Lounge2_Text_PikeQueenIsThere,
BattleFrontier_Lounge2_Text_PikeQueenSilverMons, BattleFrontier_Lounge2_Text_PikeQueenSilverMons,
BattleFrontier_Lounge2_Text_PikeQueenGoldMons BattleFrontier_Lounge2_Text_PikeQueenGoldMons
}, },
[FRONTIER_MANIAC_BATTLE_PYRAMID] = [FRONTIER_MANIAC_PYRAMID] =
{ {
BattleFrontier_Lounge2_Text_PyramidKingIsThere, BattleFrontier_Lounge2_Text_PyramidKingIsThere,
BattleFrontier_Lounge2_Text_PyramidKingSilverMons, BattleFrontier_Lounge2_Text_PyramidKingSilverMons,
@ -2135,16 +2135,16 @@ void ShowFrontierManiacMessage(void)
static const u8 sFrontierManiacStreakThresholds[][FRONTIER_MANIAC_MESSAGE_COUNT - 1] = static const u8 sFrontierManiacStreakThresholds[][FRONTIER_MANIAC_MESSAGE_COUNT - 1] =
{ {
[FRONTIER_MANIAC_BATTLE_TOWER_SINGLES] = { 21, 56 }, [FRONTIER_MANIAC_TOWER_SINGLES] = { 21, 56 },
[FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES] = { 21, 35 }, [FRONTIER_MANIAC_TOWER_DOUBLES] = { 21, 35 },
[FRONTIER_MANIAC_BATTLE_TOWER_MULTIS] = { 255, 255 }, [FRONTIER_MANIAC_TOWER_MULTIS] = { 255, 255 },
[FRONTIER_MANIAC_BATTLE_TOWER_LINK] = { 255, 255 }, [FRONTIER_MANIAC_TOWER_LINK] = { 255, 255 },
[FRONTIER_MANIAC_BATTLE_DOME] = { 2, 4 }, [FRONTIER_MANIAC_DOME] = { 2, 4 },
[FRONTIER_MANIAC_BATTLE_FACTORY] = { 7, 21 }, [FRONTIER_MANIAC_FACTORY] = { 7, 21 },
[FRONTIER_MANIAC_BATTLE_PALACE] = { 7, 21 }, [FRONTIER_MANIAC_PALACE] = { 7, 21 },
[FRONTIER_MANIAC_BATTLE_ARENA] = { 14, 28 }, [FRONTIER_MANIAC_ARENA] = { 14, 28 },
[FRONTIER_MANIAC_BATTLE_PIKE] = { 13, 112 }, //BUG: 112 (0x70) is probably a mistake; the Pike Queen is battled twice well before that [FRONTIER_MANIAC_PIKE] = { 13, 112 }, //BUG: 112 (0x70) is probably a mistake; the Pike Queen is battled twice well before that
[FRONTIER_MANIAC_BATTLE_PYRAMID] = { 7, 56 } [FRONTIER_MANIAC_PYRAMID] = { 7, 56 }
}; };
u8 i; u8 i;
@ -2153,10 +2153,10 @@ void ShowFrontierManiacMessage(void)
switch (facility) switch (facility)
{ {
case FRONTIER_MANIAC_BATTLE_TOWER_SINGLES: case FRONTIER_MANIAC_TOWER_SINGLES:
case FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES: case FRONTIER_MANIAC_TOWER_DOUBLES:
case FRONTIER_MANIAC_BATTLE_TOWER_MULTIS: case FRONTIER_MANIAC_TOWER_MULTIS:
case FRONTIER_MANIAC_BATTLE_TOWER_LINK: case FRONTIER_MANIAC_TOWER_LINK:
if (gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN])
{ {
@ -2167,7 +2167,7 @@ void ShowFrontierManiacMessage(void)
winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN];
} }
break; break;
case FRONTIER_MANIAC_BATTLE_DOME: case FRONTIER_MANIAC_DOME:
if (gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN])
{ {
@ -2178,7 +2178,7 @@ void ShowFrontierManiacMessage(void)
winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN];
} }
break; break;
case FRONTIER_MANIAC_BATTLE_FACTORY: case FRONTIER_MANIAC_FACTORY:
if (gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN])
{ {
@ -2189,7 +2189,7 @@ void ShowFrontierManiacMessage(void)
winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN];
} }
break; break;
case FRONTIER_MANIAC_BATTLE_PALACE: case FRONTIER_MANIAC_PALACE:
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN])
{ {
@ -2200,7 +2200,7 @@ void ShowFrontierManiacMessage(void)
winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN];
} }
break; break;
case FRONTIER_MANIAC_BATTLE_ARENA: case FRONTIER_MANIAC_ARENA:
if (gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN])
{ {
@ -2211,7 +2211,7 @@ void ShowFrontierManiacMessage(void)
winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN];
} }
break; break;
case FRONTIER_MANIAC_BATTLE_PIKE: case FRONTIER_MANIAC_PIKE:
if (gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN])
{ {
@ -2222,7 +2222,7 @@ void ShowFrontierManiacMessage(void)
winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN];
} }
break; break;
case FRONTIER_MANIAC_BATTLE_PYRAMID: case FRONTIER_MANIAC_PYRAMID:
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN])
{ {

View File

@ -683,16 +683,16 @@ const u16 gFrontierBannedSpecies[] =
static const u8 *const sRecordsWindowChallengeTexts[][2] = static const u8 *const sRecordsWindowChallengeTexts[][2] =
{ {
[RANKING_HALL_BATTLE_TOWER_SINGLES] = {gText_BattleTower2, gText_FacilitySingle}, [RANKING_HALL_TOWER_SINGLES] = {gText_BattleTower2, gText_FacilitySingle},
[RANKING_HALL_BATTLE_TOWER_DOUBLES] = {gText_BattleTower2, gText_FacilityDouble}, [RANKING_HALL_TOWER_DOUBLES] = {gText_BattleTower2, gText_FacilityDouble},
[RANKING_HALL_BATTLE_TOWER_MULTIS] = {gText_BattleTower2, gText_FacilityMulti}, [RANKING_HALL_TOWER_MULTIS] = {gText_BattleTower2, gText_FacilityMulti},
[RANKING_HALL_BATTLE_DOME] = {gText_BattleDome, gText_FacilitySingle}, [RANKING_HALL_DOME] = {gText_BattleDome, gText_FacilitySingle},
[RANKING_HALL_BATTLE_PALACE] = {gText_BattlePalace, gText_FacilitySingle}, [RANKING_HALL_PALACE] = {gText_BattlePalace, gText_FacilitySingle},
[RANKING_HALL_BATTLE_ARENA] = {gText_BattleArena, gText_Facility}, [RANKING_HALL_ARENA] = {gText_BattleArena, gText_Facility},
[RANKING_HALL_BATTLE_FACTORY] = {gText_BattleFactory, gText_FacilitySingle}, [RANKING_HALL_FACTORY] = {gText_BattleFactory, gText_FacilitySingle},
[RANKING_HALL_BATTLE_PIKE] = {gText_BattlePike, gText_Facility}, [RANKING_HALL_PIKE] = {gText_BattlePike, gText_Facility},
[RANKING_HALL_BATTLE_PYRAMID] = {gText_BattlePyramid, gText_Facility}, [RANKING_HALL_PYRAMID] = {gText_BattlePyramid, gText_Facility},
[RANKING_HALL_BATTLE_TOWER_LINK] = {gText_BattleTower2, gText_FacilityLink}, [RANKING_HALL_TOWER_LINK] = {gText_BattleTower2, gText_FacilityLink},
}; };
static const u8 *const sLevelModeText[] = static const u8 *const sLevelModeText[] =
@ -703,16 +703,16 @@ static const u8 *const sLevelModeText[] =
static const u8 *const sHallFacilityToRecordsText[] = static const u8 *const sHallFacilityToRecordsText[] =
{ {
[RANKING_HALL_BATTLE_TOWER_SINGLES] = gText_FrontierFacilityWinStreak, [RANKING_HALL_TOWER_SINGLES] = gText_FrontierFacilityWinStreak,
[RANKING_HALL_BATTLE_TOWER_DOUBLES] = gText_FrontierFacilityWinStreak, [RANKING_HALL_TOWER_DOUBLES] = gText_FrontierFacilityWinStreak,
[RANKING_HALL_BATTLE_TOWER_MULTIS] = gText_FrontierFacilityWinStreak, [RANKING_HALL_TOWER_MULTIS] = gText_FrontierFacilityWinStreak,
[RANKING_HALL_BATTLE_DOME] = gText_FrontierFacilityClearStreak, [RANKING_HALL_DOME] = gText_FrontierFacilityClearStreak,
[RANKING_HALL_BATTLE_PALACE] = gText_FrontierFacilityWinStreak, [RANKING_HALL_PALACE] = gText_FrontierFacilityWinStreak,
[RANKING_HALL_BATTLE_ARENA] = gText_FrontierFacilityKOsStreak, [RANKING_HALL_ARENA] = gText_FrontierFacilityKOsStreak,
[RANKING_HALL_BATTLE_FACTORY] = gText_FrontierFacilityWinStreak, [RANKING_HALL_FACTORY] = gText_FrontierFacilityWinStreak,
[RANKING_HALL_BATTLE_PIKE] = gText_FrontierFacilityRoomsCleared, [RANKING_HALL_PIKE] = gText_FrontierFacilityRoomsCleared,
[RANKING_HALL_BATTLE_PYRAMID] = gText_FrontierFacilityFloorsCleared, [RANKING_HALL_PYRAMID] = gText_FrontierFacilityFloorsCleared,
[RANKING_HALL_BATTLE_TOWER_LINK] = gText_FrontierFacilityWinStreak, [RANKING_HALL_TOWER_LINK] = gText_FrontierFacilityWinStreak,
}; };
static const u16 sFrontierBrainTrainerIds[NUM_FRONTIER_FACILITIES] = static const u16 sFrontierBrainTrainerIds[NUM_FRONTIER_FACILITIES] =
@ -2261,28 +2261,28 @@ static void Print2PRecord(s32 position, s32 x, s32 y, struct RankingHall2P *hall
if (winStreak > MAX_STREAK) if (winStreak > MAX_STREAK)
winStreak = MAX_STREAK; winStreak = MAX_STREAK;
ConvertIntToDecimalStringN(gStringVar2, winStreak, STR_CONV_MODE_RIGHT_ALIGN, 4); ConvertIntToDecimalStringN(gStringVar2, winStreak, STR_CONV_MODE_RIGHT_ALIGN, 4);
StringExpandPlaceholders(gStringVar4, sHallFacilityToRecordsText[RANKING_HALL_BATTLE_TOWER_LINK]); StringExpandPlaceholders(gStringVar4, sHallFacilityToRecordsText[RANKING_HALL_TOWER_LINK]);
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, GetStringRightAlignXOffset(1, sHallFacilityToRecordsText[RANKING_HALL_BATTLE_TOWER_LINK], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, GetStringRightAlignXOffset(1, sHallFacilityToRecordsText[RANKING_HALL_TOWER_LINK], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL);
} }
} }
static void Fill1PRecords(struct RankingHall1P *dst, s32 hallFacilityId, s32 lvlMode) static void Fill1PRecords(struct RankingHall1P *dst, s32 hallFacilityId, s32 lvlMode)
{ {
s32 i, j; s32 i, j;
struct RankingHall1P record1P[4]; struct RankingHall1P record1P[HALL_RECORDS_COUNT + 1];
struct PlayerHallRecords *playerHallRecords = calloc(1, sizeof(struct PlayerHallRecords)); struct PlayerHallRecords *playerHallRecords = calloc(1, sizeof(struct PlayerHallRecords));
GetPlayerHallRecords(playerHallRecords); GetPlayerHallRecords(playerHallRecords);
for (i = 0; i < 3; i++) for (i = 0; i < HALL_RECORDS_COUNT; i++)
record1P[i] = gSaveBlock2Ptr->hallRecords1P[hallFacilityId][lvlMode][i]; record1P[i] = gSaveBlock2Ptr->hallRecords1P[hallFacilityId][lvlMode][i];
record1P[3] = playerHallRecords->onePlayer[hallFacilityId][lvlMode]; record1P[HALL_RECORDS_COUNT] = playerHallRecords->onePlayer[hallFacilityId][lvlMode];
for (i = 0; i < 3; i++) for (i = 0; i < HALL_RECORDS_COUNT; i++)
{ {
s32 highestWinStreak = 0; s32 highestWinStreak = 0;
s32 highestId = 0; s32 highestId = 0;
for (j = 0; j < 4; j++) for (j = 0; j < HALL_RECORDS_COUNT + 1; j++)
{ {
if (record1P[j].winStreak > highestWinStreak) if (record1P[j].winStreak > highestWinStreak)
{ {
@ -2290,8 +2290,8 @@ static void Fill1PRecords(struct RankingHall1P *dst, s32 hallFacilityId, s32 lvl
highestWinStreak = record1P[j].winStreak; highestWinStreak = record1P[j].winStreak;
} }
} }
if (record1P[3].winStreak >= highestWinStreak) if (record1P[HALL_RECORDS_COUNT].winStreak >= highestWinStreak)
highestId = 3; highestId = HALL_RECORDS_COUNT;
dst[i] = record1P[highestId]; dst[i] = record1P[highestId];
record1P[highestId].winStreak = 0; record1P[highestId].winStreak = 0;
@ -2346,7 +2346,7 @@ static void PrintHallRecords(s32 hallFacilityId, s32 lvlMode)
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL);
x = GetStringRightAlignXOffset(1, sLevelModeText[lvlMode], 0xD0); x = GetStringRightAlignXOffset(1, sLevelModeText[lvlMode], 0xD0);
AddTextPrinterParameterized(gRecordsWindowId, 1, sLevelModeText[lvlMode], x, 1, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(gRecordsWindowId, 1, sLevelModeText[lvlMode], x, 1, TEXT_SPEED_FF, NULL);
if (hallFacilityId == RANKING_HALL_BATTLE_TOWER_LINK) if (hallFacilityId == RANKING_HALL_TOWER_LINK)
{ {
gSaveBlock2Ptr->frontier.opponentNames[0][PLAYER_NAME_LENGTH] = EOS; gSaveBlock2Ptr->frontier.opponentNames[0][PLAYER_NAME_LENGTH] = EOS;
gSaveBlock2Ptr->frontier.opponentNames[1][PLAYER_NAME_LENGTH] = EOS; gSaveBlock2Ptr->frontier.opponentNames[1][PLAYER_NAME_LENGTH] = EOS;
@ -2393,9 +2393,9 @@ void ClearRankingHallRecords(void)
for (i = 0; i < HALL_FACILITIES_COUNT; i++) for (i = 0; i < HALL_FACILITIES_COUNT; i++)
{ {
for (j = 0; j < 2; j++) for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++)
{ {
for (k = 0; k < 3; k++) for (k = 0; k < HALL_RECORDS_COUNT; k++)
{ {
CopyTrainerId(gSaveBlock2Ptr->hallRecords1P[i][j][k].id, ZERO); CopyTrainerId(gSaveBlock2Ptr->hallRecords1P[i][j][k].id, ZERO);
gSaveBlock2Ptr->hallRecords1P[i][j][k].name[0] = EOS; gSaveBlock2Ptr->hallRecords1P[i][j][k].name[0] = EOS;
@ -2404,9 +2404,9 @@ void ClearRankingHallRecords(void)
} }
} }
for (j = 0; j < 2; j++) for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++)
{ {
for (k = 0; k < 3; k++) for (k = 0; k < HALL_RECORDS_COUNT; k++)
{ {
CopyTrainerId(gSaveBlock2Ptr->hallRecords2P[j][k].id1, ZERO); CopyTrainerId(gSaveBlock2Ptr->hallRecords2P[j][k].id1, ZERO);
CopyTrainerId(gSaveBlock2Ptr->hallRecords2P[j][k].id2, ZERO); CopyTrainerId(gSaveBlock2Ptr->hallRecords2P[j][k].id2, ZERO);

View File

@ -182,7 +182,7 @@ u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId)
// Mail in the bag menu can't have a message but it can be checked (view the mail background, no message) // Mail in the bag menu can't have a message but it can be checked (view the mail background, no message)
static void CB2_CheckMail(void) static void CB2_CheckMail(void)
{ {
struct MailStruct mail; struct Mail mail;
mail.itemId = gSpecialVar_ItemId; mail.itemId = gSpecialVar_ItemId;
ReadMail(&mail, CB2_ReturnToBagMenuPocket, 0); ReadMail(&mail, CB2_ReturnToBagMenuPocket, 0);
} }

View File

@ -25,7 +25,7 @@ struct LoadedSaveData
/*0x00F0*/ struct ItemSlot pokeBalls[BAG_POKEBALLS_COUNT]; /*0x00F0*/ struct ItemSlot pokeBalls[BAG_POKEBALLS_COUNT];
/*0x0130*/ struct ItemSlot TMsHMs[BAG_TMHM_COUNT]; /*0x0130*/ struct ItemSlot TMsHMs[BAG_TMHM_COUNT];
/*0x0230*/ struct ItemSlot berries[BAG_BERRIES_COUNT]; /*0x0230*/ struct ItemSlot berries[BAG_BERRIES_COUNT];
/*0x02E8*/ struct MailStruct mail[MAIL_COUNT]; /*0x02E8*/ struct Mail mail[MAIL_COUNT];
}; };
// EWRAM DATA // EWRAM DATA

View File

@ -61,7 +61,7 @@ struct MailRead
/*0x0200*/ u8 playerName[12]; /*0x0200*/ u8 playerName[12];
/*0x020C*/ MainCallback exitCallback; /*0x020C*/ MainCallback exitCallback;
/*0x0210*/ MainCallback callback; /*0x0210*/ MainCallback callback;
/*0x0214*/ struct MailStruct *mail; /*0x0214*/ struct Mail *mail;
/*0x0218*/ bool8 hasText; /*0x0218*/ bool8 hasText;
/*0x0219*/ u8 signatureWidth; /*0x0219*/ u8 signatureWidth;
/*0x021a*/ u8 mailType; /*0x021a*/ u8 mailType;
@ -443,7 +443,7 @@ static const struct MailLayout sMailLayouts_Tall[] = {
}, },
}; };
void ReadMail(struct MailStruct *mail, void (*exitCallback)(void), bool8 hasText) void ReadMail(struct Mail *mail, void (*exitCallback)(void), bool8 hasText)
{ {
u16 buffer[2]; u16 buffer[2];
u16 species; u16 species;

View File

@ -7,15 +7,17 @@
#include "international_string_util.h" #include "international_string_util.h"
#include "constants/easy_chat.h" #include "constants/easy_chat.h"
void ClearMailData(void) #define UNOWN_OFFSET 30000
void ClearAllMail(void)
{ {
u8 i; u8 i;
for (i = 0; i < MAIL_COUNT; i++) for (i = 0; i < MAIL_COUNT; i++)
ClearMailStruct(&gSaveBlock1Ptr->mail[i]); ClearMail(&gSaveBlock1Ptr->mail[i]);
} }
void ClearMailStruct(struct MailStruct *mail) void ClearMail(struct Mail *mail)
{ {
s32 i; s32 i;
@ -41,7 +43,7 @@ bool8 MonHasMail(struct Pokemon *mon)
return FALSE; return FALSE;
} }
u8 GiveMailToMon(struct Pokemon *mon, u16 itemId) u8 GiveMailToMonByItemId(struct Pokemon *mon, u16 itemId)
{ {
u8 heldItem[2]; u8 heldItem[2];
u8 id, i; u8 id, i;
@ -83,7 +85,7 @@ u16 SpeciesToMailSpecies(u16 species, u32 personality)
{ {
if (species == SPECIES_UNOWN) if (species == SPECIES_UNOWN)
{ {
u32 species = GetUnownLetterByPersonality(personality) + 30000; u32 species = GetUnownLetterByPersonality(personality) + UNOWN_OFFSET;
return species; return species;
} }
@ -94,10 +96,10 @@ u16 MailSpeciesToSpecies(u16 mailSpecies, u16 *buffer)
{ {
u16 result; u16 result;
if (mailSpecies >= 30000 && mailSpecies < (30000 + NUM_UNOWN_FORMS)) if (mailSpecies >= UNOWN_OFFSET && mailSpecies < UNOWN_OFFSET + NUM_UNOWN_FORMS)
{ {
result = SPECIES_UNOWN; result = SPECIES_UNOWN;
*buffer = mailSpecies - 30000; *buffer = mailSpecies - UNOWN_OFFSET;
} }
else else
{ {
@ -107,11 +109,11 @@ u16 MailSpeciesToSpecies(u16 mailSpecies, u16 *buffer)
return result; return result;
} }
u8 GiveMailToMon2(struct Pokemon *mon, struct MailStruct *mail) u8 GiveMailToMon(struct Pokemon *mon, struct Mail *mail)
{ {
u8 heldItem[2]; u8 heldItem[2];
u16 itemId = mail->itemId; u16 itemId = mail->itemId;
u8 mailId = GiveMailToMon(mon, itemId); u8 mailId = GiveMailToMonByItemId(mon, itemId);
if (mailId == MAIL_NONE) if (mailId == MAIL_NONE)
return MAIL_NONE; return MAIL_NONE;
@ -169,7 +171,7 @@ u8 TakeMailFromMon2(struct Pokemon *mon)
{ {
if (gSaveBlock1Ptr->mail[i].itemId == ITEM_NONE) if (gSaveBlock1Ptr->mail[i].itemId == ITEM_NONE)
{ {
memcpy(&gSaveBlock1Ptr->mail[i], &gSaveBlock1Ptr->mail[GetMonData(mon, MON_DATA_MAIL)], sizeof(struct MailStruct)); memcpy(&gSaveBlock1Ptr->mail[i], &gSaveBlock1Ptr->mail[GetMonData(mon, MON_DATA_MAIL)], sizeof(struct Mail));
gSaveBlock1Ptr->mail[GetMonData(mon, MON_DATA_MAIL)].itemId = ITEM_NONE; gSaveBlock1Ptr->mail[GetMonData(mon, MON_DATA_MAIL)].itemId = ITEM_NONE;
SetMonData(mon, MON_DATA_MAIL, &newMailId); SetMonData(mon, MON_DATA_MAIL, &newMailId);
SetMonData(mon, MON_DATA_HELD_ITEM, newHeldItem); SetMonData(mon, MON_DATA_HELD_ITEM, newHeldItem);

View File

@ -1902,7 +1902,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId)
case FRONTIER_FACILITY_DOME: case FRONTIER_FACILITY_DOME:
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
for (j = 0; j < 2; j++) for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++)
{ {
if (streak < gSaveBlock2Ptr->frontier.domeRecordWinStreaks[i][j]) if (streak < gSaveBlock2Ptr->frontier.domeRecordWinStreaks[i][j])
streak = gSaveBlock2Ptr->frontier.domeRecordWinStreaks[i][j]; streak = gSaveBlock2Ptr->frontier.domeRecordWinStreaks[i][j];
@ -1915,7 +1915,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId)
#else #else
case FRONTIER_FACILITY_FACTORY: case FRONTIER_FACILITY_FACTORY:
#endif #endif
for (i = 0; i < 2; i++) for (i = 0; i < FRONTIER_LVL_MODE_COUNT; i++)
{ {
if (streak < gSaveBlock2Ptr->frontier.pikeRecordStreaks[i]) if (streak < gSaveBlock2Ptr->frontier.pikeRecordStreaks[i])
streak = gSaveBlock2Ptr->frontier.pikeRecordStreaks[i]; streak = gSaveBlock2Ptr->frontier.pikeRecordStreaks[i];
@ -1925,7 +1925,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId)
case FRONTIER_FACILITY_TOWER: case FRONTIER_FACILITY_TOWER:
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
for (j = 0; j < 2; j++) for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++)
{ {
if (streak < gSaveBlock2Ptr->frontier.towerRecordWinStreaks[i][j]) if (streak < gSaveBlock2Ptr->frontier.towerRecordWinStreaks[i][j])
streak = gSaveBlock2Ptr->frontier.towerRecordWinStreaks[i][j]; streak = gSaveBlock2Ptr->frontier.towerRecordWinStreaks[i][j];
@ -1936,7 +1936,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId)
case FRONTIER_FACILITY_PALACE: case FRONTIER_FACILITY_PALACE:
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
for (j = 0; j < 2; j++) for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++)
{ {
if (streak < gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[i][j]) if (streak < gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[i][j])
streak = gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[i][j]; streak = gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[i][j];
@ -1951,7 +1951,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId)
#endif #endif
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
for (j = 0; j < 2; j++) for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++)
{ {
if (streak < gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[i][j]) if (streak < gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[i][j])
streak = gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[i][j]; streak = gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[i][j];
@ -1960,7 +1960,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId)
*topicTextId = GEN_TOPIC_STREAK_RECORD - 1; *topicTextId = GEN_TOPIC_STREAK_RECORD - 1;
break; break;
case FRONTIER_FACILITY_ARENA: case FRONTIER_FACILITY_ARENA:
for (i = 0; i < 2; i++) for (i = 0; i < FRONTIER_LVL_MODE_COUNT; i++)
{ {
if (streak < gSaveBlock2Ptr->frontier.arenaRecordStreaks[i]) if (streak < gSaveBlock2Ptr->frontier.arenaRecordStreaks[i])
streak = gSaveBlock2Ptr->frontier.arenaRecordStreaks[i]; streak = gSaveBlock2Ptr->frontier.arenaRecordStreaks[i];
@ -1968,7 +1968,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId)
*topicTextId = GEN_TOPIC_STREAK_RECORD - 1; *topicTextId = GEN_TOPIC_STREAK_RECORD - 1;
break; break;
case FRONTIER_FACILITY_PYRAMID: case FRONTIER_FACILITY_PYRAMID:
for (i = 0; i < 2; i++) for (i = 0; i < FRONTIER_LVL_MODE_COUNT; i++)
{ {
if (streak < gSaveBlock2Ptr->frontier.pyramidRecordStreaks[i]) if (streak < gSaveBlock2Ptr->frontier.pyramidRecordStreaks[i])
streak = gSaveBlock2Ptr->frontier.pyramidRecordStreaks[i]; streak = gSaveBlock2Ptr->frontier.pyramidRecordStreaks[i];

View File

@ -302,7 +302,7 @@ bool8 MEScrCmd_setrecordmixinggift(struct ScriptContext *ctx)
bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx) bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
{ {
struct MailStruct mail; struct Mail mail;
struct Pokemon pokemon; struct Pokemon pokemon;
u16 species; u16 species;
u16 heldItem; u16 heldItem;
@ -326,7 +326,7 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
else else
{ {
memcpy(&gPlayerParty[PARTY_SIZE - 1], pokemonPtr, sizeof(struct Pokemon)); memcpy(&gPlayerParty[PARTY_SIZE - 1], pokemonPtr, sizeof(struct Pokemon));
memcpy(&mail, mailPtr, sizeof(struct MailStruct)); memcpy(&mail, mailPtr, sizeof(struct Mail));
if (species != SPECIES_EGG) if (species != SPECIES_EGG)
{ {
@ -337,7 +337,7 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
heldItem = GetMonData(&gPlayerParty[PARTY_SIZE - 1], MON_DATA_HELD_ITEM); heldItem = GetMonData(&gPlayerParty[PARTY_SIZE - 1], MON_DATA_HELD_ITEM);
if (ItemIsMail(heldItem)) if (ItemIsMail(heldItem))
GiveMailToMon2(&gPlayerParty[PARTY_SIZE - 1], &mail); GiveMailToMon(&gPlayerParty[PARTY_SIZE - 1], &mail);
CompactPartySlots(); CompactPartySlots();
CalculatePlayerPartyCount(); CalculatePlayerPartyCount();
StringExpandPlaceholders(gStringVar4, gText_MysteryGiftSentOver); StringExpandPlaceholders(gStringVar4, gText_MysteryGiftSentOver);

View File

@ -158,7 +158,7 @@ void NewGameInitData(void)
ResetPokedex(); ResetPokedex();
ClearFrontierRecord(); ClearFrontierRecord();
ClearSav1(); ClearSav1();
ClearMailData(); ClearAllMail();
gSaveBlock2Ptr->specialSaveWarpFlags = 0; gSaveBlock2Ptr->specialSaveWarpFlags = 0;
gSaveBlock2Ptr->gcnLinkFlags = 0; gSaveBlock2Ptr->gcnLinkFlags = 0;
InitPlayerTrainerId(); InitPlayerTrainerId();

View File

@ -1726,7 +1726,7 @@ static void GiveItemToMon(struct Pokemon *mon, u16 item)
if (ItemIsMail(item) == TRUE) if (ItemIsMail(item) == TRUE)
{ {
if (GiveMailToMon(mon, item) == 0xFF) if (GiveMailToMonByItemId(mon, item) == MAIL_NONE)
return; return;
} }
itemBytes[0] = item; itemBytes[0] = item;
@ -5468,7 +5468,7 @@ void ChooseMonToGiveMailFromMailbox(void)
static void TryGiveMailToSelectedMon(u8 taskId) static void TryGiveMailToSelectedMon(u8 taskId)
{ {
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId]; struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
struct MailStruct *mail; struct Mail *mail;
gPartyMenuUseExitCallback = FALSE; gPartyMenuUseExitCallback = FALSE;
mail = &gSaveBlock1Ptr->mail[gPlayerPCItemPageInfo.itemsAbove + PARTY_SIZE + gPlayerPCItemPageInfo.cursorPos]; mail = &gSaveBlock1Ptr->mail[gPlayerPCItemPageInfo.itemsAbove + PARTY_SIZE + gPlayerPCItemPageInfo.cursorPos];
@ -5478,8 +5478,8 @@ static void TryGiveMailToSelectedMon(u8 taskId)
} }
else else
{ {
GiveMailToMon2(mon, mail); GiveMailToMon(mon, mail);
ClearMailStruct(mail); ClearMail(mail);
DisplayPartyMenuMessage(gText_MailTransferredFromMailbox, TRUE); DisplayPartyMenuMessage(gText_MailTransferredFromMailbox, TRUE);
} }
ScheduleBgCopyTilemapToVram(2); ScheduleBgCopyTilemapToVram(2);

View File

@ -674,7 +674,7 @@ static u8 GetMailboxMailCount(void)
static void Mailbox_CompactMailList(void) static void Mailbox_CompactMailList(void)
{ {
struct MailStruct temp; struct Mail temp;
u8 i, j; u8 i, j;
for (i = PARTY_SIZE; i < MAIL_COUNT - 1; i++) for (i = PARTY_SIZE; i < MAIL_COUNT - 1; i++)
@ -850,7 +850,7 @@ static void Mailbox_HandleConfirmMoveToBag(u8 taskId)
static void Mailbox_DoMailMoveToBag(u8 taskId) static void Mailbox_DoMailMoveToBag(u8 taskId)
{ {
struct MailStruct *mail = &gSaveBlock1Ptr->mail[gPlayerPCItemPageInfo.itemsAbove + PARTY_SIZE + gPlayerPCItemPageInfo.cursorPos]; struct Mail *mail = &gSaveBlock1Ptr->mail[gPlayerPCItemPageInfo.itemsAbove + PARTY_SIZE + gPlayerPCItemPageInfo.cursorPos];
if (!AddBagItem(mail->itemId, 1)) if (!AddBagItem(mail->itemId, 1))
{ {
DisplayItemMessageOnField(taskId, gText_BagIsFull, Mailbox_Cancel); DisplayItemMessageOnField(taskId, gText_BagIsFull, Mailbox_Cancel);
@ -858,7 +858,7 @@ static void Mailbox_DoMailMoveToBag(u8 taskId)
else else
{ {
DisplayItemMessageOnField(taskId, gText_MailToBagMessageErased, Mailbox_Cancel); DisplayItemMessageOnField(taskId, gText_MailToBagMessageErased, Mailbox_Cancel);
ClearMailStruct(mail); ClearMail(mail);
Mailbox_CompactMailList(); Mailbox_CompactMailList();
gPlayerPCItemPageInfo.count--; gPlayerPCItemPageInfo.count--;
if (gPlayerPCItemPageInfo.count < (gPlayerPCItemPageInfo.pageItems + gPlayerPCItemPageInfo.itemsAbove) && gPlayerPCItemPageInfo.itemsAbove != 0) if (gPlayerPCItemPageInfo.count < (gPlayerPCItemPageInfo.pageItems + gPlayerPCItemPageInfo.itemsAbove) && gPlayerPCItemPageInfo.itemsAbove != 0)

File diff suppressed because it is too large Load Diff

View File

@ -101,7 +101,7 @@ static EWRAM_DATA u8 *sMenuTextAllocBuffer = NULL;
// See the corresponding GFXTAGs in src/data/trade.h // See the corresponding GFXTAGs in src/data/trade.h
static EWRAM_DATA u8 *sMenuTextTileBuffers[GFXTAG_MENU_TEXT_COUNT] = {NULL}; static EWRAM_DATA u8 *sMenuTextTileBuffers[GFXTAG_MENU_TEXT_COUNT] = {NULL};
EWRAM_DATA struct MailStruct gTradeMail[PARTY_SIZE] = {0}; EWRAM_DATA struct Mail gTradeMail[PARTY_SIZE] = {0};
EWRAM_DATA u8 gSelectedTradeMonPositions[2] = {0}; EWRAM_DATA u8 gSelectedTradeMonPositions[2] = {0};
static EWRAM_DATA struct { static EWRAM_DATA struct {
/*0x0000*/ u8 bg2hofs; /*0x0000*/ u8 bg2hofs;
@ -144,7 +144,7 @@ static EWRAM_DATA struct {
} *sTradeMenuData = {NULL}; } *sTradeMenuData = {NULL};
static EWRAM_DATA struct { static EWRAM_DATA struct {
/*0x00*/ struct Pokemon mon; /*0x00*/ struct Pokemon tempMon; // Used as a temp variable when swapping Pokémon
/*0x64*/ u32 timer; /*0x64*/ u32 timer;
/*0x68*/ u32 monPersonalities[2]; /*0x68*/ u32 monPersonalities[2];
/*0x70*/ u8 filler_70[2]; /*0x70*/ u8 filler_70[2];
@ -238,7 +238,7 @@ static void SpriteCB_BouncingPokeballDepart(struct Sprite *);
static void SpriteCB_BouncingPokeballDepartEnd(struct Sprite *); static void SpriteCB_BouncingPokeballDepartEnd(struct Sprite *);
static void SpriteCB_BouncingPokeballArrive(struct Sprite *); static void SpriteCB_BouncingPokeballArrive(struct Sprite *);
static void BufferInGameTradeMonName(void); static void BufferInGameTradeMonName(void);
static void SetInGameTradeMail(struct MailStruct *, const struct InGameTrade *); static void SetInGameTradeMail(struct Mail *, const struct InGameTrade *);
static void CB2_UpdateLinkTrade(void); static void CB2_UpdateLinkTrade(void);
static void CB2_TryFinishTrade(void); static void CB2_TryFinishTrade(void);
static void CB2_SaveAndEndTrade(void); static void CB2_SaveAndEndTrade(void);
@ -1054,7 +1054,7 @@ static bool8 BufferTradeParties(void)
} }
break; break;
case 13: case 13:
Trade_Memcpy(gBlockSendBuffer, gSaveBlock1Ptr->mail, PARTY_SIZE * sizeof(struct MailStruct) + 4); Trade_Memcpy(gBlockSendBuffer, gSaveBlock1Ptr->mail, PARTY_SIZE * sizeof(struct Mail) + 4);
sTradeMenuData->bufferPartyState++; sTradeMenuData->bufferPartyState++;
break; break;
case 15: case 15:
@ -1065,7 +1065,7 @@ static bool8 BufferTradeParties(void)
case 16: case 16:
if (_GetBlockReceivedStatus() == 3) if (_GetBlockReceivedStatus() == 3)
{ {
Trade_Memcpy(gTradeMail, gBlockRecvBuffer[id ^ 1], PARTY_SIZE * sizeof(struct MailStruct)); Trade_Memcpy(gTradeMail, gBlockRecvBuffer[id ^ 1], PARTY_SIZE * sizeof(struct Mail));
TradeResetReceivedFlags(); TradeResetReceivedFlags();
sTradeMenuData->bufferPartyState++; sTradeMenuData->bufferPartyState++;
} }
@ -3043,18 +3043,16 @@ static void TradeMons(u8 playerPartyIdx, u8 partnerPartyIdx)
u16 partnerMail = GetMonData(partnerMon, MON_DATA_MAIL); u16 partnerMail = GetMonData(partnerMon, MON_DATA_MAIL);
if (playerMail != MAIL_NONE) if (playerMail != MAIL_NONE)
ClearMailStruct(&gSaveBlock1Ptr->mail[playerMail]); ClearMail(&gSaveBlock1Ptr->mail[playerMail]);
sTradeData->mon = *playerMon; SWAP(*playerMon, *partnerMon, sTradeData->tempMon);
*playerMon = *partnerMon;
*partnerMon = sTradeData->mon;
friendship = 70; friendship = 70;
if (!GetMonData(playerMon, MON_DATA_IS_EGG)) if (!GetMonData(playerMon, MON_DATA_IS_EGG))
SetMonData(playerMon, MON_DATA_FRIENDSHIP, &friendship); SetMonData(playerMon, MON_DATA_FRIENDSHIP, &friendship);
if (partnerMail != MAIL_NONE) if (partnerMail != MAIL_NONE)
GiveMailToMon2(playerMon, &gTradeMail[partnerMail]); GiveMailToMon(playerMon, &gTradeMail[partnerMail]);
UpdatePokedexForReceivedMon(playerPartyIdx); UpdatePokedexForReceivedMon(playerPartyIdx);
if (gReceivedRemoteLinkPlayers) if (gReceivedRemoteLinkPlayers)
@ -4492,7 +4490,7 @@ static void _CreateInGameTradePokemon(u8 whichPlayerMon, u8 whichInGameTrade)
const struct InGameTrade *inGameTrade = &sIngameTrades[whichInGameTrade]; const struct InGameTrade *inGameTrade = &sIngameTrades[whichInGameTrade];
u8 level = GetMonData(&gPlayerParty[whichPlayerMon], MON_DATA_LEVEL); u8 level = GetMonData(&gPlayerParty[whichPlayerMon], MON_DATA_LEVEL);
struct MailStruct mail; struct Mail mail;
u8 metLocation = METLOC_IN_GAME_TRADE; u8 metLocation = METLOC_IN_GAME_TRADE;
u8 isMail; u8 isMail;
struct Pokemon *pokemon = &gEnemyParty[0]; struct Pokemon *pokemon = &gEnemyParty[0];
@ -4535,7 +4533,7 @@ static void _CreateInGameTradePokemon(u8 whichPlayerMon, u8 whichInGameTrade)
CalculateMonStats(&gEnemyParty[0]); CalculateMonStats(&gEnemyParty[0]);
} }
static void SetInGameTradeMail(struct MailStruct *mail, const struct InGameTrade *trade) { static void SetInGameTradeMail(struct Mail *mail, const struct InGameTrade *trade) {
s32 i; s32 i;
for (i = 0; i < MAIL_WORDS_COUNT; i++) for (i = 0; i < MAIL_WORDS_COUNT; i++)

View File

@ -1495,14 +1495,14 @@ static void Task_StartUnionRoomTrade(u8 taskId)
} }
break; break;
case 2: case 2:
memcpy(gBlockSendBuffer, gSaveBlock1Ptr->mail, sizeof(struct MailStruct) * PARTY_SIZE + 4); memcpy(gBlockSendBuffer, gSaveBlock1Ptr->mail, sizeof(struct Mail) * PARTY_SIZE + 4);
if (SendBlock(0, gBlockSendBuffer, sizeof(struct MailStruct) * PARTY_SIZE + 4)) if (SendBlock(0, gBlockSendBuffer, sizeof(struct Mail) * PARTY_SIZE + 4))
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
break; break;
case 3: case 3:
if (GetBlockReceivedStatus() == 3) if (GetBlockReceivedStatus() == 3)
{ {
memcpy(gTradeMail, gBlockRecvBuffer[GetMultiplayerId() ^ 1], sizeof(struct MailStruct) * PARTY_SIZE); memcpy(gTradeMail, gBlockRecvBuffer[GetMultiplayerId() ^ 1], sizeof(struct Mail) * PARTY_SIZE);
ResetBlockReceivedFlags(); ResetBlockReceivedFlags();
gSelectedTradeMonPositions[TRADE_PLAYER] = monId; gSelectedTradeMonPositions[TRADE_PLAYER] = monId;
gSelectedTradeMonPositions[TRADE_PARTNER] = PARTY_SIZE; gSelectedTradeMonPositions[TRADE_PARTNER] = PARTY_SIZE;