/*========================================================================= * Macros.h : The macros used by the project. * * Version 1.0 * Creation date 09/08/96 * Revision date * * That file needs to be compatible for all platforms. * * (c) Ubi Studios 1996 *=======================================================================*/ #ifndef __MACROS_H__ #define __MACROS_H__ /******************************************/ #if _MSC_VER >= 1000 #pragma once #endif /* _MSC_VER >= 1000 */ /******************************************/ #include "GAM/Options/EnumCsts.h" /* * if the constants are not to be enumerated, the typedef does not * exist, enabling the programmer to choose the memory usage for the * variable. it is his responsibility to ensure that the scope is enough * for the enum range. the enumerated type is faked with the specified * type. * if the constants are enumerated, the type exists, and the variables * are of this type. the problem is that the memory usage is implementation- * dependant */ #if defined(D_EnumerateConstants) #define M_BeginDeclareEnumerate(tdeWhatever) \ typedef enum tdeWhatever##_ \ { #define M_EndDeclareEnumerate(tdeWhatever, type) \ } tdeWhatever; #else /* D_EnumerateConstants */ #define M_BeginDeclareEnumerate(tdeWhatever) \ enum \ { #define M_EndDeclareEnumerate(tdeWhatever, type) \ }; \ typedef type tdeWhatever; #endif /* !D_EnumerateConstants */ /***************************************/ /**** Error macros (using ACPerror) ****/ /***************************************/ #define M_GameFatalError(ErrorNum) \ { \ if (ErrorNum>E_uwGameFatalErr&&ErrorNumE_uwGameStartOfInformationWarning&&ErrorNumE_uwGameStartOfWarning&&ErrorNumE_uwGameStartOfInformationWarning&&ErrorNumh_StandardGame) #define M_ObjectGetModelType(p_stObject) fn_otStandardGameGetModelType((p_stObject)->h_StandardGame) #define M_ObjectGetPersonalType(p_stObject) fn_otStandardGameGetPersonalType((p_stObject)->h_StandardGame) #define M_ObjectSetFamilyType(p_stObject,Type) fn_vStandardGameSetFamilyType((p_stObject)->h_StandardGame,(Type)) #define M_ObjectSetModelType(p_stObject,Type) fn_vStandardGameSetModelType((p_stObject)->h_StandardGame,(Type)) #define M_ObjectSetPersonalType(p_stObject,Type) fn_vStandardGameSetPersonalType((p_stObject)->h_StandardGame,(Type)) #define M_ObjectIsActivable(p_stObject) (fn_bf1StandardGameGetIsActivable((p_stObject)->h_StandardGame)==1) #define M_ObjectIsActive(p_stObject) (fn_bf1StandardGameGetIsActive((p_stObject)->h_StandardGame)==1) #define M_ActivateObject(p_stObject) (fn_vStandardGameSetIsActive((p_stObject)->h_StandardGame,1)) #define M_UnactivateObject(p_stObject) (fn_vStandardGameSetIsActive((p_stObject)->h_StandardGame,0)) #define M_ObjectIsAlreadyTreated(p_stObject) (fn_ulStandardGameGetLastTrame((p_stObject)->h_StandardGame)==g_stEngineStructure.stEngineTimer.ulTrameNumber) #define M_TreatObject(p_stObject) fn_vStandardGameSetLastTrame((p_stObject)->h_StandardGame,g_stEngineStructure.stEngineTimer.ulTrameNumber) #define M_GetMSHandle(p_stSuperObject,Name) ((MS_tdxHandleTo##Name) ((struct tdstEngineObject_ *)(HIE_fn_hGetSuperObjectObject(p_stSuperObject)))->h_##Name) #define M_GetEngineObject(p_stSuperObject) ((HIE_fn_ulGetSuperObjectType(p_stSuperObject) != HIE_C_ulActor)?NULL:((struct tdstEngineObject_ *)(HIE_fn_hGetSuperObjectObject(p_stSuperObject)))) #define M_SetSuperObject(p_stObject,p_stSuperObjectIn) fn_vStandardGameSetSuperObject((p_stObject)->h_StandardGame,(p_stSuperObjectIn)) #define M_GetSuperObject(p_stObject) (fn_h_StandardGameGetSuperObject((p_stObject)->h_StandardGame)) /*******************************************************/ #define GAM_M_MakeSubMapNumber(_lSubMap,_lEntry) ( ( ( (_lSubMap) & 0x0000FFFF ) << 16 ) + ( (_lEntry) & 0x0000FFFF ) ) #define GAM_M_GetSubMap(_lAbsolute) ( ( (_lAbsolute) & 0xFFFF0000 ) >> 16 ) #define GAM_M_GetEntry(_lAbsolute) ( (_lAbsolute) & 0x0000FFFF ) /*******************************************************/ #endif /* __MACROS_H__ */