Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Nikolay Korolev 2020-04-29 11:44:33 +03:00
commit 1e78278b5a
14 changed files with 809 additions and 240 deletions

View File

@ -3,24 +3,21 @@ image: Visual Studio 2019
configuration:
- Debug
- Release
platform: Win32
platform:
- win-x86-librw_d3d9-mss
environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
install:
- cmd: >-
git submodule update --init --recursive
copy premake5.exe "librw/premake5.exe"
cd "librw" && premake5 vs2019 && msbuild "build/librw.sln" /property:Configuration=%CONFIGURATION% /property:Platform="win-x86-d3d9"
cd "%APPVEYOR_BUILD_FOLDER%" && premake5 vs2019
premake5 vs2019
build:
project: build/re3.sln
verbosity: minimal
artifacts:
- path: bin/%CONFIGURATION%/re3.exe
- path: bin/%PLATFORM%/%CONFIGURATION%/re3.exe
name: re3.exe
- path: bin/%CONFIGURATION%/re3.pdb
- path: bin/%PLATFORM%/%CONFIGURATION%/re3.pdb
name: re3.pdb

View File

@ -1,8 +1,85 @@
Librw = os.getenv("LIBRW") or "librw"
workspace "re3"
configurations { "Debug", "Release", "ReleaseFH", "DebugRW", "ReleaseRW", "ReleaseGLFW" }
language "C++"
configurations { "Debug", "Release" }
location "build"
symbols "Full"
staticruntime "off"
filter { "system:windows" }
platforms {
"win-x86-RW33_d3d8-mss",
"win-x86-librw_d3d9-mss",
"win-x86-librw_gl3_glfw-mss",
}
filter "configurations:Debug"
defines { "DEBUG" }
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
filter { "platforms:win*" }
system "windows"
filter { "platforms:*x86*" }
architecture "x86"
filter { "platforms:*librw_d3d9*" }
defines { "RW_D3D9" }
filter "platforms:*librw_gl3_glfw*"
defines { "RW_GL3" }
defines { "GLEW_STATIC" }
includedirs { "glfw-3.3.2.bin.WIN32/include" }
includedirs { "glew-2.1.0/include" }
filter {}
pbcommands = {
"setlocal EnableDelayedExpansion",
"set file=$(TargetPath)",
"FOR %%i IN (\"%file%\") DO (",
"set filename=%%~ni",
"set fileextension=%%~xi",
"set target=!path!!filename!!fileextension!",
"copy /y \"!file!\" \"!target!\"",
")" }
function setpaths (gamepath, exepath, scriptspath)
scriptspath = scriptspath or ""
if (gamepath) then
cmdcopy = { "set \"path=" .. gamepath .. scriptspath .. "\"" }
table.insert(cmdcopy, pbcommands)
postbuildcommands (cmdcopy)
debugdir (gamepath)
if (exepath) then
debugcommand (gamepath .. exepath)
dir, file = exepath:match'(.*/)(.*)'
debugdir (gamepath .. (dir or ""))
end
end
--targetdir ("bin/%{prj.name}/" .. scriptspath)
end
project "librw"
kind "StaticLib"
targetname "rw"
targetdir "lib/%{cfg.platform}/%{cfg.buildcfg}"
files { path.join(Librw, "src/*.*") }
files { path.join(Librw, "src/*/*.*") }
filter "platforms:*RW33*"
flags { "ExcludeFromBuild" }
filter {}
project "re3"
kind "WindowedApp"
targetname "re3"
targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}"
targetextension ".exe"
characterset ("MBCS")
linkoptions "/SAFESEH:NO"
files { "src/*.*" }
files { "src/animation/*.*" }
@ -48,105 +125,38 @@ workspace "re3"
includedirs { "src/extras" }
includedirs { "eax" }
includedirs { "dxsdk/include" }
includedirs { "milessdk/include" }
includedirs { "eax" }
libdirs { "dxsdk/lib" }
libdirs { "milessdk/lib" }
filter "configurations:Debug or Release"
files { "src/fakerw/*.*" }
includedirs { "src/fakerw" }
includedirs { Librw }
libdirs { path.join(Librw, "lib/win-x86-d3d9/%{cfg.buildcfg}") }
links { "rw", "d3d9" }
filter {}
setpaths("$(GTA_III_RE_DIR)/", "$(TargetFileName)", "")
filter "configurations:DebugRW or ReleaseRW"
filter "platforms:*RW33*"
staticruntime "on"
includedirs { "rwsdk/include/d3d8" }
libdirs { "rwsdk/lib/d3d8/release" }
links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse" }
filter {}
defines { "RWLIBS" }
linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text"
filter "configurations:ReleaseGLFW"
defines { "GLEW_STATIC", "GLFW_DLL" }
filter "platforms:*librw*"
defines { "LIBRW" }
files { "src/fakerw/*.*" }
includedirs { "src/fakerw" }
includedirs { Librw }
includedirs { "glfw-3.3.2.bin.WIN32/include" }
includedirs { "glew-2.1.0/include" }
libdirs { path.join(Librw, "lib/win-x86-gl3/Release") }
libdirs { "glew-2.1.0/lib/Release/Win32" }
libdirs { "glfw-3.3.2.bin.WIN32/lib-vc2015" }
links { "opengl32" }
links { "glew32s" }
links { "glfw3dll" }
libdirs { "lib/%{cfg.platform}/%{cfg.buildcfg}" }
links { "rw" }
filter {}
pbcommands = {
"setlocal EnableDelayedExpansion",
"set file=$(TargetPath)",
"FOR %%i IN (\"%file%\") DO (",
"set filename=%%~ni",
"set fileextension=%%~xi",
"set target=!path!!filename!!fileextension!",
"copy /y \"!file!\" \"!target!\"",
")" }
filter "platforms:*d3d*"
includedirs { "dxsdk/include" }
libdirs { "dxsdk/lib" }
function setpaths (gamepath, exepath, scriptspath)
scriptspath = scriptspath or ""
if (gamepath) then
cmdcopy = { "set \"path=" .. gamepath .. scriptspath .. "\"" }
table.insert(cmdcopy, pbcommands)
postbuildcommands (cmdcopy)
debugdir (gamepath)
if (exepath) then
debugcommand (gamepath .. exepath)
dir, file = exepath:match'(.*/)(.*)'
debugdir (gamepath .. (dir or ""))
end
end
--targetdir ("bin/%{prj.name}/" .. scriptspath)
end
filter "platforms:*d3d9*"
links { "d3d9" }
project "re3"
kind "WindowedApp"
language "C++"
targetname "re3"
targetdir "bin/%{cfg.buildcfg}"
targetextension ".exe"
characterset ("MBCS")
linkoptions "/SAFESEH:NO"
setpaths("$(GTA_III_RE_DIR)/", "$(TargetFileName)", "")
symbols "Full"
staticruntime "off"
filter "configurations:Debug or Release or ReleaseFH"
prebuildcommands { "cd \"../librw\" && premake5 " .. _ACTION .. " && msbuild \"build/librw.sln\" /property:Configuration=%{cfg.longname} /property:Platform=\"win-x86-d3d9\"" }
defines { "LIBRW", "RW_D3D9" }
filter "configurations:*RW"
defines { "RWLIBS" }
staticruntime "on"
linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text"
filter "configurations:*GLFW"
prebuildcommands { "cd \"../librw\" && premake5 " .. _ACTION .. " && msbuild \"build/librw.sln\" /property:Configuration=Release /property:Platform=\"win-x86-gl3\"" }
defines { "LIBRW", "RW_GL3" }
filter "configurations:Debug*"
defines { "DEBUG" }
filter "configurations:Release*"
defines { "NDEBUG" }
optimize "On"
filter "configurations:ReleaseFH"
prebuildcommands {}
optimize "off"
staticruntime "on"
filter "platforms:*gl3_glfw*"
libdirs { "glew-2.1.0/lib/Release/Win32" }
libdirs { "glfw-3.3.2.bin.WIN32/lib-" .. string.gsub(_ACTION, "vs", "vc") }
links { "opengl32", "glew32s", "glfw3" }

