Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,985 @@
/*=========================================================================
* 3dData.cpp : 3dData's functions
*
*
*
* 3dData MUST BE REPLACE BY THE C FILENAME
*
*
* Version 1.0
* Creation date 01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_3dData_StructureDefine
#define D_3dData_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Structur/StdObjSt.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Structur/EngMode.h"
#include "Structur/Objects.h"
#include "Structur/State.h"
#include "Structur/Anim_s.h"
#include "Structur/objstbls.h"
#include "PlayAnim/PlayAnim.h"
#include "GameEng.h"
#include "Basic.h"
#include "ChanList.h"
#include "ObjInit.h"
#include "ObjType.h"
#include "ZdxStuff.h"
#include "ZeMem.h"
#include "Family.h"
#include "TBLLoad.h"
/*-----------------------------------------------------------------------------
* Description : 3dData object action script callback
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_e3dDataScriptCallBack(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;
MS_tdxHandleTo3dData h_3dData;
struct tdstEngineObject_ *p_stEngineObject;
GLD_tdstDeviceAttributes stDevAttrib;
_p_stFile=_p_stFile;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,struct tdstEngineObject_ *, p_stEngineObject);
if (M_IsTitle)
{
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubType3dData , p_stEngineObject);
h_3dData = fn_h_3dDataRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_3dData = h_3dData;
SCR_M_RdL0_SetContextLong(C_ParentContext,0,NULL);
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_3dData);
}
else if (M_IsEntry)
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,MS_tdxHandleTo3dData,h_3dData);
if (M_ActionIs(C_Entry3dDataInitialState))
{
char szCompletFileName[_MAX_PATH];
tdxHandleToState h_InitialState;
strcpy(szCompletFileName,fn_szGetFamiliesDataPath());
strcat(szCompletFileName,"\\");
strcat(szCompletFileName,_ap_szParams[0]);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubType3dData , p_stEngineObject);
h_InitialState = (tdxHandleToState) TMP_M_p_Malloc(strlen(szCompletFileName)+1);
strcpy((char *)h_InitialState,szCompletFileName);
fn_v3dDataSetInitialState(h_3dData,h_InitialState);
}
else if (M_ActionIs(C_Entry3dDataInitialObjectsTable))
{
/*char szFileName[_MAX_PATH];*/
/*SCR_tdst_Link_Value * _p_stLinkValue;*/
/* SCR_tdst_Cxt_Values *p_stVal;*/
/*p_stFamily = fn_h3dDataGetFamily(h_3dData);*/
// Shaitan => module list in the level
char * p_szInitialObjectTable;
// End Shaitan => module list in the level
/*sprintf(szFileName,"%s\\%s.tbl",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),_ap_szParams[0]);*/
if (SCR_fn_c_RdL0_IsSectionExists(_ap_szParams[0]))
{
// Shaitan => module list in the level
p_szInitialObjectTable = (char *) malloc (strlen(_ap_szParams[0]) * sizeof (char));
strcpy(p_szInitialObjectTable, _ap_szParams[0]);
SCR_M_RdL0_SetContextLong(C_ParentContext,0,(long)p_szInitialObjectTable);
/*
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
SCR_M_RdL0_SetContextLong(C_ParentContext,0,SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0));
*/
// End Shaitan => module list in level
}
}
else if( M_ActionIs(C_Entry3dDataShadowTexture) )
{
M_CheckScriptParamNumber(3);
GLD_bGetDeviceAttributes(
g_stEngineStructure.hGLDDevice,&stDevAttrib);
GLI_xLoadTexture( &h_3dData->p_stShadowTexture,&stDevAttrib,
_ap_szParams[0],
fn_lAToI(_ap_szParams[1]),
fn_lAToI(_ap_szParams[2]) );
}
else if( M_ActionIs(C_Entry3dDataShadowMaterial) )
{
SCR_tdst_Cxt_Values *p_stVal;
M_CheckScriptParamNumber(1);
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0],
SCR_CDF_uw_Anl_Normal);
h_3dData->p_stShadowMaterial = (GMT_tdxHandleToGameMaterial) SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
/*
* VL : to manage with mirrored shadow texture
*/
{
ACP_tdxHandleOfMaterial hVisualMat;
GLI_tdstTexture *p_stTexture;
unsigned char ucCyclingMode;
hVisualMat = GMT_fn_hGetVisualMaterial( h_3dData->p_stShadowMaterial );
if (hVisualMat)
{
GLI_xGetMaterialTexture( hVisualMat, &p_stTexture );
if (p_stTexture)
{
ucCyclingMode = TEX_ucGetTextureCyclingMode( p_stTexture );
ucCyclingMode |= GLI_C_lSpecialMirrorForShadow;
TEX_vSetTextureCyclingMode( p_stTexture, ucCyclingMode );
}
}
}
}
else if( M_ActionIs(C_Entry3dDataShadowScale) )
{
M_CheckScriptParamNumber(2);
fn_v3dDataSetShadowScaleX(h_3dData, fn_fAToF(_ap_szParams[0]));
fn_v3dDataSetShadowScaleY(h_3dData, fn_fAToF(_ap_szParams[1]));
}
else if( M_ActionIs(C_Entry3dDataShadowHeight) )
{
M_CheckScriptParamNumber(1);
h_3dData->xSHWHeight = fn_fAToF(_ap_szParams[0]);
}
else if( M_ActionIs(C_Entry3dDataDrawMask) )
{
M_CheckScriptParamNumber(1);
h_3dData->lDrawMaskInit = h_3dData->lDrawMask = fn_lAToI(_ap_szParams[0]);
}
/* ANNECY MT - 09/11/98 {
else if( M_ActionIs(C_Entry3dDataBrainComputationFrequency))
{
M_CheckScriptParamNumber(1);
fn_v3dDataSetBrainComputationFrequency(h_3dData,(unsigned char)fn_lAToI(_ap_szParams[0]));
}
END ANNECY MT } */
else if( M_ActionIs(C_Entry3dDataLightComputationFrequency))
{
M_CheckScriptParamNumber(1);
fn_v3dDataSetLightComputationFrequency(h_3dData,(unsigned char)fn_lAToI(_ap_szParams[0]));
}
}
return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
/*-----------------------------------------------------------------------------
* Description : 3dData's mini-structure sizeof
*-----------------------------------------------------------------------------
* Input : None
* Output : Size of
*-----------------------------------------------------------------------------
* Creation date : 14/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
* Description : 3dData object action allocation
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_v3dDataAlloc(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_3dData!=NULL)
M_GameFatalError(E_uwGameMiniStructAllocAlreadyAlloc);
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubType3dData , p_stObject);
p_stObject->h_3dData = fn_h_3dDataRealAlloc();
MMG_fn_vEndMemoryInfo ();
fn_v3dDataInitValueSAI(p_stObject->h_3dData);
}
/*HP 271098*/
#ifdef U64
static unsigned short uwBrainMainCounter=0;
#endif
/*----------------------------------------------------*/
MS_tdxHandleTo3dData fn_h_3dDataRealAlloc()
{
MS_tdxHandleTo3dData h_3dData;
h_3dData = (MS_tdxHandleTo3dData)M_p_GameMallocInHLM(fn_ul3dDataSizeOf());
POS_fn_vSetIdentityMatrix(fn_p_st3dDataGetMatrix(h_3dData));
fn_v3dDataSetFlagEndState(h_3dData,FALSE);
fn_v3dDataSetFlagEndOfAnim(h_3dData,FALSE);
fn_v3dDataSetFlagModifState(h_3dData,FALSE);
fn_v3dDataSetForcedFrame(h_3dData,0);
/* ANNECY MT - 22/09/98 {*/
fn_p_st3dDataGetCurrentFrame (h_3dData) -> p_stArrayOfElts3d = NULL;
fn_v3dDataSetSizeOfArrayOfElts3d (h_3dData , 0);
h_3dData->hMorphChannelList = NULL;
/* END ANNECY MT }*/
fn_v3dDataSetStateInLastFrame(h_3dData,NULL);
fn_v3dDataSetWantedState(h_3dData,NULL);
fn_v3dDataSetCurrentState(h_3dData,NULL);
fn_v3dDataSetCurrentObjectsTable(h_3dData,NULL);
fn_v3dDataSetInitialObjectsTable(h_3dData,NULL);
h_3dData->ulStartTime=g_stEngineStructure.stEngineTimer.ulCurrentTimerCount;
h_3dData->bSkipCurrentFrame=FALSE;
h_3dData->ulTimeDelay=0;
h_3dData->sLastFrame=-1;
h_3dData->bStateJustModified=FALSE;
h_3dData->uwNbEngineFrameSinceLastMechEvent=LME_INVALID;
h_3dData->ucFrameRate=0;
/* Zdx drawing management */
#if defined (_DEBUG)
h_3dData->lZdxMask = C_lAllZdxAreOn;
#endif
/* Draw mask initialisation */
h_3dData->lDrawMask = GLI_C_lAllIsEnable;
h_3dData->lDrawMaskInit = GLI_C_lAllIsEnable;
#ifdef D_USE_LIPSYNC
h_3dData->hLipsTable=NULL;
#endif
fn_v3dDataSetShadowScaleX(h_3dData, 1.0f);
fn_v3dDataSetShadowScaleY(h_3dData, 1.0f);
/*XB unused field in U64 engine*/
#ifndef U64
fn_v3dDataSetShadowQuality(h_3dData, 2);
fn_v3dDataSetShadowTexture(h_3dData, NULL);
fn_v3dDataSetShadowMaterial(h_3dData, NULL);
#endif /* U64 */
/*End XB*/
#if !defined(U64)
MTH3D_M_vNullVector(fn_p_st3dDataGetSHWDeformationVector(h_3dData));
*fn_p_x3dDataGetSHWHeight(h_3dData) = MTH_M_xFloatToReal(0.2f);
#endif /* U64*/
/* ANNECY MT - 12/06/98 {*/
fn_v3dDataSetBrainComputationFrequency(h_3dData,1);
h_3dData->cBrainCounter = -1;
#ifdef U64
uwBrainMainCounter=uwBrainMainCounter%16;
h_3dData->uwBrainMainCounter = ++uwBrainMainCounter;
#else
h_3dData->uwBrainMainCounter = (unsigned short) RND_fn_lGetLongRandomValue(0,1,(long) 17);
#endif
#if !defined(U64)
fn_v3dDataSetLightComputationFrequency(h_3dData,1);
h_3dData->cLightCounter = -1;
#endif /* U64*/
/* END ANNECY MT }*/
h_3dData->ucTransparency = 255;
return(h_3dData);
}
/*-----------------------------------------------------------------------------
* Description : 3dData object action free
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_v3dDataFree(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_3dData==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
fn_v3dDataFreeInitValueSAI(p_stObject->h_3dData);
PLA_fn_vDesInitAllChildOfCharacter(NULL,p_stObject);
fn_vFreeMorphList(&(p_stObject->h_3dData->hMorphChannelList));
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubType3dData , p_stObject );
M_GameFreeInHLM(p_stObject->h_3dData);
}
/*-----------------------------------------------------------------------------
* Description : 3dData object action initialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications : 24/05/98 break link with a Father-Perso Carlos Torres
* Modifications : 28/08/98 Destroy hierarchy module when reinit the map - Carlos Torres
*---------------------------------------------------------------------------*/
void fn_v3dDataInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
tdxHandleToObjectsTablesList hOTLE; /* MR0707*/
/* tdstAChannel *p_stChannel, *p_stChannelStop;*/
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_3dData==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
/*stdgame uses the global matrix to initialize itself, so reinit it as well, is possible*/
if ( (eObjectInit == OTI_LoadSavedGame) || (eObjectInit == OTI_Always) )
{
HIE_tdxHandleToSuperObject hFather,hCharacter;
/*reset the local matrix*/
fn_v3dDataSetMatrix(p_stObject->h_3dData,fn_p_st3dDataGetMatrixInit(p_stObject->h_3dData));
hCharacter = fn_h_StandardGameGetSuperObject(p_stObject->h_StandardGame);
/*we have to test for this because Always dont have a back pointer to their superobjects...*/
if ( hCharacter && (hFather = HIE_fn_hGetSuperObjectFather(hCharacter)) != NULL ) /*VOLUNTARY ASSIGNMENT!!!*/
{
/*compute the global matrix from the local matrix and the position of the actor's father*/
POS_fn_vMulMatrixMatrix(
fn_p_st3dDataGetAbsoluteMatrix(p_stObject->h_3dData),
HIE_fn_hGetSuperObjectGlobalMatrix(hFather),
fn_p_st3dDataGetMatrix(p_stObject->h_3dData)
);
/*
// prevent link with another charcter disturbing position init
if (HIE_fn_ulGetSuperObjectType(hFather)==C_ucCharacter)
fn_vReputCharacterSuperObjectAtTheWorld(hCharacter);
*/
}
}
/**** Reinit the initial transparency ****/
{
HIE_tdxHandleToSuperObject h_SupObject;
h_SupObject = M_GetSuperObject(p_stObject);
if (h_SupObject)
{
h_SupObject->fTransparenceLevel = (float)p_stObject->h_3dData->ucTransparency;
}
}
switch(eObjectInit)
{
case OTI_WhenGameStart:
break;
case OTI_MapLoaded:
fn_v3dDataInitValueSAI(p_stObject->h_3dData);
fn_v3dDataSavedValueSAI(p_stObject->h_3dData);
p_stObject->h_3dData->hArrayOfChannels = NULL;
p_stObject->h_3dData->ulNumberOfChannels = p_stObject->h_3dData->h_Family->ulNumberOfChannels;
case OTI_LoadSavedGame:
case OTI_PlayerDead:
case OTI_ReinitTheMap:
p_stObject->h_3dData->bAnimMatrixChanged = TRUE;
fn_vTakeControlOfChannel(p_stObject, (unsigned short) -1, FALSE); /*ANNECY BBB*/
fn_v3dDataSetStartTime(p_stObject->h_3dData,0);
fn_v3dDataSetTimeDelay(p_stObject->h_3dData,0);
fn_v3dDataSetTimePreviousFrame(p_stObject->h_3dData,0);
/* remove all hierarchy links*/
PLA_fn_vDesInitAllChildOfCharacter(M_GetSuperObject(p_stObject),p_stObject);
#ifdef U64
/*HP 301098*/
uwBrainMainCounter=0;
#endif
memset(&p_stObject->h_3dData->stFrame3d,0,sizeof(struct tdstFrame3d_));
fn_v3dDataSetCurrentHieCouples(p_stObject->h_3dData,NULL);
fn_v3dDataSetCurrentHieNbCouples(p_stObject->h_3dData,0);
fn_v3dDataSetSizeOfArrayOfElts3d(p_stObject->h_3dData,0);
p_stObject->h_3dData->lLastComputeFrame=0;
p_stObject->h_3dData->bStateJustModified=FALSE;
fn_v3dDataSetFrameRate(p_stObject->h_3dData,0);
#ifdef D_USE_LIPSYNC
fn_v3dDataSetLipsTable(p_stObject->h_3dData,NULL);
#endif
fn_v3dDataSetCurrentState(p_stObject->h_3dData,NULL);
p_stObject->h_3dData->stFrame3d.p_stArrayOfElts3d = NULL;
p_stObject->h_3dData->stFrame3d.p_stAnim = NULL;
p_stObject->h_3dData->lDrawMask = p_stObject->h_3dData->lDrawMaskInit;
p_stObject->h_3dData->cBrainCounter = -1;
p_stObject->h_3dData->bSkipCurrentFrame = FALSE;
#if !defined(U64)
p_stObject->h_3dData->cLightCounter = -1;
#endif /* U64*/
case OTI_AlwaysCreated:
fn_vInitMorphList(&(p_stObject->h_3dData->hMorphChannelList));
hOTLE=fn_h3dDataGetInitialObjectsTable(p_stObject->h_3dData);
#if !defined(U64)
if (hOTLE&&fn_d_hGetInitObjectsTable(hOTLE)) fn_vReInitObjectTable(hOTLE);
#endif /* U64*/
#ifdef U64
uwBrainMainCounter=uwBrainMainCounter%16;
p_stObject->h_3dData->uwBrainMainCounter = ++uwBrainMainCounter;
#else
p_stObject->h_3dData->uwBrainMainCounter = (unsigned short) RND_fn_lGetLongRandomValue(0,1,(long) 17);
#endif
/* ANNECY MT - 09/11/98 {*/
fn_v3dDataSetBrainComputationFrequency(p_stObject->h_3dData,1);
/* END ANNECY MT }*/
break;
}
if (M_GetSuperObject(p_stObject)!=NULL)
{
PLA_fn_vInitNewState(M_GetSuperObject(p_stObject),fn_h3dDataGetInitialState(p_stObject->h_3dData));
HIE_fn_vSetSuperObjectDrawMask(M_GetSuperObject(p_stObject),p_stObject->h_3dData->lDrawMask);
}
}
/*-----------------------------------------------------------------------------
* Description : 3dData object action desinitialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_v3dDataDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_3dData==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
/* if (p_stObject->h_3dData->stFrame3d.p_stArrayOfElts3d)
{
//MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeAnimation , p_stObject->h_3dData->h_Family);
//TMP_M_Free(p_stObject->h_3dData->stFrame3d.p_stArrayOfElts3d);
//fn_v3dDataSetSizeOfArrayOfElts3d(p_stObject->h_3dData,0);
//p_stObject->h_3dData->stFrame3d.p_stArrayOfElts3d = NULL;
p_stObject->h_3dData->stFrame3d.p_stAnim = NULL;
fn_vFreeArrayOfElts3d(p_stObject -> h_3dData);
}
*/
/* Olivier Didelot le 1 juillet 1998*/
/* PLA_fn_vDesInitAllChildOfCharacterByEngineobject(p_stObject);*/
switch(eObjectInit)
{
case OTI_ReinitTheMap:
break;
case OTI_MapLoaded:
PLA_fn_vDesInitAllChildOfCharacter(M_GetSuperObject(p_stObject),p_stObject);
fn_vFreeMorphList(&(p_stObject->h_3dData->hMorphChannelList));
break;
case OTI_PlayerDead:
break;
default:
break;
}
}
unsigned long fn_ul3dDataSizeOf()
{
return(sizeof(struct tdst3dData_));
}
/*************************************************************************/
/*#define M_3dData_SAIFlags (SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded|SAI_eInitWhenPlayerGameSavedLoaded)*/
void fn_v3dDataInitValueSAI(MS_tdxHandleTo3dData h_3dData)
{
SAI_fn_bInsertArrayInTable((void*)&h_3dData->stGLIObjectMatrix,sizeof(POS_tdstCompletePosition),M_3dData_SAIFlags);
/* ANNECY AV {*/
/* We don't need to save these variables
// ANNECY MT - 12/06/98 {
SAI_fn_bInsertCharInTable((void*)&h_3dData->ucBrainComputationFrequency,M_3dData_SAIFlags);
SAI_fn_bInsertCharInTable((void*)&h_3dData->ucLightComputationFrequency,M_3dData_SAIFlags);
// END ANNECY MT }
*/
/* END ANNECY AV }*/
}
/*************************************************************************/
void fn_v3dDataSavedValueSAI(MS_tdxHandleTo3dData h_3dData)
{
}
/*************************************************************************/
void fn_v3dDataFreeInitValueSAI(MS_tdxHandleTo3dData h_3dData)
{
SAI_fn_bRemoveValueFromTable((void*)&h_3dData->stGLIObjectMatrix,M_3dData_SAIFlags);
/* ANNECY AV {*/
/* We don't need to save these variables
// ANNECY MT - 12/06/98 {
SAI_fn_bRemoveValueFromTable((void*)&h_3dData->ucBrainComputationFrequency,M_3dData_SAIFlags);
SAI_fn_bRemoveValueFromTable((void*)&h_3dData->ucLightComputationFrequency,M_3dData_SAIFlags);
// END ANNECY MT }
*/
/* END ANNECY AV }*/
}
/*************************************************************************/
/*************************************/
/**** Access functions for Editor ****/
/*************************************/
/*************************************************************************/
/* END ANNECY MT }*/
/*#undef M_3dData_SAIFlags*/
/*************************************************************************/
/*-----------------------------------------------------------------------------
* Description : 3dData copy clone action
*-----------------------------------------------------------------------------
* Input : Handle to destination, handle to source
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Olivier Jourdan
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_v3dDataCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc)
{
void * pv_tmp1 = _p_stObjectDest->h_3dData->hArrayOfChannels;
void * pv_tmp2 = _p_stObjectDest->h_3dData->stFrame3d.p_stArrayOfElts3d;
void * pv_tmp3 = _p_stObjectDest->h_3dData->hFirstActiveChannel;
void * pv_tmp4 = _p_stObjectDest->h_3dData->hMorphChannelList;
unsigned short wSize = fn_w3dDataGetSizeOfArrayOfElts3d(_p_stObjectDest->h_3dData);
/* If 3dData doesn't contains pointers to structure that may be*/
/* changed during the game, this function must only be a :*/
memcpy(_p_stObjectDest->h_3dData,_p_stObjectSrc->h_3dData,fn_ul3dDataSizeOf());
/* to hold these values...*/
_p_stObjectDest->h_3dData->hArrayOfChannels = pv_tmp1;
_p_stObjectDest->h_3dData->stFrame3d.p_stArrayOfElts3d = pv_tmp2;
_p_stObjectDest->h_3dData->hFirstActiveChannel = pv_tmp3;
_p_stObjectDest->h_3dData->hMorphChannelList = pv_tmp4;
fn_v3dDataSetSizeOfArrayOfElts3d(_p_stObjectDest->h_3dData,wSize);
}
/*-----------------------------------------------------------------------------
* Description : 3dData access functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleTo3dData + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 29/01/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/****************************/
#if defined (ACTIVE_EDITOR)
MTH_tdxReal fn_v3dDataGetMatrixElement(MS_tdxHandleTo3dData h_3dData,unsigned char ucInitOrLocalOrAbsolute,unsigned char ucWhichMatrix,unsigned char ucWhichVector,unsigned char ucWhichElement)
{
MTH_tdxReal xReturn = 0.0;
MTH3D_tdstVector stI;
MTH3D_tdstVector stJ;
MTH3D_tdstVector stK;
if (ucWhichMatrix==0) /* Translation*/
{
if (ucInitOrLocalOrAbsolute==0) /*Init*/
{
POS_fn_vGetTranslationVector(fn_p_st3dDataGetMatrixInit(h_3dData),&stI);
POS_fn_vGetTranslationVector(fn_p_st3dDataGetMatrixInit(h_3dData),&stJ);
POS_fn_vGetTranslationVector(fn_p_st3dDataGetMatrixInit(h_3dData),&stK);
}
else if (ucInitOrLocalOrAbsolute==1) /*Local*/
{
POS_fn_vGetTranslationVector(&(h_3dData->stGLIObjectMatrix),&stI);
POS_fn_vGetTranslationVector(&(h_3dData->stGLIObjectMatrix),&stJ);
POS_fn_vGetTranslationVector(&(h_3dData->stGLIObjectMatrix),&stK);
}
else if (ucInitOrLocalOrAbsolute==2) /*Absolute*/
{
POS_fn_vGetTranslationVector((h_3dData->p_stGLIObjectAbsoluteMatrix),&stI);
POS_fn_vGetTranslationVector((h_3dData->p_stGLIObjectAbsoluteMatrix),&stJ);
POS_fn_vGetTranslationVector((h_3dData->p_stGLIObjectAbsoluteMatrix),&stK);
}
}
else if (ucWhichMatrix==1) /* Rotation*/
{
if (ucInitOrLocalOrAbsolute==0) /*Init*/
{
POS_fn_vGetRotationMatrix(fn_p_st3dDataGetMatrixInit(h_3dData),&stI,&stJ,&stK);
}
else if (ucInitOrLocalOrAbsolute==1) /*Local*/
{
POS_fn_vGetRotationMatrix(&(h_3dData->stGLIObjectMatrix),&stI,&stJ,&stK);
}
else if (ucInitOrLocalOrAbsolute==2) /*Absolute*/
{
POS_fn_vGetRotationMatrix((h_3dData->p_stGLIObjectAbsoluteMatrix),&stI,&stJ,&stK);
}
}
else if (ucWhichMatrix==2) /* Scale*/
{
if (ucInitOrLocalOrAbsolute==0) /*Init*/
{
POS_fn_vGetScaleMatrix(fn_p_st3dDataGetMatrixInit(h_3dData),&stI,&stJ,&stK);
}
else if (ucInitOrLocalOrAbsolute==1) /*Local*/
{
POS_fn_vGetScaleMatrix(&(h_3dData->stGLIObjectMatrix),&stI,&stJ,&stK);
}
else if (ucInitOrLocalOrAbsolute==2) /*Absolute*/
{
POS_fn_vGetScaleMatrix((h_3dData->p_stGLIObjectAbsoluteMatrix),&stI,&stJ,&stK);
}
if (MTH_M_bEqualWithEpsilon(stI.xX,MTH_C_ONE,MTH_M_xFloatToReal(0.001f)))
MTH3D_M_vSetBaseIVector(&stI);
if (MTH_M_bEqualWithEpsilon(stJ.xY,MTH_C_ONE,MTH_M_xFloatToReal(0.001f)))
MTH3D_M_vSetBaseJVector(&stJ);
if (MTH_M_bEqualWithEpsilon(stK.xZ,MTH_C_ONE,MTH_M_xFloatToReal(0.001f)))
MTH3D_M_vSetBaseKVector(&stK);
}
if (ucWhichVector==0) /* I*/
{
if (ucWhichElement==0) /* X*/
xReturn=MTH3D_M_xGetXofVector(&stI);
else if (ucWhichElement==1) /* Y*/
xReturn=MTH3D_M_xGetYofVector(&stI);
else if (ucWhichElement==2) /* Z*/
xReturn=MTH3D_M_xGetZofVector(&stI);
}
else if (ucWhichVector==1) /* J*/
{
if (ucWhichElement==0) /* X*/
xReturn=MTH3D_M_xGetXofVector(&stJ);
else if (ucWhichElement==1) /* Y*/
xReturn=MTH3D_M_xGetYofVector(&stJ);
else if (ucWhichElement==2) /* Z*/
xReturn=MTH3D_M_xGetZofVector(&stJ);
}
else if (ucWhichVector==2) /* K*/
{
if (ucWhichElement==0) /* X*/
xReturn=MTH3D_M_xGetXofVector(&stK);
else if (ucWhichElement==1) /* Y*/
xReturn=MTH3D_M_xGetYofVector(&stK);
else if (ucWhichElement==2) /* Z*/
xReturn=MTH3D_M_xGetZofVector(&stK);
}
return(xReturn);
}
#endif /*ACTIVE_EDITOR*/
#if defined (ACTIVE_EDITOR)
/*void fn_v3dDataSetChannelActivationList(MS_tdxHandleTo3dData h_3dData,CHN_tdxHandleToCASList hCASList)
{
h_3dData->hChannelActivationList=hCASList;
}
*/#endif /*ACTIVE_EDITOR*/
void fn_v3dDataSetFrameRate(MS_tdxHandleTo3dData h_3dData,unsigned char ucFrameRate)
{
unsigned long ulNbFrames;
if (ucFrameRate>1) /* Change the Start Time of the anim in order to preserve the current frame*/
{
ulNbFrames=(g_stEngineStructure.stEngineTimer.ulCurrentTimerCount-h_3dData->ulStartTime)*h_3dData->ucFrameRate;
h_3dData->ulStartTime=g_stEngineStructure.stEngineTimer.ulCurrentTimerCount-ulNbFrames/ucFrameRate;
}
h_3dData->ucFrameRate=ucFrameRate;
}
void fn_v3dDataFactorFrameRate(MS_tdxHandleTo3dData _h3dData,unsigned long _ulFactor100)
{
unsigned long ulNbFrames;
unsigned char ucFrameRate = (unsigned char) (fn_scGetSpeedInState(fn_h3dDataGetCurrentState(_h3dData))*_ulFactor100/100L);
if (ucFrameRate > 1) /* Change the Start Time of the anim in order to preserve the current frame*/
{
ulNbFrames = (g_stEngineStructure.stEngineTimer.ulCurrentTimerCount-_h3dData->ulStartTime)*_h3dData->ucFrameRate;
_h3dData->ulStartTime = g_stEngineStructure.stEngineTimer.ulCurrentTimerCount-ulNbFrames/ucFrameRate;
_h3dData->ucFrameRate = ucFrameRate;
}
}
/* The following function is only used in OAC*/
#if defined (ACTIVE_EDITOR)
GMT_tdxHandleToGameMaterial fn_p_st3dDataGetShadowMaterial(MS_tdxHandleTo3dData _h3dData)
{
return _h3dData->p_stShadowMaterial;
}
#endif
#if defined (ACTIVE_EDITOR)
/****************************/
long fn_l3dDataGetDrawMaskInit(MS_tdxHandleTo3dData _h3dData)
{
return _h3dData->lDrawMaskInit;
}
#endif /*ACTIVE_EDITOR*/
/****************************/
/****************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetCharacterInvisible(HIE_tdxHandleToSuperObject _hCharacter)
{
if( !M_GetMSHandle(_hCharacter,3dData) )
return;
M_GetMSHandle(_hCharacter,3dData)->lDrawMask =
M_GetMSHandle(_hCharacter,3dData)->lDrawMask &
(GLI_C_lAllIsEnable-GLI_C_lDrawNothing);
HIE_fn_vSetSuperObjectDrawMask(_hCharacter,
M_GetMSHandle(_hCharacter,3dData)->lDrawMask);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/****************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetCharacterVisible(HIE_tdxHandleToSuperObject _hCharacter)
{
if( !M_GetMSHandle(_hCharacter,3dData) )
return;
M_GetMSHandle(_hCharacter,3dData)->lDrawMask =
M_GetMSHandle(_hCharacter,3dData)->lDrawMask | GLI_C_lDrawNothing;
HIE_fn_vSetSuperObjectDrawMask(_hCharacter,
M_GetMSHandle(_hCharacter,3dData)->lDrawMask);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ANNECY MT - 12/06/98 {*/
/****************************/
void fn_v3dDataSetBrainComputationFrequency(MS_tdxHandleTo3dData h_3dData,unsigned char _ucFrequency)
{
h_3dData->ucBrainComputationFrequency = _ucFrequency;
if(h_3dData->cBrainCounter >= h_3dData->ucBrainComputationFrequency)
h_3dData->cBrainCounter = 0;
}
/****************************/
/****************************/
void fn_v3dDataUpdateBrainCounter(HIE_tdxHandleToSuperObject _hCharacter)
{
if(_hCharacter && M_GetMSHandle(_hCharacter,3dData))
{
MS_tdxHandleTo3dData h_3dData = M_GetMSHandle(_hCharacter,3dData);
h_3dData->cBrainCounter ++;
if (h_3dData->cBrainCounter >= h_3dData->ucBrainComputationFrequency)
h_3dData->cBrainCounter = 0;
}
}
/****************************/
ACP_tdxBool fn_b3dDataCanComputeBrain(HIE_tdxHandleToSuperObject _hCharacter)
{
if(_hCharacter && M_GetMSHandle(_hCharacter,3dData))
{
MS_tdxHandleTo3dData h_3dData = M_GetMSHandle(_hCharacter,3dData);
return (ACP_tdxBool)(h_3dData->cBrainCounter==0);
}
return TRUE; /* default*/
}
/****************************/
/****************************/
#if !defined(U64) /* MT {*/
void fn_v3dDataSetLightComputationFrequency(MS_tdxHandleTo3dData h_3dData,unsigned char _ucFrequency)
{
h_3dData->ucLightComputationFrequency = _ucFrequency;
if(h_3dData->cLightCounter >= h_3dData->ucLightComputationFrequency)
h_3dData->cLightCounter = 0;
}
/****************************/
void fn_v3dDataUpdateLightCounter(HIE_tdxHandleToSuperObject _hCharacter)
{
if(_hCharacter && M_GetMSHandle(_hCharacter,3dData))
{
MS_tdxHandleTo3dData h_3dData = M_GetMSHandle(_hCharacter,3dData);
h_3dData->cLightCounter ++;
if (h_3dData->cLightCounter == h_3dData->ucLightComputationFrequency)
h_3dData->cLightCounter = 0;
}
}
/****************************/
ACP_tdxBool fn_b3dDataCanComputeLight(HIE_tdxHandleToSuperObject _hCharacter)
{
/*
if(_hCharacter && M_GetMSHandle(_hCharacter,3dData))
{
MS_tdxHandleTo3dData h_3dData = M_GetMSHandle(_hCharacter,3dData);
return (ACP_tdxBool)(h_3dData->cLightCounter==0);
}
return TRUE; // default
*/
return TRUE;
}
#endif /* U64 - MT }*/
/* END ANNECY MT }*/
/****************************/
BOOL fn_b3dDataGetUserEventFlag(MS_tdxHandleTo3dData h_3dData, unsigned char _ucFlagIndex, MTH3D_tdstVector *_p_stPosition )
{
unsigned char ucMask = (unsigned char) (1 << _ucFlagIndex);
if ( _p_stPosition )
*_p_stPosition = h_3dData->stLastEventGlobalPosition;
return (h_3dData->ucUserEventFlags & ucMask);
}
void fn_v3dDataSetUserEventFlag( MS_tdxHandleTo3dData h_3dData,unsigned char _ucFlagIndex, BOOL _bSet, MTH3D_tdstVector *_p_stPosition )
{
unsigned char ucMask = (unsigned char) (1 << _ucFlagIndex);
if (_bSet)
h_3dData->ucUserEventFlags |= ucMask;
else
h_3dData->ucUserEventFlags &= ~ucMask;
if ( _p_stPosition )
h_3dData->stLastEventGlobalPosition = *_p_stPosition;
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned long fn_ul3dDataSetNumberOfChannels(MS_tdxHandleTo3dData h_3dData, unsigned long ulNumberOfChannels)
{
return (h_3dData->ulNumberOfChannels = ulNumberOfChannels);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* Oliv' - remove wNumRom - 22/06/1999 */
/*
#if defined (U64)
#ifndef RETAIL
short fn_wGet3dDataNumRom(tdstEngineObject * p_stEngineObject)
{
if (p_stEngineObject == NULL)
return -1;
if (((struct tdst3dData_*)((p_stEngineObject)->h_3dData)) == NULL)
return -2;
return (((struct tdst3dData_*)((p_stEngineObject)->h_3dData))->wNumRom);
}
void fn_wSet3dDataNumRom(tdstEngineObject * p_stEngineObject, short wNum)
{
if (p_stEngineObject == NULL)
return;
if (((struct tdst3dData_*)((p_stEngineObject)->h_3dData)) == NULL)
return;
(((struct tdst3dData_*)((p_stEngineObject)->h_3dData))->wNumRom) = wNum;
}
#endif *//* !RETAIL *//*
#endif *//* U64*//*
*/
/* EndOfOliv' */
/****************************/
/* ANNECY MT - 22/09/98 {*/
void fn_vAllocArrayOfElts3d(MS_tdxHandleTo3dData h_3dData, unsigned short _wNumberOfElts3d)
{
unsigned short wCurrentSize = fn_w3dDataGetSizeOfArrayOfElts3d (h_3dData);
if(_wNumberOfElts3d > wCurrentSize)
{
if(fn_p_st3dDataGetCurrentFrame (h_3dData) -> p_stArrayOfElts3d)
{
MMG_fn_vAddMemoryInfo (MMG_C_lTypeFamily , MMG_C_lSubTypeAnimation , h_3dData -> h_Family);
TMP_M_Free (fn_p_st3dDataGetCurrentFrame (h_3dData) -> p_stArrayOfElts3d);
}
MMG_fn_vAddMemoryInfo (MMG_C_lTypeFamily , MMG_C_lSubTypeAnimation , h_3dData -> h_Family);
fn_p_st3dDataGetCurrentFrame (h_3dData) -> p_stArrayOfElts3d = (tdstElement3d*)TMP_M_p_Malloc (sizeof (tdstElement3d) * _wNumberOfElts3d);
/* memset (fn_p_st3dDataGetCurrentFrame (h_3dData) -> p_stArrayOfElts3d , 0 , sizeof (tdstElement3d) * _wNumberOfElts3d); AR9904 Already done in the alloc function */
fn_v3dDataSetSizeOfArrayOfElts3d (h_3dData , _wNumberOfElts3d);
}
}
void fn_vFreeArrayOfElts3d(MS_tdxHandleTo3dData h_3dData)
{
tdstElement3d* p_stElts3d = fn_p_st3dDataGetCurrentFrame (h_3dData) -> p_stArrayOfElts3d;
if (p_stElts3d)
{
MMG_fn_vAddMemoryInfo (MMG_C_lTypeFamily , MMG_C_lSubTypeAnimation , h_3dData -> h_Family);
TMP_M_Free (p_stElts3d);
}
fn_p_st3dDataGetCurrentFrame (h_3dData) -> p_stArrayOfElts3d = NULL;
fn_v3dDataSetSizeOfArrayOfElts3d (h_3dData , 0);
}
/* END ANNECY MT }*/
/****************************/

View File

@@ -0,0 +1,174 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_3dData_StructureDefine
#define D_3dData_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Structur/StdObjSt.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Structur/EngMode.h"
#include "Structur/Objects.h"
#include "Structur/State.h"
#include "Structur/Anim_s.h"
#include "Structur/objstbls.h"
#include "PlayAnim/PlayAnim.h"
#include "GameEng.h"
#include "Basic.h"
#include "ChanList.h"
#include "ObjInit.h"
#include "ObjType.h"
#include "ZdxStuff.h"
#include "ZeMem.h"
#include "Family.h"
#include "TBLLoad.h"
#include "ldt.h"
/*****************************************************************
Name:
Description: Create callback for LDT
Author: Mircea Petrescu
Date: 8/21/98
Modified: Scripa Ovidiu 09/01/98
*****************************************************************/
int fn_iCreate3dData( LDT_tdst_Link *pLink )
{
MS_tdxHandleTo3dData h_3dData;
struct tdstEngineObject_ *p_stEngineObject;
p_stEngineObject=(struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubType3dData , p_stEngineObject);
h_3dData = fn_h_3dDataRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_3dData = h_3dData;
pLink->pObject=(void *)h_3dData;
return 0;
}
/*****************************************************************
Name:
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 8/21/98
Modified: Scripa Ovidiu 09/01/98
*****************************************************************/
int fn_iLoad3dData( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleTo3dData h_3dData=(MS_tdxHandleTo3dData)pLink->pObject;
struct tdstEngineObject_ *p_stEngineObject;
GLD_tdstDeviceAttributes stDevAttrib;
p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
/* LST2_M_StaticInitAnchor(&h_3dData->hTestPointList);*/
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)(szEntry+4))
{
case 'Slai' : /* InitialState */
{
char szCompletFileName[_MAX_PATH];
tdxHandleToState h_InitialState;
/* LDT_tdst_Link* pLink;
pLink = LDT_GetLink(LDT_szGetParam(1));
if (pLink)
{
h_InitialState = (tdxHandleToState)pLink->pObject;
}
else
{
*/
strcpy(szCompletFileName,fn_szGetFamiliesDataPath());
strcat(szCompletFileName,"\\");
strcat(szCompletFileName,LDT_szGetParam(1));
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubType3dData , p_stEngineObject);
h_InitialState = (tdxHandleToState) TMP_M_p_Malloc(strlen(szCompletFileName)+1);
strcpy((char *)h_InitialState, szCompletFileName);
/* }*/
fn_v3dDataSetInitialState(h_3dData, h_InitialState);
}
break;
case 'Olai' : /* InitialObjectsTable */
{
void* p_vLS = NULL;
if (!LDT_SearchFile(LDT_szGetParam(1),NULL)) /* ??*/
{
p_vLS = LDT_LoadSection(LDT_szGetParam(1));
}
LDT_SetFileLong(20, (unsigned long)p_vLS);
}
break;
case 'eTwo' : /* ShadowTexture */
{
GLD_bGetDeviceAttributes(
g_stEngineStructure.hGLDDevice,&stDevAttrib);
GLI_xLoadTexture( &h_3dData->p_stShadowTexture,&stDevAttrib,
LDT_szGetParam(1),
atoi( LDT_szGetParam( 2 ) ),
atoi( LDT_szGetParam( 3 ) ) );
}
break;
case 'aMwo' : /* ShadowMaterial */
{
h_3dData->p_stShadowMaterial = (GMT_tdxHandleToGameMaterial) LDT_LoadSection( LDT_szGetParam(1) );
}
break;
case 'cSwo' : /* ShadowScale */
{
fn_v3dDataSetShadowScaleX(h_3dData, (float)atof( LDT_szGetParam( 1 ) ));
fn_v3dDataSetShadowScaleY(h_3dData, (float)atof( LDT_szGetParam( 2 ) ));
}
break;
case 'eHwo' : /* ShadowHeight */
{
h_3dData->xSHWHeight = (float)atof( LDT_szGetParam( 1 ) );
}
break;
case 'ksaM' : /* DrawMask */
{
h_3dData->lDrawMaskInit = h_3dData->lDrawMask = atoi( LDT_szGetParam( 1 ) );
}
break;
case 'moCn' : /* BrainComputationFrequency */
{
fn_v3dDataSetBrainComputationFrequency(h_3dData,(unsigned char)atoi( LDT_szGetParam( 1 ) ));
}
break;
case 'moCt' : /* LightComputationFrequency */
{
fn_v3dDataSetLightComputationFrequency(h_3dData,(unsigned char)atoi( LDT_szGetParam( 1 ) ));
}
break;
}
}
}
}
return 0;
}

