mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Additional constant usage
This commit is contained in:
parent
7143865f6f
commit
dec54e6e92
@ -22,18 +22,20 @@ BattleFrontier_Lounge2_EventScript_AlreadyMetManiac::
|
||||
end
|
||||
|
||||
BattleFrontier_Lounge2_EventScript_GiveAdvice::
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 0, BattleFrontier_Lounge2_EventScript_BufferSingle
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 1, BattleFrontier_Lounge2_EventScript_BufferDouble
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 2, BattleFrontier_Lounge2_EventScript_BufferMulti
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 3, BattleFrontier_Lounge2_EventScript_BufferMultiLink
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 4, BattleFrontier_Lounge2_EventScript_BufferBattleDome
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 5, BattleFrontier_Lounge2_EventScript_BufferBattleFactory
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 6, BattleFrontier_Lounge2_EventScript_BufferBattlePalace
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 7, BattleFrontier_Lounge2_EventScript_BufferBattleArena
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 8, BattleFrontier_Lounge2_EventScript_BufferBattlePike
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 9, BattleFrontier_Lounge2_EventScript_BufferBattlePyramid
|
||||
call_if_le VAR_FRONTIER_MANIAC_FACILITY, 3, BattleFrontier_Lounge2_EventScript_BattleTowerNews
|
||||
call_if_ge VAR_FRONTIER_MANIAC_FACILITY, 4, BattleFrontier_Lounge2_EventScript_FacilityNews
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_TOWER_SINGLES, BattleFrontier_Lounge2_EventScript_BufferSingle
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_TOWER_DOUBLES, BattleFrontier_Lounge2_EventScript_BufferDouble
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_TOWER_MULTIS, BattleFrontier_Lounge2_EventScript_BufferMulti
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_TOWER_LINK, BattleFrontier_Lounge2_EventScript_BufferMultiLink
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_DOME, BattleFrontier_Lounge2_EventScript_BufferBattleDome
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_FACTORY, BattleFrontier_Lounge2_EventScript_BufferBattleFactory
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_PALACE, BattleFrontier_Lounge2_EventScript_BufferBattlePalace
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_ARENA, BattleFrontier_Lounge2_EventScript_BufferBattleArena
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_PIKE, BattleFrontier_Lounge2_EventScript_BufferBattlePike
|
||||
call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_PYRAMID, BattleFrontier_Lounge2_EventScript_BufferBattlePyramid
|
||||
@ <= FRONTIER_MANIAC_TOWER_LINK is any Battle Tower mode
|
||||
call_if_le VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_TOWER_LINK, BattleFrontier_Lounge2_EventScript_BattleTowerNews
|
||||
@ >= FRONTIER_MANIAC_DOME is any facility other than Battle Tower
|
||||
call_if_ge VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_DOME, BattleFrontier_Lounge2_EventScript_FacilityNews
|
||||
special ShowFrontierManiacMessage
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
|
@ -1158,11 +1158,11 @@ u8 GetBattlePikeWildMonHeaderId(void)
|
||||
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
u16 winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode];
|
||||
|
||||
if (winStreak <= 280)
|
||||
if (winStreak <= 20 * NUM_PIKE_ROOMS)
|
||||
headerId = 0;
|
||||
else if (winStreak <= 560)
|
||||
else if (winStreak <= 40 * NUM_PIKE_ROOMS)
|
||||
headerId = 1;
|
||||
else if (winStreak <= 840)
|
||||
else if (winStreak <= 60 * NUM_PIKE_ROOMS)
|
||||
headerId = 2;
|
||||
else
|
||||
headerId = 3;
|
||||
@ -1392,7 +1392,7 @@ static void PrepareOneTrainer(bool8 difficult)
|
||||
if (!difficult)
|
||||
battleNum = 1;
|
||||
else
|
||||
battleNum = 6;
|
||||
battleNum = FRONTIER_STAGES_PER_CHALLENGE - 1;
|
||||
|
||||
lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / NUM_PIKE_ROOMS;
|
||||
|
@ -1327,19 +1327,19 @@ void PutNewBattleTowerRecord(struct EmeraldBattleTowerRecord *newRecordEm)
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[i].trainerId[j] != newRecord->trainerId[j])
|
||||
break;
|
||||
}
|
||||
if (j == 4)
|
||||
if (j == TRAINER_ID_LENGTH)
|
||||
{
|
||||
for (k = 0; k < PLAYER_NAME_LENGTH; k++)
|
||||
{
|
||||
#ifdef BUGFIX
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[i].name[k] != newRecord->name[k])
|
||||
// Incorrect index being used
|
||||
#ifdef BUGFIX
|
||||
#define INDEX k
|
||||
#else
|
||||
#define INDEX j
|
||||
#endif
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[i].name[INDEX] != newRecord->name[INDEX])
|
||||
break;
|
||||
if (newRecord->name[k] == EOS)
|
||||
#else
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[i].name[j] != newRecord->name[j])
|
||||
break;
|
||||
if (newRecord->name[j] == EOS)
|
||||
#endif
|
||||
if (newRecord->name[INDEX] == EOS)
|
||||
{
|
||||
k = PLAYER_NAME_LENGTH;
|
||||
break;
|
||||
@ -1635,7 +1635,7 @@ static void FillTentTrainerParty(u8 monsCount)
|
||||
static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
{
|
||||
s32 i, j;
|
||||
u16 chosenMonIndices[4];
|
||||
u16 chosenMonIndices[MAX_FRONTIER_PARTY_SIZE];
|
||||
u8 friendship = MAX_FRIENDSHIP;
|
||||
u8 level = SetFacilityPtrsGetLevel();
|
||||
u8 fixedIV = 0;
|
||||
@ -1651,7 +1651,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
}
|
||||
else if (trainerId == TRAINER_EREADER)
|
||||
{
|
||||
for (i = firstMonId; i < firstMonId + 3; i++)
|
||||
for (i = firstMonId; i < firstMonId + FRONTIER_PARTY_SIZE; i++)
|
||||
CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]);
|
||||
return;
|
||||
}
|
||||
@ -1676,7 +1676,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
else
|
||||
{
|
||||
// Apprentice.
|
||||
for (i = firstMonId; i < firstMonId + 3; i++)
|
||||
for (i = firstMonId; i < firstMonId + FRONTIER_PARTY_SIZE; i++)
|
||||
CreateApprenticeMon(&gEnemyParty[i], &gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE], i - firstMonId);
|
||||
return;
|
||||
}
|
||||
@ -1775,7 +1775,7 @@ static void Unused_CreateApprenticeMons(u16 trainerId, u8 firstMonId)
|
||||
else
|
||||
level = FRONTIER_MAX_LEVEL_50;
|
||||
|
||||
for (i = 0; i != 3; i++)
|
||||
for (i = 0; i != FRONTIER_PARTY_SIZE; i++)
|
||||
{
|
||||
CreateMonWithEVSpread(&gEnemyParty[firstMonId + i], apprentice->party[i].species, level, fixedIV, 8);
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
@ -1848,7 +1848,7 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId)
|
||||
}
|
||||
else if (trainerId == TRAINER_EREADER)
|
||||
{
|
||||
for (i = firstMonId; i < firstMonId + 3; i++)
|
||||
for (i = firstMonId; i < firstMonId + FRONTIER_PARTY_SIZE; i++)
|
||||
CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]);
|
||||
return;
|
||||
}
|
||||
@ -2743,8 +2743,8 @@ u16 GetCurrentBattleTowerWinStreak(u8 lvlMode, u8 battleMode)
|
||||
{
|
||||
u16 winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode];
|
||||
|
||||
if (winStreak > 9999)
|
||||
return 9999;
|
||||
if (winStreak > MAX_STREAK)
|
||||
return MAX_STREAK;
|
||||
else
|
||||
return winStreak;
|
||||
}
|
||||
|
@ -595,13 +595,13 @@ static const u8 sBattlePointAwards[][NUM_FRONTIER_FACILITIES][FRONTIER_MODE_COUN
|
||||
// First bit is has battled them before and not won yet, second bit is has battled them and won (obtained a Symbol)
|
||||
static const u16 sBattledBrainBitFlags[NUM_FRONTIER_FACILITIES][2] =
|
||||
{
|
||||
[FRONTIER_FACILITY_TOWER] = {0x0001, 0x0002},
|
||||
[FRONTIER_FACILITY_DOME] = {0x0004, 0x0008},
|
||||
[FRONTIER_FACILITY_PALACE] = {0x0010, 0x0020},
|
||||
[FRONTIER_FACILITY_ARENA] = {0x0040, 0x0080},
|
||||
[FRONTIER_FACILITY_FACTORY] = {0x0100, 0x0200},
|
||||
[FRONTIER_FACILITY_PIKE] = {0x0400, 0x0800},
|
||||
[FRONTIER_FACILITY_PYRAMID] = {0x1000, 0x2000},
|
||||
[FRONTIER_FACILITY_TOWER] = {1 << 0, 1 << 1},
|
||||
[FRONTIER_FACILITY_DOME] = {1 << 2, 1 << 3},
|
||||
[FRONTIER_FACILITY_PALACE] = {1 << 4, 1 << 5},
|
||||
[FRONTIER_FACILITY_ARENA] = {1 << 6, 1 << 7},
|
||||
[FRONTIER_FACILITY_FACTORY] = {1 << 8, 1 << 9},
|
||||
[FRONTIER_FACILITY_PIKE] = {1 << 10, 1 << 11},
|
||||
[FRONTIER_FACILITY_PYRAMID] = {1 << 12, 1 << 13},
|
||||
};
|
||||
|
||||
static void (* const sFrontierUtilFuncs[])(void) =
|
||||
@ -636,8 +636,8 @@ static const struct WindowTemplate sFrontierResultsWindowTemplate =
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 1,
|
||||
.width = 0x1c,
|
||||
.height = 0x12,
|
||||
.width = 28,
|
||||
.height = 18,
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 1
|
||||
};
|
||||
@ -647,7 +647,7 @@ static const struct WindowTemplate sLinkContestResultsWindowTemplate =
|
||||
.bg = 0,
|
||||
.tilemapLeft = 2,
|
||||
.tilemapTop = 2,
|
||||
.width = 0x1a,
|
||||
.width = 26,
|
||||
.height = 15,
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 1
|
||||
@ -658,7 +658,7 @@ static const struct WindowTemplate sRankingHallRecordsWindowTemplate =
|
||||
.bg = 0,
|
||||
.tilemapLeft = 2,
|
||||
.tilemapTop = 1,
|
||||
.width = 0x1a,
|
||||
.width = 26,
|
||||
.height = 17,
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 1
|
||||
@ -959,7 +959,7 @@ static bool8 IsWinStreakActive(u32 challenge)
|
||||
|
||||
static void PrintAligned(const u8 *str, s32 y)
|
||||
{
|
||||
s32 x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 224);
|
||||
s32 x = GetStringCenterAlignXOffset(FONT_NORMAL, str, DISPLAY_WIDTH - 16);
|
||||
y = (y * 8) + 1;
|
||||
AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x, y, TEXT_SKIP_DRAW, NULL);
|
||||
}
|
||||
@ -2345,7 +2345,7 @@ static void PrintHallRecords(s32 hallFacilityId, s32 lvlMode)
|
||||
StringCopy(gStringVar1, sRecordsWindowChallengeTexts[hallFacilityId][0]);
|
||||
StringExpandPlaceholders(gStringVar4, sRecordsWindowChallengeTexts[hallFacilityId][1]);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, 0, 1, TEXT_SKIP_DRAW, NULL);
|
||||
x = GetStringRightAlignXOffset(FONT_NORMAL, sLevelModeText[lvlMode], 0xD0);
|
||||
x = GetStringRightAlignXOffset(FONT_NORMAL, sLevelModeText[lvlMode], DISPLAY_WIDTH - 32);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, sLevelModeText[lvlMode], x, 1, TEXT_SKIP_DRAW, NULL);
|
||||
if (hallFacilityId == RANKING_HALL_TOWER_LINK)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user