merge 9fd576f37e021f119513a38d3d6e39a2c64f85ec

This commit is contained in:
Evan 2020-06-09 22:07:46 -06:00 committed by ghoulslash
parent a0b3d4df12
commit 741f62fc0b
27 changed files with 437 additions and 38 deletions

View file

@ -11,6 +11,24 @@
#include "constants/species.h"
#include "constants/berry.h"
// free saveblock 1 defines
#define FREE_EXTRA_SEEN_FLAGS //free up extra pokedex seen flags. Frees up 104 bytes
#define FREE_FIELD_3598 //frees up unused saveblock data. 384 bytes
#define FREE_TRAINER_HILL //frees up trainer hill data. 28 bytes
#define FREE_MYSTERY_EVENT_BUFFERS //frees up mystery event. 876 bytes
#define FREE_MATCH_CALL //frees up match call data. 104 bytes
#define FREE_UNION_ROOM_CHAT //frees up field unk3C88. 210 bytes
#define FREE_ENIGMA_BERRY //frees up enigma berry. 52 bytes
#define FREE_LINK_BATTLE_RECORDS //frees link battle record data. 88 bytes
// saveblock1 total: 1846 bytes
//free saveblock 2 defines
#define FREE_BATTLE_TOWER_E_READER //frees up battle tower e reader trainer data. 188 bytes
#define FREE_POKEMON_JUMP //frees up pokemon jump data. 16 bytes
#define FREE_RECORD_MIXING_HALL_RECORDS //frees up hall records for record mixing. 1032 bytes
// saveblock2 total: 1236 bytes
//grand total: 3082
// Prevent cross-jump optimization.
#define BLOCK_CROSS_JUMP asm("");
@ -344,7 +362,9 @@ struct BattleFrontier
/*0x64C*/ struct EmeraldBattleTowerRecord towerPlayer;
/*0x738*/ struct EmeraldBattleTowerRecord towerRecords[BATTLE_TOWER_RECORD_COUNT]; // From record mixing.
/*0xBEB*/ struct BattleTowerInterview towerInterview;
/*0xBEC*/ struct BattleTowerEReaderTrainer ereaderTrainer;
#ifndef FREE_BATTLE_TOWER_E_READER
/*0xBEC*/ struct BattleTowerEReaderTrainer ereaderTrainer; //188 bytes
#endif
/*0xCA8*/ u8 challengeStatus;
/*0xCA9*/ u8 lvlMode:2;
/*0xCA9*/ u8 challengePaused:1;
@ -484,12 +504,16 @@ struct SaveBlock2
/*0xA8*/ u32 gcnLinkFlags; // Read by Pokemon Colosseum/XD
/*0xAC*/ u32 encryptionKey;
/*0xB0*/ struct PlayersApprentice playerApprentice;
/*0xDC*/ struct Apprentice apprentices[APPRENTICE_COUNT];
/*0xDC*/ struct Apprentice apprentices[APPRENTICE_COUNT]; //272 bytes
/*0x1EC*/ struct BerryCrush berryCrush;
/*0x1FC*/ struct PokemonJumpRecords pokeJump;
#ifndef FREE_POKEMON_JUMP
/*0x1FC*/ struct PokemonJumpRecords pokeJump; //16 bytes
#endif
/*0x20C*/ struct BerryPickingResults berryPick;
#ifndef FREE_RECORD_MIXING_HALL_RECORDS
/*0x21C*/ struct RankingHall1P hallRecords1P[HALL_FACILITIES_COUNT][2][3]; // From record mixing.
/*0x57C*/ struct RankingHall2P hallRecords2P[2][3]; // From record mixing.
#endif
/*0x624*/ u16 contestLinkResults[CONTEST_CATEGORIES_COUNT][CONTESTANT_COUNT];
/*0x64C*/ struct BattleFrontier frontier;
}; // sizeof=0xF2C
@ -979,11 +1003,15 @@ struct SaveBlock1
/*0x690*/ struct ItemSlot bagPocket_TMHM[BAG_TMHM_COUNT];
/*0x790*/ struct ItemSlot bagPocket_Berries[BAG_BERRIES_COUNT];
/*0x848*/ struct Pokeblock pokeblocks[POKEBLOCKS_COUNT];
/*0x988*/ u8 seen1[DEX_FLAGS_NO];
#ifndef FREE_EXTRA_SEEN_FLAGS
/*0x988*/ u8 seen1[DEX_FLAGS_NO]; //52 bytes
#endif
/*0x9BC*/ u16 berryBlenderRecords[3];
/*0x9C2*/ u8 field_9C2[6];
/*0x9C8*/ u16 trainerRematchStepCounter;
#ifndef FREE_MATCH_CALL
/*0x9C8*/ u16 trainerRematchStepCounter; //104 bytes
/*0x9CA*/ u8 trainerRematches[MAX_REMATCH_ENTRIES];
#endif
/*0xA30*/ struct ObjectEvent objectEvents[OBJECT_EVENTS_COUNT];
/*0xC70*/ struct ObjectEventTemplate objectEventTemplates[OBJECT_EVENT_TEMPLATES_COUNT];
/*0x1270*/ u8 flags[NUM_FLAG_BYTES];
@ -1002,7 +1030,7 @@ struct SaveBlock1
/*0x2798*/ u8 decorationDolls[40];
/*0x27C0*/ u8 decorationCushions[10];
/*0x27CA*/ u8 padding_27CA[2];
/*0x27CC*/ TVShow tvShows[TV_SHOWS_COUNT];
/*0x27CC*/ TVShow tvShows[TV_SHOWS_COUNT]; //900 bytes
/*0x2B50*/ PokeNews pokeNews[POKE_NEWS_COUNT];
/*0x2B90*/ u16 outbreakPokemonSpecies;
/*0x2B92*/ u8 outbreakLocationMapNum;
@ -1025,23 +1053,39 @@ struct SaveBlock1
/*0x2e64*/ struct DewfordTrend dewfordTrends[SAVED_TRENDS_COUNT];
/*0x2e90*/ struct ContestWinner contestWinners[NUM_CONTEST_WINNERS]; // see CONTEST_WINNER_*
/*0x3030*/ struct DayCare daycare;
#ifndef FREE_LINK_BATTLE_RECORDS
/*0x3150*/ struct LinkBattleRecords linkBattleRecords;
#endif
/*0x31A8*/ u8 giftRibbons[GIFT_RIBBONS_COUNT];
/*0x31B3*/ struct ExternalEventData externalEventData;
/*0x31C7*/ struct ExternalEventFlags externalEventFlags;
/*0x31DC*/ struct Roamer roamer;
/*0x31F8*/ struct EnigmaBerry enigmaBerry;
/*0x322C*/ struct MEventBuffers unk_322C;
/*0x3598*/ u8 field_3598[0x180];
/*0x3718*/ u32 trainerHillTimes[4];
#ifndef FREE_ENIGMA_BERRY
/*0x31F8*/ struct EnigmaBerry enigmaBerry; //52 bytes
#endif
#ifndef FREE_MYSTERY_EVENT_BUFFERS
/*0x322C*/ struct MEventBuffers unk_322C; //876 bytes
#endif
#ifndef FREE_FIELD_3598
/*0x3598*/ u8 field_3598[0x180]; //384 bytes
#endif
#ifndef FREE_TRAINER_HILL
/*0x3718*/ u32 trainerHillTimes[4]; //16 bytes
#endif
/*0x3728*/ struct RamScript ramScript;
/*0x3B14*/ struct RecordMixingGift recordMixingGift;
/*0x3B24*/ u8 seen2[DEX_FLAGS_NO];
#ifndef FREE_EXTRA_SEEN_FLAGS
/*0x3B24*/ u8 seen2[DEX_FLAGS_NO]; //52 bytes
#endif
/*0x3B58*/ LilycoveLady lilycoveLady;
/*0x3B98*/ struct TrainerNameRecord trainerNameRecords[20];
/*0x3C88*/ u8 registeredTexts[UNION_ROOM_KB_ROW_COUNT][21];
/*0x3D5A*/ u8 filler3D5A[0xA];
/*0x3D64*/ struct SaveTrainerHill trainerHill;
#ifndef FREE_UNION_ROOM_CHAT
/*0x3C88*/ u8 registeredTexts[UNION_ROOM_KB_ROW_COUNT][21]; //210 bytes
#endif
/*0x3D5A*/ u8 filler3D5A[0xA]; //10 bytes
#ifndef FREE_TRAINER_HILL
/*0x3D64*/ struct SaveTrainerHill trainerHill; //12 bytes
#endif
/*0x3D70*/ struct WaldaPhrase waldaPhrase;
// sizeof: 0x3D88
};