View File

@ -1390,7 +1390,7 @@ void CGarages::PrintMessages()
CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(50.0f));
CFont::SetCentreOn();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetColor(CRGBA(0, 0, 0, 255));
#if defined(PS2) || defined (FIX_BUGS)

View File

@ -110,7 +110,7 @@ int8 CMenuManager::m_bFrontEnd_ReloadObrTxtGxt;
int32 CMenuManager::m_PrefsMusicVolume = 102;
int32 CMenuManager::m_PrefsSfxVolume = 102;
char CMenuManager::m_PrefsSkinFile[256] = "$$\"\"";
char CMenuManager::m_PrefsSkinFile[256] = DEFAULT_SKIN_NAME;
int32 CMenuManager::m_KeyPressedCode = -1;
@ -286,7 +286,7 @@ ScaleAndCenterX(float x)
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); \
CFont::SetRightJustifyOn(); \
CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT)); \
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
#define ProcessSlider(value, increaseAction, decreaseAction, hoverStartX, hoverEndX) \
do { \
@ -596,7 +596,7 @@ CMenuManager::DisplayHelperText()
CFont::SetCentreOn();
CFont::SetScale(SCREEN_SCALE_X(SMALLESTTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
// TODO: name this cases?
switch (m_nHelperTextMsgId) {
@ -732,7 +732,7 @@ CMenuManager::Draw()
nextYToUse += 24.0f + 10.0f;
}
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_X), MENU_Y(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_Y));
CFont::SetRightJustifyOff();
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
@ -788,7 +788,7 @@ CMenuManager::Draw()
columnWidth = 320;
headerHeight = 240;
lineHeight = 24;
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
@ -805,7 +805,7 @@ CMenuManager::Draw()
columnWidth = 50;
headerHeight = 0;
lineHeight = 20;
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = MEDIUMTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = MEDIUMTEXT_Y_SCALE));
CFont::SetRightJustifyOff();
break;
@ -815,7 +815,7 @@ CMenuManager::Draw()
columnWidth = 120;
headerHeight = 38;
lineHeight = 20;
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE));
CFont::SetRightJustifyOff();
break;
@ -827,7 +827,7 @@ CMenuManager::Draw()
columnWidth = 320;
headerHeight = 60;
lineHeight = 24;
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
@ -835,7 +835,7 @@ CMenuManager::Draw()
columnWidth = 320;
headerHeight = 140;
lineHeight = 24;
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
@ -843,7 +843,7 @@ CMenuManager::Draw()
columnWidth = 320;
headerHeight = 117;
lineHeight = 24;
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
@ -852,7 +852,7 @@ CMenuManager::Draw()
columnWidth = 180;
headerHeight = 60;
lineHeight = 24;
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
break;
#endif
@ -860,14 +860,14 @@ CMenuManager::Draw()
columnWidth = 320;
headerHeight = 40;
lineHeight = 24;
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
}
#ifdef PS2_LIKE_MENU
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
#endif
switch (m_nCurrScreen) {
@ -1580,7 +1580,12 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
nextX += CFont::GetStringWidth(seperator, true) + bindingMargin;
}
CFont::PrintString(nextX, nextY, settingText);
nextX += CFont::GetStringWidth(settingText, true) + bindingMargin;
#ifdef MORE_LANGUAGES
if (CFont::IsJapanese())
nextX += CFont::GetStringWidth_Jap(settingText) + bindingMargin;
else
#endif
nextX += CFont::GetStringWidth(settingText, true) + bindingMargin;
}
}
if (controllerAction == -1) {
@ -1629,7 +1634,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
}
CFont::SetCentreOn();
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
if (m_bKeyChangeNotProcessed) {
CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_CIG")); // BACKSPACE TO CLEAR - LMB,RETURN TO CHANGE
@ -1639,7 +1644,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(0);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
if (!m_bKeyIsOK)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
@ -1647,24 +1652,24 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
} else {
CFont::SetCentreOn();
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_CIG")); // BACKSPACE TO CLEAR - LMB,RETURN TO CHANGE
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
m_bKeyIsOK = false;
m_bKeyChangeNotProcessed = false;
}
} else if (optionIdx == m_nSelectedListRow) {
CFont::SetCentreOn();
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetColor(CRGBA(55, 55, 55, FadeIn(255)));
CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_EIG")); // CANNOT SET A CONTROL FOR THIS ACTION
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
}
}
}
@ -1819,7 +1824,7 @@ CMenuManager::DrawControllerSetupScreen()
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
// List header
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
CFont::SetRightJustifyOff();
CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_1_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CAC"));
@ -1827,7 +1832,7 @@ CMenuManager::DrawControllerSetupScreen()
CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CCR"));
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X_LEFT_ALIGNED(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
int yStart;
if (m_ControlMethod == CONTROL_CLASSIC)
yStart = CONTSETUP_LIST_HEADER_HEIGHT + 29;
@ -1916,7 +1921,7 @@ CMenuManager::DrawControllerSetupScreen()
}
// Back button and it's shadow
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y));
CFont::SetRightJustifyOn();
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90)));
@ -2174,7 +2179,7 @@ CMenuManager::DrawFrontEndNormal()
if (CheckHover(xStart, xStart + optionWidth, optionTop, optionBottom))
hoveredBottomBarOption = i;
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetScale(MENU_X(0.35f), MENU_Y(0.7f));
CFont::SetRightJustifyOff();
if (hoveredBottomBarOption == i && hoveredBottomBarOption != curBottomBarOption)
@ -2442,7 +2447,7 @@ CMenuManager::DrawPlayerSetupScreen()
m_pSelectedSkin->nextSkin = new tSkinInfo;
m_pSelectedSkin = m_pSelectedSkin->nextSkin;
m_pSelectedSkin->skinId = 0;
strcpy(m_pSelectedSkin->skinNameOriginal, "$$\"\"");
strcpy(m_pSelectedSkin->skinNameOriginal, DEFAULT_SKIN_NAME);
strcpy(m_pSelectedSkin->skinNameDisplayed, UnicodeToAscii(TheText.Get("FET_DSN")));
int nextSkinId = 1;
m_pSelectedSkin->nextSkin = nil;
@ -2451,7 +2456,7 @@ CMenuManager::DrawPlayerSetupScreen()
SYSTEMTIME SystemTime;
HANDLE handle = FindFirstFile("skins\\*.bmp", &FindFileData);
for (int i = 1; handle != INVALID_HANDLE_VALUE && i; i = FindNextFile(handle, &FindFileData)) {
if (strncmp(FindFileData.cFileName, "$$\"\"", 5) != 0) {
if (strncmp(FindFileData.cFileName, DEFAULT_SKIN_NAME, 5) != 0) {
m_pSelectedSkin->nextSkin = new tSkinInfo;
m_pSelectedSkin = m_pSelectedSkin->nextSkin;
m_pSelectedSkin->skinId = nextSkinId;
@ -2525,7 +2530,7 @@ CMenuManager::DrawPlayerSetupScreen()
} else {
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
}
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
CFont::SetRightJustifyOn();
CFont::PrintString(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_DATE_COLUMN_RIGHT), MENU_Y(PLAYERSETUP_LIST_TOP), TheText.Get("FES_DAT"));
@ -2544,7 +2549,7 @@ CMenuManager::DrawPlayerSetupScreen()
// Skin list
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(PLAYERSETUP_ROW_TEXT_X_SCALE), MENU_Y(PLAYERSETUP_ROW_TEXT_Y_SCALE));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
if (m_nSkinsTotal > 0) {
for (m_pSelectedSkin = m_pSkinListHead.nextSkin; m_pSelectedSkin->skinId != m_nFirstVisibleRowOnList;
m_pSelectedSkin = m_pSelectedSkin->nextSkin);
@ -2698,7 +2703,7 @@ CMenuManager::DrawPlayerSetupScreen()
// Big apply button
if (strcmp(m_aSkinName, m_PrefsSkinFile) != 0) {
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
switch (m_PrefsLanguage) {
case LANGUAGE_FRENCH:
CFont::SetScale(MENU_X(1.1f), MENU_Y(1.9f));
@ -2718,7 +2723,7 @@ CMenuManager::DrawPlayerSetupScreen()
CFont::SetRightJustifyOff();
CFont::PrintString(MENU_X_LEFT_ALIGNED(20.0f), MENU_Y(220.0f), TheText.Get("FET_APL"));
}
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(SMALLTEXT_X_SCALE), MENU_Y(SMALLTEXT_Y_SCALE));
@ -2796,7 +2801,7 @@ CMenuManager::DrawPlayerSetupScreen()
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
}
}
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(SMALLTEXT_X_SCALE), MENU_Y(SMALLTEXT_Y_SCALE));
CFont::SetRightJustifyOn();
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90)));
@ -2898,6 +2903,8 @@ CMenuManager::InitialiseChangedLanguageSettings()
CGame::frenchGame = false;
CGame::germanGame = false;
#ifdef MORE_LANGUAGES
CGame::russianGame = false;
CGame::japaneseGame = false;
switch (m_PrefsLanguage) {
case LANGUAGE_POLISH:
CFont::ReloadFonts(FONT_LANGSET_POLISH);
@ -2905,6 +2912,9 @@ CMenuManager::InitialiseChangedLanguageSettings()
case LANGUAGE_RUSSIAN:
CFont::ReloadFonts(FONT_LANGSET_RUSSIAN);
break;
case LANGUAGE_JAPANESE:
CFont::ReloadFonts(FONT_LANGSET_JAPANESE);
break;
default:
CFont::ReloadFonts(FONT_LANGSET_EFIGS);
break;
@ -2919,16 +2929,17 @@ CMenuManager::InitialiseChangedLanguageSettings()
CGame::germanGame = true;
break;
#ifdef MORE_LANGUAGES
case LANGUAGE_POLISH:
CGame::polishGame = true;
break;
case LANGUAGE_RUSSIAN:
CGame::russianGame = true;
break;
case LANGUAGE_JAPANESE:
CGame::japaneseGame = true;
break;
#endif
default:
break;
}
PcSaveHelper.PopulateSlotInfo();
}
}
@ -3094,8 +3105,8 @@ CMenuManager::LoadSettings()
if (!SkinFound) {
OutputDebugString("Default skin set as no other skins are available OR saved skin not found!");
strcpy(m_PrefsSkinFile, "$$\"\"");
strcpy(m_aSkinName, "$$\"\"");
strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME);
strcpy(m_aSkinName, DEFAULT_SKIN_NAME);
}
}
@ -3169,7 +3180,7 @@ CMenuManager::MessageScreen(const char *text)
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f));
CFont::SetRightJustifyWrap(SCREEN_SCALE_FROM_RIGHT(170.0f));
CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(120.0f), SCREEN_SCALE_Y(150.0f), SCREEN_SCALE_FROM_RIGHT(120.0f), SCREEN_SCALE_FROM_BOTTOM(220.0f)), CRGBA(50, 50, 50, 210));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetCentreSize(SCREEN_SCALE_X(380.0f));
CFont::SetCentreOn();
CFont::SetColor(CRGBA(255, 217, 106, 255));
@ -3199,7 +3210,7 @@ void
CMenuManager::PrintBriefs()
{
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why
@ -3254,7 +3265,7 @@ CMenuManager::PrintErrorMessage()
return;
CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f)), CRGBA(64, 16, 16, 224));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetBackgroundOff();
CFont::SetPropOn();
CFont::SetCentreOff();
@ -4285,6 +4296,12 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_LANG_RUS:
m_PrefsLanguage = LANGUAGE_RUSSIAN;
m_bFrontEnd_ReloadObrTxtGxt = true;
CMenuManager::InitialiseChangedLanguageSettings();
SaveSettings();
break;
case MENUACTION_LANG_JAP:
m_PrefsLanguage = LANGUAGE_JAPANESE;
m_bFrontEnd_ReloadObrTxtGxt = true;
InitialiseChangedLanguageSettings();
SaveSettings();
break;
@ -5075,7 +5092,7 @@ CMenuManager::PrintController(void)
m_aFrontEndSprites[FE_ARROWS4].Draw(MENU_X_LEFT_ALIGNED(160.0f), MENU_Y(160.0f), MENU_X(235.2f), MENU_Y(175.2f), CRGBA(255, 255, 255, 255));
}
CFont::SetFontStyle(FONT_BANK); // X
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); // X
// CFont::SetScale(0.4f, 0.4f);
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); // X
@ -5452,7 +5469,7 @@ CMenuManager::PrintMap(void)
CRGBA(235, 170, 50, 255));
CFont::SetScale(MENU_X(0.4f), MENU_Y(0.7f));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
float nextX = MENU_X(30.0f), nextY = 95.0f;

