/*=========================================================================
* StdGame.h : StdGame's functions
*
*
*         StdGame MUST BE REPLACE BY THE HEADER FILENAME
*
*
* Version              1.0
* Creation date        01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
 
#if !defined(__StdGame_H__)
#define __StdGame_H__
 
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
 
#include "GAM/Header.h"
 
#undef EXTERN
#undef extern
#if !defined(D_StdGame_VariableDefine)
#define EXTERN extern
#else
#define EXTERN
#endif /* D_StdGame_VariableDefine */
 
/******************************************/
#define	GAM_C_DesactivateAtAll		0x01
#define GAM_C_Activable				0x02
#define GAM_C_Active				0x04
#define GAM_C_AllSecondPassDone		0x08
/******************************************/
#define GAM_C_Always				0x10
#define GAM_C_UselessCulling		0x20
#define GAM_C_AlwaysActive			0x40
#define GAM_C_TooFar				0x80
/******************************************/
#define GAM_C_SavedMiscFlags		(GAM_C_DesactivateAtAll|GAM_C_Activable|GAM_C_Active)
 
/**************************************************************************************************************
 
GAM_C_DesactivateAtAll	|	GAM_C_Activable     |		Means
------------------------|-----------------------|-------------------------
            0			|			0		    |	desactivated by AI
------------------------|-----------------------|-------------------------
			0			|			1			|	activable (active if in an active sector)
------------------------|-----------------------|-------------------------
			1			|			0			|	definitively dead (dead and init : NeverBackWhenTaken)
------------------------|-----------------------|-------------------------
			1			|			1			|	dead (dead and init : PlayerDead or always or GoOutOfZone)
 
 *************************************************************************************************************/
 
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
 
/********************************************************************************/
struct tdstStandardGame_
{
	/*
	 * type of the object this structure describes
	 */
	tdObjectType otObjectFamilyType; /**** -1 (C_InvalidObjectType) is a invalid type ****/
#ifndef U64
	tdObjectType otObjectModelType; /**** -1 (C_InvalidObjectType) is a invalid type ****/
#endif
	tdObjectType otObjectPersonalType; /**** (if > C_AlwaysObjectType) is a always object ****/
 
	/* super-object father pointer */
	HIE_tdxHandleToSuperObject h_SuperObject;
 
	/*
	 * how is the object activation performed ?
	 */
	enum tdeObjectinitInit_ eInitFlagWhenOutOfZone;
	enum tdeObjectinitInit_ eInitFlagWhenDeadOrTaken;
 
	/* last modification's trame number */
	unsigned long ulLastTrame;
 
	/* Capabilities of the object to follow a path in the WPgraph */
	unsigned long ubf32Capabilities;
 
	unsigned char ucTractionFactor;
 
	/* number of hit points an object have at a given time */
	unsigned char ucHitPoints/*,ucHitPointsInit*/;
	unsigned char ucHitPointsMax/*,ucHitPointsMaxInit*/;
	unsigned char ucHitPointsMaxMax;
 
	unsigned long ulCustomBits;
 
	/* Special management for platforms */
	unsigned char ucPlatFormType;
 
	/* used to know if the object is dead, taken ..., and must be not reappear if the player dead */
	/* is the object to be handled at all by the game engine ? is this object to be handled by the game engine at the current time ? */
	unsigned char ucMiscFlags;	/* DesactivateAtAll + Activable + Active + AllSecondPassDone*/
 
	/* ANNECY MT - 08/07/98 {*/
	unsigned char ucTransparencyZoneMin;
	unsigned char ucTransparencyZoneMax;
	/* END ANNECY MT }*/
 
/* ANNECY AV {*/
    /* Instead of using SAI functions to manage intialisation, which are memory eater, we save our variables ourself*/
    /* This uses 8 bytes while SAI uses 96 bytes : we save 17 Ko for 200 actors !*/
    unsigned long ulSaveCustomBits;
 