View File

@@ -0,0 +1,123 @@
/*=========================================================================
* 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 */

View File

@@ -0,0 +1,394 @@
/*ANNECY BBB 17/10/97 {*/
/*=========================================================================
* AnimEffect.cpp : AnimEffect's functions
*
* //TODO-B 17/10/97: pr<70>venir Vincent quand fini pour la binarisation ?
*
* AnimEffect MUST BE REPLACE BY THE C FILENAME
*
*
* Version 1.0
* Creation date 01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
#ifndef D_THROW_ANIM_EFFECT
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_AnimEffect_StructureDefine
#define D_AnimEffect_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
/*-----------------------------------------------------------------------------
* Description : AnimEffect's object action script callback
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_eAnimEffectScriptCallback(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;
MS_tdxHandleToAnimEffect h_AnimEffect;
struct tdstEngineObject_ *p_stEngineObject;
_p_stFile=_p_stFile;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,struct tdstEngineObject_ *, p_stEngineObject);
if (M_IsTitle)
{
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeAnimEffect , p_stEngineObject);
h_AnimEffect = fn_h_AnimEffectRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_AnimEffect = h_AnimEffect;
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_AnimEffect);
}
else if (M_IsEntry)
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,MS_tdxHandleToAnimEffect,h_AnimEffect);
if( M_ActionIs(C_EntryAnimEffectShiftPhase) )
{
MTH3D_tdstVector stVector;
M_CheckScriptParamNumber(3);
MTH3D_M_vSetVectorElements(
&stVector,
fn_fAToF(_ap_szParams[0]),
fn_fAToF(_ap_szParams[1]),
fn_fAToF(_ap_szParams[2])
);
fn_vAnimEffectSetShiftPhase(h_AnimEffect, stVector);
}
else if( M_ActionIs(C_EntryAnimEffectShiftMax) )
{
MTH3D_tdstVector stVector;
M_CheckScriptParamNumber(3);
MTH3D_M_vSetVectorElements(
&stVector,
fn_fAToF(_ap_szParams[0]),
fn_fAToF(_ap_szParams[1]),
fn_fAToF(_ap_szParams[2])
);
fn_vAnimEffectSetShiftMax(h_AnimEffect, stVector);
}
else if( M_ActionIs(C_EntryAnimEffectShiftPlus) )
{
MTH3D_tdstVector stVector;
M_CheckScriptParamNumber(3);
MTH3D_M_vSetVectorElements(
&stVector,
fn_fAToF(_ap_szParams[0]),
fn_fAToF(_ap_szParams[1]),
fn_fAToF(_ap_szParams[2])
);
fn_vAnimEffectSetShiftPlus(h_AnimEffect, stVector);
}
}
return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
/*-----------------------------------------------------------------------------
* Description : AnimEffect's save structure
*-----------------------------------------------------------------------------
* Input : SCR_tdst_File_Description *, struct tdstEngineObject_ *
* Output : Void
*-----------------------------------------------------------------------------
* Creation date : 28/02/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*
void fn_vAnimEffectSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
char szSection[SCR_CV_ui_Cfg_MaxLenName];
MS_tdxHandleToAnimEffect h_AnimEffect = p_stObject->h_AnimEffect;
SCR_M_SvL0_SaveBlankLine(p_stFile);
SCR_M_SvL0_SaveComment(p_stFile, "**** AnimEffect mini-structure definition ****");
sprintf(szSection,"%s:",C_SectionAnimEffectDescription);
SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);
// ** Put here the saving script functions ** - Oliv' - Portage v15 - 1 warning removed here
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL)
}
*/
/*-----------------------------------------------------------------------------
* Description : AnimEffect's mini-structure sizeof
*-----------------------------------------------------------------------------
* Input : None
* Output : Size of
*-----------------------------------------------------------------------------
* Creation date : 14/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
unsigned long fn_ulAnimEffectSizeOf()
{
return(sizeof(struct tdstAnimEffect_));
}
/*-----------------------------------------------------------------------------
* Description : AnimEffect's object action allocation
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vAnimEffectAlloc(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_AnimEffect!=NULL)
M_GameFatalError(E_uwGameMiniStructAllocAlreadyAlloc);
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeAnimEffect , p_stObject);
p_stObject->h_AnimEffect = fn_h_AnimEffectRealAlloc();
MMG_fn_vEndMemoryInfo ();
fn_vAnimEffectInitValueSAI(p_stObject->h_AnimEffect);
}
MS_tdxHandleToAnimEffect fn_h_AnimEffectRealAlloc()
{
MS_tdxHandleToAnimEffect h_AnimEffect;
MTH3D_tdstVector stVector = { 0.0, 0.0, 0.0 };
h_AnimEffect = (MS_tdxHandleToAnimEffect)M_p_GameMallocInHLM(fn_ulAnimEffectSizeOf());
fn_vAnimEffectSetShiftPhase(h_AnimEffect, stVector);
fn_vAnimEffectSetShiftMax(h_AnimEffect, stVector);
fn_vAnimEffectSetShiftPlus(h_AnimEffect, stVector);
return(h_AnimEffect);
}
/*-----------------------------------------------------------------------------
* Description : AnimEffect's object action free
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vAnimEffectFree(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_AnimEffect==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
fn_vAnimEffectFreeInitValueSAI(p_stObject->h_AnimEffect);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubTypeAnimEffect , p_stObject );
M_GameFreeInHLM(p_stObject->h_AnimEffect);
}
/*-----------------------------------------------------------------------------
* Description : AnimEffect's object action initialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vAnimEffectInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_AnimEffect==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_ReinitTheMap:
break;
case OTI_LoadSavedGame:
break;
case OTI_MapLoaded:
break;
case OTI_PlayerDead:
break;
default:
break;
}
}
/*-----------------------------------------------------------------------------
* Description : AnimEffect's object action desinitialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vAnimEffectDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_AnimEffect==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_ReinitTheMap:
break;
case OTI_MapLoaded:
break;
case OTI_PlayerDead:
break;
default:
break;
}
}
/*-----------------------------------------------------------------------------
* Description : AnimEffect's object copy clone action
*-----------------------------------------------------------------------------
* Input : Handle to destination, handle to source
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Olivier Jourdan
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vAnimEffectCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc)
{
/* If AnimEffect doesn't contains pointers to structure that may be*/
/* changed during the game, this function must only be a :*/
memcpy(_p_stObjectDest->h_AnimEffect,_p_stObjectSrc->h_AnimEffect,fn_ulAnimEffectSizeOf());
}
/*-----------------------------------------------------------------------------
* Description : AnimEffect access functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleToAnimEffect + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 29/01/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
extern CPA_EXPORT MTH3D_tdstVector fn_stAnimEffectGetShiftPhase(MS_tdxHandleToAnimEffect h_AnimEffect)
{
return h_AnimEffect->stShiftPhase;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
extern CPA_EXPORT MTH3D_tdstVector fn_stAnimEffectGetShiftMax(MS_tdxHandleToAnimEffect h_AnimEffect)
{
return h_AnimEffect->stShiftMax;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
extern CPA_EXPORT MTH3D_tdstVector fn_stAnimEffectGetShiftPlus(MS_tdxHandleToAnimEffect h_AnimEffect)
{
return h_AnimEffect->stShiftPlus;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
extern CPA_EXPORT void fn_vAnimEffectSetShiftPhase(MS_tdxHandleToAnimEffect h_AnimEffect,MTH3D_tdstVector _stVector)
{
h_AnimEffect->stShiftPhase = _stVector;
}
extern CPA_EXPORT void fn_vAnimEffectSetShiftMax(MS_tdxHandleToAnimEffect h_AnimEffect,MTH3D_tdstVector _stVector)
{
h_AnimEffect->stShiftMax = _stVector;
}
extern CPA_EXPORT void fn_vAnimEffectSetShiftPlus(MS_tdxHandleToAnimEffect h_AnimEffect,MTH3D_tdstVector _stVector)
{
h_AnimEffect->stShiftPlus = _stVector;
}
/*-----------------------------------------------------------------------------
* Description : AnimEffect SAI functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleToAnimEffect + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 29/01/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vAnimEffectInitValueSAI(MS_tdxHandleToAnimEffect h_AnimEffect)
{
/**** Put here the functions :*/
/**** SAI_fn_bInsertMTHVectorInTable((void*)&_h_AnimEffect->xxx,SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded);*/
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vAnimEffectSavedValueSAI(MS_tdxHandleToAnimEffect h_AnimEffect)
{
/**** Put here the functions :*/
/**** SAI_fn_bInsertMTHVectorInTable((void*)&p_AnimEffect->xxx,SAI_eSaveCurrentValue);*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void fn_vAnimEffectFreeInitValueSAI(MS_tdxHandleToAnimEffect h_AnimEffect)
{
/**** Put here the functions :*/
/*****/
}
/*ENDANNECY BBB 17/10/97 }*/
#endif /* D_THROW_ANIM_EFFECT */

View File