View file

@ -835,7 +835,11 @@ static bool8 ShouldUseItem(void)
continue;
if (item == ITEM_ENIGMA_BERRY)
#ifndef FREE_ENIGMA_BERRY
itemEffects = gSaveBlock1Ptr->enigmaBerry.itemEffect;
#else
itemEffects = 0;
#endif
else
itemEffects = gItemEffectTable[item - ITEM_POTION];

View file

@ -746,6 +746,7 @@ static void SetPlayerBerryDataInBattleStruct(void)
if (IsEnigmaBerryValid() == TRUE)
{
#ifndef FREE_ENIGMA_BERRY
for (i = 0; i < BERRY_NAME_LENGTH; i++)
battleBerry->name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i];
battleBerry->name[i] = EOS;
@ -755,6 +756,7 @@ static void SetPlayerBerryDataInBattleStruct(void)
battleBerry->holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
battleBerry->holdEffectParam = gSaveBlock1Ptr->enigmaBerry.holdEffectParam;
#endif
}
else
{
@ -781,6 +783,7 @@ static void SetAllPlayersBerryData(void)
{
if (IsEnigmaBerryValid() == TRUE)
{
#ifndef FREE_ENIGMA_BERRY
for (i = 0; i < BERRY_NAME_LENGTH; i++)
{
gEnigmaBerries[0].name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i];
@ -799,6 +802,7 @@ static void SetAllPlayersBerryData(void)
gEnigmaBerries[2].holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
gEnigmaBerries[0].holdEffectParam = gSaveBlock1Ptr->enigmaBerry.holdEffectParam;
gEnigmaBerries[2].holdEffectParam = gSaveBlock1Ptr->enigmaBerry.holdEffectParam;
#endif
}
else
{

View file

@ -225,7 +225,9 @@ static void UpdateLinkBattleRecords(struct LinkBattleRecords *records, const u8
void ClearPlayerLinkBattleRecords(void)
{
#ifndef FREE_LINK_BATTLE_RECORDS
ClearLinkBattleRecords(gSaveBlock1Ptr->linkBattleRecords.entries);
#endif
}
static void IncTrainerCardWins(s32 battlerId)
@ -261,6 +263,7 @@ static void UpdateTrainerCardWinsLosses(s32 battlerId)
void UpdatePlayerLinkBattleRecords(s32 battlerId)
{
#ifndef FREE_LINK_BATTLE_RECORDS
if (InUnionRoom() != TRUE)
{
UpdateTrainerCardWinsLosses(battlerId);
@ -271,6 +274,7 @@ void UpdatePlayerLinkBattleRecords(s32 battlerId)
gBattleOutcome,
battlerId);
}
#endif
}
static void PrintLinkBattleWinsLossesDraws(struct LinkBattleRecord *records)
@ -326,6 +330,7 @@ void ShowLinkBattleRecords(void)
x = GetStringCenterAlignXOffset(1, gStringVar4, 208);
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x, 1, 0, NULL);
#ifndef FREE_LINK_BATTLE_RECORDS
PrintLinkBattleWinsLossesDraws(gSaveBlock1Ptr->linkBattleRecords.entries);
StringExpandPlaceholders(gStringVar4, gText_WinLoseDraw);
@ -335,7 +340,7 @@ void ShowLinkBattleRecords(void)
{
PrintLinkBattleRecord(&gSaveBlock1Ptr->linkBattleRecords.entries[i], 7 + (i * 2), gSaveBlock1Ptr->linkBattleRecords.languages[i]);
}
#endif
PutWindowTilemap(gRecordsWindowId);
CopyWindowToVram(gRecordsWindowId, 3);
}

View file

@ -3258,7 +3258,11 @@ static void Cmd_getexp(void)
item = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
if (item == ITEM_ENIGMA_BERRY)
#ifndef FREE_ENIGMA_BERRY
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
#else
holdEffect = 0;
#endif
else
holdEffect = ItemId_GetHoldEffect(item);
@ -3297,7 +3301,11 @@ static void Cmd_getexp(void)
item = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HELD_ITEM);
if (item == ITEM_ENIGMA_BERRY)
#ifndef FREE_ENIGMA_BERRY
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
#else
holdEffect = 0;
#endif
else
holdEffect = ItemId_GetHoldEffect(item);

View file

