Change language stuff based on the french decomp

This commit is contained in:
DizzyEggg 2022-08-04 11:53:16 +02:00
parent 79384ec9f3
commit c991131b75
10 changed files with 56 additions and 48 deletions

View File

@ -7,6 +7,9 @@
#define WINDOW_CLEAR (1 << 0)
#define WINDOW_BG1 (1 << 7)
// Arguments for 'xStart, yStart, xEnd, yEnd' in HandleBattleWindow
#define YESNOBOX_X_Y 24, 8, 29, 13
void AI_CalcDmg(u8 battlerIdAtk, u8 battlerIdDef);
u8 TypeCalc(u16 move, u8 battlerIdAtk, u8 battlerIdDef);
u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility);

View File

@ -19,8 +19,10 @@
#ifdef ENGLISH
#define UNITS_IMPERIAL
#define CHAR_DEC_SEPARATOR CHAR_PERIOD // Period is used as a decimal separator only in the UK and the US.
#else
#define UNITS_METRIC
#define CHAR_DEC_SEPARATOR CHAR_COMMA
#endif
// Uncomment to fix some identified minor bugs

View File

@ -694,6 +694,7 @@ SECTIONS {
src/battle_transition_frontier.o(.rodata);
src/text_input_strings.o(.rodata);
src/fonts.o(.rodata);
src/international_string_util.o(.rodata);
src/mystery_event_msg.o(.rodata);
data/mystery_gift.o(.rodata);
src/m4a_tables.o(.rodata);

View File

@ -1435,7 +1435,7 @@ static void PlayerHandleYesNoInput(void)
}
if (JOY_NEW(A_BUTTON))
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
PlaySE(SE_SELECT);
if (gMultiUsePlayerCursor != 0)
@ -1447,7 +1447,7 @@ static void PlayerHandleYesNoInput(void)
}
if (JOY_NEW(B_BUTTON))
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
PlaySE(SE_SELECT);
PlayerBufferExecCompleted();
}
@ -2592,7 +2592,7 @@ static void PlayerHandleYesNoBox(void)
{
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0);
HandleBattleWindow(YESNOBOX_X_Y, 0);
BattlePutTextOnWindow(gText_BattleYesNoChoice, B_WIN_YESNO);
gMultiUsePlayerCursor = 1;
BattleCreateYesNoCursorAt(1);

View File