@@ -0,0 +1,316 @@
/*=========================================================================
* Brain.cpp : Brain's functions
*
*
*
* Brain MUST BE REPLACE BY THE C FILENAME
*
*
* Version 1.0
* Creation date 01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_Brain_StructureDefine
#define D_Brain_VariableDefine
#include "InitEnum.h"
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/EngMode.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "ObjType.h"
#include "ToolCam.h"
#include "LoadBin.h"
/* For BIN*/
#ifdef GAM_USE_SNA
#include "sna\snaglob.h"
#endif /* GAM_USE_SNA */
/* XB 05/05/99 */
extern void fn_vFirstInitAI(AI_tdxHandleToMind p_stMind);
/* End XB 05/05/99 */
extern ACP_tdxBool fn_bIsInFix(struct tdstEngineObject_ *p_stObject);
/*-----------------------------------------------------------------------------
* Description : Brain's object action script callback
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_eBrainScriptCallBack(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;
MS_tdxHandleToBrain h_Brain;
AI_tdstMind *p_stMind;
struct tdstEngineObject_ *p_stEngineObject;
_p_stFile=_p_stFile;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,struct tdstEngineObject_ *, p_stEngineObject);
if (M_IsTitle)
{
char szIntellFileName[_MAX_PATH];
char *szModelName;
char *szFamilyName;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeBrain , p_stEngineObject);
h_Brain = fn_h_BrainRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_Brain=h_Brain;
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_Brain);
p_stMind = M_pstGetMindOfBrain(h_Brain);
szModelName = fn_szFindModelTypeNameOfModelType(M_ObjectGetModelType(p_stEngineObject));
szFamilyName = fn_szFindFamilyTypeNameOfFamilyType(M_ObjectGetFamilyType(p_stEngineObject));
sprintf(szIntellFileName,"%s\\%s\\%s.ai",szFamilyName,szModelName,szModelName);
fn_vReadAI(p_stMind, szIntellFileName,p_stEngineObject );
}
else if (M_IsEntry)
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,MS_tdxHandleToBrain,h_Brain);
}
else if (M_IsEnd)
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,MS_tdxHandleToBrain,h_Brain);
}
return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
/*-----------------------------------------------------------------------------
* Description : Brain's mini-structure sizeof
*-----------------------------------------------------------------------------
* Input : None
* Output : Size of
*-----------------------------------------------------------------------------
* Creation date : 14/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
unsigned long fn_ulBrainSizeOf()
{
return(sizeof(struct tdstBrain_));
}
/*-----------------------------------------------------------------------------
* Description : Brain's object action allocation
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vBrainAlloc(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_Brain!=NULL)
M_GameFatalError(E_uwGameMiniStructAllocAlreadyAlloc);
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeBrain , p_stObject);
p_stObject->h_Brain = fn_h_BrainRealAlloc();
MMG_fn_vEndMemoryInfo ();
}
MS_tdxHandleToBrain fn_h_BrainRealAlloc()
{
MS_tdxHandleToBrain h_Brain;
h_Brain = (MS_tdxHandleToBrain)M_p_GameMallocInHLM(fn_ulBrainSizeOf());
fn_vFirstInitBrain(h_Brain);
return(h_Brain);
}
/*-----------------------------------------------------------------------------
* Description : Brain's object action free
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vBrainFree(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_Brain==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubTypeBrain , p_stObject );
M_GameFreeInHLM(p_stObject->h_Brain);
}
/*-----------------------------------------------------------------------------
* Description : Brain's object action first initialisation
*-----------------------------------------------------------------------------
* Input : Brain structure
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 14/11/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vFirstInitBrain(MS_tdxHandleToBrain h_Brain)
{
AI_tdstMind *p_stMind = fn_pstAllocMind();
M_SetMindOfBrain(h_Brain, p_stMind);
M_vSetLastCollidedGoThroughMaterialOfBrain(h_Brain, GMT_C_ulInvalidHandle);
M_vSetWarnMechanicsFlagOfBrain(h_Brain, 0);
}
/*-----------------------------------------------------------------------------
* Description : Brain's object action initialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vBrainInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_Brain==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
M_vSetLastCollidedGoThroughMaterialOfBrain(p_stObject->h_Brain, GMT_C_ulInvalidHandle);
M_vSetWarnMechanicsFlagOfBrain(p_stObject->h_Brain, 0);
switch(eObjectInit)
{
case OTI_AlwaysCreated:
/* ANNECY MT - 18/09/98 {*/
break;
/* END ANNECY MT }*/
case OTI_PlayerDead:
case OTI_ReinitTheMap:
case OTI_LoadSavedGame:
fn_vReinitAIWithFlags(M_pstGetMindOfBrain(p_stObject->h_Brain),eObjectInit);
break;
case OTI_MapLoaded:
case OTI_WhenGameStart:
/* For BIN*/
if ( !fn_bIsAllSecondPassDone(p_stObject->h_StandardGame)
#if !defined(U64)
&&SNA_fn_ucGetLoadType()!=SNA_LOAD_SNAPSHOT
&&SNA_fn_ucGetLoadType()!=4
#endif /* U64 */
)
{
#if !defined(U64)
fn_vSecondPassOfMindLoading(M_pstGetMindOfBrain(p_stObject->h_Brain),(ACP_tdxBool) fn_bIsInFix(p_stObject),eObjectInit);
#else
fn_vFirstInitAI(M_pstGetMindOfBrain(p_stObject->h_Brain));
fn_vAllSecondPassAreDone(p_stObject->h_StandardGame);
#endif /* U64 */
}
else
fn_vReinitAI(M_pstGetMindOfBrain(p_stObject->h_Brain));
AI_fn_vInsertDsgVarInSAI(M_pstGetMindOfBrain(p_stObject->h_Brain));
break;
}
}
/*-----------------------------------------------------------------------------
* Description : Brain's object action desinitialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vBrainDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_Brain==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_ReinitTheMap:
break;
case OTI_MapLoaded:
break;
case OTI_AlwaysCreated:
case OTI_PlayerDead:
break;
default:
break;
}
}
/*-----------------------------------------------------------------------------
* Description : Brain's object copy clone action
*-----------------------------------------------------------------------------
* Input : Handle to destination, handle to source
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Olivier Jourdan
*-----------------------------------------------------------------------------
* Modification date : 07/07/97 Modification Author : Olivier Jourdan
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vBrainCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc)
{
AI_tdxHandleToMind hMindSrc,hMindDest;
hMindSrc = M_pstGetMindOfBrain(_p_stObjectSrc->h_Brain);
hMindDest = M_pstGetMindOfBrain(_p_stObjectDest->h_Brain);
fn_vSimulateMindAllocationFromAnotherMind(
hMindSrc,hMindDest);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,720 @@
/*=========================================================================
* Dynam.cpp : Dynam's functions
*
*
*
* Dynam MUST BE REPLACE BY THE C FILENAME
*
*
* Version 1.0
* Creation date 01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_Dynam_StructureDefine
#define D_Dynam_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Always.h"
#include "ObjInit.h"
#include "ObjType.h"
#include "ZeMem.h"
#include "ia_dnm.h"
/*-----------------------------------------------------------------------------
* Description : Dynam's object action script callback
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/* #if !defined(U64)*/
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_eDynamScriptCallBack(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;
MS_tdxHandleToDynam h_Dynam;
struct tdstEngineObject_ *p_stEngineObject;
ACP_tdxBool bCanHangOn;
ACP_tdxBool bBase, bAdvanced, bComplex;
eDynamicSize eSize;
ACP_tdxBool bCollision;
long lObjectType;
unsigned char ucTypeOfObject;
ACP_tdxBool bIsMobile;
DNM_tdstDynamics* p_stDynamics;
_p_stFile=_p_stFile;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,struct tdstEngineObject_ *, p_stEngineObject);
lObjectType = DNM_C_lObjectType_SolidMobile;
ucTypeOfObject = DNM_C_lObjectType_Solid;
bIsMobile = TRUE;
bCanHangOn = TRUE;
if (M_IsTitle)
{
bBase = bAdvanced = bComplex = FALSE;
bCollision = FALSE; /* default value */
eSize = eDynamicSizeBase; /* default size */
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeDynamics , p_stEngineObject);
h_Dynam = fn_h_DynamRealAlloc();
if (SCR_fn_uc_RdL0_GetNumberOfParameters(_ap_szParams)>=1)
{
if (!strcmp (_ap_szParams[0],C_szDynamicSizeBase)) eSize=eDynamicSizeBase;
else if (!strcmp (_ap_szParams[0],C_szDynamicSizeAdvanced)) eSize=eDynamicSizeAdvanced;
else if (!strcmp (_ap_szParams[0],C_szDynamicSizeComplex)) eSize=eDynamicSizeComplex;
if (SCR_fn_uc_RdL0_GetNumberOfParameters(_ap_szParams)==2) bCollision = (ACP_tdxBool)atoi (_ap_szParams[1]);
}
fn_v_DynamicAlloc ( h_Dynam, eSize, bCollision, FALSE );
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_Dynam=h_Dynam;
fn_vInitDynamicalFunctionPointer(h_Dynam);
p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam);
if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamics))
{
DNM_M_vDynamicsSetSlideFactorX ( p_stDynamics, MTH_C_ONE );
DNM_M_vDynamicsSetSlideFactorY ( p_stDynamics, MTH_C_ONE );
DNM_M_vDynamicsSetSlideFactorZ ( p_stDynamics, MTH_C_ONE );
}
}
else if (M_IsEntry)
{
DNM_tdstDynamics* p_stDynamics;
p_stDynamics = fn_p_stDynamGetDynamics(p_stEngineObject->h_Dynam);
/* this test is only usefull to read old .car */
if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamics))
{
if(M_ActionIs(C_szSlideFactorX))
{
double fSlideX;
fSlideX = atof (_ap_szParams[0]);
DNM_M_vDynamicsSetSlideFactorX (p_stDynamics,MTH_M_xDoubleToReal(fSlideX));
}
else if(M_ActionIs(C_szSlideFactorY))
{
double fSlideY;
fSlideY = atof (_ap_szParams[0]);
DNM_M_vDynamicsSetSlideFactorY (p_stDynamics,MTH_M_xDoubleToReal(fSlideY));
}
else if(M_ActionIs(C_szSlideFactorZ))
{
double fSlideZ;
fSlideZ = atof (_ap_szParams[0]);
DNM_M_vDynamicsSetSlideFactorZ (p_stDynamics,MTH_M_xDoubleToReal(fSlideZ));
}
}
}
return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
/*-----------------------------------------------------------------------------
* Description : Dynam's mini-structure sizeof
*-----------------------------------------------------------------------------
* Input : None
* Output : Size of
*-----------------------------------------------------------------------------
* Creation date : 14/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
unsigned long fn_ulDynamSizeOf()
{
return(sizeof(struct tdstDynam_));
}
/*-----------------------------------------------------------------------------
* Description : Dynam's object action allocation
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vDynamAlloc(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_Dynam!=NULL)
M_GameFatalError(E_uwGameMiniStructAllocAlreadyAlloc);
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeDynamics , p_stObject);
p_stObject->h_Dynam = fn_h_DynamRealAlloc();
fn_v_DynamicAlloc ( p_stObject->h_Dynam, eDynamicSizeBase, FALSE, (ACP_tdxBool)fn_ucIsAnAlwaysObject(p_stObject) );
MMG_fn_vEndMemoryInfo ();
}
MS_tdxHandleToDynam fn_h_DynamRealAlloc()
{
MS_tdxHandleToDynam h_Dynam;
h_Dynam = (MS_tdxHandleToDynam)M_p_GameMallocInHLM(fn_ulDynamSizeOf());
fn_vDynamSetParsingDatas(h_Dynam,(struct DNM_stParsingDatas *)M_p_GameMallocInHLM(sizeof(DNM_tdstParsingDatas)));
return(h_Dynam);
}
void fn_v_DynamicAlloc ( MS_tdxHandleToDynam h_Dynam, eDynamicSize eSize, ACP_tdxBool bCollision, ACP_tdxBool bAlways )
{
DNM_tdstDynamics* p_stDynamic=NULL;
#ifdef ACTIVE_EDITOR
/* In editor mode, we make a full allocation */
/* allocation */
p_stDynamic = (DNM_tdstDynamics*)M_p_GameMallocInHLM(sizeof(DNM_tdstComplexDynamics));
fn_vDynamSetDynamics ( h_Dynam, p_stDynamic );
DNM_M_DynamicsSetReport ( p_stDynamic, (DNM_tdstReport*)M_p_GameMallocInHLM(sizeof(DNM_tdstReport)) );
/* update flags */
switch (eSize)
{
case eDynamicSizeBase : DNM_M_vDynamicsSetBaseSize (p_stDynamic); break;
case eDynamicSizeAdvanced : DNM_M_vDynamicsSetAdvancedSize (p_stDynamic); break;
case eDynamicSizeComplex : DNM_M_vDynamicsSetComplexSize (p_stDynamic); break;
}
/* since we always allocate the collision report, say so! */
DNM_M_vDynamicsSetCollisionReport ( p_stDynamic, TRUE );
#else /* ACTIVE_EDITOR*/
/* allocation */
if (bAlways)
{
switch (eSize)
{
case eDynamicSizeBase :
p_stDynamic = (DNM_tdstDynamics*)TMP_M_p_Malloc(sizeof(DNM_tdstBaseDynamics));
DNM_M_vDynamicsSetBaseSize (p_stDynamic);
break;
case eDynamicSizeAdvanced :
p_stDynamic = (DNM_tdstDynamics*)TMP_M_p_Malloc(sizeof(DNM_tdstAdvancedDynamics));
DNM_M_vDynamicsSetAdvancedSize (p_stDynamic);
break;
case eDynamicSizeComplex :
p_stDynamic = (DNM_tdstDynamics*)TMP_M_p_Malloc(sizeof(DNM_tdstComplexDynamics));
DNM_M_vDynamicsSetComplexSize (p_stDynamic);
break;
}
}
else
{
switch (eSize)
{
case eDynamicSizeBase :
p_stDynamic = (DNM_tdstDynamics*)M_p_GameMallocInHLM(sizeof(DNM_tdstBaseDynamics));
DNM_M_vDynamicsSetBaseSize (p_stDynamic);
break;
case eDynamicSizeAdvanced :
p_stDynamic = (DNM_tdstDynamics*)M_p_GameMallocInHLM(sizeof(DNM_tdstAdvancedDynamics));
DNM_M_vDynamicsSetAdvancedSize (p_stDynamic);
break;
case eDynamicSizeComplex :
p_stDynamic = (DNM_tdstDynamics*)M_p_GameMallocInHLM(sizeof(DNM_tdstComplexDynamics));
DNM_M_vDynamicsSetComplexSize (p_stDynamic);
break;
}
}
fn_vDynamSetDynamics ( h_Dynam, p_stDynamic );
DNM_M_vDynamicsSetAlways ( p_stDynamic, bAlways );
if (bCollision)
{
if( bAlways )
DNM_M_DynamicsSetReport ( p_stDynamic, (DNM_tdstReport*)TMP_M_p_Malloc(sizeof(DNM_tdstReport)) );
else
DNM_M_DynamicsSetReport ( p_stDynamic, (DNM_tdstReport*)M_p_GameMallocInHLM(sizeof(DNM_tdstReport)) );
}
else
DNM_M_DynamicsSetReport ( p_stDynamic, NULL );
DNM_M_vDynamicsSetCollisionReport ( p_stDynamic, bCollision );
#endif /* ACTIVE_EDITOR*/
}
void fn_v_DynamicFree ( MS_tdxHandleToDynam h_Dynam )
{
DNM_tdstDynamics* p_stDynamic;
if( (p_stDynamic = fn_p_stDynamGetDynamics(h_Dynam)) == NULL )
return;
#ifdef ACTIVE_EDITOR
if (DNM_M_bDynamicsIsCollisionReport(p_stDynamic))
M_GameFreeInHLM (DNM_M_p_stDynamicsGetReportWithoutCheckAccess(p_stDynamic));
M_GameFreeInHLM (p_stDynamic);
#else
if (DNM_M_bDynamicsIsAlways(p_stDynamic))
{
if (DNM_M_bDynamicsIsCollisionReport(p_stDynamic))
TMP_M_Free (DNM_M_p_stDynamicsGetReportWithoutCheckAccess(p_stDynamic));
TMP_M_Free (p_stDynamic);
}
else
{
if (DNM_M_bDynamicsIsCollisionReport(p_stDynamic))
M_GameFreeInHLM (DNM_M_p_stDynamicsGetReportWithoutCheckAccess(p_stDynamic));
M_GameFreeInHLM (p_stDynamic);
}
#endif
fn_vDynamSetDynamics( h_Dynam, NULL );
p_stDynamic = NULL;
}
/*-----------------------------------------------------------------------------
* Description : Dynam's object action free
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vDynamFree(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_Dynam==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubTypeLight , p_stObject );
fn_v_DynamicFree (p_stObject->h_Dynam);
M_GameFreeInHLM(p_stObject->h_Dynam);
}
/*-----------------------------------------------------------------------------
* Description : Dynam's object action initialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vUpdateDynamicsMS(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_Dynam==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void fn_vDynamInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
switch(eObjectInit)
{
case OTI_PlayerDead:
case OTI_ReinitTheMap:
case OTI_LoadSavedGame:
case OTI_MapLoaded:
case OTI_WhenGameStart:
DNM_fn_vInitBaseMechanic (p_stObject->h_Dynam->p_stDynamics);
memset(p_stObject->h_Dynam->p_stParsingDatas,0,sizeof(struct DNM_stParsingDatas));
break;
/* ANNECY MT - 18/09/98 {*/
case OTI_AlwaysCreated:
break;
/* END ANNECY MT }*/
}
}
/*-----------------------------------------------------------------------------
* Description : Dynam's object action desinitialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vDynamDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_Dynam==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_ReinitTheMap:
break;
case OTI_MapLoaded:
/* Free only dynamics for always (because it's in TMP)*/
if (DNM_M_bDynamicsIsAlways(p_stObject->h_Dynam->p_stDynamics))
fn_v_DynamicFree( p_stObject->h_Dynam );
break;
case OTI_AlwaysCreated:
case OTI_PlayerDead:
break;
default:
break;
}
}
/*-----------------------------------------------------------------------------
* Description : Dynam's object copy clone action
*-----------------------------------------------------------------------------
* Input : Handle to destination, handle to source
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Olivier Jourdan
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vDynamCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc)
{
MS_tdxHandleToDynam hDest,hSrc;
DNM_tdstDynamics *p_stSrcDynamic, *p_stDestDynamic;
eDynamicSize eSize;
ACP_tdxBool bAlloc=TRUE;
ACP_tdxBool bAlways;
hDest = _p_stObjectDest->h_Dynam;
hSrc = _p_stObjectSrc->h_Dynam;
p_stSrcDynamic = _p_stObjectSrc->h_Dynam->p_stDynamics;
p_stDestDynamic = _p_stObjectDest->h_Dynam->p_stDynamics;
if (!p_stSrcDynamic) return;
bAlways = (ACP_tdxBool) fn_ucIsAnAlwaysObject (_p_stObjectDest);
/* alloc */
/* Oliv' - Portage v15 - ???*/
/*#ifndef U64*/
if (DNM_M_bDynamicsIsComplexSize(p_stSrcDynamic)) eSize = eDynamicSizeComplex;
else if (DNM_M_bDynamicsIsAdvancedSize(p_stSrcDynamic)) eSize = eDynamicSizeAdvanced;
else eSize = eDynamicSizeBase;
/*#else*/
/* eSize = eDynamicSizeComplex;*/
/*#endif*/
/* EndOfOliv'*/
if (p_stDestDynamic)
{
/* size */
switch (eSize)
{
case eDynamicSizeComplex :
bAlloc = (ACP_tdxBool)!DNM_M_bDynamicsIsComplexSize(p_stDestDynamic);
break;
case eDynamicSizeAdvanced :
bAlloc = (ACP_tdxBool)!DNM_M_bDynamicsIsAdvancedSize(p_stDestDynamic);
break;
case eDynamicSizeBase :
bAlloc = (ACP_tdxBool)!DNM_M_bDynamicsIsBaseSize(p_stDestDynamic);
break;
}
/* collision */
/* LOL*/
/*#ifndef U64*/
if (DNM_M_bDynamicsIsCollisionReport(p_stSrcDynamic)!=DNM_M_bDynamicsIsCollisionReport(p_stDestDynamic))
bAlloc = TRUE;
if (bAlloc) fn_v_DynamicFree (hDest);
/*#endif*/
}
if (bAlloc) fn_v_DynamicAlloc ( hDest, eSize, (ACP_tdxBool)(DNM_M_bDynamicsIsCollisionReport(p_stSrcDynamic)), bAlways );
/* copy */
DNM_fn_vDynamicsCopyClone(hDest->p_stDynamics,hSrc->p_stDynamics);
memcpy(hDest->p_stParsingDatas,hSrc->p_stParsingDatas,sizeof(DNM_tdstParsingDatas));
hDest->eUsedMechanics = hSrc->eUsedMechanics;
/* Set the always flag again, because it may have been changed by DNM_fn_vDynamicsCopyClone.*/
DNM_M_vDynamicsSetAlways( hDest->p_stDynamics, bAlways );
}
void fn_vInitDynamicalFunctionPointer(MS_tdxHandleToDynam h_Dynam)
{
DNM_fn_vDynamicsInitDefault(fn_p_stDynamGetDynamics(h_Dynam));
}
/*-----------------------------------------------------------------------------
* Description : Dynam access functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleToDynam + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 31/01/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
struct DNM_stDynamics *fn_p_stDynamGetDynamics(MS_tdxHandleToDynam h_Dynam)
{
return(h_Dynam->p_stDynamics);
}
void fn_vDynamSetDynamics(MS_tdxHandleToDynam h_Dynam,struct DNM_stDynamics *p_stDynam)
{
h_Dynam->p_stDynamics=p_stDynam;
}
DNM_tdstParsingDatas *fn_p_stDynamGetParsingDatas(MS_tdxHandleToDynam h_Dynam)
{
return((h_Dynam->p_stParsingDatas));
}
void fn_vDynamSetParsingDatas(MS_tdxHandleToDynam h_Dynam,DNM_tdstParsingDatas *p_stParsingDatas)
{
h_Dynam->p_stParsingDatas = p_stParsingDatas;
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
DNM_tdeMechanicsID fn_eDynamGetUsedMechanics(MS_tdxHandleToDynam h_Dynam)
{
return (h_Dynam->eUsedMechanics);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void fn_vDynamSetUsedMechanics(MS_tdxHandleToDynam h_Dynam,DNM_tdeMechanicsID eUsedMechanics)
{
h_Dynam->eUsedMechanics = eUsedMechanics;
}
/* ANNECY MT - 25/08/98 {
MTH3D_tdstVector *fn_p_DynamGetCheckedSpeed(MS_tdxHandleToDynam h_Dynam,unsigned long _ul)
{
if ( _ul < C_ucNbOfCheckedSpeeds )
return (&(h_Dynam ->AveragePosition.a_CheckedSpeed[_ul]));
return NULL;
}
void fn_vDynamSetCheckedSpeed(MS_tdxHandleToDynam h_Dynam,unsigned long _ul,MTH3D_tdstVector *p_Speed)
{
if ( _ul < C_ucNbOfCheckedSpeeds )
{
MTH3D_M_vCopyVector((&(h_Dynam->AveragePosition.a_CheckedSpeed[_ul])),p_Speed);
}
else
MTH3D_M_vNullVector(&(h_Dynam ->AveragePosition.a_CheckedSpeed[_ul]));
}
MTH_tdxReal fn_xDynamGetCheckedTime(MS_tdxHandleToDynam h_Dynam,unsigned long _ul)
{
if ( _ul < C_ucNbOfCheckedSpeeds )
return (h_Dynam ->AveragePosition.a_CheckedTime[_ul]);
return 0;
}
void fn_vDynamSetCheckedTime(MS_tdxHandleToDynam h_Dynam,unsigned long _ul,MTH_tdxReal _dt)
{
if ( _ul < C_ucNbOfCheckedSpeeds )
{
h_Dynam ->AveragePosition.a_CheckedTime[_ul] = _dt;
}
else
h_Dynam ->AveragePosition.a_CheckedTime[_ul] = 0;
}
MTH3D_tdstVector *fn_p_DynamGetCheckedPos(MS_tdxHandleToDynam h_Dynam,unsigned long _ul)
{
if ( _ul < C_ucNbOfCheckedSpeeds )
return (&(h_Dynam ->AveragePosition.a_CheckedPos[_ul]));
return NULL;
}
void fn_vDynamSetCheckedPos(MS_tdxHandleToDynam h_Dynam,unsigned long _ul,MTH3D_tdstVector *p_Pos)
{
if ( _ul < C_ucNbOfCheckedSpeeds )
{
MTH3D_M_vCopyVector((&(h_Dynam->AveragePosition.a_CheckedPos[_ul])),p_Pos);
}
else
MTH3D_M_vNullVector(&(h_Dynam ->AveragePosition.a_CheckedPos[_ul]));
}
tdstSightAxisSystem *fn_p_DynamGetSightAxisSystem(MS_tdxHandleToDynam h_Dynam)
{
return &(h_Dynam->stSightAxisSystem);
}
MTH3D_tdstVector *fn_p_DynamGetSightAxis(MS_tdxHandleToDynam h_Dynam)
{
return (&(h_Dynam->stSightAxisSystem.SightAxis));
}
MTH3D_tdstVector *fn_p_DynamGetFirstComplementaryAxis(MS_tdxHandleToDynam h_Dynam)
{
return (&(h_Dynam->stSightAxisSystem.FirstComplementaryAxis));
}
MTH3D_tdstVector *fn_p_DynamGetSecondComplementaryAxis(MS_tdxHandleToDynam h_Dynam)
{
return (&(h_Dynam->stSightAxisSystem.SecondComplementaryAxis));
}
void fn_vDynamSetSightAxisSystem(MS_tdxHandleToDynam h_Dynam,tdstSightAxisSystem *p_stAxisSystem)
{
MTH3D_M_vCopyVector(&(h_Dynam->stSightAxisSystem.SightAxis),
&(p_stAxisSystem->SightAxis));
MTH3D_M_vCopyVector(&(h_Dynam->stSightAxisSystem.FirstComplementaryAxis),
&(p_stAxisSystem->FirstComplementaryAxis));
MTH3D_M_vCopyVector(&(h_Dynam->stSightAxisSystem.SecondComplementaryAxis),
&(p_stAxisSystem->SecondComplementaryAxis));
}
void fn_vDynamSetSightAxis(MS_tdxHandleToDynam h_Dynam,MTH3D_tdstVector *p_stVector)
{
MTH3D_M_vCopyVector(&(h_Dynam->stSightAxisSystem.SightAxis), p_stVector);
}
void fn_vDynamSetFirstComplementaryAxis(MS_tdxHandleToDynam h_Dynam,MTH3D_tdstVector *p_stVector)
{
MTH3D_M_vCopyVector(&(h_Dynam->stSightAxisSystem.FirstComplementaryAxis), p_stVector);
}
void fn_vDynamSetSecondComplementaryAxis(MS_tdxHandleToDynam h_Dynam,MTH3D_tdstVector *p_stVector)
{
MTH3D_M_vCopyVector(&(h_Dynam->stSightAxisSystem.SecondComplementaryAxis), p_stVector);
}
void fn_vGetPersoSightAxisSystem
(
HIE_tdxHandleToSuperObject _hPerso,
MTH3D_tdstVector *_p_stSightAxis,
MTH3D_tdstVector *_p_stFirstComplementaryAxis,
MTH3D_tdstVector *_p_stSecondComplementaryAxis
)
{
MS_tdxHandleToDynam h_Dynam;
if((h_Dynam = M_GetMSHandle(_hPerso,Dynam)) == NULL )
{
MTH3D_M_vSetBaseJVector(_p_stSightAxis);
MTH3D_M_vSetBaseJVector(_p_stFirstComplementaryAxis);
MTH3D_M_vSetBaseJVector(_p_stSecondComplementaryAxis);
return;
}
MTH3D_M_vCopyVector(_p_stSightAxis , fn_p_DynamGetSightAxis(h_Dynam));
MTH3D_M_vCopyVector(_p_stFirstComplementaryAxis , fn_p_DynamGetFirstComplementaryAxis(h_Dynam));
MTH3D_M_vCopyVector(_p_stSecondComplementaryAxis , fn_p_DynamGetSecondComplementaryAxis(h_Dynam));
}
END ANNECY MT } */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_DynamUpdateDNMObjectTypeFromMS(struct tdstDynam_ *p_stDynam)
{
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*ANNECY jt {*/
struct DNM_stDynamics* fn_p_stDynamGetDynamicsSO (HIE_tdxHandleToSuperObject hSupObj)
{
MS_tdxHandleToDynam h_Dynam;
HIE_tdxHandleToVoid h_Object;
struct DNM_stDynamics* p_stDynamics = NULL;
h_Object = HIE_fn_hGetSuperObjectObject(hSupObj);
if (h_Object)
{
h_Dynam = M_GetMSHandle (hSupObj,Dynam);
if (h_Dynam) p_stDynamics = fn_p_stDynamGetDynamics (h_Dynam);
}
return p_stDynamics;
}
/*vient de AI\AiTools.c*/
/********************************************************************************************
* Set the position of p_SuperObjPerso to p_stVertex. Do not make the mecanic collision test.
*********************************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxBool fn_bSetPositionWithoutCollideTest(HIE_tdxHandleToSuperObject p_SuperObjPerso, MTH3D_tdstVector *p_stVertex)
{
/* Set the new position*/
POS_fn_vSetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),p_stVertex);
POS_fn_vSetTranslationVector(HIE_fn_hGetSuperObjectMatrix(p_SuperObjPerso),p_stVertex);
return TRUE;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*ENDANNECY jt }*/

View File