@ -1588,7 +1588,8 @@ static bool32 sub_80B1D94(s32 rematchTableId)
static void SetRematchIdForTrainer(const struct RematchTrainer *table, u32 tableId)
{
s32 i;
#ifndef FREE_MATCH_CALL
for (i = 1; i < REMATCHES_COUNT; i++)
{
u16 trainerId = table[tableId].trainerIds[i];
@ -1600,13 +1601,14 @@ static void SetRematchIdForTrainer(const struct RematchTrainer *table, u32 table
}
gSaveBlock1Ptr->trainerRematches[tableId] = i;
#endif
}
static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u16 mapGroup, u16 mapNum)
{
s32 i;
bool32 ret = FALSE;
#ifndef FREE_MATCH_CALL
for (i = 0; i <= REMATCH_SPECIAL_TRAINER_START; i++)
{
if (table[i].mapGroup == mapGroup && table[i].mapNum == mapNum && !sub_80B1D94(i))
@ -1624,7 +1626,7 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u
}
}
}
#endif
return ret;
}
@ -1637,13 +1639,14 @@ void UpdateRematchIfDefeated(s32 rematchTableId)
static bool32 DoesSomeoneWantRematchIn_(const struct RematchTrainer *table, u16 mapGroup, u16 mapNum)
{
s32 i;
#ifndef FREE_MATCH_CALL
for (i = 0; i < REMATCH_TABLE_ENTRIES; i++)
{
if (table[i].mapGroup == mapGroup && table[i].mapNum == mapNum && gSaveBlock1Ptr->trainerRematches[i] != 0)
return TRUE;
}
#endif
return FALSE;
}
@ -1668,9 +1671,10 @@ static bool8 IsFirstTrainerIdReadyForRematch(const struct RematchTrainer *table,
return FALSE;
if (tableId >= MAX_REMATCH_ENTRIES)
return FALSE;
#ifndef FREE_MATCH_CALL
if (gSaveBlock1Ptr->trainerRematches[tableId] == 0)
return FALSE;
#endif
return TRUE;
}
@ -1682,9 +1686,10 @@ static bool8 IsTrainerReadyForRematch_(const struct RematchTrainer *table, u16 t
return FALSE;
if (tableId >= MAX_REMATCH_ENTRIES)
return FALSE;
#ifndef FREE_MATCH_CALL
if (gSaveBlock1Ptr->trainerRematches[tableId] == 0)
return FALSE;
#endif
return TRUE;
}
@ -1732,10 +1737,12 @@ static u16 GetLastBeatenRematchTrainerIdFromTable(const struct RematchTrainer *t
static void ClearTrainerWantRematchState(const struct RematchTrainer *table, u16 firstBattleTrainerId)
{
#ifndef FREE_MATCH_CALL
s32 tableId = TrainerIdToRematchTableId(table, firstBattleTrainerId);
if (tableId != -1)
gSaveBlock1Ptr->trainerRematches[tableId] = 0;
#endif
}
static u32 GetTrainerMatchCallFlag(u32 trainerId)
@ -1793,6 +1800,7 @@ static bool32 HasAtLeastFiveBadges(void)
void IncrementRematchStepCounter(void)
{
#ifndef FREE_MATCH_CALL
if (HasAtLeastFiveBadges())
{
if (gSaveBlock1Ptr->trainerRematchStepCounter >= STEP_COUNTER_MAX)
@ -1800,20 +1808,27 @@ void IncrementRematchStepCounter(void)
else
gSaveBlock1Ptr->trainerRematchStepCounter++;
}
#endif
}
static bool32 IsRematchStepCounterMaxed(void)
{
#ifndef FREE_MATCH_CALL
if (HasAtLeastFiveBadges() && gSaveBlock1Ptr->trainerRematchStepCounter >= STEP_COUNTER_MAX)
return TRUE;
else
return FALSE;
#else
return FALSE;
#endif
}
void TryUpdateRandomTrainerRematches(u16 mapGroup, u16 mapNum)
{
#ifndef FREE_MATCH_CALL
if (IsRematchStepCounterMaxed() && UpdateRandomTrainerRematches(gRematchTable, mapGroup, mapNum) == TRUE)
gSaveBlock1Ptr->trainerRematchStepCounter = 0;
#endif
}
bool32 DoesSomeoneWantRematchIn(u16 mapGroup, u16 mapNum)

View file

@ -970,9 +970,11 @@ static void SetTowerData(void)
static void SetTowerBattleWon(void)
{
#ifndef FREE_BATTLE_TOWER_E_READER
if (gTrainerBattleOpponent_A == TRAINER_EREADER)
ClearEReaderTrainer(&gSaveBlock2Ptr->frontier.ereaderTrainer);
#endif
// towerNumWins is never read outside this conditional
if (gSaveBlock2Ptr->frontier.towerNumWins < MAX_STREAK)
gSaveBlock2Ptr->frontier.towerNumWins++;
@ -1168,11 +1170,15 @@ void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId)
u8 trainerObjectGfxId;
SetFacilityPtrsGetLevel();
#ifndef FREE_BATTLE_TOWER_E_READER
if (trainerId == TRAINER_EREADER)
{
facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass;
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
#else
if (trainerId == TRAINER_FRONTIER_BRAIN)
#endif
{
SetFrontierBrainObjEventGfx_2();
return;
@ -1265,11 +1271,15 @@ u8 GetBattleFacilityTrainerGfxId(u16 trainerId)
u8 trainerObjectGfxId;
SetFacilityPtrsGetLevel();
#ifndef FREE_BATTLE_TOWER_E_READER
if (trainerId == TRAINER_EREADER)
{
facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass;
}
else if (trainerId < FRONTIER_TRAINERS_COUNT)
#else
if (trainerId < FRONTIER_TRAINERS_COUNT)
#endif
{
facilityClass = gFacilityTrainers[trainerId].facilityClass;
}
@ -1408,11 +1418,15 @@ u8 GetFrontierTrainerFrontSpriteId(u16 trainerId)
{
SetFacilityPtrsGetLevel();
#ifndef FREE_BATTLE_TOWER_E_READER
if (trainerId == TRAINER_EREADER)
{
return gFacilityClassToPicIndex[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass];
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
#else
if (trainerId == TRAINER_FRONTIER_BRAIN)
#endif
{
return GetFrontierBrainTrainerPicIndex();
}
@ -1441,11 +1455,15 @@ u8 GetFrontierOpponentClass(u16 trainerId)
u8 trainerClass = 0;
SetFacilityPtrsGetLevel();
#ifndef FREE_BATTLE_TOWER_E_READER
if (trainerId == TRAINER_EREADER)
{
trainerClass = gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass];
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
#else
if (trainerId == TRAINER_FRONTIER_BRAIN)
#endif
{
return GetFrontierBrainTrainerClass();
}
@ -1490,7 +1508,11 @@ static u8 GetFrontierTrainerFacilityClass(u16 trainerId)
if (trainerId == TRAINER_EREADER)
{
#ifndef FREE_BATTLE_TOWER_E_READER
facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass;
#else
facilityClass = 0;
#endif
}
else if (trainerId < FRONTIER_TRAINERS_COUNT)
{
@ -1521,8 +1543,10 @@ void GetFrontierTrainerName(u8 *dst, u16 trainerId)
if (trainerId == TRAINER_EREADER)
{
#ifndef FREE_BATTLE_TOWER_E_READER
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
dst[i] = gSaveBlock2Ptr->frontier.ereaderTrainer.name[i];
#endif
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
{
@ -1583,7 +1607,11 @@ static bool8 IsFrontierTrainerFemale(u16 trainerId)
SetFacilityPtrsGetLevel();
if (trainerId == TRAINER_EREADER)
{
#ifndef FREE_BATTLE_TOWER_E_READER
facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass;
#else
facilityClass = 0;
#endif
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
{
@ -1652,8 +1680,10 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
}
else if (trainerId == TRAINER_EREADER)
{
#ifndef FREE_BATTLE_TOWER_E_READER
for (i = firstMonId; i < firstMonId + 3; i++)
CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]);
#endif
return;
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
@ -1839,8 +1869,10 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId)
}
else if (trainerId == TRAINER_EREADER)
{
#ifndef FREE_BATTLE_TOWER_E_READER
for (i = firstMonId; i < firstMonId + 3; i++)
CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]);
#endif
return;
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
@ -1934,10 +1966,14 @@ static void GetOpponentIntroSpeech(void)
else
trainerId = gTrainerBattleOpponent_A;
#ifndef FREE_BATTLE_TOWER_E_READER
if (trainerId == TRAINER_EREADER)
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting);
else if (trainerId < FRONTIER_TRAINERS_COUNT)
#else
if (trainerId < FRONTIER_TRAINERS_COUNT)
FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore);
#endif
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].greeting);
else
@ -2039,6 +2075,7 @@ void DoSpecialTrainerBattle(void)
BattleTransition_StartOnField(GetSpecialBattleTransition(12));
break;
case SPECIAL_BATTLE_EREADER:
#ifndef FREE_BATTLE_TOWER_E_READER
ZeroEnemyPartyMons();
for (i = 0; i < 3; i++)
CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i]);
@ -2047,6 +2084,7 @@ void DoSpecialTrainerBattle(void)
CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(GetSpecialBattleTransition(13));
#endif
break;
case SPECIAL_BATTLE_DOME:
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOME;
@ -2817,6 +2855,7 @@ static void AwardBattleTowerRibbons(void)
// trainer with the player's current data.
static void FillEReaderTrainerWithPlayerData(void)
{
#ifndef FREE_BATTLE_TOWER_E_READER
struct BattleTowerEReaderTrainer *ereaderTrainer = &gSaveBlock2Ptr->frontier.ereaderTrainer;
s32 i, j;
@ -2849,31 +2888,44 @@ static void FillEReaderTrainerWithPlayerData(void)
ConvertPokemonToBattleTowerPokemon(&gPlayerParty[i], &ereaderTrainer->party[i]);
SetEReaderTrainerChecksum(ereaderTrainer);
#endif
}
u8 GetEreaderTrainerFrontSpriteId(void)
{
#ifndef FREE_BATTLE_TOWER_E_READER
return gFacilityClassToPicIndex[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass];
#else
return 0;
#endif
}
u8 GetEreaderTrainerClassId(void)
{
#ifndef FREE_BATTLE_TOWER_E_READER
return gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass];
#else
return 0;
#endif
}
void GetEreaderTrainerName(u8 *dst)
{
#ifndef FREE_BATTLE_TOWER_E_READER
s32 i;
for (i = 0; i < 5; i++)
dst[i] = gSaveBlock2Ptr->frontier.ereaderTrainer.name[i];
dst[i] = EOS;
#else
dst[0] = EOS;
#endif
}
// Checks if the saved E-Reader trainer is valid.
void ValidateEReaderTrainer(void)
{
#ifndef FREE_BATTLE_TOWER_E_READER
u32 i;
u32 checksum;
struct BattleTowerEReaderTrainer *ereaderTrainer;
@ -2900,38 +2952,49 @@ void ValidateEReaderTrainer(void)
ClearEReaderTrainer(&gSaveBlock2Ptr->frontier.ereaderTrainer);
gSpecialVar_Result = TRUE;
}
#else
gSpecialVar_Result = FALSE;
#endif
}
static void SetEReaderTrainerChecksum(struct BattleTowerEReaderTrainer *ereaderTrainer)
{
#ifndef FREE_BATTLE_TOWER_E_READER
s32 i;
ereaderTrainer->checksum = 0;
for (i = 0; i < (sizeof(struct BattleTowerEReaderTrainer) - 4) / 4; i++) // - 4, because of the last field being the checksum itself.
ereaderTrainer->checksum += ((u32 *)ereaderTrainer)[i];
#endif
}
void ClearEReaderTrainer(struct BattleTowerEReaderTrainer *ereaderTrainer)
{
#ifndef FREE_BATTLE_TOWER_E_READER
u32 i;
for (i = 0; i < (sizeof(struct BattleTowerEReaderTrainer)) / 4; i++)
((u32 *)ereaderTrainer)[i] = 0;
#endif
}
void CopyEReaderTrainerGreeting(void)
{
#ifndef FREE_BATTLE_TOWER_E_READER
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting);
#endif
}
static void CopyEReaderTrainerFarewellMessage(void)
{
#ifndef FREE_BATTLE_TOWER_E_READER
if (gBattleOutcome == B_OUTCOME_DREW)
gStringVar4[0] = EOS;
else if (gBattleOutcome == B_OUTCOME_WON)
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.farewellPlayerWon);
else
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.farewellPlayerLost);
#endif
}
void TryHideBattleTowerReporter(void)

View file

