/*========================================================================= * mnufont.c : Functions for the menus management * * Version 1.0 * Creation date 27/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 "DPT.h" #include "GEO.h" #include "GLI.h" */ #include "SCR.h" #include "RND.h" /* #include "POS.h" #include "SPO.h" #include "LST.h" #include "SNA.h" */ #define FON_MainFile #include "fonmem.h" #include "fonerm.h" #include "fonpub.h" #include "fonfont.h" #include "FON_Eff.h" #include "fontext.h" /*#if defined (U64) void qsort(void *,size_t,size_t,int (*)(const void *,const void *)); #endif*/ /*extern void SNA_fn_vWritePointerInGlobalPointersFile(unsigned long ulPointerAdr);*/ /*extern unsigned long SNA_fn_vReadPointerFromGlobalPointersFile();*/ /*----------------------------------------------------------------------------- * Description : Create a font *----------------------------------------------------------------------------- * Input : Name of the font * Output : Handle of the font *----------------------------------------------------------------------------- * Creation date : 2./05/96 Author : Michaël *----------------------------------------------------------------------------- * Modification date : Modification Author : * Modifications : *---------------------------------------------------------------------------*/ /*FON_tdxHandleOfFont FON_fn_xCreateFont(char *szFontName,unsigned long ulMaxNumberOfCharacters) { FON_tdxHandleOfFont hFont; // Allocate the memory hFont=FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,sizeof(FON_tdstFont)); #if !defined(U64) hFont->p_szFontName = FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,(strlen(szFontName)+1)*sizeof(char)); #endif / U64 strcpy(hFont->p_szFontName,szFontName); hFont->dLetter = FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,ulMaxNumberOfCharacters*sizeof(FON_tdxHandleOfVisual)); hFont->ulMaxNumberOfCharacters = ulMaxNumberOfCharacters; #if !defined(U64) // SCR_fnp_st_Link_SetValue(&FON_g_stGeneral.stFontLinkTable,szFontName,(unsigned long)hFont); LST2_M_StaticInitElement(hFont); LST2_M_StaticAddTail(&FON_g_stGeneral.hFontList,hFont); #endif // U64 return (hFont); }*/ /*----------------------------------------------------------------------------- * Description : Release a font *----------------------------------------------------------------------------- * Input : Handle of a font * Output : None *----------------------------------------------------------------------------- * Creation date : 2./05/96 Author : Michaël *----------------------------------------------------------------------------- * Modification date : Modification Author : * Modifications : *---------------------------------------------------------------------------*/ /*void FON_fn_vReleaseFont(FON_tdxHandleOfFont hFont) { FON_fn_vFreeInBloc(E_ucFONMemoryBlock,hFont->dLetter); #if !defined(U64) FON_fn_vFreeInBloc(E_ucFONMemoryBlock,hFont->p_szFontName); #endif // U64 FON_fn_vFreeInBloc(E_ucFONMemoryBlock,hFont); }*/ /*----------------------------------------------------------------------------- * Description : Remove a font from the global array *----------------------------------------------------------------------------- * Input : Name of the font * Output : None *----------------------------------------------------------------------------- * Creation date : 2./05/96 Author : Michaël *----------------------------------------------------------------------------- * Modification date : Modification Author : * Modifications : *---------------------------------------------------------------------------*/ /*void FON_fn_vRemoveFont(char *szFontName) { FON_fn_vReleaseFont(FON_fn_xGetFont(szFontName)); }*/ /*----------------------------------------------------------------------------- * Description : Return a font from its name *----------------------------------------------------------------------------- * Input : Name of the font * Output : Handle of the font *----------------------------------------------------------------------------- * Creation date : 2./05/96 Author : Michaël *----------------------------------------------------------------------------- * Modification date : Modification Author : * Modifications : *---------------------------------------------------------------------------*/ /*FON_tdxHandleOfFont FON_fn_xGetFont(char *szFontName) { FON_tdxHandleOfFont hReturn = NULL; #if !defined(U64) long i; FON_tdxHandleOfFont hFontElement; / * SCR_tdst_Link_Value *p_xIndex; p_xIndex = SCR_fnp_st_Link_SearchKey(&FON_g_stGeneral.stFontLinkTable,szFontName); if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized) hReturn = (FON_tdxHandleOfFont)SCR_M_ul_Link_GetValue(p_xIndex); else * / LST2_M_StaticForEachElementOf(&FON_g_stGeneral.hFontList,hFontElement,i) { if (!stricmp(hFontElement->p_szFontName,szFontName)) hReturn = hFontElement; } if (hReturn==NULL) M_FONWarningError(E_uwFONUnknownFont); #endif // U64 return(hReturn); }*/ /*----------------------------------------------------------------------------- * Description : Return the name of a font *----------------------------------------------------------------------------- * Input : Font * Output : Name of the font *----------------------------------------------------------------------------- * Creation date : 27/10/97 Author : François *----------------------------------------------------------------------------- * Modification date : Modification Author : * Modifications : *---------------------------------------------------------------------------*/ /*char *FON_fn_szGetFontName(FON_tdxHandleOfFont hFont) { char *p_szFontName = NULL; #if !defined(U64) long i; FON_tdxHandleOfFont hFontElement; LST2_M_StaticForEachElementOf(&FON_g_stGeneral.hFontList,hFontElement,i) { if (hFontElement==hFont) p_szFontName = hFontElement->p_szFontName; } / * SCR_tdst_Link_Value *p_xIndex; p_xIndex = SCR_fnp_st_Link_SearchValue(&FON_g_stGeneral.stFontLinkTable,(unsigned long)hFont); if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized) p_szFontName = SCR_M_p_sz_Link_GetKey(p_xIndex); else * / if (p_szFontName==NULL) M_FONWarningError(E_uwFONUnknownFont); #endif // U64 return(p_szFontName); }*/ /*----------------------------------------------------------------------------- * Description : Return TRUE if a font exists *----------------------------------------------------------------------------- * Input : Name of the font * Output : TRUE/FALSE *----------------------------------------------------------------------------- * Creation date : 2./05/96 Author : Michaël *----------------------------------------------------------------------------- * Modification date : Modification Author : * Modifications : *---------------------------------------------------------------------------*/ /*unsigned char FON_fn_bIsFontExists(char *szFontName) { unsigned char ucReturn = FALSE; #if !defined(U64) long i; FON_tdxHandleOfFont hFontElement; LST2_M_StaticForEachElementOf(&FON_g_stGeneral.hFontList,hFontElement,i) { if (!stricmp(hFontElement->p_szFontName,szFontName)) ucReturn = TRUE; } / * SCR_tdst_Link_Value *p_xIndex; p_xIndex = SCR_fnp_st_Link_SearchKey(&FON_g_stGeneral.stFontLinkTable,szFontName); if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized) { ucReturn = TRUE; } * / #endif // U64 return(ucReturn); }*/ /*----------------------------------------------------------------------------- * Description : General inits for the fonts *----------------------------------------------------------------------------- * Input : Nothing * Output : Nothing *----------------------------------------------------------------------------- * Creation date : 2./05/96 Author : Michaël *----------------------------------------------------------------------------- * Modification date : Modification Author : * Modifications : *---------------------------------------------------------------------------*/ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ void FON_fn_vInitFonts(void) { /*FON_g_stGeneral.hMatrix = GEO_fn_hCreateMatrix(); POS_fn_vSetIdentityMatrix(FON_g_stGeneral.hMatrix);*/ #if !defined(U64) SCR_fn_v_Link_InitTable(&FON_g_stTextLinkTable); /* SCR_fn_v_Link_InitTable(&FON_g_stGeneral.stFontLinkTable);*/ /*LST2_M_StaticInitAnchor(&FON_g_stGeneral.hFontList);*/ #endif /* U64 */ FON_g_stGeneral.uwNumberOfLanguages = 0; /* number of defined languages */ FON_g_stGeneral.d_sLanguageArray = NULL; /* array of defined languages */ FON_g_stGeneral.p_stCommonLanguage = NULL ; /* common language strings */ FON_g_stGeneral.ulElapsedTime = 0; FON_g_stGeneral.hRandomHandle = RND_fn_hReserveANewHandleIndex(); /*memset(&FON_g_stEffectByDisplay,0,sizeof(FON_stEffectByDisplay));*/ } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ /*************************************************************************/ /*int FON_fn_iQSortCmp(const void *hElement1,const void *hElement2) { unsigned short uwChar1,uwChar2; uwChar1 = (*(struct FON_tdstVisualFont_ **)hElement1)->uwCharacter; uwChar2 = (*(struct FON_tdstVisualFont_ **)hElement2)->uwCharacter; return(uwChar1-uwChar2); }*/ /*************************************************************************/ /*void FON_fn_vTreatLoadedFont(FON_tdxHandleOfFont hFont) { unsigned long i; // *** Leave all non used characters *** - Oliv' - Portage v15 - 1 warning removed here for (i=hFont->ulMaxNumberOfCharacters-1;i>0&&hFont->dLetter[i]==NULL;i--); if (hFont->ulMaxNumberOfCharacters!=i+1) { M_FONInformationErrorWithString(E_uwFONTooManyCharacterInFont,FON_fn_szGetFontName(hFont)); hFont->ulMaxNumberOfCharacters = i+1; } qsort((void*)hFont->dLetter,hFont->ulMaxNumberOfCharacters,sizeof(FON_tdxHandleOfVisual),FON_fn_iQSortCmp); }*/ /*************************************************************************/ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ void FON_fn_vDesInitFonts ( void ) { FON_fn_vDesinitFONMemory ( ) ; } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ #ifdef ACTIVE_EDITOR void FON_fn_vReInitFonts ( void ) { FON_fn_vInitFonts ( ) ; /* also clear the GAM list of available languages */ g_stEngineStructure . ucNbLanguages = 0 ; if ( g_stEngineStructure . p_stLanguageTable ) { /* this macro clears the pointer, so no need to do it ourselves */ M_GameFreeInHLM ( g_stEngineStructure . p_stLanguageTable ) ; } } #endif /* ACTIVE_EDITOR */ /*************************************************************************/ /*void FON_fn_vAddCharacterInFont(FON_tdxHandleOfFont hFont,unsigned long ulCharacterNumber,unsigned short uwCharacter,struct FON_st3DFont_ *h3DObject,MTH_tdxReal xBaseY) { hFont->dLetter[ulCharacterNumber]=FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,sizeof(struct FON_tdstVisualFont_)); hFont->dLetter[ulCharacterNumber]->uwCharacter = uwCharacter; hFont->dLetter[ulCharacterNumber]->xBaseY = xBaseY; hFont->dLetter[ulCharacterNumber]->h3DObject = h3DObject; }*/ /*************************************************************************/ /*struct FON_st3DFont_ *FON_fn_p_stGet3dObjectOfCharacter(FON_tdxHandleOfFont hFont,unsigned short uwCharacher) { struct FON_st3DFont_ *h3DObject = NULL; unsigned long i; for (i=0;iulMaxNumberOfCharacters&&hFont->dLetter[i]->uwCharacter!=uwCharacher;i++) { if (h3DObject==NULL&&hFont->dLetter[i]->uwCharacter==' ') h3DObject = hFont->dLetter[i]->h3DObject; } if (iulMaxNumberOfCharacters&&hFont->dLetter[i]->uwCharacter==uwCharacher) h3DObject = hFont->dLetter[i]->h3DObject; return (h3DObject); }*/ /*************************************************************************/ /*MTH_tdxReal FON_fn_xGetBaseYOfCharacter(FON_tdxHandleOfFont hFont,unsigned short uwCharacher) { MTH_tdxReal xBaseY=0; unsigned long i; for (i=0;iulMaxNumberOfCharacters&&hFont->dLetter[i]->uwCharacter!=uwCharacher;i++) { if (xBaseY==0&&hFont->dLetter[i]->uwCharacter==' ') xBaseY = hFont->dLetter[i]->xBaseY; } if (iulMaxNumberOfCharacters&&hFont->dLetter[i]->uwCharacter==uwCharacher) xBaseY = hFont->dLetter[i]->xBaseY; return (xBaseY); }*/ /*************************************************************************/ /*unsigned short FON_fn_uwGetDisplayedCharacter(FON_tdxHandleOfFont hFont,char *szText,unsigned long lIndex) { unsigned short uwReturn = 0; if (hFont->eTypeOfFont&FON_eGeneralStandard) uwReturn = (unsigned char)szText[lIndex]; else if (hFont->eTypeOfFont&FON_eGeneralUnicode) { if ((unsigned char)szText[lIndex]<128) uwReturn = (unsigned char)szText[lIndex]; else uwReturn = (unsigned short)((((unsigned char)szText[lIndex])<<8)+(unsigned char)szText[lIndex+1]); } return(uwReturn); }*/ /*************************************************************************/ /*unsigned long FON_fn_vGetNextCharacter(FON_tdxHandleOfFont hFont,char *szText,unsigned long lIndex) { unsigned long ulReturn = 0; if (hFont->eTypeOfFont&FON_eGeneralStandard) ulReturn = lIndex+1; else if (hFont->eTypeOfFont&FON_eGeneralUnicode) { if ((unsigned char)szText[lIndex]<128) ulReturn = lIndex+1; else ulReturn = lIndex+2; } return(ulReturn); }*/ /*************************************************************************/ /*void FON_fn_vRemoveAllFonts() { }*/ /*************************************************************************/ /*GLI_tdstLight *FON_fn_p_stCreateLight(MTH_tdxReal xR,MTH_tdxReal xG,MTH_tdxReal xB,MTH_tdxReal xA) { GLI_tdstLight *p_stLight; POS_tdstCompletePosition stLightMatrix; GLI_tdstColor stColor; MTH3D_tdstVector stI; MTH3D_tdstVector stJ; MTH3D_tdstVector stK; GLI_xCreateLight (&p_stLight,GLI_C_lParallelLight); stColor.xR = xR; stColor.xG = xG; stColor.xB = xB; stColor.xA = xA; GLI_xSetLightColor (p_stLight,&stColor ); GLI_xGetLightMatrix(p_stLight,&stLightMatrix); POS_fn_vGetRotationMatrix(&stLightMatrix, &stI, &stJ, &stK); MTH3D_M_vSetVectorElements(&stI,MTH_C_MinusONE,MTH_C_ZERO,MTH_C_ZERO); MTH3D_M_vSetVectorElements(&stJ,MTH_C_ZERO,MTH_C_ZERO,MTH_C_ONE); MTH3D_M_vSetVectorElements(&stK,MTH_C_ZERO,MTH_C_ZERO,MTH_C_ONE); POS_fn_vSetRotationMatrix(&stLightMatrix, &stI, &stJ, &stK); POS_fn_vComputeTransformMatrix (&stLightMatrix); GLI_xSetLightMatrix(p_stLight,&stLightMatrix); return(p_stLight); }*/ /*************************************************************************/ /* MR0410*/ /*void fn_vSaveFONGeneral() { unsigned long i; #if !defined(U64) //SNA_fn_vWriteStructureInGlobalPointersFile((unsigned long *)&FON_g_stGeneral,sizeof(FON_tdstGeneral)); SNA_fn_vWritePointerInGlobalPointersFile((unsigned long) FON_g_stGeneral.d_stFontAndEffectArray); for (i=0;i