/*=========================================================================
* AllActs.c : This module contain simple used functions for actions
* This is a part of the Game project.
*
* Version                      1.0
* Creation date        11/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
 
#include "ToolsCPA.h"
 
#include "Options/Options.h"
#include "Macros.h"
 
#include "Main.h"
 
#include "Actions/AllActs.h"
 
#include "Structur/3DOSLkTb.h"
#include "Structur/ErrGame.h"
#include "Structur/EngMode.h"
#include "Structur/Objects.h"
#include "Structur/StdObjSt.h"
#include "Structur/GameScpt.h"
#include "Structur/MemGame.h"
 
#include "Always.h"
#include "Basic.h"
#include "Engine.h"
#include "GameEng.h"
#include "LoadLvl.h"
#include "MainChar.h"
#include "ObjType.h"
#include "ZeMem.h"
 
/*-----------------------------------------------------------------------------
 *  Description : Used to register all script callback functions
 *-----------------------------------------------------------------------------
 *  Input :         object type
 *  Output :        Size of structure
 *-----------------------------------------------------------------------------
 *  Creation date : 02/09/96            Author : Francois
 *-----------------------------------------------------------------------------
 *  Modification date :                 Modification Author :
 *  Modifications :
 *-----------------------------------------------------------------------------
 *  Modification date :January 1997     Modification Author : Albert
 *  Modifications : Adding script registration for MSWay
 *---------------------------------------------------------------------------*/
void fn_vRegisterAllActionsScriptSections()
{
#if defined(GAM_USE_SCRIPT)
 SCR_fn_v_RdL0_RegisterCallback(C_Section3dDataDescription,fn_e3dDataScriptCallBack,SCR_CRC_c_RdL0_ForSection);
 SCR_fn_v_RdL0_RegisterCallback(C_SectionStdGameDescription,fn_eStdGameScriptCallBack,SCR_CRC_c_RdL0_ForSection);
 SCR_fn_v_RdL0_RegisterCallback(C_SectionBrainDescription,fn_eBrainScriptCallBack,SCR_CRC_c_RdL0_ForSection);
 SCR_fn_v_RdL0_RegisterCallback(C_SectionDynamDescription,fn_eDynamScriptCallBack,SCR_CRC_c_RdL0_ForSection);
 SCR_fn_v_RdL0_RegisterCallback(C_SectionCineinfoDescription,CAM_fn_eCineinfoScriptCallBack,SCR_CRC_c_RdL0_ForSection);
 SCR_fn_v_RdL0_RegisterCallback(C_SectionCollSetDescription,fn_eCollSetScriptCallBack,SCR_CRC_c_RdL0_ForSection);
 SCR_fn_v_RdL0_RegisterCallback(C_SectionSectInfoDescription,fn_eSectInfoScriptCallBack,SCR_CRC_c_RdL0_ForSection);
 SCR_fn_v_RdL0_RegisterCallback(C_SectionMSWayDescription,fn_eMSWayScriptCallBack,SCR_CRC_c_RdL0_ForSection);
 SCR_fn_v_RdL0_RegisterCallback(C_SectionLightDescription,fn_eLightScriptCallBack,SCR_CRC_c_RdL0_ForSection);
 SCR_fn_v_RdL0_RegisterCallback(C_SectionMicroDescription,fn_eMicroScriptCallback,SCR_CRC_c_RdL0_ForSection);
 SCR_fn_v_RdL0_RegisterCallback(C_SectionMSPrtSrcDescription,fn_eMSPrtSrcScriptCallback,SCR_CRC_c_RdL0_ForSection);
 SCR_fn_v_RdL0_RegisterCallback(C_SectionMSSoundDescription,fn_eMSSoundScriptCallback,SCR_CRC_c_RdL0_ForSection);
 /*ANNECY BBB 17/10/97 {*/
 SCR_fn_v_RdL0_RegisterCallback(C_SectionAnimEffectDescription,fn_eAnimEffectScriptCallback,SCR_CRC_c_RdL0_ForSection);
 /*ENDANNECY BBB 17/10/97 }*/
 /* CHINA QZY (MT) 26/02/98 {*/
 SCR_fn_v_RdL0_RegisterCallback(C_SectionMSMagnetDescription,fn_eMSMagnetScriptCallback,SCR_CRC_c_RdL0_ForSection);
 /* ENDCHINA QZY }*/
#endif /* GAM_USE_SCRIPT */
}
 
/*-----------------------------------------------------------------------------
 *  Description :   Callback script function
 *-----------------------------------------------------------------------------
 *  Input :         ...
 *  Output :        void
 *-----------------------------------------------------------------------------
 *  Creation date : 29/08/96            Author : Francois
 *-----------------------------------------------------------------------------
 *  Modification date :                 Modification Author :
 *  Modifications :
 *---------------------------------------------------------------------------*/
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_eScriptCallBackOneCharacter(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction)
{
	SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
 struct tdstEngineObject_ *p_stEngineObject;
/* HIE_tdxHandleToSuperObject h_SupObject;*/
 
 _p_stFile=_p_stFile;
 
/* SCR_M_RdL0_GetSectionLong(C_ParentSection,0,HIE_tdxHandleToSuperObject, h_SupObject);*/
 
 if (M_IsTitle)
 {
  char szTextWindows[_MAX_PATH];
  char szForScript[_MAX_PATH];
 
  sprintf(szTextWindows,"Chargement de %s",_p_szName);
  fn_vChangeWindowTitle(szTextWindows);
 
  MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeEngineObject , 0 );
  p_stEngineObject=(tdstEngineObject *)M_p_GameMallocInHLM(sizeof(struct tdstEngineObject_));
 
 
/*  if (h_SupObject!=NULL)*/
/*   HIE_fn_vSetSuperObjectObjectAndType(h_SupObject,(void *)p_stEngineObject,HIE_C_ulActor);*/
  SCR_M_RdL0_SetSectionLong(C_ThisSection,0,p_stEngineObject);
 
  SCR_M_RdL0_ComputeOpenSectionNameR(0,szForScript);
  SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stCharacter,szForScript,(unsigned long)p_stEngineObject),1,strlen(szForScript)-strlen(SCR_M_RdL0_GetCompleteSectionNameR(0)));
 }
 return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
 
 