@ -940,20 +940,25 @@ const struct BerryTree gBlankBerryTree = {};
// unused
void ClearEnigmaBerries(void)
{
#ifndef FREE_ENIGMA_BERRY
CpuFill16(0, &gSaveBlock1Ptr->enigmaBerry, sizeof(gSaveBlock1Ptr->enigmaBerry));
#endif
}
void SetEnigmaBerry(u8 *src)
{
#ifndef FREE_ENIGMA_BERRY
u32 i;
u8 *dest = (u8*)&gSaveBlock1Ptr->enigmaBerry;
for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry); i++)
dest[i] = src[i];
#endif
}
static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry)
{
#ifndef FREE_ENIGMA_BERRY
u32 i;
u32 checksum;
u8 *dest;
@ -964,10 +969,14 @@ static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry)
checksum += dest[i];
return checksum;
#else
return 0;
#endif
}
bool32 IsEnigmaBerryValid(void)
{
#ifndef FREE_ENIGMA_BERRY
if (!gSaveBlock1Ptr->enigmaBerry.berry.stageDuration)
return FALSE;
if (!gSaveBlock1Ptr->enigmaBerry.berry.maxYield)
@ -975,12 +984,19 @@ bool32 IsEnigmaBerryValid(void)
if (GetEnigmaBerryChecksum(&gSaveBlock1Ptr->enigmaBerry) != gSaveBlock1Ptr->enigmaBerry.checksum)
return FALSE;
return TRUE;
#else
return FALSE;
#endif
}
const struct Berry *GetBerryInfo(u8 berry)
{
if (berry == ITEM_TO_BERRY(ITEM_ENIGMA_BERRY) && IsEnigmaBerryValid())
#ifndef FREE_ENIGMA_BERRY
return (struct Berry*)(&gSaveBlock1Ptr->enigmaBerry.berry);
#else
return &gBerries[0]; //never reached, but will appease the compiler gods
#endif
else
{
if (berry == BERRY_NONE || berry > ITEM_TO_BERRY(LAST_BERRY_INDEX))

View file

@ -392,7 +392,9 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = {
static u8 sub_81D38D4(void)
{
#ifndef FREE_TRAINER_HILL
return (gSaveBlock1Ptr->trainerHill.unused + 1) % 256;
#endif
}
static bool32 Struct_EReaderTrainerHillTrainer_ValidateChecksum(struct EReaderTrainerHillTrainer *arg0)

View file

@ -129,7 +129,11 @@ static void Task_CloseBattlePikeCurtain(u8 taskId);
static u8 DidPlayerGetFirstFans(void);
static void SetInitialFansOfPlayer(void);
static u16 PlayerGainRandomTrainerFan(void);
#ifndef FREE_LINK_BATTLE_RECORDS
static void BufferFanClubTrainerName_(struct LinkBattleRecords *linkRecords, u8 a, u8 b);
#else
static void BufferFanClubTrainerName_(u8 whichLinkTrainer, u8 whichNPCTrainer);
#endif
void Special_ShowDiploma(void)
{
@ -4308,9 +4312,14 @@ void BufferFanClubTrainerName(void)
case FANCLUB_MEMBER8:
break;
}
#ifndef FREE_LINK_BATTLE_RECORDS
BufferFanClubTrainerName_(&gSaveBlock1Ptr->linkBattleRecords, whichLinkTrainer, whichNPCTrainer);
#else
BufferFanClubTrainerName_(whichLinkTrainer, whichNPCTrainer);
#endif
}
#ifndef FREE_LINK_BATTLE_RECORDS
static void BufferFanClubTrainerName_(struct LinkBattleRecords *linkRecords, u8 whichLinkTrainer, u8 whichNPCTrainer)
{
struct LinkBattleRecord *record = &linkRecords->entries[whichLinkTrainer];
@ -4348,6 +4357,35 @@ static void BufferFanClubTrainerName_(struct LinkBattleRecords *linkRecords, u8
ConvertInternationalString(gStringVar1, linkRecords->languages[whichLinkTrainer]);
}
}
#else
static void BufferFanClubTrainerName_(u8 whichLinkTrainer, u8 whichNPCTrainer)
{
switch (whichNPCTrainer)
{
case 0:
StringCopy(gStringVar1, gText_Wallace);
break;
case 1:
StringCopy(gStringVar1, gText_Steven);
break;
case 2:
StringCopy(gStringVar1, gText_Brawly);
break;
case 3:
StringCopy(gStringVar1, gText_Winona);
break;
case 4:
StringCopy(gStringVar1, gText_Phoebe);
break;
case 5:
StringCopy(gStringVar1, gText_Glacia);
break;
default:
StringCopy(gStringVar1, gText_Wallace);
break;
}
}
#endif
void UpdateTrainerFansAfterLinkBattle(void)
{

View file

@ -1696,9 +1696,13 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
switch (whichText)
{
case FRONTIER_BEFORE_TEXT:
#ifndef FREE_BATTLE_TOWER_E_READER
if (trainerId == TRAINER_EREADER)
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting);
else if (trainerId == TRAINER_FRONTIER_BRAIN)
#else
if (trainerId == TRAINER_FRONTIER_BRAIN)
#endif
CopyFrontierBrainText(FALSE);
else if (trainerId < FRONTIER_TRAINERS_COUNT)
FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore);
@ -1708,11 +1712,15 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
BufferApprenticeChallengeText(trainerId - TRAINER_RECORD_MIXING_APPRENTICE);
break;
case FRONTIER_PLAYER_LOST_TEXT:
#ifndef FREE_BATTLE_TOWER_E_READER
if (trainerId == TRAINER_EREADER)
{
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.farewellPlayerLost);
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
#else
if (trainerId == TRAINER_FRONTIER_BRAIN)
#endif
{
CopyFrontierBrainText(FALSE);
}
@ -1738,7 +1746,9 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
case FRONTIER_PLAYER_WON_TEXT:
if (trainerId == TRAINER_EREADER)
{
#ifndef FREE_BATTLE_TOWER_E_READER
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.farewellPlayerWon);
#endif
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
{
@ -2268,6 +2278,7 @@ static void Print2PRecord(s32 position, s32 x, s32 y, struct RankingHall2P *hall
static void Fill1PRecords(struct RankingHall1P *dst, s32 hallFacilityId, s32 lvlMode)
{
#ifndef FREE_RECORD_MIXING_HALL_RECORDS
s32 i, j;
struct RankingHall1P record1P[4];
struct PlayerHallRecords *playerHallRecords = calloc(1, sizeof(struct PlayerHallRecords));
@ -2298,10 +2309,12 @@ static void Fill1PRecords(struct RankingHall1P *dst, s32 hallFacilityId, s32 lvl
}
free(playerHallRecords);
#endif
}
static void Fill2PRecords(struct RankingHall2P *dst, s32 lvlMode)
{
#ifndef FREE_RECORD_MIXING_HALL_RECORDS
s32 i, j;
struct RankingHall2P record2P[4];
struct PlayerHallRecords *playerHallRecords = calloc(1, sizeof(struct PlayerHallRecords));
@ -2332,6 +2345,7 @@ static void Fill2PRecords(struct RankingHall2P *dst, s32 lvlMode)
}
free(playerHallRecords);
#endif
}
static void PrintHallRecords(s32 hallFacilityId, s32 lvlMode)
@ -2381,6 +2395,7 @@ void ScrollRankingHallRecordsWindow(void)
void ClearRankingHallRecords(void)
{
#ifndef FREE_RECORD_MIXING_HALL_RECORDS
s32 i, j, k;
// UB: Passing 0 as a pointer instead of a pointer holding a value of 0.
@ -2415,6 +2430,7 @@ void ClearRankingHallRecords(void)
gSaveBlock2Ptr->hallRecords2P[j][k].winStreak = 0;
}
}
#endif
}
void SaveGameFrontier(void)

View file

@ -46,6 +46,7 @@ static void UpdateGymLeaderRematchFromArray(const u16 *data, size_t size, u32 ma
s32 lowestRematchIndex = 5;
u32 i;
s32 rematchIndex;
#ifndef FREE_MATCH_CALL
for (i = 0; i < size; i++)
{
if (!gSaveBlock1Ptr->trainerRematches[data[i]])
@ -89,6 +90,7 @@ static void UpdateGymLeaderRematchFromArray(const u16 *data, size_t size, u32 ma
}
}
}
#endif
}
static s32 GetRematchIndex(u32 trainerIdx)

View file

@ -1453,7 +1453,9 @@ static void Task_SpinPokenavIcon(u8 taskId)
static bool32 TrainerIsEligibleForRematch(int matchCallId)
{
#ifndef FREE_MATCH_CALL
return gSaveBlock1Ptr->trainerRematches[matchCallId] > 0;
#endif
}
static u16 GetRematchTrainerLocation(int matchCallId)

View file

