/*=========================================================================
* mittext.c : Functions for the menus management
*
* Version              1.0
* Creation date        2./05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi R&D 1997
*=======================================================================*/
/*
*=======================================================================
Modifications:
*=======================================================================*/
/*#include "fonhdls.h"*/
 
#include "ACP_Base.h"
#include "ToolsCPA.h"
#include "macros.h"
#include "Structur/EngMode.h"
 
#include "MTH.h"
/*#include "DPT.h"*/
/*#include "GEO.h"*/
/*#include "GLI.h"*/
#include "SCR.h"
#include "RND.h"
/*#include "POS.h"*/
/*#include "SPO.h"*/
/*#include "LST.h"*/
 
#include "fonpub.h"
/*#include "fonmem.h"*/
#include "fonerm.h"
#include "fonfont.h"
/*#include "FON_Eff.h"*/
#include "fontext.h"
 
/*XB*/
/*#include <string.h>*/
/*End XB*/
 
/*************************************************************************/
/*MTH_tdxReal FON_fn_xComputePartXWithAlign(FON_tdxHandleOfString hText,long lIndex,MTH_tdxReal x,enum FON_tdeAlignment_ eXAlign)
{
 MTH_tdxReal xPosX = 0.0f;
 
 if (eXAlign==FON_E_LeftAlign)
	 xPosX=x;
 else if (eXAlign==FON_E_MiddleAlign)
  xPosX=x-FON_fn_xWidthOfText(hText,lIndex)/2;
 else if (eXAlign==FON_E_RightAlign)
  xPosX=x-FON_fn_xWidthOfText(hText,lIndex);
 
 return(xPosX);
}*/
/*************************************************************************/
/*MTH_tdxReal FON_fn_xComputeXWithAlign(FON_tdxHandleOfString hText,MTH_tdxReal x,enum FON_tdeAlignment_ eXAlign)
{
 MTH_tdxReal xPosX = 0.0f;
 
 if (eXAlign==FON_E_LeftAlign)
	 xPosX=x;
 else if (eXAlign==FON_E_MiddleAlign)
  xPosX=x-FON_fn_xWidthOfMultipleText(hText)/2;
 else if (eXAlign==FON_E_RightAlign)
  xPosX=x-FON_fn_xWidthOfMultipleText(hText);
 
 return(xPosX);
}*/
/*************************************************************************/
/*MTH_tdxReal FON_fn_xComputeYWithAlign(FON_tdxHandleOfString hText,MTH_tdxReal y,enum FON_tdeAlignment_ eYAlign)
{
 MTH_tdxReal xPosY = 0.0f;
 
 if (eYAlign==FON_E_UpAlign)
  xPosY=y/ *-FON_fn_xHeightOfMultipleText(hText)* /;
 else if (eYAlign==FON_E_MiddleAlign)
  xPosY=y-FON_fn_xHeightOfMultipleText(hText)/2;
 else if (eYAlign==FON_E_DownAlign)
  xPosY=y-FON_fn_xHeightOfMultipleText(hText);
 
 return(xPosY);
}*/
/*************************************************************************/
/*void FON_fn_vDrawText(FON_tdxHandleOfString hText,MTH_tdxReal x,MTH_tdxReal y,enum FON_tdeAlignment_ eXAlign,enum FON_tdeAlignment_ eYAlign,FON_tdeTypeOfDisplay _eDisplayType)
{
 FON_fn_vDrawText3D(hText,x,y,0.0,eXAlign,eYAlign,_eDisplayType);
}*/
/*************************************************************************/
/*void FON_fn_vDrawText3D(FON_tdxHandleOfString hText,MTH_tdxReal x,MTH_tdxReal y,MTH_tdxReal z,enum FON_tdeAlignment_ eXAlign,enum FON_tdeAlignment_ eYAlign,FON_tdeTypeOfDisplay _eDisplayType)
{ 
 char *szText;
 MTH3D_tdstVector stVector;
	MTH3D_tdstVector stI,stJ,stK;
 MTH_tdxReal xZDecalValue;
 
 FON_tdxHandleOfFont   hFont;
 struct FON_st3DFont_  *h3DObject;
 unsigned long i,j;
 unsigned long ulNextCharacter;
 
 unsigned short uwDisplayedCharacter;
 
 struct FON_stText_    *p_stText;
 
 POS_fn_vSetIdentityMatrix(FON_g_stGeneral.hMatrix);
 
 p_stText = FON_fn_p_stGetTextPointerOfHandle(hText);
 hFont = FON_fn_xGetFontOfTextHandle(hText);
	szText=p_stText->szText;
 
 MTH3D_M_vSetZofVector(&stVector,FON_fn_xComputeYWithAlign(hText,(MTH_tdxReal)y,eYAlign));
 MTH3D_M_vSetYofVector(&stVector,z);
 
 xZDecalValue = FON_fn_xHeightOfText(hText);
 for (j=0;szText[j]!=0;j=i)
 {
  MTH3D_M_vSetXofVector(&stVector,FON_fn_xComputePartXWithAlign(hText,j,(MTH_tdxReal)x,eXAlign));
	 for (i=j;szText[i]!=0&&szText[i]!=0x5E;i=ulNextCharacter)
	 {
   uwDisplayedCharacter = FON_fn_uwGetDisplayedCharacter(hFont,szText,i);
   ulNextCharacter = FON_fn_vGetNextCharacter(hFont,szText,i);
 
   if (p_stText->d_hLocalMatrix!=NULL)
   {
    POS_fn_vGetTranslationVector(p_stText->d_hLocalMatrix[i],&stI);
    MTH3D_M_vAddVector(&stI,&stI,&stVector);
    POS_fn_vSetTranslationVector(FON_g_stGeneral.hMatrix,&stI);
    POS_fn_vGetRotationMatrix(p_stText->d_hLocalMatrix[i],&stI,&stJ,&stK);
    POS_fn_vSetRotationMatrix(FON_g_stGeneral.hMatrix,&stI,&stJ,&stK);
    POS_fn_vGetScaleMatrix(p_stText->d_hLocalMatrix[i],&stI,&stJ,&stK);
    POS_fn_vSetScaleMatrix(FON_g_stGeneral.hMatrix,&stI,&stJ,&stK);
   }
   else
   {
    POS_fn_vSetTranslationVector(FON_g_stGeneral.hMatrix,&stVector);
    MTH3D_M_vSetVectorElements(&stI,1,0,0);
    MTH3D_M_vSetVectorElements(&stJ,0,1,0);
    MTH3D_M_vSetVectorElements(&stK,0,0,1);
    POS_fn_vSetRotationMatrix(FON_g_stGeneral.hMatrix,&stI,&stJ,&stK);
    POS_fn_vSetScaleMatrix(FON_g_stGeneral.hMatrix,&stI,&stJ,&stK);
   }
 
   h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,uwDisplayedCharacter);
 
   POS_fn_vGetTranslationVector(FON_g_stGeneral.hMatrix,&stI);
   MTH3D_M_vSetZofVector(&stI,MTH3D_M_xGetZofVector(&stI)+xZDecalValue-h3DObject->xHeight+FON_fn_xGetBaseYOfCharacter(hFont,uwDisplayedCharacter));
   POS_fn_vSetTranslationVector(FON_g_stGeneral.hMatrix,&stI);
 
   if (h3DObject->hGLIGeometric!=NULL)
    if (FON_fn_p_stGetTextPointerOfHandle(hText)->d_p_stLight!=NULL)
     FON_fn_vDraw3DObject(h3DObject,FON_g_stGeneral.hMatrix,FON_fn_p_stGetTextPointerOfHandle(hText)->d_p_stLight[i]);
    else
     FON_fn_vDraw3DObject(h3DObject,FON_g_stGeneral.hMatrix,NULL);
 
   // *** Effect of text *** - Oliv' - Portage v15 - 1 warning removed here
   FON_fn_vPlayLetterEffect(hText,FON_fn_p_stGetEffectPointerOfHandle(hText),i);
    
   if (_eDisplayType==FON_Enabled)
    FON_fn_vPlayLetterEffect(hText,&FON_g_stEffectByDisplay.stEnabledEffect,i);
   else if (_eDisplayType==FON_Disabled)
    FON_fn_vPlayLetterEffect(hText,&FON_g_stEffectByDisplay.stDisabledEffect,i);
   else if (_eDisplayType==FON_Pressed)
    FON_fn_vPlayLetterEffect(hText,&FON_g_stEffectByDisplay.stPressedEffect,i);
   else if (_eDisplayType==FON_Selected)
    FON_fn_vPlayLetterEffect(hText,&FON_g_stEffectByDisplay.stSelectedEffect,i);
     
   MTH3D_M_vSetXofVector(&stVector,
            MTH3D_M_xGetXofVector(&stVector)+
            h3DObject->xWidth/2+
            hFont->xCharacterSpace);
   if (szText[ulNextCharacter]!=0)
   {
    h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,FON_fn_uwGetDisplayedCharacter(hFont,szText,ulNextCharacter));
    MTH3D_M_vSetXofVector(&stVector,
             MTH3D_M_xGetXofVector(&stVector)+
             h3DObject->xWidth/2);
   }
  }
  if (szText[i]==0x5E)
   i++;
  MTH3D_M_vSetZofVector(&stVector,MTH3D_M_xGetZofVector(&stVector)+FON_fn_xHeightOfText(hText));
	}
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xWidthOfTextByHandle(FON_tdxHandleOfString hText,long lIndex)
{
 return(FON_fn_xWidthOfText(hText,lIndex));
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xHeightOfTextByHandle(FON_tdxHandleOfString hText)
{
 return(FON_fn_xHeightOfText(hText));
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xWidthOfText(FON_tdxHandleOfString hText,long lIndex)
{
 unsigned int i;
 MTH_tdxReal xPosX = 0.0f;
 char *szText=FON_fn_p_stGetTextPointerOfHandle(hText)->szText+lIndex;
 struct FON_st3DFont_     *h3DObject;
 unsigned long ulNextCharacter;
 FON_tdxHandleOfFont   hFont;
 
 hFont = FON_fn_xGetFontOfTextHandle(hText);
 
 for (i=0;szText[i]!=0&&szText[i]!=0x5E;i=ulNextCharacter)
	{
  ulNextCharacter = FON_fn_vGetNextCharacter(hFont,szText,i);
  h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,FON_fn_uwGetDisplayedCharacter(hFont,szText,i));
 
  if (i==0&&(szText[i+1]==0||szText[ulNextCharacter]==0x5E))
  {
	  xPosX=0.0f;
  }
  else if(szText[ulNextCharacter]==0||szText[ulNextCharacter]==0x5E)
	  xPosX+=(h3DObject->xWidth)/2;
  else if(i==0)
	  xPosX+=(h3DObject->xWidth)/2 + hFont->xCharacterSpace;
  else
	  xPosX+=h3DObject->xWidth + hFont->xCharacterSpace;
	}
 return(xPosX);
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xHeightOfText(FON_tdxHandleOfString hText)
{
 return(FON_fn_p_stGet3dObjectOfCharacter(FON_fn_p_stGetFontAndEffectPointerOfHandle(hText)->p_stFont,' ')->xHeight);
 return MTH_C_ZERO;
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xWidthOfLetter(FON_tdxHandleOfString hText,unsigned long lIndex)
{
 MTH_tdxReal xPosX = 0.0f;
 char *szText=FON_fn_p_stGetTextPointerOfHandle(hText)->szText+lIndex;
 struct FON_st3DFont_     *h3DObject;
 FON_tdxHandleOfFont   hFont;
 
 hFont = FON_fn_xGetFontOfTextHandle(hText);
 
 h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,FON_fn_uwGetDisplayedCharacter(hFont,szText,0));
 xPosX=h3DObject->xWidth + hFont->xCharacterSpace;
 
 return(xPosX);
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xWidthOfMultipleText(FON_tdxHandleOfString hText)
{
 unsigned long i;
 MTH_tdxReal xMaxPosX = 0.0f;
 MTH_tdxReal xPosX = 0.0f;
 char *szText=FON_fn_p_stGetTextPointerOfHandle(hText)->szText;
 struct FON_st3DFont_     *h3DObject;
 unsigned long ulNextCharacter;
 FON_tdxHandleOfFont   hFont;
 
 hFont = FON_fn_xGetFontOfTextHandle(hText);
 
 for (i=0;szText[i]!=0;i=ulNextCharacter)
	{
  ulNextCharacter = FON_fn_vGetNextCharacter(hFont,szText,i);
  if (szText[i]==0x5E)
  {
   xPosX = 0;
  }
  else
  {
   h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,FON_fn_uwGetDisplayedCharacter(hFont,szText,i));
   if(szText[ulNextCharacter]==0||szText[ulNextCharacter]==0x5E)
 	  xPosX+=(h3DObject->xWidth)/2;
   else if(i==0)
	   xPosX+=(h3DObject->xWidth)/2 + hFont->xCharacterSpace;
   else
	   xPosX+=h3DObject->xWidth + hFont->xCharacterSpace;
   if (xPosX>xMaxPosX)
    xMaxPosX = xPosX;
  }
	}
 return(xMaxPosX);
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xHeightOfMultipleText(FON_tdxHandleOfString hText)
{
 char *p_szTemp = FON_fn_p_stGetTextPointerOfHandle(hText)->szText;
 unsigned long i;
 
 for (i=1;strchr(p_szTemp,0x5E)!=NULL;i++,p_szTemp=strchr(p_szTemp,0x5E)+1);
 
 return(i*(FON_fn_p_stGet3dObjectOfCharacter(FON_fn_p_stGetFontAndEffectPointerOfHandle(hText)->p_stFont,' ')->xHeight));
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xRealHeightOfText(FON_tdxHandleOfString hText,long lIndex)
{
 unsigned int i;
 MTH_tdxReal xHeight = 0.0f;
 char *szText=FON_fn_p_stGetTextPointerOfHandle(hText)->szText+lIndex;
 struct FON_st3DFont_     *h3DObject = NULL;
 FON_tdxHandleOfFont   hFont;
 unsigned long ulNextCharacter;
 
 hFont = FON_fn_xGetFontOfTextHandle(hText);
 
 for (i=0;szText[i]!=0&&szText[i]!=0x5E;i=ulNextCharacter)
	{
  ulNextCharacter = FON_fn_vGetNextCharacter(hFont,szText,i);
  h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,FON_fn_uwGetDisplayedCharacter(hFont,szText,i));
  if (xHeight>h3DObject->xHeight)
   xHeight=h3DObject->xHeight;
	}
 return(xHeight);
}*/
/**************************************************************************/
/*void FON_fn_vAllocText(FON_tdxHandleOfString hTextNumber,unsigned long _ulSize/ *,enum FON_tdeTextEffect_ _eTextEffect* /)
{
	char/ *struct FON_stText_* / *hText;
	//struct FON_tdstFontAndEffect_ *hFontAndEffect;
//	unsigned long i;
 
	//hText = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,sizeof(struct FON_stText_));
	//hFontAndEffect=FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,sizeof(struct FON_tdstFontAndEffect_));
 
 hText/ *->szText* / = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize+1);
 memset(hText/ *->szText* /,0,_ulSize+1);
 memset(hText/ *->szText* /,' ',_ulSize);
 
 // *** Effect gestion *** - Oliv' - Portage v15 - 1 warning removed here
 / *if (_eTextEffect!=FON_e_Nothing)
 {
  if (_eTextEffect&FON_e_NeedMatrix)
   hText->d_hLocalMatrix = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
  else
   hText->d_hLocalMatrix = NULL;
  if (_eTextEffect&FON_e_Translation)
   hText->d_hLocalDynTranslation = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
  else
   hText->d_hLocalDynTranslation = NULL;
  if (_eTextEffect&FON_e_Rotation)
   hText->d_hLocalDynRotation = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
  else
   hText->d_hLocalDynRotation = NULL;
  if (_eTextEffect&FON_e_Scale)
   hText->d_hLocalDynScale = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
  else
   hText->d_hLocalDynScale = NULL;
  if (_eTextEffect&FON_e_Light)
   hText->d_p_stLight = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
  else
   hText->d_p_stLight = NULL;
 
  for (i=0;i<_ulSize;i++)
  {
   if (_eTextEffect&FON_e_NeedMatrix)
   {
    hText->d_hLocalMatrix[i] = GEO_fn_hCreateMatrix();
    POS_fn_vSetIdentityMatrix(hText->d_hLocalMatrix[i]);
   }
   if (_eTextEffect&FON_e_Translation)
   {
    hText->d_hLocalDynTranslation[i] = POS_fn_hCreateDynVector();
    POS_fn_vSetDynVector(hText->d_hLocalDynTranslation[i],0.0,0.0,0.0);
   }
   if (_eTextEffect&FON_e_Rotation)
   {
    hText->d_hLocalDynRotation[i] = POS_fn_hCreateDynVector();
    POS_fn_vSetDynVector(hText->d_hLocalDynRotation[i],0.0,0.0,0.0);
   }
   if (_eTextEffect&FON_e_Scale)
   {
    hText->d_hLocalDynScale[i] = POS_fn_hCreateDynVector();
    POS_fn_vSetDynVector(hText->d_hLocalDynScale[i],1.0,1.0,1.0);
   }
   if (_eTextEffect&FON_e_Light)
    hText->d_p_stLight[i] = NULL;
  }
 }
 else
 {
  hText->d_hLocalMatrix = NULL;
  hText->d_hLocalDynTranslation = NULL;
  hText->d_hLocalDynRotation = NULL;
  hText->d_hLocalDynScale = NULL;
  hText->d_p_stLight = NULL;
 }* /
 //hFontAndEffect->p_stFont = NULL;
	
 FON_g_stGeneral.d_stTextsArray[hTextNumber] = hText;
 //FON_g_stGeneral.d_stFontAndEffectArray[hTextNumber] = hFontAndEffect;
}*/
/**************************************************************************/
/*
void FON_fn_vAllocTextWithoutString(FON_tdxHandleOfString hTextNumber,unsigned long _ulSize)
{
 struct FON_stText_ *hText;
 struct FON_tdstFontAndEffect_ *hFontAndEffect;
 unsigned long i;
 
 hText=FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,sizeof(struct FON_stText_));
 hFontAndEffect=FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,sizeof(struct FON_tdstFontAndEffect_));
 
 hText->d_hLocalMatrix = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
 hText->d_hLocalDynTranslation = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
 hText->d_hLocalDynRotation = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
 hText->d_hLocalDynScale = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
 for (i=0;i<_ulSize;i++)
 {
  hText->d_hLocalMatrix[i] = GEO_fn_hCreateMatrix();
  POS_fn_vSetIdentityMatrix(hText->d_hLocalMatrix[i]);
  hText->d_hLocalDynTranslation[i] = POS_fn_hCreateDynVector();
  hText->d_hLocalDynRotation[i] = POS_fn_hCreateDynVector();
  hText->d_hLocalDynScale[i] = POS_fn_hCreateDynVector();
  POS_fn_vSetDynVector(hText->d_hLocalDynTranslation[i],0.0,0.0,0.0);
  POS_fn_vSetDynVector(hText->d_hLocalDynRotation[i],0.0,0.0,0.0);
  POS_fn_vSetDynVector(hText->d_hLocalDynScale[i],1.0,1.0,1.0);
 }
 hFontAndEffect->p_stFont = NULL;
	
 FON_g_stGeneral.d_stTextsArray[hTextNumber] = hText;
 FON_g_stGeneral.d_stFontAndEffectArray[hTextNumber] = hFontAndEffect;
}
*/
/**************************************************************************/
/*unsigned long FON_fn_ulGetNumberOfTexts(void)
{
 return(FON_g_stGeneral.ulNumberOfTexts);
}*/
 