@@ -0,0 +1,548 @@
/*=========================================================================
* MSMagnet.cpp : MSMagnet's functions
*
*
*
* MSMagnet MUST BE REPLACE BY THE C FILENAME
*
*
* Version 1.0
* Creation date 01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
#ifndef D_THROW_MGT
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_MSMagnet_StructureDefine
#define D_MSMagnet_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "GameEng.h"
#include "ObjInit.h"
#include "ZeMem.h"
/*-----------------------------------------------------------------------------
* Description : MSMagnet's object action script callback
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_eMSMagnetScriptCallback(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;
MS_tdxHandleToMSMagnet h_MSMagnet;
struct tdstEngineObject_ *p_stEngineObject;
_p_stFile=_p_stFile;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,struct tdstEngineObject_ *, p_stEngineObject);
if (M_IsTitle)
{
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMagnet , p_stEngineObject);
h_MSMagnet = fn_h_MSMagnetRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_MSMagnet = h_MSMagnet;
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_MSMagnet);
}
else if (M_IsEntry)
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,MS_tdxHandleToMSMagnet,h_MSMagnet);
if (M_ActionIs(C_EntryMagnetStatus))
{
M_CheckScriptParamNumber(1);
fn_vMSMagnetSetStatus(h_MSMagnet,(unsigned char)fn_lAToI(_ap_szParams[0]));
}
if (M_ActionIs(C_EntryMagnetFar))
{
M_CheckScriptParamNumber(1);
fn_vMSMagnetSetFar(h_MSMagnet,fn_fAToF(_ap_szParams[0]));
}
if (M_ActionIs(C_EntryMagnetNear))
{
M_CheckScriptParamNumber(1);
fn_vMSMagnetSetNear(h_MSMagnet,fn_fAToF(_ap_szParams[0]));
}
if (M_ActionIs(C_EntryMagnetStrength))
{
M_CheckScriptParamNumber(1);
fn_vMSMagnetSetStrength(h_MSMagnet,fn_fAToF(_ap_szParams[0]));
}
if (M_ActionIs(C_EntryMagnetDuration))
{
M_CheckScriptParamNumber(1);
fn_vMSMagnetSetDuration(h_MSMagnet,(unsigned long)fn_lAToI(_ap_szParams[0]));
}
}
return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
/*-----------------------------------------------------------------------------
* Description : MSMagnet's save structure
*-----------------------------------------------------------------------------
* Input : SCR_tdst_File_Description *, struct tdstEngineObject_ *
* Output : Void
*-----------------------------------------------------------------------------
* Creation date : 28/02/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*
void fn_vMSMagnetSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
char szSection[SCR_CV_ui_Cfg_MaxLenName];
MS_tdxHandleToMSMagnet h_MSMagnet = p_stObject->h_MSMagnet;
SCR_M_SvL0_SaveBlankLine(p_stFile);
SCR_M_SvL0_SaveComment(p_stFile, "**** MSMagnet mini-structure definition ****");
sprintf(szSection,"%s:",C_SectionMSMagnetDescription);
SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);
// ** Put here the saving script functions ** - Oliv' - Portage v15 - 1 warning removed here
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL)
}
*/
/*-----------------------------------------------------------------------------
* Description : MSMagnet's mini-structure sizeof
*-----------------------------------------------------------------------------
* Input : None
* Output : Size of
*-----------------------------------------------------------------------------
* Creation date : 14/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
unsigned long fn_ulMSMagnetSizeOf()
{
return(sizeof(struct tdstMSMagnet_));
}
/*-----------------------------------------------------------------------------
* Description : MSMagnet's object action allocation
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSMagnetAlloc(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_MSMagnet!=NULL)
M_GameFatalError(E_uwGameMiniStructAllocAlreadyAlloc);
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMagnet , p_stObject);
p_stObject->h_MSMagnet = fn_h_MSMagnetRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stObject->h_MSMagnet->ulDuration = 0;
p_stObject->h_MSMagnet->status = MAGNETOFF;
p_stObject->h_MSMagnet->xMaxIndexOfMagnetModification = 0;
/*p_stObject->h_MSMagnet->bStrengthModified = FALSE;*/
/*p_stObject->h_MSMagnet->bNearFarModified = FALSE;*/
p_stObject->h_MSMagnet->ucModifiedFlags = 0;
fn_vMSMagnetInitValueSAI(p_stObject->h_MSMagnet);
}
MS_tdxHandleToMSMagnet fn_h_MSMagnetRealAlloc()
{
MS_tdxHandleToMSMagnet h_MSMagnet;
h_MSMagnet = (MS_tdxHandleToMSMagnet)M_p_GameMallocInHLM(fn_ulMSMagnetSizeOf());
return(h_MSMagnet);
}
/*-----------------------------------------------------------------------------
* Description : MSMagnet's object action free
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSMagnetFree(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_MSMagnet==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
fn_vMSMagnetFreeInitValueSAI(p_stObject->h_MSMagnet);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMagnet , p_stObject );
M_GameFreeInHLM(p_stObject->h_MSMagnet);
}
/*-----------------------------------------------------------------------------
* Description : MSMagnet's object action initialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSMagnetInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_MSMagnet==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_ReinitTheMap:
fn_vMSMagnetSetStatus(p_stObject->h_MSMagnet, MAGNETOFF);
break;
case OTI_LoadSavedGame:
fn_vMSMagnetSetStatus(p_stObject->h_MSMagnet, MAGNETOFF);
break;
case OTI_MapLoaded:
fn_vMSMagnetSetStatus(p_stObject->h_MSMagnet, MAGNETOFF);
fn_vMSMagnetInitValueSAI(p_stObject->h_MSMagnet);
fn_vMSMagnetSavedValueSAI(p_stObject->h_MSMagnet);
break;
case OTI_PlayerDead:
fn_vMSMagnetSetStatus(p_stObject->h_MSMagnet, MAGNETOFF);
break;
default:
break;
}
}
/*-----------------------------------------------------------------------------
* Description : MSMagnet's object action desinitialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSMagnetDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_MSMagnet==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_ReinitTheMap:
break;
case OTI_MapLoaded:
break;
case OTI_PlayerDead:
break;
default:
break;
}
}
/*-----------------------------------------------------------------------------
* Description : MSMagnet's object copy clone action
*-----------------------------------------------------------------------------
* Input : Handle to destination, handle to source
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Olivier Jourdan
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSMagnetCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc)
{
/* If MSMagnet doesn't contains pointers to structure that may be*/
/* changed during the game, this function must only be a :*/
memcpy(_p_stObjectDest->h_MSMagnet,_p_stObjectSrc->h_MSMagnet,fn_ulMSMagnetSizeOf());
}
/*-----------------------------------------------------------------------------
* Description : MSMagnet access functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleToMSMagnet + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 29/01/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
MTH_tdxReal fn_xMSMagnetGetFar(MS_tdxHandleToMSMagnet h_MSMagnet)
{
return((h_MSMagnet->xFar > h_MSMagnet->xNear)?h_MSMagnet->xFar:h_MSMagnet->xNear);
}
void fn_vMSMagnetSetFar(MS_tdxHandleToMSMagnet h_MSMagnet,MTH_tdxReal xValue)
{
h_MSMagnet->xFar = xValue;
fn_vMSMagnetSetNearFarModification(h_MSMagnet,TRUE);
}
MTH_tdxReal fn_xMSMagnetGetNear(MS_tdxHandleToMSMagnet h_MSMagnet)
{
return((h_MSMagnet->xFar < h_MSMagnet->xNear)?h_MSMagnet->xFar:h_MSMagnet->xNear);
}
void fn_vMSMagnetSetNear(MS_tdxHandleToMSMagnet h_MSMagnet,MTH_tdxReal xValue)
{
h_MSMagnet->xNear = xValue;
fn_vMSMagnetSetNearFarModification(h_MSMagnet,TRUE);
}
MTH_tdxReal fn_xMSMagnetGetStrength(MS_tdxHandleToMSMagnet h_MSMagnet)
{
return(h_MSMagnet->xStrength);
}
void fn_vMSMagnetSetStrength(MS_tdxHandleToMSMagnet h_MSMagnet,MTH_tdxReal xValue)
{
h_MSMagnet->xStrength = xValue;
fn_vMSMagnetSetStrengthModification(h_MSMagnet,TRUE);
}
unsigned char fn_lMSMagnetGetStatus(MS_tdxHandleToMSMagnet h_MSMagnet)
{
return(h_MSMagnet->status);
}
void fn_vMSMagnetSetStatus(MS_tdxHandleToMSMagnet h_MSMagnet,unsigned char xValue)
{
h_MSMagnet->status = xValue;
}
void fn_vMSMagnetAddMagnetModification(MS_tdxHandleToMSMagnet h_MSMagnet, MGT_tdxHandleToMagnetModification h_MagnetModif )
{
ACP_tdxIndex xIndex;
MGT_tdxHandleToMagnetModification *p_h_MagnetModif;
for( xIndex = 0 , p_h_MagnetModif = h_MSMagnet -> d_hMagnetModification ;
xIndex < h_MSMagnet -> xMaxIndexOfMagnetModification ;
xIndex++, p_h_MagnetModif++ )
{
if( (*p_h_MagnetModif) == NULL )
{
break;
}
}
if( xIndex < MGT_MAX_NUMBEROF_MODIFIEDOBJECTS )
{
(*p_h_MagnetModif) = h_MagnetModif;
if( xIndex == h_MSMagnet -> xMaxIndexOfMagnetModification )
h_MSMagnet -> xMaxIndexOfMagnetModification++;
}
}
void fn_vMSMagnetDeleteMagnetModification(MS_tdxHandleToMSMagnet h_MSMagnet, MGT_tdxHandleToMagnetModification h_MagnetModif )
{
ACP_tdxIndex xIndex;
for( xIndex = 0 ; xIndex < h_MSMagnet -> xMaxIndexOfMagnetModification ; xIndex++ )
{
if( h_MSMagnet -> d_hMagnetModification[ xIndex ] == h_MagnetModif )
{
h_MSMagnet -> d_hMagnetModification[ xIndex ] = NULL;
if( xIndex == (h_MSMagnet -> xMaxIndexOfMagnetModification-1) )
h_MSMagnet -> xMaxIndexOfMagnetModification--;
break;
}
}
}
MGT_tdxHandleToMagnetModification fn_hMSMagnetGetMagnetModification(MS_tdxHandleToMSMagnet h_MSMagnet, ACP_tdxIndex xIndex )
{
return h_MSMagnet -> d_hMagnetModification[ xIndex ];
}
ACP_tdxIndex fn_xMSMagnetGetMaxIndexOfMagnetModification(MS_tdxHandleToMSMagnet h_MSMagnet)
{
return h_MSMagnet -> xMaxIndexOfMagnetModification;
}
MTH3D_tdstVector * fn_hMSMagnetGetPosition(MS_tdxHandleToMSMagnet h_MSMagnet)
{
return(&(h_MSMagnet->stPosition));
}
void fn_vMSMagnetSetPosition(MS_tdxHandleToMSMagnet h_MSMagnet,MTH3D_tdstVector *stPosition)
{
MTH3D_M_vCopyVector(&(h_MSMagnet->stPosition), stPosition);
}
unsigned long fn_ulMSMagnetGetDuration(MS_tdxHandleToMSMagnet h_MSMagnet)
{
return(h_MSMagnet->ulDuration);
}
void fn_vMSMagnetSetDuration(MS_tdxHandleToMSMagnet h_MSMagnet,unsigned long ulDuration)
{
h_MSMagnet->ulDuration = ulDuration;
}
void fn_vMSMagnetSetNearFarModification(MS_tdxHandleToMSMagnet h_MSMagnet,ACP_tdxBool _bModified)
{
/*h_MSMagnet->bNearFarModified = _bModified;*/
if( _bModified )
h_MSMagnet->ucModifiedFlags |= MAGNET_NEARFAR_MODIFIED;
else
h_MSMagnet->ucModifiedFlags &= ~MAGNET_NEARFAR_MODIFIED;
}
ACP_tdxBool fn_bMSMagnetIsNearFarModified(MS_tdxHandleToMSMagnet h_MSMagnet)
{
/*return h_MSMagnet->bNearFarModified;*/
return (unsigned char)( h_MSMagnet->ucModifiedFlags & MAGNET_NEARFAR_MODIFIED ? TRUE : FALSE );
}
void fn_vMSMagnetSetStrengthModification(MS_tdxHandleToMSMagnet h_MSMagnet,ACP_tdxBool _bModified)
{
/*h_MSMagnet->bStrengthModified = _bModified;*/
if( _bModified )
h_MSMagnet->ucModifiedFlags |= MAGNET_STRENGTH_MODIFIED;
else
h_MSMagnet->ucModifiedFlags &= ~MAGNET_STRENGTH_MODIFIED;
}
ACP_tdxBool fn_bMSMagnetIsStrengthModified(MS_tdxHandleToMSMagnet h_MSMagnet)
{
/*return h_MSMagnet->bStrengthModified;*/
return (unsigned char)( h_MSMagnet->ucModifiedFlags & MAGNET_STRENGTH_MODIFIED ? TRUE : FALSE );
}
void fn_vMSMagnetSetPositionModification(MS_tdxHandleToMSMagnet h_MSMagnet,ACP_tdxBool _bModified)
{
if( _bModified )
h_MSMagnet->ucModifiedFlags |= MAGNET_POSITION_MODIFIED;
else
h_MSMagnet->ucModifiedFlags &= ~MAGNET_POSITION_MODIFIED;
}
ACP_tdxBool fn_bMSMagnetIsPositionModified(MS_tdxHandleToMSMagnet h_MSMagnet)
{
return (unsigned char)( h_MSMagnet->ucModifiedFlags & MAGNET_POSITION_MODIFIED ? TRUE : FALSE );
}
/*************************************/
/**** Access functions for Editor ****/
/*************************************/
#define C_Magnet_SAIInitFlags (SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded)
#if defined(ACTIVE_EDITOR)
/*************************************************************************/
MTH_tdxReal *fn_p_xMSMagnetGetFarInit(MS_tdxHandleToMSMagnet _hMSMagnet)
{
return
(MTH_tdxReal *)SAI_fn_p_vGetTableValuePointerOf((void*)&_hMSMagnet->xFar, C_Magnet_SAIInitFlags);
}
MTH_tdxReal *fn_p_xMSMagnetGetNearInit(MS_tdxHandleToMSMagnet _hMSMagnet)
{
return
(MTH_tdxReal *)SAI_fn_p_vGetTableValuePointerOf((void*)&_hMSMagnet->xNear, C_Magnet_SAIInitFlags);
}
MTH_tdxReal *fn_p_xMSMagnetGetStrengthInit(MS_tdxHandleToMSMagnet _hMSMagnet)
{
return
(MTH_tdxReal *)SAI_fn_p_vGetTableValuePointerOf((void*)&_hMSMagnet->xStrength, C_Magnet_SAIInitFlags);
}
unsigned long *fn_p_ulMSMagnetGetDurationInit(MS_tdxHandleToMSMagnet _hMSMagnet)
{
return
(unsigned long *)SAI_fn_p_vGetTableValuePointerOf((void*)&_hMSMagnet->ulDuration, C_Magnet_SAIInitFlags);
}
#endif /* ACTIVE_EDITOR */
/*-----------------------------------------------------------------------------
* Description : MSMagnet SAI functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleToMSMagnet + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 29/01/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSMagnetInitValueSAI(MS_tdxHandleToMSMagnet _h_MSMagnet)
{
/**** Put here the functions :*/
SAI_fn_bInsertMTHRealInTable((void*)&_h_MSMagnet->xFar, C_Magnet_SAIInitFlags);
SAI_fn_bInsertMTHRealInTable((void*)&_h_MSMagnet->xNear, C_Magnet_SAIInitFlags);
SAI_fn_bInsertMTHRealInTable((void*)&_h_MSMagnet->xStrength, C_Magnet_SAIInitFlags);
SAI_fn_bInsertLongInTable((void*)&_h_MSMagnet->ulDuration, C_Magnet_SAIInitFlags);
}
void fn_vMSMagnetSavedValueSAI(MS_tdxHandleToMSMagnet _h_MSMagnet)
{
/**** Put here the functions :*/
/* SAI_fn_bInsertMTHRealInTable((void*)&_h_MSMagnet->xFar,SAI_ePlayerSaveCurrentValue);*/
/* SAI_fn_bInsertMTHRealInTable((void*)&_h_MSMagnet->xNear,SAI_ePlayerSaveCurrentValue);*/
/* SAI_fn_bInsertMTHRealInTable((void*)&_h_MSMagnet->xStrength,SAI_ePlayerSaveCurrentValue);*/
/* SAI_fn_bInsertLongInTable((void*)&_h_MSMagnet->ulDuration,SAI_ePlayerSaveCurrentValue);*/
}
void fn_vMSMagnetFreeInitValueSAI(MS_tdxHandleToMSMagnet _h_MSMagnet)
{
/**** Put here the functions :*/
/*****/
SAI_fn_bRemoveValueFromTable((void*)&_h_MSMagnet->xFar, C_Magnet_SAIInitFlags);
SAI_fn_bRemoveValueFromTable((void*)&_h_MSMagnet->xNear, C_Magnet_SAIInitFlags);
SAI_fn_bRemoveValueFromTable((void*)&_h_MSMagnet->xStrength, C_Magnet_SAIInitFlags);
SAI_fn_bRemoveValueFromTable((void*)&_h_MSMagnet->ulDuration, C_Magnet_SAIInitFlags);
/* SAI_fn_bRemoveValueFromTable((void*)&_h_MSMagnet->xFar,SAI_ePlayerSaveCurrentValue);*/
/* SAI_fn_bRemoveValueFromTable((void*)&_h_MSMagnet->xNear,SAI_ePlayerSaveCurrentValue);*/
/* SAI_fn_bRemoveValueFromTable((void*)&_h_MSMagnet->xStrength,SAI_ePlayerSaveCurrentValue);*/
/* SAI_fn_bRemoveValueFromTable((void*)&_h_MSMagnet->ulDuration,SAI_ePlayerSaveCurrentValue);*/
}
#endif /* D_THROW_MGT */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,378 @@
/*=========================================================================
* MSSound.cpp : MSSound's functions
*
*
*
* MSSound MUST BE REPLACE BY THE C FILENAME
*
*
* Version 1.0
* Creation date 01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_MSSound_StructureDefine
#define D_MSSound_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
/*-----------------------------------------------------------------------------
* Description : MSSound's object action script callback
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : xxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_eMSSoundScriptCallback(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;
MS_tdxHandleToMSSound h_MSSound;
struct tdstEngineObject_ *p_stEngineObject;
_p_stFile=_p_stFile;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,struct tdstEngineObject_ *, p_stEngineObject);
if (M_IsTitle)
{
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMSSound , p_stEngineObject);
h_MSSound = fn_h_MSSoundRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_MSSound = h_MSSound;
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_MSSound);
}
else if (M_IsEntry)
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,MS_tdxHandleToMSSound,h_MSSound);
if( M_ActionIs(C_EntryMSSoundSaturationDistance) )
{
M_CheckScriptParamNumber(1);
/*h_MSSound->stRollOff.rDistSatur = M_Fixed1616ToRealSnd(MTH_M_xRealToFixed16_16(MTH_M_xDoubleToReal(atof(_ap_szParams[0]))));*/
h_MSSound->stRollOff.rDistSatur = atol(_ap_szParams[0]);
}
else if( M_ActionIs(C_EntryMSSoundBackGroundDistance) )
{
M_CheckScriptParamNumber(1);
/*h_MSSound->stRollOff.rDistBackGround = M_Fixed1616ToRealSnd(MTH_M_xRealToFixed16_16(MTH_M_xDoubleToReal(atof(_ap_szParams[0]))));*/
h_MSSound->stRollOff.rDistBackGround = atol(_ap_szParams[0]);
}
}
return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
/*-----------------------------------------------------------------------------
* Description : MSSound's save structure
*-----------------------------------------------------------------------------
* Input : SCR_tdst_File_Description *, struct tdstEngineObject_ *
* Output : Void
*-----------------------------------------------------------------------------
* Creation date : 28/02/97 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*
void fn_vMSSoundSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
char szSection[SCR_CV_ui_Cfg_MaxLenName];
MS_tdxHandleToMSSound h_MSSound = p_stObject->h_MSSound;
SCR_M_SvL0_SaveBlankLine(p_stFile);
SCR_M_SvL0_SaveComment(p_stFile, "**** MSSound mini-structure definition ****");
sprintf(szSection,"%s:",C_SectionMSSoundDescription);
SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);
// ** Put here the saving script functions **
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL)
}
*/
/*-----------------------------------------------------------------------------
* Description : MSSound's mini-structure sizeof
*-----------------------------------------------------------------------------
* Input : None
* Output : Size of
*-----------------------------------------------------------------------------
* Creation date : 14/10/96 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
unsigned long fn_ulMSSoundSizeOf()
{
return(sizeof(struct tdstMSSound_));
}
/*-----------------------------------------------------------------------------
* Description : MSSound's object action allocation
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSSoundAlloc(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_MSSound!=NULL)
M_GameFatalError(E_uwGameMiniStructAllocAlreadyAlloc);
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMSSound , p_stObject);
p_stObject->h_MSSound = fn_h_MSSoundRealAlloc();
MMG_fn_vEndMemoryInfo ();
fn_vMSSoundInitValueSAI(p_stObject->h_MSSound);
}
MS_tdxHandleToMSSound fn_h_MSSoundRealAlloc()
{
MS_tdxHandleToMSSound h_MSSound;
h_MSSound = (MS_tdxHandleToMSSound)M_p_GameMallocInHLM(fn_ulMSSoundSizeOf());
return(h_MSSound);
}
/*-----------------------------------------------------------------------------
* Description : MSSound's object action free
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSSoundFree(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_MSSound==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
fn_vMSSoundFreeInitValueSAI(p_stObject->h_MSSound);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMSSound , p_stObject );
M_GameFreeInHLM(p_stObject->h_MSSound);
}
/*-----------------------------------------------------------------------------
* Description : MSSound's object action initialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSSoundInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_MSSound==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_WhenGameStart:
break;
case OTI_ReinitTheMap:
break;
case OTI_LoadSavedGame:
break;
case OTI_MapLoaded:
fn_vMSSoundInitValueSAI(p_stObject->h_MSSound);
fn_vMSSoundSavedValueSAI(p_stObject->h_MSSound);
break;
case OTI_PlayerDead:
break;
default:
break;
}
}
/*-----------------------------------------------------------------------------
* Description : MSSound's object action desinitialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSSoundDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_MSSound==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_WhenGameStart:
break;
case OTI_ReinitTheMap:
break;
case OTI_MapLoaded:
break;
case OTI_PlayerDead:
break;
default:
break;
}
}
/*-----------------------------------------------------------------------------
* Description : MSSound's object copy clone action
*-----------------------------------------------------------------------------
* Input : Handle to destination, handle to source
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Olivier Jourdan
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSSoundCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc)
{
/* If MSSound doesn't contains pointers to structure that may be*/
/* changed during the game, this function must only be a :*/
memcpy(_p_stObjectDest->h_MSSound,_p_stObjectSrc->h_MSSound,fn_ulMSSoundSizeOf());
}
/*-----------------------------------------------------------------------------
* Description : MSSound access functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleToMSSound + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 29/01/97 Author : Olivier (JO) Jourdan
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
SndReal fn_xMSSoundGetSaturationDistance(MS_tdxHandleToMSSound h_MSSound)
{
return( h_MSSound->stRollOff.rDistSatur );
}
void fn_vMSSoundSetSaturationDistance(MS_tdxHandleToMSSound h_MSSound,SndReal _xSaturationDistance)
{
h_MSSound->stRollOff.rDistSatur = _xSaturationDistance;
}
SndReal fn_xMSSoundGetBackGroundDistance(MS_tdxHandleToMSSound h_MSSound)
{
return( h_MSSound->stRollOff.rDistBackGround );
}
void fn_vMSSoundSetBackGroundDistance(MS_tdxHandleToMSSound h_MSSound,SndReal _xBackGroundDistance)
{
h_MSSound->stRollOff.rDistBackGround = _xBackGroundDistance;
}
SndBool fn_bRetRollOffFactor(long _lObj,RollOffParam* _p_stRolloff)
{
MS_tdxHandleToMSSound hMSSound;
if(!_lObj || _lObj==SND_C_OBJET_FANTOME)
return FALSE;
hMSSound = M_GetMSHandle( (HIE_tdxHandleToSuperObject)_lObj,MSSound );
if( !hMSSound )
return FALSE;
_p_stRolloff->rDistSatur = hMSSound->stRollOff.rDistSatur;
_p_stRolloff->rDistBackGround = hMSSound->stRollOff.rDistBackGround;
return TRUE;
}
/*-----------------------------------------------------------------------------
* Description : MSSound SAI functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleToMSSound + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 29/01/97 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#define C_Sound_SAIInitFlags SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded
void fn_vMSSoundInitValueSAI(MS_tdxHandleToMSSound h_MSSound)
{
SAI_fn_bInsertLongInTable((void*)&h_MSSound->stRollOff.rDistSatur,C_Sound_SAIInitFlags);
SAI_fn_bInsertLongInTable((void*)&h_MSSound->stRollOff.rDistBackGround,C_Sound_SAIInitFlags);
}
void fn_vMSSoundSavedValueSAI(MS_tdxHandleToMSSound h_MSSound)
{
/**** Put here the functions :*/
/**** SAI_fn_bInsertMTHVectorInTable((void*)&p_MSSound->xxx,SAI_eSaveCurrentValue);*/
}
void fn_vMSSoundFreeInitValueSAI(MS_tdxHandleToMSSound h_MSSound)
{
SAI_fn_bRemoveValueFromTable((void*)&h_MSSound->stRollOff.rDistSatur,C_Sound_SAIInitFlags);
SAI_fn_bRemoveValueFromTable((void*)&h_MSSound->stRollOff.rDistBackGround,C_Sound_SAIInitFlags);
}
#ifdef ACTIVE_EDITOR /* MT { */
SndReal *fn_p_xMSSoundGetSaturationDistanceInit(MS_tdxHandleToMSSound h_MSSound)
{
return (SndReal *)SAI_fn_p_vGetTableValuePointerOf((void*)&h_MSSound->stRollOff.rDistSatur, C_Sound_SAIInitFlags);
}
SndReal *fn_p_xMSSoundGetBackGroundDistanceInit(MS_tdxHandleToMSSound h_MSSound)
{
return (SndReal *)SAI_fn_p_vGetTableValuePointerOf((void*)&h_MSSound->stRollOff.rDistBackGround, C_Sound_SAIInitFlags);
}
#endif /* MT } */

View File