    unsigned char ucSaveHitPoints;
    unsigned char ucSaveHitPointsMax;
    unsigned char ucSaveMiscFlags;
/* END ANNECY AV }*/
 
/* ANNECY MT - 22/10/98 {*/
    unsigned char ucTooFarLimit;
/* END ANNECY MT }*/
 
#if defined(ACTIVE_EDITOR)
	unsigned char bIsLoadedInFix;
	unsigned char bIsInAllSubMaps;
#endif /* ACTIVE_EDITOR */
};
 
/***********************/
/**** Handle define ****/
/***********************/
typedef struct tdstStandardGame_ * MS_tdxHandleToStandardGame;
 
/* ANNECY AV DEMO {*/
#if !defined(U64) && !defined(SCR2BIN)
    #include "Gam/Specif/Demos.h"
#endif
/* END ANNECY AV }*/
 
/**** StdGame scripts ****/
#define C_SectionStdGameDescription                "StandardGame"
#define C_EntryStdGameType                         "Type"
#define C_EntryStdGameHitPointInit                 "HitPointsInit"
#define C_EntryStdGameHitPoint                     "HitPoints"
#define C_EntryStdGameHitPointMaxInit              "HitPointsMaxInit"
#define C_EntryStdGameHitPointMax                  "HitPointsMax"
#define C_EntryStdGameHitPointMaxMax               "HitPointsMaxMax"
#define C_EntryStdGameIsActivable                  "IsActivable"
#define C_EntryStdGameIsDesactivableAtAll          "IsDesactivableAtAll"
#define C_EntryStdInitFlag                         "InitFlags"
/*#define C_EntryStdSpecialPositionFlag              "SpecialPositionFlag"*/
#define C_ValueStdInitFlagNeverBack                "NeverBack"
#define C_ValueStdInitFlagAlways                   "Always"
#define C_ValueStdInitFlagGoOutOfZone              "WhenGoOutOfZone"
#define C_ValueStdInitFlagPlayerDead               "WhenPlayerDead"
#define C_ValueStdInitFlagMapLoaded                "WhenMapLoaded"
#define C_ValueStdInitFlagSavedGameLoaded          "WhenSavedGameLoaded"
#define C_EntryStdGamePlatFormType                 "PlatFormType"
/*ANNECY BBB 20/11/97 {*/
#define C_EntryStdGameCustomBits                   "CustomBits"
#define C_EntryStdGameCustomBitsInit               "CustomBitsInit"
/*ENDANNECY BBB 20/11/97 }*/
/* JO 18/11/97*/
#define C_EntryStdGameLinkedToSectorFlag				"LinkedToSector"
 
#define C_EntryStdGameCapabilities                  "Capabilities"
#define C_EntryStdGameTractionFactor                "TractionFactor"
 
/* ANNECY MT - 08/07/98 {*/
#define C_EntryStdGameTransparencyZone				"TransparencyZone"
/* END ANNECY MT }*/
 
/* ANNECY MT - 22/10/98 {*/
#define C_EntryStdGameTooFarLimit					"TooFarLimit"
/* END ANNECY MT }*/
 
/*
 * Custom Bit Flag values
 */
