diff --git a/include/config/save.h b/include/config/save.h new file mode 100644 index 0000000000..fee8f84607 --- /dev/null +++ b/include/config/save.h @@ -0,0 +1,21 @@ +#ifndef GUARD_CONFIG_SAVE_H +#define GUARD_CONFIG_SAVE_H + +// free saveblock 1 defines +#define FREE_EXTRA_SEEN_FLAGS FALSE //free up extra pokedex seen flags. Frees up 104 bytes +#define FREE_TRAINER_HILL FALSE //frees up trainer hill data. 28 bytes. WARNING THIS HAS BEEN SHOWN TO BREAK MULTI BATTLES +#define FREE_MYSTERY_EVENT_BUFFERS FALSE //frees up mystery event and ramScript. roughly 1880 bytes Needed by FREE_BATTLE_TOWER_E_READER +#define FREE_MATCH_CALL FALSE //frees up match call data. 104 bytes +#define FREE_UNION_ROOM_CHAT FALSE //frees up field unk3C88. 210 bytes +#define FREE_ENIGMA_BERRY FALSE //frees up enigma berry. 52 bytes +#define FREE_LINK_BATTLE_RECORDS FALSE //frees link battle record data. 88 bytes + // saveblock1 total: 1846 bytes +//free saveblock 2 defines +#define FREE_BATTLE_TOWER_E_READER FALSE //frees up battle tower e reader trainer data. 188 bytes. WARNING THIS HAS BEEN SHOWN TO BREAK THE POKÉ MARTS' QUESTIONNAIRE +#define FREE_POKEMON_JUMP FALSE //frees up pokemon jump data. 16 bytes +#define FREE_RECORD_MIXING_HALL_RECORDS FALSE //frees up hall records for record mixing. 1032 bytes + // saveblock2 total: 1236 bytes + + //grand total: 3082 + +#endif // GUARD_CONFIG_DECAP_H diff --git a/include/global.h b/include/global.h index 2f2db6be38..0a527489ab 100644 --- a/include/global.h +++ b/include/global.h @@ -17,24 +17,7 @@ #include "constants/easy_chat.h" #include "constants/trainer_hill.h" #include "constants/items.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. WARNING THIS HAS BEEN SHOWN TO BREAK MULTI BATTLES -//#define FREE_MYSTERY_EVENT_BUFFERS //frees up mystery event and ramScript. roughly 1880 bytes Needed by FREE_BATTLE_TOWER_E_READER -//#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. WARNING THIS HAS BEEN SHOWN TO BREAK THE POKÉ MARTS' QUESTIONNAIRE -//#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 +#include "config/save.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); @@ -387,9 +370,9 @@ struct BattleFrontier /*0x64C*/ struct EmeraldBattleTowerRecord towerPlayer; /*0x738*/ struct EmeraldBattleTowerRecord towerRecords[BATTLE_TOWER_RECORD_COUNT]; // From record mixing. /*0xBEB*/ struct BattleTowerInterview towerInterview; - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE /*0xBEC*/ struct BattleTowerEReaderTrainer ereaderTrainer; //188 bytes - #endif +#endif //FREE_BATTLE_TOWER_E_READER /*0xCA8*/ u8 challengeStatus; /*0xCA9*/ u8 lvlMode:2; u8 challengePaused:1; @@ -542,14 +525,14 @@ struct SaveBlock2 /*0xB0*/ struct PlayersApprentice playerApprentice; /*0xDC*/ struct Apprentice apprentices[APPRENTICE_COUNT]; //272 bytes /*0x1EC*/ struct BerryCrush berryCrush; - #ifndef FREE_POKEMON_JUMP +#if FREE_POKEMON_JUMP == FALSE /*0x1FC*/ struct PokemonJumpRecords pokeJump; //16 bytes - #endif +#endif //FREE_POKEMON_JUMP /*0x20C*/ struct BerryPickingResults berryPick; - #ifndef FREE_RECORD_MIXING_HALL_RECORDS +#if FREE_RECORD_MIXING_HALL_RECORDS == FALSE /*0x21C*/ struct RankingHall1P hallRecords1P[HALL_FACILITIES_COUNT][FRONTIER_LVL_MODE_COUNT][HALL_RECORDS_COUNT]; // From record mixing. /*0x57C*/ struct RankingHall2P hallRecords2P[FRONTIER_LVL_MODE_COUNT][HALL_RECORDS_COUNT]; // From record mixing. - #endif +#endif //FREE_RECORD_MIXING_HALL_RECORDS /*0x624*/ u16 contestLinkResults[CONTEST_CATEGORIES_COUNT][CONTESTANT_COUNT]; /*0x64C*/ struct BattleFrontier frontier; }; // sizeof=0xF2C @@ -1023,15 +1006,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]; - #ifndef FREE_EXTRA_SEEN_FLAGS +#if FREE_EXTRA_SEEN_FLAGS == FALSE /*0x988*/ u8 filler1[0x34]; // Previously Dex Flags, feel free to remove. - #endif +#endif //FREE_EXTRA_SEEN_FLAGS /*0x9BC*/ u16 berryBlenderRecords[3]; /*0x9C2*/ u8 unused_9C2[6]; - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE /*0x9C8*/ u16 trainerRematchStepCounter; //104 bytes /*0x9CA*/ u8 trainerRematches[MAX_REMATCH_ENTRIES]; - #endif +#endif //FREE_MATCH_CALL /*0xA2E*/ //u8 padding3[2]; /*0xA30*/ struct ObjectEvent objectEvents[OBJECT_EVENTS_COUNT]; /*0xC70*/ struct ObjectEventTemplate objectEventTemplates[OBJECT_EVENT_TEMPLATES_COUNT]; @@ -1075,36 +1058,36 @@ 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 +#if FREE_LINK_BATTLE_RECORDS == FALSE /*0x3150*/ struct LinkBattleRecords linkBattleRecords; - #endif +#endif //FREE_LINK_BATTLE_RECORDS /*0x31A8*/ u8 giftRibbons[GIFT_RIBBONS_COUNT]; /*0x31B3*/ struct ExternalEventData externalEventData; /*0x31C7*/ struct ExternalEventFlags externalEventFlags; /*0x31DC*/ struct Roamer roamer; - #ifndef FREE_ENIGMA_BERRY +#if FREE_ENIGMA_BERRY == FALSE /*0x31F8*/ struct EnigmaBerry enigmaBerry; - #endif - #ifndef FREE_MYSTERY_EVENT_BUFFERS +#endif //FREE_ENIGMA_BERRY +#if FREE_MYSTERY_EVENT_BUFFERS == FALSE /*0x322C*/ struct MysteryGiftSave mysteryGift; - #endif +#endif //FREE_MYSTERY_EVENT_BUFFERS /*0x3???*/ u8 dexSeen[NUM_DEX_FLAG_BYTES]; /*0x3???*/ u8 dexCaught[NUM_DEX_FLAG_BYTES]; - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE /*0x3???*/ u32 trainerHillTimes[NUM_TRAINER_HILL_MODES]; - #endif - #ifndef FREE_MYSTERY_EVENT_BUFFERS +#endif //FREE_TRAINER_HILL +#if FREE_MYSTERY_EVENT_BUFFERS == FALSE /*0x3???*/ struct RamScript ramScript; - #endif +#endif //FREE_MYSTERY_EVENT_BUFFERS /*0x3???*/ struct RecordMixingGift recordMixingGift; /*0x3???*/ LilycoveLady lilycoveLady; /*0x3???*/ struct TrainerNameRecord trainerNameRecords[20]; - #ifndef FREE_UNION_ROOM_CHAT +#if FREE_UNION_ROOM_CHAT == FALSE /*0x3???*/ u8 registeredTexts[UNION_ROOM_KB_ROW_COUNT][21]; - #endif - #ifndef FREE_TRAINER_HILL +#endif //FREE_UNION_ROOM_CHAT +#if FREE_TRAINER_HILL == FALSE /*0x3???*/ struct TrainerHillSave trainerHill; - #endif +#endif //FREE_TRAINER_HILL /*0x3???*/ struct WaldaPhrase waldaPhrase; // sizeof: 0x3??? }; diff --git a/src/battle_main.c b/src/battle_main.c index dcdc03ede7..6f42f553f9 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -647,7 +647,7 @@ static void SetPlayerBerryDataInBattleStruct(void) if (IsEnigmaBerryValid() == TRUE) { - #ifndef FREE_ENIGMA_BERRY + #if FREE_ENIGMA_BERRY == FALSE for (i = 0; i < BERRY_NAME_LENGTH; i++) battleBerry->name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i]; battleBerry->name[i] = EOS; @@ -657,7 +657,7 @@ static void SetPlayerBerryDataInBattleStruct(void) battleBerry->holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; battleBerry->holdEffectParam = gSaveBlock1Ptr->enigmaBerry.holdEffectParam; - #endif + #endif //FREE_ENIGMA_BERRY } else { @@ -683,7 +683,7 @@ static void SetAllPlayersBerryData(void) { if (IsEnigmaBerryValid() == TRUE) { - #ifndef FREE_ENIGMA_BERRY + #if FREE_ENIGMA_BERRY == FALSE for (i = 0; i < BERRY_NAME_LENGTH; i++) { gEnigmaBerries[0].name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i]; @@ -702,7 +702,7 @@ static void SetAllPlayersBerryData(void) gEnigmaBerries[2].holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; gEnigmaBerries[0].holdEffectParam = gSaveBlock1Ptr->enigmaBerry.holdEffectParam; gEnigmaBerries[2].holdEffectParam = gSaveBlock1Ptr->enigmaBerry.holdEffectParam; - #endif + #endif //FREE_ENIGMA_BERRY } else { diff --git a/src/battle_records.c b/src/battle_records.c index 8e7ee21022..b0ea66f2f4 100644 --- a/src/battle_records.c +++ b/src/battle_records.c @@ -222,9 +222,9 @@ static void UpdateLinkBattleRecords(struct LinkBattleRecords *records, const u8 void ClearPlayerLinkBattleRecords(void) { - #ifndef FREE_LINK_BATTLE_RECORDS +#if FREE_LINK_BATTLE_RECORDS == FALSE ClearLinkBattleRecords(gSaveBlock1Ptr->linkBattleRecords.entries); - #endif +#endif //FREE_LINK_BATTLE_RECORDS } static void IncTrainerCardWins(s32 battlerId) @@ -260,7 +260,7 @@ static void UpdateTrainerCardWinsLosses(s32 battlerId) void UpdatePlayerLinkBattleRecords(s32 battlerId) { - #ifndef FREE_LINK_BATTLE_RECORDS +#if FREE_LINK_BATTLE_RECORDS == FALSE if (InUnionRoom() != TRUE) { UpdateTrainerCardWinsLosses(battlerId); @@ -271,7 +271,7 @@ void UpdatePlayerLinkBattleRecords(s32 battlerId) gBattleOutcome, battlerId); } - #endif +#endif //FREE_LINK_BATTLE_RECORDS } static void PrintLinkBattleWinsLossesDraws(struct LinkBattleRecord *records) @@ -327,7 +327,7 @@ void ShowLinkBattleRecords(void) x = GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar4, 208); AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x, 1, 0, NULL); - #ifndef FREE_LINK_BATTLE_RECORDS +#if FREE_LINK_BATTLE_RECORDS == FALSE PrintLinkBattleWinsLossesDraws(gSaveBlock1Ptr->linkBattleRecords.entries); StringExpandPlaceholders(gStringVar4, gText_WinLoseDraw); @@ -337,7 +337,7 @@ void ShowLinkBattleRecords(void) { PrintLinkBattleRecord(&gSaveBlock1Ptr->linkBattleRecords.entries[i], 7 + (i * 2), gSaveBlock1Ptr->linkBattleRecords.languages[i]); } - #endif +#endif //FREE_LINK_BATTLE_RECORDS PutWindowTilemap(gRecordsWindowId); CopyWindowToVram(gRecordsWindowId, COPYWIN_FULL); } diff --git a/src/battle_setup.c b/src/battle_setup.c index af0694a226..8839ba13dc 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -1182,7 +1182,7 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data) TrainerBattleLoadArgs(sContinueScriptDoubleBattleParams, data); SetMapVarsToTrainer(); return EventScript_TryDoDoubleTrainerBattle; -#ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE case TRAINER_BATTLE_REMATCH_DOUBLE: TrainerBattleLoadArgs(sDoubleBattleParams, data); SetMapVarsToTrainer(); @@ -1193,7 +1193,7 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data) SetMapVarsToTrainer(); gTrainerBattleOpponent_A = GetRematchTrainerId(gTrainerBattleOpponent_A); return EventScript_TryDoRematchBattle; -#endif +#endif //FREE_MATCH_CALL case TRAINER_BATTLE_PYRAMID: if (gApproachingTrainerId == 0) { @@ -1681,7 +1681,7 @@ static void SetRematchIdForTrainer(const struct RematchTrainer *table, u32 table { s32 i; - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE for (i = 1; i < REMATCHES_COUNT; i++) { u16 trainerId = table[tableId].trainerIds[i]; @@ -1693,7 +1693,7 @@ static void SetRematchIdForTrainer(const struct RematchTrainer *table, u32 table } gSaveBlock1Ptr->trainerRematches[tableId] = i; - #endif +#endif //FREE_MATCH_CALL } static bool32 DoesCurrentMapMatchRematchTrainerMap(s32 i, const struct RematchTrainer *table, u16 mapGroup, u16 mapNum) @@ -1713,7 +1713,7 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u if (CheckBagHasItem(ITEM_VS_SEEKER, 1) && I_VS_SEEKER_CHARGING != 0) return FALSE; - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE for (i = 0; i <= REMATCH_SPECIAL_TRAINER_START; i++) { if (DoesCurrentMapMatchRematchTrainerMap(i,table,mapGroup,mapNum) && !IsRematchForbidden(i)) @@ -1731,7 +1731,7 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u return TRUE; } } - #endif +#endif //FREE_MATCH_CALL return FALSE; } @@ -1746,13 +1746,13 @@ static bool32 DoesSomeoneWantRematchIn_(const struct RematchTrainer *table, u16 { s32 i; - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE for (i = 0; i < REMATCH_TABLE_ENTRIES; i++) { if (table[i].mapGroup == mapGroup && table[i].mapNum == mapNum && gSaveBlock1Ptr->trainerRematches[i] != 0) return TRUE; } - #endif +#endif //FREE_MATCH_CALL return FALSE; } @@ -1777,10 +1777,10 @@ static bool8 IsFirstTrainerIdReadyForRematch(const struct RematchTrainer *table, return FALSE; if (tableId >= MAX_REMATCH_ENTRIES) return FALSE; - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE if (gSaveBlock1Ptr->trainerRematches[tableId] == 0) return FALSE; - #endif +#endif //FREE_MATCH_CALL return TRUE; } @@ -1792,10 +1792,10 @@ static bool8 IsTrainerReadyForRematch_(const struct RematchTrainer *table, u16 t return FALSE; if (tableId >= MAX_REMATCH_ENTRIES) return FALSE; - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE if (gSaveBlock1Ptr->trainerRematches[tableId] == 0) return FALSE; - #endif +#endif //FREE_MATCH_CALL return TRUE; } @@ -1843,12 +1843,12 @@ static u16 GetLastBeatenRematchTrainerIdFromTable(const struct RematchTrainer *t static void ClearTrainerWantRematchState(const struct RematchTrainer *table, u16 firstBattleTrainerId) { - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE s32 tableId = TrainerIdToRematchTableId(table, firstBattleTrainerId); if (tableId != -1) gSaveBlock1Ptr->trainerRematches[tableId] = 0; - #endif +#endif //FREE_MATCH_CALL } static u32 GetTrainerMatchCallFlag(u32 trainerId) @@ -1906,7 +1906,7 @@ static bool32 HasAtLeastFiveBadges(void) void IncrementRematchStepCounter(void) { - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE if (HasAtLeastFiveBadges() && (I_VS_SEEKER_CHARGING != 0) && (!CheckBagHasItem(ITEM_VS_SEEKER, 1))) @@ -1916,27 +1916,27 @@ void IncrementRematchStepCounter(void) else gSaveBlock1Ptr->trainerRematchStepCounter++; } - #endif +#endif //FREE_MATCH_CALL } static bool32 IsRematchStepCounterMaxed(void) { - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE if (HasAtLeastFiveBadges() && gSaveBlock1Ptr->trainerRematchStepCounter >= STEP_COUNTER_MAX) return TRUE; else return FALSE; - #else +#else return FALSE; - #endif +#endif //FREE_MATCH_CALL } void TryUpdateRandomTrainerRematches(u16 mapGroup, u16 mapNum) { - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE if (IsRematchStepCounterMaxed() && UpdateRandomTrainerRematches(gRematchTable, mapGroup, mapNum) == TRUE) gSaveBlock1Ptr->trainerRematchStepCounter = 0; - #endif +#endif //FREE_MATCH_CALL } bool32 DoesSomeoneWantRematchIn(u16 mapGroup, u16 mapNum) diff --git a/src/battle_tower.c b/src/battle_tower.c index dd4fb864bf..e190430127 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -935,10 +935,10 @@ static void SetTowerData(void) static void SetTowerBattleWon(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (gTrainerBattleOpponent_A == TRAINER_EREADER) ClearEReaderTrainer(&gSaveBlock2Ptr->frontier.ereaderTrainer); - #endif +#endif //FREE_BATTLE_TOWER_E_READER // towerNumWins is never read outside this conditional if (gSaveBlock2Ptr->frontier.towerNumWins < MAX_STREAK) @@ -1134,15 +1134,15 @@ void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId) u8 trainerObjectGfxId; SetFacilityPtrsGetLevel(); - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (trainerId == TRAINER_EREADER) { facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass; } else if (trainerId == TRAINER_FRONTIER_BRAIN) - #else +#else if (trainerId == TRAINER_FRONTIER_BRAIN) - #endif +#endif //FREE_BATTLE_TOWER_E_READER { SetFrontierBrainObjEventGfx_2(); return; @@ -1235,15 +1235,15 @@ u8 GetBattleFacilityTrainerGfxId(u16 trainerId) u8 trainerObjectGfxId; SetFacilityPtrsGetLevel(); - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (trainerId == TRAINER_EREADER) { facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass; } else if (trainerId < FRONTIER_TRAINERS_COUNT) - #else +#else if (trainerId < FRONTIER_TRAINERS_COUNT) - #endif +#endif //FREE_BATTLE_TOWER_E_READER { facilityClass = gFacilityTrainers[trainerId].facilityClass; } @@ -1382,15 +1382,15 @@ u8 GetFrontierTrainerFrontSpriteId(u16 trainerId) { SetFacilityPtrsGetLevel(); - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (trainerId == TRAINER_EREADER) { return gFacilityClassToPicIndex[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass]; } else if (trainerId == TRAINER_FRONTIER_BRAIN) - #else +#else if (trainerId == TRAINER_FRONTIER_BRAIN) - #endif +#endif //FREE_BATTLE_TOWER_E_READER { return GetFrontierBrainTrainerPicIndex(); } @@ -1419,15 +1419,15 @@ u8 GetFrontierOpponentClass(u16 trainerId) u8 trainerClass = 0; SetFacilityPtrsGetLevel(); - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (trainerId == TRAINER_EREADER) { trainerClass = gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass]; } else if (trainerId == TRAINER_FRONTIER_BRAIN) - #else +#else if (trainerId == TRAINER_FRONTIER_BRAIN) - #endif +#endif //FREE_BATTLE_TOWER_E_READER { return GetFrontierBrainTrainerClass(); } @@ -1472,11 +1472,11 @@ static u8 GetFrontierTrainerFacilityClass(u16 trainerId) if (trainerId == TRAINER_EREADER) { - #ifndef FREE_BATTLE_TOWER_E_READER + #if FREE_BATTLE_TOWER_E_READER == FALSE facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass; - #else + #else facilityClass = 0; - #endif + #endif //FREE_BATTLE_TOWER_E_READER } else if (trainerId < FRONTIER_TRAINERS_COUNT) { @@ -1507,10 +1507,10 @@ void GetFrontierTrainerName(u8 *dst, u16 trainerId) if (trainerId == TRAINER_EREADER) { - #ifndef FREE_BATTLE_TOWER_E_READER + #if FREE_BATTLE_TOWER_E_READER == FALSE for (i = 0; i < PLAYER_NAME_LENGTH; i++) dst[i] = gSaveBlock2Ptr->frontier.ereaderTrainer.name[i]; - #endif + #endif //FREE_BATTLE_TOWER_E_READER } else if (trainerId == TRAINER_FRONTIER_BRAIN) { @@ -1571,11 +1571,11 @@ static bool8 IsFrontierTrainerFemale(u16 trainerId) SetFacilityPtrsGetLevel(); if (trainerId == TRAINER_EREADER) { - #ifndef FREE_BATTLE_TOWER_E_READER + #if FREE_BATTLE_TOWER_E_READER == FALSE facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass; - #else + #else facilityClass = 0; - #endif + #endif //FREE_BATTLE_TOWER_E_READER } else if (trainerId == TRAINER_FRONTIER_BRAIN) { @@ -1644,10 +1644,10 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) } else if (trainerId == TRAINER_EREADER) { - #ifndef FREE_BATTLE_TOWER_E_READER + #if FREE_BATTLE_TOWER_E_READER == FALSE for (i = firstMonId; i < firstMonId + FRONTIER_PARTY_SIZE; i++) CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]); - #endif + #endif //FREE_BATTLE_TOWER_E_READER return; } else if (trainerId == TRAINER_FRONTIER_BRAIN) @@ -1845,10 +1845,10 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId) } else if (trainerId == TRAINER_EREADER) { - #ifndef FREE_BATTLE_TOWER_E_READER + #if FREE_BATTLE_TOWER_E_READER == FALSE for (i = firstMonId; i < firstMonId + FRONTIER_PARTY_SIZE; i++) CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]); - #endif + #endif //FREE_BATTLE_TOWER_E_READER return; } else if (trainerId == TRAINER_FRONTIER_BRAIN) @@ -1942,13 +1942,13 @@ static void GetOpponentIntroSpeech(void) else trainerId = gTrainerBattleOpponent_A; - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (trainerId == TRAINER_EREADER) FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting); else if (trainerId < FRONTIER_TRAINERS_COUNT) - #else +#else if (trainerId < FRONTIER_TRAINERS_COUNT) - #endif +#endif //FREE_BATTLE_TOWER_E_READER FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore); else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE) FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].greeting); @@ -2058,7 +2058,7 @@ void DoSpecialTrainerBattle(void) BattleTransition_StartOnField(GetSpecialBattleTransition(B_TRANSITION_GROUP_SECRET_BASE)); break; case SPECIAL_BATTLE_EREADER: - #ifndef FREE_BATTLE_TOWER_E_READER + #if FREE_BATTLE_TOWER_E_READER == FALSE ZeroEnemyPartyMons(); for (i = 0; i < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.ereaderTrainer.party); i++) CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i]); @@ -2067,7 +2067,7 @@ void DoSpecialTrainerBattle(void) CreateTask(Task_StartBattleAfterTransition, 1); PlayMapChosenOrBattleBGM(0); BattleTransition_StartOnField(GetSpecialBattleTransition(B_TRANSITION_GROUP_E_READER)); - #endif + #endif //FREE_BATTLE_TOWER_E_READER break; case SPECIAL_BATTLE_DOME: gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOME; @@ -2854,7 +2854,7 @@ static void AwardBattleTowerRibbons(void) // trainer with the player's current data. static void UNUSED FillEReaderTrainerWithPlayerData(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE struct BattleTowerEReaderTrainer *ereaderTrainer = &gSaveBlock2Ptr->frontier.ereaderTrainer; s32 i, j; @@ -2887,44 +2887,44 @@ static void UNUSED FillEReaderTrainerWithPlayerData(void) ConvertPokemonToBattleTowerPokemon(&gPlayerParty[i], &ereaderTrainer->party[i]); SetEReaderTrainerChecksum(ereaderTrainer); - #endif +#endif //FREE_BATTLE_TOWER_E_READER } u8 GetEreaderTrainerFrontSpriteId(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE return gFacilityClassToPicIndex[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass]; - #else +#else return 0; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } u8 GetEreaderTrainerClassId(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE return gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass]; - #else +#else return 0; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } void GetEreaderTrainerName(u8 *dst) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE s32 i; for (i = 0; i < 5; i++) dst[i] = gSaveBlock2Ptr->frontier.ereaderTrainer.name[i]; dst[i] = EOS; - #else +#else dst[0] = EOS; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } // Checks if the saved E-Reader trainer is valid. void ValidateEReaderTrainer(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE u32 i; u32 checksum; struct BattleTowerEReaderTrainer *ereaderTrainer; @@ -2951,49 +2951,49 @@ void ValidateEReaderTrainer(void) ClearEReaderTrainer(&gSaveBlock2Ptr->frontier.ereaderTrainer); gSpecialVar_Result = TRUE; } - #else +#else gSpecialVar_Result = FALSE; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } static void SetEReaderTrainerChecksum(struct BattleTowerEReaderTrainer *ereaderTrainer) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE 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 +#endif //FREE_BATTLE_TOWER_E_READER } void ClearEReaderTrainer(struct BattleTowerEReaderTrainer *ereaderTrainer) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE u32 i; for (i = 0; i < (sizeof(struct BattleTowerEReaderTrainer)) / 4; i++) ((u32 *)ereaderTrainer)[i] = 0; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } void CopyEReaderTrainerGreeting(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting); - #endif +#endif //FREE_BATTLE_TOWER_E_READER } static void CopyEReaderTrainerFarewellMessage(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE 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 +#endif //FREE_BATTLE_TOWER_E_READER } void TryHideBattleTowerReporter(void) diff --git a/src/berry.c b/src/berry.c index 1a37a699ab..facd5734db 100644 --- a/src/berry.c +++ b/src/berry.c @@ -1669,18 +1669,18 @@ const struct BerryTree gBlankBerryTree = {}; void SetEnigmaBerry(u8 *src) { - #ifndef FREE_ENIGMA_BERRY +#if FREE_ENIGMA_BERRY == FALSE u32 i; u8 *dest = (u8 *)&gSaveBlock1Ptr->enigmaBerry; for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry); i++) dest[i] = src[i]; - #endif +#endif //FREE_ENIGMA_BERRY } static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) { - #ifndef FREE_ENIGMA_BERRY +#if FREE_ENIGMA_BERRY == FALSE u32 i; u32 checksum; u8 *dest; @@ -1691,14 +1691,14 @@ static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) checksum += dest[i]; return checksum; - #else +#else return 0; - #endif +#endif //FREE_ENIGMA_BERRY } bool32 IsEnigmaBerryValid(void) { - #ifndef FREE_ENIGMA_BERRY +#if FREE_ENIGMA_BERRY == FALSE if (!gSaveBlock1Ptr->enigmaBerry.berry.growthDuration) return FALSE; if (!gSaveBlock1Ptr->enigmaBerry.berry.maxYield) @@ -1706,19 +1706,19 @@ bool32 IsEnigmaBerryValid(void) if (GetEnigmaBerryChecksum(&gSaveBlock1Ptr->enigmaBerry) != gSaveBlock1Ptr->enigmaBerry.checksum) return FALSE; return TRUE; - #else +#else return FALSE; - #endif +#endif //FREE_ENIGMA_BERRY } const struct Berry *GetBerryInfo(u8 berry) { if (berry == ITEM_TO_BERRY(ITEM_ENIGMA_BERRY_E_READER) && IsEnigmaBerryValid()) - #ifndef FREE_ENIGMA_BERRY + #if FREE_ENIGMA_BERRY == FALSE return (struct Berry *)(&gSaveBlock1Ptr->enigmaBerry.berry); - #else + #else return &gBerries[0]; //never reached, but will appease the compiler gods - #endif + #endif //FREE_ENIGMA_BERRY else { if (berry == BERRY_NONE || berry > ITEM_TO_BERRY(LAST_BERRY_INDEX)) diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index 193076b74b..cf12867667 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -375,9 +375,9 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { static u8 GetTrainerHillUnkVal(void) { - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE return (gSaveBlock1Ptr->trainerHill.unused + 1) % 256; - #endif +#endif //FREE_TRAINER_HILL } static bool32 ValidateTrainerChecksum(struct EReaderTrainerHillTrainer * hillTrainer) diff --git a/src/field_specials.c b/src/field_specials.c index 98733c9a78..1005d06bf2 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -140,11 +140,11 @@ static void Task_CloseBattlePikeCurtain(u8); static u8 DidPlayerGetFirstFans(void); static void SetInitialFansOfPlayer(void); static u16 PlayerGainRandomTrainerFan(void); -#ifndef FREE_LINK_BATTLE_RECORDS +#if FREE_LINK_BATTLE_RECORDS == FALSE static void BufferFanClubTrainerName_(struct LinkBattleRecords *, u8, u8); #else static void BufferFanClubTrainerName_(u8 whichLinkTrainer, u8 whichNPCTrainer); -#endif +#endif //FREE_LINK_BATTLE_RECORDS void Special_ShowDiploma(void) { @@ -4146,14 +4146,14 @@ void BufferFanClubTrainerName(void) case FANCLUB_MEMBER8: break; } - #ifndef FREE_LINK_BATTLE_RECORDS +#if FREE_LINK_BATTLE_RECORDS == FALSE BufferFanClubTrainerName_(&gSaveBlock1Ptr->linkBattleRecords, whichLinkTrainer, whichNPCTrainer); - #else +#else BufferFanClubTrainerName_(whichLinkTrainer, whichNPCTrainer); - #endif +#endif //FREE_LINK_BATTLE_RECORDS } -#ifndef FREE_LINK_BATTLE_RECORDS +#if FREE_LINK_BATTLE_RECORDS == FALSE static void BufferFanClubTrainerName_(struct LinkBattleRecords *linkRecords, u8 whichLinkTrainer, u8 whichNPCTrainer) { struct LinkBattleRecord *record = &linkRecords->entries[whichLinkTrainer]; @@ -4219,7 +4219,7 @@ static void BufferFanClubTrainerName_(u8 whichLinkTrainer, u8 whichNPCTrainer) break; } } -#endif +#endif //FREE_LINK_BATTLE_RECORDS void UpdateTrainerFansAfterLinkBattle(void) { diff --git a/src/frontier_util.c b/src/frontier_util.c index 89eae19973..bf3cd14ae8 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -1652,13 +1652,13 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId) switch (whichText) { case FRONTIER_BEFORE_TEXT: - #ifndef FREE_BATTLE_TOWER_E_READER + #if FREE_BATTLE_TOWER_E_READER == FALSE if (trainerId == TRAINER_EREADER) FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting); else if (trainerId == TRAINER_FRONTIER_BRAIN) - #else + #else if (trainerId == TRAINER_FRONTIER_BRAIN) - #endif + #endif //FREE_BATTLE_TOWER_E_READER CopyFrontierBrainText(FALSE); else if (trainerId < FRONTIER_TRAINERS_COUNT) FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore); @@ -1668,15 +1668,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 FREE_BATTLE_TOWER_E_READER == FALSE if (trainerId == TRAINER_EREADER) { FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.farewellPlayerLost); } else if (trainerId == TRAINER_FRONTIER_BRAIN) - #else + #else if (trainerId == TRAINER_FRONTIER_BRAIN) - #endif + #endif //FREE_BATTLE_TOWER_E_READER { CopyFrontierBrainText(FALSE); } @@ -1702,9 +1702,9 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId) case FRONTIER_PLAYER_WON_TEXT: if (trainerId == TRAINER_EREADER) { - #ifndef FREE_BATTLE_TOWER_E_READER + #if FREE_BATTLE_TOWER_E_READER == FALSE FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.farewellPlayerWon); - #endif + #endif //FREE_BATTLE_TOWER_E_READER } else if (trainerId == TRAINER_FRONTIER_BRAIN) { @@ -2223,7 +2223,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 +#if FREE_RECORD_MIXING_HALL_RECORDS == FALSE s32 i, j; struct RankingHall1P record1P[HALL_RECORDS_COUNT + 1]; struct PlayerHallRecords *playerHallRecords = AllocZeroed(sizeof(struct PlayerHallRecords)); @@ -2254,12 +2254,12 @@ static void Fill1PRecords(struct RankingHall1P *dst, s32 hallFacilityId, s32 lvl } Free(playerHallRecords); - #endif +#endif //FREE_RECORD_MIXING_HALL_RECORDS } static void Fill2PRecords(struct RankingHall2P *dst, s32 lvlMode) { - #ifndef FREE_RECORD_MIXING_HALL_RECORDS +#if FREE_RECORD_MIXING_HALL_RECORDS == FALSE s32 i, j; struct RankingHall2P record2P[HALL_RECORDS_COUNT + 1]; struct PlayerHallRecords *playerHallRecords = AllocZeroed(sizeof(struct PlayerHallRecords)); @@ -2290,7 +2290,7 @@ static void Fill2PRecords(struct RankingHall2P *dst, s32 lvlMode) } Free(playerHallRecords); - #endif +#endif //FREE_RECORD_MIXING_HALL_RECORDS } static void PrintHallRecords(s32 hallFacilityId, s32 lvlMode) @@ -2340,7 +2340,7 @@ void ScrollRankingHallRecordsWindow(void) void ClearRankingHallRecords(void) { - #ifndef FREE_RECORD_MIXING_HALL_RECORDS +#if FREE_RECORD_MIXING_HALL_RECORDS == FALSE s32 i, j, k; // UB: Passing 0 as a pointer instead of a pointer holding a value of 0. @@ -2375,7 +2375,7 @@ void ClearRankingHallRecords(void) gSaveBlock2Ptr->hallRecords2P[j][k].winStreak = 0; } } - #endif +#endif //FREE_RECORD_MIXING_HALL_RECORDS } void SaveGameFrontier(void) diff --git a/src/gym_leader_rematch.c b/src/gym_leader_rematch.c index 611a157e8f..222299982c 100644 --- a/src/gym_leader_rematch.c +++ b/src/gym_leader_rematch.c @@ -46,7 +46,7 @@ static void UpdateGymLeaderRematchFromArray(const u16 *data, size_t size, u32 ma s32 lowestRematchIndex = 5; u32 i; s32 rematchIndex; - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE for (i = 0; i < size; i++) { if (!gSaveBlock1Ptr->trainerRematches[data[i]]) @@ -90,7 +90,7 @@ static void UpdateGymLeaderRematchFromArray(const u16 *data, size_t size, u32 ma } } } - #endif +#endif //FREE_MATCH_CALL } static s32 GetRematchIndex(u32 trainerIdx) diff --git a/src/match_call.c b/src/match_call.c index 6fce2979b3..4d4b1d35bf 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -1460,9 +1460,9 @@ static void Task_SpinPokenavIcon(u8 taskId) static bool32 TrainerIsEligibleForRematch(int matchCallId) { - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE return gSaveBlock1Ptr->trainerRematches[matchCallId] > 0; - #endif +#endif //FREE_MATCH_CALL } static u16 GetRematchTrainerLocation(int matchCallId) diff --git a/src/mystery_event_script.c b/src/mystery_event_script.c index a97d6cf04f..ea49817e8c 100644 --- a/src/mystery_event_script.c +++ b/src/mystery_event_script.c @@ -226,7 +226,7 @@ bool8 MEScrCmd_runscript(struct ScriptContext *ctx) bool8 MEScrCmd_setenigmaberry(struct ScriptContext *ctx) { - #ifndef FREE_ENIGMA_BERRY +#if FREE_ENIGMA_BERRY == FALSE u8 *str; const u8 *message; bool32 haveBerry = IsEnigmaBerryValid(); @@ -259,7 +259,7 @@ bool8 MEScrCmd_setenigmaberry(struct ScriptContext *ctx) VarSet(VAR_ENIGMA_BERRY_AVAILABLE, 1); else ctx->mStatus = MEVENT_STATUS_LOAD_ERROR; - #endif +#endif //FREE_ENIGMA_BERRY return FALSE; } @@ -358,13 +358,13 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx) bool8 MEScrCmd_addtrainer(struct ScriptContext *ctx) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE u32 data = ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase; memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, (void *)data, sizeof(gSaveBlock2Ptr->frontier.ereaderTrainer)); ValidateEReaderTrainer(); StringExpandPlaceholders(gStringVar4, gText_MysteryEventNewTrainer); ctx->mStatus = MEVENT_STATUS_SUCCESS; - #endif +#endif //FREE_BATTLE_TOWER_E_READER return FALSE; } diff --git a/src/mystery_gift.c b/src/mystery_gift.c index b0cc2f4423..3e95234b3c 100755 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -26,46 +26,46 @@ static void IncrementCardStatForNewTrainer(u32, u32, u32 *, int); void ClearMysteryGift(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE CpuFill32(0, &gSaveBlock1Ptr->mysteryGift, sizeof(gSaveBlock1Ptr->mysteryGift)); ClearSavedWonderNewsMetadata(); // Clear is redundant, WonderNews_Reset would be sufficient - #endif +#endif //FREE_BATTLE_TOWER_E_READER InitQuestionnaireWords(); } struct WonderNews *GetSavedWonderNews(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE return &gSaveBlock1Ptr->mysteryGift.news; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } struct WonderCard *GetSavedWonderCard(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE return &gSaveBlock1Ptr->mysteryGift.card; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } struct WonderCardMetadata *GetSavedWonderCardMetadata(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE return &gSaveBlock1Ptr->mysteryGift.cardMetadata; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } struct WonderNewsMetadata *GetSavedWonderNewsMetadata(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE return &gSaveBlock1Ptr->mysteryGift.newsMetadata; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } u16 *GetQuestionnaireWordsPtr(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE return gSaveBlock1Ptr->mysteryGift.questionnaireWords; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } // Equivalent to ClearSavedWonderCardAndRelated, but nothing else to clear @@ -76,7 +76,7 @@ void ClearSavedWonderNewsAndRelated(void) bool32 SaveWonderNews(const struct WonderNews *news) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (!ValidateWonderNews(news)) return FALSE; @@ -84,23 +84,23 @@ bool32 SaveWonderNews(const struct WonderNews *news) gSaveBlock1Ptr->mysteryGift.news = *news; gSaveBlock1Ptr->mysteryGift.newsCrc = CALC_CRC(gSaveBlock1Ptr->mysteryGift.news); return TRUE; - #else +#else return FALSE; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } bool32 ValidateSavedWonderNews(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (CALC_CRC(gSaveBlock1Ptr->mysteryGift.news) != gSaveBlock1Ptr->mysteryGift.newsCrc) return FALSE; if (!ValidateWonderNews(&gSaveBlock1Ptr->mysteryGift.news)) return FALSE; return TRUE; - #else +#else return FALSE; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } static bool32 ValidateWonderNews(const struct WonderNews *news) @@ -113,36 +113,36 @@ static bool32 ValidateWonderNews(const struct WonderNews *news) bool32 IsSendingSavedWonderNewsAllowed(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE const struct WonderNews *news = &gSaveBlock1Ptr->mysteryGift.news; if (news->sendType == SEND_TYPE_DISALLOWED) return FALSE; return TRUE; - #else +#else return FALSE; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } static void ClearSavedWonderNews(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE CpuFill32(0, GetSavedWonderNews(), sizeof(gSaveBlock1Ptr->mysteryGift.news)); gSaveBlock1Ptr->mysteryGift.newsCrc = 0; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } static void ClearSavedWonderNewsMetadata(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE CpuFill32(0, GetSavedWonderNewsMetadata(), sizeof(gSaveBlock1Ptr->mysteryGift.newsMetadata)); WonderNews_Reset(); - #endif +#endif //FREE_BATTLE_TOWER_E_READER } bool32 IsWonderNewsSameAsSaved(const u8 *news) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE const u8 *savedNews = (const u8 *)&gSaveBlock1Ptr->mysteryGift.news; u32 i; if (!ValidateSavedWonderNews()) @@ -155,14 +155,14 @@ bool32 IsWonderNewsSameAsSaved(const u8 *news) } return TRUE; - #else +#else return FALSE; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } void ClearSavedWonderCardAndRelated(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE ClearSavedWonderCard(); ClearSavedWonderCardMetadata(); ClearSavedTrainerIds(); @@ -170,12 +170,12 @@ void ClearSavedWonderCardAndRelated(void) ClearMysteryGiftFlags(); ClearMysteryGiftVars(); ClearEReaderTrainer(&gSaveBlock2Ptr->frontier.ereaderTrainer); - #endif +#endif //FREE_BATTLE_TOWER_E_READER } bool32 SaveWonderCard(const struct WonderCard *card) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE struct WonderCardMetadata *metadata; if (!ValidateWonderCard(card)) return FALSE; @@ -186,14 +186,14 @@ bool32 SaveWonderCard(const struct WonderCard *card) metadata = &gSaveBlock1Ptr->mysteryGift.cardMetadata; metadata->iconSpecies = (&gSaveBlock1Ptr->mysteryGift.card)->iconSpecies; return TRUE; - #else +#else return FALSE; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } bool32 ValidateSavedWonderCard(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (gSaveBlock1Ptr->mysteryGift.cardCrc != CALC_CRC(gSaveBlock1Ptr->mysteryGift.card)) return FALSE; if (!ValidateWonderCard(&gSaveBlock1Ptr->mysteryGift.card)) @@ -202,9 +202,9 @@ bool32 ValidateSavedWonderCard(void) return FALSE; return TRUE; - #else +#else return FALSE; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } static bool32 ValidateWonderCard(const struct WonderCard *card) @@ -227,39 +227,39 @@ static bool32 ValidateWonderCard(const struct WonderCard *card) bool32 IsSendingSavedWonderCardAllowed(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE const struct WonderCard *card = &gSaveBlock1Ptr->mysteryGift.card; if (card->sendType == SEND_TYPE_DISALLOWED) return FALSE; return TRUE; - #else +#else return FALSE; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } static void ClearSavedWonderCard(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE CpuFill32(0, &gSaveBlock1Ptr->mysteryGift.card, sizeof(gSaveBlock1Ptr->mysteryGift.card)); gSaveBlock1Ptr->mysteryGift.cardCrc = 0; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } static void ClearSavedWonderCardMetadata(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE CpuFill32(0, GetSavedWonderCardMetadata(), sizeof(gSaveBlock1Ptr->mysteryGift.cardMetadata)); gSaveBlock1Ptr->mysteryGift.cardMetadataCrc = 0; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } u16 GetWonderCardFlagID(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (ValidateSavedWonderCard()) return gSaveBlock1Ptr->mysteryGift.card.flagId; - #endif +#endif //FREE_BATTLE_TOWER_E_READER return 0; } @@ -359,20 +359,20 @@ static int GetNumStampsInSavedCard(void) if (!ValidateSavedWonderCard()) return 0; - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE card = &gSaveBlock1Ptr->mysteryGift.card; if (card->type != CARD_TYPE_STAMP) return 0; return GetNumStampsInMetadata(&gSaveBlock1Ptr->mysteryGift.cardMetadata, card->maxStamps); - #else +#else return 0; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } bool32 MysteryGift_TrySaveStamp(const u16 *stamp) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE struct WonderCard *card = &gSaveBlock1Ptr->mysteryGift.card; int maxStamps = card->maxStamps; int i; @@ -392,7 +392,7 @@ bool32 MysteryGift_TrySaveStamp(const u16 *stamp) return TRUE; } } - #endif +#endif //FREE_BATTLE_TOWER_E_READER return FALSE; } @@ -402,7 +402,7 @@ bool32 MysteryGift_TrySaveStamp(const u16 *stamp) void MysteryGift_LoadLinkGameData(struct MysteryGiftLinkGameData *data, bool32 isWonderNews) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE int i; CpuFill32(0, data, sizeof(*data)); data->validationVar = GAME_DATA_VALID_VAR; @@ -443,7 +443,7 @@ void MysteryGift_LoadLinkGameData(struct MysteryGiftLinkGameData *data, bool32 i memcpy(data->romHeaderGameCode, RomHeaderGameCode, GAME_CODE_LENGTH); data->romHeaderSoftwareVersion = RomHeaderSoftwareVersion; - #endif +#endif //FREE_BATTLE_TOWER_E_READER } bool32 MysteryGift_ValidateLinkGameData(const struct MysteryGiftLinkGameData *data, bool32 isWonderNews) @@ -544,7 +544,7 @@ u16 MysteryGift_GetCardStatFromLinkData(const struct MysteryGiftLinkGameData *da static void IncrementCardStat(u32 statType) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE struct WonderCard *card = &gSaveBlock1Ptr->mysteryGift.card; if (card->type == CARD_TYPE_LINK_STAT) { @@ -574,12 +574,12 @@ static void IncrementCardStat(u32 statType) *stat = MAX_WONDER_CARD_STAT; } } - #endif +#endif //FREE_BATTLE_TOWER_E_READER } u16 MysteryGift_GetCardStat(u32 stat) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE switch (stat) { case CARD_STAT_BATTLES_WON: @@ -627,7 +627,7 @@ u16 MysteryGift_GetCardStat(u32 stat) break; } } - #endif +#endif //FREE_BATTLE_TOWER_E_READER AGB_ASSERT(0); return 0; } @@ -646,10 +646,10 @@ bool32 MysteryGift_TryEnableStatsByFlagId(u16 flagId) if (!ValidateSavedWonderCard()) return FALSE; - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (gSaveBlock1Ptr->mysteryGift.card.flagId != flagId) return FALSE; - #endif +#endif //FREE_BATTLE_TOWER_E_READER sStatsEnabled = TRUE; return TRUE; @@ -657,7 +657,7 @@ bool32 MysteryGift_TryEnableStatsByFlagId(u16 flagId) void MysteryGift_TryIncrementStat(u32 stat, u32 trainerId) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE if (sStatsEnabled) { switch (stat) @@ -685,14 +685,14 @@ void MysteryGift_TryIncrementStat(u32 stat, u32 trainerId) break; } } - #endif +#endif //FREE_BATTLE_TOWER_E_READER } static void ClearSavedTrainerIds(void) { - #ifndef FREE_BATTLE_TOWER_E_READER +#if FREE_BATTLE_TOWER_E_READER == FALSE CpuFill32(0, gSaveBlock1Ptr->mysteryGift.trainerIds, sizeof(gSaveBlock1Ptr->mysteryGift.trainerIds)); - #endif +#endif //FREE_BATTLE_TOWER_E_READER } // Returns TRUE if it's a new trainer id, FALSE if an existing one. diff --git a/src/mystery_gift_client.c b/src/mystery_gift_client.c index 762b7f02d2..62ab85b43d 100644 --- a/src/mystery_gift_client.c +++ b/src/mystery_gift_client.c @@ -232,10 +232,10 @@ static u32 Client_Run(struct MysteryGiftClient * client) InitRamScript_NoObjectEvent(client->recvBuffer, sizeof(struct RamScriptData)); break; case CLI_RECV_EREADER_TRAINER: - #ifndef FREE_BATTLE_TOWER_E_READER + #if FREE_BATTLE_TOWER_E_READER == FALSE memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, client->recvBuffer, sizeof(gSaveBlock2Ptr->frontier.ereaderTrainer)); ValidateEReaderTrainer(); - #endif + #endif //FREE_BATTLE_TOWER_E_READER break; case CLI_RUN_BUFFER_SCRIPT: memcpy(gDecompressionBuffer, client->recvBuffer, MG_LINK_BUFFER_SIZE); diff --git a/src/pokemon.c b/src/pokemon.c index 1e606b5164..3a5152d43e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -3995,11 +3995,11 @@ u8 *UseStatIncreaseItem(u16 itemId) if (gMain.inBattle) itemEffect = gEnigmaBerries[gBattlerInMenuId].itemEffect; else - #ifndef FREE_ENIGMA_BERRY + #if FREE_ENIGMA_BERRY == FALSE itemEffect = gSaveBlock1Ptr->enigmaBerry.itemEffect; - #else + #else itemEffect = 0; - #endif + #endif //FREE_ENIGMA_BERRY } else { @@ -4104,11 +4104,11 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s } if (heldItem == ITEM_ENIGMA_BERRY_E_READER) - #ifndef FREE_ENIGMA_BERRY + #if FREE_ENIGMA_BERRY == FALSE holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; - #else + #else holdEffect = 0; - #endif + #endif //FREE_ENIGMA_BERRY else holdEffect = ItemId_GetHoldEffect(heldItem); @@ -4786,11 +4786,11 @@ void AdjustFriendship(struct Pokemon *mon, u8 event) if (gMain.inBattle) holdEffect = gEnigmaBerries[0].holdEffect; else - #ifndef FREE_ENIGMA_BERRY + #if FREE_ENIGMA_BERRY == FALSE holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; - #else + #else holdEffect = 0; - #endif + #endif //FREE_ENIGMA_BERRY } else { diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index 8c745b9f1f..534b907496 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -4334,14 +4334,14 @@ static bool32 RecvPacket_MemberStateToMember(struct PokemonJump_Player *player, static struct PokemonJumpRecords *GetPokeJumpRecords(void) { - #ifndef FREE_POKEMON_JUMP +#if FREE_POKEMON_JUMP == FALSE return &gSaveBlock2Ptr->pokeJump; - #endif +#endif //FREE_POKEMON_JUMP } void ResetPokemonJumpRecords(void) { - #ifndef FREE_POKEMON_JUMP +#if FREE_POKEMON_JUMP == FALSE struct PokemonJumpRecords *records = GetPokeJumpRecords(); records->jumpsInRow = 0; records->bestJumpScore = 0; @@ -4349,12 +4349,12 @@ void ResetPokemonJumpRecords(void) records->gamesWithMaxPlayers = 0; records->unused2 = 0; records->unused1 = 0; - #endif +#endif //FREE_POKEMON_JUMP } static bool32 TryUpdateRecords(u32 jumpScore, u16 jumpsInRow, u16 excellentsInRow) { - #ifndef FREE_POKEMON_JUMP +#if FREE_POKEMON_JUMP == FALSE struct PokemonJumpRecords *records = GetPokeJumpRecords(); bool32 newRecord = FALSE; @@ -4366,18 +4366,18 @@ static bool32 TryUpdateRecords(u32 jumpScore, u16 jumpsInRow, u16 excellentsInRo records->excellentsInRow = excellentsInRow, newRecord = TRUE; return newRecord; - #else +#else return FALSE; - #endif +#endif //FREE_POKEMON_JUMP } static void IncrementGamesWithMaxPlayers(void) { - #ifndef FREE_POKEMON_JUMP +#if FREE_POKEMON_JUMP == FALSE struct PokemonJumpRecords *records = GetPokeJumpRecords(); if (records->gamesWithMaxPlayers < 9999) records->gamesWithMaxPlayers++; - #endif +#endif //FREE_POKEMON_JUMP } void ShowPokemonJumpRecords(void) @@ -4457,7 +4457,7 @@ static void Task_ShowPokemonJumpRecords(u8 taskId) static void PrintRecordsText(u16 windowId, int width) { - #ifndef FREE_POKEMON_JUMP +#if FREE_POKEMON_JUMP == FALSE int i, x; int recordNums[3]; struct PokemonJumpRecords *records = GetPokeJumpRecords(); @@ -4478,7 +4478,7 @@ static void PrintRecordsText(u16 windowId, int width) AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar1, x, 25 + (i * 16), TEXT_SKIP_DRAW, NULL); } PutWindowTilemap(windowId); - #endif +#endif //FREE_POKEMON_JUMP } static void TruncateToFirstWordOnly(u8 *str) diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index 8f2a465fd7..8494446fd2 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -842,22 +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 FREE_MATCH_CALL == FALSE if (matchCall.trainer->rematchTableIdx >= REMATCH_ELITE_FOUR_ENTRIES) return FALSE; return gSaveBlock1Ptr->trainerRematches[matchCall.trainer->rematchTableIdx] ? TRUE : FALSE; - #else +#else return FALSE; - #endif +#endif //FREE_MATCH_CALL } static bool32 MatchCall_IsRematchable_Wally(match_call_t matchCall) { - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE return gSaveBlock1Ptr->trainerRematches[matchCall.wally->rematchTableIdx] ? TRUE : FALSE; - #else +#else return FALSE; - #endif +#endif //FREE_MATCH_CALL } static bool32 MatchCall_IsRematchable_Rival(match_call_t matchCall) @@ -1012,7 +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 +#if FREE_MATCH_CALL == FALSE u32 i; for (i = 0; textData[i].text != NULL; i++) { @@ -1046,7 +1046,7 @@ static void MatchCall_BufferCallMessageTextByRematchTeam(const match_call_text_d StringExpandPlaceholders(dest, textData[i].text); } - #endif +#endif //FREE_MATCH_CALL } void MatchCall_GetNameAndDesc(u32 idx, const u8 **desc, const u8 **name) diff --git a/src/pokenav_match_call_list.c b/src/pokenav_match_call_list.c index b75077a339..37f3352148 100755 --- a/src/pokenav_match_call_list.c +++ b/src/pokenav_match_call_list.c @@ -314,7 +314,7 @@ u16 GetMatchCallMapSec(int index) bool32 ShouldDrawRematchPokeballIcon(int index) { - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE struct Pokenav_MatchCallMenu *state = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_MAIN); if (!state->matchCallEntries[index].isSpecialTrainer) index = state->matchCallEntries[index].headerId; @@ -325,9 +325,9 @@ bool32 ShouldDrawRematchPokeballIcon(int index) return FALSE; return gSaveBlock1Ptr->trainerRematches[index] != 0; - #else +#else return FALSE; - #endif +#endif //FREE_MATCH_CALL } int GetMatchCallTrainerPic(int index) @@ -471,7 +471,7 @@ int GetIndexDeltaOfNextCheckPageUp(int index) static bool32 UNUSED HasRematchEntry(void) { - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE int i; for (i = 0; i < REMATCH_TABLE_ENTRIES; i++) @@ -489,13 +489,13 @@ static bool32 UNUSED HasRematchEntry(void) return TRUE; } } - #endif +#endif //FREE_MATCH_CALL return FALSE; } static bool32 ShouldDoNearbyMessage(void) { - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE struct Pokenav_MatchCallMenu *state = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_MAIN); int selection = PokenavList_GetSelectedIndex(); if (!state->matchCallEntries[selection].isSpecialTrainer) @@ -518,6 +518,6 @@ static bool32 ShouldDoNearbyMessage(void) } } } - #endif +#endif //FREE_MATCH_CALL return FALSE; } diff --git a/src/pokenav_menu_handler_gfx.c b/src/pokenav_menu_handler_gfx.c index c0ecfcfac5..282ccfcb5a 100644 --- a/src/pokenav_menu_handler_gfx.c +++ b/src/pokenav_menu_handler_gfx.c @@ -367,7 +367,7 @@ static bool32 AreAnyTrainerRematchesNearby(void) { s32 i; - #ifndef FREE_MATCH_CALL +#if FREE_MATCH_CALL == FALSE for (i = 0; i < REMATCH_TABLE_ENTRIES; i++) { if (GetMatchTableMapSectionId(i) == gMapHeader.regionMapSectionId @@ -375,7 +375,7 @@ static bool32 AreAnyTrainerRematchesNearby(void) && gSaveBlock1Ptr->trainerRematches[i]) return TRUE; } - #endif +#endif //FREE_MATCH_CALL return FALSE; } diff --git a/src/record_mixing.c b/src/record_mixing.c index a8b5b05b60..dc02cf7a48 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -1200,7 +1200,7 @@ static void ReceiveApprenticeData(struct Apprentice *records, size_t recordSize, static void GetNewHallRecords(struct RecordMixingHallRecords *dst, void *records, size_t recordSize, u32 multiplayerId, s32 linkPlayerCount) { - #ifndef FREE_RECORD_MIXING_HALL_RECORDS +#if FREE_RECORD_MIXING_HALL_RECORDS == FALSE s32 i, j, k, l; s32 repeatTrainers; @@ -1276,7 +1276,7 @@ static void GetNewHallRecords(struct RecordMixingHallRecords *dst, void *records dst->hallRecords2P[j][k + HALL_RECORDS_COUNT] = sPartnerHallRecords[k]->twoPlayers[j]; } } - #endif +#endif //FREE_RECORD_MIXING_HALL_RECORDS } static void FillWinStreakRecords1P(struct RankingHall1P *playerRecords, struct RankingHall1P *mixRecords) @@ -1337,7 +1337,7 @@ static void FillWinStreakRecords2P(struct RankingHall2P *playerRecords, struct R static void SaveHighestWinStreakRecords(struct RecordMixingHallRecords *mixHallRecords) { - #ifndef FREE_RECORD_MIXING_HALL_RECORDS +#if FREE_RECORD_MIXING_HALL_RECORDS == FALSE s32 i, j; for (i = 0; i < HALL_FACILITIES_COUNT; i++) @@ -1348,12 +1348,12 @@ static void SaveHighestWinStreakRecords(struct RecordMixingHallRecords *mixHallR for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++) FillWinStreakRecords2P(gSaveBlock2Ptr->hallRecords2P[j], mixHallRecords->hallRecords2P[j]); - #endif +#endif //FREE_RECORD_MIXING_HALL_RECORDS } static void ReceiveRankingHallRecords(struct PlayerHallRecords *records, size_t recordSize, u32 multiplayerId) { - #ifndef FREE_RECORD_MIXING_HALL_RECORDS +#if FREE_RECORD_MIXING_HALL_RECORDS == FALSE u8 linkPlayerCount = GetLinkPlayerCount(); struct RecordMixingHallRecords *mixHallRecords = AllocZeroed(sizeof(*mixHallRecords)); @@ -1361,7 +1361,7 @@ static void ReceiveRankingHallRecords(struct PlayerHallRecords *records, size_t SaveHighestWinStreakRecords(mixHallRecords); Free(mixHallRecords); - #endif +#endif //FREE_RECORD_MIXING_HALL_RECORDS } static void GetRecordMixingDaycareMail(struct RecordMixingDaycareMail *dst) diff --git a/src/rom_header_gf.c b/src/rom_header_gf.c index 5f3d79c474..102b009829 100644 --- a/src/rom_header_gf.c +++ b/src/rom_header_gf.c @@ -33,9 +33,9 @@ struct GFRomHeader u32 flagsOffset; u32 varsOffset; u32 pokedexOffset; - #ifndef FREE_EXTRA_SEEN_FLAGS +#if FREE_EXTRA_SEEN_FLAGS == FALSE u32 seen1Offset; - #endif +#endif //FREE_EXTRA_SEEN_FLAGS u32 seen2Offset; u32 pokedexVar; u32 pokedexFlag; @@ -89,10 +89,10 @@ struct GFRomHeader u8 pcItemsCount; u32 pcItemsOffset; u32 giftRibbonsOffset; - #ifndef FREE_ENIGMA_BERRY +#if FREE_ENIGMA_BERRY == FALSE u32 enigmaBerryOffset; u32 enigmaBerrySize; - #endif +#endif //FREE_ENIGMA_BERRY const u8 *moveDescriptions; u32 unk20; }; @@ -172,10 +172,10 @@ static const struct GFRomHeader sGFRomHeader = { .pcItemsCount = PC_ITEMS_COUNT, .pcItemsOffset = offsetof(struct SaveBlock1, pcItems), .giftRibbonsOffset = offsetof(struct SaveBlock1, giftRibbons), - #ifndef FREE_ENIGMA_BERRY +#if FREE_ENIGMA_BERRY == FALSE .enigmaBerryOffset = offsetof(struct SaveBlock1, enigmaBerry), .enigmaBerrySize = sizeof(struct EnigmaBerry), - #endif +#endif //FREE_ENIGMA_BERRY .moveDescriptions = NULL, .unk20 = 0x00000000, // 0xFFFFFFFF in FRLG }; diff --git a/src/script.c b/src/script.c index 93957f3be0..718592691b 100644 --- a/src/script.c +++ b/src/script.c @@ -379,23 +379,23 @@ void TryRunOnWarpIntoMapScript(void) u32 CalculateRamScriptChecksum(void) { - #ifndef FREE_MYSTERY_EVENT_BUFFERS +#if FREE_MYSTERY_EVENT_BUFFERS == FALSE return CalcCRC16WithTable((u8 *)(&gSaveBlock1Ptr->ramScript.data), sizeof(gSaveBlock1Ptr->ramScript.data)); - #else +#else return 0; - #endif +#endif //FREE_MYSTERY_EVENT_BUFFERS } void ClearRamScript(void) { - #ifndef FREE_MYSTERY_EVENT_BUFFERS +#if FREE_MYSTERY_EVENT_BUFFERS == FALSE CpuFill32(0, &gSaveBlock1Ptr->ramScript, sizeof(struct RamScript)); - #endif +#endif //FREE_MYSTERY_EVENT_BUFFERS } bool8 InitRamScript(const u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId) { - #ifndef FREE_MYSTERY_EVENT_BUFFERS +#if FREE_MYSTERY_EVENT_BUFFERS == FALSE struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; ClearRamScript(); @@ -410,14 +410,14 @@ bool8 InitRamScript(const u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 memcpy(scriptData->script, script, scriptSize); gSaveBlock1Ptr->ramScript.checksum = CalculateRamScriptChecksum(); return TRUE; - #else +#else return FALSE; - #endif +#endif //FREE_MYSTERY_EVENT_BUFFERS } const u8 *GetRamScript(u8 objectId, const u8 *script) { - #ifndef FREE_MYSTERY_EVENT_BUFFERS +#if FREE_MYSTERY_EVENT_BUFFERS == FALSE struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; gRamScriptRetAddr = NULL; if (scriptData->magic != RAM_SCRIPT_MAGIC) @@ -438,16 +438,16 @@ const u8 *GetRamScript(u8 objectId, const u8 *script) gRamScriptRetAddr = script; return scriptData->script; } - #else +#else return script; - #endif +#endif //FREE_MYSTERY_EVENT_BUFFERS } #define NO_OBJECT OBJ_EVENT_ID_PLAYER bool32 ValidateSavedRamScript(void) { - #ifndef FREE_MYSTERY_EVENT_BUFFERS +#if FREE_MYSTERY_EVENT_BUFFERS == FALSE struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; if (scriptData->magic != RAM_SCRIPT_MAGIC) return FALSE; @@ -460,14 +460,14 @@ bool32 ValidateSavedRamScript(void) if (CalculateRamScriptChecksum() != gSaveBlock1Ptr->ramScript.checksum) return FALSE; return TRUE; - #else +#else return FALSE; - #endif +#endif //FREE_MYSTERY_EVENT_BUFFERS } u8 *GetSavedRamScriptIfValid(void) { - #ifndef FREE_MYSTERY_EVENT_BUFFERS +#if FREE_MYSTERY_EVENT_BUFFERS == FALSE struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; if (!ValidateSavedWonderCard()) return NULL; @@ -488,16 +488,16 @@ u8 *GetSavedRamScriptIfValid(void) { return scriptData->script; } - #else +#else return NULL; - #endif +#endif //FREE_MYSTERY_EVENT_BUFFERS } void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize) { - #ifndef FREE_MYSTERY_EVENT_BUFFERS +#if FREE_MYSTERY_EVENT_BUFFERS == FALSE if (scriptSize > sizeof(gSaveBlock1Ptr->ramScript.data.script)) scriptSize = sizeof(gSaveBlock1Ptr->ramScript.data.script); InitRamScript(script, scriptSize, MAP_GROUP(UNDEFINED), MAP_NUM(UNDEFINED), NO_OBJECT); - #endif +#endif //FREE_MYSTERY_EVENT_BUFFERS } diff --git a/src/trainer_hill.c b/src/trainer_hill.c index 73d4419ce5..53c4172bc2 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -283,11 +283,11 @@ void ResetTrainerHillResults(void) gSaveBlock2Ptr->frontier.savedGame = 0; gSaveBlock2Ptr->frontier.unk_EF9 = 0; - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE gSaveBlock1Ptr->trainerHill.bestTime = 0; for (i = 0; i < NUM_TRAINER_HILL_MODES; i++) SetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i], HILL_MAX_TIME); - #endif +#endif //FREE_TRAINER_HILL } static u8 GetFloorId(void) @@ -337,9 +337,9 @@ void InitTrainerHillBattleStruct(void) sFloorTrainers->facilityClass[i] = sHillData->floors[sHillData->floorId].trainers[i].facilityClass; } - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer); - #endif +#endif //FREE_TRAINER_HILL FreeDataStruct(); } @@ -350,7 +350,7 @@ void FreeTrainerHillBattleStruct(void) static void SetUpDataStruct(void) { - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE if (sHillData == NULL) { sHillData = AllocZeroed(sizeof(*sHillData)); @@ -364,7 +364,7 @@ static void SetUpDataStruct(void) CpuCopy32(sChallengeData[gSaveBlock1Ptr->trainerHill.mode], &sHillData->challenge, sizeof(sHillData->challenge) + sizeof(sHillData->floors)); TrainerHillDummy(); } - #endif +#endif //FREE_TRAINER_HILL } static void FreeDataStruct(void) @@ -402,7 +402,7 @@ void CopyTrainerHillTrainerText(u8 which, u16 trainerId) static void TrainerHillStartChallenge(void) { TrainerHillDummy(); - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE if (!ReadTrainerHillAndValidate()) gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 1; else @@ -417,12 +417,12 @@ static void TrainerHillStartChallenge(void) gSaveBlock2Ptr->frontier.trainerFlags = 0; gBattleOutcome = 0; gSaveBlock1Ptr->trainerHill.receivedPrize = 0; - #endif +#endif //FREE_TRAINER_HILL } static void GetOwnerState(void) { - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE ClearTrainerHillVBlankCounter(); gSpecialVar_Result = 0; if (gSaveBlock1Ptr->trainerHill.spokeToOwner) @@ -431,12 +431,12 @@ static void GetOwnerState(void) gSpecialVar_Result++; gSaveBlock1Ptr->trainerHill.spokeToOwner = TRUE; - #endif +#endif //FREE_TRAINER_HILL } static void GiveChallengePrize(void) { - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE u16 itemId = GetPrizeItemId(); if (sHillData->challenge.numFloors != NUM_TRAINER_HILL_FLOORS || gSaveBlock1Ptr->trainerHill.receivedPrize) @@ -454,14 +454,14 @@ static void GiveChallengePrize(void) { gSpecialVar_Result = 1; } - #endif +#endif //FREE_TRAINER_HILL } // 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 FREE_TRAINER_HILL == FALSE if (gSaveBlock1Ptr->trainerHill.checkedFinalTime) { gSpecialVar_Result = 2; @@ -478,12 +478,12 @@ static void CheckFinalTime(void) } gSaveBlock1Ptr->trainerHill.checkedFinalTime = TRUE; - #endif +#endif //FREE_TRAINER_HILL } static void TrainerHillResumeTimer(void) { - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE if (!gSaveBlock1Ptr->trainerHill.spokeToOwner) { if (gSaveBlock1Ptr->trainerHill.timer >= HILL_MAX_TIME) @@ -491,19 +491,19 @@ static void TrainerHillResumeTimer(void) else SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer); } - #endif +#endif //FREE_TRAINER_HILL } static void TrainerHillSetPlayerLost(void) { - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE gSaveBlock1Ptr->trainerHill.hasLost = TRUE; - #endif +#endif //FREE_TRAINER_HILL } static void TrainerHillGetChallengeStatus(void) { - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE if (gSaveBlock1Ptr->trainerHill.hasLost) { // The player lost their last match. @@ -521,13 +521,13 @@ static void TrainerHillGetChallengeStatus(void) // Continue playing. gSpecialVar_Result = TRAINER_HILL_PLAYER_STATUS_NORMAL; } - #endif +#endif //FREE_TRAINER_HILL } static void BufferChallengeTime(void) { s32 total, minutes, secondsWhole, secondsFraction; - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE total = gSaveBlock1Ptr->trainerHill.timer; if (total >= HILL_MAX_TIME) total = HILL_MAX_TIME; @@ -541,7 +541,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 +#endif //FREE_TRAINER_HILL } // Returns TRUE if all 4 floors are used @@ -574,7 +574,7 @@ static void GetInEReaderMode(void) bool8 InTrainerHillChallenge(void) { - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE if (VarGet(VAR_TRAINER_HILL_IS_ACTIVE) == 0) return FALSE; else if (gSaveBlock1Ptr->trainerHill.spokeToOwner) @@ -583,7 +583,7 @@ bool8 InTrainerHillChallenge(void) return TRUE; else return FALSE; - #endif +#endif //FREE_TRAINER_HILL } static void IsTrainerHillChallengeActive(void) @@ -608,7 +608,7 @@ void PrintOnTrainerHillRecordsWindow(void) { s32 i, x, y; u32 total, minutes, secondsWhole, secondsFraction; - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE SetUpDataStruct(); FillWindowPixelBuffer(0, PIXEL_FILL(0)); x = GetStringCenterAlignXOffset(FONT_NORMAL, gText_TimeBoard, 0xD0); @@ -637,7 +637,7 @@ void PrintOnTrainerHillRecordsWindow(void) PutWindowTilemap(0); CopyWindowToVram(0, COPYWIN_FULL); FreeDataStruct(); - #endif +#endif //FREE_TRAINER_HILL } // Leftover from Fire Red / Leaf Green as in these games, @@ -1008,20 +1008,20 @@ bool32 OnTrainerHillEReaderChallengeFloor(void) static void GetChallengeWon(void) { - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE if (gSaveBlock1Ptr->trainerHill.hasLost) gSpecialVar_Result = FALSE; else gSpecialVar_Result = TRUE; - #endif +#endif //FREE_TRAINER_HILL } static void TrainerHillSetMode(void) { - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE gSaveBlock1Ptr->trainerHill.mode = gSpecialVar_0x8005; gSaveBlock1Ptr->trainerHill.bestTime = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005]; - #endif +#endif //FREE_TRAINER_HILL } // Determines which prize list to use from the set of prize lists. @@ -1079,7 +1079,7 @@ static u16 GetPrizeItemId(void) else i = GetPrizeListId(FALSE); - #ifndef FREE_TRAINER_HILL +#if FREE_TRAINER_HILL == FALSE // 1 is added to Expert mode's prize list selection because otherwise it has the same prizes as Variety if (gSaveBlock1Ptr->trainerHill.mode == HILL_MODE_EXPERT) i = (i + 1) % NUM_TRAINER_HILL_PRIZE_LISTS; @@ -1114,7 +1114,7 @@ static u16 GetPrizeItemId(void) id = 4; // ITEM_FLUFFY_TAIL else id = 5; // ITEM_GREAT_BALL - #endif +#endif //FREE_TRAINER_HILL return prizeList[id]; } diff --git a/src/tv.c b/src/tv.c index 59e2026206..215af04dce 100644 --- a/src/tv.c +++ b/src/tv.c @@ -1334,17 +1334,15 @@ void PutFanClubSpecialOnTheAir(void) StringCopy(show->fanClubSpecial.idolName, name); StorePlayerIdInNormalShow(show); show->fanClubSpecial.language = gGameLanguage; - #ifndef FREE_LINK_BATTLE_RECORDS +#if FREE_LINK_BATTLE_RECORDS == FALSE if (show->fanClubSpecial.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->linkBattleRecords.languages[0] == LANGUAGE_JAPANESE) show->fanClubSpecial.idolNameLanguage = LANGUAGE_JAPANESE; else show->fanClubSpecial.idolNameLanguage = gSaveBlock1Ptr->linkBattleRecords.languages[0]; - #else +#else if (show->fanClubSpecial.language == LANGUAGE_JAPANESE) - { show->fanClubSpecial.idolNameLanguage = LANGUAGE_JAPANESE; - } - #endif +#endif //FREE_LINK_BATTLE_RECORDS } void ContestLiveUpdates_Init(u8 round1Placing) @@ -2319,10 +2317,10 @@ bool8 ShouldHideFanClubInterviewer(void) if (gSpecialVar_Result == TRUE) return TRUE; - #ifndef FREE_LINK_BATTLE_RECORDS +#if FREE_LINK_BATTLE_RECORDS == FALSE if (gSaveBlock1Ptr->linkBattleRecords.entries[0].name[0] == EOS) return TRUE; - #endif +#endif //FREE_LINK_BATTLE_RECORDS return FALSE; } diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 10b93d9a15..fce3790af5 100644 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -929,10 +929,10 @@ static void InitUnionRoomChat(struct UnionRoomChat *chat) chat->exitType = CHAT_EXIT_NONE; chat->changedRegisteredTexts = FALSE; PrepareSendBuffer_Null(chat->sendMessageBuffer); - #ifndef FREE_UNION_ROOM_CHAT +#if FREE_UNION_ROOM_CHAT == FALSE for (i = 0; i < UNION_ROOM_KB_ROW_COUNT; i++) StringCopy(chat->registeredTexts[i], gSaveBlock1Ptr->registeredTexts[i]); - #endif +#endif //FREE_UNION_ROOM_CHAT } static void FreeUnionRoomChat(void) @@ -1766,11 +1766,11 @@ static void ResetMessageEntryBuffer(void) static void SaveRegisteredTexts(void) { - #ifndef FREE_UNION_ROOM_CHAT +#if FREE_UNION_ROOM_CHAT == FALSE int i; for (i = 0; i < UNION_ROOM_KB_ROW_COUNT; i++) StringCopy(gSaveBlock1Ptr->registeredTexts[i], sChat->registeredTexts[i]); - #endif +#endif //FREE_UNION_ROOM_CHAT } static u8 *GetRegisteredTextByRow(int row) @@ -2014,7 +2014,7 @@ static u8 *GetChatHostName(void) void InitUnionRoomChatRegisteredTexts(void) { - #ifndef FREE_UNION_ROOM_CHAT +#if FREE_UNION_ROOM_CHAT == FALSE StringCopy(gSaveBlock1Ptr->registeredTexts[0], gText_Hello); StringCopy(gSaveBlock1Ptr->registeredTexts[1], gText_Pokemon2); StringCopy(gSaveBlock1Ptr->registeredTexts[2], gText_Trade); @@ -2025,7 +2025,7 @@ void InitUnionRoomChatRegisteredTexts(void) StringCopy(gSaveBlock1Ptr->registeredTexts[7], gText_YaySmileEmoji); StringCopy(gSaveBlock1Ptr->registeredTexts[8], gText_ThankYou); StringCopy(gSaveBlock1Ptr->registeredTexts[9], gText_ByeBye); - #endif +#endif //FREE_UNION_ROOM_CHAT } #define tState data[0]