@ -24,34 +24,46 @@ static void sub_801BA8C(u32 a0, u32 a1, u32 *a2, int a3);
void sub_801AFD8(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
CpuFill32(0, &gSaveBlock1Ptr->unk_322C, sizeof(gSaveBlock1Ptr->unk_322C));
sub_801B180();
InitQuestionnaireWords();
#endif
}
struct WonderNews *GetSavedWonderNews(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
return &gSaveBlock1Ptr->unk_322C.wonderNews.data;
#endif
}
struct WonderCard *GetSavedWonderCard(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
return &gSaveBlock1Ptr->unk_322C.wonderCard.data;
#endif
}
struct MEventBuffer_3430_Sub *sav1_get_mevent_buffer_2(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
return &gSaveBlock1Ptr->unk_322C.buffer_310.data;
#endif
}
struct MysteryEventStruct *sub_801B044(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
return &gSaveBlock1Ptr->unk_322C.unk_340;
#endif
}
u16 *GetQuestionnaireWordsPtr(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
return gSaveBlock1Ptr->unk_322C.questionnaireWords;
#endif
}
void DestroyWonderNews(void)
@ -61,6 +73,7 @@ void DestroyWonderNews(void)
bool32 sub_801B078(const struct WonderNews *src)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
if (!sub_801B114(src))
return FALSE;
@ -68,15 +81,19 @@ bool32 sub_801B078(const struct WonderNews *src)
gSaveBlock1Ptr->unk_322C.wonderNews.data = *src;
gSaveBlock1Ptr->unk_322C.wonderNews.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderNews.data, sizeof(struct WonderNews));
return TRUE;
#else
return FALSE;
#endif
}
bool32 ValidateReceivedWonderNews(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
if (CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderNews.data, sizeof(struct WonderNews)) != gSaveBlock1Ptr->unk_322C.wonderNews.crc)
return FALSE;
if (!sub_801B114(&gSaveBlock1Ptr->unk_322C.wonderNews.data))
return FALSE;
#endif
return TRUE;
}
@ -90,17 +107,20 @@ static bool32 sub_801B114(const struct WonderNews *data)
bool32 WonderNews_Test_Unk_02(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
const struct WonderNews *data = &gSaveBlock1Ptr->unk_322C.wonderNews.data;
if (data->unk_02 == 0)
return FALSE;
#endif
return TRUE;
}
static void s_DestroyWonderNews(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
CpuFill32(0, GetSavedWonderNews(), sizeof(gSaveBlock1Ptr->unk_322C.wonderNews.data));
gSaveBlock1Ptr->unk_322C.wonderNews.crc = 0;
#endif
}
static void sub_801B180(void)
@ -111,6 +131,7 @@ static void sub_801B180(void)
bool32 sub_801B1A4(const u8 *src)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
const u8 *r5 = (const u8 *)&gSaveBlock1Ptr->unk_322C.wonderNews.data;
u32 i;
if (!ValidateReceivedWonderNews())
@ -121,12 +142,13 @@ bool32 sub_801B1A4(const u8 *src)
if (r5[i] != src[i])
return FALSE;
}
#endif
return TRUE;
}
void DestroyWonderCard(void)
{
#ifndef FREE_BATTLE_TOWER_E_READER
sub_801B330();
sub_801B368();
sub_801B9F8();
@ -134,6 +156,7 @@ void DestroyWonderCard(void)
ClearMysteryEventFlags();
ClearMysteryEventVars();
ClearEReaderTrainer(&gSaveBlock2Ptr->frontier.ereaderTrainer);
#endif
}
bool32 sub_801B21C(const struct WonderCard *data)
@ -143,24 +166,27 @@ bool32 sub_801B21C(const struct WonderCard *data)
if (!sub_801B2CC(data))
return FALSE;
#ifndef FREE_MYSTERY_EVENT_BUFFERS
DestroyWonderCard();
memcpy(&gSaveBlock1Ptr->unk_322C.wonderCard.data, data, sizeof(struct WonderCard));
gSaveBlock1Ptr->unk_322C.wonderCard.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderCard.data, sizeof(struct WonderCard));
r2 = &gSaveBlock1Ptr->unk_322C.buffer_310.data;
r1 = &gSaveBlock1Ptr->unk_322C.wonderCard.data;
r2->unk_06 = r1->unk_02;
#endif
return TRUE;
}
bool32 ValidateReceivedWonderCard(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
if (gSaveBlock1Ptr->unk_322C.wonderCard.crc != CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderCard.data, sizeof(struct WonderCard)))
return FALSE;
if (!sub_801B2CC(&gSaveBlock1Ptr->unk_322C.wonderCard.data))
return FALSE;
if (!ValidateSavedRamScript())
return FALSE;
#endif
return TRUE;
}
@ -182,30 +208,36 @@ static bool32 sub_801B2CC(const struct WonderCard *data)
bool32 WonderCard_Test_Unk_08_6(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
const struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data;
if (data->unk_08_6 == 0)
return FALSE;
#endif
return TRUE;
}
static void sub_801B330(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
CpuFill32(0, &gSaveBlock1Ptr->unk_322C.wonderCard.data, sizeof(struct WonderCard));
gSaveBlock1Ptr->unk_322C.wonderCard.crc = 0;
#endif
}
static void sub_801B368(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
CpuFill32(0, sav1_get_mevent_buffer_2(), 18 *sizeof(u16));
gSaveBlock1Ptr->unk_322C.buffer_310.crc = 0;
#endif
}
u16 GetWonderCardFlagID(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
if (ValidateReceivedWonderCard())
return gSaveBlock1Ptr->unk_322C.wonderCard.data.unk_00;
#endif
return 0;
}
@ -302,16 +334,20 @@ static int sub_801B4CC(void)
struct WonderCard *data;
if (!ValidateReceivedWonderCard())
return 0;
#ifndef FREE_MYSTERY_EVENT_BUFFERS
data = &gSaveBlock1Ptr->unk_322C.wonderCard.data;
if (data->unk_08_0 != 1)
return 0;
return sub_801B438(&gSaveBlock1Ptr->unk_322C.buffer_310.data, data->unk_09);
#else
return 0;
#endif
}
bool32 sub_801B508(const u16 *data)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
struct WonderCard *buffer = &gSaveBlock1Ptr->unk_322C.wonderCard.data;
int size = buffer->unk_09;
int i;
@ -330,7 +366,7 @@ bool32 sub_801B508(const u16 *data)
return TRUE;
}
}
#endif
return FALSE;
}
@ -364,6 +400,7 @@ void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1)
data->unk_14 = 0;
}
#ifndef FREE_MYSTERY_EVENT_BUFFERS
for (i = 0; i < NUM_QUESTIONNAIRE_WORDS; i++)
data->unk_16[i] = gSaveBlock1Ptr->unk_322C.questionnaireWords[i];
@ -374,6 +411,7 @@ void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1)
memcpy(data->unk_5C, RomHeaderGameCode, 4);
data->unk_60 = RomHeaderSoftwareVersion;
#endif
}
bool32 sub_801B6A0(const struct MEventStruct_Unk1442CC *data, bool32 a1)
@ -461,6 +499,7 @@ u16 MEventStruct_Unk1442CC_GetValueNFrom_unk_20(const struct MEventStruct_Unk144
static void sub_801B7D8(u32 command)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data;
if (data->unk_08_0 == 2)
{
@ -491,10 +530,12 @@ static void sub_801B7D8(u32 command)
*dest = 999;
}
}
#endif
}
u16 mevent_081445C0(u32 command)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
switch (command)
{
case GET_CARD_BATTLES_WON_INTERNAL:
@ -544,6 +585,7 @@ u16 mevent_081445C0(u32 command)
}
AGB_ASSERT(0);
#endif
return 0;
}
@ -554,6 +596,7 @@ void ResetReceivedWonderCardFlag(void)
bool32 MEventHandleReceivedWonderCard(u16 a0)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
gUnknown_02022C70 = FALSE;
if (a0 == 0)
return FALSE;
@ -565,11 +608,13 @@ bool32 MEventHandleReceivedWonderCard(u16 a0)
return FALSE;
gUnknown_02022C70 = TRUE;
#endif
return TRUE;
}
void RecordIdOfWonderCardSenderByEventType(u32 a0, u32 a1)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
if (gUnknown_02022C70)
{
switch (a0)
@ -587,11 +632,14 @@ void RecordIdOfWonderCardSenderByEventType(u32 a0, u32 a1)
AGB_ASSERT(0);
}
}
#endif
}
static void sub_801B9F8(void)
{
#ifndef FREE_MYSTERY_EVENT_BUFFERS
CpuFill32(0, gSaveBlock1Ptr->unk_322C.unk_344, sizeof(gSaveBlock1Ptr->unk_322C.unk_344));
#endif
}
static bool32 sub_801BA24(u32 a0, u32 *a1, int size)