#define GAM_C_CustBitUnseenFrozenAnimPlayer		0x00000001	/* 1*/
#define GAM_C_CustBitNeedModuleMatrices			0x00000002	/* 2*/
#define GAM_C_CustBitMovable					0x00000004	/* 3*/
#define GAM_C_CustBitProjectile					0x00000008	/* 4*/
#define GAM_C_CustBitRayHit						0x00000010	/* 5*/
#define GAM_C_CustBitSightable					0x00000020	/* 6*/
#define GAM_C_CustBitCannotCrushPrincipalActor	0x00000040	/* 7*/
#define GAM_C_CustBitCollectable				0x00000080	/* 8*/
#define GAM_C_CustBitActorHasShadow				0x00000100	/* 9*/
#define GAM_C_CustBitShadowOnMe					0x00000200	/* 10*/
#define GAM_C_CustBitPrunable					0x00000400	/* 11*/
#define GAM_C_CustBitOutOfVisibility			0x00000800	/* 12*/
#define GAM_C_CustBitUnseenFrozen				0x00001000	/* 13*/
#define GAM_C_CustBitNoAnimPlayer				0x00002000	/* 14*/
#define GAM_C_CustBitFightable					0x00004000	/* 15*/
#define GAM_C_CustBitNoMechanic					0x00008000	/* 16*/
#define GAM_C_CustBitNoAI						0x00010000	/* 17*/
#define GAM_C_CustBitDestroyWhenAnimEnded		0x00020000	/* 18*/
#define GAM_C_CustBitNoAnimPlayerWhenTooFar		0x00040000	/* 19*/
#define GAM_C_CustBitNoAIWhenTooFar				0x00080000	/* 20*/
#define GAM_C_CustBitUnfreezable				0x00100000	/* 21*/
#define GAM_C_CustBitUsesTransparencyZone		0x00200000	/* 22*/
#define GAM_C_CustBitNoMecaWhenTooFar			0x00400000	/* 23*/
#define GAM_C_CustBitSoundWhenInvisible			0x00800000	/* 24*/
#define GAM_C_CustBitProtection					0x01000000	/* 25*/
#define GAM_C_CustBitCameraHit					0x02000000	/* 26*/
#define GAM_C_CustBit27							0x04000000	/* 27*/
#define GAM_C_CustBitAIUser1					0x08000000	/* 28*/
#define GAM_C_CustBitAIUser2					0x10000000	/* 29*/
#define GAM_C_CustBitAIUser3					0x20000000	/* 30*/
#define GAM_C_CustBitAIUser4					0x40000000	/* 31*/
#define GAM_C_CustBitRayman						0x80000000	/* 32*/
 
/* those bits cannot be modified, because they are for internal use only */
#define C_ulUnchangableCustomBits				( GAM_C_CustBitOutOfVisibility | GAM_C_CustBitRayman | GAM_C_CustBitProtection )
/* JO 04/11/97*/
/*
 * PlatForm Type Values
 */
#define C_ucPlatFormType_None                      0
#define C_ucPlatFormType_StandardPlatForm          1
 
/*******************************/
/**** Base functions define ****/
/*******************************/
#if !defined(U64)
extern CPA_EXPORT SCR_tde_Anl_ReturnValue fn_eStdGameScriptCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
#endif /* U64 */
 
extern CPA_EXPORT unsigned long fn_ulStdGameSizeOf();
extern CPA_EXPORT void fn_vStdGameAlloc(struct tdstEngineObject_ *p_stObject);
extern CPA_EXPORT MS_tdxHandleToStandardGame fn_h_StdGameRealAlloc();
extern CPA_EXPORT void fn_vStdGameFree(struct tdstEngineObject_ *p_stObject);
extern CPA_EXPORT void fn_vStdGameInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit);
extern CPA_EXPORT void fn_vStdGameDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit);
extern CPA_EXPORT void fn_vStdGameCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc);
 
/********************************/
/**** Acces functions define ****/
/********************************/
 
INLINE
tdObjectType fn_otStandardGameGetFamilyType (MS_tdxHandleToStandardGame h_StdGame)
    { return(h_StdGame->otObjectFamilyType); }
 
INLINE
void fn_vStandardGameSetFamilyType (MS_tdxHandleToStandardGame h_StdGame,tdObjectType otFamilyType)
    { h_StdGame->otObjectFamilyType=otFamilyType; }
 
#ifndef U64
INLINE
tdObjectType fn_otStandardGameGetModelType(MS_tdxHandleToStandardGame h_StdGame)
    { return(h_StdGame->otObjectModelType); }
 
 
