/*=========================================================================
* IPT_Scpt.h : 
*     Script read
*
* (c) Ubi Studios 1997
*=======================================================================*/
 
#if !defined(__IPT_SCPT_H__)
#define __IPT_SCPT_H__
 
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
 
/****************************************/
#if !defined(CPA_EXPORT)
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif /*CPA_WANTS_IMPORT || CPA_WANTS_EXPORT*/
#endif /*CPA_EXPORT*/
/****************************************/
 
#undef EXTERN
#undef extern
#if !defined(D_IPT_Input_VariableDefine)
#define EXTERN extern
#else
#define EXTERN
#endif /* D_IPT_Input_VariableDefine*/
 
/**** Sections definitions ****/
#define IPT_C_EntryActionSection          "InputAction"
#define IPT_C_ParamOptions                "Options"
#define IPT_C_SequenceSection             "Sequence"    /* See also in IPT_KDef.h */
#define IPT_C_AddCommandsSection          "AddCommands"
 
#define IPT_C_ActivateDeviceSection       "ActivateDevices"
#define IPT_C_ActivateKeyboardAction      "Keyboard"
#define IPT_C_ActivatePadAction           "Pad"
#define IPT_C_ActivateJoystickAction      "Joystick"
 
#define IPT_C_KeyDefineSection            "KeyDefine"
#define IPT_C_KeyDefineAction             "NewKeyDefine"
 
/**** Macros definitions ****/
#define C_GrandChildSection    ( 2)
#define C_ChildSection         ( 1)
#define C_ThisSection          ( 0)
#define C_ParentSection        (-1)
#define C_GrandParentSection   (-2)
 
#define C_GrandChildContext    ( 2)
#define C_ChildContext         ( 1)
#define C_ThisContext          ( 0)
#define C_ParentContext        (-1)
#define C_GrandParentContext   (-2)
 
#define M_IsTitle         (_eAction==SCR_EA_Anl_BeginSection)
#define M_IsEnd           (_eAction==SCR_EA_Anl_EndSection)
#define M_IsBegSubSection (_eAction==SCR_EA_Anl_BeginSubSection)
#define M_IsEndSubSection (_eAction==SCR_EA_Anl_EndSubSection)
#define M_IsEntry         (_eAction==SCR_EA_Anl_Entry)
 
 
#define M_ActionIs(szActionAsked) (!strcmpi(_p_szName,szActionAsked))
 
#define M_CheckScriptParamNumber(ulNumber) \
{ \
 if (SCR_fn_uc_RdL0_GetNumberOfParameters(_ap_szParams)!=ulNumber) \
  M_GameFatalError(E_uwGameScriptBadNumberOfArg); \
}
 
#if !defined(U64)
/**** Functions definitions ****/
SCR_tde_Anl_ReturnValue IPT_fn_eAddKeyCommandsScriptCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
SCR_tde_Anl_ReturnValue IPT_fn_eAddKeyActionScriptCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
SCR_tde_Anl_ReturnValue IPT_fn_eSequenceCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
SCR_tde_Anl_ReturnValue IPT_fn_eActivateDeviceScriptCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
SCR_tde_Anl_ReturnValue IPT_fn_eKeyDefineScriptCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
#endif /* U64 */ 
 
extern CPA_EXPORT IPT_tdxHandleToKeyWordElement IPT_fn_hAllocKeyWord(void);
extern CPA_EXPORT signed short IPT_fn_swGetKeyValue(char *_szKeyName,IPT_tdxHandleToScriptValue _hScriptValueTable);
extern CPA_EXPORT char *IPT_fn_szGetKeyName(signed short swValue,IPT_tdxHandleToScriptValue _hScriptValueTable);
extern CPA_EXPORT char *IPT_fn_p_szGetKeyPointerOfName(char *_szKeyName,IPT_tdxHandleToScriptValue _hScriptValueTable);
extern CPA_EXPORT char *IPT_fn_p_szGetNameOfKeyName(unsigned short uwKeyCode,unsigned char ucFrenchOrAmerican);
 
#undef EXTERN
#undef extern
 
#endif /* __IPT_SCPT_H__ */