View File

@ -91,6 +91,7 @@ enum eLanguages
#ifdef MORE_LANGUAGES
LANGUAGE_POLISH,
LANGUAGE_RUSSIAN,
LANGUAGE_JAPANESE,
#endif
};
@ -368,6 +369,7 @@ enum eMenuAction
#ifdef MORE_LANGUAGES
MENUACTION_LANG_PL,
MENUACTION_LANG_RUS,
MENUACTION_LANG_JAP,
#endif
};

View File

@ -97,8 +97,8 @@ bool CGame::noProstitutes;
bool CGame::playingIntro;
char CGame::aDatFile[32];
#ifdef MORE_LANGUAGES
bool CGame::polishGame = false;
bool CGame::russianGame = false;
bool CGame::japaneseGame = false;
#endif
int gameTxdSlot;

View File

@ -17,8 +17,8 @@ public:
static bool frenchGame;
static bool germanGame;
#ifdef MORE_LANGUAGES
static bool polishGame;
static bool russianGame;
static bool japaneseGame;
#endif
static bool noProstitutes;
static bool playingIntro;

View File

@ -76,6 +76,7 @@ const CMenuScreen aScreens[] = {
#ifdef MORE_LANGUAGES
MENUACTION_LANG_PL, "FEL_POL", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_RUS, "FEL_RUS", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_JAP, "FEL_JAP", SAVESLOT_NONE, MENUPAGE_NONE,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},

View File