INLINE
void fn_vStandardGameSetModelType(MS_tdxHandleToStandardGame h_StdGame,tdObjectType otModelType)
    { h_StdGame->otObjectModelType=otModelType; }
#endif 
 
INLINE
tdObjectType fn_otStandardGameGetPersonalType(MS_tdxHandleToStandardGame h_StdGame)
    { return(h_StdGame->otObjectPersonalType); }
 
INLINE
void fn_vStandardGameSetPersonalType(MS_tdxHandleToStandardGame h_StdGame,tdObjectType otPersonalType)
    { h_StdGame->otObjectPersonalType=otPersonalType; }
 
INLINE
unsigned long fn_ulStandardGameGetLastTrame(MS_tdxHandleToStandardGame h_StdGame)
    { return(h_StdGame->ulLastTrame); }
 
INLINE
void fn_vStandardGameSetLastTrame(MS_tdxHandleToStandardGame h_StdGame,unsigned long ulLastTrame)
{ h_StdGame->ulLastTrame=ulLastTrame; }
 
INLINE
unsigned char fn_ucStandardGameGetHitPoints(MS_tdxHandleToStandardGame h_StdGame)
    { return(h_StdGame->ucHitPoints); }
 
INLINE
void fn_vStandardGameSetHitPoints(MS_tdxHandleToStandardGame h_StdGame,unsigned char ucHitPoints)
    { h_StdGame->ucHitPoints=ucHitPoints; }
 
INLINE
unsigned char fn_ucStandardGameGetHitPointsMax(MS_tdxHandleToStandardGame h_StdGame)
    { return(h_StdGame->ucHitPointsMax); }
 
INLINE
void fn_vStandardGameSetHitPointsInit(MS_tdxHandleToStandardGame h_StdGame,unsigned char ucHitPointsInit)
    { h_StdGame -> ucSaveHitPoints = ucHitPointsInit ; }


INLINE
void fn_vStandardGameSetHitPointsMax(MS_tdxHandleToStandardGame h_StdGame,unsigned char ucHitPoints)
    { h_StdGame->ucHitPointsMax=ucHitPoints; }
 
INLINE
unsigned char fn_ucStandardGameGetHitPointsMaxMax(MS_tdxHandleToStandardGame h_StdGame)
    { return(h_StdGame->ucHitPointsMaxMax); }
 
INLINE
void fn_vStandardGameSetHitPointsMaxMax(MS_tdxHandleToStandardGame h_StdGame,unsigned char ucHitPoints)
    { h_StdGame->ucHitPointsMaxMax=ucHitPoints; }
 
INLINE
unsigned char fn_bf1StandardGameGetIsDesactivateAtAll(MS_tdxHandleToStandardGame h_StdGame)
{ return(unsigned char)(h_StdGame->ucMiscFlags & GAM_C_DesactivateAtAll ? TRUE : FALSE); }
 
INLINE
void fn_vStandardGameSetIsDesactivateAtAll(MS_tdxHandleToStandardGame h_StdGame,unsigned char bf1IsDesactivateAtAll)
    {
/* ANNECY AV DEMO {*/
#if !defined(U64) && !defined(SCR2BIN) && !defined(RETAIL)
      if(g_DEMO_KeybTest == DEMO_RECORD)
      {
          if (h_StdGame->h_SuperObject &&
              ((bf1IsDesactivateAtAll == TRUE  && (h_StdGame->ucMiscFlags & GAM_C_DesactivateAtAll) == 0) ||
               (bf1IsDesactivateAtAll == FALSE && (h_StdGame->ucMiscFlags & GAM_C_DesactivateAtAll) != 0)))
          {
              DEMO_fn_vTestAndSaveActivationDesactivation (h_StdGame->h_SuperObject , ! bf1IsDesactivateAtAll);
          }
      }
#endif
/* END ANNECY AV }*/
      if(bf1IsDesactivateAtAll)
		h_StdGame->ucMiscFlags |= GAM_C_DesactivateAtAll;
	  else
		h_StdGame->ucMiscFlags &= ~GAM_C_DesactivateAtAll;
    }
 
