From 4d4e039da7a02725729e12f6715b6b5c5f516d42 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 10:18:34 -0300 Subject: [PATCH 01/21] add an internationalization constant gather all ENGLISH|GERMAN|CHINESE etc preprocessor hell into a single library, so to restrict the number of targets that need to be built 8x this still has UB/EDITOR definitions so that still needs to be dealt with before we can build it only 8 times --- CMakeLists.txt | 2 ++ i18n/CMakeLists.txt | 4 ++++ i18n/include/language.hpp | 17 +++++++++++++++++ i18n/language.cpp | 24 ++++++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 i18n/CMakeLists.txt create mode 100644 i18n/include/language.hpp create mode 100644 i18n/language.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 139335b3..f1842724 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ include_directories( "${CMAKE_SOURCE_DIR}/Multiplayer" "${CMAKE_SOURCE_DIR}/Editor" "${CMAKE_SOURCE_DIR}/Console" + "${CMAKE_SOURCE_DIR}/i18n/include" ) # external libraries @@ -85,6 +86,7 @@ Editor Console Tactical ModularizedTacticalAI +i18n ) foreach(lib IN LISTS Ja2_Libs) add_subdirectory(${lib}) diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt new file mode 100644 index 00000000..e3100765 --- /dev/null +++ b/i18n/CMakeLists.txt @@ -0,0 +1,4 @@ +set(i18nSrc +"${CMAKE_CURRENT_SOURCE_DIR}/language.cpp" +PARENT_SCOPE +) diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp new file mode 100644 index 00000000..469d104e --- /dev/null +++ b/i18n/include/language.hpp @@ -0,0 +1,17 @@ +#pragma once + +namespace i18n { +enum class Lang +{ + en, + de, + ru, + nl, + pl, + fr, + it, + zh +}; +} + +extern const i18n::Lang g_lang; diff --git a/i18n/language.cpp b/i18n/language.cpp new file mode 100644 index 00000000..4850fbca --- /dev/null +++ b/i18n/language.cpp @@ -0,0 +1,24 @@ +#include + +/* FIXME: The ugliest of ugly hacks. Getting rid of this and letting language + * (ideally text and voice separately) be set in the options menu would be + * ideal. */ +const i18n::Lang g_lang{ + #if defined(ENGLISH) + i18n::Lang::en +#elif defined(CHINESE) + i18n::Lang::zh +#elif defined(DUTCH) + i18n::Lang::nl +#elif defined(FRENCH) + i18n::Lang::fr +#elif defined(GERMAN) + i18n::Lang::de +#elif defined(ITALIAN) + i18n::Lang::it +#elif defined(POLISH) + i18n::Lang::pl +#elif defined(RUSSIAN) + i18n::Lang::ru +#endif +}; From 3acd2cea97308548be8303e2d62d2e0373495332 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 10:22:25 -0300 Subject: [PATCH 02/21] move Ja 2 Libs.* to i18n it has preprocessor silliness in it --- i18n/CMakeLists.txt | 1 + {sgp => i18n}/Ja2 Libs.cpp | 0 {sgp => i18n/include}/Ja2 Libs.h | 0 sgp/CMakeLists.txt | 1 - 4 files changed, 1 insertion(+), 1 deletion(-) rename {sgp => i18n}/Ja2 Libs.cpp (100%) rename {sgp => i18n/include}/Ja2 Libs.h (100%) diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index e3100765..6c40cf61 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -1,4 +1,5 @@ set(i18nSrc "${CMAKE_CURRENT_SOURCE_DIR}/language.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/Ja2 Libs.cpp" PARENT_SCOPE ) diff --git a/sgp/Ja2 Libs.cpp b/i18n/Ja2 Libs.cpp similarity index 100% rename from sgp/Ja2 Libs.cpp rename to i18n/Ja2 Libs.cpp diff --git a/sgp/Ja2 Libs.h b/i18n/include/Ja2 Libs.h similarity index 100% rename from sgp/Ja2 Libs.h rename to i18n/include/Ja2 Libs.h diff --git a/sgp/CMakeLists.txt b/sgp/CMakeLists.txt index ddf04225..c1df77f3 100644 --- a/sgp/CMakeLists.txt +++ b/sgp/CMakeLists.txt @@ -14,7 +14,6 @@ set(sgpSrc "${CMAKE_CURRENT_SOURCE_DIR}/himage.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/impTGA.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/input.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/Ja2 Libs.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/LibraryDataBase.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/line.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MemMan.cpp" From 4624fe92f05c10f8b86be2b628e23aa93bf8c335 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 09:08:08 -0300 Subject: [PATCH 03/21] leave CHINESE struct member UINT8 Width[0x80] this might cause a horrifying alignment bug, but I doubt it --- sgp/WinFont.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/sgp/WinFont.cpp b/sgp/WinFont.cpp index bd046f7c..574235cf 100644 --- a/sgp/WinFont.cpp +++ b/sgp/WinFont.cpp @@ -37,9 +37,7 @@ typedef struct COLORVAL BackColor; UINT8 Height; UINT8 InternalLeading; -#ifdef CHINESE UINT8 Width[0x80]; -#endif } HWINFONT; LONG gWinFontAdjust; From 5d19c1fe2587a7660ea4c7cd49cf12ec8eb33493 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 07:19:05 -0300 Subject: [PATCH 04/21] make conditional CHINESE preprocessor def into global constant --- Strategic/Map Screen Interface Bottom.cpp | 1 + Strategic/Map Screen Interface Bottom.h | 6 ------ Strategic/mapscreen.cpp | 1 + Utils/message.cpp | 1 + i18n/include/language.hpp | 2 ++ i18n/language.cpp | 8 ++++++++ 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index 1cb96593..e045f060 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -55,6 +55,7 @@ #include "connect.h" +#include struct UILayout_BottomButtons { diff --git a/Strategic/Map Screen Interface Bottom.h b/Strategic/Map Screen Interface Bottom.h index 0c7dd8c6..aee14fc0 100644 --- a/Strategic/Map Screen Interface Bottom.h +++ b/Strategic/Map Screen Interface Bottom.h @@ -4,12 +4,6 @@ #include "types.h" #include "Soldier Control.h" - -#ifdef CHINESE //zwwoooooo: Chinese fonts relatively high , so to reduce the number of rows -#define MAX_MESSAGES_ON_MAP_BOTTOM 6 -#else -#define MAX_MESSAGES_ON_MAP_BOTTOM 9 -#endif #ifdef JA2UB extern INT8 gbExitingMapScreenToWhere; #endif diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index bdf89983..9e180ddd 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -115,6 +115,7 @@ #include "connect.h" //hayden #include "InterfaceItemImages.h" #include "vobject.h" +#include #ifdef JA2UB #include "laptop.h" diff --git a/Utils/message.cpp b/Utils/message.cpp index 2befaa26..4b09a0b9 100644 --- a/Utils/message.cpp +++ b/Utils/message.cpp @@ -22,6 +22,7 @@ #include "GameSettings.h" #include "sgp_logger.h" +#include typedef struct { UINT32 uiFont; diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index 469d104e..c1b3e468 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -15,3 +15,5 @@ enum class Lang } extern const i18n::Lang g_lang; + +extern const int MAX_MESSAGES_ON_MAP_BOTTOM; diff --git a/i18n/language.cpp b/i18n/language.cpp index 4850fbca..1368db18 100644 --- a/i18n/language.cpp +++ b/i18n/language.cpp @@ -22,3 +22,11 @@ const i18n::Lang g_lang{ i18n::Lang::ru #endif }; + +const int MAX_MESSAGES_ON_MAP_BOTTOM{ +#if defined(CHINESE) // zwwoooooo: Chinese fonts relatively high , so to reduce the number of rows + 6 +#else + 9 +#endif +}; From bf6de9f3422f7bfdababa5b4f292bf0dea83c1c8 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 07:45:38 -0300 Subject: [PATCH 05/21] Move GetLanguagePrefix function into i18n --- Ja2/Init.cpp | 30 ++---------------------------- Tactical/XML.h | 8 -------- i18n/include/language.hpp | 4 ++++ i18n/language.cpp | 22 ++++++++++++++++++++++ 4 files changed, 28 insertions(+), 36 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index 44a90d76..1d803358 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -78,6 +78,8 @@ #include "DynamicDialogueWidget.h" // added by Flugente for InitMyBoxes() #include "Animation Data.h" // added by Flugente +#include + extern INT16 APBPConstants[TOTAL_APBP_VALUES] = {0}; extern INT16 gubMaxActionPoints[TOTALBODYTYPES];//MAXBODYTYPES = 28... JUST GETTING IT TO WORK NOW. GOTTHARD 7/2/08 extern BOOLEAN GetCDromDriveLetter( STR8 pString ); @@ -134,34 +136,6 @@ static void AddLanguagePrefix(STR fileName, const STR language) memmove( fileComponent, language, strlen( language) ); } -static const STR GetLanguagePrefix() -{ -#ifdef ENGLISH - return ""; -#endif -#ifdef GERMAN - return GERMAN_PREFIX; -#endif -#ifdef RUSSIAN - return RUSSIAN_PREFIX; -#endif -#ifdef DUTCH - return DUTCH_PREFIX; -#endif -#ifdef POLISH - return POLISH_PREFIX; -#endif -#ifdef FRENCH - return FRENCH_PREFIX; -#endif -#ifdef ITALIAN - return ITALIAN_PREFIX; -#endif -#ifdef CHINESE - return CHINESE_PREFIX; -#endif -} - static void AddLanguagePrefix(STR fileName) { AddLanguagePrefix( fileName, GetLanguagePrefix()); diff --git a/Tactical/XML.h b/Tactical/XML.h index 963417ef..d1ab96b9 100644 --- a/Tactical/XML.h +++ b/Tactical/XML.h @@ -58,14 +58,6 @@ typedef PARSE_STAGE; #define TABLEDATA_DIRECTORY "TableData\\" #define TABLEDATA_LAPTOP_DIRECTORY "Laptop\\" -#define GERMAN_PREFIX "German." -#define RUSSIAN_PREFIX "Russian." -#define DUTCH_PREFIX "Dutch." -#define POLISH_PREFIX "Polish." -#define FRENCH_PREFIX "French." -#define ITALIAN_PREFIX "Italian." -#define CHINESE_PREFIX "Chinese." - #define ATTACHMENTSFILENAME "Items\\Attachments.xml" #define ATTACHMENTINFOFILENAME "Items\\AttachmentInfo.xml" #define ITEMSFILENAME "Items\\Items.xml" diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index c1b3e468..bd895bcc 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -1,5 +1,7 @@ #pragma once +#include + namespace i18n { enum class Lang { @@ -17,3 +19,5 @@ enum class Lang extern const i18n::Lang g_lang; extern const int MAX_MESSAGES_ON_MAP_BOTTOM; + +auto GetLanguagePrefix() -> const STR; diff --git a/i18n/language.cpp b/i18n/language.cpp index 1368db18..555b33c2 100644 --- a/i18n/language.cpp +++ b/i18n/language.cpp @@ -30,3 +30,25 @@ const int MAX_MESSAGES_ON_MAP_BOTTOM{ 9 #endif }; + +auto GetLanguagePrefix() -> const STR { + return +#if defined(ENGLISH) + "" +#elif defined(CHINESE) + "Chinese." +#elif defined(DUTCH) + "Dutch." +#elif defined(FRENCH) + "French." +#elif defined(GERMAN) + "German." +#elif defined(ITALIAN) + "Italian." +#elif defined(POLISH) + "Polish." +#elif defined(RUSSIAN) + "Russian." +#endif + ; +} From cd69f5f3aeabd64816fd02d7308407451bf6ecad Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 08:36:59 -0300 Subject: [PATCH 06/21] Make Chinese specific strings compile-time instead of conditional eventually we'll switch between CHINESE and other languages during runtime, so even if language is not chinese, these symbols must still be there these symbol names aren't used so this is fine --- Utils/Text.h | 24 ++++++++++++------------ Utils/_ChineseText.cpp | 14 -------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/Utils/Text.h b/Utils/Text.h index a71e194d..8d32695a 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -2584,18 +2584,18 @@ extern STR16 MPServerMessage[]; extern STR16 MPClientMessage[]; // WANNE: Some Chinese specific strings that needs to be in unicode! -extern STR16 ChineseSpecString1; -extern STR16 ChineseSpecString2; -extern STR16 ChineseSpecString3; -extern STR16 ChineseSpecString4; -extern STR16 ChineseSpecString5; -extern STR16 ChineseSpecString6; -extern STR16 ChineseSpecString7; -extern STR16 ChineseSpecString8; -extern STR16 ChineseSpecString9; -extern STR16 ChineseSpecString10; -extern STR16 ChineseSpecString11; -extern STR16 ChineseSpecString12; +inline constexpr STR16 ChineseSpecString1 = L"%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString2 = L"*%3d%ï¼…%%"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString3 = L"%d%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString4 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString5 = L"%s [%d%ï¼…]\n%s %d\n%s %d\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString6 = L"%s [%d%ï¼…]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString7 = L"%s [%d%ï¼…]\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString8 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente +inline constexpr STR16 ChineseSpecString9 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString10 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString11 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString12 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente enum { diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 622b69f5..3b7f881c 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -12159,18 +12159,4 @@ STR16 szRobotText[] = L"机器人附加%s技能效果。", //L"The robot gains the benefit of the %s skill trait.", }; -// WANNE: Some Chinese specific strings that needs to be in unicode! -STR16 ChineseSpecString1 = L"%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString2 = L"*%3d%ï¼…%%"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString3 = L"%d%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString4 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; -STR16 ChineseSpecString5 = L"%s [%d%ï¼…]\n%s %d\n%s %d\n%s %1.1f %s"; -STR16 ChineseSpecString6 = L"%s [%d%ï¼…]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; -STR16 ChineseSpecString7 = L"%s [%d%ï¼…]\n%s %1.1f %s"; -STR16 ChineseSpecString8 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente -STR16 ChineseSpecString9 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString10 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString11 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString12 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente - #endif //CHINESE From d008d10b31bd311f742334a2268e8b4be375c0c4 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 08:07:47 -0300 Subject: [PATCH 07/21] Replace a ton of trivial #ifdefs with runtime checks This one is big, but unless I missed something, should be all be trivial. scripted-diff with the following, then manually tweaked whatever needed: ``` if [ $# -ne 3 ]; then echo "Usage: $0 '' '' ''" exit 1 fi pattern="$1" replacement="$2" filename="$3" if [ ! -f "$filename" ]; then echo "Error: File $filename does not exist." exit 1 fi sed -i '/'"$pattern"'/ { :loop $ !{ N /'"$pattern"'.*\n.*#endif/ { s/'"$pattern"'/'"$replacement"'/ s/#else/} else {/ s/#endif/}/ P D } /'"$pattern"'/ b loop } }' "$filename" echo "Replacement complete in $filename" ``` h/t to Grok2 for the sed command --- Ja2/Init.cpp | 148 ++++---- Ja2/Intro.cpp | 7 +- Ja2/JA2 Splash.cpp | 7 +- Ja2/SaveLoadGame.cpp | 9 +- Ja2/jascreens.cpp | 7 +- Laptop/AimMembers.cpp | 7 +- Laptop/BobbyRGuns.cpp | 7 +- Laptop/BobbyRMailOrder.cpp | 13 +- Laptop/IMP Text System.cpp | 7 +- Strategic/Map Screen Interface Map.cpp | 13 +- Strategic/Strategic Town Loyalty.cpp | 7 +- Strategic/mapscreen.cpp | 18 +- Tactical/Handle Doors.cpp | 7 +- Tactical/Interface Enhanced.cpp | 499 +++++++++++++------------ Tactical/Interface Items.cpp | 13 +- Tactical/Interface Panels.cpp | 20 +- sgp/WinFont.cpp | 15 +- sgp/sgp.cpp | 5 +- 18 files changed, 413 insertions(+), 396 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index 1d803358..bf74dbf3 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -228,7 +228,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, AMMOFILENAME); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) @@ -242,9 +242,9 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, AMMOFILENAME); SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME); } -#else +} else { SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME); -#endif +} // Lesh: added this, begin strcpy(fileName, directoryName); @@ -268,14 +268,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) // the uiIndex (for reference), szItemName, szLongItemName, szItemDesc, szBRName, and szBRDesc tags -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInItemStats(fileName,TRUE), fileName); } -#endif +} //if(!WriteItemStats()) // return FALSE; @@ -340,14 +340,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat( fileName, DISEASEFILENAME ); SGP_THROW_IFFALSE( ReadInDiseaseStats( fileName,FALSE ), DISEASEFILENAME ); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInDiseaseStats(fileName,TRUE), DISEASEFILENAME); } -#endif +} strcpy(fileName, directoryName); strcat(fileName, STRUCTUREDECONSTRUCTFILENAME); @@ -385,14 +385,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, LOADSCREENHINTSFILENAME); SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName, FALSE),LOADSCREENHINTSFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName,TRUE), fileName); } - #endif + } strcpy(fileName, directoryName); strcat(fileName, ARMOURSFILENAME); @@ -422,14 +422,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) } } -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInLBEPocketStats(fileName,TRUE), fileName); } -#endif +} // THE_BOB : added for pocket popup definitions LBEPocketPopup.clear(); @@ -437,7 +437,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, LBEPOCKETPOPUPFILENAME); SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if (FileExists(fileName)) @@ -452,10 +452,10 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, LBEPOCKETPOPUPFILENAME); SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); } -#else +} else { // WANNE: Load english file SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); -#endif +} #ifdef JA2UB @@ -471,14 +471,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, MERCSTARTINGGEARFILENAME); SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName, FALSE), MERCSTARTINGGEARFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName,TRUE), fileName); } - #endif + } #endif @@ -495,14 +495,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, ATTACHMENTSLOTSFILENAME); SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName, FALSE),ATTACHMENTSLOTSFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName,TRUE), fileName); } - #endif + } // Flugente: created separate gun and item choices for different soldier classes - read in different xmls strcpy(fileName, directoryName); @@ -676,14 +676,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, CITYTABLEFILENAME); SGP_THROW_IFFALSE(ReadInMapStructure(fileName, FALSE),CITYTABLEFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInStrategicMapSectorTownNames(fileName,TRUE), fileName); } -#endif +} // Lesh: Strategic movement costs will be read in Strategic\Strategic Movement Costs.cpp, // function BOOLEAN InitStrategicMovementCosts(); @@ -734,14 +734,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, FALSE),SHIPPINGDESTINATIONSFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, TRUE),fileName); } -#endif +} strcpy(fileName, directoryName); strcat(fileName, DELIVERYMETHODSFILENAME); @@ -754,14 +754,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,FALSE), FACILITYTYPESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,TRUE), fileName); } -#endif +} // HEADROCK HAM 3.4: Read in facility locations strcpy(fileName, directoryName); @@ -775,14 +775,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSectorNames(fileName,FALSE,0), SECTORNAMESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSectorNames(fileName,TRUE, 0), fileName); } -#endif +} // HEADROCK HAM 5: Read in Coolness by Sector strcpy(fileName, directoryName); @@ -804,7 +804,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME25); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { @@ -812,7 +812,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) if(!ReadInMercProfiles(fileName,TRUE)) return FALSE; } - #endif + } } strcpy(fileName, directoryName); @@ -830,14 +830,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName,TRUE), fileName); } - #endif + } // HEADROCK PROFEX: Read in Merc Opinion data to replace PROF.DAT data strcpy(fileName, directoryName); @@ -900,14 +900,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,FALSE), ENEMYNAMESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,TRUE), fileName); } -#endif +} } @@ -919,14 +919,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,FALSE), CIVGROUPNAMESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,TRUE), fileName); } -#endif +} } @@ -936,14 +936,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,FALSE), EMAILSENDERNAMELIST); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,TRUE), fileName); } -#endif +} if (gGameExternalOptions.fEnemyRank == TRUE) { @@ -953,14 +953,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,FALSE), ENEMYRANKFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,TRUE), fileName); } -#endif +} } // Flugente: backgrounds @@ -969,14 +969,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,FALSE), BACKGROUNDSFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,TRUE), BACKGROUNDSFILENAME); } -#endif +} // Flugente: individual militia strcpy( fileName, directoryName ); @@ -990,14 +990,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,FALSE), CAMPAIGNSTATSEVENTSFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,TRUE), CAMPAIGNSTATSEVENTSFILENAME); } -#endif +} // WANNE: Only in a singleplayer game... // Externalised taunts @@ -1018,14 +1018,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, FileInfo.zFileName); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName); } - #endif + } while( GetFileNext(&FileInfo) ) { strcpy(fileName, directoryName); @@ -1033,14 +1033,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, FileInfo.zFileName); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName); } - #endif + } } GetFileClose(&FileInfo); } @@ -1052,14 +1052,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInHistorys(fileName,FALSE), HISTORYNAMEFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInHistorys(fileName,TRUE), fileName); } -#endif +} // IMP Portraits List by Jazz strcpy(fileName, directoryName); @@ -1067,14 +1067,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,FALSE), IMPPORTRAITS); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,TRUE), fileName); } -#endif +} LoadIMPPortraitsTEMP( ); @@ -1159,14 +1159,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) SGP_THROW_IFFALSE(ReadInFaceGear(zNewFaceGear, fileName), FACEGEARFILENAME); //WriteFaceGear(); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercAvailability(fileName,TRUE), fileName); } -#endif +} UINT32 i; for(i=0; i BOOLEAN Style_JA = TRUE; extern INT8 Test = 0; @@ -726,11 +727,11 @@ void DisplaySirtechSplashScreen() * (2006-10-10, Sergeant_Kolja) */ #ifdef _DEBUG - # if defined(ENGLISH) + if( g_lang == i18n::Lang::en ) { AssertMsg( 0, String( "Wheter English nor German works. May be You built English - but have only German or other foreign Disk?" ) ); - # elif defined(GERMAN) + } else if( g_lang == i18n::Lang::de ) { AssertMsg( 0, String( "Weder Englisch noch Deutsch geht. Deutsche Version kompiliert und mit englischer CDs gestartet? Das geht nicht!" ) ); - # endif + } #endif AssertMsg( 0, String( "Failed to load %s", VObjectDesc.ImageFile ) ); return; diff --git a/Ja2/JA2 Splash.cpp b/Ja2/JA2 Splash.cpp index 4ef6714a..c7d9634d 100644 --- a/Ja2/JA2 Splash.cpp +++ b/Ja2/JA2 Splash.cpp @@ -5,6 +5,7 @@ #include "Timer Control.h" #include "Multi Language Graphic Utils.h" #include +#include UINT32 guiSplashFrameFade = 10; UINT32 guiSplashStartTime = 0; @@ -13,10 +14,10 @@ extern HVSURFACE ghFrameBuffer; //Simply create videosurface, load image, and draw it to the screen. void InitJA2SplashScreen() { -#ifdef ENGLISH +if( g_lang == i18n::Lang::en ) { ClearMainMenu(); -#else +} else { UINT32 uiLogoID = 0; HVSURFACE hVSurface; // unused jonathanl // lalien reenabled for international versions VSURFACE_DESC VSurfaceDesc; //unused jonathanl // lalien reenabled for international versions @@ -69,7 +70,7 @@ void InitJA2SplashScreen() GetVideoSurface( &hVSurface, uiLogoID ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLogoID ); -#endif // ENGLISH +} // ENGLISH InvalidateScreen(); RefreshScreen( NULL ); diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index dc30a1e7..a0dd2cb5 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -152,6 +152,7 @@ #endif #include "LuaInitNPCs.h" +#include #ifdef JA2UB @@ -7205,7 +7206,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) } } -#ifdef GERMAN +if( g_lang == i18n::Lang::de ) { // Fix neutral flags if ( guiCurrentSaveGameVersion < 94 ) { @@ -7215,7 +7216,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) Menptr[ cnt].aiData.bNeutral = FALSE; } } -#endif +} //#ifdef JA2UB //if the soldier has the NON weapon version of the merc knofe or merc umbrella //ConvertWeapons( &Menptr[ cnt ] ); @@ -9896,9 +9897,9 @@ UINT32 CalcJA2EncryptionSet( SAVED_GAME_HEADER * pSaveGameHeader ) } } - #ifdef GERMAN + if( g_lang == i18n::Lang::de ) { uiEncryptionSet *= 11; - #endif + } uiEncryptionSet = uiEncryptionSet % 10; diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index 4e1d8897..87d04505 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -48,6 +48,7 @@ #include "IniReader.h" #include "sgp_logger.h" +#include #define _UNICODE // Networking Stuff @@ -331,7 +332,7 @@ UINT32 InitScreenHandle(void) if ( ubCurrentScreen == 255 ) { - #ifdef ENGLISH + if( g_lang == i18n::Lang::en ) { if( gfDoneWithSplashScreen ) { ubCurrentScreen = 0; @@ -341,9 +342,9 @@ UINT32 InitScreenHandle(void) SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); return( INTRO_SCREEN ); } - #else + } else { ubCurrentScreen = 0; - #endif + } } if ( ubCurrentScreen == 0 ) diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index 05d63151..0c1e2f37 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -49,6 +49,7 @@ #include "Encrypted File.h" #include "InterfaceItemImages.h" #include +#include // //****** Defines ****** @@ -5461,20 +5462,20 @@ void DisplayPopUpBoxExplainingMercArrivalLocationAndTime( ) //create the string to display to the user, looks like.... // L"%s should arrive at the designated drop-off point ( sector %d:%d %s ) on day %d, at approximately %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival -#ifdef GERMAN +if( g_lang == i18n::Lang::de ) { //Germans version has a different argument order swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], gMercProfiles[ pSoldier->ubProfile ].zNickname, LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, zTimeString, zSectorIDString ); -#else +} else { swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], gMercProfiles[ pSoldier->ubProfile ].zNickname, zSectorIDString, LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, zTimeString ); -#endif +} diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index d336e436..ac9855fc 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -20,6 +20,7 @@ // HEADROCK HAM 4 #include "input.h" #include "Encyclopedia_new.h" //update encyclopedia item visibility when viewing that item + #include #define BOBBYR_DEFAULT_MENU_COLOR 255 @@ -2516,11 +2517,11 @@ void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex, //if it's a used item, display how damaged the item is if( fUsed ) { - #ifdef CHINESE + if ( g_lang == i18n::Lang::zh ) { swprintf( sTemp, ChineseSpecString2, LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality );//zww - #else + } else { swprintf( sTemp, L"*%3d%%%%", LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality ); - #endif + } DrawTextToScreen(sTemp, (UINT16)(BOBBYR_ITEM_NAME_X-2), (UINT16)(usPosY - BOBBYR_ORDER_NUM_Y_OFFSET), BOBBYR_ORDER_NUM_WIDTH, BOBBYR_ITEM_NAME_TEXT_FONT, BOBBYR_ITEM_NAME_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } diff --git a/Laptop/BobbyRMailOrder.cpp b/Laptop/BobbyRMailOrder.cpp index a7610e23..a145c7a7 100644 --- a/Laptop/BobbyRMailOrder.cpp +++ b/Laptop/BobbyRMailOrder.cpp @@ -30,6 +30,7 @@ #include "GameSettings.h" #include #include +#include /* typedef struct @@ -488,11 +489,11 @@ BOOLEAN EnterBobbyRMailOrder() SetButtonCursor(guiBobbyRClearOrder, CURSOR_LAPTOP_SCREEN); SpecifyDisabledButtonStyle( guiBobbyRClearOrder, DISABLED_STYLE_NONE ); //inshy: fix position of text for buttons -#ifdef FRENCH +if(g_lang == i18n::Lang::fr) { SpecifyButtonTextOffsets( guiBobbyRClearOrder, 13, 10, TRUE ); -#else +} else { SpecifyButtonTextOffsets( guiBobbyRClearOrder, 39, 10, TRUE ); -#endif +} // Accept Order button guiBobbyRAcceptOrderImage = LoadButtonImage("LAPTOP\\AcceptOrderButton.sti", 2,0,-1,1,-1 ); @@ -504,11 +505,11 @@ BOOLEAN EnterBobbyRMailOrder() DEFAULT_MOVE_CALLBACK, BtnBobbyRAcceptOrderCallback); SetButtonCursor( guiBobbyRAcceptOrder, CURSOR_LAPTOP_SCREEN); //inshy: fix position of text for buttons -#ifdef FRENCH +if(g_lang == i18n::Lang::fr) { SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 15, 24, TRUE ); -#else +} else { SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 43, 24, TRUE ); -#endif +} SpecifyDisabledButtonStyle( guiBobbyRAcceptOrder, DISABLED_STYLE_SHADED ); if( gbSelectedCity == -1 ) diff --git a/Laptop/IMP Text System.cpp b/Laptop/IMP Text System.cpp index 4fd013b8..9555ef80 100644 --- a/Laptop/IMP Text System.cpp +++ b/Laptop/IMP Text System.cpp @@ -38,6 +38,7 @@ #include "GameSettings.h" #endif +#include #define IMP_SEEK_AMOUNT 5 * 80 * 2 @@ -204,18 +205,18 @@ void PrintImpText( void ) LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 81, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_6, FONT14ARIAL, FONT_BLACK, FALSE, 0); //inshy (18.01.2009): fix position for russian text - #ifdef RUSSIAN + if( g_lang == i18n::Lang::ru ) { // male LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 225, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0); // female LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 335, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0); - #else + } else { // male LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 240, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0); // female LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 360, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0); - #endif + } break; case ( IMP_PERSONALITY ): diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 0ec76fd7..73af166a 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -56,6 +56,7 @@ #include "MilitiaSquads.h" #include "LaptopSave.h" +#include // added by Flugente extern CHAR16 gzSectorNames[256][4][MAX_SECTOR_NAME_LENGTH]; @@ -1199,11 +1200,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen1"); // don't show loyalty string until loyalty tracking for that town has been started if( gTownLoyalty[ bTown ].fStarted && gfTownUsesLoyalty[ bTown ]) { - #ifdef CHINESE + if ( g_lang == i18n::Lang::zh ) { swprintf( sStringA, L"%d%£¥%% %s", gTownLoyalty[ bTown ].ubRating, gsLoyalString[ 0 ]); - #else + } else { swprintf( sStringA, L"%d%%%% %s", gTownLoyalty[ bTown ].ubRating, gsLoyalString[ 0 ]); - #endif + } // if loyalty is too low to train militia, and militia training is allowed here if ( ( gTownLoyalty[ bTown ].ubRating < iMinLoyaltyToTrain ) && MilitiaTrainingAllowedInTown( bTown ) ) @@ -4873,11 +4874,11 @@ void BlitMineText( INT16 sMapX, INT16 sMapY ) // if potential is not nil, show percentage of the two if (GetMaxPeriodicRemovalFromMine(ubMineIndex) > 0) { - #ifdef CHINESE + if ( g_lang == i18n::Lang::zh ) { swprintf( wSubString, L" (%d%£¥%%)", (PredictDailyIncomeFromAMine(ubMineIndex, TRUE) * 100 ) / GetMaxDailyRemovalFromMine(ubMineIndex) ); - #else + } else { swprintf( wSubString, L" (%d%%%%)", (PredictDailyIncomeFromAMine(ubMineIndex, TRUE) * 100 ) / GetMaxDailyRemovalFromMine(ubMineIndex) ); - #endif + } wcscat( wString, wSubString ); } diff --git a/Strategic/Strategic Town Loyalty.cpp b/Strategic/Strategic Town Loyalty.cpp index d4542de0..9de36dc0 100644 --- a/Strategic/Strategic Town Loyalty.cpp +++ b/Strategic/Strategic Town Loyalty.cpp @@ -40,6 +40,7 @@ #include "Luaglobal.h" #include "LuaInitNPCs.h" #include "Interface.h" +#include #include "GameInitOptionsScreen.h" extern WorldItems gAllWorldItems; @@ -1631,12 +1632,12 @@ void AdjustLoyaltyForCivsEatenByMonsters( INT16 sSectorX, INT16 sSectorY, UINT8 swprintf( str, gpStrategicString[STR_PB_BANDIT_KILLCIVS_IN_SECTOR], ubHowMany, pSectorString ); else { -#ifdef CHINESE +if( g_lang == i18n::Lang::zh ) { //diffrent order of words in Chinese swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], pSectorString, ubHowMany ); -#else +} else { swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], ubHowMany, pSectorString ); -#endif +} } DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 9e180ddd..bdd2a631 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -9665,27 +9665,27 @@ void BltCharInvPanel() // print armor/weight/camo labels mprintf(UI_CHARINV.Text.ArmorLabel.iX, UI_CHARINV.Text.ArmorLabel.iY, pInvPanelTitleStrings[ 0 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, ChineseSpecString1 ); - #else + } else { mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, L"%%" ); - #endif + } mprintf(UI_CHARINV.Text.WeightLabel.iX, UI_CHARINV.Text.WeightLabel.iY, pInvPanelTitleStrings[ 1 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, ChineseSpecString1 ); - #else + } else { mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, L"%%" ); - #endif + } mprintf(UI_CHARINV.Text.CamoLabel.iX, UI_CHARINV.Text.CamoLabel.iY, pInvPanelTitleStrings[ 2 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, ChineseSpecString1 ); - #else + } else { mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, L"%%" ); - #endif + } const auto width = UI_CHARINV.Text.PercentWidth; const auto height = UI_CHARINV.Text.PercentHeight; diff --git a/Tactical/Handle Doors.cpp b/Tactical/Handle Doors.cpp index 4d63103b..ba62ff48 100644 --- a/Tactical/Handle Doors.cpp +++ b/Tactical/Handle Doors.cpp @@ -33,6 +33,7 @@ #include "GameSettings.h" #include "fresh_header.h" #include "connect.h" +#include #ifdef JA2UB #include "Explosion Control.h" @@ -1492,7 +1493,7 @@ void SetDoorString( INT32 sGridNo ) // ATE: If here, we try to say, opened or closed... if ( gfUIIntTileLocation2 == FALSE ) { -#ifdef GERMAN +if( g_lang == i18n::Lang::de ) { wcscpy( gzIntTileLocation2, TacticalStr[ DOOR_DOOR_MOUSE_DESCRIPTION ] ); gfUIIntTileLocation2 = TRUE; @@ -1535,7 +1536,7 @@ void SetDoorString( INT32 sGridNo ) gfUIIntTileLocation = TRUE; } } -#else +} else { // Try to get doors status here... pDoorStatus = GetDoorStatus( sGridNo ); @@ -1576,7 +1577,7 @@ void SetDoorString( INT32 sGridNo ) } } -#endif +} } } diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index f992338c..37fc0757 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -54,6 +54,7 @@ #include "Food.h" // added by Flugente #include "Multi Language Graphic Utils.h" +#include //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -6586,11 +6587,11 @@ void DrawPropertyValueInColour( INT16 iValue, UINT8 ubNumLine, UINT8 ubNumRegion if( fPercentSign && wcscmp( pStr, L"--" ) != 0 && wcscmp( pStr, L"=" ) != 0 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } mprintf( usX, usY, pStr ); @@ -6681,11 +6682,11 @@ void DrawPropertyValueInColour_X( INT16 iValue, UINT8 numBullets, UINT8 ubNumLin if ( fPercentSign && wcscmp( pStr, L"--" ) != 0 && wcscmp( pStr, L"=" ) != 0 ) { -#ifdef CHINESE +if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); -#else +} else { wcscat( pStr, L"%" ); -#endif +} } mprintf( usX, usY, pStr ); @@ -10356,11 +10357,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10368,11 +10369,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10484,11 +10485,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10496,11 +10497,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10612,11 +10613,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10624,11 +10625,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10745,11 +10746,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10757,11 +10758,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10816,11 +10817,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10828,11 +10829,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode && cnt2 != 1 ) { @@ -10888,11 +10889,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10900,11 +10901,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10958,11 +10959,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10970,11 +10971,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11027,11 +11028,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11039,11 +11040,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11096,11 +11097,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11108,11 +11109,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11520,11 +11521,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11532,11 +11533,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11764,11 +11765,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11776,11 +11777,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11833,11 +11834,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11845,11 +11846,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11961,11 +11962,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11973,11 +11974,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12031,11 +12032,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12043,11 +12044,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12101,11 +12102,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12113,11 +12114,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12171,11 +12172,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12183,11 +12184,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12241,11 +12242,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12253,11 +12254,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12490,11 +12491,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] > 0) { @@ -12502,11 +12503,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12679,11 +12680,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12691,11 +12692,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12749,11 +12750,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12761,11 +12762,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12819,11 +12820,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12831,11 +12832,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12889,11 +12890,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12901,11 +12902,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12959,11 +12960,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12971,11 +12972,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13029,11 +13030,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13041,11 +13042,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13099,11 +13100,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13111,11 +13112,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13169,11 +13170,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13181,11 +13182,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13239,11 +13240,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13251,11 +13252,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13309,11 +13310,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13321,11 +13322,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13379,11 +13380,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13391,11 +13392,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13449,11 +13450,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13461,11 +13462,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13538,11 +13539,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13551,11 +13552,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13615,11 +13616,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13628,11 +13629,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13692,11 +13693,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13705,11 +13706,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13769,11 +13770,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13782,11 +13783,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13843,11 +13844,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13856,11 +13857,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13917,11 +13918,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13930,11 +13931,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13988,11 +13989,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14001,11 +14002,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14059,11 +14060,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14072,11 +14073,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14130,11 +14131,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14143,11 +14144,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14211,11 +14212,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14224,11 +14225,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14594,11 +14595,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) if( !( fComparisonMode && iModifier[0] == 0 ) ) { wcscat( pStr, L"%" ); -#ifdef CHINESE +if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); -#else +} else { wcscat( pStr, L"%" ); -#endif +} } mprintf( usX, usY, pStr ); } diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 78f7933d..87cc1279 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -82,6 +82,7 @@ #include "Sound Control.h" #include "Multi Language Graphic Utils.h" +#include #ifdef JA2UB #include "Ja25_Tactical.h" @@ -7409,11 +7410,11 @@ void RenderItemDescriptionBox( ) FindFontRightCoordinates( gODBItemDescRegions[0][0].sLeft, gODBItemDescRegions[0][0].sTop, gODBItemDescRegions[0][0].sRight - gODBItemDescRegions[0][0].sLeft, gODBItemDescRegions[0][0].sBottom - gODBItemDescRegions[0][0].sTop ,pStr, BLOCKFONT2, &usX, &usY); } - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%%" ); - #endif + } mprintf( usX, usY, pStr ); } @@ -11178,11 +11179,11 @@ void SetupPickupPage( INT8 bPage ) } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString3, sValue ); - #else + } else { swprintf( pStr, L"%d%%", sValue ); - #endif + } } SetRegionFastHelpText( &(gItemPickupMenu.Regions[ cnt - iStart ]), pStr ); diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 13d9d2cb..5eb07868 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -73,6 +73,8 @@ //legion by Jazz #include "Interface Utils.h" +#include + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -2747,27 +2749,27 @@ void RenderSMPanel( BOOLEAN *pfDirty ) mprintf( SM_ARMOR_LABEL_X - StringPixLength( pInvPanelTitleStrings[0], BLOCKFONT2 ) / 2, SM_ARMOR_LABEL_Y, pInvPanelTitleStrings[ 0 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf( SM_ARMOR_PERCENT_X, SM_ARMOR_PERCENT_Y, ChineseSpecString1 ); - #else + } else { mprintf( SM_ARMOR_PERCENT_X, SM_ARMOR_PERCENT_Y, L"%%" ); - #endif + } mprintf( SM_WEIGHT_LABEL_X - StringPixLength( pInvPanelTitleStrings[1], BLOCKFONT2 ), SM_WEIGHT_LABEL_Y, pInvPanelTitleStrings[ 1 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf( SM_WEIGHT_PERCENT_X, SM_WEIGHT_PERCENT_Y, ChineseSpecString1 ); - #else + } else { mprintf( SM_WEIGHT_PERCENT_X, SM_WEIGHT_PERCENT_Y, L"%%" ); - #endif + } mprintf( SM_CAMMO_LABEL_X - StringPixLength( pInvPanelTitleStrings[2], BLOCKFONT2 ), SM_CAMMO_LABEL_Y, pInvPanelTitleStrings[ 2 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf( SM_CAMMO_PERCENT_X, SM_CAMMO_PERCENT_Y, ChineseSpecString1 ); - #else + } else { mprintf( SM_CAMMO_PERCENT_X, SM_CAMMO_PERCENT_Y, L"%%" ); - #endif + } UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeAgilityTime, (BOOLEAN)(gpSMCurrentMerc->usValueGoneUp & AGIL_INCREASE ? TRUE : FALSE), (BOOLEAN)((gGameOptions.fNewTraitSystem && (gpSMCurrentMerc->ubCriticalStatDamage[DAMAGED_STAT_AGILITY] > 0)) ? TRUE : FALSE), gpSMCurrentMerc->bExtraAgility != 0 ); // SANDRO diff --git a/sgp/WinFont.cpp b/sgp/WinFont.cpp index 574235cf..0760c928 100644 --- a/sgp/WinFont.cpp +++ b/sgp/WinFont.cpp @@ -22,6 +22,7 @@ #include "font.h" #include "Font Control.h" #include "GameSettings.h" +#include #include @@ -353,7 +354,7 @@ INT32 CreateWinFont( LOGFONT &logfont ) HDC hdc = GetDC(NULL); SelectObject(hdc, hFont); -#ifdef CHINESE +if(g_lang == i18n::Lang::zh) { SIZE RectSize; wchar_t str[2]=L"\1"; for (int i = 1; i<0x80; i++) @@ -365,7 +366,7 @@ INT32 CreateWinFont( LOGFONT &logfont ) str[0] = L'啊'; GetTextExtentPoint32W( hdc, str, 1, &RectSize ); WinFonts[iFont].Width[0] = (UINT8)RectSize.cx; -#endif +} TEXTMETRIC tm; GetTextMetrics(hdc, &tm); @@ -467,7 +468,7 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont ) if (pWinFont == NULL) return(0); -#ifdef CHINESE +if(g_lang == i18n::Lang::zh) { wchar_t *p=string2; UINT32 size = 0; while (*p!=0) @@ -482,7 +483,7 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont ) p++; } return size; -#else +} else { SIZE RectSize; HDC hdc = GetDC(NULL); @@ -491,7 +492,7 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont ) ReleaseDC(NULL, hdc); return( (INT16)RectSize.cx ); -#endif +} } @@ -502,11 +503,11 @@ INT16 GetWinFontHeight(INT32 iFont) pWinFont = GetWinFont(iFont); if (pWinFont == NULL) return(0); -#ifdef CHINESE //zwwooooo: Correct tactical interface font height to fixed Chinese characters smearing bug +if(g_lang == i18n::Lang::zh) { //zwwooooo: Correct tactical interface font height to fixed Chinese characters smearing bug if (iFont == WinFontMap[TINYFONT1] || iFont == WinFontMap[SMALLFONT1] || iFont == WinFontMap[FONT14ARIAL]) { return pWinFont->Height + 2; } -#endif +} return pWinFont->Height; } diff --git a/sgp/sgp.cpp b/sgp/sgp.cpp index de26331d..be1fcf5a 100644 --- a/sgp/sgp.cpp +++ b/sgp/sgp.cpp @@ -58,6 +58,7 @@ #endif #include +#include static void MAGIC(std::string const& aarrrrgggh = "") {} @@ -858,13 +859,13 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC } #endif -# ifdef ENGLISH + if( g_lang == i18n::Lang::en ) { try { SetIntroType( INTRO_SPLASH ); } HANDLE_FATAL_ERROR; -# endif + } gfApplicationActive = TRUE; gfProgramIsRunning = TRUE; From 73f7812165bb8731f9c8745096de8b2aee0baac5 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 08:11:49 -0300 Subject: [PATCH 08/21] Slightly less straightforward CHINESE conversion in Interface Items.cpp A bit clunkier, had to repeat function calls because of how preprocessor tricks don't map 1:1 with actual C++. --- Tactical/Interface Items.cpp | 226 +++++++++++++++++++++++++++-------- 1 file changed, 174 insertions(+), 52 deletions(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 87cc1279..62dc9fa9 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -12281,12 +12281,28 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString11, - #else + ItemNames[ usItem ], + AmmoCaliber[ Weapon[ usItem ].ubCalibre ], + sValue, + sThreshold, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } else { swprintf( pStr, L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - ItemNames[ usItem ], AmmoCaliber[ Weapon[ usItem ].ubCalibre ], sValue, @@ -12305,16 +12321,12 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString4, - #else - swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], AmmoCaliber[ Weapon[ usItem ].ubCalibre ], sValue, @@ -12332,6 +12344,28 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + + swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", + ItemNames[ usItem ], + AmmoCaliber[ Weapon[ usItem ].ubCalibre ], + sValue, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } + } } break; @@ -12380,12 +12414,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, L"%s [%d%£¥(%d%£¥)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #else - swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - ItemNames[ usItem ], sValue, sThreshold, @@ -12403,15 +12433,31 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + sThreshold, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, L"%s [%d%£¥]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #else - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - ItemNames[ usItem ], sValue, gWeaponStatsDesc[ 9 ], //Accuracy String @@ -12428,6 +12474,25 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } } break; @@ -12438,13 +12503,9 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier { if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString9, - #else - swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], + ItemNames[ usItem ], sValue, sThreshold, gWeaponStatsDesc[ 11 ], //Damage String @@ -12455,16 +12516,26 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + sThreshold, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), //Melee damage + gWeaponStatsDesc[ 6 ], //AP String + BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], pObject, pSoldier ), //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString5, - #else - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], + ItemNames[ usItem ], sValue, gWeaponStatsDesc[ 11 ], //Damage String GetDamage(pObject), //Melee damage @@ -12474,6 +12545,19 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), //Melee damage + gWeaponStatsDesc[ 6 ], //AP String + BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], pObject, pSoldier ), //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } } break; @@ -12513,13 +12597,9 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier UINT16 explDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubDamage, 0 ); UINT16 explStunDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubStunDamage, 1 ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString5, - #else - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], + ItemNames[ usItem ], sValue, gWeaponStatsDesc[ 11 ], //Damage String explDamage, @@ -12529,6 +12609,19 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + gWeaponStatsDesc[ 11 ], //Damage String + explDamage, + gWeaponStatsDesc[ 13 ], //Stun Damage String + explStunDamage, //Stun Damage + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } break; @@ -12558,12 +12651,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString10, - #else - swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", - #endif - ItemNames[ usItem ], //Item long name sValue, //Item condition sThreshold, //repair threshold @@ -12577,15 +12666,27 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", + ItemNames[ usItem ], //Item long name + sValue, //Item condition + sThreshold, //repair threshold + pInvPanelTitleStrings[ 4 ], //Protection string + iProtection, //Protection rating in % based on best armor + Armour[ Item[ usItem ].ubClassIndex ].ubProtection * sValue / 100, + Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data) + pInvPanelTitleStrings[ 3 ], //Camo string + GetCamoBonus(pObject)+GetUrbanCamoBonus(pObject)+GetDesertCamoBonus(pObject)+GetSnowCamoBonus(pObject), //Camo bonus + gWeaponStatsDesc[ 12 ], //Weight string + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString6, - #else - swprintf( pStr, L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", - #endif - ItemNames[ usItem ], //Item long name sValue, //Item condition pInvPanelTitleStrings[ 4 ], //Protection string @@ -12598,6 +12699,21 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", + ItemNames[ usItem ], //Item long name + sValue, //Item condition + pInvPanelTitleStrings[ 4 ], //Protection string + iProtection, //Protection rating in % based on best armor + Armour[ Item[ usItem ].ubClassIndex ].ubProtection * sValue / 100, + Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data) + pInvPanelTitleStrings[ 3 ], //Camo string + GetCamoBonus(pObject)+GetUrbanCamoBonus(pObject)+GetDesertCamoBonus(pObject)+GetSnowCamoBonus(pObject), //Camo bonus + gWeaponStatsDesc[ 12 ], //Weight string + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } } break; @@ -12610,17 +12726,23 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier default: { // The final, and typical case, is that of an item with a percent status - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString7, - #else - swprintf( pStr, L"%s [%d%%]\n%s %1.1f %s", - #endif ItemNames[ usItem ], //Item long name sValue, //Item condition gWeaponStatsDesc[ 12 ], //Weight String fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %1.1f %s", + ItemNames[ usItem ], //Item long name + sValue, //Item condition + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } break; } From 33e8c1dc3999ef7ab5430bad9b8fbfeb76701b74 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 08:20:31 -0300 Subject: [PATCH 09/21] Move all the translated strings over to i18n It's where all conditional language preprocessor goes --- Utils/CMakeLists.txt | 17 ----------------- i18n/CMakeLists.txt | 17 +++++++++++++++++ {Utils => i18n}/ExportStrings.cpp | 0 {Utils => i18n}/_ChineseText.cpp | 0 {Utils => i18n}/_DutchText.cpp | 0 {Utils => i18n}/_EnglishText.cpp | 0 {Utils => i18n}/_FrenchText.cpp | 0 {Utils => i18n}/_GermanText.cpp | 0 {Utils => i18n}/_ItalianText.cpp | 0 {Utils => i18n}/_Ja25ChineseText.cpp | 0 {Utils => i18n}/_Ja25DutchText.cpp | 0 {Utils => i18n}/_Ja25EnglishText.cpp | 0 {Utils => i18n}/_Ja25FrenchText.cpp | 0 {Utils => i18n}/_Ja25GermanText.cpp | 0 {Utils => i18n}/_Ja25ItalianText.cpp | 0 {Utils => i18n}/_Ja25PolishText.cpp | 0 {Utils => i18n}/_Ja25RussianText.cpp | 0 {Utils => i18n}/_PolishText.cpp | 0 {Utils => i18n}/_RussianText.cpp | 0 {Utils => i18n/include}/ExportStrings.h | 0 {Utils => i18n/include}/_Ja25DutchText.h | 0 {Utils => i18n/include}/_Ja25EnglishText.h | 0 {Utils => i18n/include}/_Ja25FrenchText.h | 0 {Utils => i18n/include}/_Ja25GermanText.h | 0 {Utils => i18n/include}/_Ja25ItalianText.h | 0 {Utils => i18n/include}/_Ja25PolishText.h | 0 {Utils => i18n/include}/_Ja25RussianText.h | 0 27 files changed, 17 insertions(+), 17 deletions(-) rename {Utils => i18n}/ExportStrings.cpp (100%) rename {Utils => i18n}/_ChineseText.cpp (100%) rename {Utils => i18n}/_DutchText.cpp (100%) rename {Utils => i18n}/_EnglishText.cpp (100%) rename {Utils => i18n}/_FrenchText.cpp (100%) rename {Utils => i18n}/_GermanText.cpp (100%) rename {Utils => i18n}/_ItalianText.cpp (100%) rename {Utils => i18n}/_Ja25ChineseText.cpp (100%) rename {Utils => i18n}/_Ja25DutchText.cpp (100%) rename {Utils => i18n}/_Ja25EnglishText.cpp (100%) rename {Utils => i18n}/_Ja25FrenchText.cpp (100%) rename {Utils => i18n}/_Ja25GermanText.cpp (100%) rename {Utils => i18n}/_Ja25ItalianText.cpp (100%) rename {Utils => i18n}/_Ja25PolishText.cpp (100%) rename {Utils => i18n}/_Ja25RussianText.cpp (100%) rename {Utils => i18n}/_PolishText.cpp (100%) rename {Utils => i18n}/_RussianText.cpp (100%) rename {Utils => i18n/include}/ExportStrings.h (100%) rename {Utils => i18n/include}/_Ja25DutchText.h (100%) rename {Utils => i18n/include}/_Ja25EnglishText.h (100%) rename {Utils => i18n/include}/_Ja25FrenchText.h (100%) rename {Utils => i18n/include}/_Ja25GermanText.h (100%) rename {Utils => i18n/include}/_Ja25ItalianText.h (100%) rename {Utils => i18n/include}/_Ja25PolishText.h (100%) rename {Utils => i18n/include}/_Ja25RussianText.h (100%) diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt index 688f9555..ebf13645 100644 --- a/Utils/CMakeLists.txt +++ b/Utils/CMakeLists.txt @@ -7,7 +7,6 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/dsutil.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Encrypted File.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Event Pump.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/ExportStrings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Font Control.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/ImportStrings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/INIReader.cpp" @@ -37,20 +36,4 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/XML_Items.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_Language.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_SenderNameList.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_ChineseText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_DutchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_EnglishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_FrenchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_GermanText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_ItalianText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ChineseText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25DutchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25EnglishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25FrenchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25GermanText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ItalianText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25PolishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25RussianText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_PolishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_RussianText.cpp" PARENT_SCOPE) diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index 6c40cf61..8f36adea 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -1,5 +1,22 @@ set(i18nSrc "${CMAKE_CURRENT_SOURCE_DIR}/language.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Ja2 Libs.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/ExportStrings.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_ChineseText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_DutchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_EnglishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_FrenchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_GermanText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_ItalianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ChineseText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25DutchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25EnglishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25FrenchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25GermanText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ItalianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25PolishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25RussianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_PolishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_RussianText.cpp" PARENT_SCOPE ) diff --git a/Utils/ExportStrings.cpp b/i18n/ExportStrings.cpp similarity index 100% rename from Utils/ExportStrings.cpp rename to i18n/ExportStrings.cpp diff --git a/Utils/_ChineseText.cpp b/i18n/_ChineseText.cpp similarity index 100% rename from Utils/_ChineseText.cpp rename to i18n/_ChineseText.cpp diff --git a/Utils/_DutchText.cpp b/i18n/_DutchText.cpp similarity index 100% rename from Utils/_DutchText.cpp rename to i18n/_DutchText.cpp diff --git a/Utils/_EnglishText.cpp b/i18n/_EnglishText.cpp similarity index 100% rename from Utils/_EnglishText.cpp rename to i18n/_EnglishText.cpp diff --git a/Utils/_FrenchText.cpp b/i18n/_FrenchText.cpp similarity index 100% rename from Utils/_FrenchText.cpp rename to i18n/_FrenchText.cpp diff --git a/Utils/_GermanText.cpp b/i18n/_GermanText.cpp similarity index 100% rename from Utils/_GermanText.cpp rename to i18n/_GermanText.cpp diff --git a/Utils/_ItalianText.cpp b/i18n/_ItalianText.cpp similarity index 100% rename from Utils/_ItalianText.cpp rename to i18n/_ItalianText.cpp diff --git a/Utils/_Ja25ChineseText.cpp b/i18n/_Ja25ChineseText.cpp similarity index 100% rename from Utils/_Ja25ChineseText.cpp rename to i18n/_Ja25ChineseText.cpp diff --git a/Utils/_Ja25DutchText.cpp b/i18n/_Ja25DutchText.cpp similarity index 100% rename from Utils/_Ja25DutchText.cpp rename to i18n/_Ja25DutchText.cpp diff --git a/Utils/_Ja25EnglishText.cpp b/i18n/_Ja25EnglishText.cpp similarity index 100% rename from Utils/_Ja25EnglishText.cpp rename to i18n/_Ja25EnglishText.cpp diff --git a/Utils/_Ja25FrenchText.cpp b/i18n/_Ja25FrenchText.cpp similarity index 100% rename from Utils/_Ja25FrenchText.cpp rename to i18n/_Ja25FrenchText.cpp diff --git a/Utils/_Ja25GermanText.cpp b/i18n/_Ja25GermanText.cpp similarity index 100% rename from Utils/_Ja25GermanText.cpp rename to i18n/_Ja25GermanText.cpp diff --git a/Utils/_Ja25ItalianText.cpp b/i18n/_Ja25ItalianText.cpp similarity index 100% rename from Utils/_Ja25ItalianText.cpp rename to i18n/_Ja25ItalianText.cpp diff --git a/Utils/_Ja25PolishText.cpp b/i18n/_Ja25PolishText.cpp similarity index 100% rename from Utils/_Ja25PolishText.cpp rename to i18n/_Ja25PolishText.cpp diff --git a/Utils/_Ja25RussianText.cpp b/i18n/_Ja25RussianText.cpp similarity index 100% rename from Utils/_Ja25RussianText.cpp rename to i18n/_Ja25RussianText.cpp diff --git a/Utils/_PolishText.cpp b/i18n/_PolishText.cpp similarity index 100% rename from Utils/_PolishText.cpp rename to i18n/_PolishText.cpp diff --git a/Utils/_RussianText.cpp b/i18n/_RussianText.cpp similarity index 100% rename from Utils/_RussianText.cpp rename to i18n/_RussianText.cpp diff --git a/Utils/ExportStrings.h b/i18n/include/ExportStrings.h similarity index 100% rename from Utils/ExportStrings.h rename to i18n/include/ExportStrings.h diff --git a/Utils/_Ja25DutchText.h b/i18n/include/_Ja25DutchText.h similarity index 100% rename from Utils/_Ja25DutchText.h rename to i18n/include/_Ja25DutchText.h diff --git a/Utils/_Ja25EnglishText.h b/i18n/include/_Ja25EnglishText.h similarity index 100% rename from Utils/_Ja25EnglishText.h rename to i18n/include/_Ja25EnglishText.h diff --git a/Utils/_Ja25FrenchText.h b/i18n/include/_Ja25FrenchText.h similarity index 100% rename from Utils/_Ja25FrenchText.h rename to i18n/include/_Ja25FrenchText.h diff --git a/Utils/_Ja25GermanText.h b/i18n/include/_Ja25GermanText.h similarity index 100% rename from Utils/_Ja25GermanText.h rename to i18n/include/_Ja25GermanText.h diff --git a/Utils/_Ja25ItalianText.h b/i18n/include/_Ja25ItalianText.h similarity index 100% rename from Utils/_Ja25ItalianText.h rename to i18n/include/_Ja25ItalianText.h diff --git a/Utils/_Ja25PolishText.h b/i18n/include/_Ja25PolishText.h similarity index 100% rename from Utils/_Ja25PolishText.h rename to i18n/include/_Ja25PolishText.h diff --git a/Utils/_Ja25RussianText.h b/i18n/include/_Ja25RussianText.h similarity index 100% rename from Utils/_Ja25RussianText.h rename to i18n/include/_Ja25RussianText.h From 5fb989a1fc429de8512abe958c1d7a23ccc6bd94 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 08:29:55 -0300 Subject: [PATCH 10/21] Move Text.h over to i18n too Never use relative paths for #includes. Didn't touch the rest because out of scope. --- ModularizedTacticalAI/src/LegacyAIPlan.cpp | 2 +- {Utils => i18n/include}/Text.h | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {Utils => i18n/include}/Text.h (100%) diff --git a/ModularizedTacticalAI/src/LegacyAIPlan.cpp b/ModularizedTacticalAI/src/LegacyAIPlan.cpp index f08340ee..d672870e 100644 --- a/ModularizedTacticalAI/src/LegacyAIPlan.cpp +++ b/ModularizedTacticalAI/src/LegacyAIPlan.cpp @@ -15,7 +15,7 @@ #include "../../TileEngine/Isometric Utils.h" // defines NOWHERE #include "../../Utils/Debug Control.h" // LiveMessage #include "../../Utils/Font Control.h" // ScreenMsg about deadlock -#include "../../Utils/Text.h" // Sniper warning +#include // Sniper warning #include "../../Utils/message.h" // ditto diff --git a/Utils/Text.h b/i18n/include/Text.h similarity index 100% rename from Utils/Text.h rename to i18n/include/Text.h From cf0b4dfc4039a486f034089dd7930744ba4b4cef Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 09:25:43 -0300 Subject: [PATCH 11/21] Manual unrolling preprocessor stuff and added function This function is just for GERMAN but it has a unique name so it's no problem. Had to slightly change how MercID gets populated --- Ja2/jascreens.cpp | 2 -- Laptop/AimMembers.cpp | 16 +++++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index 87d04505..9e7df483 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -959,7 +959,6 @@ void DoneFadeOutForDemoExitScreen( void ) // unused //extern INT8 gbFadeSpeed; -#ifdef GERMAN void DisplayTopwareGermanyAddress() { VOBJECT_DESC vo_desc; @@ -994,7 +993,6 @@ void DisplayTopwareGermanyAddress() ExecuteBaseDirtyRectQueue(); EndFrameBufferRender(); } -#endif UINT32 DemoExitScreenHandle(void) { diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index 0c1e2f37..490d0a63 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -5367,11 +5367,17 @@ BOOLEAN DisplayShadedStretchedMercFace( UINT8 ubMercID, UINT16 usPosX, UINT16 us void DemoHiringOfMercs( ) { INT16 i; - #ifdef GERMAN - UINT8 MercID[]={ 7, 10, 4, 14, 50 }; - #else - UINT8 MercID[]={ 7, 10, 4, 42, 33 }; - #endif + UINT8 MercID[5]; + MercID[0] = 7; + MercID[1] = 10; + MercID[2] = 4; + if( g_lang == i18n::Lang::de ) { + MercID[3] = 14; + MercID[4] = 50; + } else { + MercID[3] = 42; + MercID[4] = 33; + } MERC_HIRE_STRUCT HireMercStruct; static BOOLEAN fHaveCalledBefore=FALSE; From 4b563fefc897b9ac6106c3cb0573880eaf0ba6f1 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 09:41:32 -0300 Subject: [PATCH 12/21] Slightly clunkier fix for RUSSIAN conditional --- Tactical/Dialogue Control.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index cb646341..00b32f72 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -67,6 +67,7 @@ #include "ub_config.h" #include "history.h" +#include //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -2407,8 +2408,8 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN { if ( fWavFile ) { -#ifdef RUSSIAN - if ( ( gMercProfiles[ubCharacterNum].Type == PROFILETYPE_RPC || + if ( g_lang == i18n::Lang::ru && + ( gMercProfiles[ubCharacterNum].Type == PROFILETYPE_RPC || gMercProfiles[ubCharacterNum].Type == PROFILETYPE_NPC || gMercProfiles[ubCharacterNum].Type == PROFILETYPE_VEHICLE ) && gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) { @@ -2426,7 +2427,7 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN #endif } else -#endif + { // build name of wav file (characternum + quotenum) sprintf( zFileNameHelper, "SPEECH\\%03d_%03d", usVoiceSet, usQuoteNum ); From ecdc8916f2b6b3b1fd3da359423f1393d12b2525 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 09:59:23 -0300 Subject: [PATCH 13/21] Move CHINESE BOBBYR_ITEMS_BOUGHT_X conditional definition to i18n Just awful --- Laptop/BobbyR.h | 1 + Laptop/BobbyRGuns.cpp | 7 ------- i18n/include/language.hpp | 2 ++ i18n/language.cpp | 9 +++++++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Laptop/BobbyR.h b/Laptop/BobbyR.h index 486a9a80..6d011960 100644 --- a/Laptop/BobbyR.h +++ b/Laptop/BobbyR.h @@ -25,6 +25,7 @@ void RenderBobbyR(); #define BOBBYR_GRIDLOC_X LAPTOP_SCREEN_UL_X + 4 #define BOBBYR_GRIDLOC_Y LAPTOP_SCREEN_WEB_UL_Y + 5 //LAPTOP_SCREEN_WEB_UL_Y + 45 +#define BOBBYR_ORDER_NUM_WIDTH 15 /* extern UINT16 gusFirstGunIndex; diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index ac9855fc..15613004 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -87,7 +87,6 @@ #define BOBBYR_ITEM_NAME_X BOBBYR_GRIDLOC_X + 6 #define BOBBYR_ITEM_NAME_Y_OFFSET 54 -#define BOBBYR_ORDER_NUM_WIDTH 15 #define BOBBYR_ORDER_NUM_X BOBBYR_GRIDLOC_X + 120 - BOBBYR_ORDER_NUM_WIDTH //BOBBYR_ITEM_STOCK_TEXT_X #define BOBBYR_ORDER_NUM_Y_OFFSET 1 @@ -116,12 +115,6 @@ #define BOBBYR_ITEM_QTY_NUM_X BOBBYR_GRIDLOC_X + 105//BOBBYR_ITEM_COST_TEXT_X + 1 #define BOBBYR_ITEM_QTY_NUM_Y BOBBYR_ITEM_QTY_TEXT_Y//BOBBYR_ITEM_COST_TEXT_Y + 40 -#ifdef CHINESE - #define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH - 10 //BOBBYR_ITEM_QTY_NUM_X -#else - #define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH//BOBBYR_ITEM_QTY_NUM_X -#endif - #define BOBBY_RAY_NOT_PURCHASED 255 #define BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE 200 diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index bd895bcc..e88fbe5a 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -20,4 +20,6 @@ extern const i18n::Lang g_lang; extern const int MAX_MESSAGES_ON_MAP_BOTTOM; +extern const int BOBBYR_ITEMS_BOUGHT_X; + auto GetLanguagePrefix() -> const STR; diff --git a/i18n/language.cpp b/i18n/language.cpp index 555b33c2..25b0c816 100644 --- a/i18n/language.cpp +++ b/i18n/language.cpp @@ -1,5 +1,8 @@ #include +#include +#include + /* FIXME: The ugliest of ugly hacks. Getting rid of this and letting language * (ideally text and voice separately) be set in the options menu would be * ideal. */ @@ -31,6 +34,12 @@ const int MAX_MESSAGES_ON_MAP_BOTTOM{ #endif }; +const int BOBBYR_ITEMS_BOUGHT_X{BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH +#ifdef CHINESE + - 10 +#endif +}; + auto GetLanguagePrefix() -> const STR { return #if defined(ENGLISH) From b15c4ef96c2d3e4a599201388ef5ab7c522c6988 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Tue, 31 Dec 2024 08:44:03 -0300 Subject: [PATCH 14/21] the really gnarly CHINESE #ifdef conversions these seem to be right, chinese text appears to be flowing correctly --- Utils/WordWrap.cpp | 88 +++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 47 deletions(-) diff --git a/Utils/WordWrap.cpp b/Utils/WordWrap.cpp index 3368c2f9..900193c7 100644 --- a/Utils/WordWrap.cpp +++ b/Utils/WordWrap.cpp @@ -5,6 +5,7 @@ #include "Stdio.h" #include "WinFont.h" +#include #define SINGLE_CHARACTER_WORD_FOR_WORDWRAP @@ -224,8 +225,9 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW } - if((usCurrentWidthPixels > usLineWidthPixels) -#ifdef CHINESE + if( (g_lang != i18n::Lang::zh && usCurrentWidthPixels > usLineWidthPixels) + || + (g_lang == i18n::Lang::zh && usCurrentWidthPixels > usLineWidthPixels && TempString[usCurIndex] != L',' && TempString[usCurIndex] != L'。' && TempString[usCurIndex] != L'ï¼›' @@ -237,8 +239,8 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW && TempString[usCurIndex] != L'?' && TempString[usCurIndex] != L')' && TempString[usCurIndex] != L')' -#endif )//||(DestString[ usDestIndex ]==NEWLINE_CHAR )||(fNewLine)) +) { //if an error has occured, and the string is too long @@ -250,11 +252,10 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW usLastMaxWidthIndex = usDestIndex; //Go back to begining of word - while( (DestString[ usDestIndex ] != L' ') && (usCurIndex > 0) && (usDestIndex > 0) -#ifdef CHINESE - && DestString[usDestIndex] < 255 -#endif - ) + while( + (g_lang != i18n::Lang::zh && DestString[ usDestIndex ] != L' ' && usCurIndex > 0 && usDestIndex > 0) + || + (g_lang == i18n::Lang::zh && DestString[ usDestIndex ] != L' ' && usCurIndex > 0 && usDestIndex > 0 && DestString[usDestIndex] < 255)) { OneChar[0] = DestString[ usDestIndex ]; @@ -263,8 +264,7 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW usCurIndex--; usDestIndex--; } -#ifdef CHINESE - if (DestString[usDestIndex] > 255) + if (g_lang == i18n::Lang::zh && DestString[usDestIndex] > 255) { if (DestString[usDestIndex] == L',' || DestString[usDestIndex] == L',' @@ -282,7 +282,7 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW else {usCurIndex--;} } -#endif + usEndIndex = usDestIndex; // OJW - 20090427 @@ -576,21 +576,19 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN { // each character goes towards building a new word -#ifdef CHINESE //zwwooooo: Chinese Text is not need SPACE to segmentation words, so need another process - if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 && pString[usSourceCounter] < 255) { +//zwwooooo: Chinese Text is not need SPACE to segmentation words, so need another process + if ( + (g_lang == i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 && pString[usSourceCounter] < 255) + || + (g_lang != i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) + ) { zWordString[usDestCounter++] = pString[usSourceCounter]; } else { + if(g_lang == i18n::Lang::zh) { zWordString[usDestCounter++] = pString[usSourceCounter]; -#else - if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) - { - zWordString[usDestCounter++] = pString[usSourceCounter]; - } - else - { -#endif + } // we hit a space (or end of record), so this is the END of a word! // is this a special CODE? @@ -924,12 +922,11 @@ DEF: commented out for Beta. Nov 30 // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); -#ifdef CHINESE //zwwooooo: Chinese Text don't need add space -#else +if(g_lang != i18n::Lang::zh) { // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; -#endif +} // RE-terminate the string zWordString[usDestCounter] = 0; @@ -1381,33 +1378,33 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt } else // not a special character { -#ifdef CHINESE wchar_t currentChar=pString[usSourceCounter]; - if (currentChar> 255 ) + if (g_lang == i18n::Lang::zh && currentChar> 255 ) { if (usDestCounter == 0) {zWordString[usDestCounter++] = currentChar;} else {usSourceCounter--;} } -#endif // terminate the string TEMPORARILY zWordString[usDestCounter] = 0; // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); -#ifdef CHINESE - if (currentChar <= 255) -#endif + if (g_lang != i18n::Lang::zh || + g_lang == i18n::Lang::zh && currentChar <= 255) { // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; + } // RE-terminate the string zWordString[usDestCounter] = 0; // can we fit it onto the length of our "line" ? - if ((usLineLengthPixels + usWordLengthPixels) < usWidth -#ifdef CHINESE + if ( + (g_lang != i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) < usWidth) + || + (g_lang == i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) < usWidth || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L'。' @@ -1420,7 +1417,7 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt || pString[usSourceCounter] == L'?' || pString[usSourceCounter] == L')' || pString[usSourceCounter] == L')' -#endif +) ) { // yes we can fit this word. @@ -1506,10 +1503,10 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT do { // each character goes towards building a new word - if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 -#ifdef CHINESE - && pString[usSourceCounter] <= 255 -#endif + if ( + (g_lang != i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) + || + (g_lang == i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 && pString[usSourceCounter] <= 255) ) { zWordString[usDestCounter++] = pString[usSourceCounter]; @@ -1723,24 +1720,20 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT } else // not a special character { -#ifdef CHINESE wchar_t currentChar = pString[usSourceCounter]; - if (currentChar > 255 ) + if (g_lang == i18n::Lang::zh && currentChar > 255 ) { if (usDestCounter == 0) {zWordString[usDestCounter++] = currentChar;} else {usSourceCounter--;} } -#endif // terminate the string TEMPORARILY zWordString[usDestCounter] = 0; // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); -#ifdef CHINESE - if (currentChar <= 255) -#endif + if (g_lang == i18n::Lang::zh && currentChar <= 255) // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; @@ -1748,8 +1741,10 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT zWordString[usDestCounter] = 0; // can we fit it onto the length of our "line" ? - if ((usLineLengthPixels + usWordLengthPixels) <= usWidth -#ifdef CHINESE + if ( + (g_lang != i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) <= usWidth) + || + (g_lang == i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) <= usWidth || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L'。' @@ -1759,8 +1754,7 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT || pString[usSourceCounter] == L':' || pString[usSourceCounter] == L')' || pString[usSourceCounter] == L')' -#endif - ) + )) { // yes we can fit this word. From 70f09471c21c9f7ceea931a1b143d9d8d5db0ee0 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 09:22:06 -0300 Subject: [PATCH 15/21] just cast g_lang into lua's language code because magically I got the enum order right first try --- Strategic/LuaInitNPCs.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 519dc005..721a5a44 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -96,6 +96,7 @@ extern "C" { #include "Merc Contract.h" #include "message.h" #include "Town Militia.h" +#include extern UINT8 gubWaitingForAllMercsToExitCode; @@ -13208,26 +13209,7 @@ static int l_GetUsedLanguage( lua_State *L ) { if ( lua_gettop( L ) ) { - INT32 val = 0; - -#if defined(ENGLISH) - val = 0; -#elif defined(GERMAN) - val = 1; -#elif defined(RUSSIAN) - val = 2; -#elif defined(DUTCH) - val = 3; -#elif defined(POLISH) - val = 4; -#elif defined(FRENCH) - val = 5; -#elif defined(ITALIAN) - val = 6; -#elif defined(CHINESE) - val = 7; -#endif - + INT32 val = static_cast(g_lang); lua_pushinteger( L, val ); } From 4a7625cef0b41205b90d7059e9a1bd06cfa9da2d Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 02:27:00 -0300 Subject: [PATCH 16/21] Slightly clunky RUSSIAN conversion --- Laptop/IMP Begin Screen.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index 846666ec..41141ab5 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -24,6 +24,7 @@ #include "text.h" #include "LaptopSave.h" +#include #define FULL_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 138 #define NICK_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 195 @@ -552,7 +553,7 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) //Heinz (18.01.2009): Russian layout // ViSoR (07.01.2012) : Russian and Belarussian layouts // -#if defined(RUSSIAN) || defined(BELARUSSIAN) +if(g_lang == i18n::Lang::ru) { // ViSoR (02.02.2013): Fix for Cyrillic layouts DWORD threadId = GetWindowThreadProcessId( ghWindow, 0 ); DWORD layout = (DWORD)GetKeyboardLayout( threadId ) & 0xFFFF; @@ -574,17 +575,16 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) } else if( !CheckIsKeyValid( uiKey ) ) uiKey = '#'; - - if( uiKey != '#') -#else - if( uiKey >= 'A' && uiKey <= 'Z' || +} + if( (g_lang != i18n::Lang::ru && + uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || uiKey == '_' || uiKey == '.' || uiKey == ' ' || uiKey == '"' || uiKey == 39 // This is ' which cannot be written explicitly here of course - ) -#endif + ) || + uiKey != '#') { // if the current string position is at max or great, do nothing switch( ubTextEnterMode ) From cccec0ef111fd7e7c83d3c39d145c53dfa351ace Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 02:29:24 -0300 Subject: [PATCH 17/21] straggler in Utils/Font Control.cpp --- Utils/Font Control.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Utils/Font Control.cpp b/Utils/Font Control.cpp index 87c140f5..efb10ba5 100644 --- a/Utils/Font Control.cpp +++ b/Utils/Font Control.cpp @@ -5,6 +5,7 @@ #include "vsurface.h" #include "wcheck.h" #include "Font Control.h" +#include INT32 giCurWinFont = 0; //BOOLEAN gfUseWinFonts = FALSE; @@ -77,8 +78,8 @@ HVOBJECT gvoBlockFontNarrow; INT32 gp14PointHumanist; HVOBJECT gvo14PointHumanist; -#if defined( JA2EDITOR ) && defined( ENGLISH ) - INT32 gpHugeFont; +#if defined( JA2EDITOR ) + INT32 gpHugeFont; HVOBJECT gvoHugeFont; #endif @@ -94,8 +95,8 @@ UINT16 CreateFontPaletteTables(HVOBJECT pObj ); extern UINT16 gzFontName[32]; auto GetHugeFont() -> INT32 { -#if defined(JA2EDITOR) && defined(ENGLISH) - return gpHugeFont; +#if defined(JA2EDITOR) + return g_lang == i18n::Lang::en ? gpHugeFont : gp16PointArial; #else return gp16PointArial; #endif @@ -216,10 +217,12 @@ BOOLEAN InitializeFonts( ) gvo14PointHumanist = GetFontObject( gp14PointHumanist ); CHECKF( CreateFontPaletteTables( gvo14PointHumanist ) ); - #if defined( JA2EDITOR ) && defined( ENGLISH ) + #if defined( JA2EDITOR ) + if(g_lang == i18n::Lang::en) { gpHugeFont = LoadFontFile( "FONTS\\HUGEFONT.sti" ); gvoHugeFont = GetFontObject( gpHugeFont ); CHECKF( CreateFontPaletteTables( gvoHugeFont ) ); + } #endif // Set default for font system @@ -254,8 +257,10 @@ void ShutdownFonts( ) UnloadFont( gp14PointArial); UnloadFont( gpBlockyFont); UnloadFont( gp12PointArialFixedFont ); - #if defined( JA2EDITOR ) && defined( ENGLISH ) + #if defined( JA2EDITOR ) + if(g_lang == i18n::Lang::en) { UnloadFont( gpHugeFont ); + } #endif // ATE: Shutdown any win fonts From 9ed713f9522418250773c20f0b77f54379b426f6 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 02:41:35 -0300 Subject: [PATCH 18/21] move Utils/Multi Language Graphic Utils.* to i18n has language preprocessor silliness, straight to jail --- Utils/CMakeLists.txt | 1 - i18n/CMakeLists.txt | 1 + {Utils => i18n}/Multi Language Graphic Utils.cpp | 0 {Utils => i18n/include}/Multi Language Graphic Utils.h | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename {Utils => i18n}/Multi Language Graphic Utils.cpp (100%) rename {Utils => i18n/include}/Multi Language Graphic Utils.h (100%) diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt index ebf13645..537e2335 100644 --- a/Utils/CMakeLists.txt +++ b/Utils/CMakeLists.txt @@ -15,7 +15,6 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/MapUtility.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MercTextBox.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/message.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/Multi Language Graphic Utils.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Multilingual Text Code Generator.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Music Control.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/PopUpBox.cpp" diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index 8f36adea..6d200975 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -18,5 +18,6 @@ set(i18nSrc "${CMAKE_CURRENT_SOURCE_DIR}/_Ja25RussianText.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/_PolishText.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/_RussianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/Multi Language Graphic Utils.cpp" PARENT_SCOPE ) diff --git a/Utils/Multi Language Graphic Utils.cpp b/i18n/Multi Language Graphic Utils.cpp similarity index 100% rename from Utils/Multi Language Graphic Utils.cpp rename to i18n/Multi Language Graphic Utils.cpp diff --git a/Utils/Multi Language Graphic Utils.h b/i18n/include/Multi Language Graphic Utils.h similarity index 100% rename from Utils/Multi Language Graphic Utils.h rename to i18n/include/Multi Language Graphic Utils.h From 10037291f38ded8a7316d2f091b7689969aa7cef Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 03:54:28 -0300 Subject: [PATCH 19/21] remove preprocessor from i18n Multi Language Graphic Utils.cpp --- i18n/Multi Language Graphic Utils.cpp | 33 ++++++++++----------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/i18n/Multi Language Graphic Utils.cpp b/i18n/Multi Language Graphic Utils.cpp index 4d444fb9..af383bd7 100644 --- a/i18n/Multi Language Graphic Utils.cpp +++ b/i18n/Multi Language Graphic Utils.cpp @@ -6,10 +6,11 @@ //SB #include "FileMan.h" +#include BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) { - #if defined( ENGLISH ) + if( g_lang == i18n::Lang::en ) { switch( usMLGGraphicID ) { case MLG_AIMSYMBOL: @@ -141,7 +142,7 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) return TRUE; } - #elif defined( GERMAN ) + } else if( g_lang == i18n::Lang::de ) { switch( usMLGGraphicID ) { case MLG_AIMSYMBOL: @@ -279,7 +280,7 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) return TRUE; } - #else + } else { UINT8 zLanguage[64]; @@ -292,29 +293,19 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) // // "GERMAN\\IMPSymbol_German.sti" - #if defined( DUTCH ) + if(g_lang == i18n::Lang::nl) { sprintf( (char *)zLanguage, "DUTCH" ); - #elif defined( FRENCH ) + } else if(g_lang == i18n::Lang::fr) { sprintf( (char *)zLanguage, "FRENCH" ); - #elif defined( GERMAN ) - sprintf( (char *)zLanguage, "GERMAN" ); - #elif defined( ITALIAN ) + } else if(g_lang == i18n::Lang::it) { sprintf( (char *)zLanguage, "ITALIAN" ); - #elif defined( JAPANESE ) - sprintf( (char *)zLanguage, "JAPANESE" ); - #elif defined( KOREAN ) - sprintf( (char *)zLanguage, "KOREAN" ); - #elif defined( POLISH ) + } else if(g_lang == i18n::Lang::pl) { sprintf( (char *)zLanguage, "POLISH" ); - #elif defined( RUSSIAN ) + } else if(g_lang == i18n::Lang::ru) { sprintf( (char *)zLanguage, "RUSSIAN" ); - #elif defined( SPANISH ) - sprintf( (char *)zLanguage, "SPANISH" ); - #elif defined( CHINESE ) + } else if(g_lang == i18n::Lang::zh) { sprintf( (char *)zLanguage, "CHINESE" ); - #else - # error "At least You have to specify a Language somewhere. See comments above." - #endif + } //SB: Also check for russian Gold version, like English switch( usMLGGraphicID ) @@ -584,7 +575,7 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) return TRUE; } - #endif + } return FALSE; } From e9686c0dcad7a2e396d2fa3c1175e1bafb6f395f Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 14:38:08 -0300 Subject: [PATCH 20/21] reformat CMakeLists.txt --- CMakeLists.txt | 128 ++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1842724..71e351a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,12 +22,12 @@ endif() option(ADDRESS_SANITIZER OFF) if(ADDRESS_SANITIZER) - message(STATUS "AddressSanitizer ENABLED for non-Release builds") - add_compile_options($,$>,-fsanitize=address,>) + message(STATUS "AddressSanitizer ENABLED for non-Release builds") + add_compile_options($,$>,-fsanitize=address,>) endif() if(MSVC) - add_compile_options("/wd4838") + add_compile_options("/wd4838") endif() # whether we are using MSBuild as a generator @@ -39,22 +39,22 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE) include_directories( - "${CMAKE_SOURCE_DIR}/Ja2" - "${CMAKE_SOURCE_DIR}/ext/VFS/include" - "${CMAKE_SOURCE_DIR}/Utils" - "${CMAKE_SOURCE_DIR}/TileEngine" - "${CMAKE_SOURCE_DIR}/TacticalAI" - "${CMAKE_SOURCE_DIR}/ModularizedTacticalAI/include" - "${CMAKE_SOURCE_DIR}/Tactical" - "${CMAKE_SOURCE_DIR}/Strategic" - "${CMAKE_SOURCE_DIR}/sgp" - "${CMAKE_SOURCE_DIR}/Ja2/Res" - "${CMAKE_SOURCE_DIR}/Lua" - "${CMAKE_SOURCE_DIR}/Laptop" - "${CMAKE_SOURCE_DIR}/Multiplayer" - "${CMAKE_SOURCE_DIR}/Editor" - "${CMAKE_SOURCE_DIR}/Console" - "${CMAKE_SOURCE_DIR}/i18n/include" + "${CMAKE_SOURCE_DIR}/Ja2" + "${CMAKE_SOURCE_DIR}/ext/VFS/include" + "${CMAKE_SOURCE_DIR}/Utils" + "${CMAKE_SOURCE_DIR}/TileEngine" + "${CMAKE_SOURCE_DIR}/TacticalAI" + "${CMAKE_SOURCE_DIR}/ModularizedTacticalAI/include" + "${CMAKE_SOURCE_DIR}/Tactical" + "${CMAKE_SOURCE_DIR}/Strategic" + "${CMAKE_SOURCE_DIR}/sgp" + "${CMAKE_SOURCE_DIR}/Ja2/Res" + "${CMAKE_SOURCE_DIR}/Lua" + "${CMAKE_SOURCE_DIR}/Laptop" + "${CMAKE_SOURCE_DIR}/Multiplayer" + "${CMAKE_SOURCE_DIR}/Editor" + "${CMAKE_SOURCE_DIR}/Console" + "${CMAKE_SOURCE_DIR}/i18n/include" ) # external libraries @@ -76,20 +76,20 @@ add_subdirectory(Multiplayer) # by header files rely on Application and Language preprocessor definitions, and # therefore need to be compiled multiple times. Very Bad. set(Ja2_Libs -TileEngine -TacticalAI -Utils -Strategic -sgp -Laptop -Editor -Console -Tactical -ModularizedTacticalAI -i18n + TileEngine + TacticalAI + Utils + Strategic + sgp + Laptop + Editor + Console + Tactical + ModularizedTacticalAI + i18n ) foreach(lib IN LISTS Ja2_Libs) - add_subdirectory(${lib}) + add_subdirectory(${lib}) endforeach() add_subdirectory(Ja2) @@ -111,43 +111,43 @@ set(debugFlags $,JA2BETAVERSION;JA2TESTVERSION;DEBUG_ATTACKBU # every library-language-executable combination is its own compilation target # TODO: refactor preprocessor usage onto, ideally, a single translation unit foreach(lang IN LISTS LangTargets) - foreach(exe IN LISTS ApplicationTargets) - set(Executable ${exe}_${lang}) + foreach(exe IN LISTS ApplicationTargets) + set(Executable ${exe}_${lang}) - # executable for an application/language combination, e.g. JA2_ENGLISH.exe - add_executable(${Executable} WIN32) - target_sources(${Executable} PRIVATE ${Ja2Src}) + # executable for an application/language combination, e.g. JA2_ENGLISH.exe + add_executable(${Executable} WIN32) + target_sources(${Executable} PRIVATE ${Ja2Src}) - # Good libraries have already been built, can be simply linked here - target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $) - target_link_options(${Executable} PRIVATE $) + # Good libraries have already been built, can be simply linked here + target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $) + target_link_options(${Executable} PRIVATE $) - # for each app/lang combination, the Very Bad libraries need to be built, - # with the appropriate preprocessor definitions - foreach(lib IN LISTS Ja2_Libs) - # syntactic sugar to hopefully make this more readable - set(VeryBadLib ${Executable}_${lib}) - set(isEditor $) - set(isUb $) - set(isUbEditor $) + # for each app/lang combination, the Very Bad libraries need to be built, + # with the appropriate preprocessor definitions + foreach(lib IN LISTS Ja2_Libs) + # syntactic sugar to hopefully make this more readable + set(VeryBadLib ${Executable}_${lib}) + set(isEditor $) + set(isUb $) + set(isUbEditor $) - # static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib - add_library(${VeryBadLib}) - target_sources(${VeryBadLib} PRIVATE ${${lib}Src}) + # static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib + add_library(${VeryBadLib}) + target_sources(${VeryBadLib} PRIVATE ${${lib}Src}) - target_compile_definitions(${VeryBadLib} PUBLIC - $ - $ - $ - ${debugFlags} - ${lang} - ) - target_link_libraries(${Executable} PUBLIC ${VeryBadLib}) - endforeach() + target_compile_definitions(${VeryBadLib} PUBLIC + $ + $ + $ + ${debugFlags} + ${lang} + ) + target_link_libraries(${Executable} PUBLIC ${VeryBadLib}) + endforeach() - # for sgp only - target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") - target_link_libraries(${Executable}_sgp PUBLIC libpng) - target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION) - endforeach() + # for sgp only + target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") + target_link_libraries(${Executable}_sgp PUBLIC libpng) + target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION) + endforeach() endforeach() From 959c29434eddce5a1537e2af72d5e6858a092502 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 16:33:29 -0300 Subject: [PATCH 21/21] Adjust the build system Language is now just built once per app (still some JA2UB conditionals going on in there) but building everything should now take eight times less work --- .gitignore | 2 + CMakeLists.txt | 125 ++++++++++++++++++++++++--------------------- Ja2/CMakeLists.txt | 14 ----- TODO | 1 + 4 files changed, 71 insertions(+), 71 deletions(-) diff --git a/.gitignore b/.gitignore index 6466f05c..5ef609a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +dummy.cpp + # CLion /.idea/ /cmake-build-*/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 71e351a8..9f642790 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,33 +66,44 @@ target_link_libraries(bfVFS PRIVATE 7z) # ja2export utility add_subdirectory("ext/export/src") -# static libraries whose source files, header files or header files included -# by header files do not rely on Applications or Languages preprocessor definitions, -# and therefore only need to be compiled once. Good. +# static libraries whose translation units don't rely on Application preprocessor definitions. add_subdirectory(Lua) add_subdirectory(Multiplayer) -# static libraries whose source files, header files or header files included -# by header files rely on Application and Language preprocessor definitions, and -# therefore need to be compiled multiple times. Very Bad. +set(Ja2_Libraries +"${CMAKE_SOURCE_DIR}/binkw32.lib" +"${CMAKE_SOURCE_DIR}/libexpatMT.lib" +"${CMAKE_SOURCE_DIR}/lua51.lib" +"${CMAKE_SOURCE_DIR}/lua51.vc9.lib" +"${CMAKE_SOURCE_DIR}/SMACKW32.LIB" +"Dbghelp.lib" +"Winmm.lib" +"ws2_32.lib" +bfVFS +Lua +Multiplayer +) + +# static libraries whose translation units rely on Application preprocessor definitions. set(Ja2_Libs - TileEngine - TacticalAI - Utils - Strategic - sgp - Laptop - Editor Console - Tactical + Editor + Ja2 + Laptop ModularizedTacticalAI - i18n + sgp + Strategic + Tactical + TacticalAI + TileEngine + Utils ) foreach(lib IN LISTS Ja2_Libs) add_subdirectory(${lib}) endforeach() -add_subdirectory(Ja2) +# language library relies on Application _and_ Language preprocessor definition. very bad. +add_subdirectory(i18n) # simple function to validate Languages and Application choices include(cmake/ValidateOptions.cmake) @@ -107,47 +118,47 @@ ValidateOptions("${ValidApplications}" "Applications" "${Applications}" "Applica # preprocessor definitions for Debug build, per the legacy MSBuild set(debugFlags $,JA2BETAVERSION;JA2TESTVERSION;DEBUG_ATTACKBUSY,>) -# Due to widespread preprocessor definition abuse in the codebase, practically -# every library-language-executable combination is its own compilation target -# TODO: refactor preprocessor usage onto, ideally, a single translation unit -foreach(lang IN LISTS LangTargets) - foreach(exe IN LISTS ApplicationTargets) - set(Executable ${exe}_${lang}) +foreach(app IN LISTS ApplicationTargets) + set(isEditor $) + set(isUb $) + set(isUbEditor $) + set(compilationFlags + $ + $ + $ + ) - # executable for an application/language combination, e.g. JA2_ENGLISH.exe - add_executable(${Executable} WIN32) - target_sources(${Executable} PRIVATE ${Ja2Src}) - - # Good libraries have already been built, can be simply linked here - target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $) - target_link_options(${Executable} PRIVATE $) - - # for each app/lang combination, the Very Bad libraries need to be built, - # with the appropriate preprocessor definitions - foreach(lib IN LISTS Ja2_Libs) - # syntactic sugar to hopefully make this more readable - set(VeryBadLib ${Executable}_${lib}) - set(isEditor $) - set(isUb $) - set(isUbEditor $) - - # static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib - add_library(${VeryBadLib}) - target_sources(${VeryBadLib} PRIVATE ${${lib}Src}) - - target_compile_definitions(${VeryBadLib} PUBLIC - $ - $ - $ - ${debugFlags} - ${lang} - ) - target_link_libraries(${Executable} PUBLIC ${VeryBadLib}) - endforeach() - - # for sgp only - target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") - target_link_libraries(${Executable}_sgp PUBLIC libpng) - target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION) + foreach(lib IN LISTS Ja2_Libs) + # library for an application, e.g. JA2UB_sgp + set(game_library ${app}_${lib}) + add_library(${game_library}) + target_sources(${game_library} PRIVATE ${${lib}Src}) + target_compile_definitions(${game_library} PRIVATE ${compilationFlags} ${debugFlags}) endforeach() + + foreach(lang IN LISTS LangTargets) + # executable for an application/language combination, e.g. JA2_ENGLISH.exe + set(exe ${app}_${lang}) + file(WRITE dummy.cpp "") + add_executable(${exe} WIN32 dummy.cpp) + target_link_libraries(${exe} PRIVATE ${Ja2_Libraries} $) + target_link_options(${exe} PRIVATE $) + + # language library for an application, e.g. JA2MAPEDITOR_ENGLISH_i18n + set(language_library ${exe}_i18n) + add_library(${language_library}) + target_sources(${language_library} PRIVATE ${i18nSrc}) + target_compile_definitions(${language_library} PRIVATE ${compilationFlags} ${debugFlags} ${lang}) + target_link_libraries(${exe} PRIVATE ${language_library}) + + # go through all game libraries again and link them to the app/language executable + foreach(lib IN LISTS Ja2_Libs) + target_link_libraries(${exe} PRIVATE ${app}_${lib}) + endforeach() + endforeach() + + # for SGP only + target_link_libraries(${app}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") + target_link_libraries(${app}_sgp PRIVATE libpng) + target_compile_definitions(${app}_sgp PRIVATE NO_ZLIB_COMPRESSION) endforeach() diff --git a/Ja2/CMakeLists.txt b/Ja2/CMakeLists.txt index 7f8806f9..c990339d 100644 --- a/Ja2/CMakeLists.txt +++ b/Ja2/CMakeLists.txt @@ -36,17 +36,3 @@ set(Ja2Src "${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp" ${CMAKE_CURRENT_SOURCE_DIR}/Res/ja2.rc PARENT_SCOPE) - -set(Ja2_Libraries -"${CMAKE_SOURCE_DIR}/libexpatMT.lib" -"Dbghelp.lib" -Lua -"${CMAKE_SOURCE_DIR}/lua51.lib" -"${CMAKE_SOURCE_DIR}/lua51.vc9.lib" -"Winmm.lib" -"${CMAKE_SOURCE_DIR}/SMACKW32.LIB" -"${CMAKE_SOURCE_DIR}/binkw32.lib" -bfVFS -"ws2_32.lib" -Multiplayer -PARENT_SCOPE) diff --git a/TODO b/TODO index e4bb3a3c..e2e87827 100644 --- a/TODO +++ b/TODO @@ -2,3 +2,4 @@ # priority (LOW,HIGH) and description LOW readd the C4838 (https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4838) warning to CMakeLists.txt once they're all fixed in the code +HIGH get rid of ENGLISH, GERMAN, etc preprocessor definitions completely. that way i18n can be built just once and language can be changed in the options screen pending game restart (hotloading will likely require more work)