@ -11,6 +11,7 @@ CSprite2d CFont::Sprite[MAX_FONTS];
#ifdef MORE_LANGUAGES
uint8 CFont::LanguageSet = FONT_LANGSET_EFIGS;
int32 CFont::Slot = -1;
#define JAP_TERMINATION (0x8000 | '~')
int16 CFont::Size[LANGSET_MAX][MAX_FONTS][193] = {
{
@ -166,6 +167,26 @@ int16 CFont::Size[MAX_FONTS][193] = {
#endif
};
#ifdef MORE_LANGUAGES
int16 Size_jp[] = {
15, 14, 16, 20, 19, 26, 22, 11, 18, 18, 27, 26, 13, //; 0
19, 20, 27, 19, 15, 19, 19, 21, 19, 20, 18, 19, 15, //; 13
13, 28, 15, 32, 15, 35, 15, 19, 19, 19, 19, 17, 16, //; 26
19, 20, 15, 19, 20, 14, 17, 19, 19, 19, 19, 19, 19, //; 39
19, 19, 20, 25, 20, 19, 19, 33, 31, 39, 37, 39, 37, //; 52
21, 21, 21, 19, 17, 15, 23, 21, 15, 19, 20, 16, 19, //; 65
19, 19, 20, 20, 17, 22, 19, 22, 22, 19, 22, 22, 23, //; 78
35, 35, 35, 35, 37, 19, 19, 19, 19, 29, 19, 19, 19, //; 91
19, 19, 9, 9, 9, 9, 19, 19, 19, 19, 19, 19, 19, 19, //; 104
19, 19, 19, 19, 19, 30, 19, 19, 19, 19, 19, 10, 10, //; 118
10, 10, 19, 19, 19, 19, 19, 19, 19, 19, 19, 23, 35, //; 131
12, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, //; 144
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, //; 157
19, 19, 19, 11, 19, 19, 19, 19, 19, 19, 19, 19, 19, //; 170
19, 19, 19, 19, 19, 19, 19, 19, 19, 21
};
#endif
wchar foreign_table[128] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -197,6 +218,9 @@ CFont::Initialise(void)
case FONT_LANGSET_RUSSIAN:
CTxdStore::LoadTxd(slot, "MODELS/FONTS_R.TXD");
break;
case FONT_LANGSET_JAPANESE:
CTxdStore::LoadTxd(slot, "MODELS/FONTS_J.TXD");
break;
}
#else
CTxdStore::LoadTxd(slot, "MODELS/FONTS.TXD");
@ -205,7 +229,14 @@ CFont::Initialise(void)
CTxdStore::PushCurrentTxd();
CTxdStore::SetCurrentTxd(slot);
Sprite[0].SetTexture("font2", "font2_mask");
Sprite[1].SetTexture("pager", "pager_mask");
#ifdef MORE_LANGUAGES
if (IsJapanese()) {
Sprite[1].SetTexture("FONTJAP", "FONTJAP_mask");
Sprite[3].SetTexture("FONTJAP", "FONTJAP_mask");
}
else
#endif // MORE_LANGUAGES
Sprite[1].SetTexture("pager", "pager_mask");
Sprite[2].SetTexture("font1", "font1_mask");
SetScale(1.0f, 1.0f);
SetSlantRefPoint(SCREEN_WIDTH, 0.0f);
@ -213,8 +244,8 @@ CFont::Initialise(void)
SetColor(CRGBA(0xFF, 0xFF, 0xFF, 0));
SetJustifyOff();
SetCentreOff();
SetWrapx(640.0f);
SetCentreSize(640.0f);
SetWrapx(DEFAULT_SCREEN_WIDTH);
SetCentreSize(DEFAULT_SCREEN_WIDTH);
SetBackgroundOff();
SetBackgroundColor(CRGBA(0x80, 0x80, 0x80, 0x80));
SetBackGroundOnlyTextOff();
@ -234,6 +265,8 @@ CFont::ReloadFonts(uint8 set)
Sprite[0].Delete();
Sprite[1].Delete();
Sprite[2].Delete();
if (IsJapanese())
Sprite[3].Delete();
CTxdStore::PushCurrentTxd();
CTxdStore::RemoveTxd(Slot);
switch (set)
@ -248,10 +281,18 @@ CFont::ReloadFonts(uint8 set)
case FONT_LANGSET_RUSSIAN:
CTxdStore::LoadTxd(Slot, "MODELS/FONTS_R.TXD");
break;
case FONT_LANGSET_JAPANESE:
CTxdStore::LoadTxd(Slot, "MODELS/FONTS_J.TXD");
break;
}
CTxdStore::SetCurrentTxd(Slot);
Sprite[0].SetTexture("font2", "font2_mask");
Sprite[1].SetTexture("pager", "pager_mask");
if (set == FONT_LANGSET_JAPANESE) {
Sprite[1].SetTexture("FONTJAP", "FONTJAP_mask");
Sprite[3].SetTexture("FONTJAP", "FONTJAP_mask");
}
else
Sprite[1].SetTexture("pager", "pager_mask");
Sprite[2].SetTexture("font1", "font1_mask");
CTxdStore::PopCurrentTxd();
}
@ -266,6 +307,8 @@ CFont::Shutdown(void)
Sprite[1].Delete();
Sprite[2].Delete();
#ifdef MORE_LANGUAGES
if (IsJapanese())
Sprite[3].Delete();
CTxdStore::RemoveTxdSlot(Slot);
Slot = -1;
#else
@ -279,6 +322,10 @@ CFont::InitPerFrame(void)
Details.bank = CSprite2d::GetBank(30, Sprite[0].m_pTexture);
CSprite2d::GetBank(15, Sprite[1].m_pTexture);
CSprite2d::GetBank(15, Sprite[2].m_pTexture);
#ifdef MORE_LANGUAGES
if (IsJapanese())
CSprite2d::GetBank(15, Sprite[3].m_pTexture);
#endif
SetDropShadowPosition(0);
NewLine = 0;
}
@ -291,8 +338,15 @@ CFont::PrintChar(float x, float y, wchar c)
return;
float w = GetCharacterWidth(c) / 32.0f;
float xoff = c & 0xF;
float yoff = c >> 4;
float xoff = c % 16;
float yoff = c / 16;
#ifdef MORE_LANGUAGES
if (IsJapaneseFont()) {
w = 21.0f;
xoff = (float)(c % 48);
yoff = c / 48;
}
#endif
if(Details.style == FONT_BANK || Details.style == FONT_HEADING){
if(Details.dropShadowPosition != 0){
@ -316,19 +370,64 @@ CFont::PrintChar(float x, float y, wchar c)
(xoff+1.0f)/16.0f - 0.001f, yoff/12.8f,
xoff/16.0f, (yoff+1.0f)/12.8f - 0.002f,
(xoff+1.0f)/16.0f - 0.001f, (yoff+1.0f)/12.8f - 0.002f);
}else{
#ifdef MORE_LANGUAGES
}else if (IsJapaneseFont()) {
if (Details.dropShadowPosition != 0) {
CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank
CRect(x + SCREEN_SCALE_X(Details.dropShadowPosition),
y + SCREEN_SCALE_Y(Details.dropShadowPosition),
x + SCREEN_SCALE_X(Details.dropShadowPosition) + 32.0f * Details.scaleX * 1.0f,
y + SCREEN_SCALE_Y(Details.dropShadowPosition) + 40.0f * Details.scaleY / 2.75f),
Details.dropColor,
xoff * w / 1024.0f, yoff / 25.6f,
xoff * w / 1024.0f + (1.0f / 48.0f) - 0.001f, yoff / 25.6f,
xoff * w / 1024.0f, (yoff + 1.0f) / 25.6f,
xoff * w / 1024.0f + (1.0f / 48.0f) - 0.001f, (yoff + 1.0f) / 25.6f - 0.0001f);
}
CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank
CRect(x, y,
x + 32.0f * Details.scaleX * w,
y + 32.0f * Details.scaleY * 0.5f),
x + 32.0f * Details.scaleX * 1.0f,
y + 40.0f * Details.scaleY / 2.75f),
Details.color,
xoff * w / 1024.0f, yoff / 25.6f,
xoff * w / 1024.0f + (1.0f / 48.0f) - 0.001f, yoff / 25.6f,
xoff * w / 1024.0f, (yoff + 1.0f) / 25.6f - 0.002f,
xoff * w / 1024.0f + (1.0f / 48.0f) - 0.001f, (yoff + 1.0f) / 25.6f - 0.0001f);
#endif
}else
CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank
CRect(x, y,
x + 32.0f * Details.scaleX * w,
y + 32.0f * Details.scaleY * 0.5f),
Details.color,
xoff/16.0f, yoff/16.0f,
(xoff+w)/16.0f, yoff/16.0f,
xoff/16.0f, (yoff+1.0f)/16.0f,
(xoff+w)/16.0f - 0.0001f, (yoff+1.0f)/16.0f - 0.0001f);
}
}
#ifdef MORE_LANGUAGES
bool CFont::IsJapanesePunctuation(wchar *str)
{
return (*str == 0xE7 || *str == 0x124 || *str == 0x126 || *str == 0x128 || *str == 0x104 || *str == ',' || *str == '>' || *str == '!' || *str == 0x99 || *str == '?' || *str == ':');
}
bool CFont::IsAnsiCharacter(wchar *s)
{
if (*s >= 'A' && *s <= 'Z')
return true;
if (*s >= 'a' && *s <= 'z')
return true;
if (*s >= '0' && *s <= ':')
return true;
if (*s == '(' || *s == ')')
return true;
if (*s == 'D' || *s == '$')
return true;
return false;
}
#endif
void
CFont::PrintString(float xstart, float ystart, wchar *s)
{
@ -364,17 +463,27 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
for(;;){
if(*s == '\0')
return;
int xend = Details.centre ? Details.centreSize :
float xend = Details.centre ? Details.centreSize :
Details.rightJustify ? xstart - Details.rightJustifyWrap :
Details.wrapX;
#ifdef MORE_LANGUAGES
if (IsJapaneseFont())
xend -= SCREEN_SCALE_X(21.0f * 2.0f);
#endif
if(x + GetStringWidth(s) > xend && !first){
#ifdef MORE_LANGUAGES
if (IsJapanese() && IsJapanesePunctuation(s))
s--;
#endif
// flush line
float spaceWidth = !Details.justify || Details.centre ? 0.0f :
(Details.wrapX - lineLength) / numSpaces;
float xleft = Details.centre ? xstart - x/2 :
Details.rightJustify ? xstart - x :
xstart;
PrintString(xleft, y, start, s, spaceWidth);
#ifdef MORE_LANGUAGES
PrintString(xleft, y, start, s, spaceWidth, xstart);
#endif
// reset things
lineLength = 0.0f;
numSpaces = 0;
@ -383,7 +492,12 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
x = 0.0f;
else
x = xstart;
y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY;
#ifdef MORE_LANGUAGES
if (IsJapaneseFont())
y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY;
else
#endif
y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY;
start = s;
}else
break;
@ -397,8 +511,35 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
numSpaces++;
first = false;
x += GetStringWidth(s) + GetCharacterSize(*t - ' ');
#ifdef MORE_LANGUAGES
if (IsJapaneseFont() && IsAnsiCharacter(s))
x += 21.0f;
#endif
lineLength = x;
s = t+1;
#ifdef MORE_LANGUAGES
if (IsJapaneseFont() && !*s) {
x += GetStringWidth(s);
if (IsAnsiCharacter(s))
x += 21.0f;
float xleft = Details.centre ? xstart - x / 2 :
Details.rightJustify ? xstart - x :
xstart;
if (PrintString(xleft, y, start, s, 0.0f, xstart))
{
start = s;
if (!Details.centre && !Details.rightJustify)
x = xstart;
else
x = 0.0f;
y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY;
numSpaces = 0;
first = true;
lineLength = 0.0f;
}
}
#endif
}
// print rest
if(t[0] == ' ' && t[1] == '\0')
@ -408,7 +549,21 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
float xleft = Details.centre ? xstart - x/2 :
Details.rightJustify ? xstart - x :
xstart;
#ifdef MORE_LANGUAGES
if (PrintString(xleft, y, start, s, 0.0f, xstart) && IsJapaneseFont()) {
start = s;
if (!Details.centre && !Details.rightJustify)
x = xstart;
else
x = 0.0f;
y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY;
numSpaces = 0;
first = true;
lineLength = 0.0f;
}
#else
PrintString(xleft, y, start, s, 0.0f);
#endif
}
}
@ -418,8 +573,29 @@ CFont::GetNumberLines(float xstart, float ystart, wchar *s)
int n;
float x, y;
wchar *t;
n = 0;
#ifdef MORE_LANGUAGES
bool bSomeJapBool = false;
if (IsJapanese()) {
t = s;
wchar unused;
while (*t) {
if (*t == JAP_TERMINATION || *t == '~')
t = ParseToken(t, &unused, true);
if (NewLine) {
n++;
NewLine = false;
bSomeJapBool = true;
}
t++;
}
}
if (bSomeJapBool) n--;
#endif
if(Details.centre || Details.rightJustify)
x = 0.0f;
else
@ -427,7 +603,20 @@ CFont::GetNumberLines(float xstart, float ystart, wchar *s)
y = ystart;
while(*s){
if(x + GetStringWidth(s) > (Details.centre ? Details.centreSize : Details.wrapX)){
float f = (Details.centre ? Details.centreSize : Details.wrapX);
#ifdef MORE_LANGUAGES
if (IsJapaneseFont())
f -= SCREEN_SCALE_X(21.0f * 2.0f);
#endif
if(x + GetStringWidth(s) > f){
#ifdef MORE_LANGUAGES
if (IsJapanese())
{
if (IsJapanesePunctuation(s))
s--;
}
#endif
// reached end of line
if(Details.centre || Details.rightJustify)
x = 0.0f;
@ -435,19 +624,36 @@ CFont::GetNumberLines(float xstart, float ystart, wchar *s)
x = xstart;
n++;
// Why even?
y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY;
#ifdef MORE_LANGUAGES
if (IsJapanese())
y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY;
else
#endif
y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY;
}else{
// still space in current line
t = GetNextSpace(s);
if(*t == '\0'){
// end of string
x += GetStringWidth(s);
#ifdef MORE_LANGUAGES
if (IsJapanese() && IsAnsiCharacter(s))
x += 21.0f;
#endif
n++;
s = t;
}else{
x += GetStringWidth(s);
x += GetCharacterSize(*t - ' ');
#ifdef MORE_LANGUAGES
if (IsJapanese() && IsAnsiCharacter(s))
x += 21.0f;
#endif
s = t+1;
x += GetCharacterSize(*t - ' ');
#ifdef MORE_LANGUAGES
if (IsJapanese() && !*s)
n++;
#endif
}
}
}
@ -465,65 +671,137 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s)
maxlength = 0;
numLines = 0;
if(Details.centre || Details.rightJustify)
x = 0.0f;
else
x = xstart;
y = ystart;
while(*s){
if(x + GetStringWidth(s) > (Details.centre ? Details.centreSize : Details.wrapX)){
// reached end of line
if(x > maxlength)
maxlength = x;
if(Details.centre || Details.rightJustify)
x = 0.0f;
else
x = xstart;
numLines++;
y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY;
}else{
// still space in current line
t = GetNextSpace(s);
if(*t == '\0'){
// end of string
x += GetStringWidth(s);
#ifdef MORE_LANGUAGES
if (IsJapanese()) {
numLines = GetNumberLines(xstart, ystart, s);
}else{
#endif
if(Details.centre || Details.rightJustify)
x = 0.0f;
else
x = xstart;
y = ystart;
while(*s){
if(x + GetStringWidth(s) > (Details.centre ? Details.centreSize : Details.wrapX)){
// reached end of line
if(x > maxlength)
maxlength = x;
if(Details.centre || Details.rightJustify)
x = 0.0f;
else
x = xstart;
numLines++;
s = t;
y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY;
}else{
x += GetStringWidth(s);
x += GetCharacterSize(*t - ' ');
s = t+1;
// still space in current line
t = GetNextSpace(s);
if(*t == '\0'){
// end of string
x += GetStringWidth(s);
if(x > maxlength)
maxlength = x;
numLines++;
s = t;
}else{
x += GetStringWidth(s);
x += GetCharacterSize(*t - ' ');
s = t+1;
}
}
}
#ifdef MORE_LANGUAGES
}
#endif
if(Details.centre){
if(Details.backgroundOnlyText){
rect->left = xstart - maxlength/2 - 4.0f;
rect->right = xstart + maxlength/2 + 4.0f;
rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines +
ystart + 2.0f;
rect->top = ystart - 2.0f;
#ifdef MORE_LANGUAGES
if (IsJapaneseFont()) {
rect->bottom = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + (4.0f / 2.75f);
rect->top = ystart - (4.0f / 2.75f);
} else {
#endif
rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f;
rect->top = ystart - 2.0f;
#ifdef MORE_LANGUAGES
}
#endif
}else{
rect->left = xstart - Details.centreSize*0.5f - 4.0f;
rect->right = xstart + Details.centreSize*0.5f + 4.0f;
rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines +
ystart + 2.0f;
rect->top = ystart - 2.0f;
#ifdef MORE_LANGUAGES
if (IsJapaneseFont()) {
rect->bottom = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + (4.0f / 2.75f);
rect->top = ystart - (4.0f / 2.75f);
} else {
#endif
rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f;
rect->top = ystart - 2.0f;
#ifdef MORE_LANGUAGES
}
#endif
}
}else{
rect->left = xstart - 4.0f;
rect->right = Details.wrapX;
// WTF?
rect->bottom = ystart - 4.0f + 4.0f;
rect->top = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines +
ystart + 2.0f + 2.0f;
#ifdef MORE_LANGUAGES
if (IsJapaneseFont())
rect->top = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f + (4.0f / 2.75f);
else
#endif
rect->top = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f + 2.0f;
}
}
#ifdef MORE_LANGUAGES
bool
CFont::PrintString(float x, float y, wchar *start, wchar *&end, float spwidth, float japX)
{
wchar *s, c, unused;
if (IsJapanese()) {
float jx = 0.0f;
for (s = start; s < end; s++) {
if (*s == JAP_TERMINATION || *s == '~')
s = ParseToken(s, &unused, true);
if (NewLine) {
NewLine = false;
break;
}
jx += GetCharacterSize(*s - ' ');
}
s = start;
if (Details.centre)
x = japX - jx / 2.0f;
else if (Details.rightJustify)
x = japX - jx;
}
for (s = start; s < end; s++) {
if (*s == '~' || (IsJapanese() && *s == JAP_TERMINATION))
s = ParseToken(s, &unused);
if (NewLine && IsJapanese()) {
NewLine = false;
end = s;
return true;
}
c = *s - ' ';
if (Details.slant != 0.0f && !IsJapanese())
y = (Details.slantRefX - x) * Details.slant + Details.slantRefY;
PrintChar(x, y, c);
x += GetCharacterSize(c);
if (c == 0 && (!NewLine || !IsJapanese())) // space
x += spwidth;
}
return false;
}
#else
void
CFont::PrintString(float x, float y, wchar *start, wchar *end, float spwidth)
{
@ -541,12 +819,41 @@ CFont::PrintString(float x, float y, wchar *start, wchar *end, float spwidth)
x += spwidth;
}
}
#endif
float
CFont::GetCharacterWidth(wchar c)
{
#ifdef MORE_LANGUAGES
if (Details.proportional)
if (IsJapanese()) {
if (!Details.proportional)
return Size[0][Details.style][192];
if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_BANK) {
switch (Details.style)
{
case FONT_JAPANESE:
return Size_jp[c];
default:
return Size[0][Details.style][c];
}
}
if (c < 254 && Details.style == FONT_PAGER)
return 29.4f;
switch (Details.style)
{
case FONT_JAPANESE:
return 29.4f;
case FONT_BANK:
return 10.0f;
case FONT_PAGER:
return 31.5f;
default:
return Size[0][Details.style][c];
}
}
else if (Details.proportional)
return Size[LanguageSet][Details.style][c];
else
return Size[LanguageSet][Details.style][192];
@ -562,7 +869,36 @@ float
CFont::GetCharacterSize(wchar c)
{
#ifdef MORE_LANGUAGES
if(Details.proportional)
if (IsJapanese())
{
if (!Details.proportional)
return Size[0][Details.style][192] * Details.scaleX;
if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_BANK) {
switch (Details.style)
{
case FONT_JAPANESE:
return Size_jp[c] * Details.scaleX;
default:
return Size[0][Details.style][c] * Details.scaleX;
}
}
if (c < 254 && (Details.style == FONT_PAGER))
return 29.4f * Details.scaleX;
switch (Details.style)
{
case FONT_JAPANESE:
return 29.4f * Details.scaleX;
case FONT_BANK:
return 10.0f * Details.scaleX;
case FONT_PAGER:
return 31.5f * Details.scaleX;
default:
return Size[0][Details.style][c] * Details.scaleX;
}
}
else if(Details.proportional)
return Size[LanguageSet][Details.style][c] * Details.scaleX;
else
return Size[LanguageSet][Details.style][192] * Details.scaleX;
@ -580,33 +916,127 @@ CFont::GetStringWidth(wchar *s, bool spaces)
float w;
w = 0.0f;
for(; (*s != ' ' || spaces) && *s != '\0'; s++){
if(*s == '~'){
s++;
while(*s != '~') s++;
s++;
if(*s == ' ' && !spaces)
break;
#ifdef MORE_LANGUAGES
if (IsJapanese())
{
do
{
if ((*s != ' ' || spaces) && *s != '\0') {
do {
while (*s == '~' || *s == JAP_TERMINATION) {
s++;
while (!(*s == '~' || *s == JAP_TERMINATION)) s++;
s++;
}
w += GetCharacterSize(*s - ' ');
++s;
} while (*s == '~' || *s == JAP_TERMINATION);
}
} while (IsAnsiCharacter(s));
} else
#endif
{
for (; (*s != ' ' || spaces) && *s != '\0'; s++) {
if (*s == '~') {
s++;
while (*s != '~') s++;
s++;
if (*s == ' ' && !spaces)
break;
}
w += GetCharacterSize(*s - ' ');
}
w += GetCharacterSize(*s - ' ');
}
return w;
}
#ifdef MORE_LANGUAGES
float
CFont::GetStringWidth_Jap(wchar* s)
{
float w;
w = 0.0f;
for (; *s != '\0';) {
do {
while (*s == '~' || *s == JAP_TERMINATION) {
s++;
while (!(*s == '~' || *s == JAP_TERMINATION)) s++;
s++;
}
w += GetCharacterSize(*s - ' ');
++s;
} while (*s == '~' || *s == JAP_TERMINATION);
}
return w;
}
#endif
wchar*
CFont::GetNextSpace(wchar *s)
{
for(; *s != ' ' && *s != '\0'; s++)
if(*s == '~'){
s++;
while(*s != '~') s++;
s++;
if(*s == ' ')
break;
}
#ifdef MORE_LANGUAGES
if (IsJapanese()) {
do
{
if (*s != ' ' && *s != '\0') {
do {
while (*s == '~' || *s == JAP_TERMINATION) {
s++;
while (!(*s == '~' || *s == JAP_TERMINATION)) s++;
s++;
}
++s;
} while (*s == '~' || *s == JAP_TERMINATION);
}
} while (IsAnsiCharacter(s));
} else
#endif
{
for(; *s != ' ' && *s != '\0'; s++)
if(*s == '~'){
s++;
while(*s != '~') s++;
s++;
if(*s == ' ')
break;
}
}
return s;
}
#ifdef MORE_LANGUAGES
wchar*
CFont::ParseToken(wchar *s, wchar*, bool japShit)
{
s++;
if ((Details.color.r || Details.color.g || Details.color.b) && !japShit) {
wchar c = *s;
if (IsJapanese())
c &= 0x7FFF;
switch (c) {
case 'N':
case 'n':
NewLine = true;
break;
case 'b': SetColor(CRGBA(128, 167, 243, 255)); break;
case 'g': SetColor(CRGBA(95, 160, 106, 255)); break;
case 'h': SetColor(CRGBA(225, 225, 225, 255)); break;
case 'l': SetColor(CRGBA(0, 0, 0, 255)); break;
case 'p': SetColor(CRGBA(168, 110, 252, 255)); break;
case 'r': SetColor(CRGBA(113, 43, 73, 255)); break;
case 'w': SetColor(CRGBA(175, 175, 175, 255)); break;
case 'y': SetColor(CRGBA(210, 196, 106, 255)); break;
}
} else if (IsJapanese()) {
if ((*s & 0x7FFF) == 'N' || (*s & 0x7FFF) == 'n')
NewLine = true;
}
while ((!IsJapanese() || (*s != JAP_TERMINATION)) && *s != '~') s++;
return s + 1;
}
#else
wchar*
CFont::ParseToken(wchar *s, wchar*)
{
@ -629,6 +1059,7 @@ CFont::ParseToken(wchar *s, wchar*)
while(*s != '~') s++;
return s+1;
}
#endif
void
CFont::DrawFonts(void)
@ -636,6 +1067,10 @@ CFont::DrawFonts(void)
CSprite2d::DrawBank(Details.bank);
CSprite2d::DrawBank(Details.bank+1);
CSprite2d::DrawBank(Details.bank+2);
#ifdef MORE_LANGUAGES
if (IsJapanese())
CSprite2d::DrawBank(Details.bank+3);
#endif
}
wchar
@ -645,3 +1080,39 @@ CFont::character_code(uint8 c)
return c;
return foreign_table[c-128];
}
void
CFont::SetScale(float x, float y)
{
#ifdef MORE_LANGUAGES
/*if (IsJapanese()) {
x *= 1.35f;
y *= 1.25f;
}*/
#endif
Details.scaleX = x;
Details.scaleY = y;
}
void
CFont::SetBackgroundColor(CRGBA col)
{
Details.backgroundColor = col;
}
void
CFont::SetColor(CRGBA col)
{
Details.color = col;
if (Details.alphaFade < 255.0f)
Details.color.a *= Details.alphaFade / 255.0f;
}
void
CFont::SetDropColor(CRGBA col)
{
Details.dropColor = col;
if (Details.alphaFade < 255.0f)
Details.dropColor.a *= Details.alphaFade / 255.0f;
}

