up to factory

This commit is contained in:
DizzyEggg 2018-10-27 17:39:05 +02:00
parent 826d0ea2ab
commit 269d7c2510
4 changed files with 366 additions and 1445 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2408,7 +2408,7 @@ static void sub_818E9CC(void)
gSaveBlock2Ptr->frontier.field_CA9_a = 0; gSaveBlock2Ptr->frontier.field_CA9_a = 0;
gSaveBlock2Ptr->frontier.field_CA9_b = 0; gSaveBlock2Ptr->frontier.field_CA9_b = 0;
if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860D0EC[battleMode][lvlMode])) if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860D0EC[battleMode][lvlMode]))
gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode] = 0; gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] = 0;
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1); saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
gTrainerBattleOpponent_A = 0; gTrainerBattleOpponent_A = 0;
@ -2422,7 +2422,7 @@ static void sub_818EA84(void)
switch (gSpecialVar_0x8005) switch (gSpecialVar_0x8005)
{ {
case 0: case 0:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode]; gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode];
break; break;
case 1: case 1:
gSpecialVar_Result = ((gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860D0EC[battleMode][lvlMode]) != 0); gSpecialVar_Result = ((gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860D0EC[battleMode][lvlMode]) != 0);
@ -2490,7 +2490,7 @@ static void sub_818ED28(void)
switch (gSpecialVar_0x8005) switch (gSpecialVar_0x8005)
{ {
case 0: case 0:
gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode] = gSpecialVar_0x8006; gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] = gSpecialVar_0x8006;
break; break;
case 1: case 1:
if (gSpecialVar_0x8006) if (gSpecialVar_0x8006)
@ -3481,13 +3481,13 @@ static void sub_819033C(void)
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
if (gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode] < 999) if (gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] < 999)
gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode]++; gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode]++;
if (gSaveBlock2Ptr->frontier.field_D1C[battleMode][lvlMode] < 999) if (gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][lvlMode] < 999)
gSaveBlock2Ptr->frontier.field_D1C[battleMode][lvlMode]++; gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][lvlMode]++;
if (gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.field_D14[battleMode][lvlMode]) if (gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][lvlMode])
gSaveBlock2Ptr->frontier.field_D14[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode]; gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode];
} }
static void ShowDomeOpponentInfo(void) static void ShowDomeOpponentInfo(void)

View File