#if !defined(U64)
/**************************************************************************/
FON_tdxHandleOfText FON_fn_hGetTextHandle(char *_szLinkKey)
{
  FON_tdxHandleOfText hReturn = FON_C_xInvalidTextHandle;
 
  if ( _szLinkKey && strlen(_szLinkKey) )
  {
    SCR_tdst_Link_Value *p_xIndex;
 
    p_xIndex = SCR_fnp_st_Link_SearchKey(&FON_g_stTextLinkTable,_szLinkKey);
 
    if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized)
    {
      hReturn = (FON_tdxHandleOfText) SCR_M_ul_Link_GetValue(p_xIndex);
    }
 
    if ( hReturn == FON_C_xInvalidTextHandle )
      M_FONWarningError(E_uwFONUnknownText);
  }
 
  return hReturn;
}
/**************************************************************************/
FON_tdxHandleOfText FON_fn_hGetTextHandleWithoutWarning(char *_szLinkKey)
{
  FON_tdxHandleOfText hReturn = FON_C_xInvalidTextHandle;
 
  SCR_tdst_Link_Value *p_xIndex;
 
  p_xIndex = SCR_fnp_st_Link_SearchKey(&FON_g_stTextLinkTable,_szLinkKey);
 
  if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized)
  {
    hReturn = (FON_tdxHandleOfText) SCR_M_ul_Link_GetValue(p_xIndex);
  }
  return hReturn;
}
/**************************************************************************/
#ifdef ACTIVE_EDITOR
char *FON_fn_szGetNameOfTextHandle(FON_tdxHandleOfText hString)
{
 char *p_szReturn = NULL;
 
 SCR_tdst_Link_Value *p_xIndex;
 
 p_xIndex = SCR_fnp_st_Link_SearchValue(&FON_g_stTextLinkTable,(long) hString);
 
 if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized)
 {
  p_szReturn = (char *)SCR_M_p_sz_Link_GetKey(p_xIndex);
 }
 return p_szReturn;
}
#endif /* ACTIVE_EDITOR */
/**************************************************************************/
#endif /* U64 */
 