View file

@ -219,8 +219,10 @@ static u32 mainseq_4(struct mevent_client * svr)
InitRamScript_NoObjectEvent(svr->recvBuffer, 1000);
break;
case 18:
#ifndef FREE_BATTLE_TOWER_E_READER
memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, svr->recvBuffer, 0xbc);
ValidateEReaderTrainer();
#endif
break;
case 21:
memcpy(gDecompressionBuffer, svr->recvBuffer, ME_SEND_BUF_SIZE);

View file

@ -218,6 +218,7 @@ bool8 MEScrCmd_runscript(struct ScriptContext *ctx)
bool8 MEScrCmd_setenigmaberry(struct ScriptContext *ctx)
{
#ifndef FREE_ENIGMA_BERRY
u8 *str;
const u8 *message;
bool32 haveBerry = IsEnigmaBerryValid();
@ -250,7 +251,7 @@ bool8 MEScrCmd_setenigmaberry(struct ScriptContext *ctx)
VarSet(VAR_ENIGMA_BERRY_AVAILABLE, 1);
else
ctx->data[2] = 1;
#endif
return FALSE;
}

View file

@ -4221,7 +4221,11 @@ static bool8 IsHPRecoveryItem(u16 item)
const u8 *effect;
if (item == ITEM_ENIGMA_BERRY)
#ifndef FREE_ENIGMA_BERRY
effect = gSaveBlock1Ptr->enigmaBerry.itemEffect;
#else
effect = 0;
#endif
else
effect = gItemEffectTable[item - ITEM_POTION];
@ -4538,7 +4542,11 @@ void ItemUseCB_PPRecovery(u8 taskId, TaskFunc task)
u16 item = gSpecialVar_ItemId;
if (item == ITEM_ENIGMA_BERRY)
#ifndef FREE_ENIGMA_BERRY
effect = gSaveBlock1Ptr->enigmaBerry.itemEffect;
#else
effect = 0;
#endif
else
effect = gItemEffectTable[item - ITEM_POTION];
@ -5180,7 +5188,11 @@ u8 GetItemEffectType(u16 item)
// Read the item's effect properties.
if (item == ITEM_ENIGMA_BERRY)
#ifndef FREE_ENIGMA_BERRY
itemEffect = gSaveBlock1Ptr->enigmaBerry.itemEffect;
#else
itemEffect = 0;
#endif
else
itemEffect = gItemEffectTable[item - ITEM_POTION];

View file

@ -1516,8 +1516,10 @@ void ResetPokedex(void)
{
gSaveBlock2Ptr->pokedex.owned[i] = 0;
gSaveBlock2Ptr->pokedex.seen[i] = 0;
#ifndef FREE_EXTRA_SEEN_FLAGS
gSaveBlock1Ptr->seen1[i] = 0;
gSaveBlock1Ptr->seen2[i] = 0;
#endif
}
}
@ -4253,6 +4255,7 @@ s8 GetSetPokedexFlag(u16 nationalDexNo, u8 caseID)
case FLAG_GET_SEEN:
if (gSaveBlock2Ptr->pokedex.seen[index] & mask)
{
#ifndef FREE_EXTRA_SEEN_FLAGS
if ((gSaveBlock2Ptr->pokedex.seen[index] & mask) == (gSaveBlock1Ptr->seen1[index] & mask)
&& (gSaveBlock2Ptr->pokedex.seen[index] & mask) == (gSaveBlock1Ptr->seen2[index] & mask))
retVal = 1;
@ -4263,11 +4266,15 @@ s8 GetSetPokedexFlag(u16 nationalDexNo, u8 caseID)
gSaveBlock1Ptr->seen2[index] &= ~mask;
retVal = 0;
}
#else
retVal = 1;
#endif
}
break;
case FLAG_GET_CAUGHT:
if (gSaveBlock2Ptr->pokedex.owned[index] & mask)
{
#ifndef FREE_EXTRA_SEEN_FLAGS
if ((gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock2Ptr->pokedex.seen[index] & mask)
&& (gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock1Ptr->seen1[index] & mask)
&& (gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock1Ptr->seen2[index] & mask))
@ -4280,12 +4287,17 @@ s8 GetSetPokedexFlag(u16 nationalDexNo, u8 caseID)
gSaveBlock1Ptr->seen2[index] &= ~mask;
retVal = 0;
}
#else
retVal = 1;
#endif
}
break;
case FLAG_SET_SEEN:
gSaveBlock2Ptr->pokedex.seen[index] |= mask;
#ifndef FREE_EXTRA_SEEN_FLAGS
gSaveBlock1Ptr->seen1[index] |= mask;
gSaveBlock1Ptr->seen2[index] |= mask;
#endif
break;
case FLAG_SET_CAUGHT:
gSaveBlock2Ptr->pokedex.owned[index] |= mask;

View file

@ -4696,7 +4696,11 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (gMain.inBattle)
holdEffect = gEnigmaBerries[gBattlerInMenuId].holdEffect;
else
#ifndef FREE_ENIGMA_BERRY
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
#else
holdEffect = 0;
#endif
}
else
{
@ -4737,7 +4741,11 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (gMain.inBattle)
itemEffect = gEnigmaBerries[gActiveBattler].itemEffect;
else
#ifndef FREE_ENIGMA_BERRY
itemEffect = gSaveBlock1Ptr->enigmaBerry.itemEffect;
#else
itemEffect = 0;
#endif
}
else
{
@ -5379,7 +5387,11 @@ u8 *UseStatIncreaseItem(u16 itemId)
if (gMain.inBattle)
itemEffect = gEnigmaBerries[gBattlerInMenuId].itemEffect;
else
#ifndef FREE_ENIGMA_BERRY
itemEffect = gSaveBlock1Ptr->enigmaBerry.itemEffect;
#else
itemEffect = 0;
#endif
}
else
{
@ -5440,7 +5452,11 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem)
u8 holdEffect;
if (heldItem == ITEM_ENIGMA_BERRY)
#ifndef FREE_ENIGMA_BERRY
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
#else
holdEffect = 0;
#endif
else
holdEffect = ItemId_GetHoldEffect(heldItem);
@ -5807,7 +5823,11 @@ void AdjustFriendship(struct Pokemon *mon, u8 event)
if (gMain.inBattle)
holdEffect = gEnigmaBerries[0].holdEffect;
else
#ifndef FREE_ENIGMA_BERRY
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
#else
holdEffect = 0;
#endif
}
else
{
@ -5900,7 +5920,11 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
if (gMain.inBattle)
holdEffect = gEnigmaBerries[0].holdEffect;
else
#ifndef FREE_ENIGMA_BERRY
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
#else
holdEffect = 0;
#endif
}
else
{

View file

@ -4094,11 +4094,14 @@ static bool32 RecvPacket_MemberStateToMember(struct PokemonJump_Player *player,
static struct PokemonJumpRecords *GetPokeJumpRecords(void)
{
#ifndef FREE_POKEMON_JUMP
return &gSaveBlock2Ptr->pokeJump;
#endif
}
void ResetPokemonJumpRecords(void)
{
#ifndef FREE_POKEMON_JUMP
struct PokemonJumpRecords *records = GetPokeJumpRecords();
records->jumpsInRow = 0;
records->bestJumpScore = 0;
@ -4106,10 +4109,12 @@ void ResetPokemonJumpRecords(void)
records->gamesWithMaxPlayers = 0;
records->unused2 = 0;
records->unused1 = 0;
#endif
}
static bool32 TryUpdateRecords(u32 jumpScore, u16 jumpsInRow, u16 excellentsInRow)
{
#ifndef FREE_POKEMON_JUMP
struct PokemonJumpRecords *records = GetPokeJumpRecords();
bool32 newRecord = FALSE;
@ -4121,13 +4126,18 @@ static bool32 TryUpdateRecords(u32 jumpScore, u16 jumpsInRow, u16 excellentsInRo
records->excellentsInRow = excellentsInRow, newRecord = TRUE;
return newRecord;
#else
return FALSE;
#endif
}
static void IncrementGamesWithMaxPlayers(void)
{
#ifndef FREE_POKEMON_JUMP
struct PokemonJumpRecords *records = GetPokeJumpRecords();
if (records->gamesWithMaxPlayers < 9999)
records->gamesWithMaxPlayers++;
#endif
}
void ShowPokemonJumpRecords(void)
@ -4207,6 +4217,7 @@ static void Task_ShowPokemonJumpRecords(u8 taskId)
static void PrintRecordsText(u16 windowId, int width)
{
#ifndef FREE_POKEMON_JUMP
int i, x;
int recordNums[3];
struct PokemonJumpRecords *records = GetPokeJumpRecords();
@ -4227,6 +4238,7 @@ static void PrintRecordsText(u16 windowId, int width)
AddTextPrinterParameterized(windowId, 1, gStringVar1, x, 25 + (i * 16), TEXT_SPEED_FF, NULL);
}
PutWindowTilemap(windowId);
#endif
}
static void TruncateToFirstWordOnly(u8 *str)

View file

@ -312,6 +312,7 @@ u16 GetMatchCallMapSec(int index)
bool32 ShouldDrawRematchPokeballIcon(int index)
{
#ifndef FREE_MATCH_CALL
struct Pokenav3Struct *state = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_MAIN);
if (!state->matchCallEntries[index].isSpecialTrainer)
index = state->matchCallEntries[index].headerId;
@ -322,6 +323,9 @@ bool32 ShouldDrawRematchPokeballIcon(int index)
return FALSE;
return gSaveBlock1Ptr->trainerRematches[index] != 0;
#else
return FALSE;
#endif
}
int GetMatchCallTrainerPic(int index)
@ -465,6 +469,7 @@ int GetIndexDeltaOfNextCheckPageUp(int index)
bool32 unref_sub_81CB16C(void)
{
#ifndef FREE_MATCH_CALL
int i;
for (i = 0; i < REMATCH_TABLE_ENTRIES; i++)
@ -482,12 +487,13 @@ bool32 unref_sub_81CB16C(void)
return TRUE;
}
}
#endif
return FALSE;
}
static bool32 sub_81CB1D0(void)
{
#ifndef FREE_MATCH_CALL
struct Pokenav3Struct *state = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_MAIN);
int selection = GetSelectedPokenavListIndex();
if (!state->matchCallEntries[selection].isSpecialTrainer)
@ -510,6 +516,6 @@ static bool32 sub_81CB1D0(void)
}
}
}
#endif
return FALSE;
}