INLINE
unsigned char fn_bf1StandardGameGetIsActivable(MS_tdxHandleToStandardGame h_StdGame)
    { return(unsigned char)(h_StdGame->ucMiscFlags & GAM_C_Activable ? TRUE : FALSE); }
 
INLINE
void fn_vStandardGameSetIsActivable(MS_tdxHandleToStandardGame h_StdGame,unsigned char bf1IsActivable)
    {
/* ANNECY AV DEMO {*/
#if !defined(U64) && !defined(SCR2BIN) && !defined(RETAIL)
      if (g_DEMO_KeybTest == DEMO_RECORD)
      {
          if (h_StdGame->h_SuperObject &&
              ((bf1IsActivable == TRUE  && (h_StdGame->ucMiscFlags & GAM_C_Activable) == 0) ||
               (bf1IsActivable == FALSE && (h_StdGame->ucMiscFlags & GAM_C_Activable) != 0)))
          {
              DEMO_fn_vTestAndSaveActivationDesactivation (h_StdGame->h_SuperObject , bf1IsActivable);
          }
      }
#endif
/* END ANNECY AV }*/
      if(bf1IsActivable)
		h_StdGame->ucMiscFlags |= GAM_C_Activable;
	  else
		h_StdGame->ucMiscFlags &= ~GAM_C_Activable;
    }
 
INLINE
unsigned char fn_bf1StandardGameGetIsActive(MS_tdxHandleToStandardGame h_StdGame)
    { return(unsigned char)(h_StdGame->ucMiscFlags & GAM_C_Active ? TRUE : FALSE); }
 
INLINE
void fn_vStandardGameSetIsActive(MS_tdxHandleToStandardGame h_StdGame,unsigned char bf1IsActive)
    {
/* ANNECY AV DEMO {*/
#if !defined(U64) && !defined(SCR2BIN) && !defined(RETAIL)
      if(g_DEMO_KeybTest == DEMO_RECORD)
      {
        if (h_StdGame->h_SuperObject &&
            ((bf1IsActive == TRUE  && (h_StdGame->ucMiscFlags & GAM_C_Active) == 0) ||
             (bf1IsActive == FALSE && (h_StdGame->ucMiscFlags & GAM_C_Active) != 0)))
        {
              DEMO_fn_vTestAndSaveActivationDesactivation (h_StdGame->h_SuperObject , bf1IsActive);
        }
      }
#endif
/* END ANNECY AV }*/
      if(bf1IsActive)
		h_StdGame->ucMiscFlags |= GAM_C_Active;
	  else
		h_StdGame->ucMiscFlags &= ~GAM_C_Active;
    }
 
INLINE
enum tdeObjectinitInit_ fn_eStandardGameGetInitFlagWhenOutOfZone(MS_tdxHandleToStandardGame h_StdGame)
    { return(h_StdGame->eInitFlagWhenOutOfZone); }
 
INLINE
void fn_vStandardGameSetInitFlagWhenOutOfZone(MS_tdxHandleToStandardGame h_StdGame,enum tdeObjectinitInit_ eInitFlagWhenOutOfZone)
    { h_StdGame->eInitFlagWhenOutOfZone=eInitFlagWhenOutOfZone; }
 
INLINE
enum tdeObjectinitInit_ fn_eStandardGameGetInitFlagWhenDeadOrTaken(MS_tdxHandleToStandardGame h_StdGame)
    { return(h_StdGame->eInitFlagWhenDeadOrTaken); }
 
INLINE
void fn_vStandardGameSetInitFlagWhenDeadOrTaken(MS_tdxHandleToStandardGame h_StdGame,enum tdeObjectinitInit_ eInitFlagWhenDeadOrTaken)
    { h_StdGame->eInitFlagWhenDeadOrTaken=eInitFlagWhenDeadOrTaken; }
 