@@ -0,0 +1,586 @@
/*=========================================================================
* MSWay.cpp : MSWay's functions
* Version 1.0
* Creation date January 21, 1997
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*==========================================================================
* Remarks :
* Allocation of MSWay fields are made inside the AI module memory block
* Error raised when handling MSWay fields are raised from AI error module
*==========================================================================*/
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_MSWay_StructureDefine
#define D_MSWay_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
/*ANNECY JMD{*/
#define _WP_D_WPGRAPH_FRIEND_
#include "AI/AIBASE/WPgraphe.h"
#undef _WP_D_WPGRAPH_FRIEND_
/*ENDANNECY JMD }*/
#include "AI.h"
#include "safe.h" /*BART*/
/*-----------------------------------------------------------------------------
* Description : MSWay's object action script callback
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author : Albert Pais
* Modifications :
* Effective implementation for MS Way
*-----------------------------------------------------------------------------
* Script Section Template for MS Way :
* :MSWay(NbrOfWay)
* Way(FileName,SectionNameOfWay1)
* Way(FileName,SectionNameOfWay2)
* ....
* Way(FileName,SectionNameOfWayNbrOfWay)
* :EndSection
*---------------------------------------------------------------------------*/
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_eMSWayScriptCallBack(SCR_tdst_File_Description *_p_stHandle,char *_p_szName,char *_d_szPars[],SCR_tde_Anl_Action _eAction)
{
SCRIPT_tdeReturnValue eReturnValue = R_SCRIPT_NormalReturn;
MS_tdxHandleToMSWay h_MSWay;
struct tdstEngineObject_ *p_stEngineObject;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,struct tdstEngineObject_ *, p_stEngineObject);
if (M_IsTitle)
{
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMSWay , p_stEngineObject);
h_MSWay = fn_h_MSWayRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_MSWay=h_MSWay;
/* Push the result :*/
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_MSWay);
}
return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
/*-----------------------------------------------------------------------------
* Description : MSWay's mini-structure sizeof
*-----------------------------------------------------------------------------
* Input : None
* Output : Size of
*-----------------------------------------------------------------------------
* Creation date : 14/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : January 21,1997 Modification Author : Albert Pais
* Modifications : Effective implementation for MS Way
*---------------------------------------------------------------------------*/
unsigned long fn_ulMSWaySizeOf()
{
return(sizeof(struct tdstMSWay_));
}
/*-----------------------------------------------------------------------------
* Description : MSWay's object action allocation
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : January 21,1997 Modification Author : Albert Pais
* Modifications : Effective implementation for MS Way
*---------------------------------------------------------------------------*/
void fn_vMSWayAlloc(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (MSWAY_M_hGetMSWayFromEngineObject(p_stObject)!=MSWAY_M_hInvalidMsWayHandle)
M_GameFatalError(E_uwGameMiniStructAllocAlreadyAlloc);
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMSWay , p_stObject);
MSWAY_M_hGetMSWayFromEngineObject(p_stObject) = fn_h_MSWayRealAlloc();
MMG_fn_vEndMemoryInfo ();
}
MS_tdxHandleToMSWay fn_h_MSWayRealAlloc()
{
MS_tdxHandleToMSWay h_MSWay;
h_MSWay = (MS_tdxHandleToMSWay)M_p_GameMallocInHLM(fn_ulMSWaySizeOf());
MSWay_fn_vInitPath (h_MSWay);
return(h_MSWay);
}
/*-----------------------------------------------------------------------------
* Description : MSWay's object action free
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : January 22,1997 Modification Author : Alb
* Modifications : Effective implementation for MS Way
*---------------------------------------------------------------------------*/
void fn_vMSWayFree(struct tdstEngineObject_ *p_stObject)
{
MS_tdxHandleToMSWay hMSWay;
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
hMSWay = MSWAY_M_hGetMSWayFromEngineObject(p_stObject);
if (hMSWay==MSWAY_M_hInvalidMsWayHandle)
M_GameFatalError(E_uwGameMiniStructNull);
/*ANNECY Bart#02 27/05/98 {*/
MSWay_fn_vDesinitPath(hMSWay);
/*ENDANNECY Bart#02 }*/
/* Destroy the object :*/
/* dfm
MSWay_fn_v_DestroyListOfWay
(
MSWAY_M_hGetMSWayFromEngineObject(p_stObject)
);
*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMSWay , p_stObject );
M_GameFreeInHLM(p_stObject->h_MSWay);
}
/*-----------------------------------------------------------------------------
* Description : MSWay's object action initialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSWayInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
MS_tdxHandleToMSWay hMSWay;
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
hMSWay = MSWAY_M_hGetMSWayFromEngineObject(p_stObject);
if (hMSWay==MSWAY_M_hInvalidMsWayHandle)
M_GameFatalError(E_uwGameMiniStructNull);
MSWay_fn_vInitPath (hMSWay);
}
/*-----------------------------------------------------------------------------
* Description : MSWay's object action desinitialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSWayDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
MS_tdxHandleToMSWay hMSWay;
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
hMSWay = MSWAY_M_hGetMSWayFromEngineObject(p_stObject);
if (hMSWay==MSWAY_M_hInvalidMsWayHandle)
M_GameFatalError(E_uwGameMiniStructNull);
MSWay_fn_vDesinitPath(hMSWay);
}
/*-----------------------------------------------------------------------------
* Description : MSWay's object copy clone action
*-----------------------------------------------------------------------------
* Input : Handle to destination, handle to source
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Olivier Jourdan
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vMSWayCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc)
{
/*ANNECY Bart#02 27/05/98 {*/
MSWay_fn_vDesinitPath(_p_stObjectDest->h_MSWay); /* Just To Be Sure !*/
/*ENDANNECY Bart#02 }*/
memcpy(_p_stObjectDest->h_MSWay,_p_stObjectSrc->h_MSWay,fn_ulMSWaySizeOf());
/*ANNECY Bart#02 27/05/98 {*/
MSWay_fn_vInitPath (_p_stObjectDest->h_MSWay); /* Just To Be Sure !*/
/*ENDANNECY Bart#02 }*/
}
/*-----------------------------------------------------------------------------
* Description : compute the second pass for :
* - list of way
* - waypoint
* - way
*-----------------------------------------------------------------------------
* Input : None
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 13/05/97 Author : Jacques Th<54>noz
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#if defined(GAM_USE_SCRIPT)
void fn_vWaypointSecondPass (void)
{
WP_fnv_WayPoint_LinkTableSecondPass ();
}
#endif /* GAM_USE_SCRIPT */
/*JMD*************************************************************************
* manage graph ( the m_hPath member )
*****************************************************************************
*
* waypoint are stored in the reversed order the last one is at index 0
* (see WPG_fn_hShortestPath() that built the list from the destination
* to the source, that the algorithme !) so we must read them in reverse
* order
*****************************************************************************/
void MSWay_fn_vInitPath (MS_tdxHandleToMSWay hWay)
{
/*
if ( hWay ) {
hWay->m_hPath = NULL ;
hWay->m_lIndex = -1 ;
hWay->m_bIsCircular = 0;
}
*/
MSWay_fn_vDesinitPath(hWay); /* because we want to be sure that this new graph does not ecrase an old one that would not been desalloued*/
}
void MSWay_fn_vDesinitPath(MS_tdxHandleToMSWay hWay)
{
if ( hWay )
{
if ( hWay->m_hPath )
{
#ifdef GAM_USE_SCRIPT
if (hWay->m_hPath->m_szReferenceSection[0] == '@') /*BART*/
#endif
WPG_fn_vDestroy (hWay->m_hPath) ;
}
hWay->m_hPath = NULL ;
hWay->m_lIndex = -1 ;
hWay->m_bIsCircular = 0;
}
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
WP_tdHandleOfGraph MSWay_fn_hGetPathFormPerso (HIE_tdxHandleToSuperObject hSuperObject)
{
MS_tdxHandleToMSWay h_MSWay;
h_MSWay = M_GetMSHandle(hSuperObject, MSWay);
if ( h_MSWay )
return ( h_MSWay->m_hPath ) ;
return (NULL) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void MSWay_fn_vSetPath(MS_tdxHandleToMSWay hWay, WP_tdHandleOfGraph hPath, char _bIsCircular)
{
if ( hWay && hPath )
{
if ( hWay->m_hPath != NULL )
{
#ifdef GAM_USE_SCRIPT
/*if (hWay->m_hPath->m_szNameOfGraph[0] == 0) // no name => not a real graph, so you can destroy it ! !*/
if (hWay->m_hPath->m_szReferenceSection[0] == '@') /*BART*/
#endif
WPG_fn_vDestroy (hWay->m_hPath) ;
}
hWay->m_hPath = hPath ;
/* hWay->m_lIndex = WPG_fn_lNumberOfWaypointOfGraph (hPath) - 1 ;*/
hWay->m_lIndex = 0 ;
hWay->m_bIsCircular = _bIsCircular;
}
}
long MSWay_fn_lGetNumberWayPointInPath (MS_tdxHandleToMSWay hWay)
{
if ( hWay && hWay->m_hPath )
return (LST2_M_DynamicGetNumberOfElements(&hWay->m_hPath->m_hListOfNode)) ;
return (-1) ;
}
long MSWay_fn_lGetCurrentIndexInPath (MS_tdxHandleToMSWay hWay)
{
if (hWay && hWay->m_hPath)
return (hWay->m_lIndex) ;
return (-1) ;
}
long MSWay_fn_lGetLastIndexInPath (MS_tdxHandleToMSWay hWay)
{
if ( hWay && hWay->m_hPath )
return (LST2_M_DynamicGetNumberOfElements(&hWay->m_hPath->m_hListOfNode)-1) ;
/* return (0) ;*/
return (-1) ;
}
long MSWay_fn_lGetFirstIndexInPath (MS_tdxHandleToMSWay hWay)
{
if ( hWay && hWay->m_hPath )
return (0) ;
return (-1) ;
}
long MSWay_fn_lSetCurrentIndexInPath (MS_tdxHandleToMSWay hWay, long _lIndex)
{
long lNbOfElts;
if ( hWay != NULL && hWay->m_hPath )
{
lNbOfElts = LST2_M_DynamicGetNumberOfElements(&hWay->m_hPath->m_hListOfNode);
if (hWay->m_bIsCircular)
{
_lIndex %= lNbOfElts;
if (_lIndex<0) _lIndex+=lNbOfElts;
}
if (_lIndex>=lNbOfElts)
_lIndex = lNbOfElts-1;
if (_lIndex<0)
_lIndex = 0;
hWay->m_lIndex = _lIndex ;
return (hWay->m_lIndex) ;
}
return (-1) ;
}
long MSWay_fn_lLookForWPInMSWay(MS_tdxHandleToMSWay _hWay, WP_tdhWayPoint _hWayPoint)
{
long lNbOfElts;
int iIndex;
WP_tdhGraphNode hElement;
if ( _hWay && _hWay->m_hPath )
{
lNbOfElts = LST2_M_DynamicGetNumberOfElements(&_hWay->m_hPath->m_hListOfNode);
LST2_M_DynamicForEachElementOf(&_hWay->m_hPath->m_hListOfNode, hElement, iIndex)
{
if (_hWayPoint == hElement->m_hWayPoint)
return ((long)(lNbOfElts - iIndex - 1) );
}
}
return(-1);
}
long MSWay_fn_lIncrementCurrentIndexInPath (MS_tdxHandleToMSWay hWay, int iStep)
{
long lNbOfElts;
SAF_M_AssertWithMsg((hWay != NULL),"MsWay non alloue")
if (hWay == NULL)
return (-1);
SAF_M_AssertWithMsg((hWay->m_hPath != NULL),"MsWay non initialise")
if ( hWay->m_hPath )
{
lNbOfElts = LST2_M_DynamicGetNumberOfElements(&hWay->m_hPath->m_hListOfNode);
if (hWay->m_bIsCircular)
{
hWay->m_lIndex += iStep;
hWay->m_lIndex %= lNbOfElts;
if (hWay->m_lIndex<0) hWay->m_lIndex+=lNbOfElts;
return (hWay->m_lIndex);
}
else
{
if ( (hWay->m_lIndex + iStep >= 0) &&
(hWay->m_lIndex + iStep < lNbOfElts ) )
{
hWay->m_lIndex += iStep ;
return (hWay->m_lIndex) ;
}
}
}
return (-1) ;
}
WP_tdhWayPoint MSWay_fn_hGetWayPointOfPath (MS_tdxHandleToMSWay hWay, int iIndex)
{
WP_tdhGraphNode hElement ;
int i, k ;
long lNbOfElts;
if ( hWay && hWay->m_hPath)
{
lNbOfElts = LST2_M_DynamicGetNumberOfElements(&hWay->m_hPath->m_hListOfNode);
if (hWay->m_bIsCircular)
{
iIndex %= lNbOfElts;
if (iIndex<0) iIndex+=lNbOfElts;
}
else
{
if (iIndex < 0 || iIndex >= lNbOfElts )
return(NULL);
}
k = lNbOfElts - iIndex - 1;
LST2_M_DynamicGetElementNumber(&hWay->m_hPath->m_hListOfNode, hElement, k, i)
return (hElement->m_hWayPoint);
}
return (NULL) ;
}
unsigned long MSWay_fn_ulGetCapsForNextWayPointOfPath (MS_tdxHandleToMSWay hWay, int iIndex)
{
WP_tdhWayPoint hWayPoint1, hWayPoint2 ;
unsigned long ulNewCaps ;
long lNbOfElts;
if ( hWay && hWay->m_hPath != NULL)
{
lNbOfElts = LST2_M_DynamicGetNumberOfElements(&hWay->m_hPath->m_hListOfNode);
if (hWay->m_bIsCircular)
{
iIndex %= lNbOfElts;
if (iIndex<0) iIndex+=lNbOfElts;
}
if ( iIndex >= 0 && iIndex < lNbOfElts )
{
hWayPoint1 = MSWay_fn_hGetWayPointOfPath(hWay, iIndex ) ;
hWayPoint2 = MSWay_fn_hGetWayPointOfPath(hWay, iIndex+1 ) ;
if ( hWayPoint2 )
{
if (WPG_fn_lGetLinkCapabilities (hWay->m_hPath, hWayPoint1, hWayPoint2, &ulNewCaps)== -1 )
return (0);
return ( ulNewCaps ) ;
}
}
}
return (0) ;
}
long MSWay_fn_lChangeCapsForNextWayPointOfPath (MS_tdxHandleToMSWay hWay, int iIndex, unsigned long ulNewCaps, long lValue)
{
WP_tdhWayPoint hWayPoint1, hWayPoint2 ;
long lNbOfElts;
if ( hWay && hWay->m_hPath != NULL)
{
lNbOfElts = LST2_M_DynamicGetNumberOfElements(&hWay->m_hPath->m_hListOfNode);
if (hWay->m_bIsCircular)
{
iIndex %= lNbOfElts;
if (iIndex<0) iIndex+=lNbOfElts;
}
if ( iIndex >= 0 && iIndex < lNbOfElts )
{
hWayPoint1 = MSWay_fn_hGetWayPointOfPath(hWay, iIndex ) ;
hWayPoint2 = MSWay_fn_hGetWayPointOfPath(hWay, iIndex+1 ) ;
if ( hWayPoint2 )
{
return (WPG_fn_lChangeLinkCapabilities (hWay->m_hPath, hWayPoint1, hWayPoint2, ulNewCaps, lValue)); /* -1 if error*/
}
}
}
return (-1) ;
}
long MSWay_fn_lGetWeightForNextWayPointOfPath (MS_tdxHandleToMSWay hWay, int iIndex)
{
WP_tdhWayPoint hWayPoint1, hWayPoint2 ;
long lValue ;
long lNbOfElts;
if ( hWay && hWay->m_hPath != NULL)
{
lNbOfElts = LST2_M_DynamicGetNumberOfElements(&hWay->m_hPath->m_hListOfNode);
if (hWay->m_bIsCircular)
{
iIndex %= lNbOfElts;
if (iIndex<0) iIndex+=lNbOfElts;
}
if ( iIndex >= 0 && iIndex < lNbOfElts )
{
hWayPoint1 = MSWay_fn_hGetWayPointOfPath(hWay, iIndex ) ;
hWayPoint2 = MSWay_fn_hGetWayPointOfPath(hWay, iIndex+1 ) ;
if ( hWayPoint2 )
{
if (WPG_fn_lGetLinkWeight (hWay->m_hPath, hWayPoint1, hWayPoint2, &lValue)== -1 )
return (0);
return ( lValue ) ;
}
}
}
return (0) ;
}
long MSWay_fn_lChangeWeightForNextWayPointOfPath (MS_tdxHandleToMSWay hWay, int iIndex, long lWeight)
{
WP_tdhWayPoint hWayPoint1, hWayPoint2 ;
long lNbOfElts;
if ( hWay && hWay->m_hPath != NULL)
{
lNbOfElts = LST2_M_DynamicGetNumberOfElements(&hWay->m_hPath->m_hListOfNode);
if (hWay->m_bIsCircular)
{
iIndex %= lNbOfElts;
if (iIndex<0) iIndex+=lNbOfElts;
}
if ( iIndex >= 0 && iIndex < lNbOfElts )
{
hWayPoint1 = MSWay_fn_hGetWayPointOfPath(hWay, iIndex ) ;
hWayPoint2 = MSWay_fn_hGetWayPointOfPath(hWay, iIndex+1 ) ;
if ( hWayPoint2 )
{
return (WPG_fn_lChangeLinkWeight (hWay->m_hPath, hWayPoint1, hWayPoint2, lWeight)); /* -1 if error*/
}
}
}
return (-1) ;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,891 @@
/*=========================================================================
* SectInfo.cpp : SectInfo's functions
*
*
*
* SectInfo MUST BE REPLACE BY THE C FILENAME
*
*
* Version 1.0
* Creation date 01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_SectInfo_StructureDefine
#define D_SectInfo_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Structur/anim_s.h"
#include "Basic.h"
#include "GameEng.h"
#include "micros.h"
#include "MainChar.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "AlwAct.h"
#include "Playanim/playanim.h"
#ifdef GAM_USE_SNA
#include "sna.h"
#endif /* GAM_USE_SNA */
#include "always.h"
extern BOOL bFirst;
#if defined(GAM_USE_SNA)
/*
extern tdstEngineObject *g_a20_stSNAObjectsInFix[20];
extern unsigned long g_ulSNANbObjectsInFix;
*/
#endif /* GAM_USE_SNA */
HIE_tdxHandleToSuperObject g_hCharacterLauchingSoundEvents;
/*-----------------------------------------------------------------------------
* Description : SectInfo's object action script callback
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author : Olivier
* Modifications :
*---------------------------------------------------------------------------*/
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_eSectInfoScriptCallBack(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;
MS_tdxHandleToSectInfo h_SectInfo;
struct tdstEngineObject_ *p_stEngineObject;
_p_stFile=_p_stFile;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,struct tdstEngineObject_ *, p_stEngineObject);
if (M_IsTitle)
{
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeSectInfo , p_stEngineObject);
h_SectInfo = fn_h_SectInfoRealAlloc();
MMG_fn_vEndMemoryInfo ();
h_SectInfo->hCurrentSector=NULL;
p_stEngineObject->h_SectInfo=h_SectInfo;
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_SectInfo);
}
else if (M_IsEntry)
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,MS_tdxHandleToSectInfo,h_SectInfo);
}
return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
/*-----------------------------------------------------------------------------
* Description : SectInfo's mini-structure sizeof
*-----------------------------------------------------------------------------
* Input : None
* Output : Size of
*-----------------------------------------------------------------------------
* Creation date : 14/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
unsigned long fn_ulSectInfoSizeOf()
{
return(sizeof(struct tdstSectInfo_));
}
/*-----------------------------------------------------------------------------
* Description : SectInfo's object action allocation
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vSectInfoAlloc(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_SectInfo!=NULL)
M_GameFatalError(E_uwGameMiniStructAllocAlreadyAlloc);
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeSectInfo , p_stObject);
p_stObject->h_SectInfo = fn_h_SectInfoRealAlloc();
MMG_fn_vEndMemoryInfo ();
}
MS_tdxHandleToSectInfo fn_h_SectInfoRealAlloc()
{
MS_tdxHandleToSectInfo h_SectInfo;
h_SectInfo = (MS_tdxHandleToSectInfo)M_p_GameMallocInHLM(fn_ulSectInfoSizeOf());
h_SectInfo->hNodeInSector = SECT_fn_hCreateElementLstCharacter();
return(h_SectInfo);
}
/*-----------------------------------------------------------------------------
* Description : SectInfo's object action free
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vSectInfoFree(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_SectInfo==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubTypeSectInfo , p_stObject );
M_GameFreeInHLM(p_stObject->h_SectInfo);
}
/*-----------------------------------------------------------------------------
* Description : SectInfo's object action initialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
ACP_tdxBool fn_bIsInFix(struct tdstEngineObject_ *p_stObject)
{
#if defined(GAM_USE_SNA)
unsigned char ucI;
for(ucI=0;ucI<SNA_g_stFixInfo.ulNbObject;ucI++)
{
if(SNA_g_stFixInfo.a20_stObjects[ucI]==p_stObject)
return TRUE;
}
#endif /* GAM_USE_SNA */
return FALSE;
}
void fn_vSectInfoInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
MTH3D_tdstVector *p_stV;
HIE_tdxHandleToSuperObject h_SO;
MS_tdxHandleToMSLight hLight;
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_SectInfo==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
#if defined(GAM_USE_SNA)
if( (!fn_bIsInFix( p_stObject) && SNA_fn_ucGetLoadType()==SNA_SAVE_SNAPSHOT)
||(fn_bIsInFix( p_stObject) && SNA_fn_ucGetLoadType()==4)
||(SNA_fn_ucGetLoadType()==SNA_LOAD_SNAPSHOT)
||(SNA_fn_ucGetLoadType()==SNA_LOAD_SCRIPT)
)
#endif /* GAM_USE_SNA */
{
switch(eObjectInit)
{
case OTI_MapLoaded:
p_stObject->h_SectInfo->hCurrentSector = NULL;
fn_vSectInfoSavedValueSAI(p_stObject->h_SectInfo);
case OTI_LoadSavedGame:
case OTI_ReinitTheMap:
case OTI_PlayerDead:
if (M_GetSuperObject(p_stObject)!=NULL)
{
p_stV = POS_fn_p_stGetTranslationVector(fn_p_st3dDataGetMatrix(p_stObject->h_3dData));
fn_vSectInfoInitForSingleCharacter(M_GetSuperObject(p_stObject),p_stV);
MTH3D_M_vCopyVector(&p_stObject->h_SectInfo->stPreviousPosition,p_stV);
}
break;
/* ANNECY MT - 18/09/98 {*/
case OTI_AlwaysCreated:
if (M_GetSuperObject(p_stObject)!=NULL)
{
h_SO = M_GetSuperObject(p_stObject);
p_stV = POS_fn_p_stGetTranslationVector (HIE_fn_hGetSuperObjectGlobalMatrix(h_SO));
fn_vInsertObjectInSectorList(p_stObject->h_SectInfo->hCurrentSector,h_SO);
SECT_fn_vSetCharacterPointerInCharacterList(p_stObject->h_SectInfo->hNodeInSector, h_SO);
MTH3D_M_vCopyVector(&p_stObject->h_SectInfo->stPreviousPosition,p_stV);
if( (hLight = M_GetMSHandle(h_SO,MSLight)) != 0 ) /*VOLUNTARY ASSIGNMENT*/
{
SECT_fn_vSetHandleOfLightsInDNMLightsList(
fn_hMSLightGetLightNodeInSector(hLight),
fn_p_stMSLightGetLight(hLight)
);
}
}
break;
/* END ANNECY MT }*/
default:
break;
}
}
}
/*-----------------------------------------------------------------------------
* Description : SectInfo's object action desinitialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vSectInfoDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_SectInfo==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_MapLoaded:
case OTI_ReinitTheMap:
case OTI_LoadSavedGame:
case OTI_AlwaysCreated:
case OTI_PlayerDead:
if (M_GetSuperObject(p_stObject))
{
fn_vRemoveObjectInSectorList(M_GetSuperObject(p_stObject));
}
break;
default:
break;
}
}
/*************************************************************************/
void fn_vSectInfoSavedValueSAI(MS_tdxHandleToSectInfo hSectInfo)
{
/*SAI_fn_bInsertPointerInTable((void*)&hSectInfo->hCurrentSector,SAI_ePlayerSaveCurrentValue);*/
}
/*************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSectInfoFreeInitValueSAI(MS_tdxHandleToSectInfo hSectInfo)
{
/*SAI_fn_bRemoveValueFromTable((void*)&hSectInfo->hCurrentSector,SAI_ePlayerSaveCurrentValue);*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*************************************************************************/
/*-----------------------------------------------------------------------------
* Description : SectInfo's object copy clone action
*-----------------------------------------------------------------------------
* Input : Handle to destination, handle to source
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Olivier Jourdan
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vSectInfoCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc)
{
/* Useless*/
/* memcpy(_p_stObjectDest->h_SectInfo,_p_stObjectSrc->h_SectInfo,fn_ulSectInfoSizeOf());*/
}
/*-----------------------------------------------------------------------------
* Description : Init Sector informations for a single character
*-----------------------------------------------------------------------------
* Input : Object and Sector
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Olivier
*-----------------------------------------------------------------------------
* Modification date : 02/07/97 Modification Author : Olivier
* Modifications : Optimization
*---------------------------------------------------------------------------*/
void fn_vSectInfoInitForSingleCharacter(HIE_tdxHandleToSuperObject hCharacter,struct MTH3D_tdstVector_ * hPosition)
{
HIE_tdxHandleToSuperObject testSO;
MS_tdxHandleToSectInfo hSectInfo;
MS_tdxHandleToMSLight hLight;
/* if (((SNA_fn_ucGetLoadType()!=4) ||fn_bIsInFix(HIE_fn_hGetSuperObjectObject(hCharacter)))) // MR0110*/
/* {*/
#if defined(GAM_USE_SNA)
if( (!fn_bIsInFix( HIE_fn_hGetSuperObjectObject(hCharacter)) && SNA_fn_ucGetLoadType()==SNA_SAVE_SNAPSHOT)
||(fn_bIsInFix( HIE_fn_hGetSuperObjectObject(hCharacter)) && SNA_fn_ucGetLoadType()==4)
||(SNA_fn_ucGetLoadType()==SNA_LOAD_SNAPSHOT)
||(SNA_fn_ucGetLoadType()==SNA_LOAD_SCRIPT)
)
{
#endif /* GAM_USE_SNA */
hSectInfo = M_GetMSHandle(hCharacter,SectInfo);
testSO = (HIE_tdxHandleToSuperObject)SECT_fn_hResearchInWhatSectorIAm(SECT_hFatherSector,hPosition);
/* if we are in a sector, take it, else use the universe sector*/
hSectInfo->hCurrentSector = testSO ? testSO : HIE_fn_hGetChildNumber(SECT_hFatherSector,HIE_fn_lGetNumberOfChildren(SECT_hFatherSector)-1);
SECT_fn_vSetCharacterPointerInCharacterList(hSectInfo->hNodeInSector, hCharacter);
if( (hLight = M_GetMSHandle(hCharacter,MSLight)) != 0 ) /*VOLUNTARY ASSIGNMENT*/
{
SECT_fn_vSetHandleOfLightsInDNMLightsList(
fn_hMSLightGetLightNodeInSector(hLight),
fn_p_stMSLightGetLight(hLight)
);
}
/* put the object in the sector list*/
fn_vInsertObjectInSectorList(hSectInfo->hCurrentSector,hCharacter);
#if defined(GAM_USE_SNA)
}
#endif /* GAM_USE_SNA */
}
/*void fn_vInsertAnimLightsInSectorList2(HIE_tdxHandleToSuperObject hSector,tdstAnimLights *p_stAnimLights)
{
long lState, i;
for (i = 0; i < p_stAnimLights->uwNumberOfLights; i ++ )
{
GLI_xGetLightState(p_stAnimLights->a_p_stLights[i],&lState);
if (lState)
{
SECT_fn_vIsolateDNMLightsListNode(p_stAnimLights->a_hLightsInSector[i]);
SECT_fn_vAddTailDNMLightsListNode(hSector,p_stAnimLights->a_hLightsInSector[i]);
}
else
SECT_fn_vIsolateDNMLightsListNode(p_stAnimLights->a_hLightsInSector[i]); // MR0109
}
}
*/
/*-----------------------------------------------------------------------------
* Description : Insert an object in Sector list
*-----------------------------------------------------------------------------
* Input : Object and Sector
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Olivier
*-----------------------------------------------------------------------------
* Modification date : 02/07/97 Modification Author : Olivier
* Modifications : Optimization
*---------------------------------------------------------------------------*/
void fn_vInsertObjectInSectorList(HIE_tdxHandleToSuperObject hSector,
HIE_tdxHandleToSuperObject hCharacter)
{
tdstSectInfo * p_stSectInfo;
p_stSectInfo = M_GetMSHandle(hCharacter,SectInfo);
SECT_fn_vIsolateCharListNode(p_stSectInfo->hNodeInSector);
if( fn_ucStandardGameGetPlatFormType(M_GetMSHandle(hCharacter,StandardGame))!=0 )
SECT_fn_vAddHeadCharListNode(hSector,p_stSectInfo->hNodeInSector);
else
SECT_fn_vAddTailCharListNode(hSector,p_stSectInfo->hNodeInSector);
if( M_GetMSHandle(hCharacter,MSLight) )
fn_vInsertLightInSectorList(hSector,hCharacter);
}
/*-----------------------------------------------------------------------------
* Description : Insert a light in Sector list
*-----------------------------------------------------------------------------
* Input : Object and Sector
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 28/02/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : 02/07/97 Modification Author : Olivier
* Modifications : Optimization
*---------------------------------------------------------------------------*/
void fn_vInsertLightInSectorList(HIE_tdxHandleToSuperObject hSector,
HIE_tdxHandleToSuperObject hCharacter)
{
MS_tdxHandleToMSLight hMSLight;
hMSLight = M_GetMSHandle(hCharacter,MSLight);
if (fn_bMSLightGetLocalLight(hMSLight)) {
HIE_fn_vSetSuperObjectExcluLight(hCharacter,fn_bMSLightGetOnlyLocalLight(hMSLight));
return;
}
SECT_fn_vIsolateDNMLightsListNode(fn_hMSLightGetLightNodeInSector(hMSLight));
SECT_fn_vAddTailDNMLightsListNode(hSector,fn_hMSLightGetLightNodeInSector(hMSLight));
}
/*void fn_vIsolateAnimLights(tdstAnimLights *p_stAnimLights)
{
long i;
for ( i = 0; i <p_stAnimLights->uwNumberOfLights; i ++ )
{
SECT_fn_vIsolateDNMLightsListNode(p_stAnimLights->a_hLightsInSector[i]);
}
}
*/
/*-----------------------------------------------------------------------------
* Description : Remove an object from sector list
*-----------------------------------------------------------------------------
* Input : Object and Sector
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Olivier
*-----------------------------------------------------------------------------
* Modification date : 14/03/96 Modification Author : Micha<68>l
* Modifications : Remove light from sector
*---------------------------------------------------------------------------*
* Modification date : 02/07/97 Modification Author : Olivier
* Modifications : Optimization
*---------------------------------------------------------------------------*/
void fn_vRemoveObjectInSectorList(HIE_tdxHandleToSuperObject hCharacter)
{
/*tdstAnimLights *p_stAnimLights;*/
SECT_fn_vIsolateCharListNode(M_GetMSHandle(hCharacter,SectInfo)->hNodeInSector);
if( M_GetMSHandle(hCharacter,MSLight) )
{
SECT_fn_vIsolateDNMLightsListNode(fn_hMSLightGetLightNodeInSector(M_GetMSHandle(hCharacter,MSLight)));
}
/* p_stAnimLights=PLA_fn_pstGetLightsOfAnim(hCharacter);*/
/* if (p_stAnimLights&&(p_stAnimLights->uwNumberOfLights>0))
fn_vIsolateAnimLights(p_stAnimLights);
*/}
/*-----------------------------------------------------------------------------
* Description : SectInfo access functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleToSectInfo + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 03/02/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
HIE_tdxHandleToSuperObject fn_h_SectInfoGetCurrentSector(MS_tdxHandleToSectInfo h_SectInfo)
{
return(h_SectInfo->hCurrentSector);
}
void fn_vSectInfoSetCurrentSector(MS_tdxHandleToSectInfo h_SectInfo,HIE_tdxHandleToSuperObject hCurrentSector)
{
h_SectInfo->hCurrentSector = hCurrentSector;
}
HIE_tdxHandleToSuperObject GAM_fn_hGetCurrentSector(HIE_tdxHandleToSuperObject _hCharacter)
{
if( HIE_fn_ulGetSuperObjectType(_hCharacter) != HIE_C_ulActor )
return NULL;
if( !M_GetMSHandle(_hCharacter,SectInfo) )
return NULL;
return fn_h_SectInfoGetCurrentSector(M_GetMSHandle(_hCharacter,SectInfo));
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GAM_fn_vSetCurrentSector(HIE_tdxHandleToSuperObject _hCharacter,HIE_tdxHandleToSuperObject _hCurrentSector)
{
if( HIE_fn_ulGetSuperObjectType(_hCharacter) != HIE_C_ulActor )
return;
if( !M_GetMSHandle(_hCharacter,SectInfo) )
return;
fn_vSectInfoSetCurrentSector(M_GetMSHandle(_hCharacter,SectInfo),_hCurrentSector);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Sect Info Sound Events Lauching After Crossing
*-----------------------------------------------------------------------------
* Input : Character crossing sector
* Output : Nothing
*-----------------------------------------------------------------------------
* Creation date : 03/02/97 Author : Olivier
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSectInfoLaunchSectorSoundEvents(HIE_tdxHandleToSuperObject _hCharacter)
{
HIE_tdxHandleToSuperObject * p_a10History;
HIE_tdxHandleToSuperObject * p_hIndex;
ACP_tdxIndex xNbChanges,xIndex;
if( _hCharacter == g_hCharacterLauchingSoundEvents)
{
if( (xNbChanges = SCT_fn_xGetSectorChangeHistory(&p_a10History)) > 1 )
{
for( xIndex=0,p_hIndex=p_a10History; xIndex<(xNbChanges-1); xIndex++,p_hIndex++ )
{
fn_vSectInfoLaunchEventsFromS1ToS2(*p_hIndex,*(p_hIndex+1));
}
}
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Launch sound events when crossing from sector 1
* towards sector 2
*-----------------------------------------------------------------------------
* Input : Sector from and Sector towards
* Output : Nothing
*-----------------------------------------------------------------------------
* Creation date : 03/02/97 Author : Olivier
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vSectInfoLaunchEventsFromS1ToS2(HIE_tdxHandleToSuperObject _hSector1,HIE_tdxHandleToSuperObject _hSector2)
{
unsigned long ulI;
SCT_tdxHandleOfLstSoundEvent hSoundEventList;
SND_tduRefEvt stEvent;
SCT_M_ForEachSoundEventNodeInSoundEventList(_hSector2,hSoundEventList,ulI)
{
if( SCT_fn_hGetSectorInSoundEventList(hSoundEventList) == _hSector1 ||
SCT_fn_hGetSectorInSoundEventList(hSoundEventList) == NULL)
{
/* Lauching the sound event */
/* Temporary, type of event will be FANTOME */
stEvent.pstPtr = SCT_fn_uGetSoundEventInSoundEventList(hSoundEventList);
SND_fn_lSendRequestSound(/*C_SOUNDOBJECT_SECTOR*/SND_C_OBJET_FANTOME,g_lSoundObjectTypeMusic,stEvent,0,NULL);
}
}
}
/*-----------------------------------------------------------------------------
* Description : Events are launched By Ed (default) or by the active
* Camera
*-----------------------------------------------------------------------------
* Input : Nothing
* Output : Nothing
*-----------------------------------------------------------------------------
* Creation date : 03/02/97 Author : Olivier
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vSectInfoSetCharacterLauchingEvents(HIE_tdxHandleToSuperObject _hCharacter)
{
g_hCharacterLauchingSoundEvents = _hCharacter;
}
/*-----------------------------------------------------------------------------
* Description : Debugging functions for sectors
*-----------------------------------------------------------------------------
* Input : character
* Output : name of the current (previous) sector
*-----------------------------------------------------------------------------
* Creation date : 20/06/97 Author : Olivier
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
char * fn_p_szSectInfoGetCurrentSectorName(HIE_tdxHandleToSuperObject _hCharacter)
{
#ifdef _DEBUG
return( fn_szGetSectorName(M_GetMSHandle(_hCharacter,SectInfo)->hCurrentSector) );
#else
char *pChar = NULL;
return pChar;
#endif /* DEBUG */
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* JMS 14-01-1998 */
#define C_xCorrectionVector MTH_M_xFloatToReal(0.2f)
/*-----------------------------------------------------------------------------
* Description : New version to test if a character cross a border
* between two sectors.
* This function do all modifications in SectInfo
* mini-structure, and update informations.
*-----------------------------------------------------------------------------
* Input : handle on a character
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 28/09/97 Author : Olivier
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void GAM_fn_vSectInfoTestChangeSectorForCharacter(HIE_tdxHandleToSuperObject _hCharacter)
{
tdstSectInfo * p_stSectInfo;
MTH3D_tdstVector stCurrentPosition;
HIE_tdxHandleToSuperObject hSector,hPreviousSector;
/* Try*/
MTH3D_tdstVector stCurrentRaisedPosition,stPreviousRaisedPosition;
MTH3D_tdstVector stAdding;
/* JMS 14-01-1998 */
/* Ceci est un ANTI-BUG : Il faudra par la suite que le point test de passage de secteur */
/* soit plac<61> par les <20>diteurs de tel sorte que ce dernier soit "prot<6F>g<EFBFBD>" par les ZDMs */
/* afin qu'il ne puisse en aucun cas se retrouv<75> en dehors de la map. */
MTH3D_tdstVector a2_stColons[2];
POS_fn_vGetRotationMatrix(HIE_fn_hGetSuperObjectGlobalMatrix(_hCharacter),a2_stColons,a2_stColons+1,&stAdding);
MTH3D_M_vMulScalarVector(&stAdding,C_xCorrectionVector,&stAdding);
/* End JMS 14-01-1998 */
p_stSectInfo = M_GetMSHandle(_hCharacter,SectInfo);
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(_hCharacter),&stCurrentPosition);
hSector = p_stSectInfo->hCurrentSector;
hPreviousSector = p_stSectInfo->hCurrentSector;
MTH3D_M_vCopyVector(&stCurrentRaisedPosition,&stCurrentPosition);
MTH3D_M_vCopyVector(&stPreviousRaisedPosition,&p_stSectInfo->stPreviousPosition);
MTH3D_M_vAddVector(&stCurrentRaisedPosition,&stCurrentRaisedPosition,&stAdding);
MTH3D_M_vAddVector(&stPreviousRaisedPosition,&stPreviousRaisedPosition,&stAdding);
SCT_fn_vTestChangeSectorWithHistory(
&stPreviousRaisedPosition,
&stCurrentRaisedPosition,
&hSector);
if( hSector!=p_stSectInfo->hCurrentSector )
{
ACP_tdxBool bOnInactivedSector;
/*DFM PLA_fn_vDesInitAllChildOfCharacter(_hCharacter);*/
if( _hCharacter == g_hCharacterLauchingSoundEvents) /* NOUVEAU*/
fn_vSectInfoLaunchEventsFromS1ToS2(p_stSectInfo->hCurrentSector,hSector);
p_stSectInfo->hCurrentSector = hSector;
/**/
if( !fn_ucIsAnAlwaysObject((tdstEngineObject *)HIE_fn_hGetSuperObjectObject(_hCharacter)) &&
!fn_bGetIfCharacterIsInAlwaysActiveCharacterList(_hCharacter) )
{
bOnInactivedSector = (ACP_tdxBool) (p_stSectInfo->hCurrentSector != g_hSOCurrentMainSector);
if( bOnInactivedSector )
{
SECT_tdxHandleOfElementLstActivityInteraction hActivityList;
HIE_tdxHandleToSuperObject hChildSector;
long i;
SECT_M_ForEachActivityNodeInActivityInteractionList(g_hSOCurrentMainSector,hActivityList,i)
{
hChildSector = SECT_GetSectorInActivityList(hActivityList);
if( hChildSector == p_stSectInfo->hCurrentSector )
{
bOnInactivedSector = FALSE;
break;
}
}
if( bOnInactivedSector )
{
HIE_fn_vIsolate(_hCharacter);
if( fn_ucStandardGameGetPlatFormType(M_GetMSHandle(_hCharacter,StandardGame))!=0 )
{
HIE_fn_vSuperObjectAddHead(gp_stInactiveDynamicWorld,_hCharacter);
}
else
{
HIE_fn_vSuperObjectAddTail(gp_stInactiveDynamicWorld,_hCharacter);
}
M_UnactivateObject((struct tdstEngineObject_*)HIE_fn_hGetSuperObjectObject(_hCharacter));
}
}
}
/**/
/*fn_vSectInfoLaunchSectorSoundEvents(_hCharacter);*/
fn_vInsertObjectInSectorList(
p_stSectInfo->hCurrentSector,_hCharacter);
if( _hCharacter==MC_fn_hGetCharacterInMainCharacterNode( MC_fn_hGetFirstMainCharNode()) )
fn_vInitObjectsWhenPlayerChangeSector(_hCharacter,p_stSectInfo->hCurrentSector,hPreviousSector);
}
MTH3D_M_vCopyVector(&p_stSectInfo->stPreviousPosition,&stCurrentPosition);
}
/*-----------------------------------------------------------------------------
* Description : Debug function to test incoherences in sectors list
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 25/09/97 Author : Olivier
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifdef _DEBUG
/*#ifdef DEBUG_LINK_TABLES*/
char * fn_p_szGetSectorName(HIE_tdxHandleToSuperObject _hSector)
{
#if defined(GAM_USE_SCRIPT)
void * p_vSectorObject;
SCR_tdst_Link_Table * p_stSectorLinkTable;
SCR_tdst_Link_Value * p_stLinkValue;
p_stSectorLinkTable = SECT_fn_pGetLinkTable();
p_vSectorObject = HIE_fn_hGetSuperObjectObject(_hSector);
p_stLinkValue = SCR_fnp_st_Link_SearchValue(p_stSectorLinkTable,(unsigned long)p_vSectorObject);
return((char*) (SCR_M_p_sz_Link_GetKey(p_stLinkValue)+SCR_M_ul_Link_GetAdditionalLong(p_stLinkValue,1)));
#else /* GAM_USE_SCRIPT */
/*char *pChar;*/
/*return pChar;*/
return NULL;
#endif /* GAM_USE_SCRIPT */
}
/*#endif /* DEBUG_LINK_TABLES */
void fn_vTestIntegrityForOneSector(HIE_tdxHandleToSuperObject _hSector)
{
SECT_tdxHandleOfElementLstGraphicInteraction hGraphicNode,hGraphicNode2;
SECT_tdxHandleOfElementLstCollisionInteraction hCollisionNode,hCollisionNode2;
SECT_tdxHandleOfElementLstActivityInteraction hActivityNode,hActivityNode2;
SECT_tdxHandleOfElementLstSoundInteraction hSoundNode,hSoundNode2;
unsigned long ulI,ulJ;
long lCount;
char szTotalInformation[255];
/* Testing integrity for GRAPHIC list*/
SECT_M_ForEachGraphicNodeInGraphicInteractionList(_hSector,hGraphicNode,ulI)
{
if( _hSector==SECT_GetSectorInGraphicList(hGraphicNode) )
{
M_GameInformationErrorWithString(E_uwGameCurrentSectorInOwnGraphicList,fn_p_szGetSectorName(_hSector));
}
lCount = 0;
SECT_M_ForEachGraphicNodeInGraphicInteractionList(_hSector,hGraphicNode2,ulJ)
{
if( SECT_GetSectorInGraphicList(hGraphicNode)==SECT_GetSectorInGraphicList(hGraphicNode2) )
lCount++;
}
if( lCount!=1 )
{
strcpy(szTotalInformation,fn_p_szGetSectorName(_hSector));
strcat(szTotalInformation," : ");
strcat(szTotalInformation,fn_p_szGetSectorName(SECT_GetSectorInGraphicList(hGraphicNode)));
M_GameInformationErrorWithString(E_uwGameSectorTwiceInGraphicList,szTotalInformation);
}
}
/* Testing integrity for ACTIVITY list*/
SECT_M_ForEachActivityNodeInActivityInteractionList(_hSector,hActivityNode,ulI)
{
if( _hSector==SECT_GetSectorInActivityList(hActivityNode) )
{
M_GameInformationErrorWithString(E_uwGameCurrentSectorInOwnActivityList,fn_p_szGetSectorName(_hSector));
}
lCount = 0;
SECT_M_ForEachActivityNodeInActivityInteractionList(_hSector,hActivityNode2,ulJ)
{
if( SECT_GetSectorInActivityList(hActivityNode)==SECT_GetSectorInActivityList(hActivityNode2) )
lCount++;
}
if( lCount!=1 )
{
strcpy(szTotalInformation,fn_p_szGetSectorName(_hSector));
strcat(szTotalInformation," : ");
strcat(szTotalInformation,fn_p_szGetSectorName(SECT_GetSectorInActivityList(hActivityNode)));
M_GameInformationErrorWithString(E_uwGameSectorTwiceInActivityList,szTotalInformation);
}
}
/* Testing integrity for COLLISION list*/
SECT_M_ForEachCollisionNodeInCollisionInteractionList(_hSector,hCollisionNode,ulI)
{
if( _hSector==SECT_GetSectorInCollisionList(hCollisionNode) )
{
M_GameInformationErrorWithString(E_uwGameCurrentSectorInOwnCollisionList,fn_p_szGetSectorName(_hSector));
}
lCount = 0;
SECT_M_ForEachCollisionNodeInCollisionInteractionList(_hSector,hCollisionNode2,ulJ)
{
if( SECT_GetSectorInCollisionList(hCollisionNode)==SECT_GetSectorInCollisionList(hCollisionNode2) )
lCount++;
}
if( lCount!=1 )
{
strcpy(szTotalInformation,fn_p_szGetSectorName(_hSector));
strcat(szTotalInformation," : ");
strcat(szTotalInformation,fn_p_szGetSectorName(SECT_GetSectorInCollisionList(hCollisionNode)));
M_GameInformationErrorWithString(E_uwGameSectorTwiceInCollisionList,szTotalInformation);
}
}
/* Testing integrity for SOUND list*/
SECT_M_ForEachSoundNodeInSoundInteractionList(_hSector,hSoundNode,ulI)
{
if( _hSector==SECT_GetSectorInSoundList(hSoundNode) )
{
M_GameInformationErrorWithString(E_uwGameCurrentSectorInOwnSoundList,fn_p_szGetSectorName(_hSector));
}
lCount = 0;
SECT_M_ForEachSoundNodeInSoundInteractionList(_hSector,hSoundNode2,ulJ)
{
if( SECT_GetSectorInSoundList(hSoundNode)==SECT_GetSectorInSoundList(hSoundNode2) )
lCount++;
}
if( lCount!=1 )
{
M_GameInformationErrorWithString(E_uwGameSectorTwiceInSoundList,fn_p_szGetSectorName(SECT_GetSectorInSoundList(hSoundNode)));
strcpy(szTotalInformation,fn_p_szGetSectorName(_hSector));
strcat(szTotalInformation," : ");
strcat(szTotalInformation,fn_p_szGetSectorName(SECT_GetSectorInSoundList(hSoundNode)));
M_GameInformationErrorWithString(E_uwGameSectorTwiceInSoundList,szTotalInformation);
}
}
}
#endif /* _DEBUG */
void fn_vTestAllSectorsListForIncoherences()
{
#ifdef _DEBUG
ACP_tdxIndex xI;
HIE_tdxHandleToSuperObject hSector;
HIE_M_ForEachChildOf(SECT_hFatherSector,hSector,xI)
{
fn_vTestIntegrityForOneSector(hSector);
}
#endif /* _DEBUG */
}