@ -20,11 +20,21 @@ extern u8 gUnknown_0203CEF8[];
extern void (* const gUnknown_08611C18[])(void); extern void (* const gUnknown_08611C18[])(void);
extern const u16 gUnknown_08611BFC[][2]; extern const u16 gUnknown_08611BFC[][2];
extern const struct BattleFrontierTrainer gBattleFrontierTrainers[];
extern const struct WindowTemplate gUnknown_08611C74;
extern void sub_81B8558(void); extern void sub_81B8558(void);
// This file's functions. // This file's functions.
u8 sub_81A3B30(u8 facility); u8 sub_81A3B30(u8 facility);
void ShowTowerResultsWindow(u8);
void ShowDomeResultsWindow(u8);
void ShowPalaceResultsWindow(u8);
void ShowPikeResultsWindow(void);
void sub_81A2C94(u8);
void ShowArenaResultsWindow(void);
void sub_81A2F38(void);
void sub_81A2FF8(void);
void sub_81A1780(void) void sub_81A1780(void)
{ {
@ -140,8 +150,6 @@ void sub_81A1B1C(void)
DoSoftReset(); DoSoftReset();
} }
extern const struct BattleFrontierTrainer gBattleFrontierTrainers[];
void sub_81A1B28(void) void sub_81A1B28(void)
{ {
gFacilityTrainers = gBattleFrontierTrainers; gFacilityTrainers = gBattleFrontierTrainers;
@ -159,15 +167,6 @@ void sub_81A1B38(void)
} }
} }
void PutTowerResultsWindow(u8);
void sub_81A2134(u8);
void sub_81A2460(u8);
void sub_81A2698(void);
void sub_81A2C94(u8);
void sub_81A2968(void);
void sub_81A2F38(void);
void sub_81A2FF8(void);
void sub_81A1B98(void) void sub_81A1B98(void)
{ {
if (gSpecialVar_0x8006 > 3) if (gSpecialVar_0x8006 > 3)
@ -175,22 +174,22 @@ void sub_81A1B98(void)
switch (gSpecialVar_0x8005) switch (gSpecialVar_0x8005)
{ {
case 0: case 0:
PutTowerResultsWindow(gSpecialVar_0x8006); ShowTowerResultsWindow(gSpecialVar_0x8006);
break; break;
case 1: case 1:
sub_81A2134(gSpecialVar_0x8006); ShowDomeResultsWindow(gSpecialVar_0x8006);
break; break;
case 2: case 2:
sub_81A2460(gSpecialVar_0x8006); ShowPalaceResultsWindow(gSpecialVar_0x8006);
break; break;
case 5: case 5:
sub_81A2698(); ShowPikeResultsWindow();
break; break;
case 4: case 4:
sub_81A2C94(gSpecialVar_0x8006); sub_81A2C94(gSpecialVar_0x8006);
break; break;
case 3: case 3:
sub_81A2968(); ShowArenaResultsWindow();
break; break;
case 6: case 6:
sub_81A2F38(); sub_81A2F38();
@ -232,6 +231,7 @@ void PrintHyphens(s32 y)
extern const u8 gText_WinStreak[]; extern const u8 gText_WinStreak[];
extern const u8 gText_Record[]; extern const u8 gText_Record[];
extern const u8 gText_Current[]; extern const u8 gText_Current[];
extern const u8 gText_RoomsCleared[];
extern const u8 gText_Prev[]; extern const u8 gText_Prev[];
extern const u8 gText_SingleBattleRoomResults[]; extern const u8 gText_SingleBattleRoomResults[];
extern const u8 gText_DoubleBattleRoomResults[]; extern const u8 gText_DoubleBattleRoomResults[];
@ -239,8 +239,23 @@ extern const u8 gText_MultiBattleRoomResults[];
extern const u8 gText_LinkMultiBattleRoomResults[]; extern const u8 gText_LinkMultiBattleRoomResults[];
extern const u8 gText_Lv502[]; extern const u8 gText_Lv502[];
extern const u8 gText_OpenLv[]; extern const u8 gText_OpenLv[];
extern const u8 gText_RentalSwap[];
extern const u8 gText_ClearStreak[]; extern const u8 gText_ClearStreak[];
extern const u8 gText_Total[];
extern const u8 gText_Championships[];
extern const u8 gText_SingleBattleTourneyResults[];
extern const u8 gText_DoubleBattleTourneyResults[];
extern const u8 gText_SingleBattleHallResults[];
extern const u8 gText_DoubleBattleHallResults[];
extern const u8 gText_BattleChoiceResults[];
extern const u8 gText_TimesCleared[];
extern const u8 gText_KOsInARow[];
extern const u8 gText_SetKOTourneyResults[];
extern const u8 gText_TimesVar1[];
extern const u8 gText_BattleSwapSingleResults[];
extern const u8 gText_BattleSwapDoubleResults[];
// Battle Tower.
void TowerPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y) void TowerPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y)
{ {
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL);
@ -253,13 +268,13 @@ void TowerPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y)
void TowerPrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) void TowerPrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y)
{ {
u16 num = gSaveBlock2Ptr->frontier.field_CF0[battleMode][lvlMode]; u16 num = gSaveBlock2Ptr->frontier.towerRecordWinStreaks[battleMode][lvlMode];
TowerPrintStreak(gText_Record, num, x1, x2, y); TowerPrintStreak(gText_Record, num, x1, x2, y);
} }
u16 TowerGetStreak(u8 battleMode, u8 lvlMode) u16 TowerGetWinStreak(u8 battleMode, u8 lvlMode)
{ {
u16 winStreak = gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode]; u16 winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode];
if (winStreak > 9999) if (winStreak > 9999)
return 9999; return 9999;
else else
@ -269,7 +284,7 @@ u16 TowerGetStreak(u8 battleMode, u8 lvlMode)
void TowerPrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) void TowerPrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y)
{ {
bool8 isCurrent; bool8 isCurrent;
u16 winStreak = TowerGetStreak(battleMode, lvlMode); u16 winStreak = TowerGetWinStreak(battleMode, lvlMode);
switch (battleMode) switch (battleMode)
{ {
default: default:
@ -305,9 +320,7 @@ void TowerPrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y
TowerPrintStreak(gText_Prev, winStreak, x1, x2, y); TowerPrintStreak(gText_Prev, winStreak, x1, x2, y);
} }
extern const struct WindowTemplate gUnknown_08611C74; void ShowTowerResultsWindow(u8 battleMode)
void PutTowerResultsWindow(u8 battleMode)
{ {
gRecordsWindowId = AddWindow(&gUnknown_08611C74); gRecordsWindowId = AddWindow(&gUnknown_08611C74);
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE); NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
@ -333,16 +346,17 @@ void PutTowerResultsWindow(u8 battleMode)
CopyWindowToVram(gRecordsWindowId, 3); CopyWindowToVram(gRecordsWindowId, 3);
} }
u16 sub_81A1FD8(u8 battleMode, u8 lvlMode) // Battle Dome.
u16 DomeGetWinStreak(u8 battleMode, u8 lvlMode)
{ {
u16 winStreak = gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode]; u16 winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode];
if (winStreak > 9999) if (winStreak > 9999)
return 9999; return 9999;
else else
return winStreak; return winStreak;
} }
void sub_81A2008(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y) void PrintTwoStrings(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y)
{ {
AddTextPrinterParameterized(gRecordsWindowId, 1, str1, x1, y, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(gRecordsWindowId, 1, str1, x1, y, TEXT_SPEED_FF, NULL);
ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4); ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
@ -350,10 +364,10 @@ void sub_81A2008(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y)
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
} }
void sub_81A2094(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) void DomePrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y)
{ {
bool8 isCurrent; bool8 isCurrent;
u16 winStreak = sub_81A1FD8(battleMode, lvlMode); u16 winStreak = DomeGetWinStreak(battleMode, lvlMode);
switch (battleMode) switch (battleMode)
{ {
default: default:
@ -372,7 +386,311 @@ void sub_81A2094(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y)
} }
if (isCurrent == TRUE) if (isCurrent == TRUE)
sub_81A2008(gText_Current, gText_ClearStreak, winStreak, x1, x2, y); PrintTwoStrings(gText_Current, gText_ClearStreak, winStreak, x1, x2, y);
else else
sub_81A2008(gText_Prev, gText_ClearStreak, winStreak, x1, x2, y); PrintTwoStrings(gText_Prev, gText_ClearStreak, winStreak, x1, x2, y);
} }
void ShowDomeResultsWindow(u8 battleMode)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
FillWindowPixelBuffer(gRecordsWindowId, 0x11);
if (battleMode == FRONTIER_MODE_SINGLES)
StringExpandPlaceholders(gStringVar4, gText_SingleBattleTourneyResults);
else
StringExpandPlaceholders(gStringVar4, gText_DoubleBattleTourneyResults);
sub_81A1C4C(gStringVar4, 0);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL);
PrintHyphens(10);
DomePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 64, 121, 33);
PrintTwoStrings(gText_Record, gText_ClearStreak, gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][FRONTIER_LVL_50], 64, 121, 49);
PrintTwoStrings(gText_Total, gText_Championships, gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][FRONTIER_LVL_50], 64, 112, 65);
DomePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_OPEN, 64, 121, 97);
PrintTwoStrings(gText_Record, gText_ClearStreak, gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][FRONTIER_LVL_OPEN], 64, 121, 113);
PrintTwoStrings(gText_Total, gText_Championships, gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][FRONTIER_LVL_OPEN], 64, 112, 129);
PutWindowTilemap(gRecordsWindowId);
CopyWindowToVram(gRecordsWindowId, 3);
}
// Battle Palace.
void PalacePrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y)
{
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL);
if (num > 9999)
num = 9999;
ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
StringExpandPlaceholders(gStringVar4, gText_WinStreak);
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
}
void PalacePrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y)
{
u16 num = gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[battleMode][lvlMode];
PalacePrintStreak(gText_Record, num, x1, x2, y);
}
u16 PalaceGetWinStreak(u8 battleMode, u8 lvlMode)
{
u16 winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode];
if (winStreak > 9999)
return 9999;
else
return winStreak;
}
void PalacePrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y)
{
bool8 isCurrent;
u16 winStreak = PalaceGetWinStreak(battleMode, lvlMode);
switch (battleMode)
{
default:
case FRONTIER_MODE_SINGLES:
if (lvlMode != FRONTIER_LVL_50)
isCurrent = sub_81A1C24(0x20);
else
isCurrent = sub_81A1C24(0x10);
break;
case FRONTIER_MODE_DOUBLES:
if (lvlMode != FRONTIER_LVL_50)
isCurrent = sub_81A1C24(0x800000);
else
isCurrent = sub_81A1C24(0x400000);
}
if (isCurrent == TRUE)
PalacePrintStreak(gText_Current, winStreak, x1, x2, y);
else
PalacePrintStreak(gText_Prev, winStreak, x1, x2, y);
}
void ShowPalaceResultsWindow(u8 battleMode)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
FillWindowPixelBuffer(gRecordsWindowId, 0x11);
if (battleMode == FRONTIER_MODE_SINGLES)
StringExpandPlaceholders(gStringVar4, gText_SingleBattleHallResults);
else
StringExpandPlaceholders(gStringVar4, gText_DoubleBattleHallResults);
sub_81A1C4C(gStringVar4, 2);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL);
PrintHyphens(10);
PalacePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 72, 131, 49);
PalacePrintRecordStreak(battleMode, FRONTIER_LVL_50, 72, 131, 65);
PalacePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_OPEN, 72, 131, 97);
PalacePrintRecordStreak(battleMode, FRONTIER_LVL_OPEN, 72, 131, 113);
PutWindowTilemap(gRecordsWindowId);
CopyWindowToVram(gRecordsWindowId, 3);
}
// Battle Pike.
u16 PikeGetWinStreak(u8 lvlMode)
{
u16 winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode];
if (winStreak > 9999)
return 9999;
else
return winStreak;
}
void PikePrintCleared(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y)
{
AddTextPrinterParameterized(gRecordsWindowId, 1, str1, x1, y, TEXT_SPEED_FF, NULL);
ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
StringExpandPlaceholders(gStringVar4, str2);
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
}
void PikePrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
{
bool8 isCurrent;
u16 winStreak = PikeGetWinStreak(lvlMode);
if (lvlMode != FRONTIER_LVL_50)
isCurrent = sub_81A1C24(0x800);
else
isCurrent = sub_81A1C24(0x400);
if (isCurrent == TRUE)
PrintTwoStrings(gText_Current, gText_RoomsCleared, winStreak, x1, x2, y);
else
PrintTwoStrings(gText_Prev, gText_RoomsCleared, winStreak, x1, x2, y);
}
void ShowPikeResultsWindow(void)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
FillWindowPixelBuffer(gRecordsWindowId, 0x11);
StringExpandPlaceholders(gStringVar4, gText_BattleChoiceResults);
sub_81A1C4C(gStringVar4, 0);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL);
PrintHyphens(10);
PikePrintPrevOrCurrentStreak(FRONTIER_LVL_50, 64, 114, 33);
PikePrintCleared(gText_Record, gText_RoomsCleared, gSaveBlock2Ptr->frontier.pikeRecordStreaks[FRONTIER_LVL_50], 64, 114, 49);
PikePrintCleared(gText_Total, gText_TimesCleared, gSaveBlock2Ptr->frontier.pikeTotalStreaks[FRONTIER_LVL_50], 64, 114, 65);
PikePrintPrevOrCurrentStreak(FRONTIER_LVL_OPEN, 64, 114, 97);
PikePrintCleared(gText_Record, gText_RoomsCleared, gSaveBlock2Ptr->frontier.pikeRecordStreaks[FRONTIER_LVL_OPEN], 64, 114, 113);
PikePrintCleared(gText_Total, gText_TimesCleared, gSaveBlock2Ptr->frontier.pikeTotalStreaks[FRONTIER_LVL_OPEN], 64, 114, 129);
PutWindowTilemap(gRecordsWindowId);
CopyWindowToVram(gRecordsWindowId, 3);
}
// Battle Arena.
void ArenaPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y)
{
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL);
if (num > 9999)
num = 9999;
ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
StringExpandPlaceholders(gStringVar4, gText_KOsInARow);
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
}
void ArenaPrintRecordStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
{
u16 num = gSaveBlock2Ptr->frontier.arenaRecordStreaks[lvlMode];
ArenaPrintStreak(gText_Record, num, x1, x2, y);
}
u16 ArenaGetWinStreak(u8 lvlMode)
{
u16 winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode];
if (winStreak > 9999)
return 9999;
else
return winStreak;
}
void ArenaPrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
{
bool8 isCurrent;
u16 winStreak = ArenaGetWinStreak(lvlMode);
if (lvlMode != FRONTIER_LVL_50)
isCurrent = sub_81A1C24(0x80);
else
isCurrent = sub_81A1C24(0x40);
if (isCurrent == TRUE)
ArenaPrintStreak(gText_Current, winStreak, x1, x2, y);
else
ArenaPrintStreak(gText_Prev, winStreak, x1, x2, y);
}
void ShowArenaResultsWindow(void)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
FillWindowPixelBuffer(gRecordsWindowId, 0x11);
PrintHyphens(10);
StringExpandPlaceholders(gStringVar4, gText_SetKOTourneyResults);
sub_81A1C4C(gStringVar4, 2);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL);
ArenaPrintPrevOrCurrentStreak(FRONTIER_LVL_50, 72, 126, 49);
ArenaPrintRecordStreak(FRONTIER_LVL_50, 72, 126, 65);
ArenaPrintPrevOrCurrentStreak(FRONTIER_LVL_OPEN, 72, 126, 97);
ArenaPrintRecordStreak(FRONTIER_LVL_OPEN, 72, 126, 113);
PutWindowTilemap(gRecordsWindowId);
CopyWindowToVram(gRecordsWindowId, 3);
}
// Battle Factory.
void sub_81A2A28(const u8 *str, u16 num1, u16 num2, u8 x1, u8 x2, u8 x3, u8 y)
{
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL);
if (num1 > 9999)
num1 = 9999;
ConvertIntToDecimalStringN(gStringVar1, num1, STR_CONV_MODE_RIGHT_ALIGN, 4);
StringExpandPlaceholders(gStringVar4, gText_WinStreak);
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
ConvertIntToDecimalStringN(gStringVar1, num2, STR_CONV_MODE_RIGHT_ALIGN, 4);
StringExpandPlaceholders(gStringVar4, gText_TimesVar1);
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x3, y, TEXT_SPEED_FF, NULL);
}
void sub_81A2B04(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y)
{
u16 num1 = gSaveBlock2Ptr->frontier.field_DEA[battleMode][lvlMode];
u16 num2 = gSaveBlock2Ptr->frontier.field_DFA[battleMode][lvlMode];
sub_81A2A28(gText_Record, num1, num2, x1, x2, x3, y);
}
u16 sub_81A2B70(u8 battleMode, u8 lvlMode)
{
u16 winStreak = gSaveBlock2Ptr->frontier.field_DE2[battleMode][lvlMode];
if (winStreak > 9999)
return 9999;
else
return winStreak;
}
u16 sub_81A2BA0(u8 battleMode, u8 lvlMode)
{
u16 rents = gSaveBlock2Ptr->frontier.field_DF2[battleMode][lvlMode];
if (rents > 9999)
return 9999;
else
return rents;
}
void sub_81A2BD0(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y)
{
bool8 isCurrent;
u16 winStreak = sub_81A2B70(battleMode, lvlMode);
u16 rents = sub_81A2BA0(battleMode, lvlMode);
switch (battleMode)
{
default:
case FRONTIER_MODE_SINGLES:
if (lvlMode != FRONTIER_LVL_50)
isCurrent = sub_81A1C24(0x200);
else
isCurrent = sub_81A1C24(0x100);
break;
case FRONTIER_MODE_DOUBLES:
if (lvlMode != FRONTIER_LVL_50)
isCurrent = sub_81A1C24(0x2000000);
else
isCurrent = sub_81A1C24(0x1000000);
break;
}
if (isCurrent == TRUE)
sub_81A2A28(gText_Current, winStreak, rents, x1, x2, x3, y);
else
sub_81A2A28(gText_Prev, winStreak, rents, x1, x2, x3, y);
}
void sub_81A2C94(u8 battleMode)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
FillWindowPixelBuffer(gRecordsWindowId, 0x11);
if (battleMode == FRONTIER_MODE_SINGLES)
StringExpandPlaceholders(gStringVar4, gText_BattleSwapSingleResults);
else
StringExpandPlaceholders(gStringVar4, gText_BattleSwapDoubleResults);
sub_81A1C4C(gStringVar4, 0);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_RentalSwap, 152, 33, TEXT_SPEED_FF, NULL);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL);
PrintHyphens(10);
sub_81A2BD0(battleMode, FRONTIER_LVL_50, 8, 64, 158, 49);
sub_81A2B04(battleMode, FRONTIER_LVL_50, 8, 64, 158, 65);
sub_81A2BD0(battleMode, FRONTIER_LVL_OPEN, 8, 64, 158, 113);
sub_81A2B04(battleMode, FRONTIER_LVL_OPEN, 8, 64, 158, 129);
PutWindowTilemap(gRecordsWindowId);
CopyWindowToVram(gRecordsWindowId, 3);
}