View file

@ -842,14 +842,22 @@ static bool32 MatchCall_IsRematchable_NPC(match_call_t matchCall)
static bool32 MatchCall_IsRematchable_Trainer(match_call_t matchCall)
{
#ifndef FREE_MATCH_CALL
if (matchCall.trainer->rematchTableIdx >= REMATCH_ELITE_FOUR_ENTRIES)
return FALSE;
return gSaveBlock1Ptr->trainerRematches[matchCall.trainer->rematchTableIdx] ? TRUE : FALSE;
#else
return FALSE;
#endif
}
static bool32 MatchCall_IsRematchable_Wally(match_call_t matchCall)
{
#ifndef FREE_MATCH_CALL
return gSaveBlock1Ptr->trainerRematches[matchCall.wally->rematchTableIdx] ? TRUE : FALSE;
#else
return FALSE;
#endif
}
static bool32 MatchCall_IsRematchable_Rival(match_call_t matchCall)
@ -1004,6 +1012,7 @@ static void MatchCall_BufferCallMessageText(const match_call_text_data_t *textDa
static void MatchCall_BufferCallMessageTextByRematchTeam(const match_call_text_data_t *textData, u16 idx, u8 *dest)
{
#ifndef FREE_MATCH_CALL
u32 i;
for (i = 0; textData[i].text != NULL; i++)
{
@ -1037,6 +1046,7 @@ static void MatchCall_BufferCallMessageTextByRematchTeam(const match_call_text_d
StringExpandPlaceholders(dest, textData[i].text);
}
#endif
}
void MatchCall_GetNameAndDesc(u32 idx, const u8 **desc, const u8 **name)

View file

@ -324,6 +324,7 @@ static bool32 PlayerHasTrainerRematches(void)
{
s32 i;
#ifndef FREE_MATCH_CALL
for (i = 0; i < REMATCH_TABLE_ENTRIES; i++)
{
if (GetMatchTableMapSectionId(i) == gMapHeader.regionMapSectionId
@ -331,6 +332,7 @@ static bool32 PlayerHasTrainerRematches(void)
&& gSaveBlock1Ptr->trainerRematches[i])
return TRUE;
}
#endif
return FALSE;
}

View file

@ -1167,6 +1167,7 @@ static void ReceiveApprenticeData(struct Apprentice *mixApprentice, size_t recor
static void sub_80E8578(struct RecordMixingHallRecords *dst, void *hallRecords, size_t recordSize, u32 arg3, s32 linkPlayerCount)
{
#ifndef FREE_RECORD_MIXING_HALL_RECORDS
s32 i, j, k, l;
s32 var_68;
@ -1232,6 +1233,7 @@ static void sub_80E8578(struct RecordMixingHallRecords *dst, void *hallRecords,
dst->hallRecords2P[j][k + 3] = gUnknown_03001168[k]->twoPlayers[j];
}
}
#endif
}
static void sub_80E8880(struct RankingHall1P *arg0, struct RankingHall1P *arg1)
@ -1286,6 +1288,7 @@ static void sub_80E88CC(struct RankingHall2P *arg0, struct RankingHall2P *arg1)
static void sub_80E8924(struct RecordMixingHallRecords *arg0)
{
#ifndef FREE_RECORD_MIXING_HALL_RECORDS
s32 i, j;
for (i = 0; i < HALL_FACILITIES_COUNT; i++)
@ -1295,10 +1298,12 @@ static void sub_80E8924(struct RecordMixingHallRecords *arg0)
}
for (j = 0; j < 2; j++)
sub_80E88CC(gSaveBlock2Ptr->hallRecords2P[j], arg0->hallRecords2P[j]);
#endif
}
static void ReceiveRankingHallRecords(struct PlayerHallRecords *hallRecords, size_t recordSize, u32 arg2)
{
#ifndef FREE_RECORD_MIXING_HALL_RECORDS
u8 linkPlayerCount = GetLinkPlayerCount();
struct RecordMixingHallRecords *largeStructPtr = AllocZeroed(sizeof(struct RecordMixingHallRecords));
@ -1306,6 +1311,7 @@ static void ReceiveRankingHallRecords(struct PlayerHallRecords *hallRecords, siz
sub_80E8924(largeStructPtr);
Free(largeStructPtr);
#endif
}
static void sub_80E89F8(struct RecordMixingDayCareMail *dst)

View file

@ -288,9 +288,11 @@ void ResetTrainerHillResults(void)
gSaveBlock2Ptr->frontier.savedGame = 0;
gSaveBlock2Ptr->frontier.unk_EF9 = 0;
#ifndef FREE_TRAINER_HILL
gSaveBlock1Ptr->trainerHill.bestTime = 0;
for (i = 0; i < 4; i++)
SetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i], HILL_MAX_TIME);
#endif
}
static u8 GetFloorId(void)
@ -341,7 +343,9 @@ void InitTrainerHillBattleStruct(void)
}
sRoomTrainers->facilityClass[i] = sHillData->floors[sHillData->floorId].trainers[i].facilityClass;
}
#ifndef FREE_TRAINER_HILL
SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
#endif
FreeDataStruct();
}
@ -353,6 +357,7 @@ void FreeTrainerHillBattleStruct(void)
static void SetUpDataStruct(void)
{
#ifndef FREE_TRAINER_HILL
if (sHillData == NULL)
{
sHillData = AllocZeroed(sizeof(*sHillData));
@ -360,6 +365,7 @@ static void SetUpDataStruct(void)
CpuCopy32(sDataPerTag[gSaveBlock1Ptr->trainerHill.tag], &sHillData->tag, sizeof(sHillData->tag) + 4 * sizeof(struct TrHillFloor));
TrainerHillDummy();
}
#endif
}
static void FreeDataStruct(void)
@ -398,6 +404,7 @@ void CopyTrainerHillTrainerText(u8 which, u16 trainerId)
static void TrainerHillStartChallenge(void)
{
TrainerHillDummy();
#ifndef FREE_TRAINER_HILL
if (!ReadTrainerHillAndValidate())
gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 1;
else
@ -412,10 +419,12 @@ static void TrainerHillStartChallenge(void)
gSaveBlock2Ptr->frontier.trainerFlags = 0;
gBattleOutcome = 0;
gSaveBlock1Ptr->trainerHill.receivedPrize = 0;
#endif
}
static void GetOwnerState(void)
{
#ifndef FREE_TRAINER_HILL
ClearTrainerHillVBlankCounter();
gSpecialVar_Result = 0;
if (gSaveBlock1Ptr->trainerHill.spokeToOwner)
@ -424,10 +433,12 @@ static void GetOwnerState(void)
gSpecialVar_Result++;
gSaveBlock1Ptr->trainerHill.spokeToOwner = TRUE;
#endif
}
static void GiveChallengePrize(void)
{
#ifndef FREE_TRAINER_HILL
u16 itemId = GetPrizeItemId();
if (sHillData->tag.numFloors != NUM_TRAINER_HILL_FLOORS || gSaveBlock1Ptr->trainerHill.receivedPrize)
@ -445,12 +456,14 @@ static void GiveChallengePrize(void)
{
gSpecialVar_Result = 1;
}
#endif
}
// If bestTime > timer, the challenge was completed faster and its a new record
// Otherwise the owner says it was a slow time and to complete it faster next time
static void CheckFinalTime(void)
{
#ifndef FREE_TRAINER_HILL
if (gSaveBlock1Ptr->trainerHill.checkedFinalTime)
{
gSpecialVar_Result = 2;
@ -467,10 +480,12 @@ static void CheckFinalTime(void)
}
gSaveBlock1Ptr->trainerHill.checkedFinalTime = TRUE;
#endif
}
static void TrainerHillResumeTimer(void)
{
#ifndef FREE_TRAINER_HILL
if (!gSaveBlock1Ptr->trainerHill.spokeToOwner)
{
if (gSaveBlock1Ptr->trainerHill.timer >= HILL_MAX_TIME)
@ -478,15 +493,19 @@ static void TrainerHillResumeTimer(void)
else
SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
}
#endif
}
static void TrainerHillSetPlayerLost(void)
{
#ifndef FREE_TRAINER_HILL
gSaveBlock1Ptr->trainerHill.hasLost = TRUE;
#endif
}
static void TrainerHillGetChallengeStatus(void)
{
#ifndef FREE_TRAINER_HILL
if (gSaveBlock1Ptr->trainerHill.hasLost)
{
// The player lost their last match.
@ -504,12 +523,13 @@ static void TrainerHillGetChallengeStatus(void)
// Continue playing.
gSpecialVar_Result = TRAINER_HILL_PLAYER_STATUS_NORMAL;
}
#endif
}
static void BufferChallengeTime(void)
{
s32 total, minutes, secondsWhole, secondsFraction;
#ifndef FREE_TRAINER_HILL
total = gSaveBlock1Ptr->trainerHill.timer;
if (total >= HILL_MAX_TIME)
total = HILL_MAX_TIME;
@ -523,6 +543,7 @@ static void BufferChallengeTime(void)
ConvertIntToDecimalStringN(gStringVar1, minutes, STR_CONV_MODE_RIGHT_ALIGN, 2);
ConvertIntToDecimalStringN(gStringVar2, secondsWhole, STR_CONV_MODE_RIGHT_ALIGN, 2);
ConvertIntToDecimalStringN(gStringVar3, secondsFraction, STR_CONV_MODE_LEADING_ZEROS, 2);
#endif
}
// Returns TRUE if all 4 floors are used
@ -555,6 +576,7 @@ static void GetInEReaderMode(void)
bool8 InTrainerHillChallenge(void)
{
#ifndef FREE_TRAINER_HILL
if (VarGet(VAR_TRAINER_HILL_IS_ACTIVE) == 0)
return FALSE;
else if (gSaveBlock1Ptr->trainerHill.spokeToOwner)
@ -563,6 +585,7 @@ bool8 InTrainerHillChallenge(void)
return TRUE;
else
return FALSE;
#endif
}
static void IsTrainerHillChallengeActive(void)
@ -587,7 +610,7 @@ void PrintOnTrainerHillRecordsWindow(void)
{
s32 i, x, y;
u32 total, minutes, secondsWhole, secondsFraction;
#ifndef FREE_TRAINER_HILL
SetUpDataStruct();
FillWindowPixelBuffer(0, PIXEL_FILL(0));
x = GetStringCenterAlignXOffset(1, gText_TimeBoard, 0xD0);
@ -616,6 +639,7 @@ void PrintOnTrainerHillRecordsWindow(void)
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
FreeDataStruct();
#endif
}
// Leftover from Fire Red / Leaf Green as in these games,
@ -982,16 +1006,20 @@ bool32 OnTrainerHillEReaderChallengeFloor(void)
static void GetChallengeWon(void)
{
#ifndef FREE_TRAINER_HILL
if (gSaveBlock1Ptr->trainerHill.hasLost)
gSpecialVar_Result = FALSE;
else
gSpecialVar_Result = TRUE;
#endif
}
static void TrainerHillSetTag(void)
{
#ifndef FREE_TRAINER_HILL
gSaveBlock1Ptr->trainerHill.tag = gSpecialVar_0x8005;
gSaveBlock1Ptr->trainerHill.bestTime = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005];
#endif
}
static u8 GetPrizeListId(bool8 maxTrainers)
@ -1034,6 +1062,7 @@ static u16 GetPrizeItemId(void)
else
i = GetPrizeListId(FALSE);
#ifndef FREE_TRAINER_HILL
if (gSaveBlock1Ptr->trainerHill.tag == HILL_TAG_EXPERT)
i = (i + 1) % NUM_TRAINER_HILL_PRIZE_LISTS;
@ -1051,6 +1080,7 @@ static u16 GetPrizeItemId(void)
id = 4;
else
id = 5;
#endif
return prizeList[id];
}