View File

@ -31,6 +31,9 @@ enum {
FONT_BANK,
FONT_PAGER,
FONT_HEADING,
#ifdef MORE_LANGUAGES
FONT_JAPANESE,
#endif
MAX_FONTS
};
@ -46,8 +49,13 @@ enum
FONT_LANGSET_EFIGS,
FONT_LANGSET_RUSSIAN,
FONT_LANGSET_POLISH,
FONT_LANGSET_JAPANESE,
LANGSET_MAX
};
#define FONT_LOCALE(style) (CFont::IsJapanese() ? FONT_JAPANESE : style)
#else
#define FONT_LOCALE(style) (style)
#endif
class CFont
@ -71,17 +79,28 @@ public:
static void PrintString(float x, float y, wchar *s);
static int GetNumberLines(float xstart, float ystart, wchar *s);
static void GetTextRect(CRect *rect, float xstart, float ystart, wchar *s);
#ifdef MORE_LANGUAGES
static bool PrintString(float x, float y, wchar *start, wchar* &end, float spwidth, float japX);
#else
static void PrintString(float x, float y, wchar *start, wchar *end, float spwidth);
#endif
static float GetCharacterWidth(wchar c);
static float GetCharacterSize(wchar c);
static float GetStringWidth(wchar *s, bool spaces = false);
static wchar *GetNextSpace(wchar *s);
static wchar *ParseToken(wchar *s, wchar*);
#ifdef MORE_LANGUAGES
static float GetStringWidth_Jap(wchar* s);
#endif
static uint16 *GetNextSpace(wchar *s);
#ifdef MORE_LANGUAGES
static uint16 *ParseToken(wchar *s, wchar*, bool japShit = false);
#else
static uint16 *ParseToken(wchar *s, wchar*);
#endif
static void DrawFonts(void);
static wchar character_code(uint8 c);
static uint16 character_code(uint8 c);
static CFontDetails GetDetails() { return Details; }
static void SetScale(float x, float y) { Details.scaleX = x; Details.scaleY = y; }
static void SetScale(float x, float y);
static void SetSlantRefPoint(float x, float y) { Details.slantRefX = x; Details.slantRefY = y; }
static void SetSlant(float s) { Details.slant = s; }
static void SetJustifyOn(void) {
@ -140,19 +159,17 @@ public:
static void SetRightJustifyWrap(float wrap) { Details.rightJustifyWrap = wrap; }
static void SetAlphaFade(float fade) { Details.alphaFade = fade; }
static void SetDropShadowPosition(int16 pos) { Details.dropShadowPosition = pos; }
static void SetBackgroundColor(CRGBA col);
static void SetColor(CRGBA col);
static void SetDropColor(CRGBA col);
// TODO: really just CRGBA but that isn't passed correctly
static void SetBackgroundColor(const CRGBA &col) { Details.backgroundColor = col; }
static void SetColor(const CRGBA &col) {
Details.color = col;
if(Details.alphaFade < 255.0f)
Details.color.a *= Details.alphaFade/255.0f;
}
static void SetDropColor(const CRGBA &col) {
Details.dropColor = col;
if(Details.alphaFade < 255.0f)
Details.dropColor.a *= Details.alphaFade/255.0f;
}
#ifdef MORE_LANGUAGES
static void ReloadFonts(uint8 set);
// japanese stuff
static bool IsAnsiCharacter(wchar* s);
static bool IsJapanesePunctuation(wchar* str);
static bool IsJapanese() { return LanguageSet == FONT_LANGSET_JAPANESE; }
static bool IsJapaneseFont() { return IsJapanese() && (Details.style == FONT_JAPANESE || Details.style == FONT_PAGER); }
#endif
};

