/* (c) Ubi R&D 1997*/ /* See Alain Robin for any comment or question*/ /****************************************************************************/ /* INCLUDES */ /****************************************************************************/ #include "cpa_std.h" #include "acp_base.h" #include "SCR.h" #include "GLI/Material.h" #include "MEC.h" #include "ErmGmt.h" #include "GmtStruc.h" /* structure definition*/ #include "GmtProto.h" /* functions prototype*/ #include "GmtFunct.h" /* accessors*/ #include "GmtVProt.h" /* virtual functions implementations*/ #include "GmtLoad.h" /* load functions and defines*/ /*---------------------------------------------------------------------------/ // Description : GMT_fn_hCreateFor3DOS // Structure creation for 3DOS ------------------------------------------------------------------------------ // Methods : Allocate memory and return the handle ------------------------------------------------------------------------------ // Input : // Output : The handle to the allocated memory ------------------------------------------------------------------------------ // Creation date : Apr 97 Author: Alain Robin ------------------------------------------------------------------------------ // Modifications : // Modification date : Modification author : ---------------------------------------------------------------------------*/ GMT_tdxHandleToGameMaterial GMT_fn_hCreateFor3DOS(void) { GMT_tdxHandleToGameMaterial hNewGameMaterial; MMG_fn_vAddMemoryInfo( MMG_C_lTypeGMT , MMG_C_lSubTypeFor3DOS , 0 ); GEO_M_CPAMalloc(hNewGameMaterial,GMT_tdxHandleToGameMaterial,sizeof(struct GMT_tdstGameMaterial_),E_uwGEONotEnoughtMemory); if(hNewGameMaterial!=NULL) { /* pointers initialization */ DNM_fn_vInvalidateMatCharacteristics(&(hNewGameMaterial->hMechanicsMaterial)); hNewGameMaterial->hVisualMaterial=(ACP_tdxHandleOfMaterial)NULL; hNewGameMaterial->hSoundMaterial=(SND_tdxHandleToSoundMaterial)GMT_C_InvalidSoundMaterial; hNewGameMaterial->hCollideMaterial=(GMT_tdxHandleToCollideMaterial)GMT_C_InvalidCollideMaterial; /* fbolefeysot - 01/10/98*/ /* remove init values in GMT{*/ /* hNewGameMaterial->p_stInitialValues=NULL;*/ /*END fbolefeysot}*/ #ifdef SECTOR_IN_GMT hNewGameMaterial->hSectorMaterial=(HIE_tdxHandleToSuperObject)NULL; #endif /* SECTOR_IN_GMT*/ return hNewGameMaterial; } return NULL; } /*---------------------------------------------------------------------------- // Description : GMT_fn_vCopyFor3DOS // Used to copy an existing game material struct for 3DOS (all fields) ----------------------------------------------------------------------------// // Methods : Use the "Get" and the "Set" macros to copy the field pointers ----------------------------------------------------------------------------// // Input : _hSrc : source game material // Output : _hDst : copied game material ----------------------------------------------------------------------------// // Creation date : May 97 Author: Alain Robin ----------------------------------------------------------------------------// // Modifications : // Modification date : Modification author : ----------------------------------------------------------------------------*/ void GMT_fn_vCopyFor3DOS(GMT_tdxHandleToGameMaterial _hDst, GMT_tdxHandleToGameMaterial _hSrc) { ACP_tdxHandleOfMaterial hVisual,hCopyOfVisual; #ifdef _DEBUG if((!GMT_fn_b_ulIsValid(_hDst))||(!GMT_fn_b_ulIsValid(_hSrc))) GMT_fn_vRaiseFatalError(); #endif /* Duplicate visual material */ hVisual=GMT_fn_hGetVisualMaterial(_hSrc); GLI_xDuplicateMaterial (&hCopyOfVisual,hVisual); GMT_M_vSetVisualMaterial(_hDst,hCopyOfVisual); GMT_M_vSetSoundMaterial(_hDst,GMT_M_hGetSoundMaterial(_hSrc)); GMT_M_vSetCollideMaterial(_hDst,GMT_M_hGetCollideMaterial(_hSrc)); GMT_M_vSetMechanicsMaterial(_hDst,GMT_M_hGetMechanicsMaterial(_hSrc)); #ifdef SECTOR_IN_GMT GMT_M_vSetSectorMaterial(_hDst,GMT_M_hGetSectorMaterial(_hSrc)); #endif /* SECTOR_IN_GMT */ /* Copy initial values */ /* fbolefeysot - 01/10/98*/ /* remove init values in GMT{*/ /* if(_hSrc->p_stInitialValues!=NULL) { if(_hDst->p_stInitialValues==NULL) { _hDst->p_stInitialValues=GMT_fn_hCreateGameMaterial(); memcpy(_hDst->p_stInitialValues,_hSrc->p_stInitialValues,sizeof(struct GMT_tdstGameMaterial_)); } else { memcpy(_hDst->p_stInitialValues,_hSrc->p_stInitialValues,sizeof(struct GMT_tdstGameMaterial_)); } } */ /*END fbolefeysot}*/ } /* //////////////////////////////////////////////////////////////////////////// // Description : GMT_fn_vDestroyFor3DOS // Delete a created game material handle ////////////////////////////////////////////////////////////////////////////// // Methods : None ////////////////////////////////////////////////////////////////////////////// // Input : _hOld : game material handle to delete // Output : ////////////////////////////////////////////////////////////////////////////// // Creation date : May 97 Author: Alain Robin ////////////////////////////////////////////////////////////////////////////// // Modifications : // Modification date : Modification author : //////////////////////////////////////////////////////////////////////////// */ /*XB 22/06/99*/ #ifndef U64 void GMT_fn_vDestroyFor3DOS(GMT_tdxHandleToGameMaterial _hOld) { #ifdef _DEBUG if(!GMT_fn_b_ulIsValid(_hOld)) GMT_fn_vRaiseFatalError(); #endif /* Free initial values if needed */ /* fbolefeysot - 01/10/98*/ /* remove init values in GMT{*/ /* if(_hOld->p_stInitialValues!=NULL) GEO_M_CPAFree(_hOld->p_stInitialValues); */ /*END fbolefeysot}*/ /* Free allocated structure */ GEO_M_CPAFree(_hOld); } #endif /* U64 */ /*End XB 22/06/99*/ /*---------------------------------------------------------------------------/ // Description : GMT_fn_hCreateForA3D // Structure creation for 3DOS ------------------------------------------------------------------------------ // Methods : Allocate memory and return the handle ------------------------------------------------------------------------------ // Input : // Output : The handle to the allocated memory ------------------------------------------------------------------------------ // Creation date : Apr 97 Author: Alain Robin ------------------------------------------------------------------------------ // Modifications : // Modification date : Modification author : ---------------------------------------------------------------------------*/ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ /*GMT_tdxHandleToGameMaterial GMT_fn_hCreateForA3D(void) { GMT_tdxHandleToGameMaterial hNewGameMaterial; MMG_fn_vAddMemoryInfo( MMG_C_lTypeGMT , MMG_C_lSubTypeCollideMaterial , 0 ); GEO_M_CPAMalloc(hNewGameMaterial,GMT_tdxHandleToGameMaterial,sizeof(struct GMT_tdstGameMaterial_),E_uwGEONotEnoughtMemory); if(hNewGameMaterial!=NULL) { // pointers initialization hNewGameMaterial->hVisualMaterial=(ACP_tdxHandleOfMaterial)NULL; hNewGameMaterial->hSoundMaterial=(SND_tdxHandleToSoundMaterial)GMT_C_InvalidSoundMaterial; hNewGameMaterial->hCollideMaterial=(GMT_tdxHandleToCollideMaterial)GMT_C_InvalidCollideMaterial; hNewGameMaterial->p_stInitialValues=NULL; #ifdef SECTOR_IN_GMT hNewGameMaterial->hSectorMaterial=(HIE_tdxHandleToSuperObject)NULL; #endif // SECTOR_IN_GMT // We don't initialize the DNM handle to avoid call of dnm function but we set it to NULL hNewGameMaterial->hMechanicsMaterial=NULL; return hNewGameMaterial; } return NULL; } */ /*---------------------------------------------------------------------------- // Description : GMT_fn_vCopyForA3D // Used to copy an existing game material struct for 3DOS (all fields) ----------------------------------------------------------------------------// // Methods : Use the "Get" and the "Set" macros to copy the field pointers ----------------------------------------------------------------------------// // Input : _hSrc : source game material // Output : _hDst : copied game material ----------------------------------------------------------------------------// // Creation date : May 97 Author: Alain Robin ----------------------------------------------------------------------------// // Modifications : // Modification date : Modification author : ----------------------------------------------------------------------------*/ /*void GMT_fn_vCopyForA3D(GMT_tdxHandleToGameMaterial _hDst, GMT_tdxHandleToGameMaterial _hSrc) { ACP_tdxHandleOfMaterial hVisual,hCopyOfVisual; #ifdef _DEBUG if((!GMT_fn_b_ulIsValid(_hDst))||(!GMT_fn_b_ulIsValid(_hSrc))) GMT_fn_vRaiseFatalError(); #endif // Duplicate visual material hVisual=GMT_fn_hGetVisualMaterial(_hSrc); GLI_xDuplicateMaterial (&hCopyOfVisual,hVisual); GMT_M_vSetVisualMaterial(_hDst,hCopyOfVisual); // Copy initial values if(_hSrc->p_stInitialValues!=NULL) { if(_hDst->p_stInitialValues==NULL) { _hDst->p_stInitialValues=GMT_fn_hCreateGameMaterial(); memcpy(_hDst->p_stInitialValues,_hSrc->p_stInitialValues,sizeof(struct GMT_tdstGameMaterial_)); } else { memcpy(_hDst->p_stInitialValues,_hSrc->p_stInitialValues,sizeof(struct GMT_tdstGameMaterial_)); } } } */ /* //////////////////////////////////////////////////////////////////////////// // Description : GMT_fn_vDestroyForA3D // Delete a created game material handle ////////////////////////////////////////////////////////////////////////////// // Methods : None ////////////////////////////////////////////////////////////////////////////// // Input : _hOld : game material handle to delete // Output : ////////////////////////////////////////////////////////////////////////////// // Creation date : May 97 Author: Alain Robin ////////////////////////////////////////////////////////////////////////////// // Modifications : // Modification date : Modification author : //////////////////////////////////////////////////////////////////////////// */ /*void GMT_fn_vDestroyForA3D(GMT_tdxHandleToGameMaterial _hOld) { #ifdef _DEBUG if(!GMT_fn_b_ulIsValid(_hOld)) GMT_fn_vRaiseFatalError(); #endif // Free initial values if needed if(_hOld->p_stInitialValues!=NULL) GEO_M_CPAFree(_hOld->p_stInitialValues); // Free allocated structure GEO_M_CPAFree(_hOld); } */ #endif /* //////////////////////////////////////////////////////////////////////////// // Description : GMT_fn_vInitLoadGameMaterialFor3DOS // Loading process initialization for 3DOS ////////////////////////////////////////////////////////////////////////////// // Methods : Register the callbacks ////////////////////////////////////////////////////////////////////////////// // Input : // Output : ////////////////////////////////////////////////////////////////////////////// // Creation date : 27 Feb 97 Author: Alain Robin ////////////////////////////////////////////////////////////////////////////// // Modifications : Init the link table // Modification date : 01 Apr 97 Modification author : Alain Robin //////////////////////////////////////////////////////////////////////////// */ void GMT_fn_vInitLoadGameMaterialFor3DOS(void) { #if !defined(U64) SCR_fn_v_RdL0_RegisterCallback(C_SectionGameMaterial,fn_eScriptCallBackGameMaterial, SCR_CRC_c_RdL0_ForSection); /*BEGIN OS 4/3/98*/ /* SCR_fn_v_RdL0_RegisterCallback(C_SectionGameMaterial,fn_eScriptCallBackBinGameMaterial, SCR_CRC_c_RdL0_ForBinSection);*/ /*END OS 4/3/98*/ DNM_fn_vInitLoadMecMatCharacteristics(); /* Register the mechanic callback*/ GMT_fn_vInitLoadCollideMaterial(); /* Register collide material*/ SCR_fn_v_Link_InitTable(&g_stGmtLinkTable); #endif /* U64 */ } /* //////////////////////////////////////////////////////////////////////////// // Description : GMT_fn_vInitLoadGameMaterialForA3D // Loading process initialization for A3D ////////////////////////////////////////////////////////////////////////////// // Methods : Register the callbacks ////////////////////////////////////////////////////////////////////////////// // Input : // Output : ////////////////////////////////////////////////////////////////////////////// // Creation date : 27 Feb 97 Author: Alain Robin ////////////////////////////////////////////////////////////////////////////// // Modifications : Init the link table // Modification date : 01 Apr 97 Modification author : Alain Robin //////////////////////////////////////////////////////////////////////////// */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ void GMT_fn_vInitLoadGameMaterialForA3D(void) { #if !defined(U64) SCR_fn_v_RdL0_RegisterCallback(C_SectionGameMaterial,fn_eScriptCallBackGameMaterial, SCR_CRC_c_RdL0_ForSection); /*BEGIN OS 4/3/98*/ /* SCR_fn_v_RdL0_RegisterCallback(C_SectionGameMaterial,fn_eScriptCallBackBinGameMaterial, SCR_CRC_c_RdL0_ForBinSection);*/ /*END OS 4/3/98*/ SCR_fn_v_Link_InitTable(&g_stGmtLinkTable); #endif /* U64 */ } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ #if !defined(U64) char * GMT_fn_p_szZdmMaskToName(GMT_tdxMask _xMask) { switch(_xMask) { case GMT_C_uwPieds: return GMT_C_szPieds; break; case GMT_C_uwCorps: return GMT_C_szCorps; break; case GMT_C_uwTete: return GMT_C_szTete; break; case GMT_C_uwMains: return GMT_C_szMains; break; case GMT_C_uwFigee: return GMT_C_szFigee; break; case GMT_C_uwDos: return GMT_C_szDos; break; default: return NULL; break; } } #endif /* U64 */