View File

@@ -0,0 +1,730 @@
/*=========================================================================
* StdGame.cpp : StdGame's functions
*
*
*
* StdGame MUST BE REPLACE BY THE C FILENAME
*
*
* Version 1.0
* Creation date 01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_StdGame_StructureDefine
#define D_StdGame_VariableDefine
#include "ToolsCPA.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/EngMode.h"
#include "structur/StdObjSt.h"
#include "safe.h" /*BART*/
#include "Basic.h"
#include "Family.h"
#include "ObjInit.h"
#include "ObjType.h"
#include "ZeMem.h"
#include "MainChar.h"
#include "ToolCam.h"
#include "Structur/ObjsTbls.h"
#include "Always.h"
/*******************************************************/
#define C_TRANSPARENCY_ZONE_MIN 70
#define C_TRANSPARENCY_ZONE_MAX 80
#define C_TOOFARLIMIT_INIT 70
/*******************************************************/
void fn_vStdGamePlayerSavedValueSAI(MS_tdxHandleToStandardGame h_StdGame);
void fn_vStdGamePlayerFreeInitValueSAI(MS_tdxHandleToStandardGame h_StdGame);
extern ACP_tdxBool fn_bIsInFix(struct tdstEngineObject_ *p_stObject);
/*-----------------------------------------------------------------------------
* Description : StdGame object action script callback
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_eStdGameScriptCallBack(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;
MS_tdxHandleToStandardGame h_StdGame;
struct tdstEngineObject_ *p_stEngineObject;
_p_stFile=_p_stFile;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,struct tdstEngineObject_ *, p_stEngineObject);
if (M_IsTitle)
{
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeStdGame , p_stEngineObject);
h_StdGame = fn_h_StdGameRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_StandardGame=h_StdGame;
/* JO 04/11/97*/
fn_ucStandardGameSetPlatFormType(h_StdGame,(unsigned char)0);
/*fn_ucStandardGameSetSpecialPositionFlag(h_StdGame,(unsigned char)0);*/
fn_vStandardGameSetCustomBits(h_StdGame,(unsigned long)GAM_C_CustBitUsesTransparencyZone);
fn_vStandardGameSetTransparencyZoneMin(h_StdGame,C_TRANSPARENCY_ZONE_MIN);
fn_vStandardGameSetTransparencyZoneMax(h_StdGame,C_TRANSPARENCY_ZONE_MAX);
/* ANNECY MT - 22/10/98 {*/
fn_vStandardGameSetTooFarLimit(h_StdGame,C_TOOFARLIMIT_INIT);
/* END ANNECY MT }*/
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_StdGame);
}
else if (M_IsEntry)
{
tdxHandleToObjectsTablesList h_ObjectsTablesListElement;
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,MS_tdxHandleToStandardGame,h_StdGame);
if (M_ActionIs(C_EntryStdGameType))
{
tdxHandleToState h_InitialState=NULL;
SCR_tdst_Link_Value *p_xIndex;
// Shaitan => module list in the level
SCR_tdst_Cxt_Values *p_stVal;
char * p_szInitialObjectTable;
// End Shaitan => module list in the level
M_CheckScriptParamNumber(3);
fn_vStandardGameSetPersonalType(h_StdGame,fn_otFindOrAddPersonalTypeOfPersonalTypeName(_ap_szParams[0]));
fn_vStandardGameSetFamilyType(h_StdGame,fn_otFindOrAddFamilyTypeOfFamilyTypeName(_ap_szParams[2]));
fn_vStandardGameSetModelType(h_StdGame,fn_otFindOrAddModelTypeOfModelTypeName(_ap_szParams[1]));
fn_v3dDataSetFamily(p_stEngineObject->h_3dData,fn_hFindOrAddFAmily(fn_otStandardGameGetFamilyType(h_StdGame)));
// Shaitan => module list in the level
/*
SCR_M_RdL0_GetContextLong(C_ParentContext,0,tdxHandleToObjectsTablesList,h_ObjectsTablesListElement);
*/
SCR_M_RdL0_GetContextLong(C_ParentContext,0, char*, p_szInitialObjectTable);
if (p_szInitialObjectTable)
{
SCR_M_RdL0_SetContextLong(C_GrandChildContext, 1, (long)fn_h3dDataGetFamily(p_stEngineObject->h_3dData));
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(p_szInitialObjectTable, SCR_CDF_uw_Anl_Normal);
h_ObjectsTablesListElement = (tdxHandleToObjectsTablesList) SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
// free(p_szInitialObjectTable);
}
else
h_ObjectsTablesListElement = NULL;
// End Shaitan => module list in the level
if(h_ObjectsTablesListElement!=NULL)
{
fn_v3dDataSetCurrentObjectsTable(p_stEngineObject->h_3dData,h_ObjectsTablesListElement);
fn_v3dDataSetInitialObjectsTable(p_stEngineObject->h_3dData,h_ObjectsTablesListElement);
fn_vAddAnObjectsTablesInList(fn_h3dDataGetFamily(p_stEngineObject->h_3dData),h_ObjectsTablesListElement);
}
else
{
fn_v3dDataSetCurrentObjectsTable(p_stEngineObject->h_3dData,fn_vGetDefaultObjectsTableOfFamily(fn_h3dDataGetFamily(p_stEngineObject->h_3dData)));
fn_v3dDataSetInitialObjectsTable(p_stEngineObject->h_3dData,fn_vGetDefaultObjectsTableOfFamily(fn_h3dDataGetFamily(p_stEngineObject->h_3dData)));
}
fn_vCheckObjectsTables(p_stEngineObject); /*Gizmo do nothing in release*/
h_InitialState = fn_h3dDataGetInitialState(p_stEngineObject->h_3dData);
if(h_InitialState)
{
p_xIndex = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,(char *)h_InitialState);
if (p_xIndex!=NULL&&p_xIndex->eState==SCR_ELS_Link_Initialized)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubType3dData , p_stEngineObject);
TMP_M_Free(h_InitialState);
fn_v3dDataSetInitialState(p_stEngineObject->h_3dData,(tdxHandleToState)(p_xIndex->ulValue));
}
else
{
fn_v3dDataSetInitialState(p_stEngineObject->h_3dData,NULL);
M_GameWarningError(E_uwGamePLA_BadInitialState);
}
}
}
else if (M_ActionIs(C_EntryStdGameHitPointInit))
{
fn_vStandardGameSetHitPoints(h_StdGame,(unsigned char)fn_lAToI(_ap_szParams[0]));
}
else if (M_ActionIs(C_EntryStdGameHitPointMaxInit))
{
fn_vStandardGameSetHitPointsMax(h_StdGame,(unsigned char)fn_lAToI(_ap_szParams[0]));
}
else if (M_ActionIs(C_EntryStdGameHitPointMaxMax))
{
fn_vStandardGameSetHitPointsMaxMax(h_StdGame,(unsigned char)fn_lAToI(_ap_szParams[0]));
}
else if (M_ActionIs(C_EntryStdInitFlag))
{
M_CheckScriptParamNumber(2);
if (!stricmp(_ap_szParams[0],C_ValueStdInitFlagNeverBack))
fn_vStandardGameSetInitFlagWhenOutOfZone(h_StdGame,OI_NeverBackWhenTaken);
else if (!stricmp(_ap_szParams[0],C_ValueStdInitFlagGoOutOfZone))
fn_vStandardGameSetInitFlagWhenOutOfZone(h_StdGame,OI_WhenPlayerGoOutOfActionZone);
if (!stricmp(_ap_szParams[1],C_ValueStdInitFlagNeverBack))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_NeverBackWhenTaken);
else if (!stricmp(_ap_szParams[1],C_ValueStdInitFlagAlways))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_Always);
else if (!stricmp(_ap_szParams[1],C_ValueStdInitFlagGoOutOfZone))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_WhenPlayerGoOutOfActionZone);
else if (!stricmp(_ap_szParams[1],C_ValueStdInitFlagPlayerDead))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_WhenPlayerIsDead);
else if (!stricmp(_ap_szParams[1],C_ValueStdInitFlagMapLoaded))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_WhenMapJustLoaded);
else if (!stricmp(_ap_szParams[1],C_ValueStdInitFlagSavedGameLoaded))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_WhenSavedGameJustLoaded);
}
else if( M_ActionIs(C_EntryStdGamePlatFormType) )
{
M_CheckScriptParamNumber(1);
fn_ucStandardGameSetPlatFormType(h_StdGame,(unsigned char)fn_lAToI(_ap_szParams[0]));
}
else if( M_ActionIs(C_EntryStdGameCustomBitsInit) )
{
unsigned long ulCustBits;
M_CheckScriptParamNumber(1);
ulCustBits = (unsigned long)fn_lAToI(_ap_szParams[0]);
#ifndef ACTIVE_EDITOR
// GuS : If CB 32 is on a char from level, remove it.
if( (ulCustBits & GAM_C_CustBitRayman) && ! GAM_fn_bIsEngineInFixMode() )
ulCustBits &= ~GAM_C_CustBitRayman;
#endif
fn_vStandardGameSetCustomBits(h_StdGame,ulCustBits);
}
else if( M_ActionIs(C_EntryStdGameCapabilities) )
{
unsigned long ulReturn;
char* dummy;
/*ANNECY Bart#01 14/02/98*/
ulReturn = strtoul(_ap_szParams[0], &dummy, 2);
fn_vStandardGameSetCapabilities(h_StdGame, ulReturn);
}
else if( M_ActionIs(C_EntryStdGameTractionFactor) )
{
fn_vStandardGameSetTractionFactor(h_StdGame, (unsigned char)fn_lAToI(_ap_szParams[0]));
}
else if( M_ActionIs(C_EntryStdGameTransparencyZone) )
{
M_CheckScriptParamNumber(2);
fn_vStandardGameSetTransparencyZoneMin(h_StdGame,(unsigned char)fn_lAToI(_ap_szParams[0]));
fn_vStandardGameSetTransparencyZoneMax(h_StdGame,(unsigned char)fn_lAToI(_ap_szParams[1]));
}
/* ANNECY MT - 22/10/98 {*/
else if( M_ActionIs(C_EntryStdGameTooFarLimit))
{
M_CheckScriptParamNumber(1);
fn_vStandardGameSetTooFarLimit(h_StdGame,(unsigned char)fn_lAToI(_ap_szParams[0]));
}
/* END ANNECY MT }*/
}
return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
/*-----------------------------------------------------------------------------
* Description : StdGame's mini-structure sizeof
*-----------------------------------------------------------------------------
* Input : None
* Output : Size of
*-----------------------------------------------------------------------------
* Creation date : 14/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
unsigned long fn_ulStdGameSizeOf()
{
return(sizeof(struct tdstStandardGame_));
}
/*-----------------------------------------------------------------------------
* Description : StdGame object action allocation
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vStdGameAlloc(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_StandardGame!=NULL)
M_GameFatalError(E_uwGameMiniStructAllocAlreadyAlloc);
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeStdGame , p_stObject);
p_stObject->h_StandardGame = fn_h_StdGameRealAlloc();
MMG_fn_vEndMemoryInfo ();
fn_vStdGameInitValueSAI(p_stObject->h_StandardGame);
}
MS_tdxHandleToStandardGame fn_h_StdGameRealAlloc()
{
MS_tdxHandleToStandardGame h_StdGame;
h_StdGame = (MS_tdxHandleToStandardGame)M_p_GameMallocInHLM(fn_ulStdGameSizeOf());
fn_vStandardGameSetCustomBits(h_StdGame,(unsigned long)GAM_C_CustBitUsesTransparencyZone);
fn_vStandardGameSetTransparencyZoneMin(h_StdGame,C_TRANSPARENCY_ZONE_MIN);
fn_vStandardGameSetTransparencyZoneMax(h_StdGame,C_TRANSPARENCY_ZONE_MAX);
fn_vStandardGameSetIsDesactivateAtAll(h_StdGame,0);
fn_vStandardGameSetIsActivable(h_StdGame,1);
fn_vStandardGameSetHitPoints(h_StdGame,0);
fn_vStandardGameSetHitPointsMax(h_StdGame,0);
fn_vStandardGameSetTooFarLimit(h_StdGame,C_TOOFARLIMIT_INIT);
/* ANNECY MT - 19/11/98 {*/
#if defined(ACTIVE_EDITOR)
fn_vStdGameSetInAllSubMaps(h_StdGame,FALSE);
#endif
/* END ANNECY MT }*/
return(h_StdGame);
}
/*-----------------------------------------------------------------------------
* Description : StdGame object action free
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vStdGameFree(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_StandardGame==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
fn_vStdGameFreeInitValueSAI(p_stObject->h_StandardGame);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubTypeStdGame , p_stObject );
if( p_stObject == HIE_fn_hGetSuperObjectObject( MC_fn_hGetCharacterInMainCharacterNode( MC_fn_hGetFirstMainCharNode() ) ) )
fn_vStdGamePlayerFreeInitValueSAI(p_stObject->h_StandardGame);
M_GameFreeInHLM(p_stObject->h_StandardGame);
}
/*-----------------------------------------------------------------------------
* Description : StdGame object action initialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vStdGameInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
struct MTH3D_tdstVector_ hPosition;
POS_tdstCompletePosition *hMatrix;
ACP_tdxBool bIsAnAlways;
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_StandardGame==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
fn_vStandardGameSetLastTrame(p_stObject->h_StandardGame,0);
bIsAnAlways = (ACP_tdxBool)fn_ucIsAnAlwaysObject(p_stObject);
if (eObjectInit == OTI_ReinitTheMap || eObjectInit == OTI_PlayerDead || (eObjectInit == OTI_MapLoaded && fn_bIsInFix(p_stObject)))
p_stObject -> h_StandardGame -> ulCustomBits = p_stObject -> h_StandardGame -> ulSaveCustomBits;
switch(eObjectInit)
{
/* ANNECY MT - 28/08/98 {*/
case OTI_ReinitTheMap:
if(!fn_ucIsAnAlwaysModel(p_stObject))
{
fn_vStandardGameSetIsDesactivateAtAll(p_stObject->h_StandardGame,0);
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,1);
hMatrix = fn_p_st3dDataGetAbsoluteMatrix(p_stObject->h_3dData);
POS_fn_vGetTranslationVector(hMatrix,&hPosition);
fn_vSectInfoInitForSingleCharacter(M_GetSuperObject(p_stObject),&hPosition);
}
break;
case OTI_AlwaysCreated:
if(!fn_ucIsAnAlwaysModel(p_stObject))
{
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,1);
hMatrix = fn_p_st3dDataGetAbsoluteMatrix(p_stObject->h_3dData);
POS_fn_vGetTranslationVector(hMatrix,&hPosition);
fn_vSectInfoInitForSingleCharacter(M_GetSuperObject(p_stObject),&hPosition);
}
break;
case OTI_PlayerDead:
if( !fn_ucIsAnAlwaysModel(p_stObject) &&
( !fn_bf1StandardGameGetIsDesactivateAtAll(p_stObject->h_StandardGame) || fn_bf1StandardGameGetIsActivable(p_stObject->h_StandardGame) )
)
{
fn_vStandardGameSetIsDesactivateAtAll(p_stObject->h_StandardGame,0);
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,1);
hMatrix = fn_p_st3dDataGetAbsoluteMatrix(p_stObject->h_3dData);
POS_fn_vGetTranslationVector(hMatrix,&hPosition);
fn_vSectInfoInitForSingleCharacter(M_GetSuperObject(p_stObject),&hPosition);
}
break;
case OTI_LoadSavedGame:
if(!fn_ucIsAnAlwaysModel(p_stObject))
{
if (fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_NeverBackWhenTaken)
{
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,(unsigned char)(!fn_bf1StandardGameGetIsDesactivateAtAll(p_stObject->h_StandardGame)));
}
hMatrix = fn_p_st3dDataGetAbsoluteMatrix(p_stObject->h_3dData);
POS_fn_vGetTranslationVector(hMatrix,&hPosition);
fn_vSectInfoInitForSingleCharacter(M_GetSuperObject(p_stObject),&hPosition);
}
break;
/* END ANNECY MT }*/
case OTI_MapLoaded:
fn_vStdGameSavedValueSAI(p_stObject->h_StandardGame);
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,1);
/* We save current hit points and max hit points for rayman only */
/* GuS if( p_stObject == HIE_fn_hGetSuperObjectObject( MC_fn_hGetCharacterInMainCharacterNode( MC_fn_hGetFirstMainCharNode() ) ) )*/
if (fn_ulStandardGameGetCustomBits(p_stObject -> h_StandardGame) & GAM_C_CustBitRayman)
fn_vStdGamePlayerSavedValueSAI(p_stObject->h_StandardGame);
case OTI_WhenGameStart:
if (!fn_bIsAllSecondPassDone(p_stObject->h_StandardGame))
fn_vStdGameInitValueSAI(p_stObject->h_StandardGame);
break;
}
{
MS_tdxHandleToStandardGame h_StdGame = p_stObject -> h_StandardGame;
/* ANNECY YLT - 25/11/98 {*/
if (fn_ulStandardGameGetCustomBits(h_StdGame) & GAM_C_CustBitRayman)
{
/* for main actor only: we dont itialise the number of hitpoints except at the beginning of the game*/
if (/*eObjectInit == OTI_ReinitTheMap || eObjectInit == OTI_PlayerDead ||*/ eObjectInit == OTI_WhenGameStart)
{
h_StdGame -> ucHitPoints = h_StdGame -> ucSaveHitPoints;
/*h_StdGame -> ucHitPointsMax = h_StdGame -> ucSaveHitPointsMax;*/
}
}
else
/* END ANNECY YLT }*/
{
if (eObjectInit == OTI_ReinitTheMap || eObjectInit == OTI_PlayerDead || eObjectInit == OTI_WhenGameStart)
h_StdGame -> ucHitPoints = h_StdGame -> ucSaveHitPoints;
/*
if (eObjectInit == OTI_ReinitTheMap || eObjectInit == OTI_MapLoaded || eObjectInit == OTI_WhenGameStart)
h_StdGame -> ucHitPointsMax = h_StdGame -> ucSaveHitPointsMax;
*/
}
if (eObjectInit == OTI_ReinitTheMap || eObjectInit == OTI_MapLoaded)
{
h_StdGame -> ucMiscFlags = (unsigned char ) ( (h_StdGame->ucMiscFlags & ~GAM_C_SavedMiscFlags) | h_StdGame->ucSaveMiscFlags );
}
/*if (eObjectInit == OTI_PlayerDead && bIsAnAlways)*/
/*h_StdGame -> ulCustomBits |= GAM_C_CustBitAlways;*/
}
}
/*-----------------------------------------------------------------------------
* Description : StdGame object action desinitialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vStdGameDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_StandardGame==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_AlwaysCreated:
case OTI_ReinitTheMap:
case OTI_MapLoaded:
case OTI_PlayerDead:
case OTI_LoadSavedGame:
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,0);
break;
default:
break;
}
}
/*************************************************************************/
void fn_vStdGameInitValueSAI(MS_tdxHandleToStandardGame h_StdGame)
{
/* ANNECY AV {*/
/*
SAI_fn_bInsertCharInTable((void*)&h_StdGame->ucHitPoints, SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenNewGameStart);
SAI_fn_bInsertCharInTable((void*)&h_StdGame->ucHitPointsMax, SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded|SAI_eInitWhenNewGameStart);
SAI_fn_bInsertCharInTable((void*)&h_StdGame->ucMiscFlags, SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded);
SAI_fn_bInsertLongInTable((void*)&h_StdGame->ulCustomBits, SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded|SAI_eInitWhenNewGameStart);
*/
h_StdGame -> ucSaveHitPoints = h_StdGame -> ucHitPoints;
h_StdGame -> ucSaveHitPointsMax = h_StdGame -> ucHitPointsMax;
/* ANNECY MT - 09/10/98 {*/
h_StdGame -> ucSaveMiscFlags = (unsigned char)(h_StdGame -> ucMiscFlags & GAM_C_SavedMiscFlags);
/* END ANNECY MT }*/
h_StdGame -> ulSaveCustomBits = h_StdGame -> ulCustomBits;
/* END ANNECY AV }*/
}
/*************************************************************************/
void fn_vStdGameSavedValueSAI(MS_tdxHandleToStandardGame h_StdGame)
{
#ifndef U64
if( fn_eStandardGameGetInitFlagWhenDeadOrTaken(h_StdGame) == OI_NeverBackWhenTaken )
SAI_fn_bInsertBoolInTable((void*)&h_StdGame->ucMiscFlags,GAM_C_DesactivateAtAll,SAI_eLevelSaveCurrentValue);
#endif
}
/*************************************************************************/
void fn_vStdGamePlayerSavedValueSAI(MS_tdxHandleToStandardGame h_StdGame)
{
SAI_fn_bInsertCharInTable((void*)&h_StdGame->ucHitPoints,SAI_ePlayerSaveCurrentValue);
SAI_fn_bInsertCharInTable((void*)&h_StdGame->ucHitPointsMax,SAI_ePlayerSaveCurrentValue);
SAI_fn_bInsertCharInTable((void*)&h_StdGame->ucHitPointsMaxMax,SAI_ePlayerSaveCurrentValue);
}
/*************************************************************************/
void fn_vStdGameFreeInitValueSAI(MS_tdxHandleToStandardGame h_StdGame)
{
/* ANNECY AV {*/
/*
SAI_fn_bRemoveValueFromTable((void*)&h_StdGame->ucHitPoints, SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenNewGameStart);
SAI_fn_bRemoveValueFromTable((void*)&h_StdGame->ucHitPointsMax, SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded|SAI_eInitWhenNewGameStart);
SAI_fn_bRemoveValueFromTable((void*)&h_StdGame->ucMiscFlags, SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded);
SAI_fn_bRemoveValueFromTable((void*)&h_StdGame->ulCustomBits, SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded|SAI_eInitWhenNewGameStart);
*/
/* END ANNECY AV }*/
#ifndef U64
if( fn_eStandardGameGetInitFlagWhenDeadOrTaken(h_StdGame) == OI_NeverBackWhenTaken )
SAI_fn_bRemoveValueFromTable((void*)&h_StdGame->ucMiscFlags,SAI_eLevelSaveCurrentValue);
#endif
}
/*************************************************************************/
void fn_vStdGamePlayerFreeInitValueSAI(MS_tdxHandleToStandardGame h_StdGame)
{
SAI_fn_bRemoveValueFromTable((void*)&h_StdGame->ucHitPoints,SAI_ePlayerSaveCurrentValue);
SAI_fn_bRemoveValueFromTable((void*)&h_StdGame->ucHitPointsMax,SAI_ePlayerSaveCurrentValue);
SAI_fn_bRemoveValueFromTable((void*)&h_StdGame->ucHitPointsMaxMax,SAI_ePlayerSaveCurrentValue);
}
/**************************************************************************/
void fn_vSetHitPointsToInitValue(struct tdstEngineObject_ *_p_stObject)
{
/* ANNECY AV {*/
/* SAI_fn_bInitOneValueWhen((void*)&_p_stObject->h_StandardGame->ucHitPoints,SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenNewGameStart);*/
_p_stObject -> h_StandardGame -> ucHitPoints = _p_stObject -> h_StandardGame -> ucSaveHitPoints;
/* END ANNECY AV }*/
}
/**************************************************************************/
void fn_vSetHitPointsMaxToInitValue(struct tdstEngineObject_ *_p_stObject)
{
/* ANNECY AV {*/
/* SAI_fn_bInitOneValueWhen((void*)&_p_stObject->h_StandardGame->ucHitPointsMax,SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded|SAI_eInitWhenNewGameStart);*/
_p_stObject -> h_StandardGame -> ucHitPointsMax = _p_stObject -> h_StandardGame -> ucSaveHitPointsMax;
/* END ANNECY AV }*/
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetCustomBitsToInitValue(struct tdstEngineObject_ *_p_stObject)
{
/* ANNECY AV {*/
/* SAI_fn_bInitOneValueWhen((void*)&_p_stObject->h_StandardGame->ulCustomBits,SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded|SAI_eInitWhenNewGameStart);*/
_p_stObject -> h_StandardGame -> ulCustomBits = _p_stObject -> h_StandardGame -> ulSaveCustomBits;
/* END ANNECY AV }*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*ENDANNECY BBB 20/11/97 }*/
/*************************************************************************/
/*-----------------------------------------------------------------------------
* Description : StdGame's object copy clone action
*-----------------------------------------------------------------------------
* Input : Handle to destination, handle to source
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Olivier Jourdan
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vStdGameCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc)
{
/* If StdGame doesn't contains pointers to structure that may be*/
/* changed during the game, this function must only be a :*/
memcpy(_p_stObjectDest->h_StandardGame,_p_stObjectSrc->h_StandardGame,fn_ulStdGameSizeOf());
}
/*-----------------------------------------------------------------------------
* Description : StandardGame access functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleToStandardGame + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 30/01/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
HIE_tdxHandleToSuperObject fn_h_StandardGameGetSuperObject(MS_tdxHandleToStandardGame h_StdGame)
{
SAF_M_AssertWithMsg((h_StdGame != NULL),"StdGame est NULL")
return h_StdGame ? h_StdGame->h_SuperObject : NULL;
}
void fn_vStandardGameSetSuperObject(MS_tdxHandleToStandardGame h_StdGame,HIE_tdxHandleToSuperObject h_SuperObject)
{
h_StdGame->h_SuperObject=h_SuperObject;
/**** We put the absolute matrix in 3dData structure ****/
/*RB to avoid NULL pointer access*/
if( h_SuperObject )
{
fn_v3dDataSetAbsoluteMatrix(
M_GetMSHandle(h_SuperObject,3dData),
HIE_fn_hGetSuperObjectGlobalMatrix(h_SuperObject) );
}
}
unsigned long fn_ulStandardGameGetCustomBitsSO (HIE_tdxHandleToSuperObject hSupObj)
{
return fn_ulStandardGameGetCustomBits (M_GetMSHandle(hSupObj,StandardGame));
}
void fn_vStandardGameSetCustomBitsSO(HIE_tdxHandleToSuperObject hSupObj,unsigned long ulCustomBits)
{
fn_vStandardGameSetCustomBits(M_GetMSHandle(hSupObj,StandardGame),ulCustomBits);
}
ACP_tdxBool fn_bStandardGameIsAPlatform (HIE_tdxHandleToSuperObject hSupObj)
{
return (ACP_tdxBool) (fn_ucStandardGameGetPlatFormType(M_GetMSHandle(hSupObj,StandardGame))==C_ucPlatFormType_StandardPlatForm);
}
unsigned char fn_ucStandardGameGetTransparencyZoneMinSO(HIE_tdxHandleToSuperObject hSupObj)
{
register MS_tdxHandleToStandardGame hStdGame = M_GetMSHandle(hSupObj,StandardGame);
return (unsigned char)(hStdGame ? fn_ucStandardGameGetTransparencyZoneMin(hStdGame) : C_TRANSPARENCY_ZONE_MIN);
}
unsigned char fn_ucStandardGameGetTransparencyZoneMaxSO(HIE_tdxHandleToSuperObject hSupObj)
{
register MS_tdxHandleToStandardGame hStdGame = M_GetMSHandle(hSupObj,StandardGame);
return (unsigned char)(hStdGame ? fn_ucStandardGameGetTransparencyZoneMax(hStdGame) : C_TRANSPARENCY_ZONE_MAX);
}
/* ANNECY MT - 22/10/98 {*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
unsigned char fn_ucStandardGameGetTooFarLimitSO(HIE_tdxHandleToSuperObject hSupObj)
{
register MS_tdxHandleToStandardGame hStdGame = M_GetMSHandle(hSupObj,StandardGame);
return (unsigned char)(hStdGame ? fn_ucStandardGameGetTooFarLimit(hStdGame) : C_TOOFARLIMIT_INIT);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
/* END ANNECY MT }*/
/*************************************/
/**** Access functions for Editor ****/
/*************************************/
#if defined(ACTIVE_EDITOR)
/*************************************************************************/
unsigned char *fn_p_ucStdGameGetHitPointsInit(MS_tdxHandleToStandardGame h_StdGame)
{
/* ANNECY AV {*/
/* return (unsigned char *)SAI_fn_p_vGetTableValuePointerOf((void*)&h_StdGame->ucHitPoints,SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenNewGameStart);*/
return & h_StdGame -> ucSaveHitPoints;
/* END ANNECY AV }*/
}
/*************************************************************************/
unsigned char *fn_p_ucStdGameGetHitPointsMaxInit(MS_tdxHandleToStandardGame h_StdGame)
{
/* ANNECY AV {*/
/* return (unsigned char *)SAI_fn_p_vGetTableValuePointerOf((void*)&h_StdGame->ucHitPointsMax,SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded|SAI_eInitWhenNewGameStart);*/
return & h_StdGame -> ucSaveHitPointsMax;
/* END ANNECY AV }*/
}
/*************************************************************************/
unsigned long *fn_p_ulStdGameGetCustomBitsInit(MS_tdxHandleToStandardGame _hStdGame)
{
/* ANNECY AV {*/
/* return (unsigned long *)SAI_fn_p_vGetTableValuePointerOf((void*)&_hStdGame->ulCustomBits,SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded|SAI_eInitWhenNewGameStart);*/
return & _hStdGame -> ulSaveCustomBits;
/* END ANNECY AV }*/
}
/*************************************************************************/
void fn_vStdGameSetLoadedInFix(MS_tdxHandleToStandardGame h_StdGame,unsigned char bValue)
{
h_StdGame->bIsLoadedInFix = bValue;
}
/*************************************************************************/
unsigned char fn_bStdGameIsLoadedInFix(MS_tdxHandleToStandardGame h_StdGame)
{
return(h_StdGame->bIsLoadedInFix);
}
/*************************************************************************/
/* ANNECY MT - 19/11/98 {*/
void fn_vStdGameSetInAllSubMaps(MS_tdxHandleToStandardGame h_StdGame,unsigned char bValue)
{
h_StdGame->bIsInAllSubMaps = bValue;
}
/*************************************************************************/
unsigned char fn_bStdGameIsInAllSubMaps(MS_tdxHandleToStandardGame h_StdGame)
{
return(h_StdGame->bIsInAllSubMaps);
}
/* END ANNECY MT }*/
/*************************************************************************/
#endif /* ACTIVE_EDITOR */
unsigned char fn_ucStdGameCheckValidity(HIE_tdxHandleToSuperObject _h_SprObj) {
if ( M_GetMSHandle(_h_SprObj, StandardGame ))
return (TRUE) ;
return (FALSE) ;
}