View File

@ -660,7 +660,7 @@ void CHud::Draw()
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetPropOff();
CFont::SetBackGroundOnlyTextOn();
CFont::SetColor(CRGBA(0, 0, 0, 255));
@ -701,7 +701,7 @@ void CHud::Draw()
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetFontStyle(FONT_HEADING);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetColor(CRGBA(244, 20, 20, 255));
CFont::SetWrapx(SCREEN_SCALE_X(640.0f));
CFont::SetPropOff();
@ -852,7 +852,7 @@ void CHud::Draw()
else
CFont::SetPropOff();
CFont::SetFontStyle(CTheScripts::IntroTextLines[i].m_nFont);
CFont::SetFontStyle(FONT_LOCALE(CTheScripts::IntroTextLines[i].m_nFont));
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - CTheScripts::IntroTextLines[i].m_fAtX), SCREEN_SCALE_Y(DEFAULT_SCREEN_HEIGHT - CTheScripts::IntroTextLines[i].m_fAtY), CTheScripts::IntroTextLines[i].m_Text);
}
}
@ -892,7 +892,7 @@ void CHud::Draw()
CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.120f));
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
float offsetX = SCREEN_SCALE_X(40.0f) + SCREEN_SCALE_X(8.0f);
float center = SCREEN_SCALE_FROM_RIGHT(50.0f) - SCREEN_SCALE_X(8.0f) - offsetX;
@ -1080,13 +1080,22 @@ void CHud::DrawAfterFade()
if (CGame::germanGame)
CFont::SetScale(SCREEN_SCALE_X(0.52f * 0.85f), SCREEN_SCALE_Y(1.1f * 0.85f));
#ifdef MORE_LANGUAGES
else if (CFont::IsJapanese())
CFont::SetScale(SCREEN_SCALE_X(0.52f) * 1.35f, SCREEN_SCALE_Y(1.1f) * 1.25f);
#endif
else
CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f));
CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetJustifyOff();
CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f));
CFont::SetFontStyle(FONT_BANK);
#ifdef MORE_LANGUAGES
if (CFont::IsJapanese())
CFont::SetWrapx(SCREEN_SCALE_X(229.0f + 26.0f - 4.0f));
else
#endif
CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f));
@ -1164,7 +1173,7 @@ void CHud::DrawAfterFade()
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_X(600.0f));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]);
@ -1181,7 +1190,7 @@ void CHud::DrawAfterFade()
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]);
@ -1238,7 +1247,7 @@ void CHud::DrawAfterFade()
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
#ifdef BETA_SLIDING_TEXT
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]);