INLINE
unsigned char fn_ucStandardGameGetPlatFormType(MS_tdxHandleToStandardGame h_StdGame)
    { return h_StdGame->ucPlatFormType; }
 
INLINE
void fn_ucStandardGameSetPlatFormType(MS_tdxHandleToStandardGame h_StdGame,unsigned char _ucPlatFormType)
    { h_StdGame->ucPlatFormType = _ucPlatFormType; }
 
INLINE
void fn_vStandardGameSetCapabilities(MS_tdxHandleToStandardGame h_StdGame, unsigned long _ubf32Capabilities)
    { h_StdGame->ubf32Capabilities = _ubf32Capabilities; }
 
INLINE
unsigned long fn_ulStandardGameGetCapabilities(MS_tdxHandleToStandardGame h_StdGame)
    { return ( h_StdGame->ubf32Capabilities ); }
 
INLINE
void fn_vStandardGameAddCapabilities(MS_tdxHandleToStandardGame h_StdGame, unsigned long _ubf32Capabilities)
    { h_StdGame->ubf32Capabilities |= _ubf32Capabilities; }
 
INLINE
void fn_vStandardGameSubCapabilities(MS_tdxHandleToStandardGame h_StdGame, unsigned long _ubf32Capabilities)
    { h_StdGame->ubf32Capabilities -= (h_StdGame->ubf32Capabilities & _ubf32Capabilities); }
 
INLINE
void fn_vStandardGameSetTractionFactor(MS_tdxHandleToStandardGame h_StdGame,unsigned char _ucTractionFactor)
    { h_StdGame->ucTractionFactor = _ucTractionFactor; }
 
INLINE
unsigned char fn_ucStandardGameGetTractionFactor(MS_tdxHandleToStandardGame h_StdGame)
    { return ( h_StdGame->ucTractionFactor ); }
 
INLINE
unsigned char fn_bIsAllSecondPassDone(MS_tdxHandleToStandardGame h_StdGame)
    { return(unsigned char)(h_StdGame->ucMiscFlags & GAM_C_AllSecondPassDone ? TRUE : FALSE); }
 
INLINE
void fn_vAllSecondPassAreDone(MS_tdxHandleToStandardGame h_StdGame)
    { h_StdGame->ucMiscFlags |= GAM_C_AllSecondPassDone; }
 
INLINE
unsigned long fn_ulStandardGameGetCustomBits(MS_tdxHandleToStandardGame _hStdGame)
    { return _hStdGame->ulCustomBits; }
 
INLINE
void fn_vStandardGameSetCustomBits(MS_tdxHandleToStandardGame _hStdGame,unsigned long _ulCustomBits)
    { _hStdGame->ulCustomBits = _ulCustomBits; }
 
/* ANNECY MT - 08/07/98 {*/
INLINE
unsigned char fn_ucStandardGameGetTransparencyZoneMin(MS_tdxHandleToStandardGame _hStdGame)
	{ return _hStdGame->ucTransparencyZoneMin; }
 
INLINE
void fn_vStandardGameSetTransparencyZoneMin(MS_tdxHandleToStandardGame _hStdGame, unsigned char _ucTransparencyZoneMin)
	{ _hStdGame->ucTransparencyZoneMin = _ucTransparencyZoneMin; }
 
INLINE
unsigned char fn_ucStandardGameGetTransparencyZoneMax(MS_tdxHandleToStandardGame _hStdGame)
	{ return _hStdGame->ucTransparencyZoneMax; }
 
INLINE
void fn_vStandardGameSetTransparencyZoneMax(MS_tdxHandleToStandardGame _hStdGame, unsigned char _ucTransparencyZoneMax)
	{ _hStdGame->ucTransparencyZoneMax = _ucTransparencyZoneMax; }
