Merge pull request #378 from majcosta/pr_remove_language_from_preprocessor

Get every language preprocessor conditional into one library
This commit is contained in:
majcosta
2024-12-31 18:32:50 -03:00
committed by GitHub
68 changed files with 895 additions and 744 deletions
+2
View File
@@ -1,3 +1,5 @@
dummy.cpp
# CLion
/.idea/
/cmake-build-*/
+87 -74
View File
@@ -22,12 +22,12 @@ endif()
option(ADDRESS_SANITIZER OFF)
if(ADDRESS_SANITIZER)
message(STATUS "AddressSanitizer ENABLED for non-Release builds")
add_compile_options($<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,-fsanitize=address,>)
message(STATUS "AddressSanitizer ENABLED for non-Release builds")
add_compile_options($<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,-fsanitize=address,>)
endif()
if(MSVC)
add_compile_options("/wd4838")
add_compile_options("/wd4838")
endif()
# whether we are using MSBuild as a generator
@@ -39,21 +39,22 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>: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}/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
@@ -65,32 +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
ModularizedTacticalAI
Console
Editor
Ja2
Laptop
ModularizedTacticalAI
sgp
Strategic
Tactical
TacticalAI
TileEngine
Utils
)
foreach(lib IN LISTS Ja2_Libs)
add_subdirectory(${lib})
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)
@@ -105,47 +118,47 @@ ValidateOptions("${ValidApplications}" "Applications" "${Applications}" "Applica
# preprocessor definitions for Debug build, per the legacy MSBuild
set(debugFlags $<IF:$<CONFIG:Debug>,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 $<STREQUAL:${app},JA2MAPEDITOR>)
set(isUb $<STREQUAL:${app},JA2UB>)
set(isUbEditor $<STREQUAL:${app},JA2UBMAPEDITOR>)
set(compilationFlags
$<IF:${isEditor},JA2EDITOR;JA2BETAVERSION,>
$<IF:${isUb},JA2UB;JA2UBMAPS,>
$<IF:${isUbEditor},JA2UB;JA2UBMAPS;JA2EDITOR;JA2BETAVERSION,>
)
# executable for an application/language combination, e.g. JA2_ENGLISH.exe
add_executable(${Executable} WIN32)
target_sources(${Executable} PRIVATE ${Ja2Src})
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()
# Good libraries have already been built, can be simply linked here
target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $<IF:${usingMsBuild},legacy_stdio_definitions.lib,>)
target_link_options(${Executable} PRIVATE $<IF:${usingMsBuild},/SAFESEH:NO,>)
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} $<IF:${usingMsBuild},legacy_stdio_definitions.lib,>)
target_link_options(${exe} PRIVATE $<IF:${usingMsBuild},/SAFESEH:NO,>)
# 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 $<STREQUAL:${exe},JA2MAPEDITOR>)
set(isUb $<STREQUAL:${exe},JA2UB>)
set(isUbEditor $<STREQUAL:${exe},JA2UBMAPEDITOR>)
# 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})
# static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib
add_library(${VeryBadLib})
target_sources(${VeryBadLib} PRIVATE ${${lib}Src})
# 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()
target_compile_definitions(${VeryBadLib} PUBLIC
$<IF:${isEditor},JA2EDITOR;JA2BETAVERSION,>
$<IF:${isUb},JA2UB;JA2UBMAPS,>
$<IF:${isUbEditor},JA2UB;JA2UBMAPS;JA2EDITOR;JA2BETAVERSION,>
${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(${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()
-14
View File
@@ -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)
+76 -102
View File
@@ -78,6 +78,8 @@
#include "DynamicDialogueWidget.h" // added by Flugente for InitMyBoxes()
#include "Animation Data.h" // added by Flugente
#include <language.hpp>
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());
@@ -254,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) )
@@ -268,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);
@@ -294,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;
@@ -366,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);
@@ -411,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);
@@ -448,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();
@@ -463,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))
@@ -478,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
@@ -497,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
@@ -521,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);
@@ -702,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();
@@ -760,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);
@@ -780,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);
@@ -801,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);
@@ -830,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) )
{
@@ -838,7 +812,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
if(!ReadInMercProfiles(fileName,TRUE))
return FALSE;
}
#endif
}
}
strcpy(fileName, directoryName);
@@ -856,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);
@@ -926,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
}
}
@@ -945,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
}
}
@@ -962,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)
{
@@ -979,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
@@ -995,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 );
@@ -1016,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
@@ -1044,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);
@@ -1059,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);
}
@@ -1078,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);
@@ -1093,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( );
@@ -1185,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<NUM_PROFILES; i++)
{
@@ -1206,14 +1180,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAimAvailability(fileName,FALSE), AIMAVAILABILITY);
#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(ReadInAimAvailability(fileName,TRUE), fileName);
}
#endif
}
//Main Menu by Jazz
strcpy(fileName, directoryName);
@@ -1226,7 +1200,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInActionItems(fileName,FALSE), ACTIONITEMSFILENAME);
#ifndef ENGLISH
if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1234,7 +1208,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
if(!ReadInActionItems(fileName,TRUE))
return FALSE;
}
#endif
}
if ( ReadXMLEmail == TRUE )
{
@@ -1244,7 +1218,7 @@ if ( ReadXMLEmail == TRUE )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEmailMercAvailable(fileName,FALSE), EMAILMERCAVAILABLE);
#ifndef ENGLISH
if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1252,7 +1226,7 @@ if ( ReadXMLEmail == TRUE )
if(!ReadInEmailMercAvailable(fileName,TRUE))
return FALSE;
}
#endif
}
// EMAIL MERC LEVEL UP by Jazz
strcpy(fileName, directoryName);
@@ -1260,7 +1234,7 @@ if ( ReadXMLEmail == TRUE )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEmailMercLevelUp(fileName,FALSE), EMAILMERCLEVELUP);
#ifndef ENGLISH
if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1268,7 +1242,7 @@ if ( ReadXMLEmail == TRUE )
if(!ReadInEmailMercLevelUp(fileName,TRUE))
return FALSE;
}
#endif
}
}
/*
// EMAIL OTHER by Jazz
@@ -1277,7 +1251,7 @@ if ( ReadXMLEmail == TRUE )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEmailOther(fileName,FALSE), EMAILOTHER);
#ifndef ENGLISH
if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1285,7 +1259,7 @@ if ( ReadXMLEmail == TRUE )
if(!ReadInEmailOther(fileName,TRUE))
return FALSE;
}
#endif
}
*/
//new vehicles by Jazz
@@ -1296,7 +1270,7 @@ if ( ReadXMLEmail == TRUE )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInNewVehicles(fileName,FALSE), VEHICLESFILENAME);
#ifndef ENGLISH
if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1304,9 +1278,9 @@ if ( ReadXMLEmail == TRUE )
if(!ReadInNewVehicles(fileName,TRUE))
return FALSE;
}
#endif
}
#ifndef ENGLISH
if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1314,7 +1288,7 @@ if ( ReadXMLEmail == TRUE )
if(!ReadInLanguageLocation(fileName,TRUE,zlanguageText,0))
return FALSE;
}
#endif
}
#ifdef ENABLE_BRIEFINGROOM
strcpy(fileName, directoryName);
@@ -1322,14 +1296,14 @@ if ( ReadXMLEmail == TRUE )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInBriefingRoom(fileName,FALSE,gBriefingRoomData, 4), BRIEFINGROOMFILENAME);
#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(ReadInBriefingRoom(fileName,TRUE,gBriefingRoomData, 4), fileName);
}
#endif
}
BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
@@ -1341,14 +1315,14 @@ BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMinerals(fileName,FALSE), MINERALSFILENAME);
#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(ReadInMinerals(fileName,TRUE), fileName);
}
#endif
}
// Old AIM Archive
UINT8 p;
@@ -1362,14 +1336,14 @@ BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAimOldArchive(fileName,FALSE), OLDAIMARCHIVEFILENAME);
#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(ReadInAimOldArchive(fileName,TRUE), fileName);
}
#endif
}
UINT8 emptyslotsinarchives = 0;
for (p=0;p<NUM_PROFILES;p++)
{
@@ -1419,14 +1393,14 @@ BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInDifficultySettings(fileName,FALSE), DIFFICULTYFILENAME);
#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(ReadInDifficultySettings(fileName,TRUE), fileName);
}
#endif
}
LuaState::INIT(lua::LUA_STATE_STRATEGIC_MINES_AND_UNDERGROUND, true);
g_luaUnderground.LoadScript(GetLanguagePrefix());
+4 -3
View File
@@ -36,6 +36,7 @@
#include "LuaInitNPCs.h"
#include "XML.h"
#include <language.hpp>
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;
+4 -3
View File
@@ -5,6 +5,7 @@
#include "Timer Control.h"
#include "Multi Language Graphic Utils.h"
#include <stdio.h>
#include <language.hpp>
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 );
+5 -4
View File
@@ -152,6 +152,7 @@
#endif
#include "LuaInitNPCs.h"
#include <language.hpp>
#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;
+4 -5
View File
@@ -48,6 +48,7 @@
#include "IniReader.h"
#include "sgp_logger.h"
#include <language.hpp>
#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 )
@@ -958,7 +959,6 @@ void DoneFadeOutForDemoExitScreen( void )
// unused
//extern INT8 gbFadeSpeed;
#ifdef GERMAN
void DisplayTopwareGermanyAddress()
{
VOBJECT_DESC vo_desc;
@@ -993,7 +993,6 @@ void DisplayTopwareGermanyAddress()
ExecuteBaseDirtyRectQueue();
EndFrameBufferRender();
}
#endif
UINT32 DemoExitScreenHandle(void)
{
+15 -8
View File
@@ -49,6 +49,7 @@
#include "Encrypted File.h"
#include "InterfaceItemImages.h"
#include <sstream>
#include <language.hpp>
//
//****** Defines ******
@@ -5366,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;
@@ -5461,20 +5468,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
}
+1
View File
@@ -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;
+4 -10
View File
@@ -20,6 +20,7 @@
// HEADROCK HAM 4
#include "input.h"
#include "Encyclopedia_new.h" //update encyclopedia item visibility when viewing that item
#include <language.hpp>
#define BOBBYR_DEFAULT_MENU_COLOR 255
@@ -86,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
@@ -115,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
@@ -2516,11 +2510,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);
}
+7 -6
View File
@@ -30,6 +30,7 @@
#include "GameSettings.h"
#include <vfs/Core/vfs.h>
#include <vfs/Core/File/vfs_file.h>
#include <language.hpp>
/*
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 )
+7 -7
View File
@@ -24,6 +24,7 @@
#include "text.h"
#include "LaptopSave.h"
#include <language.hpp>
#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 )
+4 -3
View File
@@ -38,6 +38,7 @@
#include "GameSettings.h"
#endif
#include <language.hpp>
#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 ):
+1 -1
View File
@@ -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 <Text.h> // Sniper warning
#include "../../Utils/message.h" // ditto
+2 -20
View File
@@ -96,6 +96,7 @@ extern "C" {
#include "Merc Contract.h"
#include "message.h"
#include "Town Militia.h"
#include <language.hpp>
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<INT32>(g_lang);
lua_pushinteger( L, val );
}
@@ -55,6 +55,7 @@
#include "connect.h"
#include <language.hpp>
struct UILayout_BottomButtons
{
-6
View File
@@ -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
+7 -6
View File
@@ -56,6 +56,7 @@
#include "MilitiaSquads.h"
#include "LaptopSave.h"
#include <language.hpp>
// 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 );
}
+4 -3
View File
@@ -40,6 +40,7 @@
#include "Luaglobal.h"
#include "LuaInitNPCs.h"
#include "Interface.h"
#include <language.hpp>
#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 );
+10 -9
View File
@@ -115,6 +115,7 @@
#include "connect.h" //hayden
#include "InterfaceItemImages.h"
#include "vobject.h"
#include <language.hpp>
#ifdef JA2UB
#include "laptop.h"
@@ -9664,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;
+1
View File
@@ -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)
+4 -3
View File
@@ -67,6 +67,7 @@
#include "ub_config.h"
#include "history.h"
#include <language.hpp>
//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 );
+4 -3
View File
@@ -33,6 +33,7 @@
#include "GameSettings.h"
#include "fresh_header.h"
#include "connect.h"
#include <language.hpp>
#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
}
}
}
File diff suppressed because it is too large Load Diff
+181 -58
View File
@@ -82,6 +82,7 @@
#include "Sound Control.h"
#include "Multi Language Graphic Utils.h"
#include <language.hpp>
#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 );
@@ -12280,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,
@@ -12304,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,
@@ -12331,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;
@@ -12379,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,
@@ -12402,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
@@ -12427,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;
@@ -12437,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
@@ -12454,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
@@ -12473,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;
@@ -12512,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,
@@ -12528,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;
@@ -12557,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
@@ -12576,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
@@ -12597,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;
@@ -12609,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;
}
+11 -9
View File
@@ -73,6 +73,8 @@
//legion by Jazz
#include "Interface Utils.h"
#include <language.hpp>
//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
-8
View File
@@ -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"
-18
View File
@@ -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"
@@ -16,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"
@@ -37,20 +35,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)
+11 -6
View File
@@ -5,6 +5,7 @@
#include "vsurface.h"
#include "wcheck.h"
#include "Font Control.h"
#include <language.hpp>
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
+41 -47
View File
@@ -5,6 +5,7 @@
#include "Stdio.h"
#include "WinFont.h"
#include <language.hpp>
#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.
+1
View File
@@ -22,6 +22,7 @@
#include "GameSettings.h"
#include "sgp_logger.h"
#include <language.hpp>
typedef struct
{
UINT32 uiFont;
+23
View File
@@ -0,0 +1,23 @@
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"
"${CMAKE_CURRENT_SOURCE_DIR}/Multi Language Graphic Utils.cpp"
PARENT_SCOPE
)
@@ -6,10 +6,11 @@
//SB
#include "FileMan.h"
#include <language.hpp>
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;
}
@@ -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
+12 -12
View File
@@ -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
{
+25
View File
@@ -0,0 +1,25 @@
#pragma once
#include <Types.h>
namespace i18n {
enum class Lang
{
en,
de,
ru,
nl,
pl,
fr,
it,
zh
};
}
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;
+63
View File
@@ -0,0 +1,63 @@
#include <language.hpp>
#include <BobbyR.h>
#include <laptop.h>
/* 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
};
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
};
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)
""
#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
;
}
-1
View File
@@ -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"
+8 -9
View File
@@ -22,6 +22,7 @@
#include "font.h"
#include "Font Control.h"
#include "GameSettings.h"
#include <language.hpp>
#include <vfs/Tools/vfs_property_container.h>
@@ -37,9 +38,7 @@ typedef struct
COLORVAL BackColor;
UINT8 Height;
UINT8 InternalLeading;
#ifdef CHINESE
UINT8 Width[0x80];
#endif
} HWINFONT;
LONG gWinFontAdjust;
@@ -355,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++)
@@ -367,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);
@@ -469,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)
@@ -484,7 +483,7 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont )
p++;
}
return size;
#else
} else {
SIZE RectSize;
HDC hdc = GetDC(NULL);
@@ -493,7 +492,7 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont )
ReleaseDC(NULL, hdc);
return( (INT16)RectSize.cx );
#endif
}
}
@@ -504,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;
}
+3 -2
View File
@@ -58,6 +58,7 @@
#endif
#include <Music Control.h>
#include <language.hpp>
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;