char *FON_fn_szLoadOneStringForCurrentLanguage(FON_tdxHandleOfText _IdOfString);
 
char *FON_fn_szGetTextPointerForHandle(FON_tdxHandleOfText hString)
{
	return ( hString == FON_C_xInvalidTextHandle )
	? NULL
	#ifdef U64 // FB170399
	: FON_fn_szLoadOneStringForCurrentLanguage(hString);
	#else
	: (
		( hString < FON_C_HandleOffsetForCommonLanguage )
		? FON_g_stGeneral.d_sLanguageArray[g_stEngineStructure.ucCurrentLanguage].d_pTextsArray[hString]
		: FON_g_stGeneral . p_stCommonLanguage -> d_pTextsArray[ hString - FON_C_HandleOffsetForCommonLanguage ]
	) ;
	#endif
 
}
 
 
#if !defined(RETAIL) || defined(USE_MONITOR)
unsigned short FON_fn_uwGetNumberOfAvailableLanguages()
{
  return FON_g_stGeneral.uwNumberOfLanguages;
}
#endif !defined(RETAIL) || defined(USE_MONITOR)
 
 
 
/*FON_tdxHandleOfString FON_fn_hGetTextHandleWithFont(char *_szLinkKey,FON_tdxHandleOfFont hFont)
{
 FON_tdxHandleOfString hReturn = FON_fn_hGetInvalidTextHandle();
 #if !defined(U64)
 SCR_tdst_Link_Value *p_xIndex;
 
 p_xIndex = SCR_fnp_st_Link_SearchKey(&FON_g_stGeneral.stTextLinkTable,_szLinkKey);
 
 if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized)
 {
  hReturn = (FON_tdxHandleOfString)SCR_M_ul_Link_GetValue(p_xIndex);
  FON_fn_vChangeFontOfText(hReturn,hFont);
 }
 
 if (hReturn==FON_fn_hGetInvalidTextHandle())
  M_FONWarningError(E_uwFONUnknownText);
 
 #endif // U64
 return (hReturn);
}*/
/*************************************************************************/
/*void FON_fn_vChangeFontOfText(FON_tdxHandleOfString hText,FON_tdxHandleOfFont hFont)
{
 FON_g_stGeneral.d_stFontAndEffectArray[hText]->p_stFont = hFont;
}*/
/*************************************************************************/
/*FON_tdxHandleOfFont FON_fn_xGetFontOfTextHandle(FON_tdxHandleOfString hText)
{
 return(FON_g_stGeneral.d_stFontAndEffectArray[hText]->p_stFont);
}*/
/*************************************************************************/
/*char/ *struct FON_stText_* / *FON_fn_p_stGetTextPointerOfHandle(FON_tdxHandleOfString hText)
{
 return(FON_g_stGeneral.d_stTextsArray[hText]);
}*/
/*************************************************************************/
/*struct FON_tdstFontAndEffect_ *FON_fn_p_stGetFontAndEffectPointerOfHandle(FON_tdxHandleOfString hText)
{
 return(FON_g_stGeneral.d_stFontAndEffectArray[hText]);
}*/
/*************************************************************************/
/*struct FON_tdstEffect_ *FON_fn_p_stGetEffectPointerOfHandle(FON_tdxHandleOfString hText)
{
 return(&FON_g_stGeneral.d_stFontAndEffectArray[hText]->stEffect);
}*/
/*************************************************************************/
/*enum FON_tdeTypeOfFont_ FON_fn_eGetTypeOfFontForText(FON_tdxHandleOfString hText)
{
 enum FON_tdeTypeOfFont_ eReturn = FON_eUnknow;
 
 if (FON_fn_p_stGetFontAndEffectPointerOfHandle(hText)->p_stFont!=NULL)
  eReturn = FON_fn_p_stGetFontAndEffectPointerOfHandle(hText)->p_stFont->eTypeOfFont;
 
 return(eReturn);
}*/
/*************************************************************************/
/*unsigned long FON_fn_ulGetDisplayedLenghtOfText(FON_tdxHandleOfString hText)
{
 // *** Return the number of displayed characters *** - Oliv' - Portage v15 - 1 warning removed here
 unsigned long i;
 unsigned long ulReturn = 0;
 char *p_szText;
 FON_tdxHandleOfFont   hFont;
 
 hFont = FON_fn_xGetFontOfTextHandle(hText);
 p_szText = FON_fn_p_stGetTextPointerOfHandle(hText)/ *->szText* /;
 
 for (i=0;p_szText[i]!=0;i=FON_fn_vGetNextCharacter(hFont,p_szText,i),ulReturn++);
 
 return(ulReturn);
}*/
/*************************************************************************/
/*unsigned long FON_fn_ulGetTrueLenghtOfText(FON_tdxHandleOfString hText)
{
 // *** Return the number of char characters *** - Oliv' - Portage v15 - 1 warning removed here
 return(strlen(FON_fn_p_stGetTextPointerOfHandle(hText)->szText));
}*/
/*************************************************************************/
/*char *FON_fn_p_szGetStringPointer(FON_tdxHandleOfString hText)
{
 return(FON_fn_p_stGetTextPointerOfHandle(hText)->szText);
}*/
/*************************************************************************/
/*void FON_fn_vChangeText(FON_tdxHandleOfString hText,char *szText)
{
 strcpy(FON_fn_p_stGetTextPointerOfHandle(hText)/ *->szText* /,szText);
}*/
/*************************************************************************/
/*void FON_fn_vUpperText(FON_tdxHandleOfString hText)
{
 strupr(FON_fn_p_stGetTextPointerOfHandle(hText)/ *->szText* /);
}*/
/*************************************************************************/
/*FON_tdxHandleOfString FON_fn_hGetInvalidTextHandle(void)
{
 return(0xffffffff);
}*/
/*************************************************************************/
/*unsigned char FON_fn_bIsAValidText(FON_tdxHandleOfString hText)
{
 if (hText==FON_fn_hGetInvalidTextHandle())
  return(FALSE);
 else
  return(TRUE);
}*/
/**************************************************************************/
/*struct FON_tdstEffect_ *FON_fn_p_stGetEffectPointer(FON_tdxHandleOfString hText)
{
 return(&FON_fn_p_stGetFontAndEffectPointerOfHandle(hText)->stEffect);
}*/
/**************************************************************************/