/* END ANNECY MT }*/
 
extern CPA_EXPORT ACP_tdxBool fn_bStandardGameIsAPlatform (HIE_tdxHandleToSuperObject hSupObj);
extern CPA_EXPORT unsigned long fn_ulStandardGameGetCustomBitsSO (HIE_tdxHandleToSuperObject hSupObj);
extern CPA_EXPORT void fn_vStandardGameSetCustomBitsSO(HIE_tdxHandleToSuperObject hSupObj,unsigned long ulCustomBits);
 
extern CPA_EXPORT HIE_tdxHandleToSuperObject fn_h_StandardGameGetSuperObject(MS_tdxHandleToStandardGame h_StdGame);
extern CPA_EXPORT void fn_vStandardGameSetSuperObject(MS_tdxHandleToStandardGame h_StdGame,HIE_tdxHandleToSuperObject h_SuperObject);
 
extern CPA_EXPORT ACP_tdxBool fn_bStandardGameGetLinkToSectorFlag(MS_tdxHandleToStandardGame h_StdGame);
extern CPA_EXPORT void fn_bStandardGameSetLinkToSectorFlag(MS_tdxHandleToStandardGame h_StdGame,ACP_tdxBool _bLinkValue);
 
extern CPA_EXPORT unsigned char fn_ucStandardGameGetTransparencyZoneMinSO(HIE_tdxHandleToSuperObject hSupObj);
extern CPA_EXPORT unsigned char fn_ucStandardGameGetTransparencyZoneMaxSO(HIE_tdxHandleToSuperObject hSupObj);
 
/* ANNECY MT - 09/10/98 {*/
INLINE
void fn_vStandardGameSetAlwaysActive(MS_tdxHandleToStandardGame h_StdGame,ACP_tdxBool _bAlways)
    { if(_bAlways) h_StdGame->ucMiscFlags |= GAM_C_AlwaysActive; else h_StdGame->ucMiscFlags &= ~GAM_C_AlwaysActive; }
 
INLINE
unsigned char fn_bStandardGameIsAlwaysActive(MS_tdxHandleToStandardGame h_StdGame)
	{ return(unsigned char)(h_StdGame->ucMiscFlags & GAM_C_AlwaysActive ? TRUE : FALSE); }
 
INLINE
void fn_vStandardGameSetAlways(MS_tdxHandleToStandardGame h_StdGame,ACP_tdxBool _bAlways)
    { if(_bAlways) h_StdGame->ucMiscFlags |= GAM_C_Always; else h_StdGame->ucMiscFlags &= ~GAM_C_Always; }
 
INLINE
unsigned char fn_bStandardGameIsAlways(MS_tdxHandleToStandardGame h_StdGame)
	{ return(unsigned char)(h_StdGame->ucMiscFlags & GAM_C_Always ? TRUE : FALSE); }
 
INLINE
void fn_vStandardGameSetUselessCulling(MS_tdxHandleToStandardGame h_StdGame,ACP_tdxBool _bUseless)
    { if(_bUseless) h_StdGame->ucMiscFlags |= GAM_C_UselessCulling; else h_StdGame->ucMiscFlags &= ~GAM_C_UselessCulling; }
 
INLINE
unsigned char fn_bStandardGameIsUselessCulling(MS_tdxHandleToStandardGame h_StdGame)
	{ return(unsigned char)(h_StdGame->ucMiscFlags & GAM_C_UselessCulling ? TRUE : FALSE); }
 
INLINE
void fn_vStandardGameSetTooFar(MS_tdxHandleToStandardGame h_StdGame,ACP_tdxBool _bTooFar)
    { if(_bTooFar) h_StdGame->ucMiscFlags |= GAM_C_TooFar; else h_StdGame->ucMiscFlags &= ~GAM_C_TooFar; }
 