View File

@ -3,6 +3,9 @@
#include "crossplatform.h"
#include "FileMgr.h"
#ifdef MORE_LANGUAGES
#include "Game.h"
#endif
#include "GenericGameStorage.h"
#include "Messages.h"
#include "PCSave.h"
@ -131,7 +134,12 @@ C_PcSave::PopulateSlotInfo()
default: assert(0);
}
char date[70];
sprintf(date, "%02d %s %04d %02d:%02d:%02d", st.wDay, UnicodeToAsciiForSaveLoad(TheText.Get(month)), st.wYear, st.wHour, st.wMinute, st.wSecond);
#ifdef MORE_LANGUAGES
if (CGame::japaneseGame)
sprintf(date, "%02d %02d %04d %02d:%02d:%02d", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond);
else
#endif // MORE_LANGUAGES
sprintf(date, "%02d %s %04d %02d:%02d:%02d", st.wDay, UnicodeToAsciiForSaveLoad(TheText.Get(month)), st.wYear, st.wHour, st.wMinute, st.wSecond);
AsciiToUnicode(date, SlotSaveDate[i]);
} else {

View File

@ -9,6 +9,8 @@
#include "ControllerConfig.h"
#include "Font.h"
tMessage CMessages::BriefMessages[NUMBRIEFMESSAGES];
tPreviousBrief CMessages::PreviousBriefs[NUMPREVIOUSBRIEFS];
tBigMessage CMessages::BIGMessages[NUMBIGMESSAGES];
@ -50,6 +52,15 @@ CMessages::WideStringCopy(wchar *dst, wchar *src, uint16 size)
dst[i] = '\0';
}
wchar FixupChar(wchar c)
{
#ifdef MORE_LANGUAGES
if (CFont::IsJapanese())
return c & 0x7fff;
#endif
return c;
}
bool
CMessages::WideStringCompare(wchar *str1, wchar *str2, uint16 size)
{
@ -59,10 +70,10 @@ CMessages::WideStringCompare(wchar *str1, wchar *str2, uint16 size)
return false;
for (int32 i = 0; i < size; i++) {
if (!str1[i])
if (FixupChar(str1[i]) == '\0')
break;
if (str1[i] != str2[i])
if (FixupChar(str1[i]) != FixupChar(str2[i]))
return false;
}
return true;
@ -368,7 +379,12 @@ CMessages::InsertNumberInString(wchar *str, int32 n1, int32 n2, int32 n3, int32
int32 i = 0;
for (int32 c = 0; c < size;) {
#ifdef MORE_LANGUAGES
if ((CFont::IsJapanese() && str[c] == (0x8000 | '~') && str[c + 1] == (0x8000 | '1') && str[c + 2] == (0x8000 | '~')) ||
(!CFont::IsJapanese() && str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~')) {
#else
if (str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~') {
#endif
switch (i) {
case 0: sprintf(numStr, "%d", n1); break;
case 1: sprintf(numStr, "%d", n2); break;
@ -406,7 +422,13 @@ CMessages::InsertStringInString(wchar *str1, wchar *str2)
wchar *_str1 = str1;
uint16 i;
for (i = 0; i < total_size; ) {
if (*_str1 == '~' && *(_str1 + 1) == 'a' && *(_str1 + 2) == '~') {
#ifdef MORE_LANGUAGES
if ((CFont::IsJapanese() && *_str1 == (0x8000 | '~') && *(_str1 + 1) == (0x8000 | 'a') && *(_str1 + 2) == (0x8000 | '~'))
|| (CFont::IsJapanese() && *_str1 == '~' && *(_str1 + 1) == 'a' && *(_str1 + 2) == '~'))
{
#else
if (*_str1 == '~' && *(_str1 + 1) == 'a' && *(_str1 + 2) == '~') {
#endif
_str1 += 3;
for (int j = 0; j < str2_size; j++) {
tempstr[i++] = str2[j];
@ -437,7 +459,12 @@ CMessages::InsertPlayerControlKeysInString(wchar *str)
wchar *_outstr = outstr;
for (i = 0; i < strSize;) {
#ifdef MORE_LANGUAGES
if ((CFont::IsJapanese() && str[i] == (0x8000 | '~') && str[i + 1] == (0x8000 | 'k') && str[i + 2] == (0x8000 | '~')) ||
(!CFont::IsJapanese() && str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~')) {
#else
if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') {
#endif
i += 4;
for (int32 cont = 0; cont < MAX_CONTROLLERACTIONS; cont++) {
uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]);

View File

@ -1,6 +1,9 @@
#include "common.h"
#include "FileMgr.h"
#ifdef MORE_LANGUAGES
#include "Game.h"
#endif
#include "Frontend.h"
#include "Messages.h"
#include "Text.h"
@ -50,6 +53,9 @@ CText::Load(void)
case LANGUAGE_RUSSIAN:
sprintf(filename, "RUSSIAN.GXT");
break;
case LANGUAGE_JAPANESE:
sprintf(filename, "JAPANESE.GXT");
break;
#endif
}
@ -257,7 +263,7 @@ CData::Unload(void)
void
AsciiToUnicode(const char *src, wchar *dst)
{
while((*dst++ = *src++) != '\0');
while((*dst++ = (unsigned char)*src++) != '\0');
}
char*
@ -266,7 +272,11 @@ UnicodeToAscii(wchar *src)
static char aStr[256];
int len;
for(len = 0; *src != '\0' && len < 256-1; len++, src++)
#ifdef MORE_LANGUAGES
if(*src < 128 || ((CGame::russianGame || CGame::japaneseGame) && *src < 256))
#else
if(*src < 128)
#endif
aStr[len] = *src;
else
aStr[len] = '#';