@ -1068,7 +1068,7 @@ static void CB2_HandleStartBattle(void)
// Recv Pokémon 5-6
ResetBlockReceivedFlags();
memcpy(&gEnemyParty[4], gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2);
TryCorrectShedinjaLanguage(&gEnemyParty[0]);
TryCorrectShedinjaLanguage(&gEnemyParty[1]);
TryCorrectShedinjaLanguage(&gEnemyParty[2]);
@ -2489,7 +2489,7 @@ static void AskRecordBattle(void)
case STATE_PRINT_YES_NO:
if (!IsTextPrinterActive(B_WIN_MSG))
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0);
HandleBattleWindow(YESNOBOX_X_Y, 0);
BattlePutTextOnWindow(gText_BattleYesNoChoice, B_WIN_YESNO);
gBattleCommunication[CURSOR_POSITION] = 1;
BattleCreateYesNoCursorAt(1);
@ -2525,7 +2525,7 @@ static void AskRecordBattle(void)
if (gBattleCommunication[CURSOR_POSITION] == 0)
{
// Selected Yes
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
gBattleCommunication[1] = MoveRecordedBattleToSaveData();
gBattleCommunication[MULTIUSE_STATE] = STATE_RECORD_YES;
}
@ -2544,7 +2544,7 @@ static void AskRecordBattle(void)
case STATE_RECORD_NO:
if (IsLinkTaskFinished() == TRUE)
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
if (gMain.anyLinkBattlerHasFrontierPass)
{
// Other battlers may be recording, wait for them
@ -2985,7 +2985,7 @@ static void SpriteCB_TrainerThrowObject_Main(struct Sprite *sprite)
sprite->callback = SpriteCB_Idle;
}
// Sprite callback for a trainer back pic to throw an object
// Sprite callback for a trainer back pic to throw an object
// (Wally throwing a ball, throwing Pokéblocks/balls in the Safari Zone)
void SpriteCB_TrainerThrowObject(struct Sprite *sprite)
{

View File

@ -5369,7 +5369,7 @@ static void Cmd_yesnoboxlearnmove(void)
switch (gBattleScripting.learnMoveState)
{
case 0:
HandleBattleWindow(24, 8, 29, 13, 0);
HandleBattleWindow(YESNOBOX_X_Y, 0);
BattlePutTextOnWindow(gText_BattleYesNoChoice, B_WIN_YESNO);
gBattleScripting.learnMoveState++;
gBattleCommunication[CURSOR_POSITION] = 0;
@ -5395,7 +5395,7 @@ static void Cmd_yesnoboxlearnmove(void)
PlaySE(SE_SELECT);
if (gBattleCommunication[1] == 0)
{
HandleBattleWindow(24, 8, 29, 13, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
gBattleScripting.learnMoveState++;
}
@ -5466,7 +5466,7 @@ static void Cmd_yesnoboxlearnmove(void)
}
break;
case 5:
HandleBattleWindow(24, 8, 29, 13, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
gBattlescriptCurrInstr += 5;
break;
case 6:
@ -5483,7 +5483,7 @@ static void Cmd_yesnoboxstoplearningmove(void)
switch (gBattleScripting.learnMoveState)
{
case 0:
HandleBattleWindow(24, 8, 29, 13, 0);
HandleBattleWindow(YESNOBOX_X_Y, 0);
BattlePutTextOnWindow(gText_BattleYesNoChoice, B_WIN_YESNO);
gBattleScripting.learnMoveState++;
gBattleCommunication[CURSOR_POSITION] = 0;
@ -5513,13 +5513,13 @@ static void Cmd_yesnoboxstoplearningmove(void)
else
gBattlescriptCurrInstr += 5;
HandleBattleWindow(24, 8, 29, 13, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
}
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
HandleBattleWindow(24, 8, 29, 13, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
}
break;
}
@ -5779,7 +5779,7 @@ static void Cmd_yesnobox(void)
switch (gBattleCommunication[0])
{
case 0:
HandleBattleWindow(24, 8, 29, 13, 0);
HandleBattleWindow(YESNOBOX_X_Y, 0);
BattlePutTextOnWindow(gText_BattleYesNoChoice, B_WIN_YESNO);
gBattleCommunication[0]++;
gBattleCommunication[CURSOR_POSITION] = 0;
@ -5804,13 +5804,13 @@ static void Cmd_yesnobox(void)
{
gBattleCommunication[CURSOR_POSITION] = 1;
PlaySE(SE_SELECT);
HandleBattleWindow(24, 8, 29, 13, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
gBattlescriptCurrInstr++;
}
else if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
HandleBattleWindow(24, 8, 29, 13, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
gBattlescriptCurrInstr++;
}
break;
@ -10116,7 +10116,7 @@ static void Cmd_trygivecaughtmonnick(void)
switch (gBattleCommunication[MULTIUSE_STATE])
{
case 0:
HandleBattleWindow(24, 8, 29, 13, 0);
HandleBattleWindow(YESNOBOX_X_Y, 0);
BattlePutTextOnWindow(gText_BattleYesNoChoice, B_WIN_YESNO);
gBattleCommunication[MULTIUSE_STATE]++;
gBattleCommunication[CURSOR_POSITION] = 0;

View File

@ -899,7 +899,7 @@ static void Task_EvolutionScene(u8 taskId)
case MVSTATE_PRINT_YES_NO:
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0);
HandleBattleWindow(YESNOBOX_X_Y, 0);
BattlePutTextOnWindow(gText_BattleYesNoChoice, B_WIN_YESNO);
gTasks[taskId].tLearnMoveState++;
sEvoCursorPos = 0;
@ -928,7 +928,7 @@ static void Task_EvolutionScene(u8 taskId)
}
if (JOY_NEW(A_BUTTON))
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
PlaySE(SE_SELECT);
if (sEvoCursorPos != 0)
@ -947,7 +947,7 @@ static void Task_EvolutionScene(u8 taskId)
if (JOY_NEW(B_BUTTON))
{
// Equivalent to selecting NO
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
PlaySE(SE_SELECT);
gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveNoState;
}

View File

@ -182,7 +182,7 @@ static void DetermineCyclingRoadResults(u32 numFrames, u8 numBikeCollisions)
if (numFrames < 3600)
{
ConvertIntToDecimalStringN(gStringVar2, numFrames / 60, STR_CONV_MODE_RIGHT_ALIGN, 2);
gStringVar2[2] = CHAR_PERIOD;
gStringVar2[2] = CHAR_DEC_SEPARATOR;
ConvertIntToDecimalStringN(&gStringVar2[3], ((numFrames % 60) * 100) / 60, STR_CONV_MODE_LEADING_ZEROS, 2);
StringAppend(gStringVar2, gText_SpaceSeconds);
}

View File

@ -270,6 +270,7 @@ static void PrintMonHeight(u16 height, u8 left, u8 top);
static void PrintMonWeight(u16 weight, u8 left, u8 top);
static void ResetOtherVideoRegisters(u16);
static u8 PrintCryScreenSpeciesName(u8, u16, u8, u8);
static void PrintDecimalNum(u8 windowId, u16 num, u8 left, u8 top);
static void DrawFootprint(u8 windowId, u16 dexNum);
static u16 CreateSizeScreenTrainerPic(u16, s16, s16, s8);
static u16 GetNextPosition(u8, u16, u16, u16);
@ -4531,13 +4532,14 @@ static void UnusedPrintMonName(u8 windowId, const u8 *name, u8 left, u8 top)
PrintInfoSubMenuText(windowId, str, left, top);
}
static void UnusedPrintDecimalNum(u8 windowId, u16 b, u8 left, u8 top)
// Unused in the English version, used to print height/weight in versions which use metric system.
static void PrintDecimalNum(u8 windowId, u16 num, u8 left, u8 top)
{
u8 str[6];
bool8 outputted = FALSE;
u8 result;
result = b / 1000;
result = num / 1000;
if (result == 0)
{
str[0] = CHAR_SPACER;
@ -4549,7 +4551,7 @@ static void UnusedPrintDecimalNum(u8 windowId, u16 b, u8 left, u8 top)
outputted = TRUE;
}
result = (b % 1000) / 100;
result = (num % 1000) / 100;
if (result == 0 && !outputted)
{
str[1] = CHAR_SPACER;
@ -4561,9 +4563,9 @@ static void UnusedPrintDecimalNum(u8 windowId, u16 b, u8 left, u8 top)
outputted = TRUE;
}
str[2] = CHAR_0 + ((b % 1000) % 100) / 10;
str[3] = CHAR_PERIOD;
str[4] = CHAR_0 + ((b % 1000) % 100) % 10;
str[2] = CHAR_0 + ((num % 1000) % 100) / 10;
str[3] = CHAR_DEC_SEPARATOR;
str[4] = CHAR_0 + ((num % 1000) % 100) % 10;
str[5] = EOS;
PrintInfoSubMenuText(windowId, str, left, top);
}

View File

@ -289,19 +289,19 @@ static void PrintNumPlayersWaitingForMsg(u8 windowId, u8 capacityCode, u8 string
switch (capacityCode << 8)
{
case LINK_GROUP_CAPACITY(0, 2):
PrintUnionRoomText(windowId, 1, sPlayersNeededOrModeTexts[0][stringId - 1], 0, 1, UR_COLOR_DEFAULT);
PrintUnionRoomText(windowId, FONT_NORMAL, sPlayersNeededOrModeTexts[0][stringId - 1], 0, 1, UR_COLOR_DEFAULT);
break;
case LINK_GROUP_CAPACITY(0, 4):
PrintUnionRoomText(windowId, 1, sPlayersNeededOrModeTexts[1][stringId - 1], 0, 1, UR_COLOR_DEFAULT);
PrintUnionRoomText(windowId, FONT_NORMAL, sPlayersNeededOrModeTexts[1][stringId - 1], 0, 1, UR_COLOR_DEFAULT);
break;
case LINK_GROUP_CAPACITY(2, 5):
PrintUnionRoomText(windowId, 1, sPlayersNeededOrModeTexts[2][stringId - 1], 0, 1, UR_COLOR_DEFAULT);
PrintUnionRoomText(windowId, FONT_NORMAL, sPlayersNeededOrModeTexts[2][stringId - 1], 0, 1, UR_COLOR_DEFAULT);
break;
case LINK_GROUP_CAPACITY(3, 5):
PrintUnionRoomText(windowId, 1, sPlayersNeededOrModeTexts[3][stringId - 1], 0, 1, UR_COLOR_DEFAULT);
PrintUnionRoomText(windowId, FONT_NORMAL, sPlayersNeededOrModeTexts[3][stringId - 1], 0, 1, UR_COLOR_DEFAULT);
break;
case LINK_GROUP_CAPACITY(2, 4):
PrintUnionRoomText(windowId, 1, sPlayersNeededOrModeTexts[4][stringId - 1], 0, 1, UR_COLOR_DEFAULT);
PrintUnionRoomText(windowId, FONT_NORMAL, sPlayersNeededOrModeTexts[4][stringId - 1], 0, 1, UR_COLOR_DEFAULT);
break;
}
@ -313,10 +313,10 @@ static void PrintPlayerNameAndIdOnWindow(u8 windowId)
u8 text[30];
u8 *txtPtr;
PrintUnionRoomText(windowId, 1, gSaveBlock2Ptr->playerName, 0, 1, UR_COLOR_DEFAULT);
PrintUnionRoomText(windowId, FONT_NORMAL, gSaveBlock2Ptr->playerName, 0, 1, UR_COLOR_DEFAULT);
txtPtr = StringCopy(text, sText_ID);
ConvertIntToDecimalStringN(txtPtr, ReadAsU16(gSaveBlock2Ptr->playerTrainerId), STR_CONV_MODE_LEADING_ZEROS, 5);
PrintUnionRoomText(windowId, 1, text, 0, 17, UR_COLOR_DEFAULT);
PrintUnionRoomText(windowId, FONT_NORMAL, text, 0, 17, UR_COLOR_DEFAULT);
}
static void GetAwaitingCommunicationText(u8 *dst, u8 caseId)
@ -431,7 +431,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
data->nPlayerModeWindowId = AddWindow(&sWindowTemplate_NumPlayerMode);
FillWindowPixelBuffer(data->bButtonCancelWindowId, PIXEL_FILL(2));
PrintUnionRoomText(data->bButtonCancelWindowId, 0, sText_BButtonCancel, 8, 1, UR_COLOR_CANCEL);
PrintUnionRoomText(data->bButtonCancelWindowId, FONT_SMALL, sText_BButtonCancel, 8, 1, UR_COLOR_CANCEL);
PutWindowTilemap(data->bButtonCancelWindowId);
CopyWindowToVram(data->bButtonCancelWindowId, COPYWIN_GFX);
@ -1011,7 +1011,7 @@ static void Task_TryJoinLinkGroup(u8 taskId)
data->playerNameAndIdWindowId = AddWindow(&sWindowTemplate_PlayerNameAndId);
FillWindowPixelBuffer(data->bButtonCancelWindowId, PIXEL_FILL(2));
PrintUnionRoomText(data->bButtonCancelWindowId, 0, sText_ChooseJoinCancel, 8, 1, UR_COLOR_CANCEL);
PrintUnionRoomText(data->bButtonCancelWindowId, FONT_SMALL, sText_ChooseJoinCancel, 8, 1, UR_COLOR_CANCEL);
PutWindowTilemap(data->bButtonCancelWindowId);
CopyWindowToVram(data->bButtonCancelWindowId, COPYWIN_GFX);
@ -2469,7 +2469,7 @@ static void ScheduleFieldMessageAndExit(const u8 *src)
static void CopyPlayerListToBuffer(struct WirelessLink_URoom *uroom)
{
memcpy(&gDecompressionBuffer[sizeof(gDecompressionBuffer) - (MAX_UNION_ROOM_LEADERS * sizeof(struct RfuPlayer))],
uroom->playerList,
uroom->playerList,
MAX_UNION_ROOM_LEADERS * sizeof(struct RfuPlayer));
}
@ -3656,7 +3656,7 @@ static u8 CreateTradeBoardWindow(const struct WindowTemplate * template)
u8 windowId = AddWindow(template);
DrawStdWindowFrame(windowId, FALSE);
FillWindowPixelBuffer(windowId, PIXEL_FILL(15));
PrintUnionRoomText(windowId, 1, sText_NameWantedOfferLv, 8, 1, UR_COLOR_TRADE_BOARD_OTHER);
PrintUnionRoomText(windowId, FONT_NORMAL, sText_NameWantedOfferLv, 8, 1, UR_COLOR_TRADE_BOARD_OTHER);
CopyWindowToVram(windowId, COPYWIN_GFX);
PutWindowTilemap(windowId);
return windowId;
@ -3971,17 +3971,17 @@ static void PrintGroupMemberOnWindow(u8 windowId, u8 x, u8 y, struct RfuPlayer *
ConvertIntToDecimalStringN(gStringVar4, id + 1, STR_CONV_MODE_LEADING_ZEROS, 2);
StringAppend(gStringVar4, sText_Colon);
PrintUnionRoomText(windowId, 1, gStringVar4, x, y, UR_COLOR_DEFAULT);
PrintUnionRoomText(windowId, FONT_NORMAL, gStringVar4, x, y, UR_COLOR_DEFAULT);
x += 18;
activity = player->rfu.data.activity;
if (player->groupScheduledAnim == UNION_ROOM_SPAWN_IN && !(activity & IN_UNION_ROOM))
{
CopyAndTranslatePlayerName(gStringVar4, player);
PrintUnionRoomText(windowId, 1, gStringVar4, x, y, colorIdx);
PrintUnionRoomText(windowId, FONT_NORMAL, gStringVar4, x, y, colorIdx);
ConvertIntToDecimalStringN(trainerId, player->rfu.data.compatibility.playerTrainerId[0] | (player->rfu.data.compatibility.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5);
StringCopy(gStringVar4, sText_ID);
StringAppend(gStringVar4, trainerId);
PrintUnionRoomText(windowId, 1, gStringVar4, GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0x88), y, colorIdx);
PrintUnionRoomText(windowId, FONT_NORMAL, gStringVar4, GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0x88), y, colorIdx);
}
}
@ -3992,11 +3992,11 @@ static void PrintGroupCandidateOnWindow(u8 windowId, u8 x, u8 y, struct RfuPlaye
if (player->groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{
CopyAndTranslatePlayerName(gStringVar4, player);
PrintUnionRoomText(windowId, 1, gStringVar4, x, y, colorIdx);
PrintUnionRoomText(windowId, FONT_NORMAL, gStringVar4, x, y, colorIdx);
ConvertIntToDecimalStringN(trainerId, player->rfu.data.compatibility.playerTrainerId[0] | (player->rfu.data.compatibility.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5);
StringCopy(gStringVar4, sText_ID);
StringAppend(gStringVar4, trainerId);
PrintUnionRoomText(windowId, 1, gStringVar4, GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0x68), y, colorIdx);
PrintUnionRoomText(windowId, FONT_NORMAL, gStringVar4, GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0x68), y, colorIdx);
}
}
@ -4101,17 +4101,17 @@ static void TradeBoardPrintItemInfo(u8 windowId, u8 y, struct RfuGameData * data
u8 type = data->tradeType;
u8 level = data->tradeLevel;
PrintUnionRoomText(windowId, 1, playerName, 8, y, colorIdx);
PrintUnionRoomText(windowId, FONT_NORMAL, playerName, 8, y, colorIdx);
if (species == SPECIES_EGG)
{
PrintUnionRoomText(windowId, 1, sText_EggTrade, 68, y, colorIdx);
PrintUnionRoomText(windowId, FONT_NORMAL, sText_EggTrade, 68, y, colorIdx);
}
else
{
BlitMenuInfoIcon(windowId, type + 1, 68, y);
PrintUnionRoomText(windowId, 1, gSpeciesNames[species], 118, y, colorIdx);
PrintUnionRoomText(windowId, FONT_NORMAL, gSpeciesNames[species], 118, y, colorIdx);
ConvertIntToDecimalStringN(levelStr, level, STR_CONV_MODE_RIGHT_ALIGN, 3);
PrintUnionRoomText(windowId, 1, levelStr, 198, y, colorIdx);
PrintUnionRoomText(windowId, FONT_NORMAL, levelStr, 198, y, colorIdx);
}
}