View File

@ -220,7 +220,7 @@ static void sub_8161F94(void)
gSaveBlock2Ptr->frontier.field_CA9_b = 0; gSaveBlock2Ptr->frontier.field_CA9_b = 0;
sub_81A3ACC(); sub_81A3ACC();
if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_085DF9AC[battleMode][lvlMode])) if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_085DF9AC[battleMode][lvlMode]))
gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] = 0; gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = 0;
ValidateBattleTowerRecordChecksums(); ValidateBattleTowerRecordChecksums();
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1); saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
@ -258,7 +258,7 @@ static void sub_81620F4(void)
case 0: case 0:
break; break;
case 1: case 1:
gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] = gSpecialVar_0x8006; gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = gSpecialVar_0x8006;
break; break;
case 2: case 2:
if (gSpecialVar_0x8006) if (gSpecialVar_0x8006)
@ -1179,7 +1179,7 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId)
{ {
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; // Unused variable. u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; // Unused variable.
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
u8 challengeNum = gSaveBlock2Ptr->frontier.winStreaks[battleMode][0] / 7; u8 challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][0] / 7;
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 6) if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 6)
fixedIV = sub_81A6CA8(challengeNum, 0); fixedIV = sub_81A6CA8(challengeNum, 0);
else else
@ -1480,8 +1480,8 @@ static void SaveCurrentWinStreak(void)
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
u16 winStreak = GetCurrentBattleTowerWinStreak(lvlMode, battleMode); u16 winStreak = GetCurrentBattleTowerWinStreak(lvlMode, battleMode);
if (gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] < winStreak) if (gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] < winStreak)
gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] = winStreak; gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = winStreak;
} }
static void sub_8163EE4(void) static void sub_8163EE4(void)
@ -1535,7 +1535,7 @@ static void SaveBattleTowerProgress(void)
{ {
u16 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u16 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u16 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); u16 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
s32 challengeNum = (signed)(gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] / 7); s32 challengeNum = (signed)(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7);
if (gSpecialVar_0x8005 == 0 && (challengeNum > 1 || gSaveBlock2Ptr->frontier.curChallengeBattleNum != 0)) if (gSpecialVar_0x8005 == 0 && (challengeNum > 1 || gSaveBlock2Ptr->frontier.curChallengeBattleNum != 0))
sub_8163EE4(); sub_8163EE4();
@ -1625,7 +1625,7 @@ static void sub_81642A0(void)
eventObjTemplates = gSaveBlock1Ptr->eventObjectTemplates; eventObjTemplates = gSaveBlock1Ptr->eventObjectTemplates;
lvlMode = gSaveBlock2Ptr->frontier.lvlMode; lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
challengeNum = gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] / 7; challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7;
species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL); species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL); species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
level = SetFacilityPtrsGetLevel(); level = SetFacilityPtrsGetLevel();
@ -1911,7 +1911,7 @@ static void sub_8164B74(void)
case 0: case 0:
if (battleMode == FRONTIER_MODE_LINK_MULTIS) if (battleMode == FRONTIER_MODE_LINK_MULTIS)
{ {
challengeNum = gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] / 7; challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7;
if (sub_800A520()) if (sub_800A520())
{ {
SendBlock(bitmask_all_link_players_but_self(), &challengeNum, sizeof(challengeNum)); SendBlock(bitmask_all_link_players_but_self(), &challengeNum, sizeof(challengeNum));
@ -2069,7 +2069,7 @@ static void ClearBattleTowerRecord(struct EmeraldBattleTowerRecord *record)
u16 GetCurrentBattleTowerWinStreak(u8 lvlMode, u8 battleMode) u16 GetCurrentBattleTowerWinStreak(u8 lvlMode, u8 battleMode)
{ {
u16 winStreak = gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode]; u16 winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode];
if (winStreak > 9999) if (winStreak > 9999)
return 9999; return 9999;