View file

@ -1386,6 +1386,7 @@ void PutFanClubSpecialOnTheAir(void)
StringCopy(show->fanClubSpecial.idolName, name);
tv_store_id_2x(show);
show->fanClubSpecial.language = gGameLanguage;
#ifndef FREE_LINK_BATTLE_RECORDS
if (show->fanClubSpecial.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->linkBattleRecords.languages[0] == LANGUAGE_JAPANESE)
{
show->fanClubSpecial.idolNameLanguage = LANGUAGE_JAPANESE;
@ -1394,6 +1395,12 @@ void PutFanClubSpecialOnTheAir(void)
{
show->fanClubSpecial.idolNameLanguage = gSaveBlock1Ptr->linkBattleRecords.languages[0];
}
#else
if (show->fanClubSpecial.language == LANGUAGE_JAPANESE)
{
show->fanClubSpecial.idolNameLanguage = LANGUAGE_JAPANESE;
}
#endif
}
void ContestLiveUpdates_Init(u8 round1Placing)
@ -2455,8 +2462,10 @@ bool8 ShouldHideFanClubInterviewer(void)
if (gSpecialVar_Result == TRUE)
return TRUE;
#ifndef FREE_LINK_BATTLE_RECORDS
if (gSaveBlock1Ptr->linkBattleRecords.entries[0].name[0] == EOS)
return TRUE;
#endif
return FALSE;
}

View file

@ -904,8 +904,10 @@ static void InitUnionRoomChat(struct UnionRoomChat *chat)
chat->exitType = 0;
chat->changedRegisteredTexts = FALSE;
PrepareSendBuffer_Null(chat->sendMessageBuffer);
#ifndef FREE_UNION_ROOM_CHAT
for (i = 0; i < UNION_ROOM_KB_ROW_COUNT; i++)
StringCopy(chat->registeredTexts[i], gSaveBlock1Ptr->registeredTexts[i]);
StringCopy(unionRoomChat->registeredTexts[i], gSaveBlock1Ptr->registeredTexts[i]);
#endif
}
static void FreeUnionRoomChat(void)
@ -1737,9 +1739,11 @@ static void ResetMessageEntryBuffer(void)
static void SaveRegisteredTexts(void)
{
#ifndef FREE_UNION_ROOM_CHAT
int i;
for (i = 0; i < UNION_ROOM_KB_ROW_COUNT; i++)
StringCopy(gSaveBlock1Ptr->registeredTexts[i], sChat->registeredTexts[i]);
#endif
}
static u8 *GetRegisteredTextByRow(int row)
@ -1983,6 +1987,7 @@ static u8 *GetChatHostName(void)
void InitUnionRoomChatRegisteredTexts(void)
{
#ifndef FREE_UNION_ROOM_CHAT
StringCopy(gSaveBlock1Ptr->registeredTexts[0], gText_Hello);
StringCopy(gSaveBlock1Ptr->registeredTexts[1], gText_Pokemon2);
StringCopy(gSaveBlock1Ptr->registeredTexts[2], gText_Trade);
@ -1993,6 +1998,7 @@ void InitUnionRoomChatRegisteredTexts(void)
StringCopy(gSaveBlock1Ptr->registeredTexts[7], gText_YaySmileEmoji);
StringCopy(gSaveBlock1Ptr->registeredTexts[8], gText_ThankYou);
StringCopy(gSaveBlock1Ptr->registeredTexts[9], gText_ByeBye);
#endif
}
#define tState data[0]