View File

@@ -0,0 +1,311 @@
/*=========================================================================
* ####.cpp : ####'s functions
*
*
*
* #### MUST BE REPLACE BY THE C FILENAME
*
*
* Version 1.0
* Creation date 01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
//*****************************************************
//*** For the structures and variables declarations ***
//*****************************************************
#define D_####_StructureDefine
#define D_####_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
/*-----------------------------------------------------------------------------
* Description : ####'s object action script callback
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : xxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue fn_e####ScriptCallback(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;
MS_tdxHandleTo#### h_####;
struct tdstEngineObject_ *p_stEngineObject;
_p_stFile=_p_stFile;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,struct tdstEngineObject_ *, p_stEngineObject);
if (M_IsTitle)
{
h_#### = fn_h_####RealAlloc();
p_stEngineObject->h_#### = h_####;
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_####);
}
else if (M_IsEntry)
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,MS_tdxHandleTo####,h_####);
}
return(eReturnValue);
}
/*-----------------------------------------------------------------------------
* Description : ####'s save structure
*-----------------------------------------------------------------------------
* Input : SCR_tdst_File_Description *, struct tdstEngineObject_ *
* Output : Void
*-----------------------------------------------------------------------------
* Creation date : 28/02/97 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*
void fn_v####SaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
char szSection[SCR_CV_ui_Cfg_MaxLenName];
MS_tdxHandleTo#### h_#### = p_stObject->h_####;
SCR_M_SvL0_SaveBlankLine(p_stFile);
SCR_M_SvL0_SaveComment(p_stFile, "**** #### mini-structure definition ****");
sprintf(szSection,"%s:",C_Section####Description);
SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);
//** Put here the saving script functions **
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL)
}
*/
/*-----------------------------------------------------------------------------
* Description : ####'s mini-structure sizeof
*-----------------------------------------------------------------------------
* Input : None
* Output : Size of
*-----------------------------------------------------------------------------
* Creation date : 14/10/96 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
unsigned long fn_ul####SizeOf()
{
return(sizeof(struct tdst####_));
}
/*-----------------------------------------------------------------------------
* Description : ####'s object action allocation
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_v####Alloc(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_####!=NULL)
M_GameFatalError(E_uwGameMiniStructAllocAlreadyAlloc);
p_stObject->h_#### = fn_h_####RealAlloc();
fn_v####InitValueSAI(MS_tdxHandleTo#### h_####);
}
MS_tdxHandleTo#### fn_h_####RealAlloc()
{
MS_tdxHandleTo#### h_####;
h_#### = (MS_tdxHandleTo####)M_p_GameMallocInHLM(fn_ul####SizeOf());
return(h_####);
}
/*-----------------------------------------------------------------------------
* Description : ####'s object action free
*-----------------------------------------------------------------------------
* Input : Object pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_v####Free(struct tdstEngineObject_ *p_stObject)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_####==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
fn_v####FreeInitValueSAI(MS_tdxHandleTo#### h_####);
M_GameFreeInHLM(E_ucGameEngineObjectMemory,p_stObject->h_####);
}
/*-----------------------------------------------------------------------------
* Description : ####'s object action initialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_v####Init(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_####==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_WhenGameStart:
break;
case OTI_ReinitTheMap:
break;
case OTI_LoadSavedGame:
break;
case OTI_MapLoaded:
fn_v####InitValueSAI(MS_tdxHandleTo#### h_####);
fn_v####SavedValueSAI(MS_tdxHandleTo#### h_####);
break;
case OTI_PlayerDead:
break;
}
}
/*-----------------------------------------------------------------------------
* Description : ####'s object action desinitialisation
*-----------------------------------------------------------------------------
* Input : When this function's called (see ObjInit.h)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 01/10/96 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_v####Desinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit)
{
if (p_stObject==NULL)
M_GameFatalError(E_uwGameMiniStructObjectNull);
if (p_stObject->h_####==NULL)
M_GameFatalError(E_uwGameMiniStructNull);
switch(eObjectInit)
{
case OTI_WhenGameStart:
break;
case OTI_ReinitTheMap:
break;
case OTI_MapLoaded:
break;
case OTI_PlayerDead:
break;
}
}
/*-----------------------------------------------------------------------------
* Description : ####'s object copy clone action
*-----------------------------------------------------------------------------
* Input : Handle to destination, handle to source
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Olivier Jourdan
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_v####CopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc)
{
// If #### doesn't contains pointers to structure that may be
// changed during the game, this function must only be a :
// memcpy(_p_stObjectDest->h_####,_p_stObjectSrc->h_####,fn_ul####SizeOf());
}
/*-----------------------------------------------------------------------------
* Description : #### access functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleTo#### + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 29/01/97 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
xtype fn_x####Getxxxxxx(MS_tdxHandleTo####)
{
return(h_####->xxxxxx);
}
void fn_v####Setxxxxxx(MS_tdxHandleTo####,xtype xValue)
{
h_####->xxxxxx = xValue;
}
/*-----------------------------------------------------------------------------
* Description : #### SAI functions
*-----------------------------------------------------------------------------
* Input : MS_tdxHandleTo#### + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 29/01/97 Author : xxxxxxxxx
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_v####InitValueSAI(MS_tdxHandleTo#### h_####)
{
//*** Put here the functions :
//*** SAI_fn_bInsertMTHVectorInTable((void*)&_h_####->xxx,SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded);
}
void fn_v####SavedValueSAI(MS_tdxHandleTo#### h_####)
{
//*** Put here the functions :
//*** SAI_fn_bInsertMTHVectorInTable((void*)&p_####->xxx,SAI_eSaveCurrentValue);
}
void fn_v####FreeInitValueSAI(MS_tdxHandleTo#### h_####)
{
//*** Put here the functions :
//***
}

View File

@@ -0,0 +1,82 @@
#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"
#include "ldt.h"
/*****************************************************************
Name:
Description: Create callback for LDT
Author: Mircea Petrescu
Date: 8/21/98
Modified:
*****************************************************************/
int fn_iCreateOneCharacter( LDT_tdst_Link *pLink )
{
struct tdstEngineObject_ *p_stEngineObject;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeEngineObject , 0 );
p_stEngineObject=(tdstEngineObject *)M_p_GameMallocInHLM(sizeof(struct tdstEngineObject_));
pLink->pObject=(void *)p_stEngineObject;
return 0;
}
/*****************************************************************
Name:
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 8/21/98
Modified: Scripa Ovidiu 09/01/98
*****************************************************************/
int fn_iLoadOneCharacter( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
struct tdstEngineObject_ *p_stEngineObject=(struct tdstEngineObject_ *)pLink->pObject;
char szTextWindows[_MAX_PATH];
char szForScript[_MAX_PATH];
int iLen;
sprintf(szTextWindows,"Chargement de %s", pLink->szName);
fn_vChangeWindowTitle(szTextWindows);
iLen=LDT_ComputeSectionName(pLink, szForScript);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stCharacter,szForScript,(unsigned long)p_stEngineObject),1,iLen);
/* OS - load 'Character' subsections : 3dData, StandardGame, Brain, Dynam, CollSet, SectInfo, CineInfo, MSWay, MSLight*/
do{
result=LDT_GetNextEntry();
if( result== ParseResult_BeginSection )
LDT_LoadSection( NULL );
}while ( result!=ParseResult_EndSection );
return 0;
}

View File

@@ -0,0 +1,115 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_AnimEffect_StructureDefine
#define D_AnimEffect_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "ldt.h"
#define lTagShiftPhase 'hPtf'
#define lTagShiftMax 'aMtf'
#define lTagShiftPlus 'lPtf'
/*****************************************************************
Function name : fn_iCreateAnimEffect
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateAnimEffect( LDT_tdst_Link *pLink )
{
MS_tdxHandleToAnimEffect h_AnimEffect;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeAnimEffect , p_stEngineObject);
h_AnimEffect = fn_h_AnimEffectRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_AnimEffect = h_AnimEffect;
pLink->pObject = (void*)h_AnimEffect;
return 0;
}
/*****************************************************************
Function name : fn_iLoadAnimEffect
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadAnimEffect( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToAnimEffect h_AnimEffect = (MS_tdxHandleToAnimEffect)pLink->pObject;
MTH3D_tdstVector stVector;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagShiftPhase : /* */
{
MTH3D_M_vSetVectorElements( &stVector,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
fn_vAnimEffectSetShiftPhase(h_AnimEffect, stVector);
}
break;
case lTagShiftMax : /* */
{
MTH3D_M_vSetVectorElements( &stVector,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
fn_vAnimEffectSetShiftMax(h_AnimEffect, stVector);
}
break;
case lTagShiftPlus : /* */
{
MTH3D_M_vSetVectorElements( &stVector,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
fn_vAnimEffectSetShiftPlus(h_AnimEffect, stVector);
}
break;
}
}
}
}
return 0;
}

View File

@@ -0,0 +1,122 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_Brain_StructureDefine
#define D_Brain_VariableDefine
#include "InitEnum.h"
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/EngMode.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "ObjType.h"
#include "ToolCam.h"
#include "LoadBin.h"
/* For BIN*/
#ifdef GAM_USE_SNA
#include "sna.h"
#endif /* GAM_USE_SNA */
#include "ldt.h"
HREF g_hRefBrain;
enum{
iEndCreateVariables,
iEndIntellModel,
iEndReflexModel,
iEndAIModel,
iEndInitVariables,
iEndComportIntell,
iEndComportReflex
};
/*****************************************************************
Name:
Description: Create callback for LDT
Author: Mircea Petrescu
Date: 8/24/98
Modified:
*****************************************************************/
int fn_iCreateBrain( LDT_tdst_Link *pLink )
{
MS_tdxHandleToBrain h_Brain;
struct tdstEngineObject_ *p_stEngineObject=(struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeBrain , p_stEngineObject);
h_Brain = fn_h_BrainRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_Brain=h_Brain;
pLink->pObject=(void *)h_Brain;
return 0;
}
int fn_iLoadBrain( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToBrain h_Brain = (MS_tdxHandleToBrain)pLink->pObject;
AI_tdstMind *p_stMind;
struct tdstEngineObject_ *p_stEngineObject=(struct tdstEngineObject_ *)pLink->pParent->pObject;
char szIntellFileName[_MAX_PATH];
char *szModelName;
char *szFamilyName;
p_stMind = M_pstGetMindOfBrain(h_Brain);
szModelName = fn_szFindModelTypeNameOfModelType(M_ObjectGetModelType(p_stEngineObject));
szFamilyName = fn_szFindFamilyTypeNameOfFamilyType(M_ObjectGetFamilyType(p_stEngineObject));
AI_M_SetPersoName(p_stMind, fn_szFindPersonalTypeNameOfPersonalType(M_ObjectGetPersonalType(p_stEngineObject)));
LDT_SetLinkValue( pLink, (unsigned long)p_stMind );
do{
result=LDT_GetNextEntry();
if( result== ParseResult_BeginSection )
LDT_LoadSection( NULL );
}while ( result!=ParseResult_EndSection );
sprintf(szIntellFileName,"%s\\%s\\%s.ai",szFamilyName,szModelName,szModelName);
/* read an .ai file */
fn_vReadAI(p_stMind, szIntellFileName,p_stEngineObject );
/* alloc intelligence and link it with its script*/
LDT_AddToRefsTable( g_hRefBrain, pLink, iEndAIModel, 0 );
return 0;
}
/* LoadBrain =>Default*/
/* fn_vReadAI => ai\aibase\specif\readrule.c fn_vReadAIModel */
/* OS Note : fn_vReadAIModel > this function need to be changed for reading of .ai files with LDT instead of SCR*/
void AI_PostProcessLDT( HREF );
void fn_vBrainPostProcessLDT( HREF hRef )
{
AI_PostProcessLDT(hRef);
}

View File

@@ -0,0 +1,208 @@
#define D_CineInfo_StructureDefine
#define D_CineInfo_VariableDefine
#include "ToolsCPA.h"
#include "Options/Def_Snd.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/EngMode.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/3DOSLkTb.h"
#include "ToolCam.h"
#include "TypeCam.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "ObjType.h"
#include "Basic.h"
#ifdef SOUND_FOR_3DOS
#include "Micros.h"
#endif
#include "GameEng.h"
#include "MainChar.h"
#include "ldt.h"
#define lTagShift 'fihS'
#define lTagDistance 'tsiD'
#define lTagAlpha 'hplA'
#define lTagTheta 'tehT'
#define lTagLinearSpeed 'eniL'
#define lTagAngularSpeed 'ugnA'
#define lTagTargetSpeed 'graT'
#define lTagDNMFlags 'FMND'
#define lTagIAFlags 'lFAI'
#define lTagFocal 'acoF'
#define lTagZMinMax 'niMZ'
#define lTagViewport 'weiV'
#define lTagChannel 'nahC'
#define lTagActivation 'itcA'
/*****************************************************************
Function name : fn_iCreateCineInfo
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateCineInfo( LDT_tdst_Link *pLink )
{
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
CAM_fn_vCineinfoAlloc(p_stEngineObject);
pLink->pObject = (MS_tdxHandleToCineinfo)p_stEngineObject->h_Cineinfo;
return 0;
}
/*****************************************************************
Function name : fn_iLoadCineInfo
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadCineInfo( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToInternalCineinfo hCineinfoInit;
MS_tdxHandleToCineinfo hCineinfo;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;;
hCineinfo = p_stEngineObject->h_Cineinfo;
hCineinfoInit = p_stEngineObject->h_Cineinfo->hInit;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagShift : /* */
{
if (strlen(szEntry) > 9) /*ShiftTarget*/
{
MTH3D_M_vSetVectorElements(&hCineinfoInit->stShiftTarget,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)));
}
else /*ShiftPos*/
{
MTH3D_M_vSetVectorElements(&hCineinfoInit->stShiftPos,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)));
}
}
break;
case lTagDistance : /* */
{
hCineinfoInit->xDistMin = (float)atof(LDT_szGetParam(1));
hCineinfoInit->xDistMax = (float)atof(LDT_szGetParam(2));
hCineinfoInit->xBoundDistMin = (float)atof(LDT_szGetParam(3));
hCineinfoInit->xBoundDistMax = (float)atof(LDT_szGetParam(4));
}
break;
case lTagAlpha : /* */
{
hCineinfoInit->xAngleAlpha = (float)atof(LDT_szGetParam(1));
hCineinfoInit->xAngleShiftAlpha = (float)atof(LDT_szGetParam(2));
}
break;
case lTagTheta : /* */
{
hCineinfoInit->xAngleTheta = (float)atof(LDT_szGetParam(1));
hCineinfoInit->xAngleShiftTheta = (float)atof(LDT_szGetParam(2));
}
break;
case lTagLinearSpeed : /* */
{
hCineinfoInit->xLinearSpeed = (float)atof(LDT_szGetParam(1));
hCineinfoInit->xLinearIncreaseSpeed = (float)atof(LDT_szGetParam(2));
hCineinfoInit->xLinearDecreaseSpeed = (float)atof(LDT_szGetParam(3));
}
break;
case lTagAngularSpeed : /* */
{
hCineinfoInit->xAngularSpeed = (float)atof(LDT_szGetParam(1));
hCineinfoInit->xAngularIncreaseSpeed = (float)atof(LDT_szGetParam(2));
hCineinfoInit->xAngularDecreaseSpeed = (float)atof(LDT_szGetParam(3));
}
break;
case lTagTargetSpeed : /* */
{
hCineinfoInit->xTargetSpeed = (float)atof(LDT_szGetParam(1));
hCineinfoInit->xTargetIncreaseSpeed = (float)atof(LDT_szGetParam(2));
hCineinfoInit->xTargetDecreaseSpeed = (float)atof(LDT_szGetParam(3));
}
break;
case lTagDNMFlags : /* */
{
hCineinfoInit->uwDNMFlags = (unsigned short) atoi(LDT_szGetParam(1));
}
break;
case lTagIAFlags : /* */
{
hCineinfoInit->uwIAFlags = (unsigned short) atoi(LDT_szGetParam(1));
}
break;
case lTagFocal : /* */
{
hCineinfoInit->xFocal = (float)atof(LDT_szGetParam(1));
}
break;
case lTagZMinMax : /* */
{
hCineinfoInit->xZMin = (float)atof(LDT_szGetParam(1));
hCineinfoInit->xZMax = (float)atof(LDT_szGetParam(2));
}
break;
case lTagViewport : /* */
{
hCineinfoInit->eTypeOfViewport = (enum e_ucListViewport_) atoi(LDT_szGetParam(1));
}
break;
case lTagChannel : /* */
{
hCineinfoInit->cChannel = (char) atoi(LDT_szGetParam(1));
}
break;
case lTagActivation : /* */
{
hCineinfoInit->bIsActive = (ACP_tdxBool) atoi(LDT_szGetParam(1));
}
break;
}
}
}
}
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,251 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_CollSet_StructureDefine
#define D_CollSet_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "GameEng.h"
#include "Structur/Engmode.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/stdobjst.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "Family.h"
#include "ObjType.h"
#include "ZdxStuff.h"
#include "Structur/3DOSLkTb.h"
#include "basic.h"
#include "LDT.h"
#define lTagZdmTable 'aTmd'
#define lTagZddTable 'aTdd'
#define lTagZdeTable 'aTed'
#define lTagZdrTable 'aTrd'
#define lTagZddActivationTable 'cAdd'
#define lTagZdeActivationTable 'cAed'
#define lTagZdmActivationTable 'cAmd'
#define lTagZdrActivationTable 'cArd'
#define lTagCharacterPriority 'arah'
#define lTagCollisionFlag 'illo'
#define lTagCollComputeFrequency 'Cllo'
/*****************************************************************
Function name : fn_iCreateCollSet
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateCollSet( LDT_tdst_Link *pLink )
{
MS_tdxHandleToCollSet h_CollSet;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeCollSet , p_stEngineObject);
h_CollSet = fn_h_CollSetRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_CollSet = h_CollSet;
fn_vCollSetSetCharacterCollisionFlag(h_CollSet, (unsigned char)1);
pLink->pObject = h_CollSet;
return 0;
}
/*****************************************************************
Function name : fn_iLoadCollSet
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadCollSet( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToCollSet h_CollSet = (MS_tdxHandleToCollSet)pLink->pObject;
ZDX_tdxHandleToZdxList p_stZdxList = NULL;
ZDX_tdxHandleToCsaList hCsaList = NULL;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
#if 0
SCR_tdst_Cxt_Values *p_stValues ;
#endif /*0*/
#if defined(ACTIVE_EDITOR)
char a255_cLinkKey[255];
int nLen;
#endif /* ACTIVE_EDITOR */
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)(szEntry+1))
{
case lTagZdmTable : /* */
{
p_stZdxList =(ZDX_tdxHandleToZdxList)LDT_LoadSection(LDT_szGetParam(1));
#if defined (ACTIVE_EDITOR)
nLen = LDT_ComputeSectionName(pLink, a255_cLinkKey);
SCR_M_v_Link_SetAdditionalLong(
SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stZDXList, a255_cLinkKey,(unsigned long)p_stZdxList),
1, nLen);
#endif /* ACTIVE_EDITOR */
CS_M_SetZdxList(Zdm, h_CollSet, p_stZdxList);
}
break;
case lTagZddTable : /* */
{
p_stZdxList =(ZDX_tdxHandleToZdxList)LDT_LoadSection(LDT_szGetParam(1));
#if defined (ACTIVE_EDITOR)
nLen = LDT_ComputeSectionName(pLink, a255_cLinkKey);
SCR_M_v_Link_SetAdditionalLong(
SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stZDXList, a255_cLinkKey,(unsigned long)p_stZdxList),
1, nLen);
#endif /* ACTIVE_EDITOR */
CS_M_SetZdxList(Zdd, h_CollSet, p_stZdxList);
}
break;
case lTagZdeTable : /* */
{
p_stZdxList =(ZDX_tdxHandleToZdxList)LDT_LoadSection(LDT_szGetParam(1));
#if defined (ACTIVE_EDITOR)
nLen = LDT_ComputeSectionName(pLink, a255_cLinkKey);
SCR_M_v_Link_SetAdditionalLong(
SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stZDXList, a255_cLinkKey,(unsigned long)p_stZdxList),
1, nLen);
#endif /* ACTIVE_EDITOR */
CS_M_SetZdxList(Zde, h_CollSet, p_stZdxList);
}
break;
case lTagZdrTable : /* */
{
p_stZdxList =(ZDX_tdxHandleToZdxList)LDT_LoadSection(LDT_szGetParam(1));
#if defined (ACTIVE_EDITOR)
nLen = LDT_ComputeSectionName(pLink, a255_cLinkKey);
SCR_M_v_Link_SetAdditionalLong(
SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stZDXList, a255_cLinkKey,(unsigned long)p_stZdxList),
1, nLen);
#endif /* ACTIVE_EDITOR */
CS_M_SetZdxList(Zdr, h_CollSet, p_stZdxList);
}
break;
case lTagZddActivationTable : /* */
{
hCsaList =(ZDX_tdxHandleToCsaList)LDT_LoadSection(LDT_szGetParam(1));
#if defined (ACTIVE_EDITOR)
nLen = LDT_ComputeSectionName(pLink, a255_cLinkKey);
SCR_M_v_Link_SetAdditionalLong(
SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stZDXList, a255_cLinkKey,(unsigned long)hCsaList),
1, nLen);
#endif /* ACTIVE_EDITOR */
CS_M_SetActivationList(Zdd,h_CollSet,hCsaList);
}
break;
case lTagZdeActivationTable : /* */
{
hCsaList =(ZDX_tdxHandleToCsaList)LDT_LoadSection(LDT_szGetParam(1));
#if defined (ACTIVE_EDITOR)
nLen = LDT_ComputeSectionName(pLink, a255_cLinkKey);
SCR_M_v_Link_SetAdditionalLong(
SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stZDXList, a255_cLinkKey,(unsigned long)hCsaList),
1, nLen);
#endif /* ACTIVE_EDITOR */
CS_M_SetActivationList(Zde,h_CollSet,hCsaList);
}
break;
case lTagZdmActivationTable : /* */
{
hCsaList =(ZDX_tdxHandleToCsaList)LDT_LoadSection(LDT_szGetParam(1));
#if defined (ACTIVE_EDITOR)
nLen = LDT_ComputeSectionName(pLink, a255_cLinkKey);
SCR_M_v_Link_SetAdditionalLong(
SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stZDXList, a255_cLinkKey,(unsigned long)hCsaList),
1, nLen);
#endif /* ACTIVE_EDITOR */
CS_M_SetActivationList(Zdm,h_CollSet,hCsaList);
}
break;
case lTagZdrActivationTable : /* */
{
hCsaList =(ZDX_tdxHandleToCsaList)LDT_LoadSection(LDT_szGetParam(1));
#if defined (ACTIVE_EDITOR)
nLen = LDT_ComputeSectionName(pLink, a255_cLinkKey);
SCR_M_v_Link_SetAdditionalLong(
SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stZDXList, a255_cLinkKey,(unsigned long)hCsaList),
1, nLen);
#endif /* ACTIVE_EDITOR */
CS_M_SetActivationList(Zdr,h_CollSet,hCsaList);
}
break;
case lTagCharacterPriority : /* */
{
CS_fn_vSetCharacterPriority( h_CollSet,(unsigned char)atoi(LDT_szGetParam(1)) );
}
break;
case lTagCollisionFlag : /* */
{
fn_vCollSetSetCharacterCollisionFlag( h_CollSet,(unsigned char)atoi(LDT_szGetParam(1)) );
}
break;
case lTagCollComputeFrequency : /* */
{
fn_vCollSetSetCollComputeFrequency( h_CollSet,(unsigned char)atoi(LDT_szGetParam(1)) );
}
break;
}
}
}
}
return 0;
}

View File

