- Added Chinese language support (thx to Noword from TBS)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2424 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2008-11-20 07:43:57 +00:00
parent 55059caf3b
commit 032fd1f353
29 changed files with 6111 additions and 366 deletions
+3 -35
View File
@@ -15,7 +15,7 @@
#endif
INT32 giCurWinFont = 0;
BOOLEAN gfUseWinFonts = FALSE;
//BOOLEAN gfUseWinFonts = FALSE;
// Global variables for video objects
@@ -87,7 +87,7 @@ HVOBJECT gvo14PointHumanist;
HVOBJECT gvoHugeFont;
#endif
INT32 giSubTitleWinFont;
//INT32 giSubTitleWinFont;
@@ -221,21 +221,7 @@ BOOLEAN InitializeFonts( )
// ATE: Init WinFont System and any winfonts we wish...
#ifdef WINFONTS
InitWinFonts( );
//giSubTitleWinFont = CreateWinFont( -16, 0, 0, 0, FALSE, FALSE, FALSE, L"¼Ð·¢Åé", CHINESEBIG5_CHARSET );
giSubTitleWinFont = CreateWinFont( -16, 0, 0, 0, FALSE, FALSE, FALSE, L"·s²Ó©úÅé", CHINESEBIG5_CHARSET );
SET_USE_WINFONTS( TRUE );
SET_WINFONT( giSubTitleWinFont );
Color = FROMRGB( 255, 255, 255 );
SetWinFontForeColor( giSubTitleWinFont, &Color );
PrintWinFont( FRAME_BUFFER, giSubTitleWinFont, 10, 100, L"Font %s initialized", gzFontName );
InvalidateScreen();
RefreshScreen( NULL );
SET_USE_WINFONTS( FALSE );
#endif
return( TRUE );
@@ -265,7 +251,7 @@ void ShutdownFonts( )
// ATE: Shutdown any win fonts
#ifdef WINFONTS
DeleteWinFont( giSubTitleWinFont );
ShutdownWinFonts();
#endif
}
@@ -342,31 +328,13 @@ UINT16 CreateFontPaletteTables(HVOBJECT pObj )
UINT16 WFGetFontHeight( INT32 FontNum )
{
if ( USE_WINFONTS( ) )
{
// return how many Y pixels we used
return( GetWinFontHeight( L"a\0", GET_WINFONT( ) ) );
}
else
{
// return how many Y pixels we used
return( GetFontHeight( FontNum ) );
}
}
INT16 WFStringPixLength( STR16 string,INT32 UseFont )
{
if ( USE_WINFONTS( ) )
{
// return how many Y pixels we used
return( WinFontStringPixLength( string, GET_WINFONT( ) ) );
}
else
{
// return how many Y pixels we used
return( StringPixLength( string, UseFont ) );
}
}
+2 -8
View File
@@ -10,12 +10,6 @@ extern INT32 giCurWinFont;
// ATE: Use this define to enable winfonts in JA2
// #define WINFONTS
#ifdef WINFONTS
#define USE_WINFONTS( ) ( gfUseWinFonts )
#else
#define USE_WINFONTS( ) ( FALSE )
#endif
#define GET_WINFONT( ) ( giCurWinFont )
#define SET_USE_WINFONTS( fSet ) ( gfUseWinFonts = fSet );
#define SET_WINFONT( fFont ) ( giCurWinFont = fFont );
@@ -97,7 +91,7 @@ extern INT32 gpHugeFont;
extern HVOBJECT gvoHugeFont;
#endif
extern INT32 giSubTitleWinFont;
//extern INT32 giSubTitleWinFont;
extern BOOLEAN gfFontsInit;
@@ -191,4 +185,4 @@ void ShutdownFonts( );
BOOLEAN SetFontShade( UINT32 uiFontID, INT8 bColorID );
#endif
#endif
+5 -1
View File
@@ -14,7 +14,7 @@
BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID )
{
#if defined( ENGLISH ) || defined( TAIWANESE ) || defined( FRENCH )
#if defined( ENGLISH ) || defined( TAIWANESE ) || defined( FRENCH ) || defined (CHINESE)
switch( usMLGGraphicID )
{
case MLG_AIMSYMBOL:
@@ -266,6 +266,10 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID )
sprintf( (char *)zLanguage, "SPANISH" );
#elif defined( TAIWANESE )
sprintf( (char *)zLanguage, "TAIWANESE" );
#elif defined( CHINESE)
sprintf( (char *)zLangauge, "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
+9 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="Utils_2005Express"
ProjectGUID="{262A5F80-0B99-4E8E-A6C7-74CB1FD0A67C}"
RootNamespace="Utils_2005Express"
@@ -430,6 +430,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\_ChineseText.cpp"
>
</File>
<File
RelativePath=".\_DutchText.cpp"
>
@@ -450,6 +454,10 @@
RelativePath=".\_ItalianText.cpp"
>
</File>
<File
RelativePath=".\_Ja25ChineseText.cpp"
>
</File>
<File
RelativePath=".\_Ja25DutchText.cpp"
>
+105 -31
View File
@@ -229,7 +229,21 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin
}
if((usCurrentWidthPixels > usLineWidthPixels))//||(DestString[ usDestIndex ]==NEWLINE_CHAR )||(fNewLine))
if((usCurrentWidthPixels > usLineWidthPixels)
#ifdef CHINESE
&& TempString[usCurIndex] != L''
&& TempString[usCurIndex] != L''
&& TempString[usCurIndex] != L''
&& TempString[usCurIndex] != L''
&& TempString[usCurIndex] != L''
&& TempString[usCurIndex] != L''
&& TempString[usCurIndex] != L''
&& TempString[usCurIndex] != L'?'
&& 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
@@ -237,7 +251,11 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin
DestString[ usDestIndex ] = L' ';
//Go back to begining of word
while( (DestString[ usDestIndex ] != L' ') && (usCurIndex > 0) )
while( (DestString[ usDestIndex ] != L' ') && (usCurIndex > 0)
#ifdef CHINESE
&& DestString[usDestIndex] < 255
#endif
)
{
OneChar[0] = DestString[ usDestIndex ];
@@ -246,6 +264,26 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin
usCurIndex--;
usDestIndex--;
}
#ifdef CHINESE
if (DestString[usDestIndex] > 255)
{
if (DestString[usDestIndex] == L''
|| DestString[usDestIndex] == L','
|| DestString[usDestIndex] == L''
|| DestString[usDestIndex] == L''
|| DestString[usDestIndex] == L''
|| DestString[usDestIndex] == L''
|| DestString[usDestIndex] == L''
|| DestString[usDestIndex] == L''
|| DestString[usDestIndex] == L'?'
|| DestString[usDestIndex] == L''
|| DestString[usDestIndex] == L')'
|| DestString[usDestIndex] == L'')
{usDestIndex++;}
else
{usCurIndex--;}
}
#endif
usEndIndex = usDestIndex;
if( usEndIndex < 0 )
@@ -472,34 +510,12 @@ BOOLEAN DrawTextToScreen(STR16 pStr, UINT16 usLocX, UINT16 usLocY, UINT16 usWidt
SetFont(ulFont);
if ( USE_WINFONTS( ) )
{
COLORVAL Color = FROMRGB( 255, 255, 255 );
SetWinFontForeColor( GET_WINFONT( ), &Color );
}
else
{
SetFontForeground(ubColor);
SetFontBackground( ubBackGroundColor );
}
if( ulFlags & TEXT_SHADOWED )
ShadowText( FRAME_BUFFER, pStr, ulFont, (UINT16)(usPosX-1), (UINT16)(usPosY-1 ) );
if ( USE_WINFONTS( ) )
{
if( fDirty )
{
gprintfdirty( usPosX, usPosY, pStr);
WinFont_mprintf( GET_WINFONT( ), usPosX,usPosY,pStr);
}
else
{
WinFont_mprintf( GET_WINFONT( ), usPosX,usPosY,pStr);
}
}
else
{
if( fDirty )
{
gprintfdirty( usPosX, usPosY, pStr);
@@ -509,7 +525,6 @@ BOOLEAN DrawTextToScreen(STR16 pStr, UINT16 usLocX, UINT16 usLocY, UINT16 usWidt
{
mprintf(usPosX,usPosY,pStr);
}
}
if( IAN_WRAP_NO_SHADOW & ulFlags )
{
@@ -555,7 +570,11 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN
do
{
// each character goes towards building a new word
if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0)
if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0
#ifdef CHINESE
&& pString[usSourceCounter] < 255
#endif
)
{
zWordString[usDestCounter++] = pString[usSourceCounter];
}
@@ -1348,12 +1367,24 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt
}
else // not a special character
{
#ifdef CHINESE
wchar_t currentChar=pString[usSourceCounter];
if (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
// add a space (in case we add another word to it)
zWordString[usDestCounter++] = 32;
@@ -1361,7 +1392,22 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt
zWordString[usDestCounter] = 0;
// can we fit it onto the length of our "line" ?
if ((usLineLengthPixels + usWordLengthPixels) < usWidth)
if ((usLineLengthPixels + usWordLengthPixels) < usWidth
#ifdef CHINESE
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L','
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L'?'
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L')'
|| pString[usSourceCounter] == L''
#endif
)
{
// yes we can fit this word.
@@ -1446,7 +1492,11 @@ 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)
if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0
#ifdef CHINESE
&& pString[usSourceCounter] <= 255
#endif
)
{
zWordString[usDestCounter++] = pString[usSourceCounter];
}
@@ -1659,12 +1709,24 @@ 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 (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
// add a space (in case we add another word to it)
zWordString[usDestCounter++] = 32;
@@ -1672,7 +1734,19 @@ 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)
if ((usLineLengthPixels + usWordLengthPixels) <= usWidth
#ifdef CHINESE
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L','
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L''
|| pString[usSourceCounter] == L')'
|| pString[usSourceCounter] == L''
#endif
)
{
// yes we can fit this word.
File diff suppressed because it is too large Load Diff
+106
View File
@@ -0,0 +1,106 @@
#ifdef PRECOMPILEDHEADERS
#include "Utils All.h"
#include "_Ja25Englishtext.h"
#else
#include "Language Defines.h"
#ifdef CHINESE
#include "text.h"
#include "Fileman.h"
#endif
#endif
#ifdef CHINESE
// VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD
STR16 zNewTacticalMessages[]=
{
/*
L"Range to target: %d tiles, Brightness: %d/%d",
L"Attaching the transmitter to your laptop computer.",
L"You cannot afford to hire %s",
L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.",
L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.",
*/
L"目标的距离: %d",
L"将发报机装到笔记本电脑上。",
L"你无法支付雇佣%s的费用",
L"在限定时间内,以上的费用包括了整个行动和下列装备的花费。",
L"现在就雇请%s吧。您可以享受我们提供的空前的“一次付费,全部服务”的优惠价格。在这个难以置信的出价里,佣兵的随身装备是免费的哦。",
/*
L"Fee",
L"There is someone else in the sector...",
L"Gun Range: %d tiles, Chance to hit: %d percent",
L"Display Cover",
L"Line of Sight",
*/
L"费用",
L"在本分区发现有人..",
L"枪的射程: %d 目标的距离: %d",
L"显示覆盖物",
L"视距",
/*
L"New Recruits cannot arrive there.",
L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!",
L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified
L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.",
L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...",
*/
L"新雇请的佣兵无法到达那里。",
L"由于你的笔记本电脑没有发报机,你无法雇请新的队员。也许你得读取存档或者重新开始游戏!",
L"%s听到了Jerry的身体下面传来金属的破碎的声音。听起来令人不安,似乎你的笔记本电脑的天线被压断了。",
L"看完副指挥官Morris留下的备忘录后,%s觉得有机会了。备忘录里有向Arulco各个城镇发射导弹的基地的坐标。它还给出了这个罪恶计划的发源地的坐标 —— 导弹工厂。",
L"看到了控制面板后, %s发现它正在倒计时,因此导弹会把这个工厂炸毁。%s得找出个脱逃的路线。使用电梯看起来是最快的办法...",
/*
L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text
L"(Cannot save during combat)", //@@@@ new text
L"The current campaign name is greater than 30 characters.", // @@@ new text
L"The current campaign cannot be found.", // @@@ new text
L"Campaign: Default ( %S )", // @@@ new text
*/
L"现在您在铁人模式进行游戏,周围有敌人的时候不能存档。",
L"(不能在战斗时存盘)",
L"当前的战役名称超过了30个字符。",
L"无法找到当前的战役。", // @@@ new text
L"战役: 默认 ( %S )", // @@@ new text
/*
L"Campaign: %S", // @@@ new text
L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text
L"In order to use the editor, please select a campaign other than the default.", ///@@new
*/
L"战役: %S", // @@@ new text
L"你选择了%S战役。 该战役是原版UB战役的玩家自定义游戏版本。你确认你要在 %S 战役下进行游戏吗?",
L"如果你要使用编辑器的话,请选择一个战役,不要用默认战役。",
};
//these strings match up with the defines in IMP Skill trait.cpp
STR16 gzIMPSkillTraitsText[]=
{
L"开锁", //"Lock picking",
L"徒手格斗", //"Hand to hand combat",
L"电子", //"Electronics",
L"夜战", //"Night operations",
L"投掷", //"Throwing",
L"教学", //"Teaching",
L"重武器", //"Heavy Weapons",
L"自动武器", //"Auto Weapons",
L"潜行", //"Stealth",
L"双手武器", //"Ambidextrous",
L"刀技", //"Knifing",
L"神射手", //"Sniper",
L"伪装", //"Camouflage",
L"武术", //"Martial Arts",
L"", //"None",
L"I.M.P 专属技能", //"I.M.P. Specialties",
};
//@@@: New string as of March 3, 2000.
STR16 gzIronManModeWarningText[]=
{
// L"You have chosen IRON MAN mode. This setting makes the game considerably more challenging as you will not be able to save your game when in a sector occupied by enemies. This setting will affect the entire course of the game. Are you sure want to play in IRON MAN mode?",
L"你选择了铁人模式。这将会游戏变得相当有挑战性,因为你无法在敌人占据的分区存档。 这个设置会影响游戏的整个进程。你确认你要在铁人模式下进行游戏吗?",
};
#endif