#ifndef __TEXTFRMT_H__
#define __TEXTFRMT_H__
 
#if _MSC_VER >= 1000
#pragma once
#endif
 
#include "GAM/Header.h"
 
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
 
/*the structure that holds all the relevant information for formatting*/
typedef struct stTfmtStatus_
{
  MTH_tdxReal xScreenWidth;
  MTH_tdxReal xBaseCharX, xBaseCharZ;
  MTH_tdxReal xBaseToAddX;
  MTH_tdxReal xRandomPosRadius;
  MTH_tdxReal xCharWidth, xLineHeight, xCharZoom;
  MTH_tdxReal xCurCharZoom ;
  MTH_tdxReal xCurCharWidth ;
  tdxHandleToObjectsTablesList hSourceObjectTable;
  char cJustificationMode;
} tdstTfmtStatus;
 
typedef struct stTfmtLineResults_
{
	short wStartChar;
	short wEndChar;
	MTH3D_tdstVector stLineOrigin;
} tdstTfmtLineResults;
 
#define MAX_TEXTAFFICHE 30
 
typedef struct stInfoTextAffiche_
{
    BOOL            bFirstInit;
    unsigned long   ulCurrentDelay;             /* Delay between letters*/
    unsigned long   ulTimer;                    /* The Timer*/
    unsigned long   ulEvent;                    /* Evenement*/
    short           wCurrentLetterInString;     /* Position of the current letter in string*/
}  tdstInfoTextAffiche;
 
 
#define TFMT_MAX_SCALEDPATTERN 50
#define TFMT_MAX_WIDTHTABLEELMENT 256
 
 
 
extern unsigned char g_ucTextAfficheId;
extern HIE_tdxHandleToSuperObject   gp_SuperObjPersoGenerated[MAX_TEXTAFFICHE];
extern tdstInfoTextAffiche g_stInfoTextAffiche[MAX_TEXTAFFICHE];
extern BOOL g_bFreeTextAfficheBlocs[MAX_TEXTAFFICHE];
 
short TFMT_wPositionModulesAccordingToText(tdstTfmtStatus *_p_stStatus, HIE_tdxHandleToSuperObject _hSuperObjPerso, char *_pszText, long _lStart, long _lEnd, MTH_tdxReal _xScreenWidth, tdstTfmtLineResults *_d_stLineResults, short _wNbLines);
unsigned long TFMT_wPositionModulesAccordingToText2(tdstTfmtStatus *_p_stStatus, HIE_tdxHandleToSuperObject _hSuperObjPerso, char *_pszText, long _lStart, long _lEnd, ACP_tdxBool *bFirstTime, short *pwCurrentChar, unsigned long *ulDelay);
void TFMT_vInitFormatterStatus(tdstTfmtStatus *_p_stStatus, HIE_tdxHandleToSuperObject _hSuperObjPerso, MTH_tdxReal _xScreenWidth);
void TFMT_vChangeLetter( HIE_tdxHandleToSuperObject hSuperObjPerso, unsigned char ucPosLetter, unsigned char ucLetter );
void TEXT_vComputeLengthOgString( char *p_szString, tdstTfmtStatus *p_stStatus );
void TFMT_vSetDefaultValuesCharacter(MTH_tdxReal _xCharWidth, MTH_tdxReal _xLineHeight, MTH_tdxReal _xCharZoom);
void TFMT_vInitTextAfficheStructure( void );
unsigned char TFMT_ucNumberOfCurrentTextAffiche( HIE_tdxHandleToSuperObject p_SuperObjPersoTreated );
unsigned char TFMT_ucSetNumber4CurrentTextAffiche( void );
void TFMT_ucClearNumberOfCurrentTextAffiche( HIE_tdxHandleToSuperObject p_SuperObjPersoTreated );
 
 
void TFMT_vInitScapingTable ( MTH_tdxReal xValue ) ;
void TFMT_vUpdateSpacingTable ( char *szText ) ;
void TFMT_vInitScaleTable ( MTH_tdxReal xValue ) ;
void TFMT_vUpdateScaleTable ( char *szText ) ;
 
#if defined(__cplusplus)
}
#endif /* __cplusplus */
 
#endif /* __TEXTFRMT_H__ */
 