INLINE
unsigned char fn_bStandardGameIsTooFar(MS_tdxHandleToStandardGame h_StdGame)
	{ return(unsigned char)(h_StdGame->ucMiscFlags & GAM_C_TooFar ? TRUE : FALSE); }
/* END ANNECY MT }*/
 
/* ANNECY MT - 22/10/98 {*/
INLINE
unsigned char fn_ucStandardGameGetTooFarLimit(MS_tdxHandleToStandardGame _hStdGame)
	{ return _hStdGame->ucTooFarLimit; }
 
INLINE
void fn_vStandardGameSetTooFarLimit(MS_tdxHandleToStandardGame _hStdGame, unsigned char _ucTooFarLimit)
    { _hStdGame->ucTooFarLimit = _ucTooFarLimit; }
 
extern CPA_EXPORT unsigned char fn_ucStandardGameGetTooFarLimitSO(HIE_tdxHandleToSuperObject hSupObj);
/* END ANNECY MT }*/
 
 
/**********************************/
/**** Special functions define ****/
/**********************************/
 
 
/**********************/
/**** SAI function ****/
/**********************/
extern CPA_EXPORT void fn_vStdGameInitValueSAI(MS_tdxHandleToStandardGame h_StdGame);
extern CPA_EXPORT void fn_vStdGameSavedValueSAI(MS_tdxHandleToStandardGame h_StdGame);
extern CPA_EXPORT void fn_vStdGameFreeInitValueSAI(MS_tdxHandleToStandardGame h_StdGame);
extern CPA_EXPORT void fn_vSetHitPointsToInitValue(struct tdstEngineObject_ *_p_stObject);
extern CPA_EXPORT void fn_vSetHitPointsMaxToInitValue(struct tdstEngineObject_ *_p_stObject);
/*ANNECY BBB 20/11/97 {*/
extern CPA_EXPORT void fn_vSetCustomBitsToInitValue(struct tdstEngineObject_ *_p_stObject);
/*ENDANNECY BBB 20/11/97 }*/
 
/*************************************/
/**** Access functions for Editor ****/
/*************************************/
#if defined(ACTIVE_EDITOR)
extern CPA_EXPORT unsigned char *fn_p_ucStdGameGetHitPointsInit(MS_tdxHandleToStandardGame h_StdGame);
extern CPA_EXPORT unsigned char *fn_p_ucStdGameGetHitPointsMaxInit(MS_tdxHandleToStandardGame h_StdGame);
extern CPA_EXPORT void fn_vStdGameSetLoadedInFix(MS_tdxHandleToStandardGame h_StdGame,unsigned char bValue);
extern CPA_EXPORT unsigned char fn_bStdGameIsLoadedInFix(MS_tdxHandleToStandardGame h_StdGame);
/* ANNECY MT - 19/11/98 {*/
extern CPA_EXPORT void fn_vStdGameSetInAllSubMaps(MS_tdxHandleToStandardGame h_StdGame,unsigned char bValue);
extern CPA_EXPORT unsigned char fn_bStdGameIsInAllSubMaps(MS_tdxHandleToStandardGame h_StdGame);
/* END ANNECY MT }*/
extern CPA_EXPORT unsigned long *fn_p_ulStdGameGetCustomBitsInit(MS_tdxHandleToStandardGame _hStdGame);
#endif /* ACTIVE_EDITOR */
 
/*NZO 25/09/97*/
#ifdef BIN_SaveBin
extern CPA_EXPORT unsigned long StdGame_fn_ulWriteBinaryBloc(unsigned long _ulStructAddress, char* _p_cDestBuffer);
#endif
/*NZO 25/09/97*/
#ifdef BIN_LoadBin
extern CPA_EXPORT void StdGame_fn_vReadBinaryBloc(unsigned long _ulStructAddress, char* _p_cDestBuffer);
#endif
 
#if defined(__cplusplus)
}
#endif /* __cplusplus */
 
#endif /* __StdGame_H__ */
 