@@ -0,0 +1,162 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_Dynam_StructureDefine
#define D_Dynam_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "ObjInit.h"
#include "ObjType.h"
#include "ZeMem.h"
#include "ia_dnm.h"
#include "ldt.h"
#define lTagSlideFactorX 'Xrot'
#define lTagSlideFactorY 'Yrot'
#define lTagSlideFactorZ 'Zrot'
/*****************************************************************
Name:
Description: Create callback for LDT
Author: Mircea Petrescu
Date: 8/24/98
Modified: Ovidiu Scripa 01/09/98; 13/10/98
*****************************************************************/
int fn_iCreateDynam( LDT_tdst_Link *pLink )
{
MS_tdxHandleToDynam h_Dynam;
struct tdstEngineObject_ *p_stEngineObject=(struct tdstEngineObject_ *)pLink->pParent->pObject;
DNM_tdstDynamics* p_stDynamics;
ACP_tdxBool bCanHangOn;
long lObjectType;
unsigned char ucTypeOfObject;
ACP_tdxBool bIsMobile;
char *szP0;
int nNoParams;
ACP_tdxBool bBase, bAdvanced, bComplex;
ACP_tdxBool bCollision;
eDynamicSize eSize;
bBase = bAdvanced = bComplex = FALSE;
bCollision = FALSE; /* default value */
eSize = eDynamicSizeBase; /* default size */
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeDynamics , p_stEngineObject);
h_Dynam = fn_h_DynamRealAlloc();
nNoParams = LDT_iGetNbParams();
if (nNoParams>=2)
{
szP0 = LDT_szGetParam(1);
if (!strcmp (szP0,C_szDynamicSizeBase))
eSize=eDynamicSizeBase;
else if (!strcmp (szP0,C_szDynamicSizeAdvanced))
eSize=eDynamicSizeAdvanced;
else if (!strcmp (szP0,C_szDynamicSizeComplex))
eSize=eDynamicSizeComplex;
if (nNoParams==3)
bCollision = (ACP_tdxBool)atoi (LDT_szGetParam(2));
}
fn_v_DynamicAlloc ( h_Dynam, eSize, bCollision );
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_Dynam=h_Dynam;
lObjectType = DNM_C_lObjectType_SolidMobile;
ucTypeOfObject = DNM_C_lObjectType_Solid;
bIsMobile = TRUE;
bCanHangOn = TRUE;
fn_vInitDynamicalFunctionPointer(h_Dynam);
p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam);
if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamics))
{
DNM_M_vDynamicsSetSlideFactorX ( p_stDynamics, MTH_C_ONE );
DNM_M_vDynamicsSetSlideFactorY ( p_stDynamics, MTH_C_ONE );
DNM_M_vDynamicsSetSlideFactorZ ( p_stDynamics, MTH_C_ONE );
}
pLink->pObject=(void *)h_Dynam;
return 0;
}
/*****************************************************************
Name:
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 8/24/98
Modified: Ovidiu Scripa 09/01/98; 13/10/98
*****************************************************************/
int fn_iLoadDynam( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToDynam h_Dynam=(MS_tdxHandleToDynam)pLink->pObject;
struct tdstEngineObject_ *p_stEngineObject=(struct tdstEngineObject_ *)pLink->pParent->pObject;
ACP_tdxBool bCanHangOn;
long lObjectType;
unsigned char ucTypeOfObject;
ACP_tdxBool bIsMobile;
DNM_tdstDynamics* p_stDynamics = fn_p_stDynamGetDynamics(p_stEngineObject->h_Dynam);
lObjectType = DNM_C_lObjectType_SolidMobile;
ucTypeOfObject = DNM_C_lObjectType_Solid;
bIsMobile = TRUE;
bCanHangOn = TRUE;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
/* this test is only usefull to read old .car */
if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamics))
{
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)(szEntry+8))
{
case lTagSlideFactorX: /* */
{
DNM_M_vDynamicsSetSlideFactorX (p_stDynamics, MTH_M_xDoubleToReal(atof(LDT_szGetParam(1))));
}
break;
case lTagSlideFactorY: /* */
{
DNM_M_vDynamicsSetSlideFactorY (p_stDynamics, MTH_M_xDoubleToReal(atof(LDT_szGetParam(1))));
}
break;
case lTagSlideFactorZ: /* */
{
DNM_M_vDynamicsSetSlideFactorZ (p_stDynamics, MTH_M_xDoubleToReal(atof(LDT_szGetParam(1))));
}
break;
}
}
}
}
}
return 0;
}

View File

@@ -0,0 +1,262 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_MSLight_StructureDefine
/*#define D_MSLight_VariableDefine*/
#include "ACP_Base.h"
#include "CPA_Expt.h"
#ifdef U64
#include "CPA_Std.h"
#include "GEO/color.h"
#endif /*U64*/
#ifndef U64
#include "ToolsCPA.h"
#include "../../GLIGLOU/MULTIDRV/INC/light_st.h"
#else
#include "../../GLI/specif/light_st.h"
#include "ToolsCPA.h"
#endif /*U64*/
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "GameEng.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "toolmatr.h"
#include "ldt.h"
#define sTagOn 'nO'
#define sTagType 'yT'
#define sTagFarNear 'aF'
#define sTagLittle 'iL'
#define sTagColor 'oC'
#define sTagGiroPhare 'iG'
#define sTagPulse 'uP'
#define sTagOffset 'fO'
#define sTagDirection 'iD'
#define sTagLocalLight 'oL'
#define sIn 'nI'
#define sInterMinPos 'iM'
#define sInterMaxPos 'aM'
#define sEx 'xE'
#define sExterMinPos 'iM'
#define sExterMaxPos 'aM'
#define sIntensityMinMax 'is'
/*****************************************************************
Function name : fn_iCreateMSLight
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateMSLight( LDT_tdst_Link *pLink )
{
char* szParam;
MS_tdxHandleToMSLight h_MSLight;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
szParam = LDT_szGetParam( 1 );
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeLight , p_stEngineObject);
h_MSLight = fn_h_LightRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_MSLight=h_MSLight;
pLink->pObject = (void*)h_MSLight;
if (!stricmp(szParam,"Parallel"))
fn_vMSLightSetTypeOfLight(h_MSLight,1);
else if (!stricmp(szParam,"Spherical"))
fn_vMSLightSetTypeOfLight(h_MSLight,2);
else if (!stricmp(szParam,"HotSpot"))
fn_vMSLightSetTypeOfLight(h_MSLight,3);
else if (!stricmp(szParam,"Ambient"))
fn_vMSLightSetTypeOfLight(h_MSLight,4);
/*CHINA WFQ (MT) 16-02-98 {*/
else if (!stricmp(szParam,"ParallelBox"))
fn_vMSLightSetTypeOfLight(h_MSLight,5);
/*ENDCHINA WFQ }*/
else
fn_vMSLightSetTypeOfLight(h_MSLight,4);
return 0;
}
/*****************************************************************
Function name : fn_iLoadMSLight
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadMSLight( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToMSLight h_MSLight = (MS_tdxHandleToMSLight)pLink->pObject;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(short*)szEntry)
{
case sTagOn : /* */
{
if (strlen(szEntry)>2) /* OnlyLocalLight*/
{
fn_vMSLightSetOnlyLocalLight(h_MSLight,(unsigned char)atoi(LDT_szGetParam(1)));
}
else /*On*/
{
fn_vMSLightSetOnOff(h_MSLight,(unsigned char)atoi(LDT_szGetParam(1)));
}
}
break;
case sTagType : /* */
{
}
break;
case sTagFarNear : /* */
{
fn_vMSLightSetNearFar(h_MSLight,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)));
}
break;
case sTagLittle : /* */
{
if (strlen(szEntry)>15) /*LittleBigTangent*/
{
}
else /*LittleBigAlpha*/
{
fn_vMSLightSetAlphas(h_MSLight,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)));
}
}
break;
case sTagColor : /* */
{
fn_vMSLightSetColorRGBA(h_MSLight,
(GEO_tdxColorValue)atof(LDT_szGetParam(1)),(GEO_tdxColorValue)atof(LDT_szGetParam(2)),(GEO_tdxColorValue)atof(LDT_szGetParam(3)),(GEO_tdxColorValue)atof(LDT_szGetParam(4)));
}
break;
case sTagGiroPhare : /* */
{
fn_vMSLightSetGiroPhare(h_MSLight,
(unsigned char)atoi(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)));
}
break;
case sTagPulse : /* */
{
fn_vMSLightSetPulse(h_MSLight,
(unsigned char)atoi(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)));
}
break;
case sTagOffset : /* */
{
fn_vMSLightSetOffset(h_MSLight,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
}
break;
case sTagDirection : /* */
{
fn_vMSLightSetDirection(h_MSLight,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
}
break;
case sTagLocalLight : /* */
{
fn_vMSLightSetLocalLight(h_MSLight,(unsigned char)atoi(LDT_szGetParam(1)));
}
case sIn : /* */
{
switch (*(short*)(szEntry+5))
{
case sInterMinPos : /* */
{
fn_xMSLightSetInterMinXYZ(h_MSLight,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
}
break;
case sInterMaxPos : /* */
{
fn_xMSLightSetInterMaxXYZ(h_MSLight,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
}
break;
case sIntensityMinMax : /* */
{
fn_xMSLightSetIntensityMinMax(h_MSLight,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)));
}
break;
}
}
case sEx : /* */
{
switch (*(short*)(szEntry+5))
{
case sExterMinPos : /* */
{
fn_xMSLightSetExterMinXYZ(h_MSLight,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
}
break;
case sExterMaxPos : /* */
{
fn_xMSLightSetExterMaxXYZ(h_MSLight,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
}
break;
}
}
}
}
}
}
return 0;
}

View File

@@ -0,0 +1,124 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_MSMagnet_StructureDefine
#define D_MSMagnet_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "GameEng.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "ldt.h"
#define sTagChamp 'hC'
#define sTagSt 'tS'
#define sTagFar 'aF'
#define sTagNear 'eN'
#define sTagDuration 'uD'
/*****************************************************************
Function name : fn_iCreateMSMagnet
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateMSMagnet( LDT_tdst_Link *pLink )
{
MS_tdxHandleToMSMagnet h_MSMagnet;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMagnet , p_stEngineObject);
h_MSMagnet = fn_h_MSMagnetRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_MSMagnet = h_MSMagnet;
pLink->pObject = (void*)h_MSMagnet;
return 0;
}
/*****************************************************************
Function name : fn_iLoadMSMagnet
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadMSMagnet( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToMSMagnet h_MSMagnet = (MS_tdxHandleToMSMagnet)pLink->pObject;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case sTagChamp : /* */
{
}
break;
case sTagSt : /* */
{
if (strlen(szEntry)>7) /*Strength*/
{
fn_vMSMagnetSetStrength(h_MSMagnet, (float)atof(LDT_szGetParam(1)) );
}
else /*Status*/
{
fn_vMSMagnetSetStatus(h_MSMagnet,(unsigned char)atoi(LDT_szGetParam(1)) );
}
}
break;
case sTagFar : /* */
{
fn_vMSMagnetSetFar(h_MSMagnet, (float)atof(LDT_szGetParam(1)) );
}
break;
case sTagNear : /* */
{
fn_vMSMagnetSetNear(h_MSMagnet, (float)atof(LDT_szGetParam(1)) );
}
break;
case sTagDuration : /* */
{
fn_vMSMagnetSetDuration(h_MSMagnet,(unsigned long)atoi(LDT_szGetParam(1)) );
}
break;
}
}
}
}
return 0;
}

View File

@@ -0,0 +1,131 @@
#ifndef D_THROW_PRT
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_MSPrtSrc_StructureDefine
#define D_MSPrtSrc_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "MainChar.h"
#include "Effect.h"
#include "ldt.h"
#define lTagGeneratorActivation 'eneG'
#define lTagParticleGenerator 'traP'
#define lTagWaterStreakGenerator 'etaW'
#define lTagFootPathEffect 'tooF'
/*OS NOTE : these callbacks were not tested because there is no 'MSPrtSrc' section in data files*/
/*****************************************************************
Function name : fn_iCreateMSPrtSrc
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateMSPrtSrc( LDT_tdst_Link *pLink )
{
MS_tdxHandleToMSPrtSrc h_MSPrtSrc;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypePrtSrc , p_stEngineObject);
h_MSPrtSrc = fn_h_MSPrtSrcRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_MSPrtSrc=h_MSPrtSrc;
h_MSPrtSrc->ucGeneratorActivation = 1;
pLink->pObject = (void*)h_MSPrtSrc;
return 0;
}
/*****************************************************************
Function name : fn_iLoadMSPrtSrc
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadMSPrtSrc( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToMSPrtSrc h_MSPrtSrc = (MS_tdxHandleToMSPrtSrc)pLink->pObject;
SCR_tdst_Cxt_Values * p_stValues;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagGeneratorActivation : /* */
{
h_MSPrtSrc->ucGeneratorActivation = (unsigned char) ((strcmp(LDT_szGetParam(1), "OFF") == 0) ? 0 : 1);
}
break;
case lTagParticleGenerator : /* */
{
/* -> OS : THIS CODE SHOULD BE CHANGED 01-Sep-98*/
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(LDT_szGetParam(1), SCR_CDF_uw_Anl_Normal);
/* <- OS : THIS CODE SHOULD BE CHANGED 01-Sep-98*/
h_MSPrtSrc->p_stParticleGenerator = (tdstParticleGenerator *)(p_stValues->a_ulValues[0]);
}
break;
case lTagWaterStreakGenerator : /* */
{
/* -> OS : THIS CODE SHOULD BE CHANGED 01-Sep-98*/
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(LDT_szGetParam(1), SCR_CDF_uw_Anl_Normal);
/* <- OS : THIS CODE SHOULD BE CHANGED 01-Sep-98*/
h_MSPrtSrc->hWaterStreakGenerator = (GAM_tdxHandleToWaterStreakEffect)(p_stValues->a_ulValues[0]);
}
break;
case lTagFootPathEffect : /* */
{
/* -> OS : THIS CODE SHOULD BE CHANGED 01-Sep-98*/
p_stValues = SCR_fnp_st_RdL0_AnalyseSection( LDT_szGetParam(1), SCR_CDF_uw_Anl_Normal );
/* <- OS : THIS CODE SHOULD BE CHANGED 01-Sep-98*/
h_MSPrtSrc->hFootPath = (GAM_tdxHandleToFootPathEffect) ( p_stValues->a_ulValues[0] );
}
break;
}
}
}
}
return 0;
}
#endif /* D_THROW_PRT */

View File

@@ -0,0 +1,100 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_MSSound_StructureDefine
#define D_MSSound_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "ldt.h"
#define lTagSaturationDistance 'utaS'
#define lTagBackGroundDistance 'kcaB'
/*****************************************************************
Function name : fn_iCreateMSSound
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateMSSound( LDT_tdst_Link *pLink )
{
MS_tdxHandleToMSSound h_MSSound;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMSSound , p_stEngineObject);
h_MSSound = fn_h_MSSoundRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_MSSound = h_MSSound;
pLink->pObject = (void*)h_MSSound;
return 0;
}
/*****************************************************************
Function name : fn_iLoadMSSound
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadMSSound( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToMSSound h_MSSound = (MS_tdxHandleToMSSound)pLink->pObject;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagSaturationDistance : /* */
{
h_MSSound->stRollOff.rDistSatur = atol(LDT_szGetParam(1));
}
break;
case lTagBackGroundDistance : /* */
{
h_MSSound->stRollOff.rDistBackGround = atol(LDT_szGetParam(1));
}
break;
}
}
}
}
return 0;
}

View File

@@ -0,0 +1,68 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_MSWay_StructureDefine
#define D_MSWay_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
/*ANNECY JMD{*/
#define _WP_D_WPGRAPH_FRIEND_
#include "AI/AIBASE/WPgraphe.h"
#undef _WP_D_WPGRAPH_FRIEND_
/*ENDANNECY JMD }*/
#include "AI.h"
#include "safe.h" /*BART*/
/*XB980504*/
#ifdef GAM_USE_SNA
#include "sna.h"
#endif /* GAM_USE_SNA */
/*End XB*/
#include "ldt.h"
/*****************************************************************
Function name : fn_iCreateMSWay
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateMSWay( LDT_tdst_Link *pLink )
{
MS_tdxHandleToMSWay h_MSWay;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMSWay , p_stEngineObject);
h_MSWay = fn_h_MSWayRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_MSWay=h_MSWay;
pLink->pObject = (void*)h_MSWay;
return 0;
}
/* load for 'MSWay' section is default*/

View File

@@ -0,0 +1,131 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_Micro_StructureDefine
#define D_Micro_VariableDefine
#include "ToolsCPA.h"
#include "SND.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "ldt.h"
#define lTagMatrixRotation 'atoR'
#define lTagMatrixTranslation 'narT'
#define lTagMicroIsActive 'tcAs'
#define lTagMicroIsInactive 'anIs'
/*****************************************************************
Function name : fn_iCreateMicro
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateMicro( LDT_tdst_Link *pLink )
{
MS_tdxHandleToMicro h_MS_Micro;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMicro , p_stEngineObject);
h_MS_Micro = fn_h_MicroRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_Micro = h_MS_Micro;
h_MS_Micro->bIsActive = 0;
POS_fn_vSetIdentityMatrix( h_MS_Micro->hMicroMatrix );
pLink->pObject = (void*)h_MS_Micro;
return 0;
}
/*****************************************************************
Function name : fn_iLoadMicro
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadMicro( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToMicro h_MS_Micro = (MS_tdxHandleToMicro)pLink->pObject;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
MTH3D_tdstVector stX,stY,stZ;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagMatrixRotation : /* */
{
MTH3D_M_vSetVectorElements(&stX,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
MTH3D_M_vSetVectorElements(&stY,
(float)atof(LDT_szGetParam(4)), (float)atof(LDT_szGetParam(5)), (float)atof(LDT_szGetParam(6)) );
MTH3D_M_vSetVectorElements(&stZ,
(float)atof(LDT_szGetParam(7)), (float)atof(LDT_szGetParam(8)), (float)atof(LDT_szGetParam(9)) );
POS_fn_vSetRotationMatrix(h_MS_Micro->hMicroMatrix,&stX,&stY,&stZ);
}
break;
case lTagMatrixTranslation : /* */
{
MTH3D_M_vSetVectorElements(&stX,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
POS_fn_vSetTranslationVector(h_MS_Micro->hMicroMatrix,&stX);
}
break;
case lTagMicroIsActive : /* */
{
h_MS_Micro->bIsActive = 1;
}
break;
case lTagMicroIsInactive : /* */
{
h_MS_Micro->bIsActive = 0;
}
break;
}
}
}
}
return 0;
}

View File

@@ -0,0 +1,73 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_SectInfo_StructureDefine
#define D_SectInfo_VariableDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Structur/anim_s.h"
#include "Basic.h"
#include "GameEng.h"
#include "micros.h"
#include "MainChar.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "AlwAct.h"
#include "Playanim/playanim.h"
#ifdef GAM_USE_SNA
#include "sna.h"
#endif /* GAM_USE_SNA */
#include "always.h"
extern BOOL bFirst;
#if defined(GAM_USE_SNA)
extern tdstEngineObject *g_a20_stSNAObjectsInFix[20];
extern unsigned long g_ulSNANbObjectsInFix;
#endif /* GAM_USE_SNA */
#include "ldt.h"
/*****************************************************************
Function name : fn_iCreateSectInfo
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateSectInfo( LDT_tdst_Link *pLink )
{
MS_tdxHandleToSectInfo h_SectInfo;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeSectInfo , p_stEngineObject);
h_SectInfo = fn_h_SectInfoRealAlloc();
MMG_fn_vEndMemoryInfo ();
h_SectInfo->hCurrentSector=NULL;
p_stEngineObject->h_SectInfo=h_SectInfo;
pLink->pObject = (void*)h_SectInfo;
return 0;
}
/* load for 'SectInfo' section is default*/

View File

@@ -0,0 +1,334 @@
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_StdGame_StructureDefine
#define D_StdGame_VariableDefine
#define D_ObjsTbls_Define
#include "ToolsCPA.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/EngMode.h"
#include "structur/StdObjSt.h"
#include "safe.h" /*BART*/
#include "Basic.h"
#include "Family.h"
#include "ObjInit.h"
#include "ObjType.h"
#include "ZeMem.h"
#include "MainChar.h"
#include "ToolCam.h"
#include "Structur/ObjsTbls.h"
#include "ChanList.h"
#include "CHLLoad.h"
#include "ldt.h"
/*******************************************************/
#define C_TRANSPARENCY_ZONE_MIN 70
#define C_TRANSPARENCY_ZONE_MAX 80
/*******************************************************/
HREF g_hRefStdGame;
/*****************************************************************
Name:
Description: Create callback for LDT
Author: Mircea Petrescu
Date: 8/21/98
Modified: Scripa Ovidiu 09/01/98
*****************************************************************/
int fn_iCreateStdGame( LDT_tdst_Link *pLink )
{
MS_tdxHandleToStandardGame h_StdGame;
struct tdstEngineObject_ *p_stEngineObject=(struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeStdGame , p_stEngineObject);
h_StdGame = fn_h_StdGameRealAlloc();
MMG_fn_vEndMemoryInfo ();
pLink->pObject=(void *)h_StdGame;
p_stEngineObject->h_StandardGame=h_StdGame;
/* JO 04/11/97*/
fn_ucStandardGameSetPlatFormType(h_StdGame,(unsigned char)0);
/*fn_ucStandardGameSetSpecialPositionFlag(h_StdGame,(unsigned char)0);*/
fn_vStandardGameSetCustomBits(h_StdGame,(unsigned long)GAM_C_CustBitUsesTransparencyZone);
fn_vStandardGameSetTransparencyZoneMin(h_StdGame,C_TRANSPARENCY_ZONE_MIN);
fn_vStandardGameSetTransparencyZoneMax(h_StdGame,C_TRANSPARENCY_ZONE_MAX);
return 0;
}
extern void fn_vLoadFamilyLDT(struct tdstFamilyList_ *p_stFamily);
/*****************************************************************
Name:
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 8/21/98
Modified: Scripa Ovidiu 09/01/98
*****************************************************************/
int fn_iLoadStdGame( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToStandardGame h_StdGame=(MS_tdxHandleToStandardGame)pLink->pObject;
struct tdstEngineObject_ *p_stEngineObject=(struct tdstEngineObject_ *)pLink->pParent->pObject;
/* .tbl files were loaded in the callback for 3dData section */
tdxHandleToObjectsTablesList h_ObjectsTablesListElement = (tdxHandleToObjectsTablesList)LDT_GetFileLong(20);
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case 'epyT' : /* Type */
{
tdxHandleToState h_InitialState=NULL;
/*SCR_tdst_Link_Value *p_xIndex;*/
struct tdstFamilyList_ *p_stFamily = NULL;
tdObjectType otFamilyType;
fn_vStandardGameSetPersonalType(h_StdGame,fn_otFindOrAddPersonalTypeOfPersonalTypeName(LDT_szGetParam( 1 )));
fn_vStandardGameSetFamilyType(h_StdGame,fn_otFindOrAddFamilyTypeOfFamilyTypeName(LDT_szGetParam( 3 )) );
fn_vStandardGameSetModelType(h_StdGame,fn_otFindOrAddModelTypeOfModelTypeName(LDT_szGetParam( 2 )) );
/* LoadFamilyLDT loads .chl, .bdv, and .sta files asociated with this family*/
otFamilyType = fn_otStandardGameGetFamilyType(h_StdGame);
p_stFamily = fn_hFindFamily(otFamilyType);
if (p_stFamily==NULL)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeFamily , 0 );
p_stFamily = (struct tdstFamilyList_*)M_p_GameMallocInHLM(sizeof(struct tdstFamilyList_));
p_stFamily->otObjectFamilyType = otFamilyType;
fn_vInitObjectsTablesList(p_stFamily); /* tmp SD Gizmo 14/04/97*/
fn_vLoadFamilyLDT(p_stFamily);
LDT_AddToRefsTable( g_hRefStdGame, (void *)pLink, 0, 1, p_stFamily );
LST2_M_DynamicAddTail(&g_stEngineStructure.hFamilyList,p_stFamily);
p_stFamily->ucPriority = GAM_g_ucHLMMemoryBlock;
}
fn_v3dDataSetFamily(p_stEngineObject->h_3dData, p_stFamily);
if(h_ObjectsTablesListElement!=NULL)
{
fn_v3dDataSetCurrentObjectsTable(p_stEngineObject->h_3dData,h_ObjectsTablesListElement);
fn_v3dDataSetInitialObjectsTable(p_stEngineObject->h_3dData,h_ObjectsTablesListElement);
fn_vAddAnObjectsTablesInList(fn_h3dDataGetFamily(p_stEngineObject->h_3dData),h_ObjectsTablesListElement);
}
else
{
fn_v3dDataSetCurrentObjectsTable(p_stEngineObject->h_3dData,fn_vGetDefaultObjectsTableOfFamily(fn_h3dDataGetFamily(p_stEngineObject->h_3dData)));
fn_v3dDataSetInitialObjectsTable(p_stEngineObject->h_3dData,fn_vGetDefaultObjectsTableOfFamily(fn_h3dDataGetFamily(p_stEngineObject->h_3dData)));
}
fn_vCheckObjectsTables(p_stEngineObject); /*Gizmo do nothing in release*/
LDT_AddToRefsTable( g_hRefStdGame, (void *)pLink, 1, 1, p_stEngineObject );
}
break;
case 'PtiH' :
{
int iLen=strlen( szEntry );
switch( iLen )
{
case 13 : /* HitPointsInit */
{
fn_vStandardGameSetHitPoints(h_StdGame,(unsigned char)atoi( LDT_szGetParam( 1 ) ));
}
break;
case 9 : /* HitPoints */
{
}
break;
case 12 : /* HitPointsMax */
{
}
break;
case 15 : /* HitPointsMaxMax */
{
fn_vStandardGameSetHitPointsMaxMax(h_StdGame,(unsigned char)atoi( LDT_szGetParam( 1 ) ));
}
break;
case 17 : /* HitPointsMaxInit */
{
fn_vStandardGameSetHitPointsMax(h_StdGame,(unsigned char)atoi( LDT_szGetParam( 1 ) ));
}
break;
}
}
break;
case 'tinI' : /* InitFlags */
{
char *sz=LDT_szGetParam(1);
if (!stricmp(sz,C_ValueStdInitFlagNeverBack))
fn_vStandardGameSetInitFlagWhenOutOfZone(h_StdGame,OI_NeverBackWhenTaken);
else if (!stricmp(sz,C_ValueStdInitFlagGoOutOfZone))
fn_vStandardGameSetInitFlagWhenOutOfZone(h_StdGame,OI_WhenPlayerGoOutOfActionZone);
sz=LDT_szGetParam(2);
if (!stricmp(sz,C_ValueStdInitFlagNeverBack))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_NeverBackWhenTaken);
else if (!stricmp(sz,C_ValueStdInitFlagAlways))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_Always);
else if (!stricmp(sz,C_ValueStdInitFlagGoOutOfZone))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_WhenPlayerGoOutOfActionZone);
else if (!stricmp(sz,C_ValueStdInitFlagPlayerDead))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_WhenPlayerIsDead);
else if (!stricmp(sz,C_ValueStdInitFlagMapLoaded))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_WhenMapJustLoaded);
else if (!stricmp(sz,C_ValueStdInitFlagSavedGameLoaded))
fn_vStandardGameSetInitFlagWhenDeadOrTaken(h_StdGame,OI_WhenSavedGameJustLoaded);
}
break;
case 'talP' : /* PlatFormType */
{
fn_ucStandardGameSetPlatFormType(h_StdGame,(unsigned char)atoi( LDT_szGetParam( 1 ) ));
}
break;
case 'tsuC' : /* CustomBitsInit */
{
fn_vStandardGameSetCustomBits(h_StdGame,(unsigned long)atoi( LDT_szGetParam( 1 ) ));
}
break;
case 'apaC' : /* Capabilities */
{
unsigned long ulReturn;
char* dummy;
ulReturn = strtoul(LDT_szGetParam(1), &dummy, 2);
fn_vStandardGameSetCapabilities(h_StdGame, ulReturn);
}
break;
case 'carT' : /* TractionFactor */
{
fn_vStandardGameSetTractionFactor(h_StdGame, (unsigned char)atoi( LDT_szGetParam( 1 ) ));
}
break;
case 'narT' : /* TransparencyZone */
{
fn_vStandardGameSetTransparencyZoneMin(h_StdGame,(unsigned char)atoi( LDT_szGetParam( 1 ) ));
fn_vStandardGameSetTransparencyZoneMax(h_StdGame,(unsigned char)atoi( LDT_szGetParam( 2 ) ));
}
break;
}
}
}
}
return 0;
}
void fn_vStdGamePostProcessLDT( HREF hRef )
{
LDT_tdst_Link *pLink;
LDT_tdst_Link *pGetFrom;
int iType;
short xCount;
long *pVal;
while( LDT_GetRefFromTable( hRef, &pLink, &pGetFrom, &iType, &xCount, &pVal )==0 )
{
switch (iType)
{
case 0:
{
struct tdstFamilyList_ *p_stFamily ;
tdxHandleToObjectsTablesList hObjectsTable;
int i, j;
p_stFamily = (struct tdstFamilyList_ *)(*pVal);
LST2_M_StaticForEachElementOf(&p_stFamily->hForObjectsTablesList,hObjectsTable,i)
{
for (j=0;j<hObjectsTable->wNumberOfElement;j++)
{ char szFamily[255],*szChannel;
SCR_tdst_Link_Value * _p_stLinkValue;
if (
(
(hObjectsTable->d_stObjectsTable[j].wTypeOfTarget==C_wTdO_PhysicalObject)
||
(hObjectsTable->d_stObjectsTable[j].wTypeOfTarget==C_wTdO_Mirror)
)
&& (hObjectsTable->d_stObjectsTable[j].uwChannelNumber!=255)
)
{ szChannel=(char *)(hObjectsTable->d_stObjectsTable[j].uwChannelNumber);
strcpy(szFamily,fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
strcat(szFamily,"-");
strcat(szFamily,szChannel);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&CHL_g_stLinkTable,szFamily);
if(_p_stLinkValue)
{
hObjectsTable->d_stObjectsTable[j].uwChannelNumber = (unsigned long)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
else
{
hObjectsTable->d_stObjectsTable[j].uwChannelNumber = (unsigned short)C_ucUnknownChannel;
}
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , hObjectsTable );
TMP_M_Free(szChannel);
}
}
}
LDT_FreeRefValues(pVal);
}
break;
case 1:
{
struct tdstEngineObject_ *p_stEngineObject=(struct tdstEngineObject_ *)(*pVal);
tdxHandleToState h_InitialState = NULL;
SCR_tdst_Link_Value *p_xIndex;
h_InitialState = fn_h3dDataGetInitialState(p_stEngineObject->h_3dData);
if(h_InitialState)
{
p_xIndex = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,(char *)h_InitialState);
if (p_xIndex!=NULL&&p_xIndex->eState==SCR_ELS_Link_Initialized)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubType3dData , p_stEngineObject);
TMP_M_Free(h_InitialState);
fn_v3dDataSetInitialState(p_stEngineObject->h_3dData,(tdxHandleToState)(p_xIndex->ulValue));
}
else
{
fn_v3dDataSetInitialState(p_stEngineObject->h_3dData,NULL);
M_GameWarningError(E_uwGamePLA_BadInitialState);
}
}
LDT_FreeRefValues(pVal);
}
break;
}
}
}